work towards making manifests only accept UPPERCASE hex strings

(mixing them between versions of manifests causes confusion).
This commit is contained in:
gardners 2012-05-27 17:56:11 +02:00
parent 07fc646fed
commit 884e427fbb
2 changed files with 13 additions and 4 deletions

@ -152,7 +152,13 @@ int rhizome_read_manifest_file(rhizome_manifest *m, const char *filename, int bu
{
/* Parse hex string of ID into public key */
rhizome_hex_to_bytes(value,m->cryptoSignPublic,
crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES*2);
crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES*2);
}
if ((!strcasecmp(var,"ID"))||(!strcasecmp(var,"FILEHASH"))) {
/* Also force to upper case to avoid case sensitive comparison problems later. */
int i;
for(i=0;i<strlen(m->vars[m->var_count]);i++)
m->values[m->var_count][i]=toupper(m->values[m->var_count][i]);
}
m->var_count++;
}

@ -375,9 +375,12 @@ int rhizome_suggest_queue_manifest_import(rhizome_manifest *m,
return -1;
} else {
if (1||debug&DEBUG_RHIZOMESYNC) {
DEBUGF("manifest id=%s, version=%lld is new to us.",
rhizome_manifest_get(m,"id",NULL,0),
rhizome_manifest_get_ll(m,"version"));
long long stored_version
=sqlite_exec_int64("select version from manifests where id='%s'",id);
DEBUGF("manifest id=%s, version=%lld is new to us (we only have version %lld).",
rhizome_manifest_get(m,"id",NULL,0),
rhizome_manifest_get_ll(m,"version"),
stored_version);
}
}