~ubuntu-branches/ubuntu/wily/backuppc/wily

« back to all changes in this revision

Viewing changes to lib/BackupPC/Xfer/Protocol.pm

  • Committer: Dave Walker (Daviey)
  • Author(s): Allison Randal
  • Date: 2011-09-19 12:04:17 UTC
  • mfrom: (33.1.1 bug-852484)
  • Revision ID: davewalker@ubuntu.com-20110919120417-2z1it0nm3rxgdowd
Tags: 3.2.1-1ubuntu1
* Merge from debian unstable. (LP: #852484) Remaining changes:
  - debian/backup.init, debian/rules, debian/postinst: Do not call init
    script on shutdown and reboot (TearDown) (Debian #488660)
  - debian/control: Add dependency for libsocket6-perl.
  - debian/control: Drop build dependency to 'par2', it's in universe.
  - configure.pl: Do not test for par2 being available at build time
  - debian/control: depend on default-mta | mail-transport-agent, instead of
    enumerating a long list of alternative MTAs.
  - debian/rules: installing setuid wrapper with setuid bit set, and no
    permissions granted to other (mode 4750)
* New upstream release. Closes: #641450
* urgency set to high because of a security fix
* Non-maintainer upload.
* Use inetutils-ping as an alternative to iputils-ping. Closes: #630777

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#
30
30
#========================================================================
31
31
#
32
 
# Version 3.2.0, released 31 Jul 2010.
 
32
# Version 3.2.1, released 24 Apr 2011.
33
33
#
34
34
# See http://backuppc.sourceforge.net.
35
35
#
288
288
    my @BackupFilesExclude = ();
289
289
    my ($shareName, $shareNameRE);
290
290
    
291
 
    #
292
 
    # $conf->{$shareType} shold be a reference to an array with one
293
 
    # element, thanks to BackupFileConfFix().
294
 
    #
295
 
    $shareName = @{ $conf->{$shareType} }[0];
 
291
    $shareName = $t->{shareName};
296
292
    $shareName =~ s/\/*$//;    # remove trailing slashes
 
293
    $shareName = "/" if ( $shareName eq "" );
297
294
 
298
295
    $t->{shareName}   = $shareName;
299
296
    $t->{shareNameRE} = $bpc->glob2re($shareName);
422
419
    my ($t, $file) = @_;
423
420
 
424
421
    my $shareName = $t->{shareName};
425
 
    my $includes  = $t->{BackupFilesOnly} || return 0;
 
422
    my $excludes  = $t->{BackupFilesExclude} || return 0;
426
423
    my $match = "";
427
424
 
428
 
    foreach my $include ( @{$includes} ) {
 
425
    foreach my $exclude ( @{$excludes} ) {
429
426
 
430
427
        #
431
428
        # construct regexp elsewhere to avoid syntactical evil
432
429
        #
433
 
        $match = '^' . quotemeta( $shareName . $include ) . '(?=\/.*)?';
 
430
        $match = '^' . quotemeta( $shareName . $exclude ) . '(?=\/.*)?';
434
431
 
435
432
        #
436
 
        # return true if the include folder is a parent of the file,
 
433
        # return true if the exclude folder is a parent of the file,
437
434
        # or the folder itself.
438
435
        #
439
436
        return 1 if ( $file =~ /$match/ );
441
438
        $match = '^' . quotemeta($file) . '(?=\/.*)?';
442
439
                
443
440
        #
444
 
        # return true if the file is a parent of the include folder,
 
441
        # return true if the file is a parent of the exclude folder,
445
442
        # or the folder itself.
446
443
        #
447
 
        return 1 if ( "$shareName$include" =~ /$match/ );
 
444
        return 1 if ( "$shareName$exclude" =~ /$match/ );
448
445
    }
449
446
    return 0;
450
447
}