Control: tags -1 upstream Control: forwarded -1 https://bugs.bacula.org/view.php?id=2458
Hi Sergio, > /etc/bacula/scripts/make_catalog_backup.pl uses a temporary file with a name > based on $args{db_name}. This fails if the database name contains / > characters, > as it well might if it is a URI like > postgresql://host/db?sslmode=verify-full&sslrootcert=/etc/ssl/certs/host-ca.crt I've written a patch to base the filename on the catalog name as you suggested (although I'm not good at perl), but the script "delete_catalog_backup" needs to be changed too. I've submitted your bug report upstream. Regards, Carsten
--- make_catalog_backup-orig.pl 2018-09-22 20:24:38.000000000 +0200 +++ make_catalog_backup.pl 2019-03-03 12:48:04.217637851 +0100 @@ -30,11 +30,15 @@ my $dir_conf='/usr/sbin/dbcheck -B -c /etc/bacula/bacula-dir.conf'; my $wd = "/var/lib/bacula"; +# sanitize catalog name for use as filename +my $dump_filename = $cat; +$dump_filename =~ s/[^A-Za-z0-9_\-]//g; + sub dump_sqlite3 { my %args = @_; - exec("echo .dump | sqlite3 '$wd/$args{db_name}.db' > '$wd/$args{db_name}.sql'"); + exec("echo .dump | sqlite3 '$wd/$args{db_name}.db' > '$wd/$dump_filename.sql'"); print "Error while executing sqlite dump $!\n"; return 1; } @@ -69,7 +73,7 @@ { my %args = @_; setup_env_pgsql(%args); - exec("HOME='$wd' pg_dump -c > '$wd/$args{db_name}.sql'"); + exec("HOME='$wd' pg_dump -c > '$wd/$dump_filename.sql'"); print "Error while executing postgres dump $!\n"; return 1; # in case of error } @@ -117,7 +121,7 @@ my %args = @_; setup_env_mysql(%args); - exec("HOME='$wd' mysqldump -f --opt $args{db_name} > '$wd/$args{db_name}.sql'"); + exec("HOME='$wd' mysqldump -f --opt $args{db_name} > '$wd/$dump_filename.sql'"); print "Error while executing mysql dump $!\n"; return 1; }