X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Frquotad%2Frquota_svc.c;h=f55c192762bf3aab0975994a05896f2f691e94cc;hp=d402f0b2f952f32a73c2e882977adac2418efc75;hb=5591654c71e7e2e5959c8718a7e880516b9081e8;hpb=8b7ad01b14df1e7529b9ba8a1ea17df0d6004ef9 diff --git a/utils/rquotad/rquota_svc.c b/utils/rquotad/rquota_svc.c index d402f0b..f55c192 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 #include #include "rquota.h" @@ -30,6 +34,7 @@ #include #include #include +#include #ifdef __STDC__ #define SIG_PF void(*)(int) @@ -59,6 +64,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, RQUOTAPROG)) { + svcerr_auth (transp, AUTH_FAILED); + return; + } +#endif + /* * Don't bother authentication for NULLPROC. */ @@ -125,6 +139,15 @@ static void rquotaprog_2(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, RQUOTAPROG)) { + svcerr_auth (transp, AUTH_FAILED); + return; + } +#endif + /* * Don't bother authentication for NULLPROC. */ @@ -190,6 +213,9 @@ int main(int argc, char **argv) openlog("rquota", LOG_PID, LOG_DAEMON); + /* WARNING: the following works on Linux and SysV, but not BSD! */ + signal(SIGCHLD, SIG_IGN); + transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { syslog(LOG_ERR, "cannot create udp service.");