aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/Makefile.am2
-rw-r--r--doc/man/gnunet-gns.111
-rw-r--r--doc/man/gnunet-namestore-fcfsd.1 (renamed from doc/man/gnunet-gns-fcfsd.1)6
-rw-r--r--src/gns/Makefile.am10
-rw-r--r--src/gns/gnunet-service-gns_resolver.c55
-rw-r--r--src/include/gnunet_namestore_service.h39
-rw-r--r--src/namestore/Makefile.am14
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c (renamed from src/gns/gnunet-gns-fcfsd.c)127
-rw-r--r--src/namestore/namestore_api.c20
-rw-r--r--src/namestore/namestore_api_common.c2
10 files changed, 145 insertions, 141 deletions
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index db26f0d6a..9e63bb243 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -13,10 +13,10 @@ man_MANS = \
13 gnunet-ecc.1 \ 13 gnunet-ecc.1 \
14 gnunet-fs.1 \ 14 gnunet-fs.1 \
15 gnunet-gns.1 \ 15 gnunet-gns.1 \
16 gnunet-gns-fcfsd.1 \
17 gnunet-gns-proxy.1 \ 16 gnunet-gns-proxy.1 \
18 gnunet-identity.1 \ 17 gnunet-identity.1 \
19 gnunet-namestore.1 \ 18 gnunet-namestore.1 \
19 gnunet-namestore-fcfsd.1 \
20 gnunet-nat-server.1 \ 20 gnunet-nat-server.1 \
21 gnunet-peerinfo.1 \ 21 gnunet-peerinfo.1 \
22 gnunet-pseudonym.1 \ 22 gnunet-pseudonym.1 \
diff --git a/doc/man/gnunet-gns.1 b/doc/man/gnunet-gns.1
index ef5a0f9bc..e5e2240b9 100644
--- a/doc/man/gnunet-gns.1
+++ b/doc/man/gnunet-gns.1
@@ -1,4 +1,4 @@
1.TH GNUNET\-GNS 1 "Aug 8, 2012" "GNUnet" 1.TH GNUNET\-GNS 1 "Aug 8, 2013" "GNUnet"
2 2
3.SH NAME 3.SH NAME
4gnunet\-gns \- Access to GNUnet Name Service 4gnunet\-gns \- Access to GNUnet Name Service
@@ -13,10 +13,6 @@ gnunet\-gns \- Access to GNUnet Name Service
13 13
14.SH OPTIONS 14.SH OPTIONS
15.B 15.B
16.IP "\-a NAME, \-\-authority=NAME"
17Get the authority of a particular name.
18For example the authority for "www.fcfs.gads" is "fcfs.gads".
19.B
20.IP "\-c FILENAME, \-\-config=FILENAME" 16.IP "\-c FILENAME, \-\-config=FILENAME"
21Use the configuration file FILENAME. 17Use the configuration file FILENAME.
22.B 18.B
@@ -26,11 +22,6 @@ This is a quiet mode where only important information is displayed.
26For example a lookup for an IP address will only yield the IP address, no 22For example a lookup for an IP address will only yield the IP address, no
27descriptive text. 23descriptive text.
28.B 24.B
29.IP "\-s NAME, \-\-shorten NAME"
30Shorten GNUnet Name Service Name.
31The service will try to shorten the delegation chain of the name if a "closer"
32authority chain exists relative to your local root zone.
33.B
34.IP "\-t RRTYPE, \-\-type=RRTYPE" 25.IP "\-t RRTYPE, \-\-type=RRTYPE"
35Resource Record Type (RRTYPE) to look for. 26Resource Record Type (RRTYPE) to look for.
36Supported RRTYPE's are: A, AAAA, CNAME, NS, PKEY, PSEU, TLSA, SRV, SOA, MX, LEHO, VPN, REV, PTR, TXT 27Supported RRTYPE's are: A, AAAA, CNAME, NS, PKEY, PSEU, TLSA, SRV, SOA, MX, LEHO, VPN, REV, PTR, TXT
diff --git a/doc/man/gnunet-gns-fcfsd.1 b/doc/man/gnunet-namestore-fcfsd.1
index fbd45e4a2..42b658018 100644
--- a/doc/man/gnunet-gns-fcfsd.1
+++ b/doc/man/gnunet-namestore-fcfsd.1
@@ -1,10 +1,10 @@
1.TH GNUNET\-GNS-FCFSD 1 "Oct 25, 2012" "GNUnet" 1.TH GNUNET\-NAMESTORE-FCFSD 1 "Oct 25, 2012" "GNUnet"
2 2
3.SH NAME 3.SH NAME
4gnunet\-gns-fcfsd \- HTTP server for GADS domain registration 4gnunet\-namestore-fcfsd \- HTTP server for GNS domain registration
5 5
6.SH SYNOPSIS 6.SH SYNOPSIS
7.B gnunet\-gns-fcfsd 7.B gnunet\-namestore-fcfsd
8.RI [ options ] 8.RI [ options ]
9.br 9.br
10 10
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 16bd6ca1c..e91014021 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -154,16 +154,6 @@ gnunet_service_gns_DEPENDENCIES = \
154 154
155 155
156 156
157gnunet_gns_fcfsd_SOURCES = \
158 gnunet-gns-fcfsd.c
159gnunet_gns_fcfsd_LDADD = -lmicrohttpd \
160 $(top_builddir)/src/util/libgnunetutil.la \
161 $(top_builddir)/src/namestore/libgnunetnamestore.la \
162 $(GN_LIBINTL)
163gnunet_gns_fcfsd_DEPENDENCIES = \
164 $(top_builddir)/src/util/libgnunetutil.la \
165 $(top_builddir)/src/namestore/libgnunetnamestore.la
166
167libw32nsp_la_SOURCES = \ 157libw32nsp_la_SOURCES = \
168 w32nsp.c 158 w32nsp.c
169libw32nsp_la_LIBADD = \ 159libw32nsp_la_LIBADD = \
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 8aa9e8188..de9e7e014 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -491,6 +491,7 @@ process_pseu_lookup_ns (void *cls,
491{ 491{
492 struct GetPseuAuthorityHandle *gph = cls; 492 struct GetPseuAuthorityHandle *gph = cls;
493 struct GNUNET_NAMESTORE_RecordData new_pkey; 493 struct GNUNET_NAMESTORE_RecordData new_pkey;
494 struct GNUNET_CRYPTO_EccPublicKey pub;
494 495
495 gph->namestore_task = NULL; 496 gph->namestore_task = NULL;
496 if (rd_count > 0) 497 if (rd_count > 0)
@@ -502,14 +503,19 @@ process_pseu_lookup_ns (void *cls,
502 time, this time not using PSEU but the original label */ 503 time, this time not using PSEU but the original label */
503 if (0 == strcmp (name, 504 if (0 == strcmp (name,
504 gph->label)) 505 gph->label))
506 {
505 free_get_pseu_authority_handle (gph); 507 free_get_pseu_authority_handle (gph);
508 }
506 else 509 else
510 {
511 GNUNET_CRYPTO_ecc_key_get_public (&gph->shorten_zone_key,
512 &pub);
507 gph->namestore_task = GNUNET_NAMESTORE_lookup (namestore_handle, 513 gph->namestore_task = GNUNET_NAMESTORE_lookup (namestore_handle,
508 &gph->shorten_zone_key, 514 &pub,
509 gph->label, 515 gph->label,
510 GNUNET_NAMESTORE_TYPE_ANY,
511 &process_pseu_lookup_ns, 516 &process_pseu_lookup_ns,
512 gph); 517 gph);
518 }
513 return; 519 return;
514 } 520 }
515 /* name is available */ 521 /* name is available */
@@ -543,6 +549,10 @@ static void
543process_pseu_result (struct GetPseuAuthorityHandle* gph, 549process_pseu_result (struct GetPseuAuthorityHandle* gph,
544 const char *pseu) 550 const char *pseu)
545{ 551{
552 struct GNUNET_CRYPTO_EccPublicKey pub;
553
554 GNUNET_CRYPTO_ecc_key_get_public (&gph->shorten_zone_key,
555 &pub);
546 if (NULL == pseu) 556 if (NULL == pseu)
547 { 557 {
548 /* no PSEU found, try original label */ 558 /* no PSEU found, try original label */
@@ -550,9 +560,8 @@ process_pseu_result (struct GetPseuAuthorityHandle* gph,
550 "No PSEU found, trying original label `%s' instead.\n", 560 "No PSEU found, trying original label `%s' instead.\n",
551 gph->label); 561 gph->label);
552 gph->namestore_task = GNUNET_NAMESTORE_lookup (namestore_handle, 562 gph->namestore_task = GNUNET_NAMESTORE_lookup (namestore_handle,
553 &gph->shorten_zone_key, 563 &pub,
554 gph->label, 564 gph->label,
555 GNUNET_NAMESTORE_TYPE_ANY,
556 &process_pseu_lookup_ns, 565 &process_pseu_lookup_ns,
557 gph); 566 gph);
558 return; 567 return;
@@ -560,9 +569,8 @@ process_pseu_result (struct GetPseuAuthorityHandle* gph,
560 569
561 /* check if 'pseu' is taken */ 570 /* check if 'pseu' is taken */
562 gph->namestore_task = GNUNET_NAMESTORE_lookup (namestore_handle, 571 gph->namestore_task = GNUNET_NAMESTORE_lookup (namestore_handle,
563 &gph->shorten_zone_key, 572 &pub,
564 pseu, 573 pseu,
565 GNUNET_NAMESTORE_TYPE_ANY,
566 &process_pseu_lookup_ns, 574 &process_pseu_lookup_ns,
567 gph); 575 gph);
568} 576}
@@ -1927,12 +1935,12 @@ process_delegation_result_dht (void* cls,
1927 1935
1928 1936
1929 /* Check for key revocation and delegate */ 1937 /* Check for key revocation and delegate */
1930 rh->namestore_task = GNUNET_NAMESTORE_lookup_record (namestore_handle, 1938 rh->namestore_task = GNUNET_NAMESTORE_lookup (namestore_handle,
1931 &rh->authority, 1939 &rh->authority,
1932 GNUNET_GNS_MASTERZONE_STR, 1940 GNUNET_GNS_MASTERZONE_STR,
1933 GNUNET_NAMESTORE_TYPE_REV, 1941 GNUNET_NAMESTORE_TYPE_REV,
1934 &process_pkey_revocation_result_ns, 1942 &process_pkey_revocation_result_ns,
1935 rh); 1943 rh);
1936 1944
1937 return; 1945 return;
1938 } 1946 }
@@ -2801,12 +2809,12 @@ process_delegation_result_ns (void* cls,
2801 memcpy ((void*)rh->rd.data, rd[i].data, rd[i].data_size); 2809 memcpy ((void*)rh->rd.data, rd[i].data, rd[i].data_size);
2802 rh->rd_count = 1; 2810 rh->rd_count = 1;
2803 /* Check for key revocation and delegate */ 2811 /* Check for key revocation and delegate */
2804 rh->namestore_task = GNUNET_NAMESTORE_lookup_record (namestore_handle, 2812 rh->namestore_task = GNUNET_NAMESTORE_lookup (namestore_handle,
2805 &rh->authority, 2813 &rh->authority,
2806 GNUNET_GNS_MASTERZONE_STR, 2814 GNUNET_GNS_MASTERZONE_STR,
2807 GNUNET_NAMESTORE_TYPE_REV, 2815 GNUNET_NAMESTORE_TYPE_REV,
2808 &process_pkey_revocation_result_ns, 2816 &process_pkey_revocation_result_ns,
2809 rh); 2817 rh);
2810 return; 2818 return;
2811 default: 2819 default:
2812 /* ignore, move to next result */ 2820 /* ignore, move to next result */
@@ -2867,12 +2875,11 @@ resolve_delegation_ns (struct ResolverHandle *rh)
2867 rh->name, 2875 rh->name,
2868 rh->authority_name, 2876 rh->authority_name,
2869 GNUNET_short_h2s (&rh->authority)); 2877 GNUNET_short_h2s (&rh->authority));
2870 rh->namestore_task = GNUNET_NAMESTORE_lookup_record (namestore_handle, 2878 rh->namestore_task = GNUNET_NAMESTORE_lookup (namestore_handle,
2871 &rh->authority, 2879 &rh->authority,
2872 rh->authority_name, 2880 rh->authority_name,
2873 GNUNET_DNSPARSER_TYPE_ANY, 2881 &process_delegation_result_ns,
2874 &process_delegation_result_ns, 2882 rh);
2875 rh);
2876} 2883}
2877 2884
2878#endif 2885#endif
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index 986e957ec..0fbbb0084 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -367,6 +367,34 @@ GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
367 367
368 368
369/** 369/**
370 * Process a records that were decrypted from a block.
371 *
372 * @param cls closure
373 * @param rd_count number of entries in @a rd array
374 * @param rd array of records with data to store
375 */
376typedef void (*GNUNET_NAMESTORE_RecordCallback) (void *cls,
377 unsigned int rd_count,
378 const struct GNUNET_NAMESTORE_RecordData *rd);
379
380
381/**
382 * Perform a lookup and decrypt the resulting block.
383 *
384 * @param h namestore to perform lookup in
385 * @param value_zone zone to look up record in
386 * @param label label to look for
387 * @param proc function to call with the result
388 * @param proc_cls closure for @a proc
389 */
390struct GNUNET_NAMESTORE_QueueEntry *
391GNUNET_NAMESTORE_lookup (struct GNUNET_NAMESTORE_Handle *h,
392 const struct GNUNET_CRYPTO_EccPublicKey *value_zone,
393 const char *label,
394 GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls);
395
396
397/**
370 * Cancel a namestore operation. The final callback from the 398 * Cancel a namestore operation. The final callback from the
371 * operation must not have been done yet. Must be called on any 399 * operation must not have been done yet. Must be called on any
372 * namestore operation that has not yet completed prior to calling 400 * namestore operation that has not yet completed prior to calling
@@ -656,17 +684,6 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block);
656 684
657 685
658/** 686/**
659 * Process a records that were decrypted from a block.
660 *
661 * @param cls closure
662 * @param rd_count number of entries in @a rd array
663 * @param rd array of records with data to store
664 */
665typedef void (*GNUNET_NAMESTORE_RecordCallback) (void *cls,
666 unsigned int rd_count,
667 const struct GNUNET_NAMESTORE_RecordData *rd);
668
669/**
670 * Decrypt block. 687 * Decrypt block.
671 * 688 *
672 * @param block block to decrypt 689 * @param block block to decrypt
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index 7c602ac13..b7ff99998 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -92,7 +92,8 @@ libexec_PROGRAMS = \
92 gnunet-service-namestore 92 gnunet-service-namestore
93 93
94bin_PROGRAMS = \ 94bin_PROGRAMS = \
95 gnunet-namestore 95 gnunet-namestore \
96 gnunet-namestore-fcfsd
96 97
97 98
98gnunet_namestore_SOURCES = \ 99gnunet_namestore_SOURCES = \
@@ -106,6 +107,17 @@ gnunet_namestore_DEPENDENCIES = \
106 libgnunetnamestore.la 107 libgnunetnamestore.la
107 108
108 109
110gnunet_namestore_fcfsd_SOURCES = \
111 gnunet-namestore-fcfsd.c
112gnunet_namestore_fcfsd_LDADD = -lmicrohttpd \
113 $(top_builddir)/src/util/libgnunetutil.la \
114 $(top_builddir)/src/namestore/libgnunetnamestore.la \
115 $(GN_LIBINTL)
116gnunet_namestore_fcfsd_DEPENDENCIES = \
117 $(top_builddir)/src/util/libgnunetutil.la \
118 $(top_builddir)/src/namestore/libgnunetnamestore.la
119
120
109 121
110gnunet_service_namestore_SOURCES = \ 122gnunet_service_namestore_SOURCES = \
111 gnunet-service-namestore.c 123 gnunet-service-namestore.c
diff --git a/src/gns/gnunet-gns-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index dd4572cb1..d949806db 100644
--- a/src/gns/gnunet-gns-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2012 Christian Grothoff (and other contributing authors) 3 (C) 2012-2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -27,12 +27,11 @@
27 * domain name is available and allocating it to the new public key 27 * domain name is available and allocating it to the new public key
28 * (should this race be solved by namestore or by fcfsd?) 28 * (should this race be solved by namestore or by fcfsd?)
29 * - nicer error reporting to browser 29 * - nicer error reporting to browser
30 * - figure out where this binary should go (is gns the right directory!?)
31 */ 30 */
32#include "platform.h" 31#include "platform.h"
33#include <gnunet_util_lib.h>
34#include <microhttpd.h> 32#include <microhttpd.h>
35#include <gnunet_namestore_service.h> 33#include "gnunet_util_lib.h"
34#include "gnunet_namestore_service.h"
36 35
37/** 36/**
38 * Invalid method page. 37 * Invalid method page.
@@ -141,7 +140,7 @@ struct Request
141 /** 140 /**
142 * Public key submitted via form. 141 * Public key submitted via form.
143 */ 142 */
144 char public_key[64]; 143 char public_key[128];
145 144
146}; 145};
147 146
@@ -192,11 +191,6 @@ static GNUNET_SCHEDULER_TaskIdentifier httpd_task;
192static struct GNUNET_NAMESTORE_Handle *ns; 191static struct GNUNET_NAMESTORE_Handle *ns;
193 192
194/** 193/**
195 * Hash of the public key of the fcfsd zone.
196 */
197static struct GNUNET_CRYPTO_ShortHashCode fcfsd_zone;
198
199/**
200 * Private key for the fcfsd zone. 194 * Private key for the fcfsd zone.
201 */ 195 */
202static struct GNUNET_CRYPTO_EccPrivateKey *fcfs_zone_pkey; 196static struct GNUNET_CRYPTO_EccPrivateKey *fcfs_zone_pkey;
@@ -227,14 +221,13 @@ run_httpd_now ()
227 httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd, NULL); 221 httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd, NULL);
228} 222}
229 223
224
230static void 225static void
231iterate_cb (void *cls, 226iterate_cb (void *cls,
232 const struct GNUNET_CRYPTO_EccPublicKey *zone_key, 227 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
233 struct GNUNET_TIME_Absolute expire, 228 const char *name,
234 const char *name, 229 unsigned int rd_len,
235 unsigned int rd_len, 230 const struct GNUNET_NAMESTORE_RecordData *rd)
236 const struct GNUNET_NAMESTORE_RecordData *rd,
237 const struct GNUNET_CRYPTO_EccSignature *signature)
238{ 231{
239 struct ZoneinfoRequest *zr = cls; 232 struct ZoneinfoRequest *zr = cls;
240 struct MHD_Response *response; 233 struct MHD_Response *response;
@@ -316,21 +309,15 @@ serve_zoneinfo_page (struct MHD_Connection *connection)
316{ 309{
317 struct ZoneinfoRequest *zr; 310 struct ZoneinfoRequest *zr;
318 311
319 zr = GNUNET_malloc (sizeof (struct ZoneinfoRequest)); 312 zr = GNUNET_new (struct ZoneinfoRequest);
320
321 zr->zoneinfo = GNUNET_malloc (DEFAULT_ZONEINFO_BUFSIZE); 313 zr->zoneinfo = GNUNET_malloc (DEFAULT_ZONEINFO_BUFSIZE);
322 zr->buf_len = DEFAULT_ZONEINFO_BUFSIZE; 314 zr->buf_len = DEFAULT_ZONEINFO_BUFSIZE;
323 zr->connection = connection; 315 zr->connection = connection;
324 zr->write_offset = 0; 316 zr->write_offset = 0;
325
326 printf ("adsadad1!\n");
327 zr->list_it = GNUNET_NAMESTORE_zone_iteration_start (ns, 317 zr->list_it = GNUNET_NAMESTORE_zone_iteration_start (ns,
328 &fcfsd_zone, 318 fcfs_zone_pkey,
329 GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION, 319 &iterate_cb,
330 GNUNET_NAMESTORE_RF_PRIVATE, 320 zr);
331 &iterate_cb,
332 zr);
333
334 return MHD_YES; 321 return MHD_YES;
335} 322}
336 323
@@ -493,25 +480,16 @@ put_continuation (void *cls,
493 * 480 *
494 * @param cls closure 481 * @param cls closure
495 * @param zone_key public key of the zone 482 * @param zone_key public key of the zone
496 * @param expire when does the corresponding block in the DHT expire (until
497 * when should we never do a DHT lookup for the same name again)?;
498 * GNUNET_TIME_UNIT_ZERO_ABS if there are no records of any type in the namestore,
499 * or the expiration time of the block in the namestore (even if there are zero
500 * records matching the desired record type)
501 * @param name name that is being mapped (at most 255 characters long) 483 * @param name name that is being mapped (at most 255 characters long)
502 * @param rd_count number of entries in 'rd' array 484 * @param rd_count number of entries in 'rd' array
503 * @param rd array of records with data to store 485 * @param rd array of records with data to store
504 * @param signature signature of the record block, NULL if signature is unavailable (i.e.
505 * because the user queried for a particular record type only)
506 */ 486 */
507static void 487static void
508zone_to_name_cb (void *cls, 488zone_to_name_cb (void *cls,
509 const struct GNUNET_CRYPTO_EccPublicKey *zone_key, 489 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
510 struct GNUNET_TIME_Absolute expire,
511 const char *name, 490 const char *name,
512 unsigned int rd_count, 491 unsigned int rd_count,
513 const struct GNUNET_NAMESTORE_RecordData *rd, 492 const struct GNUNET_NAMESTORE_RecordData *rd)
514 const struct GNUNET_CRYPTO_EccSignature *signature)
515{ 493{
516 struct Request *request = cls; 494 struct Request *request = cls;
517 struct GNUNET_NAMESTORE_RecordData r; 495 struct GNUNET_NAMESTORE_RecordData r;
@@ -527,22 +505,17 @@ zone_to_name_cb (void *cls,
527 run_httpd_now (); 505 run_httpd_now ();
528 return; 506 return;
529 } 507 }
530 GNUNET_assert (GNUNET_OK ==
531 GNUNET_CRYPTO_short_hash_from_string2 (request->public_key,
532 strlen (request->public_key),
533 &pub));
534 r.data = &pub; 508 r.data = &pub;
535 r.data_size = sizeof (pub); 509 r.data_size = sizeof (pub);
536 r.expiration_time = UINT64_MAX; 510 r.expiration_time = UINT64_MAX;
537 r.record_type = GNUNET_NAMESTORE_TYPE_PKEY; 511 r.record_type = GNUNET_NAMESTORE_TYPE_PKEY;
538 r.flags = GNUNET_NAMESTORE_RF_AUTHORITY; 512 r.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
539 request->qe = GNUNET_NAMESTORE_record_put_by_authority (ns, 513 request->qe = GNUNET_NAMESTORE_records_store (ns,
540 fcfs_zone_pkey, 514 fcfs_zone_pkey,
541 request->domain_name, 515 request->domain_name,
542 1, 516 1, &r,
543 &r, 517 &put_continuation,
544 &put_continuation, 518 request);
545 request);
546} 519}
547 520
548 521
@@ -552,35 +525,22 @@ zone_to_name_cb (void *cls,
552 * proceed to check if the requested key already exists. 525 * proceed to check if the requested key already exists.
553 * 526 *
554 * @param cls closure 527 * @param cls closure
555 * @param zone_key public key of the zone 528 * @param zone_key private key of the zone
556 * @param expire when does the corresponding block in the DHT expire (until
557 * when should we never do a DHT lookup for the same name again)?;
558 * GNUNET_TIME_UNIT_ZERO_ABS if there are no records of any type in the namestore,
559 * or the expiration time of the block in the namestore (even if there are zero
560 * records matching the desired record type)
561 * @param name name that is being mapped (at most 255 characters long) 529 * @param name name that is being mapped (at most 255 characters long)
562 * @param rd_count number of entries in 'rd' array 530 * @param rd_count number of entries in 'rd' array
563 * @param rd array of records with data to store 531 * @param rd array of records with data to store
564 * @param signature signature of the record block, NULL if signature is unavailable (i.e.
565 * because the user queried for a particular record type only)
566 */ 532 */
567static void 533static void
568lookup_result_processor (void *cls, 534lookup_result_processor (void *cls,
569 const struct GNUNET_CRYPTO_EccPublicKey *zone_key, 535 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
570 struct GNUNET_TIME_Absolute expire,
571 const char *name, 536 const char *name,
572 unsigned int rd_count, 537 unsigned int rd_count,
573 const struct GNUNET_NAMESTORE_RecordData *rd, 538 const struct GNUNET_NAMESTORE_RecordData *rd)
574 const struct GNUNET_CRYPTO_EccSignature *signature)
575{ 539{
576 struct Request *request = cls; 540 struct Request *request = cls;
577 struct GNUNET_CRYPTO_ShortHashCode pub; 541 struct GNUNET_CRYPTO_EccPublicKey pub;
578 542
579 request->qe = NULL; 543 request->qe = NULL;
580 GNUNET_assert (GNUNET_OK ==
581 GNUNET_CRYPTO_short_hash_from_string2 (request->public_key,
582 strlen (request->public_key),
583 &pub));
584 if (0 != rd_count) 544 if (0 != rd_count)
585 { 545 {
586 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 546 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -591,8 +551,18 @@ lookup_result_processor (void *cls,
591 run_httpd_now (); 551 run_httpd_now ();
592 return; 552 return;
593 } 553 }
554 if (GNUNET_OK !=
555 GNUNET_CRYPTO_ecc_public_key_from_string (request->public_key,
556 strlen (request->public_key),
557 &pub))
558 {
559 GNUNET_break (0);
560 request->phase = RP_FAIL;
561 run_httpd_now ();
562 return;
563 }
594 request->qe = GNUNET_NAMESTORE_zone_to_name (ns, 564 request->qe = GNUNET_NAMESTORE_zone_to_name (ns,
595 &fcfsd_zone, 565 fcfs_zone_pkey,
596 &pub, 566 &pub,
597 &zone_to_name_cb, 567 &zone_to_name_cb,
598 request); 568 request);
@@ -635,7 +605,7 @@ create_response (void *cls,
635 struct MHD_Response *response; 605 struct MHD_Response *response;
636 struct Request *request; 606 struct Request *request;
637 int ret; 607 int ret;
638 struct GNUNET_CRYPTO_ShortHashCode pub; 608 struct GNUNET_CRYPTO_EccPublicKey pub;
639 609
640 if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) || 610 if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) ||
641 (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) ) 611 (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) )
@@ -684,9 +654,9 @@ create_response (void *cls,
684 request->pp = NULL; 654 request->pp = NULL;
685 } 655 }
686 if (GNUNET_OK != 656 if (GNUNET_OK !=
687 GNUNET_CRYPTO_short_hash_from_string2 (request->public_key, 657 GNUNET_CRYPTO_ecc_public_key_from_string (request->public_key,
688 strlen (request->public_key), 658 strlen (request->public_key),
689 &pub)) 659 &pub))
690 { 660 {
691 /* parse error */ 661 /* parse error */
692 return fill_s_reply ("Failed to parse given public key", 662 return fill_s_reply ("Failed to parse given public key",
@@ -712,12 +682,13 @@ create_response (void *cls,
712 request, connection); 682 request, connection);
713 } 683 }
714 request->phase = RP_LOOKUP; 684 request->phase = RP_LOOKUP;
715 request->qe = GNUNET_NAMESTORE_lookup_record (ns, 685 GNUNET_CRYPTO_ecc_key_get_public (fcfs_zone_pkey,
716 &fcfsd_zone, 686 &pub);
717 request->domain_name, 687 request->qe = GNUNET_NAMESTORE_lookup (ns,
718 GNUNET_NAMESTORE_TYPE_PKEY, 688 &pub,
719 &lookup_result_processor, 689 request->domain_name,
720 request); 690 &lookup_result_processor,
691 request);
721 break; 692 break;
722 case RP_LOOKUP: 693 case RP_LOOKUP:
723 break; 694 break;
@@ -883,7 +854,6 @@ run (void *cls, char *const *args, const char *cfgfile,
883{ 854{
884 char *keyfile; 855 char *keyfile;
885 unsigned long long port; 856 unsigned long long port;
886 struct GNUNET_CRYPTO_EccPublicKey pub;
887 857
888 if (GNUNET_OK != 858 if (GNUNET_OK !=
889 GNUNET_CONFIGURATION_get_value_number (cfg, 859 GNUNET_CONFIGURATION_get_value_number (cfg,
@@ -913,9 +883,6 @@ run (void *cls, char *const *args, const char *cfgfile,
913 _("Failed to read or create private zone key\n")); 883 _("Failed to read or create private zone key\n"));
914 return; 884 return;
915 } 885 }
916 GNUNET_CRYPTO_ecc_key_get_public (fcfs_zone_pkey,
917 &pub);
918 GNUNET_CRYPTO_short_hash (&pub, sizeof (pub), &fcfsd_zone);
919 ns = GNUNET_NAMESTORE_connect (cfg); 886 ns = GNUNET_NAMESTORE_connect (cfg);
920 if (NULL == ns) 887 if (NULL == ns)
921 { 888 {
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index 98148ba1e..13cc32035 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -1132,6 +1132,26 @@ GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h,
1132 1132
1133 1133
1134/** 1134/**
1135 * Perform a lookup and decrypt the resulting block.
1136 *
1137 * @param h namestore to perform lookup in
1138 * @param value_zone zone to look up record in
1139 * @param label label to look for
1140 * @param proc function to call with the result
1141 * @param proc_cls closure for @a proc
1142 */
1143struct GNUNET_NAMESTORE_QueueEntry *
1144GNUNET_NAMESTORE_lookup (struct GNUNET_NAMESTORE_Handle *h,
1145 const struct GNUNET_CRYPTO_EccPublicKey *value_zone,
1146 const char *label,
1147 GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls)
1148{
1149 GNUNET_break (0); // FIXME: not implemented
1150 return NULL;
1151}
1152
1153
1154/**
1135 * Look for an existing PKEY delegation record for a given public key. 1155 * Look for an existing PKEY delegation record for a given public key.
1136 * Returns at most one result to the processor. 1156 * Returns at most one result to the processor.
1137 * 1157 *
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c
index 5a27f14a1..bfab39384 100644
--- a/src/namestore/namestore_api_common.c
+++ b/src/namestore/namestore_api_common.c
@@ -364,7 +364,7 @@ int
364GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, 364GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
365 const struct GNUNET_CRYPTO_EccPublicKey *zone_key, 365 const struct GNUNET_CRYPTO_EccPublicKey *zone_key,
366 const char *label, 366 const char *label,
367 GNUNET_NAMESTORE_RecordMonitor proc, 367 GNUNET_NAMESTORE_RecordCallback proc,
368 void *proc_cls) 368 void *proc_cls)
369{ 369{
370 GNUNET_break (0); 370 GNUNET_break (0);