audit-add-and-fix-messages-20050708
[openafs.git] / src / ptserver / ptprocs.c
index 0fc8e71..cb006e6 100644 (file)
@@ -232,9 +232,9 @@ SPR_INewEntry(call, aname, aid, oid)
     afs_int32 cid = ANONYMOUSID;
 
     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));
+    osi_auditU(call, PTS_INewEntEvent, code, AUD_ID, aid, AUD_STR, aname,
+              AUD_ID, oid, AUD_END);
+    ViceLog(25, ("PTS_INewEntry: code %d cid %d aid %d aname %s oid %d", code, cid, aid, aname, oid));
     return code;
 }
 
@@ -312,9 +312,9 @@ SPR_NewEntry(call, aname, flag, oid, aid)
     afs_int32 cid = ANONYMOUSID;
 
     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));
+    osi_auditU(call, PTS_NewEntEvent, code, AUD_ID, *aid, AUD_STR, aname,
+              AUD_ID, oid, AUD_END);
+    ViceLog(25, ("PTS_NewEntry: code %d cid %d aid %d aname %s oid %d", code, cid, *aid, aname, oid));
     return code;
 }
 
@@ -384,9 +384,9 @@ SPR_WhereIsIt(call, aid, apos)
     afs_int32 cid = ANONYMOUSID;
 
     code = whereIsIt(call, aid, apos, &cid);
-    osi_auditU(call, PTS_WheIsItEvent, code, AUD_LONG, aid, AUD_LONG, *apos,
+    osi_auditU(call, PTS_WheIsItEvent, code, AUD_ID, aid, AUD_LONG, *apos,
               AUD_END);
-    ViceLog(5, ("PTS_WhereIsIt: code %d cid %d aid %d apos %d", code, cid, aid, *apos));
+    ViceLog(125, ("PTS_WhereIsIt: code %d cid %d aid %d apos %d", code, cid, aid, *apos));
     return code;
 }
 
@@ -440,7 +440,7 @@ SPR_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));
+    ViceLog(125, ("PTS_DumpEntry: code %d cid %d apos %d", code, cid, apos));
     return code;
 }
 
@@ -502,7 +502,7 @@ SPR_AddToGroup(call, aid, gid)
     afs_int32 cid = ANONYMOUSID;
 
     code = addToGroup(call, aid, gid, &cid);
-    osi_auditU(call, PTS_AdToGrpEvent, code, AUD_LONG, gid, AUD_LONG, aid,
+    osi_auditU(call, PTS_AdToGrpEvent, code, AUD_ID, gid, AUD_ID, aid,
               AUD_END);
     ViceLog(5, ("PTS_AddToGroup: code %d cid %d gid %d aid %d", code, cid, gid, aid));
     return code;
@@ -597,7 +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));
+    ViceLog(125, ("PTS_NameToID: code %d", code));
     return code;
 }
 
@@ -644,6 +644,11 @@ nameToID(call, aname, aid)
        code = NameToID(tt, aname->namelist_val[i], &aid->idlist_val[i]);
        if (code != PRSUCCESS)
            aid->idlist_val[i] = ANONYMOUSID;
+        osi_audit(PTS_NmToIdEvent, code, AUD_STR,
+                  aname->namelist_val[i], AUD_ID, aid->idlist_val[i], 
+                  AUD_END);
+       ViceLog(125, ("PTS_NameToID: code %d aname %s aid %d", code,
+                     aname->namelist_val[i], aid->idlist_val[i]));
        if (count++ > 50)
            IOMGR_Poll(), count = 0;
     }
@@ -669,8 +674,8 @@ SPR_IDToName(call, aid, aname)
     afs_int32 code;
 
     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));
+    osi_auditU(call, PTS_IdToNmEvent, code, AUD_END);
+    ViceLog(125, ("PTS_IDToName: code %d", code));
     return code;
 }
 
@@ -718,6 +723,10 @@ idToName(call, aid, aname)
        code = IDToName(tt, aid->idlist_val[i], aname->namelist_val[i]);
        if (code != PRSUCCESS)
            sprintf(aname->namelist_val[i], "%d", aid->idlist_val[i]);
+        osi_audit(PTS_IdToNmEvent, code, AUD_ID, aid->idlist_val[i],
+                 AUD_STR, aname->namelist_val[i], AUD_END);
+       ViceLog(125, ("PTS_idToName: code %d aid %d aname %s", code,
+                     aid->idlist_val[i], aname->namelist_val[i]));
        if (count++ > 50)
            IOMGR_Poll(), count = 0;
     }
@@ -738,8 +747,8 @@ SPR_Delete(call, aid)
     afs_int32 cid = ANONYMOUSID;
 
     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));
+    osi_auditU(call, PTS_DelEvent, code, AUD_ID, aid, AUD_END);
+    ViceLog(25, ("PTS_Delete: code %d cid %d aid %d", code, cid, aid));
     return code;
 }
 
@@ -980,7 +989,7 @@ SPR_UpdateEntry(call, aid, name, uentry)
     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);
+    osi_auditU(call, PTS_UpdEntEvent, code, AUD_ID, aid, AUD_STR, name, AUD_END);
     ViceLog(5, ("PTS_UpdateEntry: code %d cid %d aid %d name %s", code, cid, aid, name));
     return code;
 }
@@ -1077,7 +1086,7 @@ SPR_RemoveFromGroup(call, aid, gid)
     afs_int32 cid = ANONYMOUSID;
 
     code = removeFromGroup(call, aid, gid, &cid);
