diff options
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_serv.c | 75 | ||||
-rw-r--r-- | sys/nfs/nfs_subs.c | 24 | ||||
-rw-r--r-- | sys/nfs/nfs_var.h | 6 |
3 files changed, 35 insertions, 70 deletions
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index c545fba06ba..9dc7c12903a 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_serv.c,v 1.49 2008/03/16 19:42:57 otto Exp $ */ +/* $OpenBSD: nfs_serv.c,v 1.50 2008/04/22 18:53:34 thib Exp $ */ /* $NetBSD: nfs_serv.c,v 1.34 1997/05/12 23:37:12 fvdl Exp $ */ /* @@ -118,8 +118,7 @@ nfsrv3_access(nfsd, slp, procp, mrq) fhp = &nfh.fh_generic; nfsm_srvmtofh(fhp); nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly, - (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(NFSX_UNSIGNED); nfsm_srvpostop_attr(1, (struct vattr *)0); @@ -182,8 +181,7 @@ nfsrv_getattr(nfsd, slp, procp, mrq) fhp = &nfh.fh_generic; nfsm_srvmtofh(fhp); - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly, - (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(0); return (0); @@ -274,8 +272,7 @@ nfsrv_setattr(nfsd, slp, procp, mrq) /* * Now that we have all the fields, lets do it. */ - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly, - (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(2 * NFSX_UNSIGNED); nfsm_srvwcc(nfsd, preat_ret, &preat, postat_ret, &va, &mb, @@ -368,8 +365,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq) nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = LOOKUP; nd.ni_cnd.cn_flags = LOCKLEAF | SAVESTART; - error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, &dirp, procp); if (dirp) { if (v3) dirattr_ret = VOP_GETATTR(dirp, &dirattr, cred, @@ -468,8 +464,7 @@ nfsrv_readlink(nfsd, slp, procp, mrq) uiop->uio_rw = UIO_READ; uiop->uio_segflg = UIO_SYSSPACE; uiop->uio_procp = (struct proc *)0; - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, - &rdonly, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { m_freem(mp3); nfsm_reply(2 * NFSX_UNSIGNED); @@ -551,8 +546,7 @@ nfsrv_read(nfsd, slp, procp, mrq) off = (off_t)fxdr_unsigned(u_int32_t, *tl); } nfsm_srvstrsiz(reqlen, NFS_SRVMAXDATA(nfsd)); - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, - &rdonly, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(2 * NFSX_UNSIGNED); nfsm_srvpostop_attr(1, (struct vattr *)0); @@ -763,8 +757,7 @@ nfsrv_write(nfsd, slp, procp, mrq) &bpos); return (0); } - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, - &rdonly, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(2 * NFSX_UNSIGNED); nfsm_srvwcc(nfsd, forat_ret, &forat, aftat_ret, &va, &mb, @@ -1036,8 +1029,8 @@ loop1: cred = &nfsd->nd_cr; v3 = (nfsd->nd_flag & ND_NFSV3); forat_ret = aftat_ret = 1; - error = nfsrv_fhtovp(&nfsd->nd_fh, 1, &vp, cred, slp, - nfsd->nd_nam, &rdonly, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(&nfsd->nd_fh, 1, &vp, cred, slp, + nfsd->nd_nam, &rdonly); if (!error) { if (v3) forat_ret = VOP_GETATTR(vp, &forat, cred, procp); @@ -1268,8 +1261,7 @@ nfsrv_create(nfsd, slp, procp, mrq) nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = CREATE; nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | SAVESTART; - error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, &dirp, procp); if (dirp) { if (v3) dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, @@ -1504,8 +1496,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq) nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = CREATE; nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | SAVESTART; - error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, &dirp, procp); if (dirp) dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, procp); if (error) { @@ -1654,8 +1645,7 @@ nfsrv_remove(nfsd, slp, procp, mrq) nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = DELETE; nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF; - error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, &dirp, procp); if (dirp) { if (v3) dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, @@ -1747,8 +1737,7 @@ nfsrv_rename(nfsd, slp, procp, mrq) fromnd.ni_cnd.cn_cred = cred; fromnd.ni_cnd.cn_nameiop = DELETE; fromnd.ni_cnd.cn_flags = WANTPARENT | SAVESTART; - error = nfs_namei(&fromnd, ffhp, len, slp, nam, &md, - &dpos, &fdirp, procp, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfs_namei(&fromnd, ffhp, len, slp, nam, &md, &dpos, &fdirp, procp); if (fdirp) { if (v3) fdirfor_ret = VOP_GETATTR(fdirp, &fdirfor, cred, @@ -1775,8 +1764,7 @@ nfsrv_rename(nfsd, slp, procp, mrq) tond.ni_cnd.cn_cred = cred; tond.ni_cnd.cn_nameiop = RENAME; tond.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART; - error = nfs_namei(&tond, tfhp, len2, slp, nam, &md, - &dpos, &tdirp, procp, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfs_namei(&tond, tfhp, len2, slp, nam, &md, &dpos, &tdirp, procp); if (tdirp) { if (v3) tdirfor_ret = VOP_GETATTR(tdirp, &tdirfor, cred, @@ -1918,8 +1906,7 @@ nfsrv_link(nfsd, slp, procp, mrq) nfsm_srvmtofh(fhp); nfsm_srvmtofh(dfhp); nfsm_srvnamesiz(len); - error = nfsrv_fhtovp(fhp, FALSE, &vp, cred, slp, nam, - &rdonly, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, FALSE, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_WCCDATA(v3)); nfsm_srvpostop_attr(getret, &at); @@ -1932,8 +1919,7 @@ nfsrv_link(nfsd, slp, procp, mrq) nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = CREATE; nd.ni_cnd.cn_flags = LOCKPARENT; - error = nfs_namei(&nd, dfhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfs_namei(&nd, dfhp, len, slp, nam, &md, &dpos, &dirp, procp); if (dirp) { if (v3) dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, @@ -2020,8 +2006,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq) nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = CREATE; nd.ni_cnd.cn_flags = LOCKPARENT | SAVESTART; - error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, &dirp, procp); if (dirp) { if (v3) dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, @@ -2160,8 +2145,7 @@ nfsrv_mkdir(nfsd, slp, procp, mrq) nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = CREATE; nd.ni_cnd.cn_flags = LOCKPARENT; - error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, &dirp, procp); if (dirp) { if (v3) dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, @@ -2273,8 +2257,7 @@ nfsrv_rmdir(nfsd, slp, procp, mrq) nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = DELETE; nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF; - error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, &dirp, procp); if (dirp) { if (v3) dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, @@ -2417,8 +2400,7 @@ nfsrv_readdir(nfsd, slp, procp, mrq) toff = fxdr_unsigned(u_quad_t, *tl++); } - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, - &rdonly, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(NFSX_UNSIGNED); nfsm_srvpostop_attr(getret, &at); @@ -2670,8 +2652,7 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq) verf = fxdr_hyper(tl); tl += 2; - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, - &rdonly, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(NFSX_UNSIGNED); nfsm_srvpostop_attr(getret, &at); @@ -2979,8 +2960,7 @@ nfsrv_commit(nfsd, slp, procp, mrq) off = fxdr_hyper(tl); tl += 2; cnt = fxdr_unsigned(int, *tl); - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, - &rdonly, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(2 * NFSX_UNSIGNED); nfsm_srvwcc(nfsd, for_ret, &bfor, aft_ret, &aft, &mb, &bpos); @@ -3034,8 +3014,7 @@ nfsrv_statfs(nfsd, slp, procp, mrq) fhp = &nfh.fh_generic; nfsm_srvmtofh(fhp); - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, - &rdonly, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(NFSX_UNSIGNED); nfsm_srvpostop_attr(getret, &at); @@ -3106,8 +3085,7 @@ nfsrv_fsinfo(nfsd, slp, procp, mrq) fhp = &nfh.fh_generic; nfsm_srvmtofh(fhp); - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, - &rdonly, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(NFSX_UNSIGNED); nfsm_srvpostop_attr(getret, &at); @@ -3175,8 +3153,7 @@ nfsrv_pathconf(nfsd, slp, procp, mrq) fhp = &nfh.fh_generic; nfsm_srvmtofh(fhp); - error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, - &rdonly, (nfsd->nd_flag & ND_KERBAUTH)); + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(NFSX_UNSIGNED); nfsm_srvpostop_attr(getret, &at); diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index d395001f24d..4a685c0402c 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_subs.c,v 1.73 2008/04/19 19:38:00 thib Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.74 2008/04/22 18:53:34 thib Exp $ */ /* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */ /* @@ -1221,7 +1221,7 @@ nfs_getattrcache(vp, vaper) * Set up nameidata for a lookup() call and do it */ int -nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag) +nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p) struct nameidata *ndp; fhandle_t *fhp; int len; @@ -1231,7 +1231,6 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag) caddr_t *dposp; struct vnode **retdirp; struct proc *p; - int kerbflag; { int i, rem; struct mbuf *md; @@ -1285,7 +1284,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag) * Extract and set starting directory. */ error = nfsrv_fhtovp(fhp, FALSE, &dp, ndp->ni_cnd.cn_cred, slp, - nam, &rdonly, kerbflag); + nam, &rdonly); if (error) goto out; if (dp->v_type != VDIR) { @@ -1505,7 +1504,7 @@ nfsm_srvfattr(nfsd, vap, fp) * - if not lockflag unlock it with VOP_UNLOCK() */ int -nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag) +nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp) fhandle_t *fhp; int lockflag; struct vnode **vpp; @@ -1513,7 +1512,6 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag) struct nfssvc_sock *slp; struct mbuf *nam; int *rdonlyp; - int kerbflag; { struct proc *p = curproc; /* XXX */ struct mount *mp; @@ -1542,18 +1540,8 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag) return (NFSERR_AUTHERR | AUTH_TOOWEAK); } - /* - * Check/setup credentials. - */ - if (exflags & MNT_EXKERB) { - if (!kerbflag) { - vput(*vpp); - return (NFSERR_AUTHERR | AUTH_TOOWEAK); - } - } else if (kerbflag) { - vput(*vpp); - return (NFSERR_AUTHERR | AUTH_TOOWEAK); - } else if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) { + /* Check/setup credentials. */ + if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) { cred->cr_uid = credanon->cr_uid; cred->cr_gid = credanon->cr_gid; for (i = 0; i < credanon->cr_ngroups && i < NGROUPS; i++) diff --git a/sys/nfs/nfs_var.h b/sys/nfs/nfs_var.h index 49c51d80fb6..7abe9411ce7 100644 --- a/sys/nfs/nfs_var.h +++ b/sys/nfs/nfs_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_var.h,v 1.34 2008/04/14 13:46:13 blambert Exp $ */ +/* $OpenBSD: nfs_var.h,v 1.35 2008/04/22 18:53:34 thib Exp $ */ /* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */ /* @@ -253,7 +253,7 @@ int nfs_loadattrcache(struct vnode **, struct mbuf **, caddr_t *, int nfs_getattrcache(struct vnode *, struct vattr *); int nfs_namei(struct nameidata *, fhandle_t *, int, struct nfssvc_sock *, struct mbuf *, struct mbuf **, caddr_t *, struct vnode **, - struct proc *, int); + struct proc *); void nfsm_v3attrbuild(struct mbuf **, struct vattr *, int, caddr_t *); void nfsm_adj(struct mbuf *, int, int); void nfsm_srvwcc(struct nfsrv_descript *, int, struct vattr *, int, @@ -263,7 +263,7 @@ void nfsm_srvpostopattr(struct nfsrv_descript *, int, struct vattr *, void nfsm_srvfattr(struct nfsrv_descript *, struct vattr *, struct nfs_fattr *); int nfsrv_fhtovp(fhandle_t *, int, struct vnode **, struct ucred *, - struct nfssvc_sock *, struct mbuf *, int *, int); + struct nfssvc_sock *, struct mbuf *, int *); int netaddr_match(int, union nethostaddr *, struct mbuf *); void nfs_clearcommit(struct mount *); int nfs_in_committed_range(struct vnode *, struct buf *); |