ptserver-procs-loglevels-20090603
[openafs.git] / src / ptserver / ptprocs.c
index a79201a..4c4e099 100644 (file)
@@ -84,24 +84,69 @@ RCSID
 
 extern int restricted;
 extern struct ubik_dbase *dbase;
-extern afs_int32 Initdb();
 extern int pr_noAuth;
 extern afs_int32 initd;
 extern char *pr_realmName;
-afs_int32 iNewEntry(), newEntry(), whereIsIt(), dumpEntry(), addToGroup(),
-nameToID(), Delete(), removeFromGroup();
-afs_int32 getCPS(), getCPS2(), getHostCPS(), listMax(), setMax(), listEntry();
-afs_int32 listEntries(), changeEntry(), setFieldsEntry(), put_prentries();
-afs_int32 listElements(), listOwned(), isAMemberOf(), idToName();
+extern int prp_group_default;
+extern int prp_user_default;
 
+static afs_int32 iNewEntry(struct rx_call *call, char aname[], afs_int32 aid, 
+                          afs_int32 oid, afs_int32 *cid);
+static afs_int32 newEntry(struct rx_call *call, char aname[], afs_int32 flag, 
+                         afs_int32 oid, afs_int32 *aid, afs_int32 *cid);       
+static afs_int32 whereIsIt(struct rx_call *call, afs_int32 aid, afs_int32 *apos,
+                          afs_int32 *cid);
+static afs_int32 dumpEntry(struct rx_call *call, afs_int32 apos, 
+                          struct prdebugentry *aentry, afs_int32 *cid);
+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 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 removeFromGroup(struct rx_call *call, afs_int32 aid, 
+                                afs_int32 gid, afs_int32 *cid);
+static afs_int32 getCPS(struct rx_call *call, afs_int32 aid, prlist *alist, 
+                       afs_int32 *over, afs_int32 *cid);
+static afs_int32 getCPS2(struct rx_call *call, afs_int32 aid, afs_int32 ahost,
+                        prlist *alist, afs_int32 *over, afs_int32 *cid);
+static afs_int32 getHostCPS(struct rx_call *call, afs_int32 ahost, 
+                           prlist *alist, afs_int32 *over);
+static afs_int32 listMax(struct rx_call *call, afs_int32 *uid, afs_int32 *gid);
+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, 
+                          struct prcheckentry *aentry, afs_int32 *cid);
+static afs_int32 listEntries(struct rx_call *call, afs_int32 flag, 
+                            afs_int32 startindex, prentries *bulkentries, 
+                            afs_int32 *nextstartindex, afs_int32 *cid);
+static afs_int32 put_prentries(struct prentry *tentry, prentries *bulkentries);
+static afs_int32 changeEntry(struct rx_call *call, afs_int32 aid, char *name, 
+                            afs_int32 oid, afs_int32 newid, afs_int32 *cid);
+static afs_int32 setFieldsEntry(struct rx_call *call, afs_int32 id, 
+                               afs_int32 mask, afs_int32 flags, 
+                               afs_int32 ngroups, afs_int32 nusers, 
+                               afs_int32 spare1, afs_int32 spare2, 
+                               afs_int32 *cid);
+static afs_int32 listElements(struct rx_call *call, afs_int32 aid,
+                             prlist *alist, afs_int32 *over, afs_int32 *cid);
 #if defined(SUPERGROUPS)
-afs_int32 listSuperGroups();
+static afs_int32 listSuperGroups(struct rx_call *call, afs_int32 aid, 
+                                prlist *alist, afs_int32 *over, 
+                                afs_int32 *cid);
 #endif
-
-extern int IDCmp();
-
-extern int prp_group_default;
-extern int prp_user_default;
+static afs_int32 listOwned(struct rx_call *call, afs_int32 aid, prlist *alist,
+                          afs_int32 *lastP, afs_int32 *cid);
+static afs_int32 isAMemberOf(struct rx_call *call, afs_int32 uid, afs_int32 gid,
+                            afs_int32 *flag, afs_int32 *cid);
+#if IP_WILDCARDS
+static afs_int32 addWildCards(struct ubik_trans *tt, prlist *alist, 
+                             afs_int32 host);
+#endif
+static afs_int32 WhoIsThisWithName(struct rx_call *acall, 
+                                  struct ubik_trans *at, afs_int32 *aid, 
+                                  char *aname);
 
 /* When abort, reset initd so that the header is read in on next call.
  * Abort the transaction and return the code.
@@ -109,12 +154,8 @@ extern int prp_user_default;
 #define ABORT_WITH(tt,code) return(initd=0,ubik_AbortTrans(tt),code)
 
 static int
-CreateOK(ut, cid, oid, flag, admin)
-     struct ubik_trans *ut;
-     afs_int32 cid;            /* id of caller */
-     afs_int32 oid;            /* id of owner */
-     afs_int32 flag;           /* indicates type of entry */
-     int admin;                        /* sysadmin membership */
+CreateOK(struct ubik_trans *ut, afs_int32 cid, afs_int32 oid, afs_int32 flag, 
+        int admin)
 {
     if (restricted && !admin) 
        return 0;
@@ -140,10 +181,7 @@ CreateOK(ut, cid, oid, flag, admin)
 }
 
 afs_int32
