Update of /cvsroot/freenet/freenet/src/freenet/node
In directory sc8-pr-cvs1:/tmp/cvs-serv3005/src/freenet/node

Modified Files:
        NodeReference.java 
Log Message:
use signed refs if possible. Reinstates fast RT fill.


Index: NodeReference.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/NodeReference.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -w -r1.28 -r1.29
--- NodeReference.java  22 Oct 2003 23:28:55 -0000      1.28
+++ NodeReference.java  23 Oct 2003 00:09:41 -0000      1.29
@@ -100,17 +100,23 @@
        return n;
     }
 
+    public NodeReference(FieldSet ref, boolean verify, Identity ident) 
+        throws BadReferenceException {
+       this(ref, verify, false, ident);
+    }
+    
     /**
      * Creates a new nodereference from its FieldSet, adding an externally
      * obtained identity.
      * @param ref A FieldSet containing the full Node Reference information.
      * @param verify  true mandates the existance of valid signature.
+     * @param slack   true means if there is a signature it will be checked and must 
be valid
      * @param ident  The identity to assign the fieldset to. The method
      *               will look for a field called "identityFP" in the 
      *               and match that against the fingerprint of this identity.
      * @exception BadReferenceException - if the data is malformed.
      */
-    public NodeReference(FieldSet ref, boolean verify, Identity ident) 
+    public NodeReference(FieldSet ref, boolean verify, boolean slack, Identity ident) 
         throws BadReferenceException {
 
         if (!ref.isSet("identity") && ident != null) {
@@ -210,13 +216,16 @@
                        }
         }
 
-        if (verify) {
+        if (verify || slack) {
             // last but not least, read and verify signature
             
             String signS = ref.get("signature");
-            if (signS == null)
+            if (signS == null) {
+               if(verify) {
                 throw 
                     new BadReferenceException("NodeReference must be signed");
+               }
+           } else {
             try {
                 signature = new DSASignature(signS);
                 Digest d = SHA1.getInstance();
@@ -242,6 +251,7 @@
                 throw new BadReferenceException("Signature field not correct");
             }
         }
+       }
 
         if (version != null)
             Version.seenVersion(version);

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to