diff options
author | Nadezhda Ivanova <nadezhda.ivanova@postpath.com> | 2010-01-04 11:24:10 +0200 |
---|---|---|
committer | Nadezhda Ivanova <nadezhda.ivanova@postpath.com> | 2010-01-04 11:24:10 +0200 |
commit | fb5383c69ee52fb5e6d066a43451dc8c806cc795 (patch) | |
tree | 45b72e03f68ab6d212755c524f8e8a60a3b4373a /lib/tsocket | |
parent | 60d8ab3b7b0bd2c9b633f0380d1fdf5bcf5e2621 (diff) | |
parent | a06e5cdb99ddf7abf16486d3837105ec4e0da9ee (diff) | |
download | samba-fb5383c69ee52fb5e6d066a43451dc8c806cc795.tar.gz samba-fb5383c69ee52fb5e6d066a43451dc8c806cc795.tar.bz2 samba-fb5383c69ee52fb5e6d066a43451dc8c806cc795.zip |
Merge branch 'master' of git://git.samba.org/samba
Diffstat (limited to 'lib/tsocket')
-rw-r--r-- | lib/tsocket/tsocket_bsd.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c index 1c1e58099b..7c0255742c 100644 --- a/lib/tsocket/tsocket_bsd.c +++ b/lib/tsocket/tsocket_bsd.c @@ -210,11 +210,15 @@ int _tsocket_address_bsd_from_sockaddr(TALLOC_CTX *mem_ctx, struct tsocket_address *addr; struct tsocket_address_bsd *bsda; + if (sa_socklen < sizeof(sa->sa_family)) { + errno = EINVAL; + return -1; + } + switch (sa->sa_family) { case AF_UNIX: - if (sa_socklen < sizeof(struct sockaddr_un)) { - errno = EINVAL; - return -1; + if (sa_socklen > sizeof(struct sockaddr_un)) { + sa_socklen = sizeof(struct sockaddr_un); } break; case AF_INET: @@ -222,6 +226,7 @@ int _tsocket_address_bsd_from_sockaddr(TALLOC_CTX *mem_ctx, errno = EINVAL; return -1; } + sa_socklen = sizeof(struct sockaddr_in); break; #ifdef HAVE_IPV6 case AF_INET6: @@ -229,6 +234,7 @@ int _tsocket_address_bsd_from_sockaddr(TALLOC_CTX *mem_ctx, errno = EINVAL; return -1; } + sa_socklen = sizeof(struct sockaddr_in6); break; #endif default: |