Instead of cleanly rejecting the attempt at using the openid on two distinct accounts, the module returns a MySQL error:

user warning: Duplicate entry '(some openid url)' for key 2 query: INSERT INTO www_authmap (uid, authname, module) VALUES (1, '(some open id url)','openid') in /somepath/www/modules/openid/openid.pages.inc on line 38.

then confirms "Successfully added (some openid url)", although it was obviously not added.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Leeteq’s picture

Subscribing.

fgm’s picture

Version: 6.9 » 7.x-dev

Still there in 6.10 and 7.0 UNSTABLE 5

c960657’s picture

Status: Active » Needs review
FileSize
6.87 KB

This patch catches the duplicate key exception and displays an error message. Also, it doesn't check the identity prior to contacting the OpenID Provider, because the actual claimed_id may different from the one supplied by the user. E.g. if the user just enters "yahoo.com", Yahoo responds with a claimed id that looks something like this: https://me.yahoo.com/a/15_jkHfcSwQSxcvmOujhdYhdsnwW-#a73Px

c960657’s picture

I updated the test to add a query string argument instead of a dummy fragment, because the fragment should be stripped according to section 7.2 of OpenID Authentication 2.0 (though they are currently not).

Status: Needs review » Needs work

The last submitted patch failed testing.

c960657’s picture

Status: Needs work » Needs review
FileSize
7.11 KB

Reroll.

Status: Needs review » Needs work

The last submitted patch failed testing.

c960657’s picture

Status: Needs work » Needs review

Test bot glitch.

Status: Needs review » Needs work

The last submitted patch failed testing.

andypost’s picture

Status: Needs work » Needs review

Bot was failed

Status: Needs review » Needs work

The last submitted patch failed testing.

deekayen’s picture

Status: Needs work » Needs review

trying out a new testing bot that apparently wasn't working

Gábor Hojtsy’s picture

Set #473982: OpenID not checked for duplicity a duplicate of this one.

andypost’s picture

Issue tags: +Needs backport to D6

Tested #6 looks fine but needs another review to rtbc

c960657’s picture

Status: Needs review » Needs work

$exception->errorInfo[0] == 23000 is not a reliable way to detect key conflicts across databases - see #505812: PDO uses inconsistant error codes between DBs.

skizzo’s picture

Subscribing. In D6.15 a similar warning is issued when trying to add the same OpenID twice (within the same Drupal user account).

alberto56’s picture

When trying to add the same Google OpenID (https://www.google.com/accounts/o8/id) on two different accounts, both attempts create an identity using the currently logged in Google account. Of course, if one wants to have different Google OpenIDs on two different Drupal accounts, one must log out of one Google account after having created the first OpenID, then log into a second Google account before creating the second OpenID, in which case twice entering https://www.google.com/accounts/o8/id will work (both attempts will lead to different OpenID keys). Obvious, yes, but to OpenID newbies this might be confusing -- perhaps the error message might be tweaked to help users understand how OpenID works.

wojtha’s picture

Subscribing

wojtha’s picture

Assigned: Unassigned » wojtha
FileSize
1.87 KB

Slightly different approach. I'm leaving the validation as it is, becuase it could catch some of the OpenID before whole discovery and authorization process begins and in worst case cost us only one select in DB but should save more DB requests and server load. And I'm not using PDO Exception which is not same for all databases according to #15, but the same approach like in form validation handler.

wojtha’s picture

Status: Needs work » Needs review
wojtha’s picture

Test passed, but drupal.org doesn't respond this time because of network trouble, so the test status wasn't updated.

sun’s picture

#19: openid_duplicate_key_364348.patch queued for re-testing.

sun’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs review » Needs work
Issue tags: +Needs tests, +Needs backport to D7

Sent #19 for re-test against D7. However, this needs to be re-rolled against D8 either way.

Should also be covered by tests.

andypost’s picture

Suppose we should decide on a way of collision detection - I filed #1376778: Consistent 'duplicate key' detection in core

star-szr’s picture

Version: 8.x-dev » 7.x-dev
Issue summary: View changes
Issue tags: +Needs reroll

It looks like this bugfix is relevant for D7 so bumping back there because of https://www.drupal.org/node/2116417.

mgifford’s picture

Assigned: wojtha » Unassigned
Issue tags: -Needs reroll

@wojtha last commented 4 years ago on this issue.

Thanks for the reroll @rpayanm