aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/plugin_reclaim_credential_pabc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reclaim/plugin_reclaim_credential_pabc.c')
-rw-r--r--src/reclaim/plugin_reclaim_credential_pabc.c35
1 files changed, 8 insertions, 27 deletions
diff --git a/src/reclaim/plugin_reclaim_credential_pabc.c b/src/reclaim/plugin_reclaim_credential_pabc.c
index 4b19a3544..f17925248 100644
--- a/src/reclaim/plugin_reclaim_credential_pabc.c
+++ b/src/reclaim/plugin_reclaim_credential_pabc.c
@@ -240,6 +240,9 @@ find_attr (char const *const key,
240 void *ctx) 240 void *ctx)
241{ 241{
242 struct Finder *fdr = ctx; 242 struct Finder *fdr = ctx;
243 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
244 "Found `%s', looking for `%s'\n",
245 key, fdr->target);
243 if (0 == strcmp (key, fdr->target)) 246 if (0 == strcmp (key, fdr->target))
244 fdr->result = GNUNET_strdup (value); 247 fdr->result = GNUNET_strdup (value);
245} 248}
@@ -260,37 +263,11 @@ pabc_get_attribute (void *cls,
260 size_t data_size, 263 size_t data_size,
261 const char *skey) 264 const char *skey)
262{ 265{
263 json_t *json_root;
264 json_t *json_attrs;
265 json_error_t *json_err = NULL;
266 266
267 json_root = json_loads (data, JSON_DECODE_ANY, json_err);
268 if ((NULL == json_root) ||
269 (! json_is_object (json_root)))
270 {
271 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
272 "%s is not a valid pabc credential (not an object)\n",
273 data);
274 if (NULL != json_root)
275 json_decref (json_root);
276 return NULL;
277 }
278 json_attrs = json_object_get (json_root, PABC_JSON_PLAIN_ATTRS_KEY);
279 if ((NULL == json_attrs) ||
280 (! json_is_object (json_attrs)))
281 {
282 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
283 "%s is not a valid pabc credential (attributes not an object)\n",
284 data);
285 json_decref (json_root);
286 return NULL;
287 }
288 char *attr_str = json_dumps (json_attrs, JSON_DECODE_ANY);
289 json_decref (json_root);
290 struct Finder fdr; 267 struct Finder fdr;
291 memset (&fdr, 0, sizeof (fdr)); 268 memset (&fdr, 0, sizeof (fdr));
292 fdr.target = skey; 269 fdr.target = skey;
293 pabc_cred_inspect_credential (attr_str, &find_attr, &fdr); 270 pabc_cred_inspect_credential (data, &find_attr, &fdr);
294 return fdr.result; 271 return fdr.result;
295} 272}
296 273
@@ -463,9 +440,13 @@ pabc_create_presentation (void *cls,
463 issuer = pabc_get_issuer_c (cls, credential); 440 issuer = pabc_get_issuer_c (cls, credential);
464 if (NULL == issuer) 441 if (NULL == issuer)
465 { 442 {
443 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
444 "No issuer found in credential\n");
466 pabc_free_ctx (&ctx); 445 pabc_free_ctx (&ctx);
467 return GNUNET_SYSERR; 446 return GNUNET_SYSERR;
468 } 447 }
448 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
449 "Got issuer for credential: %s\n", issuer);
469 status = PABC_load_public_parameters (ctx, issuer, &pp); 450 status = PABC_load_public_parameters (ctx, issuer, &pp);
470 if (status != PABC_OK) 451 if (status != PABC_OK)
471 { 452 {