]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 453767 - Passwords containing wide characters causes system error
authordkl%redhat.com <>
Fri, 12 Sep 2008 20:12:18 +0000 (20:12 +0000)
committerdkl%redhat.com <>
Fri, 12 Sep 2008 20:12:18 +0000 (20:12 +0000)
Patch by David Lawrence <dkl@redhat.com> - r/a=mkanat

Bugzilla/Auth/Verify/DB.pm
Bugzilla/Util.pm
userprefs.cgi

index 88ad78d5449d9b51e041296659f1407564b3d5b8..f2c008dbf1e5718eb107308fe80840a92b1493c3 100644 (file)
@@ -53,6 +53,11 @@ sub check_credentials {
         "SELECT cryptpassword FROM profiles WHERE userid = ?",
         undef, $user_id);
 
+    # Wide characters cause crypt to die
+    if (Bugzilla->params->{'utf8'}) {
+        utf8::encode($password) if utf8::is_utf8($password);
+    }
+
     # Using the internal crypted password as the salt,
     # crypt the password the user entered.
     my $entered_password_crypted = crypt($password, $real_password_crypted);
index 1e7dbf8d1bf9e2c1edc6f7b986fdcfdedacc8901..0301969f64e2b7470d4315b7fafde41f41c561aa 100644 (file)
@@ -474,6 +474,11 @@ sub bz_crypt {
         $salt .= $saltchars[rand(64)];
     }
 
+    # Wide characters cause crypt to die
+    if (Bugzilla->params->{'utf8'}) {
+        utf8::encode($password) if utf8::is_utf8($password);
+    }
+    
     # Crypt the password.
     my $cryptedpassword = crypt($password, $salt);
 
index b281fd2146ef1962dfbc85749ef974af090b04ad..d73a61e5498456327a5c0b0c546d373a1c3983db 100755 (executable)
@@ -90,8 +90,14 @@ sub SaveAccount {
                         undef, $user->id);
         $oldcryptedpwd || ThrowCodeError("unable_to_retrieve_password");
 
-        if (crypt(scalar($cgi->param('Bugzilla_password')), $oldcryptedpwd) ne 
-                  $oldcryptedpwd) 
+        my $oldpassword = $cgi->param('Bugzilla_password');
+
+        # Wide characters cause crypt to die
+        if (Bugzilla->params->{'utf8'}) {
+            utf8::encode($oldpassword) if utf8::is_utf8($oldpassword);
+        } 
+
+        if (crypt($oldpassword, $oldcryptedpwd) ne $oldcryptedpwd) 
         {
             ThrowUserError("old_password_incorrect");
         }