From 4de6622c685cce4e7868345de7e39ccd00f5355f Mon Sep 17 00:00:00 2001 From: gardners Date: Sat, 14 Apr 2012 02:44:41 +0930 Subject: [PATCH] Fixed bug in "keyring add" command. Added opening of keyring in "mdp ping" command. MDP ping now works with the new keyring framework (but authcryption is not being attempted it seems). --- commandline.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commandline.c b/commandline.c index 631d9815..df96b80a 100644 --- a/commandline.c +++ b/commandline.c @@ -351,6 +351,8 @@ int app_mdp_ping(int argc,char **argv,struct command_line_option *o) { char *sid=cli_arg(argc,argv,o,"SID|broadcast","broadcast"); + if (!keyring) keyring=keyring_open_with_pins(""); + /* MDP frames consist of: destination SID (32 bytes) destination port (4 bytes) @@ -736,13 +738,13 @@ int app_keyring_add(int argc, char **argv, struct command_line_option *o) if (!k) { fprintf(stderr,"keyring add:Failed to create/open keyring file\n"); return -1; } - if (keyring_create_identity(k,k->contexts[0],(char *)pin)) + if (keyring_create_identity(k,k->contexts[0],(char *)pin)==NULL) { - fprintf(stderr,"Could not create new identity\n"); + fprintf(stderr,"Could not create new identity (keyring_create_identity() failed)\n"); return -1; } if (keyring_commit(k)) { - fprintf(stderr,"Could not write new identity\n"); + fprintf(stderr,"Could not write new identity (keyring_commit() failed)\n"); return -1; } keyring_free(k);