aboutsummaryrefslogtreecommitdiff
path: root/src/identity-provider/gnunet-service-identity-provider.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/identity-provider/gnunet-service-identity-provider.c')
-rw-r--r--src/identity-provider/gnunet-service-identity-provider.c147
1 files changed, 26 insertions, 121 deletions
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c
index 351308c3a..4e1de36cd 100644
--- a/src/identity-provider/gnunet-service-identity-provider.c
+++ b/src/identity-provider/gnunet-service-identity-provider.c
@@ -637,10 +637,8 @@ cleanup()
637 GNUNET_NAMESTORE_disconnect (ns_handle); 637 GNUNET_NAMESTORE_disconnect (ns_handle);
638 if (NULL != stats_handle) 638 if (NULL != stats_handle)
639 GNUNET_STATISTICS_destroy (stats_handle, GNUNET_NO); 639 GNUNET_STATISTICS_destroy (stats_handle, GNUNET_NO);
640 if (NULL != token) 640 GNUNET_free_non_null (token);
641 GNUNET_free (token); 641 GNUNET_free_non_null (label);
642 if (NULL != label)
643 GNUNET_free (label);
644 642
645} 643}
646 644
@@ -648,7 +646,6 @@ cleanup()
648 * Shutdown task 646 * Shutdown task
649 * 647 *
650 * @param cls NULL 648 * @param cls NULL
651 * @param tc task context
652 */ 649 */
653static void 650static void
654do_shutdown (void *cls) 651do_shutdown (void *cls)
@@ -732,9 +729,8 @@ bootstrap_abe_result (void *cls,
732{ 729{
733 struct AbeBootstrapHandle *abh = cls; 730 struct AbeBootstrapHandle *abh = cls;
734 struct GNUNET_ABE_AbeMasterKey *abe_key; 731 struct GNUNET_ABE_AbeMasterKey *abe_key;
735 int i;
736 732
737 for (i=0;i<rd_count;i++) { 733 for (uint32_t i=0;i<rd_count;i++) {
738 if (GNUNET_GNSRECORD_TYPE_ABE_MASTER != rd[i].record_type) 734 if (GNUNET_GNSRECORD_TYPE_ABE_MASTER != rd[i].record_type)
739 continue; 735 continue;
740 abe_key = GNUNET_ABE_cpabe_deserialize_master_key (rd[i].data, 736 abe_key = GNUNET_ABE_cpabe_deserialize_master_key (rd[i].data,
@@ -964,7 +960,7 @@ issue_ticket_after_abe_bootstrap (void *cls,
964 char *label; 960 char *label;
965 char *policy; 961 char *policy;
966 int attrs_len; 962 int attrs_len;
967 int i; 963 uint32_t i;
968 size_t code_record_len; 964 size_t code_record_len;
969 965
970 //Create new ABE key for RP 966 //Create new ABE key for RP
@@ -1021,13 +1017,6 @@ issue_ticket_after_abe_bootstrap (void *cls,
1021} 1017}
1022 1018
1023 1019
1024/**
1025 * Checks a ticket issue message
1026 *
1027 * @param cls client sending the message
1028 * @param im message of type `struct TicketIssueMessage`
1029 * @return #GNUNET_OK if @a im is well-formed
1030 */
1031static int 1020static int
1032check_issue_ticket_message(void *cls, 1021check_issue_ticket_message(void *cls,
1033 const struct IssueTicketMessage *im) 1022 const struct IssueTicketMessage *im)
@@ -1044,14 +1033,6 @@ check_issue_ticket_message(void *cls,
1044} 1033}
1045 1034
1046 1035
1047/**
1048 *
1049 * Handler for ticket issue message
1050 *
1051 * @param cls unused
1052 * @param client who sent the message
1053 * @param message the message
1054 */
1055static void 1036static void
1056handle_issue_ticket_message (void *cls, 1037handle_issue_ticket_message (void *cls,
1057 const struct IssueTicketMessage *im) 1038 const struct IssueTicketMessage *im)
@@ -1083,26 +1064,31 @@ handle_issue_ticket_message (void *cls,
1083 1064
1084/** 1065/**
1085 * Cleanup revoke handle 1066 * Cleanup revoke handle
1067 *
1068 * @param rh the ticket revocation handle
1086 */ 1069 */
1087static void 1070static void
1088cleanup_revoke_ticket_handle (struct TicketRevocationHandle *handle) 1071cleanup_revoke_ticket_handle (struct TicketRevocationHandle *rh)
1089{ 1072{
1090 if (NULL != handle->attrs) 1073 if (NULL != rh->attrs)
1091 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->attrs); 1074 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (rh->attrs);
1092 if (NULL != handle->rvk_attrs) 1075 if (NULL != rh->rvk_attrs)
1093 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->rvk_attrs); 1076 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (rh->rvk_attrs);
1094 if (NULL != handle->abe_key) 1077 if (NULL != rh->abe_key)
1095 GNUNET_ABE_cpabe_delete_master_key (handle->abe_key); 1078 GNUNET_ABE_cpabe_delete_master_key (rh->abe_key);
1096 if (NULL != handle->ns_qe) 1079 if (NULL != rh->ns_qe)
1097 GNUNET_NAMESTORE_cancel (handle->ns_qe); 1080 GNUNET_NAMESTORE_cancel (rh->ns_qe);
1098 if (NULL != handle->ns_it) 1081 if (NULL != rh->ns_it)
1099 GNUNET_NAMESTORE_zone_iteration_stop (handle->ns_it); 1082 GNUNET_NAMESTORE_zone_iteration_stop (rh->ns_it);
1100 GNUNET_free (handle); 1083 GNUNET_free (rh);
1101} 1084}
1102 1085
1103 1086
1104/** 1087/**
1105 * Send revocation result 1088 * Send revocation result
1089 *
1090 * @param rh ticket revocation handle
1091 * @param success GNUNET_OK if successful result
1106 */ 1092 */
1107static void 1093static void
1108send_revocation_finished (struct TicketRevocationHandle *rh, 1094send_revocation_finished (struct TicketRevocationHandle *rh,
@@ -1190,7 +1176,7 @@ ticket_reissue_proc (void *cls,
1190 char *label; 1176 char *label;
1191 char *policy; 1177 char *policy;
1192 int attrs_len; 1178 int attrs_len;
1193 int i; 1179 uint32_t i;
1194 int reissue_ticket; 1180 int reissue_ticket;
1195 size_t code_record_len; 1181 size_t code_record_len;
1196 1182
@@ -1476,13 +1462,6 @@ get_ticket_after_abe_bootstrap (void *cls,
1476 rh); 1462 rh);
1477} 1463}
1478 1464
1479/**
1480 * Checks a ticket revocation message
1481 *
1482 * @param cls client sending the message
1483 * @param im message of type `struct RevokeTicketMessage`
1484 * @return #GNUNET_OK if @a im is well-formed
1485 */
1486static int 1465static int
1487check_revoke_ticket_message(void *cls, 1466check_revoke_ticket_message(void *cls,
1488 const struct RevokeTicketMessage *im) 1467 const struct RevokeTicketMessage *im)
@@ -1497,14 +1476,7 @@ check_revoke_ticket_message(void *cls,
1497 } 1476 }
1498 return GNUNET_OK; 1477 return GNUNET_OK;
1499} 1478}
1500/** 1479
1501 *
1502 * Handler for ticket revocation message
1503 *
1504 * @param cls unused
1505 * @param client who sent the message
1506 * @param message the message
1507 */
1508static void 1480static void
1509handle_revoke_ticket_message (void *cls, 1481handle_revoke_ticket_message (void *cls,
1510 const struct RevokeTicketMessage *rm) 1482 const struct RevokeTicketMessage *rm)
@@ -1544,13 +1516,6 @@ cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle)
1544 1516
1545 1517
1546 1518
1547/**
1548 * Checks a ticket consume message
1549 *
1550 * @param cls client sending the message
1551 * @param im message of type `struct ConsumeTicketMessage`
1552 * @return #GNUNET_OK if @a im is well-formed
1553 */
1554static int 1519static int
1555check_consume_ticket_message(void *cls, 1520check_consume_ticket_message(void *cls,
1556 const struct ConsumeTicketMessage *cm) 1521 const struct ConsumeTicketMessage *cm)
@@ -1782,14 +1747,6 @@ process_consume_abe_key (void *cls, uint32_t rd_count,
1782} 1747}
1783 1748
1784 1749
1785/**
1786 *
1787 * Handler for ticket issue message
1788 *
1789 * @param cls unused
1790 * @param client who sent the message
1791 * @param message the message
1792 */
1793static void 1750static void
1794handle_consume_ticket_message (void *cls, 1751handle_consume_ticket_message (void *cls,
1795 const struct ConsumeTicketMessage *cm) 1752 const struct ConsumeTicketMessage *cm)
@@ -1941,13 +1898,6 @@ store_after_abe_bootstrap (void *cls,
1941 GNUNET_SCHEDULER_add_now (&attr_store_task, ash); 1898 GNUNET_SCHEDULER_add_now (&attr_store_task, ash);
1942} 1899}
1943 1900
1944/**
1945 * Checks a store message
1946 *
1947 * @param cls client sending the message
1948 * @param sam message of type `struct AttributeStoreMessage`
1949 * @return #GNUNET_OK if @a im is well-formed
1950 */
1951static int 1901static int
1952check_attribute_store_message(void *cls, 1902check_attribute_store_message(void *cls,
1953 const struct AttributeStoreMessage *sam) 1903 const struct AttributeStoreMessage *sam)
@@ -1964,14 +1914,6 @@ check_attribute_store_message(void *cls,
1964} 1914}
1965 1915
1966 1916
1967/**
1968 *
1969 * Handler for store message
1970 *
1971 * @param cls unused
1972 * @param client who sent the message
1973 * @param message the message
1974 */
1975static void 1917static void
1976handle_attribute_store_message (void *cls, 1918handle_attribute_store_message (void *cls,
1977 const struct AttributeStoreMessage *sam) 1919 const struct AttributeStoreMessage *sam)
@@ -2125,12 +2067,6 @@ iterate_next_after_abe_bootstrap (void *cls,
2125 2067
2126 2068
2127 2069
2128/**
2129 * Handles a #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ITERATION_START message
2130 *
2131 * @param cls the client sending the message
2132 * @param zis_msg message from the client
2133 */
2134static void 2070static void
2135handle_iteration_start (void *cls, 2071handle_iteration_start (void *cls,
2136 const struct AttributeIterationStartMessage *ais_msg) 2072 const struct AttributeIterationStartMessage *ais_msg)
@@ -2153,12 +2089,6 @@ handle_iteration_start (void *cls,
2153} 2089}
2154 2090
2155 2091
2156/**
2157 * Handles a #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ITERATION_STOP message
2158 *
2159 * @param cls the client sending the message
2160 * @param ais_msg message from the client
2161 */
2162static void 2092static void
2163handle_iteration_stop (void *cls, 2093handle_iteration_stop (void *cls,
2164 const struct AttributeIterationStopMessage *ais_msg) 2094 const struct AttributeIterationStopMessage *ais_msg)
@@ -2188,12 +2118,6 @@ handle_iteration_stop (void *cls,
2188} 2118}
2189 2119
2190 2120
2191/**
2192 * Handles a #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_NEXT message
2193 *
2194 * @param cls the client sending the message
2195 * @param message message from the client
2196 */
2197static void 2121static void
2198handle_iteration_next (void *cls, 2122handle_iteration_next (void *cls,
2199 const struct AttributeIterationNextMessage *ais_msg) 2123 const struct AttributeIterationNextMessage *ais_msg)
@@ -2351,12 +2275,6 @@ run_ticket_iteration_round (struct TicketIteration *ti)
2351 cleanup_ticket_iter_handle (ti); 2275 cleanup_ticket_iter_handle (ti);
2352} 2276}
2353 2277
2354/**
2355 * Handles a #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_START message
2356 *
2357 * @param cls the client sending the message
2358 * @param tis_msg message from the client
2359 */
2360static void 2278static void
2361handle_ticket_iteration_start (void *cls, 2279handle_ticket_iteration_start (void *cls,
2362 const struct TicketIterationStartMessage *tis_msg) 2280 const struct TicketIterationStartMessage *tis_msg)
@@ -2381,12 +2299,6 @@ handle_ticket_iteration_start (void *cls,
2381} 2299}
2382 2300
2383 2301
2384/**
2385 * Handles a #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_STOP message
2386 *
2387 * @param cls the client sending the message
2388 * @param tis_msg message from the client
2389 */
2390static void 2302static void
2391handle_ticket_iteration_stop (void *cls, 2303handle_ticket_iteration_stop (void *cls,
2392 const struct TicketIterationStopMessage *tis_msg) 2304 const struct TicketIterationStopMessage *tis_msg)
@@ -2416,12 +2328,6 @@ handle_ticket_iteration_stop (void *cls,
2416} 2328}
2417 2329
2418 2330
2419/**
2420 * Handles a #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_NEXT message
2421 *
2422 * @param cls the client sending the message
2423 * @param message message from the client
2424 */
2425static void 2331static void
2426handle_ticket_iteration_next (void *cls, 2332handle_ticket_iteration_next (void *cls,
2427 const struct TicketIterationNextMessage *tis_msg) 2333 const struct TicketIterationNextMessage *tis_msg)
@@ -2453,9 +2359,8 @@ handle_ticket_iteration_next (void *cls,
2453 * Main function that will be run 2359 * Main function that will be run
2454 * 2360 *
2455 * @param cls closure 2361 * @param cls closure
2456 * @param args remaining command-line arguments 2362 * @param c the configuration used
2457 * @param cfgfile name of the configuration file used (for saving, can be NULL) 2363 * @param server the service handle
2458 * @param c configuration
2459 */ 2364 */
2460static void 2365static void
2461run (void *cls, 2366run (void *cls,