Bug 34215 - Undefined variables and insufficient tests of user input in share_restrictions.py
Undefined variables and insufficient tests of user input in share_restriction...
Status: RESOLVED DUPLICATE of bug 46975
Product: UCS
Classification: Unclassified
Component: Samba
UCS 4.2
Other Linux
: P5 normal (vote)
: ---
Assigned To: Samba maintainers
https://univention.plan.io/issues/5416
:
: 41508 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-03 12:01 CET by Jan Christoph Ebersbach
Modified: 2019-10-16 10:38 CEST (History)
4 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
Enterprise Customer affected?: Yes
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
requate: Patch_Available+


Attachments
Fix variable definitions and non-existing shares (554 bytes, patch)
2014-03-03 12:02 CET, Jan Christoph Ebersbach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Christoph Ebersbach univentionstaff 2014-03-03 12:01:08 CET
I tried to set the following UCR variable to alter the sysvol configuration:

  ucr set 'samba/share/sysvol/options/root preexec=/usr/bin/logon-logger %U %m %M on'

This resulted in multiple tracebacks because of the undefined variables options and match.  Once I fixed the issues, the script had problems setting options for the sysvol share which isn't defined.

The attached patch works around the issues by correcting the variables and defining any non-existing share.

First traceback:
Script: /etc/univention/templates/scripts/samba.local.config.py
Traceback (most recent call last):
  File "/etc/univention/templates/scripts/samba.local.config.py", line 40, in <module>
    conf.read()
  File "/usr/lib/pymodules/python2.6/univention/lib/share_restrictions.py", line 336, in read
    self.read_ucr()
  File "/usr/lib/pymodules/python2.6/univention/lib/share_restrictions.py", line 326, in read_ucr
    func( ucr[ key ], *match.groups() )
  File "/usr/lib/pymodules/python2.6/univention/lib/share_restrictions.py", line 301, in _set_options
    if match and share and options and value:
NameError: global name 'match' is not defined

Second traceback after removing match:
Script: /etc/univention/templates/scripts/samba.local.config.py
Traceback (most recent call last):
  File "/etc/univention/templates/scripts/samba.local.config.py", line 40, in <module>
    conf.read()
  File "/usr/lib/pymodules/python2.6/univention/lib/share_restrictions.py", line 336, in read
    self.read_ucr()
  File "/usr/lib/pymodules/python2.6/univention/lib/share_restrictions.py", line 326, in read_ucr
    func( ucr[ key ], *match.groups() )
  File "/usr/lib/pymodules/python2.6/univention/lib/share_restrictions.py", line 301, in _set_options
    if share and options and value:
NameError: global name 'options' is not defined

Third traceback after correcting option variable:
Script: /etc/univention/templates/scripts/samba.local.config.py
Traceback (most recent call last):
  File "/etc/univention/templates/scripts/samba.local.config.py", line 40, in <module>
    conf.read()
  File "/usr/lib/pymodules/python2.6/univention/lib/share_restrictions.py", line 336, in read
    self.read_ucr()
  File "/usr/lib/pymodules/python2.6/univention/lib/share_restrictions.py", line 326, in read_ucr
    func( ucr[ key ], *match.groups() )
  File "/usr/lib/pymodules/python2.6/univention/lib/share_restrictions.py", line 302, in _set_options
    if not option in self._shares[ share ]:
KeyError: 'sysvol'
Comment 1 Jan Christoph Ebersbach univentionstaff 2014-03-03 12:02:03 CET
Created attachment 5809 [details]
Fix variable definitions and non-existing shares
Comment 2 Stefan Gohmann univentionstaff 2016-02-25 12:16:13 CET
Still a problem. I've added a simple test case for this (r67683):  tests/53_samba-common/49share_local_conf
Comment 3 Florian Best univentionstaff 2017-02-17 16:55:01 CET
*** Bug 41508 has been marked as a duplicate of this bug. ***
Comment 4 Florian Best univentionstaff 2019-10-10 12:27:45 CEST
This was fixed in Bug #46975 git:ff0cee9959c14fc8e3ca7295a0178fb2108e1e6c

*** This bug has been marked as a duplicate of bug 46975 ***
Comment 5 Florian Best univentionstaff 2019-10-10 12:29:58 CEST
Reenable test case:

ucs-test (9.0.3-78)
ea1a6cb425cc | Bug #34215: reenable test case

ucs-test (6.0.33-22)
r67683 | 53_samba-common/49share_local_conf: Added new test case which checks