pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
11+ messages / 6 participants
[nested] [flat]
* BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
@ 2014-05-07 04:32 dlo@isam.kiwi
0 siblings, 1 reply; 11+ messages in thread
From: dlo@isam.kiwi @ 2014-05-07 04:32 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 10250
Logged by: Ben Walter
Email address: dlo@isam.kiwi
PostgreSQL version: Unsupported/Unknown
Operating system: openSUSE 13.1 (Bottle) (x86_64)
Description:
When storing credentials for connections into ~/.pgpass the credentials is
stored in delimited plaintext form. Not only is this practise a security
risk, but when the credential contains the delimiter (colon) it fails to be
read back out and app responds with "invalid credentials".
x.x.x.x:5432:*:username:password:with:colons
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
@ 2014-05-07 15:44 Stephen Frost <sfrost@snowman.net>
parent: dlo@isam.kiwi
0 siblings, 1 reply; 11+ messages in thread
From: Stephen Frost @ 2014-05-07 15:44 UTC (permalink / raw)
To: dlo@isam.kiwi; +Cc: pgsql-bugs
Ben,
* dlo@isam.kiwi (dlo@isam.kiwi) wrote:
> When storing credentials for connections into ~/.pgpass the credentials is
> stored in delimited plaintext form. Not only is this practise a security
> risk,
This isn't a bug, it's intentional, and if it goes against your security
requirements then simply don't do it. Storing it in .pgpass encrypted
would require a password to either be provided (in which case, just
don't have the password in the pgpass file..) or for the key to be
stored in plain-text somewhere, which would be the same situation.
Perhaps there is a feature request in here somewhere to have an
ssh-agent like daemon, but there simply hasn't been demand for it.
> but when the credential contains the delimiter (colon) it fails to be
> read back out and app responds with "invalid credentials".
>
> x.x.x.x:5432:*:username:password:with:colons
Per the fine documentation, you need to escape any such usage with a
backslash. Please review:
http://www.postgresql.org/docs/9.3/static/libpq-pgpass.html
Thanks,
Stephen
Attachments:
signature.asc (application/pgp-signature, 835B) download
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [BUGS] BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
@ 2014-05-07 20:51 Heikki Linnakangas <hlinnakangas@vmware.com>
parent: Stephen Frost <sfrost@snowman.net>
0 siblings, 1 reply; 11+ messages in thread
From: Heikki Linnakangas @ 2014-05-07 20:51 UTC (permalink / raw)
To: Stephen Frost <sfrost@snowman.net>; dlo@isam.kiwi; +Cc: pgsql-bugs; pgadmin-hackers <pgadmin-hackers@postgresql.org>
(forwarding to pgadmin-hackers)
On 05/07/2014 06:44 PM, Stephen Frost wrote:
> * dlo@isam.kiwi (dlo@isam.kiwi) wrote:
>> but when the credential contains the delimiter (colon) it fails to be
>> read back out and app responds with "invalid credentials".
>>
>> x.x.x.x:5432:*:username:password:with:colons
>
> Per the fine documentation, you need to escape any such usage with a
> backslash. Please review:
Stephen, you missed the context. pgadmin3 saves .pgpass, when you check
the "store password" checkbox in the connection dialog. And apparantly
pgadmin3 doesn't do that escaping properly.
- Heikki
--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
@ 2014-05-08 00:07 Stephen Frost <sfrost@snowman.net>
parent: Heikki Linnakangas <hlinnakangas@vmware.com>
0 siblings, 1 reply; 11+ messages in thread
From: Stephen Frost @ 2014-05-08 00:07 UTC (permalink / raw)
To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: dlo@isam.kiwi; pgsql-bugs; pgadmin-hackers <pgadmin-hackers@postgresql.org>
* Heikki Linnakangas (hlinnakangas@vmware.com) wrote:
> (forwarding to pgadmin-hackers)
Ah.
> On 05/07/2014 06:44 PM, Stephen Frost wrote:
> >* dlo@isam.kiwi (dlo@isam.kiwi) wrote:
> >>but when the credential contains the delimiter (colon) it fails to be
> >>read back out and app responds with "invalid credentials".
> >>
> >>x.x.x.x:5432:*:username:password:with:colons
> >
> >Per the fine documentation, you need to escape any such usage with a
> >backslash. Please review:
>
> Stephen, you missed the context. pgadmin3 saves .pgpass, when you
> check the "store password" checkbox in the connection dialog. And
> apparantly pgadmin3 doesn't do that escaping properly.
Wow, that's pretty rough. Hopefully they'll be able to fix it soon. :)
Thanks,
Stephen
Attachments:
signature.asc (application/pgp-signature, 835B) download
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Re: [BUGS] BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
@ 2014-05-08 08:07 Dave Page <dpage@pgadmin.org>
parent: Stephen Frost <sfrost@snowman.net>
0 siblings, 1 reply; 11+ messages in thread
From: Dave Page @ 2014-05-08 08:07 UTC (permalink / raw)
To: Stephen Frost <sfrost@snowman.net>; Akshay Joshi <akshay.joshi@enterprisedb.com>; +Cc: Heikki Linnakangas <hlinnakangas@vmware.com>; dlo@isam.kiwi; pgsql-bugs; pgadmin-hackers <pgadmin-hackers@postgresql.org>
Akshay, can you look into the quoting problem please.
On Thu, May 8, 2014 at 1:07 AM, Stephen Frost <sfrost@snowman.net> wrote:
> * Heikki Linnakangas (hlinnakangas@vmware.com) wrote:
>> (forwarding to pgadmin-hackers)
>
> Ah.
>
>> On 05/07/2014 06:44 PM, Stephen Frost wrote:
>> >* dlo@isam.kiwi (dlo@isam.kiwi) wrote:
>> >>but when the credential contains the delimiter (colon) it fails to be
>> >>read back out and app responds with "invalid credentials".
>> >>
>> >>x.x.x.x:5432:*:username:password:with:colons
>> >
>> >Per the fine documentation, you need to escape any such usage with a
>> >backslash. Please review:
>>
>> Stephen, you missed the context. pgadmin3 saves .pgpass, when you
>> check the "store password" checkbox in the connection dialog. And
>> apparantly pgadmin3 doesn't do that escaping properly.
>
> Wow, that's pretty rough. Hopefully they'll be able to fix it soon. :)
>
> Thanks,
>
> Stephen
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: [pgadmin-hackers] Re: BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
@ 2014-05-08 09:04 Akshay Joshi <akshay.joshi@enterprisedb.com>
parent: Dave Page <dpage@pgadmin.org>
0 siblings, 1 reply; 11+ messages in thread
From: Akshay Joshi @ 2014-05-08 09:04 UTC (permalink / raw)
To: Dave Page <dpage@pgadmin.org>; +Cc: Stephen Frost <sfrost@snowman.net>; Heikki Linnakangas <hlinnakangas@vmware.com>; dlo@isam.kiwi; pgsql-bugs; pgadmin-hackers <pgadmin-hackers@postgresql.org>
Sure.
On Thu, May 8, 2014 at 1:37 PM, Dave Page <dpage@pgadmin.org> wrote:
> Akshay, can you look into the quoting problem please.
>
> On Thu, May 8, 2014 at 1:07 AM, Stephen Frost <sfrost@snowman.net> wrote:
> > * Heikki Linnakangas (hlinnakangas@vmware.com) wrote:
> >> (forwarding to pgadmin-hackers)
> >
> > Ah.
> >
> >> On 05/07/2014 06:44 PM, Stephen Frost wrote:
> >> >* dlo@isam.kiwi (dlo@isam.kiwi) wrote:
> >> >>but when the credential contains the delimiter (colon) it fails to be
> >> >>read back out and app responds with "invalid credentials".
> >> >>
> >> >>x.x.x.x:5432:*:username:password:with:colons
> >> >
> >> >Per the fine documentation, you need to escape any such usage with a
> >> >backslash. Please review:
> >>
> >> Stephen, you missed the context. pgadmin3 saves .pgpass, when you
> >> check the "store password" checkbox in the connection dialog. And
> >> apparantly pgadmin3 doesn't do that escaping properly.
> >
> > Wow, that's pretty rough. Hopefully they'll be able to fix it soon. :)
> >
> > Thanks,
> >
> > Stephen
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
--
*Akshay Joshi*
*Principal Software Engineer *
*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Re: [BUGS] BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
@ 2014-05-15 06:39 Akshay Joshi <akshay.joshi@enterprisedb.com>
parent: Akshay Joshi <akshay.joshi@enterprisedb.com>
0 siblings, 1 reply; 11+ messages in thread
From: Akshay Joshi @ 2014-05-15 06:39 UTC (permalink / raw)
To: Dave Page <dpage@pgadmin.org>; +Cc: Stephen Frost <sfrost@snowman.net>; Heikki Linnakangas <hlinnakangas@vmware.com>; dlo@isam.kiwi; pgsql-bugs; pgadmin-hackers <pgadmin-hackers@postgresql.org>
Hi Dave
I have fixed the escaping issue and tested it. It works fine for me.
Attached is the patch file, can you please review it.
If code looks good to you, can you please commit the code.
On Thu, May 8, 2014 at 2:34 PM, Akshay Joshi
<akshay.joshi@enterprisedb.com>wrote:
> Sure.
>
>
> On Thu, May 8, 2014 at 1:37 PM, Dave Page <dpage@pgadmin.org> wrote:
>
>> Akshay, can you look into the quoting problem please.
>>
>> On Thu, May 8, 2014 at 1:07 AM, Stephen Frost <sfrost@snowman.net> wrote:
>> > * Heikki Linnakangas (hlinnakangas@vmware.com) wrote:
>> >> (forwarding to pgadmin-hackers)
>> >
>> > Ah.
>> >
>> >> On 05/07/2014 06:44 PM, Stephen Frost wrote:
>> >> >* dlo@isam.kiwi (dlo@isam.kiwi) wrote:
>> >> >>but when the credential contains the delimiter (colon) it fails to be
>> >> >>read back out and app responds with "invalid credentials".
>> >> >>
>> >> >>x.x.x.x:5432:*:username:password:with:colons
>> >> >
>> >> >Per the fine documentation, you need to escape any such usage with a
>> >> >backslash. Please review:
>> >>
>> >> Stephen, you missed the context. pgadmin3 saves .pgpass, when you
>> >> check the "store password" checkbox in the connection dialog. And
>> >> apparantly pgadmin3 doesn't do that escaping properly.
>> >
>> > Wow, that's pretty rough. Hopefully they'll be able to fix it soon. :)
>> >
>> > Thanks,
>> >
>> > Stephen
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
>
> --
> *Akshay Joshi*
> *Principal Software Engineer *
>
>
>
> *Phone: +91 20-3058-9517 Mobile: +91 976-788-8246*
>
--
*Akshay Joshi*
*Principal Software Engineer *
*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
Fixed_unescaped_password.patch (application/octet-stream, 3.2K) download
diff --git a/pgadmin/frm/frmPgpassConfig.cpp b/pgadmin/frm/frmPgpassConfig.cpp
index e160601..40f5249 100644
--- a/pgadmin/frm/frmPgpassConfig.cpp
+++ b/pgadmin/frm/frmPgpassConfig.cpp
@@ -172,7 +172,25 @@ void frmPgpassConfig::WriteFile(pgConn *conn)
wxString str;
size_t i;
for (i = 0 ; i < lines.GetCount() - 1 ; i++)
- str.Append(lines.Item(i).GetText() + wxT("\n"));
+ {
+ // Before writing it into the file we need to escape "\" and ":"
+ pgPassConfigLine line = lines.Item(i);
+ line.hostname.Replace(wxT("\\"), wxT("\\\\"));
+ line.hostname.Replace(wxT(":") , wxT("\\:"));
+ line.port.Replace(wxT("\\"), wxT("\\\\"));
+ line.port.Replace(wxT(":") , wxT("\\:"));
+ line.database.Replace(wxT("\\"), wxT("\\\\"));
+ line.database.Replace(wxT(":") , wxT("\\:"));
+ line.username.Replace(wxT("\\"), wxT("\\\\"));
+ line.username.Replace(wxT(":") , wxT("\\:"));
+ line.password.Replace(wxT("\\"), wxT("\\\\"));
+ line.password.Replace(wxT(":") , wxT("\\:"));
+
+ wxString strLine = line.hostname + wxT(":") + line.port + wxT(":") +
+ line.database + wxT(":") + line.username + wxT(":") + line.password + wxT("\n");
+
+ str.Append(strLine);
+ }
if (DoWriteFile(str, NULL))
{
diff --git a/pgadmin/schema/pgServer.cpp b/pgadmin/schema/pgServer.cpp
index 906d7ec..5d999e3 100644
--- a/pgadmin/schema/pgServer.cpp
+++ b/pgadmin/schema/pgServer.cpp
@@ -585,6 +585,13 @@ void pgServer::StorePassword()
+ username + wxT(":") ;
}
+ // Escape ":" and "\" from the password field
+ if (!passwd.IsEmpty())
+ {
+ passwd.Replace(wxT("\\"), wxT("\\\\"));
+ passwd.Replace(wxT(":") , wxT("\\:"));
+ }
+
file.Read(before);
wxStringTokenizer lines(before, wxT("\n\r"));
diff --git a/pgadmin/utils/pgconfig.cpp b/pgadmin/utils/pgconfig.cpp
index a7d9a31..b59531f 100644
--- a/pgadmin/utils/pgconfig.cpp
+++ b/pgadmin/utils/pgconfig.cpp
@@ -570,17 +570,47 @@ void pgPassConfigLine::Init(const wxString &line)
isComment = line.StartsWith(wxT("#"));
- wxStringTokenizer tok(isComment ? line.Mid(1) : line, wxT(":"));
- if (tok.HasMoreTokens())
- hostname = tok.GetNextToken();
- if (tok.HasMoreTokens())
- port = tok.GetNextToken();
- if (tok.HasMoreTokens())
- database = tok.GetNextToken();
- if (tok.HasMoreTokens())
- username = tok.GetNextToken();
- if (tok.HasMoreTokens())
- password = tok.GetNextToken();
+ wxString tmpLine = line;
+ // De-escape backslash "\"
+ tmpLine.Replace(wxT("\\\\"), wxT("\\"));
+
+ int iVarCount = 0;
+ wxStringTokenizer tok(isComment ? tmpLine.Mid(1) : tmpLine, wxT(":"));
+ while(tok.HasMoreTokens())
+ {
+ wxString val = tok.GetNextToken();
+ if (!val.IsEmpty())
+ {
+ /* if last charecter of the token is backslash "\" then it means
+ that it is used to escape ":" so we need to add the next token.
+ */
+ while(val.Last() == wxT('\\'))
+ {
+ val.RemoveLast();
+ val = val + wxT(":") + tok.GetNextToken();
+ }
+
+ iVarCount++;
+ switch(iVarCount)
+ {
+ case 1: // hostname
+ hostname = val;
+ break;
+ case 2: // port
+ port = val;
+ break;
+ case 3: // database
+ database = val;
+ break;
+ case 4: //username
+ username = val;
+ break;
+ case 5: // password
+ password = val;
+ break;
+ }
+ }
+ }
}
wxString pgPassConfigLine::GetText()
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Re: [BUGS] BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
@ 2014-05-16 08:23 Dave Page <dpage@pgadmin.org>
parent: Akshay Joshi <akshay.joshi@enterprisedb.com>
0 siblings, 1 reply; 11+ messages in thread
From: Dave Page @ 2014-05-16 08:23 UTC (permalink / raw)
To: Akshay Joshi <akshay.joshi@enterprisedb.com>; +Cc: Stephen Frost <sfrost@snowman.net>; Heikki Linnakangas <hlinnakangas@vmware.com>; dlo@isam.kiwi; pgadmin-hackers <pgadmin-hackers@postgresql.org>; Dhiraj Chawla <dhiraj.chawla@enterprisedb.com>
Thanks Akshay. Dhiraj, can you review please? I'm a little busy right now.
Thanks.
On Thu, May 15, 2014 at 7:39 AM, Akshay Joshi <akshay.joshi@enterprisedb.com
> wrote:
> Hi Dave
>
> I have fixed the escaping issue and tested it. It works fine for me.
> Attached is the patch file, can you please review it.
> If code looks good to you, can you please commit the code.
>
>
> On Thu, May 8, 2014 at 2:34 PM, Akshay Joshi <
> akshay.joshi@enterprisedb.com> wrote:
>
>> Sure.
>>
>>
>> On Thu, May 8, 2014 at 1:37 PM, Dave Page <dpage@pgadmin.org> wrote:
>>
>>> Akshay, can you look into the quoting problem please.
>>>
>>> On Thu, May 8, 2014 at 1:07 AM, Stephen Frost <sfrost@snowman.net>
>>> wrote:
>>> > * Heikki Linnakangas (hlinnakangas@vmware.com) wrote:
>>> >> (forwarding to pgadmin-hackers)
>>> >
>>> > Ah.
>>> >
>>> >> On 05/07/2014 06:44 PM, Stephen Frost wrote:
>>> >> >* dlo@isam.kiwi (dlo@isam.kiwi) wrote:
>>> >> >>but when the credential contains the delimiter (colon) it fails to
>>> be
>>> >> >>read back out and app responds with "invalid credentials".
>>> >> >>
>>> >> >>x.x.x.x:5432:*:username:password:with:colons
>>> >> >
>>> >> >Per the fine documentation, you need to escape any such usage with a
>>> >> >backslash. Please review:
>>> >>
>>> >> Stephen, you missed the context. pgadmin3 saves .pgpass, when you
>>> >> check the "store password" checkbox in the connection dialog. And
>>> >> apparantly pgadmin3 doesn't do that escaping properly.
>>> >
>>> > Wow, that's pretty rough. Hopefully they'll be able to fix it soon. :)
>>> >
>>> > Thanks,
>>> >
>>> > Stephen
>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>>
>> --
>> *Akshay Joshi*
>> *Principal Software Engineer *
>>
>>
>>
>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91 976-788-8246
>> <%2B91%20976-788-8246>*
>>
>
>
>
> --
> *Akshay Joshi*
> *Principal Software Engineer *
>
>
>
> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91 976-788-8246
> <%2B91%20976-788-8246>*
>
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
Fixed_unescaped_password.patch (application/octet-stream, 3.2K) download
diff --git a/pgadmin/frm/frmPgpassConfig.cpp b/pgadmin/frm/frmPgpassConfig.cpp
index e160601..40f5249 100644
--- a/pgadmin/frm/frmPgpassConfig.cpp
+++ b/pgadmin/frm/frmPgpassConfig.cpp
@@ -172,7 +172,25 @@ void frmPgpassConfig::WriteFile(pgConn *conn)
wxString str;
size_t i;
for (i = 0 ; i < lines.GetCount() - 1 ; i++)
- str.Append(lines.Item(i).GetText() + wxT("\n"));
+ {
+ // Before writing it into the file we need to escape "\" and ":"
+ pgPassConfigLine line = lines.Item(i);
+ line.hostname.Replace(wxT("\\"), wxT("\\\\"));
+ line.hostname.Replace(wxT(":") , wxT("\\:"));
+ line.port.Replace(wxT("\\"), wxT("\\\\"));
+ line.port.Replace(wxT(":") , wxT("\\:"));
+ line.database.Replace(wxT("\\"), wxT("\\\\"));
+ line.database.Replace(wxT(":") , wxT("\\:"));
+ line.username.Replace(wxT("\\"), wxT("\\\\"));
+ line.username.Replace(wxT(":") , wxT("\\:"));
+ line.password.Replace(wxT("\\"), wxT("\\\\"));
+ line.password.Replace(wxT(":") , wxT("\\:"));
+
+ wxString strLine = line.hostname + wxT(":") + line.port + wxT(":") +
+ line.database + wxT(":") + line.username + wxT(":") + line.password + wxT("\n");
+
+ str.Append(strLine);
+ }
if (DoWriteFile(str, NULL))
{
diff --git a/pgadmin/schema/pgServer.cpp b/pgadmin/schema/pgServer.cpp
index 906d7ec..5d999e3 100644
--- a/pgadmin/schema/pgServer.cpp
+++ b/pgadmin/schema/pgServer.cpp
@@ -585,6 +585,13 @@ void pgServer::StorePassword()
+ username + wxT(":") ;
}
+ // Escape ":" and "\" from the password field
+ if (!passwd.IsEmpty())
+ {
+ passwd.Replace(wxT("\\"), wxT("\\\\"));
+ passwd.Replace(wxT(":") , wxT("\\:"));
+ }
+
file.Read(before);
wxStringTokenizer lines(before, wxT("\n\r"));
diff --git a/pgadmin/utils/pgconfig.cpp b/pgadmin/utils/pgconfig.cpp
index a7d9a31..b59531f 100644
--- a/pgadmin/utils/pgconfig.cpp
+++ b/pgadmin/utils/pgconfig.cpp
@@ -570,17 +570,47 @@ void pgPassConfigLine::Init(const wxString &line)
isComment = line.StartsWith(wxT("#"));
- wxStringTokenizer tok(isComment ? line.Mid(1) : line, wxT(":"));
- if (tok.HasMoreTokens())
- hostname = tok.GetNextToken();
- if (tok.HasMoreTokens())
- port = tok.GetNextToken();
- if (tok.HasMoreTokens())
- database = tok.GetNextToken();
- if (tok.HasMoreTokens())
- username = tok.GetNextToken();
- if (tok.HasMoreTokens())
- password = tok.GetNextToken();
+ wxString tmpLine = line;
+ // De-escape backslash "\"
+ tmpLine.Replace(wxT("\\\\"), wxT("\\"));
+
+ int iVarCount = 0;
+ wxStringTokenizer tok(isComment ? tmpLine.Mid(1) : tmpLine, wxT(":"));
+ while(tok.HasMoreTokens())
+ {
+ wxString val = tok.GetNextToken();
+ if (!val.IsEmpty())
+ {
+ /* if last charecter of the token is backslash "\" then it means
+ that it is used to escape ":" so we need to add the next token.
+ */
+ while(val.Last() == wxT('\\'))
+ {
+ val.RemoveLast();
+ val = val + wxT(":") + tok.GetNextToken();
+ }
+
+ iVarCount++;
+ switch(iVarCount)
+ {
+ case 1: // hostname
+ hostname = val;
+ break;
+ case 2: // port
+ port = val;
+ break;
+ case 3: // database
+ database = val;
+ break;
+ case 4: //username
+ username = val;
+ break;
+ case 5: // password
+ password = val;
+ break;
+ }
+ }
+ }
}
wxString pgPassConfigLine::GetText()
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Re: [BUGS] BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
@ 2014-05-20 12:28 Dhiraj Chawla <dhiraj.chawla@enterprisedb.com>
parent: Dave Page <dpage@pgadmin.org>
0 siblings, 1 reply; 11+ messages in thread
From: Dhiraj Chawla @ 2014-05-20 12:28 UTC (permalink / raw)
To: Dave Page <dpage@pgadmin.org>; +Cc: Akshay Joshi <akshay.joshi@enterprisedb.com>; Stephen Frost <sfrost@snowman.net>; Heikki Linnakangas <hlinnakangas@vmware.com>; dlo@isam.kiwi; pgadmin-hackers <pgadmin-hackers@postgresql.org>
Sure Dave. I will review the patch and update accordingly.
regards,
*Dhiraj Chawla*
Senior Software Engineer
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
Phone: +91-20-30589522
On Fri, May 16, 2014 at 1:53 PM, Dave Page <dpage@pgadmin.org> wrote:
> Thanks Akshay. Dhiraj, can you review please? I'm a little busy right now.
>
> Thanks.
>
>
> On Thu, May 15, 2014 at 7:39 AM, Akshay Joshi <
> akshay.joshi@enterprisedb.com> wrote:
>
>> Hi Dave
>>
>> I have fixed the escaping issue and tested it. It works fine for me.
>> Attached is the patch file, can you please review it.
>> If code looks good to you, can you please commit the code.
>>
>>
>> On Thu, May 8, 2014 at 2:34 PM, Akshay Joshi <
>> akshay.joshi@enterprisedb.com> wrote:
>>
>>> Sure.
>>>
>>>
>>> On Thu, May 8, 2014 at 1:37 PM, Dave Page <dpage@pgadmin.org> wrote:
>>>
>>>> Akshay, can you look into the quoting problem please.
>>>>
>>>> On Thu, May 8, 2014 at 1:07 AM, Stephen Frost <sfrost@snowman.net>
>>>> wrote:
>>>> > * Heikki Linnakangas (hlinnakangas@vmware.com) wrote:
>>>> >> (forwarding to pgadmin-hackers)
>>>> >
>>>> > Ah.
>>>> >
>>>> >> On 05/07/2014 06:44 PM, Stephen Frost wrote:
>>>> >> >* dlo@isam.kiwi (dlo@isam.kiwi) wrote:
>>>> >> >>but when the credential contains the delimiter (colon) it fails to
>>>> be
>>>> >> >>read back out and app responds with "invalid credentials".
>>>> >> >>
>>>> >> >>x.x.x.x:5432:*:username:password:with:colons
>>>> >> >
>>>> >> >Per the fine documentation, you need to escape any such usage with a
>>>> >> >backslash. Please review:
>>>> >>
>>>> >> Stephen, you missed the context. pgadmin3 saves .pgpass, when you
>>>> >> check the "store password" checkbox in the connection dialog. And
>>>> >> apparantly pgadmin3 doesn't do that escaping properly.
>>>> >
>>>> > Wow, that's pretty rough. Hopefully they'll be able to fix it soon.
>>>> :)
>>>> >
>>>> > Thanks,
>>>> >
>>>> > Stephen
>>>>
>>>>
>>>>
>>>> --
>>>> Dave Page
>>>> Blog: http://pgsnake.blogspot.com
>>>> Twitter: @pgsnake
>>>>
>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>
>>>
>>>
>>> --
>>> *Akshay Joshi*
>>> *Principal Software Engineer *
>>>
>>>
>>>
>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91 976-788-8246
>>> <%2B91%20976-788-8246>*
>>>
>>
>>
>>
>> --
>> *Akshay Joshi*
>> *Principal Software Engineer *
>>
>>
>>
>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91 976-788-8246
>> <%2B91%20976-788-8246>*
>>
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Re: [BUGS] BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
@ 2014-05-22 10:17 Dhiraj Chawla <dhiraj.chawla@enterprisedb.com>
parent: Dhiraj Chawla <dhiraj.chawla@enterprisedb.com>
0 siblings, 1 reply; 11+ messages in thread
From: Dhiraj Chawla @ 2014-05-22 10:17 UTC (permalink / raw)
To: Dave Page <dpage@pgadmin.org>; +Cc: Akshay Joshi <akshay.joshi@enterprisedb.com>; Stephen Frost <sfrost@snowman.net>; Heikki Linnakangas <hlinnakangas@vmware.com>; dlo@isam.kiwi; pgadmin-hackers <pgadmin-hackers@postgresql.org>
Hi Akshay,
I have reviewed the patch and tested it as well on the Linux platform. The
patch looks good to me. It is working as expected.
regards,
*Dhiraj Chawla*
Senior Software Engineer
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
Phone: +91-20-30589522
On Tue, May 20, 2014 at 5:58 PM, Dhiraj Chawla <
dhiraj.chawla@enterprisedb.com> wrote:
> Sure Dave. I will review the patch and update accordingly.
>
> regards,
>
> *Dhiraj Chawla*
> Senior Software Engineer
> EnterpriseDB Corporation
> The Enterprise PostgreSQL Company
>
> Phone: +91-20-30589522
>
>
> On Fri, May 16, 2014 at 1:53 PM, Dave Page <dpage@pgadmin.org> wrote:
>
>> Thanks Akshay. Dhiraj, can you review please? I'm a little busy right now.
>>
>> Thanks.
>>
>>
>> On Thu, May 15, 2014 at 7:39 AM, Akshay Joshi <
>> akshay.joshi@enterprisedb.com> wrote:
>>
>>> Hi Dave
>>>
>>> I have fixed the escaping issue and tested it. It works fine for me.
>>> Attached is the patch file, can you please review it.
>>> If code looks good to you, can you please commit the code.
>>>
>>>
>>> On Thu, May 8, 2014 at 2:34 PM, Akshay Joshi <
>>> akshay.joshi@enterprisedb.com> wrote:
>>>
>>>> Sure.
>>>>
>>>>
>>>> On Thu, May 8, 2014 at 1:37 PM, Dave Page <dpage@pgadmin.org> wrote:
>>>>
>>>>> Akshay, can you look into the quoting problem please.
>>>>>
>>>>> On Thu, May 8, 2014 at 1:07 AM, Stephen Frost <sfrost@snowman.net>
>>>>> wrote:
>>>>> > * Heikki Linnakangas (hlinnakangas@vmware.com) wrote:
>>>>> >> (forwarding to pgadmin-hackers)
>>>>> >
>>>>> > Ah.
>>>>> >
>>>>> >> On 05/07/2014 06:44 PM, Stephen Frost wrote:
>>>>> >> >* dlo@isam.kiwi (dlo@isam.kiwi) wrote:
>>>>> >> >>but when the credential contains the delimiter (colon) it fails
>>>>> to be
>>>>> >> >>read back out and app responds with "invalid credentials".
>>>>> >> >>
>>>>> >> >>x.x.x.x:5432:*:username:password:with:colons
>>>>> >> >
>>>>> >> >Per the fine documentation, you need to escape any such usage with
>>>>> a
>>>>> >> >backslash. Please review:
>>>>> >>
>>>>> >> Stephen, you missed the context. pgadmin3 saves .pgpass, when you
>>>>> >> check the "store password" checkbox in the connection dialog. And
>>>>> >> apparantly pgadmin3 doesn't do that escaping properly.
>>>>> >
>>>>> > Wow, that's pretty rough. Hopefully they'll be able to fix it soon.
>>>>> :)
>>>>> >
>>>>> > Thanks,
>>>>> >
>>>>> > Stephen
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Dave Page
>>>>> Blog: http://pgsnake.blogspot.com
>>>>> Twitter: @pgsnake
>>>>>
>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>> The Enterprise PostgreSQL Company
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Akshay Joshi*
>>>> *Principal Software Engineer *
>>>>
>>>>
>>>>
>>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91
>>>> 976-788-8246 <%2B91%20976-788-8246>*
>>>>
>>>
>>>
>>>
>>> --
>>> *Akshay Joshi*
>>> *Principal Software Engineer *
>>>
>>>
>>>
>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91 976-788-8246
>>> <%2B91%20976-788-8246>*
>>>
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Re: [BUGS] BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password
@ 2014-05-28 11:47 Dave Page <dpage@pgadmin.org>
parent: Dhiraj Chawla <dhiraj.chawla@enterprisedb.com>
0 siblings, 0 replies; 11+ messages in thread
From: Dave Page @ 2014-05-28 11:47 UTC (permalink / raw)
To: Dhiraj Chawla <dhiraj.chawla@enterprisedb.com>; +Cc: Akshay Joshi <akshay.joshi@enterprisedb.com>; Stephen Frost <sfrost@snowman.net>; Heikki Linnakangas <hlinnakangas@vmware.com>; dlo@isam.kiwi; pgadmin-hackers <pgadmin-hackers@postgresql.org>
Thanks - patch applied.
On Thu, May 22, 2014 at 6:17 AM, Dhiraj Chawla <
dhiraj.chawla@enterprisedb.com> wrote:
> Hi Akshay,
>
> I have reviewed the patch and tested it as well on the Linux platform. The
> patch looks good to me. It is working as expected.
>
> regards,
>
> *Dhiraj Chawla*
> Senior Software Engineer
> EnterpriseDB Corporation
> The Enterprise PostgreSQL Company
>
> Phone: +91-20-30589522
>
>
> On Tue, May 20, 2014 at 5:58 PM, Dhiraj Chawla <
> dhiraj.chawla@enterprisedb.com> wrote:
>
>> Sure Dave. I will review the patch and update accordingly.
>>
>> regards,
>>
>> *Dhiraj Chawla*
>> Senior Software Engineer
>> EnterpriseDB Corporation
>> The Enterprise PostgreSQL Company
>>
>> Phone: +91-20-30589522
>>
>>
>> On Fri, May 16, 2014 at 1:53 PM, Dave Page <dpage@pgadmin.org> wrote:
>>
>>> Thanks Akshay. Dhiraj, can you review please? I'm a little busy right
>>> now.
>>>
>>> Thanks.
>>>
>>>
>>> On Thu, May 15, 2014 at 7:39 AM, Akshay Joshi <
>>> akshay.joshi@enterprisedb.com> wrote:
>>>
>>>> Hi Dave
>>>>
>>>> I have fixed the escaping issue and tested it. It works fine for me.
>>>> Attached is the patch file, can you please review it.
>>>> If code looks good to you, can you please commit the code.
>>>>
>>>>
>>>> On Thu, May 8, 2014 at 2:34 PM, Akshay Joshi <
>>>> akshay.joshi@enterprisedb.com> wrote:
>>>>
>>>>> Sure.
>>>>>
>>>>>
>>>>> On Thu, May 8, 2014 at 1:37 PM, Dave Page <dpage@pgadmin.org> wrote:
>>>>>
>>>>>> Akshay, can you look into the quoting problem please.
>>>>>>
>>>>>> On Thu, May 8, 2014 at 1:07 AM, Stephen Frost <sfrost@snowman.net>
>>>>>> wrote:
>>>>>> > * Heikki Linnakangas (hlinnakangas@vmware.com) wrote:
>>>>>> >> (forwarding to pgadmin-hackers)
>>>>>> >
>>>>>> > Ah.
>>>>>> >
>>>>>> >> On 05/07/2014 06:44 PM, Stephen Frost wrote:
>>>>>> >> >* dlo@isam.kiwi (dlo@isam.kiwi) wrote:
>>>>>> >> >>but when the credential contains the delimiter (colon) it fails
>>>>>> to be
>>>>>> >> >>read back out and app responds with "invalid credentials".
>>>>>> >> >>
>>>>>> >> >>x.x.x.x:5432:*:username:password:with:colons
>>>>>> >> >
>>>>>> >> >Per the fine documentation, you need to escape any such usage
>>>>>> with a
>>>>>> >> >backslash. Please review:
>>>>>> >>
>>>>>> >> Stephen, you missed the context. pgadmin3 saves .pgpass, when you
>>>>>> >> check the "store password" checkbox in the connection dialog. And
>>>>>> >> apparantly pgadmin3 doesn't do that escaping properly.
>>>>>> >
>>>>>> > Wow, that's pretty rough. Hopefully they'll be able to fix it
>>>>>> soon. :)
>>>>>> >
>>>>>> > Thanks,
>>>>>> >
>>>>>> > Stephen
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Dave Page
>>>>>> Blog: http://pgsnake.blogspot.com
>>>>>> Twitter: @pgsnake
>>>>>>
>>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>>> The Enterprise PostgreSQL Company
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Akshay Joshi*
>>>>> *Principal Software Engineer *
>>>>>
>>>>>
>>>>>
>>>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91
>>>>> 976-788-8246 <%2B91%20976-788-8246>*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Akshay Joshi*
>>>> *Principal Software Engineer *
>>>>
>>>>
>>>>
>>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91
>>>> 976-788-8246 <%2B91%20976-788-8246>*
>>>>
>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2014-05-28 11:47 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-05-07 04:32 BUG #10250: pgAdmin III 1.16.1 stores unescaped plaintext password dlo@isam.kiwi
2014-05-07 15:44 ` Stephen Frost <sfrost@snowman.net>
2014-05-07 20:51 ` Heikki Linnakangas <hlinnakangas@vmware.com>
2014-05-08 00:07 ` Stephen Frost <sfrost@snowman.net>
2014-05-08 08:07 ` Dave Page <dpage@pgadmin.org>
2014-05-08 09:04 ` Akshay Joshi <akshay.joshi@enterprisedb.com>
2014-05-15 06:39 ` Akshay Joshi <akshay.joshi@enterprisedb.com>
2014-05-16 08:23 ` Dave Page <dpage@pgadmin.org>
2014-05-20 12:28 ` Dhiraj Chawla <dhiraj.chawla@enterprisedb.com>
2014-05-22 10:17 ` Dhiraj Chawla <dhiraj.chawla@enterprisedb.com>
2014-05-28 11:47 ` Dave Page <dpage@pgadmin.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox