]> git.neil.brown.name Git - portmap.git/commitdiff
Remove get_myaddress
authorNeil Brown <neilb@notabene.brown>
Fri, 20 Apr 2007 02:42:29 +0000 (12:42 +1000)
committerNeil Brown <neilb@notabene.brown>
Fri, 20 Apr 2007 02:42:29 +0000 (12:42 +1000)
Just use INADDR_LOOPBACK for pmap_dump.
glibc already uses the loopback interface for pmap_set, pmap_unset.

Makefile
Makefile.shlib [deleted file]
get_myaddress.c [deleted file]
pmap_dump.c

index 7f5178797315f9da3a0e1d3912f3c118be610d1b..90e882a5c5fac9bad49cf656ceb02019cdb0895e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -116,15 +116,12 @@ pmap_set: pmap_set.c
 from_local: from_local.c
        cc $(CFLAGS) -DTEST -o $@ from_local.c
 
-get_myaddress: get_myaddress.c
-       cc $(CFLAGS) -DTEST -o $@ get_myaddress.c $(LIBS)
-
 lint:  
        lint $(COPT) $(OBJECTS:%.o=%.c)
 
 clean:
-       rm -f *.o portmap pmap_dump pmap_set from_local get_myaddress \
-           get_myaddress.so core
+       rm -f *.o portmap pmap_dump pmap_set from_local \
+           core
 
 tidy:  clean
        chmod 755 . ; chmod -R a+r .
@@ -133,7 +130,6 @@ deps:
        @$(CC) -M $(CFLAGS) *.c | grep -v /usr/include |sed 's/\.\///'
 
 from_local.o: from_local.c
-get_myaddress.o: get_myaddress.c
 pmap_check.o: pmap_check.c
 pmap_check.o: pmap_check.h Makefile
 pmap_dump.o: pmap_dump.c
diff --git a/Makefile.shlib b/Makefile.shlib
deleted file mode 100644 (file)
index 26b83b9..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# @(#) Makefile.shlib 1.1 96/07/06 23:00:53
-#
-# Warning: don't do this unless you are really desperate!!
-#
-# Makefile to build a shared object that forces RPC servers to register
-# and unregister with the portmapper through the loopback interface
-# instead of via the primary network interface address.
-#
-# This is a desperate attempt to prevent an attacker from using source
-# address spoofing to manipulate your portmapper tables. For this to be
-# effective you need to build the portmapper with -DLOOPBACK_SETUNSET,
-# and you need to disable IP source routing in the UNIX kernel.
-#
-# Quick summary of what to do to trick your rpc servers into cooperation:
-#
-# 1 - In the text below, uncomment the SH_CC and SH_LD definitions that are
-# appropriate for your environment. Then type:
-#
-#      make -f Makefile.shcc
-#
-# 2 - Install the get_myaddress.so shared object in a suitable place, for
-# example in the /usr/local/lib directory.
-#
-# 3 - Edit your system startup files so that the rpc servers use the
-# get_myaddress.so shared object. For several environments, the text below
-# gives an example in bourne-shell syntax of how how to start an rpc server.
-
-# SunOS 4
-# /bin/sh syntax: LD_PRELOAD=/some/where/get_myaddress.so rpcserver...
-SH_CC  = cc -pic
-SH_LD  = ld -assert pure-text
-
-# NetBSD, FreeBSD
-# /bin/sh syntax: LD_PRELOAD=/some/where/get_myaddress.so rpcserver...
-#SH_CC = cc -fpic
-#SH_LD = ld -Bshareable        
-
-# Digital UNIX
-# /bin/sh syntax: _RLD_LIST=/some/where/get_myaddress.so:DEFAULT rpcserver...
-#SH_CC = cc -pic
-#SH_LD = ld -shared
-
-# Build the shared object
-get_myaddress.so: get_myaddress.c
-       $(SH_CC) -c get_myaddress.c
-       $(SH_LD) -o get_myaddress.so get_myaddress.o
diff --git a/get_myaddress.c b/get_myaddress.c
deleted file mode 100644 (file)
index ef5dcf5..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
- /*
-  * get_myaddress - alternative version that picks the loopback interface.
-  * 
-  * Author: Wietse Venema (wietse@wzv.win.tue.nl), dept. of Mathematics and
-  * Computing Science, Eindhoven University of Technology, The Netherlands.
-  */
-
-#ifndef lint
-static char sccsid[] = "@(#) get_myaddress.c 1.1 23:00:53";
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-
-#ifndef INADDR_LOOPBACK
-#define INADDR_LOOPBACK ntohl(inet_addr("127.0.0.1"))
-#endif
-
-void    get_myaddress(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);
-}
-
-#ifdef TEST
-
-#include <stdio.h>
-
-main(argc, argv)
-int     argc;
-char  **argv;
-{
-    struct sockaddr_in addr;
-
-    get_myaddress(&addr);
-    printf("%s\n", inet_ntoa(addr.sin_addr));
-    exit(0);
-}
-
-#endif
index fc2b7cad9b54c25abe8645455560e3c547c9758f..968bf7e0c98d10fe3a16e52082256df35b39911e 100644 (file)
@@ -31,7 +31,10 @@ main(int argc, char **argv)
     register struct pmaplist *list;
     register struct rpcent *rpc;
 
-    get_myaddress(&addr);
+    memset(&addr, 0, sizeof(addr));
+    addr.sin_family = AF_INET;
+    addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+    addr.sin_port = htons(PMAPPORT);
 
     for (list = pmap_getmaps(&addr); list; list = list->pml_next) {
        rpc = getrpcbynumber((int) list->pml_map.pm_prog);