/[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.112 by sysadm, Fri Dec 19 06:16:27 2025 UTC Revision 1.114 by sysadm, Fri Dec 26 11:17:41 2025 UTC
# Line 124  static int auth_password(ssh_session ses Line 124  static int auth_password(ssh_session ses
124    
125          if (ret == 0)          if (ret == 0)
126          {          {
127                    log_common("User [%s] authenticated successfully", user);
128                  return SSH_AUTH_SUCCESS;                  return SSH_AUTH_SUCCESS;
129          }          }
130    
# Line 132  static int auth_password(ssh_session ses Line 133  static int auth_password(ssh_session ses
133                  sdata->error = 1;                  sdata->error = 1;
134          }          }
135    
136            log_common("User [%s] authentication failed (%d/%d)", user,
137                              sdata->tries, BBS_login_retry_times);
138          return SSH_AUTH_DENIED;          return SSH_AUTH_DENIED;
139  }  }
140    
# Line 518  int net_server(const char *hostaddr, in_ Line 521  int net_server(const char *hostaddr, in_
521          int ret;          int ret;
522          int flags_server[2];          int flags_server[2];
523          struct sockaddr_in sin;          struct sockaddr_in sin;
524            char local_addr[INET_ADDRSTRLEN];
525    
526  #ifdef HAVE_SYS_EPOLL_H  #ifdef HAVE_SYS_EPOLL_H
527          struct epoll_event ev, events[MAX_EVENTS];          struct epoll_event ev, events[MAX_EVENTS];
# Line 606  int net_server(const char *hostaddr, in_ Line 610  int net_server(const char *hostaddr, in_
610                  sin.sin_addr.s_addr = (hostaddr[0] != '\0' ? inet_addr(hostaddr) : INADDR_ANY);                  sin.sin_addr.s_addr = (hostaddr[0] != '\0' ? inet_addr(hostaddr) : INADDR_ANY);
611                  sin.sin_port = htons(port[i]);                  sin.sin_port = htons(port[i]);
612    
613                    if (inet_ntop(AF_INET, &(sin.sin_addr), local_addr, sizeof(local_addr)) == NULL)
614                    {
615                            log_error("inet_ntop() error (%d)", errno);
616                            return -1;
617                    }
618    
619                  // Reuse address and port                  // Reuse address and port
620                  flags_server[i] = 1;                  flags_server[i] = 1;
621                  if (setsockopt(socket_server[i], SOL_SOCKET, SO_REUSEADDR, &flags_server[i], sizeof(flags_server[i])) < 0)                  if (setsockopt(socket_server[i], SOL_SOCKET, SO_REUSEADDR, &flags_server[i], sizeof(flags_server[i])) < 0)
# Line 622  int net_server(const char *hostaddr, in_ Line 632  int net_server(const char *hostaddr, in_
632                  if (bind(socket_server[i], (struct sockaddr *)&sin, sizeof(sin)) < 0)                  if (bind(socket_server[i], (struct sockaddr *)&sin, sizeof(sin)) < 0)
633                  {                  {
634                          log_error("Bind address %s:%u error (%d)",                          log_error("Bind address %s:%u error (%d)",
635                                            inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), errno);                                            local_addr, port[i], errno);
636                          return -1;                          return -1;
637                  }                  }
638    
# Line 632  int net_server(const char *hostaddr, in_ Line 642  int net_server(const char *hostaddr, in_
642                          return -1;                          return -1;
643                  }                  }
644    
645                  log_common("Listening at %s:%u", inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));                  log_common("Listening at %s:%u", local_addr, port[i]);
646    
647  #ifdef HAVE_SYS_EPOLL_H  #ifdef HAVE_SYS_EPOLL_H
648                  ev.events = EPOLLIN;                  ev.events = EPOLLIN;
# Line 790  int net_server(const char *hostaddr, in_ Line 800  int net_server(const char *hostaddr, in_
800  #endif  #endif
801    
802                          log_common("Reload configuration");                          log_common("Reload configuration");
803                            
804                          // Restart log                          // Restart log
805                          if (log_restart() < 0)                          if (log_restart() < 0)
806                          {                          {
# Line 931  int net_server(const char *hostaddr, in_ Line 941  int net_server(const char *hostaddr, in_
941                                                  }                                                  }
942                                          }                                          }
943    
944                                          strncpy(hostaddr_client, inet_ntoa(sin.sin_addr), sizeof(hostaddr_client) - 1);                                          if (inet_ntop(AF_INET, &(sin.sin_addr), hostaddr_client, sizeof(hostaddr_client)) == NULL)
945                                          hostaddr_client[sizeof(hostaddr_client) - 1] = '\0';                                          {
946                                                    log_error("inet_ntop() error (%d)", errno);
947                                                    close(socket_client);
948                                                    break;
949                                            }
950                                          port_client = ntohs(sin.sin_port);                                          port_client = ntohs(sin.sin_port);
951    
952                                          if (SYS_child_process_count - 1 < BBS_max_client)                                          if (SYS_child_process_count - 1 < BBS_max_client)


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

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