Fix indentation
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 13 Jun 2015 10:31:21 +0000 (13:31 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 13 Jun 2015 10:35:42 +0000 (13:35 +0300)
lib/Apache2/Authen/Passphrase.pm
t/Apache2-Authen-Passphrase.t

index 2d1a7917bd7362e384193cf83a24cba3955717ad..d2be6625e24e91abd3686f283749595821bb0441 100644 (file)
@@ -29,56 +29,56 @@ our $rootdir;
 $rootdir //= $ENV{AAP_ROOTDIR};
 
 sub pwhash{
-  my ($pass)=@_;
+       my ($pass)=@_;
 
-  my $ppr=Authen::Passphrase::BlowfishCrypt->new(
-       cost => 10,
-       passphrase => $pass,
-       salt_random => 1,
-  );
+       my $ppr=Authen::Passphrase::BlowfishCrypt->new(
+               cost => 10,
+               passphrase => $pass,
+               salt_random => 1,
+       );
 
-  $ppr->as_rfc2307
+       $ppr->as_rfc2307
 }
 
 sub pwset{
-  my ($user, $pass)=@_;
+       my ($user, $pass)=@_;
 
-  my $file = "$rootdir/$user.yml";
-  my $conf = eval { LoadFile $file } // undef;
-  $conf->{passphrase}=pwhash $pass;
-  $conf->{passphrase_version}=PASSPHRASE_VERSION;
-  DumpFile $file, $conf;
+       my $file = "$rootdir/$user.yml";
+       my $conf = eval { LoadFile $file } // undef;
+       $conf->{passphrase}=pwhash $pass;
+       $conf->{passphrase_version}=PASSPHRASE_VERSION;
+       DumpFile $file, $conf;
 
-  chmod 0660, $file;
+       chmod 0660, $file;
 }
 
 sub pwcheck{
-  my ($user, $pass)=@_;
-  die INVALID_USER unless $user =~ USER_REGEX; ## no critic (RequireCarping)
-  $user=${^MATCH};# Make taint shut up
-  my $conf=LoadFile "$rootdir/$user.yml";
-
-  ## no critic (RequireCarping)
-  die BAD_PASSWORD unless keys $conf;# Empty hash means no such user
-  die BAD_PASSWORD unless Authen::Passphrase->from_rfc2307($conf->{passphrase})->match($pass);
-  ## use critic
-  pwset $user, $pass if $conf->{passphrase_version} < PASSPHRASE_VERSION
+       my ($user, $pass)=@_;
+       die INVALID_USER unless $user =~ USER_REGEX; ## no critic (RequireCarping)
+       $user=${^MATCH};                             # Make taint shut up
+       my $conf=LoadFile "$rootdir/$user.yml";
+
+       ## no critic (RequireCarping)
+       die BAD_PASSWORD unless keys $conf;          # Empty hash means no such user
+       die BAD_PASSWORD unless Authen::Passphrase->from_rfc2307($conf->{passphrase})->match($pass);
+       ## use critic
+       pwset $user, $pass if $conf->{passphrase_version} < PASSPHRASE_VERSION
 }
 
 sub handler{
-  my $r=shift;
-  local $rootdir = $r->dir_config('AuthenPassphraseRootdir');
+       my $r=shift;
+       local $rootdir = $r->dir_config('AuthenPassphraseRootdir');
 
-  my ($rc, $pass) = $r->get_basic_auth_pw;
-  return $rc unless $rc == OK;
+       my ($rc, $pass) = $r->get_basic_auth_pw;
+       return $rc unless $rc == OK;
 
-  my $user=$r->user;
-  unless (eval { pwcheck $user, $pass; 1 }) {
-       $r->note_basic_auth_failure;
-       return HTTP_UNAUTHORIZED
-  }
+       my $user=$r->user;
+       unless (eval { pwcheck $user, $pass; 1 }) {
+               $r->note_basic_auth_failure;
+               return HTTP_UNAUTHORIZED
+       }
 
-  OK
+       OK
 }
 
 1;
index 7b545189397df5c93dfba42e8dc7b062d98f47af..820b84393a19c2f305b9fcdd986c31cc9cf12711 100644 (file)
@@ -8,15 +8,15 @@ BEGIN { $ENV{AAP_ROOTDIR} = tempdir CLEANUP => 1 }
 BEGIN { use_ok('Apache2::Authen::Passphrase', qw/pwset pwcheck/) };
 
 sub pw_ok {
-  my ($user, $pass, $testname) = @_;
-  eval { pwcheck $user, $pass };
-  is $@, '', $testname;
+       my ($user, $pass, $testname) = @_;
+       eval { pwcheck $user, $pass };
+       is $@, '', $testname;
 }
 
 sub pw_nok {
-  my ($user, $pass, $testname) = @_;
-  eval { pwcheck $user, $pass };
-  isnt $@, '', $testname;
+       my ($user, $pass, $testname) = @_;
+       eval { pwcheck $user, $pass };
+       isnt $@, '', $testname;
 }
 
 pwset marius => 'password';
This page took 0.013384 seconds and 4 git commands to generate.