aboutsummaryrefslogtreecommitdiff
path: root/src/credential/plugin_rest_credential.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/credential/plugin_rest_credential.c')
-rw-r--r--src/credential/plugin_rest_credential.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/credential/plugin_rest_credential.c b/src/credential/plugin_rest_credential.c
index 2e43139de..7f39b34ea 100644
--- a/src/credential/plugin_rest_credential.c
+++ b/src/credential/plugin_rest_credential.c
@@ -309,14 +309,14 @@ json_to_credential (json_t *res)
309 sig, 309 sig,
310 sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); 310 sizeof (struct GNUNET_CRYPTO_EcdsaSignature));
311 GNUNET_free (sig); 311 GNUNET_free (sig);
312 312
313 tmp = json_object_get (res, "expiration"); 313 tmp = json_object_get (res, "expiration");
314 if (0 == json_is_integer (tmp)) 314 if (0 == json_is_integer (tmp))
315 { 315 {
316 GNUNET_free (cred); 316 GNUNET_free (cred);
317 return NULL; 317 return NULL;
318 } 318 }
319 cred->expiration.abs_value_us = json_integer_value (tmp); 319 cred->expiration.abs_value_us = json_integer_value (tmp);
320 return cred; 320 return cred;
321} 321}
322 322
@@ -342,7 +342,7 @@ credential_to_json (struct GNUNET_CREDENTIAL_Credential *cred)
342 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 342 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
343 "Issuer in credential malformed\n"); 343 "Issuer in credential malformed\n");
344 return NULL; 344 return NULL;
345 } 345 }
346 subject = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred->subject_key); 346 subject = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred->subject_key);
347 if (NULL == subject) 347 if (NULL == subject)
348 { 348 {
@@ -354,9 +354,9 @@ credential_to_json (struct GNUNET_CREDENTIAL_Credential *cred)
354 GNUNET_STRINGS_base64_encode ((char*)&cred->signature, 354 GNUNET_STRINGS_base64_encode ((char*)&cred->signature,
355 sizeof (struct GNUNET_CRYPTO_EcdsaSignature), 355 sizeof (struct GNUNET_CRYPTO_EcdsaSignature),
356 &signature); 356 &signature);
357 memcpy (attribute, 357 GNUNET_memcpy (attribute,
358 cred->issuer_attribute, 358 cred->issuer_attribute,
359 cred->issuer_attribute_len); 359 cred->issuer_attribute_len);
360 attribute[cred->issuer_attribute_len] = '\0'; 360 attribute[cred->issuer_attribute_len] = '\0';
361 cred_obj = json_object (); 361 cred_obj = json_object ();
362 json_object_set_new (cred_obj, "issuer", json_string (issuer)); 362 json_object_set_new (cred_obj, "issuer", json_string (issuer));
@@ -570,7 +570,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
570 { 570 {
571 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 571 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
572 "Missing issuer attribute\n"); 572 "Missing issuer attribute\n");
573 GNUNET_SCHEDULER_add_now (&do_error, handle); 573 GNUNET_SCHEDULER_add_now (&do_error, handle);
574 return; 574 return;
575 } 575 }
576 tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map, 576 tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map,
@@ -585,7 +585,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
585 GNUNET_SCHEDULER_add_now (&do_error, handle); 585 GNUNET_SCHEDULER_add_now (&do_error, handle);
586 return; 586 return;
587 } 587 }
588 if (GNUNET_OK != 588 if (GNUNET_OK !=
589 GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp, 589 GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp,
590 strlen (tmp), 590 strlen (tmp),
591 &handle->issuer_key)) 591 &handle->issuer_key))
@@ -626,7 +626,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
626 { 626 {
627 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 627 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
628 "Malformed subject\n"); 628 "Malformed subject\n");
629 GNUNET_SCHEDULER_add_now (&do_error, handle); 629 GNUNET_SCHEDULER_add_now (&do_error, handle);
630 return; 630 return;
631 } 631 }
632 handle->ego_lookup = GNUNET_IDENTITY_ego_lookup (cfg, 632 handle->ego_lookup = GNUNET_IDENTITY_ego_lookup (cfg,
@@ -679,7 +679,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
679 { 679 {
680 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 680 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
681 "Missing issuer attribute\n"); 681 "Missing issuer attribute\n");
682 GNUNET_SCHEDULER_add_now (&do_error, handle); 682 GNUNET_SCHEDULER_add_now (&do_error, handle);
683 return; 683 return;
684 } 684 }
685 tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map, 685 tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map,
@@ -694,7 +694,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
694 GNUNET_SCHEDULER_add_now (&do_error, handle); 694 GNUNET_SCHEDULER_add_now (&do_error, handle);
695 return; 695 return;
696 } 696 }
697 if (GNUNET_OK != 697 if (GNUNET_OK !=
698 GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp, 698 GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp,
699 strlen (tmp), 699 strlen (tmp),
700 &handle->issuer_key)) 700 &handle->issuer_key))
@@ -735,7 +735,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
735 { 735 {
736 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 736 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
737 "Malformed subject\n"); 737 "Malformed subject\n");
738 GNUNET_SCHEDULER_add_now (&do_error, handle); 738 GNUNET_SCHEDULER_add_now (&do_error, handle);
739 return; 739 return;
740 } 740 }
741 if (GNUNET_OK != 741 if (GNUNET_OK !=
@@ -946,7 +946,7 @@ get_cred_issuer_cb (void *cls,
946 { 946 {
947 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 947 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
948 "Missing expiration\n"); 948 "Missing expiration\n");
949 GNUNET_SCHEDULER_add_now (&do_error, handle); 949 GNUNET_SCHEDULER_add_now (&do_error, handle);
950 return; 950 return;
951 } 951 }
952 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,7 +955,7 @@ get_cred_issuer_cb (void *cls,
955 { 955 {
956 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 956 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
957 "Expiration malformed\n"); 957 "Expiration malformed\n");
958 GNUNET_SCHEDULER_add_now (&do_error, handle); 958 GNUNET_SCHEDULER_add_now (&do_error, handle);
959 return; 959 return;
960 } 960 }
961 961
@@ -968,7 +968,7 @@ get_cred_issuer_cb (void *cls,
968 { 968 {
969 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 969 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
970 "Malformed expiration: %s\n", expiration_str); 970 "Malformed expiration: %s\n", expiration_str);
971 GNUNET_SCHEDULER_add_now (&do_error, handle); 971 GNUNET_SCHEDULER_add_now (&do_error, handle);
972 return; 972 return;
973 } 973 }
974 GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_ISSUER_ATTR, 974 GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_ISSUER_ATTR,
@@ -980,10 +980,10 @@ get_cred_issuer_cb (void *cls,
980 { 980 {
981 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 981 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
982 "Missing issuer attribute\n"); 982 "Missing issuer attribute\n");
983 GNUNET_SCHEDULER_add_now (&do_error, handle); 983 GNUNET_SCHEDULER_add_now (&do_error, handle);
984 return; 984 return;
985 } 985 }
986 handle->issuer_attr = GNUNET_strdup(GNUNET_CONTAINER_multihashmap_get 986 handle->issuer_attr = GNUNET_strdup(GNUNET_CONTAINER_multihashmap_get
987 (handle->rest_handle->url_param_map, 987 (handle->rest_handle->url_param_map,
988 &key)); 988 &key));
989 GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_SUBJECT_KEY, 989 GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_SUBJECT_KEY,
@@ -1004,7 +1004,7 @@ get_cred_issuer_cb (void *cls,
1004 { 1004 {
1005 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1005 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1006 "Malformed subject\n"); 1006 "Malformed subject\n");
1007 GNUNET_SCHEDULER_add_now (&do_error, handle); 1007 GNUNET_SCHEDULER_add_now (&do_error, handle);
1008 return; 1008 return;
1009 } 1009 }
1010 if (GNUNET_OK != 1010 if (GNUNET_OK !=