From d31b6f7a3b71b8f789840676afde3bfa19a043b9 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 21 Jun 2005 21:21:58 +0000 Subject: [PATCH] STABLE14-pts-logging-20050619 enhance pts logging (cherry picked from commit a63ba494bf909ed36b75556cb1f4d33ce13b76c5) --- src/audit/audit.h | 1 + src/ptserver/ptprocs.c | 261 +++++++++++++++++++++++++---------------- 2 files changed, 162 insertions(+), 100 deletions(-) diff --git a/src/audit/audit.h b/src/audit/audit.h index 664b62884..cea04dcc2 100644 --- a/src/audit/audit.h +++ b/src/audit/audit.h @@ -94,6 +94,7 @@ #define PTS_LstEleEvent "AFS_PTS_LstEle" #define PTS_LstOwnEvent "AFS_PTS_LstOwn" #define PTS_IsMemOfEvent "AFS_PTS_IsMemOf" +#define PTS_UpdEntEvent "AFS_PTS_UpdEnt" #define BUDB_StartEvent "AFS_BUDB_Start" #define BUDB_FinishEvent "AFS_BUDB_Finish" diff --git a/src/ptserver/ptprocs.c b/src/ptserver/ptprocs.c index 0028d6154..0fc8e712b 100644 --- a/src/ptserver/ptprocs.c +++ b/src/ptserver/ptprocs.c @@ -229,26 +229,28 @@ SPR_INewEntry(call, aname, aid, oid) afs_int32 oid; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = iNewEntry(call, aname, aid, oid); + code = iNewEntry(call, aname, aid, oid, &cid); osi_auditU(call, PTS_INewEntEvent, code, AUD_LONG, aid, AUD_STR, aname, AUD_LONG, oid, AUD_END); + ViceLog(5, ("PTS_INewEntry: code %d cid %d aid %d aname %s oid %d", code, cid, aid, aname, oid)); return code; } afs_int32 -iNewEntry(call, aname, aid, oid) +iNewEntry(call, aname, aid, oid, cid) struct rx_call *call; char aname[PR_MAXNAMELEN]; afs_int32 aid; afs_int32 oid; + afs_int32 * cid; { /* used primarily for conversion - not intended to be used as usual means * of entering people into the database. */ struct ubik_trans *tt; register afs_int32 code; afs_int32 gflag = 0; - afs_int32 cid; int admin; stolower(aname); @@ -265,10 +267,10 @@ iNewEntry(call, aname, aid, oid) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); - admin = IsAMemberOf(tt, cid, SYSADMINID); + admin = IsAMemberOf(tt, *cid, SYSADMINID); /* first verify the id is good */ if (aid == 0) @@ -283,10 +285,10 @@ iNewEntry(call, aname, aid, oid) ABORT_WITH(tt, PRIDEXIST); /* check a few other things */ - if (!CreateOK(tt, cid, oid, gflag, admin)) + if (!CreateOK(tt, *cid, oid, gflag, admin)) ABORT_WITH(tt, PRPERM); - code = CreateEntry(tt, aname, &aid, 1, gflag, oid, cid); + code = CreateEntry(tt, aname, &aid, 1, gflag, oid, *cid); if (code != PRSUCCESS) ABORT_WITH(tt, code); @@ -307,24 +309,26 @@ SPR_NewEntry(call, aname, flag, oid, aid) afs_int32 *aid; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = newEntry(call, aname, flag, oid, aid); + code = newEntry(call, aname, flag, oid, aid, &cid); osi_auditU(call, PTS_NewEntEvent, code, AUD_LONG, *aid, AUD_STR, aname, AUD_LONG, oid, AUD_END); + ViceLog(5, ("PTS_NewEntry: code %d cid %d aid %d aname %s oid %d", code, cid, *aid, aname, oid)); return code; } afs_int32 -newEntry(call, aname, flag, oid, aid) +newEntry(call, aname, flag, oid, aid, cid) struct rx_call *call; char aname[PR_MAXNAMELEN]; afs_int32 flag; afs_int32 oid; afs_int32 *aid; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; - afs_int32 cid; int admin; extern afs_int32 WhoIsThisWithName(); char cname[PR_MAXNAMELEN]; @@ -346,19 +350,19 @@ newEntry(call, aname, flag, oid, aid) * SPR_INewEntry because we want self-registration to only do * automatic id assignment. */ - code = WhoIsThisWithName(call, tt, &cid, cname); + code = WhoIsThisWithName(call, tt, cid, cname); if (code != 2) { /* 2 specifies that this is a foreign cell request */ if (code) ABORT_WITH(tt, PRPERM); - admin = IsAMemberOf(tt, cid, SYSADMINID); + admin = IsAMemberOf(tt, *cid, SYSADMINID); } else { - admin = ((!restricted && !strcmp(aname, cname))) || IsAMemberOf(tt, cid, SYSADMINID); - oid = cid = SYSADMINID; + admin = ((!restricted && !strcmp(aname, cname))) || IsAMemberOf(tt, *cid, SYSADMINID); + oid = *cid = SYSADMINID; } - if (!CreateOK(tt, cid, oid, flag, admin)) + if (!CreateOK(tt, *cid, oid, flag, admin)) ABORT_WITH(tt, PRPERM); - code = CreateEntry(tt, aname, aid, 0, flag, oid, cid); + code = CreateEntry(tt, aname, aid, 0, flag, oid, *cid); if (code != PRSUCCESS) ABORT_WITH(tt, code); @@ -377,18 +381,21 @@ SPR_WhereIsIt(call, aid, apos) afs_int32 *apos; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = whereIsIt(call, aid, apos); + code = whereIsIt(call, aid, apos, &cid); osi_auditU(call, PTS_WheIsItEvent, code, AUD_LONG, aid, AUD_LONG, *apos, AUD_END); + ViceLog(5, ("PTS_WhereIsIt: code %d cid %d aid %d apos %d", code, cid, aid, *apos)); return code; } afs_int32 -whereIsIt(call, aid, apos) +whereIsIt(call, aid, apos, cid) struct rx_call *call; afs_int32 aid; afs_int32 *apos; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; @@ -407,6 +414,10 @@ whereIsIt(call, aid, apos) if (code) ABORT_WITH(tt, code); + code = WhoIsThis(call, tt, cid); + if (code) + ABORT_WITH(tt, PRPERM); + temp = FindByID(tt, aid); if (!temp) ABORT_WITH(tt, PRNOENT); @@ -425,20 +436,22 @@ SPR_DumpEntry(call, apos, aentry) struct prdebugentry *aentry; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = dumpEntry(call, apos, aentry); + code = dumpEntry(call, apos, aentry, &cid); osi_auditU(call, PTS_DmpEntEvent, code, AUD_LONG, apos, AUD_END); + ViceLog(5, ("PTS_DumpEntry: code %d cid %d apos %d", code, cid, apos)); return code; } afs_int32 -dumpEntry(call, apos, aentry) +dumpEntry(call, apos, aentry, cid) struct rx_call *call; afs_int32 apos; struct prdebugentry *aentry; + afs_int32 *cid; { register afs_int32 code; - afs_int32 cid; struct ubik_trans *tt; code = Initdb(); @@ -454,14 +467,14 @@ dumpEntry(call, apos, aentry) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); code = pr_ReadEntry(tt, 0, apos, aentry); if (code) ABORT_WITH(tt, code); - if (!AccessOK(tt, cid, 0, PRP_STATUS_MEM, 0)) + if (!AccessOK(tt, *cid, 0, PRP_STATUS_MEM, 0)) ABORT_WITH(tt, PRPERM); /* Since prdebugentry is in the form of a prentry not a coentry, we will @@ -486,18 +499,21 @@ SPR_AddToGroup(call, aid, gid) afs_int32 gid; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = addToGroup(call, aid, gid); + code = addToGroup(call, aid, gid, &cid); osi_auditU(call, PTS_AdToGrpEvent, code, AUD_LONG, gid, AUD_LONG, aid, AUD_END); + ViceLog(5, ("PTS_AddToGroup: code %d cid %d gid %d aid %d", code, cid, gid, aid)); return code; } afs_int32 -addToGroup(call, aid, gid) +addToGroup(call, aid, gid, cid) struct rx_call *call; afs_int32 aid; afs_int32 gid; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; @@ -505,7 +521,6 @@ addToGroup(call, aid, gid) afs_int32 tempg; struct prentry tentry; struct prentry uentry; - afs_int32 cid; code = Initdb(); if (code != PRSUCCESS) @@ -524,7 +539,7 @@ addToGroup(call, aid, gid) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); tempu = FindByID(tt, aid); @@ -550,7 +565,7 @@ addToGroup(call, aid, gid) /* make sure that this is a group */ if (!(tentry.flags & PRGRP)) ABORT_WITH(tt, PRNOTGROUP); - if (!AccessOK(tt, cid, &tentry, PRP_ADD_MEM, PRP_ADD_ANY)) + if (!AccessOK(tt, *cid, &tentry, PRP_ADD_MEM, PRP_ADD_ANY)) ABORT_WITH(tt, PRPERM); code = AddToEntry(tt, &tentry, tempg, aid); @@ -582,6 +597,7 @@ SPR_NameToID(call, aname, aid) code = nameToID(call, aname, aid); osi_auditU(call, PTS_NmToIdEvent, code, AUD_END); + ViceLog(5, ("PTS_NameToID: code %d aname %s aid %d", code, aname, aid)); return code; } @@ -654,6 +670,7 @@ SPR_IDToName(call, aid, aname) code = idToName(call, aid, aname); osi_auditU(call, PTS_IdToNmEvent, code, AUD_LONG, aid, AUD_END); + ViceLog(5, ("PTS_IDToName: code %d aid %d aname %s", code, aid, aname)); return code; } @@ -718,20 +735,22 @@ SPR_Delete(call, aid) afs_int32 aid; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = Delete(call, aid); + code = Delete(call, aid, &cid); osi_auditU(call, PTS_DelEvent, code, AUD_LONG, aid, AUD_END); + ViceLog(5, ("PTS_Delete: code %d cid %d aid %d", code, cid, aid)); return code; } afs_int32 -Delete(call, aid) +Delete(call, aid, cid) struct rx_call *call; afs_int32 aid; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; - afs_int32 cid; struct prentry tentry; afs_int32 loc, nptr; int count; @@ -754,7 +773,7 @@ Delete(call, aid) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); @@ -767,8 +786,8 @@ Delete(call, aid) ABORT_WITH(tt, PRDBFAIL); /* Do some access checking */ - if (tentry.owner != cid && !IsAMemberOf(tt, cid, SYSADMINID) - && !IsAMemberOf(tt, cid, tentry.owner) && !pr_noAuth) + if (tentry.owner != *cid && !IsAMemberOf(tt, *cid, SYSADMINID) + && !IsAMemberOf(tt, *cid, tentry.owner) && !pr_noAuth) ABORT_WITH(tt, PRPERM); /* Delete each continuation block as a separate transaction so that no one @@ -956,10 +975,26 @@ SPR_UpdateEntry(call, aid, name, uentry) afs_int32 aid; char *name; struct PrUpdateEntry *uentry; +{ + afs_int32 code; + afs_int32 cid = ANONYMOUSID; + + code = UpdateEntry(call, aid, name, uentry, &cid); + osi_auditU(call, PTS_UpdEntEvent, code, AUD_LONG, aid, AUD_STR, name, AUD_END); + ViceLog(5, ("PTS_UpdateEntry: code %d cid %d aid %d name %s", code, cid, aid, name)); + return code; +} + +afs_int32 +UpdateEntry(call, aid, name, uentry, cid) + struct rx_call *call; + afs_int32 aid; + char *name; + struct PrUpdateEntry *uentry; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; - afs_int32 cid; struct prentry tentry; afs_int32 loc; int id = 0; @@ -985,10 +1020,10 @@ SPR_UpdateEntry(call, aid, name, uentry) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); - code = IsAMemberOf(tt, cid, SYSADMINID); + code = IsAMemberOf(tt, *cid, SYSADMINID); if (!code && !pr_noAuth) ABORT_WITH(tt, PRPERM); @@ -1039,18 +1074,21 @@ SPR_RemoveFromGroup(call, aid, gid) afs_int32 gid; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = removeFromGroup(call, aid, gid); + code = removeFromGroup(call, aid, gid, &cid); osi_auditU(call, PTS_RmFmGrpEvent, code, AUD_LONG, gid, AUD_LONG, aid, AUD_END); + ViceLog(5, ("PTS_RemoveFromGroup: code %d cid %d gid %d aid %d", code, cid, gid, aid)); return code; } afs_int32 -removeFromGroup(call, aid, gid) +removeFromGroup(call, aid, gid, cid) struct rx_call *call; afs_int32 aid; afs_int32 gid; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; @@ -1058,7 +1096,6 @@ removeFromGroup(call, aid, gid) afs_int32 tempg; struct prentry uentry; struct prentry gentry; - afs_int32 cid; code = Initdb(); if (code != PRSUCCESS) @@ -1073,7 +1110,7 @@ removeFromGroup(call, aid, gid) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); tempu = FindByID(tt, aid); @@ -1096,7 +1133,7 @@ removeFromGroup(call, aid, gid) if (uentry.flags & PRGRP) ABORT_WITH(tt, PRNOTUSER); #endif - if (!AccessOK(tt, cid, &gentry, PRP_REMOVE_MEM, 0)) + if (!AccessOK(tt, *cid, &gentry, PRP_REMOVE_MEM, 0)) ABORT_WITH(tt, PRPERM); code = RemoveFromEntry(tt, aid, gid); if (code != PRSUCCESS) @@ -1127,23 +1164,25 @@ SPR_GetCPS(call, aid, alist, over) afs_int32 *over; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = getCPS(call, aid, alist, over); + code = getCPS(call, aid, alist, over, &cid); osi_auditU(call, PTS_GetCPSEvent, code, AUD_LONG, aid, AUD_END); + ViceLog(5, ("PTS_GetCPS: code %d cid %d aid %d", code, cid, aid)); return code; } afs_int32 -getCPS(call, aid, alist, over) +getCPS(call, aid, alist, over, cid) struct rx_call *call; afs_int32 aid; prlist *alist; afs_int32 *over; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; afs_int32 temp; - afs_int32 cid; struct prentry tentry; *over = 0; @@ -1170,8 +1209,8 @@ getCPS(call, aid, alist, over) 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)) + code = WhoIsThis(call, tt, cid); + if (code || !AccessOK(tt, *cid, &tentry, PRP_MEMBER_MEM, PRP_MEMBER_ANY)) ABORT_WITH(tt, PRPERM); code = GetList(tt, &tentry, alist, 1); @@ -1209,25 +1248,27 @@ SPR_GetCPS2(call, aid, ahost, alist, over) afs_int32 *over; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = getCPS2(call, aid, ahost, alist, over); + code = getCPS2(call, aid, ahost, alist, over, &cid); osi_auditU(call, PTS_GetCPS2Event, code, AUD_LONG, aid, AUD_HOST, ahost, AUD_END); + ViceLog(5, ("PTS_GetCPS2: code %d cid %d aid %d ahost %d", code, cid, aid, ahost)); return code; } afs_int32 -getCPS2(call, aid, ahost, alist, over) +getCPS2(call, aid, ahost, alist, over, cid) struct rx_call *call; afs_int32 aid; afs_int32 ahost; prlist *alist; afs_int32 *over; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; afs_int32 temp; - afs_int32 cid; struct prentry tentry; struct prentry host_tentry; afs_int32 hostid; @@ -1263,9 +1304,9 @@ getCPS2(call, aid, ahost, alist, over) ABORT_WITH(tt, code); /* afs does authenticate now */ - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code - || !AccessOK(tt, cid, &tentry, PRP_MEMBER_MEM, PRP_MEMBER_ANY)) + || !AccessOK(tt, *cid, &tentry, PRP_MEMBER_MEM, PRP_MEMBER_ANY)) ABORT_WITH(tt, PRPERM); } code = NameToID(tt, inet_ntoa(iaddr), &hostid); @@ -1307,6 +1348,7 @@ SPR_GetHostCPS(call, ahost, alist, over) code = getHostCPS(call, ahost, alist, over); osi_auditU(call, PTS_GetHCPSEvent, code, AUD_HOST, ahost, AUD_END); + ViceLog(5, ("PTS_GetHostCPS: code %d ahost %d", code, ahost)); return code; } @@ -1379,6 +1421,7 @@ SPR_ListMax(call, uid, gid) code = listMax(call, uid, gid); osi_auditU(call, PTS_LstMaxEvent, code, AUD_END); + ViceLog(5, ("PTS_ListMax: code %d", code)); return code; } @@ -1421,22 +1464,24 @@ SPR_SetMax(call, aid, gflag) afs_int32 gflag; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = setMax(call, aid, gflag); + code = setMax(call, aid, gflag, &cid); osi_auditU(call, PTS_SetMaxEvent, code, AUD_LONG, aid, AUD_LONG, gflag, AUD_END); + ViceLog(5, ("PTS_SetMax: code %d cid %d aid %d gflag %d", code, cid, aid, gflag)); return code; } afs_int32 -setMax(call, aid, gflag) +setMax(call, aid, gflag, cid) struct rx_call *call; afs_int32 aid; afs_int32 gflag; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; - afs_int32 cid; code = Initdb(); if (code != PRSUCCESS) @@ -1451,10 +1496,10 @@ setMax(call, aid, gflag) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); - if (!AccessOK(tt, cid, 0, 0, 0)) + if (!AccessOK(tt, *cid, 0, 0, 0)) ABORT_WITH(tt, PRPERM); if (((gflag & PRGRP) && (aid > 0)) || (!(gflag & PRGRP) && (aid < 0))) ABORT_WITH(tt, PRBADARG); @@ -1476,21 +1521,23 @@ SPR_ListEntry(call, aid, aentry) struct prcheckentry *aentry; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = listEntry(call, aid, aentry); + code = listEntry(call, aid, aentry, cid); osi_auditU(call, PTS_LstEntEvent, code, AUD_LONG, aid, AUD_END); + ViceLog(5, ("PTS_ListEntry: code %d cid %d aid %d", code, cid, aid)); return code; } afs_int32 -listEntry(call, aid, aentry) +listEntry(call, aid, aentry, cid) struct rx_call *call; afs_int32 aid; struct prcheckentry *aentry; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; - afs_int32 cid; afs_int32 temp; struct prentry tentry; @@ -1507,7 +1554,7 @@ listEntry(call, aid, aentry) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); temp = FindByID(tt, aid); @@ -1516,7 +1563,7 @@ listEntry(call, aid, aentry) code = pr_ReadEntry(tt, 0, temp, &tentry); if (code != 0) ABORT_WITH(tt, code); - if (!AccessOK(tt, cid, &tentry, PRP_STATUS_MEM, PRP_STATUS_ANY)) + if (!AccessOK(tt, *cid, &tentry, PRP_STATUS_MEM, PRP_STATUS_ANY)) ABORT_WITH(tt, PRPERM); aentry->flags = tentry.flags >> PRIVATE_SHIFT; @@ -1549,23 +1596,25 @@ SPR_ListEntries(call, flag, startindex, bulkentries, nextstartindex) afs_int32 *nextstartindex; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = listEntries(call, flag, startindex, bulkentries, nextstartindex); + code = listEntries(call, flag, startindex, bulkentries, nextstartindex, &cid); osi_auditU(call, PTS_LstEntsEvent, code, AUD_LONG, flag, AUD_END); + ViceLog(5, ("PTS_ListEntries: code %d cid %d flag %d", code, cid, flag)); return code; } afs_int32 -listEntries(call, flag, startindex, bulkentries, nextstartindex) +listEntries(call, flag, startindex, bulkentries, nextstartindex, cid) struct rx_call *call; afs_int32 flag; afs_int32 startindex; prentries *bulkentries; afs_int32 *nextstartindex; + afs_int32 *cid; { afs_int32 code; struct ubik_trans *tt; - afs_int32 cid; afs_int32 i, eof, pos, maxentries, f; struct prentry tentry; afs_int32 pollcount = 0; @@ -1590,10 +1639,10 @@ listEntries(call, flag, startindex, bulkentries, nextstartindex) /* Make sure we are an authenticated caller and that we are on the * SYSADMIN list. */ - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); - code = IsAMemberOf(tt, cid, SYSADMINID); + code = IsAMemberOf(tt, *cid, SYSADMINID); if (!code && !pr_noAuth) ABORT_WITH(tt, PRPERM); @@ -1692,25 +1741,27 @@ SPR_ChangeEntry(call, aid, name, oid, newid) afs_int32 newid; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = changeEntry(call, aid, name, oid, newid); + code = changeEntry(call, aid, name, oid, newid, &cid); osi_auditU(call, PTS_ChgEntEvent, code, AUD_LONG, aid, AUD_STR, name, AUD_LONG, oid, AUD_LONG, newid, AUD_END); + ViceLog(5, ("PTS_ChangeEntry: code %d cid %d aid %d name %s oid %d newid %d", code, cid, aid, name, oid, newid)); return code; } afs_int32 -changeEntry(call, aid, name, oid, newid) +changeEntry(call, aid, name, oid, newid, cid) struct rx_call *call; afs_int32 aid; char *name; afs_int32 oid; afs_int32 newid; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; afs_int32 pos; - afs_int32 cid; if (!name) return PRPERM; @@ -1734,14 +1785,14 @@ changeEntry(call, aid, name, oid, newid) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); pos = FindByID(tt, aid); if (!pos) ABORT_WITH(tt, PRNOENT); /* protection check in changeentry */ - code = ChangeEntry(tt, aid, cid, name, oid, newid); + code = ChangeEntry(tt, aid, *cid, name, oid, newid); if (code != PRSUCCESS) ABORT_WITH(tt, code); @@ -1758,26 +1809,28 @@ SPR_SetFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1, spare2) afs_int32 spare1, spare2; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; code = setFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1, - spare2); + spare2, &cid); osi_auditU(call, PTS_SetFldEntEvent, code, AUD_LONG, id, AUD_END); + ViceLog(5, ("PTS_SetFieldsEntry: code %d cid %d id %d", code, cid, id)); return code; } afs_int32 -setFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1, spare2) +setFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1, spare2, cid) struct rx_call *call; afs_int32 id; afs_int32 mask; /* specify which fields to update */ afs_int32 flags, ngroups, nusers; afs_int32 spare1, spare2; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; afs_int32 pos; - afs_int32 cid; struct prentry tentry; afs_int32 tflags; @@ -1800,7 +1853,7 @@ setFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1, spare2) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); pos = FindByID(tt, id); @@ -1812,13 +1865,13 @@ setFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1, spare2) tflags = tentry.flags; if (mask & (PR_SF_NGROUPS | PR_SF_NUSERS)) { - if (!AccessOK(tt, cid, 0, 0, 0)) + if (!AccessOK(tt, *cid, 0, 0, 0)) ABORT_WITH(tt, PRPERM); if ((tflags & PRQUOTA) == 0) { /* default if only setting one */ tentry.ngroups = tentry.nusers = 20; } } else { - if (!AccessOK(tt, cid, &tentry, 0, 0)) + if (!AccessOK(tt, *cid, &tentry, 0, 0)) ABORT_WITH(tt, PRPERM); } @@ -1860,22 +1913,24 @@ SPR_ListElements(call, aid, alist, over) afs_int32 *over; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = listElements(call, aid, alist, over); + code = listElements(call, aid, alist, over, &cid); osi_auditU(call, PTS_LstEleEvent, code, AUD_LONG, aid, AUD_END); + ViceLog(5, ("PTS_ListElements: code %d cid %d aid %d", code, cid, aid)); return code; } afs_int32 -listElements(call, aid, alist, over) +listElements(call, aid, alist, over, cid) struct rx_call *call; afs_int32 aid; prlist *alist; afs_int32 *over; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; - afs_int32 cid; afs_int32 temp; struct prentry tentry; @@ -1896,7 +1951,7 @@ listElements(call, aid, alist, over) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); @@ -1906,7 +1961,7 @@ listElements(call, aid, alist, over) code = pr_ReadEntry(tt, 0, temp, &tentry); if (code) ABORT_WITH(tt, code); - if (!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, 0); @@ -1927,9 +1982,11 @@ SPR_ListSuperGroups(call, aid, alist, over) { #if defined(SUPERGROUPS) afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = listSuperGroups(call, aid, alist, over); + code = listSuperGroups(call, aid, alist, over, &cid); osi_auditU(call, "PTS_LstSGrps", code, AUD_LONG, aid, AUD_END); + ViceLog(5, ("PTS_ListSuperGroups: code %d cid %d aid %d", code, cid, aid)); return code; #else return RXGEN_OPCODE; @@ -1938,15 +1995,15 @@ SPR_ListSuperGroups(call, aid, alist, over) #if defined(SUPERGROUPS) afs_int32 -listSuperGroups(call, aid, alist, over) +listSuperGroups(call, aid, alist, over, cid) struct rx_call *call; afs_int32 aid; prlist *alist; afs_int32 *over; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; - afs_int32 cid; afs_int32 temp; struct prentry tentry; @@ -1962,7 +2019,7 @@ listSuperGroups(call, aid, alist, over) code = ubik_SetLock(tt, 1, 1, LOCKREAD); if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); @@ -1972,7 +2029,7 @@ listSuperGroups(call, aid, alist, over) code = pr_ReadEntry(tt, 0, temp, &tentry); if (code) ABORT_WITH(tt, code); - if (!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 = GetSGList(tt, &tentry, alist); @@ -2005,22 +2062,24 @@ SPR_ListOwned(call, aid, alist, lastP) afs_int32 *lastP; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = listOwned(call, aid, alist, lastP); + code = listOwned(call, aid, alist, lastP, &cid); osi_auditU(call, PTS_LstOwnEvent, code, AUD_LONG, aid, AUD_END); + ViceLog(5, ("PTS_ListOwned: code %d cid %d aid %d", code, cid, aid)); return code; } afs_int32 -listOwned(call, aid, alist, lastP) +listOwned(call, aid, alist, lastP, cid) struct rx_call *call; afs_int32 aid; prlist *alist; afs_int32 *lastP; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; - afs_int32 cid; struct prentry tentry; afs_int32 head = 0; afs_int32 start; @@ -2046,7 +2105,7 @@ listOwned(call, aid, alist, lastP) if (code) ABORT_WITH(tt, code); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); @@ -2065,11 +2124,11 @@ listOwned(call, aid, alist, lastP) if (code) ABORT_WITH(tt, code); - if (!AccessOK(tt, cid, &tentry, -1, PRP_OWNED_ANY)) + if (!AccessOK(tt, *cid, &tentry, -1, PRP_OWNED_ANY)) ABORT_WITH(tt, PRPERM); head = tentry.owned; } else { - if (!AccessOK(tt, cid, 0, 0, 0)) + if (!AccessOK(tt, *cid, 0, 0, 0)) ABORT_WITH(tt, PRPERM); head = ntohl(cheader.orphan); } @@ -2095,19 +2154,22 @@ SPR_IsAMemberOf(call, uid, gid, flag) afs_int32 *flag; { afs_int32 code; + afs_int32 cid = ANONYMOUSID; - code = isAMemberOf(call, uid, gid, flag); + code = isAMemberOf(call, uid, gid, flag, &cid); osi_auditU(call, PTS_IsMemOfEvent, code, AUD_LONG, uid, AUD_LONG, gid, AUD_END); + ViceLog(5, ("PTS_IsAMemberOf: code %d cid %d uid %d gid %d", code, cid, uid, gid)); return code; } afs_int32 -isAMemberOf(call, uid, gid, flag) +isAMemberOf(call, uid, gid, flag, cid) struct rx_call *call; afs_int32 uid; afs_int32 gid; afs_int32 *flag; + afs_int32 *cid; { register afs_int32 code; struct ubik_trans *tt; @@ -2126,14 +2188,13 @@ isAMemberOf(call, uid, gid, flag) ABORT_WITH(tt, code); { - afs_int32 cid; afs_int32 uloc = FindByID(tt, uid); afs_int32 gloc = FindByID(tt, gid); struct prentry uentry, gentry; if (!uloc || !gloc) ABORT_WITH(tt, PRNOENT); - code = WhoIsThis(call, tt, &cid); + code = WhoIsThis(call, tt, cid); if (code) ABORT_WITH(tt, PRPERM); code = pr_ReadEntry(tt, 0, uloc, &uentry); @@ -2149,8 +2210,8 @@ isAMemberOf(call, uid, gid, flag) if (!(gentry.flags & PRGRP)) ABORT_WITH(tt, PRBADARG); #endif - if (!AccessOK(tt, cid, &uentry, 0, PRP_MEMBER_ANY) - && !AccessOK(tt, cid, &gentry, PRP_MEMBER_MEM, PRP_MEMBER_ANY)) + if (!AccessOK(tt, *cid, &uentry, 0, PRP_MEMBER_ANY) + && !AccessOK(tt, *cid, &gentry, PRP_MEMBER_MEM, PRP_MEMBER_ANY)) ABORT_WITH(tt, PRPERM); } -- 2.39.5