-WhoIsThis(acall, at, aid)
-     struct rx_call *acall;
-     struct ubik_trans *at;
-     afs_int32 *aid;
+WhoIsThis(struct rx_call *acall, struct ubik_trans *at, afs_int32 *aid)
 {
     int foreign = 0;
     /* aid is set to the identity of the caller, if known, else ANONYMOUSID */
@@ -177,7 +215,7 @@ WhoIsThis(acall, at, aid)
            foreign = afs_is_foreign_ticket_name(name,inst,tcell,pr_realmName);
 
        strncpy(vname, name, sizeof(vname));
-       if (ilen = strlen(inst)) {
+       if ((ilen = strlen(inst))) {
            if (strlen(vname) + 1 + ilen >= sizeof(vname))
                goto done;
            strcat(vname, ".");
@@ -203,11 +241,7 @@ WhoIsThis(acall, at, aid)
 }
 
 afs_int32
-SPR_INewEntry(call, aname, aid, oid)
-     struct rx_call *call;
-     char aname[PR_MAXNAMELEN];
-     afs_int32 aid;
-     afs_int32 oid;
+SPR_INewEntry(struct rx_call *call, char aname[], afs_int32 aid, afs_int32 oid)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
@@ -215,17 +249,13 @@ SPR_INewEntry(call, aname, aid, oid)
     code = iNewEntry(call, aname, aid, oid, &cid);
     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));
+    ViceLog(5, ("PTS_INewEntry: code %d cid %d aid %d aname %s oid %d\n", code, cid, aid, aname, oid));
     return code;
 }
 
-afs_int32
-iNewEntry(call, aname, aid, oid, cid)
-     struct rx_call *call;
-     char aname[PR_MAXNAMELEN];
-     afs_int32 aid;
-     afs_int32 oid;
-     afs_int32 * cid;
+static afs_int32
+iNewEntry(struct rx_call *call, char aname[], 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. */
@@ -282,12 +312,8 @@ iNewEntry(call, aname, aid, oid, cid)
 
 
 afs_int32
-SPR_NewEntry(call, aname, flag, oid, aid)
-     struct rx_call *call;
-     char aname[PR_MAXNAMELEN];
-     afs_int32 flag;
-     afs_int32 oid;
-     afs_int32 *aid;
+SPR_NewEntry(struct rx_call *call, char aname[], afs_int32 flag, afs_int32 oid, 
+            afs_int32 *aid)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
@@ -295,23 +321,17 @@ SPR_NewEntry(call, aname, flag, oid, aid)
     code = newEntry(call, aname, flag, oid, aid, &cid);
     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));
+    ViceLog(5, ("PTS_NewEntry: code %d cid %d aid %d aname %s oid %d\n", code, cid, *aid, aname, oid));
     return code;
 }
 
-afs_int32
-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;
+static afs_int32
+newEntry(struct rx_call *call, char aname[], afs_int32 flag, afs_int32 oid, 
+        afs_int32 *aid, afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
     int admin;
-    extern afs_int32 WhoIsThisWithName();
     char cname[PR_MAXNAMELEN];
     stolower(aname);
     code = Initdb();
@@ -356,10 +376,7 @@ newEntry(call, aname, flag, oid, aid, cid)
 
 
 afs_int32
-SPR_WhereIsIt(call, aid, apos)
-     struct rx_call *call;
-     afs_int32 aid;
-     afs_int32 *apos;
+SPR_WhereIsIt(struct rx_call *call, afs_int32 aid, afs_int32 *apos)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
@@ -367,16 +384,12 @@ SPR_WhereIsIt(call, aid, apos)
     code = whereIsIt(call, aid, apos, &cid);
     osi_auditU(call, PTS_WheIsItEvent, code, AUD_ID, aid, AUD_LONG, *apos,
               AUD_END);
-    ViceLog(125, ("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\n", code, cid, aid, *apos));
     return code;
 }
 
