From 6924a30bb50560c277db12522f899924e9a43b03 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 12 Sep 2006 16:25:50 +0000 Subject: r18427: set sin_port correctly on autobound socket metze (This used to be commit d373890fb26f3a593bacdb374f10d4279822b97d) --- source4/lib/socket_wrapper/socket_wrapper.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/lib') 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); -- cgit