-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
expression:implement function password. #3275
Conversation
@@ -427,6 +427,8 @@ func (v *typeInferrer) handleFuncCallExpr(x *ast.FuncCallExpr) { | |||
tp = x.Args[0].GetType() | |||
case ast.RowFunc: | |||
tp = x.Args[0].GetType() | |||
case ast.PasswordFunc: | |||
tp = types.NewFieldType(mysql.TypeVarString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to set charset: chs = v.defaultCharset
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also need to add a test case in typeinferer_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
LGTM |
@XuHuaiyu @tiancaiamao PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
expression/builtin_encryption.go
Outdated
return d, nil | ||
} | ||
|
||
// Two stage SHA1 hash of the password |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add .
at the end of this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/stage/stages
I see this Note in the document:
Should TiDB implement it? @shenli |
@tiancaiamao @shenli I think password is a useful function |
@tiancaiamao We need this. Some DBAs still use this to generate password. |
But |
@tiancaiamao @shenli |
For some historical reasons, TiDB store password not in MySQL way. The risk of this PR is that, if user change password in this way, he can't login any more:
I'll upgrade TiDB to make the stored data compatible with MySQL, so password function Please wait for while, thank you for your patience! @louishust |
@tiancaiamao I'd like to upgrade TiDB to make the stored data compatible with MySQL |
Nice! Feel fun to have a try. Basically, you would follow those steps:
|
@tiancaiamao upgradeToVer10 used to upgrade the old format password stored in TIDB to MySQL format? It seems can not upgrade using simple UPDATE statement cause I have to decode the old format to []byte and then SHA1 the []byte. Add an internal function upgrade_password for the upgrade? Or some other ways? |
Yes, you're right.
Maybe, but you can have a try. We don't store the raw password, the stored password in
Exactly. Read the fucking source code would help, including Here is the password check procedure (maybe miss information in detail):
|
Please resolve conflict. |
@tiancaiamao OK |
Conflicts: expression/typeinferer_test.go
LGTM |
No description provided.