summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/credential/credential.h2
-rw-r--r--src/credential/credential_api.c7
-rw-r--r--src/credential/credential_serialization.c1
-rw-r--r--src/credential/delegate_misc.c2
-rw-r--r--src/credential/gnunet-credential.c27
-rw-r--r--src/credential/gnunet-service-credential.c19
-rwxr-xr-xsrc/credential/test_credential_bi_and.sh10
-rwxr-xr-xsrc/credential/test_credential_bi_and2.sh10
-rwxr-xr-xsrc/credential/test_credential_bi_and3.sh11
-rwxr-xr-xsrc/credential/test_credential_bi_bw.sh11
-rwxr-xr-xsrc/credential/test_credential_bi_bw_link.sh10
-rwxr-xr-xsrc/credential/test_credential_bi_bw_link2.sh10
-rwxr-xr-xsrc/credential/test_credential_bi_fw.sh11
-rwxr-xr-xsrc/credential/test_credential_own.sh10
-rwxr-xr-xsrc/credential/test_credential_own_and2.sh22
-rw-r--r--src/include/gnunet_credential_service.h3
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;
76static struct GNUNET_SCHEDULER_Task *tt; 76static struct GNUNET_SCHEDULER_Task *tt;
77 77
78/** 78/**
79 * Return value of the commandline.
80 */
81static int ret = 0;
82
83/**
79 * Subject pubkey string 84 * Subject pubkey string
80 */ 85 */
81static char *subject; 86static char *subject;
@@ -265,9 +270,18 @@ do_timeout (void *cls)
265 270
266static void 271static void
267handle_intermediate_result(void *cls, 272handle_intermediate_result(void *cls,
268struct 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
247struct VerifyRequestHandle 247struct 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
482static void 486static void
483send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationChainEntry *ch_entry){ 487send_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 +++"
73DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` 73DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -`
74echo $DELS 74echo $DELS
75echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf 75echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf
76RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` 76gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf
77
78RES = $?
77 79
78# Cleanup properly 80# Cleanup properly
79gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 81gnunet-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
86gnunet-arm -e -c test_credential_lookup.conf 88gnunet-arm -e -c test_credential_lookup.conf
87 89
88if [ "$RES_DELS" != "Failed." ] 90if [ $RES == 0 ]
89then 91then
90 # TODO: replace echo -e bashism
91 echo -e "${RES_DELS}"
92 exit 0 92 exit 0
93else 93else
94 echo "FAIL: Failed to verify credential $RES_DELS." 94 echo "FAIL: Failed to verify credential."
95 exit 1 95 exit 1
96fi 96fi
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 +++"
70DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -` 70DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -`
71echo $DELS 71echo $DELS
72echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf 72echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf
73RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf` 73gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf
74
75RES = $?
74 76
75# Cleanup properly 77# Cleanup properly
76gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 78gnunet-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
82gnunet-arm -e -c test_credential_lookup.conf 84gnunet-arm -e -c test_credential_lookup.conf
83 85
84if [ "$RES_DELS" != "Failed." ] 86if [ $RES == 0 ]
85then 87then
86 # TODO: replace echo -e bashism
87 echo -e "${RES_DELS}"
88 exit 0 88 exit 0
89else 89else
90 echo "FAIL: Failed to verify credential $RES_DELS." 90 echo "FAIL: Failed to verify credential."
91 exit 1 91 exit 1
92fi 92fi
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 +++"
73DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -` 73DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -`
74echo $DELS 74echo $DELS
75echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf 75echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf
76RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf` 76gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf
77
78RES = $?
77 79
78# Cleanup properly 80# Cleanup properly
79gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 81gnunet-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
86gnunet-arm -e -c test_credential_lookup.conf 88gnunet-arm -e -c test_credential_lookup.conf
87 89
88if [ "$RES_DELS" != "Failed." ] 90if [ $RES == 0 ]
89then 91then
90 # TODO: replace echo -e bashism
91 echo -e "${RES_DELS}"
92 exit 0 92 exit 0
93else 93else
94 echo "FAIL: Failed to verify credential $RES_DELS." 94 echo "FAIL: Failed to verify credential."
95 exit 1 95 exit 1
96fi 96fi
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 +++"
64DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` 64DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -`
65echo $DELS 65echo $DELS
66echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf 66echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf
67RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` 67gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf
68
69RES = $?
68 70
69# Cleanup properly 71# Cleanup properly
70gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 72gnunet-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
76gnunet-arm -e -c test_credential_lookup.conf 78gnunet-arm -e -c test_credential_lookup.conf
77 79
78if [ "$RES_DELS" != "Failed." ] 80if [ $RES == 0 ]
79then 81then
80 # TODO: replace echo -e bashism
81 echo -e "${RES_DELS}"
82 exit 0 82 exit 0
83else 83else
84 echo "FAIL: Failed to verify credential $RES_DELS." 84 echo "FAIL: Failed to verify credential."
85 exit 1 85 exit 1
86fi 86fi
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 +++"
67DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` 67DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -`
68echo $DELS 68echo $DELS
69echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf 69echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf
70RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` 70gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf
71
72RES = $?
71 73
72# Cleanup properly 74# Cleanup properly
73gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 75gnunet-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
80gnunet-arm -e -c test_credential_lookup.conf 82gnunet-arm -e -c test_credential_lookup.conf
81 83
82if [ "$RES_DELS" != "Failed." ] 84if [ $RES == 0 ]
83then 85then
84 # TODO: replace echo -e bashism
85 echo -e "${RES_DELS}"
86 exit 0 86 exit 0
87else 87else
88 echo "FAIL: Failed to verify credential $RES_DELS." 88 echo "FAIL: Failed to verify credential."
89 exit 1 89 exit 1
90fi 90fi
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 +++"
68DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` 68DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -`
69echo $DELS 69echo $DELS
70echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf 70echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf
71RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` 71gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf
72
73RES = $?
72 74
73# Cleanup properly 75# Cleanup properly
74gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 76gnunet-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
81gnunet-arm -e -c test_credential_lookup.conf 83gnunet-arm -e -c test_credential_lookup.conf
82 84
83if [ "$RES_DELS" != "Failed." ] 85if [ $RES == 0 ]
84then 86then
85 # TODO: replace echo -e bashism
86 echo -e "${RES_DELS}"
87 exit 0 87 exit 0
88else 88else
89 echo "FAIL: Failed to verify credential $RES_DELS." 89 echo "FAIL: Failed to verify credential."
90 exit 1 90 exit 1
91fi 91fi
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 +++"
68DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=g --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` 68DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=g --forward --backward -c test_credential_lookup.conf | paste -d, -s - -`
69echo $DELS 69echo $DELS
70echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf 70echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf
71RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` 71gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf
72
73RES = $?
72 74
73# Cleanup properly 75# Cleanup properly
74gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 76gnunet-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
81gnunet-arm -e -c test_credential_lookup.conf 83gnunet-arm -e -c test_credential_lookup.conf
82 84
83if [ "$RES_DELS" != "Failed." ] 85if [ $RES == 0 ]
84then 86then
85 # TODO: replace echo -e bashism
86 echo -e "${RES_DELS}"
87 exit 0 87 exit 0
88else 88else
89 echo "FAIL: Failed to verify credential $RES_DELS." 89 echo "FAIL: Failed to verify credential."
90 exit 1 90 exit 1
91fi 91fi
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 +++"
107DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s` 107DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s`
108echo $DELS 108echo $DELS
109echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf 109echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf
110RES_DELS=`gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf` 110gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf
111
112 111
112RES=$?
113 113
114# Cleanup properly 114# Cleanup properly
115gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf 115gnunet-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
124gnunet-arm -e -c test_credential_lookup.conf 124gnunet-arm -e -c test_credential_lookup.conf
125 125
126if [ "$RES_DELS" != "Failed." ] 126if [ $RES == 0 ]
127then 127then
128 # TODO: replace echo -e bashism
129 echo -e "${RES_DELS}"
130 exit 0 128 exit 0
131else 129else
132 echo "FAIL: Failed to verify credential $RES_DELS." 130 echo "FAIL: Failed to verify credential."
133 exit 1 131 exit 1
134fi 132fi
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
52SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=g --attribute="g" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` 52SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=g --attribute="g" --subject="$FKEY" --ttl="2019-12-12 10:00:00"`
53gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private 53gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private
54gnunet-namestore -D -z h
55SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` 54SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$FKEY" --ttl="2019-12-12 10:00:00"`
56gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private 55gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private
57gnunet-namestore -D -z f 56gnunet-namestore -D -z f
@@ -62,27 +61,22 @@ echo "+++ Starting to Resolve +++"
62DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --backward -c test_credential_lookup.conf | paste -d, -s` 61DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --backward -c test_credential_lookup.conf | paste -d, -s`
63echo $DELS 62echo $DELS
64echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf 63echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf
65RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf` 64gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf
65
66RES = $?
66 67
67# Cleanup properly 68# Cleanup properly
68gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf 69gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf
69gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf 70gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf
70gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf 71gnunet-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
77gnunet-arm -e -c test_credential_lookup.conf 73gnunet-arm -e -c test_credential_lookup.conf
78 74
79if [ "$RES_DELS" != "Failed." ] 75if [ $RES == 0 ]
80then 76then
81 # TODO: replace echo -e bashism
82 echo -e "${RES_DELS}"
83 exit 0 77 exit 0
84else 78else
85 echo "FAIL: Failed to verify credential $RES_DELS." 79 echo "FAIL: Failed to verify credential."
86 exit 1 80 exit 1
87fi 81fi
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
264typedef void (*GNUNET_CREDENTIAL_IntermediateResultProcessor) (void *cls, 264typedef 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.