Remove a case of exposing 'struct ucred' to userspace. Use a struct xucred
for LOCKD_MSG instead. Requested by: rwatson
This commit is contained in:
parent
97b0a9a249
commit
f898f7c5b2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=101947
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 @@ client_request(void)
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user