Bug 41791 - user names with spaces cause Python backtraces
user names with spaces cause Python backtraces
Status: RESOLVED WONTFIX
Product: UCS
Classification: Unclassified
Component: UMC - Quota
UCS 4.1
Other Linux
: P5 normal (vote)
: ---
Assigned To: UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-07-14 09:20 CEST by Moritz Bunkus
Modified: 2019-01-03 07:20 CET (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 3: A User would likely not purchase the product
User Pain: 0.137
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 Bunkus 2016-07-14 09:20:26 CEST
This originates from the following forum post: http://forum.univention.de/viewtopic.php?t=5867

If a user name contains a white space then using the UMC quota module becomes impossible. A Python error+backtrace is printed instead:

28.06.16 20:29:59.354  DEBUG_INIT
28.06.16 20:30:00.201  MODULE      ( ERROR   ) : Traceback (most recent call last):
  File "/usr/sbin/univention-management-console-module", line 125, in <module>
    notifier.loop()
  File "/usr/lib/pymodules/python2.7/notifier/nf_generic.py", line 283, in loop
    step()
  File "/usr/lib/pymodules/python2.7/notifier/nf_generic.py", line 275, in step
    __min_timer = dispatch.dispatcher_run()
  File "/usr/lib/pymodules/python2.7/notifier/dispatch.py", line 72, in dispatcher_run
    if not disp():
  File "/usr/lib/pymodules/python2.7/notifier/popen.py", line 290, in _watcher
    proc.dead( pid, status )
  File "/usr/lib/pymodules/python2.7/notifier/popen.py", line 169, in dead
    self.signal_emit( 'killed', pid, status )
  File "/usr/lib/pymodules/python2.7/notifier/signals.py", line 75, in signal_emit
    self.__signals[ signal ].emit( *args )
  File "/usr/lib/pymodules/python2.7/notifier/signals.py", line 41, in emit
    cb( *args )
  File "/usr/lib/pymodules/python2.7/notifier/popen.py", line 417, in _finished
    self.signal_emit( 'finished', pid, exit_code, self.__stdout )
  File "/usr/lib/pymodules/python2.7/notifier/signals.py", line 75, in signal_emit
    self.__signals[ signal ].emit( *args )
  File "/usr/lib/pymodules/python2.7/notifier/signals.py", line 41, in emit
    cb( *args )
  File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/quota/user.py", line 80, in _users_query
    quotas = tools.repquota_parse(partition, callbackResult[header + 1 :])
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/quota/tools.py", line 115, in repquota_parse
    grp['fsoft'], grp['fhard'], grp['ftime'])
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/quota/tools.py", line 58, in __init__
    self['sizeLimitUsed'] = block2byte(bused, 'MB')
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/quota/tools.py", line 321, in block2byte
    size = long(size) * float(block_size)
ValueError: invalid literal for long() with base 10: ''

I've traced back the issue to /usr/lib/pymodules/python2.7/univention/management/console/modules/quota/tools.py def "repquota_parse". The regular expression used for matching the output of "repquota" starts with this: '(?P<user>[^ ]*) *[-+]+…' This explicitly prohibits spaces from being part of the user name.

A quick and dirty fix might be to allow white spaces within the user name capture and to require at least one white space to be present afterwards, e.g. like this: '(?P<user>.+?) +[-+]+…'

The theoretical problem with this approach is that user names that end with a white space will still not work.

The proper fix would be to let repquota report user/group IDs instead of names (by using its "-n" option) and to translate those into user names using appropriate API calls.
Comment 1 Florian Best univentionstaff 2016-07-14 09:59:44 CEST
On my UCS 4.1-2 system with such an user the user is simply not shown. Well, I couldn't create such a user via UMC/UDM-CLI and modified the uid attribute of a user via ldapmodify.
Comment 2 Stefan Gohmann univentionstaff 2019-01-03 07:20:44 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.