diff options
author | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-01-08 07:58:33 +0100 |
---|---|---|
committer | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-01-08 07:58:33 +0100 |
commit | 7ad94d1427d304483e9bf1cf1d12065f8e41d712 (patch) | |
tree | 573016db50a53b71487101245ffcaf38aab5a92a | |
parent | cc5bb40d158b207c384ae98c868573771735f10a (diff) | |
download | gnunet-7ad94d1427d304483e9bf1cf1d12065f8e41d712.tar.gz gnunet-7ad94d1427d304483e9bf1cf1d12065f8e41d712.zip |
bugfixes
-rw-r--r-- | src/credential/credential_misc.c | 1 | ||||
-rw-r--r-- | src/credential/credential_serialization.c | 1 | ||||
-rw-r--r-- | src/credential/gnunet-credential.c | 7 | ||||
-rw-r--r-- | src/credential/gnunet-service-credential.c | 14 | ||||
-rw-r--r-- | src/credential/plugin_gnsrecord_credential.c | 10 | ||||
-rw-r--r-- | src/credential/plugin_rest_credential.c | 16 | ||||
-rw-r--r-- | src/identity-provider/gnunet-idp.c | 5 | ||||
-rw-r--r-- | src/identity-provider/gnunet-service-identity-provider.c | 65 | ||||
-rw-r--r-- | src/identity-provider/identity_provider_api.c | 21 |
9 files changed, 98 insertions, 42 deletions
diff --git a/src/credential/credential_misc.c b/src/credential/credential_misc.c index c94c33919..2575f1de8 100644 --- a/src/credential/credential_misc.c +++ b/src/credential/credential_misc.c | |||
@@ -149,6 +149,7 @@ GNUNET_CREDENTIAL_credential_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey * | |||
149 | { | 149 | { |
150 | GNUNET_break (0); | 150 | GNUNET_break (0); |
151 | GNUNET_free (crd); | 151 | GNUNET_free (crd); |
152 | GNUNET_free (cred); | ||
152 | return NULL; | 153 | return NULL; |
153 | } | 154 | } |
154 | cred->signature = crd->signature; | 155 | cred->signature = crd->signature; |
diff --git a/src/credential/credential_serialization.c b/src/credential/credential_serialization.c index 1d23bb08c..2bbf3bfb8 100644 --- a/src/credential/credential_serialization.c +++ b/src/credential/credential_serialization.c | |||
@@ -279,7 +279,6 @@ GNUNET_CREDENTIAL_delegation_chain_get_size (unsigned int d_count, | |||
279 | ret += dd[i].issuer_attribute_len + dd[i].subject_attribute_len; | 279 | ret += dd[i].issuer_attribute_len + dd[i].subject_attribute_len; |
280 | } | 280 | } |
281 | return ret+GNUNET_CREDENTIAL_credentials_get_size(c_count, cd); | 281 | return ret+GNUNET_CREDENTIAL_credentials_get_size(c_count, cd); |
282 | return ret; | ||
283 | } | 282 | } |
284 | 283 | ||
285 | /** | 284 | /** |
diff --git a/src/credential/gnunet-credential.c b/src/credential/gnunet-credential.c index 03f959b95..b5bcc4d43 100644 --- a/src/credential/gnunet-credential.c +++ b/src/credential/gnunet-credential.c | |||
@@ -371,12 +371,14 @@ run (void *cls, | |||
371 | fprintf (stderr, | 371 | fprintf (stderr, |
372 | _("Failed to connect to CREDENTIAL\n")); | 372 | _("Failed to connect to CREDENTIAL\n")); |
373 | GNUNET_SCHEDULER_shutdown (); | 373 | GNUNET_SCHEDULER_shutdown (); |
374 | return; | ||
374 | } | 375 | } |
375 | if (NULL == issuer_attr) | 376 | if (NULL == issuer_attr) |
376 | { | 377 | { |
377 | fprintf (stderr, | 378 | fprintf (stderr, |
378 | _("You must provide issuer the attribute\n")); | 379 | _("You must provide issuer the attribute\n")); |
379 | GNUNET_SCHEDULER_shutdown (); | 380 | GNUNET_SCHEDULER_shutdown (); |
381 | return; | ||
380 | } | 382 | } |
381 | 383 | ||
382 | if (NULL == ego_name) | 384 | if (NULL == ego_name) |
@@ -432,6 +434,7 @@ run (void *cls, | |||
432 | _("Issuer public key `%s' is not well-formed\n"), | 434 | _("Issuer public key `%s' is not well-formed\n"), |
433 | issuer_key); | 435 | issuer_key); |
434 | GNUNET_SCHEDULER_shutdown (); | 436 | GNUNET_SCHEDULER_shutdown (); |
437 | return; | ||
435 | } | 438 | } |
436 | credential = GNUNET_CREDENTIAL_connect (cfg); | 439 | credential = GNUNET_CREDENTIAL_connect (cfg); |
437 | 440 | ||
@@ -440,12 +443,14 @@ run (void *cls, | |||
440 | fprintf (stderr, | 443 | fprintf (stderr, |
441 | _("Failed to connect to CREDENTIAL\n")); | 444 | _("Failed to connect to CREDENTIAL\n")); |
442 | GNUNET_SCHEDULER_shutdown (); | 445 | GNUNET_SCHEDULER_shutdown (); |
446 | return; | ||
443 | } | 447 | } |
444 | if (NULL == issuer_attr || NULL == subject_credential) | 448 | if (NULL == issuer_attr || NULL == subject_credential) |
445 | { | 449 | { |
446 | fprintf (stderr, | 450 | fprintf (stderr, |
447 | _("You must provide issuer and subject attributes\n")); | 451 | _("You must provide issuer and subject attributes\n")); |
448 | GNUNET_SCHEDULER_shutdown (); | 452 | GNUNET_SCHEDULER_shutdown (); |
453 | return; | ||
449 | } | 454 | } |
450 | 455 | ||
451 | //Subject credentials are comma separated | 456 | //Subject credentials are comma separated |
@@ -457,6 +462,7 @@ run (void *cls, | |||
457 | "Invalid subject credentials\n"); | 462 | "Invalid subject credentials\n"); |
458 | GNUNET_free (tmp); | 463 | GNUNET_free (tmp); |
459 | GNUNET_SCHEDULER_shutdown (); | 464 | GNUNET_SCHEDULER_shutdown (); |
465 | return; | ||
460 | } | 466 | } |
461 | int count = 1; | 467 | int count = 1; |
462 | int i; | 468 | int i; |
@@ -490,6 +496,7 @@ run (void *cls, | |||
490 | { | 496 | { |
491 | GNUNET_free ((char*)credentials[i].issuer_attribute); | 497 | GNUNET_free ((char*)credentials[i].issuer_attribute); |
492 | } | 498 | } |
499 | GNUNET_free (tmp); | ||
493 | } else if (GNUNET_YES == create_cred) { | 500 | } else if (GNUNET_YES == create_cred) { |
494 | if (NULL == ego_name) | 501 | if (NULL == ego_name) |
495 | { | 502 | { |
diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c index be88839e9..a2c339363 100644 --- a/src/credential/gnunet-service-credential.c +++ b/src/credential/gnunet-service-credential.c | |||
@@ -722,6 +722,12 @@ backward_resolution (void* cls, | |||
722 | strcpy (issuer_attribute_name, | 722 | strcpy (issuer_attribute_name, |
723 | ds_entry->unresolved_attribute_delegation); | 723 | ds_entry->unresolved_attribute_delegation); |
724 | char *next_attr = strtok (issuer_attribute_name, "."); | 724 | char *next_attr = strtok (issuer_attribute_name, "."); |
725 | if (NULL == next_attr) | ||
726 | { | ||
727 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
728 | "Failed to parse next attribute\n"); | ||
729 | continue; | ||
730 | } | ||
725 | GNUNET_asprintf (&lookup_attribute, | 731 | GNUNET_asprintf (&lookup_attribute, |
726 | "%s.gnu", | 732 | "%s.gnu", |
727 | next_attr); | 733 | next_attr); |
@@ -806,7 +812,7 @@ delegation_chain_resolution_start (void* cls) | |||
806 | * Check for attributes from the issuer and follow the chain | 812 | * Check for attributes from the issuer and follow the chain |
807 | * till you get the required subject's attributes | 813 | * till you get the required subject's attributes |
808 | */ | 814 | */ |
809 | char issuer_attribute_name[strlen (vrh->issuer_attribute)]; | 815 | char issuer_attribute_name[strlen (vrh->issuer_attribute) + strlen (".gnu") + 1]; |
810 | strcpy (issuer_attribute_name, | 816 | strcpy (issuer_attribute_name, |
811 | vrh->issuer_attribute); | 817 | vrh->issuer_attribute); |
812 | strcpy (issuer_attribute_name + strlen (vrh->issuer_attribute), | 818 | strcpy (issuer_attribute_name + strlen (vrh->issuer_attribute), |
@@ -889,7 +895,7 @@ handle_verify (void *cls, | |||
889 | vrh->issuer_key = v_msg->issuer_key; | 895 | vrh->issuer_key = v_msg->issuer_key; |
890 | vrh->subject_key = v_msg->subject_key; | 896 | vrh->subject_key = v_msg->subject_key; |
891 | vrh->issuer_attribute = GNUNET_strdup (issuer_attribute); | 897 | vrh->issuer_attribute = GNUNET_strdup (issuer_attribute); |
892 | if (NULL == issuer_attribute) | 898 | if (0 == strlen (issuer_attribute)) |
893 | { | 899 | { |
894 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 900 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
895 | "No issuer attribute provided!\n"); | 901 | "No issuer attribute provided!\n"); |
@@ -1033,7 +1039,7 @@ handle_collect (void *cls, | |||
1033 | &vrh->subject_key); | 1039 | &vrh->subject_key); |
1034 | vrh->issuer_attribute = GNUNET_strdup (issuer_attribute); | 1040 | vrh->issuer_attribute = GNUNET_strdup (issuer_attribute); |
1035 | 1041 | ||
1036 | if (NULL == issuer_attribute) | 1042 | if (0 == strlen (issuer_attribute)) |
1037 | { | 1043 | { |
1038 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1044 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1039 | "No issuer attribute provided!\n"); | 1045 | "No issuer attribute provided!\n"); |
@@ -1076,7 +1082,7 @@ check_collect (void *cls, | |||
1076 | } | 1082 | } |
1077 | attr = (const char *) &c_msg[1]; | 1083 | attr = (const char *) &c_msg[1]; |
1078 | 1084 | ||
1079 | if ( ('\0' != attr[ntohs(c_msg->header.size) - sizeof (struct CollectMessage) - 1]) || | 1085 | if ( ('\0' != attr[msg_size - sizeof (struct CollectMessage) - 1]) || |
1080 | (strlen (attr) > GNUNET_CREDENTIAL_MAX_LENGTH) ) | 1086 | (strlen (attr) > GNUNET_CREDENTIAL_MAX_LENGTH) ) |
1081 | { | 1087 | { |
1082 | GNUNET_break (0); | 1088 | GNUNET_break (0); |
diff --git a/src/credential/plugin_gnsrecord_credential.c b/src/credential/plugin_gnsrecord_credential.c index 342790b7a..ffb2857dc 100644 --- a/src/credential/plugin_gnsrecord_credential.c +++ b/src/credential/plugin_gnsrecord_credential.c | |||
@@ -199,6 +199,13 @@ credential_string_to_value (void *cls, | |||
199 | GNUNET_free (tmp_str); | 199 | GNUNET_free (tmp_str); |
200 | tmp_str = GNUNET_strdup (s); | 200 | tmp_str = GNUNET_strdup (s); |
201 | token = strtok (tmp_str, ","); | 201 | token = strtok (tmp_str, ","); |
202 | if (NULL == token) | ||
203 | { | ||
204 | GNUNET_free (tmp_str); | ||
205 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
206 | "Malformed string %s\n", s); | ||
207 | return GNUNET_SYSERR; | ||
208 | } | ||
202 | struct GNUNET_CREDENTIAL_DelegationSet set[entries]; | 209 | struct GNUNET_CREDENTIAL_DelegationSet set[entries]; |
203 | for (i=0;i<entries;i++) | 210 | for (i=0;i<entries;i++) |
204 | { | 211 | { |
@@ -219,7 +226,10 @@ credential_string_to_value (void *cls, | |||
219 | set); | 226 | set); |
220 | 227 | ||
221 | if (-1 == tmp_data_size) | 228 | if (-1 == tmp_data_size) |
229 | { | ||
230 | GNUNET_free (tmp_str); | ||
222 | return GNUNET_SYSERR; | 231 | return GNUNET_SYSERR; |
232 | } | ||
223 | *data_size += tmp_data_size; | 233 | *data_size += tmp_data_size; |
224 | *data = sets = GNUNET_malloc (*data_size); | 234 | *data = sets = GNUNET_malloc (*data_size); |
225 | GNUNET_CREDENTIAL_delegation_set_serialize (entries, | 235 | GNUNET_CREDENTIAL_delegation_set_serialize (entries, |
diff --git a/src/credential/plugin_rest_credential.c b/src/credential/plugin_rest_credential.c index 480658822..2e43139de 100644 --- a/src/credential/plugin_rest_credential.c +++ b/src/credential/plugin_rest_credential.c | |||
@@ -617,7 +617,6 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
617 | { | 617 | { |
618 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 618 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
619 | "Missing subject\n"); | 619 | "Missing subject\n"); |
620 | GNUNET_free (entity_attr); | ||
621 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 620 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
622 | return; | 621 | return; |
623 | } | 622 | } |
@@ -627,7 +626,6 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
627 | { | 626 | { |
628 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 627 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
629 | "Malformed subject\n"); | 628 | "Malformed subject\n"); |
630 | GNUNET_free (entity_attr); | ||
631 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 629 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
632 | return; | 630 | return; |
633 | } | 631 | } |
@@ -728,7 +726,6 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
728 | { | 726 | { |
729 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 727 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
730 | "Missing subject key\n"); | 728 | "Missing subject key\n"); |
731 | GNUNET_free (entity_attr); | ||
732 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 729 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
733 | return; | 730 | return; |
734 | } | 731 | } |
@@ -738,7 +735,6 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
738 | { | 735 | { |
739 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 736 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
740 | "Malformed subject\n"); | 737 | "Malformed subject\n"); |
741 | GNUNET_free (entity_attr); | ||
742 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 738 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
743 | return; | 739 | return; |
744 | } | 740 | } |
@@ -748,7 +744,6 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
748 | &handle->subject_key)) { | 744 | &handle->subject_key)) { |
749 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 745 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
750 | "Malformed subject key\n"); | 746 | "Malformed subject key\n"); |
751 | GNUNET_free (entity_attr); | ||
752 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 747 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
753 | return; | 748 | return; |
754 | } | 749 | } |
@@ -858,6 +853,7 @@ send_cred_response (struct RequestHandle *handle, | |||
858 | { | 853 | { |
859 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 854 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
860 | "Subject malformed\n"); | 855 | "Subject malformed\n"); |
856 | GNUNET_free (issuer); | ||
861 | return; | 857 | return; |
862 | } | 858 | } |
863 | GNUNET_asprintf (&id, | 859 | GNUNET_asprintf (&id, |
@@ -869,6 +865,8 @@ send_cred_response (struct RequestHandle *handle, | |||
869 | { | 865 | { |
870 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 866 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
871 | "Subject malformed\n"); | 867 | "Subject malformed\n"); |
868 | GNUNET_free (id); | ||
869 | GNUNET_free (issuer); | ||
872 | return; | 870 | return; |
873 | } | 871 | } |
874 | GNUNET_STRINGS_base64_encode ((char*)&cred->signature, | 872 | GNUNET_STRINGS_base64_encode ((char*)&cred->signature, |
@@ -953,6 +951,14 @@ get_cred_issuer_cb (void *cls, | |||
953 | } | 951 | } |
954 | expiration_str = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map, | 952 | expiration_str = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map, |
955 | &key); | 953 | &key); |
954 | if ( NULL == expiration_str ) | ||
955 | { | ||
956 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
957 | "Expiration malformed\n"); | ||
958 | GNUNET_SCHEDULER_add_now (&do_error, handle); | ||
959 | return; | ||
960 | } | ||
961 | |||
956 | if (GNUNET_OK == GNUNET_STRINGS_fancy_time_to_relative (expiration_str, | 962 | if (GNUNET_OK == GNUNET_STRINGS_fancy_time_to_relative (expiration_str, |
957 | &etime_rel)) | 963 | &etime_rel)) |
958 | { | 964 | { |
diff --git a/src/identity-provider/gnunet-idp.c b/src/identity-provider/gnunet-idp.c index 62f07842b..995dd5775 100644 --- a/src/identity-provider/gnunet-idp.c +++ b/src/identity-provider/gnunet-idp.c | |||
@@ -432,8 +432,7 @@ main(int argc, char *const argv[]) | |||
432 | &type_str), | 432 | &type_str), |
433 | GNUNET_GETOPT_OPTION_END | 433 | GNUNET_GETOPT_OPTION_END |
434 | }; | 434 | }; |
435 | GNUNET_PROGRAM_run (argc, argv, "ct", | 435 | return (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "ct", |
436 | "ct", options, | 436 | "ct", options, |
437 | &run, NULL); | 437 | &run, NULL)); |
438 | return ret; | ||
439 | } | 438 | } |
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 711ae76ce..265719d58 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c | |||
@@ -704,7 +704,6 @@ static void | |||
704 | bootstrap_abe_error (void *cls) | 704 | bootstrap_abe_error (void *cls) |
705 | { | 705 | { |
706 | struct AbeBootstrapHandle *abh = cls; | 706 | struct AbeBootstrapHandle *abh = cls; |
707 | GNUNET_free (abh); | ||
708 | abh->proc (abh->proc_cls, NULL); | 707 | abh->proc (abh->proc_cls, NULL); |
709 | GNUNET_free (abh); | 708 | GNUNET_free (abh); |
710 | } | 709 | } |
@@ -1348,7 +1347,18 @@ reenc_next_attribute (struct TicketRevocationHandle *rh) | |||
1348 | rh->abe_key, | 1347 | rh->abe_key, |
1349 | (void**)&enc_buf); | 1348 | (void**)&enc_buf); |
1350 | GNUNET_free (buf); | 1349 | GNUNET_free (buf); |
1350 | if (GNUNET_SYSERR == enc_size) | ||
1351 | { | ||
1352 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1353 | "Unable to re-encrypt with policy %s\n", | ||
1354 | policy); | ||
1355 | GNUNET_free (policy); | ||
1356 | send_revocation_finished (rh, GNUNET_SYSERR); | ||
1357 | cleanup_revoke_ticket_handle (rh); | ||
1358 | return; | ||
1359 | } | ||
1351 | GNUNET_free (policy); | 1360 | GNUNET_free (policy); |
1361 | |||
1352 | rd[0].data_size = enc_size + sizeof (uint32_t); | 1362 | rd[0].data_size = enc_size + sizeof (uint32_t); |
1353 | rd_buf = GNUNET_malloc (rd[0].data_size); | 1363 | rd_buf = GNUNET_malloc (rd[0].data_size); |
1354 | attr_ver = htonl (rh->attrs->list_head->claim->version); | 1364 | attr_ver = htonl (rh->attrs->list_head->claim->version); |
@@ -1501,7 +1511,7 @@ cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle) | |||
1501 | { | 1511 | { |
1502 | if (NULL != handle->key) | 1512 | if (NULL != handle->key) |
1503 | GNUNET_ABE_cpabe_delete_key (handle->key, | 1513 | GNUNET_ABE_cpabe_delete_key (handle->key, |
1504 | GNUNET_YES); | 1514 | GNUNET_YES); |
1505 | if (NULL != handle->attrs) | 1515 | if (NULL != handle->attrs) |
1506 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->attrs); | 1516 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->attrs); |
1507 | GNUNET_free (handle); | 1517 | GNUNET_free (handle); |
@@ -1563,9 +1573,9 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
1563 | { | 1573 | { |
1564 | decrypt_duration = GNUNET_TIME_absolute_get (); | 1574 | decrypt_duration = GNUNET_TIME_absolute_get (); |
1565 | attr_len = GNUNET_ABE_cpabe_decrypt (rd->data + sizeof (uint32_t), | 1575 | attr_len = GNUNET_ABE_cpabe_decrypt (rd->data + sizeof (uint32_t), |
1566 | rd->data_size - sizeof (uint32_t), | 1576 | rd->data_size - sizeof (uint32_t), |
1567 | handle->key, | 1577 | handle->key, |
1568 | (void**)&data); | 1578 | (void**)&data); |
1569 | if (GNUNET_SYSERR != attr_len) | 1579 | if (GNUNET_SYSERR != attr_len) |
1570 | { | 1580 | { |
1571 | GNUNET_STATISTICS_update (stats, | 1581 | GNUNET_STATISTICS_update (stats, |
@@ -1579,7 +1589,7 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
1579 | 1589 | ||
1580 | attr_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); | 1590 | attr_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); |
1581 | attr_le->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize (data, | 1591 | attr_le->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize (data, |
1582 | attr_len); | 1592 | attr_len); |
1583 | attr_le->claim->version = ntohl(*(uint32_t*)rd->data); | 1593 | attr_le->claim->version = ntohl(*(uint32_t*)rd->data); |
1584 | GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head, | 1594 | GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head, |
1585 | handle->attrs->list_tail, | 1595 | handle->attrs->list_tail, |
@@ -1611,7 +1621,7 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
1611 | crm->identity = handle->ticket.identity; | 1621 | crm->identity = handle->ticket.identity; |
1612 | data_tmp = (char *) &crm[1]; | 1622 | data_tmp = (char *) &crm[1]; |
1613 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (handle->attrs, | 1623 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (handle->attrs, |
1614 | data_tmp); | 1624 | data_tmp); |
1615 | GNUNET_MQ_send (handle->client->mq, env); | 1625 | GNUNET_MQ_send (handle->client->mq, env); |
1616 | cleanup_consume_ticket_handle (handle); | 1626 | cleanup_consume_ticket_handle (handle); |
1617 | } | 1627 | } |
@@ -1705,8 +1715,8 @@ process_consume_abe_key (void *cls, uint32_t rd_count, | |||
1705 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1715 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1706 | "Scopes %s\n", scopes); | 1716 | "Scopes %s\n", scopes); |
1707 | handle->key = GNUNET_ABE_cpabe_deserialize_key ((void*)(buf + strlen (scopes) + 1), | 1717 | handle->key = GNUNET_ABE_cpabe_deserialize_key ((void*)(buf + strlen (scopes) + 1), |
1708 | rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) | 1718 | rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) |
1709 | - strlen (scopes) - 1); | 1719 | - strlen (scopes) - 1); |
1710 | 1720 | ||
1711 | for (scope = strtok (scopes, ","); NULL != scope; scope = strtok (NULL, ",")) | 1721 | for (scope = strtok (scopes, ","); NULL != scope; scope = strtok (NULL, ",")) |
1712 | { | 1722 | { |
@@ -1837,7 +1847,7 @@ attr_store_task (void *cls) | |||
1837 | buf = GNUNET_malloc (buf_size); | 1847 | buf = GNUNET_malloc (buf_size); |
1838 | 1848 | ||
1839 | GNUNET_IDENTITY_ATTRIBUTE_serialize (as_handle->claim, | 1849 | GNUNET_IDENTITY_ATTRIBUTE_serialize (as_handle->claim, |
1840 | buf); | 1850 | buf); |
1841 | 1851 | ||
1842 | GNUNET_asprintf (&policy, | 1852 | GNUNET_asprintf (&policy, |
1843 | "%s_%lu", | 1853 | "%s_%lu", |
@@ -1849,10 +1859,21 @@ attr_store_task (void *cls) | |||
1849 | * Encrypt the attribute value and store in namestore | 1859 | * Encrypt the attribute value and store in namestore |
1850 | */ | 1860 | */ |
1851 | enc_size = GNUNET_ABE_cpabe_encrypt (buf, | 1861 | enc_size = GNUNET_ABE_cpabe_encrypt (buf, |
1852 | buf_size, | 1862 | buf_size, |
1853 | policy, //Policy | 1863 | policy, //Policy |
1854 | as_handle->abe_key, | 1864 | as_handle->abe_key, |
1855 | (void**)&enc_buf); | 1865 | (void**)&enc_buf); |
1866 | if (GNUNET_SYSERR == enc_size) | ||
1867 | { | ||
1868 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1869 | "Failed to encrypt with policy %s\n", | ||
1870 | policy); | ||
1871 | cleanup_as_handle (as_handle); | ||
1872 | GNUNET_free (buf); | ||
1873 | GNUNET_free (policy); | ||
1874 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | ||
1875 | return; | ||
1876 | } | ||
1856 | GNUNET_free (buf); | 1877 | GNUNET_free (buf); |
1857 | GNUNET_free (policy); | 1878 | GNUNET_free (policy); |
1858 | rd[0].data_size = enc_size + sizeof (uint32_t); | 1879 | rd[0].data_size = enc_size + sizeof (uint32_t); |
@@ -1921,7 +1942,7 @@ handle_attribute_store_message (void *cls, | |||
1921 | 1942 | ||
1922 | as_handle = GNUNET_new (struct AttributeStoreHandle); | 1943 | as_handle = GNUNET_new (struct AttributeStoreHandle); |
1923 | as_handle->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize ((char*)&sam[1], | 1944 | as_handle->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize ((char*)&sam[1], |
1924 | data_len); | 1945 | data_len); |
1925 | 1946 | ||
1926 | as_handle->r_id = ntohl (sam->id); | 1947 | as_handle->r_id = ntohl (sam->id); |
1927 | as_handle->identity = sam->identity; | 1948 | as_handle->identity = sam->identity; |
@@ -2004,14 +2025,18 @@ attr_iter_cb (void *cls, | |||
2004 | attrs[0] = policy; | 2025 | attrs[0] = policy; |
2005 | attrs[1] = 0; | 2026 | attrs[1] = 0; |
2006 | key = GNUNET_ABE_cpabe_create_key (ai->abe_key, | 2027 | key = GNUNET_ABE_cpabe_create_key (ai->abe_key, |
2007 | attrs); | 2028 | attrs); |
2008 | msg_extra_len = GNUNET_ABE_cpabe_decrypt (rd->data+sizeof (uint32_t), | 2029 | msg_extra_len = GNUNET_ABE_cpabe_decrypt (rd->data+sizeof (uint32_t), |
2009 | rd->data_size-sizeof (uint32_t), | 2030 | rd->data_size-sizeof (uint32_t), |
2010 | key, | 2031 | key, |
2011 | (void**)&attr_ser); | 2032 | (void**)&attr_ser); |
2033 | if (GNUNET_SYSERR == msg_extra_len) { | ||
2034 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it); | ||
2035 | return; | ||
2036 | } | ||
2012 | 2037 | ||
2013 | GNUNET_ABE_cpabe_delete_key (key, | 2038 | GNUNET_ABE_cpabe_delete_key (key, |
2014 | GNUNET_YES); | 2039 | GNUNET_YES); |
2015 | //GNUNET_free (policy); | 2040 | //GNUNET_free (policy); |
2016 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2041 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2017 | "Found attribute: %s\n", label); | 2042 | "Found attribute: %s\n", label); |
diff --git a/src/identity-provider/identity_provider_api.c b/src/identity-provider/identity_provider_api.c index d0ece80fe..38c11841c 100644 --- a/src/identity-provider/identity_provider_api.c +++ b/src/identity-provider/identity_provider_api.c | |||
@@ -514,13 +514,16 @@ handle_consume_ticket_result (void *cls, | |||
514 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (attrs); | 514 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (attrs); |
515 | } | 515 | } |
516 | } | 516 | } |
517 | op->ar_cb (op->cls, | 517 | if (NULL != op) |
518 | NULL, | 518 | { |
519 | NULL); | 519 | op->ar_cb (op->cls, |
520 | GNUNET_CONTAINER_DLL_remove (h->op_head, | 520 | NULL, |
521 | h->op_tail, | 521 | NULL); |
522 | op); | 522 | GNUNET_CONTAINER_DLL_remove (h->op_head, |
523 | GNUNET_free (op); | 523 | h->op_tail, |
524 | op); | ||
525 | GNUNET_free (op); | ||
526 | } | ||
524 | return; | 527 | return; |
525 | } | 528 | } |
526 | GNUNET_assert (0); | 529 | GNUNET_assert (0); |
@@ -926,7 +929,7 @@ GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle | |||
926 | sam->id = htonl (op->r_id); | 929 | sam->id = htonl (op->r_id); |
927 | 930 | ||
928 | GNUNET_IDENTITY_ATTRIBUTE_serialize (attr, | 931 | GNUNET_IDENTITY_ATTRIBUTE_serialize (attr, |
929 | (char*)&sam[1]); | 932 | (char*)&sam[1]); |
930 | 933 | ||
931 | sam->attr_len = htons (attr_len); | 934 | sam->attr_len = htons (attr_len); |
932 | if (NULL != h->mq) | 935 | if (NULL != h->mq) |
@@ -1093,7 +1096,7 @@ GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *h | |||
1093 | tim->id = htonl (op->r_id); | 1096 | tim->id = htonl (op->r_id); |
1094 | 1097 | ||
1095 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (attrs, | 1098 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (attrs, |
1096 | (char*)&tim[1]); | 1099 | (char*)&tim[1]); |
1097 | 1100 | ||
1098 | tim->attr_len = htons (attr_len); | 1101 | tim->attr_len = htons (attr_len); |
1099 | if (NULL != h->mq) | 1102 | if (NULL != h->mq) |