diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-21 20:20:33 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-21 20:20:33 +0100 |
commit | 647d88d649c267220feb8b5f53ec3e96359a72fc (patch) | |
tree | f0e78fbaed43f946b9e49ab42942303697584fa6 | |
parent | 0c7478479c31e75392774b17d850c4325e4ff9a8 (diff) | |
download | gnunet-647d88d649c267220feb8b5f53ec3e96359a72fc.tar.gz gnunet-647d88d649c267220feb8b5f53ec3e96359a72fc.zip |
fix sun_len issue (#4816) by adding test and fixing typo
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | src/arm/gnunet-service-arm.c | 2 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 2 | ||||
-rw-r--r-- | src/transport/plugin_transport_unix.c | 6 | ||||
-rw-r--r-- | src/util/client.c | 4 | ||||
-rw-r--r-- | src/util/connection.c | 4 | ||||
-rw-r--r-- | src/util/service.c | 2 | ||||
-rw-r--r-- | src/util/service_new.c | 2 | ||||
-rw-r--r-- | src/util/test_server_with_client_unix.c | 2 |
9 files changed, 22 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index b31d0a6c7..7f9cc2197 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1032,6 +1032,16 @@ AC_CHECK_MEMBER([struct sockaddr_in.sin_len], | |||
1032 | #include <netinet/in.h> | 1032 | #include <netinet/in.h> |
1033 | ]) | 1033 | ]) |
1034 | 1034 | ||
1035 | AC_CHECK_MEMBER([struct sockaddr_un.sun_len], | ||
1036 | [ AC_DEFINE(HAVE_SOCKADDR_UN_SUN_LEN, 1, [Do we have sockaddr_un.sun_len?]) | ||
1037 | ], | ||
1038 | [], | ||
1039 | [ | ||
1040 | #include <sys/types.h> | ||
1041 | #include <sys/socket.h> | ||
1042 | #include <sys/un.h> | ||
1043 | ]) | ||
1044 | |||
1035 | 1045 | ||
1036 | 1046 | ||
1037 | # Checks for library functions. | 1047 | # Checks for library functions. |
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 7af3659a4..4f3e964e3 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c | |||
@@ -290,7 +290,7 @@ add_unixpath (struct sockaddr **saddrs, | |||
290 | if (GNUNET_YES == abstract) | 290 | if (GNUNET_YES == abstract) |
291 | un->sun_path[0] = '\0'; | 291 | un->sun_path[0] = '\0'; |
292 | #endif | 292 | #endif |
293 | #if HAVE_SOCKADDR_IN_SIN_LEN | 293 | #if HAVE_SOCKADDR_UN_SUN_LEN |
294 | un->sun_len = (u_char) sizeof (struct sockaddr_un); | 294 | un->sun_len = (u_char) sizeof (struct sockaddr_un); |
295 | #endif | 295 | #endif |
296 | *saddrs = (struct sockaddr *) un; | 296 | *saddrs = (struct sockaddr *) un; |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 4ed5b38f7..34bbd00e0 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -549,7 +549,7 @@ add_unixpath (struct sockaddr **saddrs, | |||
549 | if (GNUNET_YES == abstract) | 549 | if (GNUNET_YES == abstract) |
550 | un->sun_path[0] = '\0'; | 550 | un->sun_path[0] = '\0'; |
551 | #endif | 551 | #endif |
552 | #if HAVE_SOCKADDR_IN_SIN_LEN | 552 | #if HAVE_SOCKADDR_UN_SUN_LEN |
553 | un->sun_len = (u_char) sizeof (struct sockaddr_un); | 553 | un->sun_len = (u_char) sizeof (struct sockaddr_un); |
554 | #endif | 554 | #endif |
555 | *saddrs = (struct sockaddr *) un; | 555 | *saddrs = (struct sockaddr *) un; |
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 49a5e89ed..6bcb7290f 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -566,7 +566,7 @@ unix_address_to_sockaddr (const char *unixpath, | |||
566 | GNUNET_memcpy (un->sun_path, unixpath, slen); | 566 | GNUNET_memcpy (un->sun_path, unixpath, slen); |
567 | un->sun_path[slen] = '\0'; | 567 | un->sun_path[slen] = '\0'; |
568 | slen = sizeof (struct sockaddr_un); | 568 | slen = sizeof (struct sockaddr_un); |
569 | #if HAVE_SOCKADDR_IN_SIN_LEN | 569 | #if HAVE_SOCKADDR_UN_SUN_LEN |
570 | un->sun_len = (u_char) slen; | 570 | un->sun_len = (u_char) slen; |
571 | #endif | 571 | #endif |
572 | (*sock_len) = slen; | 572 | (*sock_len) = slen; |
@@ -1229,7 +1229,7 @@ unix_plugin_select_read (void *cls) | |||
1229 | { | 1229 | { |
1230 | struct Plugin *plugin = cls; | 1230 | struct Plugin *plugin = cls; |
1231 | const struct GNUNET_SCHEDULER_TaskContext *tc; | 1231 | const struct GNUNET_SCHEDULER_TaskContext *tc; |
1232 | 1232 | ||
1233 | plugin->read_task = NULL; | 1233 | plugin->read_task = NULL; |
1234 | tc = GNUNET_SCHEDULER_get_task_context (); | 1234 | tc = GNUNET_SCHEDULER_get_task_context (); |
1235 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) | 1235 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) |
@@ -1252,7 +1252,7 @@ unix_plugin_select_write (void *cls) | |||
1252 | { | 1252 | { |
1253 | struct Plugin *plugin = cls; | 1253 | struct Plugin *plugin = cls; |
1254 | const struct GNUNET_SCHEDULER_TaskContext *tc; | 1254 | const struct GNUNET_SCHEDULER_TaskContext *tc; |
1255 | 1255 | ||
1256 | plugin->write_task = NULL; | 1256 | plugin->write_task = NULL; |
1257 | tc = GNUNET_SCHEDULER_get_task_context (); | 1257 | tc = GNUNET_SCHEDULER_get_task_context (); |
1258 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) | 1258 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) |
diff --git a/src/util/client.c b/src/util/client.c index 06f6ebc32..a5e04d7b2 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -491,8 +491,8 @@ try_unixpath (const char *service_name, | |||
491 | s_un.sun_path[0] = '\0'; | 491 | s_un.sun_path[0] = '\0'; |
492 | } | 492 | } |
493 | #endif | 493 | #endif |
494 | #if HAVE_SOCKADDR_IN_SIN_LEN | 494 | #if HAVE_SOCKADDR_UN_SUN_LEN |
495 | un.sun_len = (u_char) sizeof (struct sockaddr_un); | 495 | s_un.sun_len = (u_char) sizeof (struct sockaddr_un); |
496 | #endif | 496 | #endif |
497 | sock = GNUNET_NETWORK_socket_create (AF_UNIX, | 497 | sock = GNUNET_NETWORK_socket_create (AF_UNIX, |
498 | SOCK_STREAM, | 498 | SOCK_STREAM, |
diff --git a/src/util/connection.c b/src/util/connection.c index 6d3070415..02dd9f991 100644 --- a/src/util/connection.c +++ b/src/util/connection.c | |||
@@ -902,7 +902,7 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct GNUNET_CONFIGURA | |||
902 | un->sun_path[0] = '\0'; | 902 | un->sun_path[0] = '\0'; |
903 | } | 903 | } |
904 | #endif | 904 | #endif |
905 | #if HAVE_SOCKADDR_IN_SIN_LEN | 905 | #if HAVE_SOCKADDR_UN_SUN_LEN |
906 | un->sun_len = (u_char) sizeof (struct sockaddr_un); | 906 | un->sun_len = (u_char) sizeof (struct sockaddr_un); |
907 | #endif | 907 | #endif |
908 | connection = GNUNET_new (struct GNUNET_CONNECTION_Handle); | 908 | connection = GNUNET_new (struct GNUNET_CONNECTION_Handle); |
@@ -1012,7 +1012,7 @@ GNUNET_CONNECTION_create_from_sockaddr (int af_family, | |||
1012 | return NULL; | 1012 | return NULL; |
1013 | } | 1013 | } |
1014 | return GNUNET_CONNECTION_connect_socket (s, | 1014 | return GNUNET_CONNECTION_connect_socket (s, |
1015 | serv_addr, | 1015 | serv_addr, |
1016 | addrlen); | 1016 | addrlen); |
1017 | } | 1017 | } |
1018 | 1018 | ||
diff --git a/src/util/service.c b/src/util/service.c index 3beb4a085..11128425d 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -481,7 +481,7 @@ add_unixpath (struct sockaddr **saddrs, | |||
481 | if (GNUNET_YES == abstract) | 481 | if (GNUNET_YES == abstract) |
482 | un->sun_path[0] = '\0'; | 482 | un->sun_path[0] = '\0'; |
483 | #endif | 483 | #endif |
484 | #if HAVE_SOCKADDR_IN_SIN_LEN | 484 | #if HAVE_SOCKADDR_UN_SUN_LEN |
485 | un->sun_len = (u_char) sizeof (struct sockaddr_un); | 485 | un->sun_len = (u_char) sizeof (struct sockaddr_un); |
486 | #endif | 486 | #endif |
487 | *saddrs = (struct sockaddr *) un; | 487 | *saddrs = (struct sockaddr *) un; |
diff --git a/src/util/service_new.c b/src/util/service_new.c index 00d05dacc..90829c08c 100644 --- a/src/util/service_new.c +++ b/src/util/service_new.c | |||
@@ -519,7 +519,7 @@ add_unixpath (struct sockaddr **saddrs, | |||
519 | if (GNUNET_YES == abstract) | 519 | if (GNUNET_YES == abstract) |
520 | un->sun_path[0] = '\0'; | 520 | un->sun_path[0] = '\0'; |
521 | #endif | 521 | #endif |
522 | #if HAVE_SOCKADDR_IN_SIN_LEN | 522 | #if HAVE_SOCKADDR_UN_SUN_LEN |
523 | un->sun_len = (u_char) sizeof (struct sockaddr_un); | 523 | un->sun_len = (u_char) sizeof (struct sockaddr_un); |
524 | #endif | 524 | #endif |
525 | *saddrs = (struct sockaddr *) un; | 525 | *saddrs = (struct sockaddr *) un; |
diff --git a/src/util/test_server_with_client_unix.c b/src/util/test_server_with_client_unix.c index d240f1a88..8fabbe210 100644 --- a/src/util/test_server_with_client_unix.c +++ b/src/util/test_server_with_client_unix.c | |||
@@ -123,7 +123,7 @@ task (void *cls) | |||
123 | memset (&un, 0, sizeof (un)); | 123 | memset (&un, 0, sizeof (un)); |
124 | un.sun_family = AF_UNIX; | 124 | un.sun_family = AF_UNIX; |
125 | strncpy(un.sun_path, unixpath, sizeof (un.sun_path) - 1); | 125 | strncpy(un.sun_path, unixpath, sizeof (un.sun_path) - 1); |
126 | #if HAVE_SOCKADDR_IN_SIN_LEN | 126 | #if HAVE_SOCKADDR_UN_SUN_LEN |
127 | un.sun_len = (u_char) sizeof (un); | 127 | un.sun_len = (u_char) sizeof (un); |
128 | #endif | 128 | #endif |
129 | 129 | ||