]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
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 d6ddaaec911f09203d2265b783c9384d64fed2be..a362974a92438ad09ba92bca2d2d41fb2a183a89 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 d60a499945266a4eb4d53caff5978712537dde9c..ec91e8980117391a7aa3b19b664212355cefa544 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 e46715baf32594924fe4f4242154b241ef6ceaab..c43eb36254e33a766c0f5897c99fffc43fdbd1a0 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;