From 5be14856a356b087ad97b479efd9b06172fdfd2f Mon Sep 17 00:00:00 2001 From: Andreas Ebner Date: Sat, 14 Sep 2019 16:58:39 +0200 Subject: 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) --- src/credential/credential.h | 2 ++ src/credential/credential_api.c | 7 +++++-- src/credential/credential_serialization.c | 1 + src/credential/delegate_misc.c | 2 +- src/credential/gnunet-credential.c | 27 ++++++++++++++++++++------- src/credential/gnunet-service-credential.c | 19 +++++++++++++++---- src/credential/test_credential_bi_and.sh | 10 +++++----- src/credential/test_credential_bi_and2.sh | 10 +++++----- src/credential/test_credential_bi_and3.sh | 11 +++++------ src/credential/test_credential_bi_bw.sh | 11 +++++------ src/credential/test_credential_bi_bw_link.sh | 10 +++++----- src/credential/test_credential_bi_bw_link2.sh | 10 +++++----- src/credential/test_credential_bi_fw.sh | 11 +++++------ src/credential/test_credential_own.sh | 10 ++++------ src/credential/test_credential_own_and2.sh | 22 ++++++++-------------- 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 */ uint32_t id GNUNET_PACKED; + uint16_t is_bw GNUNET_PACKED; + uint32_t size GNUNET_PACKED; }; 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 struct GNUNET_CREDENTIAL_Handle *handle = cls; uint32_t r_id = ntohl (vr_msg->id); uint32_t size = ntohl (vr_msg->size); + bool is_bw = ntohs(vr_msg->is_bw); struct GNUNET_CREDENTIAL_Request *vr; GNUNET_CREDENTIAL_IntermediateResultProcessor proc; void *proc_cls; struct GNUNET_CREDENTIAL_Delegation *dd; + LOG (GNUNET_ERROR_TYPE_DEBUG, "Received intermediate reply from CREDENTIAL service\n"); + for (vr = handle->request_head; NULL != vr; vr = vr->next) if (vr->r_id == r_id) break; @@ -294,8 +297,8 @@ handle_intermediate (void *cls, const struct DelegationChainIntermediateMessage dd, 0, NULL)); - - proc (proc_cls, dd); + sleep(2); + proc (proc_cls, dd, is_bw); } 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 ( off = 0; for (i = 0; i < c_count; i++) { + //c_rec.subject_attribute_len = htonl ((uint32_t) cd[i].subject_attribute_len); c_rec.issuer_attribute_len = htonl ((uint32_t) cd[i].issuer_attribute_len); c_rec.issuer_key = cd[i].issuer_key; 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) GNUNET_assert (sizeof (struct GNUNET_CRYPTO_EcdsaSignature) == GNUNET_STRINGS_base64_decode (signature, strlen (signature), - (char **) &sig)); + (void **) &sig)); dele->signature = *sig; dele->expiration = etime_abs; 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 @@ -75,6 +75,11 @@ static struct GNUNET_CREDENTIAL_Request *collect_request; */ static struct GNUNET_SCHEDULER_Task *tt; +/** + * Return value of the commandline. + */ +static int ret = 0; + /** * Subject pubkey string */ @@ -265,9 +270,18 @@ do_timeout (void *cls) static void handle_intermediate_result(void *cls, -struct GNUNET_CREDENTIAL_Delegation *dd) + struct GNUNET_CREDENTIAL_Delegation *dd, + bool is_bw) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Intermediate result: %s.%s <- %s.%s\n", + char *prefix = ""; + // TODO change to printf + if(is_bw) + prefix = "Backward -"; + else + prefix = "Forward -"; + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s Intermediate result: %s.%s <- %s.%s\n", + prefix, GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->issuer_key), dd->issuer_attribute, GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->subject_key), @@ -316,7 +330,7 @@ handle_verify_result (void *cls, verify_request = NULL; if (NULL == dele) - printf ("Failed.\n"); + ret = 1; else { printf ("Delegation Chain:\n"); @@ -1032,22 +1046,21 @@ main (int argc, char *const *argv) "Indicates that the collect/verify process is done via forward search."), &backward), GNUNET_GETOPT_OPTION_END}; - int ret; + timeout = GNUNET_TIME_UNIT_FOREVER_REL; if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) return 2; GNUNET_log_setup ("gnunet-credential", "WARNING", NULL); - ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc, + if (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "gnunet-credential", _ ("GNUnet credential resolver tool"), options, &run, NULL)) - ? 0 - : 1; + ret = 1; GNUNET_free ((void *) argv); return ret; } 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 @@ -246,6 +246,10 @@ struct DelegationSetQueueEntry */ struct VerifyRequestHandle { + /** + * True if created by a collect request. + */ + bool is_collect; /** * We keep these in a DLL. */ @@ -480,12 +484,16 @@ shutdown_task (void *cls) } static void -send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationChainEntry *ch_entry){ +send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationChainEntry *ch_entry, bool is_bw){ struct DelegationChainIntermediateMessage *rmsg; struct GNUNET_MQ_Envelope *env; struct GNUNET_CREDENTIAL_Delegation *dd; size_t size; + // Don't report immediate results during collect + if(vrh->is_collect) + return; + dd = GNUNET_new (struct GNUNET_CREDENTIAL_Delegation); dd->issuer_key = ch_entry->issuer_key; dd->subject_key = ch_entry->subject_key; @@ -510,6 +518,7 @@ send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationCha GNUNET_MESSAGE_TYPE_CREDENTIAL_INTERMEDIATE_RESULT); // Assign id so that client can find associated request rmsg->id = vrh->request_id; + rmsg->is_bw = htons(is_bw); rmsg->size = htonl(size); GNUNET_assert ( @@ -864,7 +873,7 @@ forward_resolution (void *cls, GNUNET_strdup (del->issuer_attribute); // Found new entry, repoting intermediate result - send_intermediate_response(vrh, ds_entry->delegation_chain_entry); + send_intermediate_response(vrh, ds_entry->delegation_chain_entry, false); // current delegation as parent ds_entry->parent_queue_entry = dq_entry; @@ -1080,7 +1089,7 @@ backward_resolution (void *cls, GNUNET_strdup (current_set->lookup_attribute); // Found new entry, repoting intermediate result - send_intermediate_response(vrh, ds_entry->delegation_chain_entry); + send_intermediate_response(vrh, ds_entry->delegation_chain_entry, true); ds_entry->parent_queue_entry = dq_entry; // current_delegation; @@ -1208,7 +1217,7 @@ backward_resolution (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s still to go...\n", ds_entry->attr_trailer); - + // TODO remove vrh->pending_lookups++; ds_entry->handle = vrh; ds_entry->lookup_request = @@ -1449,6 +1458,7 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) GNUNET_memcpy (issuer_attribute, attr, ntohs (v_msg->issuer_attribute_len)); issuer_attribute[ntohs (v_msg->issuer_attribute_len)] = '\0'; vrh = GNUNET_new (struct VerifyRequestHandle); + vrh->is_collect = false; GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); vrh->client = client; vrh->request_id = v_msg->id; @@ -1623,6 +1633,7 @@ handle_collect (void *cls, const struct CollectMessage *c_msg) GNUNET_memcpy (issuer_attribute, attr, ntohs (c_msg->issuer_attribute_len)); issuer_attribute[ntohs (c_msg->issuer_attribute_len)] = '\0'; vrh = GNUNET_new (struct VerifyRequestHandle); + vrh->is_collect = true; GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); vrh->client = client; 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 +++" DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` echo $DELS echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf -RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` +gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf + +RES = $? # Cleanup properly 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 gnunet-arm -e -c test_credential_lookup.conf -if [ "$RES_DELS" != "Failed." ] +if [ $RES == 0 ] then - # TODO: replace echo -e bashism - echo -e "${RES_DELS}" exit 0 else - echo "FAIL: Failed to verify credential $RES_DELS." + echo "FAIL: Failed to verify credential." exit 1 fi 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 +++" DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -` echo $DELS echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf -RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf` +gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf + +RES = $? # Cleanup properly 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 gnunet-arm -e -c test_credential_lookup.conf -if [ "$RES_DELS" != "Failed." ] +if [ $RES == 0 ] then - # TODO: replace echo -e bashism - echo -e "${RES_DELS}" exit 0 else - echo "FAIL: Failed to verify credential $RES_DELS." + echo "FAIL: Failed to verify credential." exit 1 fi 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 +++" DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -` echo $DELS echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf -RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf` +gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf + +RES = $? # Cleanup properly 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 gnunet-arm -e -c test_credential_lookup.conf -if [ "$RES_DELS" != "Failed." ] +if [ $RES == 0 ] then - # TODO: replace echo -e bashism - echo -e "${RES_DELS}" exit 0 else - echo "FAIL: Failed to verify credential $RES_DELS." + echo "FAIL: Failed to verify credential." exit 1 fi - 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 +++" DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` echo $DELS echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf -RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` +gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf + +RES = $? # Cleanup properly 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 gnunet-arm -e -c test_credential_lookup.conf -if [ "$RES_DELS" != "Failed." ] +if [ $RES == 0 ] then - # TODO: replace echo -e bashism - echo -e "${RES_DELS}" exit 0 else - echo "FAIL: Failed to verify credential $RES_DELS." + echo "FAIL: Failed to verify credential." exit 1 fi - 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 +++" DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` echo $DELS echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf -RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` +gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf + +RES = $? # Cleanup properly 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 gnunet-arm -e -c test_credential_lookup.conf -if [ "$RES_DELS" != "Failed." ] +if [ $RES == 0 ] then - # TODO: replace echo -e bashism - echo -e "${RES_DELS}" exit 0 else - echo "FAIL: Failed to verify credential $RES_DELS." + echo "FAIL: Failed to verify credential." exit 1 fi 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 +++" DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` echo $DELS echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf -RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` +gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf + +RES = $? # Cleanup properly 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 gnunet-arm -e -c test_credential_lookup.conf -if [ "$RES_DELS" != "Failed." ] +if [ $RES == 0 ] then - # TODO: replace echo -e bashism - echo -e "${RES_DELS}" exit 0 else - echo "FAIL: Failed to verify credential $RES_DELS." + echo "FAIL: Failed to verify credential." exit 1 fi 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 +++" DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=g --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` echo $DELS echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf -RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` +gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf + +RES = $? # Cleanup properly 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 gnunet-arm -e -c test_credential_lookup.conf -if [ "$RES_DELS" != "Failed." ] +if [ $RES == 0 ] then - # TODO: replace echo -e bashism - echo -e "${RES_DELS}" exit 0 else - echo "FAIL: Failed to verify credential $RES_DELS." + echo "FAIL: Failed to verify credential." exit 1 fi - 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 +++" DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s` echo $DELS echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf -RES_DELS=`gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf` - +gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf +RES=$? # Cleanup properly 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 gnunet-arm -e -c test_credential_lookup.conf -if [ "$RES_DELS" != "Failed." ] +if [ $RES == 0 ] then - # TODO: replace echo -e bashism - echo -e "${RES_DELS}" exit 0 else - echo "FAIL: Failed to verify credential $RES_DELS." + echo "FAIL: Failed to verify credential." exit 1 fi 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 SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=g --attribute="g" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private -gnunet-namestore -D -z h SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private gnunet-namestore -D -z f @@ -62,27 +61,22 @@ echo "+++ Starting to Resolve +++" DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --backward -c test_credential_lookup.conf | paste -d, -s` echo $DELS echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf -RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf` +gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf + +RES = $? # Cleanup properly -gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf -gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf -#gnunet-namestore -z a -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf -#gnunet-namestore -z d -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf -#gnunet-namestore -z e -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf -#gnunet-namestore -z f -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf -#gnunet-namestore -z g -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf +gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf +gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf +gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf gnunet-arm -e -c test_credential_lookup.conf -if [ "$RES_DELS" != "Failed." ] +if [ $RES == 0 ] then - # TODO: replace echo -e bashism - echo -e "${RES_DELS}" exit 0 else - echo "FAIL: Failed to verify credential $RES_DELS." + echo "FAIL: Failed to verify credential." exit 1 fi 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, struct GNUNET_CREDENTIAL_Delegate *delegte); typedef void (*GNUNET_CREDENTIAL_IntermediateResultProcessor) (void *cls, - struct GNUNET_CREDENTIAL_Delegation *delegation); + struct GNUNET_CREDENTIAL_Delegation *delegation, + bool is_bw); /** * Iterator called on obtained result for an attribute delegation. -- cgit v1.2.3