diff --git a/Dockerfile/dockerfile.bbsd b/Dockerfile/dockerfile.bbsd index 054d0ea0..864c62e0 100644 --- a/Dockerfile/dockerfile.bbsd +++ b/Dockerfile/dockerfile.bbsd @@ -1,7 +1,5 @@ # Stage for Build -FROM debian:13-slim - -ARG LBBS_HOME_DIR=/usr/local/lbbs +FROM debian:13-slim AS builder RUN apt-get update && apt-get install -y \ gcc make gdb autoconf automake libtool pkg-config \ @@ -13,7 +11,7 @@ COPY ./ /home/lbbs_src WORKDIR /home/lbbs_src RUN autoreconf --install --force -RUN ./configure --prefix=${LBBS_HOME_DIR} \ +RUN ./configure --prefix=/usr/local/lbbs \ && make && make install # Stage for Runtime @@ -38,6 +36,6 @@ RUN apt-get update && apt-get install -y \ # Copy the custom configuration file COPY ./Dockerfile/php.ini /usr/local/etc/php/php.ini -COPY --from=0 /usr/local/lbbs /usr/local/lbbs +COPY --from=builder /usr/local/lbbs /usr/local/lbbs -WORKDIR ${LBBS_HOME_DIR} +WORKDIR /usr/local/lbbs diff --git a/INSTALL.md b/INSTALL.md index 2b17c0c6..dc0d44ef 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -53,9 +53,9 @@ To install LBBS on Linux (e.g. Debian 13, CentOS Stream 10), please perform the sudo -u bbs php $LBBS_HOME_DIR/utils/bin/gen_top.php 10) Create SSH2 RSA / ED25519 certificate - ssh-keygen -t rsa -C "Your Server Name" -f $LBBS_HOME_DIR/conf/ssh_host_rsa_key - ssh-keygen -t ed25519 -C "Your Server Name" -f $LBBS_HOME_DIR/conf/ssh_host_ed25519_key - ssh-keygen -t ecdsa -C "Your Server Name" -f $LBBS_HOME_DIR/conf/ssh_host_ecdsa_key + ssh-keygen -t rsa -C "Your Server Name" -N "" -f $LBBS_HOME_DIR/conf/ssh_host_rsa_key + ssh-keygen -t ed25519 -C "Your Server Name" -N "" -f $LBBS_HOME_DIR/conf/ssh_host_ed25519_key + ssh-keygen -t ecdsa -C "Your Server Name" -N "" -f $LBBS_HOME_DIR/conf/ssh_host_ecdsa_key 11) Startup sudo -u bbs $LBBS_HOME_DIR/bin/bbsd diff --git a/INSTALL.zh_CN.md b/INSTALL.zh_CN.md index 19e07e53..d0ff5c2d 100644 --- a/INSTALL.zh_CN.md +++ b/INSTALL.zh_CN.md @@ -52,9 +52,9 @@ 8) 将MySQL服务器的CA证书文件,复制到$LBBS_HOME_DIR/conf/ca_cert.pem 9) 创建SSH2 RSA / ED25519 证书 - ssh-keygen -t rsa -C "Your Server Name" -f $LBBS_HOME_DIR/conf/ssh_host_rsa_key - ssh-keygen -t ed25519 -C "Your Server Name" -f $LBBS_HOME_DIR/conf/ssh_host_ed25519_key - ssh-keygen -t ecdsa -C "Your Server Name" -f $LBBS_HOME_DIR/conf/ssh_host_ecdsa_key + ssh-keygen -t rsa -C "Your Server Name" -N "" -f $LBBS_HOME_DIR/conf/ssh_host_rsa_key + ssh-keygen -t ed25519 -C "Your Server Name" -N "" -f $LBBS_HOME_DIR/conf/ssh_host_ed25519_key + ssh-keygen -t ecdsa -C "Your Server Name" -N "" -f $LBBS_HOME_DIR/conf/ssh_host_ecdsa_key 10) 启动服务程序 sudo -u bbs $LBBS_HOME_DIR/bin/bbsd diff --git a/configure.ac b/configure.ac index 9c22cfdd..45da5d58 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([lbbs],[1.7.1]) +AC_INIT([lbbs],[1.7.2]) AC_CONFIG_SRCDIR([src/]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIRS([m4]) diff --git a/src/memory_pool.c b/src/memory_pool.c index 8d086cdf..34de2272 100644 --- a/src/memory_pool.c +++ b/src/memory_pool.c @@ -80,16 +80,19 @@ inline static void *memory_pool_add_chunk(MEMORY_POOL *p_pool) void *p_chunk; void *p_node; size_t i; + size_t chunk_size; if (p_pool->chunk_count >= p_pool->chunk_count_limit) { log_error("Chunk count limit %d reached", p_pool->chunk_count); return NULL; } - p_chunk = malloc(p_pool->node_size * p_pool->node_count_per_chunk); + + chunk_size = p_pool->node_size * p_pool->node_count_per_chunk; + p_chunk = malloc(chunk_size); if (p_chunk == NULL) { - log_error("malloc(%d * %d) error: OOM", p_pool->node_size, p_pool->node_count_per_chunk); + log_error("malloc(%zu) error: OOM", chunk_size); return NULL; } @@ -180,7 +183,7 @@ int memory_pool_check_node(MEMORY_POOL *p_pool, void *p_node) else { log_error("Address of node (%p) is not aligned with border of chunk %d [%p, %p)", - i, p_node >= p_pool->p_chunks[i], (char *)(p_pool->p_chunks[i]) + chunk_size); + p_node, i, p_pool->p_chunks[i], (char *)(p_pool->p_chunks[i]) + chunk_size); return -3; } } diff --git a/utils/bin/gen_ex_list.php b/utils/bin/gen_ex_list.php index addf433d..0ed91196 100644 --- a/utils/bin/gen_ex_list.php +++ b/utils/bin/gen_ex_list.php @@ -90,7 +90,7 @@ function gen_ex_dir(mysqli $db_conn, int $sid, int $fid = 0, string $dir = "", s if (!isset($_SERVER["argc"])) { echo ("Invalid usage"); - exit(); + exit(-1); } chdir(dirname($_SERVER["argv"][0])); @@ -138,7 +138,7 @@ function gen_ex_dir(mysqli $db_conn, int $sid, int $fid = 0, string $dir = "", s if ($rs == false) { echo ("Query section error: " . mysqli_error($db_conn)); - exit(); + exit(-2); } while ($row = mysqli_fetch_array($rs)) @@ -155,7 +155,7 @@ function gen_ex_dir(mysqli $db_conn, int $sid, int $fid = 0, string $dir = "", s if ($ret == false) { echo ("Update tm error: " . mysqli_error($db_conn)); - exit(); + exit(-3); } } else diff --git a/utils/bin/gen_section_menu.php b/utils/bin/gen_section_menu.php index 1a7ec989..273ecd36 100644 --- a/utils/bin/gen_section_menu.php +++ b/utils/bin/gen_section_menu.php @@ -2,7 +2,7 @@ if (!isset($_SERVER["argc"])) { echo ("Invalid usage"); - exit(); + exit(-1); } chdir(dirname($_SERVER["argv"][0])); @@ -18,7 +18,7 @@ if ($buffer == false) { echo "Unable to load menu config file " . $menu_input_path . "\n"; - exit(); + exit(-2); } // Load section list @@ -84,7 +84,7 @@ function (array $section, array $filter_param) : mixed if ($ret == false) { echo "Query section list error: " . mysqli_error($db_conn); - exit(); + exit(-3); } // Generate menu of section class @@ -229,7 +229,7 @@ function (array $section, array $filter_param) : mixed if ($ret == false) { echo "Query excerptional section list error: " . mysqli_error($db_conn); - exit(); + exit(-3); } // Generate menu of excerptional section class diff --git a/utils/bin/gen_top.php b/utils/bin/gen_top.php index 6db66f37..c0c07851 100644 --- a/utils/bin/gen_top.php +++ b/utils/bin/gen_top.php @@ -2,7 +2,7 @@ if (!isset($_SERVER["argc"])) { echo ("Invalid usage"); - exit(); + exit(-1); } chdir(dirname($_SERVER["argv"][0])); @@ -43,7 +43,7 @@ if ($rs == false) { echo("Query data error: " . mysqli_error($db_conn)); - exit(); + exit(-2); } $i = 1; diff --git a/utils/lib/db_open.inc.php b/utils/lib/db_open.inc.php index 4b653864..fd532ebc 100644 --- a/utils/lib/db_open.inc.php +++ b/utils/lib/db_open.inc.php @@ -37,6 +37,6 @@ function db_open($sql_charset = "utf8") if ($db_conn == NULL) { - exit(); + exit(-1); } }