#7838 configure_openldap_conf() does not handle multi-value URI
Opened by cheimes. Modified

Issue

The URI stanza supports multiple hosts. configure_openldap_conf() does not handle an existing /etc/openldap/ldap.conf with two URI stanzes correctly. It adds a second URI line to the config file.

Steps to Reproduce

See https://github.com/freeipa/freeipa/pull/2756 for a reproducer

Actual behavior

/etc/openldap/ldap.conf has two URI lines

Expected behavior

/etc/openldap/ldap.conf should only have one URI

Version/Release/Distribution

FreeIPA 4.7.3


The bug is in parseLine method https://github.com/freeipa/freeipa/blob/b431e9b684df11c811892bd9d2a5711355f0076e/ipaclient/install/ipachangeconf.py#L205-L230. Because the assignment empty space is handled before assignment value tab, it parses the line URI\tldap://ldap.example.com ldap://ldap-master.example.com:666 as option URI\tldap://ldap.example.com with value ldap://ldap-master.example.com:666. The method should use whatever assignment value comes first and produces the shortest option key.

Metadata Update from @pvoborni:
- Issue set to the milestone: FreeIPA 4.7 backlog (was: 0.0 NEEDS_TRIAGE)

master:

  • a376b6136c1180e19fca76a3753c40cdba18993f Add test case for configure_openldap_conf

ipa-4-7:

  • 52394ebcaf261f73ad1d7f50da8ccd0533437a78 Add test case for configure_openldap_conf

Metadata Update from @tdudlak:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata Update from @frenaud:
- Custom field affects_doc adjusted to on
- Issue status updated to: Open (was: Closed)

Reopening issue as it is still present. The above commits added a test but did not fix the issue.

Metadata