diff options
author | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-04-10 14:32:03 +0200 |
---|---|---|
committer | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-04-10 14:32:03 +0200 |
commit | de72aeb9ffa09576f7df749ef5ef2cf3391adec2 (patch) | |
tree | 488b0af465d17e322736c617462dd3d39bface4f /src/identity-provider | |
parent | 081f818a024f52aca9de82fc2c8c1cc181603455 (diff) | |
download | gnunet-de72aeb9ffa09576f7df749ef5ef2cf3391adec2.tar.gz gnunet-de72aeb9ffa09576f7df749ef5ef2cf3391adec2.zip |
fix tests
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 1f1036d44..4f17919b9 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; | |||
131 | */ | 131 | */ |
132 | static struct GNUNET_TIME_Relative exp_interval; | 132 | static struct GNUNET_TIME_Relative exp_interval; |
133 | 133 | ||
134 | /** | ||
135 | * Timeout task | ||
136 | */ | ||
137 | static struct GNUNET_SCHEDULER_Task *timeout; | ||
138 | |||
134 | static void | 139 | static void |
135 | do_cleanup(void *cls) | 140 | do_cleanup(void *cls) |
136 | { | 141 | { |
142 | if (NULL != timeout) | ||
143 | GNUNET_SCHEDULER_cancel (timeout); | ||
144 | if (NULL != idp_op) | ||
145 | GNUNET_IDENTITY_PROVIDER_cancel (idp_op); | ||
137 | if (NULL != attr_iterator) | 146 | if (NULL != attr_iterator) |
138 | GNUNET_IDENTITY_PROVIDER_get_attributes_stop (attr_iterator); | 147 | GNUNET_IDENTITY_PROVIDER_get_attributes_stop (attr_iterator); |
139 | if (NULL != idp_handle) | 148 | if (NULL != idp_handle) |
@@ -151,6 +160,7 @@ ticket_issue_cb (void* cls, | |||
151 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket) | 160 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket) |
152 | { | 161 | { |
153 | char* ticket_str; | 162 | char* ticket_str; |
163 | idp_op = NULL; | ||
154 | if (NULL != ticket) { | 164 | if (NULL != ticket) { |
155 | ticket_str = GNUNET_STRINGS_data_to_string_alloc (ticket, | 165 | ticket_str = GNUNET_STRINGS_data_to_string_alloc (ticket, |
156 | sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); | 166 | sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); |
@@ -166,6 +176,7 @@ store_attr_cont (void *cls, | |||
166 | int32_t success, | 176 | int32_t success, |
167 | const char*emsg) | 177 | const char*emsg) |
168 | { | 178 | { |
179 | idp_op = NULL; | ||
169 | if (GNUNET_SYSERR == success) { | 180 | if (GNUNET_SYSERR == success) { |
170 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 181 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
171 | "%s\n", emsg); | 182 | "%s\n", emsg); |
@@ -181,6 +192,7 @@ process_attrs (void *cls, | |||
181 | char *value_str; | 192 | char *value_str; |
182 | if (NULL == identity) | 193 | if (NULL == identity) |
183 | { | 194 | { |
195 | idp_op = NULL; | ||
184 | GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | 196 | GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); |
185 | return; | 197 | return; |
186 | } | 198 | } |
@@ -207,8 +219,19 @@ iter_error (void *cls) | |||
207 | } | 219 | } |
208 | 220 | ||
209 | static void | 221 | static void |
222 | timeout_task (void *cls) | ||
223 | { | ||
224 | timeout = NULL; | ||
225 | ret = 1; | ||
226 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
227 | "Timeout\n"); | ||
228 | GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | ||
229 | } | ||
230 | |||
231 | static void | ||
210 | process_rvk (void *cls, int success, const char* msg) | 232 | process_rvk (void *cls, int success, const char* msg) |
211 | { | 233 | { |
234 | idp_op = NULL; | ||
212 | if (GNUNET_OK != success) | 235 | if (GNUNET_OK != success) |
213 | { | 236 | { |
214 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 237 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
@@ -250,6 +273,9 @@ iter_finished (void *cls) | |||
250 | &ticket, | 273 | &ticket, |
251 | &process_attrs, | 274 | &process_attrs, |
252 | NULL); | 275 | NULL); |
276 | timeout = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10), | ||
277 | &timeout_task, | ||
278 | NULL); | ||
253 | return; | 279 | return; |
254 | } | 280 | } |
255 | if (revoke_ticket) | 281 | if (revoke_ticket) |
@@ -445,10 +471,10 @@ main(int argc, char *const argv[]) | |||
445 | 471 | ||
446 | GNUNET_GETOPT_OPTION_END | 472 | GNUNET_GETOPT_OPTION_END |
447 | }; | 473 | }; |
448 | if (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "ct", | 474 | if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv, "ct", |
449 | "ct", options, | 475 | "ct", options, |
450 | &run, NULL)) | 476 | &run, NULL)) |
451 | return 0; | ||
452 | else | ||
453 | return 1; | 477 | return 1; |
478 | else | ||
479 | return ret; | ||
454 | } | 480 | } |
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index b738ffc82..5fc9a11e2 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, | |||
1565 | static void | 1565 | static void |
1566 | cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle) | 1566 | cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle) |
1567 | { | 1567 | { |
1568 | struct ParallelLookup *lu; | ||
1569 | struct ParallelLookup *tmp; | ||
1570 | if (NULL != handle->lookup_request) | ||
1571 | GNUNET_GNS_lookup_cancel (handle->lookup_request); | ||
1572 | for (lu = handle->parallel_lookups_head; | ||
1573 | NULL != lu;) { | ||
1574 | GNUNET_GNS_lookup_cancel (lu->lookup_request); | ||
1575 | GNUNET_free (lu->label); | ||
1576 | tmp = lu->next; | ||
1577 | GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head, | ||
1578 | handle->parallel_lookups_tail, | ||
1579 | lu); | ||
1580 | GNUNET_free (lu); | ||
1581 | lu = tmp; | ||
1582 | } | ||
1583 | |||
1568 | if (NULL != handle->key) | 1584 | if (NULL != handle->key) |
1569 | GNUNET_ABE_cpabe_delete_key (handle->key, | 1585 | GNUNET_ABE_cpabe_delete_key (handle->key, |
1570 | GNUNET_YES); | 1586 | GNUNET_YES); |
@@ -1690,7 +1706,8 @@ abort_parallel_lookups2 (void *cls) | |||
1690 | struct ParallelLookup *tmp; | 1706 | struct ParallelLookup *tmp; |
1691 | struct AttributeResultMessage *arm; | 1707 | struct AttributeResultMessage *arm; |
1692 | struct GNUNET_MQ_Envelope *env; | 1708 | struct GNUNET_MQ_Envelope *env; |
1693 | 1709 | ||
1710 | handle->kill_task = NULL; | ||
1694 | for (lu = handle->parallel_lookups_head; | 1711 | for (lu = handle->parallel_lookups_head; |
1695 | NULL != lu;) { | 1712 | NULL != lu;) { |
1696 | GNUNET_GNS_lookup_cancel (lu->lookup_request); | 1713 | 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 21ce6e3d6..47217442a 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) | |||
873 | GNUNET_CONTAINER_DLL_remove (h->op_head, | 873 | GNUNET_CONTAINER_DLL_remove (h->op_head, |
874 | h->op_tail, | 874 | h->op_tail, |
875 | op); | 875 | op); |
876 | GNUNET_MQ_discard (op->env); | ||
877 | free_op (op); | 876 | free_op (op); |
878 | } | 877 | } |
879 | 878 | ||
diff --git a/src/identity-provider/test_idp_revoke.sh b/src/identity-provider/test_idp_revoke.sh index 6943fcf4f..7a3f5d030 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` | |||
23 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 23 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" |
24 | 24 | ||
25 | TEST_ATTR="test" | 25 | TEST_ATTR="test" |
26 | gnunet-arm -s -c test_idp.conf | 26 | gnunet-arm -s -c test_idp.conf 2&>1 > /dev/null |
27 | gnunet-identity -C alice -c test_idp.conf | 27 | gnunet-identity -C alice -c test_idp.conf |
28 | gnunet-identity -C bob -c test_idp.conf | 28 | gnunet-identity -C bob -c test_idp.conf |
29 | gnunet-identity -C eve -c test_idp.conf | 29 | 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}') | |||
31 | BOB_KEY=$(gnunet-identity -d -c test_idp.conf | grep bob | awk '{print $3}') | 31 | BOB_KEY=$(gnunet-identity -d -c test_idp.conf | grep bob | awk '{print $3}') |
32 | EVE_KEY=$(gnunet-identity -d -c test_idp.conf | grep eve | awk '{print $3}') | 32 | EVE_KEY=$(gnunet-identity -d -c test_idp.conf | grep eve | awk '{print $3}') |
33 | 33 | ||
34 | gnunet-idp -e alice -E 1s -a email -V john@doe.gnu -c test_idp.conf | 34 | gnunet-idp -e alice -E 15s -a email -V john@doe.gnu -c test_idp.conf |
35 | gnunet-idp -e alice -E 1s -a name -V John -c test_idp.conf | 35 | gnunet-idp -e alice -E 15s -a name -V John -c test_idp.conf |
36 | TICKET_BOB=$(gnunet-idp -e alice -i "email,name" -r $BOB_KEY -c test_idp.conf | awk '{print $1}') | 36 | TICKET_BOB=$(gnunet-idp -e alice -i "email,name" -r $BOB_KEY -c test_idp.conf | awk '{print $1}') |
37 | #gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf | 37 | #gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf |
38 | TICKET_EVE=$(gnunet-idp -e alice -i "email" -r $EVE_KEY -c test_idp.conf | awk '{print $1}') | 38 | 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 ' | |||
41 | #gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf | 41 | #gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf |
42 | gnunet-idp -e alice -R $TICKET_EVE -c test_idp.conf | 42 | gnunet-idp -e alice -R $TICKET_EVE -c test_idp.conf |
43 | 43 | ||
44 | sleep 2 | 44 | #sleep 6 |
45 | 45 | ||
46 | gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf > /dev/null 2>&1 | 46 | gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf 2&>1 >/dev/null |
47 | if test $? == 0 | 47 | if test $? == 0 |
48 | then | 48 | then |
49 | echo "Eve can still resolve attributes..." | 49 | echo "Eve can still resolve attributes..." |
50 | gnunet-arm -e -c test_idp.conf | 50 | gnunet-arm -e -c test_idp.conf |
51 | exit 1 | 51 | exit 1 |
52 | fi | 52 | fi |
53 | gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf > /dev/null 2>&1 | 53 | |
54 | gnunet-arm -e -c test_idp.conf | ||
55 | gnunet-arm -s -c test_idp.conf 2&>1 > /dev/null | ||
56 | |||
57 | gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf 2&>1 >/dev/null | ||
54 | if test $? != 0 | 58 | if test $? != 0 |
55 | then | 59 | then |
56 | echo "Bob cannot resolve attributes..." | 60 | echo "Bob cannot resolve attributes..." |