-afs_int32
-whereIsIt(call, aid, apos, cid)
-     struct rx_call *call;
-     afs_int32 aid;
-     afs_int32 *apos;
-     afs_int32 *cid;
+static afs_int32
+whereIsIt(struct rx_call *call, afs_int32 aid, afs_int32 *apos, afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -411,26 +424,21 @@ whereIsIt(call, aid, apos, cid)
 
 
 afs_int32
-SPR_DumpEntry(call, apos, aentry)
-     struct rx_call *call;
-     afs_int32 apos;
-     struct prdebugentry *aentry;
+SPR_DumpEntry(struct rx_call *call, afs_int32 apos, 
+             struct prdebugentry *aentry)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
 
     code = dumpEntry(call, apos, aentry, &cid);
     osi_auditU(call, PTS_DmpEntEvent, code, AUD_LONG, apos, AUD_END);
-    ViceLog(125, ("PTS_DumpEntry: code %d cid %d apos %d", code, cid, apos));
+    ViceLog(125, ("PTS_DumpEntry: code %d cid %d apos %d\n", code, cid, apos));
     return code;
 }
 
-afs_int32
-dumpEntry(call, apos, aentry, cid)
-     struct rx_call *call;
-     afs_int32 apos;
-     struct prdebugentry *aentry;
-     afs_int32 *cid;
+static afs_int32
+dumpEntry(struct rx_call *call, afs_int32 apos, struct prdebugentry *aentry, 
+         afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -451,7 +459,7 @@ dumpEntry(call, apos, aentry, cid)
     code = WhoIsThis(call, tt, cid);
     if (code)
        ABORT_WITH(tt, PRPERM);
-    code = pr_ReadEntry(tt, 0, apos, aentry);
+    code = pr_ReadEntry(tt, 0, apos, (struct prentry *)aentry);
     if (code)
        ABORT_WITH(tt, code);
 
@@ -474,10 +482,7 @@ dumpEntry(call, apos, aentry, cid)
 }
 
 afs_int32
-SPR_AddToGroup(call, aid, gid)
-     struct rx_call *call;
-     afs_int32 aid;
-     afs_int32 gid;
+SPR_AddToGroup(struct rx_call *call, afs_int32 aid, afs_int32 gid)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
@@ -485,16 +490,12 @@ SPR_AddToGroup(call, aid, gid)
     code = addToGroup(call, aid, gid, &cid);
     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));
+    ViceLog(5, ("PTS_AddToGroup: code %d cid %d gid %d aid %d\n", code, cid, gid, aid));
     return code;
 }
 
-afs_int32
-addToGroup(call, aid, gid, cid)
-     struct rx_call *call;
-     afs_int32 aid;
-     afs_int32 gid;
-     afs_int32 *cid;
+static afs_int32
+addToGroup(struct rx_call *call, afs_int32 aid, afs_int32 gid, afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -569,24 +570,18 @@ addToGroup(call, aid, gid, cid)
 }
 
 afs_int32
-SPR_NameToID(call, aname, aid)
-     struct rx_call *call;
-     namelist *aname;
-     idlist *aid;
+SPR_NameToID(struct rx_call *call, namelist *aname, idlist *aid)
 {
     afs_int32 code;
 
     code = nameToID(call, aname, aid);
     osi_auditU(call, PTS_NmToIdEvent, code, AUD_END);
-    ViceLog(125, ("PTS_NameToID: code %d", code));
+    ViceLog(125, ("PTS_NameToID: code %d\n", code));
     return code;
 }
 
-afs_int32
-nameToID(call, aname, aid)
-     struct rx_call *call;
-     namelist *aname;
-     idlist *aid;
+static afs_int32
+nameToID(struct rx_call *call, namelist *aname, idlist *aid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -645,10 +640,14 @@ nameToID(call, aname, aid)
         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,
+       ViceLog(125, ("PTS_NameToID: code %d aname %s aid %d\n", code,
                      aname->namelist_val[i], aid->idlist_val[i]));
-       if (count++ > 50)
-           IOMGR_Poll(), count = 0;
+       if (count++ > 50) {
+#ifndef AFS_PTHREAD_ENV
+           IOMGR_Poll();
+#endif
+           count = 0;
+       }
     }
     aid->idlist_len = aname->namelist_len;
 
@@ -664,24 +663,18 @@ nameToID(call, aname, aid)
  * The array of ids and names is unlimited.
  */
 afs_int32
-SPR_IDToName(call, aid, aname)
-     struct rx_call *call;
-     idlist *aid;
-     namelist *aname;
+SPR_IDToName(struct rx_call *call, idlist *aid, namelist *aname)
 {
     afs_int32 code;
 
     code = idToName(call, aid, aname);
     osi_auditU(call, PTS_IdToNmEvent, code, AUD_END);
-    ViceLog(125, ("PTS_IDToName: code %d", code));
+    ViceLog(125, ("PTS_IDToName: code %d\n", code));
     return code;
 }
 
