]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mountd/mount_dispatch.c
tcp_wrapper: Clean up logit()
[nfs-utils.git] / utils / mountd / mount_dispatch.c
index cee19810476d1270918934c4e2c826887a89aab6..d2802eff63eca504208c448ae3693222ffec6ea1 100644 (file)
@@ -4,7 +4,13 @@
  * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
  */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_TCP_WRAPPER
+#include "tcpwrapper.h"
+#endif
 
 #include "mountd.h"
 #include "rpcmisc.h"
@@ -64,6 +70,16 @@ mount_dispatch(struct svc_req *rqstp, SVCXPRT *transp)
 {
        union mountd_arguments  argument;
        union mountd_results    result;
+#ifdef HAVE_TCP_WRAPPER
+       struct sockaddr_in *sin = nfs_getrpccaller_in(transp);
+
+       /* remote host authorization check */
+       if (sin->sin_family == AF_INET &&
+           !check_default("mountd", sin, MOUNTPROG)) {
+               svcerr_auth (transp, AUTH_FAILED);
+               return;
+       }
+#endif
 
        rpc_dispatch(rqstp, transp, dtable, number_of(dtable),
                        &argument, &result);