|
|
71e593 |
From 90f32399b4100ce39cf665649fde82d215e5eb49 Mon Sep 17 00:00:00 2001
|
|
|
71e593 |
From: Tomas Halman <thalman@redhat.com>
|
|
|
71e593 |
Date: Mon, 3 Dec 2018 14:11:31 +0100
|
|
|
71e593 |
Subject: [PATCH] nss: sssd returns '/' for emtpy home directories
|
|
|
71e593 |
|
|
|
71e593 |
For empty home directory in passwd file sssd returns "/". Sssd
|
|
|
71e593 |
should respect system behaviour and return the same as nsswitch
|
|
|
71e593 |
"files" module - return empty string.
|
|
|
71e593 |
|
|
|
71e593 |
Resolves:
|
|
|
71e593 |
https://pagure.io/SSSD/sssd/issue/3901
|
|
|
71e593 |
|
|
|
71e593 |
Reviewed-by: Simo Sorce <simo@redhat.com>
|
|
|
71e593 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
71e593 |
---
|
|
|
71e593 |
src/confdb/confdb.c | 9 +++++++++
|
|
|
71e593 |
src/man/include/ad_modified_defaults.xml | 19 +++++++++++++++++++
|
|
|
71e593 |
src/responder/nss/nss_protocol_pwent.c | 2 +-
|
|
|
71e593 |
src/tests/intg/test_files_provider.py | 2 +-
|
|
|
71e593 |
4 files changed, 30 insertions(+), 2 deletions(-)
|
|
|
71e593 |
|
|
|
71e593 |
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
|
|
|
71e593 |
index b0d886c9d..d3fdd3199 100644
|
|
|
71e593 |
--- a/src/confdb/confdb.c
|
|
|
71e593 |
+++ b/src/confdb/confdb.c
|
|
|
71e593 |
@@ -1301,6 +1301,15 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
|
|
|
71e593 |
ret = ENOMEM;
|
|
|
71e593 |
goto done;
|
|
|
71e593 |
}
|
|
|
71e593 |
+ } else {
|
|
|
71e593 |
+ if (strcasecmp(domain->provider, "ad") == 0) {
|
|
|
71e593 |
+ /* ad provider default */
|
|
|
71e593 |
+ domain->fallback_homedir = talloc_strdup(domain, "/home/%d/%u");
|
|
|
71e593 |
+ if (!domain->fallback_homedir) {
|
|
|
71e593 |
+ ret = ENOMEM;
|
|
|
71e593 |
+ goto done;
|
|
|
71e593 |
+ }
|
|
|
71e593 |
+ }
|
|
|
71e593 |
}
|
|
|
71e593 |
|
|
|
71e593 |
tmp = ldb_msg_find_attr_as_string(res->msgs[0],
|
|
|
71e593 |
diff --git a/src/man/include/ad_modified_defaults.xml b/src/man/include/ad_modified_defaults.xml
|
|
|
71e593 |
index 818a2bf78..425b7e8ee 100644
|
|
|
71e593 |
--- a/src/man/include/ad_modified_defaults.xml
|
|
|
71e593 |
+++ b/src/man/include/ad_modified_defaults.xml
|
|
|
71e593 |
@@ -76,4 +76,23 @@
|
|
|
71e593 |
</listitem>
|
|
|
71e593 |
</itemizedlist>
|
|
|
71e593 |
</refsect2>
|
|
|
71e593 |
+ <refsect2 id='nss_modifications'>
|
|
|
71e593 |
+ <title>NSS configuration</title>
|
|
|
71e593 |
+ <itemizedlist>
|
|
|
71e593 |
+ <listitem>
|
|
|
71e593 |
+ <para>
|
|
|
71e593 |
+ fallback_homedir = /home/%d/%u
|
|
|
71e593 |
+ </para>
|
|
|
71e593 |
+ <para>
|
|
|
71e593 |
+ The AD provider automatically sets
|
|
|
71e593 |
+ "fallback_homedir = /home/%d/%u" to provide personal
|
|
|
71e593 |
+ home directories for users without the homeDirectory
|
|
|
71e593 |
+ attribute. If your AD Domain is properly
|
|
|
71e593 |
+ populated with Posix attributes, and you want to avoid
|
|
|
71e593 |
+ this fallback behavior, you can explicitly
|
|
|
71e593 |
+ set "fallback_homedir = %o".
|
|
|
71e593 |
+ </para>
|
|
|
71e593 |
+ </listitem>
|
|
|
71e593 |
+ </itemizedlist>
|
|
|
71e593 |
+ </refsect2>
|
|
|
71e593 |
</refsect1>
|
|
|
71e593 |
diff --git a/src/responder/nss/nss_protocol_pwent.c b/src/responder/nss/nss_protocol_pwent.c
|
|
|
71e593 |
index af9e74fc8..86fa4ec46 100644
|
|
|
71e593 |
--- a/src/responder/nss/nss_protocol_pwent.c
|
|
|
71e593 |
+++ b/src/responder/nss/nss_protocol_pwent.c
|
|
|
71e593 |
@@ -118,7 +118,7 @@ nss_get_homedir(TALLOC_CTX *mem_ctx,
|
|
|
71e593 |
|
|
|
71e593 |
homedir = nss_get_homedir_override(mem_ctx, msg, nss_ctx, domain, &hd_ctx);
|
|
|
71e593 |
if (homedir == NULL) {
|
|
|
71e593 |
- return "/";
|
|
|
71e593 |
+ return "";
|
|
|
71e593 |
}
|
|
|
71e593 |
|
|
|
71e593 |
return homedir;
|
|
|
71e593 |
diff --git a/src/tests/intg/test_files_provider.py b/src/tests/intg/test_files_provider.py
|
|
|
71e593 |
index f0155a2f7..b5e5c3fd9 100644
|
|
|
71e593 |
--- a/src/tests/intg/test_files_provider.py
|
|
|
71e593 |
+++ b/src/tests/intg/test_files_provider.py
|
|
|
71e593 |
@@ -656,7 +656,7 @@ def test_user_no_dir(setup_pw_with_canary, files_domain_only):
|
|
|
71e593 |
Test that resolving a user without a homedir defined works and returns
|
|
|
71e593 |
a fallback value
|
|
|
71e593 |
"""
|
|
|
71e593 |
- check_user(incomplete_user_setup(setup_pw_with_canary, 'dir', '/'))
|
|
|
71e593 |
+ check_user(incomplete_user_setup(setup_pw_with_canary, 'dir', ''))
|
|
|
71e593 |
|
|
|
71e593 |
|
|
|
71e593 |
def test_user_no_gecos(setup_pw_with_canary, files_domain_only):
|
|
|
71e593 |
--
|
|
|
71e593 |
2.19.1
|
|
|
71e593 |
|