diff options
Diffstat (limited to 'src/abd/gnunet-abd.c')
-rw-r--r-- | src/abd/gnunet-abd.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/abd/gnunet-abd.c b/src/abd/gnunet-abd.c index 17671273c..cf3733abd 100644 --- a/src/abd/gnunet-abd.c +++ b/src/abd/gnunet-abd.c | |||
@@ -544,6 +544,10 @@ static void | |||
544 | store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | 544 | store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
545 | { | 545 | { |
546 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; | 546 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; |
547 | struct GNUNET_ABD_Delegate *cred; | ||
548 | struct GNUNET_IDENTITY_PublicKey zone_pubkey; | ||
549 | char *subject_pubkey_str; | ||
550 | char *zone_pubkey_str; | ||
547 | 551 | ||
548 | el = NULL; | 552 | el = NULL; |
549 | 553 | ||
@@ -562,17 +566,23 @@ store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
562 | if (GNUNET_GNSRECORD_TYPE_DELEGATE == type) | 566 | if (GNUNET_GNSRECORD_TYPE_DELEGATE == type) |
563 | { | 567 | { |
564 | // Parse import | 568 | // Parse import |
565 | struct GNUNET_ABD_Delegate *cred; | ||
566 | cred = GNUNET_ABD_delegate_from_string (import); | 569 | cred = GNUNET_ABD_delegate_from_string (import); |
567 | 570 | ||
571 | if (NULL == cred) | ||
572 | { | ||
573 | fprintf (stderr, | ||
574 | "%s is not a valid credential\n", import); | ||
575 | GNUNET_SCHEDULER_shutdown(); | ||
576 | return; | ||
577 | } | ||
578 | |||
568 | // Get import subject public key string | 579 | // Get import subject public key string |
569 | char *subject_pubkey_str = | 580 | subject_pubkey_str = |
570 | GNUNET_IDENTITY_public_key_to_string (&cred->subject_key); | 581 | GNUNET_IDENTITY_public_key_to_string (&cred->subject_key); |
571 | 582 | ||
572 | // Get zone public key string | 583 | // Get zone public key string |
573 | struct GNUNET_IDENTITY_PublicKey zone_pubkey; | ||
574 | GNUNET_IDENTITY_ego_get_public_key (ego, &zone_pubkey); | 584 | GNUNET_IDENTITY_ego_get_public_key (ego, &zone_pubkey); |
575 | char *zone_pubkey_str = | 585 | zone_pubkey_str = |
576 | GNUNET_IDENTITY_public_key_to_string (&zone_pubkey); | 586 | GNUNET_IDENTITY_public_key_to_string (&zone_pubkey); |
577 | 587 | ||
578 | // Check if the subject key in the signed import matches the zone's key it is issued to | 588 | // Check if the subject key in the signed import matches the zone's key it is issued to |
@@ -580,6 +590,7 @@ store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
580 | { | 590 | { |
581 | fprintf (stderr, | 591 | fprintf (stderr, |
582 | "Import signed delegate does not match this ego's public key.\n"); | 592 | "Import signed delegate does not match this ego's public key.\n"); |
593 | GNUNET_free (cred); | ||
583 | GNUNET_SCHEDULER_shutdown (); | 594 | GNUNET_SCHEDULER_shutdown (); |
584 | return; | 595 | return; |
585 | } | 596 | } |
@@ -691,6 +702,13 @@ sign_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
691 | // work on keys | 702 | // work on keys |
692 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); | 703 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); |
693 | 704 | ||
705 | if (NULL == subject_pubkey_str) | ||
706 | { | ||
707 | fprintf (stderr, | ||
708 | "Subject pubkey not given\n"); | ||
709 | GNUNET_SCHEDULER_shutdown (); | ||
710 | return; | ||
711 | } | ||
694 | if (GNUNET_OK != | 712 | if (GNUNET_OK != |
695 | GNUNET_IDENTITY_public_key_from_string (subject_pubkey_str, | 713 | GNUNET_IDENTITY_public_key_from_string (subject_pubkey_str, |
696 | &subject_pkey)) | 714 | &subject_pkey)) |