-afs_int32
-idToName(call, aid, aname)
-     struct rx_call *call;
-     idlist *aid;
-     namelist *aname;
+static afs_int32
+idToName(struct rx_call *call, idlist *aid, namelist *aname)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -723,10 +716,14 @@ idToName(call, aid, aname)
            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,
+       ViceLog(125, ("PTS_idToName: code %d aid %d aname %s\n", code,
                      aid->idlist_val[i], aname->namelist_val[i]));
-       if (count++ > 50)
-           IOMGR_Poll(), count = 0;
+       if (count++ > 50) {
+#ifndef AFS_PTHREAD_ENV
+           IOMGR_Poll();
+#endif
+           count = 0;
+       }
     }
     aname->namelist_len = aid->idlist_len;
 
@@ -737,24 +734,19 @@ idToName(call, aid, aname)
 }
 
 afs_int32
-SPR_Delete(call, aid)
-     struct rx_call *call;
-     afs_int32 aid;
+SPR_Delete(struct rx_call *call, afs_int32 aid)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
 
     code = Delete(call, aid, &cid);
     osi_auditU(call, PTS_DelEvent, code, AUD_ID, aid, AUD_END);
-    ViceLog(25, ("PTS_Delete: code %d cid %d aid %d", code, cid, aid));
+    ViceLog(5, ("PTS_Delete: code %d cid %d aid %d\n", code, cid, aid));
     return code;
 }
 
-afs_int32
-Delete(call, aid, cid)
-     struct rx_call *call;
-     afs_int32 aid;
-     afs_int32 *cid;
+static afs_int32
+Delete(struct rx_call *call, afs_int32 aid, afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -821,8 +813,10 @@ Delete(call, aid, cid)
            if (code)
                ABORT_WITH(tt, code);
            tentry.count--;     /* maintain count */
+#ifndef AFS_PTHREAD_ENV
            if ((i & 3) == 0)
                IOMGR_Poll();
+#endif
        }
        tentry.next = centry.next;      /* thread out this block */
        code = FreeBlock(tt, nptr);     /* free continuation block */
@@ -836,7 +830,9 @@ Delete(call, aid, cid)
        code = ubik_EndTrans(tt);
        if (code)
            return code;
+#ifndef AFS_PTHREAD_ENV
        IOMGR_Poll();           /* just to keep the connection alive */
+#endif
        code = ubik_BeginTrans(dbase, UBIK_WRITETRANS, &tt);
        if (code)
            return code;
@@ -877,8 +873,10 @@ Delete(call, aid, cid)
                if (code)
                    ABORT_WITH(tt, code);
                tentryg->countsg--;     /* maintain count */
+#ifndef AFS_PTHREAD_ENV
                if ((i & 3) == 0)
                    IOMGR_Poll();
+#endif
            }
            tentryg->nextsg = centry.next;      /* thread out this block */
            code = FreeBlock(tt, nptr); /* free continuation block */
@@ -892,7 +890,9 @@ Delete(call, aid, cid)
            code = ubik_EndTrans(tt);
            if (code)
                return code;
+#ifndef AFS_PTHREAD_ENV
            IOMGR_Poll();       /* just to keep the connection alive */
+#endif
 
            code = ubik_BeginTrans(dbase, UBIK_WRITETRANS, &tt);
            if (code)
@@ -933,8 +933,10 @@ Delete(call, aid, cid)
            if (code)
                ABORT_WITH(tt, code);
            count++;
+#ifndef AFS_PTHREAD_ENV
            if ((count & 3) == 0)
                IOMGR_Poll();
+#endif
        }
        if (count < 50)
            continue;
@@ -946,7 +948,9 @@ Delete(call, aid, cid)
        code = ubik_EndTrans(tt);
        if (code)
            return code;
+#ifndef AFS_PTHREAD_ENV
        IOMGR_Poll();           /* just to keep the connection alive */
+#endif
        code = ubik_BeginTrans(dbase, UBIK_WRITETRANS, &tt);
        if (code)
            return code;
@@ -977,28 +981,21 @@ Delete(call, aid, cid)
 }
 
 afs_int32
