mirror of
https://github.com/yrutschle/sslh.git
synced 2026-10-25 01:06:20 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a61c8b0b1 | ||
|
|
0c928fedbb | ||
|
|
1a6ba5edc0 |
No files matched your search
@@ -456,19 +456,21 @@ int resolve_split_name(struct addrinfo **out, const char* ct_host, const char* s
|
||||
struct addrinfo hint;
|
||||
char *end;
|
||||
int res;
|
||||
char* host;
|
||||
char* host, *host_base;
|
||||
|
||||
memset(&hint, 0, sizeof(hint));
|
||||
hint.ai_family = PF_UNSPEC;
|
||||
hint.ai_socktype = SOCK_STREAM;
|
||||
|
||||
/* Copy parameter so not to clobber data in libconfig */
|
||||
res = asprintf(&host, "%s", ct_host);
|
||||
res = asprintf(&host_base, "%s", ct_host);
|
||||
if (res == -1) {
|
||||
log_message(LOG_ERR, "asprintf: cannot allocate memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
host = host_base;
|
||||
|
||||
/* If it is a RFC-Compliant IPv6 address ("[1234::12]:443"), remove brackets
|
||||
* around IP address */
|
||||
if (host[0] == '[') {
|
||||
@@ -483,7 +485,7 @@ int resolve_split_name(struct addrinfo **out, const char* ct_host, const char* s
|
||||
res = getaddrinfo(host, serv, &hint, out);
|
||||
if (res)
|
||||
log_message(LOG_ERR, "%s `%s:%s'\n", gai_strerror(res), host, serv);
|
||||
free(host);
|
||||
free(host_base);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
+7
-3
@@ -150,11 +150,11 @@ void main_loop(int listen_sockets[], int num_addr_listen)
|
||||
for (i = 0; i < num_addr_listen; i++) {
|
||||
listener_pid[i] = fork();
|
||||
switch(listener_pid[i]) {
|
||||
case 0: break;
|
||||
// Log if fork() fails for some reason
|
||||
case -1: log_message(LOG_ERR, "fork failed: err %d: %s\n", errno, strerror(errno));
|
||||
break;
|
||||
|
||||
default:
|
||||
// We're in the child, we have work to do
|
||||
case 0:
|
||||
/* Listening process just accepts a connection, forks, and goes
|
||||
* back to listening */
|
||||
while (1)
|
||||
@@ -178,6 +178,10 @@ void main_loop(int listen_sockets[], int num_addr_listen)
|
||||
}
|
||||
close(in_socket);
|
||||
}
|
||||
break;
|
||||
// We're in the parent, we don't need to do anything
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user