diff options
Diffstat (limited to 'src/credential')
-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 |
6 files changed, 39 insertions, 10 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 | { |