aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/namestore_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore/namestore_api.c')
-rw-r--r--src/namestore/namestore_api.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index be80e2091..a0f37f9f1 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -1221,7 +1221,7 @@ GNUNET_NAMESTORE_record_create (struct GNUNET_NAMESTORE_Handle *h,
1221 * @param h handle to the namestore 1221 * @param h handle to the namestore
1222 * @param pkey private key of the zone 1222 * @param pkey private key of the zone
1223 * @param name name that is being mapped (at most 255 characters long) 1223 * @param name name that is being mapped (at most 255 characters long)
1224 * @param rd record data 1224 * @param rd record data, remove specific record, NULL to remove the name and all records
1225 * @param cont continuation to call when done 1225 * @param cont continuation to call when done
1226 * @param cont_cls closure for cont 1226 * @param cont_cls closure for cont
1227 * @return handle to abort the request 1227 * @return handle to abort the request
@@ -1244,6 +1244,7 @@ GNUNET_NAMESTORE_record_remove (struct GNUNET_NAMESTORE_Handle *h,
1244 size_t name_len = 0; 1244 size_t name_len = 0;
1245 size_t key_len = 0; 1245 size_t key_len = 0;
1246 uint32_t rid = 0; 1246 uint32_t rid = 0;
1247 uint16_t rd_count = 1;
1247 1248
1248 GNUNET_assert (NULL != h); 1249 GNUNET_assert (NULL != h);
1249 1250
@@ -1260,9 +1261,13 @@ GNUNET_NAMESTORE_record_remove (struct GNUNET_NAMESTORE_Handle *h,
1260 GNUNET_assert (pkey_enc != NULL); 1261 GNUNET_assert (pkey_enc != NULL);
1261 key_len = ntohs (pkey_enc->len); 1262 key_len = ntohs (pkey_enc->len);
1262 1263
1263 rd_ser_len = GNUNET_NAMESTORE_records_get_size(1, rd); 1264 if (NULL == rd)
1265 rd_count = 0;
1266 else
1267 rd_count = 1;
1268 rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd);
1264 char rd_ser[rd_ser_len]; 1269 char rd_ser[rd_ser_len];
1265 GNUNET_NAMESTORE_records_serialize(1, rd, rd_ser_len, rd_ser); 1270 GNUNET_NAMESTORE_records_serialize (rd_count, rd, rd_ser_len, rd_ser);
1266 1271
1267 name_len = strlen (name) + 1; 1272 name_len = strlen (name) + 1;
1268 1273
@@ -1284,7 +1289,7 @@ GNUNET_NAMESTORE_record_remove (struct GNUNET_NAMESTORE_Handle *h,
1284 msg->gns_header.r_id = htonl (rid); 1289 msg->gns_header.r_id = htonl (rid);
1285 msg->name_len = htons (name_len); 1290 msg->name_len = htons (name_len);
1286 msg->rd_len = htons (rd_ser_len); 1291 msg->rd_len = htons (rd_ser_len);
1287 msg->rd_count = htons (1); 1292 msg->rd_count = htons (rd_count);
1288 msg->pkey_len = htons (key_len); 1293 msg->pkey_len = htons (key_len);
1289 memcpy (pkey_tmp, pkey_enc, key_len); 1294 memcpy (pkey_tmp, pkey_enc, key_len);
1290 memcpy (name_tmp, name, name_len); 1295 memcpy (name_tmp, name, name_len);