diff options
Diffstat (limited to 'src/identity-provider/plugin_rest_identity_provider.c')
-rw-r--r-- | src/identity-provider/plugin_rest_identity_provider.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/identity-provider/plugin_rest_identity_provider.c b/src/identity-provider/plugin_rest_identity_provider.c index 398d09cd2..03279983b 100644 --- a/src/identity-provider/plugin_rest_identity_provider.c +++ b/src/identity-provider/plugin_rest_identity_provider.c | |||
@@ -546,6 +546,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
546 | const char* identity; | 546 | const char* identity; |
547 | const char* name_str; | 547 | const char* name_str; |
548 | const char* value_str; | 548 | const char* value_str; |
549 | const char* exp_str; | ||
549 | 550 | ||
550 | struct RequestHandle *handle = cls; | 551 | struct RequestHandle *handle = cls; |
551 | struct EgoEntry *ego_entry; | 552 | struct EgoEntry *ego_entry; |
@@ -553,9 +554,11 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
553 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attribute; | 554 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attribute; |
554 | struct GNUNET_JSONAPI_Document *json_obj; | 555 | struct GNUNET_JSONAPI_Document *json_obj; |
555 | struct GNUNET_JSONAPI_Resource *json_res; | 556 | struct GNUNET_JSONAPI_Resource *json_res; |
557 | struct GNUNET_TIME_Relative exp; | ||
556 | char term_data[handle->rest_handle->data_size+1]; | 558 | char term_data[handle->rest_handle->data_size+1]; |
557 | json_t *value_json; | 559 | json_t *value_json; |
558 | json_t *data_json; | 560 | json_t *data_json; |
561 | json_t *exp_json; | ||
559 | json_error_t err; | 562 | json_error_t err; |
560 | struct GNUNET_JSON_Specification docspec[] = { | 563 | struct GNUNET_JSON_Specification docspec[] = { |
561 | GNUNET_JSON_spec_jsonapi_document (&json_obj), | 564 | GNUNET_JSON_spec_jsonapi_document (&json_obj), |
@@ -635,6 +638,18 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
635 | return; | 638 | return; |
636 | } | 639 | } |
637 | name_str = GNUNET_JSONAPI_resource_get_id (json_res); | 640 | name_str = GNUNET_JSONAPI_resource_get_id (json_res); |
641 | exp_json = GNUNET_JSONAPI_resource_read_attr (json_res, | ||
642 | "exp"); | ||
643 | exp_str = json_string_value (exp_json); | ||
644 | if (NULL == exp_str) { | ||
645 | exp = GNUNET_TIME_UNIT_HOURS; | ||
646 | } else { | ||
647 | if (GNUNET_OK != GNUNET_STRINGS_fancy_time_to_relative (exp_str, | ||
648 | &exp)) { | ||
649 | exp = GNUNET_TIME_UNIT_HOURS; | ||
650 | } | ||
651 | } | ||
652 | |||
638 | value_json = GNUNET_JSONAPI_resource_read_attr (json_res, | 653 | value_json = GNUNET_JSONAPI_resource_read_attr (json_res, |
639 | "value"); | 654 | "value"); |
640 | value_str = json_string_value (value_json); | 655 | value_str = json_string_value (value_json); |
@@ -646,6 +661,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
646 | handle->idp_op = GNUNET_IDENTITY_PROVIDER_attribute_store (handle->idp, | 661 | handle->idp_op = GNUNET_IDENTITY_PROVIDER_attribute_store (handle->idp, |
647 | identity_priv, | 662 | identity_priv, |
648 | attribute, | 663 | attribute, |
664 | &exp, | ||
649 | &finished_cont, | 665 | &finished_cont, |
650 | handle); | 666 | handle); |
651 | GNUNET_free (attribute); | 667 | GNUNET_free (attribute); |