Merge branch 'master' of github.com:yrutschle/sslh

This commit is contained in:
Yves Rutschle committed 2025-11-14 14:54:17 +01:00
commit c29081f71d
7 files changed
+27 -10

No files matched your search

+3
View File
@@ -1,3 +1,6 @@
vNEXT:
Fix segmentation fault in sslh-fork.
v2.3.0:
Added `max_connections` setting to `listen` and
`protocol` configuration; see the
+1 -1
View File
@@ -899,7 +899,7 @@ int check_access_rights(int in_socket, const char* service)
}
if (!hosts_ctl((char*)service, host, addr_str, STRING_UNKNOWN)) {
print_message(msg_connections, "connection from %s(%s): access denied", host, addr_str);
print_message(msg_connections, "connection from %s(%s): access denied\n", host, addr_str);
close(in_socket);
return -1;
}
+1 -1
View File
@@ -204,7 +204,7 @@ extern int hosts_ctl();
#endif
/* sslh-fork.c */
void start_shoveler(int);
void main_inetd(void);
void main_loop(struct listen_endpoint *listen_sockets, int num_addr_listen);
+1 -1
View File
@@ -221,7 +221,7 @@ void main_loop(struct listen_endpoint listen_sockets[], int num_addr_listen)
ev_run(EV_A_ 0);
}
void start_shoveler(int listen_socket) {
void main_inetd(void) {
print_message(msg_config_error, "inetd mode is not supported in libev mode\n");
exit(1);
}
+19 -2
View File
@@ -69,7 +69,7 @@ int shovel(struct connection *cnx)
/* Child process that finds out what to connect to and proxies
*/
void start_shoveler(int in_socket)
static void start_shoveler(int in_socket, struct listen_endpoint* endpoint)
{
fd_set fds;
struct timeval tv;
@@ -79,6 +79,7 @@ void start_shoveler(int in_socket)
init_cnx(&cnx);
cnx.q[0].fd = in_socket;
cnx.endpoint = endpoint;
FD_ZERO(&fds);
FD_SET(in_socket, &fds);
@@ -130,6 +131,22 @@ void start_shoveler(int in_socket)
exit(0);
}
void main_inetd(void)
{
struct listen_endpoint endpoint = {0};
struct sslhcfg_listen_item endpoint_cfg = {0};
/* Empty configuration: no connection limits, not proxyprotocol... */
endpoint.endpoint_cfg = &endpoint_cfg;
close(fileno(stderr)); /* Make sure no error will go to client */
tcp_init();
start_shoveler(0, &endpoint);
exit(0);
}
static pid_t *listener_pid;
static int listener_pid_number = 0;
@@ -252,7 +269,7 @@ void tcp_listener(struct listen_endpoint* endpoint, int num_endpoints, int activ
/* Shoveler processes don't need to hog file descriptors */
for (i = 0; i < num_endpoints; i++)
close(endpoint[i].socketfd);
start_shoveler(in_socket);
start_shoveler(in_socket, endpoint);
exit(0);
default: /* In parent process */
+1 -4
View File
@@ -308,10 +308,7 @@ int main(int argc, char *argv[], char* envp[])
if (cfg.inetd)
{
close(fileno(stderr)); /* Make sure no error will go to client */
tcp_init();
start_shoveler(0);
exit(0);
main_inetd(); /* Does not return */
}
printsettings();
+1 -1
View File
@@ -292,7 +292,7 @@ void main_loop(struct listen_endpoint listen_sockets[], int num_addr_listen)
}
void start_shoveler(int listen_socket) {
void main_inetd(void) {
print_message(msg_config_error, "inetd mode is not supported in select mode\n");
exit(1);
}