Commit adb27a7
committed
*: address @D3Hunter review (parser PR)
Fixes for D3Hunter's review on #68028:
[Blocker] Dual-password clauses are parsed but ignored by execution
- Add executor stubs that reject RETAIN CURRENT PASSWORD / DISCARD
OLD PASSWORD with ER_NOT_SUPPORTED_YET in executeAlterUser and
executeSetPwd. Full execution / privilege / storage logic lives in
the follow-up PR #68393.
- Expose exeerrors.ErrNotSupportedYet for callers (was previously
only available via dbterror.ClassExecutor.NewStd inline).
- New TestDualPasswordParserOnlyStub in passwordtest to pin the
stub's behavior.
[Major #2] CREATE USER accepted dual-password clauses outside MySQL grammar
- Drop the CreateUserSpec/CreateUserSpecList non-terminals and route
CREATE USER back through the original UserSpec/UserSpecList chain.
CREATE USER + RETAIN/DISCARD is now a parser-level syntax error,
matching MySQL.
[Major #3] ALTER USER over-accepted invalid RETAIN combinations
- Introduce AuthOptionWithPassword (the BY-form subset of AuthOption)
and restructure AlterUserSpec to bind RETAIN only to that subset.
Reject at parse time:
ALTER USER u IDENTIFIED WITH plugin AS '<hash>' RETAIN ...
ALTER USER u IDENTIFIED WITH plugin RETAIN ...
ALTER USER u RETAIN CURRENT PASSWORD (no auth)
ALTER USER u IDENTIFIED BY '...' DISCARD OLD PASSWORD
- DISCARD becomes its own AlterUserSpec variant (no auth-option
coexists with it).
[Major #4] Grammar label/documentation contradiction
- Drop the misleading 'unsupported dual password option' label on the
deleted CreateUserSpec; rewrite UserSpec/AlterUserSpec labels to
state the contract accurately.
[Major #5] Generic *PasswordOrLockOption type was overloaded
- Introduce dedicated ast.DualPasswordOption and
ast.DualPasswordOptionType (with DualPasswordRetainCurrent /
DualPasswordDiscardOld). UserSpec.DualPasswordOption now uses the
dedicated type. Remove the RetainCurrentPassword and
DiscardOldPassword iota entries from PasswordOrLockOption.
[Minor #6] ALTER USER USER() branch
- USER() still does not route through AlterUserSpecList; dual-password
on USER() is now a parse-time syntax error (covered by negative test).
[Minor #7] Parser tests had no negative coverage
- Add explicit ok=false rows for CREATE USER + RETAIN, the AS-hash +
RETAIN form, bare RETAIN with no auth, plain BY + DISCARD,
bare-plugin + RETAIN, and ALTER USER USER() + RETAIN.
[Minor #8] CREATE/ALTER user-spec grammar duplication
- Now naturally eliminated because CREATE USER reuses UserSpec.
Behavior PR (#68393) needs to:
- Remove the executor stubs added here.
- Adopt the new ast.DualPasswordOption / DualPasswordOptionType
symbols (the iota entries it currently consumes are gone).
Ref #605871 parent 8776699 commit adb27a7
8 files changed
Lines changed: 7171 additions & 7083 deletions
File tree
- pkg
- executor
- test/passwordtest
- parser
- ast
- util/dbterror/exeerrors
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1649 | 1649 | | |
1650 | 1650 | | |
1651 | 1651 | | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
1652 | 1662 | | |
1653 | 1663 | | |
1654 | 1664 | | |
| |||
2493 | 2503 | | |
2494 | 2504 | | |
2495 | 2505 | | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
2496 | 2511 | | |
2497 | 2512 | | |
2498 | 2513 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
989 | 989 | | |
990 | 990 | | |
991 | 991 | | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
992 | 1021 | | |
993 | 1022 | | |
994 | 1023 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1554 | 1554 | | |
1555 | 1555 | | |
1556 | 1556 | | |
1557 | | - | |
| 1557 | + | |
1558 | 1558 | | |
1559 | 1559 | | |
1560 | 1560 | | |
| |||
1592 | 1592 | | |
1593 | 1593 | | |
1594 | 1594 | | |
1595 | | - | |
| 1595 | + | |
1596 | 1596 | | |
1597 | | - | |
| 1597 | + | |
1598 | 1598 | | |
1599 | 1599 | | |
1600 | 1600 | | |
| |||
1725 | 1725 | | |
1726 | 1726 | | |
1727 | 1727 | | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
1728 | 1735 | | |
1729 | | - | |
1730 | | - | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
1731 | 1741 | | |
1732 | 1742 | | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
1733 | 1764 | | |
1734 | 1765 | | |
1735 | 1766 | | |
| |||
1770 | 1801 | | |
1771 | 1802 | | |
1772 | 1803 | | |
1773 | | - | |
1774 | | - | |
1775 | | - | |
1776 | | - | |
1777 | 1804 | | |
1778 | 1805 | | |
1779 | 1806 | | |
| |||
0 commit comments