Bug 42791

Summary: missing ldap filter escaping in UDM scripts
Product: UCS Reporter: Florian Best <best>
Component: UDM (Generic)Assignee: Florian Best <best>
Status: CLOSED FIXED QA Contact: Jürn Brodersen <brodersen>
Severity: normal    
Priority: P5 Flags: best: Patch_Available+
Version: UCS 4.4   
Target Milestone: UCS 4.4-0-errata   
Hardware: Other   
OS: Linux   
What kind of report is it?: Development Internal What type of bug is this?: ---
Who will be affected by this bug?: --- How will those affected feel about the bug?: ---
User Pain: Enterprise Customer affected?:
School Customer affected?: ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional):
Max CVSS v3 score:

Description Florian Best univentionstaff 2016-10-30 16:57:21 CET
management/univention-directory-manager-modules/python-lib/password.py
→ filter = 'krb5PrincipalName=%s' % username
→ filter = 'uid=%s' % username

management/univention-directory-manager-modules/scripts/lock_expired_accounts
→ ldap_filter = '(&(shadowExpire>=%s)(shadowExpire<=%s))' % (today - 6, today,)

a/management/univention-directory-manager-modules/scripts/proof_class_b_reverse
→ reverse = lo.search_s('cn=dns,%s' % baseDN, ldap.SCOPE_SUBTREE, '(&(relativeDomainName=%s)(pTRRecord=%s*))' % (string.join(entry, '.'), ldap.explode_dn(computers[i][0], 1)[0]))
→ lo.modrdn_s(reverse[0][0], 'relativeDomainName=%s' % entry)

b/management/univention-directory-manager-modules/scripts/proof_dns_dhcp_records
match_cmp_rec = lo.search_s(baseDN, ldap.SCOPE_SUBTREE, '(&(objectClass=univentionHost)(macAddress=%s))' % mac, [])
match_cmp_rec = lo.search_s(baseDN, ldap.SCOPE_SUBTREE, '(&(objectClass=univentionHost)(aRecord=%s))' % comp[1]["aRecord"][0], [])

b/management/univention-directory-manager-modules/scripts/univention-remove-old-umc-objects
ref_objects = lo.searchDn(filter='univentionPolicyReference=%s' % pol_dn)

management/univention-directory-manager-modules/scripts/proof_uniqueMembers:
member_result = conn.search_s(basedn, ldap.SCOPE_SUBTREE, '(uid=%s)' % (member_uid,), ['objectClass'])
Comment 1 Stefan Gohmann univentionstaff 2019-01-03 07:18:15 CET
This issue has been filled against UCS 4.1. The maintenance with bug and security fixes for UCS 4.1 has ended on 5st of April 2018.

Customers still on UCS 4.1 are encouraged to update to UCS 4.3. Please contact
your partner or Univention for any questions.

If this issue still occurs in newer UCS versions, please use "Clone this bug" or simply reopen the issue. In this case please provide detailed information on how this issue is affecting you.
Comment 2 Florian Best univentionstaff 2019-03-14 08:47:40 CET
Patch in fbest/42791-fix-ldap-filters
Comment 3 Florian Best univentionstaff 2019-03-14 10:50:04 CET
univention-directory-manager-modules (14.0.12-3)
2ca91ab7ce50 | Bug #42791: fix ldap filters

univention-directory-manager-modules.yaml
2ca91ab7ce50 | Bug #42791: fix ldap filters
Comment 4 Jürn Brodersen univentionstaff 2019-03-14 16:43:16 CET
python-lib/password.py -> OK
scripts/lock_expired_accounts -> OK
scripts/proof_class_b_reverse -> OK
scripts/proof_dns_dhcp_records -> OK
scripts/proof_uniqueMembers -> OK
scripts/univention-remove-old-umc-objects -> removed as discussed, because it was for the 2.4 to 3.0 upgrade (bug #24045) -> OK

YAML -> OK
Comment 5 Arvid Requate univentionstaff 2019-03-27 13:29:18 CET
<http://errata.software-univention.de/ucs/4.4/19.html>