plugins/check_amanda-client
changeset 40 d0410b54a231
parent 28 55ace296247b
child 41 b761702df772
equal deleted inserted replaced
39:2721e331ea42 40:d0410b54a231
    33 sub CRITICAL;
    33 sub CRITICAL;
    34 sub UNKNOWN;
    34 sub UNKNOWN;
    35 sub verbose;
    35 sub verbose;
    36 sub unique { my %h; @h{@_} = (); keys %h }
    36 sub unique { my %h; @h{@_} = (); keys %h }
    37 
    37 
    38 $SIG{__DIE__} = sub { UNKNOWN @_ unless $^S };
    38 local $SIG{__DIE__} = sub { UNKNOWN @_ unless $^S };
       
    39 
       
    40 # this we need for testing only, if this file gets
       
    41 # included as a module
       
    42 sub import {
       
    43     no strict 'refs';
       
    44     *{"$_[0]::verbose"} = sub { };
       
    45 }
       
    46 
    39 
    47 
    40 exit main @ARGV if not caller;
    48 exit main @ARGV if not caller;
    41 
    49 
    42 #----
    50 #----
    43 
    51 
   107     }
   115     }
   108     endgrent;
   116     endgrent;
   109     $) = "@groups";
   117     $) = "@groups";
   110 
   118 
   111     verbose "su to $uid:$gid";
   119     verbose "su to $uid:$gid";
       
   120 
       
   121     # during testing
       
   122     return ($uid, $gid) if $ENV{HARNESS_ACTIVE};
       
   123 
   112     setgid $gid;
   124     setgid $gid;
   113     setuid $uid;
   125     setuid $uid;
   114 }
   126 }
   115 
   127 
   116 sub find_tool {
   128 sub find_tool {