Merge lp:~adamhjk/swift/lp607912 into lp:~hudson-openstack/swift/trunk
Proposed by
Adam Jacob
Status: | Work in progress |
---|---|
Proposed branch: | lp:~adamhjk/swift/lp607912 |
Merge into: | lp:~hudson-openstack/swift/trunk |
Diff against target: |
76 lines (+36/-8) 2 files modified
swift/auth/server.py (+28/-7) test/unit/auth/test_server.py (+8/-1) |
To merge this branch: | bzr merge lp:~adamhjk/swift/lp607912 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Swift Core security contacts | Pending | ||
Review via email: mp+30588@code.launchpad.net |
Description of the change
Fixes lp:607912. We now do a SELECT to find out if we have an account with the matching username - if we do, we grab the cfaccount hash from that row, and re-use it when we update the record. The corresponding INSERT is changed to an INSERT OR REPLACE, which will ensure that repeat creations of the same user with a new password will get the correct behavior.
To post a comment you must log in.
Unmerged revisions
- 38. By Adam Jacob <adam@latte>
-
Moving to direct INSERT or UPDATE
- 37. By Adam Jacob <adam@latte>
-
Removing errant debug statement
- 36. By Adam Jacob <adam@latte>
-
Re-creates existing users on multiple calls - fixes lp:607912
- 35. By Adam Jacob <adam@latte>
-
Adding test for existing account behavior
- 34. By Adam Jacob <adam@latte>
-
Select first to preserve the account hash
- 33. By Adam Jacob <adam@latte>
-
Creating users with INSERT OR REPLACE
Hey Adam,
I just tested this, and creating the same user still adds extra entries in the db:
cthier@ swiftchuck: ~/swift/ lp607912$ swift-auth- create- account test tester testing 127.0.0. 1:8080/ v1/4db8017a- 68d1-485a- 98dd-b94785a2f8 55 swiftchuck: ~/swift/ lp607912$ swift-auth- create- account test tester testing 127.0.0. 1:8080/ v1/4db8017a- 68d1-485a- 98dd-b94785a2f8 55 swiftchuck: ~/swift/ lp607912$ swift-auth- create- account test tester testing2 127.0.0. 1:8080/ v1/4db8017a- 68d1-485a- 98dd-b94785a2f8 55 swiftchuck: ~/swift/ lp607912$ sqlite3 /etc/swift/auth.db 127.0.0. 1:8080/ v1/4db8017a- 68d1-485a- 98dd-b94785a2f8 55|4db8017a- 68d1-485a- 98dd-b94785a2f8 55|tester| testing 127.0.0. 1:8080/ v1/4db8017a- 68d1-485a- 98dd-b94785a2f8 55|4db8017a- 68d1-485a- 98dd-b94785a2f8 55|tester| testing 127.0.0. 1:8080/ v1/4db8017a- 68d1-485a- 98dd-b94785a2f8 55|4db8017a- 68d1-485a- 98dd-b94785a2f8 55|tester| testing2
http://
cthier@
http://
cthier@
http://
cthier@
SQLite version 3.6.22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from account;
test|http://
test|http://
test|http://
I think that the "INSERT OR REPLACE" sql isn't working the way you are expecting to. I wold recommend doing an "UPDATE" instead if it finds the account_hash.