[Catalyst-commits] r13486 - Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Mon Aug 16 09:45:08 GMT 2010


Author: t0m
Date: 2010-08-16 10:45:08 +0100 (Mon, 16 Aug 2010)
New Revision: 13486

Modified:
   Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/Backend.pm
   Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/User.pm
Log:
Fugly, but probably workable

Modified: Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/Backend.pm
===================================================================
--- Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/Backend.pm	2010-08-16 09:40:06 UTC (rev 13485)
+++ Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/Backend.pm	2010-08-16 09:45:08 UTC (rev 13486)
@@ -437,7 +437,15 @@
 
 sub from_session {
     my ( $self, $c, $id ) = @_;
-    $self->get_user($id, $c);
+    my $pass;
+    if ($id =~ s/,(.*)//) {
+        my $pass = $1;
+    }
+    my $user = $self->get_user($id, $c);
+    if ($pass) {
+        $Catalyst::Authentication::Store::LDAP::User::_ldap_connection_passwords{refaddr($user)} = $pass;
+    }
+    return $user;
 }
 
 1;

Modified: Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/User.pm
===================================================================
--- Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/User.pm	2010-08-16 09:40:06 UTC (rev 13485)
+++ Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/User.pm	2010-08-16 09:45:08 UTC (rev 13486)
@@ -56,7 +56,7 @@
 
 use overload '""' => sub { shift->stringify }, fallback => 1;
 
-my %_ldap_connection_passwords; # Store inside-out so that they don't show up
+our %_ldap_connection_passwords; # Store inside-out so that they don't show up
                                 # in dumps..
 
 =head1 METHODS
@@ -180,7 +180,10 @@
 
 sub for_session {
     my $self = shift;
-    return $self->stringify;
+    my $id = $self->stringify;
+    if ($_ldap_connection_passwords{refaddr($self)}) {
+        $id .= ',' . $_ldap_connection_passwords{refaddr($self)};
+    }
 }
 
 =head2 ldap_entry




More information about the Catalyst-commits mailing list