diff -r 2721e331ea42 -r d0410b54a231 plugins/check_amanda-client --- a/plugins/check_amanda-client Tue Jan 28 11:55:03 2014 +0100 +++ b/plugins/check_amanda-client Tue Jan 28 14:03:04 2014 +0100 @@ -35,7 +35,15 @@ sub verbose; sub unique { my %h; @h{@_} = (); keys %h } -$SIG{__DIE__} = sub { UNKNOWN @_ unless $^S }; +local $SIG{__DIE__} = sub { UNKNOWN @_ unless $^S }; + +# this we need for testing only, if this file gets +# included as a module +sub import { + no strict 'refs'; + *{"$_[0]::verbose"} = sub { }; +} + exit main @ARGV if not caller; @@ -109,6 +117,10 @@ $) = "@groups"; verbose "su to $uid:$gid"; + + # during testing + return ($uid, $gid) if $ENV{HARNESS_ACTIVE}; + setgid $gid; setuid $uid; }