use a correct credential for readlink. discussed on source-changes@.

This commit is contained in:
yamt 2005-07-21 10:39:46 +00:00
parent 445a39080e
commit d5c148af81
2 changed files with 13 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_bio.c,v 1.131 2005/07/21 10:37:36 yamt Exp $ */
/* $NetBSD: nfs_bio.c,v 1.132 2005/07/21 10:39:46 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.131 2005/07/21 10:37:36 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.132 2005/07/21 10:39:46 yamt Exp $");
#include "opt_nfs.h"
#include "opt_ddb.h"
@ -962,7 +962,7 @@ nfs_doio_read(bp, uiop)
case VLNK:
KASSERT(uiop->uio_offset == (off_t)0);
nfsstats.readlink_bios++;
error = nfs_readlinkrpc(vp, uiop, curproc->p_ucred);
error = nfs_readlinkrpc(vp, uiop, np->n_rcred);
break;
case VDIR:
nfsstats.readdir_bios++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vnops.c,v 1.223 2005/07/07 02:05:03 christos Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.224 2005/07/21 10:39:46 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.223 2005/07/07 02:05:03 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.224 2005/07/21 10:39:46 yamt Exp $");
#include "opt_inet.h"
#include "opt_nfs.h"
@ -1165,9 +1165,17 @@ nfs_readlink(v)
struct ucred *a_cred;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct nfsnode *np = VTONFS(vp);
if (vp->v_type != VLNK)
return (EPERM);
if (np->n_rcred != NULL) {
crfree(np->n_rcred);
}
np->n_rcred = ap->a_cred;
crhold(np->n_rcred);
return (nfs_bioread(vp, ap->a_uio, 0, ap->a_cred, 0));
}