diff options
author | Markus Voggenreiter <Markus.Voggenreiter@tum.de> | 2019-11-29 13:00:18 +0100 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-01-13 13:31:05 +0100 |
commit | 76df96b59f803f9ba68849f452efbeed50d80086 (patch) | |
tree | 774df3681862e922231960ef238aa33b6a219048 /src/reclaim/plugin_rest_reclaim.c | |
parent | 1267dec774294ec2dcc6d2b89bced85eb4fadaa7 (diff) | |
download | gnunet-76df96b59f803f9ba68849f452efbeed50d80086.tar.gz gnunet-76df96b59f803f9ba68849f452efbeed50d80086.zip |
Fixed Adding Attestations
Diffstat (limited to 'src/reclaim/plugin_rest_reclaim.c')
-rw-r--r-- | src/reclaim/plugin_rest_reclaim.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c index 71c59ae90..a495c5e85 100644 --- a/src/reclaim/plugin_rest_reclaim.c +++ b/src/reclaim/plugin_rest_reclaim.c | |||
@@ -1198,14 +1198,15 @@ parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, | |||
1198 | attest->data_size); | 1198 | attest->data_size); |
1199 | char *jwt_body = strtok (jwt_string, delim); | 1199 | char *jwt_body = strtok (jwt_string, delim); |
1200 | jwt_body = strtok (NULL, delim); | 1200 | jwt_body = strtok (NULL, delim); |
1201 | GNUNET_STRINGS_base64_decode(jwt_body, strlen(jwt_body), (void **) &decoded_jwt); | 1201 | GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body), |
1202 | json_val=json_loads(decoded_jwt, JSON_DECODE_ANY, json_err); | 1202 | (void **) &decoded_jwt); |
1203 | json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err); | ||
1203 | const char *key; | 1204 | const char *key; |
1204 | json_t *value; | 1205 | json_t *value; |
1205 | json_object_foreach(json_val, key, value) { | 1206 | json_object_foreach (json_val, key, value) { |
1206 | if (0 == strcasecmp (key,claim)) | 1207 | if (0 == strcasecmp (key,claim)) |
1207 | { | 1208 | { |
1208 | val_str=json_dumps(value, JSON_ENCODE_ANY); | 1209 | val_str = json_dumps (value, JSON_ENCODE_ANY); |
1209 | } | 1210 | } |
1210 | } | 1211 | } |
1211 | type_str = "String"; | 1212 | type_str = "String"; |
@@ -1216,11 +1217,20 @@ parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, | |||
1216 | { | 1217 | { |
1217 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1218 | "Attribute value from JWT Parser invalid!\n"); | 1219 | "Attribute value from JWT Parser invalid!\n"); |
1219 | return NULL; | 1220 | GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type, |
1221 | "Error: Referenced Claim Name not Found", | ||
1222 | (void **) &data, | ||
1223 | &data_size); | ||
1224 | attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (claim, type, data, data_size); | ||
1225 | attr->id = attest->id; | ||
1226 | attr->flag = 1; | ||
1227 | } | ||
1228 | else | ||
1229 | { | ||
1230 | attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (claim, type, data, data_size); | ||
1231 | attr->id = attest->id; | ||
1232 | attr->flag = 1; | ||
1220 | } | 1233 | } |
1221 | attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (claim, type, data, data_size); | ||
1222 | attr->id = attest->id; | ||
1223 | attr->flag = 1; | ||
1224 | return attr; | 1234 | return attr; |
1225 | } | 1235 | } |
1226 | 1236 | ||
@@ -1260,13 +1270,13 @@ attr_collect (void *cls, | |||
1260 | } | 1270 | } |
1261 | struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr2; | 1271 | struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr2; |
1262 | attr2 = parse_jwt (attest, reference->reference_value); | 1272 | attr2 = parse_jwt (attest, reference->reference_value); |
1263 | attr2->name = reference->name; | ||
1264 | if (NULL == attr2) | 1273 | if (NULL == attr2) |
1265 | { | 1274 | { |
1266 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1275 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1267 | "Attribute Collection with unparsed Attestation\n"); | 1276 | "Attribute Collection with unparsed Attestation\n"); |
1268 | return; | 1277 | return; |
1269 | } | 1278 | } |
1279 | attr2->name = reference->name; | ||
1270 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding reference as attribute: %s\n", | 1280 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding reference as attribute: %s\n", |
1271 | reference->name); | 1281 | reference->name); |
1272 | char *tmp_value; | 1282 | char *tmp_value; |