Bug 37447 - UMC-server crashes when extendedAttributes are not known
UMC-server crashes when extendedAttributes are not known
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 4.0
Other Linux
: P5 normal (vote)
: UCS 4.0-1-errata
Assigned To: Florian Best
Alexander Kläser
:
Depends on:
Blocks: 38222
  Show dependency treegraph
 
Reported: 2015-01-05 15:41 CET by Dirk Wiesenthal
Modified: 2015-04-09 11:28 CEST (History)
4 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
37447.py (1.00 KB, text/x-python)
2015-03-20 12:05 CET, Florian Best
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Wiesenthal univentionstaff 2015-01-05 15:41:10 CET
I found a traceback in the UMC server:

      File "/usr/sbin/univention-management-console-server", line 209, in <module>
        umc_daemon.do_action()
      File "/usr/lib/pymodules/python2.7/daemon/runner.py", line 186, in do_action
        func(self)
      File "/usr/sbin/univention-management-console-server", line 142, in _restart
        self._start()
      File "/usr/lib/pymodules/python2.7/daemon/runner.py", line 131, in _start
        self.app.run()
      File "/usr/sbin/univention-management-console-server", line 192, in run
        notifier.loop()
      File "/usr/lib/pymodules/python2.7/notifier/nf_generic.py", line 284, in loop
        step()
      File "/usr/lib/pymodules/python2.7/notifier/nf_generic.py", line 271, in step
        not __sockets[ cond ][ fd ]( sock_obj ):
      File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/server.py", line 168, in _receive
        self._handle(state, msg)
      File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/server.py", line 286, in _handle
        state.processor.request(msg)
      File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/session.py", line 289, in request
        self.handle_request_set(msg)
      File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/session.py", line 573, in handle_request_set
        userObj.modify()
      File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 364, in modify
        return self._modify(modify_childs,ignore_license=ignore_license)
      File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 823, in _modify
        ml=self._ldap_modlist()
      File "/usr/lib/pymodules/python2.7/univention/admin/handlers/users/user.py", line 1940, in _ldap_modlist
        ml=univention.admin.handlers.simpleLdap._ldap_modlist(self)
      File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 659, in _ldap_modlist
        diff_ml = self.diff()
      File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 127, in diff
        if self.descriptions[key].multivalue:
    KeyError: 'owncloudEnabled'

Seems to happen when the app was already installed, uninstalled. In a fresh session (where at the start owncloudEnabled is not yet known) ownCloud is installed again. Right after the installation, the frontend sends a SET PREFERENCES and this crashes the whole server.

Not so sure how to fix it. One could add a KeyError in the except clause, but this leads to error messages and preferences not being saved (although irrelevant at this point).

Maybe it is better to:
  udm_modules.init(self.lo, self.po, users_module, force_reload=True)
