diff options
author | Andreas Ebner <a.e.bner@web.de> | 2019-09-14 16:58:39 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-10-07 12:17:29 +0200 |
commit | 5be14856a356b087ad97b479efd9b06172fdfd2f (patch) | |
tree | 724a52f386be772cd8605224c47017f3b4d64e20 | |
parent | d4790594a33a4688641f66841f05533b3c0956b9 (diff) | |
download | gnunet-5be14856a356b087ad97b479efd9b06172fdfd2f.tar.gz gnunet-5be14856a356b087ad97b479efd9b06172fdfd2f.zip |
Bugfixes, changed test reporting behavior, modified intermediate result reporting:
- fixed a memory error when serializing the delegations
- all tests now handle the returned error code from the gnunet-credential.c via "ret" variable
- intermediate reporting excluded during collect message
- intermediate reporting now contains the direction (bw/fw)
-rw-r--r-- | src/credential/credential.h | 2 | ||||
-rw-r--r-- | src/credential/credential_api.c | 7 | ||||
-rw-r--r-- | src/credential/credential_serialization.c | 1 | ||||
-rw-r--r-- | src/credential/delegate_misc.c | 2 | ||||
-rw-r--r-- | src/credential/gnunet-credential.c | 27 | ||||
-rw-r--r-- | src/credential/gnunet-service-credential.c | 19 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and.sh | 10 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and2.sh | 10 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and3.sh | 11 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_bw.sh | 11 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_bw_link.sh | 10 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_bw_link2.sh | 10 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_fw.sh | 11 | ||||
-rwxr-xr-x | src/credential/test_credential_own.sh | 10 | ||||
-rwxr-xr-x | src/credential/test_credential_own_and2.sh | 22 | ||||
-rw-r--r-- | src/include/gnunet_credential_service.h | 3 |
16 files changed, 93 insertions, 73 deletions
diff --git a/src/credential/credential.h b/src/credential/credential.h index 504c7b464..1dd476814 100644 --- a/src/credential/credential.h +++ b/src/credential/credential.h | |||
@@ -160,6 +160,8 @@ struct DelegationChainIntermediateMessage | |||
160 | */ | 160 | */ |
161 | uint32_t id GNUNET_PACKED; | 161 | uint32_t id GNUNET_PACKED; |
162 | 162 | ||
163 | uint16_t is_bw GNUNET_PACKED; | ||
164 | |||
163 | uint32_t size GNUNET_PACKED; | 165 | uint32_t size GNUNET_PACKED; |
164 | }; | 166 | }; |
165 | 167 | ||
diff --git a/src/credential/credential_api.c b/src/credential/credential_api.c index dd66c8c72..a3eecd52d 100644 --- a/src/credential/credential_api.c +++ b/src/credential/credential_api.c | |||
@@ -270,12 +270,15 @@ handle_intermediate (void *cls, const struct DelegationChainIntermediateMessage | |||
270 | struct GNUNET_CREDENTIAL_Handle *handle = cls; | 270 | struct GNUNET_CREDENTIAL_Handle *handle = cls; |
271 | uint32_t r_id = ntohl (vr_msg->id); | 271 | uint32_t r_id = ntohl (vr_msg->id); |
272 | uint32_t size = ntohl (vr_msg->size); | 272 | uint32_t size = ntohl (vr_msg->size); |
273 | bool is_bw = ntohs(vr_msg->is_bw); | ||
273 | struct GNUNET_CREDENTIAL_Request *vr; | 274 | struct GNUNET_CREDENTIAL_Request *vr; |
274 | GNUNET_CREDENTIAL_IntermediateResultProcessor proc; | 275 | GNUNET_CREDENTIAL_IntermediateResultProcessor proc; |
275 | void *proc_cls; | 276 | void *proc_cls; |
276 | struct GNUNET_CREDENTIAL_Delegation *dd; | 277 | struct GNUNET_CREDENTIAL_Delegation *dd; |
277 | 278 | ||
279 | |||
278 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received intermediate reply from CREDENTIAL service\n"); | 280 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received intermediate reply from CREDENTIAL service\n"); |
281 | |||
279 | for (vr = handle->request_head; NULL != vr; vr = vr->next) | 282 | for (vr = handle->request_head; NULL != vr; vr = vr->next) |
280 | if (vr->r_id == r_id) | 283 | if (vr->r_id == r_id) |
281 | break; | 284 | break; |
@@ -294,8 +297,8 @@ handle_intermediate (void *cls, const struct DelegationChainIntermediateMessage | |||
294 | dd, | 297 | dd, |
295 | 0, | 298 | 0, |
296 | NULL)); | 299 | NULL)); |
297 | 300 | sleep(2); | |
298 | proc (proc_cls, dd); | 301 | proc (proc_cls, dd, is_bw); |
299 | } | 302 | } |
300 | 303 | ||
301 | 304 | ||
diff --git a/src/credential/credential_serialization.c b/src/credential/credential_serialization.c index 28773de8e..8d8eafa44 100644 --- a/src/credential/credential_serialization.c +++ b/src/credential/credential_serialization.c | |||
@@ -187,6 +187,7 @@ GNUNET_CREDENTIAL_delegates_serialize ( | |||
187 | off = 0; | 187 | off = 0; |
188 | for (i = 0; i < c_count; i++) | 188 | for (i = 0; i < c_count; i++) |
189 | { | 189 | { |
190 | //c_rec.subject_attribute_len = htonl ((uint32_t) cd[i].subject_attribute_len); | ||
190 | c_rec.issuer_attribute_len = htonl ((uint32_t) cd[i].issuer_attribute_len); | 191 | c_rec.issuer_attribute_len = htonl ((uint32_t) cd[i].issuer_attribute_len); |
191 | c_rec.issuer_key = cd[i].issuer_key; | 192 | c_rec.issuer_key = cd[i].issuer_key; |
192 | c_rec.subject_key = cd[i].subject_key; | 193 | c_rec.subject_key = cd[i].subject_key; |
diff --git a/src/credential/delegate_misc.c b/src/credential/delegate_misc.c index 25356ef7f..80124711a 100644 --- a/src/credential/delegate_misc.c +++ b/src/credential/delegate_misc.c | |||
@@ -151,7 +151,7 @@ GNUNET_CREDENTIAL_delegate_from_string (const char *s) | |||
151 | GNUNET_assert (sizeof (struct GNUNET_CRYPTO_EcdsaSignature) == | 151 | GNUNET_assert (sizeof (struct GNUNET_CRYPTO_EcdsaSignature) == |
152 | GNUNET_STRINGS_base64_decode (signature, | 152 | GNUNET_STRINGS_base64_decode (signature, |
153 | strlen (signature), | 153 | strlen (signature), |
154 | (char **) &sig)); | 154 | (void **) &sig)); |
155 | dele->signature = *sig; | 155 | dele->signature = *sig; |
156 | dele->expiration = etime_abs; | 156 | dele->expiration = etime_abs; |
157 | GNUNET_free (sig); | 157 | GNUNET_free (sig); |
diff --git a/src/credential/gnunet-credential.c b/src/credential/gnunet-credential.c index aa9828d4b..0d742d1ef 100644 --- a/src/credential/gnunet-credential.c +++ b/src/credential/gnunet-credential.c | |||
@@ -76,6 +76,11 @@ static struct GNUNET_CREDENTIAL_Request *collect_request; | |||
76 | static struct GNUNET_SCHEDULER_Task *tt; | 76 | static struct GNUNET_SCHEDULER_Task *tt; |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Return value of the commandline. | ||
80 | */ | ||
81 | static int ret = 0; | ||
82 | |||
83 | /** | ||
79 | * Subject pubkey string | 84 | * Subject pubkey string |
80 | */ | 85 | */ |
81 | static char *subject; | 86 | static char *subject; |
@@ -265,9 +270,18 @@ do_timeout (void *cls) | |||
265 | 270 | ||
266 | static void | 271 | static void |
267 | handle_intermediate_result(void *cls, | 272 | handle_intermediate_result(void *cls, |
268 | struct GNUNET_CREDENTIAL_Delegation *dd) | 273 | struct GNUNET_CREDENTIAL_Delegation *dd, |
274 | bool is_bw) | ||
269 | { | 275 | { |
270 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Intermediate result: %s.%s <- %s.%s\n", | 276 | char *prefix = ""; |
277 | // TODO change to printf | ||
278 | if(is_bw) | ||
279 | prefix = "Backward -"; | ||
280 | else | ||
281 | prefix = "Forward -"; | ||
282 | |||
283 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s Intermediate result: %s.%s <- %s.%s\n", | ||
284 | prefix, | ||
271 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->issuer_key), | 285 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->issuer_key), |
272 | dd->issuer_attribute, | 286 | dd->issuer_attribute, |
273 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->subject_key), | 287 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->subject_key), |
@@ -316,7 +330,7 @@ handle_verify_result (void *cls, | |||
316 | 330 | ||
317 | verify_request = NULL; | 331 | verify_request = NULL; |
318 | if (NULL == dele) | 332 | if (NULL == dele) |
319 | printf ("Failed.\n"); | 333 | ret = 1; |
320 | else | 334 | else |
321 | { | 335 | { |
322 | printf ("Delegation Chain:\n"); | 336 | printf ("Delegation Chain:\n"); |
@@ -1032,22 +1046,21 @@ main (int argc, char *const *argv) | |||
1032 | "Indicates that the collect/verify process is done via forward search."), | 1046 | "Indicates that the collect/verify process is done via forward search."), |
1033 | &backward), | 1047 | &backward), |
1034 | GNUNET_GETOPT_OPTION_END}; | 1048 | GNUNET_GETOPT_OPTION_END}; |
1035 | int ret; | 1049 | |
1036 | 1050 | ||
1037 | timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 1051 | timeout = GNUNET_TIME_UNIT_FOREVER_REL; |
1038 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 1052 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
1039 | return 2; | 1053 | return 2; |
1040 | 1054 | ||
1041 | GNUNET_log_setup ("gnunet-credential", "WARNING", NULL); | 1055 | GNUNET_log_setup ("gnunet-credential", "WARNING", NULL); |
1042 | ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc, | 1056 | if (GNUNET_OK == GNUNET_PROGRAM_run (argc, |
1043 | argv, | 1057 | argv, |
1044 | "gnunet-credential", | 1058 | "gnunet-credential", |
1045 | _ ("GNUnet credential resolver tool"), | 1059 | _ ("GNUnet credential resolver tool"), |
1046 | options, | 1060 | options, |
1047 | &run, | 1061 | &run, |
1048 | NULL)) | 1062 | NULL)) |
1049 | ? 0 | 1063 | ret = 1; |
1050 | : 1; | ||
1051 | GNUNET_free ((void *) argv); | 1064 | GNUNET_free ((void *) argv); |
1052 | return ret; | 1065 | return ret; |
1053 | } | 1066 | } |
diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c index cb0dca6b8..5ce0f70d9 100644 --- a/src/credential/gnunet-service-credential.c +++ b/src/credential/gnunet-service-credential.c | |||
@@ -247,6 +247,10 @@ struct DelegationSetQueueEntry | |||
247 | struct VerifyRequestHandle | 247 | struct VerifyRequestHandle |
248 | { | 248 | { |
249 | /** | 249 | /** |
250 | * True if created by a collect request. | ||
251 | */ | ||
252 | bool is_collect; | ||
253 | /** | ||
250 | * We keep these in a DLL. | 254 | * We keep these in a DLL. |
251 | */ | 255 | */ |
252 | struct VerifyRequestHandle *next; | 256 | struct VerifyRequestHandle *next; |
@@ -480,12 +484,16 @@ shutdown_task (void *cls) | |||
480 | } | 484 | } |
481 | 485 | ||
482 | static void | 486 | static void |
483 | send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationChainEntry *ch_entry){ | 487 | send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationChainEntry *ch_entry, bool is_bw){ |
484 | struct DelegationChainIntermediateMessage *rmsg; | 488 | struct DelegationChainIntermediateMessage *rmsg; |
485 | struct GNUNET_MQ_Envelope *env; | 489 | struct GNUNET_MQ_Envelope *env; |
486 | struct GNUNET_CREDENTIAL_Delegation *dd; | 490 | struct GNUNET_CREDENTIAL_Delegation *dd; |
487 | size_t size; | 491 | size_t size; |
488 | 492 | ||
493 | // Don't report immediate results during collect | ||
494 | if(vrh->is_collect) | ||
495 | return; | ||
496 | |||
489 | dd = GNUNET_new (struct GNUNET_CREDENTIAL_Delegation); | 497 | dd = GNUNET_new (struct GNUNET_CREDENTIAL_Delegation); |
490 | dd->issuer_key = ch_entry->issuer_key; | 498 | dd->issuer_key = ch_entry->issuer_key; |
491 | dd->subject_key = ch_entry->subject_key; | 499 | dd->subject_key = ch_entry->subject_key; |
@@ -510,6 +518,7 @@ send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationCha | |||
510 | GNUNET_MESSAGE_TYPE_CREDENTIAL_INTERMEDIATE_RESULT); | 518 | GNUNET_MESSAGE_TYPE_CREDENTIAL_INTERMEDIATE_RESULT); |
511 | // Assign id so that client can find associated request | 519 | // Assign id so that client can find associated request |
512 | rmsg->id = vrh->request_id; | 520 | rmsg->id = vrh->request_id; |
521 | rmsg->is_bw = htons(is_bw); | ||
513 | rmsg->size = htonl(size); | 522 | rmsg->size = htonl(size); |
514 | 523 | ||
515 | GNUNET_assert ( | 524 | GNUNET_assert ( |
@@ -864,7 +873,7 @@ forward_resolution (void *cls, | |||
864 | GNUNET_strdup (del->issuer_attribute); | 873 | GNUNET_strdup (del->issuer_attribute); |
865 | 874 | ||
866 | // Found new entry, repoting intermediate result | 875 | // Found new entry, repoting intermediate result |
867 | send_intermediate_response(vrh, ds_entry->delegation_chain_entry); | 876 | send_intermediate_response(vrh, ds_entry->delegation_chain_entry, false); |
868 | 877 | ||
869 | // current delegation as parent | 878 | // current delegation as parent |
870 | ds_entry->parent_queue_entry = dq_entry; | 879 | ds_entry->parent_queue_entry = dq_entry; |
@@ -1080,7 +1089,7 @@ backward_resolution (void *cls, | |||
1080 | GNUNET_strdup (current_set->lookup_attribute); | 1089 | GNUNET_strdup (current_set->lookup_attribute); |
1081 | 1090 | ||
1082 | // Found new entry, repoting intermediate result | 1091 | // Found new entry, repoting intermediate result |
1083 | send_intermediate_response(vrh, ds_entry->delegation_chain_entry); | 1092 | send_intermediate_response(vrh, ds_entry->delegation_chain_entry, true); |
1084 | 1093 | ||
1085 | ds_entry->parent_queue_entry = dq_entry; // current_delegation; | 1094 | ds_entry->parent_queue_entry = dq_entry; // current_delegation; |
1086 | 1095 | ||
@@ -1208,7 +1217,7 @@ backward_resolution (void *cls, | |||
1208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1217 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1209 | "%s still to go...\n", | 1218 | "%s still to go...\n", |
1210 | ds_entry->attr_trailer); | 1219 | ds_entry->attr_trailer); |
1211 | 1220 | // TODO remove | |
1212 | vrh->pending_lookups++; | 1221 | vrh->pending_lookups++; |
1213 | ds_entry->handle = vrh; | 1222 | ds_entry->handle = vrh; |
1214 | ds_entry->lookup_request = | 1223 | ds_entry->lookup_request = |
@@ -1449,6 +1458,7 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) | |||
1449 | GNUNET_memcpy (issuer_attribute, attr, ntohs (v_msg->issuer_attribute_len)); | 1458 | GNUNET_memcpy (issuer_attribute, attr, ntohs (v_msg->issuer_attribute_len)); |
1450 | issuer_attribute[ntohs (v_msg->issuer_attribute_len)] = '\0'; | 1459 | issuer_attribute[ntohs (v_msg->issuer_attribute_len)] = '\0'; |
1451 | vrh = GNUNET_new (struct VerifyRequestHandle); | 1460 | vrh = GNUNET_new (struct VerifyRequestHandle); |
1461 | vrh->is_collect = false; | ||
1452 | GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); | 1462 | GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); |
1453 | vrh->client = client; | 1463 | vrh->client = client; |
1454 | vrh->request_id = v_msg->id; | 1464 | vrh->request_id = v_msg->id; |
@@ -1623,6 +1633,7 @@ handle_collect (void *cls, const struct CollectMessage *c_msg) | |||
1623 | GNUNET_memcpy (issuer_attribute, attr, ntohs (c_msg->issuer_attribute_len)); | 1633 | GNUNET_memcpy (issuer_attribute, attr, ntohs (c_msg->issuer_attribute_len)); |
1624 | issuer_attribute[ntohs (c_msg->issuer_attribute_len)] = '\0'; | 1634 | issuer_attribute[ntohs (c_msg->issuer_attribute_len)] = '\0'; |
1625 | vrh = GNUNET_new (struct VerifyRequestHandle); | 1635 | vrh = GNUNET_new (struct VerifyRequestHandle); |
1636 | vrh->is_collect = true; | ||
1626 | GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); | 1637 | GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); |
1627 | vrh->client = client; | 1638 | vrh->client = client; |
1628 | vrh->request_id = c_msg->id; | 1639 | vrh->request_id = c_msg->id; |
diff --git a/src/credential/test_credential_bi_and.sh b/src/credential/test_credential_bi_and.sh index b5b55031c..66f0b29f2 100755 --- a/src/credential/test_credential_bi_and.sh +++ b/src/credential/test_credential_bi_and.sh | |||
@@ -73,7 +73,9 @@ echo "+++ Starting to Resolve +++" | |||
73 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` | 73 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` |
74 | echo $DELS | 74 | echo $DELS |
75 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | 75 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf |
76 | RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` | 76 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf |
77 | |||
78 | RES = $? | ||
77 | 79 | ||
78 | # Cleanup properly | 80 | # Cleanup properly |
79 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 81 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -85,13 +87,11 @@ gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | |||
85 | 87 | ||
86 | gnunet-arm -e -c test_credential_lookup.conf | 88 | gnunet-arm -e -c test_credential_lookup.conf |
87 | 89 | ||
88 | if [ "$RES_DELS" != "Failed." ] | 90 | if [ $RES == 0 ] |
89 | then | 91 | then |
90 | # TODO: replace echo -e bashism | ||
91 | echo -e "${RES_DELS}" | ||
92 | exit 0 | 92 | exit 0 |
93 | else | 93 | else |
94 | echo "FAIL: Failed to verify credential $RES_DELS." | 94 | echo "FAIL: Failed to verify credential." |
95 | exit 1 | 95 | exit 1 |
96 | fi | 96 | fi |
97 | 97 | ||
diff --git a/src/credential/test_credential_bi_and2.sh b/src/credential/test_credential_bi_and2.sh index 19354d3fe..8803dfda0 100755 --- a/src/credential/test_credential_bi_and2.sh +++ b/src/credential/test_credential_bi_and2.sh | |||
@@ -70,7 +70,9 @@ echo "+++ Starting to Resolve +++" | |||
70 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -` | 70 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -` |
71 | echo $DELS | 71 | echo $DELS |
72 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf | 72 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf |
73 | RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf` | 73 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf |
74 | |||
75 | RES = $? | ||
74 | 76 | ||
75 | # Cleanup properly | 77 | # Cleanup properly |
76 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 78 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -81,13 +83,11 @@ gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | |||
81 | 83 | ||
82 | gnunet-arm -e -c test_credential_lookup.conf | 84 | gnunet-arm -e -c test_credential_lookup.conf |
83 | 85 | ||
84 | if [ "$RES_DELS" != "Failed." ] | 86 | if [ $RES == 0 ] |
85 | then | 87 | then |
86 | # TODO: replace echo -e bashism | ||
87 | echo -e "${RES_DELS}" | ||
88 | exit 0 | 88 | exit 0 |
89 | else | 89 | else |
90 | echo "FAIL: Failed to verify credential $RES_DELS." | 90 | echo "FAIL: Failed to verify credential." |
91 | exit 1 | 91 | exit 1 |
92 | fi | 92 | fi |
93 | 93 | ||
diff --git a/src/credential/test_credential_bi_and3.sh b/src/credential/test_credential_bi_and3.sh index 83f2374a5..f88c23d46 100755 --- a/src/credential/test_credential_bi_and3.sh +++ b/src/credential/test_credential_bi_and3.sh | |||
@@ -73,7 +73,9 @@ echo "+++ Starting to Resolve +++" | |||
73 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -` | 73 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -` |
74 | echo $DELS | 74 | echo $DELS |
75 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf | 75 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf |
76 | RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf` | 76 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf |
77 | |||
78 | RES = $? | ||
77 | 79 | ||
78 | # Cleanup properly | 80 | # Cleanup properly |
79 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 81 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -85,13 +87,10 @@ gnunet-namestore -z h -d -n "@" -t DEL -c test_credential_lookup.conf | |||
85 | 87 | ||
86 | gnunet-arm -e -c test_credential_lookup.conf | 88 | gnunet-arm -e -c test_credential_lookup.conf |
87 | 89 | ||
88 | if [ "$RES_DELS" != "Failed." ] | 90 | if [ $RES == 0 ] |
89 | then | 91 | then |
90 | # TODO: replace echo -e bashism | ||
91 | echo -e "${RES_DELS}" | ||
92 | exit 0 | 92 | exit 0 |
93 | else | 93 | else |
94 | echo "FAIL: Failed to verify credential $RES_DELS." | 94 | echo "FAIL: Failed to verify credential." |
95 | exit 1 | 95 | exit 1 |
96 | fi | 96 | fi |
97 | |||
diff --git a/src/credential/test_credential_bi_bw.sh b/src/credential/test_credential_bi_bw.sh index ae5549a1d..eedcea7eb 100755 --- a/src/credential/test_credential_bi_bw.sh +++ b/src/credential/test_credential_bi_bw.sh | |||
@@ -64,7 +64,9 @@ echo "+++ Starting to Resolve +++" | |||
64 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` | 64 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` |
65 | echo $DELS | 65 | echo $DELS |
66 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | 66 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf |
67 | RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` | 67 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf |
68 | |||
69 | RES = $? | ||
68 | 70 | ||
69 | # Cleanup properly | 71 | # Cleanup properly |
70 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 72 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -75,13 +77,10 @@ gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | |||
75 | 77 | ||
76 | gnunet-arm -e -c test_credential_lookup.conf | 78 | gnunet-arm -e -c test_credential_lookup.conf |
77 | 79 | ||
78 | if [ "$RES_DELS" != "Failed." ] | 80 | if [ $RES == 0 ] |
79 | then | 81 | then |
80 | # TODO: replace echo -e bashism | ||
81 | echo -e "${RES_DELS}" | ||
82 | exit 0 | 82 | exit 0 |
83 | else | 83 | else |
84 | echo "FAIL: Failed to verify credential $RES_DELS." | 84 | echo "FAIL: Failed to verify credential." |
85 | exit 1 | 85 | exit 1 |
86 | fi | 86 | fi |
87 | |||
diff --git a/src/credential/test_credential_bi_bw_link.sh b/src/credential/test_credential_bi_bw_link.sh index 2ae04f824..a8a420d18 100755 --- a/src/credential/test_credential_bi_bw_link.sh +++ b/src/credential/test_credential_bi_bw_link.sh | |||
@@ -67,7 +67,9 @@ echo "+++ Starting to Resolve +++" | |||
67 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` | 67 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` |
68 | echo $DELS | 68 | echo $DELS |
69 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | 69 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf |
70 | RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` | 70 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf |
71 | |||
72 | RES = $? | ||
71 | 73 | ||
72 | # Cleanup properly | 74 | # Cleanup properly |
73 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 75 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -79,13 +81,11 @@ gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | |||
79 | 81 | ||
80 | gnunet-arm -e -c test_credential_lookup.conf | 82 | gnunet-arm -e -c test_credential_lookup.conf |
81 | 83 | ||
82 | if [ "$RES_DELS" != "Failed." ] | 84 | if [ $RES == 0 ] |
83 | then | 85 | then |
84 | # TODO: replace echo -e bashism | ||
85 | echo -e "${RES_DELS}" | ||
86 | exit 0 | 86 | exit 0 |
87 | else | 87 | else |
88 | echo "FAIL: Failed to verify credential $RES_DELS." | 88 | echo "FAIL: Failed to verify credential." |
89 | exit 1 | 89 | exit 1 |
90 | fi | 90 | fi |
91 | 91 | ||
diff --git a/src/credential/test_credential_bi_bw_link2.sh b/src/credential/test_credential_bi_bw_link2.sh index de4eec213..1c0d370db 100755 --- a/src/credential/test_credential_bi_bw_link2.sh +++ b/src/credential/test_credential_bi_bw_link2.sh | |||
@@ -68,7 +68,9 @@ echo "+++ Starting to Resolve +++" | |||
68 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` | 68 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` |
69 | echo $DELS | 69 | echo $DELS |
70 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | 70 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf |
71 | RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` | 71 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf |
72 | |||
73 | RES = $? | ||
72 | 74 | ||
73 | # Cleanup properly | 75 | # Cleanup properly |
74 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 76 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -80,13 +82,11 @@ gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | |||
80 | 82 | ||
81 | gnunet-arm -e -c test_credential_lookup.conf | 83 | gnunet-arm -e -c test_credential_lookup.conf |
82 | 84 | ||
83 | if [ "$RES_DELS" != "Failed." ] | 85 | if [ $RES == 0 ] |
84 | then | 86 | then |
85 | # TODO: replace echo -e bashism | ||
86 | echo -e "${RES_DELS}" | ||
87 | exit 0 | 87 | exit 0 |
88 | else | 88 | else |
89 | echo "FAIL: Failed to verify credential $RES_DELS." | 89 | echo "FAIL: Failed to verify credential." |
90 | exit 1 | 90 | exit 1 |
91 | fi | 91 | fi |
92 | 92 | ||
diff --git a/src/credential/test_credential_bi_fw.sh b/src/credential/test_credential_bi_fw.sh index 3eeb48ee9..2aba82479 100755 --- a/src/credential/test_credential_bi_fw.sh +++ b/src/credential/test_credential_bi_fw.sh | |||
@@ -68,7 +68,9 @@ echo "+++ Starting to Resolve +++" | |||
68 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=g --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` | 68 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=g --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` |
69 | echo $DELS | 69 | echo $DELS |
70 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | 70 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf |
71 | RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` | 71 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf |
72 | |||
73 | RES = $? | ||
72 | 74 | ||
73 | # Cleanup properly | 75 | # Cleanup properly |
74 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 76 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -80,13 +82,10 @@ gnunet-namestore -z g -d -n "@" -t DEL -c test_credential_lookup.conf | |||
80 | 82 | ||
81 | gnunet-arm -e -c test_credential_lookup.conf | 83 | gnunet-arm -e -c test_credential_lookup.conf |
82 | 84 | ||
83 | if [ "$RES_DELS" != "Failed." ] | 85 | if [ $RES == 0 ] |
84 | then | 86 | then |
85 | # TODO: replace echo -e bashism | ||
86 | echo -e "${RES_DELS}" | ||
87 | exit 0 | 87 | exit 0 |
88 | else | 88 | else |
89 | echo "FAIL: Failed to verify credential $RES_DELS." | 89 | echo "FAIL: Failed to verify credential." |
90 | exit 1 | 90 | exit 1 |
91 | fi | 91 | fi |
92 | |||
diff --git a/src/credential/test_credential_own.sh b/src/credential/test_credential_own.sh index 2bb5cb070..fa2580a22 100755 --- a/src/credential/test_credential_own.sh +++ b/src/credential/test_credential_own.sh | |||
@@ -107,9 +107,9 @@ echo "+++ Starting to Resolve +++" | |||
107 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s` | 107 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s` |
108 | echo $DELS | 108 | echo $DELS |
109 | echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf | 109 | echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf |
110 | RES_DELS=`gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf` | 110 | gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf |
111 | |||
112 | 111 | ||
112 | RES=$? | ||
113 | 113 | ||
114 | # Cleanup properly | 114 | # Cleanup properly |
115 | gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf | 115 | gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf |
@@ -123,13 +123,11 @@ gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_loo | |||
123 | 123 | ||
124 | gnunet-arm -e -c test_credential_lookup.conf | 124 | gnunet-arm -e -c test_credential_lookup.conf |
125 | 125 | ||
126 | if [ "$RES_DELS" != "Failed." ] | 126 | if [ $RES == 0 ] |
127 | then | 127 | then |
128 | # TODO: replace echo -e bashism | ||
129 | echo -e "${RES_DELS}" | ||
130 | exit 0 | 128 | exit 0 |
131 | else | 129 | else |
132 | echo "FAIL: Failed to verify credential $RES_DELS." | 130 | echo "FAIL: Failed to verify credential." |
133 | exit 1 | 131 | exit 1 |
134 | fi | 132 | fi |
135 | 133 | ||
diff --git a/src/credential/test_credential_own_and2.sh b/src/credential/test_credential_own_and2.sh index bbce251ec..9abfac899 100755 --- a/src/credential/test_credential_own_and2.sh +++ b/src/credential/test_credential_own_and2.sh | |||
@@ -51,7 +51,6 @@ gnunet-namestore -D -z b | |||
51 | 51 | ||
52 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=g --attribute="g" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` | 52 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=g --attribute="g" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` |
53 | gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private | 53 | gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private |
54 | gnunet-namestore -D -z h | ||
55 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` | 54 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` |
56 | gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private | 55 | gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private |
57 | gnunet-namestore -D -z f | 56 | gnunet-namestore -D -z f |
@@ -62,27 +61,22 @@ echo "+++ Starting to Resolve +++" | |||
62 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --backward -c test_credential_lookup.conf | paste -d, -s` | 61 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --backward -c test_credential_lookup.conf | paste -d, -s` |
63 | echo $DELS | 62 | echo $DELS |
64 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf | 63 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf |
65 | RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf` | 64 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf |
65 | |||
66 | RES = $? | ||
66 | 67 | ||
67 | # Cleanup properly | 68 | # Cleanup properly |
68 | gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf | 69 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
69 | gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf | 70 | gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf |
70 | gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | 71 | gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf |
71 | #gnunet-namestore -z a -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
72 | #gnunet-namestore -z d -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
73 | #gnunet-namestore -z e -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
74 | #gnunet-namestore -z f -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
75 | #gnunet-namestore -z g -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
76 | 72 | ||
77 | gnunet-arm -e -c test_credential_lookup.conf | 73 | gnunet-arm -e -c test_credential_lookup.conf |
78 | 74 | ||
79 | if [ "$RES_DELS" != "Failed." ] | 75 | if [ $RES == 0 ] |
80 | then | 76 | then |
81 | # TODO: replace echo -e bashism | ||
82 | echo -e "${RES_DELS}" | ||
83 | exit 0 | 77 | exit 0 |
84 | else | 78 | else |
85 | echo "FAIL: Failed to verify credential $RES_DELS." | 79 | echo "FAIL: Failed to verify credential." |
86 | exit 1 | 80 | exit 1 |
87 | fi | 81 | fi |
88 | 82 | ||
diff --git a/src/include/gnunet_credential_service.h b/src/include/gnunet_credential_service.h index fdee3b641..325296ecc 100644 --- a/src/include/gnunet_credential_service.h +++ b/src/include/gnunet_credential_service.h | |||
@@ -262,7 +262,8 @@ typedef void (*GNUNET_CREDENTIAL_CredentialResultProcessor) (void *cls, | |||
262 | struct GNUNET_CREDENTIAL_Delegate *delegte); | 262 | struct GNUNET_CREDENTIAL_Delegate *delegte); |
263 | 263 | ||
264 | typedef void (*GNUNET_CREDENTIAL_IntermediateResultProcessor) (void *cls, | 264 | typedef void (*GNUNET_CREDENTIAL_IntermediateResultProcessor) (void *cls, |
265 | struct GNUNET_CREDENTIAL_Delegation *delegation); | 265 | struct GNUNET_CREDENTIAL_Delegation *delegation, |
266 | bool is_bw); | ||
266 | 267 | ||
267 | /** | 268 | /** |
268 | * Iterator called on obtained result for an attribute delegation. | 269 | * Iterator called on obtained result for an attribute delegation. |