diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-26 18:48:59 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-26 18:48:59 +0000 |
commit | fa7d6b32530d3d8c2d7e542a15319c74c22061b6 (patch) | |
tree | 8f4c7615c89f646a66fc709b698ef81becdf1ad1 /src | |
parent | d79a03493ba5d0581e828724a402a2054429e7be (diff) | |
download | gnunet-fa7d6b32530d3d8c2d7e542a15319c74c22061b6.tar.gz gnunet-fa7d6b32530d3d8c2d7e542a15319c74c22061b6.zip |
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')
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 | |||
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | DEFAULTSERVICES = topology hostlist dht nse mesh fs | 9 | DEFAULTSERVICES = topology hostlist dht nse mesh fs |
10 | UNIXPATH = /tmp/gnunet-service-arm.sock | 10 | UNIXPATH = $SERVICEHOME/gnunet-service-arm.sock |
11 | UNIX_MATCH_UID = YES | 11 | UNIX_MATCH_UID = YES |
12 | UNIX_MATCH_GID = YES | 12 | UNIX_MATCH_GID = YES |
13 | 13 | ||
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, | |||
622 | "setsockopt"); | 622 | "setsockopt"); |
623 | #endif | 623 | #endif |
624 | 624 | ||
625 | if (GNUNET_NETWORK_socket_bind | 625 | if (GNUNET_OK != |
626 | (sock, (const struct sockaddr *) sa, addr_len, 0) != GNUNET_OK) | 626 | GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) sa, addr_len)) |
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 bb30f22c6..557e81ee5 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.conf" | 45 | #define CFGFILENAME "test_arm_api_data_copy.conf" |
46 | 46 | ||
47 | 47 | ||
48 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 48 | 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 | |||
6 | BINARY = gnunet-service-ats | 6 | BINARY = gnunet-service-ats |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-ats.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-ats.sock |
10 | UNIX_MATCH_UID = YES | 10 | UNIX_MATCH_UID = YES |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_MATCH_GID = YES |
12 | 12 | ||
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 | |||
6 | BINARY = gnunet-service-consensus | 6 | BINARY = gnunet-service-consensus |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-consensus.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-consensus.sock |
10 | UNIX_MATCH_UID = YES | 10 | UNIX_MATCH_UID = YES |
11 | UNIX_MATCH_GID = YES | 11 | 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 | |||
6 | BINARY = gnunet-service-core | 6 | BINARY = gnunet-service-core |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-core.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-core.sock |
10 | UNIX_MATCH_UID = YES | 10 | UNIX_MATCH_UID = YES |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_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 7a92070d7..f996ce559 100644 --- a/src/datastore/datastore.conf.in +++ b/src/datastore/datastore.conf.in | |||
@@ -1,6 +1,6 @@ | |||
1 | [datastore] | 1 | [datastore] |
2 | AUTOSTART = YES | 2 | AUTOSTART = YES |
3 | UNIXPATH = /tmp/gnunet-service-datastore.sock | 3 | UNIXPATH = $SERVICEHOME/gnunet-service-datastore.sock |
4 | UNIX_MATCH_UID = NO | 4 | UNIX_MATCH_UID = NO |
5 | UNIX_MATCH_GID = YES | 5 | UNIX_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 59c5bc1b7..38c04a182 100644 --- a/src/dht/dht.conf.in +++ b/src/dht/dht.conf.in | |||
@@ -7,7 +7,7 @@ BINARY = gnunet-service-dht | |||
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | BUCKET_SIZE = 4 | 9 | BUCKET_SIZE = 4 |
10 | UNIXPATH = /tmp/gnunet-service-dht.sock | 10 | UNIXPATH = $SERVICEHOME/gnunet-service-dht.sock |
11 | # This could be relaxed... | 11 | # This could be relaxed... |
12 | UNIX_MATCH_UID = YES | 12 | UNIX_MATCH_UID = YES |
13 | UNIX_MATCH_GID = YES | 13 | 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 | |||
3 | HOSTNAME = localhost | 3 | HOSTNAME = localhost |
4 | HOME = $SERVICEHOME | 4 | HOME = $SERVICEHOME |
5 | BINARY = gnunet-service-dns | 5 | BINARY = gnunet-service-dns |
6 | UNIXPATH = /tmp/gnunet-service-dns.sock | 6 | UNIXPATH = $SERVICEHOME/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 0e130a77f..caf90f3d2 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 != GNUNET_NETWORK_socket_bind (ret, | 170 | if (GNUNET_OK != |
171 | sa, | 171 | GNUNET_NETWORK_socket_bind (ret, |
172 | alen, | 172 | sa, |
173 | 0)) | 173 | alen)) |
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 c0dc21bfd..70b9cfd55 100644 --- a/src/dv/dv.conf.in +++ b/src/dv/dv.conf.in | |||
@@ -6,7 +6,7 @@ BINARY = gnunet-service-dv | |||
6 | HOME = $SERVICEHOME | 6 | HOME = $SERVICEHOME |
7 | HOSTNAME = localhost | 7 | HOSTNAME = localhost |
8 | @UNIXONLY@ PORT = 2571 | 8 | @UNIXONLY@ PORT = 2571 |
9 | UNIXPATH = /tmp/gnunet-service-dv.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-dv.sock |
10 | UNIX_MATCH_UID = YES | 10 | UNIX_MATCH_UID = YES |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_MATCH_GID = YES |
12 | # ACCEPT_FROM = | 12 | # 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 | |||
6 | BINARY = gnunet-daemon-experimentation | 6 | BINARY = gnunet-daemon-experimentation |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-daemon-experimentation.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-daemon-experimentation.sock |
10 | UNIX_MATCH_UID = YES | 10 | UNIX_MATCH_UID = YES |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_MATCH_GID = YES |
12 | ISSUERS = TFRM29O2RQNKLVBQIGODJ6GD58LSQ2NM9TNFBC6N48BRJHQO38Q73N2OM3V4CLKDM6CILQV4CU8PMJDRG0FNB0PDI057DBRANMLPLRG \ No newline at end of file | 12 | 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 | |||
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) |
23 | CONTENT_PUSHING = YES | 23 | CONTENT_PUSHING = YES |
24 | 24 | ||
25 | UNIXPATH = /tmp/gnunet-service-fs.sock | 25 | UNIXPATH = $SERVICEHOME/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 91fd822f8..53da718f5 100644 --- a/src/gns/gns.conf.in +++ b/src/gns/gns.conf.in | |||
@@ -3,7 +3,7 @@ AUTOSTART = YES | |||
3 | HOSTNAME = localhost | 3 | HOSTNAME = localhost |
4 | HOME = $SERVICEHOME | 4 | HOME = $SERVICEHOME |
5 | BINARY = gnunet-service-gns | 5 | BINARY = gnunet-service-gns |
6 | UNIXPATH = /tmp/gnunet-service-gns.sock | 6 | UNIXPATH = $SERVICEHOME/gnunet-service-gns.sock |
7 | @UNIXONLY@PORT = 2102 | 7 | @UNIXONLY@PORT = 2102 |
8 | 8 | ||
9 | ZONE_DIR = $SERVICEHOME/gns/ | 9 | ZONE_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? |
34 | PROXY_CACERT = $SERVICEHOME/gns/gnsCAcert.pem | 34 | PROXY_CACERT = $SERVICEHOME/gns/gnsCAcert.pem |
35 | PROXY_UNIXPATH = /tmp/gnunet-gns-proxy.sock | 35 | PROXY_UNIXPATH = $SERVICEHOME/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 8bbf22c46..f22cba0d7 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c | |||
@@ -616,8 +616,7 @@ 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)) | ||
621 | { | 620 | { |
622 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); | 621 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); |
623 | GNUNET_NETWORK_socket_close (listen_socket4); | 622 | GNUNET_NETWORK_socket_close (listen_socket4); |
@@ -640,8 +639,7 @@ run_dnsd () | |||
640 | if (GNUNET_OK != | 639 | if (GNUNET_OK != |
641 | GNUNET_NETWORK_socket_bind (listen_socket6, | 640 | GNUNET_NETWORK_socket_bind (listen_socket6, |
642 | (struct sockaddr *) &v6, | 641 | (struct sockaddr *) &v6, |
643 | sizeof (v6), | 642 | sizeof (v6))) |
644 | 0)) | ||
645 | { | 643 | { |
646 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); | 644 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); |
647 | GNUNET_NETWORK_socket_close (listen_socket6); | 645 | 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 | |||
6 | BINARY = gnunet-service-identity | 6 | BINARY = gnunet-service-identity |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-identity.unix | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-identity.unix |
10 | UNIX_MATCH_UID = NO | 10 | UNIX_MATCH_UID = NO |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_MATCH_GID = YES |
12 | 12 | ||
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, | |||
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 | /** | ||
141 | * Bind a socket to a particular address. | 135 | * Bind a socket to a particular address. |
142 | * | 136 | * |
143 | * @param desc socket to bind | 137 | * @param desc socket to bind |
144 | * @param address address to be bound | 138 | * @param address address to be bound |
145 | * @param address_len length of address | 139 | * @param address_len length of address |
146 | * @param flags flags affecting bind behaviour | ||
147 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise | 140 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise |
148 | */ | 141 | */ |
149 | int | 142 | int |
150 | GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, | 143 | GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, |
151 | const struct sockaddr *address, | 144 | const struct sockaddr *address, |
152 | socklen_t address_len, | 145 | socklen_t address_len); |
153 | int flags); | ||
154 | 146 | ||
155 | /** | 147 | /** |
156 | * Close a socket. | 148 | * 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 | |||
6 | BINARY = gnunet-service-lockmanager | 6 | BINARY = gnunet-service-lockmanager |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-lockmanager.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-lockmanager.sock |
10 | UNIX_MATCH_UID = YES | 10 | UNIX_MATCH_UID = YES |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_MATCH_GID = YES |
12 | 12 | ||
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 | |||
6 | BINARY = gnunet-service-mesh | 6 | BINARY = gnunet-service-mesh |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-mesh.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-mesh.sock |
10 | UNIX_MATCH_UID = YES | 10 | UNIX_MATCH_UID = YES |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_MATCH_GID = YES |
12 | REFRESH_CONNECTION_TIME = 5 min | 12 | 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 | |||
6 | BINARY = gnunet-service-multicast | 6 | BINARY = gnunet-service-multicast |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-multicast.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-multicast.sock |
10 | UNIX_MATCH_UID = YES | 10 | UNIX_MATCH_UID = YES |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_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 18a37f0da..8c4b71414 100644 --- a/src/namestore/namestore.conf.in +++ b/src/namestore/namestore.conf.in | |||
@@ -1,6 +1,6 @@ | |||
1 | [namestore] | 1 | [namestore] |
2 | AUTOSTART = YES | 2 | AUTOSTART = YES |
3 | UNIXPATH = /tmp/gnunet-service-namestore.sock | 3 | UNIXPATH = $SERVICEHOME/gnunet-service-namestore.sock |
4 | UNIX_MATCH_UID = NO | 4 | UNIX_MATCH_UID = NO |
5 | UNIX_MATCH_GID = YES | 5 | UNIX_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 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, | |||
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), 0))) | 407 | sizeof (sa)))) |
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 c96830c42..f613b51d2 100644 --- a/src/nse/nse.conf.in +++ b/src/nse/nse.conf.in | |||
@@ -6,7 +6,7 @@ HOME = $SERVICEHOME | |||
6 | BINARY = gnunet-service-nse | 6 | BINARY = gnunet-service-nse |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-nse.unix | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-nse.unix |
10 | UNIX_MATCH_UID = NO | 10 | UNIX_MATCH_UID = NO |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_MATCH_GID = YES |
12 | PROOFFILE = $SERVICEHOME/.nse-proof | 12 | 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 | |||
6 | BINARY = gnunet-service-peerinfo | 6 | BINARY = gnunet-service-peerinfo |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-peerinfo.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-peerinfo.sock |
10 | UNIX_MATCH_UID = NO | 10 | UNIX_MATCH_UID = NO |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_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 5a1eebf61..ad8403a95 100644 --- a/src/psyc/psyc.conf.in +++ b/src/psyc/psyc.conf.in | |||
@@ -2,6 +2,6 @@ | |||
2 | AUTOSTART = YES | 2 | AUTOSTART = YES |
3 | HOME = $SERVICEHOME | 3 | HOME = $SERVICEHOME |
4 | BINARY = gnunet-service-psyc | 4 | BINARY = gnunet-service-psyc |
5 | UNIXPATH = /tmp/gnunet-service-psyc.sock | 5 | UNIXPATH = $SERVICEHOME/gnunet-service-psyc.sock |
6 | UNIX_MATCH_UID = NO | 6 | UNIX_MATCH_UID = NO |
7 | UNIX_MATCH_GID = YES | 7 | 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 @@ | |||
2 | AUTOSTART = YES | 2 | AUTOSTART = YES |
3 | HOME = $SERVICEHOME | 3 | HOME = $SERVICEHOME |
4 | BINARY = gnunet-service-psycstore | 4 | BINARY = gnunet-service-psycstore |
5 | UNIXPATH = /tmp/gnunet-service-psycstore.sock | 5 | UNIXPATH = $SERVICEHOME/gnunet-service-psycstore.sock |
6 | @UNIXONLY@PORT = 2111 | 6 | @UNIXONLY@PORT = 2111 |
7 | UNIX_MATCH_UID = NO | 7 | UNIX_MATCH_UID = NO |
8 | UNIX_MATCH_GID = YES | 8 | 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 @@ | |||
1 | [regex] | 1 | [regex] |
2 | AUTOSTART = YES | 2 | AUTOSTART = YES |
3 | @UNIXONLY@ PORT = 2107 | 3 | @UNIXONLY@ PORT = 2107 |
4 | UNIXPATH = /tmp/gnunet-service-regex.sock | 4 | UNIXPATH = $SERVICEHOME/gnunet-service-regex.sock |
5 | HOSTNAME = localhost | 5 | HOSTNAME = localhost |
6 | HOME = $SERVICEHOME | 6 | HOME = $SERVICEHOME |
7 | BINARY = gnunet-service-regex | 7 | 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 @@ | |||
1 | [vectorproduct] | 1 | [vectorproduct] |
2 | BINARY = gnunet-service-vectorproduct | 2 | BINARY = gnunet-service-vectorproduct |
3 | UNIXPATH = /tmp/gnunet-service-vectorproduct.sock | 3 | UNIXPATH = $SERVICEHOME/gnunet-service-vectorproduct.sock |
4 | HOME = $SERVICEHOME | 4 | HOME = $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 2dc1c21d2..fda94a535 100644 --- a/src/set/set.conf.in +++ b/src/set/set.conf.in | |||
@@ -6,6 +6,6 @@ HOME = $SERVICEHOME | |||
6 | BINARY = gnunet-service-set | 6 | BINARY = gnunet-service-set |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-set.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-set.sock |
10 | UNIX_MATCH_UID = YES | 10 | UNIX_MATCH_UID = YES |
11 | UNIX_MATCH_GID = YES | 11 | 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 | |||
6 | BINARY = gnunet-service-statistics | 6 | BINARY = gnunet-service-statistics |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-statistics.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-statistics.sock |
10 | UNIX_MATCH_UID = NO | 10 | UNIX_MATCH_UID = NO |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_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 40bdae16d..fba0a1228 100644 --- a/src/testbed/testbed.conf.in +++ b/src/testbed/testbed.conf.in | |||
@@ -19,7 +19,7 @@ OPERATION_TIMEOUT = 30 s | |||
19 | ACCEPT_FROM = 127.0.0.1; | 19 | ACCEPT_FROM = 127.0.0.1; |
20 | ACCEPT_FROM6 = ::1; | 20 | ACCEPT_FROM6 = ::1; |
21 | 21 | ||
22 | UNIXPATH = /tmp/gnunet-service-testbed.sock | 22 | UNIXPATH = $SERVICEHOME/gnunet-service-testbed.sock |
23 | UNIX_MATCH_UID = YES | 23 | UNIX_MATCH_UID = YES |
24 | UNIX_MATCH_GID = YES | 24 | UNIX_MATCH_GID = YES |
25 | 25 | ||
@@ -88,7 +88,7 @@ AUTOSTART = NO | |||
88 | @UNIXONLY@ PORT = 2102 | 88 | @UNIXONLY@ PORT = 2102 |
89 | HOSTNAME = localhost | 89 | HOSTNAME = localhost |
90 | BINARY = gnunet-service-testbed-logger | 90 | BINARY = gnunet-service-testbed-logger |
91 | UNIXPATH = /tmp/gnunet-gnunet-testbed-logger.sock | 91 | UNIXPATH = $SERVICEHOME/gnunet-gnunet-testbed-logger.sock |
92 | DIR = /tmp | 92 | DIR = /tmp |
93 | UNIX_MATCH_UID = YES | 93 | UNIX_MATCH_UID = YES |
94 | UNIX_MATCH_GID = YES | 94 | UNIX_MATCH_GID = YES |
@@ -98,6 +98,6 @@ UNIX_MATCH_GID = YES | |||
98 | AUTOSTART = NO | 98 | AUTOSTART = NO |
99 | @UNIXONLY@ PORT = 2103 | 99 | @UNIXONLY@ PORT = 2103 |
100 | HOSTNAME = localhost | 100 | HOSTNAME = localhost |
101 | UNIXPATH = /tmp/gnunet-service-testbed-barrier.sock | 101 | UNIXPATH = $SERVICEHOME/gnunet-service-testbed-barrier.sock |
102 | UNIX_MATCH_UID = YES | 102 | UNIX_MATCH_UID = YES |
103 | UNIX_MATCH_GID = YES | 103 | 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) | |||
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); | ||
624 | GNUNET_NETWORK_socket_close (socket); | 623 | GNUNET_NETWORK_socket_close (socket); |
625 | if (GNUNET_OK != bind_status) | 624 | if (GNUNET_OK != bind_status) |
626 | break; | 625 | break; |
@@ -629,8 +628,7 @@ GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system) | |||
629 | continue; | 628 | continue; |
630 | bind_status = GNUNET_NETWORK_socket_bind (socket, | 629 | bind_status = GNUNET_NETWORK_socket_bind (socket, |
631 | ai->ai_addr, | 630 | ai->ai_addr, |
632 | ai->ai_addrlen, | 631 | ai->ai_addrlen); |
633 | 0); | ||
634 | GNUNET_NETWORK_socket_close (socket); | 632 | GNUNET_NETWORK_socket_close (socket); |
635 | if (GNUNET_OK != bind_status) | 633 | if (GNUNET_OK != bind_status) |
636 | break; | 634 | 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, | |||
1070 | return count; | 1070 | return count; |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | |||
1073 | /** | 1074 | /** |
1074 | * Open the bluetooth interface for reading/writing | 1075 | * Open the bluetooth interface for reading/writing |
1075 | * | 1076 | * |
@@ -1087,7 +1088,8 @@ open_device (struct HardwareInfos *dev) | |||
1087 | addr.btAddr = 0; | 1088 | addr.btAddr = 0; |
1088 | addr.port = BT_PORT_ANY; | 1089 | addr.port = BT_PORT_ANY; |
1089 | 1090 | ||
1090 | if (GNUNET_NETWORK_socket_bind (dev->handle, (const SOCKADDR*)&addr, sizeof (SOCKADDR_BTH), 0) != GNUNET_OK) | 1091 | if (GNUNET_OK != |
1092 | GNUNET_NETWORK_socket_bind (dev->handle, (const SOCKADDR*)&addr, sizeof (SOCKADDR_BTH))) | ||
1091 | { | 1093 | { |
1092 | fprintf (stderr, "Failed to bind the socket: "); | 1094 | fprintf (stderr, "Failed to bind the socket: "); |
1093 | if (GetLastError() == WSAENETDOWN) | 1095 | 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, | |||
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, 0)) | 2811 | serverAddr, addrlen)) |
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, 0)) | 2888 | serverAddr, addrlen)) |
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 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, | |||
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; | ||
576 | const char *unix_path; | 575 | const char *unix_path; |
577 | 576 | ||
578 | 577 | ||
@@ -592,21 +591,12 @@ unix_real_send (void *cls, | |||
592 | unix_path = (const char *) &addr[1]; | 591 | unix_path = (const char *) &addr[1]; |
593 | memset (&un, 0, sizeof (un)); | 592 | memset (&un, 0, sizeof (un)); |
594 | un.sun_family = AF_UNIX; | 593 | un.sun_family = AF_UNIX; |
595 | slen = strlen (unix_path); | 594 | strncpy (un.sun_path, unix_path, sizeof (un.sun_path) - 1); |
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 | ||
605 | #if HAVE_SOCKADDR_IN_SIN_LEN | 595 | #if HAVE_SOCKADDR_IN_SIN_LEN |
606 | un.sun_len = (u_char) slen; | 596 | un.sun_len = (u_char) sizeof (struct sockaddr_un); |
607 | #endif | 597 | #endif |
608 | sb = (struct sockaddr *) &un; | 598 | sb = (struct sockaddr *) &un; |
609 | sbs = slen; | 599 | sbs = sizeof (struct sockaddr_un); |
610 | 600 | ||
611 | resend: | 601 | resend: |
612 | /* Send the data */ | 602 | /* Send the data */ |
@@ -1023,19 +1013,18 @@ unix_plugin_select_read (struct Plugin *plugin) | |||
1023 | } | 1013 | } |
1024 | else | 1014 | else |
1025 | { | 1015 | { |
1026 | #if LINUX | 1016 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1027 | un.sun_path[0] = '/'; | 1017 | "Read %d bytes from socket %s\n", |
1028 | #endif | 1018 | (int) ret, |
1029 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Read %d bytes from socket %s\n", ret, | 1019 | un.sun_path); |
1030 | &un.sun_path[0]); | ||
1031 | } | 1020 | } |
1032 | 1021 | ||
1033 | GNUNET_assert (AF_UNIX == (un.sun_family)); | 1022 | GNUNET_assert (AF_UNIX == (un.sun_family)); |
1034 | ua_len = sizeof (struct UnixAddress) + strlen (&un.sun_path[0]) +1; | 1023 | ua_len = sizeof (struct UnixAddress) + strlen (un.sun_path) + 1; |
1035 | ua = GNUNET_malloc (ua_len); | 1024 | ua = GNUNET_malloc (ua_len); |
1036 | ua->addrlen = htonl (strlen (&un.sun_path[0]) +1); | 1025 | ua->addrlen = htonl (strlen (&un.sun_path[0]) +1); |
1037 | ua->options = htonl (0); | 1026 | ua->options = htonl (0); |
1038 | memcpy (&ua[1], &un.sun_path[0], strlen (&un.sun_path[0]) +1); | 1027 | memcpy (&ua[1], &un.sun_path[0], strlen (un.sun_path) + 1); |
1039 | 1028 | ||
1040 | msg = (struct UNIXMessage *) buf; | 1029 | msg = (struct UNIXMessage *) buf; |
1041 | csize = ntohs (msg->header.size); | 1030 | csize = ntohs (msg->header.size); |
@@ -1214,7 +1203,7 @@ unix_plugin_select (void *cls, | |||
1214 | * Create a slew of UNIX sockets. If possible, use IPv6 and IPv4. | 1203 | * Create a slew of UNIX sockets. If possible, use IPv6 and IPv4. |
1215 | * | 1204 | * |
1216 | * @param cls closure for server start, should be a struct Plugin * | 1205 | * @param cls closure for server start, should be a struct Plugin * |
1217 | * @return number of sockets created or GNUNET_SYSERR on error | 1206 | * @return number of sockets created or #GNUNET_SYSERR on error |
1218 | */ | 1207 | */ |
1219 | static int | 1208 | static int |
1220 | unix_transport_server_start (void *cls) | 1209 | unix_transport_server_start (void *cls) |
@@ -1223,26 +1212,16 @@ unix_transport_server_start (void *cls) | |||
1223 | struct sockaddr *serverAddr; | 1212 | struct sockaddr *serverAddr; |
1224 | socklen_t addrlen; | 1213 | socklen_t addrlen; |
1225 | struct sockaddr_un un; | 1214 | struct sockaddr_un un; |
1226 | size_t slen; | ||
1227 | 1215 | ||
1228 | memset (&un, 0, sizeof (un)); | 1216 | memset (&un, 0, sizeof (un)); |
1229 | un.sun_family = AF_UNIX; | 1217 | un.sun_family = AF_UNIX; |
1230 | slen = strlen (plugin->unix_socket_path) + 1; | 1218 | strncpy (un.sun_path, plugin->unix_socket_path, sizeof (un.sun_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); | ||
1237 | #if HAVE_SOCKADDR_IN_SIN_LEN | 1219 | #if HAVE_SOCKADDR_IN_SIN_LEN |
1238 | un.sun_len = (u_char) slen; | 1220 | un.sun_len = (u_char) sizeof (struct sockaddr_un); |
1239 | #endif | 1221 | #endif |
1240 | 1222 | ||
1241 | serverAddr = (struct sockaddr *) &un; | 1223 | serverAddr = (struct sockaddr *) &un; |
1242 | addrlen = slen; | 1224 | addrlen = sizeof (struct sockaddr_un); |
1243 | #if LINUX | ||
1244 | un.sun_path[0] = '\0'; | ||
1245 | #endif | ||
1246 | plugin->ats_network = plugin->env->get_address_type (plugin->env->cls, serverAddr, addrlen); | 1225 | plugin->ats_network = plugin->env->get_address_type (plugin->env->cls, serverAddr, addrlen); |
1247 | plugin->unix_sock.desc = | 1226 | plugin->unix_sock.desc = |
1248 | GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 0); | 1227 | GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 0); |
@@ -1251,8 +1230,8 @@ unix_transport_server_start (void *cls) | |||
1251 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); | 1230 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); |
1252 | return GNUNET_SYSERR; | 1231 | return GNUNET_SYSERR; |
1253 | } | 1232 | } |
1254 | if (GNUNET_NETWORK_socket_bind (plugin->unix_sock.desc, serverAddr, addrlen, 0) | 1233 | if (GNUNET_OK != |
1255 | != GNUNET_OK) | 1234 | GNUNET_NETWORK_socket_bind (plugin->unix_sock.desc, serverAddr, addrlen)) |
1256 | { | 1235 | { |
1257 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); | 1236 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); |
1258 | GNUNET_NETWORK_socket_close (plugin->unix_sock.desc); | 1237 | 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 | |||
9 | ACCEPT_FROM = 127.0.0.1; | 9 | ACCEPT_FROM = 127.0.0.1; |
10 | ACCEPT_FROM6 = ::1; | 10 | ACCEPT_FROM6 = ::1; |
11 | PLUGINS = tcp udp | 11 | PLUGINS = tcp udp |
12 | UNIXPATH = /tmp/gnunet-service-transport.sock | 12 | UNIXPATH = $SERVICEHOME/gnunet-service-transport.sock |
13 | BLACKLIST_FILE = $SERVICEHOME/blacklist | 13 | BLACKLIST_FILE = $SERVICEHOME/blacklist |
14 | UNIX_MATCH_UID = NO | 14 | UNIX_MATCH_UID = NO |
15 | UNIX_MATCH_GID = YES | 15 | 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, | |||
251 | struct sockaddr_un s_un; | 251 | struct sockaddr_un s_un; |
252 | 252 | ||
253 | unixpath = NULL; | 253 | unixpath = NULL; |
254 | if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && | 254 | if ((GNUNET_OK == |
255 | GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, | ||
256 | "UNIXPATH", &unixpath)) && | ||
255 | (0 < strlen (unixpath))) | 257 | (0 < strlen (unixpath))) |
256 | { | 258 | { |
257 | /* We have a non-NULL unixpath, need to validate it */ | 259 | /* We have a non-NULL unixpath, need to validate it */ |
@@ -299,7 +301,8 @@ test_service_configuration (const char *service_name, | |||
299 | #if AF_UNIX | 301 | #if AF_UNIX |
300 | char *unixpath = NULL; | 302 | char *unixpath = NULL; |
301 | 303 | ||
302 | if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && | 304 | if ((GNUNET_OK == |
305 | GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, "UNIXPATH", &unixpath)) && | ||
303 | (0 < strlen (unixpath))) | 306 | (0 < strlen (unixpath))) |
304 | ret = GNUNET_OK; | 307 | ret = GNUNET_OK; |
305 | GNUNET_free_non_null (unixpath); | 308 | GNUNET_free_non_null (unixpath); |
@@ -829,11 +832,12 @@ GNUNET_CLIENT_service_test (const char *service, | |||
829 | { | 832 | { |
830 | /* probe UNIX support */ | 833 | /* probe UNIX support */ |
831 | struct sockaddr_un s_un; | 834 | struct sockaddr_un s_un; |
832 | size_t slen; | ||
833 | char *unixpath; | 835 | char *unixpath; |
834 | 836 | ||
835 | unixpath = NULL; | 837 | unixpath = NULL; |
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? */ | 838 | if ((GNUNET_OK == |
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? */ | ||
837 | { | 841 | { |
838 | if (strlen (unixpath) >= sizeof (s_un.sun_path)) | 842 | if (strlen (unixpath) >= sizeof (s_un.sun_path)) |
839 | { | 843 | { |
@@ -852,21 +856,13 @@ GNUNET_CLIENT_service_test (const char *service, | |||
852 | { | 856 | { |
853 | memset (&s_un, 0, sizeof (s_un)); | 857 | memset (&s_un, 0, sizeof (s_un)); |
854 | s_un.sun_family = AF_UNIX; | 858 | s_un.sun_family = AF_UNIX; |
855 | slen = strlen (unixpath) + 1; | 859 | strncpy (s_un.sun_path, unixpath, sizeof (s_un.sun_path) - 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 | ||
864 | #if HAVE_SOCKADDR_IN_SIN_LEN | 860 | #if HAVE_SOCKADDR_IN_SIN_LEN |
865 | s_un.sun_len = (u_char) slen; | 861 | s_un.sun_len = (u_char) sizeof (struct sockaddr_un); |
866 | #endif | 862 | #endif |
867 | if (GNUNET_OK != | 863 | if (GNUNET_OK != |
868 | GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_un, | 864 | GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_un, |
869 | slen, GNUNET_BIND_EXCLUSIVE)) | 865 | sizeof (struct sockaddr_un))) |
870 | { | 866 | { |
871 | /* failed to bind => service must be running */ | 867 | /* failed to bind => service must be running */ |
872 | GNUNET_free (unixpath); | 868 | GNUNET_free (unixpath); |
@@ -916,7 +912,7 @@ GNUNET_CLIENT_service_test (const char *service, | |||
916 | { | 912 | { |
917 | if (GNUNET_OK != | 913 | if (GNUNET_OK != |
918 | GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_in, | 914 | GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_in, |
919 | sizeof (s_in), GNUNET_BIND_EXCLUSIVE)) | 915 | sizeof (s_in))) |
920 | { | 916 | { |
921 | /* failed to bind => service must be running */ | 917 | /* failed to bind => service must be running */ |
922 | GNUNET_free (hostname); | 918 | GNUNET_free (hostname); |
@@ -949,7 +945,7 @@ GNUNET_CLIENT_service_test (const char *service, | |||
949 | { | 945 | { |
950 | if (GNUNET_OK != | 946 | if (GNUNET_OK != |
951 | GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_in6, | 947 | GNUNET_NETWORK_socket_bind (sock, (const struct sockaddr *) &s_in6, |
952 | sizeof (s_in6), GNUNET_BIND_EXCLUSIVE)) | 948 | sizeof (s_in6))) |
953 | { | 949 | { |
954 | /* failed to bind => service must be running */ | 950 | /* failed to bind => service must be running */ |
955 | GNUNET_free (hostname); | 951 | 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 | |||
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; | ||
832 | 831 | ||
833 | GNUNET_assert (0 < strlen (unixpath)); /* sanity check */ | 832 | GNUNET_assert (0 < strlen (unixpath)); /* sanity check */ |
834 | un = GNUNET_new (struct sockaddr_un); | 833 | un = GNUNET_new (struct sockaddr_un); |
835 | un->sun_family = AF_UNIX; | 834 | un->sun_family = AF_UNIX; |
836 | slen = strlen (unixpath); | 835 | strncpy(un->sun_path, unixpath, sizeof(un->sun_path) - 1); |
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); | ||
842 | #if HAVE_SOCKADDR_IN_SIN_LEN | 836 | #if HAVE_SOCKADDR_IN_SIN_LEN |
843 | un->sun_len = (u_char) slen; | 837 | un->sun_len = (u_char) sizeof (struct sockaddr_un); |
844 | #endif | ||
845 | #if LINUX | ||
846 | un->sun_path[0] = '\0'; | ||
847 | #endif | 838 | #endif |
848 | connection = GNUNET_new (struct GNUNET_CONNECTION_Handle); | 839 | connection = GNUNET_new (struct GNUNET_CONNECTION_Handle); |
849 | connection->cfg = cfg; | 840 | connection->cfg = cfg; |
@@ -852,7 +843,7 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct | |||
852 | connection->port = 0; | 843 | connection->port = 0; |
853 | connection->hostname = NULL; | 844 | connection->hostname = NULL; |
854 | connection->addr = (struct sockaddr *) un; | 845 | connection->addr = (struct sockaddr *) un; |
855 | connection->addrlen = slen; | 846 | connection->addrlen = sizeof (struct sockaddr_un); |
856 | connection->sock = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0); | 847 | connection->sock = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0); |
857 | if (NULL == connection->sock) | 848 | if (NULL == connection->sock) |
858 | { | 849 | { |
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) | |||
759 | 759 | ||
760 | 760 | ||
761 | /** | 761 | /** |
762 | * Create the directory structure for storing | 762 | * Create the directory structure for storing a file. |
763 | * a file. | ||
764 | * | 763 | * |
765 | * @param filename name of a file in the directory | 764 | * @param filename name of a file in the directory |
766 | * @returns GNUNET_OK on success, | 765 | * @returns #GNUNET_OK on success, |
767 | * GNUNET_SYSERR on failure, | 766 | * #GNUNET_SYSERR on failure, |
768 | * GNUNET_NO if the directory | 767 | * #GNUNET_NO if the directory |
769 | * exists but is not writeable for us | 768 | * exists but is not writeable for us |
770 | */ | 769 | */ |
771 | int | 770 | int |
@@ -792,10 +791,11 @@ GNUNET_DISK_directory_create_for_file (const char *filename) | |||
792 | 791 | ||
793 | /** | 792 | /** |
794 | * Read the contents of a binary file into a buffer. | 793 | * 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 | */ |
800 | ssize_t | 800 | ssize_t |
801 | GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle * h, void *result, | 801 | 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) | |||
87 | { | 87 | { |
88 | if (EAFNOSUPPORT == errno) | 88 | if (EAFNOSUPPORT == errno) |
89 | return GNUNET_NO; | 89 | return GNUNET_NO; |
90 | fprintf (stderr, "Failed to create test socket: %s\n", STRERROR (errno)); | 90 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
91 | "Failed to create test socket: %s\n", | ||
92 | STRERROR (errno)); | ||
91 | return GNUNET_SYSERR; | 93 | return GNUNET_SYSERR; |
92 | } | 94 | } |
93 | #if WINDOWS | 95 | #if WINDOWS |
@@ -383,20 +385,18 @@ GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc, | |||
383 | * @param desc socket to bind | 385 | * @param desc socket to bind |
384 | * @param address address to be bound | 386 | * @param address address to be bound |
385 | * @param address_len length of @a address | 387 | * @param address_len length of @a address |
386 | * @param flags flags affecting bind behaviour | ||
387 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise | 388 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise |
388 | */ | 389 | */ |
389 | int | 390 | int |
390 | GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, | 391 | GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, |
391 | const struct sockaddr *address, | 392 | const struct sockaddr *address, |
392 | socklen_t address_len, | 393 | 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 (address->sa_family == AF_UNIX) | 399 | if (AF_UNIX == address->sa_family) |
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,16 +431,6 @@ 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 | ||
444 | ret = bind (desc->fd, address, bind_address_len); | 434 | ret = bind (desc->fd, address, bind_address_len); |
445 | #ifdef MINGW | 435 | #ifdef MINGW |
446 | if (SOCKET_ERROR == ret) | 436 | if (SOCKET_ERROR == ret) |
@@ -449,12 +439,10 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, | |||
449 | if (ret != 0) | 439 | if (ret != 0) |
450 | return GNUNET_SYSERR; | 440 | return GNUNET_SYSERR; |
451 | #ifndef MINGW | 441 | #ifndef MINGW |
452 | #ifndef LINUX | ||
453 | desc->addr = GNUNET_malloc (address_len); | 442 | desc->addr = GNUNET_malloc (address_len); |
454 | memcpy (desc->addr, address, address_len); | 443 | memcpy (desc->addr, address, address_len); |
455 | desc->addrlen = address_len; | 444 | desc->addrlen = address_len; |
456 | #endif | 445 | #endif |
457 | #endif | ||
458 | return GNUNET_OK; | 446 | return GNUNET_OK; |
459 | } | 447 | } |
460 | 448 | ||
@@ -483,17 +471,17 @@ GNUNET_NETWORK_socket_close (struct GNUNET_NETWORK_Handle *desc) | |||
483 | #else | 471 | #else |
484 | ret = close (desc->fd); | 472 | ret = close (desc->fd); |
485 | #endif | 473 | #endif |
486 | #ifndef LINUX | ||
487 | #ifndef MINGW | 474 | #ifndef MINGW |
488 | if ((desc->af == AF_UNIX) && (NULL != desc->addr)) | 475 | if ((desc->af == AF_UNIX) && (NULL != desc->addr)) |
489 | { | 476 | { |
490 | const struct sockaddr_un *un = (const struct sockaddr_un *) desc->addr; | 477 | const struct sockaddr_un *un = (const struct sockaddr_un *) desc->addr; |
491 | 478 | ||
492 | if (0 != unlink (un->sun_path)) | 479 | if (0 != unlink (un->sun_path)) |
493 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "unlink", un->sun_path); | 480 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, |
481 | "unlink", | ||
482 | un->sun_path); | ||
494 | } | 483 | } |
495 | #endif | 484 | #endif |
496 | #endif | ||
497 | GNUNET_NETWORK_socket_free_memory_only_ (desc); | 485 | GNUNET_NETWORK_socket_free_memory_only_ (desc); |
498 | return (ret == 0) ? GNUNET_OK : GNUNET_SYSERR; | 486 | return (ret == 0) ? GNUNET_OK : GNUNET_SYSERR; |
499 | } | 487 | } |
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 | |||
6 | BINARY = gnunet-service-resolver | 6 | BINARY = gnunet-service-resolver |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-resolver.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-resolver.sock |
10 | UNIX_MATCH_UID = NO | 10 | UNIX_MATCH_UID = NO |
11 | UNIX_MATCH_GID = NO | 11 | UNIX_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 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) | |||
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, 0)) | 472 | if (GNUNET_OK != GNUNET_NETWORK_socket_bind (sock, serverAddr, socklen)) |
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 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, | |||
841 | { | 841 | { |
842 | #ifdef AF_UNIX | 842 | #ifdef AF_UNIX |
843 | struct sockaddr_un *un; | 843 | struct sockaddr_un *un; |
844 | size_t slen; | ||
845 | 844 | ||
846 | un = GNUNET_malloc (sizeof (struct sockaddr_un)); | 845 | un = GNUNET_malloc (sizeof (struct sockaddr_un)); |
847 | un->sun_family = AF_UNIX; | 846 | un->sun_family = AF_UNIX; |
848 | slen = strlen (unixpath) + 1; | 847 | strncpy (un->sun_path, unixpath, sizeof (un->sun_path) - 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 | ||
857 | #if HAVE_SOCKADDR_IN_SIN_LEN | 848 | #if HAVE_SOCKADDR_IN_SIN_LEN |
858 | un->sun_len = (u_char) slen; | 849 | un->sun_len = (u_char) sizeof (struct sockaddr_un); |
859 | #endif | 850 | #endif |
860 | *saddrs = (struct sockaddr *) un; | 851 | *saddrs = (struct sockaddr *) un; |
861 | *saddrlens = slen; | 852 | *saddrlens = sizeof (struct sockaddr_un); |
862 | #else | 853 | #else |
863 | /* this function should never be called | 854 | /* this function should never be called |
864 | * unless AF_UNIX is defined! */ | 855 | * unless AF_UNIX is defined! */ |
@@ -980,8 +971,8 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name, | |||
980 | if ((GNUNET_YES == | 971 | if ((GNUNET_YES == |
981 | GNUNET_CONFIGURATION_have_value (cfg, service_name, "UNIXPATH")) && | 972 | GNUNET_CONFIGURATION_have_value (cfg, service_name, "UNIXPATH")) && |
982 | (GNUNET_OK == | 973 | (GNUNET_OK == |
983 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", | 974 | GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, "UNIXPATH", |
984 | &unixpath)) && | 975 | &unixpath)) && |
985 | (0 < strlen (unixpath))) | 976 | (0 < strlen (unixpath))) |
986 | { | 977 | { |
987 | /* probe UNIX support */ | 978 | /* probe UNIX support */ |
@@ -996,6 +987,11 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name, | |||
996 | LOG (GNUNET_ERROR_TYPE_INFO, | 987 | LOG (GNUNET_ERROR_TYPE_INFO, |
997 | _("Using `%s' instead\n"), unixpath); | 988 | _("Using `%s' instead\n"), unixpath); |
998 | } | 989 | } |
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); | ||
999 | } | 995 | } |
1000 | if (NULL != unixpath) | 996 | if (NULL != unixpath) |
1001 | { | 997 | { |
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 () | |||
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_NETWORK_socket_bind | 68 | GNUNET_assert (GNUNET_OK == |
69 | (desc, (const struct sockaddr *) &sa, | 69 | GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa, |
70 | sizeof (sa), 0) == GNUNET_OK); | 70 | sizeof (sa))); |
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 eeb610dd1..e5c8edeeb 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), 0)) | 71 | sizeof (sa))) |
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 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 () | |||
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_NETWORK_socket_bind | 67 | GNUNET_assert (GNUNET_OK == |
68 | (desc, (const struct sockaddr *) &sa, | 68 | GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa, |
69 | sizeof (sa), 0) == GNUNET_OK); | 69 | sizeof (sa))); |
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 6608e18db..7241bbfae 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_NETWORK_socket_bind | 64 | GNUNET_assert (GNUNET_OK == |
65 | (desc, (const struct sockaddr *) &sa, | 65 | GNUNET_NETWORK_socket_bind (desc, (const struct sockaddr *) &sa, |
66 | sizeof (sa), 0) == GNUNET_OK); | 66 | sizeof (sa))); |
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 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) | |||
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); | ||
138 | struct sockaddr *sap[2]; | 137 | struct sockaddr *sap[2]; |
139 | socklen_t slens[2]; | 138 | socklen_t slens[2]; |
140 | 139 | ||
141 | memset (&un, 0, sizeof (un)); | 140 | memset (&un, 0, sizeof (un)); |
142 | un.sun_family = AF_UNIX; | 141 | un.sun_family = AF_UNIX; |
143 | memcpy (un.sun_path, unixpath, slen); | 142 | strncpy(un.sun_path, unixpath, sizeof (un.sun_path) - 1); |
144 | un.sun_path[slen] = '\0'; | ||
145 | #if HAVE_SOCKADDR_IN_SIN_LEN | 143 | #if HAVE_SOCKADDR_IN_SIN_LEN |
146 | un.sun_len = (u_char) sizeof (un); | 144 | un.sun_len = (u_char) sizeof (un); |
147 | #endif | 145 | #endif |
148 | #if LINUX | ||
149 | un.sun_path[0] = '\0'; | ||
150 | #endif | ||
151 | 146 | ||
152 | sap[0] = (struct sockaddr *) &un; | 147 | sap[0] = (struct sockaddr *) &un; |
153 | slens[0] = sizeof (un); | 148 | 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 | |||
6 | BINARY = gnunet-service-vpn | 6 | BINARY = gnunet-service-vpn |
7 | ACCEPT_FROM = 127.0.0.1; | 7 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 8 | ACCEPT_FROM6 = ::1; |
9 | UNIXPATH = /tmp/gnunet-service-vpn.sock | 9 | UNIXPATH = $SERVICEHOME/gnunet-service-vpn.sock |
10 | UNIX_MATCH_UID = YES | 10 | UNIX_MATCH_UID = YES |
11 | UNIX_MATCH_GID = YES | 11 | UNIX_MATCH_GID = YES |
12 | 12 | ||