From 23c2d987bdfafd1376fea48e9a82072380ca09e6 Mon Sep 17 00:00:00 2001 From: rstyp <06chilled_ponchos@icloud.com> Date: Fri, 21 Feb 2025 13:38:21 -0800 Subject: [PATCH] Update error code --- fe/fe-core/src/main/java/com/starrocks/common/ErrorCode.java | 3 ++- fe/fe-core/src/main/java/com/starrocks/mysql/MysqlProto.java | 4 ++-- .../src/main/java/com/starrocks/mysql/NegotiateState.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/com/starrocks/common/ErrorCode.java b/fe/fe-core/src/main/java/com/starrocks/common/ErrorCode.java index dab517e8791f3..d70e10f195d2f 100644 --- a/fe/fe-core/src/main/java/com/starrocks/common/ErrorCode.java +++ b/fe/fe-core/src/main/java/com/starrocks/common/ErrorCode.java @@ -106,7 +106,6 @@ public enum ErrorCode { ERR_NO_SUCH_QUERY(1365, new byte[] {'4', '2', '0', '0', '0'}, "Unknown query id: %s"), ERR_CANNOT_USER(1396, new byte[] {'H', 'Y', '0', '0', '0'}, "Operation %s failed for %s"), - ERR_SECURE_TRANSPORT_REQUIRED(1403, new byte[] {'0', '8', '0', '0', '4'}, "Server rejected the insecure connection"), ERR_NON_INSERTABLE_TABLE(1471, new byte[] {'H', 'Y', '0', '0', '0'}, "The target table %s of the %s is not insertable-into"), ERR_DROP_PARTITION_NON_EXISTENT(1507, new byte[] {'H', 'Y', '0', '0', '0'}, @@ -123,6 +122,8 @@ public enum ErrorCode { ERR_EMPTY_PARTITION_IN_TABLE(1748, new byte[] {'H', 'Y', '0', '0', '0'}, "data cannot be inserted into table with empty partition. " + "Use `SHOW PARTITIONS FROM %s` to see the currently partitions of this table. "), + ERR_SECURE_TRANSPORT_REQUIRED(3159, new byte[] {'H', 'Y', '0', '0', '0'}, + "Connections using insecure transport are prohibited"), // Following is StarRocks's error code, which start from 5000 ERR_WRONG_PROC_PATH(5001, new byte[] {'H', 'Y', '0', '0', '0'}, "Proc path '%s' doesn't exist"), diff --git a/fe/fe-core/src/main/java/com/starrocks/mysql/MysqlProto.java b/fe/fe-core/src/main/java/com/starrocks/mysql/MysqlProto.java index 0ee996c046a33..55eedff5eb0bd 100644 --- a/fe/fe-core/src/main/java/com/starrocks/mysql/MysqlProto.java +++ b/fe/fe-core/src/main/java/com/starrocks/mysql/MysqlProto.java @@ -140,10 +140,10 @@ public static NegotiateResult negotiate(ConnectContext context) throws IOExcepti } if (Config.require_secure_transport && !authPacket.isSSLConnRequest()) { - LOG.debug("server refused insecure client connection"); + LOG.warn("Connections using insecure transport are prohibited"); ErrorReport.report(ErrorCode.ERR_SECURE_TRANSPORT_REQUIRED); sendResponsePacket(context); - return new NegotiateResult(null, NegotiateState.SERVER_REJECTED_INSECURE_CONNECTION); + return new NegotiateResult(null, NegotiateState.INSECURE_TRANSPORT_PROHIBITED); } if (authPacket.isSSLConnRequest()) { diff --git a/fe/fe-core/src/main/java/com/starrocks/mysql/NegotiateState.java b/fe/fe-core/src/main/java/com/starrocks/mysql/NegotiateState.java index 4bbf1b3aa7d59..ffbce5420c6b7 100644 --- a/fe/fe-core/src/main/java/com/starrocks/mysql/NegotiateState.java +++ b/fe/fe-core/src/main/java/com/starrocks/mysql/NegotiateState.java @@ -20,7 +20,7 @@ public enum NegotiateState { READ_AUTH_SWITCH_PKG_FAILED("read auth switch package failed"), ENABLE_SSL_FAILED("enable ssl failed"), READ_SSL_AUTH_PKG_FAILED("read ssl auth package failed"), - SERVER_REJECTED_INSECURE_CONNECTION("server rejected the insecure connection"), + INSECURE_TRANSPORT_PROHIBITED("Connections using insecure transport are prohibited"), NOT_SUPPORTED_AUTH_MODE("not supported auth mode"), KERBEROS_HANDSHAKE_FAILED("kerberos handshake failed"), KERBEROS_PLUGIN_NOT_LOADED("kerberos plugin not loaded"),