aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/escrow/escrow_api.c2
-rw-r--r--src/escrow/escrow_plugin_helper.c33
2 files changed, 16 insertions, 19 deletions
diff --git a/src/escrow/escrow_api.c b/src/escrow/escrow_api.c
index 3e3496ff1..10faed90b 100644
--- a/src/escrow/escrow_api.c
+++ b/src/escrow/escrow_api.c
@@ -559,6 +559,8 @@ GNUNET_ESCROW_anchor_data_to_string (const struct GNUNET_ESCROW_Anchor *anchor)
559enum GNUNET_ESCROW_Key_Escrow_Method 559enum GNUNET_ESCROW_Key_Escrow_Method
560GNUNET_ESCROW_method_string_to_number (const char *methodString) 560GNUNET_ESCROW_method_string_to_number (const char *methodString)
561{ 561{
562 if (NULL == methodString)
563 return GNUNET_ESCROW_KEY_NONE;
562 if (!strcmp (plaintext_string, methodString)) 564 if (!strcmp (plaintext_string, methodString))
563 return GNUNET_ESCROW_KEY_PLAINTEXT; 565 return GNUNET_ESCROW_KEY_PLAINTEXT;
564 else if (!strcmp (gns_string, methodString)) 566 else if (!strcmp (gns_string, methodString))
diff --git a/src/escrow/escrow_plugin_helper.c b/src/escrow/escrow_plugin_helper.c
index 3e14edf4f..f5f67d4bf 100644
--- a/src/escrow/escrow_plugin_helper.c
+++ b/src/escrow/escrow_plugin_helper.c
@@ -315,44 +315,39 @@ ESCROW_get_escrow_status (struct GNUNET_ESCROW_Handle *h,
315 "LAST_ESCROW_TIME", 315 "LAST_ESCROW_TIME",
316 &conf_last_escrow)) 316 &conf_last_escrow))
317 { 317 {
318 // TODO: is that the behavior when the section is not defined? 318 /* failed to get value from config, set last escrow time to zero */
319 status->last_escrow_time = GNUNET_TIME_absolute_get_zero_(); 319 status->last_escrow_time = GNUNET_TIME_absolute_get_zero_();
320 } 320 }
321 else
322 status->last_escrow_time.abs_value_us = (uint64_t)conf_last_escrow;
323
321 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (h->cfg, 324 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (h->cfg,
322 config_section, 325 config_section,
323 "NEXT_RECOMMENDED_ESCROW_TIME", 326 "NEXT_RECOMMENDED_ESCROW_TIME",
324 &conf_next_escrow)) 327 &conf_next_escrow))
325 { 328 {
326 // TODO: is that the behavior when the section is not defined? 329 /* failed to get value from config, set next recommended escrow to now */
327 status->next_recommended_escrow_time = GNUNET_TIME_absolute_get (); 330 status->next_recommended_escrow_time = GNUNET_TIME_absolute_get ();
328 } 331 }
329 status->last_method = GNUNET_ESCROW_KEY_NONE; 332 else
333 status->next_recommended_escrow_time.abs_value_us = (uint64_t)conf_next_escrow;
334
330 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (h->cfg, 335 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (h->cfg,
331 config_section, 336 config_section,
332 "ESCROW_METHOD", 337 "ESCROW_METHOD",
333 &conf_escrow_method)) 338 &conf_escrow_method))
334 { 339 {
335 // TODO: error handling? 340 /* failed to get value from config, set last method to NONE */
336 } 341 status->last_method = GNUNET_ESCROW_KEY_NONE;
337 status->last_escrow_time.abs_value_us = (uint64_t)conf_last_escrow;
338 status->next_recommended_escrow_time.abs_value_us = (uint64_t)conf_next_escrow;
339 if (NULL != conf_escrow_method)
340 {
341 if (NULL != conf_escrow_method && 0 == strcmp (conf_escrow_method, "plaintext"))
342 status->last_method = GNUNET_ESCROW_KEY_PLAINTEXT;
343 else if (0 == strcmp (conf_escrow_method, "gns"))
344 status->last_method = GNUNET_ESCROW_KEY_GNS;
345 else if (0 == strcmp (conf_escrow_method, "anastasis"))
346 status->last_method = GNUNET_ESCROW_KEY_ANASTASIS;
347 else
348 status->last_method = GNUNET_ESCROW_KEY_NONE;
349 } 342 }
343 else
344 status->last_method = GNUNET_ESCROW_method_string_to_number (conf_escrow_method);
350 345
351
352 GNUNET_free (config_section); 346 GNUNET_free (config_section);
353 GNUNET_free (pubkey_string); 347 GNUNET_free (pubkey_string);
354 GNUNET_free (pub); 348 GNUNET_free (pub);
355 GNUNET_free (conf_escrow_method); 349 if (NULL != conf_escrow_method)
350 GNUNET_free (conf_escrow_method);
356 351
357 return status; 352 return status;
358} 353}