diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-11-06 22:32:17 +0900 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-11-06 22:32:17 +0900 |
commit | bc3d776dd38651fae221a06a198d427d28693673 (patch) | |
tree | 431cc5c6bed61073ef9362937de41a74e95cc723 /src/namestore | |
parent | 4db7f94ce6c8d6aed2b834c050b983de42f98718 (diff) | |
download | gnunet-bc3d776dd38651fae221a06a198d427d28693673.tar.gz gnunet-bc3d776dd38651fae221a06a198d427d28693673.zip |
IPC: Convert all message payload lengths to uint16_t types.
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 25 | ||||
-rw-r--r-- | src/namestore/namestore.h | 66 | ||||
-rw-r--r-- | src/namestore/namestore_api.c | 38 | ||||
-rw-r--r-- | src/namestore/namestore_api_monitor.c | 6 |
4 files changed, 63 insertions, 72 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 9173d2e4d..a9ce9e3a1 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -787,7 +787,7 @@ send_lookup_response_with_filter (struct NamestoreClient *nc, | |||
787 | zir_msg->name_len = htons (name_len); | 787 | zir_msg->name_len = htons (name_len); |
788 | zir_msg->rd_count = htons (res_count); | 788 | zir_msg->rd_count = htons (res_count); |
789 | zir_msg->rd_len = htons ((uint16_t) rd_ser_len); | 789 | zir_msg->rd_len = htons ((uint16_t) rd_ser_len); |
790 | zir_msg->key_len = htonl (key_len); | 790 | zir_msg->key_len = htons (key_len); |
791 | GNUNET_IDENTITY_write_private_key_to_buffer (zone_key, | 791 | GNUNET_IDENTITY_write_private_key_to_buffer (zone_key, |
792 | &zir_msg[1], | 792 | &zir_msg[1], |
793 | key_len); | 793 | key_len); |
@@ -1317,8 +1317,8 @@ check_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg) | |||
1317 | size_t key_len; | 1317 | size_t key_len; |
1318 | 1318 | ||
1319 | (void) cls; | 1319 | (void) cls; |
1320 | name_len = ntohl (ll_msg->label_len); | 1320 | name_len = ntohs (ll_msg->label_len); |
1321 | key_len = ntohl (ll_msg->key_len); | 1321 | key_len = ntohs (ll_msg->key_len); |
1322 | src_size = ntohs (ll_msg->gns_header.header.size); | 1322 | src_size = ntohs (ll_msg->gns_header.header.size); |
1323 | if (name_len + key_len != src_size - sizeof(struct LabelLookupMessage)) | 1323 | if (name_len + key_len != src_size - sizeof(struct LabelLookupMessage)) |
1324 | { | 1324 | { |
@@ -1351,7 +1351,7 @@ handle_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg) | |||
1351 | size_t key_len; | 1351 | size_t key_len; |
1352 | size_t kb_read; | 1352 | size_t kb_read; |
1353 | 1353 | ||
1354 | key_len = ntohl (ll_msg->key_len); | 1354 | key_len = ntohs (ll_msg->key_len); |
1355 | if ((GNUNET_SYSERR == | 1355 | if ((GNUNET_SYSERR == |
1356 | GNUNET_IDENTITY_read_private_key_from_buffer (&ll_msg[1], | 1356 | GNUNET_IDENTITY_read_private_key_from_buffer (&ll_msg[1], |
1357 | key_len, | 1357 | key_len, |
@@ -1389,7 +1389,7 @@ handle_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg) | |||
1389 | rlc.res_rd = NULL; | 1389 | rlc.res_rd = NULL; |
1390 | rlc.rd_ser_len = 0; | 1390 | rlc.rd_ser_len = 0; |
1391 | rlc.nick = get_nick_record (&zone); | 1391 | rlc.nick = get_nick_record (&zone); |
1392 | if (GNUNET_YES != ntohl (ll_msg->is_edit_request)) | 1392 | if (GNUNET_YES != ntohs (ll_msg->is_edit_request)) |
1393 | res = nc->GSN_database->lookup_records (nc->GSN_database->cls, | 1393 | res = nc->GSN_database->lookup_records (nc->GSN_database->cls, |
1394 | &zone, | 1394 | &zone, |
1395 | conv_name, | 1395 | conv_name, |
@@ -1412,6 +1412,7 @@ handle_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg) | |||
1412 | llr_msg->name_len = htons (name_len); | 1412 | llr_msg->name_len = htons (name_len); |
1413 | llr_msg->rd_count = htons (rlc.res_rd_count); | 1413 | llr_msg->rd_count = htons (rlc.res_rd_count); |
1414 | llr_msg->rd_len = htons (rlc.rd_ser_len); | 1414 | llr_msg->rd_len = htons (rlc.rd_ser_len); |
1415 | llr_msg->reserved = htons (0); | ||
1415 | res_name = ((char *) &llr_msg[1]) + key_len; | 1416 | res_name = ((char *) &llr_msg[1]) + key_len; |
1416 | if (GNUNET_YES == rlc.found) | 1417 | if (GNUNET_YES == rlc.found) |
1417 | llr_msg->found = htons (GNUNET_YES); | 1418 | llr_msg->found = htons (GNUNET_YES); |
@@ -1446,7 +1447,7 @@ check_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1446 | (void) cls; | 1447 | (void) cls; |
1447 | msg_size = ntohs (rp_msg->gns_header.header.size); | 1448 | msg_size = ntohs (rp_msg->gns_header.header.size); |
1448 | rd_set_count = ntohs (rp_msg->rd_set_count); | 1449 | rd_set_count = ntohs (rp_msg->rd_set_count); |
1449 | key_len = ntohl (rp_msg->key_len); | 1450 | key_len = ntohs (rp_msg->key_len); |
1450 | 1451 | ||
1451 | min_size_exp = sizeof(*rp_msg) + key_len + sizeof (struct RecordSet) | 1452 | min_size_exp = sizeof(*rp_msg) + key_len + sizeof (struct RecordSet) |
1452 | * rd_set_count; | 1453 | * rd_set_count; |
@@ -1739,7 +1740,7 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1739 | struct RecordSet *rs; | 1740 | struct RecordSet *rs; |
1740 | enum GNUNET_ErrorCode res; | 1741 | enum GNUNET_ErrorCode res; |
1741 | 1742 | ||
1742 | key_len = ntohl (rp_msg->key_len); | 1743 | key_len = ntohs (rp_msg->key_len); |
1743 | if ((GNUNET_SYSERR == | 1744 | if ((GNUNET_SYSERR == |
1744 | GNUNET_IDENTITY_read_private_key_from_buffer (&rp_msg[1], | 1745 | GNUNET_IDENTITY_read_private_key_from_buffer (&rp_msg[1], |
1745 | key_len, | 1746 | key_len, |
@@ -1993,7 +1994,7 @@ handle_zone_to_name_it (void *cls, | |||
1993 | ztnr_msg->rd_len = htons (rd_ser_len); | 1994 | ztnr_msg->rd_len = htons (rd_ser_len); |
1994 | ztnr_msg->rd_count = htons (rd_count); | 1995 | ztnr_msg->rd_count = htons (rd_count); |
1995 | ztnr_msg->name_len = htons (name_len); | 1996 | ztnr_msg->name_len = htons (name_len); |
1996 | ztnr_msg->key_len = htonl (key_len); | 1997 | ztnr_msg->key_len = htons (key_len); |
1997 | GNUNET_IDENTITY_write_private_key_to_buffer (zone_key, | 1998 | GNUNET_IDENTITY_write_private_key_to_buffer (zone_key, |
1998 | &ztnr_msg[1], | 1999 | &ztnr_msg[1], |
1999 | key_len); | 2000 | key_len); |
@@ -2038,7 +2039,7 @@ handle_zone_to_name (void *cls, const struct ZoneToNameMessage *ztn_msg) | |||
2038 | ztn_ctx.rid = ntohl (ztn_msg->gns_header.r_id); | 2039 | ztn_ctx.rid = ntohl (ztn_msg->gns_header.r_id); |
2039 | ztn_ctx.nc = nc; | 2040 | ztn_ctx.nc = nc; |
2040 | ztn_ctx.ec = GNUNET_EC_NAMESTORE_ZONE_NOT_FOUND; | 2041 | ztn_ctx.ec = GNUNET_EC_NAMESTORE_ZONE_NOT_FOUND; |
2041 | key_len = ntohl (ztn_msg->key_len); | 2042 | key_len = ntohs (ztn_msg->key_len); |
2042 | if ((GNUNET_SYSERR == | 2043 | if ((GNUNET_SYSERR == |
2043 | GNUNET_IDENTITY_read_private_key_from_buffer (&ztn_msg[1], | 2044 | GNUNET_IDENTITY_read_private_key_from_buffer (&ztn_msg[1], |
2044 | key_len, | 2045 | key_len, |
@@ -2052,7 +2053,7 @@ handle_zone_to_name (void *cls, const struct ZoneToNameMessage *ztn_msg) | |||
2052 | GNUNET_break (0); | 2053 | GNUNET_break (0); |
2053 | return; | 2054 | return; |
2054 | } | 2055 | } |
2055 | pkey_len = ntohl (ztn_msg->pkey_len); | 2056 | pkey_len = ntohs (ztn_msg->pkey_len); |
2056 | if ((GNUNET_SYSERR == | 2057 | if ((GNUNET_SYSERR == |
2057 | GNUNET_IDENTITY_read_public_key_from_buffer ((char*) &ztn_msg[1] | 2058 | GNUNET_IDENTITY_read_public_key_from_buffer ((char*) &ztn_msg[1] |
2058 | + key_len, | 2059 | + key_len, |
@@ -2259,7 +2260,7 @@ handle_iteration_start (void *cls, | |||
2259 | 2260 | ||
2260 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2261 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2261 | "Received ZONE_ITERATION_START message\n"); | 2262 | "Received ZONE_ITERATION_START message\n"); |
2262 | key_len = ntohl (zis_msg->key_len); | 2263 | key_len = ntohs (zis_msg->key_len); |
2263 | zi = GNUNET_new (struct ZoneIteration); | 2264 | zi = GNUNET_new (struct ZoneIteration); |
2264 | if (0 < key_len) | 2265 | if (0 < key_len) |
2265 | { | 2266 | { |
@@ -2512,7 +2513,7 @@ handle_monitor_start (void *cls, const struct | |||
2512 | "Received ZONE_MONITOR_START message\n"); | 2513 | "Received ZONE_MONITOR_START message\n"); |
2513 | zm = GNUNET_new (struct ZoneMonitor); | 2514 | zm = GNUNET_new (struct ZoneMonitor); |
2514 | zm->nc = nc; | 2515 | zm->nc = nc; |
2515 | key_len = ntohl (zis_msg->key_len); | 2516 | key_len = ntohs (zis_msg->key_len); |
2516 | if (0 < key_len) | 2517 | if (0 < key_len) |
2517 | { | 2518 | { |
2518 | if ((GNUNET_SYSERR == | 2519 | if ((GNUNET_SYSERR == |
diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h index 0b50ac1ab..35d54d317 100644 --- a/src/namestore/namestore.h +++ b/src/namestore/namestore.h | |||
@@ -98,7 +98,7 @@ struct RecordStoreMessage | |||
98 | /** | 98 | /** |
99 | * Length of the zone key | 99 | * Length of the zone key |
100 | */ | 100 | */ |
101 | uint32_t key_len GNUNET_PACKED; | 101 | uint16_t key_len GNUNET_PACKED; |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * Followed by the private zone key | 104 | * Followed by the private zone key |
@@ -138,12 +138,12 @@ struct LabelLookupMessage | |||
138 | /** | 138 | /** |
139 | * Length of the name | 139 | * Length of the name |
140 | */ | 140 | */ |
141 | uint32_t label_len GNUNET_PACKED; | 141 | uint16_t label_len GNUNET_PACKED; |
142 | 142 | ||
143 | /** | 143 | /** |
144 | * GNUNET_YES if this lookup corresponds to an edit request | 144 | * GNUNET_YES if this lookup corresponds to an edit request |
145 | */ | 145 | */ |
146 | uint32_t is_edit_request GNUNET_PACKED; | 146 | uint16_t is_edit_request GNUNET_PACKED; |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * The record filter | 149 | * The record filter |
@@ -153,7 +153,7 @@ struct LabelLookupMessage | |||
153 | /** | 153 | /** |
154 | * Length of the zone key | 154 | * Length of the zone key |
155 | */ | 155 | */ |
156 | uint32_t key_len GNUNET_PACKED; | 156 | uint16_t key_len GNUNET_PACKED; |
157 | 157 | ||
158 | /* followed by: | 158 | /* followed by: |
159 | * the private zone key | 159 | * the private zone key |
@@ -194,9 +194,14 @@ struct LabelLookupResponseMessage | |||
194 | int16_t found GNUNET_PACKED; | 194 | int16_t found GNUNET_PACKED; |
195 | 195 | ||
196 | /** | 196 | /** |
197 | * Reserved (alignment) | ||
198 | */ | ||
199 | uint16_t reserved GNUNET_PACKED; | ||
200 | |||
201 | /** | ||
197 | * Length of the zone key | 202 | * Length of the zone key |
198 | */ | 203 | */ |
199 | uint32_t key_len GNUNET_PACKED; | 204 | uint16_t key_len GNUNET_PACKED; |
200 | 205 | ||
201 | /* followed by: | 206 | /* followed by: |
202 | * the private zone key | 207 | * the private zone key |
@@ -219,12 +224,12 @@ struct ZoneToNameMessage | |||
219 | /** | 224 | /** |
220 | * Length of the zone key | 225 | * Length of the zone key |
221 | */ | 226 | */ |
222 | uint32_t key_len GNUNET_PACKED; | 227 | uint16_t key_len GNUNET_PACKED; |
223 | 228 | ||
224 | /** | 229 | /** |
225 | * Length of the public value zone key | 230 | * Length of the public value zone key |
226 | */ | 231 | */ |
227 | uint32_t pkey_len GNUNET_PACKED; | 232 | uint16_t pkey_len GNUNET_PACKED; |
228 | 233 | ||
229 | /** | 234 | /** |
230 | * Followed by | 235 | * Followed by |
@@ -245,6 +250,14 @@ struct ZoneToNameResponseMessage | |||
245 | struct GNUNET_NAMESTORE_Header gns_header; | 250 | struct GNUNET_NAMESTORE_Header gns_header; |
246 | 251 | ||
247 | /** | 252 | /** |
253 | * result in NBO: #GNUNET_EC_NONE on success, | ||
254 | * #GNUNET_EC_NAMESTORE_NO_RESULTS if there were no | ||
255 | * results. | ||
256 | * Other error messages on error. | ||
257 | */ | ||
258 | int32_t ec GNUNET_PACKED; | ||
259 | |||
260 | /** | ||
248 | * Length of the name | 261 | * Length of the name |
249 | */ | 262 | */ |
250 | uint16_t name_len GNUNET_PACKED; | 263 | uint16_t name_len GNUNET_PACKED; |
@@ -260,17 +273,9 @@ struct ZoneToNameResponseMessage | |||
260 | uint16_t rd_count GNUNET_PACKED; | 273 | uint16_t rd_count GNUNET_PACKED; |
261 | 274 | ||
262 | /** | 275 | /** |
263 | * result in NBO: #GNUNET_EC_NONE on success, | ||
264 | * #GNUNET_EC_NAMESTORE_NO_RESULTS if there were no | ||
265 | * results. | ||
266 | * Other error messages on error. | ||
267 | */ | ||
268 | int32_t ec GNUNET_PACKED; | ||
269 | |||
270 | /** | ||
271 | * Length of the zone key | 276 | * Length of the zone key |
272 | */ | 277 | */ |
273 | uint32_t key_len GNUNET_PACKED; | 278 | uint16_t key_len GNUNET_PACKED; |
274 | 279 | ||
275 | /* followed by: | 280 | /* followed by: |
276 | * the private zone key | 281 | * the private zone key |
@@ -312,14 +317,9 @@ struct RecordResultMessage | |||
312 | uint16_t rd_count GNUNET_PACKED; | 317 | uint16_t rd_count GNUNET_PACKED; |
313 | 318 | ||
314 | /** | 319 | /** |
315 | * always zero (for alignment) | ||
316 | */ | ||
317 | uint16_t reserved GNUNET_PACKED; | ||
318 | |||
319 | /** | ||
320 | * Length of the zone key | 320 | * Length of the zone key |
321 | */ | 321 | */ |
322 | uint32_t key_len GNUNET_PACKED; | 322 | uint16_t key_len GNUNET_PACKED; |
323 | 323 | ||
324 | /* followed by: | 324 | /* followed by: |
325 | * the private key of the authority | 325 | * the private key of the authority |
@@ -339,14 +339,14 @@ struct TxControlMessage | |||
339 | struct GNUNET_NAMESTORE_Header gns_header; | 339 | struct GNUNET_NAMESTORE_Header gns_header; |
340 | 340 | ||
341 | /** | 341 | /** |
342 | * The type of control message to send | 342 | * always zero (for alignment) |
343 | */ | 343 | */ |
344 | uint16_t control GNUNET_PACKED; | 344 | uint16_t reserved GNUNET_PACKED; |
345 | 345 | ||
346 | /** | 346 | /** |
347 | * always zero (for alignment) | 347 | * The type of control message to send |
348 | */ | 348 | */ |
349 | uint16_t reserved GNUNET_PACKED; | 349 | uint16_t control GNUNET_PACKED; |
350 | 350 | ||
351 | }; | 351 | }; |
352 | 352 | ||
@@ -392,14 +392,9 @@ struct ZoneMonitorStartMessage | |||
392 | uint16_t filter; | 392 | uint16_t filter; |
393 | 393 | ||
394 | /** | 394 | /** |
395 | * Reserved for alignment | ||
396 | */ | ||
397 | uint16_t reserved; | ||
398 | |||
399 | /** | ||
400 | * Length of the zone key | 395 | * Length of the zone key |
401 | */ | 396 | */ |
402 | uint32_t key_len GNUNET_PACKED; | 397 | uint16_t key_len GNUNET_PACKED; |
403 | 398 | ||
404 | /** | 399 | /** |
405 | * Followed by the private zone key. | 400 | * Followed by the private zone key. |
@@ -448,14 +443,9 @@ struct ZoneIterationStartMessage | |||
448 | uint16_t filter; | 443 | uint16_t filter; |
449 | 444 | ||
450 | /** | 445 | /** |
451 | * Reserved for alignment | ||
452 | */ | ||
453 | uint16_t reserved; | ||
454 | |||
455 | /** | ||
456 | * Length of the zone key | 446 | * Length of the zone key |
457 | */ | 447 | */ |
458 | uint32_t key_len GNUNET_PACKED; | 448 | uint16_t key_len GNUNET_PACKED; |
459 | 449 | ||
460 | /** | 450 | /** |
461 | * Followed by the private zone key (optional) | 451 | * Followed by the private zone key (optional) |
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index e020b9e42..8deded9c0 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -407,8 +407,13 @@ check_lookup_result (void *cls, const struct LabelLookupResponseMessage *msg) | |||
407 | rd_len = ntohs (msg->rd_len); | 407 | rd_len = ntohs (msg->rd_len); |
408 | msg_len = ntohs (msg->gns_header.header.size); | 408 | msg_len = ntohs (msg->gns_header.header.size); |
409 | name_len = ntohs (msg->name_len); | 409 | name_len = ntohs (msg->name_len); |
410 | key_len = ntohl (msg->key_len); | 410 | key_len = ntohs (msg->key_len); |
411 | exp_msg_len = sizeof(*msg) + name_len + rd_len + key_len; | 411 | exp_msg_len = sizeof(*msg) + name_len + rd_len + key_len; |
412 | if (0 != ntohs (msg->reserved)) | ||
413 | { | ||
414 | GNUNET_break (0); | ||
415 | return GNUNET_SYSERR; | ||
416 | } | ||
412 | if (msg_len != exp_msg_len) | 417 | if (msg_len != exp_msg_len) |
413 | { | 418 | { |
414 | GNUNET_break (0); | 419 | GNUNET_break (0); |
@@ -463,7 +468,7 @@ handle_lookup_result (void *cls, const struct LabelLookupResponseMessage *msg) | |||
463 | rd_len = ntohs (msg->rd_len); | 468 | rd_len = ntohs (msg->rd_len); |
464 | rd_count = ntohs (msg->rd_count); | 469 | rd_count = ntohs (msg->rd_count); |
465 | name_len = ntohs (msg->name_len); | 470 | name_len = ntohs (msg->name_len); |
466 | key_len = ntohl (msg->key_len); | 471 | key_len = ntohs (msg->key_len); |
467 | GNUNET_assert (GNUNET_SYSERR != | 472 | GNUNET_assert (GNUNET_SYSERR != |
468 | GNUNET_IDENTITY_read_private_key_from_buffer (&msg[1], | 473 | GNUNET_IDENTITY_read_private_key_from_buffer (&msg[1], |
469 | key_len, | 474 | key_len, |
@@ -527,13 +532,8 @@ check_record_result (void *cls, const struct RecordResultMessage *msg) | |||
527 | (void) cls; | 532 | (void) cls; |
528 | rd_len = ntohs (msg->rd_len); | 533 | rd_len = ntohs (msg->rd_len); |
529 | msg_len = ntohs (msg->gns_header.header.size); | 534 | msg_len = ntohs (msg->gns_header.header.size); |
530 | key_len = ntohl (msg->key_len); | 535 | key_len = ntohs (msg->key_len); |
531 | name_len = ntohs (msg->name_len); | 536 | name_len = ntohs (msg->name_len); |
532 | if (0 != ntohs (msg->reserved)) | ||
533 | { | ||
534 | GNUNET_break (0); | ||
535 | return GNUNET_SYSERR; | ||
536 | } | ||
537 | if (msg_len != sizeof(struct RecordResultMessage) + key_len + name_len | 537 | if (msg_len != sizeof(struct RecordResultMessage) + key_len + name_len |
538 | + rd_len) | 538 | + rd_len) |
539 | { | 539 | { |
@@ -581,7 +581,7 @@ handle_record_result (void *cls, const struct RecordResultMessage *msg) | |||
581 | rd_len = ntohs (msg->rd_len); | 581 | rd_len = ntohs (msg->rd_len); |
582 | rd_count = ntohs (msg->rd_count); | 582 | rd_count = ntohs (msg->rd_count); |
583 | name_len = ntohs (msg->name_len); | 583 | name_len = ntohs (msg->name_len); |
584 | key_len = ntohl (msg->key_len); | 584 | key_len = ntohs (msg->key_len); |
585 | ze = find_zi (h, ntohl (msg->gns_header.r_id)); | 585 | ze = find_zi (h, ntohl (msg->gns_header.r_id)); |
586 | qe = find_qe (h, ntohl (msg->gns_header.r_id)); | 586 | qe = find_qe (h, ntohl (msg->gns_header.r_id)); |
587 | if ((NULL == ze) && (NULL == qe)) | 587 | if ((NULL == ze) && (NULL == qe)) |
@@ -710,7 +710,7 @@ check_zone_to_name_response (void *cls, | |||
710 | (void) cls; | 710 | (void) cls; |
711 | if (GNUNET_EC_NONE != ntohl (msg->ec)) | 711 | if (GNUNET_EC_NONE != ntohl (msg->ec)) |
712 | return GNUNET_OK; | 712 | return GNUNET_OK; |
713 | key_len = ntohl (msg->key_len); | 713 | key_len = ntohs (msg->key_len); |
714 | name_len = ntohs (msg->name_len); | 714 | name_len = ntohs (msg->name_len); |
715 | rd_ser_len = ntohs (msg->rd_len); | 715 | rd_ser_len = ntohs (msg->rd_len); |
716 | if (ntohs (msg->gns_header.header.size) != | 716 | if (ntohs (msg->gns_header.header.size) != |
@@ -762,7 +762,7 @@ handle_zone_to_name_response (void *cls, | |||
762 | return; | 762 | return; |
763 | } | 763 | } |
764 | res = ntohl (msg->ec); | 764 | res = ntohl (msg->ec); |
765 | key_len = ntohl (msg->key_len); | 765 | key_len = ntohs (msg->key_len); |
766 | GNUNET_assert (GNUNET_SYSERR != | 766 | GNUNET_assert (GNUNET_SYSERR != |
767 | GNUNET_IDENTITY_read_private_key_from_buffer (&msg[1], | 767 | GNUNET_IDENTITY_read_private_key_from_buffer (&msg[1], |
768 | key_len, | 768 | key_len, |
@@ -1140,7 +1140,7 @@ GNUNET_NAMESTORE_records_store2 ( | |||
1140 | GNUNET_assert (NULL != msg); | 1140 | GNUNET_assert (NULL != msg); |
1141 | GNUNET_assert (NULL != env); | 1141 | GNUNET_assert (NULL != env); |
1142 | msg->gns_header.r_id = htonl (rid); | 1142 | msg->gns_header.r_id = htonl (rid); |
1143 | msg->key_len = htonl (key_len); | 1143 | msg->key_len = htons (key_len); |
1144 | msg->rd_set_count = htons ((uint16_t) (*rds_sent)); | 1144 | msg->rd_set_count = htons ((uint16_t) (*rds_sent)); |
1145 | GNUNET_IDENTITY_write_private_key_to_buffer (pkey, | 1145 | GNUNET_IDENTITY_write_private_key_to_buffer (pkey, |
1146 | &msg[1], | 1146 | &msg[1], |
@@ -1230,9 +1230,9 @@ records_lookup ( | |||
1230 | &msg[1], | 1230 | &msg[1], |
1231 | key_len); | 1231 | key_len); |
1232 | 1232 | ||
1233 | msg->key_len = htonl (key_len); | 1233 | msg->key_len = htons (key_len); |
1234 | msg->is_edit_request = htonl (is_edit_request); | 1234 | msg->is_edit_request = htons (is_edit_request); |
1235 | msg->label_len = htonl (label_len); | 1235 | msg->label_len = htons (label_len); |
1236 | msg->filter = htons (filter); | 1236 | msg->filter = htons (filter); |
1237 | GNUNET_memcpy (((char*) &msg[1]) + key_len, label, label_len); | 1237 | GNUNET_memcpy (((char*) &msg[1]) + key_len, label, label_len); |
1238 | if (NULL == h->mq) | 1238 | if (NULL == h->mq) |
@@ -1323,8 +1323,8 @@ GNUNET_NAMESTORE_zone_to_name ( | |||
1323 | env = GNUNET_MQ_msg_extra (msg, key_len + pkey_len, | 1323 | env = GNUNET_MQ_msg_extra (msg, key_len + pkey_len, |
1324 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME); | 1324 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME); |
1325 | msg->gns_header.r_id = htonl (rid); | 1325 | msg->gns_header.r_id = htonl (rid); |
1326 | msg->key_len = htonl (key_len); | 1326 | msg->key_len = htons (key_len); |
1327 | msg->pkey_len = htonl (pkey_len); | 1327 | msg->pkey_len = htons (pkey_len); |
1328 | GNUNET_IDENTITY_write_private_key_to_buffer (zone, &msg[1], key_len); | 1328 | GNUNET_IDENTITY_write_private_key_to_buffer (zone, &msg[1], key_len); |
1329 | GNUNET_IDENTITY_write_public_key_to_buffer (value_zone, | 1329 | GNUNET_IDENTITY_write_public_key_to_buffer (value_zone, |
1330 | (char*) &msg[1] + key_len, | 1330 | (char*) &msg[1] + key_len, |
@@ -1375,7 +1375,7 @@ GNUNET_NAMESTORE_zone_iteration_start ( | |||
1375 | key_len, | 1375 | key_len, |
1376 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START); | 1376 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START); |
1377 | msg->gns_header.r_id = htonl (rid); | 1377 | msg->gns_header.r_id = htonl (rid); |
1378 | msg->key_len = htonl (key_len); | 1378 | msg->key_len = htons (key_len); |
1379 | if (NULL != zone) | 1379 | if (NULL != zone) |
1380 | GNUNET_IDENTITY_write_private_key_to_buffer (zone, &msg[1], key_len); | 1380 | GNUNET_IDENTITY_write_private_key_to_buffer (zone, &msg[1], key_len); |
1381 | if (NULL == h->mq) | 1381 | if (NULL == h->mq) |
@@ -1424,7 +1424,7 @@ GNUNET_NAMESTORE_zone_iteration_start2 ( | |||
1424 | key_len, | 1424 | key_len, |
1425 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START); | 1425 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START); |
1426 | msg->gns_header.r_id = htonl (rid); | 1426 | msg->gns_header.r_id = htonl (rid); |
1427 | msg->key_len = htonl (key_len); | 1427 | msg->key_len = htons (key_len); |
1428 | msg->filter = htons ((uint16_t) filter); | 1428 | msg->filter = htons ((uint16_t) filter); |
1429 | if (NULL != zone) | 1429 | if (NULL != zone) |
1430 | GNUNET_IDENTITY_write_private_key_to_buffer (zone, &msg[1], key_len); | 1430 | GNUNET_IDENTITY_write_private_key_to_buffer (zone, &msg[1], key_len); |
diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c index 81ea41f7d..199aec608 100644 --- a/src/namestore/namestore_api_monitor.c +++ b/src/namestore/namestore_api_monitor.c | |||
@@ -154,7 +154,7 @@ check_result (void *cls, const struct RecordResultMessage *lrm) | |||
154 | size_t key_len; | 154 | size_t key_len; |
155 | 155 | ||
156 | (void) zm; | 156 | (void) zm; |
157 | key_len = ntohl (lrm->key_len); | 157 | key_len = ntohs (lrm->key_len); |
158 | (void) cls; | 158 | (void) cls; |
159 | if (0 == key_len) | 159 | if (0 == key_len) |
160 | { | 160 | { |
@@ -222,7 +222,7 @@ handle_result (void *cls, const struct RecordResultMessage *lrm) | |||
222 | const char *name_tmp; | 222 | const char *name_tmp; |
223 | const char *rd_ser_tmp; | 223 | const char *rd_ser_tmp; |
224 | 224 | ||
225 | key_len = ntohl (lrm->key_len); | 225 | key_len = ntohs (lrm->key_len); |
226 | rd_len = ntohs (lrm->rd_len); | 226 | rd_len = ntohs (lrm->rd_len); |
227 | rd_count = ntohs (lrm->rd_count); | 227 | rd_count = ntohs (lrm->rd_count); |
228 | name_len = ntohs (lrm->name_len); | 228 | name_len = ntohs (lrm->name_len); |
@@ -308,7 +308,7 @@ reconnect (struct GNUNET_NAMESTORE_ZoneMonitor *zm) | |||
308 | GNUNET_IDENTITY_write_private_key_to_buffer (&zm->zone, | 308 | GNUNET_IDENTITY_write_private_key_to_buffer (&zm->zone, |
309 | &sm[1], | 309 | &sm[1], |
310 | zm->key_len); | 310 | zm->key_len); |
311 | sm->key_len = htonl (zm->key_len); | 311 | sm->key_len = htons (zm->key_len); |
312 | sm->filter = htons (zm->filter); | 312 | sm->filter = htons (zm->filter); |
313 | GNUNET_MQ_send (zm->mq, env); | 313 | GNUNET_MQ_send (zm->mq, env); |
314 | } | 314 | } |