fix collection extension

This commit is contained in:
yrutschle 2021-03-17 21:16:08 +01:00
parent 0409775a1a
commit 71c617050d
4 changed files with 14 additions and 13 deletions

View File

@ -1,5 +1,5 @@
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
* on Sun Feb 21 20:56:51 2021.
* on Tue Mar 16 20:23:24 2021.
# conf2struct: generate libconf parsers that read to structs
# Copyright (C) 2018-2019 Yves Rutschle

View File

@ -1,5 +1,5 @@
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
* on Sun Feb 21 20:56:51 2021.
* on Tue Mar 16 20:23:24 2021.
# conf2struct: generate libconf parsers that read to structs
# Copyright (C) 2018-2019 Yves Rutschle

View File

@ -76,8 +76,8 @@ static int extend_collection(struct cnx_collection* collection)
int i, new_length = collection->num_cnx + cnx_num_alloc;
if (cfg.verbose)
fprintf(stderr, "allocating %ld more slots.\n", cnx_num_alloc);
new = realloc(&collection->cnx, new_length * sizeof(collection->cnx[0]));
fprintf(stderr, "allocating %ld more slots (target: %d).\n", cnx_num_alloc, new_length);
new = realloc(collection->cnx, new_length * sizeof(collection->cnx[0]));
if (!new) return -1;
collection->cnx = new;
@ -165,7 +165,7 @@ static int accept_new_connection(int listen_socket, struct cnx_collection *colle
}
if (free >= collection->num_cnx) {
res = extend_collection(collection);
if (!res) {
if (res) {
log_message(LOG_ERR, "unable to extend collection -- dropping connection\n");
close(in_socket);
return -1;

17
t
View File

@ -21,7 +21,7 @@ my $sslh_port = $conf->fetch_array("listen")->[0]->{port};
my $user = (getpwuid $<)[0]; # Run under current username
# Which tests do we run
my $SSH_SHY_CNX = 1;
my $SSH_SHY_CNX = 0;
my $PROBES_NOFRAG = 1;
my $PROBES_AGAIN = 1;
my $SSL_MIX_SSH = 1;
@ -31,12 +31,12 @@ my $SSH_MIX_SSL = 1;
# coverage, but do not necessarily result in an actual test
# (e.g. some tests need to be run with valgrind to check all
# memory management code).
my $RB_CNX_NOSERVER = 1;
my $RB_PARAM_NOHOST = 1;
my $RB_WRONG_USERNAME = 1;
my $RB_OPEN_PID_FILE = 1;
my $RB_RESOLVE_ADDRESS = 1;
my $RB_CL_PARAMS = 1;
my $RB_CNX_NOSERVER = 0;
my $RB_PARAM_NOHOST = 0;
my $RB_WRONG_USERNAME = 0;
my $RB_OPEN_PID_FILE = 0;
my $RB_RESOLVE_ADDRESS = 0;
my $RB_CL_PARAMS = 0;
`lcov --directory . --zerocounters`;
@ -208,7 +208,8 @@ foreach my $s (@{$conf->fetch_array("protocols")}) {
}
my @binaries = ('sslh-select', 'sslh-fork');
#my @binaries = ('sslh-select', 'sslh-fork');
my @binaries = ('sslh-select');
for my $binary (@binaries) {
warn "Testing $binary\n";