Thread: PgAdmin forgets stored password on connection problem

PgAdmin forgets stored password on connection problem

From
Eugene Lisitsky
Date:
Hi!

Thank you for the great program and constant improvement!

I meet only several troubles usign it, one of them is:
If you have stored password in connections and a connection attempt was failed (due to some network problems for example) then PgAdmin asks you to prompt the password again on next connection attempt. What for? 
However if you close the program and open it again, PgAdmin can use the stored password.
Is it possible to make it not to ask the pass?

Thank you.

PgAdmin: 1.10.0 (aug 17 2009, rev: 7945:7946) installed from repository.
Ubuntu 9.10 Karmic Koala.
Linux: 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux

--
Yours,
Eugene Lisitsky

Re: PgAdmin forgets stored password on connection problem

From
Dave Page
Date:
On Wed, Nov 11, 2009 at 2:17 PM, Eugene Lisitsky <lisitsky@gmail.com> wrote:
> Hi!
> Thank you for the great program and constant improvement!
> I meet only several troubles usign it, one of them is:
> If you have stored password in connections and a connection attempt was
> failed (due to some network problems for example) then PgAdmin asks you to
> prompt the password again on next connection attempt. What for?

Because the connection messages are often intentionally vague, so we
don't always know if it was a password problem, and therefore always
prompt to be on the safe side.

There's definitely room for improvement here though - patches are
welcome if anyone wants to spend some time on it.

-- 
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com


Re: PgAdmin forgets stored password on connection problem

From
Eugene Lisitsky
Date:
Thank you, Dave!

2009/11/11 Dave Page <dpage@pgadmin.org>
On Wed, Nov 11, 2009 at 2:17 PM, Eugene Lisitsky <lisitsky@gmail.com> wrote:
> Hi!
> Thank you for the great program and constant improvement!
> I meet only several troubles usign it, one of them is:
> If you have stored password in connections and a connection attempt was
> failed (due to some network problems for example) then PgAdmin asks you to
> prompt the password again on next connection attempt. What for?

Because the connection messages are often intentionally vague, so we
don't always know if it was a password problem, and therefore always
prompt to be on the safe side.
Is it possible to check error and fail reason: network, connection refused, password incorrect, no access to such DB?
Or at least as a workaround fill the form with old password? 


There's definitely room for improvement here though - patches are
welcome if anyone wants to spend some time on it.
Unfortunately I'm not a C developer.  But I can try :)


--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com



--
Yours,
Eugene Lisitsky

Re: PgAdmin forgets stored password on connection problem

From
Dave Page
Date:
On Wed, Nov 11, 2009 at 3:33 PM, Eugene Lisitsky <lisitsky@gmail.com> wrote:

> Is it possible to check error and fail reason: network, connection refused,
> password incorrect, no access to such DB?

Not reliably, because we only get CONNECTION_GOOD, CONNECTION_BAD as
connection status flags from libpq, and in the event of a connection
error, get a possibly-localised error message. There are no
standardised codes for connection errors (unlike query results, for
which you can get SQL status codes etc).

> Or at least as a workaround fill the form with old password?

We don't know it, unless you just typed it in. Libpq reads it from
.pgpass and pgAdmin never touches it.

>> There's definitely room for improvement here though - patches are
>> welcome if anyone wants to spend some time on it.
>
> Unfortunately I'm not a C developer.  But I can try :)

:-)

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com


Re: PgAdmin forgets stored password on connection problem

From
Eugene Lisitsky
Date:


2009/11/11 Dave Page <dpage@pgadmin.org>
On Wed, Nov 11, 2009 at 3:33 PM, Eugene Lisitsky <lisitsky@gmail.com> wrote:

> Is it possible to check error and fail reason: network, connection refused,
> password incorrect, no access to such DB?

Not reliably, because we only get CONNECTION_GOOD, CONNECTION_BAD as
connection status flags from libpq, and in the event of a connection
error, get a possibly-localised error message. There are no
standardised codes for connection errors (unlike query results, for
which you can get SQL status codes etc).

I thought lib provides you with a detailed info.
 

> Or at least as a workaround fill the form with old password?

We don't know it, unless you just typed it in. Libpq reads it from
.pgpass and pgAdmin never touches it.
What do you think of adding one more button to the dialog "Use stored pass" which just does nothing only sends the connection request?

I tried to work with sources, but svn version didn't compile at my computer. Can you help me a little?

Compile errors like these:
g++ -DHAVE_CONFIG_H -I. -I..   -I/usr/include/postgresql -DSSL -I/usr/lib/wx/include/base-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DwxUSE_GUI=0 -O2 -DEMBED_XRC -I/usr/include/libxml2 -I/usr/include/libxml2 -DDATA_DIR=\"/usr/local/pgadmin3/share/pgadmin3/\" -Wall -Wno-non-virtual-dtor -fno-strict-aliasing -I../pgadmin/include   -MT pgAdmin3.o -MD -MP -MF .deps/pgAdmin3.Tpo -c -o pgAdmin3.o `test -f './pgAdmin3.cpp' || echo './'`./pgAdmin3.cpp
In file included from ../pgadmin/include/pgAdmin3.h:21,
                 from ./pgAdmin3.cpp:13:
