From: Marc Dionne Date: Sat, 19 Jan 2013 03:40:03 +0000 (-0500) Subject: Linux: setpag() may replace credentials X-Git-Tag: upstream/1.8.0_pre1^2~1658 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=b61eac783e8c092cd4ba9f53a2b5ca7d43e08b1b;p=packages%2Fo%2Fopenafs.git Linux: setpag() may replace credentials For recent Linux. setpag() may replace the current process' cred structure with a new one. This is not a problem for most callers, but in the case of processing a SetTokens2 pioctl with the setpag option, the new credentials should be used to determine the target for the token. Change-Id: I4441349b8a72eac7d56276abcdf243b2ffd21b98 Reviewed-on: http://gerrit.openafs.org/8924 Reviewed-by: Chas Williams - CONTRACTOR Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 0d7747186..b6b200934 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -5328,7 +5328,15 @@ DECL_PIOCTL(PSetTokens2) } if (tokenSet.flags & AFSTOKEN_EX_SETPAG) { +#if defined(AFS_LINUX26_ENV) + afs_ucred_t *old_cred = *acred; +#endif if (_settok_setParentPag(acred) == 0) { +#if defined(AFS_LINUX26_ENV) + /* setpag() may have changed our credentials */ + *acred = crref(); + crfree(old_cred); +#endif afs_InitReq(&treq, *acred); areq = &treq; }