Allow gssd ccaches in MEMORY: rather than FILE:
authorKevin Coffman <kwc@citi.umich.edu>
Fri, 13 Oct 2006 19:36:03 +0000 (15:36 -0400)
committerNeil Brown <neilb@suse.de>
Mon, 16 Oct 2006 23:46:39 +0000 (09:46 +1000)
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Add option to store gssd ccaches in a MEMORY: cache rather
than the default FILE: cache.  In response to suggestion
from Steve Dickson <steved@redhat.com> and
Nalin Dahyabhai <nalin@redhat.com>.

utils/gssd/gssd.c
utils/gssd/gssd.h
utils/gssd/krb5_util.c

index d6ddaae..a362974 100644 (file)
@@ -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;
index d60a499..ec91e89 100644 (file)
@@ -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;
 
index e46715b..c43eb36 100644 (file)
@@ -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;