summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-02 14:22:19 -0700
committerJeremy Allison <jra@samba.org>2007-11-02 14:22:19 -0700
commita45c91ec6aff3ff40462258f4527fe4a57991955 (patch)
treea9b9768a5de555492397919745094e416a8d338a
parent6665739a1634f72d0d80fb41e29133f7bc3f8f7b (diff)
downloadsamba-a45c91ec6aff3ff40462258f4527fe4a57991955.tar.gz
samba-a45c91ec6aff3ff40462258f4527fe4a57991955.tar.bz2
samba-a45c91ec6aff3ff40462258f4527fe4a57991955.zip
Ensure we use the correct socklen_t values for bind() for
Solaris. Jeremy. (This used to be commit 638579d75a2aa00836dc4c0c772381b775944b16)
-rw-r--r--source3/lib/util_sock.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index b4fda54ebd..4a73f92bd8 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1325,12 +1325,14 @@ int open_socket_in(int type,
{
struct sockaddr_storage sock;
int res;
+ socklen_t slen = sizeof(struct sockaddr_in);
sock = *psock;
#if defined(HAVE_IPV6)
if (sock.ss_family == AF_INET6) {
((struct sockaddr_in6 *)&sock)->sin6_port = htons(port);
+ slen = sizeof(struct sockaddr_in6);
}
#endif
if (sock.ss_family == AF_INET) {
@@ -1374,7 +1376,7 @@ int open_socket_in(int type,
}
/* now we've got a socket - we need to bind it */
- if( bind( res, (struct sockaddr *)&sock, sizeof(sock) ) == -1 ) {
+ if (bind(res, (struct sockaddr *)&sock, slen) == -1 ) {
if( DEBUGLVL(dlevel) && (port == SMB_PORT1 ||
port == SMB_PORT2 || port == NMB_PORT) ) {
char addr[INET6_ADDRSTRLEN];