[or-cvs] Do not warn about unknown servers in our family when they a...

Nick Mathewson nickm at seul.org
Wed Mar 15 05:04:13 UTC 2006


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv5678/src/or

Modified Files:
	router.c 
Log Message:
Do not warn about unknown servers in our family when they are given as hex digests.

Index: router.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/router.c,v
retrieving revision 1.252
retrieving revision 1.253
diff -u -p -d -r1.252 -r1.253
--- router.c	14 Mar 2006 23:40:37 -0000	1.252
+++ router.c	15 Mar 2006 05:04:11 -0000	1.253
@@ -854,7 +854,8 @@ router_rebuild_descriptor(int force)
        else
          member = router_get_by_nickname(name, 1);
        if (!member) {
-         if (!smartlist_string_isin(warned_nonexistent_family, name)) {
+         if (!smartlist_string_isin(warned_nonexistent_family, name) &&
+             !is_legal_hexdigest(name)) {
            log_warn(LD_CONFIG,
                     "I have no descriptor for the router named \"%s\" "
                     "in my declared family; I'll use the nickname as is, but "
@@ -1213,13 +1214,24 @@ is_legal_nickname(const char *s)
 int
 is_legal_nickname_or_hexdigest(const char *s)
 {
-  size_t len;
-  tor_assert(s);
   if (*s!='$')
     return is_legal_nickname(s);
+  else
+    return is_legal_hexdigest(s);
+}
 
+
+/** Return true iff <b>s</b> is a legally valid hex-encoded identity-key
+ * digest. */
+int
+is_legal_hexdigest(const char *s)
+{
+  size_t len;
+  tor_assert(s);
   len = strlen(s);
-  return len == HEX_DIGEST_LEN+1 && strspn(s+1,HEX_CHARACTERS)==len-1;
+  return (len == HEX_DIGEST_LEN+1 &&
+          s[0] == '$' &&
+          strspn(s+1,HEX_CHARACTERS)==len-1);
 }
 
 /** Forget that we have issued any router-related warnings, so that we'll



More information about the tor-commits mailing list