-#!/bin/perl
+#!/usr/bin/perl
#=============================================================
#
# BackupPC_archiveHost: Archive files for a single host
# Josh Marshall
#
# COPYRIGHT
-# Copyright (C) 2001-2007 Craig Barratt
+# Copyright (C) 2001-2009 Craig Barratt
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
#========================================================================
#
-# Version 3.1.0, released 25 Nov 2007.
+# Version 3.2.0, released 31 Jul 2010.
#
# See http://backuppc.sourceforge.net.
#
# Make sure the specified programs are executable
#
foreach my $prog ( ($tarCreate, $compPath, $splitPath, $parPath) ) {
+ if ( $prog =~ /[][;&()<>{}|^\n\r\t *\$\\'"`?]/ ) {
+ print("Error: executable path $prog contains suspicious characters\n");
+ exit(1);
+ }
next if ( $prog eq "" || -x $prog );
print("Error: $prog is not an executable program\n");
exit(1);
#
$share = $bpc->shellEscape($share);
$host = $bpc->shellEscape($host);
+$bkupNum = $bpc->shellEscape($bkupNum);
+$fileExt = $bpc->shellEscape($fileExt);
+$splitSize = $bpc->shellEscape($splitSize);
+$parfile = $bpc->shellEscape($parfile);
my $outLocE = $bpc->shellEscape($outLoc);
#
# Output file is a device or a regular file, so don't use split
#
$cmd .= ">> $outLocE";
- $mesg .= " to $outLocE";
+ $mesg .= " to $outLoc";
} else {
mkpath($outLoc) if ( !-d $outLoc );
if ( !-d $outLoc ) {
# ie: not a tape device).
#
if ( -d $outLoc && -x $parPath ) {
- if ( $parfile != 0 ) {
+ if ( length($parfile) ) {
print("Running $parPath to create parity files\n");
my $parCmd = "$parPath c -r$parfile $outLocE/$host.$bkupNum.tar$fileExt.par2 $outLocE/$host.$bkupNum.tar$fileExt*";
$ret = system($parCmd);