[opensuse-buildservice] Extra newlines in base64 passx on SLES 10 (python 2.4.2)
When converting an older oscrc that contained a random password, the add_section part that was rewriting the password to be bz2 and base64 encoded died with: Traceback (most recent call last): File "/usr/lib64/python2.4/site-packages/osc/babysitter.py", line 46, in run return prg.main() File "/usr/lib64/python2.4/site-packages/osc/cmdln.py", line 300, in main self.postoptparse() File "/usr/lib64/python2.4/site-packages/osc/commandline.py", line 115, in postoptparse override_verbose = self.options.verbose) File "/usr/lib64/python2.4/site-packages/osc/conf.py", line 617, in get_config add_section(conffile, url, user, password) File "/usr/lib64/python2.4/site-packages/osc/conf.py", line 505, in add_section cp.set(url, 'passx', passwd.encode('bz2').encode('base64')) File "/usr/lib64/python2.4/ConfigParser.py", line 640, in set ConfigParser.set(self, section, option, value) File "/usr/lib64/python2.4/ConfigParser.py", line 359, in set sectdict[self.optionxform(option)] = value File "/usr/lib64/python2.4/site-packages/osc/OscConfigParser.py", line 134, in __setitem__ self._add_option(key, val) File "/usr/lib64/python2.4/site-packages/osc/OscConfigParser.py", line 119, in _add_option self._lines.append(OptionLine(optname, line)) File "/usr/lib64/python2.4/site-packages/osc/OscConfigParser.py", line 182, in __init__ self.format(line) File "/usr/lib64/python2.4/site-packages/osc/OscConfigParser.py", line 186, in format key, val = mo.group('option', 'value') AttributeError: 'NoneType' object has no attribute 'group' Looking at the encoded password it was passx = 'QlpoOTFBWSZTWdaogbUAAAWPgDwAGgRGEBA8oEAgACKAAaeo8oUwmmgNMT1QmTbwV1iAUV8XckU4\nUJDWqIG1\n' the original password is pass = 'ZlUBqC2PELx4j3bio1kT' It seemed odd to me that base64 encoding would include \n, so I tried using base64 instead of encode('base64'): passx = base64.b64encode(passwd.encode('bz2')) passx = 'QlpoOTFBWSZTWdaogbUAAAWPgDwAGgRGEBA8oEAgACKAAaeo8oUwmmgNMT1QmTbwV1iAUV8XckU4UJDWqIG1' If you compare the two encodings you'll notice that the only difference is the infix newline and the newline at the end. -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
On 2010-01-20 12:34:06 -0600, Luke Imhoff wrote:
When converting an older oscrc that contained a random password, the add_section part that was rewriting the password to be bz2 and base64 encoded died with:
<SNIP>
It seemed odd to me that base64 encoding would include \n, so I tried using base64 instead of encode('base64'):
passx = base64.b64encode(passwd.encode('bz2')) passx = 'QlpoOTFBWSZTWdaogbUAAAWPgDwAGgRGEBA8oEAgACKAAaeo8oUwmmgNMT1QmTbwV1iAUV8XckU4UJDWqIG1'
If you compare the two encodings you'll notice that the only difference is the infix newline and the newline at the end.
Thanks I just adopted it in git master. I really fail to see a meaningful reason why encode('base64') splits the string at 76 char boundaries... Marcus -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
participants (2)
-
Luke Imhoff
-
Marcus Hüwe