diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-06-11 11:43:27 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-06-11 11:43:27 +0000 |
commit | c8549a759d6b78255a194287bc146593d5df552c (patch) | |
tree | 0842aca1a746b3b1e5022c0795ba5764f5c4c9f3 /src/gns/gnunet-gns-proxy.c | |
parent | 2a731e4d1cf6623a1fb78ebb6d6ff1f983865fbc (diff) | |
download | gnunet-c8549a759d6b78255a194287bc146593d5df552c.tar.gz gnunet-c8549a759d6b78255a194287bc146593d5df552c.zip |
-zkey, fix gnutls import
Diffstat (limited to 'src/gns/gnunet-gns-proxy.c')
-rw-r--r-- | src/gns/gnunet-gns-proxy.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index ad2d3a969..4416425a3 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c | |||
@@ -42,8 +42,8 @@ | |||
42 | #define HTML_HDR_CONTENT "Content-Type: text/html\r\n" | 42 | #define HTML_HDR_CONTENT "Content-Type: text/html\r\n" |
43 | 43 | ||
44 | /* regexp */ | 44 | /* regexp */ |
45 | #define RE_DOTPLUS "<a href=\"http://(([A-Za-z]+[.])+)([+])" | 45 | //#define RE_DOTPLUS "<a href=\"http://(([A-Za-z]+[.])+)([+])" |
46 | #define RE_A_HREF "<a href=\"https?://(([A-Za-z]+[.])+)([+]|zkey)" | 46 | #define RE_A_HREF "<a href=\"https?://(([A-Za-z0-9]+[.])+)([+]|zkey)" |
47 | #define RE_N_MATCHES 4 | 47 | #define RE_N_MATCHES 4 |
48 | 48 | ||
49 | /* The usual suspects */ | 49 | /* The usual suspects */ |
@@ -490,7 +490,7 @@ process_shorten (void* cls, const char* short_name) | |||
490 | ctask->pp_buf, | 490 | ctask->pp_buf, |
491 | short_name); | 491 | short_name); |
492 | 492 | ||
493 | sprintf (tmp, "<a href=http://%s", short_name); | 493 | sprintf (tmp, "<a href=\"http://%s", short_name); |
494 | strcpy (ctask->pp_buf, tmp); | 494 | strcpy (ctask->pp_buf, tmp); |
495 | 495 | ||
496 | ctask->pp_finished = GNUNET_YES; | 496 | ctask->pp_finished = GNUNET_YES; |
@@ -582,7 +582,12 @@ mhd_content_cb (void *cls, | |||
582 | 582 | ||
583 | nomatch = regexec ( &re_dotplus, ctask->buffer_ptr, RE_N_MATCHES, m, 0); | 583 | nomatch = regexec ( &re_dotplus, ctask->buffer_ptr, RE_N_MATCHES, m, 0); |
584 | 584 | ||
585 | if (!nomatch) | 585 | if (nomatch) |
586 | { | ||
587 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
588 | "MHD RE: No match\n"); | ||
589 | } | ||
590 | else | ||
586 | { | 591 | { |
587 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 592 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
588 | "MHD RE: Match\n"); | 593 | "MHD RE: Match\n"); |
@@ -638,8 +643,10 @@ mhd_content_cb (void *cls, | |||
638 | memset (ctask->pp_buf, 0, sizeof(ctask->pp_buf)); | 643 | memset (ctask->pp_buf, 0, sizeof(ctask->pp_buf)); |
639 | 644 | ||
640 | /* If .+ extend with authority */ | 645 | /* If .+ extend with authority */ |
641 | if (0 == strcmp (ctask->buffer_ptr+m[1].rm_eo, "+")) | 646 | if (*(ctask->buffer_ptr+m[1].rm_eo) == '+') |
642 | { | 647 | { |
648 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
649 | "Links is .+\n"); | ||
643 | memcpy (ctask->pp_buf, hostptr, (m[1].rm_eo-m[1].rm_so)); | 650 | memcpy (ctask->pp_buf, hostptr, (m[1].rm_eo-m[1].rm_so)); |
644 | strcpy ( ctask->pp_buf+strlen(ctask->pp_buf), | 651 | strcpy ( ctask->pp_buf+strlen(ctask->pp_buf), |
645 | ctask->authority); | 652 | ctask->authority); |
@@ -647,6 +654,8 @@ mhd_content_cb (void *cls, | |||
647 | /* If .zkey simply copy the name */ | 654 | /* If .zkey simply copy the name */ |
648 | else | 655 | else |
649 | { | 656 | { |
657 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
658 | "Link is zkey\n"); | ||
650 | memcpy (ctask->pp_buf, hostptr, (m[1].rm_eo-m[1].rm_so + strlen (GNUNET_GNS_TLD_ZKEY))); | 659 | memcpy (ctask->pp_buf, hostptr, (m[1].rm_eo-m[1].rm_so + strlen (GNUNET_GNS_TLD_ZKEY))); |
651 | } | 660 | } |
652 | 661 | ||
@@ -949,6 +958,10 @@ process_leho_lookup (void *cls, | |||
949 | 958 | ||
950 | strcpy (ctask->leho, ""); | 959 | strcpy (ctask->leho, ""); |
951 | 960 | ||
961 | if (rd_count == 0) | ||
962 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
963 | "No LEHO present!\n"); | ||
964 | |||
952 | for (i=0; i<rd_count; i++) | 965 | for (i=0; i<rd_count; i++) |
953 | { | 966 | { |
954 | if (rd[i].record_type != GNUNET_GNS_RECORD_LEHO) | 967 | if (rd[i].record_type != GNUNET_GNS_RECORD_LEHO) |
@@ -1551,7 +1564,7 @@ load_key_from_file (gnutls_x509_privkey_t key, char* keyfile) | |||
1551 | if (GNUTLS_E_SUCCESS != ret) | 1564 | if (GNUTLS_E_SUCCESS != ret) |
1552 | { | 1565 | { |
1553 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1566 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1554 | "Unable to import private key %s\n", keyfile); | 1567 | "Unable to import private key %s(ret=%d)\n", key_data.data, ret); |
1555 | GNUNET_break (0); | 1568 | GNUNET_break (0); |
1556 | } | 1569 | } |
1557 | } | 1570 | } |
@@ -1576,7 +1589,7 @@ load_cert_from_file (gnutls_x509_crt_t crt, char* certfile) | |||
1576 | if (GNUTLS_E_SUCCESS != ret) | 1589 | if (GNUTLS_E_SUCCESS != ret) |
1577 | { | 1590 | { |
1578 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1591 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1579 | "Unable to import certificate %s\n", certfile); | 1592 | "Unable to import certificate %s(ret=%d)\n", certfile, ret); |
1580 | GNUNET_break (0); | 1593 | GNUNET_break (0); |
1581 | } | 1594 | } |
1582 | 1595 | ||
@@ -2216,6 +2229,9 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
2216 | "Loading CA\n"); | 2229 | "Loading CA\n"); |
2217 | 2230 | ||
2218 | gnutls_global_init (); | 2231 | gnutls_global_init (); |
2232 | |||
2233 | gnutls_x509_crt_init (&proxy_ca.cert); | ||
2234 | gnutls_x509_privkey_init (&proxy_ca.key); | ||
2219 | 2235 | ||
2220 | load_cert_from_file (proxy_ca.cert, cafile); | 2236 | load_cert_from_file (proxy_ca.cert, cafile); |
2221 | load_key_from_file (proxy_ca.key, cafile); | 2237 | load_key_from_file (proxy_ca.key, cafile); |
@@ -2223,7 +2239,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
2223 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2239 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2224 | "Loading Template\n"); | 2240 | "Loading Template\n"); |
2225 | 2241 | ||
2226 | compile_regex (&re_dotplus, (char*) RE_DOTPLUS); | 2242 | compile_regex (&re_dotplus, (char*) RE_A_HREF); |
2227 | 2243 | ||
2228 | gns_handle = GNUNET_GNS_connect (cfg); | 2244 | gns_handle = GNUNET_GNS_connect (cfg); |
2229 | 2245 | ||