From 0b88463ff844d1fdfc1b76113ccfa9f760688355 Mon Sep 17 00:00:00 2001 From: aborah-sudo Date: Thu, 21 Nov 2024 10:49:16 +0530 Subject: [PATCH] Tests: SSSD fails to store users if any of the requested attribute is empty SSSD fails to store users if any of the requested attribute is empty --- src/tests/system/tests/test_ldap.py | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/tests/system/tests/test_ldap.py b/src/tests/system/tests/test_ldap.py index 251663e5f65..26ff9b8369e 100644 --- a/src/tests/system/tests/test_ldap.py +++ b/src/tests/system/tests/test_ldap.py @@ -502,3 +502,39 @@ def test_ldap__password_change_no_grace_logins_left( rc, _, _, _ = client.auth.parametrize(method).password_with_output("user1", "Secret123") assert rc == expected, err_msg + + +@pytest.mark.importance("low") +@pytest.mark.topology(KnownTopology.LDAP) +def test_ldap__empty_attribute(client: Client, ldap: LDAP): + """ + :title: SSSD fails to store users if any of the requested attribute is empty + :setup: + 1. Disable Syntax Checking + 2. Add a User + 3. Make home attribute of user empty + 4. Add Groups + 5. Start SSSD + :steps: + 1. User exists + 2. Groups are resolved + 3. User should be able to log in + :expectedresults: + 1. Id look up should success + 2. Group look up should success + 3. User log in should success + :customerscenario: True + """ + ldap.ldap.modify("cn=config", replace={"nsslapd-syntaxcheck": "off"}) + user = ldap.user("emp_user").add(password="Secret123") + user.modify(home = "") + + ldap.group("Group_1").add().add_member(member=user) + ldap.group("Group_2").add().add_member(member=user) + + client.sssd.start() + + assert client.tools.id("emp_user") is not None + for grp in ["Group_1", "Group_2"]: + assert client.tools.getent.group(grp) is not None + assert client.auth.ssh.password(user.name, "Secret123"), "User login failed!"