[Bps-public-commit] r10899 - RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler

ruz at bestpractical.com ruz at bestpractical.com
Wed Feb 20 12:07:16 EST 2008


Author: ruz
Date: Wed Feb 20 12:07:15 2008
New Revision: 10899

Modified:
   RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler/Auth

Log:
* workaround Authen::Bitcard's inabilty to deal with perl strings

Modified: RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler/Auth
==============================================================================
--- RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler/Auth	(original)
+++ RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler/Auth	Wed Feb 20 12:07:15 2008
@@ -10,9 +10,16 @@
   my $bc = Authen::Bitcard->new;
   $bc->token($RT::BitcardToken);
 
-  my $user = $bc->verify(\%ARGS) 
+  # We have to use octets as Authen::Bitcard doesn't support perl strings
+  # to avoid converting back from perl string to octets we use request_args
+  my $user = $bc->verify( scalar $m->request_args )
       or $RT::Logger->warning("Bitcard verify() returned null: @{[$bc->errstr]}");
 
+  # upgrade octets returned by An::BC into perl strings
+  use Encode ();
+  $user->{ $_ } = Encode::decode_utf8( $user->{ $_ } )
+      foreach grep defined $user->{$_}, keys %$user;
+
   ### changing the 'defined $user->{'email}' line back to '$user' enables the
   ### fsck.com #7277 exploit, if you've saved the 'Manage your Bitcard account'
   ### URL from a previous successful Bitcard login.



More information about the Bps-public-commit mailing list