diff options
Diffstat (limited to 'src/gns/gnunet-gns-proxy.c')
-rw-r--r-- | src/gns/gnunet-gns-proxy.c | 308 |
1 files changed, 154 insertions, 154 deletions
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index fc28d6565..a67f7356e 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Default Socks5 listen port. | 47 | * Default Socks5 listen port. |
48 | */ | 48 | */ |
49 | #define GNUNET_GNS_PROXY_PORT 7777 | 49 | #define GNUNET_GNS_PROXY_PORT 7777 |
50 | 50 | ||
51 | /** | 51 | /** |
@@ -119,7 +119,7 @@ | |||
119 | 119 | ||
120 | /** | 120 | /** |
121 | * Commands in Socks5. | 121 | * Commands in Socks5. |
122 | */ | 122 | */ |
123 | enum Socks5Commands | 123 | enum Socks5Commands |
124 | { | 124 | { |
125 | /** | 125 | /** |
@@ -141,7 +141,7 @@ enum Socks5Commands | |||
141 | 141 | ||
142 | /** | 142 | /** |
143 | * Address types in Socks5. | 143 | * Address types in Socks5. |
144 | */ | 144 | */ |
145 | enum Socks5AddressType | 145 | enum Socks5AddressType |
146 | { | 146 | { |
147 | /** | 147 | /** |
@@ -242,7 +242,7 @@ struct Socks5ClientRequestMessage | |||
242 | */ | 242 | */ |
243 | uint8_t addr_type; | 243 | uint8_t addr_type; |
244 | 244 | ||
245 | /* | 245 | /* |
246 | * Followed by either an ip4/ipv6 address or a domain name with a | 246 | * Followed by either an ip4/ipv6 address or a domain name with a |
247 | * length field (uint8_t) in front (depending on @e addr_type). | 247 | * length field (uint8_t) in front (depending on @e addr_type). |
248 | * followed by port number in network byte order (uint16_t). | 248 | * followed by port number in network byte order (uint16_t). |
@@ -275,7 +275,7 @@ struct Socks5ServerResponseMessage | |||
275 | */ | 275 | */ |
276 | uint8_t addr_type; | 276 | uint8_t addr_type; |
277 | 277 | ||
278 | /* | 278 | /* |
279 | * Followed by either an ip4/ipv6 address or a domain name with a | 279 | * Followed by either an ip4/ipv6 address or a domain name with a |
280 | * length field (uint8_t) in front (depending on @e addr_type). | 280 | * length field (uint8_t) in front (depending on @e addr_type). |
281 | * followed by port number in network byte order (uint16_t). | 281 | * followed by port number in network byte order (uint16_t). |
@@ -293,12 +293,12 @@ struct Socks5ServerResponseMessage | |||
293 | struct ProxyCA | 293 | struct ProxyCA |
294 | { | 294 | { |
295 | /** | 295 | /** |
296 | * The certificate | 296 | * The certificate |
297 | */ | 297 | */ |
298 | gnutls_x509_crt_t cert; | 298 | gnutls_x509_crt_t cert; |
299 | 299 | ||
300 | /** | 300 | /** |
301 | * The private key | 301 | * The private key |
302 | */ | 302 | */ |
303 | gnutls_x509_privkey_t key; | 303 | gnutls_x509_privkey_t key; |
304 | }; | 304 | }; |
@@ -310,12 +310,12 @@ struct ProxyCA | |||
310 | struct ProxyGNSCertificate | 310 | struct ProxyGNSCertificate |
311 | { | 311 | { |
312 | /** | 312 | /** |
313 | * The certificate as PEM | 313 | * The certificate as PEM |
314 | */ | 314 | */ |
315 | char cert[MAX_PEM_SIZE]; | 315 | char cert[MAX_PEM_SIZE]; |
316 | 316 | ||
317 | /** | 317 | /** |
318 | * The private key as PEM | 318 | * The private key as PEM |
319 | */ | 319 | */ |
320 | char key[MAX_PEM_SIZE]; | 320 | char key[MAX_PEM_SIZE]; |
321 | }; | 321 | }; |
@@ -328,22 +328,22 @@ struct ProxyGNSCertificate | |||
328 | struct MhdHttpList | 328 | struct MhdHttpList |
329 | { | 329 | { |
330 | /** | 330 | /** |
331 | * DLL for httpds | 331 | * DLL for httpds |
332 | */ | 332 | */ |
333 | struct MhdHttpList *prev; | 333 | struct MhdHttpList *prev; |
334 | 334 | ||
335 | /** | 335 | /** |
336 | * DLL for httpds | 336 | * DLL for httpds |
337 | */ | 337 | */ |
338 | struct MhdHttpList *next; | 338 | struct MhdHttpList *next; |
339 | 339 | ||
340 | /** | 340 | /** |
341 | * the domain name to server (only important for SSL) | 341 | * the domain name to server (only important for SSL) |
342 | */ | 342 | */ |
343 | char *domain; | 343 | char *domain; |
344 | 344 | ||
345 | /** | 345 | /** |
346 | * The daemon handle | 346 | * The daemon handle |
347 | */ | 347 | */ |
348 | struct MHD_Daemon *daemon; | 348 | struct MHD_Daemon *daemon; |
349 | 349 | ||
@@ -353,12 +353,12 @@ struct MhdHttpList | |||
353 | struct ProxyGNSCertificate *proxy_cert; | 353 | struct ProxyGNSCertificate *proxy_cert; |
354 | 354 | ||
355 | /** | 355 | /** |
356 | * The task ID | 356 | * The task ID |
357 | */ | 357 | */ |
358 | GNUNET_SCHEDULER_TaskIdentifier httpd_task; | 358 | GNUNET_SCHEDULER_TaskIdentifier httpd_task; |
359 | 359 | ||
360 | /** | 360 | /** |
361 | * is this an ssl daemon? | 361 | * is this an ssl daemon? |
362 | */ | 362 | */ |
363 | int is_ssl; | 363 | int is_ssl; |
364 | 364 | ||
@@ -369,7 +369,7 @@ struct MhdHttpList | |||
369 | 369 | ||
370 | 370 | ||
371 | /** | 371 | /** |
372 | * The socks phases. | 372 | * The socks phases. |
373 | */ | 373 | */ |
374 | enum SocksPhase | 374 | enum SocksPhase |
375 | { | 375 | { |
@@ -443,7 +443,7 @@ struct Socks5Request | |||
443 | struct Socks5Request *prev; | 443 | struct Socks5Request *prev; |
444 | 444 | ||
445 | /** | 445 | /** |
446 | * The client socket | 446 | * The client socket |
447 | */ | 447 | */ |
448 | struct GNUNET_NETWORK_Handle *sock; | 448 | struct GNUNET_NETWORK_Handle *sock; |
449 | 449 | ||
@@ -453,27 +453,27 @@ struct Socks5Request | |||
453 | struct GNUNET_GNS_LookupRequest *gns_lookup; | 453 | struct GNUNET_GNS_LookupRequest *gns_lookup; |
454 | 454 | ||
455 | /** | 455 | /** |
456 | * Client socket read task | 456 | * Client socket read task |
457 | */ | 457 | */ |
458 | GNUNET_SCHEDULER_TaskIdentifier rtask; | 458 | GNUNET_SCHEDULER_TaskIdentifier rtask; |
459 | 459 | ||
460 | /** | 460 | /** |
461 | * Client socket write task | 461 | * Client socket write task |
462 | */ | 462 | */ |
463 | GNUNET_SCHEDULER_TaskIdentifier wtask; | 463 | GNUNET_SCHEDULER_TaskIdentifier wtask; |
464 | 464 | ||
465 | /** | 465 | /** |
466 | * Timeout task | 466 | * Timeout task |
467 | */ | 467 | */ |
468 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; | 468 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; |
469 | 469 | ||
470 | /** | 470 | /** |
471 | * Read buffer | 471 | * Read buffer |
472 | */ | 472 | */ |
473 | char rbuf[SOCKS_BUFFERSIZE]; | 473 | char rbuf[SOCKS_BUFFERSIZE]; |
474 | 474 | ||
475 | /** | 475 | /** |
476 | * Write buffer | 476 | * Write buffer |
477 | */ | 477 | */ |
478 | char wbuf[SOCKS_BUFFERSIZE]; | 478 | char wbuf[SOCKS_BUFFERSIZE]; |
479 | 479 | ||
@@ -493,7 +493,7 @@ struct Socks5Request | |||
493 | struct MHD_Response *response; | 493 | struct MHD_Response *response; |
494 | 494 | ||
495 | /** | 495 | /** |
496 | * the domain name to server (only important for SSL) | 496 | * the domain name to server (only important for SSL) |
497 | */ | 497 | */ |
498 | char *domain; | 498 | char *domain; |
499 | 499 | ||
@@ -503,12 +503,12 @@ struct Socks5Request | |||
503 | char *leho; | 503 | char *leho; |
504 | 504 | ||
505 | /** | 505 | /** |
506 | * The URL to fetch | 506 | * The URL to fetch |
507 | */ | 507 | */ |
508 | char *url; | 508 | char *url; |
509 | 509 | ||
510 | /** | 510 | /** |
511 | * Handle to cURL | 511 | * Handle to cURL |
512 | */ | 512 | */ |
513 | CURL *curl; | 513 | CURL *curl; |
514 | 514 | ||
@@ -516,22 +516,22 @@ struct Socks5Request | |||
516 | * HTTP request headers for the curl request. | 516 | * HTTP request headers for the curl request. |
517 | */ | 517 | */ |
518 | struct curl_slist *headers; | 518 | struct curl_slist *headers; |
519 | 519 | ||
520 | /** | 520 | /** |
521 | * HTTP response code to give to MHD for the response. | 521 | * HTTP response code to give to MHD for the response. |
522 | */ | 522 | */ |
523 | unsigned int response_code; | 523 | unsigned int response_code; |
524 | 524 | ||
525 | /** | 525 | /** |
526 | * Number of bytes already in read buffer | 526 | * Number of bytes already in read buffer |
527 | */ | 527 | */ |
528 | size_t rbuf_len; | 528 | size_t rbuf_len; |
529 | 529 | ||
530 | /** | 530 | /** |
531 | * Number of bytes already in write buffer | 531 | * Number of bytes already in write buffer |
532 | */ | 532 | */ |
533 | size_t wbuf_len; | 533 | size_t wbuf_len; |
534 | 534 | ||
535 | /** | 535 | /** |
536 | * Number of bytes already in the IO buffer. | 536 | * Number of bytes already in the IO buffer. |
537 | */ | 537 | */ |
@@ -543,7 +543,7 @@ struct Socks5Request | |||
543 | struct sockaddr_storage destination_address; | 543 | struct sockaddr_storage destination_address; |
544 | 544 | ||
545 | /** | 545 | /** |
546 | * The socks state | 546 | * The socks state |
547 | */ | 547 | */ |
548 | enum SocksPhase state; | 548 | enum SocksPhase state; |
549 | 549 | ||
@@ -560,22 +560,22 @@ struct Socks5Request | |||
560 | 560 | ||
561 | 561 | ||
562 | /** | 562 | /** |
563 | * The port the proxy is running on (default 7777) | 563 | * The port the proxy is running on (default 7777) |
564 | */ | 564 | */ |
565 | static unsigned long port = GNUNET_GNS_PROXY_PORT; | 565 | static unsigned long port = GNUNET_GNS_PROXY_PORT; |
566 | 566 | ||
567 | /** | 567 | /** |
568 | * The CA file (pem) to use for the proxy CA | 568 | * The CA file (pem) to use for the proxy CA |
569 | */ | 569 | */ |
570 | static char *cafile_opt; | 570 | static char *cafile_opt; |
571 | 571 | ||
572 | /** | 572 | /** |
573 | * The listen socket of the proxy | 573 | * The listen socket of the proxy |
574 | */ | 574 | */ |
575 | static struct GNUNET_NETWORK_Handle *lsock; | 575 | static struct GNUNET_NETWORK_Handle *lsock; |
576 | 576 | ||
577 | /** | 577 | /** |
578 | * The listen task ID | 578 | * The listen task ID |
579 | */ | 579 | */ |
580 | static GNUNET_SCHEDULER_TaskIdentifier ltask; | 580 | static GNUNET_SCHEDULER_TaskIdentifier ltask; |
581 | 581 | ||
@@ -585,22 +585,22 @@ static GNUNET_SCHEDULER_TaskIdentifier ltask; | |||
585 | static GNUNET_SCHEDULER_TaskIdentifier curl_download_task; | 585 | static GNUNET_SCHEDULER_TaskIdentifier curl_download_task; |
586 | 586 | ||
587 | /** | 587 | /** |
588 | * The cURL multi handle | 588 | * The cURL multi handle |
589 | */ | 589 | */ |
590 | static CURLM *curl_multi; | 590 | static CURLM *curl_multi; |
591 | 591 | ||
592 | /** | 592 | /** |
593 | * Handle to the GNS service | 593 | * Handle to the GNS service |
594 | */ | 594 | */ |
595 | static struct GNUNET_GNS_Handle *gns_handle; | 595 | static struct GNUNET_GNS_Handle *gns_handle; |
596 | 596 | ||
597 | /** | 597 | /** |
598 | * DLL for http/https daemons | 598 | * DLL for http/https daemons |
599 | */ | 599 | */ |
600 | static struct MhdHttpList *mhd_httpd_head; | 600 | static struct MhdHttpList *mhd_httpd_head; |
601 | 601 | ||
602 | /** | 602 | /** |
603 | * DLL for http/https daemons | 603 | * DLL for http/https daemons |
604 | */ | 604 | */ |
605 | static struct MhdHttpList *mhd_httpd_tail; | 605 | static struct MhdHttpList *mhd_httpd_tail; |
606 | 606 | ||
@@ -621,12 +621,12 @@ static struct Socks5Request *s5r_head; | |||
621 | static struct Socks5Request *s5r_tail; | 621 | static struct Socks5Request *s5r_tail; |
622 | 622 | ||
623 | /** | 623 | /** |
624 | * The users local GNS master zone | 624 | * The users local GNS master zone |
625 | */ | 625 | */ |
626 | static struct GNUNET_CRYPTO_EccPublicSignKey local_gns_zone; | 626 | static struct GNUNET_CRYPTO_EccPublicSignKey local_gns_zone; |
627 | 627 | ||
628 | /** | 628 | /** |
629 | * The users local shorten zone | 629 | * The users local shorten zone |
630 | */ | 630 | */ |
631 | static struct GNUNET_CRYPTO_EccPrivateKey local_shorten_zone; | 631 | static struct GNUNET_CRYPTO_EccPrivateKey local_shorten_zone; |
632 | 632 | ||
@@ -636,7 +636,7 @@ static struct GNUNET_CRYPTO_EccPrivateKey local_shorten_zone; | |||
636 | static int do_shorten; | 636 | static int do_shorten; |
637 | 637 | ||
638 | /** | 638 | /** |
639 | * The CA for SSL certificate generation | 639 | * The CA for SSL certificate generation |
640 | */ | 640 | */ |
641 | static struct ProxyCA proxy_ca; | 641 | static struct ProxyCA proxy_ca; |
642 | 642 | ||
@@ -682,11 +682,11 @@ static void | |||
682 | cleanup_s5r (struct Socks5Request *s5r) | 682 | cleanup_s5r (struct Socks5Request *s5r) |
683 | { | 683 | { |
684 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 684 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
685 | "Cleaning up socks request\n"); | 685 | "Cleaning up socks request\n"); |
686 | if (NULL != s5r->curl) | 686 | if (NULL != s5r->curl) |
687 | { | 687 | { |
688 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 688 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
689 | "Cleaning up cURL handle\n"); | 689 | "Cleaning up cURL handle\n"); |
690 | curl_multi_remove_handle (curl_multi, s5r->curl); | 690 | curl_multi_remove_handle (curl_multi, s5r->curl); |
691 | curl_easy_cleanup (s5r->curl); | 691 | curl_easy_cleanup (s5r->curl); |
692 | s5r->curl = NULL; | 692 | s5r->curl = NULL; |
@@ -703,7 +703,7 @@ cleanup_s5r (struct Socks5Request *s5r) | |||
703 | GNUNET_SCHEDULER_cancel (s5r->wtask); | 703 | GNUNET_SCHEDULER_cancel (s5r->wtask); |
704 | if (NULL != s5r->gns_lookup) | 704 | if (NULL != s5r->gns_lookup) |
705 | GNUNET_GNS_lookup_cancel (s5r->gns_lookup); | 705 | GNUNET_GNS_lookup_cancel (s5r->gns_lookup); |
706 | if (NULL != s5r->sock) | 706 | if (NULL != s5r->sock) |
707 | { | 707 | { |
708 | if (SOCKS5_SOCKET_WITH_MHD <= s5r->state) | 708 | if (SOCKS5_SOCKET_WITH_MHD <= s5r->state) |
709 | GNUNET_NETWORK_socket_free_memory_only_ (s5r->sock); | 709 | GNUNET_NETWORK_socket_free_memory_only_ (s5r->sock); |
@@ -796,13 +796,13 @@ check_ssl_certificate (struct Socks5Request *s5r) | |||
796 | gnutls_session_t session; | 796 | gnutls_session_t session; |
797 | struct curl_slist * to_slist; | 797 | struct curl_slist * to_slist; |
798 | } gptr; | 798 | } gptr; |
799 | unsigned int cert_list_size; | 799 | unsigned int cert_list_size; |
800 | const gnutls_datum_t *chainp; | 800 | const gnutls_datum_t *chainp; |
801 | 801 | ||
802 | gptr.to_slist = NULL; | 802 | gptr.to_slist = NULL; |
803 | if (CURLE_OK != | 803 | if (CURLE_OK != |
804 | curl_easy_getinfo (s5r->curl, | 804 | curl_easy_getinfo (s5r->curl, |
805 | CURLINFO_GNUTLS_SESSION, | 805 | CURLINFO_GNUTLS_SESSION, |
806 | &gptr)) | 806 | &gptr)) |
807 | return GNUNET_SYSERR; | 807 | return GNUNET_SYSERR; |
808 | 808 | ||
@@ -832,7 +832,7 @@ check_ssl_certificate (struct Socks5Request *s5r) | |||
832 | return GNUNET_OK; | 832 | return GNUNET_OK; |
833 | } | 833 | } |
834 | 834 | ||
835 | 835 | ||
836 | /** | 836 | /** |
837 | * We're getting an HTTP response header from cURL. Convert it to the | 837 | * We're getting an HTTP response header from cURL. Convert it to the |
838 | * MHD response headers. Mostly copies the headers, but makes special | 838 | * MHD response headers. Mostly copies the headers, but makes special |
@@ -869,7 +869,7 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls) | |||
869 | (GNUNET_OK != check_ssl_certificate (s5r)) ) | 869 | (GNUNET_OK != check_ssl_certificate (s5r)) ) |
870 | return 0; | 870 | return 0; |
871 | 871 | ||
872 | GNUNET_break (CURLE_OK == | 872 | GNUNET_break (CURLE_OK == |
873 | curl_easy_getinfo (s5r->curl, | 873 | curl_easy_getinfo (s5r->curl, |
874 | CURLINFO_RESPONSE_CODE, | 874 | CURLINFO_RESPONSE_CODE, |
875 | &resp_code)); | 875 | &resp_code)); |
@@ -885,27 +885,27 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls) | |||
885 | if (NULL != s5r->leho) | 885 | if (NULL != s5r->leho) |
886 | { | 886 | { |
887 | char *cors_hdr; | 887 | char *cors_hdr; |
888 | 888 | ||
889 | GNUNET_asprintf (&cors_hdr, | 889 | GNUNET_asprintf (&cors_hdr, |
890 | (HTTPS_PORT == s5r->port) | 890 | (HTTPS_PORT == s5r->port) |
891 | ? "https://%s" | 891 | ? "https://%s" |
892 | : "http://%s", | 892 | : "http://%s", |
893 | s5r->leho); | 893 | s5r->leho); |
894 | 894 | ||
895 | GNUNET_break (MHD_YES == | 895 | GNUNET_break (MHD_YES == |
896 | MHD_add_response_header (s5r->response, | 896 | MHD_add_response_header (s5r->response, |
897 | MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, | 897 | MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, |
898 | cors_hdr)); | 898 | cors_hdr)); |
899 | GNUNET_free (cors_hdr); | 899 | GNUNET_free (cors_hdr); |
900 | } | 900 | } |
901 | /* force connection to be closed after each request, as we | 901 | /* force connection to be closed after each request, as we |
902 | do not support HTTP pipelining */ | 902 | do not support HTTP pipelining */ |
903 | GNUNET_break (MHD_YES == | 903 | GNUNET_break (MHD_YES == |
904 | MHD_add_response_header (s5r->response, | 904 | MHD_add_response_header (s5r->response, |
905 | MHD_HTTP_HEADER_CONNECTION, | 905 | MHD_HTTP_HEADER_CONNECTION, |
906 | "close")); | 906 | "close")); |
907 | } | 907 | } |
908 | 908 | ||
909 | ndup = GNUNET_strndup (buffer, bytes); | 909 | ndup = GNUNET_strndup (buffer, bytes); |
910 | hdr_type = strtok (ndup, ":"); | 910 | hdr_type = strtok (ndup, ":"); |
911 | if (NULL == hdr_type) | 911 | if (NULL == hdr_type) |
@@ -927,9 +927,9 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls) | |||
927 | if ( (NULL != s5r->leho) && | 927 | if ( (NULL != s5r->leho) && |
928 | (0 == strcasecmp (hdr_type, | 928 | (0 == strcasecmp (hdr_type, |
929 | MHD_HTTP_HEADER_SET_COOKIE)) ) | 929 | MHD_HTTP_HEADER_SET_COOKIE)) ) |
930 | 930 | ||
931 | { | 931 | { |
932 | new_cookie_hdr = GNUNET_malloc (strlen (hdr_val) + | 932 | new_cookie_hdr = GNUNET_malloc (strlen (hdr_val) + |
933 | strlen (s5r->domain) + 1); | 933 | strlen (s5r->domain) + 1); |
934 | offset = 0; | 934 | offset = 0; |
935 | domain_matched = GNUNET_NO; /* make sure we match domain at most once */ | 935 | domain_matched = GNUNET_NO; /* make sure we match domain at most once */ |
@@ -946,7 +946,7 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls) | |||
946 | if (0 == strcasecmp (cookie_domain, s5r->leho + delta_cdomain)) | 946 | if (0 == strcasecmp (cookie_domain, s5r->leho + delta_cdomain)) |
947 | { | 947 | { |
948 | offset += sprintf (new_cookie_hdr + offset, | 948 | offset += sprintf (new_cookie_hdr + offset, |
949 | " domain=%s;", | 949 | " domain=%s;", |
950 | s5r->domain); | 950 | s5r->domain); |
951 | continue; | 951 | continue; |
952 | } | 952 | } |
@@ -954,9 +954,9 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls) | |||
954 | else if (0 == strcmp (cookie_domain, s5r->leho)) | 954 | else if (0 == strcmp (cookie_domain, s5r->leho)) |
955 | { | 955 | { |
956 | offset += sprintf (new_cookie_hdr + offset, | 956 | offset += sprintf (new_cookie_hdr + offset, |
957 | " domain=%s;", | 957 | " domain=%s;", |
958 | s5r->domain); | 958 | s5r->domain); |
959 | continue; | 959 | continue; |
960 | } | 960 | } |
961 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 961 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
962 | _("Cookie domain `%s' supplied by server is invalid\n"), | 962 | _("Cookie domain `%s' supplied by server is invalid\n"), |
@@ -973,14 +973,14 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls) | |||
973 | if (0 == strcasecmp (MHD_HTTP_HEADER_LOCATION, hdr_type)) | 973 | if (0 == strcasecmp (MHD_HTTP_HEADER_LOCATION, hdr_type)) |
974 | { | 974 | { |
975 | char *leho_host; | 975 | char *leho_host; |
976 | 976 | ||
977 | GNUNET_asprintf (&leho_host, | 977 | GNUNET_asprintf (&leho_host, |
978 | (HTTPS_PORT != s5r->port) | 978 | (HTTPS_PORT != s5r->port) |
979 | ? "http://%s" | 979 | ? "http://%s" |
980 | : "https://%s", | 980 | : "https://%s", |
981 | s5r->leho); | 981 | s5r->leho); |
982 | if (0 == strncmp (leho_host, | 982 | if (0 == strncmp (leho_host, |
983 | hdr_val, | 983 | hdr_val, |
984 | strlen (leho_host))) | 984 | strlen (leho_host))) |
985 | { | 985 | { |
986 | GNUNET_asprintf (&new_location, | 986 | GNUNET_asprintf (&new_location, |
@@ -1051,12 +1051,12 @@ curl_download_cb (void *ptr, size_t size, size_t nmemb, void* ctx) | |||
1051 | "Pausing CURL download, not enough space\n"); | 1051 | "Pausing CURL download, not enough space\n"); |
1052 | return CURL_WRITEFUNC_PAUSE; /* not enough space */ | 1052 | return CURL_WRITEFUNC_PAUSE; /* not enough space */ |
1053 | } | 1053 | } |
1054 | memcpy (&s5r->io_buf[s5r->io_len], | 1054 | memcpy (&s5r->io_buf[s5r->io_len], |
1055 | ptr, | 1055 | ptr, |
1056 | total); | 1056 | total); |
1057 | s5r->io_len += total; | 1057 | s5r->io_len += total; |
1058 | if (s5r->io_len == total) | 1058 | if (s5r->io_len == total) |
1059 | run_mhd_now (s5r->hd); | 1059 | run_mhd_now (s5r->hd); |
1060 | return total; | 1060 | return total; |
1061 | } | 1061 | } |
1062 | 1062 | ||
@@ -1178,7 +1178,7 @@ curl_download_prepare () | |||
1178 | GNUNET_NETWORK_fdset_destroy (gws); | 1178 | GNUNET_NETWORK_fdset_destroy (gws); |
1179 | GNUNET_NETWORK_fdset_destroy (grs); | 1179 | GNUNET_NETWORK_fdset_destroy (grs); |
1180 | } | 1180 | } |
1181 | else | 1181 | else |
1182 | { | 1182 | { |
1183 | curl_download_task = GNUNET_SCHEDULER_add_delayed (rtime, | 1183 | curl_download_task = GNUNET_SCHEDULER_add_delayed (rtime, |
1184 | &curl_task_download, | 1184 | &curl_task_download, |
@@ -1194,7 +1194,7 @@ curl_download_prepare () | |||
1194 | * @param tc task context | 1194 | * @param tc task context |
1195 | */ | 1195 | */ |
1196 | static void | 1196 | static void |
1197 | curl_task_download (void *cls, | 1197 | curl_task_download (void *cls, |
1198 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 1198 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
1199 | { | 1199 | { |
1200 | int running; | 1200 | int running; |
@@ -1206,7 +1206,7 @@ curl_task_download (void *cls, | |||
1206 | curl_download_task = GNUNET_SCHEDULER_NO_TASK; | 1206 | curl_download_task = GNUNET_SCHEDULER_NO_TASK; |
1207 | do | 1207 | do |
1208 | { | 1208 | { |
1209 | running = 0; | 1209 | running = 0; |
1210 | mret = curl_multi_perform (curl_multi, &running); | 1210 | mret = curl_multi_perform (curl_multi, &running); |
1211 | while (NULL != (msg = curl_multi_info_read (curl_multi, &msgnum))) | 1211 | while (NULL != (msg = curl_multi_info_read (curl_multi, &msgnum))) |
1212 | { | 1212 | { |
@@ -1232,7 +1232,7 @@ curl_task_download (void *cls, | |||
1232 | case CURLE_GOT_NOTHING: | 1232 | case CURLE_GOT_NOTHING: |
1233 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1233 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1234 | "CURL download completed.\n"); | 1234 | "CURL download completed.\n"); |
1235 | s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE; | 1235 | s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE; |
1236 | run_mhd_now (s5r->hd); | 1236 | run_mhd_now (s5r->hd); |
1237 | break; | 1237 | break; |
1238 | default: | 1238 | default: |
@@ -1241,7 +1241,7 @@ curl_task_download (void *cls, | |||
1241 | curl_easy_strerror (msg->data.result)); | 1241 | curl_easy_strerror (msg->data.result)); |
1242 | /* FIXME: indicate error somehow? close MHD connection badly as well? */ | 1242 | /* FIXME: indicate error somehow? close MHD connection badly as well? */ |
1243 | s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE; | 1243 | s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE; |
1244 | run_mhd_now (s5r->hd); | 1244 | run_mhd_now (s5r->hd); |
1245 | break; | 1245 | break; |
1246 | } | 1246 | } |
1247 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1247 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1262,12 +1262,12 @@ curl_task_download (void *cls, | |||
1262 | break; | 1262 | break; |
1263 | } | 1263 | } |
1264 | }; | 1264 | }; |
1265 | } while (mret == CURLM_CALL_MULTI_PERFORM); | 1265 | } while (mret == CURLM_CALL_MULTI_PERFORM); |
1266 | if (CURLM_OK != mret) | 1266 | if (CURLM_OK != mret) |
1267 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1267 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1268 | "%s failed at %s:%d: `%s'\n", | 1268 | "%s failed at %s:%d: `%s'\n", |
1269 | "curl_multi_perform", __FILE__, __LINE__, | 1269 | "curl_multi_perform", __FILE__, __LINE__, |
1270 | curl_multi_strerror (mret)); | 1270 | curl_multi_strerror (mret)); |
1271 | if (0 == running) | 1271 | if (0 == running) |
1272 | { | 1272 | { |
1273 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1273 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1418,7 +1418,7 @@ create_response (void *cls, | |||
1418 | if (NULL == s5r->curl) | 1418 | if (NULL == s5r->curl) |
1419 | return MHD_queue_response (con, | 1419 | return MHD_queue_response (con, |
1420 | MHD_HTTP_INTERNAL_SERVER_ERROR, | 1420 | MHD_HTTP_INTERNAL_SERVER_ERROR, |
1421 | curl_failure_response); | 1421 | curl_failure_response); |
1422 | curl_easy_setopt (s5r->curl, CURLOPT_HEADERFUNCTION, &curl_check_hdr); | 1422 | curl_easy_setopt (s5r->curl, CURLOPT_HEADERFUNCTION, &curl_check_hdr); |
1423 | curl_easy_setopt (s5r->curl, CURLOPT_HEADERDATA, s5r); | 1423 | curl_easy_setopt (s5r->curl, CURLOPT_HEADERDATA, s5r); |
1424 | curl_easy_setopt (s5r->curl, CURLOPT_FOLLOWLOCATION, 0); | 1424 | curl_easy_setopt (s5r->curl, CURLOPT_FOLLOWLOCATION, 0); |
@@ -1436,11 +1436,11 @@ create_response (void *cls, | |||
1436 | ? "http://%s:%d%s" | 1436 | ? "http://%s:%d%s" |
1437 | : "https://%s:%d%s", | 1437 | : "https://%s:%d%s", |
1438 | ipaddr, | 1438 | ipaddr, |
1439 | port, | 1439 | port, |
1440 | s5r->url); | 1440 | s5r->url); |
1441 | curl_easy_setopt (s5r->curl, | 1441 | curl_easy_setopt (s5r->curl, |
1442 | CURLOPT_URL, | 1442 | CURLOPT_URL, |
1443 | curlurl); | 1443 | curlurl); |
1444 | GNUNET_free (curlurl); | 1444 | GNUNET_free (curlurl); |
1445 | 1445 | ||
1446 | if (0 == strcasecmp (meth, MHD_HTTP_METHOD_PUT)) | 1446 | if (0 == strcasecmp (meth, MHD_HTTP_METHOD_PUT)) |
@@ -1451,10 +1451,10 @@ create_response (void *cls, | |||
1451 | curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); | 1451 | curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); |
1452 | curl_easy_setopt (s5r->curl, CURLOPT_READFUNCTION, &curl_upload_cb); | 1452 | curl_easy_setopt (s5r->curl, CURLOPT_READFUNCTION, &curl_upload_cb); |
1453 | curl_easy_setopt (s5r->curl, CURLOPT_READDATA, s5r); | 1453 | curl_easy_setopt (s5r->curl, CURLOPT_READDATA, s5r); |
1454 | } | 1454 | } |
1455 | else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_POST)) | 1455 | else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_POST)) |
1456 | { | 1456 | { |
1457 | s5r->state = SOCKS5_SOCKET_UPLOAD_STARTED; | 1457 | s5r->state = SOCKS5_SOCKET_UPLOAD_STARTED; |
1458 | curl_easy_setopt (s5r->curl, CURLOPT_POST, 1); | 1458 | curl_easy_setopt (s5r->curl, CURLOPT_POST, 1); |
1459 | curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb); | 1459 | curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb); |
1460 | curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); | 1460 | curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); |
@@ -1463,12 +1463,12 @@ create_response (void *cls, | |||
1463 | } | 1463 | } |
1464 | else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_HEAD)) | 1464 | else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_HEAD)) |
1465 | { | 1465 | { |
1466 | s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; | 1466 | s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; |
1467 | curl_easy_setopt (s5r->curl, CURLOPT_NOBODY, 1); | 1467 | curl_easy_setopt (s5r->curl, CURLOPT_NOBODY, 1); |
1468 | } | 1468 | } |
1469 | else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_GET)) | 1469 | else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_GET)) |
1470 | { | 1470 | { |
1471 | s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; | 1471 | s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; |
1472 | curl_easy_setopt (s5r->curl, CURLOPT_HTTPGET, 1); | 1472 | curl_easy_setopt (s5r->curl, CURLOPT_HTTPGET, 1); |
1473 | curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb); | 1473 | curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb); |
1474 | curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); | 1474 | curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); |
@@ -1479,10 +1479,10 @@ create_response (void *cls, | |||
1479 | _("Unsupported HTTP method `%s'\n"), | 1479 | _("Unsupported HTTP method `%s'\n"), |
1480 | meth); | 1480 | meth); |
1481 | curl_easy_cleanup (s5r->curl); | 1481 | curl_easy_cleanup (s5r->curl); |
1482 | s5r->curl = NULL; | 1482 | s5r->curl = NULL; |
1483 | return MHD_NO; | 1483 | return MHD_NO; |
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | if (0 == strcasecmp (ver, MHD_HTTP_VERSION_1_0)) | 1486 | if (0 == strcasecmp (ver, MHD_HTTP_VERSION_1_0)) |
1487 | { | 1487 | { |
1488 | curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); | 1488 | curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); |
@@ -1495,26 +1495,26 @@ create_response (void *cls, | |||
1495 | { | 1495 | { |
1496 | curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NONE); | 1496 | curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NONE); |
1497 | } | 1497 | } |
1498 | 1498 | ||
1499 | if (HTTPS_PORT == s5r->port) | 1499 | if (HTTPS_PORT == s5r->port) |
1500 | { | 1500 | { |
1501 | curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_ALL); | 1501 | curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_ALL); |
1502 | curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYPEER, 1L); | 1502 | curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYPEER, 1L); |
1503 | /* Disable cURL checking the hostname, as we will check ourselves | 1503 | /* Disable cURL checking the hostname, as we will check ourselves |
1504 | as only we have the domain name or the LEHO or the DANE record */ | 1504 | as only we have the domain name or the LEHO or the DANE record */ |
1505 | curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYHOST, 0L); | 1505 | curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYHOST, 0L); |
1506 | } | 1506 | } |
1507 | else | 1507 | else |
1508 | { | 1508 | { |
1509 | curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_NONE); | 1509 | curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_NONE); |
1510 | } | 1510 | } |
1511 | 1511 | ||
1512 | if (CURLM_OK != curl_multi_add_handle (curl_multi, s5r->curl)) | 1512 | if (CURLM_OK != curl_multi_add_handle (curl_multi, s5r->curl)) |
1513 | { | 1513 | { |
1514 | GNUNET_break (0); | 1514 | GNUNET_break (0); |
1515 | curl_easy_cleanup (s5r->curl); | 1515 | curl_easy_cleanup (s5r->curl); |
1516 | s5r->curl = NULL; | 1516 | s5r->curl = NULL; |
1517 | return MHD_NO; | 1517 | return MHD_NO; |
1518 | } | 1518 | } |
1519 | MHD_get_connection_values (con, | 1519 | MHD_get_connection_values (con, |
1520 | MHD_HEADER_KIND, | 1520 | MHD_HEADER_KIND, |
@@ -1522,18 +1522,18 @@ create_response (void *cls, | |||
1522 | curl_easy_setopt (s5r->curl, CURLOPT_HTTPHEADER, s5r->headers); | 1522 | curl_easy_setopt (s5r->curl, CURLOPT_HTTPHEADER, s5r->headers); |
1523 | curl_download_prepare (); | 1523 | curl_download_prepare (); |
1524 | return MHD_YES; | 1524 | return MHD_YES; |
1525 | } | 1525 | } |
1526 | 1526 | ||
1527 | /* continuing to process request */ | 1527 | /* continuing to process request */ |
1528 | if (0 != *upload_data_size) | 1528 | if (0 != *upload_data_size) |
1529 | { | 1529 | { |
1530 | left = GNUNET_MIN (*upload_data_size, | 1530 | left = GNUNET_MIN (*upload_data_size, |
1531 | sizeof (s5r->io_buf) - s5r->io_len); | 1531 | sizeof (s5r->io_buf) - s5r->io_len); |
1532 | memcpy (&s5r->io_buf[s5r->io_len], | 1532 | memcpy (&s5r->io_buf[s5r->io_len], |
1533 | upload_data, | 1533 | upload_data, |
1534 | left); | 1534 | left); |
1535 | s5r->io_len += left; | 1535 | s5r->io_len += left; |
1536 | *upload_data_size -= left; | 1536 | *upload_data_size -= left; |
1537 | GNUNET_assert (NULL != s5r->curl); | 1537 | GNUNET_assert (NULL != s5r->curl); |
1538 | curl_easy_pause (s5r->curl, CURLPAUSE_CONT); | 1538 | curl_easy_pause (s5r->curl, CURLPAUSE_CONT); |
1539 | curl_download_prepare (); | 1539 | curl_download_prepare (); |
@@ -1545,12 +1545,12 @@ create_response (void *cls, | |||
1545 | "Finished processing UPLOAD\n"); | 1545 | "Finished processing UPLOAD\n"); |
1546 | s5r->state = SOCKS5_SOCKET_UPLOAD_DONE; | 1546 | s5r->state = SOCKS5_SOCKET_UPLOAD_DONE; |
1547 | } | 1547 | } |
1548 | if (NULL == s5r->response) | 1548 | if (NULL == s5r->response) |
1549 | return MHD_YES; /* too early to queue response, did not yet get headers from cURL */ | 1549 | return MHD_YES; /* too early to queue response, did not yet get headers from cURL */ |
1550 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1550 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1551 | "Queueing response with MHD\n"); | 1551 | "Queueing response with MHD\n"); |
1552 | return MHD_queue_response (con, | 1552 | return MHD_queue_response (con, |
1553 | s5r->response_code, | 1553 | s5r->response_code, |
1554 | s5r->response); | 1554 | s5r->response); |
1555 | } | 1555 | } |
1556 | 1556 | ||
@@ -1582,7 +1582,7 @@ mhd_completed_cb (void *cls, | |||
1582 | "MHD encountered error handling request: %d\n", | 1582 | "MHD encountered error handling request: %d\n", |
1583 | toe); | 1583 | toe); |
1584 | cleanup_s5r (s5r); | 1584 | cleanup_s5r (s5r); |
1585 | *con_cls = NULL; | 1585 | *con_cls = NULL; |
1586 | } | 1586 | } |
1587 | 1587 | ||
1588 | 1588 | ||
@@ -1590,7 +1590,7 @@ mhd_completed_cb (void *cls, | |||
1590 | * Function called when MHD first processes an incoming connection. | 1590 | * Function called when MHD first processes an incoming connection. |
1591 | * Gives us the respective URI information. | 1591 | * Gives us the respective URI information. |
1592 | * | 1592 | * |
1593 | * We use this to associate the `struct MHD_Connection` with our | 1593 | * We use this to associate the `struct MHD_Connection` with our |
1594 | * internal `struct Socks5Request` data structure (by checking | 1594 | * internal `struct Socks5Request` data structure (by checking |
1595 | * for matching sockets). | 1595 | * for matching sockets). |
1596 | * | 1596 | * |
@@ -1600,7 +1600,7 @@ mhd_completed_cb (void *cls, | |||
1600 | * @return the `struct Socks5Request` that this @a connection is for | 1600 | * @return the `struct Socks5Request` that this @a connection is for |
1601 | */ | 1601 | */ |
1602 | static void * | 1602 | static void * |
1603 | mhd_log_callback (void *cls, | 1603 | mhd_log_callback (void *cls, |
1604 | const char *url, | 1604 | const char *url, |
1605 | struct MHD_Connection *connection) | 1605 | struct MHD_Connection *connection) |
1606 | { | 1606 | { |
@@ -1610,7 +1610,7 @@ mhd_log_callback (void *cls, | |||
1610 | 1610 | ||
1611 | ci = MHD_get_connection_info (connection, | 1611 | ci = MHD_get_connection_info (connection, |
1612 | MHD_CONNECTION_INFO_CONNECTION_FD); | 1612 | MHD_CONNECTION_INFO_CONNECTION_FD); |
1613 | if (NULL == ci) | 1613 | if (NULL == ci) |
1614 | { | 1614 | { |
1615 | GNUNET_break (0); | 1615 | GNUNET_break (0); |
1616 | return NULL; | 1616 | return NULL; |
@@ -1770,8 +1770,8 @@ do_httpd (void *cls, | |||
1770 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 1770 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
1771 | { | 1771 | { |
1772 | struct MhdHttpList *hd = cls; | 1772 | struct MhdHttpList *hd = cls; |
1773 | 1773 | ||
1774 | hd->httpd_task = GNUNET_SCHEDULER_NO_TASK; | 1774 | hd->httpd_task = GNUNET_SCHEDULER_NO_TASK; |
1775 | MHD_run (hd->daemon); | 1775 | MHD_run (hd->daemon); |
1776 | schedule_httpd (hd); | 1776 | schedule_httpd (hd); |
1777 | } | 1777 | } |
@@ -1785,10 +1785,10 @@ do_httpd (void *cls, | |||
1785 | static void | 1785 | static void |
1786 | run_mhd_now (struct MhdHttpList *hd) | 1786 | run_mhd_now (struct MhdHttpList *hd) |
1787 | { | 1787 | { |
1788 | if (GNUNET_SCHEDULER_NO_TASK != | 1788 | if (GNUNET_SCHEDULER_NO_TASK != |
1789 | hd->httpd_task) | 1789 | hd->httpd_task) |
1790 | GNUNET_SCHEDULER_cancel (hd->httpd_task); | 1790 | GNUNET_SCHEDULER_cancel (hd->httpd_task); |
1791 | hd->httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd, | 1791 | hd->httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd, |
1792 | hd); | 1792 | hd); |
1793 | } | 1793 | } |
1794 | 1794 | ||
@@ -1801,7 +1801,7 @@ run_mhd_now (struct MhdHttpList *hd) | |||
1801 | * @return NULL on error | 1801 | * @return NULL on error |
1802 | */ | 1802 | */ |
1803 | static void* | 1803 | static void* |
1804 | load_file (const char* filename, | 1804 | load_file (const char* filename, |
1805 | unsigned int* size) | 1805 | unsigned int* size) |
1806 | { | 1806 | { |
1807 | void *buffer; | 1807 | void *buffer; |
@@ -1832,7 +1832,7 @@ load_file (const char* filename, | |||
1832 | * @return #GNUNET_OK on success | 1832 | * @return #GNUNET_OK on success |
1833 | */ | 1833 | */ |
1834 | static int | 1834 | static int |
1835 | load_key_from_file (gnutls_x509_privkey_t key, | 1835 | load_key_from_file (gnutls_x509_privkey_t key, |
1836 | const char* keyfile) | 1836 | const char* keyfile) |
1837 | { | 1837 | { |
1838 | gnutls_datum_t key_data; | 1838 | gnutls_datum_t key_data; |
@@ -1860,7 +1860,7 @@ load_key_from_file (gnutls_x509_privkey_t key, | |||
1860 | * @return #GNUNET_OK on success | 1860 | * @return #GNUNET_OK on success |
1861 | */ | 1861 | */ |
1862 | static int | 1862 | static int |
1863 | load_cert_from_file (gnutls_x509_crt_t crt, | 1863 | load_cert_from_file (gnutls_x509_crt_t crt, |
1864 | const char* certfile) | 1864 | const char* certfile) |
1865 | { | 1865 | { |
1866 | gnutls_datum_t cert_data; | 1866 | gnutls_datum_t cert_data; |
@@ -1896,8 +1896,8 @@ generate_gns_certificate (const char *name) | |||
1896 | struct tm *tm_data; | 1896 | struct tm *tm_data; |
1897 | struct ProxyGNSCertificate *pgc; | 1897 | struct ProxyGNSCertificate *pgc; |
1898 | 1898 | ||
1899 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1899 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1900 | "Generating TLS/SSL certificate for `%s'\n", | 1900 | "Generating TLS/SSL certificate for `%s'\n", |
1901 | name); | 1901 | name); |
1902 | GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_init (&request)); | 1902 | GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_init (&request)); |
1903 | GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_set_key (request, proxy_ca.key)); | 1903 | GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_set_key (request, proxy_ca.key)); |
@@ -1914,15 +1914,15 @@ generate_gns_certificate (const char *name) | |||
1914 | &serial, | 1914 | &serial, |
1915 | sizeof (serial)); | 1915 | sizeof (serial)); |
1916 | etime = time (NULL); | 1916 | etime = time (NULL); |
1917 | tm_data = localtime (&etime); | 1917 | tm_data = localtime (&etime); |
1918 | gnutls_x509_crt_set_activation_time (request, | 1918 | gnutls_x509_crt_set_activation_time (request, |
1919 | etime); | 1919 | etime); |
1920 | tm_data->tm_year++; | 1920 | tm_data->tm_year++; |
1921 | etime = mktime (tm_data); | 1921 | etime = mktime (tm_data); |
1922 | gnutls_x509_crt_set_expiration_time (request, | 1922 | gnutls_x509_crt_set_expiration_time (request, |
1923 | etime); | 1923 | etime); |
1924 | gnutls_x509_crt_sign (request, | 1924 | gnutls_x509_crt_sign (request, |
1925 | proxy_ca.cert, | 1925 | proxy_ca.cert, |
1926 | proxy_ca.key); | 1926 | proxy_ca.key); |
1927 | key_buf_size = sizeof (pgc->key); | 1927 | key_buf_size = sizeof (pgc->key); |
1928 | cert_buf_size = sizeof (pgc->cert); | 1928 | cert_buf_size = sizeof (pgc->cert); |
@@ -1954,10 +1954,10 @@ lookup_ssl_httpd (const char* domain) | |||
1954 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1954 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1955 | "Starting fresh MHD HTTPS instance for domain `%s'\n", | 1955 | "Starting fresh MHD HTTPS instance for domain `%s'\n", |
1956 | domain); | 1956 | domain); |
1957 | pgc = generate_gns_certificate (domain); | 1957 | pgc = generate_gns_certificate (domain); |
1958 | hd = GNUNET_new (struct MhdHttpList); | 1958 | hd = GNUNET_new (struct MhdHttpList); |
1959 | hd->is_ssl = GNUNET_YES; | 1959 | hd->is_ssl = GNUNET_YES; |
1960 | hd->domain = GNUNET_strdup (domain); | 1960 | hd->domain = GNUNET_strdup (domain); |
1961 | hd->proxy_cert = pgc; | 1961 | hd->proxy_cert = pgc; |
1962 | hd->daemon = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_SSL | MHD_USE_NO_LISTEN_SOCKET, | 1962 | hd->daemon = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_SSL | MHD_USE_NO_LISTEN_SOCKET, |
1963 | 0, | 1963 | 0, |
@@ -1975,8 +1975,8 @@ lookup_ssl_httpd (const char* domain) | |||
1975 | GNUNET_free (hd); | 1975 | GNUNET_free (hd); |
1976 | return NULL; | 1976 | return NULL; |
1977 | } | 1977 | } |
1978 | GNUNET_CONTAINER_DLL_insert (mhd_httpd_head, | 1978 | GNUNET_CONTAINER_DLL_insert (mhd_httpd_head, |
1979 | mhd_httpd_tail, | 1979 | mhd_httpd_tail, |
1980 | hd); | 1980 | hd); |
1981 | return hd; | 1981 | return hd; |
1982 | } | 1982 | } |
@@ -2003,7 +2003,7 @@ timeout_s5r_handshake (void *cls, | |||
2003 | 2003 | ||
2004 | /** | 2004 | /** |
2005 | * We're done with the Socks5 protocol, now we need to pass the | 2005 | * We're done with the Socks5 protocol, now we need to pass the |
2006 | * connection data through to the final destination, either | 2006 | * connection data through to the final destination, either |
2007 | * direct (if the protocol might not be HTTP), or via MHD | 2007 | * direct (if the protocol might not be HTTP), or via MHD |
2008 | * (if the port looks like it should be HTTP). | 2008 | * (if the port looks like it should be HTTP). |
2009 | * | 2009 | * |
@@ -2078,7 +2078,7 @@ do_write (void *cls, | |||
2078 | if (len <= 0) | 2078 | if (len <= 0) |
2079 | { | 2079 | { |
2080 | /* write error: connection closed, shutdown, etc.; just clean up */ | 2080 | /* write error: connection closed, shutdown, etc.; just clean up */ |
2081 | cleanup_s5r (s5r); | 2081 | cleanup_s5r (s5r); |
2082 | return; | 2082 | return; |
2083 | } | 2083 | } |
2084 | memmove (s5r->wbuf, | 2084 | memmove (s5r->wbuf, |
@@ -2099,10 +2099,10 @@ do_write (void *cls, | |||
2099 | 2099 | ||
2100 | switch (s5r->state) | 2100 | switch (s5r->state) |
2101 | { | 2101 | { |
2102 | case SOCKS5_INIT: | 2102 | case SOCKS5_INIT: |
2103 | GNUNET_assert (0); | 2103 | GNUNET_assert (0); |
2104 | break; | 2104 | break; |
2105 | case SOCKS5_REQUEST: | 2105 | case SOCKS5_REQUEST: |
2106 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s5r->rtask); | 2106 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s5r->rtask); |
2107 | break; | 2107 | break; |
2108 | case SOCKS5_DATA_TRANSFER: | 2108 | case SOCKS5_DATA_TRANSFER: |
@@ -2136,7 +2136,7 @@ signal_socks_failure (struct Socks5Request *s5r, | |||
2136 | s_resp->reply = sc; | 2136 | s_resp->reply = sc; |
2137 | s5r->state = SOCKS5_WRITE_THEN_CLEANUP; | 2137 | s5r->state = SOCKS5_WRITE_THEN_CLEANUP; |
2138 | if (GNUNET_SCHEDULER_NO_TASK != s5r->wtask) | 2138 | if (GNUNET_SCHEDULER_NO_TASK != s5r->wtask) |
2139 | s5r->wtask = | 2139 | s5r->wtask = |
2140 | GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, | 2140 | GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, |
2141 | s5r->sock, | 2141 | s5r->sock, |
2142 | &do_write, s5r); | 2142 | &do_write, s5r); |
@@ -2159,16 +2159,16 @@ signal_socks_success (struct Socks5Request *s5r) | |||
2159 | s_resp->reserved = 0; | 2159 | s_resp->reserved = 0; |
2160 | s_resp->addr_type = SOCKS5_AT_IPV4; | 2160 | s_resp->addr_type = SOCKS5_AT_IPV4; |
2161 | /* zero out IPv4 address and port */ | 2161 | /* zero out IPv4 address and port */ |
2162 | memset (&s_resp[1], | 2162 | memset (&s_resp[1], |
2163 | 0, | 2163 | 0, |
2164 | sizeof (struct in_addr) + sizeof (uint16_t)); | 2164 | sizeof (struct in_addr) + sizeof (uint16_t)); |
2165 | s5r->wbuf_len += sizeof (struct Socks5ServerResponseMessage) + | 2165 | s5r->wbuf_len += sizeof (struct Socks5ServerResponseMessage) + |
2166 | sizeof (struct in_addr) + sizeof (uint16_t); | 2166 | sizeof (struct in_addr) + sizeof (uint16_t); |
2167 | if (GNUNET_SCHEDULER_NO_TASK == s5r->wtask) | 2167 | if (GNUNET_SCHEDULER_NO_TASK == s5r->wtask) |
2168 | s5r->wtask = | 2168 | s5r->wtask = |
2169 | GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, | 2169 | GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, |
2170 | s5r->sock, | 2170 | s5r->sock, |
2171 | &do_write, s5r); | 2171 | &do_write, s5r); |
2172 | } | 2172 | } |
2173 | 2173 | ||
2174 | 2174 | ||
@@ -2207,7 +2207,7 @@ handle_gns_result (void *cls, | |||
2207 | } | 2207 | } |
2208 | if (GNUNET_YES == got_ip) | 2208 | if (GNUNET_YES == got_ip) |
2209 | break; | 2209 | break; |
2210 | if (GNUNET_OK != | 2210 | if (GNUNET_OK != |
2211 | GNUNET_NETWORK_test_pf (PF_INET)) | 2211 | GNUNET_NETWORK_test_pf (PF_INET)) |
2212 | break; | 2212 | break; |
2213 | got_ip = GNUNET_YES; | 2213 | got_ip = GNUNET_YES; |
@@ -2222,7 +2222,7 @@ handle_gns_result (void *cls, | |||
2222 | #endif | 2222 | #endif |
2223 | } | 2223 | } |
2224 | break; | 2224 | break; |
2225 | case GNUNET_DNSPARSER_TYPE_AAAA: | 2225 | case GNUNET_DNSPARSER_TYPE_AAAA: |
2226 | { | 2226 | { |
2227 | struct sockaddr_in6 *in; | 2227 | struct sockaddr_in6 *in; |
2228 | 2228 | ||
@@ -2232,8 +2232,8 @@ handle_gns_result (void *cls, | |||
2232 | break; | 2232 | break; |
2233 | } | 2233 | } |
2234 | if (GNUNET_YES == got_ip) | 2234 | if (GNUNET_YES == got_ip) |
2235 | break; | 2235 | break; |
2236 | if (GNUNET_OK != | 2236 | if (GNUNET_OK != |
2237 | GNUNET_NETWORK_test_pf (PF_INET)) | 2237 | GNUNET_NETWORK_test_pf (PF_INET)) |
2238 | break; | 2238 | break; |
2239 | /* FIXME: allow user to disable IPv6 per configuration option... */ | 2239 | /* FIXME: allow user to disable IPv6 per configuration option... */ |
@@ -2248,7 +2248,7 @@ handle_gns_result (void *cls, | |||
2248 | in->sin6_len = sizeof (*in); | 2248 | in->sin6_len = sizeof (*in); |
2249 | #endif | 2249 | #endif |
2250 | } | 2250 | } |
2251 | break; | 2251 | break; |
2252 | case GNUNET_NAMESTORE_TYPE_VPN: | 2252 | case GNUNET_NAMESTORE_TYPE_VPN: |
2253 | GNUNET_break (0); /* should have been translated within GNS */ | 2253 | GNUNET_break (0); /* should have been translated within GNS */ |
2254 | break; | 2254 | break; |
@@ -2264,14 +2264,14 @@ handle_gns_result (void *cls, | |||
2264 | } | 2264 | } |
2265 | if (GNUNET_YES != got_ip) | 2265 | if (GNUNET_YES != got_ip) |
2266 | { | 2266 | { |
2267 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2267 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2268 | "Name resolution failed to yield useful IP address.\n"); | 2268 | "Name resolution failed to yield useful IP address.\n"); |
2269 | signal_socks_failure (s5r, | 2269 | signal_socks_failure (s5r, |
2270 | SOCKS5_STATUS_GENERAL_FAILURE); | 2270 | SOCKS5_STATUS_GENERAL_FAILURE); |
2271 | return; | 2271 | return; |
2272 | } | 2272 | } |
2273 | s5r->state = SOCKS5_DATA_TRANSFER; | 2273 | s5r->state = SOCKS5_DATA_TRANSFER; |
2274 | signal_socks_success (s5r); | 2274 | signal_socks_success (s5r); |
2275 | } | 2275 | } |
2276 | 2276 | ||
2277 | 2277 | ||
@@ -2314,12 +2314,12 @@ do_s5r_read (void *cls, | |||
2314 | if ( (NULL != tc->read_ready) && | 2314 | if ( (NULL != tc->read_ready) && |
2315 | (GNUNET_NETWORK_fdset_isset (tc->read_ready, s5r->sock)) ) | 2315 | (GNUNET_NETWORK_fdset_isset (tc->read_ready, s5r->sock)) ) |
2316 | { | 2316 | { |
2317 | rlen = GNUNET_NETWORK_socket_recv (s5r->sock, | 2317 | rlen = GNUNET_NETWORK_socket_recv (s5r->sock, |
2318 | &s5r->rbuf[s5r->rbuf_len], | 2318 | &s5r->rbuf[s5r->rbuf_len], |
2319 | sizeof (s5r->rbuf) - s5r->rbuf_len); | 2319 | sizeof (s5r->rbuf) - s5r->rbuf_len); |
2320 | if (rlen <= 0) | 2320 | if (rlen <= 0) |
2321 | { | 2321 | { |
2322 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2322 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2323 | "socks5 client disconnected.\n"); | 2323 | "socks5 client disconnected.\n"); |
2324 | cleanup_s5r (s5r); | 2324 | cleanup_s5r (s5r); |
2325 | return; | 2325 | return; |
@@ -2449,7 +2449,7 @@ do_s5r_read (void *cls, | |||
2449 | GNUNET_NO /* only cached */, | 2449 | GNUNET_NO /* only cached */, |
2450 | (GNUNET_YES == do_shorten) ? &local_shorten_zone : NULL, | 2450 | (GNUNET_YES == do_shorten) ? &local_shorten_zone : NULL, |
2451 | &handle_gns_result, | 2451 | &handle_gns_result, |
2452 | s5r); | 2452 | s5r); |
2453 | break; | 2453 | break; |
2454 | } | 2454 | } |
2455 | default: | 2455 | default: |
@@ -2469,7 +2469,7 @@ do_s5r_read (void *cls, | |||
2469 | GNUNET_break_op (0); | 2469 | GNUNET_break_op (0); |
2470 | signal_socks_failure (s5r, | 2470 | signal_socks_failure (s5r, |
2471 | SOCKS5_STATUS_GENERAL_FAILURE); | 2471 | SOCKS5_STATUS_GENERAL_FAILURE); |
2472 | return; | 2472 | return; |
2473 | } | 2473 | } |
2474 | if (SOCKS5_DATA_TRANSFER == s5r->state) | 2474 | if (SOCKS5_DATA_TRANSFER == s5r->state) |
2475 | { | 2475 | { |
@@ -2478,7 +2478,7 @@ do_s5r_read (void *cls, | |||
2478 | } | 2478 | } |
2479 | /* We are done reading right now */ | 2479 | /* We are done reading right now */ |
2480 | GNUNET_SCHEDULER_cancel (s5r->rtask); | 2480 | GNUNET_SCHEDULER_cancel (s5r->rtask); |
2481 | s5r->rtask = GNUNET_SCHEDULER_NO_TASK; | 2481 | s5r->rtask = GNUNET_SCHEDULER_NO_TASK; |
2482 | return; | 2482 | return; |
2483 | case SOCKS5_RESOLVING: | 2483 | case SOCKS5_RESOLVING: |
2484 | GNUNET_assert (0); | 2484 | GNUNET_assert (0); |
@@ -2500,7 +2500,7 @@ do_s5r_read (void *cls, | |||
2500 | * @param tc the scheduler context | 2500 | * @param tc the scheduler context |
2501 | */ | 2501 | */ |
2502 | static void | 2502 | static void |
2503 | do_accept (void *cls, | 2503 | do_accept (void *cls, |
2504 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 2504 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
2505 | { | 2505 | { |
2506 | struct GNUNET_NETWORK_Handle *s; | 2506 | struct GNUNET_NETWORK_Handle *s; |
@@ -2595,8 +2595,8 @@ do_shutdown (void *cls, | |||
2595 | /** | 2595 | /** |
2596 | * Continue initialization after we have our zone information. | 2596 | * Continue initialization after we have our zone information. |
2597 | */ | 2597 | */ |
2598 | static void | 2598 | static void |
2599 | run_cont () | 2599 | run_cont () |
2600 | { | 2600 | { |
2601 | struct MhdHttpList *hd; | 2601 | struct MhdHttpList *hd; |
2602 | struct sockaddr_in sa; | 2602 | struct sockaddr_in sa; |
@@ -2612,7 +2612,7 @@ run_cont () | |||
2612 | lsock = GNUNET_NETWORK_socket_create (AF_INET, | 2612 | lsock = GNUNET_NETWORK_socket_create (AF_INET, |
2613 | SOCK_STREAM, | 2613 | SOCK_STREAM, |
2614 | 0); | 2614 | 0); |
2615 | if (NULL == lsock) | 2615 | if (NULL == lsock) |
2616 | { | 2616 | { |
2617 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); | 2617 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); |
2618 | GNUNET_SCHEDULER_shutdown (); | 2618 | GNUNET_SCHEDULER_shutdown (); |
@@ -2666,7 +2666,7 @@ run_cont () | |||
2666 | } | 2666 | } |
2667 | 2667 | ||
2668 | 2668 | ||
2669 | /** | 2669 | /** |
2670 | * Method called to inform about the egos of the shorten zone of this peer. | 2670 | * Method called to inform about the egos of the shorten zone of this peer. |
2671 | * | 2671 | * |
2672 | * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, | 2672 | * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, |
@@ -2674,7 +2674,7 @@ run_cont () | |||
2674 | * @a ego does indicate an error (i.e. name is taken or no default | 2674 | * @a ego does indicate an error (i.e. name is taken or no default |
2675 | * value is known). If @a ego is non-NULL and if '*ctx' | 2675 | * value is known). If @a ego is non-NULL and if '*ctx' |
2676 | * is set in those callbacks, the value WILL be passed to a subsequent | 2676 | * is set in those callbacks, the value WILL be passed to a subsequent |
2677 | * call to the identity callback of #GNUNET_IDENTITY_connect (if | 2677 | * call to the identity callback of #GNUNET_IDENTITY_connect (if |
2678 | * that one was not NULL). | 2678 | * that one was not NULL). |
2679 | * | 2679 | * |
2680 | * @param cls closure, NULL | 2680 | * @param cls closure, NULL |
@@ -2706,7 +2706,7 @@ identity_shorten_cb (void *cls, | |||
2706 | } | 2706 | } |
2707 | 2707 | ||
2708 | 2708 | ||
2709 | /** | 2709 | /** |
2710 | * Method called to inform about the egos of the master zone of this peer. | 2710 | * Method called to inform about the egos of the master zone of this peer. |
2711 | * | 2711 | * |
2712 | * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, | 2712 | * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, |
@@ -2714,7 +2714,7 @@ identity_shorten_cb (void *cls, | |||
2714 | * @a ego does indicate an error (i.e. name is taken or no default | 2714 | * @a ego does indicate an error (i.e. name is taken or no default |
2715 | * value is known). If @a ego is non-NULL and if '*ctx' | 2715 | * value is known). If @a ego is non-NULL and if '*ctx' |
2716 | * is set in those callbacks, the value WILL be passed to a subsequent | 2716 | * is set in those callbacks, the value WILL be passed to a subsequent |
2717 | * call to the identity callback of #GNUNET_IDENTITY_connect (if | 2717 | * call to the identity callback of #GNUNET_IDENTITY_connect (if |
2718 | * that one was not NULL). | 2718 | * that one was not NULL). |
2719 | * | 2719 | * |
2720 | * @param cls closure, NULL | 2720 | * @param cls closure, NULL |
@@ -2770,7 +2770,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
2770 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 2770 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2771 | "Failed to create cURL multi handle!\n"); | 2771 | "Failed to create cURL multi handle!\n"); |
2772 | return; | 2772 | return; |
2773 | } | 2773 | } |
2774 | cafile = cafile_opt; | 2774 | cafile = cafile_opt; |
2775 | if (NULL == cafile) | 2775 | if (NULL == cafile) |
2776 | { | 2776 | { |
@@ -2787,11 +2787,11 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
2787 | } | 2787 | } |
2788 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2788 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2789 | "Using %s as CA\n", cafile); | 2789 | "Using %s as CA\n", cafile); |
2790 | 2790 | ||
2791 | gnutls_global_init (); | 2791 | gnutls_global_init (); |
2792 | gnutls_x509_crt_init (&proxy_ca.cert); | 2792 | gnutls_x509_crt_init (&proxy_ca.cert); |
2793 | gnutls_x509_privkey_init (&proxy_ca.key); | 2793 | gnutls_x509_privkey_init (&proxy_ca.key); |
2794 | 2794 | ||
2795 | if ( (GNUNET_OK != load_cert_from_file (proxy_ca.cert, cafile)) || | 2795 | if ( (GNUNET_OK != load_cert_from_file (proxy_ca.cert, cafile)) || |
2796 | (GNUNET_OK != load_key_from_file (proxy_ca.key, cafile)) ) | 2796 | (GNUNET_OK != load_key_from_file (proxy_ca.key, cafile)) ) |
2797 | { | 2797 | { |
@@ -2801,7 +2801,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
2801 | gnutls_x509_crt_deinit (proxy_ca.cert); | 2801 | gnutls_x509_crt_deinit (proxy_ca.cert); |
2802 | gnutls_x509_privkey_deinit (proxy_ca.key); | 2802 | gnutls_x509_privkey_deinit (proxy_ca.key); |
2803 | gnutls_global_deinit (); | 2803 | gnutls_global_deinit (); |
2804 | GNUNET_free_non_null (cafile_cfg); | 2804 | GNUNET_free_non_null (cafile_cfg); |
2805 | return; | 2805 | return; |
2806 | } | 2806 | } |
2807 | GNUNET_free_non_null (cafile_cfg); | 2807 | GNUNET_free_non_null (cafile_cfg); |
@@ -2815,11 +2815,11 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
2815 | return; | 2815 | return; |
2816 | } | 2816 | } |
2817 | identity = GNUNET_IDENTITY_connect (cfg, | 2817 | identity = GNUNET_IDENTITY_connect (cfg, |
2818 | NULL, NULL); | 2818 | NULL, NULL); |
2819 | id_op = GNUNET_IDENTITY_get (identity, | 2819 | id_op = GNUNET_IDENTITY_get (identity, |
2820 | "gns-proxy", | 2820 | "gns-proxy", |
2821 | &identity_master_cb, | 2821 | &identity_master_cb, |
2822 | NULL); | 2822 | NULL); |
2823 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 2823 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
2824 | &do_shutdown, NULL); | 2824 | &do_shutdown, NULL); |
2825 | } | 2825 | } |
@@ -2844,7 +2844,7 @@ main (int argc, char *const *argv) | |||
2844 | &GNUNET_GETOPT_set_string, &cafile_opt}, | 2844 | &GNUNET_GETOPT_set_string, &cafile_opt}, |
2845 | GNUNET_GETOPT_OPTION_END | 2845 | GNUNET_GETOPT_OPTION_END |
2846 | }; | 2846 | }; |
2847 | static const char* page = | 2847 | static const char* page = |
2848 | "<html><head><title>gnunet-gns-proxy</title>" | 2848 | "<html><head><title>gnunet-gns-proxy</title>" |
2849 | "</head><body>cURL fail</body></html>"; | 2849 | "</head><body>cURL fail</body></html>"; |
2850 | int ret; | 2850 | int ret; |