raghav-reglobe opened a new pull request, #70349:
URL: https://github.com/apache/doris/pull/70349

   ### What problem does this PR solve?
   
   Issue Number: close #70340
   
   Related PR: #67792
   
   Problem Summary:
   
   Since #67792 (durable `ACCOUNT_LOCK` / `ACCOUNT_UNLOCK`) the password policy 
reports nine rows — it added `password_policy.account_locked` — while `Auth` 
copied the rows into `mysql.user` only `if (passWordPolicyInfo.size() == 8)`. 
The guard never held again, so every `password_policy.*` column of `mysql.user` 
read empty for every user: `expiration_seconds`, `password_creation_time`, 
`history_num`, `num_failed_login`, `password_lock_seconds`, 
`failed_login_counter`, `lock_time`.
   
   ```sql
   CREATE USER u1 IDENTIFIED BY 'p1' FAILED_LOGIN_ATTEMPTS 3 PASSWORD_LOCK_TIME 
1 DAY;
   SELECT `password_policy.num_failed_login`, 
`password_policy.password_lock_seconds` FROM mysql.user WHERE User = 'u1';
   -- before: '' / ''      after: 3 / 86400
   ```
   
   Fix: the columns are filled by row name, in `MysqlDBTable`'s column order 
(`PasswordPolicy.MYSQL_USER_COLUMNS` lists them), so a policy row added later 
cannot blank the existing ones again; and the administrative lock gets a column 
of its own, `password_policy.account_locked` (`true` / `false`), which until 
now could only be read from the trailing `ACCOUNT_LOCK` of `SHOW CREATE USER`. 
`history_passwords` stays masked as before.
   
   ### Release note
   
   Fix `mysql.user` showing empty `password_policy.*` columns for every user 
(since #67792), and add `password_policy.account_locked` to `mysql.user`.
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [x] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   `AccountLockTest.testMysqlUserCarriesThePolicyColumnsAndTheLock`: a user 
created with `FAILED_LOGIN_ATTEMPTS 3 PASSWORD_LOCK_TIME 1 DAY` reads `3` / 
`86400` / `0` in `mysql.user`, `history_passwords` stays masked, and 
`account_locked` follows `ACCOUNT_LOCK` / `ACCOUNT_UNLOCK`.
   
   - Behavior changed:
       - [ ] No.
       - [x] Yes. `mysql.user` gains the column 
`password_policy.account_locked` (appended last).
   
   - Does this need documentation?
       - [ ] No.
       - [x] Yes. The `mysql.user` column list gains 
`password_policy.account_locked`.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to