diff options
Diffstat (limited to 'src/namestore/gnunet-service-namestore.c')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index e67ffaa65..250e2b812 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -1137,31 +1137,34 @@ handle_record_remove_it (void *cls, | |||
1137 | rrc->op_res = 0; | 1137 | rrc->op_res = 0; |
1138 | } | 1138 | } |
1139 | 1139 | ||
1140 | static void handle_record_remove (void *cls, | 1140 | |
1141 | struct GNUNET_SERVER_Client * client, | 1141 | static void |
1142 | const struct GNUNET_MessageHeader * message) | 1142 | handle_record_remove (void *cls, |
1143 | struct GNUNET_SERVER_Client * client, | ||
1144 | const struct GNUNET_MessageHeader * message) | ||
1143 | { | 1145 | { |
1144 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_RECORD_REMOVE"); | ||
1145 | struct GNUNET_NAMESTORE_Client *nc; | 1146 | struct GNUNET_NAMESTORE_Client *nc; |
1147 | const struct RecordRemoveMessage * rr_msg; | ||
1146 | struct RecordRemoveResponseMessage rrr_msg; | 1148 | struct RecordRemoveResponseMessage rrr_msg; |
1147 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; | 1149 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; |
1148 | struct GNUNET_NAMESTORE_CryptoContainer *cc = NULL; | 1150 | struct GNUNET_NAMESTORE_CryptoContainer *cc; |
1149 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; | 1151 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; |
1150 | struct GNUNET_CRYPTO_ShortHashCode pubkey_hash; | 1152 | struct GNUNET_CRYPTO_ShortHashCode pubkey_hash; |
1151 | struct GNUNET_HashCode long_hash; | 1153 | struct GNUNET_HashCode long_hash; |
1152 | char * pkey_tmp = NULL; | 1154 | const char * pkey_tmp; |
1153 | char * name_tmp = NULL; | 1155 | const char * name_tmp; |
1154 | char * rd_ser = NULL; | 1156 | const char * rd_ser; |
1155 | size_t key_len = 0; | 1157 | size_t key_len; |
1156 | size_t name_len = 0; | 1158 | size_t name_len; |
1157 | size_t rd_ser_len = 0; | 1159 | size_t rd_ser_len; |
1158 | size_t msg_size = 0; | 1160 | size_t msg_size; |
1159 | size_t msg_size_exp = 0; | 1161 | size_t msg_size_exp = 0; |
1160 | uint32_t rd_count; | 1162 | uint32_t rd_count; |
1161 | uint32_t rid = 0; | 1163 | uint32_t rid; |
1162 | 1164 | ||
1163 | int res = GNUNET_SYSERR; | 1165 | int res = GNUNET_SYSERR; |
1164 | 1166 | ||
1167 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_RECORD_REMOVE"); | ||
1165 | if (ntohs (message->size) < sizeof (struct RecordRemoveMessage)) | 1168 | if (ntohs (message->size) < sizeof (struct RecordRemoveMessage)) |
1166 | { | 1169 | { |
1167 | GNUNET_break_op (0); | 1170 | GNUNET_break_op (0); |
@@ -1177,7 +1180,7 @@ static void handle_record_remove (void *cls, | |||
1177 | return; | 1180 | return; |
1178 | } | 1181 | } |
1179 | 1182 | ||
1180 | struct RecordRemoveMessage * rr_msg = (struct RecordRemoveMessage *) message; | 1183 | rr_msg = (const struct RecordRemoveMessage *) message; |
1181 | rid = ntohl (rr_msg->gns_header.r_id); | 1184 | rid = ntohl (rr_msg->gns_header.r_id); |
1182 | name_len = ntohs (rr_msg->name_len); | 1185 | name_len = ntohs (rr_msg->name_len); |
1183 | rd_ser_len = ntohs (rr_msg->rd_len); | 1186 | rd_ser_len = ntohs (rr_msg->rd_len); |
@@ -1208,7 +1211,7 @@ static void handle_record_remove (void *cls, | |||
1208 | return; | 1211 | return; |
1209 | } | 1212 | } |
1210 | 1213 | ||
1211 | pkey_tmp = (char *) &rr_msg[1]; | 1214 | pkey_tmp = (const char *) &rr_msg[1]; |
1212 | name_tmp = &pkey_tmp[key_len]; | 1215 | name_tmp = &pkey_tmp[key_len]; |
1213 | rd_ser = &name_tmp[name_len]; | 1216 | rd_ser = &name_tmp[name_len]; |
1214 | 1217 | ||
@@ -1236,7 +1239,9 @@ static void handle_record_remove (void *cls, | |||
1236 | 1239 | ||
1237 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash)) | 1240 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash)) |
1238 | { | 1241 | { |
1239 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone `%s'\n",GNUNET_short_h2s(&pubkey_hash)); | 1242 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1243 | "Received new private key for zone `%s'\n", | ||
1244 | GNUNET_short_h2s(&pubkey_hash)); | ||
1240 | cc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer)); | 1245 | cc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer)); |
1241 | cc->privkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len); | 1246 | cc->privkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len); |
1242 | cc->pubkey = GNUNET_malloc(sizeof (pub)); | 1247 | cc->pubkey = GNUNET_malloc(sizeof (pub)); |