From f6dbb235373b122ae15643ef5dbbe821ee1307d9 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 9 May 2012 11:07:31 -0400 Subject: NSS: Add fallback_homedir option This option is similar to override_homedir, except that it will take effect only for users that do not have an explicit home directory specified in LDAP. https://fedorahosted.org/sssd/ticket/1250 --- src/confdb/confdb.c | 20 ++++++++++++++++---- src/confdb/confdb.h | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src/confdb') diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c index 427101e9..1c5e40cd 100644 --- a/src/confdb/confdb.c +++ b/src/confdb/confdb.c @@ -949,10 +949,22 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, tmp = ldb_msg_find_attr_as_string(res->msgs[0], CONFDB_NSS_OVERRIDE_HOMEDIR, NULL); - domain->override_homedir = talloc_strdup(domain, tmp); - if (!domain->name) { - ret = ENOMEM; - goto done; + if (tmp != NULL) { + domain->override_homedir = talloc_strdup(domain, tmp); + if (!domain->override_homedir) { + ret = ENOMEM; + goto done; + } + } + + tmp = ldb_msg_find_attr_as_string(res->msgs[0], + CONFDB_NSS_FALLBACK_HOMEDIR, NULL); + if (tmp != NULL) { + domain->fallback_homedir = talloc_strdup(domain, tmp); + if (!domain->fallback_homedir) { + ret = ENOMEM; + goto done; + } } tmp = ldb_msg_find_attr_as_string(res->msgs[0], diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h index 5ec9f721..c816d533 100644 --- a/src/confdb/confdb.h +++ b/src/confdb/confdb.h @@ -81,6 +81,7 @@ #define CONFDB_NSS_FILTER_GROUPS "filter_groups" #define CONFDB_NSS_PWFIELD "pwfield" #define CONFDB_NSS_OVERRIDE_HOMEDIR "override_homedir" +#define CONFDB_NSS_FALLBACK_HOMEDIR "fallback_homedir" #define CONFDB_NSS_VETOED_SHELL "vetoed_shells" #define CONFDB_NSS_ALLOWED_SHELL "allowed_shells" #define CONFDB_NSS_SHELL_FALLBACK "shell_fallback" @@ -192,6 +193,7 @@ struct sss_domain_info { gid_t override_gid; const char *override_homedir; + const char *fallback_homedir; const char *subdomain_homedir; uint32_t user_timeout; -- cgit