From 6d7e27acebf039aa472ab2df41baa447cae9e1cc Mon Sep 17 00:00:00 2001 From: alfred Date: Thu, 15 Aug 2002 21:52:22 +0000 Subject: Remove a case of exposing 'struct ucred' to userspace. Use a struct xucred for LOCKD_MSG instead. Requested by: rwatson --- sys/nfsclient/nfs_lock.c | 2 +- sys/nfsclient/nfs_lock.h | 2 +- usr.sbin/rpc.lockd/kern.c | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/nfsclient/nfs_lock.c b/sys/nfsclient/nfs_lock.c index 404fce9..ee028dc 100644 --- a/sys/nfsclient/nfs_lock.c +++ b/sys/nfsclient/nfs_lock.c @@ -139,7 +139,7 @@ nfs_dolock(struct vop_advlock_args *ap) msg.lm_fh_len = NFS_ISV3(vp) ? VTONFS(vp)->n_fhsize : NFSX_V2FH; bcopy(VTONFS(vp)->n_fhp, msg.lm_fh, msg.lm_fh_len); msg.lm_nfsv3 = NFS_ISV3(vp); - msg.lm_cred = *(td->td_ucred); + cru2x(td->td_ucred, &msg.lm_cred); /* * Open the lock fifo. If for any reason we don't find the fifo, it diff --git a/sys/nfsclient/nfs_lock.h b/sys/nfsclient/nfs_lock.h index af99bc5..e4bb794 100644 --- a/sys/nfsclient/nfs_lock.h +++ b/sys/nfsclient/nfs_lock.h @@ -72,7 +72,7 @@ typedef struct __lock_msg { struct sockaddr_storage lm_addr; /* The address. */ int lm_nfsv3; /* If NFS version 3. */ size_t lm_fh_len; /* The file handle length. */ - struct ucred lm_cred; /* user cred for lock req */ + struct xucred lm_cred; /* user cred for lock req */ u_int8_t lm_fh[NFS_SMALLFH];/* The file handle. */ } LOCKD_MSG; diff --git a/usr.sbin/rpc.lockd/kern.c b/usr.sbin/rpc.lockd/kern.c index 5eb9413..2576258 100644 --- a/usr.sbin/rpc.lockd/kern.c +++ b/usr.sbin/rpc.lockd/kern.c @@ -74,7 +74,7 @@ static OWNER owner; static char hostname[MAXHOSTNAMELEN + 1]; /* Hostname. */ static void client_cleanup(void); -static void set_auth(CLIENT *cl, struct ucred *ucred); +static void set_auth(CLIENT *cl, struct xucred *ucred); int lock_request(LOCKD_MSG *); int test_request(LOCKD_MSG *); void show(LOCKD_MSG *); @@ -238,17 +238,17 @@ err: } void -set_auth(cl, ucred) +set_auth(cl, xucred) CLIENT *cl; - struct ucred *ucred; + struct xucred *xucred; { if (cl->cl_auth != NULL) cl->cl_auth->ah_ops->ah_destroy(cl->cl_auth); cl->cl_auth = authunix_create(hostname, - ucred->cr_uid, - ucred->cr_groups[0], - ucred->cr_ngroups-1, - &ucred->cr_groups[1]); + xucred->cr_uid, + xucred->cr_groups[0], + xucred->cr_ngroups - 1, + &xucred->cr_groups[1]); } -- cgit v1.1