../pgadmin/include/utils/misc.h:120: error: ‘wxPoint’ has not been declared
../pgadmin/include/utils/misc.h:120: error: ‘wxSize’ has not been declared
In file included from ../pgadmin/include/pgAdmin3.h:22,
                 from ./pgAdmin3.cpp:13:
../pgadmin/include/ctl/ctlTree.h:26: error: expected class-name before ‘{’ token
../pgadmin/include/ctl/ctlTree.h:28: error: ISO C++ forbids declaration of ‘wxPoint’ with no type
../pgadmin/include/ctl/ctlTree.h:28: error: expected ‘,’ or ‘...’ before ‘&’ token
In file included from ../pgadmin/include/pgAdmin3.h:22,
                 from ./pgAdmin3.cpp:13:
......


and at the end:

./pgAdmin3.cpp: At global scope:
./pgAdmin3.cpp:171: error: variable or field ‘OnSelect’ declared void
./pgAdmin3.cpp:171: error: ‘wxCommandEvent’ was not declared in this scope
./pgAdmin3.cpp:171: error: ‘ev’ was not declared in this scope
make[2]: *** [pgAdmin3.o] Error 1
make[2]: Выход из каталога `/home/e/eclipse-workspace/pgAdmin/src/pgadmin3/pgadmin'
make[1]: *** [all-recursive] Error 1
make[1]: Выход из каталога `/home/e/eclipse-workspace/pgAdmin/src/pgadmin3'
make: *** [all] Error 2


Thank you!
 

>> There's definitely room for improvement here though - patches are
>> welcome if anyone wants to spend some time on it.
>
> Unfortunately I'm not a C developer.  But I can try :)

:-)

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com



--
Yours,
Eugene Lisitsky

Re: PgAdmin forgets stored password on connection problem

From
Dave Page
Date:
2009/11/11 Eugene Lisitsky <lisitsky@gmail.com>:
>
> What do you think of adding one more button to the dialog "Use stored pass"
> which just does nothing only sends the connection request?

I can't get excited at the thought of cluttering the UI to resolve a
minor issue. I'd rather we tried to read the pgpass file so we could
default the password. Not sure how much effort that would take, but we
can probably lift much of the code from libpq.

> I tried to work with sources, but svn version didn't compile at my computer.
> Can you help me a little?
> Compile errors like these:
> g++ -DHAVE_CONFIG_H -I. -I..   -I/usr/include/postgresql -DSSL
> -I/usr/lib/wx/include/base-unicode-release-2.8 -I/usr/include/wx-2.8
> -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DwxUSE_GUI=0

wxUSE_GUI=0 is never going to work. How did you install wxWidgets?



--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com


Re: PgAdmin forgets stored password on connection problem

From
Eugene Lisitsky
Date:
I can't get excited at the thought of cluttering the UI to resolve a
minor issue. I'd rather we tried to read the pgpass file so we could
default the password. Not sure how much effort that would take, but we
can probably lift much of the code from libpq.
Excellent idea!
How do you write .pgpass now? Using some functions from libpq or with your own tools only?
 

> I tried to work with sources, but svn version didn't compile at my computer.
> Can you help me a little?
> Compile errors like these:
> g++ -DHAVE_CONFIG_H -I. -I..   -I/usr/include/postgresql -DSSL
> -I/usr/lib/wx/include/base-unicode-release-2.8 -I/usr/include/wx-2.8
> -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DwxUSE_GUI=0

wxUSE_GUI=0 is never going to work. How did you install wxWidgets?
 
I'm working with Ubuntu 9.10 Karmic Koala.
All software was installed from repository:
wx2.8-doc
wx2.8-examples
wx2.8-headers
wx-common
libwxgtk2.8-0
libwxbase2.8-0
 
Than ./configure in the source folder:
....
PostgreSQL directory: /usr
PostgreSQL pg_config binary: /usr/bin/pg_config
PostgreSQL version: PostgreSQL 8.4.1
PostgreSQL SSL support: Present

wxWidgets directory: /usr
wxWidgets wx-config binary: /usr/bin/wx-config
wxWidgets version: wxWidgets 2.8.10

libxml2 directory: /usr
libxml2 xml2-config binary: /usr/bin/xml2-config
libxml2 version: libxml2 2.7.5

libxslt directory: /usr
libxslt xslt-config binary: /usr/bin/xslt-config
libxslt version: libxslt 1.1.24

