fixed various bugs with rhizome manifest extraction.

This commit is contained in:
gardners 2012-05-16 15:55:03 +09:30
parent 1a3d13d59e
commit 74e0d69cb9
3 changed files with 11 additions and 4 deletions

View File

@ -1154,10 +1154,12 @@ int app_rhizome_extract_manifest(int argc, const char *const *argv, struct comma
case 0: ret = 1; break;
case 1: ret = 0;
if (manifestpath[0]) {
#warning why do we ask for the manifest to be signed here, when we are just extracting it? Anyway, it wont work while the author field is null.
if (rhizome_manifest_finalise(m, 1,NULL) == -1)
ret = WHY("Could not overwrite manifest file.");
else if (rhizome_write_manifest_file(m, manifestpath) == -1)
/* If the manifest has been read in from database, the blob is there,
and we can lie and say we are finalised and just want to write it
out. XXX really should have a dirty/clean flag, so that write
works is clean but not finalised. */
m->finalised=1;
if (rhizome_write_manifest_file(m, manifestpath) == -1)
ret = WHY("Could not overwrite manifest file.");
}
break;

View File

@ -107,6 +107,10 @@ int extractSid(unsigned char *packet,int *ofs,char *sid)
int validateSid(const char *sid)
{
if (!sid) {
WHY("SID == NULL");
return 0;
}
if (!strcasecmp(sid,"broadcast")) return 1;
size_t n = strlen(sid);
if (n != SID_STRLEN)

View File

@ -140,6 +140,7 @@ int rhizome_bk_xor(const char *author,
*/
int rhizome_extract_privatekey(rhizome_manifest *m,const char *authorHex)
{
if (!authorHex) return WHY("No author SID supplied");
char *bk = rhizome_manifest_get(m, "BK", NULL, 0);
if (!bk) return WHY("Cannot obtain private key as manifest lacks BK field");