/[LeafOK_CVS]/lbbs/src/net_server.c
ViewVC logotype

Diff of /lbbs/src/net_server.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.59 by sysadm, Mon Jun 16 14:32:25 2025 UTC Revision 1.80 by sysadm, Fri Nov 7 04:58:09 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /* SPDX-License-Identifier: GPL-3.0-or-later */
2                                                    net_server.c  -  description  /*
3                                                           -------------------   * net_server
4          Copyright            : (C) 2004-2025 by Leaflet   *   - network server with SSH support
5          Email                : leaflet@leafok.com   *
6   ***************************************************************************/   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7     */
 /***************************************************************************  
  *                                                                         *  
  *   This program is free software; you can redistribute it and/or modify  *  
  *   it under the terms of the GNU General Public License as published by  *  
  *   the Free Software Foundation; either version 3 of the License, or     *  
  *   (at your option) any later version.                                   *  
  *                                                                         *  
  ***************************************************************************/  
   
 #define _XOPEN_SOURCE 500  
 #define _POSIX_C_SOURCE 200809L  
 #define _GNU_SOURCE  
8    
 #include "net_server.h"  
 #include "common.h"  
 #include "bbs_main.h"  
9  #include "bbs.h"  #include "bbs.h"
10  #include "log.h"  #include "bbs_main.h"
11    #include "bwf.h"
12    #include "common.h"
13    #include "database.h"
14    #include "file_loader.h"
15  #include "io.h"  #include "io.h"
16  #include "init.h"  #include "init.h"
17  #include "menu.h"  #include "log.h"
 #include "database.h"  
18  #include "login.h"  #include "login.h"
19  #include "file_loader.h"  #include "menu.h"
20    #include "net_server.h"
21    #include "section_list.h"
22  #include "section_list_loader.h"  #include "section_list_loader.h"
23  #include <errno.h>  #include <errno.h>
24  #include <fcntl.h>  #include <fcntl.h>
25  #include <string.h>  #include <pty.h>
26  #include <signal.h>  #include <signal.h>
27  #include <stdlib.h>  #include <stdlib.h>
28    #include <string.h>
29  #include <unistd.h>  #include <unistd.h>
30  #include <sys/syscall.h>  #include <utmp.h>
 #include <sys/socket.h>  
 #include <sys/wait.h>  
 #include <sys/epoll.h>  
31  #include <arpa/inet.h>  #include <arpa/inet.h>
32  #include <netinet/in.h>  #include <libssh/callbacks.h>
 #include <systemd/sd-daemon.h>  
