[PATCH] mirrorbrain.conf: Trailing spaces in passwords are taken #112

Closed
poeml opened this Issue Jun 5, 2015 · 0 comments

Projects

None yet

1 participant

@poeml
Owner
poeml commented Jun 5, 2015
                                                                                       [          ]

Issue migrated (2015-06-05) from old issue tracker http://mirrorbrain.org/issues/issue112

Title    [PATCH] mirrorbrain.conf: Trailing spaces in passwords are taken
             literally
 Priority  bug                  Status         resolved
Superseder                    Nosy List        jcpunk, poeml
 Assigned  poeml               Keywords
      To

                             Files
 File name             Uploaded               Type     Edit Remove

issue_112.patch jcpunk, 2013-04-19.19:04:31 text/x-patch

msg400 (view) Author: poeml Date: 2012-06-27.21:03:08

(Related to issue 27)

Trailing spaces in /etc/mirrorbrain.conf dbpass values are taken literally, which
can be very hard to debug and find. We allow spaces in passwords (as per issue
27), but we should probably disallow them trailing, to avoid confusion.

msg423 (view) Author: jcpunk Date: 2013-04-19.19:04:31

I've attached a patch that fixes this issue.

msg488 (view) Author: poeml Date: 2014-01-29.22:47:32

Hm, I think the .rstrip() should run before the .replace(' ', r'\ ')
Right?

Otherwise, one could end up with a password ending with a trailing backslash instead of
a trailing space.

So I think, better is:
@@ -122,6 +122,7 @@
except:
sys.exit("Your config doesn't have a 'dbname' setting.")

  •        config['dbpass'] = config['dbpass'].rstrip()
           config['dbpass'] = config['dbpass'].replace(' ', r'\ ')
           config['dbpass'] = config['dbpass'].replace('\t', '\\t')
           config['dbpass'] = config['dbpass'].replace("'", r"\'")
    
msg489 (view) Author: poeml Date: 2014-01-29.22:51:10

Committed to SVN trunk, r8345. Thanks, Pat!

History
         Date          User  Action                     Args
2014-01-29 22:51:10 poeml  set    status: chatting -> resolved
                                    messages: + msg489
2014-01-29 22:47:32 poeml  set    messages: + msg488
                                    title: mirrorbrain.conf: Trailing spaces in
2014-01-22 20:06:51 poeml  set    passwords are taken literally -> [PATCH]
                                    mirrorbrain.conf: Trailing spaces in
                                    passwords are taken literally
                                    files: + issue_112.patch
2013-04-19 19:04:31 jcpunk set    nosy: + jcpunk
                                    messages: + msg423
2012-06-27 21:03:08 poeml  create

(end of migrated issue)
@poeml poeml added bug resolved labels Jun 5, 2015
@poeml poeml closed this Jun 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment