summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1997-07-22 15:35:57 +0000
committerdfr <dfr@FreeBSD.org>1997-07-22 15:35:57 +0000
commit331e950c31a841478f4718c2fc7a9e87caa9d57f (patch)
tree9b10aa69bb6ec7ebd38c85969083c37d5edc9b15
parent29f6f6602dbf07eb46c5d0dd699fa79c17421623 (diff)
downloadFreeBSD-src-331e950c31a841478f4718c2fc7a9e87caa9d57f.zip
FreeBSD-src-331e950c31a841478f4718c2fc7a9e87caa9d57f.tar.gz
Correct some dumb mistakes in the WebNFS stuff.
Submitted by: bde
-rw-r--r--sys/nfs/nfs_common.c24
-rw-r--r--sys/nfs/nfs_subs.c24
-rw-r--r--sys/nfsclient/nfs_subs.c24
-rw-r--r--sys/nfsserver/nfs_srvsubs.c24
4 files changed, 64 insertions, 32 deletions
diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c
index 105bc52..4c102c8 100644
--- a/sys/nfs/nfs_common.c
+++ b/sys/nfs/nfs_common.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.38 1997/04/04 17:49:29 dfr Exp $
+ * $Id: nfs_subs.c,v 1.39 1997/07/16 09:06:29 dfr Exp $
*/
/*
@@ -1455,7 +1455,10 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
tocp = cnp->cn_pnbuf;
md = *mdp;
rem = mtod(md, caddr_t) + md->m_len - fromcp;
+#ifdef __FreeBSD__
+ /* XXX why is this in FreeBSD but not in NetBSD? */
cnp->cn_hash = 0;
+#endif
for (i = 0; i < len; i++) {
while (rem == 0) {
md = md->m_next;
@@ -1470,7 +1473,10 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
error = EACCES;
goto out;
}
+#ifdef __FreeBSD__
+ /* XXX why is this in FreeBSD but not in NetBSD? */
cnp->cn_hash += (unsigned char)*fromcp;
+#endif
*tocp++ = *fromcp++;
rem--;
}
@@ -1481,7 +1487,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (len > 0) {
if (rem >= len)
*dposp += len;
- else if (error = nfs_adv(mdp, dposp, len, rem))
+ else if ((error = nfs_adv(mdp, dposp, len, rem)) != 0)
goto out;
}
@@ -1501,6 +1507,8 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (rdonly)
cnp->cn_flags |= RDONLY;
+ *retdirp = dp;
+
if (pubflag) {
/*
* Oh joy. For WebNFS, handle those pesky '%' escapes,
@@ -1560,20 +1568,20 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (cnp->cn_pnbuf[0] == '/')
dp = rootvnode;
} else {
- cnp->cn_flags |= NOCROSSMOUNT;
+ cnp->cn_flags |= NOCROSSMOUNT;
}
cnp->cn_proc = p;
VREF(dp);
- for (;;) {
+ for (;;) {
cnp->cn_nameptr = cnp->cn_pnbuf;
ndp->ni_startdir = dp;
/*
* And call lookup() to do the real work
*/
- cnp->cn_proc = p;
- if (error = lookup(ndp))
+ error = lookup(ndp);
+ if (error)
break;
/*
* Check for encountering a symbolic link
@@ -1600,7 +1608,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
error = ELOOP;
break;
}
- if (ndp->ni_pathlen > 0)
+ if (ndp->ni_pathlen > 1)
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
else
cp = cnp->cn_pnbuf;
@@ -1647,7 +1655,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
VREF(dp);
}
}
- }
+ }
out:
FREE(cnp->cn_pnbuf, M_NAMEI);
return (error);
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 105bc52..4c102c8 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.38 1997/04/04 17:49:29 dfr Exp $
+ * $Id: nfs_subs.c,v 1.39 1997/07/16 09:06:29 dfr Exp $
*/
/*
@@ -1455,7 +1455,10 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
tocp = cnp->cn_pnbuf;
md = *mdp;
rem = mtod(md, caddr_t) + md->m_len - fromcp;
+#ifdef __FreeBSD__
+ /* XXX why is this in FreeBSD but not in NetBSD? */
cnp->cn_hash = 0;
+#endif
for (i = 0; i < len; i++) {
while (rem == 0) {
md = md->m_next;
@@ -1470,7 +1473,10 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
error = EACCES;
goto out;
}
+#ifdef __FreeBSD__
+ /* XXX why is this in FreeBSD but not in NetBSD? */
cnp->cn_hash += (unsigned char)*fromcp;
+#endif
*tocp++ = *fromcp++;
rem--;
}
@@ -1481,7 +1487,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (len > 0) {
if (rem >= len)
*dposp += len;
- else if (error = nfs_adv(mdp, dposp, len, rem))
+ else if ((error = nfs_adv(mdp, dposp, len, rem)) != 0)
goto out;
}
@@ -1501,6 +1507,8 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (rdonly)
cnp->cn_flags |= RDONLY;
+ *retdirp = dp;
+
if (pubflag) {
/*
* Oh joy. For WebNFS, handle those pesky '%' escapes,
@@ -1560,20 +1568,20 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (cnp->cn_pnbuf[0] == '/')
dp = rootvnode;
} else {
- cnp->cn_flags |= NOCROSSMOUNT;
+ cnp->cn_flags |= NOCROSSMOUNT;
}
cnp->cn_proc = p;
VREF(dp);
- for (;;) {
+ for (;;) {
cnp->cn_nameptr = cnp->cn_pnbuf;
ndp->ni_startdir = dp;
/*
* And call lookup() to do the real work
*/
- cnp->cn_proc = p;
- if (error = lookup(ndp))
+ error = lookup(ndp);
+ if (error)
break;
/*
* Check for encountering a symbolic link
@@ -1600,7 +1608,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
error = ELOOP;
break;
}
- if (ndp->ni_pathlen > 0)
+ if (ndp->ni_pathlen > 1)
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
else
cp = cnp->cn_pnbuf;
@@ -1647,7 +1655,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
VREF(dp);
}
}
- }
+ }
out:
FREE(cnp->cn_pnbuf, M_NAMEI);
return (error);
diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c
index 105bc52..4c102c8 100644
--- a/sys/nfsclient/nfs_subs.c
+++ b/sys/nfsclient/nfs_subs.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.38 1997/04/04 17:49:29 dfr Exp $
+ * $Id: nfs_subs.c,v 1.39 1997/07/16 09:06:29 dfr Exp $
*/
/*
@@ -1455,7 +1455,10 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
tocp = cnp->cn_pnbuf;
md = *mdp;
rem = mtod(md, caddr_t) + md->m_len - fromcp;
+#ifdef __FreeBSD__
+ /* XXX why is this in FreeBSD but not in NetBSD? */
cnp->cn_hash = 0;
+#endif
for (i = 0; i < len; i++) {
while (rem == 0) {
md = md->m_next;
@@ -1470,7 +1473,10 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
error = EACCES;
goto out;
}
+#ifdef __FreeBSD__
+ /* XXX why is this in FreeBSD but not in NetBSD? */
cnp->cn_hash += (unsigned char)*fromcp;
+#endif
*tocp++ = *fromcp++;
rem--;
}
@@ -1481,7 +1487,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (len > 0) {
if (rem >= len)
*dposp += len;
- else if (error = nfs_adv(mdp, dposp, len, rem))
+ else if ((error = nfs_adv(mdp, dposp, len, rem)) != 0)
goto out;
}
@@ -1501,6 +1507,8 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (rdonly)
cnp->cn_flags |= RDONLY;
+ *retdirp = dp;
+
if (pubflag) {
/*
* Oh joy. For WebNFS, handle those pesky '%' escapes,
@@ -1560,20 +1568,20 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (cnp->cn_pnbuf[0] == '/')
dp = rootvnode;
} else {
- cnp->cn_flags |= NOCROSSMOUNT;
+ cnp->cn_flags |= NOCROSSMOUNT;
}
cnp->cn_proc = p;
VREF(dp);
- for (;;) {
+ for (;;) {
cnp->cn_nameptr = cnp->cn_pnbuf;
ndp->ni_startdir = dp;
/*
* And call lookup() to do the real work
*/
- cnp->cn_proc = p;
- if (error = lookup(ndp))
+ error = lookup(ndp);
+ if (error)
break;
/*
* Check for encountering a symbolic link
@@ -1600,7 +1608,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
error = ELOOP;
break;
}
- if (ndp->ni_pathlen > 0)
+ if (ndp->ni_pathlen > 1)
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
else
cp = cnp->cn_pnbuf;
@@ -1647,7 +1655,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
VREF(dp);
}
}
- }
+ }
out:
FREE(cnp->cn_pnbuf, M_NAMEI);
return (error);
diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c
index 105bc52..4c102c8 100644
--- a/sys/nfsserver/nfs_srvsubs.c
+++ b/sys/nfsserver/nfs_srvsubs.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.38 1997/04/04 17:49:29 dfr Exp $
+ * $Id: nfs_subs.c,v 1.39 1997/07/16 09:06:29 dfr Exp $
*/
/*
@@ -1455,7 +1455,10 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
tocp = cnp->cn_pnbuf;
md = *mdp;
rem = mtod(md, caddr_t) + md->m_len - fromcp;
+#ifdef __FreeBSD__
+ /* XXX why is this in FreeBSD but not in NetBSD? */
cnp->cn_hash = 0;
+#endif
for (i = 0; i < len; i++) {
while (rem == 0) {
md = md->m_next;
@@ -1470,7 +1473,10 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
error = EACCES;
goto out;
}
+#ifdef __FreeBSD__
+ /* XXX why is this in FreeBSD but not in NetBSD? */
cnp->cn_hash += (unsigned char)*fromcp;
+#endif
*tocp++ = *fromcp++;
rem--;
}
@@ -1481,7 +1487,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (len > 0) {
if (rem >= len)
*dposp += len;
- else if (error = nfs_adv(mdp, dposp, len, rem))
+ else if ((error = nfs_adv(mdp, dposp, len, rem)) != 0)
goto out;
}
@@ -1501,6 +1507,8 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (rdonly)
cnp->cn_flags |= RDONLY;
+ *retdirp = dp;
+
if (pubflag) {
/*
* Oh joy. For WebNFS, handle those pesky '%' escapes,
@@ -1560,20 +1568,20 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
if (cnp->cn_pnbuf[0] == '/')
dp = rootvnode;
} else {
- cnp->cn_flags |= NOCROSSMOUNT;
+ cnp->cn_flags |= NOCROSSMOUNT;
}
cnp->cn_proc = p;
VREF(dp);
- for (;;) {
+ for (;;) {
cnp->cn_nameptr = cnp->cn_pnbuf;
ndp->ni_startdir = dp;
/*
* And call lookup() to do the real work
*/
- cnp->cn_proc = p;
- if (error = lookup(ndp))
+ error = lookup(ndp);
+ if (error)
break;
/*
* Check for encountering a symbolic link
@@ -1600,7 +1608,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
error = ELOOP;
break;
}
- if (ndp->ni_pathlen > 0)
+ if (ndp->ni_pathlen > 1)
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
else
cp = cnp->cn_pnbuf;
@@ -1647,7 +1655,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
VREF(dp);
}
}
- }
+ }
out:
FREE(cnp->cn_pnbuf, M_NAMEI);
return (error);
OpenPOWER on IntegriCloud