From 1c72778c5056b411768a3d4d832388a36d907c47 Mon Sep 17 00:00:00 2001 From: gardners Date: Tue, 2 Oct 2012 21:00:56 +0930 Subject: [PATCH] fixed problem with rhizome direct push / manifest import where signatures were not being recorded. Also fixed separate issue where rhizomeprotocols tests expected selfsigned to be 1 on receiver end, when it will never be, because the BK doesn't match. rhizome direct push test in rhizomeprotocols now passes. #9 --- rhizome.c | 2 +- rhizome_database.c | 5 +++++ testdefs_rhizome.sh | 5 +++-- tests/rhizomeprotocol | 10 +++++++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/rhizome.c b/rhizome.c index 69768b83..f4716e53 100644 --- a/rhizome.c +++ b/rhizome.c @@ -364,7 +364,7 @@ int rhizome_add_manifest(rhizome_manifest *m_in,int ttl) service ? service : "NULL", alloca_tohex_sid(m_in->cryptoSignPublic), m_in->version - ); + ); monitor_announce_bundle(m_in); return 0; } diff --git a/rhizome_database.c b/rhizome_database.c index f898bd19..5368c760 100644 --- a/rhizome_database.c +++ b/rhizome_database.c @@ -1449,6 +1449,11 @@ int rhizome_import_from_files(const char *manifestpath,const char *filepath) } else if (rhizome_manifest_verify(m) == -1) { status = WHY("Could not verify manifest file."); } else { + /* Make sure we store signatures */ + m->manifest_bytes=m->manifest_all_bytes; + DEBUGF("selfsignedP=%d", + rhizome_is_self_signed(m)); + /* Add the manifest and its associated file to the Rhizome database. */ m->dataFileName = strdup(filepath); if (rhizome_manifest_check_file(m)) diff --git a/testdefs_rhizome.sh b/testdefs_rhizome.sh index bcfa36aa..d1252a30 100644 --- a/testdefs_rhizome.sh +++ b/testdefs_rhizome.sh @@ -46,17 +46,18 @@ assert_manifest_complete() { } assert_rhizome_list() { + # PGS 20121002 - Removed sensitivity to self-signed flag, because it will be + # different between originator and a receiver of a bundle. assertStdoutLineCount --stderr '==' $(($# + 2)) assertStdoutIs --stderr --line=1 -e '11\n' assertStdoutIs --stderr --line=2 -e 'service:id:version:date:.inserttime:.selfsigned:filesize:filehash:sender:recipient:name\n' local filename for filename; do - re__selfsigned=1 case "$filename" in *!) filename="${filename%!}"; re__selfsigned=0;; esac unpack_manifest_for_grep "$filename" - assertStdoutGrep --stderr --matches=1 "^$re_service:$re_manifestid:.*:$re__selfsigned:$re_filesize:$re_filehash:$re_sender:$re_recipient:$re_name\$" + assertStdoutGrep --stderr --matches=1 "^$re_service:$re_manifestid:.*:.*:$re_filesize:$re_filehash:$re_sender:$re_recipient:$re_name\$" done } diff --git a/tests/rhizomeprotocol b/tests/rhizomeprotocol index 1d98934d..d2cc5886 100755 --- a/tests/rhizomeprotocol +++ b/tests/rhizomeprotocol @@ -286,10 +286,14 @@ setup_Push() { } test_Push() { executeOk_servald rhizome direct push - assert bundle_received_by $BID1 $VERSION1 +B - assert ! bundle_received_by $BID2 $VERSION2 +A + assert bundle_received_by $BID2 $VERSION2 +A + assert ! bundle_received_by $BID1 $VERSION1 +B + set_instance +A + executeOk_servald rhizome list '' + assert_rhizome_list file1 file2 set_instance +B - assert_received file1 + executeOk_servald rhizome list '' + assert_rhizome_list file2 } doc_Pull="One way pull bundle from unconnected node"