-SPR_UpdateEntry(call, aid, name, uentry)
-     struct rx_call *call;
-     afs_int32 aid;
-     char *name;
-     struct PrUpdateEntry *uentry;
+SPR_UpdateEntry(struct rx_call *call, 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_ID, aid, AUD_STR, name, AUD_END);
-    ViceLog(5, ("PTS_UpdateEntry: code %d cid %d aid %d name %s", code, cid, aid, name));
+    ViceLog(5, ("PTS_UpdateEntry: code %d cid %d aid %d name %s\n", 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;
+UpdateEntry(struct rx_call *call, afs_int32 aid, char *name, 
+           struct PrUpdateEntry *uentry, afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -1075,10 +1072,7 @@ UpdateEntry(call, aid, name, uentry, cid)
 }
 
 afs_int32
-SPR_RemoveFromGroup(call, aid, gid)
-     struct rx_call *call;
-     afs_int32 aid;
-     afs_int32 gid;
+SPR_RemoveFromGroup(struct rx_call *call, afs_int32 aid, afs_int32 gid)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
@@ -1086,16 +1080,13 @@ SPR_RemoveFromGroup(call, aid, gid)
     code = removeFromGroup(call, aid, gid, &cid);
     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));
+    ViceLog(5, ("PTS_RemoveFromGroup: code %d cid %d gid %d aid %d\n", code, cid, gid, aid));
     return code;
 }
 
-afs_int32
-removeFromGroup(call, aid, gid, cid)
-     struct rx_call *call;
-     afs_int32 aid;
-     afs_int32 gid;
-     afs_int32 *cid;
+static afs_int32
+removeFromGroup(struct rx_call *call, afs_int32 aid, afs_int32 gid, 
+               afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -1164,28 +1155,20 @@ removeFromGroup(call, aid, gid, cid)
 
 
 afs_int32
-SPR_GetCPS(call, aid, alist, over)
-     struct rx_call *call;
-     afs_int32 aid;
-     prlist *alist;
-     afs_int32 *over;
+SPR_GetCPS(struct rx_call *call, afs_int32 aid, prlist *alist, afs_int32 *over)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
 
     code = getCPS(call, aid, alist, over, &cid);
     osi_auditU(call, PTS_GetCPSEvent, code, AUD_ID, aid, AUD_END);
-    ViceLog(125, ("PTS_GetCPS: code %d cid %d aid %d", code, cid, aid));
+    ViceLog(125, ("PTS_GetCPS: code %d cid %d aid %d\n", code, cid, aid));
     return code;
 }
 
