aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-27 09:49:39 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-27 09:49:39 +0000
commitbcdae74167d2e1f9d8dd9b01fb368bf8bcc2287d (patch)
treeb1f47d243e677d53de0c3503a1d5caf43dba073e
parentdd22c2132e58ba4ac960337efc0f843c12f58780 (diff)
downloadgnunet-bcdae74167d2e1f9d8dd9b01fb368bf8bcc2287d.tar.gz
gnunet-bcdae74167d2e1f9d8dd9b01fb368bf8bcc2287d.zip
-undo #29640, somehow causes problems
-rw-r--r--src/arm/arm.conf.in2
-rw-r--r--src/arm/gnunet-service-arm.c4
-rw-r--r--src/arm/test_exponential_backoff.c2
-rw-r--r--src/ats/ats.conf.in2
-rw-r--r--src/consensus/consensus.conf.in2
-rw-r--r--src/core/core.conf.in2
-rw-r--r--src/datastore/datastore.conf.in2
-rw-r--r--src/dht/dht.conf.in2
-rw-r--r--src/dns/dns.conf.in2
-rw-r--r--src/dns/dnsstub.c10
-rw-r--r--src/dv/dv.conf.in2
-rw-r--r--src/experimentation/experimentation.conf.in2
-rw-r--r--src/fs/fs.conf.in2
-rw-r--r--src/gns/gns.conf.in4
-rw-r--r--src/gns/gnunet-dns2gns.c6
-rw-r--r--src/identity/identity.conf.in2
-rw-r--r--src/include/gnunet_network_lib.h10
-rw-r--r--src/lockmanager/lockmanager.conf.in2
-rw-r--r--src/mesh/mesh.conf.in2
-rw-r--r--src/multicast/multicast.conf.in2
-rw-r--r--src/namestore/namestore.conf.in2
-rw-r--r--src/nat/nat_test.c2
-rw-r--r--src/nse/nse.conf.in2
-rw-r--r--src/peerinfo/peerinfo.conf.in2
-rw-r--r--src/psyc/psyc.conf.in2
-rw-r--r--src/psycstore/psycstore.conf.in2
-rw-r--r--src/regex/regex.conf.in2
-rw-r--r--src/scalarproduct/scalarproduct.conf.in2
-rw-r--r--src/set/set.conf.in2
-rw-r--r--src/statistics/statistics.conf.in2
-rw-r--r--src/testbed/testbed.conf.in6
-rw-r--r--src/testing/testing.c6
-rw-r--r--src/transport/gnunet-helper-transport-bluetooth.c4
-rw-r--r--src/transport/plugin_transport_udp.c4
-rw-r--r--src/transport/plugin_transport_unix.c51
-rw-r--r--src/transport/transport.conf.in2
-rw-r--r--src/util/client.c30
-rw-r--r--src/util/connection.c15
-rw-r--r--src/util/disk.c12
-rw-r--r--src/util/network.c28
-rw-r--r--src/util/resolver.conf.in2
-rw-r--r--src/util/server.c2
-rw-r--r--src/util/service.c24
-rw-r--r--src/util/test_connection.c6
-rw-r--r--src/util/test_connection_addressing.c2
-rw-r--r--src/util/test_connection_receive_cancel.c6
-rw-r--r--src/util/test_connection_timeout.c6
-rw-r--r--src/util/test_server_with_client_unix.c7
-rw-r--r--src/vpn/vpn.conf.in2
49 files changed, 182 insertions, 117 deletions
diff --git a/src/arm/arm.conf.in b/src/arm/arm.conf.in
index e9bf82e9f..b9a33242f 100644
--- a/src/arm/arm.conf.in
+++ b/src/arm/arm.conf.in
@@ -7,7 +7,7 @@ BINARY = gnunet-service-arm
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9DEFAULTSERVICES = topology hostlist dht nse mesh fs 9DEFAULTSERVICES = topology hostlist dht nse mesh fs
10UNIXPATH = $SERVICEHOME/gnunet-service-arm.sock 10UNIXPATH = /tmp/gnunet-service-arm.sock
11UNIX_MATCH_UID = YES 11UNIX_MATCH_UID = YES
12UNIX_MATCH_GID = YES 12UNIX_MATCH_GID = YES
13 13
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c
index ab1fe6481..906f0adde 100644
--- a/src/arm/gnunet-service-arm.c
+++ b/src/arm/gnunet-service-arm.c
@@ -622,8 +622,8 @@ create_listen_socket (struct sockaddr *sa, socklen_t addr_len,
622 "setsockopt"); 622 "setsockopt");
623#endif 623#endif
624 624
625 if (GNUNET_OK != 625 if (GNUNET_NETWORK_socket_bind
626 GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) sa, addr_len)) 626 (sock, (const struct sockaddr *) sa, addr_len, 0) != GNUNET_OK)
627 { 627 {
628 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 628 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
629 _ 629 _
diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c
index 557e81ee5..08c4fd8ee 100644
--- a/src/arm/test_exponential_backoff.c
+++ b/src/arm/test_exponential_backoff.c
@@ -42,7 +42,7 @@
42 42
43#define BINARY "mockup-service" 43#define BINARY "mockup-service"
44 44
45#define CFGFILENAME "test_arm_api_data_copy.conf" 45#define CFGFILENAME "test_arm_api_data2.conf"
46 46
47 47
48static const struct GNUNET_CONFIGURATION_Handle *cfg; 48static const struct GNUNET_CONFIGURATION_Handle *cfg;
diff --git a/src/ats/ats.conf.in b/src/ats/ats.conf.in
index f911c0bcf..457e86c65 100644
--- a/src/ats/ats.conf.in
+++ b/src/ats/ats.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-ats 6BINARY = gnunet-service-ats
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-ats.sock 9UNIXPATH = /tmp/gnunet-service-ats.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12 12
diff --git a/src/consensus/consensus.conf.in b/src/consensus/consensus.conf.in
index c91a0be49..18e976deb 100644
--- a/src/consensus/consensus.conf.in
+++ b/src/consensus/consensus.conf.in
@@ -6,6 +6,6 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-consensus 6BINARY = gnunet-service-consensus
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-consensus.sock 9UNIXPATH = /tmp/gnunet-service-consensus.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
diff --git a/src/core/core.conf.in b/src/core/core.conf.in
index e1e5f5b6f..839c21eeb 100644
--- a/src/core/core.conf.in
+++ b/src/core/core.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-core 6BINARY = gnunet-service-core
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-core.sock 9UNIXPATH = /tmp/gnunet-service-core.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12# DISABLE_SOCKET_FORWARDING = NO 12# DISABLE_SOCKET_FORWARDING = NO
diff --git a/src/datastore/datastore.conf.in b/src/datastore/datastore.conf.in
index f996ce559..7a92070d7 100644
--- a/src/datastore/datastore.conf.in
+++ b/src/datastore/datastore.conf.in
@@ -1,6 +1,6 @@
1[datastore] 1[datastore]
2AUTOSTART = YES 2AUTOSTART = YES
3UNIXPATH = $SERVICEHOME/gnunet-service-datastore.sock 3UNIXPATH = /tmp/gnunet-service-datastore.sock
4UNIX_MATCH_UID = NO 4UNIX_MATCH_UID = NO
5UNIX_MATCH_GID = YES 5UNIX_MATCH_GID = YES
6@UNIXONLY@ PORT = 2093 6@UNIXONLY@ PORT = 2093
diff --git a/src/dht/dht.conf.in b/src/dht/dht.conf.in
index 38c04a182..59c5bc1b7 100644
--- a/src/dht/dht.conf.in
+++ b/src/dht/dht.conf.in
@@ -7,7 +7,7 @@ BINARY = gnunet-service-dht
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9BUCKET_SIZE = 4 9BUCKET_SIZE = 4
10UNIXPATH = $SERVICEHOME/gnunet-service-dht.sock 10UNIXPATH = /tmp/gnunet-service-dht.sock
11# This could be relaxed... 11# This could be relaxed...
12UNIX_MATCH_UID = YES 12UNIX_MATCH_UID = YES
13UNIX_MATCH_GID = YES 13UNIX_MATCH_GID = YES
diff --git a/src/dns/dns.conf.in b/src/dns/dns.conf.in
index a1282b3ed..7944b410a 100644
--- a/src/dns/dns.conf.in
+++ b/src/dns/dns.conf.in
@@ -3,7 +3,7 @@ AUTOSTART = YES
3HOSTNAME = localhost 3HOSTNAME = localhost
4HOME = $SERVICEHOME 4HOME = $SERVICEHOME
5BINARY = gnunet-service-dns 5BINARY = gnunet-service-dns
6UNIXPATH = $SERVICEHOME/gnunet-service-dns.sock 6UNIXPATH = /tmp/gnunet-service-dns.sock
7 7
8# Access to this service can compromise all DNS queries in this 8# Access to this service can compromise all DNS queries in this
9# system. Thus access should be restricted to the same UID. 9# system. Thus access should be restricted to the same UID.
diff --git a/src/dns/dnsstub.c b/src/dns/dnsstub.c
index caf90f3d2..0e130a77f 100644
--- a/src/dns/dnsstub.c
+++ b/src/dns/dnsstub.c
@@ -167,11 +167,11 @@ open_socket (int af)
167 return NULL; 167 return NULL;
168 } 168 }
169 sa->sa_family = af; 169 sa->sa_family = af;
170 if (GNUNET_OK != 170 if (GNUNET_OK != GNUNET_NETWORK_socket_bind (ret,
171 GNUNET_NETWORK_socket_bind (ret, 171 sa,
172 sa, 172 alen,
173 alen)) 173 0))
174 { 174 {
175 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 175 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
176 _("Could not bind to any port: %s\n"), 176 _("Could not bind to any port: %s\n"),
177 STRERROR (errno)); 177 STRERROR (errno));
diff --git a/src/dv/dv.conf.in b/src/dv/dv.conf.in
index 70b9cfd55..c0dc21bfd 100644
--- a/src/dv/dv.conf.in
+++ b/src/dv/dv.conf.in
@@ -6,7 +6,7 @@ BINARY = gnunet-service-dv
6HOME = $SERVICEHOME 6HOME = $SERVICEHOME
7HOSTNAME = localhost 7HOSTNAME = localhost
8@UNIXONLY@ PORT = 2571 8@UNIXONLY@ PORT = 2571
9UNIXPATH = $SERVICEHOME/gnunet-service-dv.sock 9UNIXPATH = /tmp/gnunet-service-dv.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12# ACCEPT_FROM = 12# ACCEPT_FROM =
diff --git a/src/experimentation/experimentation.conf.in b/src/experimentation/experimentation.conf.in
index c06e54dd4..6597dd0c1 100644
--- a/src/experimentation/experimentation.conf.in
+++ b/src/experimentation/experimentation.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-daemon-experimentation 6BINARY = gnunet-daemon-experimentation
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-daemon-experimentation.sock 9UNIXPATH = /tmp/gnunet-daemon-experimentation.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12ISSUERS = TFRM29O2RQNKLVBQIGODJ6GD58LSQ2NM9TNFBC6N48BRJHQO38Q73N2OM3V4CLKDM6CILQV4CU8PMJDRG0FNB0PDI057DBRANMLPLRG \ No newline at end of file 12ISSUERS = TFRM29O2RQNKLVBQIGODJ6GD58LSQ2NM9TNFBC6N48BRJHQO38Q73N2OM3V4CLKDM6CILQV4CU8PMJDRG0FNB0PDI057DBRANMLPLRG \ No newline at end of file
diff --git a/src/fs/fs.conf.in b/src/fs/fs.conf.in
index ef98272f6..2375dc7ec 100644
--- a/src/fs/fs.conf.in
+++ b/src/fs/fs.conf.in
@@ -22,7 +22,7 @@ CONTENT_CACHING = YES
22# (may improve anonymity, probably not a good idea if content_caching is NO) 22# (may improve anonymity, probably not a good idea if content_caching is NO)
23CONTENT_PUSHING = YES 23CONTENT_PUSHING = YES
24 24
25UNIXPATH = $SERVICEHOME/gnunet-service-fs.sock 25UNIXPATH = /tmp/gnunet-service-fs.sock
26 26
27# Do we require users that want to access file-sharing to run this process 27# Do we require users that want to access file-sharing to run this process
28# (usually not a good idea) 28# (usually not a good idea)
diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in
index 53da718f5..91fd822f8 100644
--- a/src/gns/gns.conf.in
+++ b/src/gns/gns.conf.in
@@ -3,7 +3,7 @@ AUTOSTART = YES
3HOSTNAME = localhost 3HOSTNAME = localhost
4HOME = $SERVICEHOME 4HOME = $SERVICEHOME
5BINARY = gnunet-service-gns 5BINARY = gnunet-service-gns
6UNIXPATH = $SERVICEHOME/gnunet-service-gns.sock 6UNIXPATH = /tmp/gnunet-service-gns.sock
7@UNIXONLY@PORT = 2102 7@UNIXONLY@PORT = 2102
8 8
9ZONE_DIR = $SERVICEHOME/gns/ 9ZONE_DIR = $SERVICEHOME/gns/
@@ -32,7 +32,7 @@ AUTOSTART = NO
32 32
33# Where is the certificate for the GNS proxy stored? 33# Where is the certificate for the GNS proxy stored?
34PROXY_CACERT = $SERVICEHOME/gns/gnsCAcert.pem 34PROXY_CACERT = $SERVICEHOME/gns/gnsCAcert.pem
35PROXY_UNIXPATH = $SERVICEHOME/gnunet-gns-proxy.sock 35PROXY_UNIXPATH = /tmp/gnunet-gns-proxy.sock
36 36
37 37
38[fcfsd] 38[fcfsd]
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index f22cba0d7..8bbf22c46 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -616,7 +616,8 @@ run_dnsd ()
616 if (GNUNET_OK != 616 if (GNUNET_OK !=
617 GNUNET_NETWORK_socket_bind (listen_socket4, 617 GNUNET_NETWORK_socket_bind (listen_socket4,
618 (struct sockaddr *) &v4, 618 (struct sockaddr *) &v4,
619 sizeof (v4))) 619 sizeof (v4),
620 0))
620 { 621 {
621 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); 622 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind");
622 GNUNET_NETWORK_socket_close (listen_socket4); 623 GNUNET_NETWORK_socket_close (listen_socket4);
@@ -639,7 +640,8 @@ run_dnsd ()
639 if (GNUNET_OK != 640 if (GNUNET_OK !=
640 GNUNET_NETWORK_socket_bind (listen_socket6, 641 GNUNET_NETWORK_socket_bind (listen_socket6,
641 (struct sockaddr *) &v6, 642 (struct sockaddr *) &v6,
642 sizeof (v6))) 643 sizeof (v6),
644 0))
643 { 645 {
644 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); 646 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind");
645 GNUNET_NETWORK_socket_close (listen_socket6); 647 GNUNET_NETWORK_socket_close (listen_socket6);
diff --git a/src/identity/identity.conf.in b/src/identity/identity.conf.in
index d06912681..671e5f2f1 100644
--- a/src/identity/identity.conf.in
+++ b/src/identity/identity.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-identity 6BINARY = gnunet-service-identity
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-identity.unix 9UNIXPATH = /tmp/gnunet-service-identity.unix
10UNIX_MATCH_UID = NO 10UNIX_MATCH_UID = NO
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12 12
diff --git a/src/include/gnunet_network_lib.h b/src/include/gnunet_network_lib.h
index 55d0a3d7b..e2ebd450e 100644
--- a/src/include/gnunet_network_lib.h
+++ b/src/include/gnunet_network_lib.h
@@ -132,17 +132,25 @@ GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd,
132 132
133 133
134/** 134/**
135 * Fail to bind if an address is already in use.
136 */
137#define GNUNET_BIND_EXCLUSIVE 0x01
138
139
140/**
135 * Bind a socket to a particular address. 141 * Bind a socket to a particular address.
136 * 142 *
137 * @param desc socket to bind 143 * @param desc socket to bind
138 * @param address address to be bound 144 * @param address address to be bound
139 * @param address_len length of address 145 * @param address_len length of address
146 * @param flags flags affecting bind behaviour
140 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise 147 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
141 */ 148 */
142int 149int
143GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, 150GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
144 const struct sockaddr *address, 151 const struct sockaddr *address,
145 socklen_t address_len); 152 socklen_t address_len,
153 int flags);
146 154
147/** 155/**
148 * Close a socket. 156 * Close a socket.
diff --git a/src/lockmanager/lockmanager.conf.in b/src/lockmanager/lockmanager.conf.in
index 1fee355e2..42d574324 100644
--- a/src/lockmanager/lockmanager.conf.in
+++ b/src/lockmanager/lockmanager.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-lockmanager 6BINARY = gnunet-service-lockmanager
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-lockmanager.sock 9UNIXPATH = /tmp/gnunet-service-lockmanager.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12 12
diff --git a/src/mesh/mesh.conf.in b/src/mesh/mesh.conf.in
index aaa337a98..504e2ecb1 100644
--- a/src/mesh/mesh.conf.in
+++ b/src/mesh/mesh.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-mesh 6BINARY = gnunet-service-mesh
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-mesh.sock 9UNIXPATH = /tmp/gnunet-service-mesh.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12REFRESH_CONNECTION_TIME = 5 min 12REFRESH_CONNECTION_TIME = 5 min
diff --git a/src/multicast/multicast.conf.in b/src/multicast/multicast.conf.in
index 8a19450ab..bd37cb474 100644
--- a/src/multicast/multicast.conf.in
+++ b/src/multicast/multicast.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-multicast 6BINARY = gnunet-service-multicast
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-multicast.sock 9UNIXPATH = /tmp/gnunet-service-multicast.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12# DISABLE_SOCKET_FORWARDING = NO 12# DISABLE_SOCKET_FORWARDING = NO
diff --git a/src/namestore/namestore.conf.in b/src/namestore/namestore.conf.in
index 8c4b71414..18a37f0da 100644
--- a/src/namestore/namestore.conf.in
+++ b/src/namestore/namestore.conf.in
@@ -1,6 +1,6 @@
1[namestore] 1[namestore]
2AUTOSTART = YES 2AUTOSTART = YES
3UNIXPATH = $SERVICEHOME/gnunet-service-namestore.sock 3UNIXPATH = /tmp/gnunet-service-namestore.sock
4UNIX_MATCH_UID = NO 4UNIX_MATCH_UID = NO
5UNIX_MATCH_GID = YES 5UNIX_MATCH_GID = YES
6@UNIXONLY@ PORT = 2099 6@UNIXONLY@ PORT = 2099
diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c
index 387a68d8f..0c1d59a87 100644
--- a/src/nat/nat_test.c
+++ b/src/nat/nat_test.c
@@ -404,7 +404,7 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
404 if ((ret->lsock == NULL) || 404 if ((ret->lsock == NULL) ||
405 (GNUNET_OK != 405 (GNUNET_OK !=
406 GNUNET_NETWORK_socket_bind (ret->lsock, (const struct sockaddr *) &sa, 406 GNUNET_NETWORK_socket_bind (ret->lsock, (const struct sockaddr *) &sa,
407 sizeof (sa)))) 407 sizeof (sa), 0)))
408 { 408 {
409 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 409 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
410 _ 410 _
diff --git a/src/nse/nse.conf.in b/src/nse/nse.conf.in
index f613b51d2..c96830c42 100644
--- a/src/nse/nse.conf.in
+++ b/src/nse/nse.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-nse 6BINARY = gnunet-service-nse
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-nse.unix 9UNIXPATH = /tmp/gnunet-service-nse.unix
10UNIX_MATCH_UID = NO 10UNIX_MATCH_UID = NO
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12PROOFFILE = $SERVICEHOME/.nse-proof 12PROOFFILE = $SERVICEHOME/.nse-proof
diff --git a/src/peerinfo/peerinfo.conf.in b/src/peerinfo/peerinfo.conf.in
index 0fba5cfde..11302211d 100644
--- a/src/peerinfo/peerinfo.conf.in
+++ b/src/peerinfo/peerinfo.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-peerinfo 6BINARY = gnunet-service-peerinfo
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-peerinfo.sock 9UNIXPATH = /tmp/gnunet-service-peerinfo.sock
10UNIX_MATCH_UID = NO 10UNIX_MATCH_UID = NO
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12# DISABLE_SOCKET_FORWARDING = NO 12# DISABLE_SOCKET_FORWARDING = NO
diff --git a/src/psyc/psyc.conf.in b/src/psyc/psyc.conf.in
index ad8403a95..5a1eebf61 100644
--- a/src/psyc/psyc.conf.in
+++ b/src/psyc/psyc.conf.in
@@ -2,6 +2,6 @@
2AUTOSTART = YES 2AUTOSTART = YES
3HOME = $SERVICEHOME 3HOME = $SERVICEHOME
4BINARY = gnunet-service-psyc 4BINARY = gnunet-service-psyc
5UNIXPATH = $SERVICEHOME/gnunet-service-psyc.sock 5UNIXPATH = /tmp/gnunet-service-psyc.sock
6UNIX_MATCH_UID = NO 6UNIX_MATCH_UID = NO
7UNIX_MATCH_GID = YES 7UNIX_MATCH_GID = YES
diff --git a/src/psycstore/psycstore.conf.in b/src/psycstore/psycstore.conf.in
index 21bfef328..c43c5158e 100644
--- a/src/psycstore/psycstore.conf.in
+++ b/src/psycstore/psycstore.conf.in
@@ -2,7 +2,7 @@
2AUTOSTART = YES 2AUTOSTART = YES
3HOME = $SERVICEHOME 3HOME = $SERVICEHOME
4BINARY = gnunet-service-psycstore 4BINARY = gnunet-service-psycstore
5UNIXPATH = $SERVICEHOME/gnunet-service-psycstore.sock 5UNIXPATH = /tmp/gnunet-service-psycstore.sock
6@UNIXONLY@PORT = 2111 6@UNIXONLY@PORT = 2111
7UNIX_MATCH_UID = NO 7UNIX_MATCH_UID = NO
8UNIX_MATCH_GID = YES 8UNIX_MATCH_GID = YES
diff --git a/src/regex/regex.conf.in b/src/regex/regex.conf.in
index ad4dbaf08..2ff48c5ae 100644
--- a/src/regex/regex.conf.in
+++ b/src/regex/regex.conf.in
@@ -1,7 +1,7 @@
1[regex] 1[regex]
2AUTOSTART = YES 2AUTOSTART = YES
3@UNIXONLY@ PORT = 2107 3@UNIXONLY@ PORT = 2107
4UNIXPATH = $SERVICEHOME/gnunet-service-regex.sock 4UNIXPATH = /tmp/gnunet-service-regex.sock
5HOSTNAME = localhost 5HOSTNAME = localhost
6HOME = $SERVICEHOME 6HOME = $SERVICEHOME
7BINARY = gnunet-service-regex 7BINARY = gnunet-service-regex
diff --git a/src/scalarproduct/scalarproduct.conf.in b/src/scalarproduct/scalarproduct.conf.in
index 05f23aa95..e47af6f6a 100644
--- a/src/scalarproduct/scalarproduct.conf.in
+++ b/src/scalarproduct/scalarproduct.conf.in
@@ -1,6 +1,6 @@
1[vectorproduct] 1[vectorproduct]
2BINARY = gnunet-service-vectorproduct 2BINARY = gnunet-service-vectorproduct
3UNIXPATH = $SERVICEHOME/gnunet-service-vectorproduct.sock 3UNIXPATH = /tmp/gnunet-service-vectorproduct.sock
4HOME = $SERVICEHOME 4HOME = $SERVICEHOME
5# PORT = 2106 5# PORT = 2106
6@UNIXONLY@ PORT = 2087 6@UNIXONLY@ PORT = 2087
diff --git a/src/set/set.conf.in b/src/set/set.conf.in
index fda94a535..2dc1c21d2 100644
--- a/src/set/set.conf.in
+++ b/src/set/set.conf.in
@@ -6,6 +6,6 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-set 6BINARY = gnunet-service-set
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-set.sock 9UNIXPATH = /tmp/gnunet-service-set.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
diff --git a/src/statistics/statistics.conf.in b/src/statistics/statistics.conf.in
index 3d2294d37..669e89bd7 100644
--- a/src/statistics/statistics.conf.in
+++ b/src/statistics/statistics.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-statistics 6BINARY = gnunet-service-statistics
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-statistics.sock 9UNIXPATH = /tmp/gnunet-service-statistics.sock
10UNIX_MATCH_UID = NO 10UNIX_MATCH_UID = NO
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12# DISABLE_SOCKET_FORWARDING = NO 12# DISABLE_SOCKET_FORWARDING = NO
diff --git a/src/testbed/testbed.conf.in b/src/testbed/testbed.conf.in
index fba0a1228..40bdae16d 100644
--- a/src/testbed/testbed.conf.in
+++ b/src/testbed/testbed.conf.in
@@ -19,7 +19,7 @@ OPERATION_TIMEOUT = 30 s
19ACCEPT_FROM = 127.0.0.1; 19ACCEPT_FROM = 127.0.0.1;
20ACCEPT_FROM6 = ::1; 20ACCEPT_FROM6 = ::1;
21 21
22UNIXPATH = $SERVICEHOME/gnunet-service-testbed.sock 22UNIXPATH = /tmp/gnunet-service-testbed.sock
23UNIX_MATCH_UID = YES 23UNIX_MATCH_UID = YES
24UNIX_MATCH_GID = YES 24UNIX_MATCH_GID = YES
25 25
@@ -88,7 +88,7 @@ AUTOSTART = NO
88@UNIXONLY@ PORT = 2102 88@UNIXONLY@ PORT = 2102
89HOSTNAME = localhost 89HOSTNAME = localhost
90BINARY = gnunet-service-testbed-logger 90BINARY = gnunet-service-testbed-logger
91UNIXPATH = $SERVICEHOME/gnunet-gnunet-testbed-logger.sock 91UNIXPATH = /tmp/gnunet-gnunet-testbed-logger.sock
92DIR = /tmp 92DIR = /tmp
93UNIX_MATCH_UID = YES 93UNIX_MATCH_UID = YES
94UNIX_MATCH_GID = YES 94UNIX_MATCH_GID = YES
@@ -98,6 +98,6 @@ UNIX_MATCH_GID = YES
98AUTOSTART = NO 98AUTOSTART = NO
99@UNIXONLY@ PORT = 2103 99@UNIXONLY@ PORT = 2103
100HOSTNAME = localhost 100HOSTNAME = localhost
101UNIXPATH = $SERVICEHOME/gnunet-service-testbed-barrier.sock 101UNIXPATH = /tmp/gnunet-service-testbed-barrier.sock
102UNIX_MATCH_UID = YES 102UNIX_MATCH_UID = YES
103UNIX_MATCH_GID = YES 103UNIX_MATCH_GID = YES
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 7f5154a4c..8502809f3 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -619,7 +619,8 @@ GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system)
619 continue; 619 continue;
620 bind_status = GNUNET_NETWORK_socket_bind (socket, 620 bind_status = GNUNET_NETWORK_socket_bind (socket,
621 ai->ai_addr, 621 ai->ai_addr,
622 ai->ai_addrlen); 622 ai->ai_addrlen,
623 0);
623 GNUNET_NETWORK_socket_close (socket); 624 GNUNET_NETWORK_socket_close (socket);
624 if (GNUNET_OK != bind_status) 625 if (GNUNET_OK != bind_status)
625 break; 626 break;
@@ -628,7 +629,8 @@ GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system)
628 continue; 629 continue;
629 bind_status = GNUNET_NETWORK_socket_bind (socket, 630 bind_status = GNUNET_NETWORK_socket_bind (socket,
630 ai->ai_addr, 631 ai->ai_addr,
631 ai->ai_addrlen); 632 ai->ai_addrlen,
633 0);
632 GNUNET_NETWORK_socket_close (socket); 634 GNUNET_NETWORK_socket_close (socket);
633 if (GNUNET_OK != bind_status) 635 if (GNUNET_OK != bind_status)
634 break; 636 break;
diff --git a/src/transport/gnunet-helper-transport-bluetooth.c b/src/transport/gnunet-helper-transport-bluetooth.c
index f12303982..43eccf0aa 100644
--- a/src/transport/gnunet-helper-transport-bluetooth.c
+++ b/src/transport/gnunet-helper-transport-bluetooth.c
@@ -1070,7 +1070,6 @@ read_from_the_socket (void *sock,
1070 return count; 1070 return count;
1071} 1071}
1072 1072
1073
1074/** 1073/**
1075 * Open the bluetooth interface for reading/writing 1074 * Open the bluetooth interface for reading/writing
1076 * 1075 *
@@ -1088,8 +1087,7 @@ open_device (struct HardwareInfos *dev)
1088 addr.btAddr = 0; 1087 addr.btAddr = 0;
1089 addr.port = BT_PORT_ANY; 1088 addr.port = BT_PORT_ANY;
1090 1089
1091 if (GNUNET_OK != 1090 if (GNUNET_NETWORK_socket_bind (dev->handle, (const SOCKADDR*)&addr, sizeof (SOCKADDR_BTH), 0) != GNUNET_OK)
1092 GNUNET_NETWORK_socket_bind (dev->handle, (const SOCKADDR*)&addr, sizeof (SOCKADDR_BTH)))
1093 { 1091 {
1094 fprintf (stderr, "Failed to bind the socket: "); 1092 fprintf (stderr, "Failed to bind the socket: ");
1095 if (GetLastError() == WSAENETDOWN) 1093 if (GetLastError() == WSAENETDOWN)
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index eb3d92163..bc64fd5d2 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -2808,7 +2808,7 @@ setup_sockets (struct Plugin *plugin,
2808 GNUNET_a2s (serverAddr, addrlen)); 2808 GNUNET_a2s (serverAddr, addrlen));
2809 /* binding */ 2809 /* binding */
2810 if (GNUNET_OK == GNUNET_NETWORK_socket_bind (plugin->sockv6, 2810 if (GNUNET_OK == GNUNET_NETWORK_socket_bind (plugin->sockv6,
2811 serverAddr, addrlen)) 2811 serverAddr, addrlen, 0))
2812 break; 2812 break;
2813 eno = errno; 2813 eno = errno;
2814 if (0 != plugin->port) 2814 if (0 != plugin->port)
@@ -2885,7 +2885,7 @@ setup_sockets (struct Plugin *plugin,
2885 2885
2886 /* binding */ 2886 /* binding */
2887 if (GNUNET_OK == GNUNET_NETWORK_socket_bind (plugin->sockv4, 2887 if (GNUNET_OK == GNUNET_NETWORK_socket_bind (plugin->sockv4,
2888 serverAddr, addrlen)) 2888 serverAddr, addrlen, 0))
2889 break; 2889 break;
2890 eno = errno; 2890 eno = errno;
2891 if (0 != plugin->port) 2891 if (0 != plugin->port)
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index 4e3038787..2087d30e5 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -572,6 +572,7 @@ unix_real_send (void *cls,
572 const void *sb; 572 const void *sb;
573 size_t sbs; 573 size_t sbs;
574 struct sockaddr_un un; 574 struct sockaddr_un un;
575 size_t slen;
575 const char *unix_path; 576 const char *unix_path;
576 577
577 578
@@ -591,12 +592,21 @@ unix_real_send (void *cls,
591 unix_path = (const char *) &addr[1]; 592 unix_path = (const char *) &addr[1];
592 memset (&un, 0, sizeof (un)); 593 memset (&un, 0, sizeof (un));
593 un.sun_family = AF_UNIX; 594 un.sun_family = AF_UNIX;
594 strncpy (un.sun_path, unix_path, sizeof (un.sun_path) - 1); 595 slen = strlen (unix_path);
596 if (slen >= sizeof (un.sun_path))
597 slen = sizeof (un.sun_path) - 1;
598 GNUNET_assert (slen < sizeof (un.sun_path));
599 memcpy (un.sun_path, unix_path, slen);
600 un.sun_path[slen] = '\0';
601 slen = sizeof (struct sockaddr_un);
602#if LINUX
603 un.sun_path[0] = '\0';
604#endif
595#if HAVE_SOCKADDR_IN_SIN_LEN 605#if HAVE_SOCKADDR_IN_SIN_LEN
596 un.sun_len = (u_char) sizeof (struct sockaddr_un); 606 un.sun_len = (u_char) slen;
597#endif 607#endif
598 sb = (struct sockaddr *) &un; 608 sb = (struct sockaddr *) &un;
599 sbs = sizeof (struct sockaddr_un); 609 sbs = slen;
600 610
601resend: 611resend:
602 /* Send the data */ 612 /* Send the data */
@@ -1013,18 +1023,19 @@ unix_plugin_select_read (struct Plugin *plugin)
1013 } 1023 }
1014 else 1024 else
1015 { 1025 {
1016 LOG (GNUNET_ERROR_TYPE_DEBUG, 1026#if LINUX
1017 "Read %d bytes from socket %s\n", 1027 un.sun_path[0] = '/';
1018 (int) ret, 1028#endif
1019 un.sun_path); 1029 LOG (GNUNET_ERROR_TYPE_DEBUG, "Read %d bytes from socket %s\n", ret,
1030 &un.sun_path[0]);
1020 } 1031 }
1021 1032
1022 GNUNET_assert (AF_UNIX == (un.sun_family)); 1033 GNUNET_assert (AF_UNIX == (un.sun_family));
1023 ua_len = sizeof (struct UnixAddress) + strlen (un.sun_path) + 1; 1034 ua_len = sizeof (struct UnixAddress) + strlen (&un.sun_path[0]) +1;
1024 ua = GNUNET_malloc (ua_len); 1035 ua = GNUNET_malloc (ua_len);
1025 ua->addrlen = htonl (strlen (&un.sun_path[0]) +1); 1036 ua->addrlen = htonl (strlen (&un.sun_path[0]) +1);
1026 ua->options = htonl (0); 1037 ua->options = htonl (0);
1027 memcpy (&ua[1], &un.sun_path[0], strlen (un.sun_path) + 1); 1038 memcpy (&ua[1], &un.sun_path[0], strlen (&un.sun_path[0]) +1);
1028 1039
1029 msg = (struct UNIXMessage *) buf; 1040 msg = (struct UNIXMessage *) buf;
1030 csize = ntohs (msg->header.size); 1041 csize = ntohs (msg->header.size);
@@ -1203,7 +1214,7 @@ unix_plugin_select (void *cls,
1203 * Create a slew of UNIX sockets. If possible, use IPv6 and IPv4. 1214 * Create a slew of UNIX sockets. If possible, use IPv6 and IPv4.
1204 * 1215 *
1205 * @param cls closure for server start, should be a struct Plugin * 1216 * @param cls closure for server start, should be a struct Plugin *
1206 * @return number of sockets created or #GNUNET_SYSERR on error 1217 * @return number of sockets created or GNUNET_SYSERR on error
1207 */ 1218 */
1208static int 1219static int
1209unix_transport_server_start (void *cls) 1220unix_transport_server_start (void *cls)
@@ -1212,16 +1223,26 @@ unix_transport_server_start (void *cls)
1212 struct sockaddr *serverAddr; 1223 struct sockaddr *serverAddr;
1213 socklen_t addrlen; 1224 socklen_t addrlen;
1214 struct sockaddr_un un; 1225 struct sockaddr_un un;
1226 size_t slen;
1215 1227
1216 memset (&un, 0, sizeof (un)); 1228 memset (&un, 0, sizeof (un));
1217 un.sun_family = AF_UNIX; 1229 un.sun_family = AF_UNIX;
1218 strncpy (un.sun_path, plugin->unix_socket_path, sizeof (un.sun_path) - 1); 1230 slen = strlen (plugin->unix_socket_path) + 1;
1231 if (slen >= sizeof (un.sun_path))
1232 slen = sizeof (un.sun_path) - 1;
1233
1234 memcpy (un.sun_path, plugin->unix_socket_path, slen);
1235 un.sun_path[slen] = '\0';
1236 slen = sizeof (struct sockaddr_un);
1219#if HAVE_SOCKADDR_IN_SIN_LEN 1237#if HAVE_SOCKADDR_IN_SIN_LEN
1220 un.sun_len = (u_char) sizeof (struct sockaddr_un); 1238 un.sun_len = (u_char) slen;
1221#endif 1239#endif
1222 1240
1223 serverAddr = (struct sockaddr *) &un; 1241 serverAddr = (struct sockaddr *) &un;
1224 addrlen = sizeof (struct sockaddr_un); 1242 addrlen = slen;
1243#if LINUX
1244 un.sun_path[0] = '\0';
1245#endif
1225 plugin->ats_network = plugin->env->get_address_type (plugin->env->cls, serverAddr, addrlen); 1246 plugin->ats_network = plugin->env->get_address_type (plugin->env->cls, serverAddr, addrlen);
1226 plugin->unix_sock.desc = 1247 plugin->unix_sock.desc =
1227 GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 0); 1248 GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 0);
@@ -1230,8 +1251,8 @@ unix_transport_server_start (void *cls)
1230 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); 1251 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
1231 return GNUNET_SYSERR; 1252 return GNUNET_SYSERR;
1232 } 1253 }
1233 if (GNUNET_OK != 1254 if (GNUNET_NETWORK_socket_bind (plugin->unix_sock.desc, serverAddr, addrlen, 0)
1234 GNUNET_NETWORK_socket_bind (plugin->unix_sock.desc, serverAddr, addrlen)) 1255 != GNUNET_OK)
1235 { 1256 {
1236 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); 1257 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind");
1237 GNUNET_NETWORK_socket_close (plugin->unix_sock.desc); 1258 GNUNET_NETWORK_socket_close (plugin->unix_sock.desc);
diff --git a/src/transport/transport.conf.in b/src/transport/transport.conf.in
index d33fa99fe..fd8b5dbbb 100644
--- a/src/transport/transport.conf.in
+++ b/src/transport/transport.conf.in
@@ -9,7 +9,7 @@ NEIGHBOUR_LIMIT = 50
9ACCEPT_FROM = 127.0.0.1; 9ACCEPT_FROM = 127.0.0.1;
10ACCEPT_FROM6 = ::1; 10ACCEPT_FROM6 = ::1;
11PLUGINS = tcp udp 11PLUGINS = tcp udp
12UNIXPATH = $SERVICEHOME/gnunet-service-transport.sock 12UNIXPATH = /tmp/gnunet-service-transport.sock
13BLACKLIST_FILE = $SERVICEHOME/blacklist 13BLACKLIST_FILE = $SERVICEHOME/blacklist
14UNIX_MATCH_UID = NO 14UNIX_MATCH_UID = NO
15UNIX_MATCH_GID = YES 15UNIX_MATCH_GID = YES
diff --git a/src/util/client.c b/src/util/client.c
index 64960f232..30c80bf03 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -251,9 +251,7 @@ try_unixpath (const char *service_name,
251 struct sockaddr_un s_un; 251 struct sockaddr_un s_un;
252 252
253 unixpath = NULL; 253 unixpath = NULL;
254 if ((GNUNET_OK == 254 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) &&
255 GNUNET_CONFIGURATION_get_value_filename (cfg, service_name,
256 "UNIXPATH", &unixpath)) &&
257 (0 < strlen (unixpath))) 255 (0 < strlen (unixpath)))
258 { 256 {
259 /* We have a non-NULL unixpath, need to validate it */ 257 /* We have a non-NULL unixpath, need to validate it */
@@ -301,8 +299,7 @@ test_service_configuration (const char *service_name,
301#if AF_UNIX 299#if AF_UNIX
302 char *unixpath = NULL; 300 char *unixpath = NULL;
303 301
304 if ((GNUNET_OK == 302 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) &&
305 GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, "UNIXPATH", &unixpath)) &&
306 (0 < strlen (unixpath))) 303 (0 < strlen (unixpath)))
307 ret = GNUNET_OK; 304 ret = GNUNET_OK;
308 GNUNET_free_non_null (unixpath); 305 GNUNET_free_non_null (unixpath);
@@ -832,12 +829,11 @@ GNUNET_CLIENT_service_test (const char *service,
832 { 829 {
833 /* probe UNIX support */ 830 /* probe UNIX support */
834 struct sockaddr_un s_un; 831 struct sockaddr_un s_un;
832 size_t slen;
835 char *unixpath; 833 char *unixpath;
836 834
837 unixpath = NULL; 835 unixpath = NULL;
838 if ((GNUNET_OK == 836 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service, "UNIXPATH", &unixpath)) && (0 < strlen (unixpath))) /* We have a non-NULL unixpath, does that mean it's valid? */
839 GNUNET_CONFIGURATION_get_value_filename (cfg, service, "UNIXPATH", &unixpath)) &&
840 (0 < strlen (unixpath))) /* We have a non-NULL unixpath, does that mean it's valid? */
841 { 837 {
842 if (strlen (unixpath) >= sizeof (s_un.sun_path)) 838 if (strlen (unixpath) >= sizeof (s_un.sun_path))
843 { 839 {
@@ -856,13 +852,21 @@ GNUNET_CLIENT_service_test (const char *service,
856 { 852 {
857 memset (&s_un, 0, sizeof (s_un)); 853 memset (&s_un, 0, sizeof (s_un));
858 s_un.sun_family = AF_UNIX; 854 s_un.sun_family = AF_UNIX;
859 strncpy (s_un.sun_path, unixpath, sizeof (s_un.sun_path) - 1); 855 slen = strlen (unixpath) + 1;
856 if (slen >= sizeof (s_un.sun_path))
857 slen = sizeof (s_un.sun_path) - 1;
858 memcpy (s_un.sun_path, unixpath, slen);
859 s_un.sun_path[slen] = '\0';
860 slen = sizeof (struct sockaddr_un);
861#if LINUX
862 s_un.sun_path[0] = '\0';
863#endif
860#if HAVE_SOCKADDR_IN_SIN_LEN 864#if HAVE_SOCKADDR_IN_SIN_LEN
861 s_un.sun_len = (u_char) sizeof (struct sockaddr_un); 865 s_un.sun_len = (u_char) slen;
862#endif 866#endif
863 if (GNUNET_OK != 867 if (GNUNET_OK !=
864 GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_un, 868 GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_un,
865 sizeof (struct sockaddr_un))) 869 slen, GNUNET_BIND_EXCLUSIVE))
866 { 870 {
867 /* failed to bind => service must be running */ 871 /* failed to bind => service must be running */
868 GNUNET_free (unixpath); 872 GNUNET_free (unixpath);
@@ -912,7 +916,7 @@ GNUNET_CLIENT_service_test (const char *service,
912 { 916 {
913 if (GNUNET_OK != 917 if (GNUNET_OK !=
914 GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_in, 918 GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_in,
915 sizeof (s_in))) 919 sizeof (s_in), GNUNET_BIND_EXCLUSIVE))
916 { 920 {
917 /* failed to bind => service must be running */ 921 /* failed to bind => service must be running */
918 GNUNET_free (hostname); 922 GNUNET_free (hostname);
@@ -945,7 +949,7 @@ GNUNET_CLIENT_service_test (const char *service,
945 { 949 {
946 if (GNUNET_OK != 950 if (GNUNET_OK !=
947 GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_in6, 951 GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_in6,
948 sizeof (s_in6))) 952 sizeof (s_in6), GNUNET_BIND_EXCLUSIVE))
949 { 953 {
950 /* failed to bind => service must be running */ 954 /* failed to bind => service must be running */
951 GNUNET_free (hostname); 955 GNUNET_free (hostname);
diff --git a/src/util/connection.c b/src/util/connection.c
index c8d9919ea..3290abcfc 100644
--- a/src/util/connection.c
+++ b/src/util/connection.c
@@ -828,13 +828,22 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct
828#ifdef AF_UNIX 828#ifdef AF_UNIX
829 struct GNUNET_CONNECTION_Handle *connection; 829 struct GNUNET_CONNECTION_Handle *connection;
830 struct sockaddr_un *un; 830 struct sockaddr_un *un;
831 size_t slen;
831 832
832 GNUNET_assert (0 < strlen (unixpath)); /* sanity check */ 833 GNUNET_assert (0 < strlen (unixpath)); /* sanity check */
833 un = GNUNET_new (struct sockaddr_un); 834 un = GNUNET_new (struct sockaddr_un);
834 un->sun_family = AF_UNIX; 835 un->sun_family = AF_UNIX;
835 strncpy(un->sun_path, unixpath, sizeof(un->sun_path) - 1); 836 slen = strlen (unixpath);
837 if (slen >= sizeof (un->sun_path))
838 slen = sizeof (un->sun_path) - 1;
839 memcpy (un->sun_path, unixpath, slen);
840 un->sun_path[slen] = '\0';
841 slen = sizeof (struct sockaddr_un);
836#if HAVE_SOCKADDR_IN_SIN_LEN 842#if HAVE_SOCKADDR_IN_SIN_LEN
837 un->sun_len = (u_char) sizeof (struct sockaddr_un); 843 un->sun_len = (u_char) slen;
844#endif
845#if LINUX
846 un->sun_path[0] = '\0';
838#endif 847#endif
839 connection = GNUNET_new (struct GNUNET_CONNECTION_Handle); 848 connection = GNUNET_new (struct GNUNET_CONNECTION_Handle);
840 connection->cfg = cfg; 849 connection->cfg = cfg;
@@ -843,7 +852,7 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct
843 connection->port = 0; 852 connection->port = 0;
844 connection->hostname = NULL; 853 connection->hostname = NULL;
845 connection->addr = (struct sockaddr *) un; 854 connection->addr = (struct sockaddr *) un;
846 connection->addrlen = sizeof (struct sockaddr_un); 855 connection->addrlen = slen;
847 connection->sock = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0); 856 connection->sock = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0);
848 if (NULL == connection->sock) 857 if (NULL == connection->sock)
849 { 858 {
diff --git a/src/util/disk.c b/src/util/disk.c
index 34480e36a..066b0b99b 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -759,12 +759,13 @@ GNUNET_DISK_directory_create (const char *dir)
759 759
760 760
761/** 761/**
762 * Create the directory structure for storing a file. 762 * Create the directory structure for storing
763 * a file.
763 * 764 *
764 * @param filename name of a file in the directory 765 * @param filename name of a file in the directory
765 * @returns #GNUNET_OK on success, 766 * @returns GNUNET_OK on success,
766 * #GNUNET_SYSERR on failure, 767 * GNUNET_SYSERR on failure,
767 * #GNUNET_NO if the directory 768 * GNUNET_NO if the directory
768 * exists but is not writeable for us 769 * exists but is not writeable for us
769 */ 770 */
770int 771int
@@ -791,11 +792,10 @@ GNUNET_DISK_directory_create_for_file (const char *filename)
791 792
792/** 793/**
793 * Read the contents of a binary file into a buffer. 794 * Read the contents of a binary file into a buffer.
794 *
795 * @param h handle to an open file 795 * @param h handle to an open file
796 * @param result the buffer to write the result to 796 * @param result the buffer to write the result to
797 * @param len the maximum number of bytes to read 797 * @param len the maximum number of bytes to read
798 * @return the number of bytes read on success, #GNUNET_SYSERR on failure 798 * @return the number of bytes read on success, GNUNET_SYSERR on failure
799 */ 799 */
800ssize_t 800ssize_t
801GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle * h, void *result, 801GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle * h, void *result,
diff --git a/src/util/network.c b/src/util/network.c
index 793290b45..c0b977368 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -87,9 +87,7 @@ GNUNET_NETWORK_test_pf (int pf)
87 { 87 {
88 if (EAFNOSUPPORT == errno) 88 if (EAFNOSUPPORT == errno)
89 return GNUNET_NO; 89 return GNUNET_NO;
90 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 90 fprintf (stderr, "Failed to create test socket: %s\n", STRERROR (errno));
91 "Failed to create test socket: %s\n",
92 STRERROR (errno));
93 return GNUNET_SYSERR; 91 return GNUNET_SYSERR;
94 } 92 }
95#if WINDOWS 93#if WINDOWS
@@ -385,18 +383,20 @@ GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc,
385 * @param desc socket to bind 383 * @param desc socket to bind
386 * @param address address to be bound 384 * @param address address to be bound
387 * @param address_len length of @a address 385 * @param address_len length of @a address
386 * @param flags flags affecting bind behaviour
388 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise 387 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
389 */ 388 */
390int 389int
391GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, 390GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
392 const struct sockaddr *address, 391 const struct sockaddr *address,
393 socklen_t address_len) 392 socklen_t address_len,
393 int flags)
394{ 394{
395 int ret; 395 int ret;
396 socklen_t bind_address_len = address_len; 396 socklen_t bind_address_len = address_len;
397 397
398#ifdef LINUX 398#ifdef LINUX
399 if (AF_UNIX == address->sa_family) 399 if (address->sa_family == AF_UNIX)
400 { 400 {
401 const struct sockaddr_un *address_un = (const struct sockaddr_un *)address; 401 const struct sockaddr_un *address_un = (const struct sockaddr_un *)address;
402 if (address_un->sun_path[0] == '\0') 402 if (address_un->sun_path[0] == '\0')
@@ -431,6 +431,16 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
431 LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt"); 431 LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
432 } 432 }
433#endif 433#endif
434#ifndef LINUX
435#ifndef MINGW
436 if (address->sa_family == AF_UNIX && (flags & GNUNET_BIND_EXCLUSIVE) == 0)
437 {
438 const struct sockaddr_un *un = (const struct sockaddr_un *) address;
439
440 (void) unlink (un->sun_path);
441 }
442#endif
443#endif
434 ret = bind (desc->fd, address, bind_address_len); 444 ret = bind (desc->fd, address, bind_address_len);
435#ifdef MINGW 445#ifdef MINGW
436 if (SOCKET_ERROR == ret) 446 if (SOCKET_ERROR == ret)
@@ -439,10 +449,12 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
439 if (ret != 0) 449 if (ret != 0)
440 return GNUNET_SYSERR; 450 return GNUNET_SYSERR;
441#ifndef MINGW 451#ifndef MINGW
452#ifndef LINUX
442 desc->addr = GNUNET_malloc (address_len); 453 desc->addr = GNUNET_malloc (address_len);
443 memcpy (desc->addr, address, address_len); 454 memcpy (desc->addr, address, address_len);
444 desc->addrlen = address_len; 455 desc->addrlen = address_len;
445#endif 456#endif
457#endif
446 return GNUNET_OK; 458 return GNUNET_OK;
447} 459}
448 460
@@ -471,17 +483,17 @@ GNUNET_NETWORK_socket_close (struct GNUNET_NETWORK_Handle *desc)
471#else 483#else
472 ret = close (desc->fd); 484 ret = close (desc->fd);
473#endif 485#endif
486#ifndef LINUX
474#ifndef MINGW 487#ifndef MINGW
475 if ((desc->af == AF_UNIX) && (NULL != desc->addr)) 488 if ((desc->af == AF_UNIX) && (NULL != desc->addr))
476 { 489 {
477 const struct sockaddr_un *un = (const struct sockaddr_un *) desc->addr; 490 const struct sockaddr_un *un = (const struct sockaddr_un *) desc->addr;
478 491
479 if (0 != unlink (un->sun_path)) 492 if (0 != unlink (un->sun_path))
480 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, 493 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "unlink", un->sun_path);
481 "unlink",
482 un->sun_path);
483 } 494 }
484#endif 495#endif
496#endif
485 GNUNET_NETWORK_socket_free_memory_only_ (desc); 497 GNUNET_NETWORK_socket_free_memory_only_ (desc);
486 return (ret == 0) ? GNUNET_OK : GNUNET_SYSERR; 498 return (ret == 0) ? GNUNET_OK : GNUNET_SYSERR;
487} 499}
diff --git a/src/util/resolver.conf.in b/src/util/resolver.conf.in
index 005082ea5..cccb60c2f 100644
--- a/src/util/resolver.conf.in
+++ b/src/util/resolver.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-resolver 6BINARY = gnunet-service-resolver
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-resolver.sock 9UNIXPATH = /tmp/gnunet-service-resolver.sock
10UNIX_MATCH_UID = NO 10UNIX_MATCH_UID = NO
11UNIX_MATCH_GID = NO 11UNIX_MATCH_GID = NO
12# DISABLE_SOCKET_FORWARDING = NO 12# DISABLE_SOCKET_FORWARDING = NO
diff --git a/src/util/server.c b/src/util/server.c
index 4df8fd83d..9e88992ca 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -469,7 +469,7 @@ open_listen_socket (const struct sockaddr *serverAddr, socklen_t socklen)
469 return NULL; 469 return NULL;
470 } 470 }
471 /* bind the socket */ 471 /* bind the socket */
472 if (GNUNET_OK != GNUNET_NETWORK_socket_bind (sock, serverAddr, socklen)) 472 if (GNUNET_OK != GNUNET_NETWORK_socket_bind (sock, serverAddr, socklen, 0))
473 { 473 {
474 eno = errno; 474 eno = errno;
475 if (EADDRINUSE != errno) 475 if (EADDRINUSE != errno)
diff --git a/src/util/service.c b/src/util/service.c
index 489dd2e55..b91be9664 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -841,15 +841,24 @@ add_unixpath (struct sockaddr **saddrs, socklen_t * saddrlens,
841{ 841{
842#ifdef AF_UNIX 842#ifdef AF_UNIX
843 struct sockaddr_un *un; 843 struct sockaddr_un *un;
844 size_t slen;
844 845
845 un = GNUNET_malloc (sizeof (struct sockaddr_un)); 846 un = GNUNET_malloc (sizeof (struct sockaddr_un));
846 un->sun_family = AF_UNIX; 847 un->sun_family = AF_UNIX;
847 strncpy (un->sun_path, unixpath, sizeof (un->sun_path) - 1); 848 slen = strlen (unixpath) + 1;
849 if (slen >= sizeof (un->sun_path))
850 slen = sizeof (un->sun_path) - 1;
851 memcpy (un->sun_path, unixpath, slen);
852 un->sun_path[slen] = '\0';
853 slen = sizeof (struct sockaddr_un);
854#if LINUX
855 un->sun_path[0] = '\0';
856#endif
848#if HAVE_SOCKADDR_IN_SIN_LEN 857#if HAVE_SOCKADDR_IN_SIN_LEN
849 un->sun_len = (u_char) sizeof (struct sockaddr_un); 858 un->sun_len = (u_char) slen;
850#endif 859#endif
851 *saddrs = (struct sockaddr *) un; 860 *saddrs = (struct sockaddr *) un;
852 *saddrlens = sizeof (struct sockaddr_un); 861 *saddrlens = slen;
853#else 862#else
854 /* this function should never be called 863 /* this function should never be called
855 * unless AF_UNIX is defined! */ 864 * unless AF_UNIX is defined! */
@@ -971,8 +980,8 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name,
971 if ((GNUNET_YES == 980 if ((GNUNET_YES ==
972 GNUNET_CONFIGURATION_have_value (cfg, service_name, "UNIXPATH")) && 981 GNUNET_CONFIGURATION_have_value (cfg, service_name, "UNIXPATH")) &&
973 (GNUNET_OK == 982 (GNUNET_OK ==
974 GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, "UNIXPATH", 983 GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH",
975 &unixpath)) && 984 &unixpath)) &&
976 (0 < strlen (unixpath))) 985 (0 < strlen (unixpath)))
977 { 986 {
978 /* probe UNIX support */ 987 /* probe UNIX support */
@@ -987,11 +996,6 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name,
987 LOG (GNUNET_ERROR_TYPE_INFO, 996 LOG (GNUNET_ERROR_TYPE_INFO,
988 _("Using `%s' instead\n"), unixpath); 997 _("Using `%s' instead\n"), unixpath);
989 } 998 }
990 if (GNUNET_OK !=
991 GNUNET_DISK_directory_create_for_file (unixpath))
992 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
993 "mkdir",
994 unixpath);
995 } 999 }
996 if (NULL != unixpath) 1000 if (NULL != unixpath)
997 { 1001 {
diff --git a/src/util/test_connection.c b/src/util/test_connection.c
index 6644623d4..1ba20498f 100644
--- a/src/util/test_connection.c
+++ b/src/util/test_connection.c
@@ -65,9 +65,9 @@ open_listen_socket ()
65 if (GNUNET_NETWORK_socket_setsockopt 65 if (GNUNET_NETWORK_socket_setsockopt
66 (desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK) 66 (desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK)
67 GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt"); 67 GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt");
68 GNUNET_assert (GNUNET_OK == 68 GNUNET_assert (GNUNET_NETWORK_socket_bind
69 GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa, 69 (desc, (const struct sockaddr *) &sa,
70 sizeof (sa))); 70 sizeof (sa), 0) == GNUNET_OK);
71 GNUNET_NETWORK_socket_listen (desc, 5); 71 GNUNET_NETWORK_socket_listen (desc, 5);
72 return desc; 72 return desc;
73} 73}
diff --git a/src/util/test_connection_addressing.c b/src/util/test_connection_addressing.c
index e5c8edeeb..eeb610dd1 100644
--- a/src/util/test_connection_addressing.c
+++ b/src/util/test_connection_addressing.c
@@ -68,7 +68,7 @@ open_listen_socket ()
68 GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt"); 68 GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt");
69 if (GNUNET_OK != 69 if (GNUNET_OK !=
70 GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa, 70 GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa,
71 sizeof (sa))) 71 sizeof (sa), 0))
72 { 72 {
73 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 73 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
74 "bind"); 74 "bind");
diff --git a/src/util/test_connection_receive_cancel.c b/src/util/test_connection_receive_cancel.c
index c61272a57..99905e232 100644
--- a/src/util/test_connection_receive_cancel.c
+++ b/src/util/test_connection_receive_cancel.c
@@ -64,9 +64,9 @@ open_listen_socket ()
64 if (GNUNET_NETWORK_socket_setsockopt 64 if (GNUNET_NETWORK_socket_setsockopt
65 (desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK) 65 (desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK)
66 GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt"); 66 GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt");
67 GNUNET_assert (GNUNET_OK == 67 GNUNET_assert (GNUNET_NETWORK_socket_bind
68 GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa, 68 (desc, (const struct sockaddr *) &sa,
69 sizeof (sa))); 69 sizeof (sa), 0) == GNUNET_OK);
70 GNUNET_NETWORK_socket_listen (desc, 5); 70 GNUNET_NETWORK_socket_listen (desc, 5);
71 return desc; 71 return desc;
72} 72}
diff --git a/src/util/test_connection_timeout.c b/src/util/test_connection_timeout.c
index 7241bbfae..6608e18db 100644
--- a/src/util/test_connection_timeout.c
+++ b/src/util/test_connection_timeout.c
@@ -61,9 +61,9 @@ open_listen_socket ()
61 if (GNUNET_NETWORK_socket_setsockopt 61 if (GNUNET_NETWORK_socket_setsockopt
62 (desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK) 62 (desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK)
63 GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt"); 63 GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt");
64 GNUNET_assert (GNUNET_OK == 64 GNUNET_assert (GNUNET_NETWORK_socket_bind
65 GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa, 65 (desc, (const struct sockaddr *) &sa,
66 sizeof (sa))); 66 sizeof (sa), 0) == GNUNET_OK);
67 GNUNET_NETWORK_socket_listen (desc, 5); 67 GNUNET_NETWORK_socket_listen (desc, 5);
68 return desc; 68 return desc;
69} 69}
diff --git a/src/util/test_server_with_client_unix.c b/src/util/test_server_with_client_unix.c
index a4e0ffe5d..57a67d3f4 100644
--- a/src/util/test_server_with_client_unix.c
+++ b/src/util/test_server_with_client_unix.c
@@ -134,15 +134,20 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
134{ 134{
135 struct sockaddr_un un; 135 struct sockaddr_un un;
136 const char *unixpath = "/tmp/testsock"; 136 const char *unixpath = "/tmp/testsock";
137 size_t slen = strlen (unixpath);
137 struct sockaddr *sap[2]; 138 struct sockaddr *sap[2];
138 socklen_t slens[2]; 139 socklen_t slens[2];
139 140
140 memset (&un, 0, sizeof (un)); 141 memset (&un, 0, sizeof (un));
141 un.sun_family = AF_UNIX; 142 un.sun_family = AF_UNIX;
142 strncpy(un.sun_path, unixpath, sizeof (un.sun_path) - 1); 143 memcpy (un.sun_path, unixpath, slen);
144 un.sun_path[slen] = '\0';
143#if HAVE_SOCKADDR_IN_SIN_LEN 145#if HAVE_SOCKADDR_IN_SIN_LEN
144 un.sun_len = (u_char) sizeof (un); 146 un.sun_len = (u_char) sizeof (un);
145#endif 147#endif
148#if LINUX
149 un.sun_path[0] = '\0';
150#endif
146 151
147 sap[0] = (struct sockaddr *) &un; 152 sap[0] = (struct sockaddr *) &un;
148 slens[0] = sizeof (un); 153 slens[0] = sizeof (un);
diff --git a/src/vpn/vpn.conf.in b/src/vpn/vpn.conf.in
index 55c86dc03..57657b94f 100644
--- a/src/vpn/vpn.conf.in
+++ b/src/vpn/vpn.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
6BINARY = gnunet-service-vpn 6BINARY = gnunet-service-vpn
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $SERVICEHOME/gnunet-service-vpn.sock 9UNIXPATH = /tmp/gnunet-service-vpn.sock
10UNIX_MATCH_UID = YES 10UNIX_MATCH_UID = YES
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12 12