diff options
| author | hjl <hjl> | 2000-08-25 23:10:40 +0000 |
|---|---|---|
| committer | hjl <hjl> | 2000-08-25 23:10:40 +0000 |
| commit | 764e46f5c5fe1a6e376f4cd350424f33afc9e838 (patch) | |
| tree | 29248c861c97d8be3f44e162b062808dca306988 /utils | |
| parent | 25f30caad17b6379a462d567b242e961082e1485 (diff) | |
| download | nfs-utils-764e46f5c5fe1a6e376f4cd350424f33afc9e838.tar.gz nfs-utils-764e46f5c5fe1a6e376f4cd350424f33afc9e838.tar.xz nfs-utils-764e46f5c5fe1a6e376f4cd350424f33afc9e838.zip | |
2000-08-25 H.J. Lu <hjl@lucon.org>
* support/include/tcpwrapper.h: New for the tcp wrapper
support.
* support/misc/Makefile: Likewise.
* support/misc/from_local.c: Likewise.
* support/misc/tcpwrapper.c: Likewise.
* aclocal.m4 (AC_TCP_WRAPPER): New.
* configure.in: Use it. Substitute LIBWRAP.
* configure: Rebuilt.
* config.mk.in (LIBNSL): New.
(LIBWRAP): Likewise.
* support/Makefile (SUBDIRS): Add misc.
* support/lib/Makefile (LIBS): Add libmisc.a.
* utils/rquotad/Makefile (LIBS): Add
-lmisc $(LIBWRAP) $(LIBNSL)
* utils/statd/Makefile (LIBS): Likewise.
* utils/rquotad/rquota_svc.c: Include "tcpwrapper.h" if
HAVE_TCP_WRAPPER is defined.
(rquotaprog_1): Call check_default () if HAVE_TCP_WRAPPER is
defined. Reject an RPC call if check_default () fails.
* utils/statd/statd.c: Include "tcpwrapper.h" if
HAVE_TCP_WRAPPER is defined.
(sm_prog_1_wrapper): New. A wrapper for sm_prog_1. Call
check_default () before calling sm_prog_1 (). Define it as
sm_prog_1_wrapper if HAVE_TCP_WRAPPER is defined.
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/rquotad/Makefile | 2 | ||||
| -rw-r--r-- | utils/rquotad/rquota_svc.c | 13 | ||||
| -rw-r--r-- | utils/statd/Makefile | 2 | ||||
| -rw-r--r-- | utils/statd/statd.c | 21 |
4 files changed, 35 insertions, 3 deletions
diff --git a/utils/rquotad/Makefile b/utils/rquotad/Makefile index 1572655..82928b6 100644 --- a/utils/rquotad/Makefile +++ b/utils/rquotad/Makefile @@ -8,6 +8,6 @@ OBJS = rquota_server.o rquota_svc.o rquota_xdr.o quotactl.o hasquota.o DEPLIBS = MAN8 = rquotad -LIBS += -lnfs $(LIBBSD) +LIBS += -lnfs -lmisc $(LIBBSD) $(LIBWRAP) $(LIBNSL) include $(TOP)rules.mk diff --git a/utils/rquotad/rquota_svc.c b/utils/rquotad/rquota_svc.c index d402f0b..81b6928 100644 --- a/utils/rquotad/rquota_svc.c +++ b/utils/rquotad/rquota_svc.c @@ -20,6 +20,10 @@ */ #include "config.h" +#ifdef HAVE_TCP_WRAPPER +#include "tcpwrapper.h" +#endif + #include <unistd.h> #include <rpc/rpc.h> #include "rquota.h" @@ -59,6 +63,15 @@ static void rquotaprog_1(struct svc_req *rqstp, register SVCXPRT *transp) xdrproc_t xdr_argument, xdr_result; char *(*local)(char *, struct svc_req *); +#ifdef HAVE_TCP_WRAPPER + /* remote host authorization check */ + if (!check_default("rquotad", svc_getcaller(transp), + rqstp->rq_proc, (u_long) 0)) { + svcerr_auth (transp, AUTH_FAILED); + return; + } +#endif + /* * Don't bother authentication for NULLPROC. */ diff --git a/utils/statd/Makefile b/utils/statd/Makefile index 3a3a794..211e22d 100644 --- a/utils/statd/Makefile +++ b/utils/statd/Makefile @@ -16,7 +16,7 @@ PROGRAM = statd PREFIX = rpc. OBJS = $(SRCS:.c=.o) CCOPTS = $(DEBUG) $(SIMUL) -LIBS = -lexport +LIBS = -lexport -lmisc $(LIBWRAP) $(LIBNSL) SRCS = $(RPCSRCS) $(SIMSRCS) \ callback.c notlist.c log.c misc.c monitor.c notify.c simu.c \ diff --git a/utils/statd/statd.c b/utils/statd/statd.c index 91cb3bc..d07a260 100644 --- a/utils/statd/statd.c +++ b/utils/statd/statd.c @@ -21,13 +21,32 @@ int _rpcpmstart = 0; /* flags for tirpc rpcgen */ int _rpcfdtype = 0; int _rpcsvcdirty = 0; -extern void sm_prog_1 (struct svc_req *, register SVCXPRT); +extern void sm_prog_1 (struct svc_req *, register SVCXPRT *); #ifdef SIMULATIONS extern void simulator (int, char **); #endif +#ifdef HAVE_TCP_WRAPPER +#include "tcpwrapper.h" + +static void +sm_prog_1_wrapper (struct svc_req *rqstp, register SVCXPRT *transp) +{ + /* remote host authorization check */ + if (!check_default("statd", svc_getcaller(transp), + rqstp->rq_proc, (u_long) 0)) { + svcerr_auth (transp, AUTH_FAILED); + return; + } + + sm_prog_1 (rqstp, transp); +} + +#define sm_prog_1 sm_prog_1_wrapper +#endif + /* * Signal handler. */ |
