diff options
Diffstat (limited to 'src/namestore/plugin_namestore_postgres.c')
-rw-r--r-- | src/namestore/plugin_namestore_postgres.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c index 01dddde9e..bdbaf96b3 100644 --- a/src/namestore/plugin_namestore_postgres.c +++ b/src/namestore/plugin_namestore_postgres.c | |||
@@ -73,8 +73,7 @@ database_setup (struct Plugin *plugin) | |||
73 | " record_data BYTEA NOT NULL DEFAULT ''," | 73 | " record_data BYTEA NOT NULL DEFAULT ''," |
74 | " label TEXT NOT NULL DEFAULT ''," | 74 | " label TEXT NOT NULL DEFAULT ''," |
75 | " CONSTRAINT zl UNIQUE (zone_private_key,label)" | 75 | " CONSTRAINT zl UNIQUE (zone_private_key,label)" |
76 | ")" | 76 | ")"); |
77 | "WITH OIDS"); | ||
78 | struct GNUNET_PQ_ExecuteStatement es_default = | 77 | struct GNUNET_PQ_ExecuteStatement es_default = |
79 | GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns098records (" | 78 | GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns098records (" |
80 | " seq BIGSERIAL PRIMARY KEY," | 79 | " seq BIGSERIAL PRIMARY KEY," |
@@ -85,8 +84,7 @@ database_setup (struct Plugin *plugin) | |||
85 | " record_data BYTEA NOT NULL DEFAULT ''," | 84 | " record_data BYTEA NOT NULL DEFAULT ''," |
86 | " label TEXT NOT NULL DEFAULT ''," | 85 | " label TEXT NOT NULL DEFAULT ''," |
87 | " CONSTRAINT zl UNIQUE (zone_private_key,label)" | 86 | " CONSTRAINT zl UNIQUE (zone_private_key,label)" |
88 | ")" | 87 | ")"); |
89 | "WITH OIDS"); | ||
90 | const struct GNUNET_PQ_ExecuteStatement *cr; | 88 | const struct GNUNET_PQ_ExecuteStatement *cr; |
91 | struct GNUNET_PQ_ExecuteStatement sc = GNUNET_PQ_EXECUTE_STATEMENT_END; | 89 | struct GNUNET_PQ_ExecuteStatement sc = GNUNET_PQ_EXECUTE_STATEMENT_END; |
92 | 90 | ||
@@ -182,13 +180,13 @@ database_setup (struct Plugin *plugin) | |||
182 | static int | 180 | static int |
183 | namestore_postgres_store_records (void *cls, | 181 | namestore_postgres_store_records (void *cls, |
184 | const struct | 182 | const struct |
185 | GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 183 | GNUNET_IDENTITY_PrivateKey *zone_key, |
186 | const char *label, | 184 | const char *label, |
187 | unsigned int rd_count, | 185 | unsigned int rd_count, |
188 | const struct GNUNET_GNSRECORD_Data *rd) | 186 | const struct GNUNET_GNSRECORD_Data *rd) |
189 | { | 187 | { |
190 | struct Plugin *plugin = cls; | 188 | struct Plugin *plugin = cls; |
191 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 189 | struct GNUNET_IDENTITY_PublicKey pkey; |
192 | uint64_t rvalue; | 190 | uint64_t rvalue; |
193 | uint32_t rd_count32 = (uint32_t) rd_count; | 191 | uint32_t rd_count32 = (uint32_t) rd_count; |
194 | ssize_t data_size; | 192 | ssize_t data_size; |
@@ -197,13 +195,14 @@ namestore_postgres_store_records (void *cls, | |||
197 | 0, | 195 | 0, |
198 | sizeof(pkey)); | 196 | sizeof(pkey)); |
199 | for (unsigned int i = 0; i < rd_count; i++) | 197 | for (unsigned int i = 0; i < rd_count; i++) |
200 | if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) | 198 | if (GNUNET_YES == |
199 | GNUNET_GNSRECORD_is_zonekey_type (rd[i].record_type)) | ||
201 | { | 200 | { |
202 | GNUNET_break (sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) == | 201 | GNUNET_break (GNUNET_OK == |
203 | rd[i].data_size); | 202 | GNUNET_GNSRECORD_identity_from_data (rd[i].data, |
204 | GNUNET_memcpy (&pkey, | 203 | rd[i].data_size, |
205 | rd[i].data, | 204 | rd[i].record_type, |
206 | rd[i].data_size); | 205 | &pkey)); |
207 | break; | 206 | break; |
208 | } | 207 | } |
209 | rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 208 | rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
@@ -298,7 +297,7 @@ struct ParserContext | |||
298 | /** | 297 | /** |
299 | * Zone key, NULL if part of record. | 298 | * Zone key, NULL if part of record. |
300 | */ | 299 | */ |
301 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key; | 300 | const struct GNUNET_IDENTITY_PrivateKey *zone_key; |
302 | 301 | ||
303 | /** | 302 | /** |
304 | * Number of results still to return (counted down by | 303 | * Number of results still to return (counted down by |
@@ -332,7 +331,7 @@ parse_result_call_iterator (void *cls, | |||
332 | size_t data_size; | 331 | size_t data_size; |
333 | uint32_t record_count; | 332 | uint32_t record_count; |
334 | char *label; | 333 | char *label; |
335 | struct GNUNET_CRYPTO_EcdsaPrivateKey zk; | 334 | struct GNUNET_IDENTITY_PrivateKey zk; |
336 | struct GNUNET_PQ_ResultSpec rs_with_zone[] = { | 335 | struct GNUNET_PQ_ResultSpec rs_with_zone[] = { |
337 | GNUNET_PQ_result_spec_uint64 ("seq", &serial), | 336 | GNUNET_PQ_result_spec_uint64 ("seq", &serial), |
338 | GNUNET_PQ_result_spec_uint32 ("record_count", &record_count), | 337 | GNUNET_PQ_result_spec_uint32 ("record_count", &record_count), |
@@ -409,7 +408,7 @@ parse_result_call_iterator (void *cls, | |||
409 | static int | 408 | static int |
410 | namestore_postgres_lookup_records (void *cls, | 409 | namestore_postgres_lookup_records (void *cls, |
411 | const struct | 410 | const struct |
412 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 411 | GNUNET_IDENTITY_PrivateKey *zone, |
413 | const char *label, | 412 | const char *label, |
414 | GNUNET_NAMESTORE_RecordIterator iter, | 413 | GNUNET_NAMESTORE_RecordIterator iter, |
415 | void *iter_cls) | 414 | void *iter_cls) |
@@ -459,7 +458,7 @@ namestore_postgres_lookup_records (void *cls, | |||
459 | static int | 458 | static int |
460 | namestore_postgres_iterate_records (void *cls, | 459 | namestore_postgres_iterate_records (void *cls, |
461 | const struct | 460 | const struct |
462 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 461 | GNUNET_IDENTITY_PrivateKey *zone, |
463 | uint64_t serial, | 462 | uint64_t serial, |
464 | uint64_t limit, | 463 | uint64_t limit, |
465 | GNUNET_NAMESTORE_RecordIterator iter, | 464 | GNUNET_NAMESTORE_RecordIterator iter, |
@@ -526,9 +525,9 @@ namestore_postgres_iterate_records (void *cls, | |||
526 | static int | 525 | static int |
527 | namestore_postgres_zone_to_name (void *cls, | 526 | namestore_postgres_zone_to_name (void *cls, |
528 | const struct | 527 | const struct |
529 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 528 | GNUNET_IDENTITY_PrivateKey *zone, |
530 | const struct | 529 | const struct |
531 | GNUNET_CRYPTO_EcdsaPublicKey *value_zone, | 530 | GNUNET_IDENTITY_PublicKey *value_zone, |
532 | GNUNET_NAMESTORE_RecordIterator iter, | 531 | GNUNET_NAMESTORE_RecordIterator iter, |
533 | void *iter_cls) | 532 | void *iter_cls) |
534 | { | 533 | { |