[mirrorbrain-commits] r7885 - /trunk/mirrordoctor/mb/conn.py

From: <poeml_at_mirrorbrain.org>
Date: Tue, 01 Dec 2009 17:59:14 -0000
Author: poeml
Date: Tue Dec  1 18:59:12 2009
New Revision: 7885

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=7885&view=rev
Log:
mb: escape special characters in the password, before passing it to
SQLObject/psycopg2, thus (mostly) fixing issue 27.

Modified:
    trunk/mirrordoctor/mb/conn.py

Modified: trunk/mirrordoctor/mb/conn.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mirrordoctor/mb/conn.py?rev=7885&r1=7884&r2=7885&view=diff
==============================================================================
--- trunk/mirrordoctor/mb/conn.py (original)
+++ trunk/mirrordoctor/mb/conn.py Tue Dec  1 18:59:12 2009
@@ -97,6 +97,11 @@
                 import psycopg2
             except: 
                 sys.exit('To use mb with PostgreSQL, you need the pcycopg2 Python module installed.')
+            # see http://mirrorbrain.org/issues/issue27
+            config['dbpass'] = config['dbpass'].replace(' ', r'\ ')
+            config['dbpass'] = config['dbpass'].replace('\t', '\\\t')
+            config['dbpass'] = config['dbpass'].replace("'", r"\'")
+            config['dbpass'] = config['dbpass'].replace('"', r'$$"$$')
         elif dbdriver in ['mysql']:
             dbport = '3306'
         else:




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Tue Dec 01 2009 - 17:59:16 GMT

This archive was generated by hypermail 2.2.0 : Tue Dec 01 2009 - 18:45:10 GMT