summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2014-06-03 15:13:02 +0200
committerMichael Adam <obnox@samba.org>2014-06-05 23:57:10 +0200
commitf9ddd20c2d51475f82e563f26232b9944ebba799 (patch)
tree642d39e512061e04e2b2a396d9a21105f79a8539
parent8f28674b50e68e4f7815cd843088f54be3d074a4 (diff)
downloadsamba-f9ddd20c2d51475f82e563f26232b9944ebba799.tar.gz
samba-f9ddd20c2d51475f82e563f26232b9944ebba799.tar.xz
samba-f9ddd20c2d51475f82e563f26232b9944ebba799.zip
swrap: fix AF_UNSPEC special case in swrap_bind()
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r--lib/socket_wrapper/socket_wrapper.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c
index 0303b210434..b66b9510f47 100644
--- a/lib/socket_wrapper/socket_wrapper.c
+++ b/lib/socket_wrapper/socket_wrapper.c
@@ -1309,6 +1309,26 @@ static int sockaddr_convert_to_un(struct socket_info *si,
#endif
switch (in_addr->sa_family) {
+ case AF_UNSPEC: {
+ struct sockaddr_in *sin;
+ if (si->family != AF_INET) {
+ break;
+ }
+ if (in_len < sizeof(struct sockaddr_in)) {
+ break;
+ }
+ sin = (struct sockaddr_in *)in_addr;
+ if(sin->sin_addr.s_addr != htonl(INADDR_ANY)) {
+ break;
+ }
+
+ /*
+ * Note: in the special case of AF_UNSPEC and INADDR_ANY,
+ * AF_UNSPEC is mapped to AF_INET and must be treated here.
+ */
+
+ /* FALL THROUGH */
+ }
case AF_INET:
#ifdef HAVE_IPV6
case AF_INET6: