LINUX: Always crref after _settok_setParentPag 47/14147/2
authorYadavendra Yadav <yadayada@in.ibm.com>
Wed, 15 Apr 2020 10:33:00 +0000 (05:33 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 17 Apr 2020 16:40:10 +0000 (12:40 -0400)
commit8002a46125e8224ba697c194edba5ad09e4cfc44
tree13bbeded29af11c8b356687bcd18518c569b463d
parent826bb826274e48c867b41cb948d031a423373901
LINUX: Always crref after _settok_setParentPag

Commit b61eac78 (Linux: setpag() may replace credentials) changed
PSetTokens2 to call crref() after _settok_setParentPag(), since
changing the parent PAG may change our credentials structure. But that
commit did not update the old pioctl PSetTokens, so -setpag
functionality remained broken on Linux for utilities that called the
old pioctl ('klog' is one such utility).

To fix this, we could copy the same code from PSetTokens2 into
PSetTokens. But instead just move this code into _settok_setParentPag
itself, to avoid code duplication. This commit also refactors
_settok_setParentPag a little to make the platform-specific ifdefs a
little easier to read through.

Change-Id: I65a165ebb1d823e690926de31b28a7728d2561b9
Reviewed-on: https://gerrit.openafs.org/14147
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Yadavendra Yadav <yadayada@in.ibm.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/afs_pioctl.c