* 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 <sys/types.h>
#include <stdio.h>
#include <winsock2.h>
#else
#include <netinet/in.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
+#endif
#include <lock.h>
#include <ubik.h>
#include <rx/xdr.h>
#include <afs/com_err.h>
+#include <afs/cellconfig.h>
#include "ptserver.h"
#include "pterror.h"
#include <stdlib.h>
extern int pr_realmNameLen;
/* We accept foreign names, so we will deal with '@' later */
- if (index (name, ':') || index(name, '\n')) return 0;
+ if (strchr (name, ':') || strchr(name, '\n')) return 0;
if (strlen (name) >= PR_MAXNAMELEN - pr_realmNameLen - 1) return 0;
return 1;
}
if (ntohl(tentry.flags) & PRGRP) {
if ((tentry.count == 0) && !admin) return PRGROUPEMPTY;
/* terminate prefix at colon if there is one */
- if (prefix = index(tentry.name, ':')) *prefix = 0;
+ if ((prefix = strchr(tentry.name, ':'))) *prefix = 0;
}
prefix = tentry.name;
}
if ((strcmp (prefix, "system") == 0) && !admin) return PRPERM;
strcpy (name, aname); /* in case aname & cname are same */
- suffix = index(name, ':');
+ suffix = strchr(name, ':');
if (suffix == 0) {
/* sysadmin can make groups w/o ':', but they must still look like
* legal user names. */
}
done:
/* check for legal name with either group rules or user rules */
- if (suffix = index(cname, ':')) {
+ if ((suffix = strchr(cname, ':'))) {
/* check for confusing characters */
- if (index(cname, '\n') || /* restrict so recreate can work */
- index(suffix+1, ':')) /* avoid multiple colons */
+ if (strchr(cname, '\n') || /* restrict so recreate can work */
+ strchr(suffix+1, ':')) /* avoid multiple colons */
return PRBADNAM;
} else {
if (!CorrectUserName (cname)) return PRBADNAM;
} else {
flags = oid = aid = 0;
}
- if (!(flags & PRACCESS)) /* provide default access */
+ if (!(flags & PRACCESS)) { /* provide default access */
if (flags & PRGRP)
flags |= PRP_GROUP_DEFAULT;
else
flags |= PRP_USER_DEFAULT;
+ }
if (flags & any) return 1;
if (oid) {
if ((flags & mem) && IsAMemberOf (ut, cid, aid)) return 1;
}
/* Allow members of SYSVIEWERID to get membership and status only */
- if (((mem == PRP_STATUS_MEM)||(mem == PRP_MEMBER_MEM))&&(IsAMemberOf (ut, cid, SYSVIEWERID))) return 1;
+ if (((mem == PRP_STATUS_MEM)||(mem == PRP_MEMBER_MEM)||
+ (any == PRP_OWNED_ANY))&&(IsAMemberOf (ut, cid, SYSVIEWERID)))
+ return 1;
if (IsAMemberOf (ut, cid, SYSADMINID)) return 1;
return 0; /* no access */
}
struct prentry tentry, tent;
char *atsign;
- bzero(&tentry, sizeof(tentry));
+ memset(&tentry, 0, sizeof(tentry));
if ((oid == 0) || (oid == ANONYMOUSID)) oid = creator;
return PRBADARG;
}
- atsign = index(aname,'@');
+ atsign = strchr(aname, '@');
if (!atsign) {
/* A normal user or group. Pick an id for it */
if (idflag)
afs_int32 hloc;
if (aid == bid) return PRINCONSISTENT;
- bzero(&hentry,sizeof(hentry));
+ memset(&hentry, 0, sizeof(hentry));
temp = FindByID(at,bid);
if (temp == 0) return PRNOENT;
code = pr_ReadEntry(at, 0, temp, &tentry);
} /* for all coentry slots */
hloc = nptr;
nptr = centry.next;
- bcopy(¢ry,&hentry,sizeof(centry));
+ memcpy(&hentry, ¢ry, sizeof(centry));
} /* while there are coentries */
return PRNOENT;
}
afs_int32 i;
afs_int32 nptr;
- if (index(tentry->name,'@')) {
+ if (strchr(tentry->name,'@')) {
if (tentry->flags & PRGRP) {
/* If there are still foreign user accounts from that cell
don't delete the group */
if (inc_header_word (at, instcount, -1)) return PRDBFAIL;
}
else {
- if (index(tentry->name,'@')) {
+ if (strchr(tentry->name,'@')) {
if (inc_header_word (at, foreigncount, -1)) return PRDBFAIL;
} else {
if (inc_header_word (at, usercount, -1)) return PRDBFAIL;
afs_int32 nptr;
afs_int32 last; /* addr of last cont. block */
afs_int32 first = 0;
- afs_int32 cloc;
+ afs_int32 cloc = 0;
afs_int32 slot = -1;
if (entry->id == aid) return PRINCONSISTENT;
else {
entry->next = nptr;
}
- bzero(&aentry,sizeof(aentry));
+ memset(&aentry, 0, sizeof(aentry));
aentry.flags |= PRCONT;
aentry.id = entry->id;
aentry.next = 0;
prlist *alist;
afs_int32 add;
{
- afs_int32 code;
+ afs_int32 code = 0;
afs_int32 i;
struct contentry centry;
afs_int32 nptr;
char oldname[PR_MAXNAMELEN];
char *atsign;
- bzero(holder,PR_MAXNAMELEN);
- bzero(temp,PR_MAXNAMELEN);
+ memset(holder, 0, PR_MAXNAMELEN);
+ memset(temp, 0, PR_MAXNAMELEN);
loc = FindByID(at,aid);
if (!loc) return PRNOENT;
code = pr_ReadEntry(at,0,loc,&tentry);
}
}
- atsign = index(tentry.name, '@'); /* check for foreign entry */
+ atsign = strchr(tentry.name, '@'); /* check for foreign entry */
/* Change the owner */
if (oid && (oid != tentry.owner)) {
{
char *newatsign;
- newatsign = index (name, '@');
+ newatsign = strchr(name, '@');
if (newatsign != atsign){ /* if they are the same no problem*/
/*if the pointers are not equal the strings better be */
if ((atsign == NULL) || (newatsign == NULL) ||
prlist *alist;
afs_int32 *size;
{
- if (!(index(tentry->name, '@')))
+ if (!(strchr(tentry->name, '@')))
return (AddToPRList (alist, size, AUTHUSERID));
else
return PRSUCCESS;