-afs_int32
-getCPS(call, aid, alist, over, cid)
-     struct rx_call *call;
-     afs_int32 aid;
-     prlist *alist;
-     afs_int32 *over;
-     afs_int32 *cid;
+static afs_int32
+getCPS(struct rx_call *call, afs_int32 aid, prlist *alist, afs_int32 *over, 
+       afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -1231,9 +1214,7 @@ getCPS(call, aid, alist, over, cid)
 
 #ifdef IP_WILDCARDS
 int
-inCPS(CPS, id)
-     prlist CPS;
-     afs_int32 id;
+inCPS(prlist CPS, afs_int32 id)
 {
     int i;
 
@@ -1247,12 +1228,8 @@ inCPS(CPS, id)
 
 
 afs_int32
-SPR_GetCPS2(call, aid, ahost, alist, over)
-     struct rx_call *call;
-     afs_int32 aid;
-     afs_int32 ahost;
-     prlist *alist;
-     afs_int32 *over;
+SPR_GetCPS2(struct rx_call *call, afs_int32 aid, afs_int32 ahost, 
+           prlist *alist, afs_int32 *over)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
@@ -1260,18 +1237,13 @@ SPR_GetCPS2(call, aid, ahost, alist, over)
     code = getCPS2(call, aid, ahost, alist, over, &cid);
     osi_auditU(call, PTS_GetCPS2Event, code, AUD_ID, aid, AUD_HOST, ahost,
               AUD_END);
-    ViceLog(125, ("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\n", code, cid, aid, ahost));
     return code;
 }
 
-afs_int32
-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;
+static afs_int32
+getCPS2(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;
@@ -1281,9 +1253,6 @@ getCPS2(call, aid, ahost, alist, over, cid)
     afs_int32 hostid;
     int host_list = 0;
     struct in_addr iaddr;
-#if IP_WILDCARDS
-    extern afs_int32 addWildCards();
-#endif /* IP_WILDCARDS */
 
     *over = 0;
     iaddr.s_addr = ntohl(ahost);
@@ -1345,35 +1314,26 @@ getCPS2(call, aid, ahost, alist, over, cid)
 
 
 afs_int32
-SPR_GetHostCPS(call, ahost, alist, over)
-     struct rx_call *call;
-     afs_int32 ahost;
-     prlist *alist;
-     afs_int32 *over;
+SPR_GetHostCPS(struct rx_call *call, afs_int32 ahost, prlist *alist, 
+              afs_int32 *over)
 {
     afs_int32 code;
 
     code = getHostCPS(call, ahost, alist, over);
     osi_auditU(call, PTS_GetHCPSEvent, code, AUD_HOST, ahost, AUD_END);
-    ViceLog(125, ("PTS_GetHostCPS: code %d ahost %d", code, ahost));
+    ViceLog(125, ("PTS_GetHostCPS: code %d ahost %d\n", code, ahost));
     return code;
 }
 
 afs_int32
-getHostCPS(call, ahost, alist, over)
-     struct rx_call *call;
-     afs_int32 ahost;
-     prlist *alist;
-     afs_int32 *over;
+getHostCPS(struct rx_call *call, afs_int32 ahost, prlist *alist, 
+          afs_int32 *over)
 {
     register afs_int32 code, temp;
     struct ubik_trans *tt;
     struct prentry host_tentry;
     afs_int32 hostid;
     struct in_addr iaddr;
-#if IP_WILDCARDS
-    extern afs_int32 addWildCards();
-#endif /* IP_WILDCARDS */
 
     *over = 0;
     iaddr.s_addr = ntohl(ahost);
@@ -1419,24 +1379,18 @@ getHostCPS(call, ahost, alist, over)
 
 
 afs_int32
-SPR_ListMax(call, uid, gid)
-     struct rx_call *call;
-     afs_int32 *uid;
-     afs_int32 *gid;
+SPR_ListMax(struct rx_call *call, afs_int32 *uid, afs_int32 *gid)
 {
     afs_int32 code;
 
     code = listMax(call, uid, gid);
     osi_auditU(call, PTS_LstMaxEvent, code, AUD_END);
-    ViceLog(125, ("PTS_ListMax: code %d", code));
+    ViceLog(125, ("PTS_ListMax: code %d\n", code));
     return code;
 }
 
 afs_int32
-listMax(call, uid, gid)
-     struct rx_call *call;
-     afs_int32 *uid;
-     afs_int32 *gid;
+listMax(struct rx_call *call, afs_int32 *uid, afs_int32 *gid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -1465,10 +1419,7 @@ listMax(call, uid, gid)
 }
 
 afs_int32
-SPR_SetMax(call, aid, gflag)
-     struct rx_call *call;
-     afs_int32 aid;
-     afs_int32 gflag;
+SPR_SetMax(struct rx_call *call, afs_int32 aid, afs_int32 gflag)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
@@ -1476,16 +1427,12 @@ SPR_SetMax(call, aid, gflag)
     code = setMax(call, aid, gflag, &cid);
     osi_auditU(call, PTS_SetMaxEvent, code, AUD_ID, aid, AUD_LONG, gflag,
               AUD_END);
-    ViceLog(125, ("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\n", code, cid, aid, gflag));
     return code;
 }
 
-afs_int32
-setMax(call, aid, gflag, cid)
-     struct rx_call *call;
-     afs_int32 aid;
-     afs_int32 gflag;
-     afs_int32 *cid;
+static afs_int32
+setMax(struct rx_call *call, afs_int32 aid, afs_int32 gflag, afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -1522,26 +1469,20 @@ setMax(call, aid, gflag, cid)
 }
 
 afs_int32
-SPR_ListEntry(call, aid, aentry)
-     struct rx_call *call;
-     afs_int32 aid;
-     struct prcheckentry *aentry;
+SPR_ListEntry(struct rx_call *call, afs_int32 aid, struct prcheckentry *aentry)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
 
     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));
+    ViceLog(125, ("PTS_ListEntry: code %d cid %d aid %d\n", code, cid, aid));
     return code;
 }
 
-afs_int32
-listEntry(call, aid, aentry, cid)
-     struct rx_call *call;
-     afs_int32 aid;
-     struct prcheckentry *aentry;
-     afs_int32 *cid;
+static afs_int32
+listEntry(struct rx_call *call, afs_int32 aid, struct prcheckentry *aentry, 
+         afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -1595,30 +1536,21 @@ listEntry(call, aid, aentry, cid)
 }
 
 afs_int32
-SPR_ListEntries(call, flag, startindex, bulkentries, nextstartindex)
-     struct rx_call *call;
-     afs_int32 flag;
-     afs_int32 startindex;
-     prentries *bulkentries;
-     afs_int32 *nextstartindex;
+SPR_ListEntries(struct rx_call *call, afs_int32 flag, afs_int32 startindex, 
+               prentries *bulkentries, afs_int32 *nextstartindex)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
 
     code = listEntries(call, flag, startindex, bulkentries, nextstartindex, &cid);
     osi_auditU(call, PTS_LstEntsEvent, code, AUD_LONG, flag, AUD_END);
-    ViceLog(125, ("PTS_ListEntries: code %d cid %d flag %d", code, cid, flag));
+    ViceLog(125, ("PTS_ListEntries: code %d cid %d flag %d\n", code, cid, flag));
     return code;
 }
 
