Skip to content
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM jumpserver/chen-base:20241212_102050 AS stage-build
FROM jumpserver/chen-base:20250708_060644 AS stage-build
ENV LANG=en_US.UTF-8

WORKDIR /opt/chen/
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile-base
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN set -ex \
&& chmod 755 /usr/local/bin/check \
&& rm -f check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz

ARG WISP_VERSION=v0.2.5
ARG WISP_VERSION=v0.2.7
RUN set -ex \
&& wget https://github.com/jumpserver/wisp/releases/download/${WISP_VERSION}/wisp-${WISP_VERSION}-linux-${TARGETARCH}.tar.gz \
&& tar -xf wisp-${WISP_VERSION}-linux-${TARGETARCH}.tar.gz -C /usr/local/bin/ --strip-components=1 \
Expand All @@ -43,7 +43,7 @@ RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=che
npm install

# Install Maven dependencies
ARG MAVEN_VERSION=3.9.9
ARG MAVEN_VERSION=3.9.10
ARG USER_HOME_DIR="/root"
ARG BASE_URL=https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries
ARG MAVEN_MIRROR=https://repo.maven.apache.org/maven2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

@Slf4j
Expand Down Expand Up @@ -214,8 +215,14 @@ private void handleSQLChunk(QueryConsoleAction action) {
*/
private void handleSQLComplete() {
try {

// 等待所有分段接收完成
latch.await();
boolean completed = latch.await(10, TimeUnit.SECONDS); // 超时10秒

if (!completed) {
this.getConsoleLogger().error("read sql message timeout!!");
return;
}

// 按照索引顺序合并所有分段
StringBuilder sqlBuilder = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ private void executeStatement(SQLExecutePlan plan, Statement statement, SQLQuery
fs.add(HexUtils.bytesToHex((byte[]) obj));
} else if (obj instanceof Blob) {
fs.add(HexUtils.bytesToHex(((Blob) obj).getBytes(1, (int) ((Blob) obj).length())));
} else if (obj!= null && obj.getClass().getSimpleName().equalsIgnoreCase("pgobject")) {
fs.add(obj.toString());
} else {
fs.add(obj);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
import org.jumpserver.chen.framework.datasource.sql.SQL;
import org.jumpserver.chen.modules.base.ssl.JKSGenerator;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Properties;

public class MysqlConnectionManager extends BaseConnectionManager {
Expand All @@ -33,6 +38,34 @@ public void ping() throws SQLException {
}


@Override
public Connection getConnection() throws SQLException {
var conn = super.getConnection();
setTimeZone(conn);
return conn;
}

@Override
public Connection getPhysicalConnection() throws SQLException {
var conn = super.getPhysicalConnection();
setTimeZone(conn);
return conn;
}

private void setTimeZone(Connection conn) throws SQLException {
ZoneId zoneId = ZoneId.systemDefault();

ZonedDateTime now = ZonedDateTime.now(zoneId);
ZoneOffset offset = now.getOffset();

String offsetStr = offset.toString();

try (Statement stmt = conn.createStatement()) {
stmt.execute("SET time_zone = '" + offsetStr + "'");
}
}


protected void setSSLProps(Properties props) {
if (this.getConnectInfo().getOptions().get("useSSL") != null
&& (boolean) this.getConnectInfo().getOptions().get("useSSL")) {
Expand Down