mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
Improve keyring PIN handling
Replace explicit [<pin,pin...>] command-line arguments with --entry-pin=<pin> options. Update test scripts accordlingly. Add --keyring-pin=<pin> option (with one test case).
This commit is contained in:
parent
7f52ac0ae3
commit
f66a894a63
@ -1201,11 +1201,10 @@ int app_rhizome_add_file(const struct parsed_command *parsed, void *context)
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_parsed(parsed);
|
||||
const char *filepath, *manifestpath, *authorSidHex, *pin, *bskhex;
|
||||
const char *filepath, *manifestpath, *authorSidHex, *bskhex;
|
||||
cli_arg(parsed, "filepath", &filepath, NULL, "");
|
||||
if (cli_arg(parsed, "author_sid", &authorSidHex, cli_optional_sid, "") == -1)
|
||||
return -1;
|
||||
cli_arg(parsed, "pin", &pin, NULL, "");
|
||||
cli_arg(parsed, "manifestpath", &manifestpath, NULL, "");
|
||||
if (cli_arg(parsed, "bsk", &bskhex, cli_optional_bundle_key, NULL) == -1)
|
||||
return -1;
|
||||
@ -1224,7 +1223,7 @@ int app_rhizome_add_file(const struct parsed_command *parsed, void *context)
|
||||
|
||||
if (create_serval_instance_dir() == -1)
|
||||
return -1;
|
||||
if (!(keyring = keyring_open_with_pins((char *)pin)))
|
||||
if (!(keyring = keyring_open_instance_cli(parsed)))
|
||||
return -1;
|
||||
if (rhizome_opendb() == -1)
|
||||
return -1;
|
||||
@ -1408,11 +1407,10 @@ int app_rhizome_extract_bundle(const struct parsed_command *parsed, void *contex
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_parsed(parsed);
|
||||
const char *manifestpath, *filepath, *manifestid, *pins, *bskhex;
|
||||
const char *manifestpath, *filepath, *manifestid, *bskhex;
|
||||
if ( cli_arg(parsed, "manifestid", &manifestid, cli_manifestid, "") == -1
|
||||
|| cli_arg(parsed, "manifestpath", &manifestpath, NULL, "") == -1
|
||||
|| cli_arg(parsed, "filepath", &filepath, NULL, "") == -1
|
||||
|| cli_arg(parsed, "pin,pin...", &pins, NULL, "") == -1
|
||||
|| cli_arg(parsed, "bsk", &bskhex, cli_optional_bundle_key, NULL) == -1)
|
||||
return -1;
|
||||
|
||||
@ -1421,7 +1419,7 @@ int app_rhizome_extract_bundle(const struct parsed_command *parsed, void *contex
|
||||
return -1;
|
||||
if (rhizome_opendb() == -1)
|
||||
return -1;
|
||||
if (!(keyring = keyring_open_with_pins(pins)))
|
||||
if (!(keyring = keyring_open_instance_cli(parsed)))
|
||||
return -1;
|
||||
|
||||
int ret=0;
|
||||
@ -1537,8 +1535,7 @@ int app_rhizome_list(const struct parsed_command *parsed, void *context)
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_parsed(parsed);
|
||||
const char *pins, *service, *name, *sender_sid, *recipient_sid, *offset, *limit;
|
||||
cli_arg(parsed, "pin,pin...", &pins, NULL, "");
|
||||
const char *service, *name, *sender_sid, *recipient_sid, *offset, *limit;
|
||||
cli_arg(parsed, "service", &service, NULL, "");
|
||||
cli_arg(parsed, "name", &name, NULL, "");
|
||||
cli_arg(parsed, "sender_sid", &sender_sid, cli_optional_sid, "");
|
||||
@ -1548,7 +1545,7 @@ int app_rhizome_list(const struct parsed_command *parsed, void *context)
|
||||
/* Create the instance directory if it does not yet exist */
|
||||
if (create_serval_instance_dir() == -1)
|
||||
return -1;
|
||||
if (!(keyring = keyring_open_with_pins(pins)))
|
||||
if (!(keyring = keyring_open_instance_cli(parsed)))
|
||||
return -1;
|
||||
if (rhizome_opendb() == -1)
|
||||
return -1;
|
||||
@ -1559,9 +1556,7 @@ int app_keyring_create(const struct parsed_command *parsed, void *context)
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_parsed(parsed);
|
||||
const char *pin;
|
||||
cli_arg(parsed, "pin,pin...", &pin, NULL, "");
|
||||
if (!keyring_open_with_pins(pin))
|
||||
if (!keyring_open_instance())
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@ -1570,9 +1565,7 @@ int app_keyring_list(const struct parsed_command *parsed, void *context)
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_parsed(parsed);
|
||||
const char *pins;
|
||||
cli_arg(parsed, "pin,pin...", &pins, NULL, "");
|
||||
keyring_file *k = keyring_open_with_pins(pins);
|
||||
keyring_file *k = keyring_open_instance_cli(parsed);
|
||||
if (!k)
|
||||
return -1;
|
||||
int cn, in;
|
||||
@ -1600,10 +1593,11 @@ int app_keyring_add(const struct parsed_command *parsed, void *context)
|
||||
DEBUG_parsed(parsed);
|
||||
const char *pin;
|
||||
cli_arg(parsed, "pin", &pin, NULL, "");
|
||||
keyring_file *k = keyring_open_with_pins("");
|
||||
keyring_file *k = keyring_open_instance_cli(parsed);
|
||||
if (!k)
|
||||
return -1;
|
||||
const keyring_identity *id = keyring_create_identity(k, k->contexts[0], pin);
|
||||
keyring_enter_pin(k, pin);
|
||||
const keyring_identity *id = keyring_create_identity(k, k->contexts[k->context_count - 1], pin);
|
||||
if (id == NULL) {
|
||||
keyring_free(k);
|
||||
return WHY("Could not create new identity");
|
||||
@ -1644,15 +1638,14 @@ int app_keyring_set_did(const struct parsed_command *parsed, void *context)
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_parsed(parsed);
|
||||
const char *sid, *did, *pin, *name;
|
||||
const char *sid, *did, *name;
|
||||
cli_arg(parsed, "sid", &sid, str_is_subscriber_id, "");
|
||||
cli_arg(parsed, "did", &did, cli_optional_did, "");
|
||||
cli_arg(parsed, "name", &name, NULL, "");
|
||||
cli_arg(parsed, "pin", &pin, NULL, "");
|
||||
|
||||
if (strlen(name)>63) return WHY("Name too long (31 char max)");
|
||||
|
||||
if (!(keyring = keyring_open_with_pins(pin)))
|
||||
if (!(keyring = keyring_open_instance_cli(parsed)))
|
||||
return -1;
|
||||
|
||||
unsigned char packedSid[SID_SIZE];
|
||||
@ -2136,6 +2129,7 @@ int app_network_scan(const struct parsed_command *parsed, void *context)
|
||||
|
||||
Keep this list alphabetically sorted for user convenience.
|
||||
*/
|
||||
#define KEYRING_PIN_OPTIONS ,"[--keyring-pin=<pin>]","[--entry-pin=<pin>]..."
|
||||
struct command_line_option command_line_options[]={
|
||||
{app_dna_lookup,{"dna","lookup","<did>","[<timeout>]",NULL},0,
|
||||
"Lookup the SIP/MDP address of the supplied telephone number (DID)."},
|
||||
@ -2177,20 +2171,20 @@ struct command_line_option command_line_options[]={
|
||||
"Append a manifest to the end of the file it belongs to."},
|
||||
{app_rhizome_hash_file,{"rhizome","hash","file","<filepath>",NULL},CLIFLAG_STANDALONE,
|
||||
"Compute the Rhizome hash of a file"},
|
||||
{app_rhizome_add_file,{"rhizome","add","file","<author_sid>","<pin>","<filepath>","[<manifestpath>]","[<bsk>]",NULL},CLIFLAG_STANDALONE,
|
||||
{app_rhizome_add_file,{"rhizome","add","file" KEYRING_PIN_OPTIONS,"<author_sid>","<filepath>","[<manifestpath>]","[<bsk>]",NULL},CLIFLAG_STANDALONE,
|
||||
"Add a file to Rhizome and optionally write its manifest to the given path"},
|
||||
{app_rhizome_import_bundle,{"rhizome","import","bundle","<filepath>","<manifestpath>",NULL},CLIFLAG_STANDALONE,
|
||||
"Import a payload/manifest pair into Rhizome"},
|
||||
{app_rhizome_list,{"rhizome","list","[<pin,pin...>]","[<service>]","[<name>]","[<sender_sid>]","[<recipient_sid>]","[<offset>]","[<limit>]",NULL},CLIFLAG_STANDALONE,
|
||||
{app_rhizome_list,{"rhizome","list" KEYRING_PIN_OPTIONS,"[<service>]","[<name>]","[<sender_sid>]","[<recipient_sid>]","[<offset>]","[<limit>]",NULL},CLIFLAG_STANDALONE,
|
||||
"List all manifests and files in Rhizome"},
|
||||
{app_rhizome_extract_bundle,{"rhizome","extract","bundle",
|
||||
"<manifestid>","[<manifestpath>]","[<filepath>]","[<pin,pin...>]","[<bsk>]",NULL},CLIFLAG_STANDALONE,
|
||||
{app_rhizome_extract_bundle,{"rhizome","extract","bundle" KEYRING_PIN_OPTIONS,
|
||||
"<manifestid>","[<manifestpath>]","[<filepath>]","[<bsk>]",NULL},CLIFLAG_STANDALONE,
|
||||
"Extract a manifest and decrypted file to the given paths."},
|
||||
{app_rhizome_extract_bundle,{"rhizome","extract","manifest",
|
||||
"<manifestid>","[<manifestpath>]","[<pin,pin...>]",NULL},CLIFLAG_STANDALONE,
|
||||
{app_rhizome_extract_bundle,{"rhizome","extract","manifest" KEYRING_PIN_OPTIONS,
|
||||
"<manifestid>","[<manifestpath>]",NULL},CLIFLAG_STANDALONE,
|
||||
"Extract a manifest from Rhizome and write it to the given path"},
|
||||
{app_rhizome_extract_bundle,{"rhizome","extract","file",
|
||||
"<manifestid>","[<filepath>]","[<pin,pin...>]","[<bsk>]",NULL},CLIFLAG_STANDALONE,
|
||||
{app_rhizome_extract_bundle,{"rhizome","extract","file" KEYRING_PIN_OPTIONS,
|
||||
"<manifestid>","[<filepath>]","[<bsk>]",NULL},CLIFLAG_STANDALONE,
|
||||
"Extract a file from Rhizome and write it to the given path"},
|
||||
{app_rhizome_dump_file,{"rhizome","dump","file","<fileid>","[<filepath>]",NULL},CLIFLAG_STANDALONE,
|
||||
"Extract a file from Rhizome and write it to the given path without attempting decryption"},
|
||||
@ -2205,11 +2199,11 @@ struct command_line_option command_line_options[]={
|
||||
"Fetch all new content from the specified Rhizome Direct server. Return when done."},
|
||||
{app_keyring_create,{"keyring","create",NULL},0,
|
||||
"Create a new keyring file."},
|
||||
{app_keyring_list,{"keyring","list","[<pin,pin...>]",NULL},CLIFLAG_STANDALONE,
|
||||
{app_keyring_list,{"keyring","list" KEYRING_PIN_OPTIONS,NULL},CLIFLAG_STANDALONE,
|
||||
"List identites in specified key ring that can be accessed using the specified PINs"},
|
||||
{app_keyring_add,{"keyring","add","[<pin>]",NULL},CLIFLAG_STANDALONE,
|
||||
{app_keyring_add,{"keyring","add" KEYRING_PIN_OPTIONS,"[<pin>]",NULL},CLIFLAG_STANDALONE,
|
||||
"Create a new identity in the keyring protected by the provided PIN"},
|
||||
{app_keyring_set_did,{"set","did","<sid>","<did>","<name>","[<pin>]",NULL},CLIFLAG_STANDALONE,
|
||||
{app_keyring_set_did,{"set","did" KEYRING_PIN_OPTIONS,"<sid>","<did>","<name>",NULL},CLIFLAG_STANDALONE,
|
||||
"Set the DID for the specified SID. Optionally supply PIN to unlock the SID record in the keyring."},
|
||||
{app_id_self,{"id","self",NULL},0,
|
||||
"Return my own identity(s) as URIs"},
|
||||
|
54
keyring.c
54
keyring.c
@ -123,7 +123,8 @@ keyring_file *keyring_open(char *file)
|
||||
keyring_free(k);
|
||||
return NULL;
|
||||
}
|
||||
k->contexts[0]->KeyRingPin=strdup(""); /* Implied empty PIN if none provided */
|
||||
// First context is always with null keyring PIN.
|
||||
k->contexts[0]->KeyRingPin=strdup("");
|
||||
k->contexts[0]->KeyRingSaltLen=KEYRING_PAGE_SIZE-KEYRING_BAM_BYTES;
|
||||
k->contexts[0]->KeyRingSalt=malloc(k->contexts[0]->KeyRingSaltLen);
|
||||
if (!k->contexts[0]->KeyRingSalt) {
|
||||
@ -257,20 +258,23 @@ void keyring_free_keypair(keypair *kp)
|
||||
|
||||
/* Create a new keyring context for the loaded keyring file.
|
||||
We don't need to load any identities etc, as that happens when we enter
|
||||
an identity pin.
|
||||
an identity pin.
|
||||
If the pin is NULL, it is assumed to be blank.
|
||||
The pin does NOT have to be numeric, and has no practical length limitation,
|
||||
as it is used as an input into a hashing function. But for sanity sake, let's
|
||||
limit it to 16KB.
|
||||
*/
|
||||
int keyring_enter_keyringpin(keyring_file *k,char *pin)
|
||||
int keyring_enter_keyringpin(keyring_file *k, const char *pin)
|
||||
{
|
||||
if (!k) return WHY("k is null");
|
||||
if (k->context_count>=KEYRING_MAX_CONTEXTS)
|
||||
if (k->context_count>=KEYRING_MAX_CONTEXTS)
|
||||
return WHY("Too many loaded contexts already");
|
||||
if (k->context_count<1)
|
||||
return WHY("Cannot enter PIN without keyring salt being available");
|
||||
|
||||
int cn;
|
||||
for (cn = 0; cn < k->context_count; ++cn)
|
||||
if (strcmp(k->contexts[cn]->KeyRingPin, pin) == 0)
|
||||
return 1;
|
||||
k->contexts[k->context_count]=calloc(sizeof(keyring_context),1);
|
||||
if (!k->contexts[k->context_count]) return WHY("Could not allocate new keyring context structure");
|
||||
keyring_context *c=k->contexts[k->context_count];
|
||||
@ -1325,25 +1329,7 @@ void keyring_identity_extract(const keyring_identity *id, const unsigned char **
|
||||
}
|
||||
}
|
||||
|
||||
int keyring_enter_pins(keyring_file *k, const char *pinlist)
|
||||
{
|
||||
char pin[1024];
|
||||
int i,j=0;
|
||||
|
||||
for(i=0;i<=strlen(pinlist);i++)
|
||||
if (pinlist[i]==','||pinlist[i]==0)
|
||||
{
|
||||
pin[j]=0;
|
||||
keyring_enter_pin(k,pin);
|
||||
j=0;
|
||||
}
|
||||
else
|
||||
if (j<1023) pin[j++]=pinlist[i];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
keyring_file *keyring_open_with_pins(const char *pinlist)
|
||||
keyring_file *keyring_open_instance()
|
||||
{
|
||||
keyring_file *k = NULL;
|
||||
IN();
|
||||
@ -1354,7 +1340,25 @@ keyring_file *keyring_open_with_pins(const char *pinlist)
|
||||
RETURN(NULL);
|
||||
if ((k = keyring_open(keyringFile)) == NULL)
|
||||
RETURN(NULL);
|
||||
keyring_enter_pins(k,pinlist);
|
||||
RETURN(k);
|
||||
}
|
||||
|
||||
keyring_file *keyring_open_instance_cli(const struct parsed_command *parsed)
|
||||
{
|
||||
IN();
|
||||
keyring_file *k = keyring_open_instance();
|
||||
if (k == NULL)
|
||||
RETURN(NULL);
|
||||
const char *kpin = NULL;
|
||||
cli_arg(parsed, "--keyring-pin", &kpin, NULL, "");
|
||||
keyring_enter_keyringpin(k, kpin);
|
||||
// Always open all PIN-less entries.
|
||||
keyring_enter_pin(k, "");
|
||||
// Open all entries for which an entry PIN has been given.
|
||||
unsigned i;
|
||||
for (i = 0; i < parsed->labelc; ++i)
|
||||
if (strn_str_cmp(parsed->labelv[i].label, parsed->labelv[i].len, "--entry-pin") == 0)
|
||||
keyring_enter_pin(k, parsed->labelv[i].text);
|
||||
RETURN(k);
|
||||
}
|
||||
|
||||
|
@ -86,10 +86,10 @@ int overlayServerMode()
|
||||
/* Get keyring available for use.
|
||||
Required for MDP, and very soon as a complete replacement for the
|
||||
HLR for DNA lookups, even in non-overlay mode. */
|
||||
keyring=keyring_open_with_pins("");
|
||||
if (!keyring) {
|
||||
keyring = keyring_open_instance();
|
||||
if (!keyring)
|
||||
return WHY("Could not open serval keyring file.");
|
||||
}
|
||||
keyring_enter_pin(keyring, "");
|
||||
/* put initial identity in if we don't have any visible */
|
||||
keyring_seed(keyring);
|
||||
|
||||
|
4
serval.h
4
serval.h
@ -265,9 +265,9 @@ extern keyring_file *keyring;
|
||||
|
||||
/* Public calls to keyring management */
|
||||
keyring_file *keyring_open(char *file);
|
||||
keyring_file *keyring_open_with_pins(const char *pinlist);
|
||||
keyring_file *keyring_open_instance();
|
||||
keyring_file *keyring_open_instance_cli(const struct parsed_command *parsed);
|
||||
int keyring_enter_pin(keyring_file *k, const char *pin);
|
||||
int keyring_enter_pins(keyring_file *k, const char *pinlist);
|
||||
int keyring_set_did(keyring_identity *id,char *did,char *name);
|
||||
int keyring_sanitise_position(const keyring_file *k,int *cn,int *in,int *kp);
|
||||
int keyring_next_keytype(const keyring_file *k, int *cn, int *in, int *kp, int keytype);
|
||||
|
2
server.c
2
server.c
@ -420,7 +420,7 @@ int getKeyring(char *backing_file)
|
||||
exit(WHY("Keyring being opened twice"));
|
||||
keyring=keyring_open(backing_file);
|
||||
/* unlock all entries with blank pins */
|
||||
keyring_enter_pins(keyring,"");
|
||||
keyring_enter_pin(keyring, "");
|
||||
}
|
||||
keyring_seed(keyring);
|
||||
|
||||
|
@ -388,7 +388,7 @@ rhizome_add_file() {
|
||||
local size="${2:-64}"
|
||||
[ -e "$name" ] || create_file "$name" $size
|
||||
local sidvar="SID$instance_name"
|
||||
executeOk_servald rhizome add file "${!sidvar}" '' "$name" "$name.manifest"
|
||||
executeOk_servald rhizome add file "${!sidvar}" "$name" "$name.manifest"
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 --author="${!sidvar}" "$name" --and-others
|
||||
extract_manifest_vars "$name.manifest"
|
||||
@ -401,8 +401,8 @@ rhizome_update_file() {
|
||||
local sidvar="SID$instance_name"
|
||||
[ "$new_name" != "$orig_name" ] && cp "$orig_name.manifest" "$new_name.manifest"
|
||||
$SED -i -e '/^date=/d;/^filehash=/d;/^filesize=/d;/^version=/d;/^name=/d' "$new_name.manifest"
|
||||
executeOk_servald rhizome add file "${!sidvar}" '' "$new_name" "$new_name.manifest"
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome add file "${!sidvar}" "$new_name" "$new_name.manifest"
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 "$new_name"
|
||||
extract_manifest_vars "$new_name.manifest"
|
||||
}
|
||||
|
@ -32,17 +32,18 @@ assert_keyring_list() {
|
||||
tfw_cat --stdout
|
||||
}
|
||||
|
||||
doc_KeyringCreate="Creating a keyring overrwites any existing keyring"
|
||||
doc_KeyringCreate="Create keyring destroys existing keys"
|
||||
test_KeyringCreate() {
|
||||
executeOk_servald keyring add ''
|
||||
executeOk_servald keyring add ''
|
||||
executeOk_servald keyring list
|
||||
assert_keyring_list 1
|
||||
assert_keyring_list 2
|
||||
executeOk_servald keyring create
|
||||
assert_keyring_list 0
|
||||
}
|
||||
|
||||
doc_KeyringPinless="Add and list all PIN-less keys"
|
||||
test_KeyringPinless() {
|
||||
doc_Pinless="No keyring PIN with PIN-less identities"
|
||||
test_Pinless() {
|
||||
executeOk_servald keyring add ''
|
||||
executeOk_servald keyring list
|
||||
assert_keyring_list 1
|
||||
@ -54,31 +55,48 @@ test_KeyringPinless() {
|
||||
assert_keyring_list 3
|
||||
}
|
||||
|
||||
doc_KeyringEntryPin="Add and list PIN-locked keys"
|
||||
test_KeyringEntryPin() {
|
||||
doc_IdentityPins="No keyring PIN with identity PINs"
|
||||
test_IdentityPins() {
|
||||
executeOk_servald keyring add 'one'
|
||||
executeOk_servald keyring list
|
||||
assert_keyring_list 0
|
||||
executeOk_servald keyring list 'one'
|
||||
executeOk_servald keyring list --entry-pin 'one'
|
||||
assert_keyring_list 1
|
||||
executeOk_servald keyring add 'two'
|
||||
executeOk_servald keyring list
|
||||
assert_keyring_list 0
|
||||
executeOk_servald keyring list 'one'
|
||||
executeOk_servald keyring list --entry-pin 'one'
|
||||
assert_keyring_list 1
|
||||
executeOk_servald keyring list 'one,two'
|
||||
executeOk_servald keyring list --entry-pin 'one' --entry-pin 'two'
|
||||
assert_keyring_list 2
|
||||
executeOk_servald keyring add 'three'
|
||||
executeOk_servald keyring list
|
||||
assert_keyring_list 0
|
||||
executeOk_servald keyring list 'one'
|
||||
executeOk_servald keyring list --entry-pin 'one'
|
||||
assert_keyring_list 1
|
||||
executeOk_servald keyring list 'one,two'
|
||||
executeOk_servald keyring list --entry-pin 'one' --entry-pin 'two'
|
||||
assert_keyring_list 2
|
||||
executeOk_servald keyring list 'one,two,three'
|
||||
executeOk_servald keyring list --entry-pin 'one' --entry-pin 'two' --entry-pin 'three'
|
||||
assert_keyring_list 3
|
||||
executeOk_servald keyring list 'two,three,one'
|
||||
executeOk_servald keyring list --entry-pin 'two' --entry-pin 'three'
|
||||
assert_keyring_list 2
|
||||
executeOk_servald keyring list --entry-pin 'three'
|
||||
assert_keyring_list 1
|
||||
}
|
||||
|
||||
doc_KeyringPinIdentityPinless="Keyring PIN with PIN-less identities"
|
||||
test_KeyringPinIdentityPinless() {
|
||||
executeOk_servald keyring add --keyring-pin=hello ''
|
||||
executeOk_servald keyring list --keyring-pin=hello
|
||||
assert_keyring_list 1
|
||||
executeOk_servald keyring add --keyring-pin=hello ''
|
||||
executeOk_servald keyring list --keyring-pin=hello
|
||||
assert_keyring_list 2
|
||||
executeOk_servald keyring add --keyring-pin=hello ''
|
||||
executeOk_servald keyring list --keyring-pin=hello
|
||||
assert_keyring_list 3
|
||||
executeOk_servald keyring list
|
||||
assert_keyring_list 0
|
||||
}
|
||||
|
||||
runTests "$@"
|
||||
|
136
tests/rhizomeops
136
tests/rhizomeops
@ -56,7 +56,7 @@ setup_AddNoAuthorNoManifest() {
|
||||
echo "A test file" >file1
|
||||
}
|
||||
test_AddNoAuthorNoManifest() {
|
||||
executeOk_servald rhizome add file '' '' file1
|
||||
executeOk_servald rhizome add file '' file1
|
||||
assert_stdout_add_file file1
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ setup_AddNoManifest() {
|
||||
echo "A test file" >file1
|
||||
}
|
||||
test_AddNoManifest() {
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1
|
||||
executeOk_servald rhizome add file $SIDB1 file1
|
||||
assert_stdout_add_file file1
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ setup_AddNoAuthor() {
|
||||
echo "A test file" >file1
|
||||
}
|
||||
test_AddNoAuthor() {
|
||||
executeOk_servald rhizome add file '' '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file file1 file1.manifest
|
||||
assert_stdout_add_file file1
|
||||
assertGrep --matches=0 file1.manifest '^BK='
|
||||
}
|
||||
@ -93,12 +93,12 @@ setup_AddNoAuthor() {
|
||||
echo "crypt=1" >file1.manifest
|
||||
}
|
||||
test_AddNoAuthor() {
|
||||
executeOk_servald rhizome add file '' '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file '' file1 file1.manifest
|
||||
tfw_cat --stdout --stderr
|
||||
assert_stdout_add_file file1
|
||||
extract_stdout_secret file1_secret
|
||||
assertGrep --matches=0 file1.manifest '^BK='
|
||||
executeOk_servald rhizome extract file $re_manifestid file1x '' $file1_secret
|
||||
executeOk_servald rhizome extract file $re_manifestid file1x $file1_secret
|
||||
tfw_cat --stdout --stderr
|
||||
assert diff file1 file1x
|
||||
}
|
||||
@ -113,7 +113,7 @@ setup_AddNonExistManifest() {
|
||||
}
|
||||
test_AddNonExistManifest() {
|
||||
assert --error-on-fail [ ! -e file1.manifest ]
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
assert_stdout_add_file file1
|
||||
assert [ -r file1.manifest ]
|
||||
assert_manifest_complete file1.manifest
|
||||
@ -131,7 +131,7 @@ setup_AddManifest() {
|
||||
echo -e 'name=wah\ndate=12345' >file1.manifest
|
||||
}
|
||||
test_AddManifest() {
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
tfw_cat --stdout --stderr -v file1.manifest
|
||||
assert_stdout_add_file file1 name=wah
|
||||
assert_manifest_complete file1.manifest
|
||||
@ -148,7 +148,7 @@ setup_AddEmpty() {
|
||||
assert_rhizome_list
|
||||
}
|
||||
test_AddEmpty() {
|
||||
executeOk_servald rhizome add file $SIDB1 '' '' .manifest
|
||||
executeOk_servald rhizome add file $SIDB1 '' .manifest
|
||||
tfw_cat --stdout --stderr -v .manifest
|
||||
assert_stdout_add_file ''
|
||||
assert_manifest_complete .manifest
|
||||
@ -170,11 +170,11 @@ setup_AddThenList() {
|
||||
}
|
||||
test_AddThenList() {
|
||||
# Add first file
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 --author=$SIDB1 file1
|
||||
# Add second file
|
||||
executeOk_servald rhizome add file $SIDB1 '' file2 file2.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file2 file2.manifest
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 --author=$SIDB1 file1 file2
|
||||
}
|
||||
@ -184,7 +184,7 @@ setup_ExtractManifestAfterAdd() {
|
||||
setup_servald
|
||||
setup_rhizome
|
||||
echo "A test file" >file1
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 --author=$SIDB1 file1
|
||||
extract_manifest_id manifestid file1.manifest
|
||||
@ -213,7 +213,7 @@ setup_ExtractManifestFileAfterAdd() {
|
||||
setup_servald
|
||||
setup_rhizome
|
||||
echo "A test file" >file1
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 --author=$SIDB1 file1
|
||||
extract_manifest_id manifestid file1.manifest
|
||||
@ -244,7 +244,7 @@ setup_ExtractManifestToStdout() {
|
||||
setup_servald
|
||||
setup_rhizome
|
||||
echo "A test file" >file1
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
extract_manifest_id manifestid file1.manifest
|
||||
extract_manifest_version version file1.manifest
|
||||
extract_manifest_filehash filehash file1.manifest
|
||||
@ -275,7 +275,7 @@ setup_ExtractManifestAfterAddNoAuthor() {
|
||||
setup_servald
|
||||
setup_rhizome
|
||||
echo "A test file" >file1
|
||||
executeOk_servald rhizome add file '' '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file '' file1 file1.manifest
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file1
|
||||
extract_manifest_id manifestid file1.manifest
|
||||
@ -320,7 +320,7 @@ test_ExtractManifestInvalidID() {
|
||||
execute --exit-status=255 $servald rhizome extract manifest 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDE foo.manifest
|
||||
assertStdoutLineCount '==' 0
|
||||
assert [ ! -e foo.manifest ]
|
||||
execute --exit-status=255 $servald rhizome extract manifest '' foo.manifest
|
||||
execute --exit-status=255 $servald rhizome extract manifest foo.manifest
|
||||
assertStdoutLineCount '==' 0
|
||||
assert [ ! -e foo.manifest ]
|
||||
}
|
||||
@ -330,7 +330,7 @@ setup_ExtractFileAfterAdd() {
|
||||
setup_servald
|
||||
setup_rhizome
|
||||
echo "A test file" >file1
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
tfw_cat --stderr
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 --author=$SIDB1 file1
|
||||
@ -384,7 +384,7 @@ test_ExtractFileInvalidID() {
|
||||
execute --exit-status=255 $servald rhizome extract file 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDE foo
|
||||
assertStdoutLineCount '==' 0
|
||||
assert [ ! -e foo ]
|
||||
execute --exit-status=255 $servald rhizome extract file '' foo
|
||||
execute --exit-status=255 $servald rhizome extract file foo
|
||||
assertStdoutLineCount '==' 0
|
||||
assert [ ! -e foo ]
|
||||
execute --exit-status=255 $servald rhizome dump file 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEx foo
|
||||
@ -393,7 +393,7 @@ test_ExtractFileInvalidID() {
|
||||
execute --exit-status=255 $servald rhizome dump file 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDE foo
|
||||
assertStdoutLineCount '==' 0
|
||||
assert [ ! -e foo ]
|
||||
execute --exit-status=255 $servald rhizome dump file '' foo
|
||||
execute --exit-status=255 $servald rhizome dump file foo
|
||||
assertStdoutLineCount '==' 0
|
||||
assert [ ! -e foo ]
|
||||
}
|
||||
@ -408,10 +408,10 @@ setup_AddDuplicate() {
|
||||
echo "Another test file" >file2
|
||||
echo "A test file, second version" >file1_2
|
||||
# Add first file
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
extract_stdout_secret file1_secret
|
||||
# Add second file
|
||||
executeOk_servald rhizome add file $SIDB1 '' file2 file2.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file2 file2.manifest
|
||||
extract_stdout_secret file2_secret
|
||||
# Make sure they are both in the list.
|
||||
executeOk_servald rhizome list
|
||||
@ -421,7 +421,7 @@ test_AddDuplicate() {
|
||||
# Add first file again - nothing should change in its manifests, and it
|
||||
# should appear that the add command succeeded (with perhaps some grumbling
|
||||
# on stderr).
|
||||
execute --exit-status=2 $servald rhizome add file $SIDB1 '' file1 file1.manifestA
|
||||
execute --exit-status=2 $servald rhizome add file $SIDB1 file1 file1.manifestA
|
||||
assert [ -s file1.manifestA ]
|
||||
assert_stdout_add_file file1
|
||||
extract_stdout_secret file1_dup_secret
|
||||
@ -430,7 +430,7 @@ test_AddDuplicate() {
|
||||
strip_signatures file1.manifest file1.manifestA
|
||||
assert diff file1.manifest file1.manifestA
|
||||
# Repeat for second file.
|
||||
execute --exit-status=2 $servald rhizome add file $SIDB1 '' file2 file2.manifestA
|
||||
execute --exit-status=2 $servald rhizome add file $SIDB1 file2 file2.manifestA
|
||||
assert [ -s file2.manifestA ]
|
||||
assert_stdout_add_file file2
|
||||
extract_stdout_secret file2_dup_secret
|
||||
@ -450,7 +450,7 @@ test_AddMismatched() {
|
||||
# Try to add another file using an existing manifest, should fail and leave
|
||||
# the manifest file unchanged.
|
||||
cp file1.manifest file1_2.manifest
|
||||
execute $servald rhizome add file $SIDB1 '' file1_2 file1_2.manifest
|
||||
execute $servald rhizome add file $SIDB1 file1_2 file1_2.manifest
|
||||
assertExitStatus '!=' 0
|
||||
assert diff file1.manifest file1_2.manifest
|
||||
# And rhizome store should be unchanged.
|
||||
@ -472,7 +472,7 @@ setup_AddUpdateSameVersion() {
|
||||
}
|
||||
test_AddUpdateSameVersion() {
|
||||
tfw_cat -v file1_2.manifest
|
||||
execute $servald rhizome add file $SIDB1 '' file1_2 file1_2.manifest
|
||||
execute $servald rhizome add file $SIDB1 file1_2 file1_2.manifest
|
||||
assertExitStatus --stderr '!=' 0
|
||||
tfw_cat -v file1_2.manifest
|
||||
assert cmp file1_2.manifest file1_2.manifest.orig
|
||||
@ -491,7 +491,7 @@ setup_AddUpdateNewVersion() {
|
||||
}
|
||||
test_AddUpdateNewVersion() {
|
||||
tfw_cat -v file1_2.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1_2 file1_2.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1_2 file1_2.manifest
|
||||
tfw_cat --stderr
|
||||
assert_stdout_add_file file1_2 name=file1
|
||||
assert_manifest_newer file1.manifest file1_2.manifest
|
||||
@ -506,7 +506,7 @@ setup_AddUpdateDiscoverAuthor() {
|
||||
}
|
||||
test_AddUpdateDiscoverAuthor() {
|
||||
tfw_cat -v file1_2.manifest
|
||||
executeOk_servald rhizome add file '' '' file1_2 file1_2.manifest
|
||||
executeOk_servald rhizome add file '' file1_2 file1_2.manifest
|
||||
tfw_cat --stderr
|
||||
# Rhizome store contents have new payload.
|
||||
executeOk_servald rhizome list
|
||||
@ -520,7 +520,7 @@ setup_AddUpdateNoAuthor() {
|
||||
}
|
||||
test_AddUpdateNoAuthor() {
|
||||
tfw_cat -v file1_2.manifest
|
||||
execute $servald rhizome add file $SIDB1 '' file1_2 file1_2.manifest
|
||||
execute $servald rhizome add file $SIDB1 file1_2 file1_2.manifest
|
||||
tfw_cat --stderr
|
||||
assertExitStatus '!=' 0
|
||||
# Rhizome store contents have old payload.
|
||||
@ -534,7 +534,7 @@ setup_AddUpdateNoAuthorWithSecret() {
|
||||
}
|
||||
test_AddUpdateNoAuthorWithSecret() {
|
||||
tfw_cat -v file1_2.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1_2 file1_2.manifest "$file1_secret"
|
||||
executeOk_servald rhizome add file $SIDB1 file1_2 file1_2.manifest "$file1_secret"
|
||||
tfw_cat --stderr
|
||||
# Rhizome store contents have new payload.
|
||||
executeOk_servald rhizome list
|
||||
@ -550,7 +550,7 @@ setup_AddUpdateAutoVersion() {
|
||||
test_AddUpdateAutoVersion() {
|
||||
tfw_cat -v file1_2.manifest
|
||||
sleep 0.001 # Ensure that at least one millisecond has elapsed
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1_2 file1_2.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1_2 file1_2.manifest
|
||||
assert_manifest_newer file1.manifest file1_2.manifest
|
||||
# Rhizome store contents reflect new payload.
|
||||
executeOk_servald rhizome list
|
||||
@ -565,7 +565,7 @@ setup_AddUnsupportedService() {
|
||||
echo -e 'service=Fubar' >file1.manifest
|
||||
}
|
||||
test_AddUnsupportedService() {
|
||||
execute $servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
execute $servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
assertExitStatus '!=' 0
|
||||
}
|
||||
|
||||
@ -577,7 +577,7 @@ setup_EncryptedPayload() {
|
||||
echo -e "service=file\nname=private\ncrypt=1" >file1.manifest
|
||||
}
|
||||
test_EncryptedPayload() {
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
tfw_cat --stdout --stderr
|
||||
assert_stdout_add_file file1
|
||||
assert_manifest_complete file1.manifest
|
||||
@ -600,7 +600,7 @@ setup_MeshMSAddCreate() {
|
||||
echo -e "service=MeshMS1\nsender=$SIDB1\nrecipient=$SIDB2" >file1.manifest
|
||||
}
|
||||
test_MeshMSAddCreate() {
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
assert_stdout_add_file file1
|
||||
assert_manifest_complete file1.manifest
|
||||
extract_manifest_crypt crypt file1.manifest
|
||||
@ -620,7 +620,7 @@ setup_MeshMSAddGrow() {
|
||||
echo -e "service=MeshMS1\nsender=$SIDB1\nrecipient=$SIDB2" >file1.manifest
|
||||
}
|
||||
test_MeshMSAddGrow() {
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
assert_stdout_add_file file1
|
||||
assert_manifest_complete file1.manifest
|
||||
executeOk_servald rhizome list
|
||||
@ -633,7 +633,7 @@ test_MeshMSAddGrow() {
|
||||
ofilehashes+=("$filehash")
|
||||
echo -e "id=$id\nBK=$bk\nservice=MeshMS1\nsender=$SIDB1\nrecipient=$SIDB2" >file1.manifest
|
||||
echo "Message$m" >>file1
|
||||
executeOk_servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 file1
|
||||
extract_manifest_id idx file1.manifest
|
||||
@ -658,7 +658,7 @@ setup_MeshMSAddMissingSender() {
|
||||
echo -e "service=MeshMS1\nrecipient=$SIDB2" >file1.manifest
|
||||
}
|
||||
test_MeshMSAddMissingSender() {
|
||||
execute $servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
execute $servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
assertExitStatus '!=' 0
|
||||
}
|
||||
|
||||
@ -672,7 +672,7 @@ setup_MeshMSAddMissingRecipient() {
|
||||
echo -e "service=MeshMS1\nsender=$SIDB1" >file1.manifest
|
||||
}
|
||||
test_MeshMSAddMissingRecipient() {
|
||||
execute $servald rhizome add file $SIDB1 '' file1 file1.manifest
|
||||
execute $servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
assertExitStatus '!=' 0
|
||||
}
|
||||
|
||||
@ -684,7 +684,7 @@ setup_MeshMSAddMissingAuthor() {
|
||||
echo -e "service=MeshMS1\nsender=$SIDB1\nrecipient=$SIDB2" >file1.manifest
|
||||
}
|
||||
test_MeshMSAddMissingAuthor() {
|
||||
executeOk_servald rhizome add file '' '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file '' file1 file1.manifest
|
||||
assert_stdout_add_file file1
|
||||
assert_manifest_complete file1.manifest
|
||||
executeOk_servald rhizome list
|
||||
@ -699,21 +699,21 @@ setup_ListFilter() {
|
||||
echo "File2" > file2
|
||||
echo "File3" > file3
|
||||
echo "File4" > file4
|
||||
executeOk_servald rhizome add file '' '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file '' file1 file1.manifest
|
||||
assert_stdout_add_file file1
|
||||
executeOk_servald rhizome add file '' '' file2 file2.manifest
|
||||
executeOk_servald rhizome add file '' file2 file2.manifest
|
||||
assert_stdout_add_file file2
|
||||
executeOk_servald rhizome add file '' '' file3 file3.manifest
|
||||
executeOk_servald rhizome add file '' file3 file3.manifest
|
||||
assert_stdout_add_file file3
|
||||
executeOk_servald rhizome add file '' '' file4 file4.manifest
|
||||
executeOk_servald rhizome add file '' file4 file4.manifest
|
||||
assert_stdout_add_file file4
|
||||
}
|
||||
test_ListFilter() {
|
||||
executeOk_servald rhizome list '' file
|
||||
executeOk_servald rhizome list file
|
||||
assert_rhizome_list file1 file2 file3 file4
|
||||
executeOk_servald rhizome list '' file 'file%'
|
||||
executeOk_servald rhizome list file 'file%'
|
||||
assert_rhizome_list file1 file2 file3 file4
|
||||
executeOk_servald rhizome list '' '' 'file2'
|
||||
executeOk_servald rhizome list '' 'file2'
|
||||
assert_rhizome_list file2
|
||||
}
|
||||
|
||||
@ -729,49 +729,49 @@ setup_MeshMSListFilter() {
|
||||
echo -e "service=MeshMS1\nsender=$SIDB1\nrecipient=$SIDB4" >file3.manifest
|
||||
echo "Message3" >file4
|
||||
echo -e "service=MeshMS1\nsender=$SIDB2\nrecipient=$SIDB3" >file4.manifest
|
||||
executeOk_servald rhizome add file '' '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file '' file1 file1.manifest
|
||||
assert_stdout_add_file file1
|
||||
assert_manifest_complete file1.manifest
|
||||
executeOk_servald rhizome add file '' '' file2 file2.manifest
|
||||
executeOk_servald rhizome add file '' file2 file2.manifest
|
||||
assert_stdout_add_file file2
|
||||
assert_manifest_complete file2.manifest
|
||||
executeOk_servald rhizome add file '' '' file3 file3.manifest
|
||||
executeOk_servald rhizome add file '' file3 file3.manifest
|
||||
assert_stdout_add_file file3
|
||||
assert_manifest_complete file3.manifest
|
||||
executeOk_servald rhizome add file '' '' file4 file4.manifest
|
||||
executeOk_servald rhizome add file '' file4 file4.manifest
|
||||
assert_stdout_add_file file4
|
||||
assert_manifest_complete file4.manifest
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 file1 file2 file3 file4
|
||||
}
|
||||
test_MeshMSListFilter() {
|
||||
executeOk_servald rhizome list '' file
|
||||
executeOk_servald rhizome list file
|
||||
assert_rhizome_list
|
||||
executeOk_servald rhizome list '' MeshMS1
|
||||
executeOk_servald rhizome list MeshMS1
|
||||
assert_rhizome_list --fromhere=1 file1 file2 file3 file4
|
||||
executeOk_servald rhizome list '' '' '' $SIDB1
|
||||
executeOk_servald rhizome list '' '' $SIDB1
|
||||
assert_rhizome_list --fromhere=1 file1 file2 file3
|
||||
executeOk_servald rhizome list '' '' '' $SIDB2
|
||||
executeOk_servald rhizome list '' '' $SIDB2
|
||||
assert_rhizome_list --fromhere=1 file4
|
||||
executeOk_servald rhizome list '' '' $SIDB3
|
||||
assert_rhizome_list
|
||||
executeOk_servald rhizome list '' '' $SIDB4
|
||||
assert_rhizome_list
|
||||
executeOk_servald rhizome list '' '' '' $SIDB1
|
||||
assert_rhizome_list
|
||||
executeOk_servald rhizome list '' '' '' $SIDB2
|
||||
assert_rhizome_list --fromhere=1 file1
|
||||
executeOk_servald rhizome list '' '' '' $SIDB3
|
||||
assert_rhizome_list --fromhere=1 file2 file4
|
||||
executeOk_servald rhizome list file '' '' $SIDB3
|
||||
assert_rhizome_list
|
||||
executeOk_servald rhizome list '' '' '' $SIDB4
|
||||
assert_rhizome_list
|
||||
executeOk_servald rhizome list '' '' '' '' $SIDB1
|
||||
assert_rhizome_list
|
||||
executeOk_servald rhizome list '' '' '' '' $SIDB2
|
||||
assert_rhizome_list --fromhere=1 file1
|
||||
executeOk_servald rhizome list '' '' '' '' $SIDB3
|
||||
assert_rhizome_list --fromhere=1 file2 file4
|
||||
executeOk_servald rhizome list '' file '' '' $SIDB3
|
||||
assert_rhizome_list
|
||||
executeOk_servald rhizome list '' '' '' '' $SIDB4
|
||||
assert_rhizome_list --fromhere=1 file3
|
||||
executeOk_servald rhizome list '' '' '' $SIDB1 $SIDB4
|
||||
executeOk_servald rhizome list '' '' $SIDB1 $SIDB4
|
||||
assert_rhizome_list --fromhere=1 file3
|
||||
executeOk_servald rhizome list '' '' '' $SIDB2 $SIDB4
|
||||
executeOk_servald rhizome list '' '' $SIDB2 $SIDB4
|
||||
assert_rhizome_list
|
||||
executeOk_servald rhizome list '' '' '' $SIDB2 $SIDB3
|
||||
executeOk_servald rhizome list '' '' $SIDB2 $SIDB3
|
||||
assert_rhizome_list --fromhere=1 file4
|
||||
}
|
||||
|
||||
@ -781,7 +781,7 @@ setup_ImportForeignBundle() {
|
||||
setup_rhizome
|
||||
set_instance +A
|
||||
echo "Hello from A" >fileA
|
||||
executeOk_servald rhizome add file $SIDA1 '' fileA fileA.manifest
|
||||
executeOk_servald rhizome add file $SIDA1 fileA fileA.manifest
|
||||
assert_stdout_add_file fileA
|
||||
set_instance +B
|
||||
}
|
||||
@ -799,7 +799,7 @@ setup_ImportOwnBundle() {
|
||||
setup_servald
|
||||
setup_rhizome
|
||||
echo "Hello from B" >fileB
|
||||
executeOk_servald rhizome add file $SIDB2 '' fileB fileB.manifest
|
||||
executeOk_servald rhizome add file $SIDB2 fileB fileB.manifest
|
||||
assert_stdout_add_file fileB
|
||||
extract_manifest_id manifestid fileB.manifest
|
||||
extract_manifest_version version fileB.manifest
|
||||
@ -839,7 +839,7 @@ setup_ImportCombinedBundle() {
|
||||
setup_rhizome
|
||||
set_instance +A
|
||||
echo "Hello from A" >fileA
|
||||
executeOk_servald rhizome add file $SIDA1 '' fileA fileA.manifest
|
||||
executeOk_servald rhizome add file $SIDA1 fileA fileA.manifest
|
||||
assert_stdout_add_file fileA
|
||||
extract_manifest_id manifestid fileA.manifest
|
||||
extract_manifest_filehash filehash fileA.manifest
|
||||
|
@ -77,14 +77,14 @@ setup_FileTransfer() {
|
||||
test_FileTransfer() {
|
||||
wait_until bundle_received_by $BID:$VERSION +B
|
||||
set_instance +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file1
|
||||
assert_rhizome_received file1
|
||||
set_instance +A
|
||||
rhizome_update_file file1 file2
|
||||
set_instance +B
|
||||
wait_until bundle_received_by $BID:$VERSION +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file2
|
||||
assert_rhizome_received file2
|
||||
}
|
||||
@ -95,7 +95,7 @@ setup_EncryptedTransfer() {
|
||||
set_instance +A
|
||||
echo "Clear Text" >file1
|
||||
echo -e "service=MeshMS1\nsender=$SIDA\nrecipient=$SIDB" >file1.manifest
|
||||
executeOk_servald rhizome add file $SIDA '' file1 file1.manifest
|
||||
executeOk_servald rhizome add file $SIDA file1 file1.manifest
|
||||
extract_manifest_id BID file1.manifest
|
||||
extract_manifest_version VERSION file1.manifest
|
||||
start_servald_instances +A +B
|
||||
@ -136,14 +136,14 @@ setup_HTTPTransport() {
|
||||
test_HTTPTransport() {
|
||||
wait_until bundle_received_by $BID:$VERSION +B
|
||||
set_instance +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file1
|
||||
assert_rhizome_received file1
|
||||
set_instance +A
|
||||
rhizome_update_file file1 file2
|
||||
set_instance +B
|
||||
wait_until bundle_received_by $BID:$VERSION +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file2
|
||||
assert_rhizome_received file2
|
||||
}
|
||||
@ -163,14 +163,14 @@ setup_MDPTransport() {
|
||||
test_MDPTransport() {
|
||||
wait_until bundle_received_by $BID:$VERSION +B
|
||||
set_instance +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file1
|
||||
assert_rhizome_received file1
|
||||
set_instance +A
|
||||
rhizome_update_file file1 file2
|
||||
set_instance +B
|
||||
wait_until bundle_received_by $BID:$VERSION +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file2
|
||||
assert_rhizome_received file2
|
||||
}
|
||||
@ -193,7 +193,7 @@ setup_FileTransferBigMDP() {
|
||||
test_FileTransferBigMDP() {
|
||||
wait_until bundle_received_by $BID:$VERSION +B
|
||||
set_instance +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file1
|
||||
assert_rhizome_received file1
|
||||
}
|
||||
@ -216,7 +216,7 @@ setup_FileTransferBig() {
|
||||
test_FileTransferBig() {
|
||||
wait_until bundle_received_by $BID:$VERSION +B
|
||||
set_instance +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file1
|
||||
assert_rhizome_received file1
|
||||
}
|
||||
@ -246,7 +246,7 @@ test_FileTransferMulti() {
|
||||
wait_until bundle_received_by $BID:$VERSION +B +C +D +E
|
||||
for i in B C D E; do
|
||||
set_instance +$i
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file1
|
||||
assert_rhizome_received file1
|
||||
done
|
||||
@ -277,7 +277,7 @@ test_FileTransferMultiMDP() {
|
||||
wait_until bundle_received_by $BID:$VERSION +B +C +D +E
|
||||
for i in B C D E; do
|
||||
set_instance +$i
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file1
|
||||
assert_rhizome_received file1
|
||||
done
|
||||
@ -300,7 +300,7 @@ setup_FileTransferDelete() {
|
||||
test_FileTransferDelete() {
|
||||
wait_until bundle_received_by $BID:$VERSION +B
|
||||
set_instance +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 file1_2
|
||||
assert_rhizome_received file1_2
|
||||
}
|
||||
@ -332,7 +332,7 @@ name. We decided against this approach as the VOMP channel driver was written
|
||||
in time to avoid it.
|
||||
EOF
|
||||
set_instance +B
|
||||
executeOk_servald rhizome add file $SIDB '' README.WHYNOTSIPS README.WHYNOTSIPS.manifest
|
||||
executeOk_servald rhizome add file $SIDB README.WHYNOTSIPS README.WHYNOTSIPS.manifest
|
||||
assert_manifest_complete README.WHYNOTSIPS.manifest
|
||||
assert_stdout_add_file README.WHYNOTSIPS
|
||||
set_instance +A
|
||||
@ -350,7 +350,7 @@ test_HttpImport() {
|
||||
--form 'manifest=@README.WHYNOTSIPS.manifest' \
|
||||
"$addr_localhost:$PORTA/rhizome/import"
|
||||
tfw_cat http.headers http.output
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 README.WHYNOTSIPS
|
||||
assert_rhizome_received README.WHYNOTSIPS
|
||||
}
|
||||
@ -371,7 +371,7 @@ test_HttpAddLocal() {
|
||||
echo 'File file1' >file1
|
||||
executeOk curl --silent --form 'data=@file1' "http://${addr_localhost}:$PORTA/rhizome/secretaddfile" --output file1.manifest
|
||||
assert_manifest_complete file1.manifest
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 file1
|
||||
extract_manifest_name name file1.manifest
|
||||
assert [ "$name" = file1 ]
|
||||
@ -421,13 +421,13 @@ test_DirectPush() {
|
||||
tfw_cat --stdout --stderr
|
||||
assert bundle_received_by $BID_B1:$VERSION_B1 $BID_B2:$VERSION_B2 $BID_B3:$VERSION_B3 +A
|
||||
set_instance +A
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 fileA1 fileA2 fileA3 --fromhere=0 fileB1 fileB2 fileB3
|
||||
assert_rhizome_received fileB1
|
||||
assert_rhizome_received fileB2
|
||||
assert_rhizome_received fileB3
|
||||
set_instance +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 fileB1 fileB2 fileB3
|
||||
}
|
||||
|
||||
@ -442,10 +442,10 @@ test_DirectPull() {
|
||||
tfw_cat --stdout --stderr
|
||||
assert bundle_received_by $BID_A1:$VERSION_A1 $BID_A2:$VERSION_A2 $BID_A2:$VERSION_A2 --stderr
|
||||
set_instance +A
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 fileA1 fileA2 fileA3
|
||||
set_instance +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 fileA1 fileA2 fileA3 --fromhere=1 fileB1 fileB2 fileB3
|
||||
assert_rhizome_received fileA1
|
||||
assert_rhizome_received fileA2
|
||||
@ -463,13 +463,13 @@ test_DirectSync() {
|
||||
tfw_cat --stdout --stderr
|
||||
assert bundle_received_by $BID_A1:$VERSION_A1 $BID_A2:$VERSION_A2 $BID_A2:$VERSION_A2 --stderr
|
||||
set_instance +A
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=1 fileA1 fileA2 fileA3 --fromhere=0 fileB1 fileB2 fileB3
|
||||
assert_rhizome_received fileB1
|
||||
assert_rhizome_received fileB2
|
||||
assert_rhizome_received fileB3
|
||||
set_instance +B
|
||||
executeOk_servald rhizome list ''
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 fileA1 fileA2 fileA3 --fromhere=1 fileB1 fileB2 fileB3
|
||||
assert_rhizome_received fileA1
|
||||
assert_rhizome_received fileA2
|
||||
|
Loading…
x
Reference in New Issue
Block a user