Date: Fri, 10 Jan 2003 06:10:03 -0800 (PST) From: "Denis N. Peplin" <info@volginfo.ru> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/37343: portmap TCP binds strangeness Message-ID: <200301101410.h0AEA3SS037961@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/37343; it has been noted by GNATS. From: "Denis N. Peplin" <info@volginfo.ru> To: freebsd-gnats-submit@FreeBSD.org, marck@rinet.ru Cc: Subject: Re: bin/37343: portmap TCP binds strangeness Date: Fri, 10 Jan 2003 17:12:13 +0300 Yet another hack. Index: portmap.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/portmap/Attic/portmap.c,v retrieving revision 1.10.2.3 diff -u -r1.10.2.3 portmap.c --- portmap.c 6 May 2002 18:18:21 -0000 1.10.2.3 +++ portmap.c 10 Jan 2003 14:01:47 -0000 @@ -119,6 +119,7 @@ int sock, c; char **hosts = NULL; int nhosts = 0; + int nhosts2 = 0; struct sockaddr_in addr; int len = sizeof(struct sockaddr_in); register struct pmaplist *pml; @@ -165,7 +166,7 @@ hosts[0] = "0.0.0.0"; else hosts[nhosts - 1] = "127.0.0.1"; - + nhosts2 = nhosts; /* * Add UDP socket(s) - bind to specific IPs if asked to */ @@ -203,7 +204,14 @@ /* * Add TCP socket */ - addr.sin_addr.s_addr = 0; + nhosts = nhosts2; + while (nhosts > 0) { + --nhosts; + + if (!inet_aton(hosts[nhosts], &addr.sin_addr)) { + syslog(LOG_ERR, "bad IP address: %s", hosts[nhosts]); + exit(1); + } if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { syslog(LOG_ERR, "cannot create tcp socket: %m"); exit(1); @@ -216,6 +224,7 @@ == (SVCXPRT *)NULL) { syslog(LOG_ERR, "couldn't do tcp_create"); exit(1); + } } /* make an entry for ourself */ pml = (struct pmaplist *)malloc((u_int)sizeof(struct pmaplist)); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301101410.h0AEA3SS037961>