]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/nfs4mount.c
mount.nfs4: Remove checks for idmapd and gssd running.
[nfs-utils.git] / utils / mount / nfs4mount.c
index b59c27cc319e0d27fd9fcde1dad863ee3fa3bab6..2a58d0ae08e1208479d85f0c72987022f01bd97c 100644 (file)
@@ -50,6 +50,7 @@
 #endif
 
 extern int verbose;
+extern int sloppy;
 
 char *IDMAPLCK = DEFAULT_DIR "/rpcidmapd";
 #define idmapd_check() do { \
@@ -189,9 +190,10 @@ int nfs4mount(const char *spec, const char *node, int *flags,
        static struct nfs4_mount_data data;
        static char hostdir[1024];
        static char ip_addr[16] = "127.0.0.1";
-       static struct sockaddr_in server_addr;
+       static struct sockaddr_in server_addr, client_addr;
        static int pseudoflavour[MAX_USER_FLAVOUR];
        int num_flavour = 0;
+       int ip_addr_in_opts = 0;
 
        char *hostname, *dirname, *old_opts;
        char new_opts[1024];
@@ -302,11 +304,12 @@ int nfs4mount(const char *spec, const char *node, int *flags,
                                                                opteq+1);
                                strncpy(ip_addr,opteq+1, sizeof(ip_addr));
                                ip_addr[sizeof(ip_addr)-1] = '\0';
+                               ip_addr_in_opts = 1;
                        } else if (!strcmp(opt, "sec")) {
                                num_flavour = parse_sec(opteq+1, pseudoflavour);
                                if (!num_flavour)
                                        goto fail;
-                       } else if (!strcmp(opt, "addr")) {
+                       } else if (!strcmp(opt, "addr") || sloppy) {
                                /* ignore */;
                        } else {
                                printf(_("unknown nfs mount parameter: "
@@ -333,7 +336,7 @@ int nfs4mount(const char *spec, const char *node, int *flags,
                                nocto = !val;
                        else if (!strcmp(opt, "ac"))
                                noac = !val;
-                       else {
+                       else if (!sloppy) {
                                printf(_("unknown nfs mount option: "
                                         "%s%s\n"), val ? "" : "no", opt);
                                goto fail;
@@ -349,6 +352,10 @@ int nfs4mount(const char *spec, const char *node, int *flags,
        /*
         * Give a warning if the rpc.idmapd daemon is not running
         */
+#if 0
+       /* We shouldn't have these checks as nothing in this package
+        * creates the files that are checked
+        */
        idmapd_check();
 
        if (num_flavour == 0)
@@ -359,6 +366,7 @@ int nfs4mount(const char *spec, const char *node, int *flags,
                 */
                gssd_check();
        }
+#endif
        data.auth_flavourlen = num_flavour;
        data.auth_flavours = pseudoflavour;
 
@@ -412,9 +420,19 @@ int nfs4mount(const char *spec, const char *node, int *flags,
                                NFS_PROGRAM, 4, data.proto == IPPROTO_UDP ? "udp" : "tcp", 
                                ntohs(server_addr.sin_port));
                }
-               clnt_ping(&server_addr, NFS_PROGRAM, 4, data.proto);
-               if (rpc_createerr.cf_stat == RPC_SUCCESS)
+               client_addr.sin_family = 0;
+               client_addr.sin_addr.s_addr = 0;
+               clnt_ping(&server_addr, NFS_PROGRAM, 4, data.proto, &client_addr);
+               if (rpc_createerr.cf_stat == RPC_SUCCESS) {
+                       if (!ip_addr_in_opts &&
+                           client_addr.sin_family != 0 &&
+                           client_addr.sin_addr.s_addr != 0) {
+                               snprintf(ip_addr, sizeof(ip_addr), "%s",
+                                        inet_ntoa(client_addr.sin_addr));
+                               data.client_addr.len = strlen(ip_addr);
+                       }
                        break;
+               }
 
                switch(rpc_createerr.cf_stat){
                case RPC_TIMEDOUT: