--- lbbs/src/net_server.c 2025/06/07 08:33:08 1.57 +++ lbbs/src/net_server.c 2025/06/23 08:47:56 1.64 @@ -14,38 +14,35 @@ * * ***************************************************************************/ -#define _XOPEN_SOURCE 500 -#define _POSIX_C_SOURCE 200809L -#define _GNU_SOURCE - -#include "net_server.h" -#include "common.h" -#include "bbs_main.h" #include "bbs.h" -#include "log.h" +#include "bbs_main.h" +#include "common.h" +#include "database.h" +#include "file_loader.h" #include "io.h" #include "init.h" -#include "menu.h" -#include "database.h" +#include "log.h" #include "login.h" -#include "file_loader.h" +#include "menu.h" +#include "net_server.h" #include "section_list_loader.h" #include #include -#include #include #include +#include #include -#include -#include -#include -#include #include -#include -#include +#include #include #include -#include +#include +#include +#include +#include +#include +#include +#include struct process_sockaddr_t { @@ -56,7 +53,7 @@ typedef struct process_sockaddr_t PROCES static PROCESS_SOCKADDR process_sockaddr_pool[MAX_CLIENT_LIMIT]; -#define SSH_AUTH_MAX_DURATION 60 // seconds +#define SSH_AUTH_MAX_DURATION (60 * 1000) // milliseconds struct ssl_server_cb_data_t { @@ -185,9 +182,9 @@ static int fork_server(void) event = ssh_event_new(); ssh_event_add_session(event, SSH_session); - for (i = 0; i < SSH_AUTH_MAX_DURATION && !SYS_server_exit && !cb_data.error && SSH_channel == NULL; i++) + for (i = 0; i < SSH_AUTH_MAX_DURATION && !SYS_server_exit && !cb_data.error && SSH_channel == NULL; i += 100) { - ret = ssh_event_dopoll(event, 1000); // 1 second + ret = ssh_event_dopoll(event, 100); // 0.1 second if (ret == SSH_ERROR) { log_error("ssh_event_dopoll() error: %s\n", ssh_get_error(SSH_session)); @@ -273,6 +270,7 @@ int net_server(const char *hostaddr, in_ if (ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDADDR, hostaddr) < 0 || ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDPORT, &port) < 0 || ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, SSH_HOST_KEYFILE) < 0 || + ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY_ALGORITHMS, "ssh-rsa,rsa-sha2-512,rsa-sha2-256") < 0 || ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_LOG_VERBOSITY, &ssh_log_level) < 0) { log_error("Error setting SSH bind options: %s\n", ssh_get_error(sshbind)); @@ -525,7 +523,7 @@ int net_server(const char *hostaddr, in_ port_client = ntohs(sin.sin_port); - log_common("Accept %sconnection from %s:%d\n", (SSH_v2 ? "" : "SSH2 "), hostaddr_client, port_client); + log_common("Accept %s connection from %s:%d\n", (SSH_v2 ? "SSH" : "telnet"), hostaddr_client, port_client); if (SYS_child_process_count - 1 < BBS_max_client) {