diff options
Diffstat (limited to 'src/identity-provider')
-rw-r--r-- | src/identity-provider/gnunet-idp.c | 32 | ||||
-rw-r--r-- | src/identity-provider/gnunet-service-identity-provider.c | 19 | ||||
-rw-r--r-- | src/identity-provider/identity_provider_api.c | 1 | ||||
-rwxr-xr-x | src/identity-provider/test_idp_revoke.sh | 16 |
4 files changed, 57 insertions, 11 deletions
diff --git a/src/identity-provider/gnunet-idp.c b/src/identity-provider/gnunet-idp.c index 1f1036d440..4f17919b95 100644 --- a/src/identity-provider/gnunet-idp.c +++ b/src/identity-provider/gnunet-idp.c @@ -131,9 +131,18 @@ static struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attr_list; */ static struct GNUNET_TIME_Relative exp_interval; +/** + * Timeout task + */ +static struct GNUNET_SCHEDULER_Task *timeout; + static void do_cleanup(void *cls) { + if (NULL != timeout) + GNUNET_SCHEDULER_cancel (timeout); + if (NULL != idp_op) + GNUNET_IDENTITY_PROVIDER_cancel (idp_op); if (NULL != attr_iterator) GNUNET_IDENTITY_PROVIDER_get_attributes_stop (attr_iterator); if (NULL != idp_handle) @@ -151,6 +160,7 @@ ticket_issue_cb (void* cls, const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket) { char* ticket_str; + idp_op = NULL; if (NULL != ticket) { ticket_str = GNUNET_STRINGS_data_to_string_alloc (ticket, sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); @@ -166,6 +176,7 @@ store_attr_cont (void *cls, int32_t success, const char*emsg) { + idp_op = NULL; if (GNUNET_SYSERR == success) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", emsg); @@ -181,6 +192,7 @@ process_attrs (void *cls, char *value_str; if (NULL == identity) { + idp_op = NULL; GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); return; } @@ -207,8 +219,19 @@ iter_error (void *cls) } static void +timeout_task (void *cls) +{ + timeout = NULL; + ret = 1; + GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, + "Timeout\n"); + GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); +} + +static void process_rvk (void *cls, int success, const char* msg) { + idp_op = NULL; if (GNUNET_OK != success) { GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, @@ -250,6 +273,9 @@ iter_finished (void *cls) &ticket, &process_attrs, NULL); + timeout = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10), + &timeout_task, + NULL); return; } if (revoke_ticket) @@ -445,10 +471,10 @@ main(int argc, char *const argv[]) GNUNET_GETOPT_OPTION_END }; - if (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "ct", + if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv, "ct", "ct", options, &run, NULL)) - return 0; - else return 1; + else + return ret; } diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index b738ffc82a..5fc9a11e2c 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c @@ -1565,6 +1565,22 @@ handle_revoke_ticket_message (void *cls, static void cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle) { + struct ParallelLookup *lu; + struct ParallelLookup *tmp; + if (NULL != handle->lookup_request) + GNUNET_GNS_lookup_cancel (handle->lookup_request); + for (lu = handle->parallel_lookups_head; + NULL != lu;) { + GNUNET_GNS_lookup_cancel (lu->lookup_request); + GNUNET_free (lu->label); + tmp = lu->next; + GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head, + handle->parallel_lookups_tail, + lu); + GNUNET_free (lu); + lu = tmp; + } + if (NULL != handle->key) GNUNET_ABE_cpabe_delete_key (handle->key, GNUNET_YES); @@ -1690,7 +1706,8 @@ abort_parallel_lookups2 (void *cls) struct ParallelLookup *tmp; struct AttributeResultMessage *arm; struct GNUNET_MQ_Envelope *env; - + + handle->kill_task = NULL; for (lu = handle->parallel_lookups_head; NULL != lu;) { GNUNET_GNS_lookup_cancel (lu->lookup_request); diff --git a/src/identity-provider/identity_provider_api.c b/src/identity-provider/identity_provider_api.c index 21ce6e3d67..47217442a2 100644 --- a/src/identity-provider/identity_provider_api.c +++ b/src/identity-provider/identity_provider_api.c @@ -873,7 +873,6 @@ GNUNET_IDENTITY_PROVIDER_cancel (struct GNUNET_IDENTITY_PROVIDER_Operation *op) GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); - GNUNET_MQ_discard (op->env); free_op (op); } diff --git a/src/identity-provider/test_idp_revoke.sh b/src/identity-provider/test_idp_revoke.sh index 6943fcf4f7..7a3f5d0301 100755 --- a/src/identity-provider/test_idp_revoke.sh +++ b/src/identity-provider/test_idp_revoke.sh @@ -23,7 +23,7 @@ rm -rf `gnunet-config -c test_idp.conf -s PATHS -o GNUNET_HOME -f` which timeout &> /dev/null && DO_TIMEOUT="timeout 30" TEST_ATTR="test" -gnunet-arm -s -c test_idp.conf +gnunet-arm -s -c test_idp.conf 2&>1 > /dev/null gnunet-identity -C alice -c test_idp.conf gnunet-identity -C bob -c test_idp.conf gnunet-identity -C eve -c test_idp.conf @@ -31,8 +31,8 @@ ALICE_KEY=$(gnunet-identity -d -c test_idp.conf | grep alice | awk '{print $3}') BOB_KEY=$(gnunet-identity -d -c test_idp.conf | grep bob | awk '{print $3}') EVE_KEY=$(gnunet-identity -d -c test_idp.conf | grep eve | awk '{print $3}') -gnunet-idp -e alice -E 1s -a email -V john@doe.gnu -c test_idp.conf -gnunet-idp -e alice -E 1s -a name -V John -c test_idp.conf +gnunet-idp -e alice -E 15s -a email -V john@doe.gnu -c test_idp.conf +gnunet-idp -e alice -E 15s -a name -V John -c test_idp.conf TICKET_BOB=$(gnunet-idp -e alice -i "email,name" -r $BOB_KEY -c test_idp.conf | awk '{print $1}') #gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf TICKET_EVE=$(gnunet-idp -e alice -i "email" -r $EVE_KEY -c test_idp.conf | awk '{print $1}') @@ -41,16 +41,20 @@ TICKET_EVE=$(gnunet-idp -e alice -i "email" -r $EVE_KEY -c test_idp.conf | awk ' #gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf gnunet-idp -e alice -R $TICKET_EVE -c test_idp.conf -sleep 2 +#sleep 6 -gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf > /dev/null 2>&1 +gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf 2&>1 >/dev/null if test $? == 0 then echo "Eve can still resolve attributes..." gnunet-arm -e -c test_idp.conf exit 1 fi -gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf > /dev/null 2>&1 + +gnunet-arm -e -c test_idp.conf +gnunet-arm -s -c test_idp.conf 2&>1 > /dev/null + +gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf 2&>1 >/dev/null if test $? != 0 then echo "Bob cannot resolve attributes..." |