Bug 35136 - Using brackets in the version of an INI file make the registration fail
Using brackets in the version of an INI file make the registration fail
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: App Center
UCS 3.2
Other Linux
: P5 normal (vote)
: UCS 3.2-2-errata
Assigned To: Dirk Wiesenthal
Alexander Kläser
:
Depends on:
Blocks: 35896
  Show dependency treegraph
 
Reported: 2014-06-17 13:17 CEST by Moritz Muehlenhoff
Modified: 2014-09-11 14:46 CEST (History)
3 users (show)

See Also:
What kind of report is it?: ---
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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Muehlenhoff univentionstaff 2014-06-17 13:17:31 CEST
I used the following version string in the INI file of the UCC app:

[Application]
ID=ucc
Name=Univention Corporate Client 2.0
Version=2.0 (rev2)

This leads to an error when registering the app after the successful update/installation. The following traceback was logged:

20.05.14 08:51:42.298  MODULE      ( PROCESS ) : Aufruf des Nach-Installations-Triggers python-support
20.05.14 08:51:43.953  MODULE      ( ERROR   ) : Registering LDAP object failed. Bad search filter
20.05.14 08:51:43.953  MODULE      ( PROCESS ) : Die Registrierung der Applikation im LDAP ist fehlgeschlagen. Sie wird bei jedem Öffnen des App Center Moduls wiederholt werden.
20.05.14 08:51:43.953  MODULE      ( WARN    ) : Die Registrierung der Applikation im LDAP ist fehlgeschlagen. Sie wird bei jedem Öffnen des App Center Moduls wiederholt werden.
20.05.14 08:51:43.967  MODULE      ( WARN    ) : Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/appcenter/app_center.py", line 1399, in install
    self.tell_ldap(component_manager.ucr, package_manager)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/appcenter/app_center.py", line 1205, in tell_ldap
    ldap_object = iapp.get_ldap_object(or_create=True)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/appcenter/app_center.py", line 1104, in get_ldap_object
    return ApplicationLDAPObject(ldap_id, lo, co)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/appcenter/app_center.py", line 126, in __init__
    self.reload()
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/appcenter/app_center.py", line 129, in reload
    result = appcenter_udm_module.lookup(self._co, self._lo, 'id=%s' % self._ldap_id)
  File "/usr/lib/pymodules/python2.6/univention/admin/handlers/appcenter/app.py", line 401, in lookup
    for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit):
  File "/usr/lib/pymodules/python2.6/univention/admin/uldap.py", line 355, in search
    raise univention.admin.uexceptions.ldapError, _err2str(msg)
ldapError: Bad search filter


As a workaround I avoided the brackets in the version string, but we should fix the underlying bug.
Comment 1 Dirk Wiesenthal univentionstaff 2014-06-17 13:27:06 CEST
- appcenter_udm_module.lookup(self._co, self._lo, 'id=%s' % self._ldap_id)
+ appcenter_udm_module.lookup(self._co, self._lo, 'id=%s' % ldap.filter.escape_filter_chars(self._ldap_id))

_ldap_id can be two values:

  udm_object.info['id'] # if already exists
  '%s_%s' % (app.id, app.get('version')) # if it is new

Needs to be tested for both cases, but should work.

We should also fix
  appcenter_udm_module.lookup(co, lo, '(&(id=%s_*)(server=%s))' % (self.id, localhost))

(altough the ID of an application is normally "safe")

There is also
  container_udm_module.lookup(co, lo, 'cn=%s' % container, base=base)

which can also have the application's id as "container".
Comment 2 Dirk Wiesenthal univentionstaff 2014-07-08 12:54:33 CEST
Fixed in
  univention-management-console-module-appcenter 3.0.51-23.257.201407081251

Setting UCR variable in postinst
Comment 3 Dirk Wiesenthal univentionstaff 2014-07-08 12:55:21 CEST
(In reply to Dirk Wiesenthal from comment #2)
> Setting UCR variable in postinst

I meant:
ID and Version may contain brackets
Comment 4 Alexander Kläser univentionstaff 2014-07-09 15:00:41 CEST
My tests where fine (i.e., installation, upgrade, removal with uncommon characters in the version string) and produced DNs similar to this one:

DN: univentionAppID=univention-demo_0.3 (\3D\3D**!!gamma!!**\3D\3D),cn=univention-demo,cn=apps,cn=univention,dc=ucs322,dc=qa

YAML file → OK
Comment 5 Janek Walkenhorst univentionstaff 2014-07-10 13:33:36 CEST
http://errata.univention.de/ucs/3.2/139.html