changeset 249:0057f48f7945

fixed simple auth package to work with utf8 strings
author sergey
date Tue, 06 Nov 2012 20:00:57 +0400
parents 814d755e5d12
children 129e48bb5afb
files Lib/IMPL/Security/Auth/Simple.pm
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/Security/Auth/Simple.pm	Tue Nov 06 00:58:15 2012 +0400
+++ b/Lib/IMPL/Security/Auth/Simple.pm	Tue Nov 06 20:00:57 2012 +0400
@@ -2,6 +2,7 @@
 use strict;
 
 use Digest::MD5 qw(md5_hex);
+use Encode qw(encode);
 
 use IMPL::Security::Auth qw(:Const);
 
@@ -57,7 +58,7 @@
     
     my $salt = $this->_salt;
 
-    if (md5_hex($salt, $challenge, $salt) eq $this->_image) {
+    if (md5_hex($salt,encode('utf-8', $challenge), $salt) eq $this->_image) {
         if ($this->_stage == STAGE_INIT) {
             $this->_stage(STAGE_DONE);
         }
@@ -73,7 +74,7 @@
     die new IMPL::InvalidArgumentException("The parameter is required",'password') unless $args{password};
     
     my $salt = $self->GenSSID();
-    return return join ('|',STAGE_INIT, $salt, md5_hex($salt,$args{password},$salt));
+    return return join ('|',STAGE_INIT, $salt, md5_hex($salt,encode('utf-8', $args{password}),$salt));
 }
 
 sub SecDataArgs {