diff options
Diffstat (limited to 'src/namestore/test_namestore_api_zone_iteration.c')
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index d69b7cc62..a363ee28d 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c | |||
@@ -37,9 +37,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
37 | 37 | ||
38 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 38 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
39 | 39 | ||
40 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 40 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; |
41 | 41 | ||
42 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey2; | 42 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; |
43 | 43 | ||
44 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; | 44 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; |
45 | 45 | ||
@@ -88,32 +88,22 @@ end (void *cls) | |||
88 | GNUNET_SCHEDULER_cancel (endbadly_task); | 88 | GNUNET_SCHEDULER_cancel (endbadly_task); |
89 | endbadly_task = NULL; | 89 | endbadly_task = NULL; |
90 | } | 90 | } |
91 | if (NULL != privkey) | ||
92 | { | ||
93 | GNUNET_free (privkey); | ||
94 | privkey = NULL; | ||
95 | } | ||
96 | if (NULL != privkey2) | ||
97 | { | ||
98 | GNUNET_free (privkey2); | ||
99 | privkey2 = NULL; | ||
100 | } | ||
101 | GNUNET_free_non_null (s_name_1); | 91 | GNUNET_free_non_null (s_name_1); |
102 | GNUNET_free_non_null (s_name_2); | 92 | GNUNET_free_non_null (s_name_2); |
103 | GNUNET_free_non_null (s_name_3); | 93 | GNUNET_free_non_null (s_name_3); |
104 | if (NULL != s_rd_1) | 94 | if (NULL != s_rd_1) |
105 | { | 95 | { |
106 | GNUNET_free ((void *) s_rd_1->data); | 96 | GNUNET_free_nz ((void *) s_rd_1->data); |
107 | GNUNET_free (s_rd_1); | 97 | GNUNET_free (s_rd_1); |
108 | } | 98 | } |
109 | if (NULL != s_rd_2) | 99 | if (NULL != s_rd_2) |
110 | { | 100 | { |
111 | GNUNET_free ((void *) s_rd_2->data); | 101 | GNUNET_free_nz ((void *) s_rd_2->data); |
112 | GNUNET_free (s_rd_2); | 102 | GNUNET_free (s_rd_2); |
113 | } | 103 | } |
114 | if (NULL != s_rd_3) | 104 | if (NULL != s_rd_3) |
115 | { | 105 | { |
116 | GNUNET_free ((void *) s_rd_3->data); | 106 | GNUNET_free_nz ((void *) s_rd_3->data); |
117 | GNUNET_free (s_rd_3); | 107 | GNUNET_free (s_rd_3); |
118 | } | 108 | } |
119 | if (NULL != nsh) | 109 | if (NULL != nsh) |
@@ -161,7 +151,7 @@ zone_proc (void *cls, | |||
161 | 151 | ||
162 | GNUNET_assert (NULL != zone); | 152 | GNUNET_assert (NULL != zone); |
163 | if (0 == GNUNET_memcmp (zone, | 153 | if (0 == GNUNET_memcmp (zone, |
164 | privkey)) | 154 | &privkey)) |
165 | { | 155 | { |
166 | if (0 == strcmp (label, s_name_1)) | 156 | if (0 == strcmp (label, s_name_1)) |
167 | { | 157 | { |
@@ -207,7 +197,7 @@ zone_proc (void *cls, | |||
207 | } | 197 | } |
208 | } | 198 | } |
209 | else if (0 == GNUNET_memcmp (zone, | 199 | else if (0 == GNUNET_memcmp (zone, |
210 | privkey2)) | 200 | &privkey2)) |
211 | { | 201 | { |
212 | if (0 == strcmp (label, s_name_3)) | 202 | if (0 == strcmp (label, s_name_3)) |
213 | { | 203 | { |
@@ -382,9 +372,11 @@ empty_zone_end (void *cls) | |||
382 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 372 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
383 | "Using zonekey file `%s' \n", | 373 | "Using zonekey file `%s' \n", |
384 | hostkey_file); | 374 | hostkey_file); |
385 | privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | 375 | GNUNET_assert (GNUNET_SYSERR != |
376 | GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
377 | GNUNET_YES, | ||
378 | &privkey)); | ||
386 | GNUNET_free (hostkey_file); | 379 | GNUNET_free (hostkey_file); |
387 | GNUNET_assert (privkey != NULL); | ||
388 | 380 | ||
389 | GNUNET_asprintf (&hostkey_file, | 381 | GNUNET_asprintf (&hostkey_file, |
390 | "zonefiles%s%s", | 382 | "zonefiles%s%s", |
@@ -393,16 +385,18 @@ empty_zone_end (void *cls) | |||
393 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 385 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
394 | "Using zonekey file `%s' \n", | 386 | "Using zonekey file `%s' \n", |
395 | hostkey_file); | 387 | hostkey_file); |
396 | privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | 388 | GNUNET_assert (GNUNET_SYSERR != |
389 | GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
390 | GNUNET_YES, | ||
391 | &privkey2)); | ||
397 | GNUNET_free (hostkey_file); | 392 | GNUNET_free (hostkey_file); |
398 | GNUNET_assert (privkey2 != NULL); | ||
399 | 393 | ||
400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); | 394 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); |
401 | 395 | ||
402 | GNUNET_asprintf (&s_name_1, "dummy1"); | 396 | GNUNET_asprintf (&s_name_1, "dummy1"); |
403 | s_rd_1 = create_record (1); | 397 | s_rd_1 = create_record (1); |
404 | GNUNET_NAMESTORE_records_store (nsh, | 398 | GNUNET_NAMESTORE_records_store (nsh, |
405 | privkey, | 399 | &privkey, |
406 | s_name_1, | 400 | s_name_1, |
407 | 1, s_rd_1, | 401 | 1, s_rd_1, |
408 | &put_cont, | 402 | &put_cont, |
@@ -412,7 +406,7 @@ empty_zone_end (void *cls) | |||
412 | GNUNET_asprintf (&s_name_2, "dummy2"); | 406 | GNUNET_asprintf (&s_name_2, "dummy2"); |
413 | s_rd_2 = create_record (1); | 407 | s_rd_2 = create_record (1); |
414 | GNUNET_NAMESTORE_records_store (nsh, | 408 | GNUNET_NAMESTORE_records_store (nsh, |
415 | privkey, | 409 | &privkey, |
416 | s_name_2, | 410 | s_name_2, |
417 | 1, s_rd_2, | 411 | 1, s_rd_2, |
418 | &put_cont, | 412 | &put_cont, |
@@ -423,7 +417,7 @@ empty_zone_end (void *cls) | |||
423 | GNUNET_asprintf (&s_name_3, "dummy3"); | 417 | GNUNET_asprintf (&s_name_3, "dummy3"); |
424 | s_rd_3 = create_record (1); | 418 | s_rd_3 = create_record (1); |
425 | GNUNET_NAMESTORE_records_store (nsh, | 419 | GNUNET_NAMESTORE_records_store (nsh, |
426 | privkey2, | 420 | &privkey2, |
427 | s_name_3, | 421 | s_name_3, |
428 | 1, | 422 | 1, |
429 | s_rd_3, | 423 | s_rd_3, |