+2006-03-28 kwc@citi.umich.edu
+ Add option to specify directory to search for credentials cache files
+
+
+ From: Vince Busam <vbusam@google.com>
+ Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
+
+ Add command line option to specify which directory should be searched
+ to find credentials caches.
+ (really this time)
+
2006-03-28 kwc@citi.umich.edu
Must still use knowledge of the glue context for pre-1.4 versions of MIT krb5
char pipefsdir[PATH_MAX] = GSSD_PIPEFS_DIR;
char keytabfile[PATH_MAX] = GSSD_DEFAULT_KEYTAB_FILE;
+char ccachedir[PATH_MAX] = GSSD_DEFAULT_CRED_DIR;
void
sig_die(int signal)
static void
usage(char *progname)
{
- fprintf(stderr, "usage: %s [-f] [-v] [-r] [-p pipefsdir] [-k keytab]\n",
+ fprintf(stderr, "usage: %s [-f] [-v] [-r] [-p pipefsdir] [-k keytab] [-d ccachedir]\n",
progname);
exit(1);
}
extern char *optarg;
char *progname;
- while ((opt = getopt(argc, argv, "fvrmp:k:")) != -1) {
+ while ((opt = getopt(argc, argv, "fvrmp:k:d:")) != -1) {
switch (opt) {
case 'f':
fg = 1;
if (keytabfile[sizeof(keytabfile)-1] != '\0')
errx(1, "keytab path name too long");
break;
+ case 'd':
+ strncpy(ccachedir, optarg, sizeof(ccachedir));
+ if (ccachedir[sizeof(ccachedir-1)] != '\0')
+ errx(1, "ccachedir path name too long");
+ break;
default:
usage(argv[0]);
break;
.SH NAME
rpc.gssd \- rpcsec_gss daemon
.SH SYNOPSIS
-.B "rpc.gssd [-f] [-k keytab] [-p pipefsdir] [-v] [-r]"
+.B "rpc.gssd [-f] [-k keytab] [-p pipefsdir] [-v] [-r] [-d ccachedir]"
.SH DESCRIPTION
The rpcsec_gss protocol gives a means of using the gss-api generic security
api to provide security for protocols using rpc (in particular, nfs). Before
where to look for the rpc_pipefs filesystem. The default value is
"/var/lib/nfs/rpc_pipefs".
.TP
+.B -d directory
+Tells
+.B rpc.gssd
+where to look for kerberos credential files. The default value is "/tmp".
+.TP
.B -v
Increases the verbosity of the output (can be specified multiple times).
.TP
}
/*
- * Look in the GSSD_DEFAULT_CRED_DIR for files that look like they
+ * Look in the ccachedir for files that look like they
* are Kerberos Credential Cache files for a given UID. Return
* non-zero and the dirent pointer for the entry most likely to be
* what we want. Otherwise, return zero and no dirent pointer.
struct stat best_match_stat, tmp_stat;
*d = NULL;
- n = scandir(GSSD_DEFAULT_CRED_DIR, &namelist, select_krb5_ccache, 0);
+ n = scandir(ccachedir, &namelist, select_krb5_ccache, 0);
if (n < 0) {
perror("scandir looking for krb5 credentials caches");
}
if (strstr(namelist[i]->d_name, substring) ||
!strcmp(namelist[i]->d_name, fullstring)) {
snprintf(statname, sizeof(statname),
- "%s/%s", GSSD_DEFAULT_CRED_DIR,
+ "%s/%s", ccachedir,
namelist[i]->d_name);
if (stat(statname, &tmp_stat)) {
printerr(0, "Error doing stat "
memset(buf, 0, sizeof(buf));
if (gssd_find_existing_krb5_ccache(uid, &d)) {
snprintf(buf, sizeof(buf), "FILE:%s/%s",
- GSSD_DEFAULT_CRED_DIR, d->d_name);
+ ccachedir, d->d_name);
free(d);
}
else
snprintf(buf, sizeof(buf), "FILE:%s/%s%u",
- GSSD_DEFAULT_CRED_DIR,
- GSSD_DEFAULT_CRED_PREFIX, uid);
+ ccachedir, GSSD_DEFAULT_CRED_PREFIX, uid);
printerr(2, "using %s as credentials cache for client with "
"uid %u for server %s\n", buf, uid, servername);
gssd_set_krb5_ccache_name(buf);