* Changed BackupPC::Lib so that user check is optional in new()
authorcbarratt <cbarratt>
Sun, 11 May 2003 06:37:01 +0000 (06:37 +0000)
committercbarratt <cbarratt>
Sun, 11 May 2003 06:37:01 +0000 (06:37 +0000)
configure.pl
lib/BackupPC/Lib.pm

index 36c702d..ff910d0 100755 (executable)
@@ -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;
index 0da9356..ecc455d 100644 (file)
@@ -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");