aboutsummaryrefslogtreecommitdiff
path: root/src/identity/gnunet-identity.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-05-08 14:54:42 +0200
committerChristian Grothoff <christian@grothoff.org>2019-05-08 14:54:42 +0200
commit1b80ff9ee79b3fbe2028a8c22a01e45e9131cda2 (patch)
tree742185e47289bbed654eb641bf8f3d2409ee7976 /src/identity/gnunet-identity.c
parentfba6afbd58e0b37b33850db4b1341dbf9392d1f3 (diff)
downloadgnunet-1b80ff9ee79b3fbe2028a8c22a01e45e9131cda2.tar.gz
gnunet-1b80ff9ee79b3fbe2028a8c22a01e45e9131cda2.zip
make generated ego key available in continuation when creating egos
Diffstat (limited to 'src/identity/gnunet-identity.c')
-rw-r--r--src/identity/gnunet-identity.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index 051f08cd3..583305710 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -51,6 +51,11 @@ static int list;
51static int monitor; 51static int monitor;
52 52
53/** 53/**
54 * Was "verbose" specified?
55 */
56static unsigned int verbose;
57
58/**
54 * -C option 59 * -C option
55 */ 60 */
56static char *create_ego; 61static char *create_ego;
@@ -164,22 +169,37 @@ delete_finished (void *cls,
164 * Creation operation finished. 169 * Creation operation finished.
165 * 170 *
166 * @param cls pointer to operation handle 171 * @param cls pointer to operation handle
172 * @param pk private key of the ego, or NULL on error
167 * @param emsg error message, NULL on success 173 * @param emsg error message, NULL on success
168 */ 174 */
169static void 175static void
170create_finished (void *cls, 176create_finished (void *cls,
177 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk,
171 const char *emsg) 178 const char *emsg)
172{ 179{
173 struct GNUNET_IDENTITY_Operation **op = cls; 180 struct GNUNET_IDENTITY_Operation **op = cls;
174 181
175 *op = NULL; 182 *op = NULL;
176 if (NULL != emsg) 183 if (NULL == pk)
177 { 184 {
178 fprintf (stderr, 185 fprintf (stderr,
179 _("Failed to create ego: %s\n"), 186 _("Failed to create ego: %s\n"),
180 emsg); 187 emsg);
181 global_ret = 1; 188 global_ret = 1;
182 } 189 }
190 else if (verbose)
191 {
192 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
193 char *pubs;
194
195 GNUNET_CRYPTO_ecdsa_key_get_public (pk,
196 &pub);
197 pubs = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pub);
198 fprintf (stdout,
199 "%s\n",
200 pubs);
201 GNUNET_free (pubs);
202 }
183 test_finished (); 203 test_finished ();
184} 204}
185 205
@@ -383,7 +403,7 @@ main (int argc, char *const *argv)
383 "SUBSYSTEM", 403 "SUBSYSTEM",
384 gettext_noop ("set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)"), 404 gettext_noop ("set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)"),
385 &set_subsystem), 405 &set_subsystem),
386 406 GNUNET_GETOPT_option_verbose (&verbose),
387 GNUNET_GETOPT_OPTION_END 407 GNUNET_GETOPT_OPTION_END
388 }; 408 };
389 int res; 409 int res;