summaryrefslogtreecommitdiff
path: root/LedgerSMB/AM.pm
diff options
context:
space:
mode:
authorlinuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-06 22:45:59 +0000
committerlinuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-06 22:45:59 +0000
commitc99d26f519720cef827dc4eda6932c2f6cca7a5a (patch)
tree521528f403b5deeebb08da8ec65d13901dfc13e3 /LedgerSMB/AM.pm
parent7afe2ed70e210a9e7c13dae2b3d417a7e6a45655 (diff)
initial setup of backuppath with default to . Also adjusted to use correct db connect globals
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1035 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/AM.pm')
-rwxr-xr-xLedgerSMB/AM.pm13
1 files changed, 6 insertions, 7 deletions
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm
index aea71518..e914b70d 100755
--- a/LedgerSMB/AM.pm
+++ b/LedgerSMB/AM.pm
@@ -1254,8 +1254,8 @@ sub check_template_name {
if ($form->{file} =~ /^(.:)*?\/|:|\.\.\/|^\//){
$form->error("Directory transversal not allowed.");
}
- if ($form->{file} =~ /^${LedgerSMB::Sysconfig::userspath}\//){
- $form->error("Not allowed to access ${LedgerSMB::Sysconfig::userspath}/ with this method");
+ if ($form->{file} =~ /^${LedgerSMB::Sysconfig::backuppath}\//){
+ $form->error("Not allowed to access ${LedgerSMB::Sysconfig::backuppath}/ with this method");
}
my $whitelisted = 0;
for (@allowedsuff){
@@ -1604,7 +1604,7 @@ sub backup {
$t[4] = substr("0$t[4]", -2);
my $boundary = time;
- my $tmpfile = "${LedgerSMB::Sysconfig::userspath}/$boundary.$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql";
+ my $tmpfile = "${LedgerSMB::Sysconfig::backuppath}/$boundary.$globalDBname-$form->{dbversion}-$t[5]$t[4]$t[3].sql";
$tmpfile .= ".gz" if ${LedgerSMB::Sysconfig::gzip};
$form->{OUT} = "$tmpfile";
@@ -1623,14 +1623,14 @@ sub backup {
my $suffix = "";
if ($form->{media} eq 'email') {
- print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} -Fc $myconfig->{dbname}`;
+ print OUT `pg_dump -U $globalDBUserName -h $globalDBhost -Fc -p $globalDBport $globalDBname`;
close OUT;
use LedgerSMB::Mailer;
$mail = new Mailer;
$mail->{to} = qq|"$myconfig->{name}" <$myconfig->{email}>|;
$mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|;
- $mail->{subject} = "LedgerSMB Backup / $myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql$suffix";
+ $mail->{subject} = "LedgerSMB Backup / $globalDBname-$form->{dbversion}-$t[5]$t[4]$t[3].sql$suffix";
@{ $mail->{attachments} } = ($tmpfile);
$mail->{version} = $form->{version};
$mail->{fileid} = "$boundary.";
@@ -1650,8 +1650,7 @@ sub backup {
print OUT qq|Content-Type: application/file;\n| .
qq|Content-Disposition: attachment; filename="$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql$suffix"\n\n|;
- print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} -Fc $myconfig->{dbname}`;
-
+ print OUT `pg_dump -U $globalDBUserName -h $globalDBhost -Fc -p $globalDBport $globalDBname`;
}
unlink "$tmpfile";