cifs.upcall: do a brute-force search for KRB5 credcache
commitb20aba35fdee6a43fbceb0b656c803c451d3e13b
authorJeff Layton <jlayton@redhat.com>
Wed, 14 Oct 2009 14:59:00 +0000 (14 10:59 -0400)
committerKarolin Seeger <kseeger@samba.org>
Tue, 20 Oct 2009 13:00:34 +0000 (20 15:00 +0200)
tree4978b7cb17435f72b2d1ecbe97180a296a7011da
parentd818ccafee4f494bec1cc29fbac2ea4f7a51a3af
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 5df191a5fdad480d00d278c7f5046c6f0b80e386)
source3/client/cifs.upcall.c