From 37e2e1d24beb9d5a4474dfaacfa209d2c060991f Mon Sep 17 00:00:00 2001 From: Ashesh Vashi Date: Mon, 6 Jun 2016 22:48:50 +0530 Subject: [PATCH] Fixing the decryption issue during restoring the connection on restart. As we convert the binary password to string during storing the connection information, we also need to convert it back to byte-arrays during restoring the connections. Hence - decode the passowrd using 'utf-8' encoding during storing the connection information, and encode it during restoring the connections. --- web/pgadmin/utils/driver/psycopg2/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py b/web/pgadmin/utils/driver/psycopg2/__init__.py index 38e38cbf2..0be232dab 100644 --- a/web/pgadmin/utils/driver/psycopg2/__init__.py +++ b/web/pgadmin/utils/driver/psycopg2/__init__.py @@ -1049,7 +1049,7 @@ class ServerManager(object): res = dict() res['sid'] = self.sid - res['password'] = str(self.password) + res['password'] = self.password.decode('utf-8') connections = res['connections'] = dict() @@ -1151,6 +1151,10 @@ WHERE db.oid = {0}""".format(did)) # first connection for identifications. from pgadmin.browser.server_groups.servers.types import ServerType self.pinged = datetime.datetime.now() + try: + data['password'] = data['password'].encode('utf-8') + except: + pass connections = data['connections'] for conn_id in connections: