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

ssl supplyment: fix checkstyle #3893

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -860,10 +860,10 @@ public void handleSSLData(ByteBuffer dataBuffer) throws IOException {
return;
}
int offset = 0;
SSLProtoHandler proto = new SSLProtoHandler(this);
SSLProtoHandler sslProtoHandler = new SSLProtoHandler(this);
boolean hasRemaining = true;
while (hasRemaining) {
ProtoHandlerResult result = proto.handle(dataBuffer, offset, false, true);
ProtoHandlerResult result = sslProtoHandler.handle(dataBuffer, offset, false, true);
switch (result.getCode()) {
case SSL_PROTO_PACKET:
case SSL_CLOSE_PACKET:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.actiontech.dble.backend.pool.PooledConnectionListener;
import com.actiontech.dble.backend.pool.ReadTimeStatusInstance;
import com.actiontech.dble.buffer.BufferType;
import com.actiontech.dble.config.model.SystemConfig;
import com.actiontech.dble.config.model.db.DbInstanceConfig;
import com.actiontech.dble.net.IOProcessor;
import com.actiontech.dble.net.SocketWR;
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/com/actiontech/dble/net/connection/SSLHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public void sendhandShake() throws SSLException {
default:
throw new IllegalStateException("unknown handshake status: " + handshakeStatus);
}

} catch (SSLException e) {
LOGGER.warn("during the handshake, unwrap data exception: ", e);
con.close("during the handshake, unwrap data fail");
Expand All @@ -90,14 +89,14 @@ private void unwrapNonAppData(byte[] data) {

try {

final SSLEngineResult result = unwrap(engine, in);
final Status status = result.getStatus();
final SSLEngineResult result = unwrap(engine, in);
final Status status = result.getStatus();

final int produced = result.bytesProduced();
final int consumed = result.bytesConsumed();
if (status == Status.CLOSED) {
return;
}
final int produced = result.bytesProduced();
final int consumed = result.bytesConsumed();
if (status == Status.CLOSED) {
return;
}
for (; ; ) {
final SSLEngineResult.HandshakeStatus handshakeStatus = engine.getHandshakeStatus();
switch (handshakeStatus) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* Create Date: 2024-12-05
*/
public interface IOpenSSLWrapper {
public SSLEngine createClientSSLEngine();
SSLEngine createClientSSLEngine();

public boolean initContext();
boolean initContext();

public SSLEngine createServerSSLEngine(boolean isAuthClient);
SSLEngine createServerSSLEngine(boolean isAuthClient);
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ private void handleHandshake(byte[] data) {
String serverPlugin = new String(handshakePacket.getAuthPluginName());
try {
pluginName = PluginName.valueOf(serverPlugin);
if (connection.isSupportSSL()) {//todo:move config in dbinstance scope
if (connection.isSupportSSL()) {
//todo:move config in dbinstance scope
sendSSLRequestPacket(++data[3]);
connection.sendSSLHandShake(OpenSSLWrapper.PROTOCOL);
} else {
Expand Down
Loading