summaryrefslogtreecommitdiff
path: root/src/authorization/anastasis-helper-authorization-iban.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-19 12:25:34 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-19 12:25:34 +0200
commit87bc2f469bf120bbd57e98a0a8ea46e80de84927 (patch)
tree710867c85e6cfae09d07d526b6d4950c2e48bf75 /src/authorization/anastasis-helper-authorization-iban.c
parent260eaf05fa395a6d541fd2917faf47dc342b3005 (diff)
downloadanastasis-87bc2f469bf120bbd57e98a0a8ea46e80de84927.tar.gz
anastasis-87bc2f469bf120bbd57e98a0a8ea46e80de84927.tar.bz2
anastasis-87bc2f469bf120bbd57e98a0a8ea46e80de84927.zip
-update IBAN plugin, write man page for anastasis-helper-authorization-iban
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 @@
* @author Christian Grothoff
*
* TODO:
- * - needs to load authentication information
* - needs to add DB triggers to notify main service of inbound activity
* - needs man page
*/
@@ -139,6 +138,7 @@ shutdown_task (void *cls)
}
ANASTASIS_DB_plugin_unload (db_plugin);
db_plugin = NULL;
+ ANASTASIS_EUFIN_auth_free (&auth);
cfg = NULL;
}
@@ -293,7 +293,68 @@ run (void *cls,
global_ret = EXIT_NOTCONFIGURED;
return;
}
- // FIXME: initialize 'auth' from cfg!
+ {
+ char *iban;
+ char *receiver_name;
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "authorization-iban",
+ "CREDIT_IBAN",
+ &iban))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "authorization-iban",
+ "CREDIT_IBAN");
+ global_ret = EXIT_NOTCONFIGURED;
+ ANASTASIS_DB_plugin_unload (db_plugin);
+ db_plugin = NULL;
+ return;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "authorization-iban",
+ "BUSINESS_NAME",
+ &receiver_name))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "authorization-iban",
+ "BUSINESS_NAME");
+ global_ret = EXIT_NOTCONFIGURED;
+ ANASTASIS_DB_plugin_unload (db_plugin);
+ db_plugin = NULL;
+ return;
+ }
+ {
+ size_t len;
+ char *uri_receiver_name;
+
+ len = GNUNET_STRINGS_urlencode (receiver_name,
+ strlen (receiver_name),
+ &uri_receiver_name);
+ GNUNET_assert (uri_receiver_name[len] == '\0');
+ GNUNET_asprintf (&credit_account_uri,
+ "payto://iban/%s?receiver-name=%s",
+ iban,
+ uri_receiver_name);
+ GNUNET_free (uri_receiver_name);
+ }
+ GNUNET_free (iban);
+ GNUNET_free (receiver_name);
+ }
+
+ if (GNUNET_OK !=
+ ANASTASIS_EUFIN_auth_parse_cfg (cfg,
+ "authorization-iban",
+ &auth))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to load bank access configuration data\n");
+ ANASTASIS_DB_plugin_unload (db_plugin);
+ db_plugin = NULL;
+ global_ret = EXIT_NOTCONFIGURED;
+ return;
+ }
{
enum GNUNET_DB_QueryStatus qs;
@@ -303,6 +364,7 @@ run (void *cls,
if (qs < 0)
{
GNUNET_break (0);
+ ANASTASIS_EUFIN_auth_free (&auth);
ANASTASIS_DB_plugin_unload (db_plugin);
db_plugin = NULL;
return;