diff --git a/rhizome_bundle.c b/rhizome_bundle.c index 17494058..e9826463 100644 --- a/rhizome_bundle.c +++ b/rhizome_bundle.c @@ -96,8 +96,9 @@ rhizome_manifest *rhizome_read_manifest_file(char *filename,int bufferP,int flag /* Read signature blocks from file. */ while(ofsmanifest_bytes) { - fprintf(stderr,"ofs=0x%x, m->manifest_bytes=0x%x\n", - ofs,m->manifest_bytes); + if (debug&DEBUG_RHIZOME) + fprintf(stderr,"ofs=0x%x, m->manifest_bytes=0x%x\n", + ofs,m->manifest_bytes); rhizome_manifest_extract_signature(m,&ofs); } @@ -129,7 +130,8 @@ rhizome_manifest *rhizome_read_manifest_file(char *filename,int bufferP,int flag } } - WHY("Group membership determination not implemented (see which signatories are groups? what about manifests signed by groups we don't yet know about?)"); + if (debug&DEBUG_RHIZOME) + WHY("Group membership determination not implemented (see which signatories are groups? what about manifests signed by groups we don't yet know about?)"); } m->manifest_bytes=end_of_text; diff --git a/rhizome_crypto.c b/rhizome_crypto.c index c1b923d1..8df8f1b6 100644 --- a/rhizome_crypto.c +++ b/rhizome_crypto.c @@ -154,7 +154,7 @@ int rhizome_manifest_extract_signature(rhizome_manifest *m,int *ofs) bcopy(&publicKey[0],m->signatories[m->sig_count], crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES); m->sig_count++; - WHY("Signature passed."); + if (debug&DEBUG_RHIZOME) WHY("Signature passed."); } break; default: diff --git a/rhizome_database.c b/rhizome_database.c index 7a6cf098..7fddcdda 100644 --- a/rhizome_database.c +++ b/rhizome_database.c @@ -304,8 +304,13 @@ int rhizome_store_bundle(rhizome_manifest *m,char *associated_filename) { char sqlcmd[1024]; const char *cmdtail; + int i; - char *manifestid=rhizome_bytes_to_hex(m->cryptoSignPublic,crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES); + char manifestid[65]; + strncpy(manifestid,rhizome_manifest_get(m,"id",NULL,0),64); + manifestid[64]=0; + for(i=0;i<64;i++) + manifestid[i]=toupper(manifestid[i]); if (!m->finalised) return WHY("Manifest was not finalised"); diff --git a/rhizome_fetch.c b/rhizome_fetch.c index 4ce8c680..f6bfb750 100644 --- a/rhizome_fetch.c +++ b/rhizome_fetch.c @@ -197,11 +197,8 @@ int rhizome_queue_manifest_import(rhizome_manifest *m, } } } - - /* got file, so now import */ - WHY("Actual importing not implemented"); - - return WHY("Not implemented."); + + return 0; } int rhizome_fetching_get_fds(struct pollfd *fds,int *fdcount,int fdmax) @@ -255,8 +252,10 @@ int rhizome_fetch_poll() if (q->request_ofs>=q->request_len) { /* Sent all of request. Switch to listening for HTTP response headers. */ - if (debug&DEBUG_RHIZOME) fprintf(stderr,"Sent http request to fetch file. (%d of %d bytes)\n",q->request_ofs,q->request_len); - fprintf(stderr,"sent [%s]\n",q->request); + if (debug&DEBUG_RHIZOME) { + fprintf(stderr,"Sent http request to fetch file. (%d of %d bytes)\n",q->request_ofs,q->request_len); + fprintf(stderr,"sent [%s]\n",q->request); + } q->request_len=0; q->request_ofs=0; q->state=RHIZOME_FETCH_RXHTTPHEADERS; } @@ -305,12 +304,14 @@ int rhizome_fetch_poll() rhizome_datastore_path, rhizome_manifest_get(q->manifest,"id",NULL,0)); /* Do really write the manifest unchanged */ - fprintf(stderr,"manifest has %d signatories\n",q->manifest->sig_count); - fprintf(stderr,"manifest id = %s, len=%d\n", - rhizome_manifest_get(q->manifest,"id",NULL,0), - q->manifest->manifest_bytes); - dump("manifest",&q->manifest->manifestdata[0], - q->manifest->manifest_all_bytes); + if (debug&DEBUG_RHIZOME) { + fprintf(stderr,"manifest has %d signatories\n",q->manifest->sig_count); + fprintf(stderr,"manifest id = %s, len=%d\n", + rhizome_manifest_get(q->manifest,"id",NULL,0), + q->manifest->manifest_bytes); + dump("manifest",&q->manifest->manifestdata[0], + q->manifest->manifest_all_bytes); + } q->manifest->finalised=1; q->manifest->manifest_bytes=q->manifest->manifest_all_bytes; if (!rhizome_write_manifest_file(q->manifest,filename)) { @@ -345,7 +346,8 @@ int rhizome_fetch_poll() q->request_len+=bytes; if (q->request_len<1024) q->request[q->request_len]=0; - dump("http reply headers",(unsigned char *)q->request,q->request_len); + if (debug&DEBUG_RHIZOME) + dump("http reply headers",(unsigned char *)q->request,q->request_len); for(;i<(q->request_len+bytes);i++) { switch(q->request[i]) { diff --git a/rhizome_packetformats.c b/rhizome_packetformats.c index 80e6d2ad..c50e68be 100644 --- a/rhizome_packetformats.c +++ b/rhizome_packetformats.c @@ -308,9 +308,8 @@ int overlay_rhizome_saw_advertisements(int i,overlay_frame *f, long long now) } else { if (debug&DEBUG_RHIZOME) fprintf(stderr,"Verifying manifest %s revealed no errors -- will try to store.\n",manifest_id); - /* Add manifest to import queue. Challenge here is that we need to know - the IPv4 address of the peer */ - WHY("Doesn't provide IPv4 address of sender of frame"); + /* Add manifest to import queue. We need to know originating IPv4 address + so that we can transfer by HTTP. */ if (rhizome_queue_manifest_import(m,f->recvaddr)) rhizome_manifest_free(m); }