From 6e18539119224c930760ab801c24efe92b809a1e Mon Sep 17 00:00:00 2001 From: Kevin Coffman Date: Fri, 13 Oct 2006 15:36:03 -0400 Subject: [PATCH] Allow gssd ccaches in MEMORY: rather than FILE: Signed-off-by: Kevin Coffman Add option to store gssd ccaches in a MEMORY: cache rather than the default FILE: cache. In response to suggestion from Steve Dickson and Nalin Dahyabhai . --- utils/gssd/gssd.c | 6 +++++- utils/gssd/gssd.h | 1 + utils/gssd/krb5_util.c | 8 +++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c index d6ddaae..a362974 100644 --- a/utils/gssd/gssd.c +++ b/utils/gssd/gssd.c @@ -56,6 +56,7 @@ char pipefsdir[PATH_MAX] = GSSD_PIPEFS_DIR; char keytabfile[PATH_MAX] = GSSD_DEFAULT_KEYTAB_FILE; char ccachedir[PATH_MAX] = GSSD_DEFAULT_CRED_DIR; +int use_memcache = 0; void sig_die(int signal) @@ -92,7 +93,7 @@ main(int argc, char *argv[]) extern char *optarg; char *progname; - while ((opt = getopt(argc, argv, "fvrmp:k:d:")) != -1) { + while ((opt = getopt(argc, argv, "fvrmMp:k:d:")) != -1) { switch (opt) { case 'f': fg = 1; @@ -100,6 +101,9 @@ main(int argc, char *argv[]) case 'm': /* Accept but ignore this. Now the default. */ break; + case 'M': + use_memcache = 1; + break; case 'v': verbosity++; break; diff --git a/utils/gssd/gssd.h b/utils/gssd/gssd.h index d60a499..ec91e89 100644 --- a/utils/gssd/gssd.h +++ b/utils/gssd/gssd.h @@ -61,6 +61,7 @@ enum {AUTHTYPE_KRB5, AUTHTYPE_SPKM3, AUTHTYPE_LIPKEY}; extern char pipefsdir[PATH_MAX]; extern char keytabfile[PATH_MAX]; extern char ccachedir[PATH_MAX]; +extern int use_memcache; TAILQ_HEAD(clnt_list_head, clnt_info) clnt_list; diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c index e46715b..c43eb36 100644 --- a/utils/gssd/krb5_util.c +++ b/utils/gssd/krb5_util.c @@ -334,6 +334,7 @@ gssd_get_single_krb5_cred(krb5_context context, char cc_name[BUFSIZ]; int code; time_t now = time(0); + char *cache_type; memset(&my_creds, 0, sizeof(my_creds)); @@ -380,7 +381,12 @@ gssd_get_single_krb5_cred(krb5_context context, * Initialize cache file which we're going to be using */ - snprintf(cc_name, sizeof(cc_name), "FILE:%s/%s%s_%s", + if (use_memcache) + cache_type = "MEMORY"; + else + cache_type = "FILE"; + snprintf(cc_name, sizeof(cc_name), "%s:%s/%s%s_%s", + cache_type, GSSD_DEFAULT_CRED_DIR, GSSD_DEFAULT_CRED_PREFIX, GSSD_DEFAULT_MACHINE_CRED_SUFFIX, ple->realm); ple->endtime = my_creds.times.endtime; -- 2.39.5