aboutsummaryrefslogtreecommitdiff
path: root/src/authorization/anastasis_authorization_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/authorization/anastasis_authorization_plugin.c')
-rw-r--r--src/authorization/anastasis_authorization_plugin.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/authorization/anastasis_authorization_plugin.c b/src/authorization/anastasis_authorization_plugin.c
index adb1c5b..da28f40 100644
--- a/src/authorization/anastasis_authorization_plugin.c
+++ b/src/authorization/anastasis_authorization_plugin.c
@@ -66,32 +66,25 @@ struct AuthPlugin
66 */ 66 */
67 char *lib_name; 67 char *lib_name;
68 68
69 /**
70 * Cost of using this plugin.
71 */
72 struct TALER_Amount cost;
73}; 69};
74 70
75 71
76struct ANASTASIS_AuthorizationPlugin * 72struct ANASTASIS_AuthorizationPlugin *
77ANASTASIS_authorization_plugin_load ( 73ANASTASIS_authorization_plugin_load (
78 const char *method, 74 const char *method,
79 const struct GNUNET_CONFIGURATION_Handle *AH_cfg, 75 const struct GNUNET_CONFIGURATION_Handle *AH_cfg)
80 struct TALER_Amount *cost)
81{ 76{
82 struct ANASTASIS_AuthorizationPlugin *authorization; 77 struct ANASTASIS_AuthorizationPlugin *authorization;
83 char *lib_name; 78 char *lib_name;
84 char *sec_name; 79 char *sec_name;
85 struct AuthPlugin *ap; 80 struct AuthPlugin *ap;
86 char *currency; 81 char *currency;
82 struct TALER_Amount cost;
87 83
88 for (ap = ap_head; NULL != ap; ap = ap->next) 84 for (ap = ap_head; NULL != ap; ap = ap->next)
89 if (0 == strcmp (method, 85 if (0 == strcmp (method,
90 ap->name)) 86 ap->name))
91 {
92 *cost = ap->cost;
93 return ap->authorization; 87 return ap->authorization;
94 }
95 if (GNUNET_OK != 88 if (GNUNET_OK !=
96 TALER_config_get_currency (AH_cfg, 89 TALER_config_get_currency (AH_cfg,
97 &currency)) 90 &currency))
@@ -104,7 +97,7 @@ ANASTASIS_authorization_plugin_load (
104 TALER_config_get_amount (AH_cfg, 97 TALER_config_get_amount (AH_cfg,
105 sec_name, 98 sec_name,
106 "COST", 99 "COST",
107 &ap->cost)) 100 &cost))
108 { 101 {
109 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, 102 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
110 sec_name, 103 sec_name,
@@ -117,7 +110,7 @@ ANASTASIS_authorization_plugin_load (
117 110
118 if (0 != 111 if (0 !=
119 strcasecmp (currency, 112 strcasecmp (currency,
120 ap->cost.currency)) 113 cost.currency))
121 { 114 {
122 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, 115 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
123 sec_name, 116 sec_name,
@@ -144,13 +137,13 @@ ANASTASIS_authorization_plugin_load (
144 GNUNET_free (ap); 137 GNUNET_free (ap);
145 return NULL; 138 return NULL;
146 } 139 }
140 authorization->cost = cost;
147 ap->name = GNUNET_strdup (method); 141 ap->name = GNUNET_strdup (method);
148 ap->lib_name = lib_name; 142 ap->lib_name = lib_name;
149 ap->authorization = authorization; 143 ap->authorization = authorization;
150 GNUNET_CONTAINER_DLL_insert (ap_head, 144 GNUNET_CONTAINER_DLL_insert (ap_head,
151 ap_tail, 145 ap_tail,
152 ap); 146 ap);
153 *cost = ap->cost;
154 return authorization; 147 return authorization;
155} 148}
156 149