mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-26 08:51:50 -06:00
172df673dd
OpenLDAP has deprecated PORT and HOST stanzes in ldap.conf. The presence of either option causes FreeIPA installation to fail. Refuse installation when a deprecated and unsupported option is present. Fixes: https://pagure.io/freeipa/issue/7418 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
# Copyright (C) 2018 FreeIPA Contributors see COPYING for license
|
|
|
|
from __future__ import absolute_import
|
|
|
|
import tempfile
|
|
|
|
import pytest
|
|
|
|
from ipaclient.install.client import check_ldap_conf
|
|
from ipapython.admintool import ScriptError
|
|
|
|
|
|
@pytest.mark.parametrize("lines,expected", [
|
|
(["PORT 389"], "PORT"),
|
|
(["HOST example.org"], "HOST"),
|
|
(["HOST example.org", "# PORT 389"], "HOST"),
|
|
(["\tHOST example.org", "# PORT 389"], "HOST"),
|
|
(["HOST example.org", "PORT 389"], "HOST, PORT"),
|
|
(["# HOST example.org", "# PORT 389"], None),
|
|
(["URI PORT"], None),
|
|
([], None),
|
|
])
|
|
def test_check_ldap(lines, expected):
|
|
with tempfile.NamedTemporaryFile('w+') as f:
|
|
for line in lines:
|
|
f.write(line)
|
|
f.write('\n')
|
|
f.write('\n')
|
|
f.flush()
|
|
|
|
if expected is None:
|
|
assert check_ldap_conf(f.name) is True
|
|
else:
|
|
with pytest.raises(ScriptError) as e:
|
|
check_ldap_conf(f.name)
|
|
msg = e.value.msg
|
|
assert msg.endswith(expected)
|