Browse Source

Do not warn about unknown servers in our family when they are given as hex digests.

svn:r6163
Nick Mathewson 19 years ago
parent
commit
3c0a5f6365
1 changed files with 16 additions and 4 deletions
  1. 16 4
      src/or/router.c

+ 16 - 4
src/or/router.c

@@ -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