cifs.upcall: do a brute-force search for KRB5 credcache
authorJeff Layton <jlayton@redhat.com>
Wed, 14 Oct 2009 15:06:23 +0000 (11:06 -0400)
committerKarolin Seeger <kseeger@samba.org>
Wed, 13 Jan 2010 13:00:51 +0000 (14:00 +0100)
commit835906f3985cd9ea5f63d23e284b88a05145d9b5
tree95f637a58bf66889b53a9a4af862aa931b2abf6e
parent3d9e22f284e2988c6ba78b11dac02d208baf2d00
cifs.upcall: do a brute-force search for KRB5 credcache

A few weeks ago, I added some code to cifs.upcall to take the pid sent
by the kernel and use that to get the value of the $KRB5CCNAME
environment var for the process. That works fine on the initial mount,
but could be problematic on reconnect.

There's no guarantee on a reconnect that the process that initiates the
upcall will have $KRB5CCNAME pointed at the correct credcache. Because
of this, the current scheme isn't going to be reliable enough and we
need to use something different.

This patch replaces that scheme with one very similar to the one used by
rpc.gssd in nfs-utils. It searches the credcache dir (currently
hardcoded to /tmp) for a valid credcache for the given uid. If it finds
one then it uses that as the credentials cache. If it finds more than
one, it uses the one with the latest TGT expiration.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Addresses bug #6810.
(cherry picked from commit 6eacb25d736d47e1b4572aec5a143b15fbed619e)
source/client/cifs.upcall.c