diff options
Diffstat (limited to 'src/reclaim/plugin_reclaim_credential_pabc.c')
-rw-r--r-- | src/reclaim/plugin_reclaim_credential_pabc.c | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/src/reclaim/plugin_reclaim_credential_pabc.c b/src/reclaim/plugin_reclaim_credential_pabc.c index 84b1f92f5..8f9a0509d 100644 --- a/src/reclaim/plugin_reclaim_credential_pabc.c +++ b/src/reclaim/plugin_reclaim_credential_pabc.c | |||
@@ -151,6 +151,8 @@ 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 | if (NULL == value) | ||
155 | return; | ||
154 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
155 | "Found attribue in PABC credential: `%s': `%s'\n", | 157 | "Found attribue in PABC credential: `%s': `%s'\n", |
156 | key, value); | 158 | key, value); |
@@ -176,40 +178,13 @@ pabc_parse_attributes (void *cls, | |||
176 | size_t data_size) | 178 | size_t data_size) |
177 | { | 179 | { |
178 | struct GNUNET_RECLAIM_AttributeList *attrs; | 180 | struct GNUNET_RECLAIM_AttributeList *attrs; |
179 | json_t *json_root; | ||
180 | json_t *json_attrs; | ||
181 | json_error_t *json_err = NULL; | ||
182 | |||
183 | json_root = json_loads (data, JSON_DECODE_ANY, json_err); | ||
184 | if ((NULL == json_root) || | ||
185 | (! json_is_object (json_root))) | ||
186 | { | ||
187 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
188 | "%s is not a valid pabc credentials (not an object)\n", | ||
189 | data); | ||
190 | if (NULL != json_root) | ||
191 | json_decref (json_root); | ||
192 | return NULL; | ||
193 | } | ||
194 | json_attrs = json_object_get (json_root, PABC_JSON_PLAIN_ATTRS_KEY); | ||
195 | if ((NULL == json_attrs) || | ||
196 | (! json_is_object (json_attrs))) | ||
197 | { | ||
198 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
199 | "%s is not a valid pab credentials (attributes not an object)\n", | ||
200 | data); | ||
201 | json_decref (json_root); | ||
202 | return NULL; | ||
203 | } | ||
204 | 181 | ||
205 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 182 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
206 | "Collecting PABC attributes...\n"); | 183 | "Collecting PABC attributes...\n"); |
207 | attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); | 184 | attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); |
208 | char *attr_str = json_dumps (json_attrs, JSON_DECODE_ANY); | ||
209 | GNUNET_assert (PABC_OK == | 185 | GNUNET_assert (PABC_OK == |
210 | pabc_cred_inspect_credential (attr_str, | 186 | pabc_cred_inspect_credential (data, |
211 | &inspect_attrs, attrs)); | 187 | &inspect_attrs, attrs)); |
212 | json_decref (json_root); | ||
213 | return attrs; | 188 | return attrs; |
214 | } | 189 | } |
215 | 190 | ||