~ubuntu-branches/ubuntu/hardy/backuppc/hardy-security

« back to all changes in this revision

Viewing changes to lib/BackupPC/CGI/RestoreFile.pm

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-05-10 15:14:19 UTC
  • mfrom: (0.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070510151419-q6sqqtljkt428vph
Tags: 3.0.0-2ubuntu1
* Merge from Debian unstable.
* Remaining Ubuntu changes:
  - Use LSB functions in the init script, and make /var/run/backuppc if
    needed.
  - Remove dependancy on wwwconfig-common.
  - We like apache 2 more, so move it first to the alternatives list.
  - Bump libfile-rsyncp-perl and rsync from Suggests to Depends.
  - Remove stop script symlinks from rc0 and rc6.
* Ubuntu changes dropped:
  - Don't use wwwconfig-common in post{inst,rm}.
* Don't chown /var/run/backuppc in the postinst.
* Don't move /var/lib/backuppc/conf/* (and then delete) to /etc/backuppc
  in rules, upstream is shipping the config files in /etc/backuppc
  themselves.
* Unfuzzify debian/config.pl.diff.
* Munge Maintainer field as per spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#
29
29
#========================================================================
30
30
#
31
 
# Version 2.1.2, released 5 Sep 2005.
 
31
# Version 3.0.0, released 28 Jan 2007.
32
32
#
33
33
# See http://backuppc.sourceforge.net.
34
34
#
37
37
package BackupPC::CGI::RestoreFile;
38
38
 
39
39
use strict;
 
40
use Encode;
40
41
use BackupPC::CGI::Lib qw(:all);
41
42
use BackupPC::FileZIO;
42
43
use BackupPC::Attrib qw(:all);
43
44
use BackupPC::View;
44
45
 
 
46
 
45
47
sub action
46
48
{
47
49
    restoreFile($In{host}, $In{num}, $In{share}, $In{dir});
150
152
    my $view = BackupPC::View->new($bpc, $host, \@Backups);
151
153
    my $a = $view->fileAttrib($num, $share, $dir);
152
154
    if ( $dir =~ m{(^|/)\.\.(/|$)} || !defined($a) ) {
153
 
        ErrorExit("Can't restore bad file ${EscHTML($dir)} ($num, $share, $dir)");
 
155
        $dir = decode_utf8($dir);
 
156
        ErrorExit("Can't restore bad file ${EscHTML($dir)} ($num, $share)");
154
157
    }
155
158
    my $f = BackupPC::FileZIO->open($a->{fullPath}, 0, $a->{compress});
156
159
    my $data;