mirror of
https://git.openafs.org/openafs.git
synced 2025-01-22 08:50:17 +00:00
cr_gid is already used by Darwin
Commit eb8e55bba7
introduced a variety
of functions for accessing members of the credentials structure in a
platform independent way. Sadly, cr_gid is already defined by the
Darwin platform headers (on Darwin, the GID is just the first of
the user's groups)
Turn cr_gid() into afs_cr_gid() to avoid this problem, and for
consistency, also rename cr_uid, cr_ruid, cr_rgid, and the
corresponding set_* functions.
Change-Id: I82d74900324d079b5a5c8985510a2c9586c4a526
Reviewed-on: http://gerrit.openafs.org/805
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
fc5e2a4d81
commit
954f67c682
@ -1423,7 +1423,7 @@ afs_vop_rename(ap)
|
||||
* run mv as the user, thus:
|
||||
*/
|
||||
printf("su %d -c /bin/mv /afs/.:mount/%d:%d:%d:%d/%s /afs/.:mount/%d:%d:%d:%d/%s\n",
|
||||
cr_uid(cn_cred(tcnp)), fvc->f.fid.Cell, fvc->f.fid.Fid.Volume,
|
||||
afs_cr_uid(cn_cred(tcnp)), fvc->f.fid.Cell, fvc->f.fid.Fid.Volume,
|
||||
fvc->f.fid.Fid.Vnode, fvc->f.fid.Fid.Unique, fname,
|
||||
tvc->f.fid.Cell, tvc->f.fid.Fid.Volume, tvc->f.fid.Fid.Vnode,
|
||||
tvc->f.fid.Fid.Unique, tname);
|
||||
|
@ -976,7 +976,7 @@ OSI_VC_DECL(avc);
|
||||
/* at least one daemon is idle, so ask it to do the store.
|
||||
* Also, note that we don't lock it any more... */
|
||||
tb = afs_BQueue(BOP_STORE, avc, 0, 1, acred,
|
||||
(afs_size_t) cr_uid(acred), 0L, (void *)0);
|
||||
(afs_size_t) afs_cr_uid(acred), 0L, (void *)0);
|
||||
/* sleep waiting for the store to start, then retrieve error code */
|
||||
while ((tb->flags & BUVALID) == 0) {
|
||||
tb->flags |= BUWAIT;
|
||||
|
@ -54,10 +54,10 @@ crdup(cred_t * cr)
|
||||
{
|
||||
cred_t *tmp = crget();
|
||||
|
||||
set_cr_uid(tmp, cr_uid(cr));
|
||||
set_cr_ruid(tmp, cr_ruid(cr));
|
||||
set_cr_gid(tmp, cr_gid(cr));
|
||||
set_cr_rgid(tmp, cr_rgid(cr));
|
||||
afs_set_cr_uid(tmp, afs_cr_uid(cr));
|
||||
afs_set_cr_ruid(tmp, afs_cr_ruid(cr));
|
||||
afs_set_cr_gid(tmp, afs_cr_gid(cr));
|
||||
afs_set_cr_rgid(tmp, afs_cr_rgid(cr));
|
||||
|
||||
get_group_info(cr_group_info(cr));
|
||||
set_cr_group_info(tmp, cr_group_info(cr));
|
||||
@ -70,10 +70,10 @@ crref(void)
|
||||
{
|
||||
cred_t *cr = crget();
|
||||
|
||||
set_cr_uid(cr, current_fsuid());
|
||||
set_cr_ruid(cr, current_uid());
|
||||
set_cr_gid(cr, current_fsgid());
|
||||
set_cr_rgid(cr, current_gid());
|
||||
afs_set_cr_uid(cr, current_fsuid());
|
||||
afs_set_cr_ruid(cr, current_uid());
|
||||
afs_set_cr_gid(cr, current_fsgid());
|
||||
afs_set_cr_rgid(cr, current_gid());
|
||||
|
||||
task_lock(current);
|
||||
get_group_info(current_group_info());
|
||||
@ -98,15 +98,15 @@ crset(cred_t * cr)
|
||||
if (current->cred != current->real_cred)
|
||||
return;
|
||||
new_creds = prepare_creds();
|
||||
new_creds->fsuid = cr_uid(cr);
|
||||
new_creds->uid = cr_ruid(cr);
|
||||
new_creds->fsgid = cr_gid(cr);
|
||||
new_creds->gid = cr_rgid(cr);
|
||||
new_creds->fsuid = afs_cr_uid(cr);
|
||||
new_creds->uid = afs_cr_ruid(cr);
|
||||
new_creds->fsgid = afs_cr_gid(cr);
|
||||
new_creds->gid = afs_cr_rgid(cr);
|
||||
#else
|
||||
current->fsuid = cr_uid(cr);
|
||||
current->uid = cr_ruid(cr);
|
||||
current->fsgid = cr_gid(cr);
|
||||
current->gid = cr_rgid(cr);
|
||||
current->fsuid = afs_cr_uid(cr);
|
||||
current->uid = afs_cr_ruid(cr);
|
||||
current->fsgid = afs_cr_gid(cr);
|
||||
current->gid = afs_cr_rgid(cr);
|
||||
#endif
|
||||
|
||||
/* using set_current_groups() will sort the groups */
|
||||
|
@ -209,7 +209,7 @@ setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag,
|
||||
code = __setpag(cr, pagvalue, newpag, change_parent);
|
||||
|
||||
#ifdef LINUX_KEYRING_SUPPORT
|
||||
if (code == 0 && cr_rgid(*cr) != NFSXLATOR_CRED) {
|
||||
if (code == 0 && afs_cr_rgid(*cr) != NFSXLATOR_CRED) {
|
||||
(void) install_session_keyring(NULL);
|
||||
|
||||
if (current_session_keyring()) {
|
||||
|
@ -120,8 +120,8 @@ svcauth_afs_accept(struct svc_rqst *rqstp, u32 *authp)
|
||||
ns->code = EACCES;
|
||||
ns->client_addr = *addr;
|
||||
ns->client_addrlen = rqstp->rq_addrlen;
|
||||
ns->client_uid = cr_uid(&rqstp->rq_cred);
|
||||
ns->client_gid = cr_gid(&rqstp->rq_cred);
|
||||
ns->client_uid = afs_cr_uid(&rqstp->rq_cred);
|
||||
ns->client_gid = afs_cr_gid(&rqstp->rq_cred);
|
||||
if (cr_group_info(&rqstp->rq_cred)->ngroups > 0)
|
||||
ns->client_g0 = GROUP_AT(cr_group_info(&rqstp->rq_cred), 0);
|
||||
else
|
||||
@ -138,15 +138,15 @@ svcauth_afs_accept(struct svc_rqst *rqstp, u32 *authp)
|
||||
}
|
||||
|
||||
credp = crget();
|
||||
set_cr_uid(credp, cr_uid(&rqstp->rq_cred));
|
||||
set_cr_gid(credp, cr_gid(&rqstp->rq_cred));
|
||||
afs_set_cr_uid(credp, afs_cr_uid(&rqstp->rq_cred));
|
||||
afs_set_cr_gid(credp, afs_cr_gid(&rqstp->rq_cred));
|
||||
get_group_info(cr_group_info(&rqstp->rq_cred));
|
||||
set_cr_group_info(credp, cr_group_info(&rqstp->rq_cred));
|
||||
|
||||
/* avoid creating wildcard entries by mapping anonymous
|
||||
* clients to afs_nobody */
|
||||
if (cr_uid(credp) == -1)
|
||||
set_cr_uid(credp, -2);
|
||||
if (afs_cr_uid(credp) == -1)
|
||||
afs_set_cr_uid(credp, -2);
|
||||
code = afs_nfsclient_reqhandler(0, &credp, addr->sin_addr.s_addr,
|
||||
&ns->uid, &outexp);
|
||||
if (!code && outexp) EXP_RELE(outexp);
|
||||
@ -191,7 +191,7 @@ int osi_linux_nfs_initreq(struct vrequest *av, afs_ucred_t *cr, int *code)
|
||||
|
||||
*code = ns->code;
|
||||
if (!ns->code) {
|
||||
cr_ruid(cr) = NFSXLATOR_CRED;
|
||||
afs_cr_ruid(cr) = NFSXLATOR_CRED;
|
||||
av->uid = ns->uid;
|
||||
}
|
||||
return 1;
|
||||
|
@ -52,10 +52,10 @@ crdup(cred_t * cr)
|
||||
{
|
||||
cred_t *tmp = crget();
|
||||
|
||||
set_cr_uid(tmp, cr_uid(cr));
|
||||
set_cr_ruid(tmp, cr_ruid(cr));
|
||||
set_cr_gid(tmp, cr_gid(cr));
|
||||
set_cr_rgid(tmp, cr_rgid(cr));
|
||||
afs_set_cr_uid(tmp, afs_cr_uid(cr));
|
||||
afs_set_cr_ruid(tmp, afs_cr_ruid(cr));
|
||||
afs_set_cr_gid(tmp, afs_cr_gid(cr));
|
||||
afs_set_cr_rgid(tmp, afs_cr_rgid(cr));
|
||||
|
||||
memcpy(tmp->cr_groups, cr->cr_groups, NGROUPS * sizeof(gid_t));
|
||||
tmp->cr_ngroups = cr->cr_ngroups;
|
||||
@ -68,10 +68,10 @@ crref(void)
|
||||
{
|
||||
cred_t *cr = crget();
|
||||
|
||||
set_cr_uid(cr, current_fsuid());
|
||||
set_cr_ruid(cr, current_uid());
|
||||
set_cr_gid(cr, current_fsgid());
|
||||
set_cr_rgid(cr, current_gid());
|
||||
afs_set_cr_uid(cr, current_fsuid());
|
||||
afs_set_cr_ruid(cr, current_uid());
|
||||
afs_set_cr_gid(cr, current_fsgid());
|
||||
afs_set_cr_rgid(cr, current_gid());
|
||||
|
||||
memcpy(cr->cr_groups, current->groups, NGROUPS * sizeof(gid_t));
|
||||
cr->cr_ngroups = current->ngroups;
|
||||
@ -94,15 +94,15 @@ crset(cred_t * cr)
|
||||
if (current->cred != current->real_cred)
|
||||
return;
|
||||
new_creds = prepare_creds();
|
||||
new_creds->fsuid = cr_uid(cr);
|
||||
new_creds->uid = cr_ruid(cr);
|
||||
new_creds->fsgid = cr_gid(cr);
|
||||
new_creds->gid = cr_rgid(cr);
|
||||
new_creds->fsuid = afs_cr_uid(cr);
|
||||
new_creds->uid = afs_cr_ruid(cr);
|
||||
new_creds->fsgid = afs_cr_gid(cr);
|
||||
new_creds->gid = afs_cr_rgid(cr);
|
||||
#else
|
||||
current->fsuid = cr_uid(cr);
|
||||
current->uid = cr_ruid(cr);
|
||||
current->fsgid = cr_gid(cr);
|
||||
current->gid = cr_rgid(cr);
|
||||
current->fsuid = afs_cr_uid(cr);
|
||||
current->uid = afs_cr_ruid(cr);
|
||||
current->fsgid = afs_cr_gid(cr);
|
||||
current->gid = afs_cr_rgid(cr);
|
||||
#endif
|
||||
memcpy(current->groups, cr->cr_groups, NGROUPS * sizeof(gid_t));
|
||||
current->ngroups = cr->cr_ngroups;
|
||||
|
@ -1493,12 +1493,12 @@ uafs_Init(char *rn, char *mountDirParam, char *confDirParam,
|
||||
afs_osi_Alloc(sizeof(struct usr_ucred));
|
||||
usr_assert(afs_global_ucredp != NULL);
|
||||
afs_global_ucredp->cr_ref = 1;
|
||||
set_cr_uid(afs_global_ucredp, geteuid());
|
||||
set_cr_gid(afs_global_ucredp, getegid());
|
||||
set_cr_ruid(afs_global_ucredp, getuid());
|
||||
set_cr_rgid(afs_global_ucredp, getgid());
|
||||
afs_global_ucredp->cr_suid = cr_ruid(afs_global_ucredp);
|
||||
afs_global_ucredp->cr_sgid = cr_rgid(afs_global_ucredp);
|
||||
afs_set_cr_uid(afs_global_ucredp, geteuid());
|
||||
afs_set_cr_gid(afs_global_ucredp, getegid());
|
||||
afs_set_cr_ruid(afs_global_ucredp, getuid());
|
||||
afs_set_cr_rgid(afs_global_ucredp, getgid());
|
||||
afs_global_ucredp->cr_suid = afs_cr_ruid(afs_global_ucredp);
|
||||
afs_global_ucredp->cr_sgid = afs_cr_rgid(afs_global_ucredp);
|
||||
st = getgroups(NGROUPS, &afs_global_ucredp->cr_groups[0]);
|
||||
usr_assert(st >= 0);
|
||||
afs_global_ucredp->cr_ngroups = (unsigned long)st;
|
||||
@ -1983,8 +1983,8 @@ syscallThread(void *argp)
|
||||
*/
|
||||
u.u_viceid = getuid();
|
||||
crp = u.u_cred;
|
||||
set_cr_uid(crp, getuid());
|
||||
set_cr_ruid(crp, getuid());
|
||||
afs_set_cr_uid(crp, getuid());
|
||||
afs_set_cr_ruid(crp, getuid());
|
||||
crp->cr_suid = getuid();
|
||||
crp->cr_groups[0] = getgid();
|
||||
crp->cr_ngroups = 1;
|
||||
@ -2579,8 +2579,8 @@ uafs_mkdir_r(char *path, int mode)
|
||||
usr_vattr_null(&attrs);
|
||||
attrs.va_type = VREG;
|
||||
attrs.va_mode = mode;
|
||||
attrs.va_uid = cr_uid(u.u_cred);
|
||||
attrs.va_gid = cr_gid(u.u_cred);
|
||||
attrs.va_uid = afs_cr_uid(u.u_cred);
|
||||
attrs.va_gid = afs_cr_gid(u.u_cred);
|
||||
dirP = NULL;
|
||||
code = afs_mkdir(VTOAFS(parentP), nameP, &attrs, &dirP, u.u_cred);
|
||||
VN_RELE(parentP);
|
||||
@ -2678,8 +2678,8 @@ uafs_open_r(char *path, int flags, int mode)
|
||||
usr_vattr_null(&attrs);
|
||||
attrs.va_type = VREG;
|
||||
attrs.va_mode = mode;
|
||||
attrs.va_uid = cr_uid(u.u_cred);
|
||||
attrs.va_gid = cr_gid(u.u_cred);
|
||||
attrs.va_uid = afs_cr_uid(u.u_cred);
|
||||
attrs.va_gid = afs_cr_gid(u.u_cred);
|
||||
if (flags & O_TRUNC) {
|
||||
attrs.va_size = 0;
|
||||
}
|
||||
@ -3505,8 +3505,8 @@ uafs_symlink_r(char *target, char *source)
|
||||
usr_vattr_null(&attrs);
|
||||
attrs.va_type = VLNK;
|
||||
attrs.va_mode = 0777;
|
||||
attrs.va_uid = cr_uid(u.u_cred);
|
||||
attrs.va_gid = cr_gid(u.u_cred);
|
||||
attrs.va_uid = afs_cr_uid(u.u_cred);
|
||||
attrs.va_gid = afs_cr_gid(u.u_cred);
|
||||
code = afs_symlink(VTOAFS(dirP), nameP, &attrs, target, u.u_cred);
|
||||
VN_RELE(dirP);
|
||||
if (code != 0) {
|
||||
|
@ -271,7 +271,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
|
||||
}
|
||||
InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE | AFS_SETGROUP;
|
||||
InStatus.ClientModTime = osi_Time();
|
||||
InStatus.Group = (afs_int32) cr_gid(acred);
|
||||
InStatus.Group = (afs_int32) afs_cr_gid(acred);
|
||||
if (AFS_NFSXLATORREQ(acred)) {
|
||||
/*
|
||||
* XXX The following is mainly used to fix a bug in the HP-UX
|
||||
|
@ -99,7 +99,7 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
|
||||
InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE | AFS_SETGROUP;
|
||||
InStatus.ClientModTime = osi_Time();
|
||||
InStatus.UnixModeBits = attrs->va_mode & 0xffff; /* only care about protection bits */
|
||||
InStatus.Group = (afs_int32) cr_gid(acred);
|
||||
InStatus.Group = (afs_int32) afs_cr_gid(acred);
|
||||
tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1);
|
||||
ObtainWriteLock(&adp->lock, 153);
|
||||
|
||||
|
@ -745,7 +745,7 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, afs_ucred_t *acred)
|
||||
/* at least one daemon is idle, so ask it to do the store.
|
||||
* Also, note that we don't lock it any more... */
|
||||
tb = afs_BQueue(BOP_STORE, avc, 0, 1, acred,
|
||||
(afs_size_t) cr_uid(acred), (afs_size_t) 0,
|
||||
(afs_size_t) afs_cr_uid(acred), (afs_size_t) 0,
|
||||
(void *)0);
|
||||
/* sleep waiting for the store to start, then retrieve error code */
|
||||
while ((tb->flags & BUVALID) == 0) {
|
||||
|
@ -1400,25 +1400,25 @@ extern int afsd_dynamic_vcaches;
|
||||
#endif
|
||||
|
||||
/* Wrappers for access to credentials structure members */
|
||||
#define cr_uid(cred) ((cred)->cr_uid)
|
||||
#define cr_gid(cred) ((cred)->cr_gid)
|
||||
#define cr_ruid(cred) ((cred)->cr_ruid)
|
||||
#define cr_rgid(cred) ((cred)->cr_rgid)
|
||||
#define afs_cr_uid(cred) ((cred)->cr_uid)
|
||||
#define afs_cr_gid(cred) ((cred)->cr_gid)
|
||||
#define afs_cr_ruid(cred) ((cred)->cr_ruid)
|
||||
#define afs_cr_rgid(cred) ((cred)->cr_rgid)
|
||||
|
||||
static_inline void
|
||||
set_cr_uid(afs_ucred_t *cred, uid_t uid) {
|
||||
afs_set_cr_uid(afs_ucred_t *cred, uid_t uid) {
|
||||
cred->cr_uid = uid;
|
||||
}
|
||||
static_inline void
|
||||
set_cr_gid(afs_ucred_t *cred, gid_t gid) {
|
||||
afs_set_cr_gid(afs_ucred_t *cred, gid_t gid) {
|
||||
cred->cr_gid = gid;
|
||||
}
|
||||
static_inline void
|
||||
set_cr_ruid(afs_ucred_t *cred, uid_t uid) {
|
||||
afs_set_cr_ruid(afs_ucred_t *cred, uid_t uid) {
|
||||
cred->cr_ruid = uid;
|
||||
}
|
||||
static_inline void
|
||||
set_cr_rgid(afs_ucred_t *cred, gid_t gid) {
|
||||
afs_set_cr_rgid(afs_ucred_t *cred, gid_t gid) {
|
||||
cred->cr_rgid = gid;
|
||||
}
|
||||
#endif /* _AFS_H_ */
|
||||
|
@ -713,7 +713,7 @@ afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq,
|
||||
InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE | AFS_SETGROUP;
|
||||
InStatus.ClientModTime = avc->f.m.Date;
|
||||
InStatus.Owner = avc->f.m.Owner;
|
||||
InStatus.Group = (afs_int32) cr_gid(acred);
|
||||
InStatus.Group = (afs_int32) afs_cr_gid(acred);
|
||||
/* Only care about protection bits. */
|
||||
InStatus.UnixModeBits = avc->f.m.Mode & 0xffff;
|
||||
|
||||
|
@ -798,7 +798,7 @@ afs_DynrootVOPRemove(struct vcache *avc, afs_ucred_t *acred, char *aname)
|
||||
#if defined(AFS_SUN510_ENV)
|
||||
if (crgetruid(acred))
|
||||
#else
|
||||
if (cr_uid(acred))
|
||||
if (afs_cr_uid(acred))
|
||||
#endif
|
||||
return EPERM;
|
||||
|
||||
@ -838,7 +838,7 @@ afs_DynrootVOPSymlink(struct vcache *avc, afs_ucred_t *acred,
|
||||
{
|
||||
struct afs_dynSymlink *tps;
|
||||
|
||||
if (cr_uid(acred))
|
||||
if (afs_cr_uid(acred))
|
||||
return EPERM;
|
||||
if (afs_CellOrAliasExists(aname))
|
||||
return EEXIST;
|
||||
|
@ -203,10 +203,10 @@ afs_nfsclient_reqhandler(struct afs_exporter *exporter,
|
||||
#if defined(AFS_SUN510_ENV)
|
||||
uid = crgetuid(*cred);
|
||||
#else
|
||||
uid = cr_uid(*cred);
|
||||
uid = afs_cr_uid(*cred);
|
||||
#endif
|
||||
/* Do this early, so pag management knows */
|
||||
set_cr_rgid(*cred, NFSXLATOR_CRED); /* Identify it as nfs xlator call */
|
||||
afs_set_cr_rgid(*cred, NFSXLATOR_CRED); /* Identify it as nfs xlator call */
|
||||
if ((afs_nfsexporter->exp_states & EXP_CLIPAGS) && pag != NOPAG) {
|
||||
uid = pag;
|
||||
} else if (pag != NOPAG) {
|
||||
@ -226,7 +226,7 @@ afs_nfsclient_reqhandler(struct afs_exporter *exporter,
|
||||
}
|
||||
np = afs_FindNfsClientPag(uid, host, 0);
|
||||
afs_Trace4(afs_iclSetp, CM_TRACE_NFSREQH, ICL_TYPE_INT32, pag,
|
||||
ICL_TYPE_LONG, cr_uid(*cred), ICL_TYPE_INT32, host,
|
||||
ICL_TYPE_LONG, afs_cr_uid(*cred), ICL_TYPE_INT32, host,
|
||||
ICL_TYPE_POINTER, np);
|
||||
/* If remote-pags are enabled, we are no longer interested in what PAG
|
||||
* they claimed, and from here on we should behave as if they claimed
|
||||
@ -253,7 +253,7 @@ afs_nfsclient_reqhandler(struct afs_exporter *exporter,
|
||||
}
|
||||
np = afs_GetNfsClientPag(uid, host);
|
||||
np->pag = pag;
|
||||
np->client_uid = cr_uid(*cred);
|
||||
np->client_uid = afs_cr_uid(*cred);
|
||||
} else {
|
||||
if (pag == NOPAG) {
|
||||
if ((code = setpag(cred, np->pag, &pag, 0))) {
|
||||
@ -590,12 +590,12 @@ afs_iauth_verify(long id, fsid_t * fsidp, long host, int uid,
|
||||
|
||||
if (code) {
|
||||
/* ensure anonymous cred. */
|
||||
set_cr_uid(credp, (uid_t) -2; /* anonymous */
|
||||
set_cr_ruid(credp, (uid_t) -2;
|
||||
afs_set_cr_uid(credp, (uid_t) -2; /* anonymous */
|
||||
afs_set_cr_ruid(credp, (uid_t) -2;
|
||||
}
|
||||
|
||||
/* Mark this thread as an NFS translator thread. */
|
||||
set_cr_rgid(credp, NFSXLATOR_CRED);
|
||||
afs_set_cr_rgid(credp, NFSXLATOR_CRED);
|
||||
|
||||
AFS_GUNLOCK();
|
||||
return 0;
|
||||
|
@ -424,7 +424,7 @@ afs_osi_proc2cred(afs_proc_t * pr)
|
||||
}
|
||||
pcred = proc_ucred(pr);
|
||||
cr.cr_ref = 1;
|
||||
set_cr_uid(&cr, cr_uid(pcred));
|
||||
afs_set_cr_uid(&cr, afs_cr_uid(pcred));
|
||||
cr.cr_ngroups = pcred->cr_ngroups;
|
||||
memcpy(cr.cr_groups, pcred->cr_groups,
|
||||
NGROUPS * sizeof(gid_t));
|
||||
@ -445,7 +445,7 @@ afs_osi_proc2cred(afs_proc_t * pr)
|
||||
|| (pr->p_stat == SSTOP)) {
|
||||
pcred_readlock(pr);
|
||||
cr.cr_ref = 1;
|
||||
set_cr_uid(&cr, cr_uid(pr->p_cred->pc_ucred));
|
||||
afs_set_cr_uid(&cr, afs_cr_uid(pr->p_cred->pc_ucred));
|
||||
cr.cr_ngroups = pr->p_cred->pc_ucred->cr_ngroups;
|
||||
memcpy(cr.cr_groups, pr->p_cred->pc_ucred->cr_groups,
|
||||
NGROUPS * sizeof(gid_t));
|
||||
@ -471,7 +471,7 @@ afs_osi_proc2cred(afs_proc_t * pr)
|
||||
|| (pr->state == TASK_UNINTERRUPTIBLE)
|
||||
|| (pr->state == TASK_STOPPED)) {
|
||||
cr.cr_ref = 1;
|
||||
set_cr_uid(&cr, task_uid(pr));
|
||||
afs_set_cr_uid(&cr, task_uid(pr));
|
||||
#if defined(AFS_LINUX26_ENV)
|
||||
#if defined(STRUCT_TASK_HAS_CRED)
|
||||
get_group_info(pr->cred->group_info);
|
||||
|
@ -455,11 +455,11 @@ afs_InitReq(register struct vrequest *av, afs_ucred_t *acred)
|
||||
if (acred == NOCRED)
|
||||
av->uid = -2; /* XXX nobody... ? */
|
||||
else
|
||||
av->uid = cr_uid(acred); /* bsd creds don't have ruid */
|
||||
av->uid = afs_cr_uid(acred); /* bsd creds don't have ruid */
|
||||
#elif defined(AFS_SUN510_ENV)
|
||||
av->uid = crgetruid(acred);
|
||||
#else
|
||||
av->uid = cr_uid(acred); /* default when no pag is set */
|
||||
av->uid = afs_cr_uid(acred); /* default when no pag is set */
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
@ -609,7 +609,7 @@ PagInCred(afs_ucred_t *cred)
|
||||
out:
|
||||
#endif
|
||||
#if defined(AFS_LINUX26_ENV) && defined(LINUX_KEYRING_SUPPORT)
|
||||
if (pag == NOPAG && cr_rgid(cred) != NFSXLATOR_CRED) {
|
||||
if (pag == NOPAG && afs_cr_rgid(cred) != NFSXLATOR_CRED) {
|
||||
struct key *key;
|
||||
afs_uint32 upag, newpag;
|
||||
|
||||
|
@ -425,7 +425,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
|
||||
/* Set up credentials */
|
||||
memset(&ccred, 0, sizeof(ccred));
|
||||
pag = PagInCred(credp);
|
||||
ccred.uid = cr_uid(credp);
|
||||
ccred.uid = afs_cr_uid(credp);
|
||||
if (pag != NOPAG) {
|
||||
afs_get_groups_from_pag(pag, &g0, &g1);
|
||||
ccred.group0 = g0;
|
||||
|
@ -99,7 +99,7 @@ int afspag_PUnlog(char *ain, afs_int32 ainSize, afs_ucred_t **acred)
|
||||
return EIO; /* Inappropriate ioctl for device */
|
||||
|
||||
pag = PagInCred(*acred);
|
||||
uid = (pag == NOPAG) ? cr_uid(*acred) : pag;
|
||||
uid = (pag == NOPAG) ? afs_cr_uid(*acred) : pag;
|
||||
i = UHash(uid);
|
||||
ObtainWriteLock(&afs_xuser, 823);
|
||||
for (tu = afs_users[i]; tu; tu = tu->next) {
|
||||
@ -187,7 +187,7 @@ int afspag_PSetTokens(char *ain, afs_int32 ainSize, afs_ucred_t **acred)
|
||||
#endif
|
||||
}
|
||||
pag = PagInCred(*acred);
|
||||
uid = (pag == NOPAG) ? cr_uid(*acred) : pag;
|
||||
uid = (pag == NOPAG) ? afs_cr_uid(*acred) : pag;
|
||||
/* now we just set the tokens */
|
||||
tu = afs_GetUser(uid, tcell->cellnum, WRITE_LOCK);
|
||||
if (!tu->cellinfo)
|
||||
|
@ -3237,9 +3237,9 @@ DECL_PIOCTL(PSetSysName)
|
||||
ain += t + 1;
|
||||
num = count;
|
||||
}
|
||||
if (cr_gid(*acred) == RMTUSER_REQ ||
|
||||
cr_gid(*acred) == RMTUSER_REQ_PRIV) { /* Handles all exporters */
|
||||
if (allpags && cr_gid(*acred) != RMTUSER_REQ_PRIV) {
|
||||
if (afs_cr_gid(*acred) == RMTUSER_REQ ||
|
||||
afs_cr_gid(*acred) == RMTUSER_REQ_PRIV) { /* Handles all exporters */
|
||||
if (allpags && afs_cr_gid(*acred) != RMTUSER_REQ_PRIV) {
|
||||
return EPERM;
|
||||
}
|
||||
pag = PagInCred(*acred);
|
||||
@ -3977,7 +3977,7 @@ HandleClientContext(struct afs_ioctl *ablob, int *com,
|
||||
#ifdef AFS_AIX41_ENV
|
||||
setuerror(0);
|
||||
#endif
|
||||
set_cr_gid(newcred, isroot ? RMTUSER_REQ_PRIV : RMTUSER_REQ);
|
||||
afs_set_cr_gid(newcred, isroot ? RMTUSER_REQ_PRIV : RMTUSER_REQ);
|
||||
#ifdef AFS_AIX51_ENV
|
||||
newcred->cr_groupset.gs_union.un_groups[0] = g0;
|
||||
newcred->cr_groupset.gs_union.un_groups[1] = g1;
|
||||
@ -4013,15 +4013,15 @@ HandleClientContext(struct afs_ioctl *ablob, int *com,
|
||||
return EINVAL;
|
||||
}
|
||||
if (exporter->exp_states & EXP_PWSYNC) {
|
||||
if (uid != cr_uid(credp)) {
|
||||
if (uid != afs_cr_uid(credp)) {
|
||||
crfree(newcred);
|
||||
return ENOEXEC; /* XXX Find a better errno XXX */
|
||||
}
|
||||
}
|
||||
set_cr_uid(newcred, uid); /* Only temporary */
|
||||
afs_set_cr_uid(newcred, uid); /* Only temporary */
|
||||
code = EXP_REQHANDLER(exporter, &newcred, hostaddr, &pag, &outexporter);
|
||||
/* The client's pag is the only unique identifier for it */
|
||||
set_cr_uid(newcred, pag);
|
||||
afs_set_cr_uid(newcred, pag);
|
||||
*acred = newcred;
|
||||
if (!code && *com == PSETPAG) {
|
||||
/* Special case for 'setpag' */
|
||||
@ -4709,7 +4709,7 @@ DECL_PIOCTL(PNFSNukeCreds)
|
||||
return EINVAL;
|
||||
memcpy(&addr, ain, sizeof(afs_int32));
|
||||
|
||||
if (cr_gid(*acred) == RMTUSER_REQ_PRIV && !addr) {
|
||||
if (afs_cr_gid(*acred) == RMTUSER_REQ_PRIV && !addr) {
|
||||
tu = afs_GetUser(areq->uid, -1, SHARED_LOCK);
|
||||
if (!tu->exporter || !(addr = EXP_GETHOST(tu->exporter))) {
|
||||
afs_PutUser(tu, SHARED_LOCK);
|
||||
|
@ -608,11 +608,11 @@ afs_GCPAGs_perproc_func(afs_proc_t * pproc)
|
||||
|
||||
pag = PagInCred(pcred);
|
||||
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD40_ENV) || defined(AFS_LINUX22_ENV)
|
||||
uid = (pag != NOPAG ? pag : cr_uid(pcred));
|
||||
uid = (pag != NOPAG ? pag : afs_cr_uid(pcred));
|
||||
#elif defined(AFS_SUN510_ENV)
|
||||
uid = (pag != NOPAG ? pag : crgetruid(pcred));
|
||||
#else
|
||||
uid = (pag != NOPAG ? pag : cr_ruid(pcred);
|
||||
uid = (pag != NOPAG ? pag : afs_cr_ruid(pcred);
|
||||
#endif
|
||||
hash = UHash(uid);
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
#define AFS_NFSXLATORREQ(cred) 0
|
||||
#else
|
||||
#define AFS_NFSXLATORREQ(cred) (cr_rgid(cred) == NFSXLATOR_CRED)
|
||||
#define AFS_NFSXLATORREQ(cred) (afs_cr_rgid(cred) == NFSXLATOR_CRED)
|
||||
#endif
|
||||
|
||||
struct afs_exporter;
|
||||
|
Loading…
Reference in New Issue
Block a user