make router_nickname_is_approved() do the right thing

svn:r2090
This commit is contained in:
Roger Dingledine 2004-07-21 22:54:27 +00:00
parent 3783d2e682
commit f82a36508d

View File

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