]> 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:10:11 +0000 (20:10 +0000)
committerdkl%redhat.com <>
Fri, 12 Sep 2008 20:10:11 +0000 (20:10 +0000)
Patch by David Lawrence <dkl@redhat.com> - a/r=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 9ff810b4f424af7894b1857074e76de0cdf31398..defa1527085a5b773fa8c7834b9be410452f3d8a 100644 (file)
@@ -480,6 +480,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 3ccfe820a9c357ec8137b6c3d4547104e9f970e6..24a6a569988afd35a421c20dd113adc59fee4809 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");
         }