Blob Blame Raw
From f9518dce861a1fe9a3a5c5c63ac45f67fdbc5e68 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Thu, 30 Nov 2017 10:21:17 +0100
Subject: [PATCH 79/79] test_files_provider: Regression test for implicit_files
 + proxy

Related to:
https://pagure.io/SSSD/sssd/issue/3590
---
 src/tests/intg/test_files_provider.py | 40 +++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/src/tests/intg/test_files_provider.py b/src/tests/intg/test_files_provider.py
index 169da713767b6495e117d805b29d8d6346237ebc..ea4e5b70a3626cb43217b59488cf186e3325ae8d 100644
--- a/src/tests/intg/test_files_provider.py
+++ b/src/tests/intg/test_files_provider.py
@@ -145,6 +145,26 @@ def files_domain_only(request):
     return None
 
 
+@pytest.fixture
+def proxy_to_files_domain_only(request):
+    conf = unindent("""\
+        [sssd]
+        domains             = proxy, local
+        services            = nss
+
+        [domain/local]
+        id_provider = local
+
+        [domain/proxy]
+        id_provider = proxy
+        proxy_lib_name = files
+        auth_provider = none
+    """).format(**locals())
+    create_conf_fixture(request, conf)
+    create_sssd_fixture(request)
+    return None
+
+
 @pytest.fixture
 def no_sssd_domain(request):
     conf = unindent("""\
@@ -980,6 +1000,26 @@ def test_no_sssd_domain(add_user_with_canary, no_sssd_domain):
     assert user == USER1
 
 
+def test_proxy_to_files_domain_only(add_user_with_canary,
+                                    proxy_to_files_domain_only):
+    """
+    Test that implicit_files domain is not started together with proxy to files
+    """
+    local_user1 = dict(name='user1', passwd='*', uid=10009, gid=10009,
+                       gecos='user1', dir='/home/user1', shell='/bin/bash')
+
+    # Add a user with a different UID than the one in files
+    subprocess.check_call(
+        ["sss_useradd", "-u", "10009", "-M", USER1["name"]])
+
+    res, user = call_sssd_getpwnam(USER1["name"])
+    assert res == NssReturnCode.SUCCESS
+    assert user == local_user1
+
+    res, _ = call_sssd_getpwnam("{0}@implicit_files".format(USER1["name"]))
+    assert res == NssReturnCode.NOTFOUND
+
+
 def test_no_files_domain(add_user_with_canary, no_files_domain):
     """
     Test that if no files domain is configured, sssd will add the implicit one
-- 
2.15.1