From owner-freebsd-stable Thu Aug 30 6:18:53 2001 Delivered-To: freebsd-stable@freebsd.org Received: from shaft.techsupport.co.uk (shaft.techsupport.co.uk [212.250.77.214]) by hub.freebsd.org (Postfix) with ESMTP id 0BAF137B41C for ; Thu, 30 Aug 2001 06:18:44 -0700 (PDT) (envelope-from rasputin@shaft.techsupport.co.uk) Received: from rasputin by shaft.techsupport.co.uk with local (Exim 3.22 #1) id 15cRiM-00013e-00 for stable@freebsd.org; Thu, 30 Aug 2001 14:18:34 +0100 Date: Thu, 30 Aug 2001 14:18:34 +0100 From: Rasputin To: stable@freebsd.org Subject: Re: portmapper flags? Message-ID: <20010830141834.A4042@shaft.techsupport.co.uk> Reply-To: Rasputin References: <20010828164720.A29316@shaft.techsupport.co.uk> <20010829182507.P40625-100000@nohow.demon.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010829182507.P40625-100000@nohow.demon.co.uk>; from noway@nohow.demon.co.uk on Wed, Aug 29, 2001 at 06:31:18PM +0100 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Ok, if anyone needs it, can they try this patch out? It makes portmapper follow the manpage, i.e. it won't try to bind to UDP:127.0.0.1 twice and crash. It doesn't fix tcp yet, but the manpage doesn't say you can restrict tcp anyway, and for all I know there's a reason for that (no hablo NFS) Oh, and sorry if the code sucks. It works and compiles without bugs on this end, but I'm no code ninja. If anyone wants to a) let me know if it works for them b) laugh at it and suggest a neater/more secure way of doing it drop me a line. I'll hold back on a send-pr for a day or two. Cheers! -- Isn't it interesting that the same people who laugh at science fiction listen to weather forecasts and economists? -- Kelvin Throop III Rasputin :: Jack of All Trades - Master of Nuns :: --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="portmap.patch" --- portmap.c.orig Tue Apr 10 00:35:19 2001 +++ portmap.c Thu Aug 30 13:51:06 2001 @@ -159,12 +159,26 @@ * If no hosts were specified, just bind to INADDR_ANY. Otherwise * make sure 127.0.0.1 is added to the list. */ - ++nhosts; - hosts = realloc(hosts, nhosts * sizeof(char *)); - if (nhosts == 1) + if (nhosts == 0){ + ++nhosts; + hosts = realloc(hosts, nhosts * sizeof(char *)); hosts[0] = "0.0.0.0"; - else - hosts[nhosts - 1] = "127.0.0.1"; + } + else { + /* add localhost *if* it's not already there */ + + int n, lh_requested = 0; + + for(n=0;n