#include "afs/audit.h"
extern int restricted;
+extern int restrict_anonymous;
extern struct ubik_dbase *dbase;
extern int pr_noAuth;
extern int prp_group_default;
static afs_int32 addToGroup(struct rx_call *call, afs_int32 aid, afs_int32 gid,
afs_int32 *cid);
static afs_int32 nameToID(struct rx_call *call, namelist *aname, idlist *aid);
-static afs_int32 idToName(struct rx_call *call, idlist *aid, namelist *aname);
+static afs_int32 idToName(struct rx_call *call, idlist *aid, namelist *aname, afs_int32 *cid);
static afs_int32 Delete(struct rx_call *call, afs_int32 aid, afs_int32 *cid);
static afs_int32 UpdateEntry(struct rx_call *call, afs_int32 aid, char *name,
struct PrUpdateEntry *uentry, afs_int32 *cid);
static afs_int32 getCPS2(struct rx_call *call, afs_int32 aid, afs_uint32 ahost,
prlist *alist, afs_int32 *over, afs_int32 *cid);
static afs_int32 getHostCPS(struct rx_call *call, afs_uint32 ahost,
- prlist *alist, afs_int32 *over);
-static afs_int32 listMax(struct rx_call *call, afs_int32 *uid, afs_int32 *gid);
+ prlist *alist, afs_int32 *over, afs_int32 *cid);
+static afs_int32 listMax(struct rx_call *call, afs_int32 *uid, afs_int32 *gid, afs_int32 *cid);
static afs_int32 setMax(struct rx_call *call, afs_int32 aid, afs_int32 gflag,
afs_int32 *cid);
static afs_int32 listEntry(struct rx_call *call, afs_int32 aid,
code = WhoIsThis(call, tt, cid);
if (code)
ABORT_WITH(tt, PRPERM);
+ if (!pr_noAuth && restrict_anonymous && *cid == ANONYMOUSID)
+ ABORT_WITH(tt, PRPERM);
temp = FindByID(tt, aid);
if (!temp)
SPR_IDToName(struct rx_call *call, idlist *aid, namelist *aname)
{
afs_int32 code;
+ afs_int32 cid = ANONYMOUSID;
- code = idToName(call, aid, aname);
+ code = idToName(call, aid, aname, &cid);
osi_auditU(call, PTS_IdToNmEvent, code, AUD_END);
ViceLog(125, ("PTS_IDToName: code %d\n", code));
return code;
}
static afs_int32
-idToName(struct rx_call *call, idlist *aid, namelist *aname)
+idToName(struct rx_call *call, idlist *aid, namelist *aname, afs_int32 *cid)
{
afs_int32 code;
struct ubik_trans *tt;
if (code)
return code;
+ code = WhoIsThis(call, tt, cid);
+ if (code)
+ ABORT_WITH(tt, PRPERM);
+ if (!pr_noAuth && restrict_anonymous && *cid == ANONYMOUSID)
+ ABORT_WITH(tt, PRPERM);
+
for (i = 0; i < aid->idlist_len; i++) {
code = IDToName(tt, aid->idlist_val[i], aname->namelist_val[i]);
if (code != PRSUCCESS)
if (code)
return code;
+ code = WhoIsThis(call, tt, cid);
+ if (code)
+ ABORT_WITH(tt, PRPERM);
+ if (!pr_noAuth && restrict_anonymous && *cid == ANONYMOUSID)
+ ABORT_WITH(tt, PRPERM);
+
temp = FindByID(tt, aid);
if (!temp)
ABORT_WITH(tt, PRNOENT);
if (code)
ABORT_WITH(tt, code);
- /* afs does authenticate now */
- code = WhoIsThis(call, tt, cid);
- if (code || !AccessOK(tt, *cid, &tentry, PRP_MEMBER_MEM, PRP_MEMBER_ANY))
+ if (!AccessOK(tt, *cid, &tentry, PRP_MEMBER_MEM, PRP_MEMBER_ANY))
ABORT_WITH(tt, PRPERM);
code = GetList(tt, &tentry, alist, 1);
afs_int32 *over)
{
afs_int32 code;
+ afs_int32 cid = ANONYMOUSID;
- code = getHostCPS(call, ahost, alist, over);
+ code = getHostCPS(call, ahost, alist, over, &cid);
osi_auditU(call, PTS_GetHCPSEvent, code, AUD_HOST, htonl(ahost), AUD_END);
ViceLog(125, ("PTS_GetHostCPS: code %d ahost %d\n", code, ahost));
return code;
afs_int32
getHostCPS(struct rx_call *call, afs_uint32 ahost, prlist *alist,
- afs_int32 *over)
+ afs_int32 *over, afs_int32 *cid)
{
afs_int32 code, temp;
struct ubik_trans *tt;
if (code)
return code;
+ code = WhoIsThis(call, tt, cid);
+ if (code)
+ ABORT_WITH(tt, PRPERM);
+ if (!pr_noAuth && restrict_anonymous && *cid == ANONYMOUSID)
+ ABORT_WITH(tt, PRPERM);
+
code = NameToID(tt, afs_inet_ntoa_r(iaddr.s_addr, hoststr), &hostid);
if (code == PRSUCCESS && hostid != 0) {
temp = FindByID(tt, hostid);
SPR_ListMax(struct rx_call *call, afs_int32 *uid, afs_int32 *gid)
{
afs_int32 code;
+ afs_int32 cid = ANONYMOUSID;
- code = listMax(call, uid, gid);
+ code = listMax(call, uid, gid, &cid);
osi_auditU(call, PTS_LstMaxEvent, code, AUD_END);
ViceLog(125, ("PTS_ListMax: code %d\n", code));
return code;
}
afs_int32
-listMax(struct rx_call *call, afs_int32 *uid, afs_int32 *gid)
+listMax(struct rx_call *call, afs_int32 *uid, afs_int32 *gid, afs_int32 *cid)
{
afs_int32 code;
struct ubik_trans *tt;
if (code)
return code;
+ code = WhoIsThis(call, tt, cid);
+ if (code)
+ ABORT_WITH(tt, PRPERM);
+ if (!pr_noAuth && restrict_anonymous && *cid == ANONYMOUSID)
+ ABORT_WITH(tt, PRPERM);
+
code = GetMax(tt, uid, gid);
if (code != PRSUCCESS)
ABORT_WITH(tt, code);
code = WhoIsThis(call, tt, cid);
if (code)
ABORT_WITH(tt, PRPERM);
+ if (!pr_noAuth && restrict_anonymous && *cid == ANONYMOUSID)
+ ABORT_WITH(tt, PRPERM);
temp = FindByID(tt, aid);
if (!temp)
ABORT_WITH(tt, PRNOENT);
if (code)
return code;
- code = ubik_SetLock(tt, 1, 1, LOCKREAD);
- if (code)
- ABORT_WITH(tt, code);
code = WhoIsThis(call, tt, cid);
if (code)
ABORT_WITH(tt, PRPERM);
+ if (!pr_noAuth && restrict_anonymous && *cid == ANONYMOUSID)
+ ABORT_WITH(tt, PRPERM);
+
+ code = ubik_SetLock(tt, 1, 1, LOCKREAD);
+ if (code)
+ ABORT_WITH(tt, code);
temp = FindByID(tt, aid);
if (!temp)