Le 25/10/2010 08:04, Guillaume Lelarge a écrit :
> Le 25/10/2010 00:43, Anssi Kääriäinen a écrit :
>> On 10/22/2010 02:06 AM, Guillaume Lelarge wrote:
>>> The only reason I could guess is that localhost is resolved differently,
>>> once in IPv4 and once in IPv6. And that either your pg_hba.conf accepts
>>> IPv4 and IPv6 connections but with a different authentication methode,
>>> or your .pgpass already has the password for IPv4, and not IPv6 (or
>>> vice-versa). Not sure I explained myself clearly :)
>>>
>>> I think you should check your .pgpass file and your pg_hba.conf file.
>>> And be careful about IPv4 and IPv6 resolution.
>>>    
>> Yes, this is it:
>> I had this leftover line in pg_hba.conf:
>> host    all         all         ::1/128               md5
>>
>> Removing the line gives me:
>> FATAL:  no pg_hba.conf entry for host "::1", user "akaariai", ...
>>
>> And changing md5 to trust fixes the issue.
>>
>> I wonder if it would be possible to supply -w to pg_dump to make pg_dump
>> fail automatically instead of asking for password and thus hanging the
>> whole pgadmin program. Unfortunately supported only from version 8.4...
>>
> 
> This is actually a great idea. I'll try to add this for next release.
> You're right that it's only supported from 8.4, but I still think this
> is something we should do.
> 

OK, I have a patch that implements this. I'll commit it in a few days if
there is no objection.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com
>From 599ca4fe82ad9e139b48aebe0efb51547f4b398f Mon Sep 17 00:00:00 2001
From: Guillaume Lelarge <guilla...@lelarge.info>
Date: Tue, 26 Oct 2010 07:47:55 -0700
Subject: [PATCH] Use -w switch when available for dump/restore

If a user tries to dump a database within pgAdmin, and if there is no .pgpass
file, pgAdmin is frozen waiting for a password noone can enter. The -w switch
allows the use of .pgpass file but, if this file is missing and the
authentication method asks for a password, pg_dump/pg_restore will fail rather
than block pgAdmin.

Report from Anssi Kaariainen.

Implements #270.
---
 pgadmin/frm/frmBackup.cpp        |    3 +++
 pgadmin/frm/frmBackupGlobals.cpp |    3 +++
 pgadmin/frm/frmBackupServer.cpp  |    3 +++
 pgadmin/frm/frmRestore.cpp       |    3 +++
 4 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/pgadmin/frm/frmBackup.cpp b/pgadmin/frm/frmBackup.cpp
index 99f012f..1e9ecdc 100644
--- a/pgadmin/frm/frmBackup.cpp
+++ b/pgadmin/frm/frmBackup.cpp
@@ -331,6 +331,9 @@ wxString frmBackup::getCmdPart1()
     if (!cbRolename->GetValue().IsEmpty())
         cmd += wxT(" --role ") + commandLineCleanOption(qtIdent(cbRolename->GetValue()));
 
+    if (pgAppMinimumVersion(backupExecutable, 8, 4))
+        cmd += wxT(" --no-password ");
+
     if (object->GetConnection()->GetIsGreenplum())
         cmd += wxT(" --gp-syntax ");
     return cmd;
diff --git a/pgadmin/frm/frmBackupGlobals.cpp b/pgadmin/frm/frmBackupGlobals.cpp
index c40fc88..eff25c2 100644
--- a/pgadmin/frm/frmBackupGlobals.cpp
+++ b/pgadmin/frm/frmBackupGlobals.cpp
@@ -189,6 +189,9 @@ wxString frmBackupGlobals::getCmdPart1()
     if (!cbRolename->GetValue().IsEmpty())
         cmd += wxT(" --role ") + commandLineCleanOption(qtIdent(cbRolename->GetValue()));
 
+    if (pgAppMinimumVersion(backupExecutable, 8, 4))
+        cmd += wxT(" --no-password ");
+
     return cmd;
 }
 
diff --git a/pgadmin/frm/frmBackupServer.cpp b/pgadmin/frm/frmBackupServer.cpp
index b9f640a..c750076 100644
--- a/pgadmin/frm/frmBackupServer.cpp
+++ b/pgadmin/frm/frmBackupServer.cpp
@@ -180,6 +180,9 @@ wxString frmBackupServer::getCmdPart1()
     if (!cbRolename->GetValue().IsEmpty())
         cmd += wxT(" --role ") + commandLineCleanOption(qtIdent(cbRolename->GetValue()));
 
+    if (pgAppMinimumVersion(backupExecutable, 8, 4))
+        cmd += wxT(" --no-password ");
+
     return cmd;
 }
 
diff --git a/pgadmin/frm/frmRestore.cpp b/pgadmin/frm/frmRestore.cpp
index 3d1d2b5..6cda15a 100644
--- a/pgadmin/frm/frmRestore.cpp
+++ b/pgadmin/frm/frmRestore.cpp
@@ -310,6 +310,9 @@ wxString frmRestore::getCmdPart1()
     if (!cbRolename->GetValue().IsEmpty())
          cmd += wxT(" --role ") + commandLineCleanOption(qtIdent(cbRolename->GetValue()));
 
+    if (pgAppMinimumVersion(restoreExecutable, 8, 4))
+        cmd += wxT(" --no-password ");
+
     return cmd;
 }
 
-- 
1.7.1

-- 
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Reply via email to