From: Eric Bollengier Date: Thu, 12 Apr 2012 12:01:14 +0000 (+0200) Subject: Fix #4062 on make_catalog_backup.pl script when user/password are empty X-Git-Tag: Release-7.0.0~268 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4c15171459a2a23d3a542ec63eff51f6b4246885;p=bacula%2Fbacula Fix #4062 on make_catalog_backup.pl script when user/password are empty The make_catalog_backup.pl sets PGUSER and PGPASSWORD env vars even if they are not set in the bacula config. This leads to an error if postgresql is used with IDENT authentification. The following error message is printed: --- pg_dump: [archiver (db)] connection to database "bacula" failed: FATAL: no PostgreSQL user name specified in startup packet --- diff --git a/bacula/src/cats/make_catalog_backup.pl.in b/bacula/src/cats/make_catalog_backup.pl.in index f955d93c2c..efb91fd261 100644 --- a/bacula/src/cats/make_catalog_backup.pl.in +++ b/bacula/src/cats/make_catalog_backup.pl.in @@ -69,10 +69,13 @@ sub dump_pgsql if ($args{db_port}) { $ENV{PGPORT}=$args{db_port}; } - + if ($args{db_user}) { + $ENV{PGUSER}=$args{db_user}; + } + if ($args{db_password}) { + $ENV{PGPASSWORD}=$args{db_password}; + } $ENV{PGDATABASE}=$args{db_name}; - $ENV{PGUSER}=$args{db_user}; - $ENV{PGPASSWORD}=$args{db_password}; exec("HOME='$wd' pg_dump -c > '$wd/$args{db_name}.sql'"); print "Error while executing postgres dump $!\n"; return 1; # in case of error