diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-04-26 10:27:06 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-04-26 10:27:06 +0200 |
commit | 00f935e43df6f8c2129cb80992c35f5d0423901e (patch) | |
tree | 44bc94f984dfdf952d5659691280fd5d1cbea1ff /src/reclaim | |
parent | cef6317f17a706647c0a5d5f7e52548a7130b713 (diff) | |
download | gnunet-00f935e43df6f8c2129cb80992c35f5d0423901e.tar.gz gnunet-00f935e43df6f8c2129cb80992c35f5d0423901e.zip |
-fix build reclaim
Diffstat (limited to 'src/reclaim')
-rw-r--r-- | src/reclaim/plugin_reclaim_credential_pabc.c | 82 |
1 files changed, 7 insertions, 75 deletions
diff --git a/src/reclaim/plugin_reclaim_credential_pabc.c b/src/reclaim/plugin_reclaim_credential_pabc.c index 2f6b7b8c4..89acd9032 100644 --- a/src/reclaim/plugin_reclaim_credential_pabc.c +++ b/src/reclaim/plugin_reclaim_credential_pabc.c | |||
@@ -228,50 +228,6 @@ pabc_parse_attributes_p (void *cls, | |||
228 | return pabc_parse_attributes (cls, cred->data, cred->data_size); | 228 | return pabc_parse_attributes (cls, cred->data, cred->data_size); |
229 | } | 229 | } |
230 | 230 | ||
231 | struct Finder | ||
232 | { | ||
233 | const char* target; | ||
234 | char *result; | ||
235 | }; | ||
236 | |||
237 | static void | ||
238 | find_attr (char const *const key, | ||
239 | char const *const value, | ||
240 | void *ctx) | ||
241 | { | ||
242 | struct Finder *fdr = ctx; | ||
243 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
244 | "Found `%s', looking for `%s'\n", | ||
245 | key, fdr->target); | ||
246 | if (0 == strcmp (key, fdr->target)) | ||
247 | fdr->result = GNUNET_strdup (value); | ||
248 | } | ||
249 | |||
250 | |||
251 | |||
252 | /** | ||
253 | * Parse a pabc and return an attribute value. | ||
254 | * | ||
255 | * @param cls the plugin | ||
256 | * @param data the pabc credential data | ||
257 | * @param data_size the pabc credential size | ||
258 | * @param skey the attribute key to look for. | ||
259 | * @return a string, containing the isser | ||
260 | */ | ||
261 | char * | ||
262 | pabc_get_attribute (void *cls, | ||
263 | const char *data, | ||
264 | size_t data_size, | ||
265 | const char *skey) | ||
266 | { | ||
267 | |||
268 | struct Finder fdr; | ||
269 | memset (&fdr, 0, sizeof (fdr)); | ||
270 | fdr.target = skey; | ||
271 | pabc_cred_inspect_credential (data, &find_attr, &fdr); | ||
272 | return fdr.result; | ||
273 | } | ||
274 | |||
275 | 231 | ||
276 | /** | 232 | /** |
277 | * Parse a pabc and return the issuer | 233 | * Parse a pabc and return the issuer |
@@ -301,22 +257,6 @@ pabc_get_issuer (void *cls, | |||
301 | * @param cred the pabc credential | 257 | * @param cred the pabc credential |
302 | * @return a string, containing the isser | 258 | * @return a string, containing the isser |
303 | */ | 259 | */ |
304 | char* | ||
305 | pabc_get_issuer (void *cls, | ||
306 | const char *data, | ||
307 | size_t data_size) | ||
308 | { | ||
309 | return pabc_get_attribute (cls, data, data_size, "issuer"); | ||
310 | } | ||
311 | |||
312 | |||
313 | /** | ||
314 | * Parse a pabc and return the issuer | ||
315 | * | ||
316 | * @param cls the plugin | ||
317 | * @param cred the pabc credential | ||
318 | * @return a string, containing the isser | ||
319 | */ | ||
320 | char * | 260 | char * |
321 | pabc_get_issuer_c (void *cls, | 261 | pabc_get_issuer_c (void *cls, |
322 | const struct GNUNET_RECLAIM_Credential *cred) | 262 | const struct GNUNET_RECLAIM_Credential *cred) |
@@ -351,27 +291,19 @@ pabc_get_issuer_p (void *cls, | |||
351 | * @param cred the pabc credential | 291 | * @param cred the pabc credential |
352 | * @return a string, containing the isser | 292 | * @return a string, containing the isser |
353 | */ | 293 | */ |
354 | int | 294 | enum GNUNET_GenericReturnValue |
355 | pabc_get_expiration (void *cls, | 295 | pabc_get_expiration (void *cls, |
356 | const char *data, | 296 | const char *data, |
357 | size_t data_size, | 297 | size_t data_size, |
358 | struct GNUNET_TIME_Absolute *exp) | 298 | struct GNUNET_TIME_Absolute *exp) |
359 | { | 299 | { |
360 | json_t *json_root; | 300 | char *exp_str; |
361 | json_t *json_attrs; | 301 | uint64_t exp_i; |
362 | json_t *value; | 302 | |
363 | json_t *exp_j; | 303 | if (PABC_OK != pabc_cred_get_attr_by_name_from_cred (data, |
364 | json_error_t *json_err = NULL; | 304 | "expiration", |
365 | const char*key; | 305 | &exp_str)) |
366 | |||
367 | json_root = json_loads (data, JSON_DECODE_ANY, json_err); | ||
368 | if ((NULL == json_root) || | ||
369 | (! json_is_object (json_root))) | ||
370 | { | ||
371 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
372 | "Unable to retrive expiration from credential\n"); | ||
373 | return GNUNET_SYSERR; | 306 | return GNUNET_SYSERR; |
374 | } | ||
375 | 307 | ||
376 | if (1 != sscanf (exp_str, "%llu", &exp_i)) | 308 | if (1 != sscanf (exp_str, "%llu", &exp_i)) |
377 | { | 309 | { |