--- portmap-5.orig/Makefile +++ portmap-5/Makefile @@ -8,7 +8,7 @@ # if you disagree. See `man 3 syslog' for examples. Some syslog versions # do not provide this flexibility. # -FACILITY=LOG_MAIL +FACILITY=LOG_DAEMON # To disable tcp-wrapper style access control, comment out the following # macro definitions. Access control can also be turned off by providing @@ -16,7 +16,8 @@ # daemon, is always treated as an authorized host. HOSTS_ACCESS= -DHOSTS_ACCESS -WRAP_LIB = $(WRAP_DIR)/libwrap.a +#WRAP_LIB = $(WRAP_DIR)/libwrap.a +WRAP_LIB = -lwrap # Comment out if your RPC library does not allocate privileged ports for # requests from processes with root privilege, or the new portmap will @@ -71,7 +72,7 @@ # With verbose logging on, HP-UX 9.x and AIX 4.1 leave zombies behind when # SIGCHLD is not ignored. Enable next macro for a fix. # -# ZOMBIES = -DIGNORE_SIGCHLD # AIX 4.x, HP-UX 9.x +ZOMBIES = -DIGNORE_SIGCHLD # AIX 4.x, HP-UX 9.x # Uncomment the following macro if your system does not have u_long. # @@ -81,11 +82,14 @@ # libwrap.a object library. WRAP_DIR should specify the directory with # that library. -WRAP_DIR= ../tcp_wrappers +WRAP_DIR= $(TCPD_DIR) # Auxiliary object files that may be missing from your C library. # -AUX = daemon.o strerror.o +#AUX = daemon.o strerror.o + +# glibc has strerror() (it's POSIX) and daemon() (when compiling -D_BSD_SOURCE) +AUX = # NEXTSTEP is a little different. The following seems to work with NS 3.2 # @@ -99,22 +103,31 @@ # Comment out if your compiler talks ANSI and understands const # -CONST = -Dconst= +#CONST = -Dconst= ### End of configurable stuff. ############################## +GLIBC=$(shell grep -s -c __GLIBC__ /usr/include/features.h) + +ifeq ($(GLIBC),0) +LIBS += # -lbsd +else +LIBS += -lnsl +endif + + SHELL = /bin/sh -COPT = $(CONST) -Dperror=xperror $(HOSTS_ACCESS) $(CHECK_PORT) \ +COPT = $(CONST) $(HOSTS_ACCESS) $(CHECK_PORT) \ $(SYS) -DFACILITY=$(FACILITY) $(ULONG) $(ZOMBIES) $(SA_LEN) \ $(LOOPBACK) $(SETPGRP) -CFLAGS = $(COPT) -O $(NSARCHS) +CFLAGS = -Wall $(COPT) -O2 $(NSARCHS) OBJECTS = portmap.o pmap_check.o from_local.o $(AUX) all: portmap pmap_dump pmap_set -portmap: $(OBJECTS) $(WRAP_DIR)/libwrap.a +portmap: $(OBJECTS) # $(WRAP_DIR)/libwrap.a $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(WRAP_LIB) $(LIBS) pmap_dump: pmap_dump.c @@ -129,6 +142,17 @@ get_myaddress: get_myaddress.c cc $(CFLAGS) -DTEST -o $@ get_myaddress.c $(LIBS) +install: all + install -o root -g root -m 0755 -s portmap ${BASEDIR}/sbin + install -o root -g root -m 0755 -s pmap_dump ${BASEDIR}/sbin + install -o root -g root -m 0755 -s pmap_set ${BASEDIR}/sbin + install -o root -g root -m 0644 portmap.8 ${BASEDIR}/usr/share/man/man8 + install -o root -g root -m 0644 pmap_dump.8 ${BASEDIR}/usr/share/man/man8 + install -o root -g root -m 0644 pmap_set.8 ${BASEDIR}/usr/share/man/man8 + cat README BLURB >${BASEDIR}/usr/share/doc/portmap/portmapper.txt + gzip -9f ${BASEDIR}/usr/share/doc/portmap/portmapper.txt + + lint: lint $(COPT) $(OBJECTS:%.o=%.c) --- portmap-5.orig/BLURB +++ portmap-5/BLURB @@ -1,3 +1,6 @@ + +############################################################################### + @(#) BLURB 1.5 96/07/06 23:09:45 This is the fifth replacement portmapper release. --- portmap-5.orig/pmap_set.8 +++ portmap-5/pmap_set.8 @@ -0,0 +1,24 @@ +.TH PMAP_SET 8 "21th June 1997" Linux "Linux Programmer's Manual" +.SH NAME +pmap_set \- set the list of registered RPC programs +.SH SYNOPSIS +.B pmap_set +.SH DESCRIPTION +The +.B pmap_set +command can be used to restart a running portmapper or to set +the list of registered RPC programs on the local host. If you +want to use the program to restart the portmapper you have to +redirect the output of +.B pmap_dump +to a file. After this you can restart the portmapper and restore +the list of the registered RPC programs by feeding the output +of +.B pmap_dump +to the +.B pmap_set +command. +.SH SEE ALSO +.BR pmap_dump (8), +.BR rpc.portmap (8) + --- portmap-5.orig/pmap_set.c +++ portmap-5/pmap_set.c @@ -47,9 +47,9 @@ int *prot; unsigned *port; { - char proto_name[BUFSIZ]; + char proto_name[256]; - if (sscanf(buf, "%lu %lu %s %u", prog, vers, proto_name, port) != 4) { + if (sscanf(buf, "%lu %lu %255s %u", prog, vers, proto_name, port) != 4) { return (0); } if (strcmp(proto_name, "tcp") == 0) { --- portmap-5.orig/debian/dirs +++ portmap-5/debian/dirs @@ -0,0 +1,4 @@ +bin +sbin +usr/share/man/man8 +usr/share/doc/portmap --- portmap-5.orig/debian/docs +++ portmap-5/debian/docs @@ -0,0 +1 @@ +README --- portmap-5.orig/debian/control +++ portmap-5/debian/control @@ -0,0 +1,17 @@ +Source: portmap +Section: net +Priority: standard +Maintainer: Anthony Towns +Standards-Version: 3.1.1 +Build-Depends: libwrap-dev, debhelper + +Package: portmap +Architecture: any +Depends: ${shlibs:Depends} +Replaces: netbase (<< 4.00) +Description: The RPC portmapper + Portmap is a server that converts RPC (Remote Procedure Call) program + numbers into DARPA protocol port numbers. It must be running in order + to make RPC calls. + . + Services that use RPC include NFS and NIS. --- portmap-5.orig/debian/prerm +++ portmap-5/debian/prerm @@ -0,0 +1,8 @@ +#!/bin/sh -e + +if [ "$1" = "upgrade" ]; then + # save portmap state; will be reread when portmap start is run + pmap_dump >/var/run/portmap.upgrade-state +fi + +##DEBHELPER## --- portmap-5.orig/debian/rules +++ portmap-5/debian/rules @@ -0,0 +1,83 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This is the debhelper compatability version to use. +export DH_COMPAT=1 + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + + touch configure-stamp + +build: configure-stamp build-stamp +build-stamp: + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #/usr/bin/docbook-to-man debian/portmap.sgml > portmap.1 + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/tmp. + $(MAKE) install BASEDIR=`pwd`/debian/tmp + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install +# dh_testversion + dh_testdir + dh_testroot +# dh_installdebconf + dh_installdocs + dh_installexamples + dh_installmenu +# dh_installemacsen +# dh_installpam + dh_installinit -- start 41 S . start 10 0 6 . + dh_installcron + dh_installmanpages + dh_installinfo +# dh_undocumented + dh_installchangelogs CHANGES + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- portmap-5.orig/debian/conffiles +++ portmap-5/debian/conffiles @@ -0,0 +1 @@ +/etc/init.d/portmap --- portmap-5.orig/debian/changelog +++ portmap-5/debian/changelog @@ -0,0 +1,33 @@ +portmap (5-2.1) unstable; urgency=low + + * NMU + * [pmap_check.c] Drop group privileges as well. (Closes: #58864) + * [portmap.c] Corrected error message for failure to bind with tcp. + (Closes: #61876) + * [portmap.c, Makefile] Use glibc's strerror() and daemon(). (Closes: #106380) + * [portmap.c] Don't declare extern int errno but #include so as + not to reference the deprecated errno@GLIBC_2.0 symbol. (Closes: #168530) + * New upload, built using newer binutils which should fix the prelinking + issue on powerpc. (Closes: #176352) + * [debian/copyright] Updated the upstream location. (Closes: #181807) + * [debian/rules] Removed obsolete dh_suidregister. + + -- J.H.M. Dassen (Ray) Sat, 13 Sep 2003 17:08:22 +0200 + +portmap (5-2) unstable; urgency=low + + * Fix from_local.c to declare some functions it uses correctly. Thanks + to Bdale Garbee. (Closes: Bug#90090) + * Add -Wall to CFLAGS, and fix most of the warnings it comes up with. + + -- Anthony Towns Sun, 18 Mar 2001 19:04:25 +1000 + +portmap (5-1) unstable; urgency=low + + * Initial Release. + + -- Anthony Towns Sat, 5 Aug 2000 22:08:49 +1000 + +Local variables: +mode: debian-changelog +End: --- portmap-5.orig/debian/init.d +++ portmap-5/debian/init.d @@ -0,0 +1,50 @@ +#!/bin/sh +# +# start/stop portmap daemon. + +test -f /sbin/portmap || exit 0 + +case "$1" in + start) + echo -n "Starting portmap daemon:" + echo -n " portmap" + start-stop-daemon --start --quiet --exec /sbin/portmap + echo "." + + if [ -f /var/run/portmap.upgrade-state ]; then + echo -n "Restoring old RPC service information..." + sleep 1 # needs a short pause or pmap_set won't work. :( + pmap_set /var/run/portmap.state + $0 stop + $0 start + if [ ! -f /var/run/portmap.upgrade-state ]; then + sleep 1 + pmap_set on +Sat, 5 Aug 2000 22:08:49 +1000. + +Upstream location: ftp://ftp.porcupine.org/pub/security/ + +Upstream Author: Wietse Venema + +Copyright: + +Most of the files, fall under the following copyright, and are distributable +under the terms of the BSD license (/usr/share/common-licenses/BSD): + + * Copyright (c) 1983,1991 The Regents of the University of California. + * All rights reserved. + +Some of the RPC code, is copyrighted by Sun Microsystems, and is provided +under the following terms: + + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user or with the express written consent of + * Sun Microsystems, Inc. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + --- portmap-5.orig/pmap_check.c +++ portmap-5/pmap_check.c @@ -41,10 +41,14 @@ #include #include #include +#include #ifdef SYSV40 #include #include #endif +#include +#include +#include extern char *inet_ntoa(); @@ -101,10 +105,16 @@ * Give up root privileges so that we can never allocate a privileged * port when forwarding an rpc request. */ + if (setgid(1) == -1) { + syslog(LOG_ERR, "setgid(1) failed: %m"); + exit(1); + } if (setuid(1) == -1) { syslog(LOG_ERR, "setuid(1) failed: %m"); exit(1); } + initgroups("daemon", 1); + (void) signal(SIGINT, toggle_verboselog); } --- portmap-5.orig/portmap.8 +++ portmap-5/portmap.8 @@ -0,0 +1,146 @@ +.\" Copyright (c) 1987 Sun Microsystems +.\" Copyright (c) 1990, 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" from: @(#)portmap.8 5.3 (Berkeley) 3/16/91 +.\" $Id: portmap.8,v 1.2 1993/08/01 07:24:03 mycroft Exp $ +.\" +.Dd March 16, 1991 +.Dt PORTMAP 8 +.Os BSD 4.3 +.Sh NAME +.Nm portmap +.Nd +.Tn DARPA +port to +.Tn RPC +program number mapper +.Sh SYNOPSIS +.Nm portmap +.Op Fl d +.Op Fl v +.Sh DESCRIPTION +.Nm Portmap +is a server that converts +.Tn RPC +program numbers into +.Tn DARPA +protocol port numbers. +It must be running in order to make +.Tn RPC +calls. +.Pp +When an +.Tn RPC +server is started, it will tell +.Nm portmap +what port number it is listening to, and what +.Tn RPC +program numbers it is prepared to serve. +When a client wishes to make an +.Tn RPC +call to a given program number, +it will first contact +.Nm portmap +on the server machine to determine +the port number where +.Tn RPC +packets should be sent. +.Pp +.Nm Portmap +must be started before any +.Tn RPC +servers are invoked. +.Pp +Normally +.Nm portmap +forks and dissociates itself from the terminal +like any other daemon. +.Nm Portmap +then logs errors using +.Xr syslog 3 . +.Pp +Option available: +.Bl -tag -width Ds +.It Fl d +(debug) prevents +.Nm portmap +from running as a daemon, +and causes errors and debugging information +to be printed to the standard error output. +.It Fl v +(verbose) run +.Nm portmap +in verbose mode. +.El + +This +.Nm portmap +version is protected by the +.Nm tcp_wrapper +library. You have to give the clients access to +.Nm portmap +if they should be allowed to use it. To allow connects from clients of +the .bar.com domain you could use the following line in /etc/hosts.allow: + +portmap: .bar.com + +You have to use the daemon name +.Nm portmap +for the daemon name (even if the binary has a different name). For the +client names you can only use the keyword ALL or IP addresses (NOT +host or domain names). + +For further information please have a look at the +.Xr tcpd 8 , +.Xr hosts_allow 5 +and +.Xr hosts_access 5 +manual pages. + +.Sh SEE ALSO +.Xr inetd.conf 5 , +.Xr rpcinfo 8 , +.Xr pmap_set 8 , +.Xr pmap_dump 8 , +.Xr inetd 8 +.Xr tcpd 8 +.Xr hosts_access 5 +.Xr hosts_options 5 +.Sh BUGS +If +.Nm portmap +crashes, all servers must be restarted. +.Sh HISTORY +The +.Nm +command appeared in +.Bx 4.3 --- portmap-5.orig/portmap.c +++ portmap-5/portmap.c @@ -80,6 +80,10 @@ * Mountain View, California 94043 */ +#if defined(__GLIBC__) +#define _BSD_SOURCE 1 /* for daemon(3) */ +#include +#endif /* __GLIBC__ */ #include #include #include @@ -94,8 +98,11 @@ #ifdef SYSV40 #include #endif +#include +#include +#include +#include -extern char *strerror(); #include #ifndef LOG_PERROR @@ -124,7 +131,6 @@ static void callit(); struct pmaplist *pmaplist; int debugging = 0; -extern int errno; #include "pmap_check.h" @@ -227,7 +233,7 @@ setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on); #endif if (bind(sock, (struct sockaddr *)&addr, len) != 0) { - syslog(LOG_ERR, "cannot bind udp: %m"); + syslog(LOG_ERR, "cannot bind tcp: %m"); exit(1); } if ((xprt = svctcp_create(sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE)) @@ -350,7 +356,7 @@ */ /* remote host authorization check */ check_default(svc_getcaller(xprt), rqstp->rq_proc, (u_long) 0); - if (!svc_sendreply(xprt, xdr_void, (caddr_t)0) && debugging) { + if (!svc_sendreply(xprt, (xdrproc_t) xdr_void, (caddr_t)0) && debugging) { abort(); } break; @@ -359,7 +365,7 @@ /* * Set a program,version to port mapping */ - if (!svc_getargs(xprt, xdr_pmap, ®)) + if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (caddr_t) ®)) svcerr_decode(xprt); else { /* reject non-local requests, protect priv. ports */ @@ -401,7 +407,7 @@ ans = 1; } done: - if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&ans)) && + if ((!svc_sendreply(xprt, (xdrproc_t) xdr_int, (caddr_t)&ans)) && debugging) { (void) fprintf(stderr, "svc_sendreply\n"); abort(); @@ -413,7 +419,7 @@ /* * Remove a program,version to port mapping. */ - if (!svc_getargs(xprt, xdr_pmap, ®)) + if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (caddr_t) ®)) svcerr_decode(xprt); else { ans = 0; @@ -447,7 +453,7 @@ prevpml->pml_next = pml; free(t); } - if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&ans)) && + if ((!svc_sendreply(xprt, (xdrproc_t) xdr_int, (caddr_t)&ans)) && debugging) { (void) fprintf(stderr, "svc_sendreply\n"); abort(); @@ -459,7 +465,7 @@ /* * Lookup the mapping for a program,version and return its port */ - if (!svc_getargs(xprt, xdr_pmap, ®)) + if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (caddr_t) ®)) svcerr_decode(xprt); else { /* remote host authorization check */ @@ -474,7 +480,7 @@ port = fnd->pml_map.pm_port; else port = 0; - if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&port)) && + if ((!svc_sendreply(xprt, (xdrproc_t) xdr_int, (caddr_t)&port)) && debugging) { (void) fprintf(stderr, "svc_sendreply\n"); abort(); @@ -486,7 +492,7 @@ /* * Return the current set of mapped program,version */ - if (!svc_getargs(xprt, xdr_void, NULL)) + if (!svc_getargs(xprt, (xdrproc_t) xdr_void, (caddr_t) NULL)) svcerr_decode(xprt); else { /* remote host authorization check */ @@ -497,7 +503,7 @@ } else { p = pmaplist; } - if ((!svc_sendreply(xprt, xdr_pmaplist, + if ((!svc_sendreply(xprt, (xdrproc_t) xdr_pmaplist, (caddr_t)&p)) && debugging) { (void) fprintf(stderr, "svc_sendreply\n"); abort(); @@ -645,7 +651,7 @@ timeout.tv_sec = 5; timeout.tv_usec = 0; a.rmt_args.args = buf; - if (!svc_getargs(xprt, xdr_rmtcall_args, &a)) + if (!svc_getargs(xprt, (xdrproc_t) xdr_rmtcall_args, (caddr_t) &a)) return; /* host and service access control */ if (!check_callit(svc_getcaller(xprt), @@ -674,9 +680,9 @@ au->aup_uid, au->aup_gid, au->aup_len, au->aup_gids); } a.rmt_port = (u_long)port; - if (clnt_call(client, a.rmt_proc, xdr_opaque_parms, &a, - xdr_len_opaque_parms, &a, timeout) == RPC_SUCCESS) { - svc_sendreply(xprt, xdr_rmtcall_result, (caddr_t)&a); + if (clnt_call(client, a.rmt_proc, (xdrproc_t) xdr_opaque_parms, (char*) &a, + (xdrproc_t) xdr_len_opaque_parms, (char*) &a, timeout) == RPC_SUCCESS) { + svc_sendreply(xprt, (xdrproc_t) xdr_rmtcall_result, (caddr_t)&a); } AUTH_DESTROY(client->cl_auth); clnt_destroy(client); --- portmap-5.orig/from_local.c +++ portmap-5/from_local.c @@ -51,6 +51,9 @@ #include #include #include +#include +#include +#include #ifndef TRUE #define TRUE 1 --- portmap-5.orig/pmap_dump.8 +++ portmap-5/pmap_dump.8 @@ -0,0 +1,24 @@ +.TH PMAP_DUMP 8 "21th June 1997" Linux "Linux Programmer's Manual" +.SH NAME +pmap_dump \- print a list of all registered RPC programs +.SH SYNOPSIS +.B pmap_dump +.SH DESCRIPTION +The +.B pmap_dump +command can be used to restart a running portmapper or to print +a list of all registered RPC programs on the local host. If you +want to use the program to restart the portmapper you have to +redirect the output of +.B pmap_dump +to a file. After this you can restart the portmapper and restore +the list of the registered RPC programs by feeding the output +of +.B pmap_dump +to the +.B pmap_set +command. +.SH SEE ALSO +.BR pmap_set (8), +.BR rpc.portmap (8) + --- portmap-5.orig/pmap_dump.c +++ portmap-5/pmap_dump.c @@ -23,6 +23,19 @@ static char *protoname(); +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK ntohl(inet_addr("127.0.0.1")) +#endif + +static void get_myloopaddress(addrp) +struct sockaddr_in *addrp; +{ + memset((char *) addrp, 0, sizeof(*addrp)); + addrp->sin_family = AF_INET; + addrp->sin_port = htons(PMAPPORT); + addrp->sin_addr.s_addr = htonl(INADDR_LOOPBACK); +} + main(argc, argv) int argc; char **argv; @@ -31,7 +44,7 @@ register struct pmaplist *list; register struct rpcent *rpc; - get_myaddress(&addr); + get_myloopaddress(&addr); for (list = pmap_getmaps(&addr); list; list = list->pml_next) { rpc = getrpcbynumber((int) list->pml_map.pm_prog); --- portmap-5.orig/daemon.c +++ portmap-5/daemon.c @@ -36,11 +36,8 @@ #endif /* LIBC_SCCS and not lint */ #include - -/* From unistd.h */ -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 +#include +#include /* From paths.h */ #define _PATH_DEVNULL "/dev/null"