diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2017-10-06 09:08:23 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2017-10-06 09:08:23 +0200 |
commit | 407c000bf423dc07f1f12fba9b8a8bcd08886d6c (patch) | |
tree | 53100e1f1a780e23d78c6c2637e8d5970febc94c /src | |
parent | 1731fbd017731df1f3f88bd4b3beac765996a1ad (diff) | |
download | gnunet-407c000bf423dc07f1f12fba9b8a8bcd08886d6c.tar.gz gnunet-407c000bf423dc07f1f12fba9b8a8bcd08886d6c.zip |
-fix bugs
Diffstat (limited to 'src')
-rw-r--r-- | src/identity-provider/gnunet-idp.c | 4 | ||||
-rw-r--r-- | src/identity-provider/gnunet-service-identity-provider.c | 55 | ||||
-rw-r--r-- | src/identity-provider/identity_attribute.c | 2 | ||||
-rw-r--r-- | src/identity-provider/identity_provider_api.c | 4 | ||||
-rwxr-xr-x | src/identity-provider/test_idp_issue.sh | 2 |
5 files changed, 46 insertions, 21 deletions
diff --git a/src/identity-provider/gnunet-idp.c b/src/identity-provider/gnunet-idp.c index a8739e6f6..fbe1d9613 100644 --- a/src/identity-provider/gnunet-idp.c +++ b/src/identity-provider/gnunet-idp.c | |||
@@ -151,7 +151,7 @@ store_attr_cont (void *cls, | |||
151 | "%s\n", emsg); | 151 | "%s\n", emsg); |
152 | } else { | 152 | } else { |
153 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 153 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
154 | "Sucessfully added identity attribute %s=%s\n", | 154 | "Successfully added identity attribute %s=%s\n", |
155 | attr_name, attr_value); | 155 | attr_name, attr_value); |
156 | } | 156 | } |
157 | GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | 157 | GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); |
@@ -251,7 +251,7 @@ iter_cb (void *cls, | |||
251 | break; | 251 | break; |
252 | } | 252 | } |
253 | GNUNET_free (attrs_tmp); | 253 | GNUNET_free (attrs_tmp); |
254 | } else { | 254 | } else if (list) { |
255 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 255 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
256 | "%s: %s\n", attr->name, (char*)attr->data); | 256 | "%s: %s\n", attr->name, (char*)attr->data); |
257 | } | 257 | } |
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 0b7f3389e..3b3af331e 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c | |||
@@ -1366,7 +1366,7 @@ static void | |||
1366 | process_parallel_lookup (void *cls, uint32_t rd_count, | 1366 | process_parallel_lookup (void *cls, uint32_t rd_count, |
1367 | const struct GNUNET_GNSRECORD_Data *rd) | 1367 | const struct GNUNET_GNSRECORD_Data *rd) |
1368 | { | 1368 | { |
1369 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 1369 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1370 | "Parallel lookup finished (count=%u)\n", rd_count); | 1370 | "Parallel lookup finished (count=%u)\n", rd_count); |
1371 | struct ParallelLookup *parallel_lookup = cls; | 1371 | struct ParallelLookup *parallel_lookup = cls; |
1372 | struct ExchangeHandle *handle = parallel_lookup->handle; | 1372 | struct ExchangeHandle *handle = parallel_lookup->handle; |
@@ -1385,7 +1385,7 @@ process_parallel_lookup (void *cls, uint32_t rd_count, | |||
1385 | rd->data_size, | 1385 | rd->data_size, |
1386 | handle->key, | 1386 | handle->key, |
1387 | (void**)&data); | 1387 | (void**)&data); |
1388 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Adding value: %s\n", data); | 1388 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding value: %s\n", data); |
1389 | token_add_attr (handle->token, | 1389 | token_add_attr (handle->token, |
1390 | parallel_lookup->label, | 1390 | parallel_lookup->label, |
1391 | data); | 1391 | data); |
@@ -1400,7 +1400,7 @@ process_parallel_lookup (void *cls, uint32_t rd_count, | |||
1400 | data = GNUNET_GNSRECORD_value_to_string (rd[i].record_type, | 1400 | data = GNUNET_GNSRECORD_value_to_string (rd[i].record_type, |
1401 | rd[i].data, | 1401 | rd[i].data, |
1402 | rd[i].data_size); | 1402 | rd[i].data_size); |
1403 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Adding value: %s\n", data); | 1403 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding value: %s\n", data); |
1404 | token_add_attr (handle->token, parallel_lookup->label, data); | 1404 | token_add_attr (handle->token, parallel_lookup->label, data); |
1405 | GNUNET_free (data); | 1405 | GNUNET_free (data); |
1406 | } | 1406 | } |
@@ -1485,7 +1485,7 @@ process_lookup_result (void *cls, uint32_t rd_count, | |||
1485 | size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); | 1485 | size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); |
1486 | 1486 | ||
1487 | scopes = GNUNET_strdup (buf); | 1487 | scopes = GNUNET_strdup (buf); |
1488 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 1488 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1489 | "Scopes %s\n", scopes); | 1489 | "Scopes %s\n", scopes); |
1490 | handle->key = GNUNET_CRYPTO_cpabe_deserialize_key ((void*)(buf + strlen (scopes) + 1), | 1490 | handle->key = GNUNET_CRYPTO_cpabe_deserialize_key ((void*)(buf + strlen (scopes) + 1), |
1491 | rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) | 1491 | rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) |
@@ -1496,7 +1496,7 @@ process_lookup_result (void *cls, uint32_t rd_count, | |||
1496 | GNUNET_asprintf (&lookup_query, | 1496 | GNUNET_asprintf (&lookup_query, |
1497 | "%s.gnu", | 1497 | "%s.gnu", |
1498 | scope); | 1498 | scope); |
1499 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 1499 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1500 | "Looking up %s\n", lookup_query); | 1500 | "Looking up %s\n", lookup_query); |
1501 | parallel_lookup = GNUNET_new (struct ParallelLookup); | 1501 | parallel_lookup = GNUNET_new (struct ParallelLookup); |
1502 | parallel_lookup->handle = handle; | 1502 | parallel_lookup->handle = handle; |
@@ -1776,9 +1776,19 @@ send_ticket_result (struct IdpClient *client, | |||
1776 | 1776 | ||
1777 | attrs_size = attribute_list_serialize_get_size (attrs); | 1777 | attrs_size = attribute_list_serialize_get_size (attrs); |
1778 | 1778 | ||
1779 | /* store ticket in DB */ | ||
1780 | if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls, | ||
1781 | ticket, | ||
1782 | attrs)) | ||
1783 | { | ||
1784 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1785 | "Unable to store ticket after issue\n"); | ||
1786 | GNUNET_break (0); | ||
1787 | } | ||
1788 | |||
1779 | env = GNUNET_MQ_msg_extra (irm, | 1789 | env = GNUNET_MQ_msg_extra (irm, |
1780 | sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket2) + attrs_size, | 1790 | sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket2) + attrs_size, |
1781 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT); | 1791 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT); |
1782 | ticket_buf = (struct GNUNET_IDENTITY_PROVIDER_Ticket2 *)&irm[1]; | 1792 | ticket_buf = (struct GNUNET_IDENTITY_PROVIDER_Ticket2 *)&irm[1]; |
1783 | *ticket_buf = *ticket; | 1793 | *ticket_buf = *ticket; |
1784 | attrs_buf = (char*)&ticket_buf[1]; | 1794 | attrs_buf = (char*)&ticket_buf[1]; |
@@ -1792,8 +1802,8 @@ send_ticket_result (struct IdpClient *client, | |||
1792 | 1802 | ||
1793 | static void | 1803 | static void |
1794 | store_ticket_issue_cont (void *cls, | 1804 | store_ticket_issue_cont (void *cls, |
1795 | int32_t success, | 1805 | int32_t success, |
1796 | const char *emsg) | 1806 | const char *emsg) |
1797 | { | 1807 | { |
1798 | struct TicketIssueHandle *handle = cls; | 1808 | struct TicketIssueHandle *handle = cls; |
1799 | 1809 | ||
@@ -1843,10 +1853,10 @@ serialize_abe_keyinfo2 (const struct TicketIssueHandle *handle, | |||
1843 | } | 1853 | } |
1844 | buf = GNUNET_malloc (attrs_str_len + size); | 1854 | buf = GNUNET_malloc (attrs_str_len + size); |
1845 | write_ptr = buf; | 1855 | write_ptr = buf; |
1846 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 1856 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1847 | "Writing attributes\n"); | 1857 | "Writing attributes\n"); |
1848 | for (le = handle->attrs->list_head; NULL != le; le = le->next) { | 1858 | for (le = handle->attrs->list_head; NULL != le; le = le->next) { |
1849 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 1859 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1850 | "%s\n", le->attribute->name); | 1860 | "%s\n", le->attribute->name); |
1851 | 1861 | ||
1852 | 1862 | ||
@@ -1943,6 +1953,7 @@ issue_ticket_after_abe_bootstrap (void *cls, | |||
1943 | ih); | 1953 | ih); |
1944 | GNUNET_free (ecdhe_privkey); | 1954 | GNUNET_free (ecdhe_privkey); |
1945 | GNUNET_free (label); | 1955 | GNUNET_free (label); |
1956 | GNUNET_free (attrs); | ||
1946 | GNUNET_free (code_record_data); | 1957 | GNUNET_free (code_record_data); |
1947 | } | 1958 | } |
1948 | 1959 | ||
@@ -2041,7 +2052,7 @@ static void | |||
2041 | process_parallel_lookup2 (void *cls, uint32_t rd_count, | 2052 | process_parallel_lookup2 (void *cls, uint32_t rd_count, |
2042 | const struct GNUNET_GNSRECORD_Data *rd) | 2053 | const struct GNUNET_GNSRECORD_Data *rd) |
2043 | { | 2054 | { |
2044 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 2055 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2045 | "Parallel lookup finished (count=%u)\n", rd_count); | 2056 | "Parallel lookup finished (count=%u)\n", rd_count); |
2046 | struct ParallelLookup2 *parallel_lookup = cls; | 2057 | struct ParallelLookup2 *parallel_lookup = cls; |
2047 | struct ConsumeTicketHandle *handle = parallel_lookup->handle; | 2058 | struct ConsumeTicketHandle *handle = parallel_lookup->handle; |
@@ -2056,6 +2067,7 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
2056 | GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head, | 2067 | GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head, |
2057 | handle->parallel_lookups_tail, | 2068 | handle->parallel_lookups_tail, |
2058 | parallel_lookup); | 2069 | parallel_lookup); |
2070 | GNUNET_free (parallel_lookup->label); | ||
2059 | GNUNET_free (parallel_lookup); | 2071 | GNUNET_free (parallel_lookup); |
2060 | if (1 != rd_count) | 2072 | if (1 != rd_count) |
2061 | GNUNET_break(0);//TODO | 2073 | GNUNET_break(0);//TODO |
@@ -2075,7 +2087,18 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
2075 | } | 2087 | } |
2076 | if (NULL != handle->parallel_lookups_head) | 2088 | if (NULL != handle->parallel_lookups_head) |
2077 | return; //Wait for more | 2089 | return; //Wait for more |
2078 | //Else we are done | 2090 | /* Else we are done */ |
2091 | |||
2092 | /* Store ticket in DB */ | ||
2093 | if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls, | ||
2094 | &handle->ticket, | ||
2095 | handle->attrs)) | ||
2096 | { | ||
2097 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
2098 | "Unable to store ticket after consume\n"); | ||
2099 | GNUNET_break (0); | ||
2100 | } | ||
2101 | |||
2079 | GNUNET_SCHEDULER_cancel (handle->kill_task); | 2102 | GNUNET_SCHEDULER_cancel (handle->kill_task); |
2080 | attrs_len = attribute_list_serialize_get_size (handle->attrs); | 2103 | attrs_len = attribute_list_serialize_get_size (handle->attrs); |
2081 | env = GNUNET_MQ_msg_extra (crm, | 2104 | env = GNUNET_MQ_msg_extra (crm, |
@@ -2177,7 +2200,7 @@ process_consume_abe_key (void *cls, uint32_t rd_count, | |||
2177 | size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); | 2200 | size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); |
2178 | 2201 | ||
2179 | scopes = GNUNET_strdup (buf); | 2202 | scopes = GNUNET_strdup (buf); |
2180 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 2203 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2181 | "Scopes %s\n", scopes); | 2204 | "Scopes %s\n", scopes); |
2182 | handle->key = GNUNET_CRYPTO_cpabe_deserialize_key ((void*)(buf + strlen (scopes) + 1), | 2205 | handle->key = GNUNET_CRYPTO_cpabe_deserialize_key ((void*)(buf + strlen (scopes) + 1), |
2183 | rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) | 2206 | rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) |
@@ -2188,7 +2211,7 @@ process_consume_abe_key (void *cls, uint32_t rd_count, | |||
2188 | GNUNET_asprintf (&lookup_query, | 2211 | GNUNET_asprintf (&lookup_query, |
2189 | "%s.gnu", | 2212 | "%s.gnu", |
2190 | scope); | 2213 | scope); |
2191 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 2214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2192 | "Looking up %s\n", lookup_query); | 2215 | "Looking up %s\n", lookup_query); |
2193 | parallel_lookup = GNUNET_new (struct ParallelLookup2); | 2216 | parallel_lookup = GNUNET_new (struct ParallelLookup2); |
2194 | parallel_lookup->handle = handle; | 2217 | parallel_lookup->handle = handle; |
@@ -2204,6 +2227,7 @@ process_consume_abe_key (void *cls, uint32_t rd_count, | |||
2204 | GNUNET_CONTAINER_DLL_insert (handle->parallel_lookups_head, | 2227 | GNUNET_CONTAINER_DLL_insert (handle->parallel_lookups_head, |
2205 | handle->parallel_lookups_tail, | 2228 | handle->parallel_lookups_tail, |
2206 | parallel_lookup); | 2229 | parallel_lookup); |
2230 | GNUNET_free (lookup_query); | ||
2207 | } | 2231 | } |
2208 | handle->kill_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES,3), | 2232 | handle->kill_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES,3), |
2209 | &abort_parallel_lookups2, | 2233 | &abort_parallel_lookups2, |
@@ -2241,7 +2265,7 @@ handle_consume_ticket_message (void *cls, | |||
2241 | GNUNET_asprintf (&lookup_query, | 2265 | GNUNET_asprintf (&lookup_query, |
2242 | "%s.gnu", | 2266 | "%s.gnu", |
2243 | rnd_label); | 2267 | rnd_label); |
2244 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 2268 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2245 | "Looking for ABE key under %s\n", lookup_query); | 2269 | "Looking for ABE key under %s\n", lookup_query); |
2246 | 2270 | ||
2247 | ch->lookup_request | 2271 | ch->lookup_request |
@@ -2252,6 +2276,7 @@ handle_consume_ticket_message (void *cls, | |||
2252 | GNUNET_GNS_LO_LOCAL_MASTER, | 2276 | GNUNET_GNS_LO_LOCAL_MASTER, |
2253 | &process_consume_abe_key, | 2277 | &process_consume_abe_key, |
2254 | ch); | 2278 | ch); |
2279 | GNUNET_free (rnd_label); | ||
2255 | GNUNET_free (lookup_query); | 2280 | GNUNET_free (lookup_query); |
2256 | GNUNET_SERVICE_client_continue (idp->client); | 2281 | GNUNET_SERVICE_client_continue (idp->client); |
2257 | } | 2282 | } |
diff --git a/src/identity-provider/identity_attribute.c b/src/identity-provider/identity_attribute.c index 1c5654946..b90a08e3e 100644 --- a/src/identity-provider/identity_attribute.c +++ b/src/identity-provider/identity_attribute.c | |||
@@ -114,7 +114,7 @@ attribute_list_deserialize (const char* data, | |||
114 | le = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry); | 114 | le = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry); |
115 | le->attribute = attribute_deserialize (read_ptr, | 115 | le->attribute = attribute_deserialize (read_ptr, |
116 | data_size - (read_ptr - data)); | 116 | data_size - (read_ptr - data)); |
117 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 117 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
118 | "Deserialized attribute %s\n", le->attribute->name); | 118 | "Deserialized attribute %s\n", le->attribute->name); |
119 | GNUNET_CONTAINER_DLL_insert (attrs->list_head, | 119 | GNUNET_CONTAINER_DLL_insert (attrs->list_head, |
120 | attrs->list_tail, | 120 | attrs->list_tail, |
diff --git a/src/identity-provider/identity_provider_api.c b/src/identity-provider/identity_provider_api.c index 6e0ce7b42..371dce86d 100644 --- a/src/identity-provider/identity_provider_api.c +++ b/src/identity-provider/identity_provider_api.c | |||
@@ -560,7 +560,7 @@ handle_consume_ticket_result (void *cls, | |||
560 | uint32_t r_id = ntohl (msg->id); | 560 | uint32_t r_id = ntohl (msg->id); |
561 | 561 | ||
562 | attrs_len = ntohs (msg->attrs_len); | 562 | attrs_len = ntohs (msg->attrs_len); |
563 | LOG (GNUNET_ERROR_TYPE_MESSAGE, | 563 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
564 | "Processing attribute result.\n"); | 564 | "Processing attribute result.\n"); |
565 | 565 | ||
566 | 566 | ||
@@ -641,7 +641,7 @@ handle_attribute_result (void *cls, | |||
641 | uint32_t r_id = ntohl (msg->id); | 641 | uint32_t r_id = ntohl (msg->id); |
642 | 642 | ||
643 | attr_len = ntohs (msg->attr_len); | 643 | attr_len = ntohs (msg->attr_len); |
644 | LOG (GNUNET_ERROR_TYPE_MESSAGE, | 644 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
645 | "Processing attribute result.\n"); | 645 | "Processing attribute result.\n"); |
646 | 646 | ||
647 | 647 | ||
diff --git a/src/identity-provider/test_idp_issue.sh b/src/identity-provider/test_idp_issue.sh index 38369a33e..f2f48057d 100755 --- a/src/identity-provider/test_idp_issue.sh +++ b/src/identity-provider/test_idp_issue.sh | |||
@@ -32,6 +32,6 @@ gnunet-idp -e testego -a email -V john@doe.gnu -c test_idp.conf | |||
32 | gnunet-idp -e testego -a name -V John -c test_idp.conf | 32 | gnunet-idp -e testego -a name -V John -c test_idp.conf |
33 | #gnunet-idp -e testego -D -c test_idp.conf | 33 | #gnunet-idp -e testego -D -c test_idp.conf |
34 | TICKET=$(gnunet-idp -e testego -i "email,name" -r $SUBJECT_KEY -c test_idp.conf | awk '{print $1}') | 34 | TICKET=$(gnunet-idp -e testego -i "email,name" -r $SUBJECT_KEY -c test_idp.conf | awk '{print $1}') |
35 | echo "Consuming $TICKET" | 35 | #echo "Consuming $TICKET" |
36 | gnunet-idp -e rpego -C $TICKET -c test_idp.conf | 36 | gnunet-idp -e rpego -C $TICKET -c test_idp.conf |
37 | gnunet-arm -e -c test_idp.conf | 37 | gnunet-arm -e -c test_idp.conf |