aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-25 22:36:56 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-25 22:36:56 +0000
commitee0de607e52152c03a865559422dad4faacad53d (patch)
tree1a0c4beb6e5c311c4200dc736325485543ac944f /src
parentf5f5d0877b5598ff90ff9ebeaa5fa63da929f132 (diff)
downloadgnunet-ee0de607e52152c03a865559422dad4faacad53d.tar.gz
gnunet-ee0de607e52152c03a865559422dad4faacad53d.zip
trying to fix #2458, largely works
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_namestore_service.h3
-rw-r--r--src/namestore/gnunet-namestore.c2
-rw-r--r--src/namestore/gnunet-service-namestore.c7
-rw-r--r--src/namestore/namestore.conf.in11
-rw-r--r--src/namestore/namestore_api.c9
-rw-r--r--src/namestore/plugin_namestore_postgres.c25
-rw-r--r--src/namestore/test_namestore_api.c4
-rw-r--r--src/namestore/test_namestore_api.conf13
-rw-r--r--src/namestore/test_namestore_api_create.c4
-rw-r--r--src/namestore/test_namestore_api_create_update.c4
-rw-r--r--src/namestore/test_namestore_api_lookup.c4
-rw-r--r--src/namestore/test_namestore_api_lookup_specific_type.c4
-rw-r--r--src/namestore/test_namestore_api_put.c4
-rw-r--r--src/namestore/test_namestore_api_remove.c4
-rw-r--r--src/namestore/test_namestore_api_remove_not_existing_record.c4
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c4
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c4
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c4
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c4
-rw-r--r--src/namestore/test_plugin_namestore.c2
-rw-r--r--src/namestore/test_plugin_namestore_postgres.conf1
21 files changed, 64 insertions, 57 deletions
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index f8a830dd7..00c8ba26b 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -108,10 +108,9 @@ GNUNET_NAMESTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
108 * resources). 108 * resources).
109 * 109 *
110 * @param h handle to the namestore 110 * @param h handle to the namestore
111 * @param drop set to GNUNET_YES to delete all data in namestore (!)
112 */ 111 */
113void 112void
114GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h, int drop); 113GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h);
115 114
116 115
117/** 116/**
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index aa3af1a73..a79178aba 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -126,7 +126,7 @@ do_shutdown (void *cls,
126{ 126{
127 if (NULL != ns) 127 if (NULL != ns)
128 { 128 {
129 GNUNET_NAMESTORE_disconnect (ns, GNUNET_NO); 129 GNUNET_NAMESTORE_disconnect (ns);
130 ns = NULL; 130 ns = NULL;
131 } 131 }
132 if (NULL != zone_pkey) 132 if (NULL != zone_pkey)
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 257892bf9..740ab6e87 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -1949,7 +1949,12 @@ find_next_zone_iteration_result (struct ZoneIterationProcResult *proc)
1949 1949
1950 do 1950 do
1951 { 1951 {
1952 GSN_database->iterate_records (GSN_database->cls, zone , NULL, proc->zi->offset, &zone_iteraterate_proc, proc); 1952 if (GNUNET_SYSERR ==
1953 GSN_database->iterate_records (GSN_database->cls, zone, NULL, proc->zi->offset, &zone_iteraterate_proc, proc))
1954 {
1955 GNUNET_break (0);
1956 break;
1957 }
1953 proc->zi->offset++; 1958 proc->zi->offset++;
1954 } 1959 }
1955 while ((0 == proc->records_included) && (GNUNET_NO == proc->res_iteration_finished)); 1960 while ((0 == proc->records_included) && (GNUNET_NO == proc->res_iteration_finished));
diff --git a/src/namestore/namestore.conf.in b/src/namestore/namestore.conf.in
index d93aea6cc..ca6156fa3 100644
--- a/src/namestore/namestore.conf.in
+++ b/src/namestore/namestore.conf.in
@@ -18,14 +18,5 @@ FILENAME = $SERVICEHOME/namestore/sqlite.db
18 18
19[namestore-postgres] 19[namestore-postgres]
20CONFIG = connect_timeout=10; dbname=gnunet 20CONFIG = connect_timeout=10; dbname=gnunet
21 21TEMPORARY_TABLE = NO
22[namestore-mysql]
23DATABASE = gnunet
24CONFIG = ~/.my.cnf
25# USER = gnunet
26# PASSWORD =
27# HOST = localhost
28# PORT = 3306
29
30
31 22
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index 0f47750b3..6ea375942 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -1000,10 +1000,11 @@ GNUNET_NAMESTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
1000static void 1000static void
1001clean_up_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1001clean_up_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1002{ 1002{
1003 struct GNUNET_NAMESTORE_Handle *h = cls;
1003 struct PendingMessage *p; 1004 struct PendingMessage *p;
1004 struct GNUNET_NAMESTORE_QueueEntry *q; 1005 struct GNUNET_NAMESTORE_QueueEntry *q;
1005 struct GNUNET_NAMESTORE_ZoneIterator *z; 1006 struct GNUNET_NAMESTORE_ZoneIterator *z;
1006 struct GNUNET_NAMESTORE_Handle *h = cls; 1007
1007 GNUNET_assert (h != NULL); 1008 GNUNET_assert (h != NULL);
1008 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n"); 1009 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
1009 while (NULL != (p = h->pending_head)) 1010 while (NULL != (p = h->pending_head))
@@ -1011,19 +1012,16 @@ clean_up_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1011 GNUNET_CONTAINER_DLL_remove (h->pending_head, h->pending_tail, p); 1012 GNUNET_CONTAINER_DLL_remove (h->pending_head, h->pending_tail, p);
1012 GNUNET_free (p); 1013 GNUNET_free (p);
1013 } 1014 }
1014
1015 while (NULL != (q = h->op_head)) 1015 while (NULL != (q = h->op_head))
1016 { 1016 {
1017 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, q); 1017 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, q);
1018 GNUNET_free (q); 1018 GNUNET_free (q);
1019 } 1019 }
1020
1021 while (NULL != (z = h->z_head)) 1020 while (NULL != (z = h->z_head))
1022 { 1021 {
1023 GNUNET_CONTAINER_DLL_remove (h->z_head, h->z_tail, z); 1022 GNUNET_CONTAINER_DLL_remove (h->z_head, h->z_tail, z);
1024 GNUNET_free (z); 1023 GNUNET_free (z);
1025 } 1024 }
1026
1027 if (NULL != h->client) 1025 if (NULL != h->client)
1028 { 1026 {
1029 GNUNET_CLIENT_disconnect (h->client); 1027 GNUNET_CLIENT_disconnect (h->client);
@@ -1044,10 +1042,9 @@ clean_up_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1044 * resources). 1042 * resources).
1045 * 1043 *
1046 * @param h handle to the namestore 1044 * @param h handle to the namestore
1047 * @param drop set to GNUNET_YES to delete all data in namestore (!)
1048 */ 1045 */
1049void 1046void
1050GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h, int drop) 1047GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h)
1051{ 1048{
1052 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from namestore service\n"); 1049 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from namestore service\n");
1053 GNUNET_SCHEDULER_add_now (&clean_up_task, h); 1050 GNUNET_SCHEDULER_add_now (&clean_up_task, h);
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index 1daf0c7c1..0df6aa413 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -113,7 +113,28 @@ database_setup (struct Plugin *plugin)
113 "namestore-postgres"); 113 "namestore-postgres");
114 if (NULL == plugin->dbh) 114 if (NULL == plugin->dbh)
115 return GNUNET_SYSERR; 115 return GNUNET_SYSERR;
116 res = 116 if (GNUNET_YES ==
117 GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg,
118 "namestore-postgres",
119 "TEMPORARY_TABLE"))
120 {
121 res =
122 PQexec (plugin->dbh,
123 "CREATE TEMPORARY TABLE ns091records ("
124 " zone_key BYTEA NOT NULL DEFAULT '',"
125 " zone_delegation BYTEA NOT NULL DEFAULT '',"
126 " zone_hash BYTEA NOT NULL DEFAULT '',"
127 " record_count INTEGER NOT NULL DEFAULT 0,"
128 " record_data BYTEA NOT NULL DEFAULT '',"
129 " block_expiration_time BIGINT NOT NULL DEFAULT 0,"
130 " signature BYTEA NOT NULL DEFAULT '',"
131 " record_name TEXT NOT NULL DEFAULT '',"
132 " record_name_hash BYTEA NOT NULL DEFAULT '',"
133 " rvalue BIGINT NOT NULL DEFAULT 0"
134 ")" "WITH OIDS");
135 }
136 else
137 res =
117 PQexec (plugin->dbh, 138 PQexec (plugin->dbh,
118 "CREATE TABLE ns091records (" 139 "CREATE TABLE ns091records ("
119 " zone_key BYTEA NOT NULL DEFAULT ''," 140 " zone_key BYTEA NOT NULL DEFAULT '',"
@@ -127,6 +148,7 @@ database_setup (struct Plugin *plugin)
127 " record_name_hash BYTEA NOT NULL DEFAULT ''," 148 " record_name_hash BYTEA NOT NULL DEFAULT '',"
128 " rvalue BIGINT NOT NULL DEFAULT 0" 149 " rvalue BIGINT NOT NULL DEFAULT 0"
129 ")" "WITH OIDS"); 150 ")" "WITH OIDS");
151
130 if ((NULL == res) || ((PQresultStatus (res) != PGRES_COMMAND_OK) && (0 != strcmp ("42P07", /* duplicate table */ 152 if ((NULL == res) || ((PQresultStatus (res) != PGRES_COMMAND_OK) && (0 != strcmp ("42P07", /* duplicate table */
131 PQresultErrorField 153 PQresultErrorField
132 (res, 154 (res,
@@ -380,6 +402,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
380 LOG (GNUNET_ERROR_TYPE_DEBUG, 402 LOG (GNUNET_ERROR_TYPE_DEBUG,
381 "Ending iteration (no more results)\n"); 403 "Ending iteration (no more results)\n");
382 PQclear (res); 404 PQclear (res);
405 iter (iter_cls, NULL, GNUNET_TIME_UNIT_ZERO_ABS, NULL, 0, NULL, NULL);
383 return GNUNET_NO; 406 return GNUNET_NO;
384 } 407 }
385 GNUNET_assert (1 == cnt); 408 GNUNET_assert (1 == cnt);
diff --git a/src/namestore/test_namestore_api.c b/src/namestore/test_namestore_api.c
index 7fb52a2da..23c87d4f0 100644
--- a/src/namestore/test_namestore_api.c
+++ b/src/namestore/test_namestore_api.c
@@ -58,7 +58,7 @@ static void
58endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 58endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
59{ 59{
60 if (nsh != NULL) 60 if (nsh != NULL)
61 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 61 GNUNET_NAMESTORE_disconnect (nsh);
62 nsh = NULL; 62 nsh = NULL;
63 63
64 if (privkey != NULL) 64 if (privkey != NULL)
@@ -84,7 +84,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
84 84
85 if (nsh != NULL) 85 if (nsh != NULL)
86 { 86 {
87 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 87 GNUNET_NAMESTORE_disconnect (nsh);
88 nsh = NULL; 88 nsh = NULL;
89 } 89 }
90 res = 0; 90 res = 0;
diff --git a/src/namestore/test_namestore_api.conf b/src/namestore/test_namestore_api.conf
index 33e07a45c..697c9ef51 100644
--- a/src/namestore/test_namestore_api.conf
+++ b/src/namestore/test_namestore_api.conf
@@ -16,20 +16,13 @@ CONFIG = $DEFAULTCONFIG
16BINARY = gnunet-service-namestore 16BINARY = gnunet-service-namestore
17ACCEPT_FROM = 127.0.0.1; 17ACCEPT_FROM = 127.0.0.1;
18ACCEPT_FROM6 = ::1; 18ACCEPT_FROM6 = ::1;
19DATABASE = sqlite 19DATABASE = postgres
20ZONEFILE_DIRECTORY = zonefiles 20ZONEFILE_DIRECTORY = zonefiles
21 21
22[namestore-sqlite] 22[namestore-sqlite]
23FILENAME = $SERVICEHOME/namestore/sqlite_test.db 23FILENAME = $SERVICEHOME/namestore/sqlite_test.db
24 24
25[namestore-postgres] 25[namestore-postgres]
26CONFIG = connect_timeout=10; dbname=gnunet 26CONFIG = connect_timeout=10; dbname=gnunetcheck
27 27TEMPORARY_TABLE = YES
28[namestore-mysql]
29DATABASE = gnunet
30CONFIG = ~/.my.cnf
31# USER = gnunet
32# PASSWORD =
33# HOST = localhost
34# PORT = 3306
35 28
diff --git a/src/namestore/test_namestore_api_create.c b/src/namestore/test_namestore_api_create.c
index a9956c53e..9c794b235 100644
--- a/src/namestore/test_namestore_api_create.c
+++ b/src/namestore/test_namestore_api_create.c
@@ -79,7 +79,7 @@ static void
79endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 79endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
80{ 80{
81 if (nsh != NULL) 81 if (nsh != NULL)
82 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 82 GNUNET_NAMESTORE_disconnect (nsh);
83 nsh = NULL; 83 nsh = NULL;
84 if (privkey != NULL) 84 if (privkey != NULL)
85 GNUNET_CRYPTO_rsa_key_free (privkey); 85 GNUNET_CRYPTO_rsa_key_free (privkey);
@@ -103,7 +103,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
103 GNUNET_CRYPTO_rsa_key_free (privkey); 103 GNUNET_CRYPTO_rsa_key_free (privkey);
104 privkey = NULL; 104 privkey = NULL;
105 if (nsh != NULL) 105 if (nsh != NULL)
106 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 106 GNUNET_NAMESTORE_disconnect (nsh);
107 nsh = NULL; 107 nsh = NULL;
108} 108}
109 109
diff --git a/src/namestore/test_namestore_api_create_update.c b/src/namestore/test_namestore_api_create_update.c
index f3cc3917f..c7d79418a 100644
--- a/src/namestore/test_namestore_api_create_update.c
+++ b/src/namestore/test_namestore_api_create_update.c
@@ -77,7 +77,7 @@ static void
77endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 77endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
78{ 78{
79 if (nsh != NULL) 79 if (nsh != NULL)
80 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 80 GNUNET_NAMESTORE_disconnect (nsh);
81 nsh = NULL; 81 nsh = NULL;
82 if (privkey != NULL) 82 if (privkey != NULL)
83 GNUNET_CRYPTO_rsa_key_free (privkey); 83 GNUNET_CRYPTO_rsa_key_free (privkey);
@@ -101,7 +101,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
101 GNUNET_CRYPTO_rsa_key_free (privkey); 101 GNUNET_CRYPTO_rsa_key_free (privkey);
102 privkey = NULL; 102 privkey = NULL;
103 if (nsh != NULL) 103 if (nsh != NULL)
104 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 104 GNUNET_NAMESTORE_disconnect (nsh);
105 nsh = NULL; 105 nsh = NULL;
106} 106}
107 107
diff --git a/src/namestore/test_namestore_api_lookup.c b/src/namestore/test_namestore_api_lookup.c
index 84dc414c6..702fb2db1 100644
--- a/src/namestore/test_namestore_api_lookup.c
+++ b/src/namestore/test_namestore_api_lookup.c
@@ -70,7 +70,7 @@ static void
70endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 70endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
71{ 71{
72 if (nsh != NULL) 72 if (nsh != NULL)
73 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 73 GNUNET_NAMESTORE_disconnect (nsh);
74 nsh = NULL; 74 nsh = NULL;
75 if (privkey != NULL) 75 if (privkey != NULL)
76 GNUNET_CRYPTO_rsa_key_free (privkey); 76 GNUNET_CRYPTO_rsa_key_free (privkey);
@@ -96,7 +96,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
96 GNUNET_CRYPTO_rsa_key_free (privkey); 96 GNUNET_CRYPTO_rsa_key_free (privkey);
97 privkey = NULL; 97 privkey = NULL;
98 if (nsh != NULL) 98 if (nsh != NULL)
99 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 99 GNUNET_NAMESTORE_disconnect (nsh);
100 nsh = NULL; 100 nsh = NULL;
101} 101}
102 102
diff --git a/src/namestore/test_namestore_api_lookup_specific_type.c b/src/namestore/test_namestore_api_lookup_specific_type.c
index 45507fcc5..26f037b00 100644
--- a/src/namestore/test_namestore_api_lookup_specific_type.c
+++ b/src/namestore/test_namestore_api_lookup_specific_type.c
@@ -73,7 +73,7 @@ static void
73endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 73endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
74{ 74{
75 if (nsh != NULL) 75 if (nsh != NULL)
76 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 76 GNUNET_NAMESTORE_disconnect (nsh);
77 nsh = NULL; 77 nsh = NULL;
78 if (privkey != NULL) 78 if (privkey != NULL)
79 GNUNET_CRYPTO_rsa_key_free (privkey); 79 GNUNET_CRYPTO_rsa_key_free (privkey);
@@ -102,7 +102,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
102 GNUNET_CRYPTO_rsa_key_free (privkey); 102 GNUNET_CRYPTO_rsa_key_free (privkey);
103 privkey = NULL; 103 privkey = NULL;
104 if (nsh != NULL) 104 if (nsh != NULL)
105 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 105 GNUNET_NAMESTORE_disconnect (nsh);
106 nsh = NULL; 106 nsh = NULL;
107} 107}
108 108
diff --git a/src/namestore/test_namestore_api_put.c b/src/namestore/test_namestore_api_put.c
index 135b4a3e8..162026b2f 100644
--- a/src/namestore/test_namestore_api_put.c
+++ b/src/namestore/test_namestore_api_put.c
@@ -61,7 +61,7 @@ static void
61endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 61endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
62{ 62{
63 if (nsh != NULL) 63 if (nsh != NULL)
64 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 64 GNUNET_NAMESTORE_disconnect (nsh);
65 nsh = NULL; 65 nsh = NULL;
66 66
67 if (privkey != NULL) 67 if (privkey != NULL)
@@ -90,7 +90,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
90 } 90 }
91 if (nsh != NULL) 91 if (nsh != NULL)
92 { 92 {
93 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 93 GNUNET_NAMESTORE_disconnect (nsh);
94 nsh = NULL; 94 nsh = NULL;
95 } 95 }
96} 96}
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c
index f91085315..0ee4e44f7 100644
--- a/src/namestore/test_namestore_api_remove.c
+++ b/src/namestore/test_namestore_api_remove.c
@@ -74,7 +74,7 @@ static void
74endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 74endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
75{ 75{
76 if (nsh != NULL) 76 if (nsh != NULL)
77 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 77 GNUNET_NAMESTORE_disconnect (nsh);
78 nsh = NULL; 78 nsh = NULL;
79 if (privkey != NULL) 79 if (privkey != NULL)
80 GNUNET_CRYPTO_rsa_key_free (privkey); 80 GNUNET_CRYPTO_rsa_key_free (privkey);
@@ -100,7 +100,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
100 GNUNET_CRYPTO_rsa_key_free (privkey); 100 GNUNET_CRYPTO_rsa_key_free (privkey);
101 privkey = NULL; 101 privkey = NULL;
102 if (nsh != NULL) 102 if (nsh != NULL)
103 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 103 GNUNET_NAMESTORE_disconnect (nsh);
104 nsh = NULL; 104 nsh = NULL;
105} 105}
106 106
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 a18e342e1..9ca7afae7 100644
--- a/src/namestore/test_namestore_api_remove_not_existing_record.c
+++ b/src/namestore/test_namestore_api_remove_not_existing_record.c
@@ -74,7 +74,7 @@ static void
74endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 74endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
75{ 75{
76 if (nsh != NULL) 76 if (nsh != NULL)
77 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 77 GNUNET_NAMESTORE_disconnect (nsh);
78 nsh = NULL; 78 nsh = NULL;
79 if (privkey != NULL) 79 if (privkey != NULL)
80 GNUNET_CRYPTO_rsa_key_free (privkey); 80 GNUNET_CRYPTO_rsa_key_free (privkey);
@@ -101,7 +101,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
101 GNUNET_CRYPTO_rsa_key_free (privkey); 101 GNUNET_CRYPTO_rsa_key_free (privkey);
102 privkey = NULL; 102 privkey = NULL;
103 if (nsh != NULL) 103 if (nsh != NULL)
104 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 104 GNUNET_NAMESTORE_disconnect (nsh);
105 nsh = NULL; 105 nsh = NULL;
106} 106}
107 107
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index d018b74c5..5a8b12778 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -90,7 +90,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
90 } 90 }
91 91
92 if (nsh != NULL) 92 if (nsh != NULL)
93 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 93 GNUNET_NAMESTORE_disconnect (nsh);
94 nsh = NULL; 94 nsh = NULL;
95 95
96 GNUNET_free_non_null(sig_1); 96 GNUNET_free_non_null(sig_1);
@@ -172,7 +172,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
172 GNUNET_free (s_rd_3); 172 GNUNET_free (s_rd_3);
173 } 173 }
174 if (nsh != NULL) 174 if (nsh != NULL)
175 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 175 GNUNET_NAMESTORE_disconnect (nsh);
176 nsh = NULL; 176 nsh = NULL;
177} 177}
178 178
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 9ed3fde28..429636e4b 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -90,7 +90,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
90 } 90 }
91 91
92 if (nsh != NULL) 92 if (nsh != NULL)
93 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 93 GNUNET_NAMESTORE_disconnect (nsh);
94 nsh = NULL; 94 nsh = NULL;
95 GNUNET_free_non_null(sig_1); 95 GNUNET_free_non_null(sig_1);
96 GNUNET_free_non_null(sig_2); 96 GNUNET_free_non_null(sig_2);
@@ -167,7 +167,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
167 GNUNET_free (s_rd_3); 167 GNUNET_free (s_rd_3);
168 } 168 }
169 if (nsh != NULL) 169 if (nsh != NULL)
170 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 170 GNUNET_NAMESTORE_disconnect (nsh);
171 nsh = NULL; 171 nsh = NULL;
172} 172}
173 173
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index 732550acd..4974875d1 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -88,7 +88,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
88 stopiteration_task = GNUNET_SCHEDULER_NO_TASK; 88 stopiteration_task = GNUNET_SCHEDULER_NO_TASK;
89 } 89 }
90 if (nsh != NULL) 90 if (nsh != NULL)
91 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 91 GNUNET_NAMESTORE_disconnect (nsh);
92 nsh = NULL; 92 nsh = NULL;
93 GNUNET_free_non_null(sig_1); 93 GNUNET_free_non_null(sig_1);
94 GNUNET_free_non_null(sig_2); 94 GNUNET_free_non_null(sig_2);
@@ -165,7 +165,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
165 GNUNET_free (s_rd_3); 165 GNUNET_free (s_rd_3);
166 } 166 }
167 if (nsh != NULL) 167 if (nsh != NULL)
168 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 168 GNUNET_NAMESTORE_disconnect (nsh);
169 nsh = NULL; 169 nsh = NULL;
170 if (returned_records == 1) 170 if (returned_records == 1)
171 res = 0; 171 res = 0;
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c
index 9c2aebc36..0e29b8b33 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -70,7 +70,7 @@ static void
70endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 70endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
71{ 71{
72 if (nsh != NULL) 72 if (nsh != NULL)
73 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 73 GNUNET_NAMESTORE_disconnect (nsh);
74 nsh = NULL; 74 nsh = NULL;
75 if (privkey != NULL) 75 if (privkey != NULL)
76 GNUNET_CRYPTO_rsa_key_free (privkey); 76 GNUNET_CRYPTO_rsa_key_free (privkey);
@@ -91,7 +91,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
91 GNUNET_CRYPTO_rsa_key_free (privkey); 91 GNUNET_CRYPTO_rsa_key_free (privkey);
92 privkey = NULL; 92 privkey = NULL;
93 if (nsh != NULL) 93 if (nsh != NULL)
94 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 94 GNUNET_NAMESTORE_disconnect (nsh);
95 nsh = NULL; 95 nsh = NULL;
96} 96}
97 97
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c
index 0ff98b43b..45cce861f 100644
--- a/src/namestore/test_plugin_namestore.c
+++ b/src/namestore/test_plugin_namestore.c
@@ -187,9 +187,7 @@ run (void *cls, char *const *args, const char *cfgfile,
187 "Failed to initialize namestore. Database likely not setup, skipping test.\n"); 187 "Failed to initialize namestore. Database likely not setup, skipping test.\n");
188 return; 188 return;
189 } 189 }
190
191 put_record (nsp, 1); 190 put_record (nsp, 1);
192
193 get_record (nsp, 1); 191 get_record (nsp, 1);
194 192
195 memset (&zone_key, 1, sizeof (zone_key)); 193 memset (&zone_key, 1, sizeof (zone_key));
diff --git a/src/namestore/test_plugin_namestore_postgres.conf b/src/namestore/test_plugin_namestore_postgres.conf
index e2641eac2..6d91cddd7 100644
--- a/src/namestore/test_plugin_namestore_postgres.conf
+++ b/src/namestore/test_plugin_namestore_postgres.conf
@@ -1,2 +1,3 @@
1[datacache-postgres] 1[datacache-postgres]
2CONFIG = connect_timeout=10; dbname=gnunetcheck 2CONFIG = connect_timeout=10; dbname=gnunetcheck
3TEMPORARY_TABLE = YES