(GNUNET_YES != (aret = access (access_cls, gcp, uaddr, addrlen))))
{
if (GNUNET_NO == aret)
- LOG (GNUNET_ERROR_TYPE_INFO, _("Access denied to `%s'\n"),
+ LOG (GNUNET_ERROR_TYPE_INFO,
+ _("Access denied to `%s'\n"),
GNUNET_a2s (uaddr, addrlen));
GNUNET_break (GNUNET_OK ==
GNUNET_NETWORK_socket_shutdown (sock, SHUT_RDWR));
#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);
-#if HAVE_SOCKADDR_IN_SIN_LEN
- un->sun_len = (u_char) slen;
+ strncpy (un->sun_path, unixpath, sizeof (un->sun_path) - 1);
+#ifdef LINUX
+ {
+ int abstract;
+
+ abstract = GNUNET_CONFIGURATION_get_value_yesno (cfg, "TESTING",
+ "USE_ABSTRACT_SOCKETS");
+ if (GNUNET_YES == abstract)
+ un->sun_path[0] = '\0';
+ }
#endif
-#if LINUX
- un->sun_path[0] = '\0';
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ un->sun_len = (u_char) sizeof (struct sockaddr_un);
#endif
connection = GNUNET_new (struct GNUNET_CONNECTION_Handle);
connection->cfg = cfg;
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)
{