Recently we got a new version of user_pass_rehash() with some "backward compatible" code that attempts to read a user identifier using the last login timestamp.

Unfortunately, the login parameter is checked with a string:

$result = db_query_range("SELECT uid FROM {users} WHERE pass = '%s' AND login = '%s' AND uid > 0", $password, $login, 0, 2);

Since that field is an integer, the correct code is:

$result = db_query_range("SELECT uid FROM {users} WHERE pass = '%s' AND login = %d AND uid > 0", $password, $login, 0, 2);

Without that, this fix is totally useless for PostgreSQL users (and it actually generate errors in their logs.)

Comments

AlexisWilke created an issue. See original summary.

joyceg’s picture

Assigned: Unassigned » joyceg
joyceg’s picture

StatusFileSize
new661 bytes
joyceg’s picture

Status: Active » Needs review
AlexisWilke’s picture

I do not know whether Drupal test servers offer a test with PostgreSQL, if not, you cannot be sure that your fix will pass...

Anyway, it is wrong since you kept the quotes. My sample is correct:

... login = %d ...

joyceg’s picture

Status: Needs review » Needs work
joyceg’s picture

StatusFileSize
new659 bytes
joyceg’s picture

Status: Needs work » Needs review
AlexisWilke’s picture

Status: Needs review » Reviewed & tested by the community

Okay, that works.

Note that if you want to work on patches for PostgreSQL then you should have a test system with PostgreSQL running on it. That way you can make sure it goes through as expected...

Status: Reviewed & tested by the community » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.