pts: add some sanity checks in ptuser.c

Double-check that when we're expecting two entries back, we
actually got two entries, in addition to the RPC return value.

Change-Id: I34631ac542667c337ed3268153eb61c70e3fa87e
Reviewed-on: https://gerrit.openafs.org/11668
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Benjamin Kaduk 2015-01-13 21:39:57 -05:00
parent 32901c58b2
commit f413fd927a

View File

@ -444,6 +444,10 @@ pr_AddToGroup(prname user, prname group)
if (code)
goto done;
/* if here, still could be missing an entry */
if (lids.idlist_len != 2) {
code = PRINTERNAL;
goto done;
}
if (lids.idlist_val[0] == ANONYMOUSID
|| lids.idlist_val[1] == ANONYMOUSID) {
code = PRNOENT;
@ -483,6 +487,10 @@ pr_RemoveUserFromGroup(prname user, prname group)
if (code)
goto done;
if (lids.idlist_len != 2) {
code = PRINTERNAL;
goto done;
}
if (lids.idlist_val[0] == ANONYMOUSID
|| lids.idlist_val[1] == ANONYMOUSID) {
code = PRNOENT;
@ -988,6 +996,11 @@ pr_IsAMemberOf(prname uname, prname gname, afs_int32 *flag)
xdr_free((xdrproc_t) xdr_idlist, &lids);
return code;
}
if (lids.idlist_len != 2) {
free(lnames.namelist_val);
xdr_free((xdrproc_t) xdr_idlist, &lids);
return PRINTERNAL;
}
code =
ubik_PR_IsAMemberOf(pruclient, 0, lids.idlist_val[0],
lids.idlist_val[1], flag);