#include "ptint.h"
#include "pterror.h"
#include "ptserver.h"
+#include "ptuser.h"
struct prheader cheader;
int fd;
}
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;
*/
afs_int32
-ReadHeader()
+ReadHeader(void)
{
afs_int32 code;
}
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);
}
#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... */
#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)) || \
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];
}
-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;
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));
return (nflag ? pre.nextName : pre.nextID);
}
-void
+static void
add_group(long id)
{
struct grp_list *g;
g->groups[i] = id;
}
-void
-display_groups()
+static void
+display_groups(void)
{
register int i, id;
struct grp_list *g;
}
}
-void
+static void
display_group(int id)
{
register int i, offset;
}
}
-void
+static void
fix_pre(struct prentry *pre)
{
register int i;
}
}
-char *
+static char *
id_to_name(int id)
{
register int offset;
return 0;
}
-char *
+static char *
checkin(struct prentry *pre)
{
struct hash_entry *he, *last;
return (he->h_name);
}
-char *
+static char *
check_core(register int id)
{
struct hash_entry *he;
#endif /* !AFS_PTHREAD_ENV */
int
-GetToken(format, l)
- char *format;
- afs_int32 *l;
+GetToken(char *format, afs_int32 *l)
{
int c;
#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
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.
#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;
}
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 */
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, ".");
}
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;
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. */
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;
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();
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;
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;
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;
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;
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);
}
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;
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;
}
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;
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;
* 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;
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;
}
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;
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;
}
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;
}
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;
}
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;
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;
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;
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;
#ifdef IP_WILDCARDS
int
-inCPS(CPS, id)
- prlist CPS;
- afs_int32 id;
+inCPS(prlist CPS, afs_int32 id)
{
int i;
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;
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;
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);
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;
}
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);
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;
}
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;
}
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;
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;
}
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;
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;
}
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;
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;
}
#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;
}
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;
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;
}
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;
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;
}
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;
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;
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;
}
#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;
* 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;
}
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;
}
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;
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;
}
#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;
}
#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 */
#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
#include <rx/rx.h>
#include <rx/xdr.h>
#include "ptclient.h"
+#include "ptuser.h"
#include "pterror.h"
+#include "ptprototypes.h"
#include <afs/afsutil.h>
#include <afs/com_err.h>
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;
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;
return 0;
}
-int
+static int
pts_Sleep(struct cmd_syndesc *as, void *arock)
{
int delay;
return 0;
}
-int
-popsource()
+static int
+popsource(void)
{
register struct sourcestack *sp;
if (!(sp = shead))
}
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
return 0;
}
-int
+static int
GetGlobals(struct cmd_syndesc *as, void *arock)
{
struct authstate *state = (struct authstate *) arock;
return code;
}
-int
+static int
CleanUp(struct cmd_syndesc *as, void *arock)
{
if (as && !strcmp(as->name, "help"))
return 0;
}
-int
+static int
CreateGroup(struct cmd_syndesc *as, void *arock)
{
register afs_int32 code;
return 0;
}
-int
+static int
CreateUser(struct cmd_syndesc *as, void *arock)
{
register afs_int32 code;
#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;
#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;
}
-int
+static int
AddToGroup(struct cmd_syndesc *as, void *arock)
{
register afs_int32 code;
return 0;
}
-int
+static int
RemoveFromGroup(struct cmd_syndesc *as, void *arock)
{
register afs_int32 code;
return 0;
}
-int
+static int
ListMembership(struct cmd_syndesc *as, void *arock)
{
register afs_int32 code;
return 0;
}
-int
+static int
Delete(struct cmd_syndesc *as, void *arock)
{
register afs_int32 code;
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;
return (rcode);
}
-int
+static int
ListEntries(struct cmd_syndesc *as, void *arock)
{
afs_int32 code = 0;
return code;
}
-int
+static int
ChownGroup(struct cmd_syndesc *as, void *arock)
{
register afs_int32 code;
return code;
}
-int
+static int
ChangeName(struct cmd_syndesc *as, void *arock)
{
register afs_int32 code;
return code;
}
-int
+static int
ListMax(struct cmd_syndesc *as, void *arock)
{
register afs_int32 code;
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;
return code;
}
-int
+static int
SetFields(struct cmd_syndesc *as, void *arock)
{
register afs_int32 code;
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:
return 0;
}
-int
+static int
ListOwned(struct cmd_syndesc *as, void *arock)
{
register afs_int32 code;
}
static void
-add_std_args(register struct cmd_syndesc *ts)
+add_std_args(struct cmd_syndesc *ts)
{
char test_help[AFSDIR_PATH_MAX];
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);
finished = 1;
source = NULL;
- if (code = cmd_Dispatch(argc, argv)) {
+ if ((code = cmd_Dispatch(argc, argv))) {
CleanUp(NULL, NULL);
exit(1);
}
#include <afs/auth.h>
#include <afs/keys.h>
#include "ptserver.h"
+#include "ptprototypes.h"
#include "error_macros.h"
#include "afs/audit.h"
#include <afs/afsutil.h>
#include <afs/com_err.h>
-
+#include <rx/rxstat.h>
/* make all of these into a structure if you want */
struct prheader cheader;
extern afs_int32 depthsg;
#endif
-extern int afsconf_ServerAuth();
-extern int afsconf_CheckAuth();
-
int pr_realmNameLen;
char *pr_realmName;
#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') {
struct rx_service *tservice;
struct rx_securityClass *sc[3];
extern int RXSTATS_ExecuteRequest();
- extern int PR_ExecuteRequest();
#if 0
struct ktc_encryptionKey tkey;
#endif
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
}
int
-pr_End()
+pr_End(void)
{
int code = 0;
#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 */
#include <afs/cellconfig.h>
#include "ptserver.h"
#include "pterror.h"
+#include "ptprototypes.h"
#include <stdlib.h>
/* Foreign cells are represented by the group system:authuser@cell*/
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;
#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;
afs_int32 initd = 0;
afs_int32
-Initdb()
+Initdb(void)
{
afs_int32 code;
struct ubik_trans *tt;
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;
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);
}
-afs_int32
+static afs_int32
allocNextId(struct ubik_trans * at, struct prentry * cellEntry)
{
/* Id's for foreign cell entries are constructed as follows:
return id;
}
-int
+static int
inRange(struct prentry *cellEntry, afs_int32 aid)
{
afs_uint32 id, cellid, groupid;
}
-int
+static int
AddAuthGroup(struct prentry *tentry, prlist *alist, afs_int32 *size)
{
if (!(strchr(tentry->name, '@')))
#include <afs/afsutil.h>
#include <afs/com_err.h>
#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)
}
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
return 0;
}
-void
+static void
skip(char **s)
{
while (**s != ' ' && **s != '\t' && **s != '\0')
#include <afs/afsutil.h>
#include <afs/com_err.h>
#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
#include <netinet/in.h>
#endif
#include <string.h>
+#include <math.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <afs/cellconfig.h>
#include "ptclient.h"
#include "pterror.h"
+#include "ptuser.h"
+#include "ptprototypes.h"
#include <afs/afsutil.h>
#include <afs/com_err.h>
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;
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);
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 */
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);
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) {
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);
}
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)) {
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);
}
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
#include <sys/types.h>
#include <netinet/in.h>
#include <string.h>
+#include <stdarg.h>
#include <lock.h>
#define UBIK_INTERNALS
#include <afs/stds.h>
+#include <afs/cellconfig.h>
#include <ubik.h>
#include <rx/xdr.h>
#include "ptint.h"
return (0);
}
-long
+int
ubik_SetLock(struct ubik_trans *atrans, afs_int32 apos, afs_int32 alen,
int atype)
{
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);
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");
}
int
-ubik_Write(struct ubik_trans *tt, char *buf, long len)
+ubik_Write(struct ubik_trans *tt, void *buf, afs_int32 len)
{
int status;
}
int
-ubik_Read(struct ubik_trans *tt, char *buf, long len)
+ubik_Read(struct ubik_trans *tt, void *buf, afs_int32 len)
{
int status;
return (1);
}
if (status < len)
- memset(&buf[status], 0, len - status);
+ memset((char *)buf + status, 0, len - status);
return (0);
}
afs_int32 depth);
#endif
-afs_int32
+static afs_int32
IDHash(afs_int32 x)
{
/* returns hash bucket for 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;
}
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;
/* 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);
}
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;