aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-07-12 13:28:01 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-07-12 13:28:01 +0000
commitf0af6efe99502662d6d1ba6596f7d4e6e1680424 (patch)
tree5205ac798b9a2e0536ec023372e94fe625525739 /src
parent6272777c0cdf48f86b96e2b7c4749e821ccba286 (diff)
downloadgnunet-f0af6efe99502662d6d1ba6596f7d4e6e1680424.tar.gz
gnunet-f0af6efe99502662d6d1ba6596f7d4e6e1680424.zip
automatically replace all server addresses with client addresses
Diffstat (limited to 'src')
-rw-r--r--src/hello/hello.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/hello/hello.c b/src/hello/hello.c
index cb318f47d..a85a6ee97 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -811,7 +811,10 @@ add_address_to_uri (void *cls, const struct GNUNET_HELLO_Address *address,
811 const char *addr; 811 const char *addr;
812 char *uri_addr; 812 char *uri_addr;
813 char *ret; 813 char *ret;
814 char *addr_dup;
815 char *pos;
814 char tbuf[16] = ""; 816 char tbuf[16] = "";
817 char *client_str = "_client";
815 struct tm *t; 818 struct tm *t;
816 time_t seconds; 819 time_t seconds;
817 820
@@ -829,11 +832,18 @@ add_address_to_uri (void *cls, const struct GNUNET_HELLO_Address *address,
829 return GNUNET_OK; 832 return GNUNET_OK;
830 } 833 }
831 addr = papi->address_to_string (papi->cls, address->address, address->address_length); 834 addr = papi->address_to_string (papi->cls, address->address, address->address_length);
835
832 if ( (addr == NULL) || (strlen(addr) == 0) ) 836 if ( (addr == NULL) || (strlen(addr) == 0) )
833 return GNUNET_OK; 837 return GNUNET_OK;
838
839 addr_dup = GNUNET_strdup (addr);
840 if (NULL != (pos = strstr (addr_dup, "_server")))
841 memcpy (pos, client_str, strlen(client_str)); /* Replace all server addresses with client addresses */
842
834 /* For URIs we use '(' and ')' instead of '[' and ']' as brackets are reserved 843 /* For URIs we use '(' and ')' instead of '[' and ']' as brackets are reserved
835 characters in URIs */ 844 characters in URIs */
836 uri_addr = map_characters (addr, "[]", "()"); 845 uri_addr = map_characters (addr_dup, "[]", "()");
846 GNUNET_free (addr_dup);
837 seconds = expiration.abs_value / 1000; 847 seconds = expiration.abs_value / 1000;
838 t = gmtime (&seconds); 848 t = gmtime (&seconds);
839 849