aboutsummaryrefslogtreecommitdiff
path: root/src/gnsrecord
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnsrecord')
-rw-r--r--src/gnsrecord/gnsrecord_misc.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index ba8803850..82c38f19a 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -107,8 +107,8 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a,
107 { 107 {
108 LOG (GNUNET_ERROR_TYPE_DEBUG, 108 LOG (GNUNET_ERROR_TYPE_DEBUG,
109 "Expiration time %llu != %llu\n", 109 "Expiration time %llu != %llu\n",
110 a->expiration_time, 110 (unsigned long long) a->expiration_time,
111 b->expiration_time); 111 (unsigned long long) b->expiration_time);
112 return GNUNET_NO; 112 return GNUNET_NO;
113 } 113 }
114 if ((a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS) 114 if ((a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS)
@@ -282,11 +282,13 @@ GNUNET_GNSRECORD_identity_from_data (const char *data,
282 return GNUNET_SYSERR; 282 return GNUNET_SYSERR;
283 if (data_size > sizeof (struct GNUNET_IDENTITY_PublicKey)) 283 if (data_size > sizeof (struct GNUNET_IDENTITY_PublicKey))
284 return GNUNET_SYSERR; 284 return GNUNET_SYSERR;
285 key->type = type; 285 return (GNUNET_IDENTITY_read_key_from_buffer (key, data, data_size) ==
286 memcpy (key, data, data_size); 286 data_size?
287 return GNUNET_OK; 287 GNUNET_OK :
288 GNUNET_SYSERR);
288} 289}
289 290
291
290enum GNUNET_GenericReturnValue 292enum GNUNET_GenericReturnValue
291GNUNET_GNSRECORD_data_from_identity (const struct 293GNUNET_GNSRECORD_data_from_identity (const struct
292 GNUNET_IDENTITY_PublicKey *key, 294 GNUNET_IDENTITY_PublicKey *key,
@@ -294,13 +296,15 @@ GNUNET_GNSRECORD_data_from_identity (const struct
294 size_t *data_size, 296 size_t *data_size,
295 uint32_t *type) 297 uint32_t *type)
296{ 298{
297 *type = key->type; 299 *type = ntohl (key->type);
298 *data_size = GNUNET_IDENTITY_key_get_length (key); 300 *data_size = GNUNET_IDENTITY_key_get_length (key);
299 if (0 == *data_size) 301 if (0 == *data_size)
300 return GNUNET_SYSERR; 302 return GNUNET_SYSERR;
301 *data = GNUNET_malloc (*data_size); 303 *data = GNUNET_malloc (*data_size);
302 memcpy (*data, key, *data_size); 304 return (GNUNET_IDENTITY_write_key_to_buffer (key, *data, *data_size) ==
303 return GNUNET_OK; 305 *data_size?
306 GNUNET_OK :
307 GNUNET_SYSERR);
304} 308}
305 309
306 310
@@ -309,14 +313,15 @@ GNUNET_GNSRECORD_is_zonekey_type (uint32_t type)
309{ 313{
310 switch (type) 314 switch (type)
311 { 315 {
312 case GNUNET_GNSRECORD_TYPE_PKEY: 316 case GNUNET_GNSRECORD_TYPE_PKEY:
313 case GNUNET_GNSRECORD_TYPE_EDKEY: 317 case GNUNET_GNSRECORD_TYPE_EDKEY:
314 return GNUNET_YES; 318 return GNUNET_YES;
315 default: 319 default:
316 return GNUNET_NO; 320 return GNUNET_NO;
317 } 321 }
318} 322}
319 323
324
320size_t 325size_t
321GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block) 326GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block)
322{ 327{