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 /src/credential/gnunet-service-credential.c | |
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)
Diffstat (limited to 'src/credential/gnunet-service-credential.c')
-rw-r--r-- | src/credential/gnunet-service-credential.c | 19 |
1 files changed, 15 insertions, 4 deletions
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; |