diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-09-12 16:25:50 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:18:27 -0500 |
commit | 6924a30bb50560c277db12522f899924e9a43b03 (patch) | |
tree | 29aaae8c99cdbcfe2ec10cf8af74aed73a60e3c7 /source4/lib | |
parent | 3c096b3a9ac4980101677b5268a45e5fabfe607a (diff) | |
download | samba-6924a30bb50560c277db12522f899924e9a43b03.tar.gz samba-6924a30bb50560c277db12522f899924e9a43b03.tar.bz2 samba-6924a30bb50560c277db12522f899924e9a43b03.zip |
r18427: set sin_port correctly on autobound socket
metze
(This used to be commit d373890fb26f3a593bacdb374f10d4279822b97d)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/socket_wrapper/socket_wrapper.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source4/lib/socket_wrapper/socket_wrapper.c b/source4/lib/socket_wrapper/socket_wrapper.c index 65e7a8defd..53ccb5396d 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.c +++ b/source4/lib/socket_wrapper/socket_wrapper.c @@ -535,6 +535,7 @@ static int swrap_auto_bind(struct socket_info *si) int i; char type; int ret; + int port; struct stat st; un_addr.sun_family = AF_UNIX; @@ -552,9 +553,10 @@ static int swrap_auto_bind(struct socket_info *si) } for (i=0;i<1000;i++) { + port = 10000 + i; snprintf(un_addr.sun_path, sizeof(un_addr.sun_path), "%s/"SOCKET_FORMAT, socket_wrapper_dir(), - type, socket_wrapper_default_iface(), i + 10000); + type, socket_wrapper_default_iface(), port); if (stat(un_addr.sun_path, &st) == 0) continue; ret = real_bind(si->fd, (struct sockaddr *)&un_addr, sizeof(un_addr)); @@ -571,7 +573,7 @@ static int swrap_auto_bind(struct socket_info *si) memset(&in, 0, sizeof(in)); in.sin_family = AF_INET; - in.sin_port = htons(i); + in.sin_port = htons(port); in.sin_addr.s_addr = htonl(127<<24 | socket_wrapper_default_iface()); si->myname_len = sizeof(in); |