[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Make server fingerprints a little more first-class so t...



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv11926/mixminion

Modified Files:
	ServerInfo.py 
Log Message:
Make server fingerprints a little more first-class so the directory admins can use them.

Index: ServerInfo.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ServerInfo.py,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- ServerInfo.py	13 Dec 2004 07:06:10 -0000	1.90
+++ ServerInfo.py	3 May 2005 03:29:35 -0000	1.91
@@ -174,7 +174,8 @@
                      "Configuration": ("ALLOW", None, None),
                      },
         }
-    _features = { "capabilities" : 1, "caps" : 1 }
+    _features = { "capabilities" : 1, "caps" : 1,
+                  "fignerprint" : 1 }
     expected_versions = {
          "Server" : ( "Descriptor-Version", "0.2"),
          "Incoming/MMTP" : ("Version", "0.1"),
@@ -346,6 +347,16 @@
         """DOCDOC"""
         return sha1(pk_encode_public_key(self.getIdentity()))
 
+    def getIdentityFingerprint(self):
+        """DOCDOC"""
+        d = getIdentityDigest(self)
+        assert (len(d) % 2) == 0
+        b = binascii.b2a_hex(d)
+        r = []
+        for i in xrange(0, len(b), 4):
+            r.append(b[i:i+4])
+        return " ".join(r)
+
     def getIncomingMMTPProtocols(self):
         """Return a list of the MMTP versions supported by this this server
            for incoming packets."""
@@ -500,6 +511,8 @@
         if sec == '-':
             if name in ("caps", "capabilities"):
                 return " ".join(self.getCaps())
+            elif name == 'fingerprint':
+                return self.getIdentityFingerprint()
             assert 0
         else:
             return mixminion.Config._ConfigFile.getFeature(self,sec,name)