Re: knfsd-980910 is released with nfsd-patch-2.1.121

G. Allen Morris III (gam3@dharma.sehda.com)
Sat, 12 Sep 1998 00:12:10 -0700


H.J.

here is a quick and dirty patch to mountd.c to allow submounts.
It just looks for the export with the longest matching path.
It could catch more errors but the kernel will catch what is
missed here.

--- mountd.c.orig Sat Sep 12 00:01:49 1998
+++ mountd.c Sat Sep 12 00:04:41 1998
@@ -204,6 +204,8 @@
nfs_export *exp;
char rpath[MAXPATHLEN+1];
char *p = *path;
+ char epath[MAXPATHLEN+1];
+ char *ep;

if (*p == '\0')
p = "/";
@@ -216,12 +218,22 @@
rpath[MAXPATHLEN] = '\0';
p = rpath;
}
+ ep = strcpy(epath, p);

/* Now authenticate the intruder... */
- if (!(exp = auth_authenticate("mount", sin, p))) {
+ /* Find the longest export the matches */
+ while (strchr(ep, '/')) {
+ char *pt;
+fprintf(stderr, "%s\n", ep);
+ if (exp = auth_authenticate("mount", sin, ep)) {
+ break;
+ }
+ *strrchr(ep, '/') = '\0';
+ }
+ if (!strchr(ep, '/')) {
*error = NFSERR_ACCES;
} else if (stat(p, &stb) < 0) {
- xlog(L_WARNING, "can't stat exported dir %s: %s",
+ xlog(L_WARNING, "can't stat dir %s: %s",
p, strerror(errno));
if (errno == ENOENT)
*error = NFSERR_NOENT;

---------------------------------
G. Allen Morris III

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/faq.html