Bug 32463 - Quoting problems in system setup profile
Quoting problems in system setup profile
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: System setup
UCS 3.1
Other Linux
: P5 normal (vote)
: UCS 3.1-1-errata
Assigned To: Philipp Hahn
Lukas Walter
:
Depends on:
Blocks: 32535
  Show dependency treegraph
 
Reported: 2013-09-02 16:28 CEST by Stefan Gohmann
Modified: 2013-09-24 11:09 CEST (History)
1 user (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 Stefan Gohmann univentionstaff 2013-09-02 16:28:35 CEST
Currently we have a problem with special characters in the system setup profile, for example for the root_password.
Comment 1 Stefan Gohmann univentionstaff 2013-09-02 16:31:55 CEST
Something for our quoting expert ... ;)

See also here: http://forum.univention.de/viewtopic.php?f=48&t=2826
Comment 2 Philipp Hahn univentionstaff 2013-09-05 16:20:12 CEST
The shell function get_profile_var() wrongly stripped all quotes from the profile variable.
Please note that the profile file is not shell correctly quoted, but simply uses the format key="value" or key='value'; if value contains " or ' that would breaks shell parsing. Therefore it's required to use the above mentioned shell function.

Patch extracted from attachment 5319 [details] of Bug #32324 and applied to 3.2 and 3.1-1.

3.2-0: r43740 univention-system-setup_7.0.35-1.505.201309051608
3.1-1: r43741 univention-system-setup_6.0.76-20.506.201309051608

changelog-3.2.xml, 2013-09-05-univention-system-setup.yaml: r43743
A profile parsing function was fixed to not strip all double quotes from supplied values, which now allows to use quotes in passwords


# . /usr/lib/univention-system-setup/scripts/setup_utils.sh
# cat >>"$profile_file" <<__TEST__
p1="root"
p2='root'
p3="root'root"
p4='root"root'
__TEST__
# get_profile_var p1 # root → root
# get_profile_var p2 # 'root' → root
# get_profile_var p3 # root'root → root'root
# get_profile_var p4 # 'rootroot' → root"root
Comment 3 Philipp Hahn univentionstaff 2013-09-06 10:53:37 CEST
r43764: Fix '/' in UCRV names
3.2-0: 7.0.35-2.507.201309061048
3.1-0: 6.0.76-21.508.201309061048, YAML r43765

# . /usr/lib/univention-system-setup/scripts/setup_utils.sh 
# echo 'ldap/base="dc=autotest090,dc=local" >>"$profile_file"
# get_profile_var "ldap/base"
dc=autotest090,dc=local
Comment 4 Lukas Walter univentionstaff 2013-09-12 14:47:15 CEST
OK: works perfectly
OK: ucs-3.2 changelog
OK: YAML
Comment 5 Philipp Hahn univentionstaff 2013-09-16 13:12:46 CEST
There was the additional problem, that the password could not contain the hash (#) character, since everything after the first # in a line of the profile was stripped.
The regexp to parse the profile has been changed to allow comments only on lines by itself; trailing comments are no longer allowed:
 OK:
  # this is a comment
  variable=value
  variable="value"
  variable='value'   
   # trailing space ^ after the final ' or " are stripped
 INVALID:
  variable=value # this is a comment
(In the invalid example the variable is set to the complete trailing string "value # this is a comment" and not only "value".)

Please note, that the current documentation also only mentions full-line comments
at <http://docs.univention.de/installation-3.1.html#profile:variables>:
> Multiple values for one variable are separated by blank spaces. Lines are commented out with #.

r44064 | Bug #32463: Fix parsing profile
univention-system-setup_7.0.42-2.516.201309161259
Comment 6 Philipp Hahn univentionstaff 2013-09-17 14:34:14 CEST
3.1-1:
r44147 | Bug #32463: USS: Fix parsing profile
r44146 | Bug #32463: USS: Fix parsing profile
Comment 7 Lukas Walter univentionstaff 2013-09-17 14:39:21 CEST
OK: ucs-3.1-1 svn
OK: ucs-3.2-0 svn
OK: works
OK: YAML
Comment 8 Moritz Muehlenhoff univentionstaff 2013-09-24 11:09:45 CEST
http://errata.univention.de/ucs/3.1/183.html