[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r36675 - gnunet/src/identity-token
From: |
gnunet |
Subject: |
[GNUnet-SVN] r36675 - gnunet/src/identity-token |
Date: |
Thu, 19 Nov 2015 16:41:32 +0100 |
Author: schanzen
Date: 2015-11-19 16:41:32 +0100 (Thu, 19 Nov 2015)
New Revision: 36675
Modified:
gnunet/src/identity-token/gnunet-service-identity-token.c
gnunet/src/identity-token/plugin_rest_identity_token.c
Log:
- fixes
Modified: gnunet/src/identity-token/gnunet-service-identity-token.c
===================================================================
--- gnunet/src/identity-token/gnunet-service-identity-token.c 2015-11-19
12:18:35 UTC (rev 36674)
+++ gnunet/src/identity-token/gnunet-service-identity-token.c 2015-11-19
15:41:32 UTC (rev 36675)
@@ -188,13 +188,13 @@
json_object_set_new (new_payload_json, key, json_integer
(new_iat.abs_value_us));
}
else {
- json_object_set_new (new_payload_json, key, value);
+ json_object_set (new_payload_json, key, value);
}
}
- json_decref (payload_json);
// reassemble and set
new_payload_str = json_dumps (new_payload_json, JSON_COMPACT);
+ json_decref (payload_json);
json_decref (new_payload_json);
GNUNET_STRINGS_base64_encode (new_payload_str,
strlen (new_payload_str),
@@ -271,7 +271,9 @@
//TODO autopurge expired tokens here if set in config
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, ">>> Found record\n");
//There should be only a single record for a token under a label
- if (1 != rd_count || (rd->record_type != GNUNET_GNSRECORD_TYPE_ID_TOKEN))
+ if ((1 != rd_count)
+ || (rd->record_type != GNUNET_GNSRECORD_TYPE_ID_TOKEN)
+ || (0 == (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION & rd->flags)))
{
GNUNET_NAMESTORE_zone_iterator_next (ns_it);
return;
Modified: gnunet/src/identity-token/plugin_rest_identity_token.c
===================================================================
--- gnunet/src/identity-token/plugin_rest_identity_token.c 2015-11-19
12:18:35 UTC (rev 36674)
+++ gnunet/src/identity-token/plugin_rest_identity_token.c 2015-11-19
15:41:32 UTC (rev 36675)
@@ -420,8 +420,6 @@
struct GNUNET_GNSRECORD_Data token_record;
struct GNUNET_HashCode key;
struct GNUNET_TIME_Relative etime_rel;
- static struct GNUNET_TIME_Absolute etime_abs;
- int etime_is_rel = GNUNET_SYSERR;
int renew_token = GNUNET_NO;
time = GNUNET_TIME_absolute_get().abs_value_us;
@@ -447,53 +445,29 @@
return;
}
- if (0 == strcmp (exp_str, "never"))
- {
- etime_abs = GNUNET_TIME_UNIT_FOREVER_ABS;
- etime_is_rel = GNUNET_NO;
- }
- else if (GNUNET_OK ==
+ if (GNUNET_OK !=
GNUNET_STRINGS_fancy_time_to_relative (exp_str,
&etime_rel))
{
- etime_is_rel = GNUNET_YES;
- }
- else if (GNUNET_OK ==
- GNUNET_STRINGS_fancy_time_to_absolute (exp_str,
- &etime_abs))
- {
- etime_is_rel = GNUNET_NO;
- }
- else {
handle->emsg = GNUNET_strdup ("Expiration invalid!\n");
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- if (GNUNET_YES == etime_is_rel)
- {
- exp_time = time + etime_rel.rel_value_us;
- }
- else
- {
- exp_time = etime_abs.abs_value_us;
- }
+ exp_time = time + etime_rel.rel_value_us;
//Get renewal policy for token
- if (GNUNET_YES == etime_is_rel)
- {
- GNUNET_CRYPTO_hash (GNUNET_IDENTITY_TOKEN_RENEW_TOKEN,
- strlen (GNUNET_IDENTITY_TOKEN_RENEW_TOKEN),
- &key);
+ GNUNET_CRYPTO_hash (GNUNET_IDENTITY_TOKEN_RENEW_TOKEN,
+ strlen (GNUNET_IDENTITY_TOKEN_RENEW_TOKEN),
+ &key);
- if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains
(handle->conndata_handle->url_param_map,
- &key))
- {
- renew_str = GNUNET_CONTAINER_multihashmap_get
(handle->conndata_handle->url_param_map,
- &key);
- if (0 == strcmp (renew_str, "true"))
- renew_token = GNUNET_YES;
- }
+ if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains
(handle->conndata_handle->url_param_map,
+ &key))
+ {
+ renew_str = GNUNET_CONTAINER_multihashmap_get
(handle->conndata_handle->url_param_map,
+ &key);
+ if (0 == strcmp (renew_str, "true"))
+ renew_token = GNUNET_YES;
}
//json_object_set_new (handle->payload, "lbl", json_string (lbl_str));
@@ -571,7 +545,7 @@
token_record.expiration_time = exp_time;
token_record.record_type = GNUNET_GNSRECORD_TYPE_ID_TOKEN;
token_record.flags = GNUNET_GNSRECORD_RF_NONE;
- if (GNUNET_YES == etime_is_rel)
+ if (GNUNET_YES == renew_token)
token_record.flags |= GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
//Persist token
handle->ns_qe = GNUNET_NAMESTORE_records_store (handle->ns_handle,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r36675 - gnunet/src/identity-token,
gnunet <=