diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-04-20 19:56:26 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-04-20 19:56:26 +0200 |
commit | e78aaa7eb9f1f69c6c6f1efd53f4196820471ec9 (patch) | |
tree | ebe1c5be265ab001b8923eb7f37f07eefb1d9525 /src/reclaim/plugin_reclaim_credential_pabc.c | |
parent | 96ead001860cba3251402f31cf21641e60dd49b1 (diff) | |
download | gnunet-e78aaa7eb9f1f69c6c6f1efd53f4196820471ec9.tar.gz gnunet-e78aaa7eb9f1f69c6c6f1efd53f4196820471ec9.zip |
- fix
Diffstat (limited to 'src/reclaim/plugin_reclaim_credential_pabc.c')
-rw-r--r-- | src/reclaim/plugin_reclaim_credential_pabc.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/reclaim/plugin_reclaim_credential_pabc.c b/src/reclaim/plugin_reclaim_credential_pabc.c index 87406e60b..84b1f92f5 100644 --- a/src/reclaim/plugin_reclaim_credential_pabc.c +++ b/src/reclaim/plugin_reclaim_credential_pabc.c | |||
@@ -151,6 +151,9 @@ inspect_attrs (char const *const key, | |||
151 | { | 151 | { |
152 | struct GNUNET_RECLAIM_AttributeList *attrs = ctx; | 152 | struct GNUNET_RECLAIM_AttributeList *attrs = ctx; |
153 | 153 | ||
154 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
155 | "Found attribue in PABC credential: `%s': `%s'\n", | ||
156 | key, value); | ||
154 | GNUNET_RECLAIM_attribute_list_add (attrs, | 157 | GNUNET_RECLAIM_attribute_list_add (attrs, |
155 | key, | 158 | key, |
156 | NULL, | 159 | NULL, |
@@ -193,15 +196,19 @@ pabc_parse_attributes (void *cls, | |||
193 | (! json_is_object (json_attrs))) | 196 | (! json_is_object (json_attrs))) |
194 | { | 197 | { |
195 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 198 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
196 | "%s is not a valid pabc credentials (attributes not an object)\n", | 199 | "%s is not a valid pab credentials (attributes not an object)\n", |
197 | data); | 200 | data); |
198 | json_decref (json_root); | 201 | json_decref (json_root); |
199 | return NULL; | 202 | return NULL; |
200 | } | 203 | } |
201 | 204 | ||
205 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
206 | "Collecting PABC attributes...\n"); | ||
202 | attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); | 207 | attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); |
203 | char *attr_str = json_dumps (json_attrs, JSON_DECODE_ANY); | 208 | char *attr_str = json_dumps (json_attrs, JSON_DECODE_ANY); |
204 | pabc_cred_inspect_credential (attr_str, &inspect_attrs, attrs); | 209 | GNUNET_assert (PABC_OK == |
210 | pabc_cred_inspect_credential (attr_str, | ||
211 | &inspect_attrs, attrs)); | ||
205 | json_decref (json_root); | 212 | json_decref (json_root); |
206 | return attrs; | 213 | return attrs; |
207 | } | 214 | } |
@@ -218,6 +225,8 @@ struct GNUNET_RECLAIM_AttributeList * | |||
218 | pabc_parse_attributes_c (void *cls, | 225 | pabc_parse_attributes_c (void *cls, |
219 | const struct GNUNET_RECLAIM_Credential *cred) | 226 | const struct GNUNET_RECLAIM_Credential *cred) |
220 | { | 227 | { |
228 | if (cred->type != GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC) | ||
229 | return NULL; | ||
221 | return pabc_parse_attributes (cls, cred->data, cred->data_size); | 230 | return pabc_parse_attributes (cls, cred->data, cred->data_size); |
222 | } | 231 | } |
223 | 232 | ||
@@ -233,6 +242,8 @@ struct GNUNET_RECLAIM_AttributeList * | |||
233 | pabc_parse_attributes_p (void *cls, | 242 | pabc_parse_attributes_p (void *cls, |
234 | const struct GNUNET_RECLAIM_Presentation *cred) | 243 | const struct GNUNET_RECLAIM_Presentation *cred) |
235 | { | 244 | { |
245 | if (cred->type != GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC) | ||
246 | return NULL; | ||
236 | return pabc_parse_attributes (cls, cred->data, cred->data_size); | 247 | return pabc_parse_attributes (cls, cred->data, cred->data_size); |
237 | } | 248 | } |
238 | 249 | ||
@@ -413,11 +424,13 @@ pabc_get_expiration (void *cls, | |||
413 | * @param cred the pabc credential | 424 | * @param cred the pabc credential |
414 | * @return a string, containing the isser | 425 | * @return a string, containing the isser |
415 | */ | 426 | */ |
416 | int | 427 | enum GNUNET_GenericReturnValue |
417 | pabc_get_expiration_c (void *cls, | 428 | pabc_get_expiration_c (void *cls, |
418 | const struct GNUNET_RECLAIM_Credential *cred, | 429 | const struct GNUNET_RECLAIM_Credential *cred, |
419 | struct GNUNET_TIME_Absolute *exp) | 430 | struct GNUNET_TIME_Absolute *exp) |
420 | { | 431 | { |
432 | if (cred->type != GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC) | ||
433 | return GNUNET_NO; | ||
421 | return pabc_get_expiration (cls, cred->data, cred->data_size, exp); | 434 | return pabc_get_expiration (cls, cred->data, cred->data_size, exp); |
422 | } | 435 | } |
423 | 436 | ||
@@ -429,11 +442,13 @@ pabc_get_expiration_c (void *cls, | |||
429 | * @param cred the pabc credential | 442 | * @param cred the pabc credential |
430 | * @return a string, containing the isser | 443 | * @return a string, containing the isser |
431 | */ | 444 | */ |
432 | int | 445 | enum GNUNET_GenericReturnValue |
433 | pabc_get_expiration_p (void *cls, | 446 | pabc_get_expiration_p (void *cls, |
434 | const struct GNUNET_RECLAIM_Presentation *cred, | 447 | const struct GNUNET_RECLAIM_Presentation *cred, |
435 | struct GNUNET_TIME_Absolute *exp) | 448 | struct GNUNET_TIME_Absolute *exp) |
436 | { | 449 | { |
450 | if (cred->type != GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC) | ||
451 | return GNUNET_NO; | ||
437 | return pabc_get_expiration (cls, cred->data, cred->data_size, exp); | 452 | return pabc_get_expiration (cls, cred->data, cred->data_size, exp); |
438 | } | 453 | } |
439 | 454 | ||