diff --git a/src/ptserver/ptprocs.c b/src/ptserver/ptprocs.c index ae1a562920..f9f48fc689 100644 --- a/src/ptserver/ptprocs.c +++ b/src/ptserver/ptprocs.c @@ -345,13 +345,19 @@ newEntry(struct rx_call *call, char aname[], afs_int32 flag, afs_int32 oid, * automatic id assignment. */ code = WhoIsThisWithName(call, tt, cid, cname); - if (code != 2) { /* 2 specifies that this is a foreign cell request */ - if (code) - ABORT_WITH(tt, PRPERM); - admin = IsAMemberOf(tt, *cid, SYSADMINID); - } else { - admin = ((!restricted && !strcmp(aname, cname))) || IsAMemberOf(tt, *cid, SYSADMINID); - oid = *cid = SYSADMINID; + if (code && code != 2) + ABORT_WITH(tt, PRPERM); + admin = IsAMemberOf(tt, *cid, SYSADMINID); + if (code == 2 /* foreign cell request */) { + if (!restricted && (strcmp(aname, cname) == 0)) { + /* can't autoregister while providing an owner id */ + if (oid != 0) + ABORT_WITH(tt, PRPERM); + + admin = 1; + oid = SYSADMINID; + *cid = SYSADMINID; + } } if (!CreateOK(tt, *cid, oid, flag, admin)) ABORT_WITH(tt, PRPERM);