Skip to content

Commit 4cb6593

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]>
1 parent 804b22c commit 4cb6593

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
@@ -593,3 +593,41 @@ def test_ldap__limit_search_base_group(client: Client, provider: LDAP):
593593
assert (
594594
"(h2,ou2_usr1,ldap.test)" not in result.members
595595
), "'ou1_grp2' members did not match the expected ones when search base is limited."
596+
597+
598+
@pytest.mark.importance("low")
599+
@pytest.mark.topology(KnownTopology.LDAP)
600+
def test_ldap__enumeration_and_group_with_hash_in_name(client: Client, ldap: LDAP):
601+
"""
602+
:title: getent shows groups with '#' in the name
603+
:setup:
604+
1. Create group with # in the name
605+
2. Create group without # in the name
606+
3. Enable enumeration
607+
:steps:
608+
1. Wait for enumeration to complete
609+
2. check output of `getent group -s sss`
610+
:expectedresults:
611+
1. Enumeration task finishes
612+
2. Both groups are in the `getent` output
613+
:customerscenario: False
614+
"""
615+
group1 = ldap.group("my#group").add()
616+
group2 = ldap.group("my_group").add()
617+
client.sssd.clear(db=True, memcache=True, logs=True)
618+
client.sssd.domain["enumerate"] = "True"
619+
client.sssd.domain["ldap_enumeration_refresh_offset"] = "1"
620+
client.sssd.restart()
621+
622+
timeout = time.time() + 60
623+
logfile = "/var/log/sssd/sssd_test.log"
624+
while True:
625+
log = client.fs.read(logfile)
626+
if "[enum_groups_done]" in log:
627+
break
628+
assert timeout > time.time(), "Timeout while waiting for enumeration to finish"
629+
time.sleep(1)
630+
result = client.host.conn.exec(["getent", "group", "-s", "sss"])
631+
632+
assert group1.name in result.stdout, f"{group1.name} is not in getent output"
633+
assert group2.name in result.stdout, f"{group2.name} is not in getent output"

0 commit comments

Comments
 (0)