Alon Bar-Lev has uploaded a new change for review.

Change subject: packaging: setup: handle special characters in database password
......................................................................

packaging: setup: handle special characters in database password

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=811234
Change-Id: Ide021a99d30b616e6396a7412ec17cf3a3e0ed02
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M packaging/setup/plugins/ovirt-engine-common/db/pgpass.py
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/69/17769/1

diff --git a/packaging/setup/plugins/ovirt-engine-common/db/pgpass.py 
b/packaging/setup/plugins/ovirt-engine-common/db/pgpass.py
index 564ca24..1d098f3 100644
--- a/packaging/setup/plugins/ovirt-engine-common/db/pgpass.py
+++ b/packaging/setup/plugins/ovirt-engine-common/db/pgpass.py
@@ -54,6 +54,15 @@
             os.close(fd)
             os.chmod(pgpass, 0o600)
         with open(pgpass, 'w') as f:
+            def pescape(s):
+                ret = ''
+                for c in s:
+                    if c in ('\\', ':'):
+                        ret += '\\' + c
+                    else:
+                        ret += c
+                return ret
+
             f.write(
                 (
                     '# DB USER credentials.\n'
@@ -63,7 +72,9 @@
                     port=self.environment[osetupcons.DBEnv.PORT],
                     database=self.environment[osetupcons.DBEnv.DATABASE],
                     user=self.environment[osetupcons.DBEnv.USER],
-                    password=self.environment[osetupcons.DBEnv.PASSWORD],
+                    password=pescape(
+                        self.environment[osetupcons.DBEnv.PASSWORD]
+                    ),
                 ),
             )
 


-- 
To view, visit http://gerrit.ovirt.org/17769
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide021a99d30b616e6396a7412ec17cf3a3e0ed02
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to