errors when defaulting to md5 authentication method.

nbz - August 1, 2008 - 19:32
Project:Secure Password Hashes (phpass)
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:fixed
Description

I can't log in as admin on my test system atm due to this. (not too serious for me as I have no data on the test system).

Steps:

1. Install the module.
2. Set hash method to md5.

Now with users who still have a phpass has can log in (and the hash will be converted to an md5), but if a user only has an md5 hash, the following error messages are given:

* Sorry, unrecognized username or password. Have you forgotten your password?
* warning: array_fill() [function.array-fill]: Number of elements must be positive in C:\wamp\www\drupal-6.3\includes\database.inc on line 240.
* warning: implode() [function.implode]: Invalid arguments passed in C:\wamp\www\drupal-6.3\includes\database.inc on line 240.
* warning: array_keys() [function.array-keys]: The first argument should be an array in C:\wamp\www\drupal-6.3\modules\user\user.module on line 514.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in C:\wamp\www\drupal-6.3\modules\user\user.module on line 514.

#1

nbz - August 1, 2008 - 20:06
Status:active» needs review

I managed to fix this by changing:

<?php
 
// authenticate the standard Drupal way
 
return user_authenticate($user, $pass);;
?>

to

<?php
  $form_state
['values']['name'] = $user;
 
$form_state['values']['pass'] = $pass;

 
// authenticate the standard Drupal way
 
return user_authenticate($form_state['values']);
?>

It is a bit of a hack, but it works.

#2

nbz - October 29, 2008 - 15:21

This issue still exists.

#3

jmpoure - March 11, 2009 - 12:37

I had the same problem and had to reset admin password.

#4

nbz - March 12, 2009 - 02:34

If you made the above changes, that should have prevented the need to reset the password? Did the suggested changes work for you?

#5

jmpoure - March 13, 2009 - 14:16

I am ready to test a patch, but on which page? Can you create a patch please?

#6

nbz - March 13, 2009 - 14:59
AttachmentSize
phpass.patch 641 bytes

#7

tacituseu - October 11, 2009 - 19:09
Status:needs review» reviewed & tested by the community

It's an omission made while porting from D5 to D6 (http://drupal.org/node/114774#user_authenticate), attached cleaned up patch.

AttachmentSize
phpass_ua.patch 587 bytes

#8

Owen Barton - January 29, 2010 - 10:39
Status:reviewed & tested by the community» fixed

Committed - thanks!

 
 

Drupal is a registered trademark of Dries Buytaert.