every time in univention/management/console/protocol/session.py's _get_user_obj(). Not sure about the performance though. On the other hand, this is done in any UDM module all the time...
Comment 1 Alexander Kläser univentionstaff 2015-02-18 11:57:46 CET
Is this problem being resolved with Bug 37347?
Comment 2 Florian Best univentionstaff 2015-02-18 12:38:20 CET
(In reply to Alexander Kläser from comment #1)
> Is this problem being resolved with Bug 37347?
No, the server still crashes.
Comment 3 Florian Best univentionstaff 2015-03-20 12:04:52 CET
Along with this bug I fixed a lot of server crashes which could be done through malicious user input (e.g. null bytes in requests) or LDAP errors (because udm_errors.base is not catched):

E.g.:
umc-client -U Administrator -P univention -s 10.200.27.6 SET '' -e -o '{"locale": "\x00"}'
umc-client -U Administrator -P univention -s 10.200.27.6 SET '' -e -o '{"user": {"preferences": "\x00"}}'

I replaced the usage of the users/user handlers module by raw LDAP.
Fix: svn r59293
YAML: 2015-03-13-univention-management-console.yaml
EUIIM

I tried my best to write a script which provokes this error also without the UMC server to fix the underlying UDM errors but could not. It is easy reproducible: just remove the extended attribute and set one favorite.
Comment 4 Florian Best univentionstaff 2015-03-20 12:05:37 CET
Created attachment 6774 [details]
37447.py
Comment 5 Florian Best univentionstaff 2015-03-24 10:08:17 CET
24.03.15 10:05:37.008  MAIN        ( ERROR   ) : Traceback (most recent call last):
  File "/usr/sbin/univention-management-console-server", line 210, in <module>
    umc_daemon.do_action()
  File "/usr/lib/pymodules/python2.7/daemon/runner.py", line 186, in do_action
    func(self)
  File "/usr/sbin/univention-management-console-server", line 142, in _restart
    self._start()
  File "/usr/lib/pymodules/python2.7/daemon/runner.py", line 131, in _start
    self.app.run()
  File "/usr/sbin/univention-management-console-server", line 192, in run
    notifier.loop()
  File "/usr/lib/pymodules/python2.7/notifier/nf_generic.py", line 284, in loop
    step()
  File "/usr/lib/pymodules/python2.7/notifier/nf_generic.py", line 271, in step
    not __sockets[ cond ][ fd ]( sock_obj ):
  File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/server.py", line 159, in _receive
    self._handle(state, msg)
  File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/server.py", line 277, in _handle
    state.processor.request(msg)
  File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/session.py", line 282, in request
    self.handle_request_get(msg)
  File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/session.py", line 393, in handle_request_get
    favorites = self._get_user_favorites()
  File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/session.py", line 569, in _get_user_favorites
    favorites = self._get_user_preferences(self._get_user_connection()).setdefault('favorites', ucr.get('umc/web/favorites/default', '')).strip()
  File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/session.py", line 540, in _get_user_preferences
    return dict(val.split('=', 1) if '=' in val else (val, '') for val in preferences)
TypeError: 'NoneType' object is not iterable
Comment 6 Florian Best univentionstaff 2015-03-24 10:29:36 CET
(In reply to Florian Best from comment #5)
> "/usr/lib/pymodules/python2.7/univention/management/console/protocol/session.
> py", line 540, in _get_user_preferences
>     return dict(val.split('=', 1) if '=' in val else (val, '') for val in
> preferences)
> TypeError: 'NoneType' object is not iterable

This error happened if a user did not have the attribute univentionUMCProperty set. Fixed in svn r59334.
Comment 7 Alexander Kläser univentionstaff 2015-03-24 11:59:26 CET
(In reply to Dirk Wiesenthal from comment #0)
> I found a traceback in the UMC server:
> [...]
>       File
> "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line
> 127, in diff
>         if self.descriptions[key].multivalue:
>     KeyError: 'owncloudEnabled'

OK, this works now, cool!

I could reproduce the error in the following manner:
(1) install owncloud (1st time)
(2) uninstall owncloud
(3) install owncloud → the session renewed automatically → UMC server crashes
(4) goto (2)

(In reply to Florian Best from comment #6)
> (In reply to Florian Best from comment #5)
> > "/usr/lib/pymodules/python2.7/univention/management/console/protocol/session.
> > py", line 540, in _get_user_preferences
> >     return dict(val.split('=', 1) if '=' in val else (val, '') for val in
> > preferences)
> > TypeError: 'NoneType' object is not iterable
> 
> This error happened if a user did not have the attribute
> univentionUMCProperty set. Fixed in svn r59334.

OK, this works fine now, could not re-provoke this error with the new version.

YAML entry: OK, I made minor adjustments and adapted the package version [r59339, r59340].
Comment 8 Janek Walkenhorst univentionstaff 2015-03-25 16:42:48 CET
<http://errata.univention.de/ucs/4.0/125.html>