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

privilege: fix user change after show grants and add user existed check for show grants (#19568) #19587

Merged
merged 5 commits into from
Sep 3, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #19568 to release-3.0


What problem does this PR solve?

Issue Number: close #18878

Problem Summary:

  • select user() returns different result after execute show grants
  • show grants can show grants on not existed user.

What is changed and how it works?

What's Changed:

  • Do not use auth.UserIdentity pointer on show grants.
  • Add check in showGrants to avoid executed on not existed user.

How it Works:

Because of SHOW GRANTS change the content in auth.Identity, when execute SHOW GRANTS, it will change the host of User in session variable. The result of select user() will changed.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Side effects

  • None

Release note

  • Fix SHOW GRANTS can show grants for not existed user.

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@imtbkcat please accept the invitation then you can push to the cherry-pick pull requests.
https://github.com/ti-srebot/tidb/invitations

@tiancaiamao
Copy link
Contributor

Please resolve conflict @imtbkcat

@lysu
Copy link
Contributor

lysu commented Sep 2, 2020

@imtbkcat compile failed PTAL

@imtbkcat imtbkcat force-pushed the release-3.0-6fdd609c0031 branch from bcf5fd0 to b7f211b Compare September 2, 2020 08:13
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 3, 2020
@zz-jason
Copy link
Member

zz-jason commented Sep 3, 2020

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 3, 2020
@ti-srebot
Copy link
Contributor Author

Your auto merge job has been accepted, waiting for:

  • 19428

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@ti-srebot merge failed.

@zz-jason
Copy link
Member

zz-jason commented Sep 3, 2020

/merge

@zz-jason
Copy link
Member

zz-jason commented Sep 3, 2020

/run-sqllogic-test-2
/run-integration-common-test

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot merged commit d0eaee9 into pingcap:release-3.0 Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/privilege sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug. type/3.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants