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:
Simon Wilkinson 2009-11-11 08:12:51 +00:00 committed by Derrick Brashear
parent fc5e2a4d81
commit 954f67c682
21 changed files with 97 additions and 97 deletions

View File

@ -1423,7 +1423,7 @@ afs_vop_rename(ap)
* run mv as the user, thus: * 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", 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, 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.Cell, tvc->f.fid.Fid.Volume, tvc->f.fid.Fid.Vnode,
tvc->f.fid.Fid.Unique, tname); tvc->f.fid.Fid.Unique, tname);

View File

@ -976,7 +976,7 @@ OSI_VC_DECL(avc);
/* at least one daemon is idle, so ask it to do the store. /* at least one daemon is idle, so ask it to do the store.
* Also, note that we don't lock it any more... */ * Also, note that we don't lock it any more... */
tb = afs_BQueue(BOP_STORE, avc, 0, 1, acred, 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 */ /* sleep waiting for the store to start, then retrieve error code */
while ((tb->flags & BUVALID) == 0) { while ((tb->flags & BUVALID) == 0) {
tb->flags |= BUWAIT; tb->flags |= BUWAIT;

View File

@ -54,10 +54,10 @@ crdup(cred_t * cr)
{ {
cred_t *tmp = crget(); cred_t *tmp = crget();
set_cr_uid(tmp, cr_uid(cr)); afs_set_cr_uid(tmp, afs_cr_uid(cr));
set_cr_ruid(tmp, cr_ruid(cr)); afs_set_cr_ruid(tmp, afs_cr_ruid(cr));
set_cr_gid(tmp, cr_gid(cr)); afs_set_cr_gid(tmp, afs_cr_gid(cr));
set_cr_rgid(tmp, cr_rgid(cr)); afs_set_cr_rgid(tmp, afs_cr_rgid(cr));
get_group_info(cr_group_info(cr)); get_group_info(cr_group_info(cr));
set_cr_group_info(tmp, cr_group_info(cr)); set_cr_group_info(tmp, cr_group_info(cr));
@ -70,10 +70,10 @@ crref(void)
{ {
cred_t *cr = crget(); cred_t *cr = crget();
set_cr_uid(cr, current_fsuid()); afs_set_cr_uid(cr, current_fsuid());
set_cr_ruid(cr, current_uid()); afs_set_cr_ruid(cr, current_uid());
set_cr_gid(cr, current_fsgid()); afs_set_cr_gid(cr, current_fsgid());
set_cr_rgid(cr, current_gid()); afs_set_cr_rgid(cr, current_gid());
task_lock(current); task_lock(current);
get_group_info(current_group_info()); get_group_info(current_group_info());
@ -98,15 +98,15 @@ crset(cred_t * cr)
if (current->cred != current->real_cred) if (current->cred != current->real_cred)
return; return;
new_creds = prepare_creds(); new_creds = prepare_creds();
new_creds->fsuid = cr_uid(cr); new_creds->fsuid = afs_cr_uid(cr);
new_creds->uid = cr_ruid(cr); new_creds->uid = afs_cr_ruid(cr);
new_creds->fsgid = cr_gid(cr); new_creds->fsgid = afs_cr_gid(cr);
new_creds->gid = cr_rgid(cr); new_creds->gid = afs_cr_rgid(cr);
#else #else
current->fsuid = cr_uid(cr); current->fsuid = afs_cr_uid(cr);
current->uid = cr_ruid(cr); current->uid = afs_cr_ruid(cr);
current->fsgid = cr_gid(cr); current->fsgid = afs_cr_gid(cr);
current->gid = cr_rgid(cr); current->gid = afs_cr_rgid(cr);
#endif #endif
/* using set_current_groups() will sort the groups */ /* using set_current_groups() will sort the groups */

View File

@ -209,7 +209,7 @@ setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag,
code = __setpag(cr, pagvalue, newpag, change_parent); code = __setpag(cr, pagvalue, newpag, change_parent);
#ifdef LINUX_KEYRING_SUPPORT #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); (void) install_session_keyring(NULL);
if (current_session_keyring()) { if (current_session_keyring()) {

View File

@ -120,8 +120,8 @@ svcauth_afs_accept(struct svc_rqst *rqstp, u32 *authp)
ns->code = EACCES; ns->code = EACCES;
ns->client_addr = *addr; ns->client_addr = *addr;
ns->client_addrlen = rqstp->rq_addrlen; ns->client_addrlen = rqstp->rq_addrlen;
ns->client_uid = cr_uid(&rqstp->rq_cred); ns->client_uid = afs_cr_uid(&rqstp->rq_cred);
ns->client_gid = cr_gid(&rqstp->rq_cred); ns->client_gid = afs_cr_gid(&rqstp->rq_cred);
if (cr_group_info(&rqstp->rq_cred)->ngroups > 0) if (cr_group_info(&rqstp->rq_cred)->ngroups > 0)
ns->client_g0 = GROUP_AT(cr_group_info(&rqstp->rq_cred), 0); ns->client_g0 = GROUP_AT(cr_group_info(&rqstp->rq_cred), 0);
else else
@ -138,15 +138,15 @@ svcauth_afs_accept(struct svc_rqst *rqstp, u32 *authp)
} }
credp = crget(); credp = crget();
set_cr_uid(credp, cr_uid(&rqstp->rq_cred)); afs_set_cr_uid(credp, afs_cr_uid(&rqstp->rq_cred));
set_cr_gid(credp, cr_gid(&rqstp->rq_cred)); afs_set_cr_gid(credp, afs_cr_gid(&rqstp->rq_cred));
get_group_info(cr_group_info(&rqstp->rq_cred)); get_group_info(cr_group_info(&rqstp->rq_cred));
set_cr_group_info(credp, cr_group_info(&rqstp->rq_cred)); set_cr_group_info(credp, cr_group_info(&rqstp->rq_cred));
/* avoid creating wildcard entries by mapping anonymous /* avoid creating wildcard entries by mapping anonymous
* clients to afs_nobody */ * clients to afs_nobody */
if (cr_uid(credp) == -1) if (afs_cr_uid(credp) == -1)
set_cr_uid(credp, -2); afs_set_cr_uid(credp, -2);
code = afs_nfsclient_reqhandler(0, &credp, addr->sin_addr.s_addr, code = afs_nfsclient_reqhandler(0, &credp, addr->sin_addr.s_addr,
&ns->uid, &outexp); &ns->uid, &outexp);
if (!code && outexp) EXP_RELE(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; *code = ns->code;
if (!ns->code) { if (!ns->code) {
cr_ruid(cr) = NFSXLATOR_CRED; afs_cr_ruid(cr) = NFSXLATOR_CRED;
av->uid = ns->uid; av->uid = ns->uid;
} }
return 1; return 1;

View File

@ -52,10 +52,10 @@ crdup(cred_t * cr)
{ {
cred_t *tmp = crget(); cred_t *tmp = crget();
set_cr_uid(tmp, cr_uid(cr)); afs_set_cr_uid(tmp, afs_cr_uid(cr));
set_cr_ruid(tmp, cr_ruid(cr)); afs_set_cr_ruid(tmp, afs_cr_ruid(cr));
set_cr_gid(tmp, cr_gid(cr)); afs_set_cr_gid(tmp, afs_cr_gid(cr));
set_cr_rgid(tmp, cr_rgid(cr)); afs_set_cr_rgid(tmp, afs_cr_rgid(cr));
memcpy(tmp->cr_groups, cr->cr_groups, NGROUPS * sizeof(gid_t)); memcpy(tmp->cr_groups, cr->cr_groups, NGROUPS * sizeof(gid_t));
tmp->cr_ngroups = cr->cr_ngroups; tmp->cr_ngroups = cr->cr_ngroups;
@ -68,10 +68,10 @@ crref(void)
{ {
cred_t *cr = crget(); cred_t *cr = crget();
set_cr_uid(cr, current_fsuid()); afs_set_cr_uid(cr, current_fsuid());
set_cr_ruid(cr, current_uid()); afs_set_cr_ruid(cr, current_uid());
set_cr_gid(cr, current_fsgid()); afs_set_cr_gid(cr, current_fsgid());
set_cr_rgid(cr, current_gid()); afs_set_cr_rgid(cr, current_gid());
memcpy(cr->cr_groups, current->groups, NGROUPS * sizeof(gid_t)); memcpy(cr->cr_groups, current->groups, NGROUPS * sizeof(gid_t));
cr->cr_ngroups = current->ngroups; cr->cr_ngroups = current->ngroups;
@ -94,15 +94,15 @@ crset(cred_t * cr)
if (current->cred != current->real_cred) if (current->cred != current->real_cred)
return; return;
new_creds = prepare_creds(); new_creds = prepare_creds();
new_creds->fsuid = cr_uid(cr); new_creds->fsuid = afs_cr_uid(cr);
new_creds->uid = cr_ruid(cr); new_creds->uid = afs_cr_ruid(cr);
new_creds->fsgid = cr_gid(cr); new_creds->fsgid = afs_cr_gid(cr);
new_creds->gid = cr_rgid(cr); new_creds->gid = afs_cr_rgid(cr);
#else #else
current->fsuid = cr_uid(cr); current->fsuid = afs_cr_uid(cr);
current->uid = cr_ruid(cr); current->uid = afs_cr_ruid(cr);
current->fsgid = cr_gid(cr); current->fsgid = afs_cr_gid(cr);
current->gid = cr_rgid(cr); current->gid = afs_cr_rgid(cr);
#endif #endif
memcpy(current->groups, cr->cr_groups, NGROUPS * sizeof(gid_t)); memcpy(current->groups, cr->cr_groups, NGROUPS * sizeof(gid_t));
current->ngroups = cr->cr_ngroups; current->ngroups = cr->cr_ngroups;

View File

@ -1493,12 +1493,12 @@ uafs_Init(char *rn, char *mountDirParam, char *confDirParam,
afs_osi_Alloc(sizeof(struct usr_ucred)); afs_osi_Alloc(sizeof(struct usr_ucred));
usr_assert(afs_global_ucredp != NULL); usr_assert(afs_global_ucredp != NULL);
afs_global_ucredp->cr_ref = 1; afs_global_ucredp->cr_ref = 1;
set_cr_uid(afs_global_ucredp, geteuid()); afs_set_cr_uid(afs_global_ucredp, geteuid());
set_cr_gid(afs_global_ucredp, getegid()); afs_set_cr_gid(afs_global_ucredp, getegid());
set_cr_ruid(afs_global_ucredp, getuid()); afs_set_cr_ruid(afs_global_ucredp, getuid());
set_cr_rgid(afs_global_ucredp, getgid()); afs_set_cr_rgid(afs_global_ucredp, getgid());
afs_global_ucredp->cr_suid = cr_ruid(afs_global_ucredp); afs_global_ucredp->cr_suid = afs_cr_ruid(afs_global_ucredp);
afs_global_ucredp->cr_sgid = cr_rgid(afs_global_ucredp); afs_global_ucredp->cr_sgid = afs_cr_rgid(afs_global_ucredp);
st = getgroups(NGROUPS, &afs_global_ucredp->cr_groups[0]); st = getgroups(NGROUPS, &afs_global_ucredp->cr_groups[0]);
usr_assert(st >= 0); usr_assert(st >= 0);
afs_global_ucredp->cr_ngroups = (unsigned long)st; afs_global_ucredp->cr_ngroups = (unsigned long)st;
@ -1983,8 +1983,8 @@ syscallThread(void *argp)
*/ */
u.u_viceid = getuid(); u.u_viceid = getuid();
crp = u.u_cred; crp = u.u_cred;
set_cr_uid(crp, getuid()); afs_set_cr_uid(crp, getuid());
set_cr_ruid(crp, getuid()); afs_set_cr_ruid(crp, getuid());
crp->cr_suid = getuid(); crp->cr_suid = getuid();
crp->cr_groups[0] = getgid(); crp->cr_groups[0] = getgid();
crp->cr_ngroups = 1; crp->cr_ngroups = 1;
@ -2579,8 +2579,8 @@ uafs_mkdir_r(char *path, int mode)
usr_vattr_null(&attrs); usr_vattr_null(&attrs);
attrs.va_type = VREG; attrs.va_type = VREG;
attrs.va_mode = mode; attrs.va_mode = mode;
attrs.va_uid = cr_uid(u.u_cred); attrs.va_uid = afs_cr_uid(u.u_cred);
attrs.va_gid = cr_gid(u.u_cred); attrs.va_gid = afs_cr_gid(u.u_cred);
dirP = NULL; dirP = NULL;
code = afs_mkdir(VTOAFS(parentP), nameP, &attrs, &dirP, u.u_cred); code = afs_mkdir(VTOAFS(parentP), nameP, &attrs, &dirP, u.u_cred);
VN_RELE(parentP); VN_RELE(parentP);
@ -2678,8 +2678,8 @@ uafs_open_r(char *path, int flags, int mode)
usr_vattr_null(&attrs); usr_vattr_null(&attrs);
attrs.va_type = VREG; attrs.va_type = VREG;
attrs.va_mode = mode; attrs.va_mode = mode;
attrs.va_uid = cr_uid(u.u_cred); attrs.va_uid = afs_cr_uid(u.u_cred);
attrs.va_gid = cr_gid(u.u_cred); attrs.va_gid = afs_cr_gid(u.u_cred);
if (flags & O_TRUNC) { if (flags & O_TRUNC) {
attrs.va_size = 0; attrs.va_size = 0;
} }
@ -3505,8 +3505,8 @@ uafs_symlink_r(char *target, char *source)
usr_vattr_null(&attrs); usr_vattr_null(&attrs);
attrs.va_type = VLNK; attrs.va_type = VLNK;
attrs.va_mode = 0777; attrs.va_mode = 0777;
attrs.va_uid = cr_uid(u.u_cred); attrs.va_uid = afs_cr_uid(u.u_cred);
attrs.va_gid = cr_gid(u.u_cred); attrs.va_gid = afs_cr_gid(u.u_cred);
code = afs_symlink(VTOAFS(dirP), nameP, &attrs, target, u.u_cred); code = afs_symlink(VTOAFS(dirP), nameP, &attrs, target, u.u_cred);
VN_RELE(dirP); VN_RELE(dirP);
if (code != 0) { if (code != 0) {

View File

@ -271,7 +271,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
} }
InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE | AFS_SETGROUP; InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE | AFS_SETGROUP;
InStatus.ClientModTime = osi_Time(); InStatus.ClientModTime = osi_Time();
InStatus.Group = (afs_int32) cr_gid(acred); InStatus.Group = (afs_int32) afs_cr_gid(acred);
if (AFS_NFSXLATORREQ(acred)) { if (AFS_NFSXLATORREQ(acred)) {
/* /*
* XXX The following is mainly used to fix a bug in the HP-UX * XXX The following is mainly used to fix a bug in the HP-UX

View File

@ -99,7 +99,7 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE | AFS_SETGROUP; InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE | AFS_SETGROUP;
InStatus.ClientModTime = osi_Time(); InStatus.ClientModTime = osi_Time();
InStatus.UnixModeBits = attrs->va_mode & 0xffff; /* only care about protection bits */ 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); tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1);
ObtainWriteLock(&adp->lock, 153); ObtainWriteLock(&adp->lock, 153);

View File

@ -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. /* at least one daemon is idle, so ask it to do the store.
* Also, note that we don't lock it any more... */ * Also, note that we don't lock it any more... */
tb = afs_BQueue(BOP_STORE, avc, 0, 1, acred, 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); (void *)0);
/* sleep waiting for the store to start, then retrieve error code */ /* sleep waiting for the store to start, then retrieve error code */
while ((tb->flags & BUVALID) == 0) { while ((tb->flags & BUVALID) == 0) {

View File

@ -1400,25 +1400,25 @@ extern int afsd_dynamic_vcaches;
#endif #endif
/* Wrappers for access to credentials structure members */ /* Wrappers for access to credentials structure members */
#define cr_uid(cred) ((cred)->cr_uid) #define afs_cr_uid(cred) ((cred)->cr_uid)
#define cr_gid(cred) ((cred)->cr_gid) #define afs_cr_gid(cred) ((cred)->cr_gid)
#define cr_ruid(cred) ((cred)->cr_ruid) #define afs_cr_ruid(cred) ((cred)->cr_ruid)
#define cr_rgid(cred) ((cred)->cr_rgid) #define afs_cr_rgid(cred) ((cred)->cr_rgid)
static_inline void 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; cred->cr_uid = uid;
} }
static_inline void 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; cred->cr_gid = gid;
} }
static_inline void 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; cred->cr_ruid = uid;
} }
static_inline void 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; cred->cr_rgid = gid;
} }
#endif /* _AFS_H_ */ #endif /* _AFS_H_ */

View File

@ -713,7 +713,7 @@ afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq,
InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE | AFS_SETGROUP; InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE | AFS_SETGROUP;
InStatus.ClientModTime = avc->f.m.Date; InStatus.ClientModTime = avc->f.m.Date;
InStatus.Owner = avc->f.m.Owner; 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. */ /* Only care about protection bits. */
InStatus.UnixModeBits = avc->f.m.Mode & 0xffff; InStatus.UnixModeBits = avc->f.m.Mode & 0xffff;

View File

@ -798,7 +798,7 @@ afs_DynrootVOPRemove(struct vcache *avc, afs_ucred_t *acred, char *aname)
#if defined(AFS_SUN510_ENV) #if defined(AFS_SUN510_ENV)
if (crgetruid(acred)) if (crgetruid(acred))
#else #else
if (cr_uid(acred)) if (afs_cr_uid(acred))
#endif #endif
return EPERM; return EPERM;
@ -838,7 +838,7 @@ afs_DynrootVOPSymlink(struct vcache *avc, afs_ucred_t *acred,
{ {
struct afs_dynSymlink *tps; struct afs_dynSymlink *tps;
if (cr_uid(acred)) if (afs_cr_uid(acred))
return EPERM; return EPERM;
if (afs_CellOrAliasExists(aname)) if (afs_CellOrAliasExists(aname))
return EEXIST; return EEXIST;

View File

@ -203,10 +203,10 @@ afs_nfsclient_reqhandler(struct afs_exporter *exporter,
#if defined(AFS_SUN510_ENV) #if defined(AFS_SUN510_ENV)
uid = crgetuid(*cred); uid = crgetuid(*cred);
#else #else
uid = cr_uid(*cred); uid = afs_cr_uid(*cred);
#endif #endif
/* Do this early, so pag management knows */ /* 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) { if ((afs_nfsexporter->exp_states & EXP_CLIPAGS) && pag != NOPAG) {
uid = pag; uid = pag;
} else if (pag != NOPAG) { } else if (pag != NOPAG) {
@ -226,7 +226,7 @@ afs_nfsclient_reqhandler(struct afs_exporter *exporter,
} }
np = afs_FindNfsClientPag(uid, host, 0); np = afs_FindNfsClientPag(uid, host, 0);
afs_Trace4(afs_iclSetp, CM_TRACE_NFSREQH, ICL_TYPE_INT32, pag, 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); ICL_TYPE_POINTER, np);
/* If remote-pags are enabled, we are no longer interested in what PAG /* 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 * 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 = afs_GetNfsClientPag(uid, host);
np->pag = pag; np->pag = pag;
np->client_uid = cr_uid(*cred); np->client_uid = afs_cr_uid(*cred);
} else { } else {
if (pag == NOPAG) { if (pag == NOPAG) {
if ((code = setpag(cred, np->pag, &pag, 0))) { 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) { if (code) {
/* ensure anonymous cred. */ /* ensure anonymous cred. */
set_cr_uid(credp, (uid_t) -2; /* anonymous */ afs_set_cr_uid(credp, (uid_t) -2; /* anonymous */
set_cr_ruid(credp, (uid_t) -2; afs_set_cr_ruid(credp, (uid_t) -2;
} }
/* Mark this thread as an NFS translator thread. */ /* Mark this thread as an NFS translator thread. */
set_cr_rgid(credp, NFSXLATOR_CRED); afs_set_cr_rgid(credp, NFSXLATOR_CRED);
AFS_GUNLOCK(); AFS_GUNLOCK();
return 0; return 0;

View File

@ -424,7 +424,7 @@ afs_osi_proc2cred(afs_proc_t * pr)
} }
pcred = proc_ucred(pr); pcred = proc_ucred(pr);
cr.cr_ref = 1; 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; cr.cr_ngroups = pcred->cr_ngroups;
memcpy(cr.cr_groups, pcred->cr_groups, memcpy(cr.cr_groups, pcred->cr_groups,
NGROUPS * sizeof(gid_t)); NGROUPS * sizeof(gid_t));
@ -445,7 +445,7 @@ afs_osi_proc2cred(afs_proc_t * pr)
|| (pr->p_stat == SSTOP)) { || (pr->p_stat == SSTOP)) {
pcred_readlock(pr); pcred_readlock(pr);
cr.cr_ref = 1; 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; cr.cr_ngroups = pr->p_cred->pc_ucred->cr_ngroups;
memcpy(cr.cr_groups, pr->p_cred->pc_ucred->cr_groups, memcpy(cr.cr_groups, pr->p_cred->pc_ucred->cr_groups,
NGROUPS * sizeof(gid_t)); NGROUPS * sizeof(gid_t));
@ -471,7 +471,7 @@ afs_osi_proc2cred(afs_proc_t * pr)
|| (pr->state == TASK_UNINTERRUPTIBLE) || (pr->state == TASK_UNINTERRUPTIBLE)
|| (pr->state == TASK_STOPPED)) { || (pr->state == TASK_STOPPED)) {
cr.cr_ref = 1; 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(AFS_LINUX26_ENV)
#if defined(STRUCT_TASK_HAS_CRED) #if defined(STRUCT_TASK_HAS_CRED)
get_group_info(pr->cred->group_info); get_group_info(pr->cred->group_info);

View File

@ -455,11 +455,11 @@ afs_InitReq(register struct vrequest *av, afs_ucred_t *acred)
if (acred == NOCRED) if (acred == NOCRED)
av->uid = -2; /* XXX nobody... ? */ av->uid = -2; /* XXX nobody... ? */
else 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) #elif defined(AFS_SUN510_ENV)
av->uid = crgetruid(acred); av->uid = crgetruid(acred);
#else #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 #endif
} }
return 0; return 0;
@ -609,7 +609,7 @@ PagInCred(afs_ucred_t *cred)
out: out:
#endif #endif
#if defined(AFS_LINUX26_ENV) && defined(LINUX_KEYRING_SUPPORT) #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; struct key *key;
afs_uint32 upag, newpag; afs_uint32 upag, newpag;

View File

@ -425,7 +425,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
/* Set up credentials */ /* Set up credentials */
memset(&ccred, 0, sizeof(ccred)); memset(&ccred, 0, sizeof(ccred));
pag = PagInCred(credp); pag = PagInCred(credp);
ccred.uid = cr_uid(credp); ccred.uid = afs_cr_uid(credp);
if (pag != NOPAG) { if (pag != NOPAG) {
afs_get_groups_from_pag(pag, &g0, &g1); afs_get_groups_from_pag(pag, &g0, &g1);
ccred.group0 = g0; ccred.group0 = g0;

View File

@ -99,7 +99,7 @@ int afspag_PUnlog(char *ain, afs_int32 ainSize, afs_ucred_t **acred)
return EIO; /* Inappropriate ioctl for device */ return EIO; /* Inappropriate ioctl for device */
pag = PagInCred(*acred); pag = PagInCred(*acred);
uid = (pag == NOPAG) ? cr_uid(*acred) : pag; uid = (pag == NOPAG) ? afs_cr_uid(*acred) : pag;
i = UHash(uid); i = UHash(uid);
ObtainWriteLock(&afs_xuser, 823); ObtainWriteLock(&afs_xuser, 823);
for (tu = afs_users[i]; tu; tu = tu->next) { 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 #endif
} }
pag = PagInCred(*acred); pag = PagInCred(*acred);
uid = (pag == NOPAG) ? cr_uid(*acred) : pag; uid = (pag == NOPAG) ? afs_cr_uid(*acred) : pag;
/* now we just set the tokens */ /* now we just set the tokens */
tu = afs_GetUser(uid, tcell->cellnum, WRITE_LOCK); tu = afs_GetUser(uid, tcell->cellnum, WRITE_LOCK);
if (!tu->cellinfo) if (!tu->cellinfo)

View File

@ -3237,9 +3237,9 @@ DECL_PIOCTL(PSetSysName)
ain += t + 1; ain += t + 1;
num = count; num = count;
} }
if (cr_gid(*acred) == RMTUSER_REQ || if (afs_cr_gid(*acred) == RMTUSER_REQ ||
cr_gid(*acred) == RMTUSER_REQ_PRIV) { /* Handles all exporters */ afs_cr_gid(*acred) == RMTUSER_REQ_PRIV) { /* Handles all exporters */
if (allpags && cr_gid(*acred) != RMTUSER_REQ_PRIV) { if (allpags && afs_cr_gid(*acred) != RMTUSER_REQ_PRIV) {
return EPERM; return EPERM;
} }
pag = PagInCred(*acred); pag = PagInCred(*acred);
@ -3977,7 +3977,7 @@ HandleClientContext(struct afs_ioctl *ablob, int *com,
#ifdef AFS_AIX41_ENV #ifdef AFS_AIX41_ENV
setuerror(0); setuerror(0);
#endif #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 #ifdef AFS_AIX51_ENV
newcred->cr_groupset.gs_union.un_groups[0] = g0; newcred->cr_groupset.gs_union.un_groups[0] = g0;
newcred->cr_groupset.gs_union.un_groups[1] = g1; newcred->cr_groupset.gs_union.un_groups[1] = g1;
@ -4013,15 +4013,15 @@ HandleClientContext(struct afs_ioctl *ablob, int *com,
return EINVAL; return EINVAL;
} }
if (exporter->exp_states & EXP_PWSYNC) { if (exporter->exp_states & EXP_PWSYNC) {
if (uid != cr_uid(credp)) { if (uid != afs_cr_uid(credp)) {
crfree(newcred); crfree(newcred);
return ENOEXEC; /* XXX Find a better errno XXX */ 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); code = EXP_REQHANDLER(exporter, &newcred, hostaddr, &pag, &outexporter);
/* The client's pag is the only unique identifier for it */ /* The client's pag is the only unique identifier for it */
set_cr_uid(newcred, pag); afs_set_cr_uid(newcred, pag);
*acred = newcred; *acred = newcred;
if (!code && *com == PSETPAG) { if (!code && *com == PSETPAG) {
/* Special case for 'setpag' */ /* Special case for 'setpag' */
@ -4709,7 +4709,7 @@ DECL_PIOCTL(PNFSNukeCreds)
return EINVAL; return EINVAL;
memcpy(&addr, ain, sizeof(afs_int32)); 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); tu = afs_GetUser(areq->uid, -1, SHARED_LOCK);
if (!tu->exporter || !(addr = EXP_GETHOST(tu->exporter))) { if (!tu->exporter || !(addr = EXP_GETHOST(tu->exporter))) {
afs_PutUser(tu, SHARED_LOCK); afs_PutUser(tu, SHARED_LOCK);

View File

@ -608,11 +608,11 @@ afs_GCPAGs_perproc_func(afs_proc_t * pproc)
pag = PagInCred(pcred); pag = PagInCred(pcred);
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD40_ENV) || defined(AFS_LINUX22_ENV) #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) #elif defined(AFS_SUN510_ENV)
uid = (pag != NOPAG ? pag : crgetruid(pcred)); uid = (pag != NOPAG ? pag : crgetruid(pcred));
#else #else
uid = (pag != NOPAG ? pag : cr_ruid(pcred); uid = (pag != NOPAG ? pag : afs_cr_ruid(pcred);
#endif #endif
hash = UHash(uid); hash = UHash(uid);

View File

@ -43,7 +43,7 @@
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
#define AFS_NFSXLATORREQ(cred) 0 #define AFS_NFSXLATORREQ(cred) 0
#else #else
#define AFS_NFSXLATORREQ(cred) (cr_rgid(cred) == NFSXLATOR_CRED) #define AFS_NFSXLATORREQ(cred) (afs_cr_rgid(cred) == NFSXLATOR_CRED)
#endif #endif
struct afs_exporter; struct afs_exporter;