]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/rquotad/rquota_svc.c
2000-08-25 Ion Badulescu <ionut@cs.columbia.edu>
[nfs-utils.git] / utils / rquotad / rquota_svc.c
index 81b692845e2da0e6e39524a7238b537ce53ac085..f55c192762bf3aab0975994a05896f2f691e94cc 100644 (file)
@@ -34,6 +34,7 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <syslog.h>
+#include <signal.h>
 
 #ifdef __STDC__
 #define SIG_PF void(*)(int)
@@ -66,7 +67,7 @@ static void rquotaprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
 #ifdef HAVE_TCP_WRAPPER
    /* remote host authorization check */
    if (!check_default("rquotad", svc_getcaller(transp),
-                     rqstp->rq_proc, (u_long) 0)) {
+                     rqstp->rq_proc, RQUOTAPROG)) {
          svcerr_auth (transp, AUTH_FAILED);
          return;
    }
@@ -138,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.
     */
@@ -203,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.");