aboutsummaryrefslogtreecommitdiff
path: root/src/authorization/anastasis-helper-authorization-iban.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/authorization/anastasis-helper-authorization-iban.c')
-rw-r--r--src/authorization/anastasis-helper-authorization-iban.c66
1 files changed, 64 insertions, 2 deletions
diff --git a/src/authorization/anastasis-helper-authorization-iban.c b/src/authorization/anastasis-helper-authorization-iban.c
index f908b72..0d3200a 100644
--- a/src/authorization/anastasis-helper-authorization-iban.c
+++ b/src/authorization/anastasis-helper-authorization-iban.c
@@ -19,7 +19,6 @@
19 * @author Christian Grothoff 19 * @author Christian Grothoff
20 * 20 *
21 * TODO: 21 * TODO:
22 * - needs to load authentication information
23 * - needs to add DB triggers to notify main service of inbound activity 22 * - needs to add DB triggers to notify main service of inbound activity
24 * - needs man page 23 * - needs man page
25 */ 24 */
@@ -139,6 +138,7 @@ shutdown_task (void *cls)
139 } 138 }
140 ANASTASIS_DB_plugin_unload (db_plugin); 139 ANASTASIS_DB_plugin_unload (db_plugin);
141 db_plugin = NULL; 140 db_plugin = NULL;
141 ANASTASIS_EUFIN_auth_free (&auth);
142 cfg = NULL; 142 cfg = NULL;
143} 143}
144 144
@@ -293,7 +293,68 @@ run (void *cls,
293 global_ret = EXIT_NOTCONFIGURED; 293 global_ret = EXIT_NOTCONFIGURED;
294 return; 294 return;
295 } 295 }
296 // FIXME: initialize 'auth' from cfg! 296 {
297 char *iban;
298 char *receiver_name;
299
300 if (GNUNET_OK !=
301 GNUNET_CONFIGURATION_get_value_string (cfg,
302 "authorization-iban",
303 "CREDIT_IBAN",
304 &iban))
305 {
306 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
307 "authorization-iban",
308 "CREDIT_IBAN");
309 global_ret = EXIT_NOTCONFIGURED;
310 ANASTASIS_DB_plugin_unload (db_plugin);
311 db_plugin = NULL;
312 return;
313 }
314 if (GNUNET_OK !=
315 GNUNET_CONFIGURATION_get_value_string (cfg,
316 "authorization-iban",
317 "BUSINESS_NAME",
318 &receiver_name))
319 {
320 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
321 "authorization-iban",
322 "BUSINESS_NAME");
323 global_ret = EXIT_NOTCONFIGURED;
324 ANASTASIS_DB_plugin_unload (db_plugin);
325 db_plugin = NULL;
326 return;
327 }
328 {
329 size_t len;
330 char *uri_receiver_name;
331
332 len = GNUNET_STRINGS_urlencode (receiver_name,
333 strlen (receiver_name),
334 &uri_receiver_name);
335 GNUNET_assert (uri_receiver_name[len] == '\0');
336 GNUNET_asprintf (&credit_account_uri,
337 "payto://iban/%s?receiver-name=%s",
338 iban,
339 uri_receiver_name);
340 GNUNET_free (uri_receiver_name);
341 }
342 GNUNET_free (iban);
343 GNUNET_free (receiver_name);
344 }
345
346 if (GNUNET_OK !=
347 ANASTASIS_EUFIN_auth_parse_cfg (cfg,
348 "authorization-iban",
349 &auth))
350 {
351 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
352 "Failed to load bank access configuration data\n");
353 ANASTASIS_DB_plugin_unload (db_plugin);
354 db_plugin = NULL;
355 global_ret = EXIT_NOTCONFIGURED;
356 return;
357 }
297 { 358 {
298 enum GNUNET_DB_QueryStatus qs; 359 enum GNUNET_DB_QueryStatus qs;
299 360
@@ -303,6 +364,7 @@ run (void *cls,
303 if (qs < 0) 364 if (qs < 0)
304 { 365 {
305 GNUNET_break (0); 366 GNUNET_break (0);
367 ANASTASIS_EUFIN_auth_free (&auth);
306 ANASTASIS_DB_plugin_unload (db_plugin); 368 ANASTASIS_DB_plugin_unload (db_plugin);
307 db_plugin = NULL; 369 db_plugin = NULL;
308 return; 370 return;