diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-03-04 14:42:21 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-03-04 14:42:21 +0000 |
commit | 5de1a745cf9077a0c88d413f9aa1e85567ad3847 (patch) | |
tree | 37b2b9c101f91b054e5da9700064318ec624ada7 /src/gns/gnunet-gns-fcfsd.c | |
parent | cd76ea7b25ac497f523061874261af542bda6191 (diff) | |
download | gnunet-5de1a745cf9077a0c88d413f9aa1e85567ad3847.tar.gz gnunet-5de1a745cf9077a0c88d413f9aa1e85567ad3847.zip |
-finishing gnunet-gns-fcfsd
Diffstat (limited to 'src/gns/gnunet-gns-fcfsd.c')
-rw-r--r-- | src/gns/gnunet-gns-fcfsd.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/gns/gnunet-gns-fcfsd.c b/src/gns/gnunet-gns-fcfsd.c index 36b5c3fae..fcb229c69 100644 --- a/src/gns/gnunet-gns-fcfsd.c +++ b/src/gns/gnunet-gns-fcfsd.c | |||
@@ -23,7 +23,6 @@ | |||
23 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | * | 24 | * |
25 | * TODO: | 25 | * TODO: |
26 | * - actually parse uploaded public key and store it | ||
27 | * - the code currently contains a 'race' between checking that the | 26 | * - the code currently contains a 'race' between checking that the |
28 | * 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 |
29 | * (should this race be solved by namestore or by fcfsd?) | 28 | * (should this race be solved by namestore or by fcfsd?) |
@@ -369,7 +368,12 @@ lookup_result_processor (void *cls, | |||
369 | { | 368 | { |
370 | struct Request *request = cls; | 369 | struct Request *request = cls; |
371 | struct GNUNET_NAMESTORE_RecordData r; | 370 | struct GNUNET_NAMESTORE_RecordData r; |
372 | 371 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; | |
372 | |||
373 | GNUNET_assert (GNUNET_OK == | ||
374 | GNUNET_CRYPTO_rsa_public_key_from_string (request->public_key, | ||
375 | strlen (request->public_key), | ||
376 | &pub)); | ||
373 | request->qe = NULL; | 377 | request->qe = NULL; |
374 | if (0 != rd_count) | 378 | if (0 != rd_count) |
375 | { | 379 | { |
@@ -381,9 +385,9 @@ lookup_result_processor (void *cls, | |||
381 | run_httpd_now (); | 385 | run_httpd_now (); |
382 | return; | 386 | return; |
383 | } | 387 | } |
384 | r.data = "binary public key"; | 388 | r.data = &pub; |
389 | r.data_size = sizeof (pub); | ||
385 | r.expiration = GNUNET_TIME_UNIT_FOREVER_ABS; | 390 | r.expiration = GNUNET_TIME_UNIT_FOREVER_ABS; |
386 | r.data_size = sizeof ("binary public key"); | ||
387 | r.record_type = htonl (GNUNET_GNS_TYPE_PKEY); | 391 | r.record_type = htonl (GNUNET_GNS_TYPE_PKEY); |
388 | r.flags = htonl (GNUNET_NAMESTORE_RF_AUTHORITY); | 392 | r.flags = htonl (GNUNET_NAMESTORE_RF_AUTHORITY); |
389 | request->qe = GNUNET_NAMESTORE_record_create (ns, | 393 | request->qe = GNUNET_NAMESTORE_record_create (ns, |
@@ -431,6 +435,7 @@ create_response (void *cls, | |||
431 | struct MHD_Response *response; | 435 | struct MHD_Response *response; |
432 | struct Request *request; | 436 | struct Request *request; |
433 | int ret; | 437 | int ret; |
438 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; | ||
434 | 439 | ||
435 | if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) || | 440 | if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) || |
436 | (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) ) | 441 | (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) ) |
@@ -475,12 +480,15 @@ create_response (void *cls, | |||
475 | MHD_destroy_post_processor (request->pp); | 480 | MHD_destroy_post_processor (request->pp); |
476 | request->pp = NULL; | 481 | request->pp = NULL; |
477 | } | 482 | } |
478 | if (strlen (request->public_key) != 2) | 483 | if (GNUNET_OK != |
479 | { | 484 | GNUNET_CRYPTO_rsa_public_key_from_string (request->public_key, |
480 | /* parse error */ | 485 | strlen (request->public_key), |
481 | return fill_s_reply ("Failed to parse given public key", | 486 | &pub)) |
482 | request, connection); | 487 | { |
483 | } | 488 | /* parse error */ |
489 | return fill_s_reply ("Failed to parse given public key", | ||
490 | request, connection); | ||
491 | } | ||
484 | switch (request->phase) | 492 | switch (request->phase) |
485 | { | 493 | { |
486 | case RP_START: | 494 | case RP_START: |