aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/namestore/gnunet-service-namestore.c193
-rw-r--r--src/namestore/namestore.conf.in1
-rw-r--r--src/namestore/test_namestore_api.c6
-rw-r--r--src/namestore/test_namestore_api.conf3
-rw-r--r--src/namestore/test_namestore_api_create.c7
-rw-r--r--src/namestore/test_namestore_api_create_update.c7
-rw-r--r--src/namestore/test_namestore_api_lookup.c6
-rw-r--r--src/namestore/test_namestore_api_lookup_specific_type.c6
-rw-r--r--src/namestore/test_namestore_api_put.c7
-rw-r--r--src/namestore/test_namestore_api_remove.c6
-rw-r--r--src/namestore/test_namestore_api_remove_not_existing_record.c6
-rw-r--r--src/namestore/test_namestore_api_sign_verify.c6
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c13
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c11
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c11
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c6
-rw-r--r--src/namestore/zonefiles/4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone (renamed from src/namestore/hostkey)bin913 -> 913 bytes
-rw-r--r--src/namestore/zonefiles/KJI3AL00K91EDPFJF58DAJM7H61D189TLP70N56JL8SVDCJE1SJ3SNNBOQPPONTL37FMHPS39SMK2NMVC0GQMGA6QCMHITT78O8GF80.zone (renamed from src/namestore/hostkey2)bin914 -> 914 bytes
18 files changed, 268 insertions, 27 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 703944a5c..c5b15244d 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -31,7 +31,7 @@
31#include "gnunet_signatures.h" 31#include "gnunet_signatures.h"
32#include "namestore.h" 32#include "namestore.h"
33 33
34 34#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename)
35 35
36/** 36/**
37 * A namestore operation. 37 * A namestore operation.
@@ -69,25 +69,129 @@ struct GNUNET_NAMESTORE_Client
69 struct GNUNET_NAMESTORE_ZoneIteration *op_tail; 69 struct GNUNET_NAMESTORE_ZoneIteration *op_tail;
70}; 70};
71 71
72struct GNUNET_NAMESTORE_CryptoContainer
73{
74 struct GNUNET_NAMESTORE_CryptoContainer *next;
75 struct GNUNET_NAMESTORE_CryptoContainer *prev;
76
77 char * filename;
78
79 GNUNET_HashCode zone;
80 struct GNUNET_CRYPTO_RsaPrivateKey *privkey;
81 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pubkey;
82};
72 83
73 84
74/** 85/**
75 * Configuration handle. 86* Configuration handle.
76 */ 87*/
77const struct GNUNET_CONFIGURATION_Handle *GSN_cfg; 88const struct GNUNET_CONFIGURATION_Handle *GSN_cfg;
78 89
79static struct GNUNET_NAMESTORE_PluginFunctions *GSN_database; 90/**
91* Database handle
92*/
93struct GNUNET_NAMESTORE_PluginFunctions *GSN_database;
94
95/**
96* Zonefile directory
97*/
98static char *zonefile_directory;
99
100static char *db_lib_name;
101
80 102
81/** 103/**
82 * Our notification context. 104 * Our notification context.
83 */ 105 */
84static struct GNUNET_SERVER_NotificationContext *snc; 106static struct GNUNET_SERVER_NotificationContext *snc;
85 107
86static char *db_lib_name;
87
88static struct GNUNET_NAMESTORE_Client *client_head; 108static struct GNUNET_NAMESTORE_Client *client_head;
89static struct GNUNET_NAMESTORE_Client *client_tail; 109static struct GNUNET_NAMESTORE_Client *client_tail;
90 110
111struct GNUNET_NAMESTORE_CryptoContainer *c_head;
112struct GNUNET_NAMESTORE_CryptoContainer *c_tail;
113
114
115/**
116 * Write zonefile to disk
117 * @param file where to write
118 * @param ret the key
119 *
120 * @return GNUNET_OK on success, GNUNET_SYSERR on fail
121 */
122
123int write_key_to_file (const char *filename, struct GNUNET_NAMESTORE_CryptoContainer *c)
124{
125 struct GNUNET_CRYPTO_RsaPrivateKey *ret = c->privkey;
126 struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *enc;
127 struct GNUNET_DISK_FileHandle *fd;
128
129 if (GNUNET_YES == GNUNET_DISK_file_test (filename))
130 {
131 GNUNET_HashCode zone;
132 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
133 struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
134
135 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(filename);
136 if (privkey == NULL)
137 {
138 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
139 _("File zone `%s' but corrupt content already exists, failed to write! \n"), GNUNET_h2s (&zone));
140 return GNUNET_SYSERR;
141 }
142
143 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
144 GNUNET_CRYPTO_hash(&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone);
145 GNUNET_CRYPTO_rsa_key_free(privkey);
146
147 if (0 == memcmp (&zone, &c->zone, sizeof(zone)))
148 {
149 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
150 _("File zone `%s' containing this key already exists\n"), GNUNET_h2s (&zone));
151 return GNUNET_OK;
152 }
153 else
154 {
155 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
156 _("File zone `%s' but different zone key already exists, failed to write! \n"), GNUNET_h2s (&zone));
157 return GNUNET_OK;
158 }
159 }
160 fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_FAILIFEXISTS, GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
161 if (NULL == fd)
162 {
163 if (errno == EEXIST)
164 {
165 if (GNUNET_YES != GNUNET_DISK_file_test (filename))
166 {
167 /* must exist but not be accessible, fail for good! */
168 if (0 != ACCESS (filename, R_OK))
169 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "access", filename);
170 else
171 GNUNET_break (0); /* what is going on!? */
172 return GNUNET_SYSERR;
173 }
174 }
175 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "open", filename);
176 return GNUNET_SYSERR;
177 }
178
179 if (GNUNET_YES != GNUNET_DISK_file_lock (fd, 0, sizeof (struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded), GNUNET_YES))
180 return GNUNET_SYSERR;
181 enc = GNUNET_CRYPTO_rsa_encode_key (ret);
182 GNUNET_assert (enc != NULL);
183 GNUNET_assert (ntohs (enc->len) == GNUNET_DISK_file_write (fd, enc, ntohs (enc->len)));
184 GNUNET_free (enc);
185 GNUNET_DISK_file_sync (fd);
186 if (GNUNET_YES != GNUNET_DISK_file_unlock (fd, 0, sizeof (struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded)))
187 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename);
188 GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd));
189
190 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
191 _("Stored zonekey for zone `%s' in file `%s'\n"),GNUNET_h2s(&c->zone), c->filename);
192 return GNUNET_OK;
193}
194
91 195
92/** 196/**
93 * Task run during shutdown. 197 * Task run during shutdown.
@@ -99,15 +203,32 @@ static void
99cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 203cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
100{ 204{
101 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping namestore service\n"); 205 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping namestore service\n");
102
103 struct GNUNET_NAMESTORE_ZoneIteration * no; 206 struct GNUNET_NAMESTORE_ZoneIteration * no;
104 struct GNUNET_NAMESTORE_ZoneIteration * tmp; 207 struct GNUNET_NAMESTORE_ZoneIteration * tmp;
105 struct GNUNET_NAMESTORE_Client * nc; 208 struct GNUNET_NAMESTORE_Client * nc;
106 struct GNUNET_NAMESTORE_Client * next; 209 struct GNUNET_NAMESTORE_Client * next;
210 struct GNUNET_NAMESTORE_CryptoContainer *c;
107 211
108 GNUNET_SERVER_notification_context_destroy (snc); 212 GNUNET_SERVER_notification_context_destroy (snc);
109 snc = NULL; 213 snc = NULL;
110 214
215 for (c = c_head; c != NULL; c = c_head)
216 {
217 if (c->filename != NULL)
218 write_key_to_file(c->filename, c);
219 else
220 {
221 GNUNET_asprintf(&c->filename, "%s/%s.zone", zonefile_directory, GNUNET_h2s_full (&c->zone));
222 write_key_to_file(c->filename, c);
223 }
224
225 GNUNET_CONTAINER_DLL_remove(c_head, c_tail, c);
226 GNUNET_CRYPTO_rsa_key_free(c->privkey);
227 GNUNET_free (c->pubkey);
228 GNUNET_free(c->filename);
229 GNUNET_free (c);
230 }
231
111 for (nc = client_head; nc != NULL; nc = next) 232 for (nc = client_head; nc != NULL; nc = next)
112 { 233 {
113 next = nc->next; 234 next = nc->next;
@@ -125,6 +246,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
125 246
126 GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, GSN_database)); 247 GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, GSN_database));
127 GNUNET_free (db_lib_name); 248 GNUNET_free (db_lib_name);
249 GNUNET_free_non_null(zonefile_directory);
128} 250}
129 251
130static struct GNUNET_NAMESTORE_Client * 252static struct GNUNET_NAMESTORE_Client *
@@ -1403,6 +1525,30 @@ static void handle_iteration_next (void *cls,
1403 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1525 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1404} 1526}
1405 1527
1528int zonekey_file_it (void *cls, const char *filename)
1529{
1530 int *counter = cls;
1531 if ((filename != NULL) && (NULL != strstr(filename, ".zone")))
1532 {
1533 struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
1534 struct GNUNET_NAMESTORE_CryptoContainer *c;
1535 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(filename);
1536 if (privkey == NULL)
1537 return GNUNET_OK;
1538
1539 c = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer));
1540 c->pubkey = GNUNET_malloc(sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
1541 c->privkey = privkey;
1542 GNUNET_CRYPTO_rsa_key_get_public(privkey, c->pubkey);
1543 GNUNET_CRYPTO_hash(c->pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &c->zone);
1544
1545 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found zonefile for zone `%s'\n", GNUNET_h2s (&c->zone));
1546
1547 GNUNET_CONTAINER_DLL_insert(c_head, c_tail, c);
1548 (*counter) ++;
1549 }
1550 return GNUNET_OK;
1551}
1406 1552
1407 1553
1408/** 1554/**
@@ -1417,7 +1563,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1417 const struct GNUNET_CONFIGURATION_Handle *cfg) 1563 const struct GNUNET_CONFIGURATION_Handle *cfg)
1418{ 1564{
1419 char * database; 1565 char * database;
1420 1566 int counter = 0;
1421 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting namestore service\n"); 1567 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting namestore service\n");
1422 1568
1423 static const struct GNUNET_SERVER_MessageHandler handlers[] = { 1569 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
@@ -1444,6 +1590,31 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1444 1590
1445 GSN_cfg = cfg; 1591 GSN_cfg = cfg;
1446 1592
1593 /* Load private keys from disk */
1594 if (GNUNET_OK !=
1595 GNUNET_CONFIGURATION_get_value_filename (cfg, "namestore", "zonefile_directory",
1596 &zonefile_directory))
1597 {
1598 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("No directory to load zonefiles specified in configuration\n"));
1599 GNUNET_SCHEDULER_add_now (&cleanup_task, NULL);
1600 return;
1601 }
1602
1603 if (GNUNET_NO == GNUNET_DISK_file_test (zonefile_directory))
1604 {
1605 if (GNUNET_SYSERR == GNUNET_DISK_directory_create (zonefile_directory))
1606 {
1607 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Creating directory `%s' for zone files failed!\n"), zonefile_directory);
1608 GNUNET_SCHEDULER_add_now (&cleanup_task, NULL);
1609 return;
1610 }
1611 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created directory `%s' for zone files\n", zonefile_directory);
1612 }
1613
1614 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Scanning directory `%s' for zone files\n", zonefile_directory);
1615 GNUNET_DISK_directory_scan (zonefile_directory, zonekey_file_it, &counter);
1616 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u zone files\n", counter);
1617
1447 /* Loading database plugin */ 1618 /* Loading database plugin */
1448 if (GNUNET_OK != 1619 if (GNUNET_OK !=
1449 GNUNET_CONFIGURATION_get_value_string (cfg, "namestore", "database", 1620 GNUNET_CONFIGURATION_get_value_string (cfg, "namestore", "database",
@@ -1453,9 +1624,13 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1453 GNUNET_asprintf (&db_lib_name, "libgnunet_plugin_namestore_%s", database); 1624 GNUNET_asprintf (&db_lib_name, "libgnunet_plugin_namestore_%s", database);
1454 GSN_database = GNUNET_PLUGIN_load (db_lib_name, (void *) GSN_cfg); 1625 GSN_database = GNUNET_PLUGIN_load (db_lib_name, (void *) GSN_cfg);
1455 if (GSN_database == NULL) 1626 if (GSN_database == NULL)
1627 {
1456 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not load database backend `%s'\n", 1628 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not load database backend `%s'\n",
1457 db_lib_name); 1629 db_lib_name);
1458 GNUNET_free (database); 1630 GNUNET_free (database);
1631 GNUNET_SCHEDULER_add_now (&cleanup_task, NULL);
1632 return;
1633 }
1459 1634
1460 /* Configuring server handles */ 1635 /* Configuring server handles */
1461 GNUNET_SERVER_add_handlers (server, handlers); 1636 GNUNET_SERVER_add_handlers (server, handlers);
diff --git a/src/namestore/namestore.conf.in b/src/namestore/namestore.conf.in
index c9b9984e9..d93aea6cc 100644
--- a/src/namestore/namestore.conf.in
+++ b/src/namestore/namestore.conf.in
@@ -11,6 +11,7 @@ BINARY = gnunet-service-namestore
11ACCEPT_FROM = 127.0.0.1; 11ACCEPT_FROM = 127.0.0.1;
12ACCEPT_FROM6 = ::1; 12ACCEPT_FROM6 = ::1;
13DATABASE = sqlite 13DATABASE = sqlite
14ZONEFILE_DIRECTORY = $SERVICEHOME/namestore/zonefiles
14 15
15[namestore-sqlite] 16[namestore-sqlite]
16FILENAME = $SERVICEHOME/namestore/sqlite.db 17FILENAME = $SERVICEHOME/namestore/sqlite.db
diff --git a/src/namestore/test_namestore_api.c b/src/namestore/test_namestore_api.c
index 21e65af29..85ad50804 100644
--- a/src/namestore/test_namestore_api.c
+++ b/src/namestore/test_namestore_api.c
@@ -167,7 +167,11 @@ run (void *cls, char *const *args, const char *cfgfile,
167 delete_existing_db(cfg); 167 delete_existing_db(cfg);
168 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); 168 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL);
169 169
170 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 170 char *hostkey_file;
171 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
172 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
173 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
174 GNUNET_free (hostkey_file);
171 GNUNET_assert (privkey != NULL); 175 GNUNET_assert (privkey != NULL);
172 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 176 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
173 177
diff --git a/src/namestore/test_namestore_api.conf b/src/namestore/test_namestore_api.conf
index a1ddd10e4..eaeeae859 100644
--- a/src/namestore/test_namestore_api.conf
+++ b/src/namestore/test_namestore_api.conf
@@ -4,7 +4,7 @@ DEFAULTSERVICES = namestore
4UNIXPATH = /tmp/gnunet-p1-service-arm.sock 4UNIXPATH = /tmp/gnunet-p1-service-arm.sock
5 5
6[namestore] 6[namestore]
7#PREFIX = valgrind --leak-check=full --track-origins=yes 7PREFIX = valgrind --leak-check=full --track-origins=yes
8AUTOSTART = YES 8AUTOSTART = YES
9UNIXPATH = /tmp/gnunet-service-namestore.sock 9UNIXPATH = /tmp/gnunet-service-namestore.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
@@ -17,6 +17,7 @@ BINARY = gnunet-service-namestore
17ACCEPT_FROM = 127.0.0.1; 17ACCEPT_FROM = 127.0.0.1;
18ACCEPT_FROM6 = ::1; 18ACCEPT_FROM6 = ::1;
19DATABASE = sqlite 19DATABASE = sqlite
20ZONEFILE_DIRECTORY = zonefiles
20 21
21[namestore-sqlite] 22[namestore-sqlite]
22FILENAME = $SERVICEHOME/namestore/sqlite_test.db 23FILENAME = $SERVICEHOME/namestore/sqlite_test.db
diff --git a/src/namestore/test_namestore_api_create.c b/src/namestore/test_namestore_api_create.c
index a2e1366c8..1bda272e6 100644
--- a/src/namestore/test_namestore_api_create.c
+++ b/src/namestore/test_namestore_api_create.c
@@ -400,8 +400,11 @@ run (void *cls, char *const *args, const char *cfgfile,
400 size_t rd_ser_len; 400 size_t rd_ser_len;
401 401
402 /* load privat key */ 402 /* load privat key */
403 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 403 char *hostkey_file;
404 GNUNET_assert (privkey != NULL); 404 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
405 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
406 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
407 GNUNET_free (hostkey_file);
405 /* get public key */ 408 /* get public key */
406 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 409 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
407 410
diff --git a/src/namestore/test_namestore_api_create_update.c b/src/namestore/test_namestore_api_create_update.c
index ca2cde10c..4f8f6e05f 100644
--- a/src/namestore/test_namestore_api_create_update.c
+++ b/src/namestore/test_namestore_api_create_update.c
@@ -444,7 +444,12 @@ run (void *cls, char *const *args, const char *cfgfile,
444 size_t rd_ser_len; 444 size_t rd_ser_len;
445 445
446 /* load privat key */ 446 /* load privat key */
447 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 447 char *hostkey_file;
448 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
449 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
450 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
451 GNUNET_free (hostkey_file);
452
448 GNUNET_assert (privkey != NULL); 453 GNUNET_assert (privkey != NULL);
449 /* get public key */ 454 /* get public key */
450 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 455 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
diff --git a/src/namestore/test_namestore_api_lookup.c b/src/namestore/test_namestore_api_lookup.c
index 7d748447c..17477294a 100644
--- a/src/namestore/test_namestore_api_lookup.c
+++ b/src/namestore/test_namestore_api_lookup.c
@@ -256,7 +256,11 @@ run (void *cls, char *const *args, const char *cfgfile,
256 size_t rd_ser_len; 256 size_t rd_ser_len;
257 257
258 /* load privat key */ 258 /* load privat key */
259 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 259 char *hostkey_file;
260 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
261 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
262 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
263 GNUNET_free (hostkey_file);
260 GNUNET_assert (privkey != NULL); 264 GNUNET_assert (privkey != NULL);
261 /* get public key */ 265 /* get public key */
262 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 266 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
diff --git a/src/namestore/test_namestore_api_lookup_specific_type.c b/src/namestore/test_namestore_api_lookup_specific_type.c
index a74c602f2..3facec50f 100644
--- a/src/namestore/test_namestore_api_lookup_specific_type.c
+++ b/src/namestore/test_namestore_api_lookup_specific_type.c
@@ -324,7 +324,11 @@ run (void *cls, char *const *args, const char *cfgfile,
324 size_t rd_ser_len; 324 size_t rd_ser_len;
325 325
326 /* load privat key */ 326 /* load privat key */
327 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 327 char *hostkey_file;
328 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
329 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
330 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
331 GNUNET_free (hostkey_file);
328 GNUNET_assert (privkey != NULL); 332 GNUNET_assert (privkey != NULL);
329 /* get public key */ 333 /* get public key */
330 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 334 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
diff --git a/src/namestore/test_namestore_api_put.c b/src/namestore/test_namestore_api_put.c
index 2b01391ae..310c9a331 100644
--- a/src/namestore/test_namestore_api_put.c
+++ b/src/namestore/test_namestore_api_put.c
@@ -174,7 +174,12 @@ run (void *cls, char *const *args, const char *cfgfile,
174 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); 174 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL);
175 175
176 /* load privat key */ 176 /* load privat key */
177 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 177 char *hostkey_file;
178 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
180 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
181 GNUNET_free (hostkey_file);
182
178 GNUNET_assert (privkey != NULL); 183 GNUNET_assert (privkey != NULL);
179 /* get public key */ 184 /* get public key */
180 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 185 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c
index 78a5be56a..88c4771d1 100644
--- a/src/namestore/test_namestore_api_remove.c
+++ b/src/namestore/test_namestore_api_remove.c
@@ -288,7 +288,11 @@ run (void *cls, char *const *args, const char *cfgfile,
288 size_t rd_ser_len; 288 size_t rd_ser_len;
289 289
290 /* load privat key */ 290 /* load privat key */
291 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 291 char *hostkey_file;
292 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
293 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
294 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
295 GNUNET_free (hostkey_file);
292 GNUNET_assert (privkey != NULL); 296 GNUNET_assert (privkey != NULL);
293 /* get public key */ 297 /* get public key */
294 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 298 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c
index 4ee633598..431e7d1a5 100644
--- a/src/namestore/test_namestore_api_remove_not_existing_record.c
+++ b/src/namestore/test_namestore_api_remove_not_existing_record.c
@@ -222,7 +222,11 @@ run (void *cls, char *const *args, const char *cfgfile,
222 size_t rd_ser_len; 222 size_t rd_ser_len;
223 223
224 /* load privat key */ 224 /* load privat key */
225 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 225 char *hostkey_file;
226 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
227 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
228 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
229 GNUNET_free (hostkey_file);
226 GNUNET_assert (privkey != NULL); 230 GNUNET_assert (privkey != NULL);
227 /* get public key */ 231 /* get public key */
228 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 232 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
diff --git a/src/namestore/test_namestore_api_sign_verify.c b/src/namestore/test_namestore_api_sign_verify.c
index 084285ede..1fb479611 100644
--- a/src/namestore/test_namestore_api_sign_verify.c
+++ b/src/namestore/test_namestore_api_sign_verify.c
@@ -74,7 +74,11 @@ run (void *cls, char *const *args, const char *cfgfile,
74 struct GNUNET_CRYPTO_RsaSignature * signature; 74 struct GNUNET_CRYPTO_RsaSignature * signature;
75 75
76 /* load privat key */ 76 /* load privat key */
77 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 77 char *hostkey_file;
78 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
79 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
80 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
81 GNUNET_free (hostkey_file);
78 GNUNET_assert (privkey != NULL); 82 GNUNET_assert (privkey != NULL);
79 /* get public key */ 83 /* get public key */
80 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 84 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index 92e8e7988..f06411061 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -387,12 +387,21 @@ run (void *cls, char *const *args, const char *cfgfile,
387 delete_existing_db(cfg); 387 delete_existing_db(cfg);
388 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,&endbadly, NULL); 388 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,&endbadly, NULL);
389 389
390 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 390 char *hostkey_file;
391 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
392 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
393 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
394 GNUNET_free (hostkey_file);
391 GNUNET_assert (privkey != NULL); 395 GNUNET_assert (privkey != NULL);
392 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 396 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
393 GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone); 397 GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone);
394 398
395 privkey2 = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey2"); 399
400 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "KJI3AL00K91EDPFJF58DAJM7H61D189TLP70N56JL8SVDCJE1SJ3SNNBOQPPONTL37FMHPS39SMK2NMVC0GQMGA6QCMHITT78O8GF80.zone");
401 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
402 privkey2 = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
403 GNUNET_free (hostkey_file);
404
396 GNUNET_assert (privkey2 != NULL); 405 GNUNET_assert (privkey2 != NULL);
397 GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2); 406 GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2);
398 GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2); 407 GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2);
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index 7cdcea42a..4b0ce817f 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -368,12 +368,19 @@ run (void *cls, char *const *args, const char *cfgfile,
368 delete_existing_db(cfg); 368 delete_existing_db(cfg);
369 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,&endbadly, NULL); 369 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,&endbadly, NULL);
370 370
371 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 371 char *hostkey_file;
372 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
373 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
374 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
375 GNUNET_free (hostkey_file);
372 GNUNET_assert (privkey != NULL); 376 GNUNET_assert (privkey != NULL);
373 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 377 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
374 GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone); 378 GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone);
375 379
376 privkey2 = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey2"); 380 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "KJI3AL00K91EDPFJF58DAJM7H61D189TLP70N56JL8SVDCJE1SJ3SNNBOQPPONTL37FMHPS39SMK2NMVC0GQMGA6QCMHITT78O8GF80.zone");
381 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
382 privkey2 = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
383 GNUNET_free (hostkey_file);
377 GNUNET_assert (privkey2 != NULL); 384 GNUNET_assert (privkey2 != NULL);
378 GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2); 385 GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2);
379 GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2); 386 GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2);
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index 0c2fe0624..4093ff3bb 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -408,12 +408,19 @@ run (void *cls, char *const *args, const char *cfgfile,
408 delete_existing_db(cfg); 408 delete_existing_db(cfg);
409 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,&endbadly, NULL); 409 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,&endbadly, NULL);
410 410
411 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 411 char *hostkey_file;
412 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
413 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
414 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
415 GNUNET_free (hostkey_file);
412 GNUNET_assert (privkey != NULL); 416 GNUNET_assert (privkey != NULL);
413 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 417 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
414 GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone); 418 GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone);
415 419
416 privkey2 = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey2"); 420 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "KJI3AL00K91EDPFJF58DAJM7H61D189TLP70N56JL8SVDCJE1SJ3SNNBOQPPONTL37FMHPS39SMK2NMVC0GQMGA6QCMHITT78O8GF80.zone");
421 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
422 privkey2 = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
423 GNUNET_free (hostkey_file);
417 GNUNET_assert (privkey2 != NULL); 424 GNUNET_assert (privkey2 != NULL);
418 GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2); 425 GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2);
419 GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2); 426 GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2);
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c
index 0ed3b63c2..498b1197d 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -220,7 +220,11 @@ run (void *cls, char *const *args, const char *cfgfile,
220 220
221 221
222 /* load privat key */ 222 /* load privat key */
223 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); 223 char *hostkey_file;
224 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone");
225 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
226 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
227 GNUNET_free (hostkey_file);
224 GNUNET_assert (privkey != NULL); 228 GNUNET_assert (privkey != NULL);
225 /* get public key */ 229 /* get public key */
226 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 230 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
diff --git a/src/namestore/hostkey b/src/namestore/zonefiles/4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone
index eac1d1e2f..eac1d1e2f 100644
--- a/src/namestore/hostkey
+++ b/src/namestore/zonefiles/4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zone
Binary files differ
diff --git a/src/namestore/hostkey2 b/src/namestore/zonefiles/KJI3AL00K91EDPFJF58DAJM7H61D189TLP70N56JL8SVDCJE1SJ3SNNBOQPPONTL37FMHPS39SMK2NMVC0GQMGA6QCMHITT78O8GF80.zone
index 871fc90ed..871fc90ed 100644
--- a/src/namestore/hostkey2
+++ b/src/namestore/zonefiles/KJI3AL00K91EDPFJF58DAJM7H61D189TLP70N56JL8SVDCJE1SJ3SNNBOQPPONTL37FMHPS39SMK2NMVC0GQMGA6QCMHITT78O8GF80.zone
Binary files differ