diff options
author | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
commit | d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb (patch) | |
tree | 9efd18ea7d425652085ed0bd5e8e45604bc5f6b9 /src/credential/gnunet-service-credential.c | |
parent | a0fce305c565c0937d917a92712f15e9c5736260 (diff) | |
download | gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.tar.gz gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.zip |
uncrustify as demanded.
Diffstat (limited to 'src/credential/gnunet-service-credential.c')
-rw-r--r-- | src/credential/gnunet-service-credential.c | 1064 |
1 files changed, 555 insertions, 509 deletions
diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c index 75711265d..4c001af1b 100644 --- a/src/credential/gnunet-service-credential.c +++ b/src/credential/gnunet-service-credential.c | |||
@@ -16,7 +16,7 @@ | |||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file credential/gnunet-service-credential.c | 21 | * @file credential/gnunet-service-credential.c |
22 | * @brief GNUnet Credential Service (main service) | 22 | * @brief GNUnet Credential Service (main service) |
@@ -46,8 +46,7 @@ struct VerifyRequestHandle; | |||
46 | struct DelegationSetQueueEntry; | 46 | struct DelegationSetQueueEntry; |
47 | 47 | ||
48 | 48 | ||
49 | struct DelegationChainEntry | 49 | struct DelegationChainEntry { |
50 | { | ||
51 | /** | 50 | /** |
52 | * DLL | 51 | * DLL |
53 | */ | 52 | */ |
@@ -82,8 +81,7 @@ struct DelegationChainEntry | |||
82 | /** | 81 | /** |
83 | * DLL for record | 82 | * DLL for record |
84 | */ | 83 | */ |
85 | struct CredentialRecordEntry | 84 | struct CredentialRecordEntry { |
86 | { | ||
87 | /** | 85 | /** |
88 | * DLL | 86 | * DLL |
89 | */ | 87 | */ |
@@ -109,8 +107,7 @@ struct CredentialRecordEntry | |||
109 | * DLL used for delegations | 107 | * DLL used for delegations |
110 | * Used for OR delegations | 108 | * Used for OR delegations |
111 | */ | 109 | */ |
112 | struct DelegationQueueEntry | 110 | struct DelegationQueueEntry { |
113 | { | ||
114 | /** | 111 | /** |
115 | * DLL | 112 | * DLL |
116 | */ | 113 | */ |
@@ -146,8 +143,7 @@ struct DelegationQueueEntry | |||
146 | * DLL for delegation sets | 143 | * DLL for delegation sets |
147 | * Used for AND delegation set | 144 | * Used for AND delegation set |
148 | */ | 145 | */ |
149 | struct DelegationSetQueueEntry | 146 | struct DelegationSetQueueEntry { |
150 | { | ||
151 | /** | 147 | /** |
152 | * DLL | 148 | * DLL |
153 | */ | 149 | */ |
@@ -223,9 +219,7 @@ struct DelegationSetQueueEntry | |||
223 | /** | 219 | /** |
224 | * Handle to a lookup operation from api | 220 | * Handle to a lookup operation from api |
225 | */ | 221 | */ |
226 | struct VerifyRequestHandle | 222 | struct VerifyRequestHandle { |
227 | { | ||
228 | |||
229 | /** | 223 | /** |
230 | * We keep these in a DLL. | 224 | * We keep these in a DLL. |
231 | */ | 225 | */ |
@@ -350,7 +344,7 @@ static struct GNUNET_GNS_Handle *gns; | |||
350 | static struct GNUNET_NAMESTORE_Handle *namestore; | 344 | static struct GNUNET_NAMESTORE_Handle *namestore; |
351 | 345 | ||
352 | static void | 346 | static void |
353 | cleanup_delegation_set (struct DelegationSetQueueEntry *ds_entry) | 347 | cleanup_delegation_set(struct DelegationSetQueueEntry *ds_entry) |
354 | { | 348 | { |
355 | struct DelegationQueueEntry *dq_entry; | 349 | struct DelegationQueueEntry *dq_entry; |
356 | struct DelegationSetQueueEntry *child; | 350 | struct DelegationSetQueueEntry *child; |
@@ -359,88 +353,99 @@ cleanup_delegation_set (struct DelegationSetQueueEntry *ds_entry) | |||
359 | return; | 353 | return; |
360 | 354 | ||
361 | for (dq_entry = ds_entry->queue_entries_head; NULL != dq_entry; | 355 | for (dq_entry = ds_entry->queue_entries_head; NULL != dq_entry; |
362 | dq_entry = ds_entry->queue_entries_head) { | 356 | dq_entry = ds_entry->queue_entries_head) |
363 | GNUNET_CONTAINER_DLL_remove (ds_entry->queue_entries_head, | 357 | { |
364 | ds_entry->queue_entries_tail, | 358 | GNUNET_CONTAINER_DLL_remove(ds_entry->queue_entries_head, |
365 | dq_entry); | 359 | ds_entry->queue_entries_tail, |
366 | for (child = dq_entry->set_entries_head; NULL != child; | 360 | dq_entry); |
367 | child = dq_entry->set_entries_head) { | 361 | for (child = dq_entry->set_entries_head; NULL != child; |
368 | GNUNET_CONTAINER_DLL_remove (dq_entry->set_entries_head, | 362 | child = dq_entry->set_entries_head) |
369 | dq_entry->set_entries_tail, | 363 | { |
370 | child); | 364 | GNUNET_CONTAINER_DLL_remove(dq_entry->set_entries_head, |
371 | cleanup_delegation_set (child); | 365 | dq_entry->set_entries_tail, |
366 | child); | ||
367 | cleanup_delegation_set(child); | ||
368 | } | ||
369 | GNUNET_free(dq_entry); | ||
370 | } | ||
371 | GNUNET_free_non_null(ds_entry->issuer_key); | ||
372 | GNUNET_free_non_null(ds_entry->lookup_attribute); | ||
373 | GNUNET_free_non_null(ds_entry->issuer_attribute); | ||
374 | GNUNET_free_non_null(ds_entry->unresolved_attribute_delegation); | ||
375 | GNUNET_free_non_null(ds_entry->attr_trailer); | ||
376 | if (NULL != ds_entry->lookup_request) | ||
377 | { | ||
378 | GNUNET_GNS_lookup_cancel(ds_entry->lookup_request); | ||
379 | ds_entry->lookup_request = NULL; | ||
372 | } | 380 | } |
373 | GNUNET_free (dq_entry); | 381 | if (NULL != ds_entry->delegation_chain_entry) |
374 | } | 382 | { |
375 | GNUNET_free_non_null (ds_entry->issuer_key); | 383 | GNUNET_free_non_null(ds_entry->delegation_chain_entry->subject_attribute); |
376 | GNUNET_free_non_null (ds_entry->lookup_attribute); | 384 | GNUNET_free_non_null(ds_entry->delegation_chain_entry->issuer_attribute); |
377 | GNUNET_free_non_null (ds_entry->issuer_attribute); | 385 | GNUNET_free(ds_entry->delegation_chain_entry); |
378 | GNUNET_free_non_null (ds_entry->unresolved_attribute_delegation); | 386 | } |
379 | GNUNET_free_non_null (ds_entry->attr_trailer); | 387 | GNUNET_free(ds_entry); |
380 | if (NULL != ds_entry->lookup_request) { | ||
381 | GNUNET_GNS_lookup_cancel (ds_entry->lookup_request); | ||
382 | ds_entry->lookup_request = NULL; | ||
383 | } | ||
384 | if (NULL != ds_entry->delegation_chain_entry) { | ||
385 | GNUNET_free_non_null (ds_entry->delegation_chain_entry->subject_attribute); | ||
386 | GNUNET_free_non_null (ds_entry->delegation_chain_entry->issuer_attribute); | ||
387 | GNUNET_free (ds_entry->delegation_chain_entry); | ||
388 | } | ||
389 | GNUNET_free (ds_entry); | ||
390 | } | 388 | } |
391 | 389 | ||
392 | static void | 390 | static void |
393 | cleanup_handle (struct VerifyRequestHandle *vrh) | 391 | cleanup_handle(struct VerifyRequestHandle *vrh) |
394 | { | 392 | { |
395 | struct CredentialRecordEntry *cr_entry; | 393 | struct CredentialRecordEntry *cr_entry; |
396 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up...\n"); | 394 | |
397 | if (NULL != vrh->lookup_request) { | 395 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Cleaning up...\n"); |
398 | GNUNET_GNS_lookup_cancel (vrh->lookup_request); | 396 | if (NULL != vrh->lookup_request) |
399 | vrh->lookup_request = NULL; | 397 | { |
400 | } | 398 | GNUNET_GNS_lookup_cancel(vrh->lookup_request); |
401 | cleanup_delegation_set (vrh->root_set); | 399 | vrh->lookup_request = NULL; |
402 | GNUNET_free_non_null (vrh->issuer_attribute); | 400 | } |
401 | cleanup_delegation_set(vrh->root_set); | ||
402 | GNUNET_free_non_null(vrh->issuer_attribute); | ||
403 | for (cr_entry = vrh->cred_chain_head; NULL != vrh->cred_chain_head; | 403 | for (cr_entry = vrh->cred_chain_head; NULL != vrh->cred_chain_head; |
404 | cr_entry = vrh->cred_chain_head) { | 404 | cr_entry = vrh->cred_chain_head) |
405 | GNUNET_CONTAINER_DLL_remove (vrh->cred_chain_head, | 405 | { |
406 | vrh->cred_chain_tail, | 406 | GNUNET_CONTAINER_DLL_remove(vrh->cred_chain_head, |
407 | cr_entry); | 407 | vrh->cred_chain_tail, |
408 | GNUNET_free_non_null (cr_entry->credential); | 408 | cr_entry); |
409 | GNUNET_free (cr_entry); | 409 | GNUNET_free_non_null(cr_entry->credential); |
410 | } | 410 | GNUNET_free(cr_entry); |
411 | GNUNET_free (vrh); | 411 | } |
412 | GNUNET_free(vrh); | ||
412 | } | 413 | } |
413 | 414 | ||
414 | static void | 415 | static void |
415 | shutdown_task (void *cls) | 416 | shutdown_task(void *cls) |
416 | { | 417 | { |
417 | struct VerifyRequestHandle *vrh; | 418 | struct VerifyRequestHandle *vrh; |
418 | 419 | ||
419 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down!\n"); | 420 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Shutting down!\n"); |
420 | 421 | ||
421 | while (NULL != (vrh = vrh_head)) { | 422 | while (NULL != (vrh = vrh_head)) |
422 | // CREDENTIAL_resolver_lookup_cancel (clh->lookup); | 423 | { |
423 | GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh); | 424 | // CREDENTIAL_resolver_lookup_cancel (clh->lookup); |
424 | cleanup_handle (vrh); | 425 | GNUNET_CONTAINER_DLL_remove(vrh_head, vrh_tail, vrh); |
425 | } | 426 | cleanup_handle(vrh); |
426 | 427 | } | |
427 | if (NULL != gns) { | 428 | |
428 | GNUNET_GNS_disconnect (gns); | 429 | if (NULL != gns) |
429 | gns = NULL; | 430 | { |
430 | } | 431 | GNUNET_GNS_disconnect(gns); |
431 | if (NULL != namestore) { | 432 | gns = NULL; |
432 | GNUNET_NAMESTORE_disconnect (namestore); | 433 | } |
433 | namestore = NULL; | 434 | if (NULL != namestore) |
434 | } | 435 | { |
435 | if (NULL != statistics) { | 436 | GNUNET_NAMESTORE_disconnect(namestore); |
436 | GNUNET_STATISTICS_destroy (statistics, GNUNET_NO); | 437 | namestore = NULL; |
437 | statistics = NULL; | 438 | } |
438 | } | 439 | if (NULL != statistics) |
440 | { | ||
441 | GNUNET_STATISTICS_destroy(statistics, GNUNET_NO); | ||
442 | statistics = NULL; | ||
443 | } | ||
439 | } | 444 | } |
440 | 445 | ||
441 | 446 | ||
442 | static void | 447 | static void |
443 | send_lookup_response (struct VerifyRequestHandle *vrh) | 448 | send_lookup_response(struct VerifyRequestHandle *vrh) |
444 | { | 449 | { |
445 | struct GNUNET_MQ_Envelope *env; | 450 | struct GNUNET_MQ_Envelope *env; |
446 | struct DelegationChainResultMessage *rmsg; | 451 | struct DelegationChainResultMessage *rmsg; |
@@ -451,99 +456,103 @@ send_lookup_response (struct VerifyRequestHandle *vrh) | |||
451 | struct CredentialRecordEntry *tmp; | 456 | struct CredentialRecordEntry *tmp; |
452 | size_t size; | 457 | size_t size; |
453 | 458 | ||
454 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending response\n"); | 459 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending response\n"); |
455 | dce = vrh->delegation_chain_head; | 460 | dce = vrh->delegation_chain_head; |
456 | for (uint32_t i = 0; i < vrh->delegation_chain_size; i++) { | 461 | for (uint32_t i = 0; i < vrh->delegation_chain_size; i++) |
457 | dd[i].issuer_key = dce->issuer_key; | 462 | { |
458 | dd[i].subject_key = dce->subject_key; | 463 | dd[i].issuer_key = dce->issuer_key; |
459 | dd[i].issuer_attribute = dce->issuer_attribute; | 464 | dd[i].subject_key = dce->subject_key; |
460 | dd[i].issuer_attribute_len = strlen (dce->issuer_attribute) + 1; | 465 | dd[i].issuer_attribute = dce->issuer_attribute; |
461 | dd[i].subject_attribute_len = 0; | 466 | dd[i].issuer_attribute_len = strlen(dce->issuer_attribute) + 1; |
462 | dd[i].subject_attribute = NULL; | 467 | dd[i].subject_attribute_len = 0; |
463 | if (NULL != dce->subject_attribute) { | 468 | dd[i].subject_attribute = NULL; |
464 | dd[i].subject_attribute = dce->subject_attribute; | 469 | if (NULL != dce->subject_attribute) |
465 | dd[i].subject_attribute_len = strlen (dce->subject_attribute) + 1; | 470 | { |
471 | dd[i].subject_attribute = dce->subject_attribute; | ||
472 | dd[i].subject_attribute_len = strlen(dce->subject_attribute) + 1; | ||
473 | } | ||
474 | dce = dce->next; | ||
466 | } | 475 | } |
467 | dce = dce->next; | ||
468 | } | ||
469 | 476 | ||
470 | /** | 477 | /** |
471 | * Remove all credentials not needed | 478 | * Remove all credentials not needed |
472 | */ | 479 | */ |
473 | for (cd = vrh->cred_chain_head; NULL != cd;) { | 480 | for (cd = vrh->cred_chain_head; NULL != cd;) |
474 | if (cd->refcount > 0) { | 481 | { |
482 | if (cd->refcount > 0) | ||
483 | { | ||
484 | cd = cd->next; | ||
485 | continue; | ||
486 | } | ||
487 | tmp = cd; | ||
475 | cd = cd->next; | 488 | cd = cd->next; |
476 | continue; | 489 | GNUNET_CONTAINER_DLL_remove(vrh->cred_chain_head, |
490 | vrh->cred_chain_tail, | ||
491 | tmp); | ||
492 | GNUNET_free(tmp->credential); | ||
493 | GNUNET_free(tmp); | ||
494 | vrh->cred_chain_size--; | ||
477 | } | 495 | } |
478 | tmp = cd; | ||
479 | cd = cd->next; | ||
480 | GNUNET_CONTAINER_DLL_remove (vrh->cred_chain_head, | ||
481 | vrh->cred_chain_tail, | ||
482 | tmp); | ||
483 | GNUNET_free (tmp->credential); | ||
484 | GNUNET_free (tmp); | ||
485 | vrh->cred_chain_size--; | ||
486 | } | ||
487 | 496 | ||
488 | /** | 497 | /** |
489 | * Get serialized record data | 498 | * Get serialized record data |
490 | * Append at the end of rmsg | 499 | * Append at the end of rmsg |
491 | */ | 500 | */ |
492 | cd = vrh->cred_chain_head; | 501 | cd = vrh->cred_chain_head; |
493 | for (uint32_t i = 0; i < vrh->cred_chain_size; i++) { | 502 | for (uint32_t i = 0; i < vrh->cred_chain_size; i++) |
494 | cred[i].issuer_key = cd->credential->issuer_key; | 503 | { |
495 | cred[i].subject_key = cd->credential->subject_key; | 504 | cred[i].issuer_key = cd->credential->issuer_key; |
496 | cred[i].issuer_attribute_len | 505 | cred[i].subject_key = cd->credential->subject_key; |
497 | = strlen (cd->credential->issuer_attribute) + 1; | 506 | cred[i].issuer_attribute_len |
498 | cred[i].issuer_attribute = cd->credential->issuer_attribute; | 507 | = strlen(cd->credential->issuer_attribute) + 1; |
499 | cred[i].expiration = cd->credential->expiration; | 508 | cred[i].issuer_attribute = cd->credential->issuer_attribute; |
500 | cred[i].signature = cd->credential->signature; | 509 | cred[i].expiration = cd->credential->expiration; |
501 | cd = cd->next; | 510 | cred[i].signature = cd->credential->signature; |
502 | } | 511 | cd = cd->next; |
512 | } | ||
503 | size | 513 | size |
504 | = GNUNET_CREDENTIAL_delegation_chain_get_size (vrh->delegation_chain_size, | 514 | = GNUNET_CREDENTIAL_delegation_chain_get_size(vrh->delegation_chain_size, |
505 | dd, | 515 | dd, |
506 | vrh->cred_chain_size, | 516 | vrh->cred_chain_size, |
507 | cred); | 517 | cred); |
508 | env = GNUNET_MQ_msg_extra (rmsg, | 518 | env = GNUNET_MQ_msg_extra(rmsg, |
509 | size, | 519 | size, |
510 | GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT); | 520 | GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT); |
511 | // Assign id so that client can find associated request | 521 | // Assign id so that client can find associated request |
512 | rmsg->id = vrh->request_id; | 522 | rmsg->id = vrh->request_id; |
513 | rmsg->d_count = htonl (vrh->delegation_chain_size); | 523 | rmsg->d_count = htonl(vrh->delegation_chain_size); |
514 | rmsg->c_count = htonl (vrh->cred_chain_size); | 524 | rmsg->c_count = htonl(vrh->cred_chain_size); |
515 | 525 | ||
516 | if (0 < vrh->cred_chain_size) | 526 | if (0 < vrh->cred_chain_size) |
517 | rmsg->cred_found = htonl (GNUNET_YES); | 527 | rmsg->cred_found = htonl(GNUNET_YES); |
518 | else | 528 | else |
519 | rmsg->cred_found = htonl (GNUNET_NO); | 529 | rmsg->cred_found = htonl(GNUNET_NO); |
520 | 530 | ||
521 | GNUNET_assert ( | 531 | GNUNET_assert( |
522 | -1 | 532 | -1 |
523 | != GNUNET_CREDENTIAL_delegation_chain_serialize (vrh->delegation_chain_size, | 533 | != GNUNET_CREDENTIAL_delegation_chain_serialize(vrh->delegation_chain_size, |
524 | dd, | 534 | dd, |
525 | vrh->cred_chain_size, | 535 | vrh->cred_chain_size, |
526 | cred, | 536 | cred, |
527 | size, | 537 | size, |
528 | (char *)&rmsg[1])); | 538 | (char *)&rmsg[1])); |
529 | 539 | ||
530 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); | 540 | GNUNET_MQ_send(GNUNET_SERVICE_client_get_mq(vrh->client), env); |
531 | GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh); | 541 | GNUNET_CONTAINER_DLL_remove(vrh_head, vrh_tail, vrh); |
532 | cleanup_handle (vrh); | 542 | cleanup_handle(vrh); |
533 | 543 | ||
534 | GNUNET_STATISTICS_update (statistics, | 544 | GNUNET_STATISTICS_update(statistics, |
535 | "Completed verifications", | 545 | "Completed verifications", |
536 | 1, | 546 | 1, |
537 | GNUNET_NO); | 547 | GNUNET_NO); |
538 | } | 548 | } |
539 | 549 | ||
540 | 550 | ||
541 | static void | 551 | static void |
542 | backward_resolution (void *cls, | 552 | backward_resolution(void *cls, |
543 | uint32_t rd_count, | 553 | uint32_t rd_count, |
544 | const struct GNUNET_GNSRECORD_Data *rd) | 554 | const struct GNUNET_GNSRECORD_Data *rd) |
545 | { | 555 | { |
546 | |||
547 | struct VerifyRequestHandle *vrh; | 556 | struct VerifyRequestHandle *vrh; |
548 | const struct GNUNET_CREDENTIAL_DelegationRecord *sets; | 557 | const struct GNUNET_CREDENTIAL_DelegationRecord *sets; |
549 | struct CredentialRecordEntry *cred_pointer; | 558 | struct CredentialRecordEntry *cred_pointer; |
@@ -559,176 +568,194 @@ backward_resolution (void *cls, | |||
559 | current_set->lookup_request = NULL; | 568 | current_set->lookup_request = NULL; |
560 | vrh = current_set->handle; | 569 | vrh = current_set->handle; |
561 | vrh->pending_lookups--; | 570 | vrh->pending_lookups--; |
562 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got %d attrs\n", rd_count); | 571 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Got %d attrs\n", rd_count); |
563 | 572 | ||
564 | // Each OR | 573 | // Each OR |
565 | for (uint32_t i = 0; i < rd_count; i++) { | 574 | for (uint32_t i = 0; i < rd_count; i++) |
566 | if (GNUNET_GNSRECORD_TYPE_ATTRIBUTE != rd[i].record_type) | 575 | { |
567 | continue; | 576 | if (GNUNET_GNSRECORD_TYPE_ATTRIBUTE != rd[i].record_type) |
568 | 577 | continue; | |
569 | sets = rd[i].data; | ||
570 | struct GNUNET_CREDENTIAL_DelegationSet set[ntohl (sets->set_count)]; | ||
571 | GNUNET_log ( | ||
572 | GNUNET_ERROR_TYPE_DEBUG, | ||
573 | "Found new attribute delegation with %d sets. Creating new Job...\n", | ||
574 | ntohl (sets->set_count)); | ||
575 | |||
576 | if (GNUNET_OK | ||
577 | != GNUNET_CREDENTIAL_delegation_set_deserialize ( | ||
578 | GNUNET_ntohll (sets->data_size), | ||
579 | (const char *)&sets[1], | ||
580 | ntohl (sets->set_count), | ||
581 | set)) { | ||
582 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to deserialize!\n"); | ||
583 | continue; | ||
584 | } | ||
585 | dq_entry = GNUNET_new (struct DelegationQueueEntry); | ||
586 | dq_entry->required_solutions = ntohl (sets->set_count); | ||
587 | dq_entry->parent_set = current_set; | ||
588 | GNUNET_CONTAINER_DLL_insert (current_set->queue_entries_head, | ||
589 | current_set->queue_entries_tail, | ||
590 | dq_entry); | ||
591 | // Each AND | ||
592 | for (uint32_t j = 0; j < ntohl (sets->set_count); j++) { | ||
593 | ds_entry = GNUNET_new (struct DelegationSetQueueEntry); | ||
594 | if (NULL != current_set->attr_trailer) { | ||
595 | if (0 == set[j].subject_attribute_len) { | ||
596 | GNUNET_asprintf (&expanded_attr, "%s", current_set->attr_trailer); | ||
597 | |||
598 | } else { | ||
599 | GNUNET_asprintf (&expanded_attr, | ||
600 | "%s.%s", | ||
601 | set[j].subject_attribute, | ||
602 | current_set->attr_trailer); | ||
603 | } | ||
604 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Expanded to %s\n", expanded_attr); | ||
605 | ds_entry->unresolved_attribute_delegation = expanded_attr; | ||
606 | } else { | ||
607 | if (0 != set[j].subject_attribute_len) { | ||
608 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
609 | "Not Expanding %s\n", | ||
610 | set[j].subject_attribute); | ||
611 | ds_entry->unresolved_attribute_delegation | ||
612 | = GNUNET_strdup (set[j].subject_attribute); | ||
613 | } | ||
614 | } | ||
615 | |||
616 | // Add a credential chain entry | ||
617 | ds_entry->delegation_chain_entry | ||
618 | = GNUNET_new (struct DelegationChainEntry); | ||
619 | ds_entry->delegation_chain_entry->subject_key = set[j].subject_key; | ||
620 | ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); | ||
621 | GNUNET_memcpy (ds_entry->issuer_key, | ||
622 | &set[j].subject_key, | ||
623 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | ||
624 | if (0 < set[j].subject_attribute_len) | ||
625 | ds_entry->delegation_chain_entry->subject_attribute | ||
626 | = GNUNET_strdup (set[j].subject_attribute); | ||
627 | ds_entry->delegation_chain_entry->issuer_key = *current_set->issuer_key; | ||
628 | ds_entry->delegation_chain_entry->issuer_attribute | ||
629 | = GNUNET_strdup (current_set->lookup_attribute); | ||
630 | |||
631 | ds_entry->parent_queue_entry = dq_entry; // current_delegation; | ||
632 | GNUNET_CONTAINER_DLL_insert (dq_entry->set_entries_head, | ||
633 | dq_entry->set_entries_tail, | ||
634 | ds_entry); | ||
635 | |||
636 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking for cred match\n"); | ||
637 | /** | ||
638 | * Check if this delegation already matches one of our credentials | ||
639 | */ | ||
640 | for (cred_pointer = vrh->cred_chain_head; cred_pointer != NULL; | ||
641 | cred_pointer = cred_pointer->next) { | ||
642 | if (0 | ||
643 | != GNUNET_memcmp (&set->subject_key, | ||
644 | &cred_pointer->credential->issuer_key)) | ||
645 | continue; | ||
646 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
647 | "Checking if %s matches %s\n", | ||
648 | ds_entry->unresolved_attribute_delegation, | ||
649 | cred_pointer->credential->issuer_attribute); | ||
650 | |||
651 | if (0 | ||
652 | != strcmp (ds_entry->unresolved_attribute_delegation, | ||
653 | cred_pointer->credential->issuer_attribute)) | ||
654 | continue; | ||
655 | 578 | ||
656 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found issuer\n"); | 579 | sets = rd[i].data; |
657 | cred_pointer->refcount++; | 580 | struct GNUNET_CREDENTIAL_DelegationSet set[ntohl(sets->set_count)]; |
658 | // Backtrack | 581 | GNUNET_log( |
659 | for (tmp_set = ds_entry; NULL != tmp_set->parent_queue_entry; | 582 | GNUNET_ERROR_TYPE_DEBUG, |
660 | tmp_set = tmp_set->parent_queue_entry->parent_set) { | 583 | "Found new attribute delegation with %d sets. Creating new Job...\n", |
661 | tmp_set->parent_queue_entry->required_solutions--; | 584 | ntohl(sets->set_count)); |
662 | if (NULL != tmp_set->delegation_chain_entry) { | 585 | |
663 | vrh->delegation_chain_size++; | 586 | if (GNUNET_OK |
664 | GNUNET_CONTAINER_DLL_insert (vrh->delegation_chain_head, | 587 | != GNUNET_CREDENTIAL_delegation_set_deserialize( |
665 | vrh->delegation_chain_tail, | 588 | GNUNET_ntohll(sets->data_size), |
666 | tmp_set->delegation_chain_entry); | 589 | (const char *)&sets[1], |
667 | } | 590 | ntohl(sets->set_count), |
668 | if (0 < tmp_set->parent_queue_entry->required_solutions) | 591 | set)) |
669 | break; | 592 | { |
593 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to deserialize!\n"); | ||
594 | continue; | ||
670 | } | 595 | } |
671 | 596 | dq_entry = GNUNET_new(struct DelegationQueueEntry); | |
672 | if (NULL == tmp_set->parent_queue_entry) { | 597 | dq_entry->required_solutions = ntohl(sets->set_count); |
673 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "All solutions found\n"); | 598 | dq_entry->parent_set = current_set; |
674 | // Found match | 599 | GNUNET_CONTAINER_DLL_insert(current_set->queue_entries_head, |
675 | send_lookup_response (vrh); | 600 | current_set->queue_entries_tail, |
676 | return; | 601 | dq_entry); |
602 | // Each AND | ||
603 | for (uint32_t j = 0; j < ntohl(sets->set_count); j++) | ||
604 | { | ||
605 | ds_entry = GNUNET_new(struct DelegationSetQueueEntry); | ||
606 | if (NULL != current_set->attr_trailer) | ||
607 | { | ||
608 | if (0 == set[j].subject_attribute_len) | ||
609 | { | ||
610 | GNUNET_asprintf(&expanded_attr, "%s", current_set->attr_trailer); | ||
611 | } | ||
612 | else | ||
613 | { | ||
614 | GNUNET_asprintf(&expanded_attr, | ||
615 | "%s.%s", | ||
616 | set[j].subject_attribute, | ||
617 | current_set->attr_trailer); | ||
618 | } | ||
619 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Expanded to %s\n", expanded_attr); | ||
620 | ds_entry->unresolved_attribute_delegation = expanded_attr; | ||
621 | } | ||
622 | else | ||
623 | { | ||
624 | if (0 != set[j].subject_attribute_len) | ||
625 | { | ||
626 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
627 | "Not Expanding %s\n", | ||
628 | set[j].subject_attribute); | ||
629 | ds_entry->unresolved_attribute_delegation | ||
630 | = GNUNET_strdup(set[j].subject_attribute); | ||
631 | } | ||
632 | } | ||
633 | |||
634 | // Add a credential chain entry | ||
635 | ds_entry->delegation_chain_entry | ||
636 | = GNUNET_new(struct DelegationChainEntry); | ||
637 | ds_entry->delegation_chain_entry->subject_key = set[j].subject_key; | ||
638 | ds_entry->issuer_key = GNUNET_new(struct GNUNET_CRYPTO_EcdsaPublicKey); | ||
639 | GNUNET_memcpy(ds_entry->issuer_key, | ||
640 | &set[j].subject_key, | ||
641 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); | ||
642 | if (0 < set[j].subject_attribute_len) | ||
643 | ds_entry->delegation_chain_entry->subject_attribute | ||
644 | = GNUNET_strdup(set[j].subject_attribute); | ||
645 | ds_entry->delegation_chain_entry->issuer_key = *current_set->issuer_key; | ||
646 | ds_entry->delegation_chain_entry->issuer_attribute | ||
647 | = GNUNET_strdup(current_set->lookup_attribute); | ||
648 | |||
649 | ds_entry->parent_queue_entry = dq_entry; // current_delegation; | ||
650 | GNUNET_CONTAINER_DLL_insert(dq_entry->set_entries_head, | ||
651 | dq_entry->set_entries_tail, | ||
652 | ds_entry); | ||
653 | |||
654 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Checking for cred match\n"); | ||
655 | /** | ||
656 | * Check if this delegation already matches one of our credentials | ||
657 | */ | ||
658 | for (cred_pointer = vrh->cred_chain_head; cred_pointer != NULL; | ||
659 | cred_pointer = cred_pointer->next) | ||
660 | { | ||
661 | if (0 | ||
662 | != GNUNET_memcmp(&set->subject_key, | ||
663 | &cred_pointer->credential->issuer_key)) | ||
664 | continue; | ||
665 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
666 | "Checking if %s matches %s\n", | ||
667 | ds_entry->unresolved_attribute_delegation, | ||
668 | cred_pointer->credential->issuer_attribute); | ||
669 | |||
670 | if (0 | ||
671 | != strcmp(ds_entry->unresolved_attribute_delegation, | ||
672 | cred_pointer->credential->issuer_attribute)) | ||
673 | continue; | ||
674 | |||
675 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Found issuer\n"); | ||
676 | cred_pointer->refcount++; | ||
677 | // Backtrack | ||
678 | for (tmp_set = ds_entry; NULL != tmp_set->parent_queue_entry; | ||
679 | tmp_set = tmp_set->parent_queue_entry->parent_set) | ||
680 | { | ||
681 | tmp_set->parent_queue_entry->required_solutions--; | ||
682 | if (NULL != tmp_set->delegation_chain_entry) | ||
683 | { | ||
684 | vrh->delegation_chain_size++; | ||
685 | GNUNET_CONTAINER_DLL_insert(vrh->delegation_chain_head, | ||
686 | vrh->delegation_chain_tail, | ||
687 | tmp_set->delegation_chain_entry); | ||
688 | } | ||
689 | if (0 < tmp_set->parent_queue_entry->required_solutions) | ||
690 | break; | ||
691 | } | ||
692 | |||
693 | if (NULL == tmp_set->parent_queue_entry) | ||
694 | { | ||
695 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "All solutions found\n"); | ||
696 | // Found match | ||
697 | send_lookup_response(vrh); | ||
698 | return; | ||
699 | } | ||
700 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Not all solutions found yet.\n"); | ||
701 | continue; | ||
702 | } | ||
703 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
704 | "Building new lookup request from %s\n", | ||
705 | ds_entry->unresolved_attribute_delegation); | ||
706 | // Continue with backward resolution | ||
707 | char | ||
708 | issuer_attribute_name[strlen(ds_entry->unresolved_attribute_delegation) | ||
709 | + 1]; | ||
710 | strcpy(issuer_attribute_name, ds_entry->unresolved_attribute_delegation); | ||
711 | char *next_attr = strtok(issuer_attribute_name, "."); | ||
712 | if (NULL == next_attr) | ||
713 | { | ||
714 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | ||
715 | "Failed to parse next attribute\n"); | ||
716 | continue; | ||
717 | } | ||
718 | GNUNET_asprintf(&lookup_attribute, "%s", next_attr); | ||
719 | GNUNET_asprintf(&ds_entry->lookup_attribute, "%s", next_attr); | ||
720 | if (strlen(next_attr) | ||
721 | == strlen(ds_entry->unresolved_attribute_delegation)) | ||
722 | { | ||
723 | ds_entry->attr_trailer = NULL; | ||
724 | } | ||
725 | else | ||
726 | { | ||
727 | next_attr += strlen(next_attr) + 1; | ||
728 | ds_entry->attr_trailer = GNUNET_strdup(next_attr); | ||
729 | } | ||
730 | |||
731 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | ||
732 | "Looking up %s\n", | ||
733 | ds_entry->lookup_attribute); | ||
734 | if (NULL != ds_entry->attr_trailer) | ||
735 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | ||
736 | "%s still to go...\n", | ||
737 | ds_entry->attr_trailer); | ||
738 | |||
739 | vrh->pending_lookups++; | ||
740 | ds_entry->handle = vrh; | ||
741 | ds_entry->lookup_request | ||
742 | = GNUNET_GNS_lookup(gns, | ||
743 | lookup_attribute, | ||
744 | ds_entry->issuer_key, // issuer_key, | ||
745 | GNUNET_GNSRECORD_TYPE_ATTRIBUTE, | ||
746 | GNUNET_GNS_LO_DEFAULT, | ||
747 | &backward_resolution, | ||
748 | ds_entry); | ||
749 | GNUNET_free(lookup_attribute); | ||
677 | } | 750 | } |
678 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Not all solutions found yet.\n"); | ||
679 | continue; | ||
680 | } | ||
681 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
682 | "Building new lookup request from %s\n", | ||
683 | ds_entry->unresolved_attribute_delegation); | ||
684 | // Continue with backward resolution | ||
685 | char | ||
686 | issuer_attribute_name[strlen (ds_entry->unresolved_attribute_delegation) | ||
687 | + 1]; | ||
688 | strcpy (issuer_attribute_name, ds_entry->unresolved_attribute_delegation); | ||
689 | char *next_attr = strtok (issuer_attribute_name, "."); | ||
690 | if (NULL == next_attr) { | ||
691 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
692 | "Failed to parse next attribute\n"); | ||
693 | continue; | ||
694 | } | ||
695 | GNUNET_asprintf (&lookup_attribute, "%s", next_attr); | ||
696 | GNUNET_asprintf (&ds_entry->lookup_attribute, "%s", next_attr); | ||
697 | if (strlen (next_attr) | ||
698 | == strlen (ds_entry->unresolved_attribute_delegation)) { | ||
699 | ds_entry->attr_trailer = NULL; | ||
700 | } else { | ||
701 | next_attr += strlen (next_attr) + 1; | ||
702 | ds_entry->attr_trailer = GNUNET_strdup (next_attr); | ||
703 | } | ||
704 | |||
705 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
706 | "Looking up %s\n", | ||
707 | ds_entry->lookup_attribute); | ||
708 | if (NULL != ds_entry->attr_trailer) | ||
709 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
710 | "%s still to go...\n", | ||
711 | ds_entry->attr_trailer); | ||
712 | |||
713 | vrh->pending_lookups++; | ||
714 | ds_entry->handle = vrh; | ||
715 | ds_entry->lookup_request | ||
716 | = GNUNET_GNS_lookup (gns, | ||
717 | lookup_attribute, | ||
718 | ds_entry->issuer_key, // issuer_key, | ||
719 | GNUNET_GNSRECORD_TYPE_ATTRIBUTE, | ||
720 | GNUNET_GNS_LO_DEFAULT, | ||
721 | &backward_resolution, | ||
722 | ds_entry); | ||
723 | GNUNET_free (lookup_attribute); | ||
724 | } | 751 | } |
725 | } | ||
726 | 752 | ||
727 | if (0 == vrh->pending_lookups) { | 753 | if (0 == vrh->pending_lookups) |
728 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "We are all out of attributes...\n"); | 754 | { |
729 | send_lookup_response (vrh); | 755 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "We are all out of attributes...\n"); |
730 | return; | 756 | send_lookup_response(vrh); |
731 | } | 757 | return; |
758 | } | ||
732 | } | 759 | } |
733 | 760 | ||
734 | 761 | ||
@@ -738,90 +765,96 @@ backward_resolution (void *cls, | |||
738 | * @param cls the closure (our client lookup handle) | 765 | * @param cls the closure (our client lookup handle) |
739 | */ | 766 | */ |
740 | static void | 767 | static void |
741 | delegation_chain_resolution_start (void *cls) | 768 | delegation_chain_resolution_start(void *cls) |
742 | { | 769 | { |
743 | struct VerifyRequestHandle *vrh = cls; | 770 | struct VerifyRequestHandle *vrh = cls; |
744 | struct DelegationSetQueueEntry *ds_entry; | 771 | struct DelegationSetQueueEntry *ds_entry; |
745 | struct CredentialRecordEntry *cr_entry; | 772 | struct CredentialRecordEntry *cr_entry; |
773 | |||
746 | vrh->lookup_request = NULL; | 774 | vrh->lookup_request = NULL; |
747 | 775 | ||
748 | if (0 == vrh->cred_chain_size) { | 776 | if (0 == vrh->cred_chain_size) |
749 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No credentials found\n"); | 777 | { |
750 | send_lookup_response (vrh); | 778 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "No credentials found\n"); |
751 | return; | 779 | send_lookup_response(vrh); |
752 | } | 780 | return; |
781 | } | ||
753 | 782 | ||
754 | for (cr_entry = vrh->cred_chain_head; cr_entry != NULL; | 783 | for (cr_entry = vrh->cred_chain_head; cr_entry != NULL; |
755 | cr_entry = cr_entry->next) { | 784 | cr_entry = cr_entry->next) |
756 | if (0 | 785 | { |
757 | != GNUNET_memcmp (&cr_entry->credential->issuer_key, | 786 | if (0 |
758 | &vrh->issuer_key)) | 787 | != GNUNET_memcmp(&cr_entry->credential->issuer_key, |
759 | continue; | 788 | &vrh->issuer_key)) |
760 | if (0 | 789 | continue; |
761 | != strcmp (cr_entry->credential->issuer_attribute, | 790 | if (0 |
762 | vrh->issuer_attribute)) | 791 | != strcmp(cr_entry->credential->issuer_attribute, |
763 | continue; | 792 | vrh->issuer_attribute)) |
764 | cr_entry->refcount++; | 793 | continue; |
765 | // Found match prematurely | 794 | cr_entry->refcount++; |
766 | send_lookup_response (vrh); | 795 | // Found match prematurely |
767 | return; | 796 | send_lookup_response(vrh); |
768 | } | 797 | return; |
798 | } | ||
769 | 799 | ||
770 | /** | 800 | /** |
771 | * Check for attributes from the issuer and follow the chain | 801 | * Check for attributes from the issuer and follow the chain |
772 | * till you get the required subject's attributes | 802 | * till you get the required subject's attributes |
773 | */ | 803 | */ |
774 | char issuer_attribute_name[strlen (vrh->issuer_attribute) + 1]; | 804 | char issuer_attribute_name[strlen(vrh->issuer_attribute) + 1]; |
775 | strcpy (issuer_attribute_name, vrh->issuer_attribute); | 805 | strcpy(issuer_attribute_name, vrh->issuer_attribute); |
776 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 806 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
777 | "Looking up %s\n", | 807 | "Looking up %s\n", |
778 | issuer_attribute_name); | 808 | issuer_attribute_name); |
779 | ds_entry = GNUNET_new (struct DelegationSetQueueEntry); | 809 | ds_entry = GNUNET_new(struct DelegationSetQueueEntry); |
780 | ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); | 810 | ds_entry->issuer_key = GNUNET_new(struct GNUNET_CRYPTO_EcdsaPublicKey); |
781 | GNUNET_memcpy (ds_entry->issuer_key, | 811 | GNUNET_memcpy(ds_entry->issuer_key, |
782 | &vrh->issuer_key, | 812 | &vrh->issuer_key, |
783 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 813 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); |
784 | ds_entry->issuer_attribute = GNUNET_strdup (vrh->issuer_attribute); | 814 | ds_entry->issuer_attribute = GNUNET_strdup(vrh->issuer_attribute); |
785 | ds_entry->handle = vrh; | 815 | ds_entry->handle = vrh; |
786 | ds_entry->lookup_attribute = GNUNET_strdup (vrh->issuer_attribute); | 816 | ds_entry->lookup_attribute = GNUNET_strdup(vrh->issuer_attribute); |
787 | vrh->root_set = ds_entry; | 817 | vrh->root_set = ds_entry; |
788 | vrh->pending_lookups = 1; | 818 | vrh->pending_lookups = 1; |
789 | // Start with backward resolution | 819 | // Start with backward resolution |
790 | ds_entry->lookup_request = GNUNET_GNS_lookup (gns, | 820 | ds_entry->lookup_request = GNUNET_GNS_lookup(gns, |
791 | issuer_attribute_name, | 821 | issuer_attribute_name, |
792 | &vrh->issuer_key, // issuer_key, | 822 | &vrh->issuer_key, // issuer_key, |
793 | GNUNET_GNSRECORD_TYPE_ATTRIBUTE, | 823 | GNUNET_GNSRECORD_TYPE_ATTRIBUTE, |
794 | GNUNET_GNS_LO_DEFAULT, | 824 | GNUNET_GNS_LO_DEFAULT, |
795 | &backward_resolution, | 825 | &backward_resolution, |
796 | ds_entry); | 826 | ds_entry); |
797 | } | 827 | } |
798 | 828 | ||
799 | static int | 829 | static int |
800 | check_verify (void *cls, const struct VerifyMessage *v_msg) | 830 | check_verify(void *cls, const struct VerifyMessage *v_msg) |
801 | { | 831 | { |
802 | size_t msg_size; | 832 | size_t msg_size; |
803 | const char *attr; | 833 | const char *attr; |
804 | 834 | ||
805 | msg_size = ntohs (v_msg->header.size); | 835 | msg_size = ntohs(v_msg->header.size); |
806 | if (msg_size < sizeof (struct VerifyMessage)) { | 836 | if (msg_size < sizeof(struct VerifyMessage)) |
807 | GNUNET_break (0); | 837 | { |
808 | return GNUNET_SYSERR; | 838 | GNUNET_break(0); |
809 | } | 839 | return GNUNET_SYSERR; |
810 | if (ntohs (v_msg->issuer_attribute_len) > GNUNET_CREDENTIAL_MAX_LENGTH) { | 840 | } |
811 | GNUNET_break (0); | 841 | if (ntohs(v_msg->issuer_attribute_len) > GNUNET_CREDENTIAL_MAX_LENGTH) |
812 | return GNUNET_SYSERR; | 842 | { |
813 | } | 843 | GNUNET_break(0); |
844 | return GNUNET_SYSERR; | ||
845 | } | ||
814 | attr = (const char *)&v_msg[1]; | 846 | attr = (const char *)&v_msg[1]; |
815 | 847 | ||
816 | if (strlen (attr) > GNUNET_CREDENTIAL_MAX_LENGTH) { | 848 | if (strlen(attr) > GNUNET_CREDENTIAL_MAX_LENGTH) |
817 | GNUNET_break (0); | 849 | { |
818 | return GNUNET_SYSERR; | 850 | GNUNET_break(0); |
819 | } | 851 | return GNUNET_SYSERR; |
852 | } | ||
820 | return GNUNET_OK; | 853 | return GNUNET_OK; |
821 | } | 854 | } |
822 | 855 | ||
823 | static void | 856 | static void |
824 | handle_verify (void *cls, const struct VerifyMessage *v_msg) | 857 | handle_verify(void *cls, const struct VerifyMessage *v_msg) |
825 | { | 858 | { |
826 | struct VerifyRequestHandle *vrh; | 859 | struct VerifyRequestHandle *vrh; |
827 | struct GNUNET_SERVICE_Client *client = cls; | 860 | struct GNUNET_SERVICE_Client *client = cls; |
@@ -834,96 +867,101 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) | |||
834 | char *credential_data; | 867 | char *credential_data; |
835 | const char *utf_in; | 868 | const char *utf_in; |
836 | 869 | ||
837 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received VERIFY message\n"); | 870 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received VERIFY message\n"); |
838 | utf_in = (const char *)&v_msg[1]; | 871 | utf_in = (const char *)&v_msg[1]; |
839 | GNUNET_STRINGS_utf8_tolower (utf_in, attrptr); | 872 | GNUNET_STRINGS_utf8_tolower(utf_in, attrptr); |
840 | GNUNET_memcpy (issuer_attribute, attr, ntohs (v_msg->issuer_attribute_len)); | 873 | GNUNET_memcpy(issuer_attribute, attr, ntohs(v_msg->issuer_attribute_len)); |
841 | issuer_attribute[ntohs (v_msg->issuer_attribute_len)] = '\0'; | 874 | issuer_attribute[ntohs(v_msg->issuer_attribute_len)] = '\0'; |
842 | vrh = GNUNET_new (struct VerifyRequestHandle); | 875 | vrh = GNUNET_new(struct VerifyRequestHandle); |
843 | GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); | 876 | GNUNET_CONTAINER_DLL_insert(vrh_head, vrh_tail, vrh); |
844 | vrh->client = client; | 877 | vrh->client = client; |
845 | vrh->request_id = v_msg->id; | 878 | vrh->request_id = v_msg->id; |
846 | vrh->issuer_key = v_msg->issuer_key; | 879 | vrh->issuer_key = v_msg->issuer_key; |
847 | vrh->subject_key = v_msg->subject_key; | 880 | vrh->subject_key = v_msg->subject_key; |
848 | vrh->issuer_attribute = GNUNET_strdup (issuer_attribute); | 881 | vrh->issuer_attribute = GNUNET_strdup(issuer_attribute); |
849 | GNUNET_SERVICE_client_continue (vrh->client); | 882 | GNUNET_SERVICE_client_continue(vrh->client); |
850 | if (0 == strlen (issuer_attribute)) { | 883 | if (0 == strlen(issuer_attribute)) |
851 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No issuer attribute provided!\n"); | 884 | { |
852 | send_lookup_response (vrh); | 885 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "No issuer attribute provided!\n"); |
853 | return; | 886 | send_lookup_response(vrh); |
854 | } | 887 | return; |
888 | } | ||
855 | /** | 889 | /** |
856 | * First, collect credentials | 890 | * First, collect credentials |
857 | * TODO: cleanup! | 891 | * TODO: cleanup! |
858 | */ | 892 | */ |
859 | credentials_count = ntohl (v_msg->c_count); | 893 | credentials_count = ntohl(v_msg->c_count); |
860 | credential_data_size = ntohs (v_msg->header.size) | 894 | credential_data_size = ntohs(v_msg->header.size) |
861 | - sizeof (struct VerifyMessage) | 895 | - sizeof(struct VerifyMessage) |
862 | - ntohs (v_msg->issuer_attribute_len) - 1; | 896 | - ntohs(v_msg->issuer_attribute_len) - 1; |
863 | struct GNUNET_CREDENTIAL_Credential credentials[credentials_count]; | 897 | struct GNUNET_CREDENTIAL_Credential credentials[credentials_count]; |
864 | memset (credentials, | 898 | memset(credentials, |
865 | 0, | 899 | 0, |
866 | sizeof (struct GNUNET_CREDENTIAL_Credential) * credentials_count); | 900 | sizeof(struct GNUNET_CREDENTIAL_Credential) * credentials_count); |
867 | credential_data = (char *)&v_msg[1] + ntohs (v_msg->issuer_attribute_len) + 1; | 901 | credential_data = (char *)&v_msg[1] + ntohs(v_msg->issuer_attribute_len) + 1; |
868 | if (GNUNET_OK | 902 | if (GNUNET_OK |
869 | != GNUNET_CREDENTIAL_credentials_deserialize (credential_data_size, | 903 | != GNUNET_CREDENTIAL_credentials_deserialize(credential_data_size, |
870 | credential_data, | 904 | credential_data, |
871 | credentials_count, | 905 | credentials_count, |
872 | credentials)) { | 906 | credentials)) |
873 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot deserialize credentials!\n"); | 907 | { |
874 | send_lookup_response (vrh); | 908 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot deserialize credentials!\n"); |
875 | return; | 909 | send_lookup_response(vrh); |
876 | } | 910 | return; |
877 | 911 | } | |
878 | for (uint32_t i = 0; i < credentials_count; i++) { | 912 | |
879 | cr_entry = GNUNET_new (struct CredentialRecordEntry); | 913 | for (uint32_t i = 0; i < credentials_count; i++) |
880 | cr_entry->credential | 914 | { |
881 | = GNUNET_malloc (sizeof (struct GNUNET_CREDENTIAL_Credential) | 915 | cr_entry = GNUNET_new(struct CredentialRecordEntry); |
882 | + credentials[i].issuer_attribute_len + 1); | 916 | cr_entry->credential |
883 | GNUNET_memcpy (cr_entry->credential, | 917 | = GNUNET_malloc(sizeof(struct GNUNET_CREDENTIAL_Credential) |
884 | &credentials[i], | 918 | + credentials[i].issuer_attribute_len + 1); |
885 | sizeof (struct GNUNET_CREDENTIAL_Credential)); | 919 | GNUNET_memcpy(cr_entry->credential, |
886 | GNUNET_memcpy (&cr_entry->credential[1], | 920 | &credentials[i], |
887 | credentials[i].issuer_attribute, | 921 | sizeof(struct GNUNET_CREDENTIAL_Credential)); |
888 | credentials[i].issuer_attribute_len); | 922 | GNUNET_memcpy(&cr_entry->credential[1], |
889 | cr_entry->credential->issuer_attribute_len | 923 | credentials[i].issuer_attribute, |
890 | = credentials[i].issuer_attribute_len; | 924 | credentials[i].issuer_attribute_len); |
891 | cr_entry->credential->issuer_attribute = (char *)&cr_entry->credential[1]; | 925 | cr_entry->credential->issuer_attribute_len |
892 | GNUNET_CONTAINER_DLL_insert_tail (vrh->cred_chain_head, | 926 | = credentials[i].issuer_attribute_len; |
893 | vrh->cred_chain_tail, | 927 | cr_entry->credential->issuer_attribute = (char *)&cr_entry->credential[1]; |
894 | cr_entry); | 928 | GNUNET_CONTAINER_DLL_insert_tail(vrh->cred_chain_head, |
895 | vrh->cred_chain_size++; | 929 | vrh->cred_chain_tail, |
896 | } | 930 | cr_entry); |
897 | 931 | vrh->cred_chain_size++; | |
898 | delegation_chain_resolution_start (vrh); | 932 | } |
933 | |||
934 | delegation_chain_resolution_start(vrh); | ||
899 | } | 935 | } |
900 | 936 | ||
901 | static void | 937 | static void |
902 | handle_cred_collection_error_cb (void *cls) | 938 | handle_cred_collection_error_cb(void *cls) |
903 | { | 939 | { |
904 | struct VerifyRequestHandle *vrh = cls; | 940 | struct VerifyRequestHandle *vrh = cls; |
905 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 941 | |
906 | "Got disconnected from namestore database.\n"); | 942 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
943 | "Got disconnected from namestore database.\n"); | ||
907 | vrh->cred_collection_iter = NULL; | 944 | vrh->cred_collection_iter = NULL; |
908 | send_lookup_response (vrh); | 945 | send_lookup_response(vrh); |
909 | } | 946 | } |
910 | 947 | ||
911 | static void | 948 | static void |
912 | collect_next (void *cls) | 949 | collect_next(void *cls) |
913 | { | 950 | { |
914 | struct VerifyRequestHandle *vrh = cls; | 951 | struct VerifyRequestHandle *vrh = cls; |
952 | |||
915 | vrh->collect_next_task = NULL; | 953 | vrh->collect_next_task = NULL; |
916 | GNUNET_assert (NULL != vrh->cred_collection_iter); | 954 | GNUNET_assert(NULL != vrh->cred_collection_iter); |
917 | GNUNET_NAMESTORE_zone_iterator_next (vrh->cred_collection_iter, 1); | 955 | GNUNET_NAMESTORE_zone_iterator_next(vrh->cred_collection_iter, 1); |
918 | } | 956 | } |
919 | 957 | ||
920 | 958 | ||
921 | static void | 959 | static void |
922 | handle_cred_collection_cb (void *cls, | 960 | handle_cred_collection_cb(void *cls, |
923 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 961 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, |
924 | const char *label, | 962 | const char *label, |
925 | unsigned int rd_count, | 963 | unsigned int rd_count, |
926 | const struct GNUNET_GNSRECORD_Data *rd) | 964 | const struct GNUNET_GNSRECORD_Data *rd) |
927 | { | 965 | { |
928 | struct VerifyRequestHandle *vrh = cls; | 966 | struct VerifyRequestHandle *vrh = cls; |
929 | struct GNUNET_CREDENTIAL_Credential *crd; | 967 | struct GNUNET_CREDENTIAL_Credential *crd; |
@@ -931,37 +969,40 @@ handle_cred_collection_cb (void *cls, | |||
931 | int cred_record_count; | 969 | int cred_record_count; |
932 | 970 | ||
933 | cred_record_count = 0; | 971 | cred_record_count = 0; |
934 | for (uint32_t i = 0; i < rd_count; i++) { | 972 | for (uint32_t i = 0; i < rd_count; i++) |
935 | if (GNUNET_GNSRECORD_TYPE_CREDENTIAL != rd[i].record_type) | 973 | { |
936 | continue; | 974 | if (GNUNET_GNSRECORD_TYPE_CREDENTIAL != rd[i].record_type) |
937 | cred_record_count++; | 975 | continue; |
938 | crd | 976 | cred_record_count++; |
939 | = GNUNET_CREDENTIAL_credential_deserialize (rd[i].data, rd[i].data_size); | 977 | crd |
940 | if (NULL == crd) { | 978 | = GNUNET_CREDENTIAL_credential_deserialize(rd[i].data, rd[i].data_size); |
941 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid credential found\n"); | 979 | if (NULL == crd) |
942 | continue; | 980 | { |
981 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Invalid credential found\n"); | ||
982 | continue; | ||
983 | } | ||
984 | cr_entry = GNUNET_new(struct CredentialRecordEntry); | ||
985 | cr_entry->credential = crd; | ||
986 | GNUNET_CONTAINER_DLL_insert_tail(vrh->cred_chain_head, | ||
987 | vrh->cred_chain_tail, | ||
988 | cr_entry); | ||
989 | vrh->cred_chain_size++; | ||
943 | } | 990 | } |
944 | cr_entry = GNUNET_new (struct CredentialRecordEntry); | 991 | vrh->collect_next_task = GNUNET_SCHEDULER_add_now(&collect_next, vrh); |
945 | cr_entry->credential = crd; | ||
946 | GNUNET_CONTAINER_DLL_insert_tail (vrh->cred_chain_head, | ||
947 | vrh->cred_chain_tail, | ||
948 | cr_entry); | ||
949 | vrh->cred_chain_size++; | ||
950 | } | ||
951 | vrh->collect_next_task = GNUNET_SCHEDULER_add_now (&collect_next, vrh); | ||
952 | } | 992 | } |
953 | 993 | ||
954 | static void | 994 | static void |
955 | handle_cred_collection_finished_cb (void *cls) | 995 | handle_cred_collection_finished_cb(void *cls) |
956 | { | 996 | { |
957 | struct VerifyRequestHandle *vrh = cls; | 997 | struct VerifyRequestHandle *vrh = cls; |
958 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Done collecting credentials.\n"); | 998 | |
999 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Done collecting credentials.\n"); | ||
959 | vrh->cred_collection_iter = NULL; | 1000 | vrh->cred_collection_iter = NULL; |
960 | delegation_chain_resolution_start (vrh); | 1001 | delegation_chain_resolution_start(vrh); |
961 | } | 1002 | } |
962 | 1003 | ||
963 | static void | 1004 | static void |
964 | handle_collect (void *cls, const struct CollectMessage *c_msg) | 1005 | handle_collect(void *cls, const struct CollectMessage *c_msg) |
965 | { | 1006 | { |
966 | char attr[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; | 1007 | char attr[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; |
967 | char issuer_attribute[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; | 1008 | char issuer_attribute[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; |
@@ -970,31 +1011,32 @@ handle_collect (void *cls, const struct CollectMessage *c_msg) | |||
970 | char *attrptr = attr; | 1011 | char *attrptr = attr; |
971 | const char *utf_in; | 1012 | const char *utf_in; |
972 | 1013 | ||
973 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received COLLECT message\n"); | 1014 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received COLLECT message\n"); |
974 | 1015 | ||
975 | utf_in = (const char *)&c_msg[1]; | 1016 | utf_in = (const char *)&c_msg[1]; |
976 | GNUNET_STRINGS_utf8_tolower (utf_in, attrptr); | 1017 | GNUNET_STRINGS_utf8_tolower(utf_in, attrptr); |
977 | 1018 | ||
978 | GNUNET_memcpy (issuer_attribute, attr, ntohs (c_msg->issuer_attribute_len)); | 1019 | GNUNET_memcpy(issuer_attribute, attr, ntohs(c_msg->issuer_attribute_len)); |
979 | issuer_attribute[ntohs (c_msg->issuer_attribute_len)] = '\0'; | 1020 | issuer_attribute[ntohs(c_msg->issuer_attribute_len)] = '\0'; |
980 | vrh = GNUNET_new (struct VerifyRequestHandle); | 1021 | vrh = GNUNET_new(struct VerifyRequestHandle); |
981 | GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); | 1022 | GNUNET_CONTAINER_DLL_insert(vrh_head, vrh_tail, vrh); |
982 | vrh->client = client; | 1023 | vrh->client = client; |
983 | vrh->request_id = c_msg->id; | 1024 | vrh->request_id = c_msg->id; |
984 | vrh->issuer_key = c_msg->issuer_key; | 1025 | vrh->issuer_key = c_msg->issuer_key; |
985 | GNUNET_CRYPTO_ecdsa_key_get_public (&c_msg->subject_key, &vrh->subject_key); | 1026 | GNUNET_CRYPTO_ecdsa_key_get_public(&c_msg->subject_key, &vrh->subject_key); |
986 | vrh->issuer_attribute = GNUNET_strdup (issuer_attribute); | 1027 | vrh->issuer_attribute = GNUNET_strdup(issuer_attribute); |
987 | 1028 | ||
988 | if (0 == strlen (issuer_attribute)) { | 1029 | if (0 == strlen(issuer_attribute)) |
989 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No issuer attribute provided!\n"); | 1030 | { |
990 | send_lookup_response (vrh); | 1031 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "No issuer attribute provided!\n"); |
991 | return; | 1032 | send_lookup_response(vrh); |
992 | } | 1033 | return; |
993 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Getting credentials for subject\n"); | 1034 | } |
1035 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Getting credentials for subject\n"); | ||
994 | /** | 1036 | /** |
995 | * First, get attribute from subject | 1037 | * First, get attribute from subject |
996 | */ | 1038 | */ |
997 | vrh->cred_collection_iter = GNUNET_NAMESTORE_zone_iteration_start ( | 1039 | vrh->cred_collection_iter = GNUNET_NAMESTORE_zone_iteration_start( |
998 | namestore, | 1040 | namestore, |
999 | &c_msg->subject_key, | 1041 | &c_msg->subject_key, |
1000 | &handle_cred_collection_error_cb, | 1042 | &handle_cred_collection_error_cb, |
@@ -1003,49 +1045,52 @@ handle_collect (void *cls, const struct CollectMessage *c_msg) | |||
1003 | vrh, | 1045 | vrh, |
1004 | &handle_cred_collection_finished_cb, | 1046 | &handle_cred_collection_finished_cb, |
1005 | vrh); | 1047 | vrh); |
1006 | GNUNET_SERVICE_client_continue (vrh->client); | 1048 | GNUNET_SERVICE_client_continue(vrh->client); |
1007 | } | 1049 | } |
1008 | 1050 | ||
1009 | 1051 | ||
1010 | static int | 1052 | static int |
1011 | check_collect (void *cls, const struct CollectMessage *c_msg) | 1053 | check_collect(void *cls, const struct CollectMessage *c_msg) |
1012 | { | 1054 | { |
1013 | size_t msg_size; | 1055 | size_t msg_size; |
1014 | const char *attr; | 1056 | const char *attr; |
1015 | 1057 | ||
1016 | msg_size = ntohs (c_msg->header.size); | 1058 | msg_size = ntohs(c_msg->header.size); |
1017 | if (msg_size < sizeof (struct CollectMessage)) { | 1059 | if (msg_size < sizeof(struct CollectMessage)) |
1018 | GNUNET_break (0); | 1060 | { |
1019 | return GNUNET_SYSERR; | 1061 | GNUNET_break(0); |
1020 | } | 1062 | return GNUNET_SYSERR; |
1021 | if (ntohs (c_msg->issuer_attribute_len) > GNUNET_CREDENTIAL_MAX_LENGTH) { | 1063 | } |
1022 | GNUNET_break (0); | 1064 | if (ntohs(c_msg->issuer_attribute_len) > GNUNET_CREDENTIAL_MAX_LENGTH) |
1023 | return GNUNET_SYSERR; | 1065 | { |
1024 | } | 1066 | GNUNET_break(0); |
1067 | return GNUNET_SYSERR; | ||
1068 | } | ||
1025 | attr = (const char *)&c_msg[1]; | 1069 | attr = (const char *)&c_msg[1]; |
1026 | 1070 | ||
1027 | if (('\0' != attr[msg_size - sizeof (struct CollectMessage) - 1]) | 1071 | if (('\0' != attr[msg_size - sizeof(struct CollectMessage) - 1]) |
1028 | || (strlen (attr) > GNUNET_CREDENTIAL_MAX_LENGTH)) { | 1072 | || (strlen(attr) > GNUNET_CREDENTIAL_MAX_LENGTH)) |
1029 | GNUNET_break (0); | 1073 | { |
1030 | return GNUNET_SYSERR; | 1074 | GNUNET_break(0); |
1031 | } | 1075 | return GNUNET_SYSERR; |
1076 | } | ||
1032 | return GNUNET_OK; | 1077 | return GNUNET_OK; |
1033 | } | 1078 | } |
1034 | 1079 | ||
1035 | static void | 1080 | static void |
1036 | client_disconnect_cb (void *cls, | 1081 | client_disconnect_cb(void *cls, |
1037 | struct GNUNET_SERVICE_Client *client, | 1082 | struct GNUNET_SERVICE_Client *client, |
1038 | void *app_ctx) | 1083 | void *app_ctx) |
1039 | { | 1084 | { |
1040 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client); | 1085 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client); |
1041 | } | 1086 | } |
1042 | 1087 | ||
1043 | static void * | 1088 | static void * |
1044 | client_connect_cb (void *cls, | 1089 | client_connect_cb(void *cls, |
1045 | struct GNUNET_SERVICE_Client *client, | 1090 | struct GNUNET_SERVICE_Client *client, |
1046 | struct GNUNET_MQ_Handle *mq) | 1091 | struct GNUNET_MQ_Handle *mq) |
1047 | { | 1092 | { |
1048 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client); | 1093 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client); |
1049 | return client; | 1094 | return client; |
1050 | } | 1095 | } |
1051 | 1096 | ||
@@ -1057,43 +1102,44 @@ client_connect_cb (void *cls, | |||
1057 | * @param handle service handle | 1102 | * @param handle service handle |
1058 | */ | 1103 | */ |
1059 | static void | 1104 | static void |
1060 | run (void *cls, | 1105 | run(void *cls, |
1061 | const struct GNUNET_CONFIGURATION_Handle *c, | 1106 | const struct GNUNET_CONFIGURATION_Handle *c, |
1062 | struct GNUNET_SERVICE_Handle *handle) | 1107 | struct GNUNET_SERVICE_Handle *handle) |
1063 | { | 1108 | { |
1109 | gns = GNUNET_GNS_connect(c); | ||
1110 | if (NULL == gns) | ||
1111 | { | ||
1112 | fprintf(stderr, _("Failed to connect to GNS\n")); | ||
1113 | } | ||
1114 | namestore = GNUNET_NAMESTORE_connect(c); | ||
1115 | if (NULL == namestore) | ||
1116 | { | ||
1117 | fprintf(stderr, _("Failed to connect to namestore\n")); | ||
1118 | } | ||
1064 | 1119 | ||
1065 | gns = GNUNET_GNS_connect (c); | 1120 | statistics = GNUNET_STATISTICS_create("credential", c); |
1066 | if (NULL == gns) { | 1121 | GNUNET_SCHEDULER_add_shutdown(&shutdown_task, NULL); |
1067 | fprintf (stderr, _ ("Failed to connect to GNS\n")); | ||
1068 | } | ||
1069 | namestore = GNUNET_NAMESTORE_connect (c); | ||
1070 | if (NULL == namestore) { | ||
1071 | fprintf (stderr, _ ("Failed to connect to namestore\n")); | ||
1072 | } | ||
1073 | |||
1074 | statistics = GNUNET_STATISTICS_create ("credential", c); | ||
1075 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | ||
1076 | } | 1122 | } |
1077 | 1123 | ||
1078 | 1124 | ||
1079 | /** | 1125 | /** |
1080 | * Define "main" method using service macro | 1126 | * Define "main" method using service macro |
1081 | */ | 1127 | */ |
1082 | GNUNET_SERVICE_MAIN ( | 1128 | GNUNET_SERVICE_MAIN( |
1083 | "credential", | 1129 | "credential", |
1084 | GNUNET_SERVICE_OPTION_NONE, | 1130 | GNUNET_SERVICE_OPTION_NONE, |
1085 | &run, | 1131 | &run, |
1086 | &client_connect_cb, | 1132 | &client_connect_cb, |
1087 | &client_disconnect_cb, | 1133 | &client_disconnect_cb, |
1088 | NULL, | 1134 | NULL, |
1089 | GNUNET_MQ_hd_var_size (verify, | 1135 | GNUNET_MQ_hd_var_size(verify, |
1090 | GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY, | 1136 | GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY, |
1091 | struct VerifyMessage, | 1137 | struct VerifyMessage, |
1092 | NULL), | 1138 | NULL), |
1093 | GNUNET_MQ_hd_var_size (collect, | 1139 | GNUNET_MQ_hd_var_size(collect, |
1094 | GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT, | 1140 | GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT, |
1095 | struct CollectMessage, | 1141 | struct CollectMessage, |
1096 | NULL), | 1142 | NULL), |
1097 | GNUNET_MQ_handler_end ()); | 1143 | GNUNET_MQ_handler_end()); |
1098 | 1144 | ||
1099 | /* end of gnunet-service-credential.c */ | 1145 | /* end of gnunet-service-credential.c */ |