Building a debug version of pgAdmin: No
Statically linking pgAdmin: No
Building a Mac OS X appbundle: No

pgAdmin configuration is now complete. You can now compile and
install pgAdmin using 'make; make install'.

After that I try to do `make`.

Thank you.



--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com



--
Yours,
Eugene Lisitsky

Re: PgAdmin forgets stored password on connection problem

From
Dave Page
Date:
On Thu, Nov 12, 2009 at 10:32 AM, Eugene Lisitsky <lisitsky@gmail.com> wrote:
>> I can't get excited at the thought of cluttering the UI to resolve a
>> minor issue. I'd rather we tried to read the pgpass file so we could
>> default the password. Not sure how much effort that would take, but we
>> can probably lift much of the code from libpq.
>
> Excellent idea!
> How do you write .pgpass now? Using some functions from libpq or with your
> own tools only?

Our own code. libpq doesn't have any code to write to pgpass files.

>> > I tried to work with sources, but svn version didn't compile at my
>> > computer.
>> > Can you help me a little?
>> > Compile errors like these:
>> > g++ -DHAVE_CONFIG_H -I. -I..   -I/usr/include/postgresql -DSSL
>> > -I/usr/lib/wx/include/base-unicode-release-2.8 -I/usr/include/wx-2.8
>> > -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DwxUSE_GUI=0
>>
>> wxUSE_GUI=0 is never going to work. How did you install wxWidgets?
>
>
> I'm working with Ubuntu 9.10 Karmic Koala.

What does wx-config --cflags return ? The fact that you have
wxUSE_GUI=0 set will disable 90% of wxWidgets that pgAdmin needs - we
need to find out where that's coming from.



--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com


Re: PgAdmin forgets stored password on connection problem

From
Eugene Lisitsky
Date:


2009/11/12 Dave Page <dpage@pgadmin.org>
On Thu, Nov 12, 2009 at 10:32 AM, Eugene Lisitsky <lisitsky@gmail.com> wrote:
>> I can't get excited at the thought of cluttering the UI to resolve a
>> minor issue. I'd rather we tried to read the pgpass file so we could
>> default the password. Not sure how much effort that would take, but we
>> can probably lift much of the code from libpq.
>
> Excellent idea!
> How do you write .pgpass now? Using some functions from libpq or with your
> own tools only?

Our own code. libpq doesn't have any code to write to pgpass files.

>> > I tried to work with sources, but svn version didn't compile at my
>> > computer.
>> > Can you help me a little?
>> > Compile errors like these:
>> > g++ -DHAVE_CONFIG_H -I. -I..   -I/usr/include/postgresql -DSSL
>> > -I/usr/lib/wx/include/base-unicode-release-2.8 -I/usr/include/wx-2.8
>> > -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DwxUSE_GUI=0
>>
>> wxUSE_GUI=0 is never going to work. How did you install wxWidgets?
>
>
> I'm working with Ubuntu 9.10 Karmic Koala.

What does wx-config --cflags return ? The fact that you have
wxUSE_GUI=0 set will disable 90% of wxWidgets that pgAdmin needs - we
need to find out where that's coming from.


$ wx-config --cflags
-I/usr/lib/wx/include/base-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DwxUSE_GUI=0 -pthread
 


--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com



--
Yours,
Eugene Lisitsky

Re: PgAdmin forgets stored password on connection problem

From
Dave Page
Date:
On Thu, Nov 12, 2009 at 11:55 AM, Eugene Lisitsky <lisitsky@gmail.com> wrote:
>
> $ wx-config --cflags
> -I/usr/lib/wx/include/base-unicode-release-2.8 -I/usr/include/wx-2.8
> -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DwxUSE_GUI=0 -pthread

Not sure what to suggest then. I just installed on a Karmic box I'm
testing here, and I get:

dpage@fuji:~$ wx-config --cflags
-I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8
-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread


-- 
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com


Re: PgAdmin forgets stored password on connection problem

From
Eugene Lisitsky
Date:


2009/11/12 Dave Page <dpage@pgadmin.org>
On Thu, Nov 12, 2009 at 11:55 AM, Eugene Lisitsky <lisitsky@gmail.com> wrote:
>
> $ wx-config --cflags
> -I/usr/lib/wx/include/base-unicode-release-2.8 -I/usr/include/wx-2.8
> -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DwxUSE_GUI=0 -pthread

Not sure what to suggest then. I just installed on a Karmic box I'm
testing here, and I get:

dpage@fuji:~$ wx-config --cflags
-I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8
-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread

Thank you, Dave!

You message gave me an idea about lack of wx-gtk bridge.
So I've installed:
$ sudo aptitude install libwxgtk2.8-dev 
 
and now I have the same wx-config output:
$ wx-config --cflags
-I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread

I'll try to compile pgadmin again.



--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com



--
Yours,
Eugene Lisitsky