33  #include <libssh/libssh.h>  #include <libssh/libssh.h>
34  #include <libssh/server.h>  #include <libssh/server.h>
35  #include <libssh/callbacks.h>  #include <netinet/in.h>
36    #include <sys/epoll.h>
37    #include <sys/socket.h>
38    #include <sys/syscall.h>
39    #include <sys/types.h>
40    #include <sys/wait.h>
41    #include <systemd/sd-daemon.h>
42    
43    enum _net_server_constant_t
44    {
45            WAIT_CHILD_PROCESS_EXIT_TIMEOUT = 5, // second
46            WAIT_CHILD_PROCESS_KILL_TIMEOUT = 1, // second
47    
48            SSH_AUTH_MAX_DURATION = 60 * 1000, // milliseconds
49    };
50    
51  struct process_sockaddr_t  struct process_sockaddr_t
52  {  {
# Line 56  typedef struct process_sockaddr_t PROCES Line 57  typedef struct process_sockaddr_t PROCES
57    
58  static PROCESS_SOCKADDR process_sockaddr_pool[MAX_CLIENT_LIMIT];  static PROCESS_SOCKADDR process_sockaddr_pool[MAX_CLIENT_LIMIT];
59    
60  #define SSH_AUTH_MAX_DURATION (60 * 1000) // milliseconds  static const char SFTP_SERVER_PATH[] = "/usr/lib/sftp-server";
61    
62  struct ssl_server_cb_data_t  /* A userdata struct for session. */
63    struct session_data_struct
64  {  {
65          int tries;          int tries;
66          int error;          int error;
67  };  };
68    
69    /* A userdata struct for channel. */
70    struct channel_data_struct
71    {
72            /* pid of the child process the channel will spawn. */
73            pid_t pid;
74            /* For PTY allocation */
75            socket_t pty_master;
76            socket_t pty_slave;
77            /* For communication with the child process. */
78            socket_t child_stdin;
79            socket_t child_stdout;
80            /* Only used for subsystem and exec requests. */
81            socket_t child_stderr;
82            /* Event which is used to poll the above descriptors. */
83            ssh_event event;
84            /* Terminal size struct. */
85            struct winsize *winsize;
86    };
87    
88  static int auth_password(ssh_session session, const char *user,  static int auth_password(ssh_session session, const char *user,
89                                                   const char *password, void *userdata)                                                   const char *password, void *userdata)
90  {  {
91          struct ssl_server_cb_data_t *p_data = userdata;          struct session_data_struct *sdata = (struct session_data_struct *)userdata;
92          int ret;          int ret;
93    
94          if (strcmp(user, "guest") == 0)          if (strcmp(user, "guest") == 0)
# Line 84  static int auth_password(ssh_session ses Line 105  static int auth_password(ssh_session ses
105                  return SSH_AUTH_SUCCESS;                  return SSH_AUTH_SUCCESS;
106          }          }
107    
108          if ((++(p_data->tries)) >= BBS_login_retry_times)          if ((++(sdata->tries)) >= BBS_login_retry_times)
109          {          {
110                  p_data->error = 1;                  sdata->error = 1;
111          }          }
112    
113          return SSH_AUTH_DENIED;          return SSH_AUTH_DENIED;
114  }  }
115    
116  static int pty_request(ssh_session session, ssh_channel channel, const char *term,  static int pty_request(ssh_session session, ssh_channel channel, const char *term,
117                                             int x, int y, int px, int py, void *userdata)                                             int cols, int rows, int px, int py, void *userdata)
118  {  {
119          return 0;          struct channel_data_struct *cdata = (struct channel_data_struct *)userdata;
120            int rc;
121    
122            (void)session;
123            (void)channel;
124            (void)term;
125    
126            cdata->winsize->ws_row = (unsigned short int)rows;
127            cdata->winsize->ws_col = (unsigned short int)cols;
128            cdata->winsize->ws_xpixel = (unsigned short int)px;
129            cdata->winsize->ws_ypixel = (unsigned short int)py;
130    
131            rc = openpty(&cdata->pty_master, &cdata->pty_slave, NULL, NULL, cdata->winsize);
132            if (rc != 0)
133            {
134                    log_error("Failed to open pty\n");
135                    return SSH_ERROR;
136            }
137    
138            return SSH_OK;
139    }
140    
141    static int pty_resize(ssh_session session, ssh_channel channel, int cols, int rows,
142                                              int py, int px, void *userdata)
143    {
144            struct channel_data_struct *cdata = (struct channel_data_struct *)userdata;
145    
146            (void)session;
147            (void)channel;
148    
149            cdata->winsize->ws_row = (unsigned short int)rows;
150            cdata->winsize->ws_col = (unsigned short int)cols;
151            cdata->winsize->ws_xpixel = (unsigned short int)px;
152            cdata->winsize->ws_ypixel = (unsigned short int)py;
153    
154            if (cdata->pty_master != -1)
155            {
156                    return ioctl(cdata->pty_master, TIOCSWINSZ, cdata->winsize);
157            }
158    
159            return SSH_ERROR;
160    }
161    
162    static int exec_pty(const char *mode, const char *command, struct channel_data_struct *cdata)
163    {
164            (void)cdata;
165    
166            if (command != NULL)
167            {
168                    log_error("Forbid exec /bin/sh %s %s)\n", mode, command);
169            }
170    
171            return SSH_OK;
172    }
173    
174    static int exec_nopty(const char *command, struct channel_data_struct *cdata)
175    {
176            (void)cdata;
177    
178            if (command != NULL)
179            {
180                    log_error("Forbid exec /bin/sh -c %s)\n", command);
181            }
182    
183            return SSH_OK;
184    }
185    
186    static int exec_request(ssh_session session, ssh_channel channel, const char *command, void *userdata)
187    {
188            struct channel_data_struct *cdata = (struct channel_data_struct *)userdata;
189    
190            (void)session;
191            (void)channel;
192    
193            if (cdata->pid > 0)
194            {
195                    return SSH_ERROR;
196            }
197    
198            if (cdata->pty_master != -1 && cdata->pty_slave != -1)
199            {
200                    return exec_pty("-c", command, cdata);
201            }
202            return exec_nopty(command, cdata);
203  }  }
204    
205  static int shell_request(ssh_session session, ssh_channel channel, void *userdata)  static int shell_request(ssh_session session, ssh_channel channel, void *userdata)
206  {  {
207          return 0;          struct channel_data_struct *cdata = (struct channel_data_struct *)userdata;
208    
209            (void)session;
210            (void)channel;
211    
212            if (cdata->pid > 0)
213            {
214                    return SSH_ERROR;
215            }
216    
217            if (cdata->pty_master != -1 && cdata->pty_slave != -1)
218            {
219                    return exec_pty("-l", NULL, cdata);
220            }
221            /* Client requested a shell without a pty, let's pretend we allow that */
222            return SSH_OK;
223  }  }
224    
225  static struct ssh_channel_callbacks_struct channel_cb = {  static int subsystem_request(ssh_session session, ssh_channel channel, const char *subsystem, void *userdata)
226          .channel_pty_request_function = pty_request,  {
227          .channel_shell_request_function = shell_request};          (void)session;
228            (void)channel;
229    
230            log_error("subsystem_request(subsystem=%s)\n", subsystem);
231    
232            /* subsystem requests behave similarly to exec requests. */
233            if (strcmp(subsystem, "sftp") == 0)
234            {
235                    return exec_request(session, channel, SFTP_SERVER_PATH, userdata);
236            }
237            return SSH_ERROR;
238    }
239    
240  static ssh_channel new_session_channel(ssh_session session, void *userdata)  static ssh_channel channel_open(ssh_session session, void *userdata)
241  {  {
242            (void)userdata;
243    
244          if (SSH_channel != NULL)          if (SSH_channel != NULL)
245          {          {
246                  return NULL;                  return NULL;
247          }          }
248    
249          SSH_channel = ssh_channel_new(session);          SSH_channel = ssh_channel_new(session);
         ssh_callbacks_init(&channel_cb);  
         ssh_set_channel_callbacks(SSH_channel, &channel_cb);  
250    
251          return SSH_channel;          return SSH_channel;
252  }  }
# Line 124  static ssh_channel new_session_channel(s Line 254  static ssh_channel new_session_channel(s
254  static int fork_server(void)  static int fork_server(void)
255  {  {
256          ssh_event event;          ssh_event event;
257            long int ssh_timeout = 0;
258          int pid;          int pid;
259          int i;          int i;
260          int ret;          int ret;
261    
262          struct ssl_server_cb_data_t cb_data = {          /* Structure for storing the pty size. */
263            struct winsize wsize = {
264                    .ws_row = 0,
265                    .ws_col = 0,
266                    .ws_xpixel = 0,
267                    .ws_ypixel = 0};
268    
269            /* Our struct holding information about the channel. */
270            struct channel_data_struct cdata = {
271                    .pid = 0,
272                    .pty_master = -1,
273                    .pty_slave = -1,
274                    .child_stdin = -1,
275                    .child_stdout = -1,
276                    .child_stderr = -1,
277                    .event = NULL,
278                    .winsize = &wsize};
279    
280            struct session_data_struct cb_data = {
281                  .tries = 0,                  .tries = 0,
282                  .error = 0,                  .error = 0,
283          };          };
284    
285          struct ssh_server_callbacks_struct cb = {          struct ssh_channel_callbacks_struct channel_cb = {
286                    .userdata = &cdata,
287                    .channel_pty_request_function = pty_request,
288                    .channel_pty_window_change_function = pty_resize,
289                    .channel_shell_request_function = shell_request,
290                    .channel_exec_request_function = exec_request,
291                    .channel_subsystem_request_function = subsystem_request};
292    
293            struct ssh_server_callbacks_struct server_cb = {
294                  .userdata = &cb_data,                  .userdata = &cb_data,
295                  .auth_password_function = auth_password,                  .auth_password_function = auth_password,
296                  .channel_open_request_session_function = new_session_channel,                  .channel_open_request_session_function = channel_open,
297          };          };
298    
299          pid = fork();          pid = fork();
# Line 172  static int fork_server(void) Line 329  static int fork_server(void)
329    
330                  ssh_bind_free(sshbind);                  ssh_bind_free(sshbind);
331    
332                  ssh_callbacks_init(&cb);                  ssh_timeout = 60; // second
333                  ssh_set_server_callbacks(SSH_session, &cb);                  if (ssh_options_set(SSH_session, SSH_OPTIONS_TIMEOUT, &ssh_timeout) < 0)
334                    {
335                            log_error("Error setting SSH options: %s\n", ssh_get_error(SSH_session));
336                            goto cleanup;
337                    }
338    
339                    ssh_set_auth_methods(SSH_session, SSH_AUTH_METHOD_PASSWORD);
340    
341                    ssh_callbacks_init(&server_cb);
342                    ssh_callbacks_init(&channel_cb);
343    
344                    ssh_set_server_callbacks(SSH_session, &server_cb);
345    
346                  if (ssh_handle_key_exchange(SSH_session))                  if (ssh_handle_key_exchange(SSH_session))
347                  {                  {
348                          log_error("ssh_handle_key_exchange() error: %s\n", ssh_get_error(SSH_session));                          log_error("ssh_handle_key_exchange() error: %s\n", ssh_get_error(SSH_session));
349                          goto cleanup;                          goto cleanup;
350                  }                  }
                 ssh_set_auth_methods(SSH_session, SSH_AUTH_METHOD_PASSWORD);  
351    
352                  event = ssh_event_new();                  event = ssh_event_new();
353                  ssh_event_add_session(event, SSH_session);                  ssh_event_add_session(event, SSH_session);
# Line 190  static int fork_server(void) Line 357  static int fork_server(void)
357                          ret = ssh_event_dopoll(event, 100); // 0.1 second                          ret = ssh_event_dopoll(event, 100); // 0.1 second
358                          if (ret == SSH_ERROR)                          if (ret == SSH_ERROR)
359                          {                          {
360    #ifdef _DEBUG
361                                  log_error("ssh_event_dopoll() error: %s\n", ssh_get_error(SSH_session));                                  log_error("ssh_event_dopoll() error: %s\n", ssh_get_error(SSH_session));
362    #endif
363                                  goto cleanup;                                  goto cleanup;
364                          }                          }
365                  }                  }
# Line 200  static int fork_server(void) Line 369  static int fork_server(void)
369                          log_error("SSH auth error, tried %d times\n", cb_data.tries);                          log_error("SSH auth error, tried %d times\n", cb_data.tries);
370                          goto cleanup;                          goto cleanup;
371                  }                  }
372    
373                    ssh_set_channel_callbacks(SSH_channel, &channel_cb);
374    
375                    do
376                    {
377                            ret = ssh_event_dopoll(event, 100); // 0.1 second
378                            if (ret == SSH_ERROR)
379                            {
380                                    ssh_channel_close(SSH_channel);
381                            }
382    
383                            if (ret == SSH_AGAIN) // loop until SSH connection is fully established
384                            {
385                                    /* Executed only once, once the child process starts. */
386                                    cdata.event = event;
387                                    break;
388                            }
389                    } while (ssh_channel_is_open(SSH_channel));
390    
391                    ssh_timeout = 0;
392                    if (ssh_options_set(SSH_session, SSH_OPTIONS_TIMEOUT, &ssh_timeout) < 0)
393                    {
394                            log_error("Error setting SSH options: %s\n", ssh_get_error(SSH_session));
395                            goto cleanup;
396                    }
397          }          }
398    
399          // Redirect Input          // Redirect Input
# Line 228  cleanup: Line 422  cleanup:
422    
423          if (SSH_v2)          if (SSH_v2)
424          {          {
425                    close(cdata.pty_master);
426                    close(cdata.child_stdin);
427                    close(cdata.child_stdout);
428                    close(cdata.child_stderr);
429    
430                  ssh_channel_free(SSH_channel);                  ssh_channel_free(SSH_channel);
431                  ssh_disconnect(SSH_session);                  ssh_disconnect(SSH_session);
432          }          }
# Line 260  int net_server(const char *hostaddr, in_ Line 459  int net_server(const char *hostaddr, in_
459          struct epoll_event ev, events[MAX_EVENTS];          struct epoll_event ev, events[MAX_EVENTS];
460          int nfds, epollfd;          int nfds, epollfd;
461          siginfo_t siginfo;          siginfo_t siginfo;
462            int notify_child_exit = 0;
463            time_t tm_notify_child_exit = time(NULL);
464          int sd_notify_stopping = 0;          int sd_notify_stopping = 0;
465          MENU_SET *p_bbs_menu_new;          MENU_SET bbs_menu_new;
466            MENU_SET top10_menu_new;
467          int i, j;          int i, j;
468          pid_t pid;          pid_t pid;
469          int ssh_log_level = SSH_LOG_NOLOG;          int ssh_log_level = SSH_LOG_NOLOG;
# Line 273  int net_server(const char *hostaddr, in_ Line 475  int net_server(const char *hostaddr, in_
475          if (ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDADDR, hostaddr) < 0 ||          if (ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDADDR, hostaddr) < 0 ||
476                  ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDPORT, &port) < 0 ||                  ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDPORT, &port) < 0 ||
477                  ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, SSH_HOST_KEYFILE) < 0 ||                  ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, SSH_HOST_KEYFILE) < 0 ||
478                    ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY_ALGORITHMS, "ssh-rsa,rsa-sha2-512,rsa-sha2-256") < 0 ||
479                  ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_LOG_VERBOSITY, &ssh_log_level) < 0)                  ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_LOG_VERBOSITY, &ssh_log_level) < 0)
480          {          {
481                  log_error("Error setting SSH bind options: %s\n", ssh_get_error(sshbind));                  log_error("Error setting SSH bind options: %s\n", ssh_get_error(sshbind));
# Line 354  int net_server(const char *hostaddr, in_ Line 557  int net_server(const char *hostaddr, in_
557          {          {
558                  if (SYS_server_exit && !sd_notify_stopping)                  if (SYS_server_exit && !sd_notify_stopping)
559                  {                  {
                         signal(SIGHUP, SIG_IGN);  
   
560                          sd_notify(0, "STOPPING=1");                          sd_notify(0, "STOPPING=1");
561                          sd_notify_stopping = 1;                          sd_notify_stopping = 1;
562                  }                  }
# Line 403  int net_server(const char *hostaddr, in_ Line 604  int net_server(const char *hostaddr, in_
604    
605                  if (SYS_server_exit && !SYS_child_exit && SYS_child_process_count > 0)                  if (SYS_server_exit && !SYS_child_exit && SYS_child_process_count > 0)
606                  {                  {
607                          log_common("Notify %d child process to exit\n", SYS_child_process_count);                          if (notify_child_exit == 0)
                         if (kill(0, SIGTERM) < 0)  
608                          {                          {
609                                  log_error("Send SIGTERM signal failed (%d)\n", errno);                                  sd_notifyf(0, "STATUS=Notify %d child process to exit", SYS_child_process_count);
610                                    log_common("Notify %d child process to exit\n", SYS_child_process_count);
611    
612                                    if (kill(0, SIGTERM) < 0)
613                                    {
614                                            log_error("Send SIGTERM signal failed (%d)\n", errno);
615                                    }
616    
617                                    notify_child_exit = 1;
618                                    tm_notify_child_exit = time(NULL);
619                          }                          }
620                            else if (notify_child_exit == 1 && time(NULL) - tm_notify_child_exit >= WAIT_CHILD_PROCESS_EXIT_TIMEOUT)
621                            {
622                                    sd_notifyf(0, "STATUS=Kill %d child process", SYS_child_process_count);
623    
624                                    for (i = 0; i < BBS_max_client; i++)
625                                    {
626                                            if (process_sockaddr_pool[i].pid != 0)
627                                            {
628                                                    log_error("Kill child process (pid=%d)\n", process_sockaddr_pool[i].pid);
629                                                    if (kill(process_sockaddr_pool[i].pid, SIGKILL) < 0)
630                                                    {
631                                                            log_error("Send SIGKILL signal failed (%d)\n", errno);
632                                                    }
633                                            }
634                                    }
635    
636                          sd_notifyf(0, "STATUS=Waiting for %d child process to exit", SYS_child_process_count);                                  notify_child_exit = 2;
637                                    tm_notify_child_exit = time(NULL);
638                            }
639                            else if (notify_child_exit == 2 && time(NULL) - tm_notify_child_exit >= WAIT_CHILD_PROCESS_KILL_TIMEOUT)
640                            {
641                                    log_error("Main process prepare to exit without waiting for %d child process any longer\n", SYS_child_process_count);
642                                    SYS_child_process_count = 0;
643                            }
644                  }                  }
645    
646                  if (SYS_conf_reload && !SYS_server_exit)                  if (SYS_conf_reload && !SYS_server_exit)
# Line 423  int net_server(const char *hostaddr, in_ Line 654  int net_server(const char *hostaddr, in_
654                                  log_error("Reload conf failed\n");                                  log_error("Reload conf failed\n");
655                          }                          }
656    
657                          p_bbs_menu_new = calloc(1, sizeof(MENU_SET));                          // Reload BWF config
658                          if (p_bbs_menu_new == NULL)                          if (bwf_load(CONF_BWF) < 0)
659                          {                          {
660                                  log_error("OOM: calloc(MENU_SET)\n");                                  log_error("Reload BWF conf failed\n");
661                          }                          }
                         else if (load_menu(p_bbs_menu_new, CONF_MENU) < 0)  
                         {  
                                 unload_menu(p_bbs_menu_new);  
                                 free(p_bbs_menu_new);  
                                 p_bbs_menu_new = NULL;  
662    
663                                  log_error("Reload menu failed\n");                          if (load_menu(&bbs_menu_new, CONF_MENU) < 0)
664                            {
665                                    unload_menu(&bbs_menu_new);
666                                    log_error("Reload bbs menu failed\n");
667                          }                          }
668                          else                          else
669                          {                          {
670                                  unload_menu(p_bbs_menu);                                  unload_menu(&bbs_menu);
671                                  free(p_bbs_menu);                                  memcpy(&bbs_menu, &bbs_menu_new, sizeof(bbs_menu_new));
672                                    log_common("Reload bbs menu successfully\n");
                                 p_bbs_menu = p_bbs_menu_new;  
                                 p_bbs_menu_new = NULL;  
   
                                 log_common("Reload menu successfully\n");  
673                          }                          }
674    
675                          sd_notify(0, "READY=1");                          if (load_menu(&top10_menu_new, CONF_TOP10_MENU) < 0)
676                  }                          {
677                                    unload_menu(&top10_menu_new);
678                  if (SYS_data_file_reload && !SYS_server_exit)                                  log_error("Reload top10 menu failed\n");
679                  {                          }
680                          SYS_data_file_reload = 0;                          else
681                          sd_notify(0, "RELOADING=1");                          {
682                                    unload_menu(&top10_menu);
683                                    top10_menu_new.allow_exit = 1;
684                                    memcpy(&top10_menu, &top10_menu_new, sizeof(top10_menu_new));
685                                    log_common("Reload top10 menu successfully\n");
686                            }
687    
688                          for (int i = 0; i < data_files_load_startup_count; i++)                          for (int i = 0; i < data_files_load_startup_count; i++)
689                          {                          {
690                                  if (load_file(data_files_load_startup[i]) < 0)                                  if (load_file(data_files_load_startup[i]) < 0)
691                                  {                                  {
692                                          log_error("load_file_mmap(%s) error\n", data_files_load_startup[i]);                                          log_error("load_file(%s) error\n", data_files_load_startup[i]);
693                                  }                                  }
694                          }                          }
   
695                          log_common("Reload data files successfully\n");                          log_common("Reload data files successfully\n");
                         sd_notify(0, "READY=1");  
                 }  
   
                 if (SYS_section_list_reload && !SYS_server_exit)  
                 {  
                         SYS_section_list_reload = 0;  
696    
697                          if (section_list_loader_reload() < 0)                          // Load section config and gen_ex
698                            if (load_section_config_from_db(1) < 0)
699                          {                          {
700                                  log_error("ksection_list_loader_reload() failed\n");                                  log_error("load_section_config_from_db(1) error\n");
701                          }                          }
702                            else
703                            {
704                                    log_common("Reload section config and gen_ex successfully\n");
705                            }
706    
707                            sd_notify(0, "READY=1");
708                  }                  }
709    
710                  nfds = epoll_wait(epollfd, events, MAX_EVENTS, 100); // 0.1 second                  nfds = epoll_wait(epollfd, events, MAX_EVENTS, 100); // 0.1 second
# Line 527  int net_server(const char *hostaddr, in_ Line 757  int net_server(const char *hostaddr, in_
757    
758                                          port_client = ntohs(sin.sin_port);                                          port_client = ntohs(sin.sin_port);
759    
760                                          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);
761    
762                                          if (SYS_child_process_count - 1 < BBS_max_client)                                          if (SYS_child_process_count - 1 < BBS_max_client)
763                                          {                                          {


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1