diff options
Diffstat (limited to 'src/credential/gnunet-credential.c')
-rw-r--r-- | src/credential/gnunet-credential.c | 412 |
1 files changed, 201 insertions, 211 deletions
diff --git a/src/credential/gnunet-credential.c b/src/credential/gnunet-credential.c index 3d20e7082..55a4653fb 100644 --- a/src/credential/gnunet-credential.c +++ b/src/credential/gnunet-credential.c | |||
@@ -251,22 +251,21 @@ do_timeout (void *cls) | |||
251 | 251 | ||
252 | static void | 252 | static void |
253 | handle_collect_result (void *cls, | 253 | handle_collect_result (void *cls, |
254 | unsigned int d_count, | 254 | unsigned int d_count, |
255 | struct GNUNET_CREDENTIAL_Delegation *dc, | 255 | struct GNUNET_CREDENTIAL_Delegation *dc, |
256 | unsigned int c_count, | 256 | unsigned int c_count, |
257 | struct GNUNET_CREDENTIAL_Credential *cred) | 257 | struct GNUNET_CREDENTIAL_Credential *cred) |
258 | { | 258 | { |
259 | int i; | 259 | int i; |
260 | char* line; | 260 | char *line; |
261 | 261 | ||
262 | verify_request = NULL; | 262 | verify_request = NULL; |
263 | if (NULL != cred) | 263 | if (NULL != cred) |
264 | { | 264 | { |
265 | for (i=0;i<c_count;i++) | 265 | for (i = 0; i < c_count; i++) |
266 | { | 266 | { |
267 | line = GNUNET_CREDENTIAL_credential_to_string (&cred[i]); | 267 | line = GNUNET_CREDENTIAL_credential_to_string (&cred[i]); |
268 | printf ("%s\n", | 268 | printf ("%s\n", line); |
269 | line); | ||
270 | GNUNET_free (line); | 269 | GNUNET_free (line); |
271 | } | 270 | } |
272 | } | 271 | } |
@@ -284,44 +283,48 @@ handle_verify_result (void *cls, | |||
284 | struct GNUNET_CREDENTIAL_Credential *cred) | 283 | struct GNUNET_CREDENTIAL_Credential *cred) |
285 | { | 284 | { |
286 | int i; | 285 | int i; |
287 | char* iss_key; | 286 | char *iss_key; |
288 | char* sub_key; | 287 | char *sub_key; |
289 | 288 | ||
290 | verify_request = NULL; | 289 | verify_request = NULL; |
291 | if (NULL == cred) | 290 | if (NULL == cred) |
292 | printf ("Failed.\n"); | 291 | printf ("Failed.\n"); |
293 | else | 292 | else |
294 | { | 293 | { |
295 | printf("Delegation Chain:\n"); | 294 | printf ("Delegation Chain:\n"); |
296 | for (i=0;i<d_count;i++) | 295 | for (i = 0; i < d_count; i++) |
297 | { | 296 | { |
298 | iss_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dc[i].issuer_key); | 297 | iss_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dc[i].issuer_key); |
299 | sub_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dc[i].subject_key); | 298 | sub_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dc[i].subject_key); |
300 | 299 | ||
301 | if (0 != dc[i].subject_attribute_len) | 300 | if (0 != dc[i].subject_attribute_len) |
302 | { | 301 | { |
303 | printf ("(%d) %s.%s <- %s.%s\n", i, | 302 | printf ("(%d) %s.%s <- %s.%s\n", |
304 | iss_key, dc[i].issuer_attribute, | 303 | i, |
305 | sub_key, dc[i].subject_attribute); | 304 | iss_key, |
306 | } else { | 305 | dc[i].issuer_attribute, |
307 | printf ("(%d) %s.%s <- %s\n", i, | 306 | sub_key, |
308 | iss_key, dc[i].issuer_attribute, | 307 | dc[i].subject_attribute); |
308 | } | ||
309 | else | ||
310 | { | ||
311 | printf ("(%d) %s.%s <- %s\n", | ||
312 | i, | ||
313 | iss_key, | ||
314 | dc[i].issuer_attribute, | ||
309 | sub_key); | 315 | sub_key); |
310 | } | 316 | } |
311 | GNUNET_free (iss_key); | 317 | GNUNET_free (iss_key); |
312 | GNUNET_free (sub_key); | 318 | GNUNET_free (sub_key); |
313 | } | 319 | } |
314 | printf("\nCredentials:\n"); | 320 | printf ("\nCredentials:\n"); |
315 | for (i=0;i<c_count;i++) | 321 | for (i = 0; i < c_count; i++) |
316 | { | 322 | { |
317 | iss_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred[i].issuer_key); | 323 | iss_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred[i].issuer_key); |
318 | sub_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred[i].subject_key); | 324 | sub_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred[i].subject_key); |
319 | printf ("%s.%s <- %s\n", | 325 | printf ("%s.%s <- %s\n", iss_key, cred[i].issuer_attribute, sub_key); |
320 | iss_key, cred[i].issuer_attribute, | ||
321 | sub_key); | ||
322 | GNUNET_free (iss_key); | 326 | GNUNET_free (iss_key); |
323 | GNUNET_free (sub_key); | 327 | GNUNET_free (sub_key); |
324 | |||
325 | } | 328 | } |
326 | printf ("Successful.\n"); | 329 | printf ("Successful.\n"); |
327 | } | 330 | } |
@@ -338,8 +341,7 @@ handle_verify_result (void *cls, | |||
338 | * @param ego an ego known to identity service, or NULL | 341 | * @param ego an ego known to identity service, or NULL |
339 | */ | 342 | */ |
340 | static void | 343 | static void |
341 | identity_cb (void *cls, | 344 | identity_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) |
342 | const struct GNUNET_IDENTITY_Ego *ego) | ||
343 | { | 345 | { |
344 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 346 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; |
345 | struct GNUNET_CREDENTIAL_Credential *cred; | 347 | struct GNUNET_CREDENTIAL_Credential *cred; |
@@ -353,7 +355,7 @@ identity_cb (void *cls, | |||
353 | if (NULL != ego_name) | 355 | if (NULL != ego_name) |
354 | { | 356 | { |
355 | fprintf (stderr, | 357 | fprintf (stderr, |
356 | _("Ego `%s' not known to identity service\n"), | 358 | _ ("Ego `%s' not known to identity service\n"), |
357 | ego_name); | 359 | ego_name); |
358 | } | 360 | } |
359 | GNUNET_SCHEDULER_shutdown (); | 361 | GNUNET_SCHEDULER_shutdown (); |
@@ -362,25 +364,25 @@ identity_cb (void *cls, | |||
362 | 364 | ||
363 | if (GNUNET_YES == collect) | 365 | if (GNUNET_YES == collect) |
364 | { | 366 | { |
365 | 367 | ||
366 | if (GNUNET_OK != | 368 | if (GNUNET_OK != |
367 | GNUNET_CRYPTO_ecdsa_public_key_from_string (issuer_key, | 369 | GNUNET_CRYPTO_ecdsa_public_key_from_string (issuer_key, |
368 | strlen (issuer_key), | 370 | strlen (issuer_key), |
369 | &issuer_pkey)) | 371 | &issuer_pkey)) |
370 | { | 372 | { |
371 | fprintf (stderr, | 373 | fprintf (stderr, |
372 | _("Issuer public key `%s' is not well-formed\n"), | 374 | _ ("Issuer public key `%s' is not well-formed\n"), |
373 | issuer_key); | 375 | issuer_key); |
374 | GNUNET_SCHEDULER_shutdown (); | 376 | GNUNET_SCHEDULER_shutdown (); |
375 | } | 377 | } |
376 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); | 378 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); |
377 | 379 | ||
378 | collect_request = GNUNET_CREDENTIAL_collect(credential, | 380 | collect_request = GNUNET_CREDENTIAL_collect (credential, |
379 | &issuer_pkey, | 381 | &issuer_pkey, |
380 | issuer_attr, //TODO argument | 382 | issuer_attr, //TODO argument |
381 | privkey, | 383 | privkey, |
382 | &handle_collect_result, | 384 | &handle_collect_result, |
383 | NULL); | 385 | NULL); |
384 | return; | 386 | return; |
385 | } | 387 | } |
386 | 388 | ||
@@ -388,20 +390,19 @@ identity_cb (void *cls, | |||
388 | 390 | ||
389 | if (NULL == expiration) | 391 | if (NULL == expiration) |
390 | { | 392 | { |
391 | fprintf (stderr, | 393 | fprintf (stderr, "Please specify a TTL\n"); |
392 | "Please specify a TTL\n"); | ||
393 | GNUNET_SCHEDULER_shutdown (); | 394 | GNUNET_SCHEDULER_shutdown (); |
394 | return; | 395 | return; |
395 | } else if (GNUNET_OK == GNUNET_STRINGS_fancy_time_to_relative (expiration, | 396 | } |
396 | &etime_rel)) | 397 | else if (GNUNET_OK == |
398 | GNUNET_STRINGS_fancy_time_to_relative (expiration, &etime_rel)) | ||
397 | { | 399 | { |
398 | etime_abs = GNUNET_TIME_relative_to_absolute (etime_rel); | 400 | etime_abs = GNUNET_TIME_relative_to_absolute (etime_rel); |
399 | } else if (GNUNET_OK != GNUNET_STRINGS_fancy_time_to_absolute (expiration, | 401 | } |
400 | &etime_abs)) | 402 | else if (GNUNET_OK != |
403 | GNUNET_STRINGS_fancy_time_to_absolute (expiration, &etime_abs)) | ||
401 | { | 404 | { |
402 | fprintf (stderr, | 405 | fprintf (stderr, "%s is not a valid ttl!\n", expiration); |
403 | "%s is not a valid ttl!\n", | ||
404 | expiration); | ||
405 | GNUNET_SCHEDULER_shutdown (); | 406 | GNUNET_SCHEDULER_shutdown (); |
406 | return; | 407 | return; |
407 | } | 408 | } |
@@ -411,9 +412,9 @@ identity_cb (void *cls, | |||
411 | GNUNET_free_non_null (ego_name); | 412 | GNUNET_free_non_null (ego_name); |
412 | ego_name = NULL; | 413 | ego_name = NULL; |
413 | cred = GNUNET_CREDENTIAL_credential_issue (privkey, | 414 | cred = GNUNET_CREDENTIAL_credential_issue (privkey, |
414 | &subject_pkey, | 415 | &subject_pkey, |
415 | issuer_attr, | 416 | issuer_attr, |
416 | &etime_abs); | 417 | &etime_abs); |
417 | 418 | ||
418 | res = GNUNET_CREDENTIAL_credential_to_string (cred); | 419 | res = GNUNET_CREDENTIAL_credential_to_string (cred); |
419 | GNUNET_free (cred); | 420 | GNUNET_free (cred); |
@@ -431,41 +432,37 @@ identity_cb (void *cls, | |||
431 | */ | 432 | */ |
432 | static int | 433 | static int |
433 | parse_expiration (const char *expirationstring, | 434 | parse_expiration (const char *expirationstring, |
434 | int *etime_is_rel, | 435 | int *etime_is_rel, |
435 | uint64_t *etime) | 436 | uint64_t *etime) |
436 | { | 437 | { |
437 | // copied from namestore/gnunet-namestore.c | 438 | // copied from namestore/gnunet-namestore.c |
438 | struct GNUNET_TIME_Relative etime_rel; | 439 | struct GNUNET_TIME_Relative etime_rel; |
439 | struct GNUNET_TIME_Absolute etime_abs; | 440 | struct GNUNET_TIME_Absolute etime_abs; |
440 | 441 | ||
441 | if (0 == strcmp (expirationstring, | 442 | if (0 == strcmp (expirationstring, "never")) |
442 | "never")) | ||
443 | { | 443 | { |
444 | *etime = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; | 444 | *etime = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; |
445 | *etime_is_rel = GNUNET_NO; | 445 | *etime_is_rel = GNUNET_NO; |
446 | return GNUNET_OK; | 446 | return GNUNET_OK; |
447 | } | 447 | } |
448 | if (GNUNET_OK == | 448 | if (GNUNET_OK == |
449 | GNUNET_STRINGS_fancy_time_to_relative (expirationstring, | 449 | GNUNET_STRINGS_fancy_time_to_relative (expirationstring, &etime_rel)) |
450 | &etime_rel)) | ||
451 | { | 450 | { |
452 | *etime_is_rel = GNUNET_YES; | 451 | *etime_is_rel = GNUNET_YES; |
453 | *etime = etime_rel.rel_value_us; | 452 | *etime = etime_rel.rel_value_us; |
454 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 453 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
455 | "Storing record with relative expiration time of %s\n", | 454 | "Storing record with relative expiration time of %s\n", |
456 | GNUNET_STRINGS_relative_time_to_string (etime_rel, | 455 | GNUNET_STRINGS_relative_time_to_string (etime_rel, GNUNET_NO)); |
457 | GNUNET_NO)); | ||
458 | return GNUNET_OK; | 456 | return GNUNET_OK; |
459 | } | 457 | } |
460 | if (GNUNET_OK == | 458 | if (GNUNET_OK == |
461 | GNUNET_STRINGS_fancy_time_to_absolute (expirationstring, | 459 | GNUNET_STRINGS_fancy_time_to_absolute (expirationstring, &etime_abs)) |
462 | &etime_abs)) | ||
463 | { | 460 | { |
464 | *etime_is_rel = GNUNET_NO; | 461 | *etime_is_rel = GNUNET_NO; |
465 | *etime = etime_abs.abs_value_us; | 462 | *etime = etime_abs.abs_value_us; |
466 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 463 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
467 | "Storing record with absolute expiration time of %s\n", | 464 | "Storing record with absolute expiration time of %s\n", |
468 | GNUNET_STRINGS_absolute_time_to_string (etime_abs)); | 465 | GNUNET_STRINGS_absolute_time_to_string (etime_abs)); |
469 | return GNUNET_OK; | 466 | return GNUNET_OK; |
470 | } | 467 | } |
471 | return GNUNET_SYSERR; | 468 | return GNUNET_SYSERR; |
@@ -477,14 +474,12 @@ parse_expiration (const char *expirationstring, | |||
477 | static void | 474 | static void |
478 | error_cb (void *cls) | 475 | error_cb (void *cls) |
479 | { | 476 | { |
480 | fprintf(stderr, "Error occured during lookup, shutting down.\n"); | 477 | fprintf (stderr, "Error occured during lookup, shutting down.\n"); |
481 | GNUNET_SCHEDULER_shutdown (); | 478 | GNUNET_SCHEDULER_shutdown (); |
482 | return; | 479 | return; |
483 | } | 480 | } |
484 | static void | 481 | static void |
485 | add_continuation (void *cls, | 482 | add_continuation (void *cls, int32_t success, const char *emsg) |
486 | int32_t success, | ||
487 | const char *emsg) | ||
488 | { | 483 | { |
489 | // TODO what does that do, can I somehow parse an empty callback on success or do I have to set the qe* to NULL? | 484 | // TODO what does that do, can I somehow parse an empty callback on success or do I have to set the qe* to NULL? |
490 | struct GNUNET_NAMESTORE_QueueEntry **qe = cls; | 485 | struct GNUNET_NAMESTORE_QueueEntry **qe = cls; |
@@ -495,18 +490,16 @@ add_continuation (void *cls, | |||
495 | 490 | ||
496 | static void | 491 | static void |
497 | get_existing_record (void *cls, | 492 | get_existing_record (void *cls, |
498 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 493 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
499 | const char *rec_name, | 494 | const char *rec_name, |
500 | unsigned int rd_count, | 495 | unsigned int rd_count, |
501 | const struct GNUNET_GNSRECORD_Data *rd) | 496 | const struct GNUNET_GNSRECORD_Data *rd) |
502 | { | 497 | { |
503 | struct GNUNET_GNSRECORD_Data rdn[rd_count + 1]; | 498 | struct GNUNET_GNSRECORD_Data rdn[rd_count + 1]; |
504 | struct GNUNET_GNSRECORD_Data *rde; | 499 | struct GNUNET_GNSRECORD_Data *rde; |
505 | 500 | ||
506 | memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data)); | 501 | memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data)); |
507 | GNUNET_memcpy (&rdn[1], | 502 | GNUNET_memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data)); |
508 | rd, | ||
509 | rd_count * sizeof (struct GNUNET_GNSRECORD_Data)); | ||
510 | rde = &rdn[0]; | 503 | rde = &rdn[0]; |
511 | rde->data = data; | 504 | rde->data = data; |
512 | rde->data_size = data_size; | 505 | rde->data_size = data_size; |
@@ -523,29 +516,28 @@ get_existing_record (void *cls, | |||
523 | rde->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; | 516 | rde->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; |
524 | GNUNET_assert (NULL != rec_name); | 517 | GNUNET_assert (NULL != rec_name); |
525 | add_qe = GNUNET_NAMESTORE_records_store (ns, | 518 | add_qe = GNUNET_NAMESTORE_records_store (ns, |
526 | &zone_pkey, | 519 | &zone_pkey, |
527 | rec_name, | 520 | rec_name, |
528 | rd_count + 1, | 521 | rd_count + 1, |
529 | rde, | 522 | rde, |
530 | &add_continuation, | 523 | &add_continuation, |
531 | &add_qe); | 524 | &add_qe); |
532 | 525 | ||
533 | return; | 526 | return; |
534 | } | 527 | } |
535 | 528 | ||
536 | static void | 529 | static void |
537 | store_cb (void *cls, | 530 | store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) |
538 | const struct GNUNET_IDENTITY_Ego *ego) | ||
539 | { | 531 | { |
540 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; | 532 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; |
541 | 533 | ||
542 | el = NULL; | 534 | el = NULL; |
543 | 535 | ||
544 | ns = GNUNET_NAMESTORE_connect (cfg); | 536 | ns = GNUNET_NAMESTORE_connect (cfg); |
545 | if (NULL == ns) | 537 | if (NULL == ns) |
546 | { | 538 | { |
547 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 539 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
548 | _("Failed to connect to namestore\n")); | 540 | _ ("Failed to connect to namestore\n")); |
549 | GNUNET_SCHEDULER_shutdown (); | 541 | GNUNET_SCHEDULER_shutdown (); |
550 | return; | 542 | return; |
551 | } | 543 | } |
@@ -554,23 +546,27 @@ store_cb (void *cls, | |||
554 | zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego); | 546 | zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego); |
555 | 547 | ||
556 | // TODO maybe dont have to set subject, if only used in if/else can use import here instead!! | 548 | // TODO maybe dont have to set subject, if only used in if/else can use import here instead!! |
557 | if( GNUNET_GNSRECORD_TYPE_DELEGATE == type){ | 549 | if (GNUNET_GNSRECORD_TYPE_DELEGATE == type) |
550 | { | ||
558 | // Parse import | 551 | // Parse import |
559 | struct GNUNET_CREDENTIAL_Delegate *cred; | 552 | struct GNUNET_CREDENTIAL_Delegate *cred; |
560 | cred = GNUNET_CREDENTIAL_delegate_from_string (import); | 553 | cred = GNUNET_CREDENTIAL_delegate_from_string (import); |
561 | 554 | ||
562 | // Get import subject public key string | 555 | // Get import subject public key string |
563 | char *subject_pubkey_str = GNUNET_CRYPTO_ecdsa_public_key_to_string(&cred->subject_key); | 556 | char *subject_pubkey_str = |
557 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred->subject_key); | ||
564 | 558 | ||
565 | // Get zone public key string | 559 | // Get zone public key string |
566 | struct GNUNET_CRYPTO_EcdsaPublicKey zone_pubkey; | 560 | struct GNUNET_CRYPTO_EcdsaPublicKey zone_pubkey; |
567 | GNUNET_IDENTITY_ego_get_public_key (ego, &zone_pubkey); | 561 | GNUNET_IDENTITY_ego_get_public_key (ego, &zone_pubkey); |
568 | char *zone_pubkey_str = GNUNET_CRYPTO_ecdsa_public_key_to_string(&zone_pubkey); | 562 | char *zone_pubkey_str = |
563 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&zone_pubkey); | ||
569 | 564 | ||
570 | // Check if the subject key in the signed import matches the zone's key it is issued to | 565 | // Check if the subject key in the signed import matches the zone's key it is issued to |
571 | if(strcmp(zone_pubkey_str, subject_pubkey_str) != 0) | 566 | if (strcmp (zone_pubkey_str, subject_pubkey_str) != 0) |
572 | { | 567 | { |
573 | fprintf (stderr, "Import signed delegate does not match this ego's public key.\n"); | 568 | fprintf (stderr, |
569 | "Import signed delegate does not match this ego's public key.\n"); | ||
574 | GNUNET_SCHEDULER_shutdown (); | 570 | GNUNET_SCHEDULER_shutdown (); |
575 | return; | 571 | return; |
576 | } | 572 | } |
@@ -580,18 +576,19 @@ store_cb (void *cls, | |||
580 | etime_is_rel = GNUNET_NO; | 576 | etime_is_rel = GNUNET_NO; |
581 | 577 | ||
582 | // Prepare the data to be store in the record | 578 | // Prepare the data to be store in the record |
583 | data_size = GNUNET_CREDENTIAL_delegate_serialize (cred, (char **)&data); | 579 | data_size = GNUNET_CREDENTIAL_delegate_serialize (cred, (char **) &data); |
584 | GNUNET_free(cred); | 580 | GNUNET_free (cred); |
585 | } else { | 581 | } |
582 | else | ||
583 | { | ||
586 | // For all other types e.g. GNUNET_GNSRECORD_TYPE_ATTRIBUTE | 584 | // For all other types e.g. GNUNET_GNSRECORD_TYPE_ATTRIBUTE |
587 | if (GNUNET_OK != GNUNET_GNSRECORD_string_to_value (type, | 585 | if (GNUNET_OK != |
588 | subject, | 586 | GNUNET_GNSRECORD_string_to_value (type, subject, &data, &data_size)) |
589 | &data, | ||
590 | &data_size)) | ||
591 | { | 587 | { |
592 | fprintf (stderr, "Value `%s' invalid for record type `%s'\n", | 588 | fprintf (stderr, |
593 | subject, | 589 | "Value `%s' invalid for record type `%s'\n", |
594 | typestring); | 590 | subject, |
591 | typestring); | ||
595 | GNUNET_SCHEDULER_shutdown (); | 592 | GNUNET_SCHEDULER_shutdown (); |
596 | return; | 593 | return; |
597 | } | 594 | } |
@@ -603,12 +600,9 @@ store_cb (void *cls, | |||
603 | GNUNET_SCHEDULER_shutdown (); | 600 | GNUNET_SCHEDULER_shutdown (); |
604 | return; | 601 | return; |
605 | } | 602 | } |
606 | if (GNUNET_OK != parse_expiration (expiration, | 603 | if (GNUNET_OK != parse_expiration (expiration, &etime_is_rel, &etime)) |
607 | &etime_is_rel, | ||
608 | &etime)) | ||
609 | { | 604 | { |
610 | fprintf (stderr, "Invalid time format `%s'\n", | 605 | fprintf (stderr, "Invalid time format `%s'\n", expiration); |
611 | expiration); | ||
612 | GNUNET_SCHEDULER_shutdown (); | 606 | GNUNET_SCHEDULER_shutdown (); |
613 | return; | 607 | return; |
614 | } | 608 | } |
@@ -616,18 +610,17 @@ store_cb (void *cls, | |||
616 | 610 | ||
617 | // Start lookup | 611 | // Start lookup |
618 | add_qe = GNUNET_NAMESTORE_records_lookup (ns, | 612 | add_qe = GNUNET_NAMESTORE_records_lookup (ns, |
619 | &zone_pkey, | 613 | &zone_pkey, |
620 | record_label, | 614 | record_label, |
621 | &error_cb, | 615 | &error_cb, |
622 | NULL, | 616 | NULL, |
623 | &get_existing_record, | 617 | &get_existing_record, |
624 | NULL); | 618 | NULL); |
625 | return; | 619 | return; |
626 | } | 620 | } |
627 | 621 | ||
628 | static void | 622 | static void |
629 | sign_cb (void *cls, | 623 | sign_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) |
630 | const struct GNUNET_IDENTITY_Ego *ego) | ||
631 | { | 624 | { |
632 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 625 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; |
633 | struct GNUNET_CREDENTIAL_Delegate *dele; | 626 | struct GNUNET_CREDENTIAL_Delegate *dele; |
@@ -642,9 +635,13 @@ sign_cb (void *cls, | |||
642 | fprintf (stderr, "Please specify a TTL\n"); | 635 | fprintf (stderr, "Please specify a TTL\n"); |
643 | GNUNET_SCHEDULER_shutdown (); | 636 | GNUNET_SCHEDULER_shutdown (); |
644 | return; | 637 | return; |
645 | } else if (GNUNET_OK != GNUNET_STRINGS_fancy_time_to_absolute (expiration, &etime_abs)) | 638 | } |
639 | else if (GNUNET_OK != | ||
640 | GNUNET_STRINGS_fancy_time_to_absolute (expiration, &etime_abs)) | ||
646 | { | 641 | { |
647 | fprintf (stderr, "%s is not a valid ttl! Only absolute times are accepted!\n", expiration); | 642 | fprintf (stderr, |
643 | "%s is not a valid ttl! Only absolute times are accepted!\n", | ||
644 | expiration); | ||
648 | GNUNET_SCHEDULER_shutdown (); | 645 | GNUNET_SCHEDULER_shutdown (); |
649 | return; | 646 | return; |
650 | } | 647 | } |
@@ -656,17 +653,19 @@ sign_cb (void *cls, | |||
656 | 653 | ||
657 | // Subject Public Key | 654 | // Subject Public Key |
658 | token = strtok (subject, " "); | 655 | token = strtok (subject, " "); |
659 | if (key_length == strlen(token)) | 656 | if (key_length == strlen (token)) |
660 | { | 657 | { |
661 | subject_pubkey_str = token; | 658 | subject_pubkey_str = token; |
662 | } else { | 659 | } |
663 | fprintf (stderr, "Key error, wrong length: %ld!\n", strlen(token)); | 660 | else |
661 | { | ||
662 | fprintf (stderr, "Key error, wrong length: %ld!\n", strlen (token)); | ||
664 | GNUNET_SCHEDULER_shutdown (); | 663 | GNUNET_SCHEDULER_shutdown (); |
665 | return; | 664 | return; |
666 | } | 665 | } |
667 | // Subject Attribute(s) | 666 | // Subject Attribute(s) |
668 | token = strtok (NULL, " "); | 667 | token = strtok (NULL, " "); |
669 | if(NULL != token) | 668 | if (NULL != token) |
670 | { | 669 | { |
671 | subject_attr = token; | 670 | subject_attr = token; |
672 | } | 671 | } |
@@ -674,21 +673,24 @@ sign_cb (void *cls, | |||
674 | // work on keys | 673 | // work on keys |
675 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); | 674 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); |
676 | 675 | ||
677 | if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_public_key_from_string (subject_pubkey_str, | 676 | if (GNUNET_OK != |
677 | GNUNET_CRYPTO_ecdsa_public_key_from_string (subject_pubkey_str, | ||
678 | strlen (subject_pubkey_str), | 678 | strlen (subject_pubkey_str), |
679 | &subject_pkey)) | 679 | &subject_pkey)) |
680 | { | 680 | { |
681 | fprintf (stderr, "Subject public key `%s' is not well-formed\n", subject_pubkey_str); | 681 | fprintf (stderr, |
682 | "Subject public key `%s' is not well-formed\n", | ||
683 | subject_pubkey_str); | ||
682 | GNUNET_SCHEDULER_shutdown (); | 684 | GNUNET_SCHEDULER_shutdown (); |
683 | return; | 685 | return; |
684 | } | 686 | } |
685 | 687 | ||
686 | // Sign delegate | 688 | // Sign delegate |
687 | dele = GNUNET_CREDENTIAL_delegate_issue (privkey, | 689 | dele = GNUNET_CREDENTIAL_delegate_issue (privkey, |
688 | &subject_pkey, | 690 | &subject_pkey, |
689 | issuer_attr, | 691 | issuer_attr, |
690 | subject_attr, | 692 | subject_attr, |
691 | &etime_abs); | 693 | &etime_abs); |
692 | res = GNUNET_CREDENTIAL_delegate_to_string (dele); | 694 | res = GNUNET_CREDENTIAL_delegate_to_string (dele); |
693 | GNUNET_free (dele); | 695 | GNUNET_free (dele); |
694 | printf ("%s\n", res); | 696 | printf ("%s\n", res); |
@@ -715,18 +717,20 @@ run (void *cls, | |||
715 | { | 717 | { |
716 | cfg = c; | 718 | cfg = c; |
717 | 719 | ||
718 | tt = GNUNET_SCHEDULER_add_delayed (timeout, | 720 | tt = GNUNET_SCHEDULER_add_delayed (timeout, &do_timeout, NULL); |
719 | &do_timeout, NULL); | ||
720 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); | 721 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); |
721 | 722 | ||
722 | // Check relevant cmdline parameters | 723 | // Check relevant cmdline parameters |
723 | if (GNUNET_YES == create_is) { | 724 | if (GNUNET_YES == create_is) |
724 | if (NULL == ego_name) { | 725 | { |
726 | if (NULL == ego_name) | ||
727 | { | ||
725 | fprintf (stderr, "Missing option '-ego'\n"); | 728 | fprintf (stderr, "Missing option '-ego'\n"); |
726 | GNUNET_SCHEDULER_shutdown (); | 729 | GNUNET_SCHEDULER_shutdown (); |
727 | return; | 730 | return; |
728 | } | 731 | } |
729 | if (NULL == issuer_attr) { | 732 | if (NULL == issuer_attr) |
733 | { | ||
730 | fprintf (stderr, "Missing option '-attribute' for issuer attribute\n"); | 734 | fprintf (stderr, "Missing option '-attribute' for issuer attribute\n"); |
731 | GNUNET_SCHEDULER_shutdown (); | 735 | GNUNET_SCHEDULER_shutdown (); |
732 | return; | 736 | return; |
@@ -741,16 +745,15 @@ run (void *cls, | |||
741 | // Lookup ego, on success call store_cb and store as ATTRIBUTE type | 745 | // Lookup ego, on success call store_cb and store as ATTRIBUTE type |
742 | type = GNUNET_GNSRECORD_TYPE_ATTRIBUTE; | 746 | type = GNUNET_GNSRECORD_TYPE_ATTRIBUTE; |
743 | record_label = issuer_attr; | 747 | record_label = issuer_attr; |
744 | el = GNUNET_IDENTITY_ego_lookup (cfg, | 748 | el = GNUNET_IDENTITY_ego_lookup (cfg, ego_name, &store_cb, (void *) cfg); |
745 | ego_name, | ||
746 | &store_cb, | ||
747 | (void *) cfg); | ||
748 | return; | 749 | return; |
749 | } | 750 | } |
750 | 751 | ||
751 | if (GNUNET_YES == create_ss) { | 752 | if (GNUNET_YES == create_ss) |
753 | { | ||
752 | // check if signed parameter has been passed in cmd line call | 754 | // check if signed parameter has been passed in cmd line call |
753 | if (NULL == import) { | 755 | if (NULL == import) |
756 | { | ||
754 | fprintf (stderr, "'import' required\n"); | 757 | fprintf (stderr, "'import' required\n"); |
755 | GNUNET_SCHEDULER_shutdown (); | 758 | GNUNET_SCHEDULER_shutdown (); |
756 | return; | 759 | return; |
@@ -759,16 +762,15 @@ run (void *cls, | |||
759 | type = GNUNET_GNSRECORD_TYPE_DELEGATE; | 762 | type = GNUNET_GNSRECORD_TYPE_DELEGATE; |
760 | record_label = GNUNET_GNS_EMPTY_LABEL_AT; | 763 | record_label = GNUNET_GNS_EMPTY_LABEL_AT; |
761 | // Store subject side | 764 | // Store subject side |
762 | el = GNUNET_IDENTITY_ego_lookup (cfg, | 765 | el = GNUNET_IDENTITY_ego_lookup (cfg, ego_name, &store_cb, (void *) cfg); |
763 | ego_name, | ||
764 | &store_cb, | ||
765 | (void *) cfg); | ||
766 | 766 | ||
767 | return; | 767 | return; |
768 | } | 768 | } |
769 | 769 | ||
770 | if (GNUNET_YES == sign_ss) { | 770 | if (GNUNET_YES == sign_ss) |
771 | if (NULL == ego_name) { | 771 | { |
772 | if (NULL == ego_name) | ||
773 | { | ||
772 | fprintf (stderr, "ego required\n"); | 774 | fprintf (stderr, "ego required\n"); |
773 | GNUNET_SCHEDULER_shutdown (); | 775 | GNUNET_SCHEDULER_shutdown (); |
774 | return; | 776 | return; |
@@ -781,82 +783,68 @@ run (void *cls, | |||
781 | } | 783 | } |
782 | 784 | ||
783 | // lookup ego and call function sign_cb on success | 785 | // lookup ego and call function sign_cb on success |
784 | el = GNUNET_IDENTITY_ego_lookup (cfg, | 786 | el = GNUNET_IDENTITY_ego_lookup (cfg, ego_name, &sign_cb, (void *) cfg); |
785 | ego_name, | ||
786 | &sign_cb, | ||
787 | (void *) cfg); | ||
788 | return; | 787 | return; |
789 | } | 788 | } |
790 | 789 | ||
791 | if (GNUNET_YES == collect) { | 790 | if (GNUNET_YES == collect) |
791 | { | ||
792 | if (NULL == issuer_key) | 792 | if (NULL == issuer_key) |
793 | { | 793 | { |
794 | fprintf (stderr, | 794 | fprintf (stderr, _ ("Issuer public key not well-formed\n")); |
795 | _("Issuer public key not well-formed\n")); | ||
796 | GNUNET_SCHEDULER_shutdown (); | 795 | GNUNET_SCHEDULER_shutdown (); |
797 | return; | 796 | return; |
798 | |||
799 | } | 797 | } |
800 | 798 | ||
801 | credential = GNUNET_CREDENTIAL_connect (cfg); | 799 | credential = GNUNET_CREDENTIAL_connect (cfg); |
802 | 800 | ||
803 | if (NULL == credential) | 801 | if (NULL == credential) |
804 | { | 802 | { |
805 | fprintf (stderr, | 803 | fprintf (stderr, _ ("Failed to connect to CREDENTIAL\n")); |
806 | _("Failed to connect to CREDENTIAL\n")); | ||
807 | GNUNET_SCHEDULER_shutdown (); | 804 | GNUNET_SCHEDULER_shutdown (); |
808 | return; | 805 | return; |
809 | } | 806 | } |
810 | if (NULL == issuer_attr) | 807 | if (NULL == issuer_attr) |
811 | { | 808 | { |
812 | fprintf (stderr, | 809 | fprintf (stderr, _ ("You must provide issuer the attribute\n")); |
813 | _("You must provide issuer the attribute\n")); | ||
814 | GNUNET_SCHEDULER_shutdown (); | 810 | GNUNET_SCHEDULER_shutdown (); |
815 | return; | 811 | return; |
816 | } | 812 | } |
817 | 813 | ||
818 | if (NULL == ego_name) { | 814 | if (NULL == ego_name) |
819 | fprintf (stderr, | 815 | { |
820 | _("ego required\n")); | 816 | fprintf (stderr, _ ("ego required\n")); |
821 | GNUNET_SCHEDULER_shutdown (); | 817 | GNUNET_SCHEDULER_shutdown (); |
822 | return; | 818 | return; |
823 | } | 819 | } |
824 | el = GNUNET_IDENTITY_ego_lookup (cfg, | 820 | el = GNUNET_IDENTITY_ego_lookup (cfg, ego_name, &identity_cb, (void *) cfg); |
825 | ego_name, | ||
826 | &identity_cb, | ||
827 | (void *) cfg); | ||
828 | return; | 821 | return; |
829 | 822 | } | |
830 | } | ||
831 | 823 | ||
832 | if (NULL == subject) | 824 | if (NULL == subject) |
833 | { | 825 | { |
834 | fprintf (stderr, | 826 | fprintf (stderr, _ ("Subject public key needed\n")); |
835 | _("Subject public key needed\n")); | ||
836 | GNUNET_SCHEDULER_shutdown (); | 827 | GNUNET_SCHEDULER_shutdown (); |
837 | return; | 828 | return; |
838 | |||
839 | } | 829 | } |
840 | if (GNUNET_OK != | 830 | if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_public_key_from_string (subject, |
841 | GNUNET_CRYPTO_ecdsa_public_key_from_string (subject, | 831 | strlen (subject), |
842 | strlen (subject), | 832 | &subject_pkey)) |
843 | &subject_pkey)) | ||
844 | { | 833 | { |
845 | fprintf (stderr, | 834 | fprintf (stderr, |
846 | _("Subject public key `%s' is not well-formed\n"), | 835 | _ ("Subject public key `%s' is not well-formed\n"), |
847 | subject); | 836 | subject); |
848 | GNUNET_SCHEDULER_shutdown (); | 837 | GNUNET_SCHEDULER_shutdown (); |
849 | return; | 838 | return; |
850 | } | 839 | } |
851 | 840 | ||
852 | if (GNUNET_YES == verify) { | 841 | if (GNUNET_YES == verify) |
842 | { | ||
853 | if (NULL == issuer_key) | 843 | if (NULL == issuer_key) |
854 | { | 844 | { |
855 | fprintf (stderr, | 845 | fprintf (stderr, _ ("Issuer public key not well-formed\n")); |
856 | _("Issuer public key not well-formed\n")); | ||
857 | GNUNET_SCHEDULER_shutdown (); | 846 | GNUNET_SCHEDULER_shutdown (); |
858 | return; | 847 | return; |
859 | |||
860 | } | 848 | } |
861 | if (GNUNET_OK != | 849 | if (GNUNET_OK != |
862 | GNUNET_CRYPTO_ecdsa_public_key_from_string (issuer_key, | 850 | GNUNET_CRYPTO_ecdsa_public_key_from_string (issuer_key, |
@@ -864,7 +852,7 @@ run (void *cls, | |||
864 | &issuer_pkey)) | 852 | &issuer_pkey)) |
865 | { | 853 | { |
866 | fprintf (stderr, | 854 | fprintf (stderr, |
867 | _("Issuer public key `%s' is not well-formed\n"), | 855 | _ ("Issuer public key `%s' is not well-formed\n"), |
868 | issuer_key); | 856 | issuer_key); |
869 | GNUNET_SCHEDULER_shutdown (); | 857 | GNUNET_SCHEDULER_shutdown (); |
870 | return; | 858 | return; |
@@ -873,15 +861,13 @@ run (void *cls, | |||
873 | 861 | ||
874 | if (NULL == credential) | 862 | if (NULL == credential) |
875 | { | 863 | { |
876 | fprintf (stderr, | 864 | fprintf (stderr, _ ("Failed to connect to CREDENTIAL\n")); |
877 | _("Failed to connect to CREDENTIAL\n")); | ||
878 | GNUNET_SCHEDULER_shutdown (); | 865 | GNUNET_SCHEDULER_shutdown (); |
879 | return; | 866 | return; |
880 | } | 867 | } |
881 | if (NULL == issuer_attr || NULL == subject_credential) | 868 | if (NULL == issuer_attr || NULL == subject_credential) |
882 | { | 869 | { |
883 | fprintf (stderr, | 870 | fprintf (stderr, _ ("You must provide issuer and subject attributes\n")); |
884 | _("You must provide issuer and subject attributes\n")); | ||
885 | GNUNET_SCHEDULER_shutdown (); | 871 | GNUNET_SCHEDULER_shutdown (); |
886 | return; | 872 | return; |
887 | } | 873 | } |
@@ -891,63 +877,62 @@ run (void *cls, | |||
891 | char *tok = strtok (tmp, ","); | 877 | char *tok = strtok (tmp, ","); |
892 | if (NULL == tok) | 878 | if (NULL == tok) |
893 | { | 879 | { |
894 | fprintf (stderr, | 880 | fprintf (stderr, "Invalid subject credentials\n"); |
895 | "Invalid subject credentials\n"); | ||
896 | GNUNET_free (tmp); | 881 | GNUNET_free (tmp); |
897 | GNUNET_SCHEDULER_shutdown (); | 882 | GNUNET_SCHEDULER_shutdown (); |
898 | return; | 883 | return; |
899 | } | 884 | } |
900 | int count = 1; | 885 | int count = 1; |
901 | int i; | 886 | int i; |
902 | while (NULL != (tok = strtok(NULL, ","))) | 887 | while (NULL != (tok = strtok (NULL, ","))) |
903 | count++; | 888 | count++; |
904 | struct GNUNET_CREDENTIAL_Credential credentials[count]; | 889 | struct GNUNET_CREDENTIAL_Credential credentials[count]; |
905 | struct GNUNET_CREDENTIAL_Credential *cred; | 890 | struct GNUNET_CREDENTIAL_Credential *cred; |
906 | GNUNET_free (tmp); | 891 | GNUNET_free (tmp); |
907 | tmp = GNUNET_strdup (subject_credential); | 892 | tmp = GNUNET_strdup (subject_credential); |
908 | tok = strtok (tmp, ","); | 893 | tok = strtok (tmp, ","); |
909 | for (i=0;i<count;i++) | 894 | for (i = 0; i < count; i++) |
910 | { | 895 | { |
911 | cred = GNUNET_CREDENTIAL_credential_from_string (tok); | 896 | cred = GNUNET_CREDENTIAL_credential_from_string (tok); |
912 | GNUNET_memcpy (&credentials[i], | 897 | GNUNET_memcpy (&credentials[i], |
913 | cred, | 898 | cred, |
914 | sizeof (struct GNUNET_CREDENTIAL_Credential)); | 899 | sizeof (struct GNUNET_CREDENTIAL_Credential)); |
915 | credentials[i].issuer_attribute = GNUNET_strdup (cred->issuer_attribute); | 900 | credentials[i].issuer_attribute = GNUNET_strdup (cred->issuer_attribute); |
916 | tok = strtok(NULL, ","); | 901 | tok = strtok (NULL, ","); |
917 | GNUNET_free (cred); | 902 | GNUNET_free (cred); |
918 | } | 903 | } |
919 | 904 | ||
920 | verify_request = GNUNET_CREDENTIAL_verify(credential, | 905 | verify_request = GNUNET_CREDENTIAL_verify (credential, |
921 | &issuer_pkey, | 906 | &issuer_pkey, |
922 | issuer_attr, //TODO argument | 907 | issuer_attr, //TODO argument |
923 | &subject_pkey, | 908 | &subject_pkey, |
924 | count, | 909 | count, |
925 | credentials, | 910 | credentials, |
926 | &handle_verify_result, | 911 | &handle_verify_result, |
927 | NULL); | 912 | NULL); |
928 | for (i=0;i<count;i++) | 913 | for (i = 0; i < count; i++) |
929 | { | 914 | { |
930 | GNUNET_free ((char*)credentials[i].issuer_attribute); | 915 | GNUNET_free ((char *) credentials[i].issuer_attribute); |
931 | } | 916 | } |
932 | GNUNET_free (tmp); | 917 | GNUNET_free (tmp); |
933 | } else if (GNUNET_YES == create_cred) { | 918 | } |
919 | else if (GNUNET_YES == create_cred) | ||
920 | { | ||
934 | if (NULL == ego_name) | 921 | if (NULL == ego_name) |
935 | { | 922 | { |
936 | fprintf (stderr, | 923 | fprintf (stderr, _ ("Issuer ego required\n")); |
937 | _("Issuer ego required\n")); | ||
938 | GNUNET_SCHEDULER_shutdown (); | 924 | GNUNET_SCHEDULER_shutdown (); |
939 | return; | 925 | return; |
940 | |||
941 | } | 926 | } |
942 | el = GNUNET_IDENTITY_ego_lookup (cfg, | 927 | el = GNUNET_IDENTITY_ego_lookup (cfg, ego_name, &identity_cb, (void *) cfg); |
943 | ego_name, | ||
944 | &identity_cb, | ||
945 | (void *) cfg); | ||
946 | 928 | ||
947 | return; | 929 | return; |
948 | } else { | 930 | } |
931 | else | ||
932 | { | ||
949 | fprintf (stderr, | 933 | fprintf (stderr, |
950 | _("Please specify name to lookup, subject key and issuer key!\n")); | 934 | _ ( |
935 | "Please specify name to lookup, subject key and issuer key!\n")); | ||
951 | GNUNET_SCHEDULER_shutdown (); | 936 | GNUNET_SCHEDULER_shutdown (); |
952 | } | 937 | } |
953 | return; | 938 | return; |
@@ -976,7 +961,8 @@ main (int argc, char *const *argv) | |||
976 | GNUNET_GETOPT_option_string ('s', | 961 | GNUNET_GETOPT_option_string ('s', |
977 | "subject", | 962 | "subject", |
978 | "PKEY", | 963 | "PKEY", |
979 | gettext_noop ("The public key of the subject to lookup the credential for, or for issuer side storage: subject and its attributes"), | 964 | gettext_noop ("The public key of the subject to lookup the" |
965 | "credential for, or for issuer side storage: subject and its attributes"), | ||
980 | &subject), | 966 | &subject), |
981 | GNUNET_GETOPT_option_string ('b', | 967 | GNUNET_GETOPT_option_string ('b', |
982 | "credential", | 968 | "credential", |
@@ -1001,7 +987,8 @@ main (int argc, char *const *argv) | |||
1001 | GNUNET_GETOPT_option_string ('T', | 987 | GNUNET_GETOPT_option_string ('T', |
1002 | "ttl", | 988 | "ttl", |
1003 | "EXP", | 989 | "EXP", |
1004 | gettext_noop ("The time to live for the credential. e.g. 5m, 6h, \"1990-12-30 12:00:00\""), | 990 | gettext_noop ("The time to live for the credential." |
991 | "e.g. 5m, 6h, \"1990-12-30 12:00:00\""), | ||
1005 | &expiration), | 992 | &expiration), |
1006 | GNUNET_GETOPT_option_flag ('g', | 993 | GNUNET_GETOPT_option_flag ('g', |
1007 | "collect", | 994 | "collect", |
@@ -1033,13 +1020,16 @@ main (int argc, char *const *argv) | |||
1033 | return 2; | 1020 | return 2; |
1034 | 1021 | ||
1035 | GNUNET_log_setup ("gnunet-credential", "WARNING", NULL); | 1022 | GNUNET_log_setup ("gnunet-credential", "WARNING", NULL); |
1036 | ret = | 1023 | ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc, |
1037 | (GNUNET_OK == | 1024 | argv, |
1038 | GNUNET_PROGRAM_run (argc, argv, "gnunet-credential", | 1025 | "gnunet-credential", |
1039 | _("GNUnet credential resolver tool"), | 1026 | _ ("GNUnet credential resolver tool"), |
1040 | options, | 1027 | options, |
1041 | &run, NULL)) ? 0 : 1; | 1028 | &run, |
1042 | GNUNET_free ((void*) argv); | 1029 | NULL)) |
1030 | ? 0 | ||
1031 | : 1; | ||
1032 | GNUNET_free ((void *) argv); | ||
1043 | return ret; | 1033 | return ret; |
1044 | } | 1034 | } |
1045 | 1035 | ||