summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Layton <jlayton@samba.org>2016-08-24 11:41:53 -0400
committerJeff Layton <jlayton@samba.org>2016-08-24 11:41:53 -0400
commit39dbb7b47bea9d6d7cf93ddd53cda501c3898bd6 (patch)
treee7240af01883a3a5c108992a675f79b4623096dc
parent3db6b3a814a2908b230fcfbdb82846775e56dd93 (diff)
downloadcifs-utils-39dbb7b47bea9d6d7cf93ddd53cda501c3898bd6.tar.gz
cifs-utils-39dbb7b47bea9d6d7cf93ddd53cda501c3898bd6.tar.bz2
cifs-utils-39dbb7b47bea9d6d7cf93ddd53cda501c3898bd6.zip
cifs.upcall: make get_tgt_time take a ccache arg
...instead of dealing with the ccname. Push resolution of the cache into the caller. Signed-off-by: Jeff Layton <jlayton@samba.org>
-rw-r--r--cifs.upcall.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/cifs.upcall.c b/cifs.upcall.c
index a258335..a205766 100644
--- a/cifs.upcall.c
+++ b/cifs.upcall.c
@@ -102,20 +102,14 @@ krb5_auth_con_getsendsubkey(krb5_context context,
#endif
/* does the ccache have a valid TGT? */
-static time_t get_tgt_time(const char *ccname)
+static time_t get_tgt_time(krb5_ccache ccache)
{
- krb5_ccache ccache;
krb5_cc_cursor cur;
krb5_creds creds;
krb5_principal principal;
time_t credtime = 0;
char *realm = NULL;
- if (krb5_cc_resolve(context, ccname, &ccache)) {
- syslog(LOG_DEBUG, "%s: unable to resolve krb5 cache", __func__);
- goto err_cache;
- }
-
if (krb5_cc_set_flags(context, ccache, 0)) {
syslog(LOG_DEBUG, "%s: unable to set flags", __func__);
goto err_cache;
@@ -156,8 +150,6 @@ err_endseq:
krb5_cc_end_seq_get(context, ccache, &cur);
err_ccstart:
krb5_free_principal(context, principal);
-err_princ:
- krb5_cc_close(context, ccache);
err_cache:
return credtime;
}
@@ -167,15 +159,22 @@ get_default_cc(void)
{
const char *ccname;
char *rcc = NULL;
+ krb5_ccache ccache;
ccname = krb5_cc_default_name(context);
if (!ccname) {
- syslog(LOG_DEBUG, "krb5_cc_default returned NULL.");
+ syslog(LOG_DEBUG, "%s: krb5_cc_default returned NULL.", __func__);
return NULL;
}
- if (get_tgt_time(ccname))
+ if (krb5_cc_resolve(context, ccname, &ccache)) {
+ syslog(LOG_DEBUG, "%s: unable to resolve krb5 cache", __func__);
+ return NULL;
+ }
+
+ if (get_tgt_time(ccache))
rcc = strdup(ccname);
+ krb5_cc_close(context, ccache);
return rcc;
}