Skip to content

Commit 53365dc

Browse files
thalmanalexey-tikhonov
authored andcommitted
test: enumeration with # in the group name
Reviewed-by: Alejandro López <[email protected]> Reviewed-by: Dan Lavu <[email protected]> (cherry picked from commit 4cb6593) Reviewed-by: Alejandro López <[email protected]>
1 parent cf0d337 commit 53365dc

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/tests/system/tests/test_ldap.py

+38
Original file line numberDiff line numberDiff line change
@@ -503,3 +503,41 @@ def test_ldap__password_change_no_grace_logins_left(
503503

504504
rc, _, _, _ = client.auth.parametrize(method).password_with_output("user1", "Secret123")
505505
assert rc == expected, err_msg
506+
507+
508+
@pytest.mark.importance("low")
509+
@pytest.mark.topology(KnownTopology.LDAP)
510+
def test_ldap__enumeration_and_group_with_hash_in_name(client: Client, ldap: LDAP):
511+
"""
512+
:title: getent shows groups with '#' in the name
513+
:setup:
514+
1. Create group with # in the name
515+
2. Create group without # in the name
516+
3. Enable enumeration
517+
:steps:
518+
1. Wait for enumeration to complete
519+
2. check output of `getent group -s sss`
520+
:expectedresults:
521+
1. Enumeration task finishes
522+
2. Both groups are in the `getent` output
523+
:customerscenario: False
524+
"""
525+
group1 = ldap.group("my#group").add()
526+
group2 = ldap.group("my_group").add()
527+
client.sssd.clear(db=True, memcache=True, logs=True)
528+
client.sssd.domain["enumerate"] = "True"
529+
client.sssd.domain["ldap_enumeration_refresh_offset"] = "1"
530+
client.sssd.restart()
531+
532+
timeout = time.time() + 60
533+
logfile = "/var/log/sssd/sssd_test.log"
534+
while True:
535+
log = client.fs.read(logfile)
536+
if "[enum_groups_done]" in log:
537+
break
538+
assert timeout > time.time(), "Timeout while waiting for enumeration to finish"
539+
time.sleep(1)
540+
result = client.host.conn.exec(["getent", "group", "-s", "sss"])
541+
542+
assert group1.name in result.stdout, f"{group1.name} is not in getent output"
543+
assert group2.name in result.stdout, f"{group2.name} is not in getent output"

0 commit comments

Comments
 (0)