From 79448c25acead55728f40beec18e00113d8356f4 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Mon, 16 Mar 2009 13:08:38 +0000 Subject: [PATCH] ptserver-prototypes-20090316 LICENSE IPL10 FIXES 124249 prototype the ptserver directory --- src/ptserver/db_verify.c | 9 +- src/ptserver/map.c | 4 +- src/ptserver/pt_util.c | 44 ++-- src/ptserver/ptclient.c | 4 +- src/ptserver/ptclient.h | 27 -- src/ptserver/ptprocs.c | 474 +++++++++++++----------------------- src/ptserver/ptprototypes.h | 94 +++++-- src/ptserver/pts.c | 69 +++--- src/ptserver/ptserver.c | 16 +- src/ptserver/ptuser.c | 2 +- src/ptserver/ptuser.h | 74 +++--- src/ptserver/ptutils.c | 21 +- src/ptserver/readgroup.c | 8 +- src/ptserver/readpwd.c | 4 +- src/ptserver/testpt.c | 37 +-- src/ptserver/ubik.c | 25 +- src/ptserver/utils.c | 20 +- 17 files changed, 427 insertions(+), 505 deletions(-) diff --git a/src/ptserver/db_verify.c b/src/ptserver/db_verify.c index fe5c4acb2..0298e79dc 100644 --- a/src/ptserver/db_verify.c +++ b/src/ptserver/db_verify.c @@ -56,6 +56,7 @@ RCSID #include "ptint.h" #include "pterror.h" #include "ptserver.h" +#include "ptuser.h" struct prheader cheader; int fd; @@ -85,7 +86,7 @@ printheader(struct prheader *h) } static afs_int32 -pr_Read(afs_int32 pos, char *buff, afs_int32 len) +pr_Read(afs_int32 pos, void *buff, afs_int32 len) { afs_int32 code; @@ -110,7 +111,7 @@ pr_Read(afs_int32 pos, char *buff, afs_int32 len) */ afs_int32 -ReadHeader() +ReadHeader(void) { afs_int32 code; @@ -138,14 +139,14 @@ IDHash(afs_int32 x) } static afs_int32 -NameHash(register unsigned char *aname) +NameHash(register char *aname) { /* returns hash bucket for aname */ register unsigned int hash = 0; register int i; /* stolen directly from the HashString function in the vol package */ for (i = strlen(aname), aname += i - 1; i--; aname--) - hash = (hash * 31) + (*aname - 31); + hash = (hash * 31) + (*(unsigned char *)aname - 31); return (hash % HASHSIZE); } diff --git a/src/ptserver/map.c b/src/ptserver/map.c index c0ac98b44..4ef1190ea 100644 --- a/src/ptserver/map.c +++ b/src/ptserver/map.c @@ -44,8 +44,8 @@ RCSID #endif #undef PRINT_MAP_ERROR -/* #define MAP_DEBUG /**/ -/* #define NEED_READ_WRITE /**/ +/* #define MAP_DEBUG */ +/* #define NEED_READ_WRITE */ #define LSHIFT 5 #define MSHIFT 8 /* XXX make this 8 in the production version... */ diff --git a/src/ptserver/pt_util.c b/src/ptserver/pt_util.c index f74b6a95f..7ea8f9007 100644 --- a/src/ptserver/pt_util.c +++ b/src/ptserver/pt_util.c @@ -39,6 +39,7 @@ RCSID #include "ptint.h" #include "ptserver.h" #include "pterror.h" +#include "ptprototypes.h" #define IDHash(x) (abs(x) % HASHSIZE) #define print_id(x) ( ((flags&DO_SYS)==0 && (x<-32767 || x>97536)) || \ @@ -48,15 +49,16 @@ extern char *optarg; extern int optind; int restricted = 0; -int display_entry(); -void add_group(); -void display_groups(); -void display_group(); -void fix_pre(); -char *checkin(); -char *check_core(); -char *id_to_name(); -int CommandProc(struct cmd_syndesc *, void *); + +static int display_entry(int); +static void add_group(long); +static void display_groups(void); +static void display_group(int); +static void fix_pre(struct prentry *); +static char *id_to_name(int); +static char *checkin(struct prentry *); +static char *check_core(int); +static int CommandProc(struct cmd_syndesc *, void *); struct hash_entry { char h_name[PR_MAXNAMELEN]; @@ -130,12 +132,12 @@ main(int argc, char **argv) } -int +static int CommandProc(register struct cmd_syndesc *a_as, void *arock) { register int i; long code = 0; - long cc, upos; + long upos; long gpos = 0; struct prentry uentry, gentry; struct ubik_hdr *uh; @@ -367,11 +369,9 @@ CommandProc(register struct cmd_syndesc *a_as, void *arock) exit(0); } -int +static int display_entry(int offset) { - register int i; - lseek(dbase_fd, offset + HDRSIZE, L_SET); read(dbase_fd, &pre, sizeof(struct prentry)); @@ -391,7 +391,7 @@ display_entry(int offset) return (nflag ? pre.nextName : pre.nextID); } -void +static void add_group(long id) { struct grp_list *g; @@ -407,8 +407,8 @@ add_group(long id) g->groups[i] = id; } -void -display_groups() +static void +display_groups(void) { register int i, id; struct grp_list *g; @@ -426,7 +426,7 @@ display_groups() } } -void +static void display_group(int id) { register int i, offset; @@ -497,7 +497,7 @@ display_group(int id) } } -void +static void fix_pre(struct prentry *pre) { register int i; @@ -524,7 +524,7 @@ fix_pre(struct prentry *pre) } } -char * +static char * id_to_name(int id) { register int offset; @@ -551,7 +551,7 @@ id_to_name(int id) return 0; } -char * +static char * checkin(struct prentry *pre) { struct hash_entry *he, *last; @@ -581,7 +581,7 @@ checkin(struct prentry *pre) return (he->h_name); } -char * +static char * check_core(register int id) { struct hash_entry *he; diff --git a/src/ptserver/ptclient.c b/src/ptserver/ptclient.c index ba24d6264..f9e59b6f7 100644 --- a/src/ptserver/ptclient.c +++ b/src/ptserver/ptclient.c @@ -64,9 +64,7 @@ osi_audit() #endif /* !AFS_PTHREAD_ENV */ int -GetToken(format, l) - char *format; - afs_int32 *l; +GetToken(char *format, afs_int32 *l) { int c; diff --git a/src/ptserver/ptclient.h b/src/ptserver/ptclient.h index f4de08045..429ba9157 100644 --- a/src/ptserver/ptclient.h +++ b/src/ptserver/ptclient.h @@ -19,31 +19,4 @@ #include "ptserver.h" #endif /* defined(UKERNEL) */ - -extern int PR_INewEntry(); -extern int PR_WhereIsIt(); -extern int PR_DumpEntry(); -extern int PR_AddToGroup(); -extern int PR_NameToID(); -extern int PR_IDToName(); -extern int PR_Delete(); -extern int PR_RemoveFromGroup(); -extern int PR_GetCPS(); -extern int PR_NewEntry(); -extern int PR_ListMax(); -extern int PR_SetMax(); -extern int PR_ListEntry(); -extern int PR_ListEntries(); -extern int PR_ChangeEntry(); -extern int PR_ListElements(); -extern int PR_IsAMemberOf(); -extern int PR_SetFieldsEntry(); -extern int PR_ListOwned(); -extern int PR_GetCPS2(); -extern int PR_GetHostCPS(); -extern int PR_UpdateEntry(); -#if defined(SUPERGROUPS) -extern int PR_ListSuperGroups(); -#endif - #define pr_ErrorMsg afs_error_message diff --git a/src/ptserver/ptprocs.c b/src/ptserver/ptprocs.c index 030d2ab0e..4c7b6908a 100644 --- a/src/ptserver/ptprocs.c +++ b/src/ptserver/ptprocs.c @@ -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; @@ -219,13 +253,9 @@ SPR_INewEntry(call, aname, aid, 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; @@ -299,19 +325,13 @@ SPR_NewEntry(call, aname, flag, oid, aid) 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; @@ -371,12 +388,8 @@ SPR_WhereIsIt(call, 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,10 +424,8 @@ 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; @@ -425,12 +436,9 @@ SPR_DumpEntry(call, apos, aentry) 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; @@ -489,12 +494,8 @@ SPR_AddToGroup(call, aid, gid) 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,10 +570,7 @@ 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; @@ -582,11 +580,8 @@ SPR_NameToID(call, aname, aid) 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; @@ -668,10 +663,7 @@ 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; @@ -681,11 +673,8 @@ SPR_IDToName(call, aid, aname) 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; @@ -745,9 +734,7 @@ 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; @@ -758,11 +745,8 @@ SPR_Delete(call, 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; @@ -997,11 +981,8 @@ 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; @@ -1013,12 +994,8 @@ SPR_UpdateEntry(call, aid, name, uentry) } 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; @@ -1095,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; @@ -1110,12 +1084,9 @@ SPR_RemoveFromGroup(call, aid, gid) 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; @@ -1184,11 +1155,7 @@ 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; @@ -1199,13 +1166,9 @@ SPR_GetCPS(call, aid, alist, over) 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; @@ -1251,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; @@ -1267,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; @@ -1284,14 +1241,9 @@ SPR_GetCPS2(call, aid, ahost, alist, over) 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; @@ -1301,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); @@ -1365,11 +1314,8 @@ 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; @@ -1380,20 +1326,14 @@ SPR_GetHostCPS(call, ahost, alist, over) } 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); @@ -1439,10 +1379,7 @@ 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; @@ -1453,10 +1390,7 @@ SPR_ListMax(call, uid, gid) } 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; @@ -1485,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; @@ -1500,12 +1431,8 @@ SPR_SetMax(call, 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; @@ -1542,10 +1469,7 @@ 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; @@ -1556,12 +1480,9 @@ SPR_ListEntry(call, aid, aentry) 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; @@ -1615,12 +1536,8 @@ 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; @@ -1631,14 +1548,9 @@ SPR_ListEntries(call, flag, startindex, bulkentries, nextstartindex) 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; @@ -1718,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; @@ -1762,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; @@ -1779,14 +1685,9 @@ SPR_ChangeEntry(call, 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; @@ -1830,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; @@ -1848,14 +1748,12 @@ SPR_SetFieldsEntry(call, id, mask, flags, ngroups, nusers, spare1, spare2) 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; @@ -1935,11 +1833,8 @@ 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; @@ -1950,13 +1845,9 @@ SPR_ListElements(call, aid, alist, over) 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; @@ -2003,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; @@ -2023,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; @@ -2084,11 +1968,8 @@ 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; @@ -2100,12 +1981,8 @@ SPR_ListOwned(call, aid, alist, lastP) } 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; @@ -2176,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; @@ -2192,13 +2066,9 @@ SPR_IsAMemberOf(call, uid, gid, flag) 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; @@ -2250,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; @@ -2302,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 */ diff --git a/src/ptserver/ptprototypes.h b/src/ptserver/ptprototypes.h index 041a9f286..12eff060d 100644 --- a/src/ptserver/ptprototypes.h +++ b/src/ptserver/ptprototypes.h @@ -10,37 +10,91 @@ #ifndef _PTPROTOTYPES_H_ #define _PTPROTOTYPES_H_ + + +/* ptint.ss.c */ +extern int PR_ExecuteRequest (struct rx_call *z_call); + /* utils.c */ #if defined(SUPERGROUPS) -extern afs_int32 IsAMemberOfSG(struct ubik_trans *at, afs_int32 aid, afs_int32 gid, afs_int32 depth) ; +extern afs_int32 IsAMemberOfSG(struct ubik_trans *at, afs_int32 aid, + afs_int32 gid, afs_int32 depth) ; #endif /* SUPERGROUPS */ -extern afs_int32 IDHash(afs_int32 x); extern afs_int32 NameHash(register unsigned char *aname); -extern afs_int32 pr_Write(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, char *buff, afs_int32 len); -extern afs_int32 pr_Read(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, char *buff, afs_int32 len); -extern int pr_WriteEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, struct prentry *tentry); -extern int pr_ReadEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, struct prentry *tentry); -extern int pr_WriteCoEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, struct contentry *tentry); -extern int pr_ReadCoEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, struct contentry *tentry); +extern afs_int32 pr_Write(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, + void *buff, afs_int32 len); +extern afs_int32 pr_Read(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, + void *buff, afs_int32 len); +extern int pr_WriteEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, + struct prentry *tentry); +extern int pr_ReadEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, + struct prentry *tentry); +extern int pr_WriteCoEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, + struct contentry *tentry); +extern int pr_ReadCoEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, + struct contentry *tentry); extern afs_int32 AllocBlock(register struct ubik_trans *at); extern afs_int32 FreeBlock(register struct ubik_trans *at, afs_int32 pos); extern afs_int32 FindByID(register struct ubik_trans *at, afs_int32 aid); -extern afs_int32 FindByName(register struct ubik_trans *at, char aname[PR_MAXNAMELEN], struct prentry *tentryp); -extern afs_int32 AllocID(register struct ubik_trans *at, afs_int32 flag, afs_int32 *aid); -extern afs_int32 IDToName(register struct ubik_trans *at, afs_int32 aid, char aname[PR_MAXNAMELEN]); -extern afs_int32 NameToID(register struct ubik_trans *at, char aname[PR_MAXNAMELEN], afs_int32 *aid); -extern int IDCmp(afs_int32 *a, afs_int32 *b); -extern afs_int32 RemoveFromIDHash(struct ubik_trans *tt, afs_int32 aid, afs_int32 *loc); -extern afs_int32 AddToIDHash(struct ubik_trans *tt, afs_int32 aid, afs_int32 loc); -extern afs_int32 RemoveFromNameHash(struct ubik_trans *tt, char *aname, afs_int32 *loc); -extern afs_int32 AddToNameHash(struct ubik_trans *tt, char *aname, afs_int32 loc); -extern afs_int32 AddToOwnerChain(struct ubik_trans *at, afs_int32 gid, afs_int32 oid); -extern afs_int32 RemoveFromOwnerChain(struct ubik_trans *at, afs_int32 gid, afs_int32 oid); +extern afs_int32 FindByName(register struct ubik_trans *at, + char aname[PR_MAXNAMELEN], struct prentry *tentryp); +extern afs_int32 AllocID(register struct ubik_trans *at, afs_int32 flag, + afs_int32 *aid); +extern afs_int32 IDToName(register struct ubik_trans *at, afs_int32 aid, + char aname[PR_MAXNAMELEN]); +extern afs_int32 NameToID(register struct ubik_trans *at, + char aname[PR_MAXNAMELEN], afs_int32 *aid); +extern int IDCmp(const void *a, const void *b); +extern afs_int32 RemoveFromIDHash(struct ubik_trans *tt, afs_int32 aid, + afs_int32 *loc); +extern afs_int32 AddToIDHash(struct ubik_trans *tt, afs_int32 aid, + afs_int32 loc); +extern afs_int32 RemoveFromNameHash(struct ubik_trans *tt, char *aname, + afs_int32 *loc); +extern afs_int32 AddToNameHash(struct ubik_trans *tt, char *aname, + afs_int32 loc); +extern afs_int32 AddToOwnerChain(struct ubik_trans *at, afs_int32 gid, + afs_int32 oid); +extern afs_int32 RemoveFromOwnerChain(struct ubik_trans *at, afs_int32 gid, + afs_int32 oid); extern afs_int32 AddToOrphan(struct ubik_trans *at, afs_int32 gid); extern afs_int32 RemoveFromOrphan(struct ubik_trans *at, afs_int32 gid); extern afs_int32 IsOwnerOf(struct ubik_trans *at, afs_int32 aid, afs_int32 gid); extern afs_int32 OwnerOf(struct ubik_trans *at, afs_int32 gid); -extern afs_int32 IsAMemberOf(struct ubik_trans *at, afs_int32 aid, afs_int32 gid); +extern afs_int32 IsAMemberOf(struct ubik_trans *at, afs_int32 aid, + afs_int32 gid); + +/* ptutils.c */ +extern afs_int32 AddToEntry(struct ubik_trans *tt, struct prentry *entry, + afs_int32 loc, afs_int32 aid); +extern int AccessOK(struct ubik_trans *ut, afs_int32 cid, + struct prentry *tentry, int mem, int any); +extern afs_int32 CreateEntry(struct ubik_trans *at, char aname[], + afs_int32 *aid, afs_int32 idflag, + afs_int32 flag, afs_int32 oid, afs_int32 creator); +extern afs_int32 RemoveFromEntry(struct ubik_trans *at, afs_int32 aid, + afs_int32 bid); +extern afs_int32 DeleteEntry(struct ubik_trans *at, struct prentry *tentry, + afs_int32 loc); +extern afs_int32 GetList(struct ubik_trans *at, struct prentry *tentry, + prlist *alist, afs_int32 add); +extern afs_int32 GetList2(struct ubik_trans *at, struct prentry *tentry, + struct prentry *tentry2, prlist *alist, + afs_int32 add); +extern afs_int32 GetMax(struct ubik_trans *at, afs_int32 *uid, afs_int32 *gid); +extern afs_int32 SetMax(struct ubik_trans *at, afs_int32 id, afs_int32 flag); +extern afs_int32 ChangeEntry(struct ubik_trans *at, afs_int32 aid, + afs_int32 cid, char *name, afs_int32 oid, + afs_int32 newid); +extern afs_int32 GetOwnedChain(struct ubik_trans *ut, afs_int32 *next, + prlist *alist); +extern afs_int32 AddToPRList(prlist *alist, int *sizeP, afs_int32 id); +extern afs_int32 read_DbHeader(struct ubik_trans *tt); +extern afs_int32 Initdb(void); + +/* ptuser.c */ + +/* All ptuser prototypes are in ptuser.h - for public consumption ... */ #endif diff --git a/src/ptserver/pts.c b/src/ptserver/pts.c index ed508b326..3ca37f3ad 100644 --- a/src/ptserver/pts.c +++ b/src/ptserver/pts.c @@ -32,7 +32,9 @@ RCSID #include #include #include "ptclient.h" +#include "ptuser.h" #include "pterror.h" +#include "ptprototypes.h" #include #include @@ -56,7 +58,9 @@ struct authstate { char cell[MAXCELLCHARS]; }; -int +static int CleanUp(struct cmd_syndesc *as, void *arock); + +static int pts_Interactive(struct cmd_syndesc *as, void *arock) { source = stdin; @@ -64,14 +68,14 @@ pts_Interactive(struct cmd_syndesc *as, void *arock) return 0; } -int +static int pts_Quit(struct cmd_syndesc *as, void *arock) { finished = 1; return 0; } -int +static int pts_Source(struct cmd_syndesc *as, void *arock) { FILE *fd; @@ -99,7 +103,7 @@ pts_Source(struct cmd_syndesc *as, void *arock) return 0; } -int +static int pts_Sleep(struct cmd_syndesc *as, void *arock) { int delay; @@ -116,8 +120,8 @@ pts_Sleep(struct cmd_syndesc *as, void *arock) return 0; } -int -popsource() +static int +popsource(void) { register struct sourcestack *sp; if (!(sp = shead)) @@ -131,7 +135,7 @@ popsource() } int -osi_audit() +osi_audit(void) { /* OK, this REALLY sucks bigtime, but I can't tell who is calling * afsconf_CheckAuth easily, and only *SERVERS* should be calling osi_audit @@ -140,7 +144,7 @@ osi_audit() return 0; } -int +static int GetGlobals(struct cmd_syndesc *as, void *arock) { struct authstate *state = (struct authstate *) arock; @@ -211,7 +215,7 @@ GetGlobals(struct cmd_syndesc *as, void *arock) return code; } -int +static int CleanUp(struct cmd_syndesc *as, void *arock) { if (as && !strcmp(as->name, "help")) @@ -224,7 +228,7 @@ CleanUp(struct cmd_syndesc *as, void *arock) return 0; } -int +static int CreateGroup(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -284,7 +288,7 @@ CreateGroup(struct cmd_syndesc *as, void *arock) return 0; } -int +static int CreateUser(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -330,8 +334,8 @@ CreateUser(struct cmd_syndesc *as, void *arock) #ifdef notdef -int -GetNameOrId(register struct cmd_syndesc *as, struct idlist *lids, struct namelist *lnames) +static int +GetNameOrId(struct cmd_syndesc *as, struct idlist *lids, struct namelist *lnames) { register afs_int32 code = 0; int n = 0; @@ -421,8 +425,9 @@ GetNameOrId(register struct cmd_syndesc *as, struct idlist *lids, struct namelis #endif -int -GetNameOrId(register struct cmd_syndesc *as, struct idlist *lids, struct namelist *lnames) +static int +GetNameOrId(struct cmd_syndesc *as, struct idlist *lids, + struct namelist *lnames) { register afs_int32 code = 0; int n = 0, nd = 0, nm = 0, id, x; @@ -509,7 +514,7 @@ GetNameOrId(register struct cmd_syndesc *as, struct idlist *lids, struct namelis } -int +static int AddToGroup(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -530,7 +535,7 @@ AddToGroup(struct cmd_syndesc *as, void *arock) return 0; } -int +static int RemoveFromGroup(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -551,7 +556,7 @@ RemoveFromGroup(struct cmd_syndesc *as, void *arock) return 0; } -int +static int ListMembership(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -596,7 +601,7 @@ ListMembership(struct cmd_syndesc *as, void *arock) return 0; } -int +static int Delete(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -635,7 +640,7 @@ char *flags_upcase = "SOMA "; /* legal all access values */ char *flags_dncase = "s mar"; /* legal member acces values */ int flags_shift[5] = { 2, 1, 2, 2, 1 }; /* bits for each */ -int +static int CheckEntry(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -734,7 +739,7 @@ CheckEntry(struct cmd_syndesc *as, void *arock) return (rcode); } -int +static int ListEntries(struct cmd_syndesc *as, void *arock) { afs_int32 code = 0; @@ -771,7 +776,7 @@ ListEntries(struct cmd_syndesc *as, void *arock) return code; } -int +static int ChownGroup(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -787,7 +792,7 @@ ChownGroup(struct cmd_syndesc *as, void *arock) return code; } -int +static int ChangeName(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -803,7 +808,7 @@ ChangeName(struct cmd_syndesc *as, void *arock) return code; } -int +static int ListMax(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -824,8 +829,8 @@ ListMax(struct cmd_syndesc *as, void *arock) return code; } -int -SetMax(struct cmd_syndesc *as, void *arock) +static int +SetMaxCommand(struct cmd_syndesc *as, void *arock) { register afs_int32 code; afs_int32 maxid; @@ -864,7 +869,7 @@ SetMax(struct cmd_syndesc *as, void *arock) return code; } -int +static int SetFields(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -885,7 +890,7 @@ SetFields(struct cmd_syndesc *as, void *arock) int new; if (strpbrk(access, "76543210") != 0) { /* all octal digits */ - sscanf(access, "%lo", &flags); + sscanf(access, "%lo", (long unsigned int *) &flags); } else { /* interpret flag bit names */ if (strlen(access) != 5) { form_error: @@ -959,7 +964,7 @@ SetFields(struct cmd_syndesc *as, void *arock) return 0; } -int +static int ListOwned(struct cmd_syndesc *as, void *arock) { register afs_int32 code; @@ -1010,7 +1015,7 @@ ListOwned(struct cmd_syndesc *as, void *arock) } static void -add_std_args(register struct cmd_syndesc *ts) +add_std_args(struct cmd_syndesc *ts) { char test_help[AFSDIR_PATH_MAX]; @@ -1135,7 +1140,7 @@ main(int argc, char **argv) ts = cmd_CreateSyntax("listmax", ListMax, NULL, "list max id"); add_std_args(ts); - ts = cmd_CreateSyntax("setmax", SetMax, NULL, "set max id"); + ts = cmd_CreateSyntax("setmax", SetMaxCommand, NULL, "set max id"); cmd_AddParm(ts, "-group", CMD_SINGLE, CMD_OPTIONAL, "group max"); cmd_AddParm(ts, "-user", CMD_SINGLE, CMD_OPTIONAL, "user max"); add_std_args(ts); @@ -1183,7 +1188,7 @@ main(int argc, char **argv) finished = 1; source = NULL; - if (code = cmd_Dispatch(argc, argv)) { + if ((code = cmd_Dispatch(argc, argv))) { CleanUp(NULL, NULL); exit(1); } diff --git a/src/ptserver/ptserver.c b/src/ptserver/ptserver.c index ce632c523..93ff53f6d 100644 --- a/src/ptserver/ptserver.c +++ b/src/ptserver/ptserver.c @@ -139,11 +139,12 @@ RCSID #include #include #include "ptserver.h" +#include "ptprototypes.h" #include "error_macros.h" #include "afs/audit.h" #include #include - +#include /* make all of these into a structure if you want */ struct prheader cheader; @@ -154,9 +155,6 @@ struct afsconf_dir *prdir; extern afs_int32 depthsg; #endif -extern int afsconf_ServerAuth(); -extern int afsconf_CheckAuth(); - int pr_realmNameLen; char *pr_realmName; @@ -177,8 +175,7 @@ extern int prp_user_default; #include "AFS_component_version_number.c" int -prp_access_mask(s) - char *s; +prp_access_mask(char *s) { int r; if (*s >= '0' && *s <= '9') { @@ -216,7 +213,6 @@ main(int argc, char **argv) struct rx_service *tservice; struct rx_securityClass *sc[3]; extern int RXSTATS_ExecuteRequest(); - extern int PR_ExecuteRequest(); #if 0 struct ktc_encryptionKey tkey; #endif @@ -472,11 +468,11 @@ main(int argc, char **argv) if (kerberosKeys) { /* initialize ubik */ ubik_CRXSecurityProc = afsconf_ClientAuth; - ubik_CRXSecurityRock = (char *)prdir; + ubik_CRXSecurityRock = prdir; ubik_SRXSecurityProc = afsconf_ServerAuth; - ubik_SRXSecurityRock = (char *)prdir; + ubik_SRXSecurityRock = prdir; ubik_CheckRXSecurityProc = afsconf_CheckAuth; - ubik_CheckRXSecurityRock = (char *)prdir; + ubik_CheckRXSecurityRock = prdir; } /* The max needed is when deleting an entry. A full CoEntry deletion * required removal from 39 entries. Each of which may refers to the entry diff --git a/src/ptserver/ptuser.c b/src/ptserver/ptuser.c index 0c4eaf119..aa2dc12ca 100644 --- a/src/ptserver/ptuser.c +++ b/src/ptserver/ptuser.c @@ -247,7 +247,7 @@ pr_Initialize(IN afs_int32 secLevel, IN const char *confDir, IN char *cell) } int -pr_End() +pr_End(void) { int code = 0; diff --git a/src/ptserver/ptuser.h b/src/ptserver/ptuser.h index 022822508..75fd71fb4 100644 --- a/src/ptserver/ptuser.h +++ b/src/ptserver/ptuser.h @@ -12,33 +12,49 @@ #include "afs/ptint.h" -afs_int32 pr_Initialize(afs_int32 secLevel, const char *confDir, char *cell); -int pr_End(void); -int pr_CreateUser(char name[PR_MAXNAMELEN], afs_int32 *id); -int pr_CreateGroup(char name[PR_MAXNAMELEN], char owner[PR_MAXNAMELEN], afs_int32 *id); -int pr_Delete(char *name); -int pr_DeleteByID(afs_int32 id); -int pr_AddToGroup(char *user, char *group); -int pr_RemoveUserFromGroup(char *user, char *group); -int pr_NameToId(namelist *names, idlist *ids); -int pr_SNameToId(char name[PR_MAXNAMELEN], afs_int32 *id); -int pr_IdToName(idlist *ids, namelist *names); -int pr_SIdToName(afs_int32 id, char name[PR_MAXNAMELEN]); -int pr_GetCPS(afs_int32 id, prlist *CPS); -int pr_GetCPS2(afs_int32 id, afs_int32 host, prlist *CPS); -int pr_GetHostCPS(afs_int32 host, prlist *CPS); -int pr_ListMembers(char *group, namelist *lnames); -int pr_ListOwned(afs_int32 oid, namelist *lnames, afs_int32 *moreP); -int pr_IDListMembers(afs_int32 gid, namelist *lnames); -int pr_ListEntry(afs_int32 id, struct prcheckentry *aentry); -afs_int32 pr_ListEntries(int flag, afs_int32 startindex, afs_int32 *nentries, struct prlistentries **entries, afs_int32 *nextstartindex); -int pr_CheckEntryByName(char *name, afs_int32 *id, char *owner, char *creator); -int pr_CheckEntryById(char *name, afs_int32 id, char *owner, char *creator); -int pr_ChangeEntry(char *oldname, char *newname, afs_int32 *newid, char *newowner); -int pr_IsAMemberOf(char *uname, char *gname, afs_int32 *flag); -int pr_ListMaxUserId(afs_int32 *mid); -int pr_SetMaxUserId(afs_int32 mid); -int pr_ListMaxGroupId(afs_int32 *mid); -int pr_SetMaxGroupId(afs_int32 mid); -afs_int32 pr_SetFieldsEntry(afs_int32 id, afs_int32 mask, afs_int32 flags, afs_int32 ngroups, afs_int32 nusers); +/* display.c */ +extern int pr_PrintEntry(FILE *f, int hostOrder, afs_int32 ea, + struct prentry *e, int indent); + +/* ptuser.c */ +extern afs_int32 pr_Initialize(afs_int32 secLevel, const char *confDir, + char *cell); +extern int pr_End(void); +extern int pr_CreateUser(char name[PR_MAXNAMELEN], afs_int32 *id); +extern int pr_CreateGroup(char name[PR_MAXNAMELEN], char owner[PR_MAXNAMELEN], + afs_int32 *id); +extern int pr_Delete(char *name); +extern int pr_DeleteByID(afs_int32 id); +extern int pr_AddToGroup(char *user, char *group); +extern int pr_RemoveUserFromGroup(char *user, char *group); +extern int pr_NameToId(namelist *names, idlist *ids); +extern int pr_SNameToId(char name[PR_MAXNAMELEN], afs_int32 *id); +extern int pr_IdToName(idlist *ids, namelist *names); +extern int pr_SIdToName(afs_int32 id, char name[PR_MAXNAMELEN]); +extern int pr_GetCPS(afs_int32 id, prlist *CPS); +extern int pr_GetCPS2(afs_int32 id, afs_int32 host, prlist *CPS); +extern int pr_GetHostCPS(afs_int32 host, prlist *CPS); +extern int pr_ListMembers(char *group, namelist *lnames); +extern int pr_ListOwned(afs_int32 oid, namelist *lnames, afs_int32 *moreP); +extern int pr_IDListMembers(afs_int32 gid, namelist *lnames); +extern int pr_ListEntry(afs_int32 id, struct prcheckentry *aentry); +extern afs_int32 pr_ListEntries(int flag, afs_int32 startindex, + afs_int32 *nentries, + struct prlistentries **entries, + afs_int32 *nextstartindex); +extern int pr_CheckEntryByName(char *name, afs_int32 *id, char *owner, + char *creator); +extern int pr_CheckEntryById(char *name, afs_int32 id, char *owner, + char *creator); +extern int pr_ChangeEntry(char *oldname, char *newname, afs_int32 *newid, + char *newowner); +extern int pr_IsAMemberOf(char *uname, char *gname, afs_int32 *flag); +extern int pr_ListMaxUserId(afs_int32 *mid); +extern int pr_SetMaxUserId(afs_int32 mid); +extern int pr_ListMaxGroupId(afs_int32 *mid); +extern int pr_SetMaxGroupId(afs_int32 mid); +extern afs_int32 pr_SetFieldsEntry(afs_int32 id, afs_int32 mask, + afs_int32 flags, afs_int32 ngroups, + afs_int32 nusers); + #endif /* PTUSER_H */ diff --git a/src/ptserver/ptutils.c b/src/ptserver/ptutils.c index 61e07e966..27c84764e 100644 --- a/src/ptserver/ptutils.c +++ b/src/ptserver/ptutils.c @@ -42,6 +42,7 @@ RCSID #include #include "ptserver.h" #include "pterror.h" +#include "ptprototypes.h" #include /* Foreign cells are represented by the group system:authuser@cell*/ @@ -51,9 +52,11 @@ extern int restricted; extern struct ubik_dbase *dbase; extern struct afsconf_dir *prdir; extern int pr_noAuth; -extern int IDCmp(); -extern afs_int32 AddToEntry(); +static int inRange(struct prentry *cellEntry, afs_int32 aid); +static afs_int32 allocNextId(struct ubik_trans *, struct prentry *); +static int AddAuthGroup(struct prentry *tentry, prlist *alist, afs_int32 *size); + static char *whoami = "ptserver"; int prp_user_default = PRP_USER_DEFAULT; @@ -64,10 +67,8 @@ int prp_group_default = PRP_GROUP_DEFAULT; #include "map.h" afs_int32 depthsg = 5; /* Maximum iterations used during IsAMemberOF */ -extern int IDCmp(); afs_int32 GetListSG2(struct ubik_trans *at, afs_int32 gid, prlist * alist, afs_int32 * sizeP, afs_int32 depth); -afs_int32 allocNextId(struct ubik_trans *, struct prentry *); struct map *sg_flagged; struct map *sg_found; @@ -1713,7 +1714,7 @@ int pr_noAuth; afs_int32 initd = 0; afs_int32 -Initdb() +Initdb(void) { afs_int32 code; struct ubik_trans *tt; @@ -2045,7 +2046,7 @@ ChangeEntry(struct ubik_trans *at, afs_int32 aid, afs_int32 cid, char *name, afs tentry.owner = oid; /* The entry must be written through first so Remove and Add routines * can operate on disk data */ - code = pr_WriteEntry(at, 0, loc, (char *)&tentry); + code = pr_WriteEntry(at, 0, loc, &tentry); if (code) return PRDBFAIL; @@ -2112,7 +2113,7 @@ ChangeEntry(struct ubik_trans *at, afs_int32 aid, afs_int32 cid, char *name, afs if (code != PRSUCCESS) return code; strncpy(tentry.name, name, PR_MAXNAMELEN); - code = pr_WriteEntry(at, 0, loc, (char *)&tentry); + code = pr_WriteEntry(at, 0, loc, &tentry); if (code) return PRDBFAIL; code = AddToNameHash(at, tentry.name, loc); @@ -2124,7 +2125,7 @@ ChangeEntry(struct ubik_trans *at, afs_int32 aid, afs_int32 cid, char *name, afs } -afs_int32 +static afs_int32 allocNextId(struct ubik_trans * at, struct prentry * cellEntry) { /* Id's for foreign cell entries are constructed as follows: @@ -2155,7 +2156,7 @@ allocNextId(struct ubik_trans * at, struct prentry * cellEntry) return id; } -int +static int inRange(struct prentry *cellEntry, afs_int32 aid) { afs_uint32 id, cellid, groupid; @@ -2186,7 +2187,7 @@ inRange(struct prentry *cellEntry, afs_int32 aid) } -int +static int AddAuthGroup(struct prentry *tentry, prlist *alist, afs_int32 *size) { if (!(strchr(tentry->name, '@'))) diff --git a/src/ptserver/readgroup.c b/src/ptserver/readgroup.c index a07e3a298..797085cf2 100644 --- a/src/ptserver/readgroup.c +++ b/src/ptserver/readgroup.c @@ -25,10 +25,12 @@ RCSID #include #include #include "ptclient.h" +#include "ptuser.h" #include "pterror.h" +#include "ptprototypes.h" int verbose = 0; -void skip(); +static void skip(char **); void report_error(afs_int32 code, char *name, char *gname) @@ -46,7 +48,7 @@ report_error(afs_int32 code, char *name, char *gname) } int -osi_audit() +osi_audit(void) { /* OK, this REALLY sucks bigtime, but I can't tell who is calling * afsconf_CheckAuth easily, and only *SERVERS* should be calling osi_audit @@ -209,7 +211,7 @@ main(int argc, char **argv) return 0; } -void +static void skip(char **s) { while (**s != ' ' && **s != '\t' && **s != '\0') diff --git a/src/ptserver/readpwd.c b/src/ptserver/readpwd.c index c662ca3a1..292508506 100644 --- a/src/ptserver/readpwd.c +++ b/src/ptserver/readpwd.c @@ -24,9 +24,11 @@ RCSID #include #include #include "ptclient.h" +#include "ptuser.h" +#include "ptprototypes.h" int -osi_audit() +osi_audit(void) { /* OK, this REALLY sucks bigtime, but I can't tell who is calling * afsconf_CheckAuth easily, and only *SERVERS* should be calling osi_audit diff --git a/src/ptserver/testpt.c b/src/ptserver/testpt.c index e986e1a1b..a57c27ea2 100644 --- a/src/ptserver/testpt.c +++ b/src/ptserver/testpt.c @@ -25,6 +25,7 @@ RCSID #include #endif #include +#include #ifdef HAVE_FCNTL_H #include #endif @@ -42,6 +43,8 @@ RCSID #include #include "ptclient.h" #include "pterror.h" +#include "ptuser.h" +#include "ptprototypes.h" #include #include @@ -178,11 +181,11 @@ afs_int32 *groupOwners; /* ids of owners of groups */ int nUsers, nGroups, nAdds, nRems, nUDels, nGDels; int -IdCmp(afs_int32 *a, afs_int32 *b) +IdCmp(const void *a, const void *b) { - if (*a > *b) { + if (*(afs_int32 *)a > *(afs_int32 *)b) { return 1; - } else if (*a == *b) { + } else if (*(afs_int32 *)a == *(afs_int32 *)b) { return 0; } else /* (*a < *b) */ { return -1; @@ -199,7 +202,6 @@ static int GetGroupLimit(int N, int x) { int y; - double sqrt(); if ((x >= N) || (x < 0)) { printf("GetGroupLimit: input value out of range %d (%d)\n", x, N); @@ -271,7 +273,6 @@ CreateGroup(int g) afs_int32 code; char name[16]; afs_int32 id = 0; - afs_int32 flags = PRGRP; afs_int32 owner = 0; char *ownerName = NULL; int ownerType; /* type of ownership */ @@ -344,7 +345,7 @@ DeleteRandomId(afs_int32 *list) k = random(); /* random starting point */ for (j = 0; j < number; j++) { /* find an undeleted id */ m = (k + j) % number; - if (id = list[m]) { + if ((id = list[m])) { code = ubik_PR_Delete(pruclient, 0, id); if (code) { afs_com_err(whoami, code, "Couldn't delete %di", id); @@ -582,21 +583,23 @@ TestManyMembers(struct cmd_syndesc *as, void *arock) if (ui) { int i; int ng; /* number groups */ - int (*proc) (); /* membership listing procedure */ int over; + int (*proc)(struct ubik_client *, afs_int32, afs_int32, prlist *, + afs_int32 *); prlist alist; alist.prlist_len = 0; alist.prlist_val = 0; - if (random() & 4) - proc = PR_ListElements; - else - proc = PR_GetCPS; - code = ubik_Call(proc, pruclient, 0, ui, &alist, &over); + if (random() & 4) { + proc = ubik_PR_ListElements; + } else { + proc = ubik_PR_GetCPS; + } + code = (*proc)(pruclient, 0, ui, &alist, &over); if (code) { afs_com_err(whoami, code, "getting membership list of (%di) using %s", ui, - ((proc == PR_GetCPS) ? "GetCPR" : "ListElements")); + (proc == ubik_PR_ListElements?"ListElements":"GetCPS")); exit(24); } if (over) { @@ -607,7 +610,7 @@ TestManyMembers(struct cmd_syndesc *as, void *arock) if (population[u * number + i]) glist[ng++] = groups[i]; qsort(glist, ng, sizeof(afs_int32), IdCmp); - if (ng != (alist.prlist_len - ((proc == PR_GetCPS) ? 3 : 0))) { + if (ng != (alist.prlist_len - ((proc == ubik_PR_GetCPS) ? 3 : 0))) { fprintf(stderr, "Membership list for %di of unexpected length: was %d but expected %d\n", ui, alist.prlist_len, ng); @@ -624,7 +627,7 @@ TestManyMembers(struct cmd_syndesc *as, void *arock) } if (code) exit(21); - if (proc == PR_GetCPS) { + if (proc == ubik_PR_GetCPS) { if ((alist.prlist_val[i /* =ng */ ] != AUTHUSERID) || (alist.prlist_val[++i] != ANYUSERID) || (alist.prlist_val[++i] != ui)) { @@ -852,7 +855,7 @@ TestPrServ(struct cmd_syndesc *as, void *arock) strcat(name, ":abcdefghijklmnopqrstuvwxyz"); name[0] = 1; /* bash the owner name */ id = 0; - code = pr_CreateGroup(name, &id); + code = pr_CreateGroup(name, creator, &id); if (code != PRNOENT) { /* owner doesn't exist */ afs_com_err(whoami, code, "succeeded creating %s", name); exit(9); @@ -1067,7 +1070,7 @@ add_std_args(register struct cmd_syndesc *ts) } int -osi_audit() +osi_audit(void) { /* OK, this REALLY sucks bigtime, but I can't tell who is calling * afsconf_CheckAuth easily, and only *SERVERS* should be calling osi_audit diff --git a/src/ptserver/ubik.c b/src/ptserver/ubik.c index a68a82522..e1418c056 100644 --- a/src/ptserver/ubik.c +++ b/src/ptserver/ubik.c @@ -9,10 +9,12 @@ RCSID #include #include #include +#include #include #define UBIK_INTERNALS #include +#include #include #include #include "ptint.h" @@ -80,7 +82,7 @@ ubik_Truncate(register struct ubik_trans *transPtr, afs_int32 length) return (0); } -long +int ubik_SetLock(struct ubik_trans *atrans, afs_int32 apos, afs_int32 alen, int atype) { @@ -100,17 +102,22 @@ ubik_CacheUpdate(register struct ubik_trans *atrans) return (0); } -int -panic(char *a, char *b, char *c, char *d) +void +panic(char *format, ...) { - printf(a, b, c, d); + va_list ap; + + va_start(ap, format); + vprintf(format, ap); + va_end(ap); + abort(); printf("BACK FROM ABORT\n"); /* shouldn't come back from floating pt exception */ exit(1); /* never know, though */ } int -ubik_GetVersion(int dummy, struct ubik_version *ver) +ubik_GetVersion(struct ubik_trans *dummy, struct ubik_version *ver) { memset(ver, 0, sizeof(struct ubik_version)); return (0); @@ -118,7 +125,7 @@ ubik_GetVersion(int dummy, struct ubik_version *ver) int -ubik_Seek(struct ubik_trans *tt, long afd, long pos) +ubik_Seek(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos) { if (lseek(dbase_fd, pos + HDRSIZE, 0) < 0) { perror("ubik_Seek"); @@ -128,7 +135,7 @@ ubik_Seek(struct ubik_trans *tt, long afd, long pos) } int -ubik_Write(struct ubik_trans *tt, char *buf, long len) +ubik_Write(struct ubik_trans *tt, void *buf, afs_int32 len) { int status; @@ -141,7 +148,7 @@ ubik_Write(struct ubik_trans *tt, char *buf, long len) } int -ubik_Read(struct ubik_trans *tt, char *buf, long len) +ubik_Read(struct ubik_trans *tt, void *buf, afs_int32 len) { int status; @@ -151,7 +158,7 @@ ubik_Read(struct ubik_trans *tt, char *buf, long len) return (1); } if (status < len) - memset(&buf[status], 0, len - status); + memset((char *)buf + status, 0, len - status); return (0); } diff --git a/src/ptserver/utils.c b/src/ptserver/utils.c index df0c6e847..76ce9fb8e 100644 --- a/src/ptserver/utils.c +++ b/src/ptserver/utils.c @@ -34,7 +34,7 @@ afs_int32 IsAMemberOfSG(struct ubik_trans *at, afs_int32 aid, afs_int32 gid, afs_int32 depth); #endif -afs_int32 +static afs_int32 IDHash(afs_int32 x) { /* returns hash bucket for x */ @@ -42,20 +42,20 @@ IDHash(afs_int32 x) } afs_int32 -NameHash(register unsigned char *aname) +NameHash(register char *aname) { /* returns hash bucket for aname */ register unsigned int hash = 0; - register int i; + register size_t i; /* stolen directly from the HashString function in the vol package */ for (i = strlen(aname), aname += i - 1; i--; aname--) - hash = (hash * 31) + (*aname - 31); + hash = (hash * 31) + (*(unsigned char *)aname - 31); return (hash % HASHSIZE); } afs_int32 -pr_Write(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, char *buff, afs_int32 len) +pr_Write(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, void *buff, afs_int32 len) { /* package up seek and write into one procedure for ease of use */ afs_int32 code; @@ -72,7 +72,7 @@ pr_Write(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, char *buff, afs_in } afs_int32 -pr_Read(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, char *buff, afs_int32 len) +pr_Read(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, void *buff, afs_int32 len) { /* same thing for read */ afs_int32 code; @@ -349,7 +349,7 @@ AllocID(register struct ubik_trans *at, afs_int32 flag, afs_int32 *aid) /* allocs an id from the proper area of address space, based on flag */ register afs_int32 code = 1; register afs_int32 i = 0; - register maxcount = 50; /* to prevent infinite loops */ + register int maxcount = 50; /* to prevent infinite loops */ if (flag & PRGRP) { *aid = ntohl(cheader.maxGroup); @@ -433,12 +433,12 @@ NameToID(register struct ubik_trans *at, char aname[PR_MAXNAMELEN], afs_int32 *a } int -IDCmp(afs_int32 *a, afs_int32 *b) +IDCmp(const void *a, const void *b) { /* used to sort CPS's so that comparison with acl's is easier */ - if (*a > *b) { + if (*(afs_int32 *)a > *(afs_int32 *)b) { return 1; - } else if (*a == *b) { + } else if (*(afs_int32 *)a == *(afs_int32 *)b) { return 0; } else /* (*a < *b) */ { return -1; -- 2.39.5