浏览代码

make router_nickname_is_approved() do the right thing

svn:r2090
Roger Dingledine 21 年之前
父节点
当前提交
f82a36508d
共有 1 个文件被更改,包括 7 次插入5 次删除
  1. 7 5
      src/or/dirserv.c

+ 7 - 5
src/or/dirserv.c

@@ -178,20 +178,22 @@ dirserv_router_fingerprint_is_known(const routerinfo_t *router)
   }
 }
 
-/** Return true iff any router named <b>nickname</b> is in the fingerprint
- * list. */
+/** Return true iff any router named <b>nickname</b> with <b>digest</b>
+ * is in the verified fingerprint list. */
 static int
 router_nickname_is_approved(const char *nickname, const char *digest)
 {
   int i,j;
   fingerprint_entry_t *ent;
   char fp[FINGERPRINT_LEN+1];
+  char hexdigest[HEX_DIGEST_LEN+1];
   if (!fingerprint_list)
     return 0;
 
-  for (i=j=0;i<DIGEST_LEN;++i,++j) {
-    fp[i]=digest[j];
-    if ((j%4)==3 && j != 19)
+  base16_encode(hexdigest, sizeof(hexdigest), digest, DIGEST_LEN);
+  for (i=j=0;j<HEX_DIGEST_LEN;++i,++j) {
+    fp[i]=hexdigest[j];
+    if ((j%4)==3 && j != 39)
       fp[++i]=' ';
   }
   fp[i]='\0';