Commit 9b12d378 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

fixup! generate.password: Strip new lines from the password file

Strip earlier, as stripping so late leads to correct self.passwd
but incorrect passwd, thus 3rd party applications storing passwords
with additional newlines are still resulting in bad passwords.

/reviewed-on !366
parent 05a8d355
...@@ -134,14 +134,14 @@ class Password(object): ...@@ -134,14 +134,14 @@ class Password(object):
if self.storage_path: if self.storage_path:
try: try:
with open(self.storage_path) as f: with open(self.storage_path) as f:
passwd = f.read() passwd = f.read().strip('\n')
except IOError as e: except IOError as e:
if e.errno != errno.ENOENT: if e.errno != errno.ENOENT:
raise raise
if not passwd: if not passwd:
passwd = self.generatePassword(int(options.get('bytes', '8'))) passwd = self.generatePassword(int(options.get('bytes', '8')))
self.update = self.install self.update = self.install
self.passwd = passwd.strip('\n') self.passwd = passwd
# Password must not go into .installed file, for 2 reasons: # Password must not go into .installed file, for 2 reasons:
# security of course but also to prevent buildout to always reinstall. # security of course but also to prevent buildout to always reinstall.
def get(option, *args, **kw): def get(option, *args, **kw):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment