aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2017-10-07 10:55:04 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2017-10-07 10:55:04 +0200
commitbada12fb79c54aa1151e86b0284e8b6f38fd020c (patch)
treede72cf63a49ad69e5f7685751cd328f1de4c1a32 /src
parentfd111326e7c91616593ff361bdad61deea337aa9 (diff)
downloadgnunet-bada12fb79c54aa1151e86b0284e8b6f38fd020c.tar.gz
gnunet-bada12fb79c54aa1151e86b0284e8b6f38fd020c.zip
-fixes
Diffstat (limited to 'src')
-rw-r--r--src/identity-provider/gnunet-service-identity-provider.c107
1 files changed, 62 insertions, 45 deletions
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c
index 62955b5da..b4cf154b4 100644
--- a/src/identity-provider/gnunet-service-identity-provider.c
+++ b/src/identity-provider/gnunet-service-identity-provider.c
@@ -1037,6 +1037,51 @@ handle_issue_ticket_message (void *cls,
1037 1037
1038} 1038}
1039 1039
1040/**********************************************************
1041 * Revocation
1042 **********************************************************/
1043
1044/**
1045 * Cleanup revoke handle
1046 */
1047static void
1048cleanup_revoke_ticket_handle (struct TicketRevocationHandle *handle)
1049{
1050 if (NULL != handle->attrs)
1051 attribute_list_destroy (handle->attrs);
1052 if (NULL != handle->abe_key)
1053 GNUNET_free (handle->abe_key);
1054 if (NULL != handle->ns_qe)
1055 GNUNET_NAMESTORE_cancel (handle->ns_qe);
1056 if (NULL != handle->ns_it)
1057 GNUNET_NAMESTORE_zone_iteration_stop (handle->ns_it);
1058 GNUNET_free (handle);
1059}
1060
1061
1062/**
1063 * Send revocation result
1064 */
1065static void
1066send_revocation_finished (struct TicketRevocationHandle *rh,
1067 uint32_t success)
1068{
1069 struct GNUNET_MQ_Envelope *env;
1070 struct RevokeTicketResultMessage *trm;
1071
1072 env = GNUNET_MQ_msg (trm,
1073 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET_RESULT);
1074 trm->id = htonl (rh->r_id);
1075 trm->success = htonl (success);
1076 GNUNET_MQ_send (rh->client->mq,
1077 env);
1078 GNUNET_CONTAINER_DLL_remove (rh->client->revocation_list_head,
1079 rh->client->revocation_list_tail,
1080 rh);
1081 cleanup_revoke_ticket_handle (rh);
1082}
1083
1084
1040/** 1085/**
1041 * Process ticket from database 1086 * Process ticket from database
1042 * 1087 *
@@ -1060,10 +1105,10 @@ reissue_ticket_cont (void *cls,
1060 rh->ns_qe = NULL; 1105 rh->ns_qe = NULL;
1061 if (GNUNET_SYSERR == success) 1106 if (GNUNET_SYSERR == success)
1062 { 1107 {
1063 //TODO cleanup_ticket_revocation_handle (handle);
1064 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", 1108 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n",
1065 "Unknown Error\n"); 1109 "Unknown Error\n");
1066 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 1110 send_revocation_finished (rh, GNUNET_SYSERR);
1111 cleanup_revoke_ticket_handle (rh);
1067 return; 1112 return;
1068 } 1113 }
1069 rh->offset++; 1114 rh->offset++;
@@ -1091,6 +1136,7 @@ ticket_reissue_proc (void *cls,
1091 const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs) 1136 const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs)
1092{ 1137{
1093 struct TicketRevocationHandle *rh = cls; 1138 struct TicketRevocationHandle *rh = cls;
1139 const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs_to_reissue;
1094 struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; 1140 struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le;
1095 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; 1141 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
1096 struct GNUNET_GNSRECORD_Data code_record[1]; 1142 struct GNUNET_GNSRECORD_Data code_record[1];
@@ -1107,17 +1153,25 @@ ticket_reissue_proc (void *cls,
1107 { 1153 {
1108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1154 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1109 "Iteration done\n"); 1155 "Iteration done\n");
1110 /* Send reply ? */ 1156 send_revocation_finished (rh, GNUNET_OK);
1111 GNUNET_break (0); 1157 cleanup_revoke_ticket_handle (rh);
1112 return; 1158 return;
1113 } 1159 }
1114 //Create new ABE key for RP 1160 //Create new ABE key for RP
1115 attrs_len = 0; 1161 attrs_len = 0;
1116 for (le = attrs->list_head; NULL != le; le = le->next) 1162 attrs_to_reissue = attrs;
1163
1164 /* If this is the RP we want to revoke attributes of, the do so */
1165 if (0 == memcmp (&ticket->audience,
1166 &rh->ticket.audience,
1167 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
1168 attrs_to_reissue = rh->attrs;
1169
1170 for (le = attrs_to_reissue->list_head; NULL != le; le = le->next)
1117 attrs_len++; 1171 attrs_len++;
1118 attr_arr = GNUNET_malloc ((attrs_len + 1)*sizeof (char*)); 1172 attr_arr = GNUNET_malloc ((attrs_len + 1)*sizeof (char*));
1119 i = 0; 1173 i = 0;
1120 for (le = attrs->list_head; NULL != le; le = le->next) { 1174 for (le = attrs_to_reissue->list_head; NULL != le; le = le->next) {
1121 attr_arr[i] = (char*) le->attribute->name; 1175 attr_arr[i] = (char*) le->attribute->name;
1122 i++; 1176 i++;
1123 } 1177 }
@@ -1155,46 +1209,7 @@ ticket_reissue_proc (void *cls,
1155} 1209}
1156 1210
1157 1211
1158/**********************************************************
1159 * Revocation
1160 **********************************************************/
1161 1212
1162/**
1163 * Cleanup revoke handle
1164 */
1165static void
1166cleanup_revoke_ticket_handle (struct TicketRevocationHandle *handle)
1167{
1168 if (NULL != handle->attrs)
1169 attribute_list_destroy (handle->attrs);
1170 if (NULL != handle->abe_key)
1171 GNUNET_free (handle->abe_key);
1172 if (NULL != handle->ns_qe)
1173 GNUNET_NAMESTORE_cancel (handle->ns_qe);
1174 GNUNET_free (handle);
1175}
1176
1177/**
1178 * Send revocation result
1179 */
1180static void
1181send_revocation_finished (struct TicketRevocationHandle *rh,
1182 uint32_t success)
1183{
1184 struct GNUNET_MQ_Envelope *env;
1185 struct RevokeTicketResultMessage *trm;
1186
1187 env = GNUNET_MQ_msg (trm,
1188 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET_RESULT);
1189 trm->id = htonl (rh->r_id);
1190 trm->success = htonl (success);
1191 GNUNET_MQ_send (rh->client->mq,
1192 env);
1193 GNUNET_CONTAINER_DLL_remove (rh->client->revocation_list_head,
1194 rh->client->revocation_list_tail,
1195 rh);
1196 cleanup_revoke_ticket_handle (rh);
1197}
1198 1213
1199/* Prototype for below function */ 1214/* Prototype for below function */
1200static void 1215static void
@@ -1329,6 +1344,7 @@ revoke_collect_iter_error (void *cls)
1329 1344
1330 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1345 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1331 "Failed to iterate over attributes\n"); 1346 "Failed to iterate over attributes\n");
1347 rh->ns_it = NULL;
1332 send_revocation_finished (rh, GNUNET_SYSERR); 1348 send_revocation_finished (rh, GNUNET_SYSERR);
1333 cleanup_revoke_ticket_handle (rh); 1349 cleanup_revoke_ticket_handle (rh);
1334} 1350}
@@ -1340,6 +1356,7 @@ static void
1340revoke_collect_iter_finished (void *cls) 1356revoke_collect_iter_finished (void *cls)
1341{ 1357{
1342 struct TicketRevocationHandle *rh = cls; 1358 struct TicketRevocationHandle *rh = cls;
1359 rh->ns_it = NULL;
1343 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 1360 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
1344 "Revocation Phase II: Invalidating old ABE Master\n"); 1361 "Revocation Phase II: Invalidating old ABE Master\n");
1345 /* Bootstrap new abe key */ 1362 /* Bootstrap new abe key */