mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
make sure reset authentication methods can only be used on alter queries
This commit is contained in:
parent
026fa0a7fd
commit
3247f3ad08
@ -561,6 +561,11 @@ bool ParserCreateUserQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
|
||||
if (!reset_authentication_methods_to_new.has_value())
|
||||
{
|
||||
reset_authentication_methods_to_new = parseResetAuthenticationMethods(pos, expected);
|
||||
|
||||
if (reset_authentication_methods_to_new.value() && !alter)
|
||||
{
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "RESET AUTHENTICATION METHODS TO NEW can only be used on ALTER statement");
|
||||
}
|
||||
}
|
||||
|
||||
if (!valid_until)
|
||||
|
@ -51,3 +51,5 @@ Trailing comma should result in syntax error
|
||||
SYNTAX_ERROR
|
||||
First auth method can't specify type if WITH keyword is not present
|
||||
SYNTAX_ERROR
|
||||
RESET AUTHENTICATION METHODS TO NEW can only be used on alter statement
|
||||
BAD_ARGUMENTS
|
||||
|
@ -144,4 +144,7 @@ ${CLICKHOUSE_CLIENT} --query "ALTER USER ${user} ADD IDENTIFIED WITH plaintext_p
|
||||
echo "First auth method can't specify type if WITH keyword is not present"
|
||||
${CLICKHOUSE_CLIENT} --query "CREATE USER ${user} IDENTIFIED plaintext_password by '1'" 2>&1 | grep -m1 -o "SYNTAX_ERROR"
|
||||
|
||||
echo "RESET AUTHENTICATION METHODS TO NEW can only be used on alter statement"
|
||||
${CLICKHOUSE_CLIENT} --query "CREATE USER ${user} RESET AUTHENTICATION METHODS TO NEW" 2>&1 | grep -m1 -o "BAD_ARGUMENTS"
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query "DROP USER IF EXISTS ${user}"
|
||||
|
Loading…
Reference in New Issue
Block a user