summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-10-17 14:43:07 +0200
committerJakub Hrozek <jhrozek@redhat.com>2012-10-18 20:19:33 +0200
commit66318dfe1e7138ff3fc780c4b3f0b29c4b2d8712 (patch)
tree0ae1709db5b7c491795cd33d8d4b8ed81366a4f7 /src
parentd9b1ecd81527640e5c15e6617e981a14ead9419f (diff)
downloadsssd-66318dfe1e7138ff3fc780c4b3f0b29c4b2d8712.tar.gz
sssd-66318dfe1e7138ff3fc780c4b3f0b29c4b2d8712.tar.xz
sssd-66318dfe1e7138ff3fc780c4b3f0b29c4b2d8712.zip
Allow setting the default_shell option per-domain as well
https://fedorahosted.org/sssd/ticket/1583
Diffstat (limited to 'src')
-rw-r--r--src/confdb/confdb.c10
-rw-r--r--src/confdb/confdb.h1
-rwxr-xr-xsrc/config/SSSDConfigTest.py2
-rw-r--r--src/config/etc/sssd.api.conf1
-rw-r--r--src/man/sssd-ad.5.xml3
-rw-r--r--src/man/sssd.conf.5.xml3
-rw-r--r--src/responder/nss/nsssrv_cmd.c4
7 files changed, 21 insertions, 3 deletions
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
index 37a5758c7..13035a416 100644
--- a/src/confdb/confdb.c
+++ b/src/confdb/confdb.c
@@ -1074,6 +1074,16 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
}
}
+ tmp = ldb_msg_find_attr_as_string(res->msgs[0],
+ CONFDB_NSS_DEFAULT_SHELL, NULL);
+ if (tmp != NULL) {
+ domain->default_shell = talloc_strdup(domain, tmp);
+ if (!domain->default_shell) {
+ ret = ENOMEM;
+ goto done;
+ }
+ }
+
ret = get_entry_as_bool(res->msgs[0], &domain->case_sensitive,
CONFDB_DOMAIN_CASE_SENSITIVE, true);
if(ret != EOK) {
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
index 0e02e6cf1..88e80c17d 100644
--- a/src/confdb/confdb.h
+++ b/src/confdb/confdb.h
@@ -212,6 +212,7 @@ struct sss_domain_info {
const char *fallback_homedir;
const char *subdomain_homedir;
const char *override_shell;
+ const char *default_shell;
uint32_t user_timeout;
uint32_t group_timeout;
diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py
index 73e1ea692..3bfa63103 100755
--- a/src/config/SSSDConfigTest.py
+++ b/src/config/SSSDConfigTest.py
@@ -510,6 +510,7 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
'override_homedir',
'fallback_homedir',
'override_shell',
+ 'default_shell',
'pwd_expiration_warning',
'id_provider',
'auth_provider',
@@ -848,6 +849,7 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
'override_homedir',
'fallback_homedir',
'override_shell',
+ 'default_shell',
'pwd_expiration_warning',
'id_provider',
'auth_provider',
diff --git a/src/config/etc/sssd.api.conf b/src/config/etc/sssd.api.conf
index 2ba47d716..a5af1200b 100644
--- a/src/config/etc/sssd.api.conf
+++ b/src/config/etc/sssd.api.conf
@@ -109,6 +109,7 @@ case_sensitive = bool, None, false
override_homedir = str, None, false
fallback_homedir = str, None, false
override_shell = str, None, false
+default_shell = str, None, false
#Entry cache timeouts
entry_cache_user_timeout = int, None, false
diff --git a/src/man/sssd-ad.5.xml b/src/man/sssd-ad.5.xml
index 0d3f34890..1570ed8a7 100644
--- a/src/man/sssd-ad.5.xml
+++ b/src/man/sssd-ad.5.xml
@@ -205,7 +205,8 @@ fallback_homedir = /home/%u
<para>
The default shell to use if the provider does not
return one during lookup. This option supersedes
- any other shell options if it takes effect.
+ any other shell options if it takes effect and can
+ be set either in the [nss] section or per-domain.
</para>
<para>
Default: not set (Return NULL if no shell is
diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml
index c818b97d8..f0c3b606e 100644
--- a/src/man/sssd.conf.5.xml
+++ b/src/man/sssd.conf.5.xml
@@ -585,7 +585,8 @@ override_homedir = /home/%u
<para>
The default shell to use if the provider does not
return one during lookup. This option supersedes
- any other shell options if it takes effect.
+ any other shell options if it takes effect and can
+ be set either in the [nss] section or per-domain.
</para>
<para>
Default: not set (Return NULL if no shell is
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 42d32e9db..ec2561123 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -173,7 +173,9 @@ static const char *get_shell_override(TALLOC_CTX *mem_ctx,
user_shell = ldb_msg_find_attr_as_string(msg, SYSDB_SHELL, NULL);
if (!user_shell) {
/* Check whether there is a default shell specified */
- if (nctx->default_shell) {
+ if (dom->default_shell) {
+ return talloc_strdup(mem_ctx, dom->default_shell);
+ } else if (nctx->default_shell) {
return talloc_strdup(mem_ctx, nctx->default_shell);
}
return NULL;