summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-26 18:48:59 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-26 18:48:59 +0000
commitfa7d6b32530d3d8c2d7e542a15319c74c22061b6 (patch)
tree8f4c7615c89f646a66fc709b698ef81becdf1ad1 /src
parentd79a03493ba5d0581e828724a402a2054429e7be (diff)
moving from abstract unix domain socket paths to normal unix domain socket paths (#2887), removing now unnecessary/dead flags argument to GNUNET_NETWORK_socket_bind
Diffstat (limited to 'src')
-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, 117 insertions, 182 deletions
diff --git a/src/arm/arm.conf.in b/src/arm/arm.conf.in
index b9a33242f..e9bf82e9f 100644
--- a/src/arm/arm.conf.in
+++ b/src/arm/arm.conf.in
@@ -7,7 +7,7 @@ BINARY = gnunet-service-arm
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
DEFAULTSERVICES = topology hostlist dht nse mesh fs
-UNIXPATH = /tmp/gnunet-service-arm.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-arm.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c
index 906f0adde..ab1fe6481 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,
"setsockopt");
#endif
- if (GNUNET_NETWORK_socket_bind
- (sock, (const struct sockaddr *) sa, addr_len, 0) != GNUNET_OK)
+ if (GNUNET_OK !=
+ GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) sa, addr_len))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_
diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c
index bb30f22c6..557e81ee5 100644
--- a/src/arm/test_exponential_backoff.c
+++ b/src/arm/test_exponential_backoff.c
@@ -42,7 +42,7 @@
#define BINARY "mockup-service"
-#define CFGFILENAME "test_arm_api_data.conf"
+#define CFGFILENAME "test_arm_api_data_copy.conf"
static const struct GNUNET_CONFIGURATION_Handle *cfg;
diff --git a/src/ats/ats.conf.in b/src/ats/ats.conf.in
index 457e86c65..f911c0bcf 100644
--- a/src/ats/ats.conf.in
+++ b/src/ats/ats.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-ats
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-ats.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-ats.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
diff --git a/src/consensus/consensus.conf.in b/src/consensus/consensus.conf.in
index 18e976deb..c91a0be49 100644
--- a/src/consensus/consensus.conf.in
+++ b/src/consensus/consensus.conf.in
@@ -6,6 +6,6 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-consensus
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-consensus.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-consensus.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
diff --git a/src/core/core.conf.in b/src/core/core.conf.in
index 839c21eeb..e1e5f5b6f 100644
--- a/src/core/core.conf.in
+++ b/src/core/core.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-core
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-core.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-core.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
# DISABLE_SOCKET_FORWARDING = NO
diff --git a/src/datastore/datastore.conf.in b/src/datastore/datastore.conf.in
index 7a92070d7..f996ce559 100644
--- a/src/datastore/datastore.conf.in
+++ b/src/datastore/datastore.conf.in
@@ -1,6 +1,6 @@
[datastore]
AUTOSTART = YES
-UNIXPATH = /tmp/gnunet-service-datastore.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-datastore.sock
UNIX_MATCH_UID = NO
UNIX_MATCH_GID = YES
@UNIXONLY@ PORT = 2093
diff --git a/src/dht/dht.conf.in b/src/dht/dht.conf.in
index 59c5bc1b7..38c04a182 100644
--- a/src/dht/dht.conf.in
+++ b/src/dht/dht.conf.in
@@ -7,7 +7,7 @@ BINARY = gnunet-service-dht
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
BUCKET_SIZE = 4
-UNIXPATH = /tmp/gnunet-service-dht.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-dht.sock
# This could be relaxed...
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
diff --git a/src/dns/dns.conf.in b/src/dns/dns.conf.in
index 7944b410a..a1282b3ed 100644
--- a/src/dns/dns.conf.in
+++ b/src/dns/dns.conf.in
@@ -3,7 +3,7 @@ AUTOSTART = YES
HOSTNAME = localhost
HOME = $SERVICEHOME
BINARY = gnunet-service-dns
-UNIXPATH = /tmp/gnunet-service-dns.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-dns.sock
# Access to this service can compromise all DNS queries in this
# system. Thus access should be restricted to the same UID.
diff --git a/src/dns/dnsstub.c b/src/dns/dnsstub.c
index 0e130a77f..caf90f3d2 100644
--- a/src/dns/dnsstub.c
+++ b/src/dns/dnsstub.c
@@ -167,11 +167,11 @@ open_socket (int af)
return NULL;
}
sa->sa_family = af;
- if (GNUNET_OK != GNUNET_NETWORK_socket_bind (ret,
- sa,
- alen,
- 0))
- {
+ if (GNUNET_OK !=
+ GNUNET_NETWORK_socket_bind (ret,
+ sa,
+ alen))
+ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Could not bind to any port: %s\n"),
STRERROR (errno));
diff --git a/src/dv/dv.conf.in b/src/dv/dv.conf.in
index c0dc21bfd..70b9cfd55 100644
--- a/src/dv/dv.conf.in
+++ b/src/dv/dv.conf.in
@@ -6,7 +6,7 @@ BINARY = gnunet-service-dv
HOME = $SERVICEHOME
HOSTNAME = localhost
@UNIXONLY@ PORT = 2571
-UNIXPATH = /tmp/gnunet-service-dv.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-dv.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
# ACCEPT_FROM =
diff --git a/src/experimentation/experimentation.conf.in b/src/experimentation/experimentation.conf.in
index 6597dd0c1..c06e54dd4 100644
--- a/src/experimentation/experimentation.conf.in
+++ b/src/experimentation/experimentation.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-daemon-experimentation
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-daemon-experimentation.sock
+UNIXPATH = $SERVICEHOME/gnunet-daemon-experimentation.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
ISSUERS = TFRM29O2RQNKLVBQIGODJ6GD58LSQ2NM9TNFBC6N48BRJHQO38Q73N2OM3V4CLKDM6CILQV4CU8PMJDRG0FNB0PDI057DBRANMLPLRG \ No newline at end of file
diff --git a/src/fs/fs.conf.in b/src/fs/fs.conf.in
index 2375dc7ec..ef98272f6 100644
--- a/src/fs/fs.conf.in
+++ b/src/fs/fs.conf.in
@@ -22,7 +22,7 @@ CONTENT_CACHING = YES
# (may improve anonymity, probably not a good idea if content_caching is NO)
CONTENT_PUSHING = YES
-UNIXPATH = /tmp/gnunet-service-fs.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-fs.sock
# Do we require users that want to access file-sharing to run this process
# (usually not a good idea)
diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in
index 91fd822f8..53da718f5 100644
--- a/src/gns/gns.conf.in
+++ b/src/gns/gns.conf.in
@@ -3,7 +3,7 @@ AUTOSTART = YES
HOSTNAME = localhost
HOME = $SERVICEHOME
BINARY = gnunet-service-gns
-UNIXPATH = /tmp/gnunet-service-gns.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-gns.sock
@UNIXONLY@PORT = 2102
ZONE_DIR = $SERVICEHOME/gns/
@@ -32,7 +32,7 @@ AUTOSTART = NO
# Where is the certificate for the GNS proxy stored?
PROXY_CACERT = $SERVICEHOME/gns/gnsCAcert.pem
-PROXY_UNIXPATH = /tmp/gnunet-gns-proxy.sock
+PROXY_UNIXPATH = $SERVICEHOME/gnunet-gns-proxy.sock
[fcfsd]
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index 8bbf22c46..f22cba0d7 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -616,8 +616,7 @@ run_dnsd ()
if (GNUNET_OK !=
GNUNET_NETWORK_socket_bind (listen_socket4,
(struct sockaddr *) &v4,
- sizeof (v4),
- 0))
+ sizeof (v4)))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind");
GNUNET_NETWORK_socket_close (listen_socket4);
@@ -640,8 +639,7 @@ run_dnsd ()
if (GNUNET_OK !=
GNUNET_NETWORK_socket_bind (listen_socket6,
(struct sockaddr *) &v6,
- sizeof (v6),
- 0))
+ sizeof (v6)))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind");
GNUNET_NETWORK_socket_close (listen_socket6);
diff --git a/src/identity/identity.conf.in b/src/identity/identity.conf.in
index 671e5f2f1..d06912681 100644
--- a/src/identity/identity.conf.in
+++ b/src/identity/identity.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-identity
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-identity.unix
+UNIXPATH = $SERVICEHOME/gnunet-service-identity.unix
UNIX_MATCH_UID = NO
UNIX_MATCH_GID = YES
diff --git a/src/include/gnunet_network_lib.h b/src/include/gnunet_network_lib.h
index e2ebd450e..55d0a3d7b 100644
--- a/src/include/gnunet_network_lib.h
+++ b/src/include/gnunet_network_lib.h
@@ -132,25 +132,17 @@ GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd,
/**
- * Fail to bind if an address is already in use.
- */
-#define GNUNET_BIND_EXCLUSIVE 0x01
-
-
-/**
* Bind a socket to a particular address.
*
* @param desc socket to bind
* @param address address to be bound
* @param address_len length of address
- * @param flags flags affecting bind behaviour
* @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
*/
int
GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
const struct sockaddr *address,
- socklen_t address_len,
- int flags);
+ socklen_t address_len);
/**
* Close a socket.
diff --git a/src/lockmanager/lockmanager.conf.in b/src/lockmanager/lockmanager.conf.in
index 42d574324..1fee355e2 100644
--- a/src/lockmanager/lockmanager.conf.in
+++ b/src/lockmanager/lockmanager.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-lockmanager
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-lockmanager.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-lockmanager.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
diff --git a/src/mesh/mesh.conf.in b/src/mesh/mesh.conf.in
index 504e2ecb1..aaa337a98 100644
--- a/src/mesh/mesh.conf.in
+++ b/src/mesh/mesh.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-mesh
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-mesh.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-mesh.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
REFRESH_CONNECTION_TIME = 5 min
diff --git a/src/multicast/multicast.conf.in b/src/multicast/multicast.conf.in
index bd37cb474..8a19450ab 100644
--- a/src/multicast/multicast.conf.in
+++ b/src/multicast/multicast.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-multicast
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-multicast.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-multicast.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
# DISABLE_SOCKET_FORWARDING = NO
diff --git a/src/namestore/namestore.conf.in b/src/namestore/namestore.conf.in
index 18a37f0da..8c4b71414 100644
--- a/src/namestore/namestore.conf.in
+++ b/src/namestore/namestore.conf.in
@@ -1,6 +1,6 @@
[namestore]
AUTOSTART = YES
-UNIXPATH = /tmp/gnunet-service-namestore.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-namestore.sock
UNIX_MATCH_UID = NO
UNIX_MATCH_GID = YES
@UNIXONLY@ PORT = 2099
diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c
index 0c1d59a87..387a68d8f 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,
if ((ret->lsock == NULL) ||
(GNUNET_OK !=
GNUNET_NETWORK_socket_bind (ret->lsock, (const struct sockaddr *) &sa,
- sizeof (sa), 0)))
+ sizeof (sa))))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_
diff --git a/src/nse/nse.conf.in b/src/nse/nse.conf.in
index c96830c42..f613b51d2 100644
--- a/src/nse/nse.conf.in
+++ b/src/nse/nse.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-nse
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-nse.unix
+UNIXPATH = $SERVICEHOME/gnunet-service-nse.unix
UNIX_MATCH_UID = NO
UNIX_MATCH_GID = YES
PROOFFILE = $SERVICEHOME/.nse-proof
diff --git a/src/peerinfo/peerinfo.conf.in b/src/peerinfo/peerinfo.conf.in
index 11302211d..0fba5cfde 100644
--- a/src/peerinfo/peerinfo.conf.in
+++ b/src/peerinfo/peerinfo.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-peerinfo
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-peerinfo.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-peerinfo.sock
UNIX_MATCH_UID = NO
UNIX_MATCH_GID = YES
# DISABLE_SOCKET_FORWARDING = NO
diff --git a/src/psyc/psyc.conf.in b/src/psyc/psyc.conf.in
index 5a1eebf61..ad8403a95 100644
--- a/src/psyc/psyc.conf.in
+++ b/src/psyc/psyc.conf.in
@@ -2,6 +2,6 @@
AUTOSTART = YES
HOME = $SERVICEHOME
BINARY = gnunet-service-psyc
-UNIXPATH = /tmp/gnunet-service-psyc.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-psyc.sock
UNIX_MATCH_UID = NO
UNIX_MATCH_GID = YES
diff --git a/src/psycstore/psycstore.conf.in b/src/psycstore/psycstore.conf.in
index c43c5158e..21bfef328 100644
--- a/src/psycstore/psycstore.conf.in
+++ b/src/psycstore/psycstore.conf.in
@@ -2,7 +2,7 @@
AUTOSTART = YES
HOME = $SERVICEHOME
BINARY = gnunet-service-psycstore
-UNIXPATH = /tmp/gnunet-service-psycstore.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-psycstore.sock
@UNIXONLY@PORT = 2111
UNIX_MATCH_UID = NO
UNIX_MATCH_GID = YES
diff --git a/src/regex/regex.conf.in b/src/regex/regex.conf.in
index 2ff48c5ae..ad4dbaf08 100644
--- a/src/regex/regex.conf.in
+++ b/src/regex/regex.conf.in
@@ -1,7 +1,7 @@
[regex]
AUTOSTART = YES
@UNIXONLY@ PORT = 2107
-UNIXPATH = /tmp/gnunet-service-regex.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-regex.sock
HOSTNAME = localhost
HOME = $SERVICEHOME
BINARY = gnunet-service-regex
diff --git a/src/scalarproduct/scalarproduct.conf.in b/src/scalarproduct/scalarproduct.conf.in
index e47af6f6a..05f23aa95 100644
--- a/src/scalarproduct/scalarproduct.conf.in
+++ b/src/scalarproduct/scalarproduct.conf.in
@@ -1,6 +1,6 @@
[vectorproduct]
BINARY = gnunet-service-vectorproduct
-UNIXPATH = /tmp/gnunet-service-vectorproduct.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-vectorproduct.sock
HOME = $SERVICEHOME
# PORT = 2106
@UNIXONLY@ PORT = 2087
diff --git a/src/set/set.conf.in b/src/set/set.conf.in
index 2dc1c21d2..fda94a535 100644
--- a/src/set/set.conf.in
+++ b/src/set/set.conf.in
@@ -6,6 +6,6 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-set
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-set.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-set.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
diff --git a/src/statistics/statistics.conf.in b/src/statistics/statistics.conf.in
index 669e89bd7..3d2294d37 100644
--- a/src/statistics/statistics.conf.in
+++ b/src/statistics/statistics.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-statistics
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-statistics.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-statistics.sock
UNIX_MATCH_UID = NO
UNIX_MATCH_GID = YES
# DISABLE_SOCKET_FORWARDING = NO
diff --git a/src/testbed/testbed.conf.in b/src/testbed/testbed.conf.in
index 40bdae16d..fba0a1228 100644
--- a/src/testbed/testbed.conf.in
+++ b/src/testbed/testbed.conf.in
@@ -19,7 +19,7 @@ OPERATION_TIMEOUT = 30 s
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-testbed.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-testbed.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
@@ -88,7 +88,7 @@ AUTOSTART = NO
@UNIXONLY@ PORT = 2102
HOSTNAME = localhost
BINARY = gnunet-service-testbed-logger
-UNIXPATH = /tmp/gnunet-gnunet-testbed-logger.sock
+UNIXPATH = $SERVICEHOME/gnunet-gnunet-testbed-logger.sock
DIR = /tmp
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
@@ -98,6 +98,6 @@ UNIX_MATCH_GID = YES
AUTOSTART = NO
@UNIXONLY@ PORT = 2103
HOSTNAME = localhost
-UNIXPATH = /tmp/gnunet-service-testbed-barrier.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-testbed-barrier.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 8502809f3..7f5154a4c 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -619,8 +619,7 @@ GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system)
continue;
bind_status = GNUNET_NETWORK_socket_bind (socket,
ai->ai_addr,
- ai->ai_addrlen,
- 0);
+ ai->ai_addrlen);
GNUNET_NETWORK_socket_close (socket);
if (GNUNET_OK != bind_status)
break;
@@ -629,8 +628,7 @@ GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system)
continue;
bind_status = GNUNET_NETWORK_socket_bind (socket,
ai->ai_addr,
- ai->ai_addrlen,
- 0);
+ ai->ai_addrlen);
GNUNET_NETWORK_socket_close (socket);
if (GNUNET_OK != bind_status)
break;
diff --git a/src/transport/gnunet-helper-transport-bluetooth.c b/src/transport/gnunet-helper-transport-bluetooth.c
index 43eccf0aa..f12303982 100644
--- a/src/transport/gnunet-helper-transport-bluetooth.c
+++ b/src/transport/gnunet-helper-transport-bluetooth.c
@@ -1070,6 +1070,7 @@ read_from_the_socket (void *sock,
return count;
}
+
/**
* Open the bluetooth interface for reading/writing
*
@@ -1087,7 +1088,8 @@ open_device (struct HardwareInfos *dev)
addr.btAddr = 0;
addr.port = BT_PORT_ANY;
- if (GNUNET_NETWORK_socket_bind (dev->handle, (const SOCKADDR*)&addr, sizeof (SOCKADDR_BTH), 0) != GNUNET_OK)
+ if (GNUNET_OK !=
+ GNUNET_NETWORK_socket_bind (dev->handle, (const SOCKADDR*)&addr, sizeof (SOCKADDR_BTH)))
{
fprintf (stderr, "Failed to bind the socket: ");
if (GetLastError() == WSAENETDOWN)
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index bc64fd5d2..eb3d92163 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -2808,7 +2808,7 @@ setup_sockets (struct Plugin *plugin,
GNUNET_a2s (serverAddr, addrlen));
/* binding */
if (GNUNET_OK == GNUNET_NETWORK_socket_bind (plugin->sockv6,
- serverAddr, addrlen, 0))
+ serverAddr, addrlen))
break;
eno = errno;
if (0 != plugin->port)
@@ -2885,7 +2885,7 @@ setup_sockets (struct Plugin *plugin,
/* binding */
if (GNUNET_OK == GNUNET_NETWORK_socket_bind (plugin->sockv4,
- serverAddr, addrlen, 0))
+ serverAddr, addrlen))
break;
eno = errno;
if (0 != plugin->port)
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index 2087d30e5..4e3038787 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -572,7 +572,6 @@ unix_real_send (void *cls,
const void *sb;
size_t sbs;
struct sockaddr_un un;
- size_t slen;
const char *unix_path;
@@ -592,21 +591,12 @@ unix_real_send (void *cls,
unix_path = (const char *) &addr[1];
memset (&un, 0, sizeof (un));
un.sun_family = AF_UNIX;
- slen = strlen (unix_path);
- if (slen >= sizeof (un.sun_path))
- slen = sizeof (un.sun_path) - 1;
- GNUNET_assert (slen < sizeof (un.sun_path));
- memcpy (un.sun_path, unix_path, slen);
- un.sun_path[slen] = '\0';
- slen = sizeof (struct sockaddr_un);
-#if LINUX
- un.sun_path[0] = '\0';
-#endif
+ strncpy (un.sun_path, unix_path, sizeof (un.sun_path) - 1);
#if HAVE_SOCKADDR_IN_SIN_LEN
- un.sun_len = (u_char) slen;
+ un.sun_len = (u_char) sizeof (struct sockaddr_un);
#endif
sb = (struct sockaddr *) &un;
- sbs = slen;
+ sbs = sizeof (struct sockaddr_un);
resend:
/* Send the data */
@@ -1023,19 +1013,18 @@ unix_plugin_select_read (struct Plugin *plugin)
}
else
{
-#if LINUX
- un.sun_path[0] = '/';
-#endif
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Read %d bytes from socket %s\n", ret,
- &un.sun_path[0]);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Read %d bytes from socket %s\n",
+ (int) ret,
+ un.sun_path);
}
GNUNET_assert (AF_UNIX == (un.sun_family));
- ua_len = sizeof (struct UnixAddress) + strlen (&un.sun_path[0]) +1;
+ ua_len = sizeof (struct UnixAddress) + strlen (un.sun_path) + 1;
ua = GNUNET_malloc (ua_len);
ua->addrlen = htonl (strlen (&un.sun_path[0]) +1);
ua->options = htonl (0);
- memcpy (&ua[1], &un.sun_path[0], strlen (&un.sun_path[0]) +1);
+ memcpy (&ua[1], &un.sun_path[0], strlen (un.sun_path) + 1);
msg = (struct UNIXMessage *) buf;
csize = ntohs (msg->header.size);
@@ -1214,7 +1203,7 @@ unix_plugin_select (void *cls,
* Create a slew of UNIX sockets. If possible, use IPv6 and IPv4.
*
* @param cls closure for server start, should be a struct Plugin *
- * @return number of sockets created or GNUNET_SYSERR on error
+ * @return number of sockets created or #GNUNET_SYSERR on error
*/
static int
unix_transport_server_start (void *cls)
@@ -1223,26 +1212,16 @@ unix_transport_server_start (void *cls)
struct sockaddr *serverAddr;
socklen_t addrlen;
struct sockaddr_un un;
- size_t slen;
memset (&un, 0, sizeof (un));
un.sun_family = AF_UNIX;
- slen = strlen (plugin->unix_socket_path) + 1;
- if (slen >= sizeof (un.sun_path))
- slen = sizeof (un.sun_path) - 1;
-
- memcpy (un.sun_path, plugin->unix_socket_path, slen);
- un.sun_path[slen] = '\0';
- slen = sizeof (struct sockaddr_un);
+ strncpy (un.sun_path, plugin->unix_socket_path, sizeof (un.sun_path) - 1);
#if HAVE_SOCKADDR_IN_SIN_LEN
- un.sun_len = (u_char) slen;
+ un.sun_len = (u_char) sizeof (struct sockaddr_un);
#endif
serverAddr = (struct sockaddr *) &un;
- addrlen = slen;
-#if LINUX
- un.sun_path[0] = '\0';
-#endif
+ addrlen = sizeof (struct sockaddr_un);
plugin->ats_network = plugin->env->get_address_type (plugin->env->cls, serverAddr, addrlen);
plugin->unix_sock.desc =
GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 0);
@@ -1251,8 +1230,8 @@ unix_transport_server_start (void *cls)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
return GNUNET_SYSERR;
}
- if (GNUNET_NETWORK_socket_bind (plugin->unix_sock.desc, serverAddr, addrlen, 0)
- != GNUNET_OK)
+ if (GNUNET_OK !=
+ GNUNET_NETWORK_socket_bind (plugin->unix_sock.desc, serverAddr, addrlen))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind");
GNUNET_NETWORK_socket_close (plugin->unix_sock.desc);
diff --git a/src/transport/transport.conf.in b/src/transport/transport.conf.in
index fd8b5dbbb..d33fa99fe 100644
--- a/src/transport/transport.conf.in
+++ b/src/transport/transport.conf.in
@@ -9,7 +9,7 @@ NEIGHBOUR_LIMIT = 50
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
PLUGINS = tcp udp
-UNIXPATH = /tmp/gnunet-service-transport.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-transport.sock
BLACKLIST_FILE = $SERVICEHOME/blacklist
UNIX_MATCH_UID = NO
UNIX_MATCH_GID = YES
diff --git a/src/util/client.c b/src/util/client.c
index 30c80bf03..64960f232 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -251,7 +251,9 @@ try_unixpath (const char *service_name,
struct sockaddr_un s_un;
unixpath = NULL;
- if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) &&
+ if ((GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_filename (cfg, service_name,
+ "UNIXPATH", &unixpath)) &&
(0 < strlen (unixpath)))
{
/* We have a non-NULL unixpath, need to validate it */
@@ -299,7 +301,8 @@ test_service_configuration (const char *service_name,
#if AF_UNIX
char *unixpath = NULL;
- if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) &&
+ if ((GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, "UNIXPATH", &unixpath)) &&
(0 < strlen (unixpath)))
ret = GNUNET_OK;
GNUNET_free_non_null (unixpath);
@@ -829,11 +832,12 @@ GNUNET_CLIENT_service_test (const char *service,
{
/* probe UNIX support */
struct sockaddr_un s_un;
- size_t slen;
char *unixpath;
unixpath = NULL;
- 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? */
+ if ((GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_filename (cfg, service, "UNIXPATH", &unixpath)) &&
+ (0 < strlen (unixpath))) /* We have a non-NULL unixpath, does that mean it's valid? */
{
if (strlen (unixpath) >= sizeof (s_un.sun_path))
{
@@ -852,21 +856,13 @@ GNUNET_CLIENT_service_test (const char *service,
{
memset (&s_un, 0, sizeof (s_un));
s_un.sun_family = AF_UNIX;
- slen = strlen (unixpath) + 1;
- if (slen >= sizeof (s_un.sun_path))
- slen = sizeof (s_un.sun_path) - 1;
- memcpy (s_un.sun_path, unixpath, slen);
- s_un.sun_path[slen] = '\0';
- slen = sizeof (struct sockaddr_un);
-#if LINUX
- s_un.sun_path[0] = '\0';
-#endif
+ strncpy (s_un.sun_path, unixpath, sizeof (s_un.sun_path) - 1);
#if HAVE_SOCKADDR_IN_SIN_LEN
- s_un.sun_len = (u_char) slen;
+ s_un.sun_len = (u_char) sizeof (struct sockaddr_un);
#endif
if (GNUNET_OK !=
GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_un,
- slen, GNUNET_BIND_EXCLUSIVE))
+ sizeof (struct sockaddr_un)))
{
/* failed to bind => service must be running */
GNUNET_free (unixpath);
@@ -916,7 +912,7 @@ GNUNET_CLIENT_service_test (const char *service,
{
if (GNUNET_OK !=
GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_in,
- sizeof (s_in), GNUNET_BIND_EXCLUSIVE))
+ sizeof (s_in)))
{
/* failed to bind => service must be running */
GNUNET_free (hostname);
@@ -949,7 +945,7 @@ GNUNET_CLIENT_service_test (const char *service,
{
if (GNUNET_OK !=
GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_in6,
- sizeof (s_in6), GNUNET_BIND_EXCLUSIVE))
+ sizeof (s_in6)))
{
/* failed to bind => service must be running */
GNUNET_free (hostname);
diff --git a/src/util/connection.c b/src/util/connection.c
index 3290abcfc..c8d9919ea 100644
--- a/src/util/connection.c
+++ b/src/util/connection.c
@@ -828,22 +828,13 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct
#ifdef AF_UNIX
struct GNUNET_CONNECTION_Handle *connection;
struct sockaddr_un *un;
- size_t slen;
GNUNET_assert (0 < strlen (unixpath)); /* sanity check */
un = GNUNET_new (struct sockaddr_un);
un->sun_family = AF_UNIX;
- slen = strlen (unixpath);
- if (slen >= sizeof (un->sun_path))
- slen = sizeof (un->sun_path) - 1;
- memcpy (un->sun_path, unixpath, slen);
- un->sun_path[slen] = '\0';
- slen = sizeof (struct sockaddr_un);
+ strncpy(un->sun_path, unixpath, sizeof(un->sun_path) - 1);
#if HAVE_SOCKADDR_IN_SIN_LEN
- un->sun_len = (u_char) slen;
-#endif
-#if LINUX
- un->sun_path[0] = '\0';
+ un->sun_len = (u_char) sizeof (struct sockaddr_un);
#endif
connection = GNUNET_new (struct GNUNET_CONNECTION_Handle);
connection->cfg = cfg;
@@ -852,7 +843,7 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct
connection->port = 0;
connection->hostname = NULL;
connection->addr = (struct sockaddr *) un;
- connection->addrlen = slen;
+ connection->addrlen = sizeof (struct sockaddr_un);
connection->sock = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0);
if (NULL == connection->sock)
{
diff --git a/src/util/disk.c b/src/util/disk.c
index 066b0b99b..34480e36a 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -759,13 +759,12 @@ GNUNET_DISK_directory_create (const char *dir)
/**
- * Create the directory structure for storing
- * a file.
+ * Create the directory structure for storing a file.
*
* @param filename name of a file in the directory
- * @returns GNUNET_OK on success,
- * GNUNET_SYSERR on failure,
- * GNUNET_NO if the directory
+ * @returns #GNUNET_OK on success,
+ * #GNUNET_SYSERR on failure,
+ * #GNUNET_NO if the directory
* exists but is not writeable for us
*/
int
@@ -792,10 +791,11 @@ GNUNET_DISK_directory_create_for_file (const char *filename)
/**
* Read the contents of a binary file into a buffer.
+ *
* @param h handle to an open file
* @param result the buffer to write the result to
* @param len the maximum number of bytes to read
- * @return the number of bytes read on success, GNUNET_SYSERR on failure
+ * @return the number of bytes read on success, #GNUNET_SYSERR on failure
*/
ssize_t
GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle * h, void *result,
diff --git a/src/util/network.c b/src/util/network.c
index c0b977368..793290b45 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -87,7 +87,9 @@ GNUNET_NETWORK_test_pf (int pf)
{
if (EAFNOSUPPORT == errno)
return GNUNET_NO;
- fprintf (stderr, "Failed to create test socket: %s\n", STRERROR (errno));
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Failed to create test socket: %s\n",
+ STRERROR (errno));
return GNUNET_SYSERR;
}
#if WINDOWS
@@ -383,20 +385,18 @@ GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc,
* @param desc socket to bind
* @param address address to be bound
* @param address_len length of @a address
- * @param flags flags affecting bind behaviour
* @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
*/
int
GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
const struct sockaddr *address,
- socklen_t address_len,
- int flags)
+ socklen_t address_len)
{
int ret;
socklen_t bind_address_len = address_len;
#ifdef LINUX
- if (address->sa_family == AF_UNIX)
+ if (AF_UNIX == address->sa_family)
{
const struct sockaddr_un *address_un = (const struct sockaddr_un *)address;
if (address_un->sun_path[0] == '\0')
@@ -431,16 +431,6 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
}
#endif
-#ifndef LINUX
-#ifndef MINGW
- if (address->sa_family == AF_UNIX && (flags & GNUNET_BIND_EXCLUSIVE) == 0)
- {
- const struct sockaddr_un *un = (const struct sockaddr_un *) address;
-
- (void) unlink (un->sun_path);
- }
-#endif
-#endif
ret = bind (desc->fd, address, bind_address_len);
#ifdef MINGW
if (SOCKET_ERROR == ret)
@@ -449,12 +439,10 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
if (ret != 0)
return GNUNET_SYSERR;
#ifndef MINGW
-#ifndef LINUX
desc->addr = GNUNET_malloc (address_len);
memcpy (desc->addr, address, address_len);
desc->addrlen = address_len;
#endif
-#endif
return GNUNET_OK;
}
@@ -483,17 +471,17 @@ GNUNET_NETWORK_socket_close (struct GNUNET_NETWORK_Handle *desc)
#else
ret = close (desc->fd);
#endif
-#ifndef LINUX
#ifndef MINGW
if ((desc->af == AF_UNIX) && (NULL != desc->addr))
{
const struct sockaddr_un *un = (const struct sockaddr_un *) desc->addr;
if (0 != unlink (un->sun_path))
- LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "unlink", un->sun_path);
+ LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING,
+ "unlink",
+ un->sun_path);
}
#endif
-#endif
GNUNET_NETWORK_socket_free_memory_only_ (desc);
return (ret == 0) ? GNUNET_OK : GNUNET_SYSERR;
}
diff --git a/src/util/resolver.conf.in b/src/util/resolver.conf.in
index cccb60c2f..005082ea5 100644
--- a/src/util/resolver.conf.in
+++ b/src/util/resolver.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-resolver
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-resolver.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-resolver.sock
UNIX_MATCH_UID = NO
UNIX_MATCH_GID = NO
# DISABLE_SOCKET_FORWARDING = NO
diff --git a/src/util/server.c b/src/util/server.c
index 9e88992ca..4df8fd83d 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)
return NULL;
}
/* bind the socket */
- if (GNUNET_OK != GNUNET_NETWORK_socket_bind (sock, serverAddr, socklen, 0))
+ if (GNUNET_OK != GNUNET_NETWORK_socket_bind (sock, serverAddr, socklen))
{
eno = errno;
if (EADDRINUSE != errno)
diff --git a/src/util/service.c b/src/util/service.c
index b91be9664..489dd2e55 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -841,24 +841,15 @@ add_unixpath (struct sockaddr **saddrs, socklen_t * saddrlens,
{
#ifdef AF_UNIX
struct sockaddr_un *un;
- size_t slen;
un = GNUNET_malloc (sizeof (struct sockaddr_un));
un->sun_family = AF_UNIX;
- slen = strlen (unixpath) + 1;
- if (slen >= sizeof (un->sun_path))
- slen = sizeof (un->sun_path) - 1;
- memcpy (un->sun_path, unixpath, slen);
- un->sun_path[slen] = '\0';
- slen = sizeof (struct sockaddr_un);
-#if LINUX
- un->sun_path[0] = '\0';
-#endif
+ strncpy (un->sun_path, unixpath, sizeof (un->sun_path) - 1);
#if HAVE_SOCKADDR_IN_SIN_LEN
- un->sun_len = (u_char) slen;
+ un->sun_len = (u_char) sizeof (struct sockaddr_un);
#endif
*saddrs = (struct sockaddr *) un;
- *saddrlens = slen;
+ *saddrlens = sizeof (struct sockaddr_un);
#else
/* this function should never be called
* unless AF_UNIX is defined! */
@@ -980,8 +971,8 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name,
if ((GNUNET_YES ==
GNUNET_CONFIGURATION_have_value (cfg, service_name, "UNIXPATH")) &&
(GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH",
- &unixpath)) &&
+ GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, "UNIXPATH",
+ &unixpath)) &&
(0 < strlen (unixpath)))
{
/* probe UNIX support */
@@ -996,6 +987,11 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name,
LOG (GNUNET_ERROR_TYPE_INFO,
_("Using `%s' instead\n"), unixpath);
}
+ if (GNUNET_OK !=
+ GNUNET_DISK_directory_create_for_file (unixpath))
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+ "mkdir",
+ unixpath);
}
if (NULL != unixpath)
{
diff --git a/src/util/test_connection.c b/src/util/test_connection.c
index 1ba20498f..6644623d4 100644
--- a/src/util/test_connection.c
+++ b/src/util/test_connection.c
@@ -65,9 +65,9 @@ open_listen_socket ()
if (GNUNET_NETWORK_socket_setsockopt
(desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt");
- GNUNET_assert (GNUNET_NETWORK_socket_bind
- (desc, (const struct sockaddr *) &sa,
- sizeof (sa), 0) == GNUNET_OK);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa,
+ sizeof (sa)));
GNUNET_NETWORK_socket_listen (desc, 5);
return desc;
}
diff --git a/src/util/test_connection_addressing.c b/src/util/test_connection_addressing.c
index eeb610dd1..e5c8edeeb 100644
--- a/src/util/test_connection_addressing.c
+++ b/src/util/test_connection_addressing.c
@@ -68,7 +68,7 @@ open_listen_socket ()
GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt");
if (GNUNET_OK !=
GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa,
- sizeof (sa), 0))
+ sizeof (sa)))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
"bind");
diff --git a/src/util/test_connection_receive_cancel.c b/src/util/test_connection_receive_cancel.c
index 99905e232..c61272a57 100644
--- a/src/util/test_connection_receive_cancel.c
+++ b/src/util/test_connection_receive_cancel.c
@@ -64,9 +64,9 @@ open_listen_socket ()
if (GNUNET_NETWORK_socket_setsockopt
(desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt");
- GNUNET_assert (GNUNET_NETWORK_socket_bind
- (desc, (const struct sockaddr *) &sa,
- sizeof (sa), 0) == GNUNET_OK);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa,
+ sizeof (sa)));
GNUNET_NETWORK_socket_listen (desc, 5);
return desc;
}
diff --git a/src/util/test_connection_timeout.c b/src/util/test_connection_timeout.c
index 6608e18db..7241bbfae 100644
--- a/src/util/test_connection_timeout.c
+++ b/src/util/test_connection_timeout.c
@@ -61,9 +61,9 @@ open_listen_socket ()
if (GNUNET_NETWORK_socket_setsockopt
(desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt");
- GNUNET_assert (GNUNET_NETWORK_socket_bind
- (desc, (const struct sockaddr *) &sa,
- sizeof (sa), 0) == GNUNET_OK);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa,
+ sizeof (sa)));
GNUNET_NETWORK_socket_listen (desc, 5);
return desc;
}
diff --git a/src/util/test_server_with_client_unix.c b/src/util/test_server_with_client_unix.c
index 57a67d3f4..a4e0ffe5d 100644
--- a/src/util/test_server_with_client_unix.c
+++ b/src/util/test_server_with_client_unix.c
@@ -134,20 +134,15 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct sockaddr_un un;
const char *unixpath = "/tmp/testsock";
- size_t slen = strlen (unixpath);
struct sockaddr *sap[2];
socklen_t slens[2];
memset (&un, 0, sizeof (un));
un.sun_family = AF_UNIX;
- memcpy (un.sun_path, unixpath, slen);
- un.sun_path[slen] = '\0';
+ strncpy(un.sun_path, unixpath, sizeof (un.sun_path) - 1);
#if HAVE_SOCKADDR_IN_SIN_LEN
un.sun_len = (u_char) sizeof (un);
#endif
-#if LINUX
- un.sun_path[0] = '\0';
-#endif
sap[0] = (struct sockaddr *) &un;
slens[0] = sizeof (un);
diff --git a/src/vpn/vpn.conf.in b/src/vpn/vpn.conf.in
index 57657b94f..55c86dc03 100644
--- a/src/vpn/vpn.conf.in
+++ b/src/vpn/vpn.conf.in
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME
BINARY = gnunet-service-vpn
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-UNIXPATH = /tmp/gnunet-service-vpn.sock
+UNIXPATH = $SERVICEHOME/gnunet-service-vpn.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES