From f7fdbaad4baa1b241e5f5bfa30c7585abb10b0bd Mon Sep 17 00:00:00 2001
From: Marius Gavrilescu <marius@ieval.ro>
Date: Sun, 4 Aug 2013 20:11:17 +0300
Subject: [PATCH] Fix previous release

---
 Changes                          | 2 ++
 README                           | 4 ++--
 lib/Apache2/Authen/Passphrase.pm | 9 ++++++---
 lib/Apache2/Authen/pod2htmd.tmp  | 2 --
 lib/Apache2/Authen/pod2htmi.tmp  | 2 --
 t/Apache2-Authen-Passphrase.t    | 4 +---
 6 files changed, 11 insertions(+), 12 deletions(-)
 delete mode 100644 lib/Apache2/Authen/pod2htmd.tmp
 delete mode 100644 lib/Apache2/Authen/pod2htmi.tmp

diff --git a/Changes b/Changes
index ca77758..f93cd70 100644
--- a/Changes
+++ b/Changes
@@ -2,3 +2,5 @@ Revision history for Perl extension Apache2::Authen::Passphrase.
 
 0.001 Sun  4 Aug 19:47:54 EEST 2013
 	- Initial Release
+0.001001 Sun  4 Aug 20:10:24 EEST 2013
+	- Fix the broken previous release
\ No newline at end of file
diff --git a/README b/README
index 1149eeb..26e3bf9 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
-Apache2-Authen-Passphrase version 0.001
-=======================================
+Apache2-Authen-Passphrase version 0.001001
+==========================================
 
 Apache2::Authen::Passphrase is a perl module which provides easy-to-use Apache2 authentication. It exports some utility functions and it contains a PerlAuthenHandler.
 
diff --git a/lib/Apache2/Authen/Passphrase.pm b/lib/Apache2/Authen/Passphrase.pm
index 0770f74..4beea0e 100644
--- a/lib/Apache2/Authen/Passphrase.pm
+++ b/lib/Apache2/Authen/Passphrase.pm
@@ -1,4 +1,4 @@
-package Apache2::Authen::Passphrase 0.001;
+package Apache2::Authen::Passphrase 0.001001;
 
 use 5.014000;
 use strict;
@@ -40,7 +40,7 @@ sub pwhash{
 sub pwset{
   my ($user, $pass)=@_;
 
-  my $file = "$rootdir/us/$user.yml";
+  my $file = "$rootdir/$user.yml";
   my $conf = eval { LoadFile $file } // undef;
   $conf->{passphrase}=pwhash $pass;
   $conf->{passphrase_version}=PASSPHRASE_VERSION;
@@ -53,7 +53,7 @@ sub pwcheck{
   my ($user, $pass)=@_;
   die INVALID_USER unless $user =~ USER_REGEX;
   $user=${^MATCH};# Make taint shut up
-  my $conf=LoadFile "$rootdir/us/$user.yml";
+  my $conf=LoadFile "$rootdir/$user.yml";
 
   die BAD_PASSWORD unless keys $conf;# Empty hash means no such user
   die BAD_PASSWORD unless Authen::Passphrase->from_rfc2307($conf->{passphrase})->match($pass);
@@ -62,6 +62,7 @@ sub pwcheck{
 
 sub handler{
   my $r=shift;
+  local $rootdir = $r->dir_config('AuthenPassphraseRootdir');
 
   my ($rc, $pass) = $r->get_basic_auth_pw;
   return $rc unless $rc == OK;
@@ -85,6 +86,7 @@ Apache2::Authen::Passphrase - basic authentication with Authen::Passphrase
 =head1 SYNOPSIS
 
   use Apache2::Authen::Passphrase qw/pwcheck pwset pwhash/;
+  $Apache2::Authen::Passphrase::rootdir = "/path/to/user/directory"
   my $hash = pwhash $username, $password;
   pwset $username, "pass123";
   eval { pwcheck $username, "pass123" };
@@ -92,6 +94,7 @@ Apache2::Authen::Passphrase - basic authentication with Authen::Passphrase
   # In Apache2 config
   <Location /secret>
     PerlAuthenHandler Apache2::Authen::Passphrase
+    PerlSetVar AuthenPassphraseRootdir /path/to/user/directory
     AuthName MyAuth
     Require valid-user
   </Location>
diff --git a/lib/Apache2/Authen/pod2htmd.tmp b/lib/Apache2/Authen/pod2htmd.tmp
deleted file mode 100644
index 61e86d9..0000000
--- a/lib/Apache2/Authen/pod2htmd.tmp
+++ /dev/null
@@ -1,2 +0,0 @@
-
-.
diff --git a/lib/Apache2/Authen/pod2htmi.tmp b/lib/Apache2/Authen/pod2htmi.tmp
deleted file mode 100644
index 61e86d9..0000000
--- a/lib/Apache2/Authen/pod2htmi.tmp
+++ /dev/null
@@ -1,2 +0,0 @@
-
-.
diff --git a/t/Apache2-Authen-Passphrase.t b/t/Apache2-Authen-Passphrase.t
index b27498b..0ebf90d 100644
--- a/t/Apache2-Authen-Passphrase.t
+++ b/t/Apache2-Authen-Passphrase.t
@@ -6,9 +6,7 @@ use File::Temp qw/tempdir/;
 use Test::More tests => 7;
 BEGIN { use_ok('Apache2::Authen::Passphrase', qw/pwset pwcheck/) };
 
-my $tempdir = tempdir CLEANUP => 1;
-mkdir "$tempdir/us";
-$Apache2::Authen::Passphrase::rootdir = $tempdir;
+$Apache2::Authen::Passphrase::rootdir = tempdir CLEANUP => 1;
 
 sub pw_ok {
   my ($user, $pass, $testname) = @_;
-- 
2.39.5