Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for old (< 4.1) passwords #2

Closed
felixge opened this issue Aug 16, 2010 · 9 comments
Closed

Support for old (< 4.1) passwords #2

felixge opened this issue Aug 16, 2010 · 9 comments

Comments

@felixge
Copy link
Collaborator

felixge commented Aug 16, 2010

Mysql uses some homebrew hashing and scrambling code for old passwords which needs to be ported to Javascript.

I have started some initial work here:

http://github.com/felixge/node-mysql/commit/0cb56d994641bad3426fd5cfc7e452f7903bc059

hash_password seems to be successfully ported, but I could need help with:

  • randominit
  • my_rnd
  • scramble_323

See this link for details:

http://github.com/felixge/node-mysql/blob/0cb56d994641bad3426fd5cfc7e452f7903bc059/test/fixture/libmysql_password.c#L34-72

@CrabDude
Copy link

Just for reference, I had this issue in a fresh npm install (node v0.2.0 and node-mysql via npm 8/24/10, don't know how to get it's version) on CentOS.

Felixge suggested resetting the password using PASSWORD (see #2 below).

To rectify I tried the following:

  1. create new user w/new password => FAIL
  2. SET PASSWORD FOR 'your_user'@'your_host' = PASSWORD('your_password'); (and again with OLD_PASSWORD) => FAIL
  3. UPDATE mysql.user SET Password = PASSWORD('your_password') WHERE Host = 'your_host' AND User = 'your_user'; (and again with OLD_PASSWORD) => FAIL

@CrabDude
Copy link

Additionally, my issue is verified related as removal the user's password successfully connected.

@iamcal
Copy link

iamcal commented Sep 1, 2010

It looks like all of the oldAuth code linked to above has been removed. If I wanted to implement this, where did you intend it to go?

@felixge
Copy link
Collaborator Author

felixge commented Sep 1, 2010

iamcal: There is a branch called oldpw, see:

http://github.com/felixge/node-mysql/tree/oldpw

It's not rebased with master right now, but the code in question shouldn't cause any conflicts. It'd be really awesome if you could help me with this, let me know if I can provide any help for you.

@iamcal
Copy link

iamcal commented Sep 2, 2010

I've gotten hashPassword(), initRandom(), myRnd() and scamble323() all working in this branch: http://github.com/iamcal/node-mysql/tree/oldpw

The implementation of hashPassword() is buggy on your oldpw branch, so that's been rewritten.

There are a bunch of tests for all the new functions that use the output from tests/fixture/libmysql_password.c as reference. They can be found in test/simple/test-auth-old.js

@felixge
Copy link
Collaborator Author

felixge commented Sep 2, 2010

Wow, thank you so much for you help on this. There are a few things (tabs vs. spaces, test output, etc.) I like to do differently, but no worries - I'll take care of all that : ).

Right now I'm working on integrating your branch into master and testing it against a mysql install that uses the old password mechanism. Once I got this going I'll let you know if it works!

@felixge
Copy link
Collaborator Author

felixge commented Sep 2, 2010

Alright, I got the branch rebased and _sendOldAuth all wired up. When testing against my test install I'm now getting:

Error: Access denied for user 'root'@'my-host-name' (using password: YES)

I've pushed my latest commits up, you can see them here:

http://github.com/felixge/node-mysql/commits/oldpw

If you have a suitable install around it'd be awesome if you could have a look and see if it works for you, or if you are hitting the same problem.

Thanks, --fg

@felixge
Copy link
Collaborator Author

felixge commented Sep 2, 2010

Ok, nevermind my previous comment. Your code works fantastically! I just reformatted the styling a little to go along with the rest of the project and merged your commits into master and released v0.4.0 via npm!

Thank you so much for your help on this one. I wasted hours on my buggy version of hash_password alone, it would have probably taken me forever to finish the rest of stuff you ported.

Everybody else: I'm closing this issue now. Please test if you are now able to connect to your databases and let me know if you hit any issues.

@iamcal
Copy link

iamcal commented Sep 2, 2010

Awesome!

dveeden pushed a commit to dveeden/mysql that referenced this issue Jan 31, 2023
Thanks to chengw (at) garena.com for the fix!
dveeden pushed a commit to dveeden/mysql that referenced this issue Jan 31, 2023
Pull recent changes from the main fork
dveeden pushed a commit to dveeden/mysql that referenced this issue Jan 31, 2023
* add RejectReadOnly

* update README.md

* close connection explicitly before returning ErrBadConn for 1792 (mysqljs#2)

* add test and improve doc

* doc/comment changes
myspar pushed a commit to myspar/mysql that referenced this issue Dec 21, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants