* directory or online at http://www.openafs.org/dl/license10.html
*/
+#include <afsconfig.h>
#include <afs/param.h>
+
+RCSID("$Header$");
+
#include <afs/stds.h>
#include <ctype.h>
#include <stdio.h>
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#else
-#include <strings.h>
#include <netinet/in.h>
#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
#include "ptserver.h"
#include "pterror.h"
#include "afs/audit.h"
afs_int32 listElements(), listOwned(), isAMemberOf(), idToName();
static stolower();
-extern afs_int32 IDCmp();
+extern int IDCmp();
/* When abort, reset initd so that the header is read in on next call.
* Abort the transarction and return the code.
goto done; /* no longer supported */
}
else if (code == 2) { /* kad class */
- if (code = rxkad_GetServerInfo
- (acall->conn, (afs_int32 *) 0, 0/*was &exp*/,
- name, inst, tcell, (afs_int32 *) 0))
+ if ((code = rxkad_GetServerInfo
+ (acall->conn, NULL, 0/*was &exp*/,
+ name, inst, tcell, NULL)))
goto done;
#if 0
/* This test is unnecessary, since rxkad_GetServerInfo already check.
return 0;
}
-afs_int32 PR_INewEntry (call,aname,aid,oid)
+afs_int32 SPR_INewEntry (call,aname,aid,oid)
struct rx_call *call;
char aname[PR_MAXNAMELEN];
afs_int32 aid;
}
-afs_int32 PR_NewEntry (call, aname, flag, oid, aid)
+afs_int32 SPR_NewEntry (call, aname, flag, oid, aid)
struct rx_call *call;
char aname[PR_MAXNAMELEN];
afs_int32 flag;
if (code) ABORT_WITH(tt,code);
/* this is for cross-cell self registration. It is not added in the
- * PR_INewEntry because we want self-registration to only do
+ * SPR_INewEntry because we want self-registration to only do
* automatic id assignment.
*/
code = WhoIsThisWithName(call,tt,&cid,cname);
-afs_int32 PR_WhereIsIt (call,aid,apos)
+afs_int32 SPR_WhereIsIt (call,aid,apos)
struct rx_call *call;
afs_int32 aid;
afs_int32 *apos;
}
-afs_int32 PR_DumpEntry (call,apos, aentry)
+afs_int32 SPR_DumpEntry (call,apos, aentry)
struct rx_call *call;
afs_int32 apos;
struct prdebugentry *aentry;
code = pr_ReadEntry(tt, 0, apos, aentry);
if (code) ABORT_WITH(tt,code);
- if (!AccessOK (tt, cid, aentry, PRP_STATUS_MEM, PRP_STATUS_ANY))
+ if (!AccessOK (tt, cid, 0, PRP_STATUS_MEM, 0))
ABORT_WITH(tt,PRPERM);
/* Since prdebugentry is in the form of a prentry not a coentry, we will
return PRSUCCESS;
}
-afs_int32 PR_AddToGroup (call,aid,gid)
+afs_int32 SPR_AddToGroup (call,aid,gid)
struct rx_call *call;
afs_int32 aid;
afs_int32 gid;
if (code) ABORT_WITH(tt,PRPERM);
tempu = FindByID(tt,aid);
if (!tempu) ABORT_WITH(tt,PRNOENT);
- bzero(&uentry,sizeof(uentry));
+ memset(&uentry, 0, sizeof(uentry));
code = pr_ReadEntry(tt,0,tempu,&uentry);
if (code != 0) ABORT_WITH(tt,code);
/* we don't allow groups as members of groups at present */
return PRSUCCESS;
}
-afs_int32 PR_NameToID (call, aname, aid)
+afs_int32 SPR_NameToID (call, aname, aid)
struct rx_call *call;
namelist *aname;
idlist *aid;
/* Initialize return struct */
aid->idlist_len = 0;
- aid->idlist_val = (afs_int32 *)0;
+ aid->idlist_val = NULL;
size = aname->namelist_len;
if (size == 0) return 0;
}
/*
- * PR_IDToName
+ * SPR_IDToName
* Given an array of ids, find the name for each of them.
* The array of ids and names is unlimited.
*/
-afs_int32 PR_IDToName (call, aid, aname)
+afs_int32 SPR_IDToName (call, aid, aname)
struct rx_call *call;
idlist *aid;
namelist *aname;
/* leave this first for rpc stub */
size = aid->idlist_len;
- if (size <= 0) size = 0;
+ if (size == 0) return 0;
+ if (size < 0) return PRTOOMANY;
aname->namelist_val = (prname *)malloc(size*PR_MAXNAMELEN);
aname->namelist_len = 0;
+ if (aname->namelist_val == 0) return PRNOMEM;
if (aid->idlist_len == 0) return 0;
if (size == 0) return PRTOOMANY; /* rxgen will probably handle this */
return PRSUCCESS;
}
-afs_int32 PR_Delete (call, aid)
+afs_int32 SPR_Delete (call, aid)
struct rx_call *call;
afs_int32 aid;
{
return PRSUCCESS;
}
-afs_int32 PR_UpdateEntry (call, aid, name, uentry)
+afs_int32 SPR_UpdateEntry (call, aid, name, uentry)
struct rx_call *call;
afs_int32 aid;
char *name;
return PRSUCCESS;
}
-afs_int32 PR_RemoveFromGroup (call,aid,gid)
+afs_int32 SPR_RemoveFromGroup (call,aid,gid)
struct rx_call *call;
afs_int32 aid;
afs_int32 gid;
if (!tempu) ABORT_WITH(tt,PRNOENT);
tempg = FindByID(tt,gid);
if (!tempg) ABORT_WITH(tt,PRNOENT);
- bzero(&uentry,sizeof(uentry));
- bzero(&gentry,sizeof(gentry));
+ memset(&uentry, 0, sizeof(uentry));
+ memset(&gentry, 0, sizeof(gentry));
code = pr_ReadEntry(tt,0,tempu,&uentry);
if (code != 0) ABORT_WITH(tt,code);
code = pr_ReadEntry(tt,0,tempg,&gentry);
}
-afs_int32 PR_GetCPS (call, aid, alist, over)
+afs_int32 SPR_GetCPS (call, aid, alist, over)
struct rx_call *call;
afs_int32 aid;
prlist *alist;
*over = 0;
alist->prlist_len = 0;
- alist->prlist_val = (afs_int32 *) 0;
+ alist->prlist_val = NULL;
code = Initdb();
if (code != PRSUCCESS) return code;
code = ubik_BeginTransReadAny(dbase,UBIK_READTRANS,&tt);
#endif /* IP_WILDCARDS */
-afs_int32 PR_GetCPS2 (call, aid, ahost, alist, over)
+afs_int32 SPR_GetCPS2 (call, aid, ahost, alist, over)
struct rx_call *call;
afs_int32 aid;
afs_int32 ahost;
*over = 0;
iaddr.s_addr = ntohl(ahost);
alist->prlist_len = 0;
- alist->prlist_val = (afs_int32 *) 0;
+ alist->prlist_val = NULL;
code = Initdb();
if (code != PRSUCCESS) return code;
code = ubik_BeginTransReadAny(dbase,UBIK_READTRANS,&tt);
}
-afs_int32 PR_GetHostCPS (call, ahost, alist, over)
+afs_int32 SPR_GetHostCPS (call, ahost, alist, over)
struct rx_call *call;
afs_int32 ahost;
prlist *alist;
*over = 0;
iaddr.s_addr = ntohl(ahost);
alist->prlist_len = 0;
- alist->prlist_val = (afs_int32 *) 0;
+ alist->prlist_val = NULL;
code = Initdb();
if (code != PRSUCCESS) return code;
code = ubik_BeginTransReadAny(dbase,UBIK_READTRANS,&tt);
}
-afs_int32 PR_ListMax (call,uid,gid)
+afs_int32 SPR_ListMax (call,uid,gid)
struct rx_call *call;
afs_int32 *uid;
afs_int32 *gid;
return PRSUCCESS;
}
-afs_int32 PR_SetMax (call,aid,gflag)
+afs_int32 SPR_SetMax (call,aid,gflag)
struct rx_call *call;
afs_int32 aid;
afs_int32 gflag;
return PRSUCCESS;
}
-afs_int32 PR_ListEntry (call,aid,aentry)
+afs_int32 SPR_ListEntry (call,aid,aentry)
struct rx_call *call;
afs_int32 aid;
struct prcheckentry *aentry;
ABORT_WITH(tt,PRPERM);
aentry->flags = tentry.flags >> PRIVATE_SHIFT;
- if (aentry->flags == 0)
+ if (aentry->flags == 0) {
if (tentry.flags & PRGRP)
aentry->flags = PRP_GROUP_DEFAULT >> PRIVATE_SHIFT;
else aentry->flags = PRP_USER_DEFAULT >> PRIVATE_SHIFT;
+ }
aentry->owner = tentry.owner;
aentry->id = tentry.id;
strncpy(aentry->name,tentry.name,PR_MAXNAMELEN);
aentry->ngroups = tentry.ngroups;
aentry->nusers = tentry.nusers;
aentry->count = tentry.count;
- bzero (aentry->reserved, sizeof(aentry->reserved));
+ memset(aentry->reserved, 0, sizeof(aentry->reserved));
code = ubik_EndTrans(tt);
if (code) return code;
return PRSUCCESS;
}
-afs_int32 PR_ListEntries(call, flag, startindex, bulkentries, nextstartindex)
+afs_int32 SPR_ListEntries(call, flag, startindex, bulkentries, nextstartindex)
struct rx_call *call;
afs_int32 flag;
afs_int32 startindex;
afs_int32 code;
struct ubik_trans *tt;
afs_int32 cid;
- afs_int32 temp, i, eof, pos, maxentries, f;
+ afs_int32 i, eof, pos, maxentries, f;
struct prentry tentry;
afs_int32 pollcount=0;
entry->nusers = tentry->nusers;
entry->count = tentry->count;
strncpy(entry->name,tentry->name,PR_MAXNAMELEN);
- bzero(entry->reserved, sizeof(entry->reserved));
+ memset(entry->reserved, 0, sizeof(entry->reserved));
bulkentries->prentries_len++;
return 0;
}
-afs_int32 PR_ChangeEntry (call,aid,name,oid,newid)
+afs_int32 SPR_ChangeEntry (call,aid,name,oid,newid)
struct rx_call *call;
afs_int32 aid;
char *name;
return code;
}
-afs_int32 PR_SetFieldsEntry (call, id, mask, flags, ngroups, nusers, spare1, spare2)
+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 */
return code;
}
-afs_int32 PR_ListElements (call, aid, alist, over)
+afs_int32 SPR_ListElements (call, aid, alist, over)
struct rx_call *call;
afs_int32 aid;
prlist *alist;
*over = 0;
alist->prlist_len = 0;
- alist->prlist_val = (afs_int32 *) 0;
+ alist->prlist_val = NULL;
code = Initdb();
if (code != PRSUCCESS) return code;
}
/*
- * PR_istOwned
+ * SPR_ListOwned
* List the entries owned by this id. If the id is zero,
* return the orphans list. This will return up to PR_MAXGROUPS
* at a time with the lastP available to get the rest. The
* maximum value is enforced in GetOwnedChain().
*/
-afs_int32 PR_ListOwned (call, aid, alist, lastP)
+afs_int32 SPR_ListOwned (call, aid, alist, lastP)
struct rx_call *call;
afs_int32 aid;
prlist *alist;
afs_int32 start;
alist->prlist_len = 0;
- alist->prlist_val = (afs_int32 *) 0;
+ alist->prlist_val = NULL;
if (!lastP) return PRBADARG;
start = *lastP;
return code;
}
-afs_int32 PR_IsAMemberOf (call,uid,gid,flag)
+afs_int32 SPR_IsAMemberOf (call,uid,gid,flag)
struct rx_call *call;
afs_int32 uid;
afs_int32 gid;
register char *s;
{
register int tc;
- while (tc = *s) {
+ while ((tc = *s)) {
if (isupper(tc)) *s = tolower(tc);
s++;
}
int size = 0, i, code;
int added = 0;
- while (host = (host & wild)) {
+ while ((host = (host & wild))) {
wild = htonl ( ntohl(wild) << 8) ;
iaddr.s_addr = host;
code = NameToID(tt, inet_ntoa(iaddr),&hostid);
} else
continue;
wlist.prlist_len = 0;
- wlist.prlist_val = (afs_int32 *) 0;
+ wlist.prlist_val = NULL;
code = GetList (tt, &tentry, &wlist, 0);
if (code) return code;
added += wlist.prlist_len;
for (i=0; i< wlist.prlist_len; i++) {
if (!inCPS(*alist,wlist.prlist_val[i]))
- if (code = AddToPRList (alist, &size, wlist.prlist_val[i] )) {
+ if ((code = AddToPRList (alist, &size, wlist.prlist_val[i] ))) {
free(wlist.prlist_val);
return(code);
}
int clen;
extern char *pr_realmName;
- if (code = rxkad_GetServerInfo
- (acall->conn, (afs_int32 *) 0, 0/*was &exp*/,
- name, inst, tcell, (afs_int32 *) 0))
+ if ((code = rxkad_GetServerInfo
+ (acall->conn, NULL, 0/*was &exp*/,
+ name, inst, tcell, NULL)))
goto done;
strncpy (vname, name, sizeof(vname));
- if (ilen = strlen (inst)) {
+ if ((ilen = strlen(inst))) {
if (strlen(vname) + 1 + ilen >= sizeof(vname)) goto done;
strcat (vname, ".");
strcat (vname, inst);
}
- if (clen = strlen (tcell)){
+ if ( (clen = strlen(tcell))) {
#if defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
static char local_realm[AFS_REALM_SZ] = "";