-    osi_auditU(call, PTS_RmFmGrpEvent, code, AUD_LONG, gid, AUD_LONG, aid,
+    osi_auditU(call, PTS_RmFmGrpEvent, code, AUD_ID, gid, AUD_ID, aid,
               AUD_END);
     ViceLog(5, ("PTS_RemoveFromGroup: code %d cid %d gid %d aid %d", code, cid, gid, aid));
     return code;
@@ -1167,8 +1176,8 @@ SPR_GetCPS(call, aid, alist, over)
     afs_int32 cid = ANONYMOUSID;
 
     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));
+    osi_auditU(call, PTS_GetCPSEvent, code, AUD_ID, aid, AUD_END);
+    ViceLog(125, ("PTS_GetCPS: code %d cid %d aid %d", code, cid, aid));
     return code;
 }
 
@@ -1251,9 +1260,9 @@ SPR_GetCPS2(call, aid, ahost, alist, over)
     afs_int32 cid = ANONYMOUSID;
 
     code = getCPS2(call, aid, ahost, alist, over, &cid);
-    osi_auditU(call, PTS_GetCPS2Event, code, AUD_LONG, aid, AUD_HOST, ahost,
+    osi_auditU(call, PTS_GetCPS2Event, code, AUD_ID, aid, AUD_HOST, ahost,
               AUD_END);
-    ViceLog(5, ("PTS_GetCPS2: code %d cid %d aid %d ahost %d", code, cid, aid, ahost));
+    ViceLog(125, ("PTS_GetCPS2: code %d cid %d aid %d ahost %d", code, cid, aid, ahost));
     return code;
 }
 
@@ -1348,7 +1357,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));
+    ViceLog(125, ("PTS_GetHostCPS: code %d ahost %d", code, ahost));
     return code;
 }
 
@@ -1421,7 +1430,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));
+    ViceLog(125, ("PTS_ListMax: code %d", code));
     return code;
 }
 
@@ -1467,9 +1476,9 @@ SPR_SetMax(call, aid, gflag)
     afs_int32 cid = ANONYMOUSID;
 
     code = setMax(call, aid, gflag, &cid);
-    osi_auditU(call, PTS_SetMaxEvent, code, AUD_LONG, aid, AUD_LONG, gflag,
+    osi_auditU(call, PTS_SetMaxEvent, code, AUD_ID, aid, AUD_LONG, gflag,
               AUD_END);
-    ViceLog(5, ("PTS_SetMax: code %d cid %d aid %d gflag %d", code, cid, aid, gflag));
+    ViceLog(125, ("PTS_SetMax: code %d cid %d aid %d gflag %d", code, cid, aid, gflag));
     return code;
 }
 
@@ -1523,9 +1532,9 @@ SPR_ListEntry(call, aid, aentry)
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
 
-    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));
+    code = listEntry(call, aid, aentry, &cid);
+    osi_auditU(call, PTS_LstEntEvent, code, AUD_ID, aid, AUD_END);
+    ViceLog(125, ("PTS_ListEntry: code %d cid %d aid %d", code, cid, aid));
     return code;
 }
 
@@ -1600,7 +1609,7 @@ SPR_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));
+    ViceLog(125, ("PTS_ListEntries: code %d cid %d flag %d", code, cid, flag));
     return code;
 }
 
@@ -1744,7 +1753,7 @@ SPR_ChangeEntry(call, aid, name, oid, newid)
     afs_int32 cid = ANONYMOUSID;
 
     code = changeEntry(call, aid, name, oid, newid, &cid);
-    osi_auditU(call, PTS_ChgEntEvent, code, AUD_LONG, aid, AUD_STR, name,
+    osi_auditU(call, PTS_ChgEntEvent, code, AUD_ID, 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;
@@ -1814,7 +1823,7 @@ SPR_SetFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1, spare2)
     code =
        setFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1,
                       spare2, &cid);
-    osi_auditU(call, PTS_SetFldEntEvent, code, AUD_LONG, id, AUD_END);
+    osi_auditU(call, PTS_SetFldEntEvent, code, AUD_ID, id, AUD_END);
     ViceLog(5, ("PTS_SetFieldsEntry: code %d cid %d id %d", code, cid, id));
     return code;
 }
@@ -1916,8 +1925,8 @@ SPR_ListElements(call, aid, alist, over)
     afs_int32 cid = ANONYMOUSID;
 
     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));
+    osi_auditU(call, PTS_LstEleEvent, code, AUD_ID, aid, AUD_END);
+    ViceLog(125, ("PTS_ListElements: code %d cid %d aid %d", code, cid, aid));
     return code;
 }
 
@@ -1985,8 +1994,8 @@ SPR_ListSuperGroups(call, aid, alist, over)
     afs_int32 cid = ANONYMOUSID;
 
     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));
+    osi_auditU(call, PTS_LstSGrps, code, AUD_ID, aid, AUD_END);
+    ViceLog(125, ("PTS_ListSuperGroups: code %d cid %d aid %d", code, cid, aid));
     return code;
 #else
     return RXGEN_OPCODE;
@@ -2065,8 +2074,8 @@ SPR_ListOwned(call, aid, alist, lastP)
     afs_int32 cid = ANONYMOUSID;
 
     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));
+    osi_auditU(call, PTS_LstOwnEvent, code, AUD_ID, aid, AUD_END);
+    ViceLog(125, ("PTS_ListOwned: code %d cid %d aid %d", code, cid, aid));
     return code;
 }
 
@@ -2159,7 +2168,7 @@ SPR_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));
+    ViceLog(125, ("PTS_IsAMemberOf: code %d cid %d uid %d gid %d", code, cid, uid, gid));
     return code;
 }