aboutsummaryrefslogtreecommitdiff
path: root/src/identity-provider
diff options
context:
space:
mode:
authorSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>2018-01-08 07:58:33 +0100
committerSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>2018-01-08 07:58:33 +0100
commit7ad94d1427d304483e9bf1cf1d12065f8e41d712 (patch)
tree573016db50a53b71487101245ffcaf38aab5a92a /src/identity-provider
parentcc5bb40d158b207c384ae98c868573771735f10a (diff)
downloadgnunet-7ad94d1427d304483e9bf1cf1d12065f8e41d712.tar.gz
gnunet-7ad94d1427d304483e9bf1cf1d12065f8e41d712.zip
bugfixes
Diffstat (limited to 'src/identity-provider')
-rw-r--r--src/identity-provider/gnunet-idp.c5
-rw-r--r--src/identity-provider/gnunet-service-identity-provider.c65
-rw-r--r--src/identity-provider/identity_provider_api.c21
3 files changed, 59 insertions, 32 deletions
diff --git a/src/identity-provider/gnunet-idp.c b/src/identity-provider/gnunet-idp.c
index 62f07842b..995dd5775 100644
--- a/src/identity-provider/gnunet-idp.c
+++ b/src/identity-provider/gnunet-idp.c
@@ -432,8 +432,7 @@ main(int argc, char *const argv[])
432 &type_str), 432 &type_str),
433 GNUNET_GETOPT_OPTION_END 433 GNUNET_GETOPT_OPTION_END
434 }; 434 };
435 GNUNET_PROGRAM_run (argc, argv, "ct", 435 return (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "ct",
436 "ct", options, 436 "ct", options,
437 &run, NULL); 437 &run, NULL));
438 return ret;
439} 438}
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c
index 711ae76ce..265719d58 100644
--- a/src/identity-provider/gnunet-service-identity-provider.c
+++ b/src/identity-provider/gnunet-service-identity-provider.c
@@ -704,7 +704,6 @@ static void
704bootstrap_abe_error (void *cls) 704bootstrap_abe_error (void *cls)
705{ 705{
706 struct AbeBootstrapHandle *abh = cls; 706 struct AbeBootstrapHandle *abh = cls;
707 GNUNET_free (abh);
708 abh->proc (abh->proc_cls, NULL); 707 abh->proc (abh->proc_cls, NULL);
709 GNUNET_free (abh); 708 GNUNET_free (abh);
710} 709}
@@ -1348,7 +1347,18 @@ reenc_next_attribute (struct TicketRevocationHandle *rh)
1348 rh->abe_key, 1347 rh->abe_key,
1349 (void**)&enc_buf); 1348 (void**)&enc_buf);
1350 GNUNET_free (buf); 1349 GNUNET_free (buf);
1350 if (GNUNET_SYSERR == enc_size)
1351 {
1352 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1353 "Unable to re-encrypt with policy %s\n",
1354 policy);
1355 GNUNET_free (policy);
1356 send_revocation_finished (rh, GNUNET_SYSERR);
1357 cleanup_revoke_ticket_handle (rh);
1358 return;
1359 }
1351 GNUNET_free (policy); 1360 GNUNET_free (policy);
1361
1352 rd[0].data_size = enc_size + sizeof (uint32_t); 1362 rd[0].data_size = enc_size + sizeof (uint32_t);
1353 rd_buf = GNUNET_malloc (rd[0].data_size); 1363 rd_buf = GNUNET_malloc (rd[0].data_size);
1354 attr_ver = htonl (rh->attrs->list_head->claim->version); 1364 attr_ver = htonl (rh->attrs->list_head->claim->version);
@@ -1501,7 +1511,7 @@ cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle)
1501{ 1511{
1502 if (NULL != handle->key) 1512 if (NULL != handle->key)
1503 GNUNET_ABE_cpabe_delete_key (handle->key, 1513 GNUNET_ABE_cpabe_delete_key (handle->key,
1504 GNUNET_YES); 1514 GNUNET_YES);
1505 if (NULL != handle->attrs) 1515 if (NULL != handle->attrs)
1506 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->attrs); 1516 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->attrs);
1507 GNUNET_free (handle); 1517 GNUNET_free (handle);
@@ -1563,9 +1573,9 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
1563 { 1573 {
1564 decrypt_duration = GNUNET_TIME_absolute_get (); 1574 decrypt_duration = GNUNET_TIME_absolute_get ();
1565 attr_len = GNUNET_ABE_cpabe_decrypt (rd->data + sizeof (uint32_t), 1575 attr_len = GNUNET_ABE_cpabe_decrypt (rd->data + sizeof (uint32_t),
1566 rd->data_size - sizeof (uint32_t), 1576 rd->data_size - sizeof (uint32_t),
1567 handle->key, 1577 handle->key,
1568 (void**)&data); 1578 (void**)&data);
1569 if (GNUNET_SYSERR != attr_len) 1579 if (GNUNET_SYSERR != attr_len)
1570 { 1580 {
1571 GNUNET_STATISTICS_update (stats, 1581 GNUNET_STATISTICS_update (stats,
@@ -1579,7 +1589,7 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
1579 1589
1580 attr_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); 1590 attr_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry);
1581 attr_le->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize (data, 1591 attr_le->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize (data,
1582 attr_len); 1592 attr_len);
1583 attr_le->claim->version = ntohl(*(uint32_t*)rd->data); 1593 attr_le->claim->version = ntohl(*(uint32_t*)rd->data);
1584 GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head, 1594 GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head,
1585 handle->attrs->list_tail, 1595 handle->attrs->list_tail,
@@ -1611,7 +1621,7 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
1611 crm->identity = handle->ticket.identity; 1621 crm->identity = handle->ticket.identity;
1612 data_tmp = (char *) &crm[1]; 1622 data_tmp = (char *) &crm[1];
1613 GNUNET_IDENTITY_ATTRIBUTE_list_serialize (handle->attrs, 1623 GNUNET_IDENTITY_ATTRIBUTE_list_serialize (handle->attrs,
1614 data_tmp); 1624 data_tmp);
1615 GNUNET_MQ_send (handle->client->mq, env); 1625 GNUNET_MQ_send (handle->client->mq, env);
1616 cleanup_consume_ticket_handle (handle); 1626 cleanup_consume_ticket_handle (handle);
1617} 1627}
@@ -1705,8 +1715,8 @@ process_consume_abe_key (void *cls, uint32_t rd_count,
1705 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1715 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1706 "Scopes %s\n", scopes); 1716 "Scopes %s\n", scopes);
1707 handle->key = GNUNET_ABE_cpabe_deserialize_key ((void*)(buf + strlen (scopes) + 1), 1717 handle->key = GNUNET_ABE_cpabe_deserialize_key ((void*)(buf + strlen (scopes) + 1),
1708 rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) 1718 rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)
1709 - strlen (scopes) - 1); 1719 - strlen (scopes) - 1);
1710 1720
1711 for (scope = strtok (scopes, ","); NULL != scope; scope = strtok (NULL, ",")) 1721 for (scope = strtok (scopes, ","); NULL != scope; scope = strtok (NULL, ","))
1712 { 1722 {
@@ -1837,7 +1847,7 @@ attr_store_task (void *cls)
1837 buf = GNUNET_malloc (buf_size); 1847 buf = GNUNET_malloc (buf_size);
1838 1848
1839 GNUNET_IDENTITY_ATTRIBUTE_serialize (as_handle->claim, 1849 GNUNET_IDENTITY_ATTRIBUTE_serialize (as_handle->claim,
1840 buf); 1850 buf);
1841 1851
1842 GNUNET_asprintf (&policy, 1852 GNUNET_asprintf (&policy,
1843 "%s_%lu", 1853 "%s_%lu",
@@ -1849,10 +1859,21 @@ attr_store_task (void *cls)
1849 * Encrypt the attribute value and store in namestore 1859 * Encrypt the attribute value and store in namestore
1850 */ 1860 */
1851 enc_size = GNUNET_ABE_cpabe_encrypt (buf, 1861 enc_size = GNUNET_ABE_cpabe_encrypt (buf,
1852 buf_size, 1862 buf_size,
1853 policy, //Policy 1863 policy, //Policy
1854 as_handle->abe_key, 1864 as_handle->abe_key,
1855 (void**)&enc_buf); 1865 (void**)&enc_buf);
1866 if (GNUNET_SYSERR == enc_size)
1867 {
1868 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1869 "Failed to encrypt with policy %s\n",
1870 policy);
1871 cleanup_as_handle (as_handle);
1872 GNUNET_free (buf);
1873 GNUNET_free (policy);
1874 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
1875 return;
1876 }
1856 GNUNET_free (buf); 1877 GNUNET_free (buf);
1857 GNUNET_free (policy); 1878 GNUNET_free (policy);
1858 rd[0].data_size = enc_size + sizeof (uint32_t); 1879 rd[0].data_size = enc_size + sizeof (uint32_t);
@@ -1921,7 +1942,7 @@ handle_attribute_store_message (void *cls,
1921 1942
1922 as_handle = GNUNET_new (struct AttributeStoreHandle); 1943 as_handle = GNUNET_new (struct AttributeStoreHandle);
1923 as_handle->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize ((char*)&sam[1], 1944 as_handle->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize ((char*)&sam[1],
1924 data_len); 1945 data_len);
1925 1946
1926 as_handle->r_id = ntohl (sam->id); 1947 as_handle->r_id = ntohl (sam->id);
1927 as_handle->identity = sam->identity; 1948 as_handle->identity = sam->identity;
@@ -2004,14 +2025,18 @@ attr_iter_cb (void *cls,
2004 attrs[0] = policy; 2025 attrs[0] = policy;
2005 attrs[1] = 0; 2026 attrs[1] = 0;
2006 key = GNUNET_ABE_cpabe_create_key (ai->abe_key, 2027 key = GNUNET_ABE_cpabe_create_key (ai->abe_key,
2007 attrs); 2028 attrs);
2008 msg_extra_len = GNUNET_ABE_cpabe_decrypt (rd->data+sizeof (uint32_t), 2029 msg_extra_len = GNUNET_ABE_cpabe_decrypt (rd->data+sizeof (uint32_t),
2009 rd->data_size-sizeof (uint32_t), 2030 rd->data_size-sizeof (uint32_t),
2010 key, 2031 key,
2011 (void**)&attr_ser); 2032 (void**)&attr_ser);
2033 if (GNUNET_SYSERR == msg_extra_len) {
2034 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it);
2035 return;
2036 }
2012 2037
2013 GNUNET_ABE_cpabe_delete_key (key, 2038 GNUNET_ABE_cpabe_delete_key (key,
2014 GNUNET_YES); 2039 GNUNET_YES);
2015 //GNUNET_free (policy); 2040 //GNUNET_free (policy);
2016 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2041 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2017 "Found attribute: %s\n", label); 2042 "Found attribute: %s\n", label);
diff --git a/src/identity-provider/identity_provider_api.c b/src/identity-provider/identity_provider_api.c
index d0ece80fe..38c11841c 100644
--- a/src/identity-provider/identity_provider_api.c
+++ b/src/identity-provider/identity_provider_api.c
@@ -514,13 +514,16 @@ handle_consume_ticket_result (void *cls,
514 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (attrs); 514 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (attrs);
515 } 515 }
516 } 516 }
517 op->ar_cb (op->cls, 517 if (NULL != op)
518 NULL, 518 {
519 NULL); 519 op->ar_cb (op->cls,
520 GNUNET_CONTAINER_DLL_remove (h->op_head, 520 NULL,
521 h->op_tail, 521 NULL);
522 op); 522 GNUNET_CONTAINER_DLL_remove (h->op_head,
523 GNUNET_free (op); 523 h->op_tail,
524 op);
525 GNUNET_free (op);
526 }
524 return; 527 return;
525 } 528 }
526 GNUNET_assert (0); 529 GNUNET_assert (0);
@@ -926,7 +929,7 @@ GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle
926 sam->id = htonl (op->r_id); 929 sam->id = htonl (op->r_id);
927 930
928 GNUNET_IDENTITY_ATTRIBUTE_serialize (attr, 931 GNUNET_IDENTITY_ATTRIBUTE_serialize (attr,
929 (char*)&sam[1]); 932 (char*)&sam[1]);
930 933
931 sam->attr_len = htons (attr_len); 934 sam->attr_len = htons (attr_len);
932 if (NULL != h->mq) 935 if (NULL != h->mq)
@@ -1093,7 +1096,7 @@ GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *h
1093 tim->id = htonl (op->r_id); 1096 tim->id = htonl (op->r_id);
1094 1097
1095 GNUNET_IDENTITY_ATTRIBUTE_list_serialize (attrs, 1098 GNUNET_IDENTITY_ATTRIBUTE_list_serialize (attrs,
1096 (char*)&tim[1]); 1099 (char*)&tim[1]);
1097 1100
1098 tim->attr_len = htons (attr_len); 1101 tim->attr_len = htons (attr_len);
1099 if (NULL != h->mq) 1102 if (NULL != h->mq)