From 64d3e46cfb99a711e500fa1f114e7c44bdf10040 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 26 Oct 2012 22:13:01 +0000 Subject: -bugfixes, code cleanup --- src/gns/gns.conf.in | 2 +- src/gns/gns.h | 33 ++- src/gns/gns_api.c | 40 +-- src/gns/gnunet-gns-proxy.c | 118 +++------ src/gns/gnunet-gns.c | 84 +++++-- src/gns/gnunet-service-gns.c | 387 +++++++++++++---------------- src/gns/gnunet-service-gns_interceptor.c | 134 +++++------ src/gns/gnunet-service-gns_interceptor.h | 34 ++- src/gns/gnunet-service-gns_resolver.c | 6 +- src/gns/gnunet-service-gns_resolver.h | 402 ++++++++++++++++++++++--------- src/gns/plugin_block_gns.c | 27 ++- src/gns/proxy/gnunet-gns-proxy.py | 226 ----------------- src/gns/proxy/test_cert.pem | 51 ---- 13 files changed, 722 insertions(+), 822 deletions(-) delete mode 100644 src/gns/proxy/gnunet-gns-proxy.py delete mode 100644 src/gns/proxy/test_cert.pem (limited to 'src/gns') diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in index 303fbf90b..9746c07af 100644 --- a/src/gns/gns.conf.in +++ b/src/gns/gns.conf.in @@ -12,7 +12,7 @@ HIJACK_DNS = NO AUTO_IMPORT_PKEY = YES AUTO_IMPORT_CONFIRMATION_REQ = NO MAX_PARALLEL_BACKGROUND_QUERIES = 25 -DEFAULT_LOOKUP_TIMEOUT = 10 +DEFAULT_LOOKUP_TIMEOUT = 10 s ZONE_PUBLISH_TIME_WINDOW = 4 h # PREFIX = valgrind --leak-check=full --track-origins=yes diff --git a/src/gns/gns.h b/src/gns/gns.h index 2f4ce3928..10119800d 100644 --- a/src/gns/gns.h +++ b/src/gns/gns.h @@ -27,14 +27,32 @@ #include "gnunet_gns_service.h" +/** + * Name of the GADS TLD. + */ #define GNUNET_GNS_TLD "gads" + +/** + * Name of the zone key TLD. + */ #define GNUNET_GNS_TLD_ZKEY "zkey" + +/** + * TLD name used to indicate relative names. + */ #define GNUNET_GNS_TLD_PLUS "+" -#define GNUNET_GNS_DHT_MAX_UPDATE_INTERVAL 3600 +/** + * Maximum length of a label in DNS. + */ #define MAX_DNS_LABEL_LENGTH 63 + +/** + * Maximum length of a name in DNS. + */ #define MAX_DNS_NAME_LENGTH 253 + GNUNET_NETWORK_STRUCT_BEGIN /** @@ -43,7 +61,7 @@ GNUNET_NETWORK_STRUCT_BEGIN struct GNUNET_GNS_ClientLookupMessage { /** - * Header of type GNUNET_MESSAGE_TYPE_GNS_CLIENT_LOOKUP + * Header of type GNUNET_MESSAGE_TYPE_GNS_CLIENT_LOOKUP */ struct GNUNET_MessageHeader header; @@ -107,13 +125,14 @@ struct GNUNET_GNS_ClientLookupResultMessage }; + /** * Message from client to GNS service to shorten names. */ struct GNUNET_GNS_ClientShortenMessage { /** - * Header of type GNUNET_MESSAGE_TYPE_GNS_CLIENT_SHORTEN + * Header of type GNUNET_MESSAGE_TYPE_GNS_CLIENT_SHORTEN */ struct GNUNET_MessageHeader header; @@ -152,7 +171,7 @@ struct GNUNET_GNS_ClientShortenMessage struct GNUNET_GNS_ClientShortenResultMessage { /** - * Header of type GNUNET_MESSAGE_TYPE_GNS_CLIENT_SHORTEN_RESULT + * Header of type GNUNET_MESSAGE_TYPE_GNS_CLIENT_SHORTEN_RESULT */ struct GNUNET_MessageHeader header; @@ -165,13 +184,14 @@ struct GNUNET_GNS_ClientShortenResultMessage }; + /** * Message from client to GNS service to lookup an authority of a name. */ struct GNUNET_GNS_ClientGetAuthMessage { /** - * Header of type GNUNET_MESSAGE_TYPE_GNS_CLIENT_GET_AUTH + * Header of type GNUNET_MESSAGE_TYPE_GNS_CLIENT_GET_AUTH */ struct GNUNET_MessageHeader header; @@ -190,7 +210,7 @@ struct GNUNET_GNS_ClientGetAuthMessage struct GNUNET_GNS_ClientGetAuthResultMessage { /** - * Header of type GNUNET_MESSAGE_TYPE_GNS_CLIENT_GET_AUTH_RESULT + * Header of type GNUNET_MESSAGE_TYPE_GNS_CLIENT_GET_AUTH_RESULT */ struct GNUNET_MessageHeader header; @@ -202,6 +222,7 @@ struct GNUNET_GNS_ClientGetAuthResultMessage /* followed by the authority part of the name or '\0' for no result*/ }; + GNUNET_NETWORK_STRUCT_END #endif diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index fef7b866d..b3173a554 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c @@ -68,7 +68,7 @@ struct GNUNET_GNS_LookupRequest /** * request id */ - uint64_t r_id; + uint32_t r_id; }; @@ -106,7 +106,7 @@ struct GNUNET_GNS_ShortenRequest /** * request id */ - uint64_t r_id; + uint32_t r_id; }; @@ -165,14 +165,14 @@ struct PendingMessage struct PendingMessage *next; /** - * request id + * Size of the message. */ - uint64_t r_id; + size_t size; /** - * Size of the message. + * request id */ - size_t size; + uint32_t r_id; /** * This message has been transmitted. GNUNET_NO if the message is @@ -249,8 +249,16 @@ struct GNUNET_GNS_Handle * Reconnect task */ GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + + /** + * How long do we wait until we try to reconnect? + */ + struct GNUNET_TIME_Relative reconnect_backoff; - uint32_t r_id; + /** + * Request Id generator. Incremented by one for each request. + */ + uint32_t r_id_gen; /** * Did we start our receive loop yet? @@ -319,7 +327,7 @@ force_reconnect (struct GNUNET_GNS_Handle *h) h->in_receive = GNUNET_NO; for (st = h->shorten_head; NULL != st; st = st->next) { - p = (struct PendingMessage*) &st[1]; + p = (struct PendingMessage *) &st[1]; if (GNUNET_NO == p->transmitted) continue; p->transmitted = GNUNET_NO; @@ -329,7 +337,7 @@ force_reconnect (struct GNUNET_GNS_Handle *h) } for (lh = h->lookup_head; NULL != lh; lh = lh->next) { - p = (struct PendingMessage*) &lh[1]; + p = (struct PendingMessage *) &lh[1]; if (GNUNET_NO == p->transmitted) continue; p->transmitted = GNUNET_NO; @@ -339,7 +347,7 @@ force_reconnect (struct GNUNET_GNS_Handle *h) } for (ga = h->get_auth_head; NULL != ga; ga = ga->next) { - p = (struct PendingMessage*) &ga[1]; + p = (struct PendingMessage *) &ga[1]; if (GNUNET_NO == p->transmitted) continue; p->transmitted = GNUNET_NO; @@ -347,8 +355,8 @@ force_reconnect (struct GNUNET_GNS_Handle *h) h->pending_tail, p); } - /* FIXME: 1s too long, exponential-backoff, starting at 1ms! (max = 1s might be OK) */ - h->reconnect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, + h->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (h->reconnect_backoff); + h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_backoff, &reconnect_task, h); } @@ -618,7 +626,7 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg) const struct GNUNET_GNS_ClientLookupResultMessage *lookup_msg; const struct GNUNET_GNS_ClientShortenResultMessage *shorten_msg; const struct GNUNET_GNS_ClientGetAuthResultMessage *get_auth_msg; - uint64_t r_id; + uint32_t r_id; if (NULL == msg) { @@ -860,7 +868,7 @@ GNUNET_GNS_lookup_zone (struct GNUNET_GNS_Handle *handle, lr->gns_handle = handle; lr->lookup_proc = proc; lr->proc_cls = proc_cls; - lr->r_id = handle->r_id++; + lr->r_id = handle->r_id_gen++; pending = (struct PendingMessage *)&lr[1]; pending->size = msize; pending->r_id = lr->r_id; @@ -975,7 +983,7 @@ GNUNET_GNS_shorten_zone (struct GNUNET_GNS_Handle *handle, sr->gns_handle = handle; sr->shorten_proc = proc; sr->proc_cls = proc_cls; - sr->r_id = handle->r_id++; + sr->r_id = handle->r_id_gen++; GNUNET_CONTAINER_DLL_insert_tail (handle->shorten_head, handle->shorten_tail, sr); pending = (struct PendingMessage *)&sr[1]; @@ -1070,7 +1078,7 @@ GNUNET_GNS_get_authority (struct GNUNET_GNS_Handle *handle, gar->gns_handle = handle; gar->auth_proc = proc; gar->proc_cls = proc_cls; - gar->r_id = handle->r_id++; + gar->r_id = handle->r_id_gen++; GNUNET_CONTAINER_DLL_insert_tail (handle->get_auth_head, handle->get_auth_tail, gar); diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 47d149330..fb7b80e16 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c @@ -500,41 +500,6 @@ i_to_hexchar (unsigned char i) } -/** -// FIXME: use cURL API - * Escape given 0-terminated string - * - * @param to_esc string to escapse - * @return allocated new escaped string (MUST free!) - */ -static char* -escape_to_urlenc (const char *to_esc) -{ - char *pos = (char*)to_esc; - char *res = GNUNET_malloc (strlen (to_esc) * 3 + 1); - char *rpos = res; - - while ('\0' != *pos) - { - if (isalnum (*pos) || - ('-' == *pos) || ('_' == *pos) || - ('.' == *pos) || ('~' == *pos)) - *rpos++ = *pos; - else if (' ' == *pos) - *rpos++ = '+'; - else - { - *rpos++ = '%'; - *rpos++ = i_to_hexchar (*pos >> 4); - *rpos++ = i_to_hexchar (*pos >> 15); - } - pos++; - } - *rpos = '\0'; - return res; -} - - static int con_post_data_iter (void *cls, enum MHD_ValueKind kind, @@ -610,9 +575,14 @@ con_post_data_iter (void *cls, if (0 == off) { + enc = curl_easy_escape (ctask->curl, key, 0); + if (NULL == enc) + { + GNUNET_break (0); + return MHD_NO; + } /* a key */ pdata = GNUNET_malloc (sizeof (struct ProxyUploadData)); - enc = escape_to_urlenc (key); pdata->value = GNUNET_malloc (strlen (enc) + 3); if (NULL != ctask->upload_data_head) { @@ -624,7 +594,7 @@ con_post_data_iter (void *cls, pdata->value[strlen (pdata->value)] = '='; pdata->bytes_left = strlen (pdata->value); pdata->total_bytes = pdata->bytes_left; - GNUNET_free (enc); + curl_free (enc); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Escaped POST key: '%s'\n", @@ -636,13 +606,18 @@ con_post_data_iter (void *cls, } /* a value */ + enc = curl_easy_escape (ctask->curl, data, 0); + if (NULL == enc) + { + GNUNET_break (0); + return MHD_NO; + } pdata = GNUNET_malloc (sizeof (struct ProxyUploadData)); - enc = escape_to_urlenc (data); pdata->value = GNUNET_malloc (strlen (enc) + 1); memcpy (pdata->value, enc, strlen (enc)); pdata->bytes_left = strlen (pdata->value); pdata->total_bytes = pdata->bytes_left; - GNUNET_free (enc); + curl_free (enc); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Escaped POST value: '%s'\n", @@ -1341,6 +1316,7 @@ postprocess_buffer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) run_mhd_now (ctask->mhd); } + /** * Handle data from cURL * @@ -1592,7 +1568,6 @@ curl_task_download (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct ProxyCurlTask *ctask; int num_ctasks; long resp_code; - struct ProxyCurlTask *clean_head = NULL; struct ProxyCurlTask *clean_tail = NULL; @@ -1602,8 +1577,8 @@ curl_task_download (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Shutdown requested while trying to download\n"); - //TODO cleanup - return; + //TODO cleanup + return; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ready to dl\n"); @@ -2392,13 +2367,11 @@ do_write (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) len); } else - { - + { GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "write"); s5r->cleanup = GNUNET_YES; s5r->cleanup_sock = GNUNET_YES; - cleanup_s5r (s5r); - + cleanup_s5r (s5r); return; } @@ -2429,8 +2402,6 @@ do_read_remote (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct Socks5Request *s5r = cls; s5r->fwdrtask = GNUNET_SCHEDULER_NO_TASK; - - if ((NULL != tc->write_ready) && (GNUNET_NETWORK_fdset_isset (tc->read_ready, s5r->remote_sock)) && (s5r->wbuf_len = GNUNET_NETWORK_socket_recv (s5r->remote_sock, s5r->wbuf, @@ -2442,7 +2413,7 @@ do_read_remote (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } else { - if (s5r->wbuf_len == 0) + if (0 == s5r->wbuf_len) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "0 bytes received from remote... graceful shutdown!\n"); if (s5r->fwdwtask != GNUNET_SCHEDULER_NO_TASK) @@ -2460,8 +2431,7 @@ do_read_remote (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) s5r->wtask = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, s5r->sock, - &do_write, s5r); - + &do_write, s5r); } @@ -2699,7 +2669,7 @@ accept_cb (void* cls, const struct sockaddr *addr, socklen_t addrlen) static int add_handle_to_ssl_mhd (struct GNUNET_NETWORK_Handle *h, const char* domain) { - struct MhdHttpList *hd = NULL; + struct MhdHttpList *hd; struct ProxyGNSCertificate *pgc; struct NetworkHandleList *nh; @@ -2781,7 +2751,6 @@ do_read (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct socks5_server_hello *s_hello; struct socks5_client_request *c_req; struct socks5_server_response *s_resp; - int ret; char domain[256]; uint8_t dom_len; @@ -2790,7 +2759,6 @@ do_read (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) uint32_t remote_ip; struct sockaddr_in remote_addr; struct in_addr *r_sin_addr; - struct NetworkHandleList *nh; s5r->rtask = GNUNET_SCHEDULER_NO_TASK; @@ -3100,7 +3068,6 @@ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - struct MhdHttpList *hd; struct MhdHttpList *tmp_hd; struct NetworkHandleList *nh; @@ -3111,9 +3078,6 @@ do_shutdown (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n"); - - gnutls_global_deinit (); - if (NULL != local_gns_zone) GNUNET_free (local_gns_zone); if (NULL != local_private_zone) @@ -3142,13 +3106,11 @@ do_shutdown (void *cls, GNUNET_SCHEDULER_cancel (hd->httpd_task); hd->httpd_task = GNUNET_SCHEDULER_NO_TASK; } - if (NULL != hd->daemon) { MHD_stop_daemon (hd->daemon); hd->daemon = NULL; } - for (nh = hd->socket_handles_head; nh != NULL; nh = tmp_nh) { tmp_nh = nh->next; @@ -3200,12 +3162,11 @@ do_shutdown (void *cls, GNUNET_free_non_null (pdata->value); GNUNET_free (pdata); } - GNUNET_free (ctask); } curl_multi_cleanup (curl_multi); - GNUNET_GNS_disconnect (gns_handle); + gnutls_global_deinit (); } @@ -3243,9 +3204,9 @@ static int load_local_zone_key (const struct GNUNET_CONFIGURATION_Handle *cfg) { char *keyfile; - struct GNUNET_CRYPTO_RsaPrivateKey *key = NULL; + struct GNUNET_CRYPTO_RsaPrivateKey *key; struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; - struct GNUNET_CRYPTO_ShortHashCode *zone = NULL; + struct GNUNET_CRYPTO_ShortHashCode *zone; struct GNUNET_CRYPTO_ShortHashAsciiEncoded zonename; if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", @@ -3361,9 +3322,7 @@ run (void *cls, char *const *args, const char *cfgfile, struct sockaddr_un mhd_unix_sock_addr; #endif - curl_multi = curl_multi_init (); - - if (NULL == curl_multi) + if (NULL == (curl_multi = curl_multi_init ())) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create cURL multo handle!\n"); @@ -3376,8 +3335,8 @@ run (void *cls, char *const *args, const char *cfgfile, if (NULL == cafile) { if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns-proxy", - "PROXY_CACERT", - &cafile_cfg)) + "PROXY_CACERT", + &cafile_cfg)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to load proxy CA config value!\n"); @@ -3408,19 +3367,16 @@ run (void *cls, char *const *args, const char *cfgfile, compile_regex (&re_dotplus, (char*) RE_A_HREF); - gns_handle = GNUNET_GNS_connect (cfg); - - if (GNUNET_NO == load_local_zone_key (cfg)) + if (NULL == (gns_handle = GNUNET_GNS_connect (cfg))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unable to load zone!\n"); + "Unable to connect to GNS!\n"); return; } - - if (NULL == gns_handle) + if (GNUNET_NO == load_local_zone_key (cfg)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unable to connect to GNS!\n"); + "Unable to load zone!\n"); return; } @@ -3477,12 +3433,9 @@ run (void *cls, char *const *args, const char *cfgfile, "Specify PROXY_UNIXPATH in gns-proxy config section!\n"); return; } - - mhd_unix_socket = GNUNET_NETWORK_socket_create (AF_UNIX, - SOCK_STREAM, - 0); - - if (NULL == mhd_unix_socket) + if (NULL == (mhd_unix_socket = GNUNET_NETWORK_socket_create (AF_UNIX, + SOCK_STREAM, + 0))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to create unix domain socket!\n"); @@ -3500,7 +3453,6 @@ run (void *cls, char *const *args, const char *cfgfile, #endif len = strlen (proxy_sockfile) + sizeof(AF_UNIX); - GNUNET_free (proxy_sockfile); if (GNUNET_OK != GNUNET_NETWORK_socket_bind (mhd_unix_socket, diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 068a9266e..ba30b56fb 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c @@ -44,7 +44,6 @@ static char *shorten_name; */ static char *lookup_name; - /** * record type to look up (-t option) */ @@ -60,15 +59,24 @@ static char *auth_name; */ static int raw; +/** + * Requested record type. + */ static enum GNUNET_GNS_RecordType rtype; -/* Handle to lookup request */ +/** + * Handle to lookup request + */ static struct GNUNET_GNS_LookupRequest *lookup_request; -/* Handle to shorten request */ +/** + * Handle to shorten request + */ static struct GNUNET_GNS_ShortenRequest *shorten_request; -/* Handle to get authority request */ +/** + * Handle to get authority request + */ static struct GNUNET_GNS_GetAuthRequest *getauth_request; @@ -83,21 +91,37 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (NULL != lookup_request) + { GNUNET_GNS_cancel_lookup_request (lookup_request); - + lookup_request = NULL; + } if (NULL != shorten_request) + { GNUNET_GNS_cancel_shorten_request (shorten_request); - + shorten_request = NULL; + } if (NULL != getauth_request) + { GNUNET_GNS_cancel_get_auth_request (getauth_request); - + getauth_request = NULL; + } if (NULL != gns) + { GNUNET_GNS_disconnect (gns); + gns = NULL; + } } +/** + * Function called with the result of a shorten operation. + * Prints the result. + * + * @param cls a 'const char *' with the original (long) name + * @param nshort the shortened name + */ static void -process_shorten_result (void* cls, const char* nshort) +process_shorten_result (void* cls, const char *nshort) { const char *original_name = cls; @@ -110,6 +134,13 @@ process_shorten_result (void* cls, const char* nshort) } +/** + * Function called with the result of a GADS lookup. + * + * @param cls the 'const char *' name that was resolved + * @param rd_count number of records returned + * @param rd array of 'rd_count' records with the results + */ static void process_lookup_result (void* cls, uint32_t rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -122,7 +153,7 @@ process_lookup_result (void* cls, uint32_t rd_count, lookup_request = NULL; if (!raw) { - if (rd_count == 0) + if (0 == rd_count) printf("No results.\n"); else printf("%s:\n", name); @@ -143,8 +174,16 @@ process_lookup_result (void* cls, uint32_t rd_count, } +/** + * Function called with the result of an authority lookup. + * + * @param cls the 'const char *' with the name for which the + * authority was resolved + * @param auth name of the authority + */ static void -process_auth_result (void* cls, const char* auth) +process_auth_result (void* cls, + const char *auth) { getauth_request = NULL; printf ("%s\n", auth); @@ -254,14 +293,16 @@ run (void *cls, char *const *args, const char *cfgfile, else rtype = GNUNET_GNS_RECORD_A; - if ((NULL != shorten_name) && (NULL != shorten_zone) && (NULL != private_zone)) + if ( (NULL != shorten_name) && + (NULL != shorten_zone) && + (NULL != private_zone) ) { shorten_request = GNUNET_GNS_shorten_zone (gns, shorten_name, - private_zone, - shorten_zone, - zone, - &process_shorten_result, - shorten_name); + private_zone, + shorten_zone, + zone, + &process_shorten_result, + shorten_name); } if (NULL != lookup_name) { @@ -270,7 +311,8 @@ run (void *cls, char *const *args, const char *cfgfile, rtype, GNUNET_NO, /* Use DHT */ shorten_key, - &process_lookup_result, lookup_name); + &process_lookup_result, + lookup_name); } if (NULL != auth_name) { @@ -285,16 +327,15 @@ run (void *cls, char *const *args, const char *cfgfile, if (NULL != private_zone) GNUNET_free (private_zone); - if ((NULL == auth_name) && - (NULL == shorten_name) && - (NULL == lookup_name)) + if ( (NULL == auth_name) && + (NULL == shorten_name) && + (NULL == lookup_name)) { fprintf (stderr, _("Please specify lookup, shorten or authority operation!\n")); GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); return; } - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, NULL); } @@ -328,7 +369,6 @@ main (int argc, char *const *argv) &GNUNET_GETOPT_set_one, &raw}, GNUNET_GETOPT_OPTION_END }; - int ret; if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 88e1f9d58..dc22efdab 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c @@ -72,6 +72,7 @@ struct ClientShortenHandle * List for all shorten requests */ struct ClientShortenHandle *next; + /** * List for all shorten requests */ @@ -82,10 +83,30 @@ struct ClientShortenHandle */ struct GNUNET_SERVER_Client *client; + /** + * Namestore lookup task + */ + struct GNUNET_NAMESTORE_QueueEntry *namestore_task; + + /** + * master zone + */ + struct GNUNET_CRYPTO_ShortHashCode root_zone; + + /** + * private zone + */ + struct GNUNET_CRYPTO_ShortHashCode private_zone; + + /** + * shorten zone + */ + struct GNUNET_CRYPTO_ShortHashCode shorten_zone; + /** * The request id */ - uint64_t request_id; + uint32_t request_id; /** * request type @@ -106,26 +127,7 @@ struct ClientShortenHandle * name of shorten zone (relative to root) */ char shorten_zone_id[MAX_DNS_NAME_LENGTH]; - - /** - * master zone - */ - struct GNUNET_CRYPTO_ShortHashCode root_zone; - - /** - * private zone - */ - struct GNUNET_CRYPTO_ShortHashCode private_zone; - - /** - * shorten zone - */ - struct GNUNET_CRYPTO_ShortHashCode shorten_zone; - /** - * Namestore lookup task - */ - struct GNUNET_NAMESTORE_QueueEntry *namestore_task; }; @@ -135,18 +137,20 @@ struct ClientShortenHandle struct ClientGetAuthHandle { /** - * Handle to the requesting client */ + * Handle to the requesting client + */ struct GNUNET_SERVER_Client *client; /** - * request id + * name to lookup authority */ - uint64_t request_id; + char *name; /** - * name to lookup authority + * request id */ - char *name; + uint32_t request_id; + }; @@ -162,34 +166,34 @@ struct ClientLookupHandle struct GNUNET_SERVER_Client *client; /** - * The zone we look up in + * optional zone private key used for shorten */ - struct GNUNET_CRYPTO_ShortHashCode zone; + struct GNUNET_CRYPTO_RsaPrivateKey *shorten_key; /** - * GNUNET_YES if we only want to lookup from local cache + * the name to look up */ - int only_cached; + char *name; /** - * request id + * The zone we look up in */ - uint64_t request_id; + struct GNUNET_CRYPTO_ShortHashCode zone; /** - * request type + * request id */ - enum GNUNET_GNS_RecordType type; + uint32_t request_id; /** - * optional zone private key used for shorten + * GNUNET_YES if we only want to lookup from local cache */ - struct GNUNET_CRYPTO_RsaPrivateKey *shorten_key; + int only_cached; /** - * the name to look up + * request type */ - char *name; + enum GNUNET_GNS_RecordType type; }; @@ -306,19 +310,36 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) while (NULL != (csh_tmp = csh_head)) { GNUNET_CONTAINER_DLL_remove (csh_head, csh_tail, csh_tmp); - GNUNET_free(csh_tmp); + GNUNET_free (csh_tmp); } GNUNET_SERVER_notification_context_destroy (nc); gns_interceptor_stop (); gns_resolver_cleanup (); if (NULL != statistics) + { GNUNET_STATISTICS_destroy (statistics, GNUNET_NO); - if (zone_publish_task != GNUNET_SCHEDULER_NO_TASK) + statistics = NULL; + } + if (GNUNET_SCHEDULER_NO_TASK != zone_publish_task) + { GNUNET_SCHEDULER_cancel (zone_publish_task); + zone_publish_task = GNUNET_SCHEDULER_NO_TASK; + } if (NULL != namestore_iter) + { GNUNET_NAMESTORE_zone_iteration_stop (namestore_iter); - GNUNET_NAMESTORE_disconnect(namestore_handle); - GNUNET_DHT_disconnect(dht_handle); + namestore_iter = NULL; + } + if (NULL != namestore_handle) + { + GNUNET_NAMESTORE_disconnect (namestore_handle); + namestore_handle = NULL; + } + if (NULL != dht_handle) + { + GNUNET_DHT_disconnect (dht_handle); + dht_handle = NULL; + } } @@ -345,7 +366,7 @@ publish_zone_dht_next (void *cls, */ static void publish_zone_dht_start (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); + const struct GNUNET_SCHEDULER_TaskContext *tc); /** @@ -360,7 +381,7 @@ publish_zone_dht_start (void *cls, * @param signature the signature for the record data */ static void -put_gns_record(void *cls, +put_gns_record (void *cls, const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key, struct GNUNET_TIME_Absolute expiration, const char *name, @@ -389,19 +410,17 @@ put_gns_record(void *cls, * we can safely set the interval to the value for a single * record */ - put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window, - 1); - + put_interval = zone_publish_time_window; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, "No records in db.\n"); } else { put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window, - num_public_records); + num_public_records); } put_interval = GNUNET_TIME_relative_max (MINIMUM_ZONE_ITERATION_INTERVAL, - put_interval); + put_interval); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zone iteration finished. Adjusted zone iteration interval to %s\n", @@ -484,7 +503,8 @@ put_gns_record(void *cls, GNUNET_STRINGS_relative_time_to_string (DHT_OPERATION_TIMEOUT, GNUNET_YES)); GNUNET_STATISTICS_update (statistics, - "Record bytes put into DHT", rd_payload_length, GNUNET_NO); + "Record bytes put into DHT", + rd_payload_length, GNUNET_NO); (void) GNUNET_DHT_put (dht_handle, &dht_key, DHT_GNS_REPLICATION_LEVEL, @@ -505,7 +525,7 @@ put_gns_record(void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Last record count was lower than current record count. Reducing interval.\n"); put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window, - num_public_records); + num_public_records); next_put_interval = GNUNET_TIME_relative_divide (put_interval, LATE_ITERATION_SPEEDUP_FACTOR); } @@ -517,8 +537,8 @@ put_gns_record(void *cls, next_put_interval.rel_value, GNUNET_NO); zone_publish_task = GNUNET_SCHEDULER_add_delayed (next_put_interval, - &publish_zone_dht_next, - NULL); + &publish_zone_dht_next, + NULL); } @@ -529,11 +549,13 @@ put_gns_record(void *cls, * @param tc task context */ static void -publish_zone_dht_start(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +publish_zone_dht_start (void *cls, + const struct GNUNET_SCHEDULER_TaskContext *tc) { zone_publish_task = GNUNET_SCHEDULER_NO_TASK; - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Scheduling DHT zone update!\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Scheduling DHT zone update!\n"); /* start counting again */ num_public_records = 0; namestore_iter = GNUNET_NAMESTORE_zone_iteration_start (namestore_handle, @@ -561,7 +583,8 @@ send_shorten_response (void* cls, const char* name) struct GNUNET_GNS_ClientShortenResultMessage *rmsg; size_t name_len; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message with %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Sending `%s' message with %s\n", "SHORTEN_RESULT", name); if (NULL == name) name_len = 0; @@ -616,9 +639,8 @@ process_shorten_in_private_zone_lookup (void *cls, csh->namestore_task = NULL; if (0 == strcmp (csh->private_zone_id, "")) - pzone = NULL; - - if (rd_count == 0) + pzone = NULL; + if (0 == rd_count) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No shorten zone in private zone!\n"); @@ -627,17 +649,14 @@ process_shorten_in_private_zone_lookup (void *cls, } else { - GNUNET_assert (rd_count == 1); - + GNUNET_break (1 == rd_count); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shorten zone %s found in private zone %s\n", name, csh->private_zone_id); sprintf (csh->shorten_zone_id, "%s.%s", name, csh->private_zone_id); } - GNUNET_CONTAINER_DLL_remove (csh_head, csh_tail, csh); - gns_resolver_shorten_name (&csh->root_zone, pzone, szone, @@ -663,12 +682,12 @@ process_shorten_in_private_zone_lookup (void *cls, */ static void process_shorten_in_root_zone_lookup (void *cls, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key, - struct GNUNET_TIME_Absolute expiration, - const char *name, - unsigned int rd_count, - const struct GNUNET_NAMESTORE_RecordData *rd, - const struct GNUNET_CRYPTO_RsaSignature *signature) + const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key, + struct GNUNET_TIME_Absolute expiration, + const char *name, + unsigned int rd_count, + const struct GNUNET_NAMESTORE_RecordData *rd, + const struct GNUNET_CRYPTO_RsaSignature *signature) { struct ClientShortenHandle *csh = cls; struct GNUNET_CRYPTO_ShortHashCode *szone = &csh->shorten_zone; @@ -677,17 +696,14 @@ process_shorten_in_root_zone_lookup (void *cls, csh->namestore_task = NULL; if (0 == strcmp (csh->private_zone_id, "")) pzone = NULL; - - if (rd_count == 0) + if (0 == rd_count) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No shorten zone in zone and no private zone!\n"); strcpy (csh->shorten_zone_id, ""); - GNUNET_CONTAINER_DLL_remove (csh_head, csh_tail, csh); szone = NULL; - gns_resolver_shorten_name (&csh->root_zone, pzone, szone, @@ -697,19 +713,15 @@ process_shorten_in_root_zone_lookup (void *cls, &send_shorten_response, csh); return; } - - GNUNET_assert (rd_count == 1); - + GNUNET_break (rd_count == 1); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Private zone %s found in root zone\n", name); - strcpy (csh->private_zone_id, name); - csh->namestore_task = GNUNET_NAMESTORE_zone_to_name (namestore_handle, - pzone, - szone, - &process_shorten_in_private_zone_lookup, - csh); + pzone, + szone, + &process_shorten_in_private_zone_lookup, + csh); } @@ -723,7 +735,6 @@ process_shorten_in_root_zone_lookup (void *cls, * @param rd_count number of records found * @param rd record data * @param signature - * */ static void process_private_in_root_zone_lookup (void *cls, @@ -762,25 +773,6 @@ process_private_in_root_zone_lookup (void *cls, } -/** - * Lookup the zone infos and shorten name - * - * @param csh the shorten handle - * - */ -static void -start_shorten_name (struct ClientShortenHandle *csh) -{ - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Looking for private zone name in root zone\n"); - csh->namestore_task = GNUNET_NAMESTORE_zone_to_name (namestore_handle, - &csh->root_zone, - &csh->private_zone, - &process_private_in_root_zone_lookup, - csh); -} - - /** * Handle a shorten message from the api * @@ -800,7 +792,8 @@ handle_shorten (void *cls, uint16_t msg_size; const struct GNUNET_GNS_ClientShortenMessage *sh_msg; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "SHORTEN"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received `%s' message\n", "SHORTEN"); msg_size = ntohs (message->size); if (msg_size < sizeof (struct GNUNET_GNS_ClientShortenMessage)) { @@ -861,7 +854,11 @@ handle_shorten (void *cls, csh->root_zone = zone_hash; //Default zone else csh->root_zone = sh_msg->zone; - start_shorten_name (csh); + csh->namestore_task = GNUNET_NAMESTORE_zone_to_name (namestore_handle, + &csh->root_zone, + &csh->private_zone, + &process_private_in_root_zone_lookup, + csh); GNUNET_STATISTICS_update (statistics, "Name shorten attempts", 1, GNUNET_NO); GNUNET_SERVER_receive_done (client, GNUNET_OK); @@ -872,10 +869,11 @@ handle_shorten (void *cls, * Send get authority response back to client * * @param cls the closure containing a client get auth handle - * @param name the shortened name result or NULL if cannot be shortened + * @param name the name of the authority, or NULL on error */ static void -send_get_auth_response(void *cls, const char* name) +send_get_auth_response (void *cls, + const char* name) { struct ClientGetAuthHandle *cah = cls; struct GNUNET_GNS_ClientGetAuthResultMessage *rmsg; @@ -890,21 +888,20 @@ send_get_auth_response(void *cls, const char* name) } if (NULL == name) name = ""; - rmsg = GNUNET_malloc(sizeof(struct GNUNET_GNS_ClientGetAuthResultMessage) - + strlen(name) + 1); + rmsg = GNUNET_malloc (sizeof (struct GNUNET_GNS_ClientGetAuthResultMessage) + + strlen (name) + 1); rmsg->id = cah->request_id; rmsg->header.type = htons(GNUNET_MESSAGE_TYPE_GNS_GET_AUTH_RESULT); rmsg->header.size = htons(sizeof(struct GNUNET_GNS_ClientGetAuthResultMessage) + - strlen(name) + 1); + strlen (name) + 1); strcpy ((char*)&rmsg[1], name); GNUNET_SERVER_notification_context_unicast (nc, cah->client, &rmsg->header, GNUNET_NO); GNUNET_SERVER_receive_done (cah->client, GNUNET_OK); - GNUNET_free(rmsg); GNUNET_free_non_null(cah->name); GNUNET_free(cah); @@ -930,12 +927,13 @@ handle_get_authority (void *cls, uint16_t msg_size; const struct GNUNET_GNS_ClientGetAuthMessage *sh_msg; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "GET_AUTH"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received `%s' message\n", "GET_AUTH"); msg_size = ntohs(message->size); if (msg_size < sizeof (struct GNUNET_GNS_ClientGetAuthMessage)) { GNUNET_break (0); - GNUNET_SERVER_receive_done (client, GNUNET_OK); + GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } GNUNET_SERVER_notification_context_add (nc, client); @@ -967,17 +965,17 @@ handle_get_authority (void *cls, send_get_auth_response(cah, name); return; } - if (0 != strcmp (name + strlen (name) - strlen(GNUNET_GNS_TLD), + if (0 != strcmp (name + strlen (name) - strlen (GNUNET_GNS_TLD), GNUNET_GNS_TLD)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GET_AUTH: %s is not our domain. Returning\n", name); cah->name = NULL; - send_get_auth_response(cah, name); + send_get_auth_response (cah, name); return; } - if (0 == strcmp(name, GNUNET_GNS_TLD)) + if (0 == strcmp (name, GNUNET_GNS_TLD)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GET_AUTH: %s is us. Returning\n", name); @@ -988,8 +986,8 @@ handle_get_authority (void *cls, cah->name = GNUNET_malloc (strlen (name) - strlen (GNUNET_GNS_TLD) + 1); - memcpy(cah->name, name, - strlen (name) - strlen (GNUNET_GNS_TLD)); + memcpy (cah->name, name, + strlen (name) - strlen (GNUNET_GNS_TLD)); /* Start delegation resolution in our namestore */ gns_resolver_get_authority (zone_hash, zone_hash, name, @@ -999,7 +997,6 @@ handle_get_authority (void *cls, } - /** * Reply to client with the result from our lookup. * @@ -1008,9 +1005,9 @@ handle_get_authority (void *cls, * @param rd the record data */ static void -send_lookup_response(void* cls, - uint32_t rd_count, - const struct GNUNET_NAMESTORE_RecordData *rd) +send_lookup_response (void* cls, + uint32_t rd_count, + const struct GNUNET_NAMESTORE_RecordData *rd) { struct ClientLookupHandle* clh = cls; struct GNUNET_GNS_ClientLookupResultMessage *rmsg; @@ -1020,8 +1017,7 @@ send_lookup_response(void* cls, "LOOKUP_RESULT", rd_count); len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); - rmsg = GNUNET_malloc ( - len + sizeof (struct GNUNET_GNS_ClientLookupResultMessage)); + rmsg = GNUNET_malloc (len + sizeof (struct GNUNET_GNS_ClientLookupResultMessage)); rmsg->id = clh->request_id; rmsg->rd_count = htonl(rd_count); @@ -1041,11 +1037,10 @@ send_lookup_response(void* cls, if (NULL != clh->shorten_key) GNUNET_CRYPTO_rsa_key_free (clh->shorten_key); - GNUNET_free(clh); - + GNUNET_free (clh); GNUNET_STATISTICS_update (statistics, "Completed lookups", 1, GNUNET_NO); - if (rd != NULL) + if (NULL != rd) GNUNET_STATISTICS_update (statistics, "Records resolved", rd_count, GNUNET_NO); } @@ -1059,9 +1054,9 @@ send_lookup_response(void* cls, * @param message the message */ static void -handle_lookup(void *cls, - struct GNUNET_SERVER_Client * client, - const struct GNUNET_MessageHeader * message) +handle_lookup (void *cls, + struct GNUNET_SERVER_Client * client, + const struct GNUNET_MessageHeader * message) { size_t namelen; char name[MAX_DNS_NAME_LENGTH]; @@ -1075,13 +1070,13 @@ handle_lookup(void *cls, uint16_t msg_size; const struct GNUNET_GNS_ClientLookupMessage *sh_msg; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "LOOKUP"); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "LOOKUP"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received `%s' message\n", "LOOKUP"); msg_size = ntohs(message->size); if (msg_size < sizeof (struct GNUNET_GNS_ClientLookupMessage)) { GNUNET_break (0); - GNUNET_SERVER_receive_done (client, GNUNET_OK); + GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } sh_msg = (const struct GNUNET_GNS_ClientLookupMessage *) message; @@ -1103,10 +1098,10 @@ handle_lookup(void *cls, GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } - GNUNET_STRINGS_utf8_tolower(utf_in, &nameptr); + GNUNET_STRINGS_utf8_tolower (utf_in, &nameptr); } - namelen = strlen(name)+1; + namelen = strlen (name) + 1; clh = GNUNET_malloc (sizeof (struct ClientLookupHandle)); memset (clh, 0, sizeof (struct ClientLookupHandle)); clh->client = client; @@ -1126,7 +1121,7 @@ handle_lookup(void *cls, return; } - if ((clh->type == GNUNET_GNS_RECORD_A) && + if ((GNUNET_GNS_RECORD_A == clh->type) && (GNUNET_OK != v4_enabled)) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, @@ -1136,7 +1131,7 @@ handle_lookup(void *cls, return; } - if ((clh->type == GNUNET_GNS_RECORD_AAAA) && + if ((GNUNET_GNS_RECORD_AAAA == clh->type) && (GNUNET_OK != v6_enabled)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -1167,44 +1162,15 @@ handle_lookup(void *cls, only_cached, &send_lookup_response, clh); } - GNUNET_STATISTICS_update (statistics, "Record lookup attempts", 1, GNUNET_NO); } -/** - * Test if the given AF is supported by this system. - * - * @param af to test - * @return GNUNET_OK if the AF is supported - */ -static int -test_af (int af) -{ - int s; - - s = socket (af, SOCK_STREAM, 0); - if (-1 == s) - { - if (EAFNOSUPPORT == errno) - return GNUNET_NO; - fprintf (stderr, "Failed to create test socket: %s\n", STRERROR (errno)); - return GNUNET_SYSERR; - } -#if WINDOWS - closesocket (s); -#else - close (s); -#endif - return GNUNET_OK; -} - - /** * Process GNS requests. * - * @param cls closure) + * @param cls closure * @param server the initialized server * @param c configuration to use */ @@ -1212,23 +1178,21 @@ static void run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { - char* keyfile; - struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; - unsigned long long max_parallel_bg_queries = 0; - unsigned long long default_lookup_timeout_secs = 0; - int ignore_pending = GNUNET_NO; - static const struct GNUNET_SERVER_MessageHandler handlers[] = { {&handle_shorten, NULL, GNUNET_MESSAGE_TYPE_GNS_SHORTEN, 0}, {&handle_lookup, NULL, GNUNET_MESSAGE_TYPE_GNS_LOOKUP, 0}, {&handle_get_authority, NULL, GNUNET_MESSAGE_TYPE_GNS_GET_AUTH, 0} }; + char* keyfile; + struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; + unsigned long long max_parallel_bg_queries = 0; + int ignore_pending = GNUNET_NO; - v6_enabled = test_af (AF_INET6); - v4_enabled = test_af (AF_INET); + v6_enabled = GNUNET_NETWORK_test_pf (PF_INET6); + v4_enabled = GNUNET_NETWORK_test_pf (PF_INET); if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (c, "gns", - "ZONEKEY", &keyfile)) + "ZONEKEY", &keyfile)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No private key for root zone specified!\n"); @@ -1241,7 +1205,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, zone_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); GNUNET_CRYPTO_rsa_key_get_public (zone_key, &pkey); - GNUNET_CRYPTO_short_hash(&pkey, sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_hash); @@ -1260,76 +1223,69 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GNUNET_CONFIGURATION_get_value_yesno (c, "gns", "AUTO_IMPORT_PKEY")) { - GNUNET_log(GNUNET_ERROR_TYPE_INFO, - "Automatic PKEY import is enabled.\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Automatic PKEY import is enabled.\n"); auto_import_pkey = GNUNET_YES; - } - put_interval = INITIAL_PUT_INTERVAL; - zone_publish_time_window = DEFAULT_ZONE_PUBLISH_TIME_WINDOW; if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (c, "gns", - "ZONE_PUBLISH_TIME_WINDOW", - &zone_publish_time_window)) + "ZONE_PUBLISH_TIME_WINDOW", + &zone_publish_time_window)) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Time window for zone iteration: %s\n", GNUNET_STRINGS_relative_time_to_string (zone_publish_time_window, GNUNET_YES)); } - if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (c, "gns", "MAX_PARALLEL_BACKGROUND_QUERIES", &max_parallel_bg_queries)) { - GNUNET_log(GNUNET_ERROR_TYPE_INFO, - "Number of allowed parallel background queries: %llu\n", - max_parallel_bg_queries); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Number of allowed parallel background queries: %llu\n", + max_parallel_bg_queries); } if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (c, "gns", "AUTO_IMPORT_CONFIRMATION_REQ")) { - GNUNET_log(GNUNET_ERROR_TYPE_INFO, - "Auto import requires user confirmation\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Auto import requires user confirmation\n"); ignore_pending = GNUNET_YES; } if (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_number(c, "gns", - "DEFAULT_LOOKUP_TIMEOUT", - &default_lookup_timeout_secs)) + GNUNET_CONFIGURATION_get_value_time (c, "gns", + "DEFAULT_LOOKUP_TIMEOUT", + &default_lookup_timeout)) { - GNUNET_log(GNUNET_ERROR_TYPE_INFO, - "Default lookup timeout: %llus\n", default_lookup_timeout_secs); - default_lookup_timeout = GNUNET_TIME_relative_multiply( - GNUNET_TIME_UNIT_SECONDS, - default_lookup_timeout_secs); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Default lookup timeout: %s\n", + GNUNET_STRINGS_relative_time_to_string (default_lookup_timeout, + GNUNET_YES)); } - /** - * handle to the dht - */ - dht_handle = GNUNET_DHT_connect(c, - //max_parallel_bg_queries); //FIXME get ht_len from cfg - 1024); - + dht_handle = GNUNET_DHT_connect (c, + (unsigned int) max_parallel_bg_queries); if (NULL == dht_handle) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not connect to DHT!\n"); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Could not connect to DHT!\n")); + GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); + return; } - if (gns_resolver_init(namestore_handle, dht_handle, zone_hash, c, - max_parallel_bg_queries, - ignore_pending) - == GNUNET_SYSERR) + if (GNUNET_SYSERR == + gns_resolver_init (namestore_handle, dht_handle, zone_hash, c, + max_parallel_bg_queries, + ignore_pending)) { - GNUNET_log(GNUNET_ERROR_TYPE_ERROR, - "Unable to initialize resolver!\n"); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Unable to initialize resolver!\n")); GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); return; } @@ -1354,18 +1310,9 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, */ first_zone_iteration = GNUNET_YES; zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, NULL); - GNUNET_SERVER_add_handlers (server, handlers); - - //FIXME - //GNUNET_SERVER_disconnect_notify (server, - // &client_disconnect_notification, - // NULL); - statistics = GNUNET_STATISTICS_create ("gns", c); - nc = GNUNET_SERVER_notification_context_create (server, 1); - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); } diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c index 0081bc833..9c1c3a666 100644 --- a/src/gns/gnunet-service-gns_interceptor.c +++ b/src/gns/gnunet-service-gns_interceptor.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) + (C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -17,9 +17,7 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** - * * @file gns/gnunet-service-gns_interceptor.c * @brief GNUnet GNS interceptor logic * @author Martin Schanzenbach @@ -86,8 +84,8 @@ static struct GNUNET_TIME_Relative default_lookup_timeout; * @param rd the record data */ static void -reply_to_dns(void* cls, uint32_t rd_count, - const struct GNUNET_NAMESTORE_RecordData *rd) +reply_to_dns (void* cls, uint32_t rd_count, + const struct GNUNET_NAMESTORE_RecordData *rd) { uint32_t i; size_t len; @@ -199,23 +197,25 @@ reply_to_dns(void* cls, uint32_t rd_count, 1024, /* FIXME magic from dns redirector */ &buf, &len); - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, - "Built DNS response! (ret=%d,len=%d)\n", ret, len); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Built DNS response! (ret=%d,len=%d)\n", + ret, len); if (ret == GNUNET_OK) { - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, - "Answering DNS request\n"); - GNUNET_DNS_request_answer(ilh->request_handle, - len, - buf); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Answering DNS request\n"); + GNUNET_DNS_request_answer (ilh->request_handle, + len, + buf); - GNUNET_free(buf); - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Answered DNS request\n"); + GNUNET_free (buf); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Answered DNS request\n"); } else { - GNUNET_log(GNUNET_ERROR_TYPE_ERROR, - "Error building DNS response! (ret=%d)", ret); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Error building DNS response! (ret=%d)", ret); } packet->num_answers = 0; @@ -236,8 +236,8 @@ reply_to_dns(void* cls, uint32_t rd_count, * @param q the DNS query we received parsed from p */ static void -start_resolution_for_dns(struct GNUNET_DNS_RequestHandle *request, - struct GNUNET_DNSPARSER_Packet *p, +start_resolution_for_dns (struct GNUNET_DNS_RequestHandle *request, + struct GNUNET_DNSPARSER_Packet *p, struct GNUNET_DNSPARSER_Query *q) { struct InterceptLookupHandle* ilh; @@ -245,7 +245,6 @@ start_resolution_for_dns(struct GNUNET_DNS_RequestHandle *request, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting resolution for %s (type=%d)!\n", q->name, q->type); - ilh = GNUNET_malloc(sizeof(struct InterceptLookupHandle)); ilh->packet = p; ilh->query = q; @@ -260,7 +259,6 @@ start_resolution_for_dns(struct GNUNET_DNS_RequestHandle *request, } - /** * The DNS request handler * Called for every incoming DNS request. @@ -271,17 +269,16 @@ start_resolution_for_dns(struct GNUNET_DNS_RequestHandle *request, * @param request udp payload of the DNS request */ static void -handle_dns_request(void *cls, - struct GNUNET_DNS_RequestHandle *rh, - size_t request_length, - const char *request) +handle_dns_request (void *cls, + struct GNUNET_DNS_RequestHandle *rh, + size_t request_length, + const char *request) { struct GNUNET_DNSPARSER_Packet *p; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Hijacked a DNS request...processing\n"); - p = GNUNET_DNSPARSER_parse (request, request_length); - - if (NULL == p) + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Hijacked a DNS request...processing\n"); + if (NULL == (p = GNUNET_DNSPARSER_parse (request, request_length))) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Received malformed DNS packet, leaving it untouched\n"); @@ -302,7 +299,7 @@ handle_dns_request(void *cls, * The way it is implemented here now is buggy and will lead to erratic * behaviour (if multiple queries are present). */ - if (p->num_queries == 0) + if (0 == p->num_queries) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No Queries in DNS packet... forwarding\n"); @@ -311,14 +308,6 @@ handle_dns_request(void *cls, return; } - if (p->num_queries > 1) - { - /* Note: We could also look for .gads */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - ">1 queriy in DNS packet... odd. We only process #1\n"); - } - - /** * Check for .gads/.zkey */ @@ -327,19 +316,23 @@ handle_dns_request(void *cls, (is_zkey_tld(p->queries[0].name) == GNUNET_YES) || (strcmp(p->queries[0].name, GNUNET_GNS_TLD) == 0)) { - start_resolution_for_dns(rh, p, p->queries); - } - else - { - /** - * This request does not concern us. Forward to real DNS. - */ - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, - "Request for %s is forwarded to DNS\n", p->queries[0].name); - GNUNET_DNS_request_forward (rh); - GNUNET_DNSPARSER_free_packet (p); + if (p->num_queries > 1) + { + /* Note: We could also look for .gads */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + ">1 queriy in DNS packet... odd. We only process #1\n"); + } + start_resolution_for_dns (rh, p, p->queries); + return; } - + /** + * This request does not concern us. Forward to real DNS. + */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Request for %s is forwarded to DNS\n", + p->queries[0].name); + GNUNET_DNS_request_forward (rh); + GNUNET_DNSPARSER_free_packet (p); } @@ -352,53 +345,48 @@ handle_dns_request(void *cls, * @return GNUNET_OK on success */ int -gns_interceptor_init(struct GNUNET_CRYPTO_ShortHashCode zone, - struct GNUNET_CRYPTO_RsaPrivateKey *key, - const struct GNUNET_CONFIGURATION_Handle *c) +gns_interceptor_init (struct GNUNET_CRYPTO_ShortHashCode zone, + struct GNUNET_CRYPTO_RsaPrivateKey *key, + const struct GNUNET_CONFIGURATION_Handle *c) { - unsigned long long default_lookup_timeout_secs = 0; - GNUNET_log(GNUNET_ERROR_TYPE_INFO, "DNS hijacking enabled... connecting to service.\n"); - our_zone = zone; our_key = key; /** * Do gnunet dns init here */ - dns_handle = GNUNET_DNS_connect(c, - GNUNET_DNS_FLAG_PRE_RESOLUTION, - &handle_dns_request, /* rh */ - NULL); /* Closure */ - - if (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_number(c, "gns", - "DEFAULT_LOOKUP_TIMEOUT", - &default_lookup_timeout_secs)) - { - default_lookup_timeout = GNUNET_TIME_relative_multiply( - GNUNET_TIME_UNIT_SECONDS, - default_lookup_timeout_secs); - } - + dns_handle = GNUNET_DNS_connect (c, + GNUNET_DNS_FLAG_PRE_RESOLUTION, + &handle_dns_request, /* rh */ + NULL); /* Closure */ + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_time (c, "gns", + "DEFAULT_LOOKUP_TIMEOUT", + &default_lookup_timeout)) + default_lookup_timeout = GNUNET_TIME_UNIT_ZERO; if (NULL == dns_handle) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to connect to the dnsservice!\n"); return GNUNET_SYSERR; } - return GNUNET_YES; } + /** * Disconnect from interceptor */ void -gns_interceptor_stop(void) +gns_interceptor_stop () { - if (dns_handle) + if (NULL != dns_handle) + { GNUNET_DNS_disconnect(dns_handle); + dns_handle = NULL; + } } /* end of gns_interceptor.c */ diff --git a/src/gns/gnunet-service-gns_interceptor.h b/src/gns/gnunet-service-gns_interceptor.h index dc39aecef..613ce8cdc 100644 --- a/src/gns/gnunet-service-gns_interceptor.h +++ b/src/gns/gnunet-service-gns_interceptor.h @@ -1,6 +1,32 @@ +/* + This file is part of GNUnet. + (C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +/** + * @file gns/gnunet-service-gns_interceptor.h + * @brief GNUnet GNS service + * @author Martin Schanzenbach + */ #ifndef GNUNET_GNS_INTERCEPTOR_H #define GNUNET_GNS_INTERCEPTOR_H +#include "gnunet_util_lib.h" + /** * Initialize dns interceptor * @@ -10,14 +36,14 @@ * @return GNUNET_YES on success GNUNET_SYSERR on error */ int -gns_interceptor_init(struct GNUNET_CRYPTO_ShortHashCode zone, - struct GNUNET_CRYPTO_RsaPrivateKey *key, - const struct GNUNET_CONFIGURATION_Handle *c); +gns_interceptor_init (struct GNUNET_CRYPTO_ShortHashCode zone, + struct GNUNET_CRYPTO_RsaPrivateKey *key, + const struct GNUNET_CONFIGURATION_Handle *c); /** * Stops the interceptor */ void -gns_interceptor_stop(void); +gns_interceptor_stop (void); #endif diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 964f798d0..7391efbf8 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -186,6 +186,7 @@ is_srv (char* name) return ret; } + /** * Determine if this name is canonical (is a legal name in a zone, without delegation); * note that we do not test that the name does not contain illegal characters, we only @@ -1490,6 +1491,7 @@ handle_dns_resolver (void *cls, finish_lookup (rh, rlh, 1, &rd); } + /** * Resolve DNS name via local stub resolver * @@ -3960,7 +3962,7 @@ process_zone_to_name_shorten_root (void *cls, * @param rd_count number of results (0) * @param rd data (NULL) */ -void +static void handle_delegation_ns_shorten (void* cls, struct ResolverHandle *rh, uint32_t rd_count, @@ -4289,7 +4291,7 @@ finish_get_auth (struct ResolverHandle *rh, * @param rd_count number of results (0) * @param rd data (NULL) */ -void +static void handle_delegation_result_ns_get_auth(void* cls, struct ResolverHandle *rh, uint32_t rd_count, diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h index b24fd1274..e8bb74697 100644 --- a/src/gns/gnunet-service-gns_resolver.h +++ b/src/gns/gnunet-service-gns_resolver.h @@ -1,3 +1,27 @@ +/* + This file is part of GNUnet. + (C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +/** + * @file gns/gnunet-service-gns_resolver.h + * @brief GNUnet GNS service + * @author Martin Schanzenbach + */ #ifndef GNS_RESOLVER_H #define GNS_RESOLVER_H @@ -5,12 +29,16 @@ #include "gnunet_dht_service.h" #define DHT_OPERATION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) + #define GNUNET_GNS_DEFAULT_LOOKUP_TIMEOUT \ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) + #define DHT_LOOKUP_TIMEOUT DHT_OPERATION_TIMEOUT + #define DHT_GNS_REPLICATION_LEVEL 5 #define GNUNET_GNS_MAX_PARALLEL_LOOKUPS 500 + #define GNUNET_GNS_MAX_NS_TASKS 500 /* @@ -23,17 +51,26 @@ struct AuthorityChain struct AuthorityChain *next; - /* the zone hash of the authority */ + /** + * the zone hash of the authority + */ struct GNUNET_CRYPTO_ShortHashCode zone; - /* (local) name of the authority */ + /** + * (local) name of the authority + */ char name[MAX_DNS_LABEL_LENGTH]; - /* was the ns entry fresh */ + /** + * was the ns entry fresh + */ int fresh; }; -/* handle to a resolution process */ + +/** + * handle to a resolution process + */ struct ResolverHandle; @@ -45,8 +82,8 @@ struct ResolverHandle; * @param rd result data */ typedef void (*RecordLookupProcessor) (void *cls, - uint32_t rd_count, - const struct GNUNET_NAMESTORE_RecordData *rd); + uint32_t rd_count, + const struct GNUNET_NAMESTORE_RecordData *rd); /** @@ -55,16 +92,18 @@ typedef void (*RecordLookupProcessor) (void *cls, * @param cls the closure * @param name shortened name */ -typedef void (*ShortenResultProcessor) (void *cls, const char* name); +typedef void (*ShortenResultProcessor) (void *cls, + const char* name); /** * processor for an authority result * * @param cls the closure - * @param name name + * @param name name of the authority */ -typedef void (*GetAuthorityResultProcessor) (void *cls, const char* name); +typedef void (*GetAuthorityResultProcessor) (void *cls, + const char* name); /** * processor for a resolution result @@ -72,34 +111,57 @@ typedef void (*GetAuthorityResultProcessor) (void *cls, const char* name); * @param cls the closure * @param rh the resolution handle * @param rd_count number of results - * @param rd result data + * @param rd result data (array of 'rd_count' records) */ typedef void (*ResolutionResultProcessor) (void *cls, - struct ResolverHandle *rh, - uint32_t rd_count, - const struct GNUNET_NAMESTORE_RecordData *rd); + struct ResolverHandle *rh, + uint32_t rd_count, + const struct GNUNET_NAMESTORE_RecordData *rd); /** * Resolution status indicator - * RSL_RECORD_EXISTS: the name to lookup exists - * RSL_RECORD_EXPIRED: the name in the record expired - * RSL_TIMED_OUT: resolution timed out - * RSL_DELEGATE_VPN: Found VPN delegation - * RSL_DELEGATE_NS: Found NS delegation - * RSL_DELEGATE_PKEY: Found PKEY delegation - * RSL_CNAME_FOUND: Found CNAME record - * RSL_PKEY_REVOKED: Found PKEY has been revoked */ enum ResolutionStatus { + /** + * the name to lookup exists + */ RSL_RECORD_EXISTS = 1, + + /** + * the name in the record expired + */ RSL_RECORD_EXPIRED = 2, + + /** + * resolution timed out + */ RSL_TIMED_OUT = 4, + + /** + * Found VPN delegation + */ RSL_DELEGATE_VPN = 8, + + /** + * Found NS delegation + */ RSL_DELEGATE_NS = 16, + + /** + * Found PKEY delegation + */ RSL_DELEGATE_PKEY = 32, + + /** + * Found CNAME record + */ RSL_CNAME_FOUND = 64, + + /** + * Found PKEY has been revoked + */ RSL_PKEY_REVOKED = 128 }; @@ -116,91 +178,149 @@ enum ResolutionStatus struct ResolverHandle { - /* DLL */ + /** + * DLL + */ struct ResolverHandle *next; - /* DLL */ + /** + * DLL + */ struct ResolverHandle *prev; - /* Last record data found */ + /** + * Last record data found + */ struct GNUNET_NAMESTORE_RecordData rd; - /* Number of last record data found */ + /** + * Number of last record data found + */ unsigned int rd_count; - /* The name to resolve */ + /** + * The name to resolve + */ char name[MAX_DNS_NAME_LENGTH]; - /* has this query been answered? how many matches */ + /** + * has this query been answered? how many matches + */ int answered; - /* Use only cache */ + /** + * Use only cache + */ int only_cached; - /* the authoritative zone to query */ + /** + * the authoritative zone to query + */ struct GNUNET_CRYPTO_ShortHashCode authority; - /* the name of the authoritative zone to query */ + /** + * the name of the authoritative zone to query + */ char authority_name[MAX_DNS_LABEL_LENGTH]; - /* a handle for dht lookups. should be NULL if no lookups are in progress */ + /** + * a handle for dht lookups. should be NULL if no lookups are in progress + */ struct GNUNET_DHT_GetHandle *get_handle; - /* timeout set for this lookup task */ + /** + * timeout set for this lookup task + */ struct GNUNET_TIME_Relative timeout; - /* a handle to a vpn request */ + /** + * a handle to a vpn request + */ struct GNUNET_VPN_RedirectionRequest *vpn_handle; - /* a socket for a dns request */ + /** + * a socket for a dns request + */ struct GNUNET_NETWORK_Handle *dns_sock; - /* a synthesized dns name */ + /** + * a synthesized dns name + */ char dns_name[MAX_DNS_NAME_LENGTH]; - /* the authoritative dns zone */ + /** + * the authoritative dns zone + */ char dns_zone[MAX_DNS_NAME_LENGTH]; - /* the address of the DNS server FIXME not needed? */ + /** + * the address of the DNS server FIXME not needed? + */ struct sockaddr_in dns_addr; - /* handle to the local stub resolver request */ + /** + * handle to the local stub resolver request + */ struct GNUNET_RESOLVER_RequestHandle *dns_resolver_handle; - /* select task for DNS */ + /** + * select task for DNS + */ GNUNET_SCHEDULER_TaskIdentifier dns_read_task; - /* pointer to raw dns query payload FIXME needs to be freed/NULL */ + /** + * pointer to raw dns query payload FIXME needs to be freed/NULL + */ char *dns_raw_packet; - /* size of the raw dns query */ + /** + * size of the raw dns query + */ size_t dns_raw_packet_size; - /* timeout task for the lookup */ + /** + * timeout task for the lookup + */ GNUNET_SCHEDULER_TaskIdentifier timeout_task; - /* continuation to call on timeout */ + /** + * continuation to call on timeout + */ GNUNET_SCHEDULER_Task timeout_cont; - /* closure for timeout cont */ + /** + * closure for timeout cont + */ void* timeout_cont_cls; - /* called when resolution phase finishes */ + /** + * called when resolution phase finishes + */ ResolutionResultProcessor proc; - /* closure passed to proc */ + /** + * closure passed to proc + */ void* proc_cls; - /* DLL to store the authority chain */ + /** + * DLL to store the authority chain + */ struct AuthorityChain *authority_chain_head; - /* DLL to store the authority chain */ + /** + * DLL to store the authority chain + */ struct AuthorityChain *authority_chain_tail; - /* status of the resolution result */ + /** + * status of the resolution result + */ enum ResolutionStatus status; - /* The provate local zone of this request */ + /** + * The provate local zone of this request + */ struct GNUNET_CRYPTO_ShortHashCode private_local_zone; /** @@ -233,16 +353,24 @@ struct ResolverHandle */ struct RecordLookupHandle { - /* the record type to look up */ + /** + * the record type to look up + */ enum GNUNET_GNS_RecordType record_type; - /* the name to look up */ + /** + * the name to look up + */ char name[MAX_DNS_NAME_LENGTH]; - /* Method to call on record resolution result */ + /** + * Method to call on record resolution result + */ RecordLookupProcessor proc; - /* closure to pass to proc */ + /** + * closure to pass to proc + */ void* proc_cls; }; @@ -253,98 +381,150 @@ struct RecordLookupHandle */ struct NameShortenHandle { - /* Method to call on shorten result */ + /** + * Method to call on shorten result + */ ShortenResultProcessor proc; - /* closure to pass to proc */ + /** + * closure to pass to proc + */ void* proc_cls; - /* result of shorten */ + /** + * result of shorten + */ char result[MAX_DNS_NAME_LENGTH]; - /* root zone */ + /** + * root zone + */ struct GNUNET_CRYPTO_ShortHashCode *root_zone; - /* private zone */ + /** + * private zone + */ struct GNUNET_CRYPTO_ShortHashCode *private_zone; - /* name of private zone */ + /** + * name of private zone + */ char private_zone_name[MAX_DNS_LABEL_LENGTH]; - /* shorten zone */ + /** + * shorten zone + */ struct GNUNET_CRYPTO_ShortHashCode *shorten_zone; - /* name of shorten zone */ + /** + * name of shorten zone + */ char shorten_zone_name[MAX_DNS_LABEL_LENGTH]; }; + /** * Handle to a get authority context */ struct GetNameAuthorityHandle { - /* the name to look up authority for */ + /** + * the name to look up authority for + */ char name[MAX_DNS_NAME_LENGTH]; - /* the result */ + /** + * the result + */ char result[MAX_DNS_NAME_LENGTH]; - /* Method to call on result */ + /** + * Method to call on result + */ GetAuthorityResultProcessor proc; - /* closure to pass to proc */ + /** + * closure to pass to proc + */ void* proc_cls; }; + /** * Handle to a pseu lookup */ struct GetPseuAuthorityHandle { - /* DLL */ + /** + * DLL + */ struct GetPseuAuthorityHandle *next; - /* DLL */ + /** + * DLL + */ struct GetPseuAuthorityHandle *prev; - /* the name to store the zone under */ + /** + * the name to store the zone under + */ char name[MAX_DNS_LABEL_LENGTH]; - /* test name to store the zone under */ + /** + * test name to store the zone under + */ char test_name[MAX_DNS_LABEL_LENGTH]; - /* the zone of our authority */ + /** + * the zone of our authority + */ struct GNUNET_CRYPTO_ShortHashCode our_zone; - /* the private key of the zone to store the pseu in */ + /** + * the private key of the zone to store the pseu in + */ struct GNUNET_CRYPTO_RsaPrivateKey *key; - /* a handle for dht lookups. should be NULL if no lookups are in progress */ + /** + * a handle for dht lookups. should be NULL if no lookups are in progress + */ struct GNUNET_DHT_GetHandle *get_handle; - /* timeout task for lookup */ + /** + * timeout task for lookup + */ GNUNET_SCHEDULER_TaskIdentifier timeout; - /* Authority to shorten */ + /** + * Authority to shorten + */ struct AuthorityChain *auth; - /* handle to namestore request */ + /** + * handle to namestore request + */ struct GNUNET_NAMESTORE_QueueEntry* namestore_task; }; + /** * Namestore queue entries in background */ struct NamestoreBGTask { - /* node in heap */ + /** + * node in heap + */ struct GNUNET_CONTAINER_HeapNode *node; - /* queue entry */ + /** + * queue entry + */ struct GNUNET_NAMESTORE_QueueEntry *qe; }; + /** * Initialize the resolver * MUST be called before other gns_resolver_* methods @@ -359,18 +539,20 @@ struct NamestoreBGTask * @returns GNUNET_OK on success */ int -gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh, - struct GNUNET_DHT_Handle *dh, - struct GNUNET_CRYPTO_ShortHashCode lz, - const struct GNUNET_CONFIGURATION_Handle *c, - unsigned long long max_bg_queries, - int ignore_pending); +gns_resolver_init (struct GNUNET_NAMESTORE_Handle *nh, + struct GNUNET_DHT_Handle *dh, + struct GNUNET_CRYPTO_ShortHashCode lz, + const struct GNUNET_CONFIGURATION_Handle *c, + unsigned long long max_bg_queries, + int ignore_pending); + /** * Cleanup resolver: Terminate pending lookups */ void -gns_resolver_cleanup(void); +gns_resolver_cleanup (void); + /** * Lookup of a record in a specific zone @@ -387,15 +569,16 @@ gns_resolver_cleanup(void); * @param cls the closure to pass to proc */ void -gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, - struct GNUNET_CRYPTO_ShortHashCode pzone, - uint32_t record_type, - const char* name, - struct GNUNET_CRYPTO_RsaPrivateKey *key, - struct GNUNET_TIME_Relative timeout, - int only_cached, - RecordLookupProcessor proc, - void* cls); +gns_resolver_lookup_record (struct GNUNET_CRYPTO_ShortHashCode zone, + struct GNUNET_CRYPTO_ShortHashCode pzone, + uint32_t record_type, + const char* name, + struct GNUNET_CRYPTO_RsaPrivateKey *key, + struct GNUNET_TIME_Relative timeout, + int only_cached, + RecordLookupProcessor proc, + void* cls); + /** * Shortens a name if possible. If the shortening fails @@ -414,14 +597,15 @@ gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, * @param proc_cls the closure to pass to proc */ void -gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode *zone, - struct GNUNET_CRYPTO_ShortHashCode *pzone, - struct GNUNET_CRYPTO_ShortHashCode *szone, - const char* name, - const char* private_zone_name, - const char* shorten_zone_name, - ShortenResultProcessor proc, - void* proc_cls); +gns_resolver_shorten_name (struct GNUNET_CRYPTO_ShortHashCode *zone, + struct GNUNET_CRYPTO_ShortHashCode *pzone, + struct GNUNET_CRYPTO_ShortHashCode *szone, + const char* name, + const char* private_zone_name, + const char* shorten_zone_name, + ShortenResultProcessor proc, + void* proc_cls); + /** * Tries to resolve the authority for name @@ -434,11 +618,11 @@ gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode *zone, * @param proc_cls the closure to pass to the processor */ void -gns_resolver_get_authority(struct GNUNET_CRYPTO_ShortHashCode zone, - struct GNUNET_CRYPTO_ShortHashCode pzone, - const char* name, - GetAuthorityResultProcessor proc, - void* proc_cls); +gns_resolver_get_authority (struct GNUNET_CRYPTO_ShortHashCode zone, + struct GNUNET_CRYPTO_ShortHashCode pzone, + const char* name, + GetAuthorityResultProcessor proc, + void* proc_cls); /** * Generic function to check for TLDs @@ -448,7 +632,9 @@ gns_resolver_get_authority(struct GNUNET_CRYPTO_ShortHashCode zone, * @return GNUNET_YES or GNUNET_NO */ int -is_tld(const char* name, const char* tld); +is_tld (const char* name, + const char* tld); + /** * Checks for gnunet/zkey diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c index a2faecf2d..d8da01f5b 100644 --- a/src/gns/plugin_block_gns.c +++ b/src/gns/plugin_block_gns.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet - (C) 2010 Christian Grothoff (and other contributing authors) + (C) 2010, 2012 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -63,17 +63,19 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, size_t xquery_size, const void *reply_block, size_t reply_block_size) { + const struct GNSNameRecordBlock *nrb; const char* name; + const char *name_end; + const char *rd_data; struct GNUNET_HashCode query_key; struct GNUNET_HashCode mhash; struct GNUNET_HashCode chash; struct GNUNET_CRYPTO_ShortHashCode pkey_hash; - struct GNSNameRecordBlock *nrb; struct GNUNET_CRYPTO_HashAsciiEncoded xor_exp; struct GNUNET_CRYPTO_HashAsciiEncoded xor_got; uint32_t rd_count; - char* rd_data = NULL; - int rd_len; + size_t rd_len; + size_t name_len; uint32_t record_xquery; unsigned int record_match; @@ -97,9 +99,15 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, /* this is a reply */ - nrb = (struct GNSNameRecordBlock *)reply_block; - name = (const char*)&nrb[1]; - + nrb = (const struct GNSNameRecordBlock *)reply_block; + name = (const char*) &nrb[1]; + name_end = memchr (name, 0, reply_block_size - sizeof (struct GNSNameRecordBlock)); + if (NULL == name_end) + { + GNUNET_break_op (0); + return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; + } + name_len = (name_end - name) + 1; GNUNET_CRYPTO_short_hash (&nrb->public_key, sizeof(nrb->public_key), &pkey_hash); @@ -121,9 +129,8 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, record_match = 0; rd_count = ntohl(nrb->rd_count); - rd_data = (char*)&nrb[1]; - rd_data += strlen(name) + 1; - rd_len = reply_block_size - (strlen(name) + 1 + rd_data = &name[name_len]; + rd_len = reply_block_size - (name_len + sizeof(struct GNSNameRecordBlock)); { struct GNUNET_NAMESTORE_RecordData rd[rd_count]; diff --git a/src/gns/proxy/gnunet-gns-proxy.py b/src/gns/proxy/gnunet-gns-proxy.py deleted file mode 100644 index 73085bdf5..000000000 --- a/src/gns/proxy/gnunet-gns-proxy.py +++ /dev/null @@ -1,226 +0,0 @@ -#!/usr/bin/python - -""" -Copyright (c) 2001 SUZUKI Hisao - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -""" - -__doc__ = """Tiny HTTP Proxy. - -This module implements GET, HEAD, POST, PUT and DELETE methods -on BaseHTTPServer, and behaves as an HTTP proxy. The CONNECT -method is also implemented experimentally, but has not been -tested yet. - -Any help will be greatly appreciated. SUZUKI Hisao -""" - -__version__ = "0.2.1" - -import BaseHTTPServer, select, socket, SocketServer, urlparse, re, string, os, sys - -class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): - __base = BaseHTTPServer.BaseHTTPRequestHandler - __base_handle = __base.handle - - server_version = "TinyHTTPProxy/" + __version__ - rbufsize = 0 # self.rfile Be unbuffered - host_port = () - - def handle(self): - (ip, port) = self.client_address - if hasattr(self, 'allowed_clients') and ip not in self.allowed_clients: - self.raw_requestline = self.rfile.readline() - if self.parse_request(): self.send_error(403) - else: - self.__base_handle() - - def _connect_to(self, netloc, soc): - i = netloc.find(':') - to_replace = "" - if i >= 0: - self.host_port = netloc[:i], int(netloc[i+1:]) - if (re.match("(\w+\.)*gnunet$", self.host_port[0])): - print 'calling gnunet-gns -a '+netloc[:i] - auth = os.popen("gnunet-gns -a "+netloc[:i]) - lines = auth.readlines() - if (len(lines) > 0): - print 'result: '+lines[0].split(" ")[-1].rstrip() - to_replace = lines[0].split(" ")[-1].rstrip() - else: - to_replace = "+" - else: - self.host_port = netloc, 80 - if (re.match("(\w+\.)*gnunet$", self.host_port[0])): - print 'calling gnunet-gns -a '+netloc - auth = os.popen("gnunet-gns -a "+netloc) - lines = auth.readlines() - if (len(lines) > 0): - print 'result: '+lines[0].split(" ")[-1].rstrip() - to_replace = lines[0].split(" ")[-1].rstrip() - else: - to_replace = "+" - - print "\t" "connect to %s:%d" % self.host_port - try: soc.connect(self.host_port) - except socket.error, arg: - try: msg = arg[1] - except: msg = arg - self.send_error(404, msg) - return (0, 0) - return (1, to_replace) - - def do_CONNECT(self): - soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - res, to_repl = self._connect_to(self.path, soc) - if res: - self.log_request(200) - self.wfile.write(self.protocol_version + - " 200 Connection established\r\n") - self.wfile.write("Proxy-agent: %s\r\n" % self.version_string()) - self.wfile.write("\r\n") - self._read_write(soc, to_repl, 300) - finally: - print "\t" "bye" - soc.close() - self.connection.close() - - def test_re2(self, mo): - short = os.popen("gnunet-gns -s"+string.replace(mo.group(1), 'a href="http://', "")) - lines = short.readlines() - if (len(lines) < 1): - return mo.group(1) - elif (len(lines[0].split(" ")) > 0): - return 'a href="http://'+lines[0].split(" ")[-1].rstrip() - else: - return mo.group(1) - - def shorten_zkey(self): - return lambda mo: self.test_re2(mo) - #return lambda mo: 'a href="http://'+os.popen("gnunet-gns -s"+string.replace(mo.group(1), 'a href="http://', "")).readlines()[0].split(" ")[-1].rstrip() - - def test_re(self, to_repl, mo): - short = os.popen("gnunet-gns -s "+string.replace(mo.group(1)+to_repl, 'a href="http://', "")) - lines = short.readlines() - if (len(lines) < 1): - return to_repl - elif (len(lines[0].split(" ")) > 0): - return 'a href="http://'+lines[0].split(" ")[-1].rstrip() - else: - return to_repl - - def replace_and_shorten(self, to_repl): - return lambda mo: self.test_re(to_repl, mo) - # return lambda mo: 'a href="http://'+os.popen("gnunet-gns -s "+string.replace(mo.group(1)+to_repl, 'a href="http://', "")).readlines()[0].split(" ")[-1].rstrip() - #full = string.replace(mo.group(1)+to_repl, 'a href="http://', "") - #print 'calling gnunet-gns -s '+full - #s = os.popen("gnunet-gns -s "+full) - #lines = s.readlines() - #print 'short: '+lines[0].split(" ")[-1].rstrip() - #return 'a href="'+lines[0].split(" ")[-1].rstrip() - - def do_GET(self): - (scm, netloc, path, params, query, fragment) = urlparse.urlparse( - self.path, 'http') - if scm != 'http' or fragment or not netloc: - self.send_error(400, "bad url %s" % self.path) - return - soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - res, to_repl = self._connect_to(netloc, soc) - if res: - self.log_request() - soc.send("%s %s %s\r\n" % ( - self.command, - urlparse.urlunparse(('', '', path, params, query, '')), - self.request_version)) - if (re.match("(\w+\.)*gnunet$", self.headers['Host'])): - leho = os.popen("gnunet-gns -t LEHO -u "+self.headers['Host']).readlines() - if (len(leho) < 2): - print "Legacy hostname lookup failed!" - elif (len(leho) == 1): - print "Legacy hostname not present!" - else: - newhost = leho[1].split(" ")[-1].rstrip() - print "Changing Host: "+self.headers['Host']+" to "+newhost - self.headers['Host'] = newhost - self.headers['Connection'] = 'close' - del self.headers['Proxy-Connection'] - del self.headers['Accept-Encoding'] - for key_val in self.headers.items(): - soc.send("%s: %s\r\n" % key_val) - soc.send("\r\n") - self._read_write(soc, to_repl) - finally: - print "\t" "bye" - soc.close() - self.connection.close() - - def _read_write(self, soc, to_repl="", max_idling=20): - iw = [self.connection, soc] - ow = [] - count = 0 - msg = '' - while 1: - count += 1 - (ins, _, exs) = select.select(iw, ow, iw, 3) - if exs: - break - if ins: - for i in ins: - if i is soc: - out = self.connection - else: - out = soc - data = i.recv(8192) - if data: - #try: - data = re.sub(r'\nAccept-Ranges: \w+', r'', data) - data = re.sub('(a href="http://(\w+\.)*zkey)', - self.shorten_zkey(), data) - if (re.match("(\w+\.)*gnunet$", self.host_port[0])): - arr = self.host_port[0].split('.') - arr.pop(0) - data = re.sub('(a href="http://(\w+\.)*)(\+)', - self.replace_and_shorten(to_repl), data) - out.send(data) - count = 0 - #except: - # print "GNS exception:", sys.exc_info()[0] - - else: - print "\t" "idle", count - print msg - if count == max_idling: break - - do_HEAD = do_GET - do_POST = do_GET - do_PUT = do_GET - do_DELETE=do_GET - -class ThreadingHTTPServer (SocketServer.ThreadingMixIn, - BaseHTTPServer.HTTPServer): pass - -if __name__ == '__main__': - from sys import argv - if argv[1:] and argv[1] in ('-h', '--help'): - print argv[0], "[port [allowed_client_name ...]]" - else: - if argv[2:]: - allowed = [] - for name in argv[2:]: - client = socket.gethostbyname(name) - allowed.append(client) - print "Accept: %s (%s)" % (client, name) - ProxyHandler.allowed_clients = allowed - del argv[2:] - else: - print "Any clients will be served..." - BaseHTTPServer.test(ProxyHandler, ThreadingHTTPServer) - diff --git a/src/gns/proxy/test_cert.pem b/src/gns/proxy/test_cert.pem deleted file mode 100644 index 806fd48ff..000000000 --- a/src/gns/proxy/test_cert.pem +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEBzCCAu+gAwIBAgIJAI38FT23eNxGMA0GCSqGSIb3DQEBBQUAMIGZMQswCQYD -VQQGEwJERTEQMA4GA1UECAwHQmF2YXJpYTEPMA0GA1UEBwwGTXVuaWNoMR0wGwYD -VQQKDBRHTlVuZXQgTmFtaW5nIFN5c3RlbTEPMA0GA1UECwwGR05VbmV0MRUwEwYD -VQQDDAxHTlMgUHJveHkgQ0ExIDAeBgkqhkiG9w0BCQEWEWJvdW5jZUBnbnVuZXQu -b3JnMB4XDTEyMDcxNDIwMTQxN1oXDTIyMDcxMjIwMTQxN1owgZkxCzAJBgNVBAYT -AkRFMRAwDgYDVQQIDAdCYXZhcmlhMQ8wDQYDVQQHDAZNdW5pY2gxHTAbBgNVBAoM -FEdOVW5ldCBOYW1pbmcgU3lzdGVtMQ8wDQYDVQQLDAZHTlVuZXQxFTATBgNVBAMM -DEdOUyBQcm94eSBDQTEgMB4GCSqGSIb3DQEJARYRYm91bmNlQGdudW5ldC5vcmcw -ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDXPUIPuAKOMSJkgPUPBJ6K -axnhZ+uQ461AA6P+8YAIJFgN+rlWdeJPEmQwBAsu4tFGwQ+QwPRlPUffyLl4GA24 -8sHcrGImTnLaybKrqLMud7ti4aqct/w3r2gwJiaGDJguav/mOLyqRNlsqxVUjOC+ -6T39PaFofILekk2YQUnngl5Tvp4F20MhpziRPuHeObHDQHSzGxzirubvFb36bI3V -DA4HeMaom/oAU47mkx72JE0S1xlIa7H+d7n7oS73uO7oufB+H0FAnNJa+S9PF8t+ -bezCnfBSxwIpP3fUtUOq3lbRc6wx3Bm1hkQ1M86H+XuWXCy6HLz54P3GrYiw9sOX -AgMBAAGjUDBOMB0GA1UdDgQWBBRZs/qlW1u7P99aF6pcEQuCU1avXDAfBgNVHSME -GDAWgBRZs/qlW1u7P99aF6pcEQuCU1avXDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3 -DQEBBQUAA4IBAQCfx7JL7fX2CnLIyvs9cqEsu/8zFGwSg4NRj53IgE3K7z2pP3Wb -NdTo5JmlVOgy3ywQYPXPqveFXGIZR4+fPSRFIYNRuaqiRp6brx9h4xAVwbfp7UF5 -vZEGCcPnuXt2ZL+EE7JJNyCTp6ZfjnvTkAoKOQtMz5YfhaM65uIsA/Rr1fs7nk8z -qq9LQU8+sYzgzpGXFVrv48vuq+/d4V2wj+d2z4Q3VA1smsa3gstebEQUgyiFtMYB -+OHI0RFLQY97c5CyQRqZsgMto7IPoKwaTWTVvlQcxikx+Xs1SG9vYndBaI1ClLSI -xrbu7Gk2bwLfUXxdaJSOTrgKHLXTx14FXPbT ------END CERTIFICATE----- ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEA1z1CD7gCjjEiZID1DwSeimsZ4WfrkOOtQAOj/vGACCRYDfq5 -VnXiTxJkMAQLLuLRRsEPkMD0ZT1H38i5eBgNuPLB3KxiJk5y2smyq6izLne7YuGq -nLf8N69oMCYmhgyYLmr/5ji8qkTZbKsVVIzgvuk9/T2haHyC3pJNmEFJ54JeU76e -BdtDIac4kT7h3jmxw0B0sxsc4q7m7xW9+myN1QwOB3jGqJv6AFOO5pMe9iRNEtcZ -SGux/ne5+6Eu97ju6Lnwfh9BQJzSWvkvTxfLfm3swp3wUscCKT931LVDqt5W0XOs -MdwZtYZENTPOh/l7llwsuhy8+eD9xq2IsPbDlwIDAQABAoIBAG6s9iIlCVNaWof5 -c4lEY81jIwyvpgZ7vCNVe+dlAOOu5IRTryeROExWdaPnAGUchmXucfWJ8mF4cFPW -39+r5qp6UUsKbPGrlw1/d1sjRPeY44cF6Pfq90se6+EOTPLS2RHNPUaBWCnpey+Q -jUhLpGkmgBSOs0eJ9rVB35pxv/HFOxnFQO80sAJElixEZlGL1jgLKCFDW/5BDKrO -oKiRylugTC75pcAW6tvqZtE/WCPr1xaJP2AOfLlWQY/STR1NyeJxs4JSsQlCZNBY -RTam0kVQhs64QGYh+XKhQtvaqTfN22flCiJHuOy3sDlst8dPrlEW8bHVTCDE18y0 -ZzwVcVkCgYEA6ts1crJ/69RuvZd7c5//b1ptjaXQhRTRYGDLdAaTY+cSP29bc5CG -fx/Zohg+5hpD/1fhiWkQPY5u88XQkLxnLSiSt0WDOslTxWLAnDJa6VakldTOV8Fl -4KmeXU1jG2gYmTiFf5nz7FqAudld0Mim1qWGu4rtVeaaEyFoyfndw1sCgYEA6p3u -dyT5dNSJFdHO5auvzexRukBOjnaUTz7fVukzs44hnW8hv3hYAR5o7u2Ye5f0Xclr -tLyeZfeiiBGkANy592ljI4ZeDnkkrWH9HH+fk3nJUs1VsP7viJSouhpvGZpz2sU9 -Axz4oUb9/1bDA2BSs0cEFGZ9K4RWoTg7aL11YXUCgYAaguBHsEqsbnCJyl3PMZJ+ -GXEgekVNoIn6HTMaR9u/fUgcDQ//vaLRGuFQYPhItVJTsrHs9wU0Ta3MqtneXMYw -3NGjCp/DtRJVx84CU9TbXkJ5/2nDkjtT3xHXanLzlw6fzTeUreZRGe5KDHWAqgXb -WRgad5ZPChb+bdkMY75a3QKBgQCYTc3wKmCGJzKWp4zYK4wE8dRcREK62N+OUhJK -KTkW5r2LpgkSct0uXL9h23uRQCOyfn8c5RUuvIMWMd11cdSHeDKTbTbBzoKwy1u0 -lGTTJ8w5pHJsZBK7Z0XhCif1Rv7Olhv1WWlNyPg6Oeh+2JjXKNLNK3s2NMLIBekL -JXJ9wQKBgGsvTzH5cUG7dIiIH7X6UQ/RN9eY7y5se5g+JUYZwGljZcLM0svanxW1 -UpPA2weyrFrWvDUEupMVg7rrocBMMJ205OUaymKdrSaVeWQxevzigEt6ZX67G6Xw -uj+MLQ3+yj87JlVqoDRvAHlltLfz9AzPM2sSGOdaqC2q14DJXVOU ------END RSA PRIVATE KEY----- -- cgit v1.2.3