X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=support%2Fnfs%2Fexports.c;h=f1ca6329af5769241f363ed84a366737b9495c06;hb=f783ec6a999e424054ccab773e7c6ba6b38eb1fe;hp=6b567081123edee90f976fd508847df6381ff4c6;hpb=4c337e2131123c339bc4921779b57b69b77be2fd;p=nfs-utils.git diff --git a/support/nfs/exports.c b/support/nfs/exports.c index 6b56708..f1ca632 100644 --- a/support/nfs/exports.c +++ b/support/nfs/exports.c @@ -127,8 +127,6 @@ getexportent(int fromkernel, int fromexports) if (ok <= 0) return NULL; - strncpy (def_ee.m_path, def_ee.e_path, sizeof (def_ee.m_path) - 1); - def_ee.m_path [sizeof (def_ee.m_path) - 1] = '\0'; ok = getexport(exp, sizeof(exp)); } if (ok < 0) { @@ -187,8 +185,6 @@ getexportent(int fromkernel, int fromexports) rpath[sizeof (rpath) - 1] = '\0'; strncpy(ee.e_path, rpath, sizeof (ee.e_path) - 1); ee.e_path[sizeof (ee.e_path) - 1] = '\0'; - strncpy (ee.m_path, ee.e_path, sizeof (ee.m_path) - 1); - ee.m_path [sizeof (ee.m_path) - 1] = '\0'; } return ⅇ @@ -360,8 +356,6 @@ mkexportent(char *hname, char *path, char *options) } strncpy(ee.e_path, path, sizeof (ee.e_path)); ee.e_path[sizeof (ee.e_path) - 1] = '\0'; - strncpy (ee.m_path, ee.e_path, sizeof (ee.m_path) - 1); - ee.m_path [sizeof (ee.m_path) - 1] = '\0'; if (parseopts(options, &ee, 0, NULL) < 0) return NULL; return ⅇ @@ -476,6 +470,18 @@ static void clearflags(int mask, unsigned int active, struct exportent *ep) /* options that can vary per flavor: */ #define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ | NFSEXP_ALLSQUASH) +/* + * For those flags which are not allowed to vary by pseudoflavor, + * ensure that the export flags agree with the flags on each + * pseudoflavor: + */ +static void fix_pseudoflavor_flags(struct exportent *ep) +{ + struct sec_entry *p; + + for (p = ep->e_secinfo; p->flav; p++) + p->flags |= ep->e_flags & ~NFSEXP_SECINFO_FLAGS; +} /* * Parse option string pointed to by cp and set mount options accordingly. @@ -483,7 +489,6 @@ static void clearflags(int mask, unsigned int active, struct exportent *ep) static int parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr) { - struct sec_entry *p; int had_subtree_opt = 0; char *flname = efname?efname:"command line"; int flline = efp?efp->x_line:0; @@ -595,7 +600,7 @@ bad_option: if (opt[5]!='\0' && *oe == '\0') ep->e_flags |= NFSEXP_FSID; else if (valid_uuid(opt+5)) - ep->e_uuid = strdup(opt+7); + ep->e_uuid = strdup(opt+5); else { xlog(L_ERROR, "%s: %d: bad fsid \"%s\"\n", flname, flline, opt); @@ -641,9 +646,13 @@ bad_option: while (isblank(*cp)) cp++; } - - for (p = ep->e_secinfo; p->flav; p++) - p->flags |= ep->e_flags & ~NFSEXP_SECINFO_FLAGS; + /* + * Turn on nohide which will allow this export to cross over + * the 'mount --bind' mount point. + */ + if (ep->e_fslocdata) + ep->e_flags |= NFSEXP_NOHIDE; + fix_pseudoflavor_flags(ep); ep->e_squids = squids; ep->e_sqgids = sqgids; ep->e_nsquids = nsquids; @@ -760,4 +769,3 @@ syntaxerr(char *msg) xlog(L_ERROR, "%s:%d: syntax error: %s", efname, efp?efp->x_line:0, msg); } -