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

Change subject: packaging: setup: legacy: db: parse pgpass file with escapes
......................................................................

packaging: setup: legacy: db: parse pgpass file with escapes

read escape of \\ and \: correctly.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1064428
Change-Id: I4727d1c926cefa44c3a98382983126b8f9873051
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
1 file changed, 17 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/07/24407/1

diff --git a/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py 
b/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
index 734c344..3b69991 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
@@ -68,8 +68,23 @@
                 'r',
             ) as f:
                 for l in f:
-                    l = l.rstrip('\n')
-                    d = l.split(':')
+                    if l[-1] != '\n':
+                        l += '\n'
+                    d = []
+                    escape = False
+                    s = ''
+                    for c in l:
+                        if escape:
+                            escape = False
+                            s += c
+                        else:
+                            if c == ':' or c == '\n':
+                                d.append(s)
+                                s = ''
+                            elif c == '\\':
+                                escape = True
+                            else:
+                                s += c
                     if len(d) == 5 and d[3] == legacy_user:
                         self._dbenv = {
                             osetupcons.DBEnv.HOST: d[0],


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4727d1c926cefa44c3a98382983126b8f9873051
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to