X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fnfsmount.c;h=eac9590f5610d836045fcb2aeaf60e54f86804d7;hp=f21c81c4a583c077facab4c4b105b0ed84f00c65;hb=f12ed63e95dec929d6893b16983233d2940a889c;hpb=e6e19816da66cde1cc4fd062c898ce66a9b4e336 diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c index f21c81c..eac9590 100644 --- a/utils/mount/nfsmount.c +++ b/utils/mount/nfsmount.c @@ -104,6 +104,7 @@ typedef union { static char errbuf[BUFSIZ]; static char *erreob = &errbuf[BUFSIZ]; extern int verbose; +extern int sloppy; /* Convert RPC errors into strings */ int rpc_strerror(int); @@ -606,13 +607,17 @@ parse_options(char *old_opts, struct nfs_mount_data *data, } else if (!strcmp(opt, "namlen")) { if (nfs_mount_version >= 2) data->namlen = val; + else if (sloppy) + continue; else goto bad_parameter; #endif } else if (!strcmp(opt, "addr")) { /* ignore */; continue; - } else + } else if (sloppy) + continue; + else goto bad_parameter; sprintf(cbuf, "%s=%s,", opt, opteq+1); } else if (opteq) { @@ -629,7 +634,9 @@ parse_options(char *old_opts, struct nfs_mount_data *data, mnt_pmap->pm_prot = IPPROTO_TCP; data->flags |= NFS_MOUNT_TCP; #endif - } else + } else if (sloppy) + continue; + else goto bad_parameter; #if NFS_MOUNT_VERSION >= 5 } else if (!strcmp(opt, "sec")) { @@ -660,6 +667,8 @@ parse_options(char *old_opts, struct nfs_mount_data *data, data->pseudoflavor = AUTH_GSS_SPKMI; else if (!strcmp(secflavor, "spkm3p")) data->pseudoflavor = AUTH_GSS_SPKMP; + else if (sloppy) + continue; else { printf(_("Warning: Unrecognized security flavor %s.\n"), secflavor); @@ -679,7 +688,9 @@ parse_options(char *old_opts, struct nfs_mount_data *data, goto bad_parameter; } strncpy(data->context, context, NFS_MAX_CONTEXT_LEN); - } else + } else if (sloppy) + continue; + else goto bad_parameter; sprintf(cbuf, "%s=%s,", opt, opteq+1); } else { @@ -766,6 +777,8 @@ parse_options(char *old_opts, struct nfs_mount_data *data, #endif } else { bad_option: + if (sloppy) + continue; printf(_("Unsupported nfs mount option: " "%s%s\n"), val ? "" : "no", opt); goto out_bad; @@ -817,8 +830,8 @@ nfsmnt_check_compat(const struct pmap *nfs_pmap, const struct pmap *mnt_pmap) int nfsmount(const char *spec, const char *node, int *flags, - char **extra_opts, char **mount_opts, int *nfs_mount_vers, - int running_bg) + char **extra_opts, char **mount_opts, + int running_bg, int *need_statd) { static char *prev_bg_host; char hostdir[1024]; @@ -847,11 +860,7 @@ nfsmount(const char *spec, const char *node, int *flags, time_t prevt; time_t timeout; - /* The version to try is either specified or 0 - In case it is 0 we tell the caller what we tried */ - if (!*nfs_mount_vers) - *nfs_mount_vers = find_kernel_nfs_mount_version(); - nfs_mount_version = *nfs_mount_vers; + nfs_mount_version = find_kernel_nfs_mount_version(); if (strlen(spec) >= sizeof(hostdir)) { fprintf(stderr, _("mount: " @@ -902,7 +911,6 @@ nfsmount(const char *spec, const char *node, int *flags, #if NFS_MOUNT_VERSION >= 2 data.namlen = NAME_MAX; #endif - data.pseudoflavor = AUTH_SYS; bg = 0; retry = 10000; /* 10000 minutes ~ 1 week */ @@ -1090,6 +1098,15 @@ nfsmount(const char *spec, const char *node, int *flags, flavor = mountres->auth_flavors.auth_flavors_val; while (--i >= 0) { + /* If no flavour requested, use first simple + * flavour that is offered. + */ + if (! (data.flags & NFS_MOUNT_SECFLAVOUR) && + (flavor[i] == AUTH_SYS || + flavor[i] == AUTH_NONE)) { + data.pseudoflavor = flavor[i]; + data.flags |= NFS_MOUNT_SECFLAVOUR; + } if (flavor[i] == data.pseudoflavor) yum = 1; #ifdef NFS_MOUNT_DEBUG @@ -1102,7 +1119,7 @@ nfsmount(const char *spec, const char *node, int *flags, "mount: %s:%s failed, " "security flavor not supported\n", hostname, dirname); - /* server has registered us in mtab, send umount */ + /* server has registered us in rmtab, send umount */ nfs_call_umount(&mnt_server, &dirname); goto fail; } @@ -1177,6 +1194,7 @@ noauth_flavors: strcat(new_opts, cbuf); *extra_opts = xstrdup(new_opts); + *need_statd = ! (data.flags & NFS_MOUNT_NONLM); return 0; /* abort */