Skip to content

Commit

Permalink
Tests: SSSD fails to store users if any of the requested attribute is…
Browse files Browse the repository at this point in the history
… empty

SSSD fails to store users if any of the requested attribute is empty
  • Loading branch information
aborah-sudo committed Nov 21, 2024
1 parent 21c6280 commit 0aee34f
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/tests/system/tests/test_ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,3 +502,68 @@ 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. Create an Organizational Unit
4. Add Groups
5. Configure SSSD
:steps:
1. The user can be queried (id command)
2. Groups are resolved properly using the getent group command
:expectedresults:
1. Id look up should success
2. Group look up should success
:customerscenario: True
"""
ldap.ldap.modify("cn=config", replace={"nsslapd-syntaxcheck": "off"})
ldap.ldap.add(
"uid=emp_user,dc=ldap,dc=test",
{
"objectClass": ["top", "posixAccount", "organizationalPerson", "inetorgperson", "shadowaccount"],
"shadowFlag": "",
"cn": "Temp user",
"sn": "user",
"uidNumber": "10219",
"gidNumber": 10000,
"gecos": "Kuch toh",
"homeDirectory": "/home/emp_user",
"loginShell": "/bin/bash",
"userPassword": "Secret123",
},
)

ldap.ou("Groups").add()
ldap.ldap.add(
"cn=Group_1,ou=Groups,dc=ldap,dc=test",
{
"objectClass": ["top", "posixGroup", "groupOfNames"],
"cn": "Group_1",
"gidNumber": 10000,
"member": "uid=emp_user,dc=ldap,dc=test",
},
)

ldap.ldap.add(
"cn=Group_2,ou=Groups,dc=ldap,dc=test",
{
"objectClass": ["top", "posixGroup", "groupOfNames"],
"cn": "Group_2",
"gidNumber": 10001,
"member": "uid=emp_user,dc=ldap,dc=test",
},
)

client.sssd.dom("test")["ldap_group_object_class"] = "groupOfNames"
client.sssd.start()

assert client.tools.id("emp_user") is not None
assert client.tools.getent.group("Group_1") is not None
assert client.tools.getent.group("Group_2") is not None

0 comments on commit 0aee34f

Please sign in to comment.