-afs_int32
-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;
+static afs_int32
+listEntries(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;
@@ -1662,7 +1594,9 @@ listEntries(call, flag, startindex, bulkentries, nextstartindex, cid)
            goto done;
 
        if (++pollcount > 50) {
+#ifndef AFS_PTHREAD_ENV
            IOMGR_Poll();
+#endif
            pollcount = 0;
        }
 
@@ -1696,10 +1630,8 @@ listEntries(call, flag, startindex, bulkentries, nextstartindex, cid)
 }
 
 #define PR_MAXENTRIES 500
-afs_int32
-put_prentries(tentry, bulkentries)
-     struct prentry *tentry;
-     prentries *bulkentries;
+static afs_int32
+put_prentries(struct prentry *tentry, prentries *bulkentries)
 {
     struct prlistentries *entry;
 
@@ -1740,12 +1672,8 @@ put_prentries(tentry, bulkentries)
 }
 
 afs_int32
-SPR_ChangeEntry(call, aid, name, oid, newid)
-     struct rx_call *call;
-     afs_int32 aid;
-     char *name;
-     afs_int32 oid;
-     afs_int32 newid;
+SPR_ChangeEntry(struct rx_call *call, afs_int32 aid, char *name, afs_int32 oid, 
+               afs_int32 newid)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
@@ -1753,18 +1681,13 @@ SPR_ChangeEntry(call, aid, name, oid, newid)
     code = changeEntry(call, aid, name, oid, newid, &cid);
     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));
+    ViceLog(5, ("PTS_ChangeEntry: code %d cid %d aid %d name %s oid %d newid %d\n", code, cid, aid, name, oid, newid));
     return code;
 }
 
-afs_int32
-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;
+static afs_int32
+changeEntry(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;
@@ -1808,12 +1731,11 @@ changeEntry(call, aid, name, oid, newid, cid)
 }
 
 afs_int32
-SPR_SetFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1, spare2)
-     struct rx_call *call;
-     afs_int32 id;
-     afs_int32 mask;           /* specify which fields to update */
-     afs_int32 flags, ngroups, nusers;
-     afs_int32 spare1, spare2;
+SPR_SetFieldsEntry(struct rx_call *call, 
+                  afs_int32 id, 
+                  afs_int32 mask, /* specify which fields to update */ 
+                  afs_int32 flags, afs_int32 ngroups, afs_int32 nusers, 
+                  afs_int32 spare1, afs_int32 spare2)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
@@ -1822,18 +1744,16 @@ SPR_SetFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1, spare2)
        setFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1,
                       spare2, &cid);
     osi_auditU(call, PTS_SetFldEntEvent, code, AUD_ID, id, AUD_END);
-    ViceLog(5, ("PTS_SetFieldsEntry: code %d cid %d id %d", code, cid, id));
+    ViceLog(5, ("PTS_SetFieldsEntry: code %d cid %d id %d\n", code, cid, id));
     return code;
 }
 
-afs_int32
-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;
+static afs_int32
+setFieldsEntry(struct rx_call *call, 
+              afs_int32 id, 
+              afs_int32 mask, /* specify which fields to update */ 
+              afs_int32 flags, afs_int32 ngroups, afs_int32 nusers, 
+              afs_int32 spare1, afs_int32 spare2, afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -1913,28 +1833,21 @@ setFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1, spare2, cid)
 }
 
 afs_int32
-SPR_ListElements(call, aid, alist, over)
-     struct rx_call *call;
-     afs_int32 aid;
-     prlist *alist;
-     afs_int32 *over;
+SPR_ListElements(struct rx_call *call, afs_int32 aid, prlist *alist, 
+                afs_int32 *over)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
 
     code = listElements(call, aid, alist, over, &cid);
     osi_auditU(call, PTS_LstEleEvent, code, AUD_ID, aid, AUD_END);
-    ViceLog(125, ("PTS_ListElements: code %d cid %d aid %d", code, cid, aid));
+    ViceLog(125, ("PTS_ListElements: code %d cid %d aid %d\n", code, cid, aid));
     return code;
 }
 
