From f6257f558390295c581f4e5af8f084341db05d34 Mon Sep 17 00:00:00 2001 From: cbarratt Date: Sun, 11 May 2003 06:37:01 +0000 Subject: [PATCH] * Changed BackupPC::Lib so that user check is optional in new() --- configure.pl | 2 +- lib/BackupPC/Lib.pm | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configure.pl b/configure.pl index 36c702d..ff910d0 100755 --- a/configure.pl +++ b/configure.pl @@ -99,7 +99,7 @@ my $bpc; if ( $ConfigPath ne "" && -r $ConfigPath ) { (my $topDir = $ConfigPath) =~ s{/[^/]+/[^/]+$}{}; die("BackupPC::Lib->new failed\n") - if ( !($bpc = BackupPC::Lib->new($topDir, ".")) ); + if ( !($bpc = BackupPC::Lib->new($topDir, ".", 1)) ); %Conf = $bpc->Conf(); %OrigConf = %Conf; $Conf{TopDir} = $topDir; diff --git a/lib/BackupPC/Lib.pm b/lib/BackupPC/Lib.pm index 0da9356..ecc455d 100644 --- a/lib/BackupPC/Lib.pm +++ b/lib/BackupPC/Lib.pm @@ -52,7 +52,7 @@ use Digest::MD5; sub new { my $class = shift; - my($topDir, $installDir) = @_; + my($topDir, $installDir, $noUserCheck) = @_; my $bpc = bless { TopDir => $topDir || '/data/BackupPC', @@ -86,7 +86,8 @@ sub new # # Verify we are running as the correct user # - if ( $bpc->{Conf}{BackupPCUserVerify} + if ( !$noUserCheck + && $bpc->{Conf}{BackupPCUserVerify} && $> != (my $uid = (getpwnam($bpc->{Conf}{BackupPCUser}))[2]) ) { print("Wrong user: my userid is $>, instead of $uid" . " ($bpc->{Conf}{BackupPCUser})\n"); -- 2.20.1