-afs_int32
-listElements(call, aid, alist, over, cid)
-     struct rx_call *call;
-     afs_int32 aid;
-     prlist *alist;
-     afs_int32 *over;
-     afs_int32 *cid;
+static afs_int32
+listElements(struct rx_call *call, afs_int32 aid, prlist *alist, 
+            afs_int32 *over, afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -1981,11 +1894,8 @@ listElements(call, aid, alist, over, cid)
 
 
 afs_int32
-SPR_ListSuperGroups(call, aid, alist, over)
-     struct rx_call *call;
-     afs_int32 aid;
-     prlist *alist;
-     afs_int32 *over;
+SPR_ListSuperGroups(struct rx_call *call, afs_int32 aid, prlist *alist, 
+                   afs_int32 *over)
 {
 #if defined(SUPERGROUPS)
     afs_int32 code;
@@ -1993,7 +1903,7 @@ SPR_ListSuperGroups(call, aid, alist, over)
 
     code = listSuperGroups(call, aid, alist, over, &cid);
     osi_auditU(call, PTS_LstSGrps, code, AUD_ID, aid, AUD_END);
-    ViceLog(125, ("PTS_ListSuperGroups: code %d cid %d aid %d", code, cid, aid));
+    ViceLog(125, ("PTS_ListSuperGroups: code %d cid %d aid %d\n", code, cid, aid));
     return code;
 #else
     return RXGEN_OPCODE;
@@ -2001,13 +1911,9 @@ SPR_ListSuperGroups(call, aid, alist, over)
 }
 
 #if defined(SUPERGROUPS)
-afs_int32
-listSuperGroups(call, aid, alist, over, cid)
-     struct rx_call *call;
-     afs_int32 aid;
-     prlist *alist;
-     afs_int32 *over;
-     afs_int32 *cid;
+static afs_int32
+listSuperGroups(struct rx_call *call, afs_int32 aid, prlist *alist, 
+               afs_int32 *over, afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -2062,28 +1968,21 @@ listSuperGroups(call, aid, alist, over, cid)
  * maximum value is enforced in GetOwnedChain().
  */
 afs_int32
-SPR_ListOwned(call, aid, alist, lastP)
-     struct rx_call *call;
-     afs_int32 aid;
-     prlist *alist;
-     afs_int32 *lastP;
+SPR_ListOwned(struct rx_call *call, afs_int32 aid, prlist *alist, 
+             afs_int32 *lastP)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
 
     code = listOwned(call, aid, alist, lastP, &cid);
     osi_auditU(call, PTS_LstOwnEvent, code, AUD_ID, aid, AUD_END);
-    ViceLog(125, ("PTS_ListOwned: code %d cid %d aid %d", code, cid, aid));
+    ViceLog(125, ("PTS_ListOwned: code %d cid %d aid %d\n", code, cid, aid));
     return code;
 }
 
 afs_int32
-listOwned(call, aid, alist, lastP, cid)
-     struct rx_call *call;
-     afs_int32 aid;
-     prlist *alist;
-     afs_int32 *lastP;
-     afs_int32 *cid;
+listOwned(struct rx_call *call, afs_int32 aid, prlist *alist, afs_int32 *lastP, 
+         afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -2154,11 +2053,8 @@ listOwned(call, aid, alist, lastP, cid)
 }
 
 afs_int32
-SPR_IsAMemberOf(call, uid, gid, flag)
-     struct rx_call *call;
-     afs_int32 uid;
-     afs_int32 gid;
-     afs_int32 *flag;
+SPR_IsAMemberOf(struct rx_call *call, afs_int32 uid, afs_int32 gid, 
+               afs_int32 *flag)
 {
     afs_int32 code;
     afs_int32 cid = ANONYMOUSID;
@@ -2166,17 +2062,13 @@ 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(125, ("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\n", code, cid, uid, gid));
     return code;
 }
 
-afs_int32
-isAMemberOf(call, uid, gid, flag, cid)
-     struct rx_call *call;
-     afs_int32 uid;
-     afs_int32 gid;
-     afs_int32 *flag;
-     afs_int32 *cid;
+static afs_int32
+isAMemberOf(struct rx_call *call, afs_int32 uid, afs_int32 gid, afs_int32 *flag,
+           afs_int32 *cid)
 {
     register afs_int32 code;
     struct ubik_trans *tt;
@@ -2228,11 +2120,8 @@ isAMemberOf(call, uid, gid, flag, cid)
 }
 
 #if IP_WILDCARDS
-afs_int32
-addWildCards(tt, alist, host)
-     struct ubik_trans *tt;
-     prlist *alist;
-     afs_int32 host;
+static afs_int32
+addWildCards(struct ubik_trans *tt, prlist *alist, afs_int32 host)
 {
     afs_int32 temp;
     struct prentry tentry;
@@ -2280,12 +2169,9 @@ addWildCards(tt, alist, host)
 }
 #endif /* IP_WILDCARDS */
 
-afs_int32
-WhoIsThisWithName(acall, at, aid, aname)
-     struct rx_call *acall;
-     struct ubik_trans *at;
-     afs_int32 *aid;
-     char *aname;
+static afs_int32
+WhoIsThisWithName(struct rx_call *acall, struct ubik_trans *at, afs_int32 *aid, 
+                 char *aname)
 {
     /* aid is set to the identity of the caller, if known, else ANONYMOUSID */
     /* returns -1 and sets aid to ANONYMOUSID on any failure */