1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

Explicitly parse config to avoid options override (#74)

Since libssh 0.9.0 the global server configuration file is automatically
parsed when new connections are accepted, unless
ssh_bind_options_parse_config() is explicitly called or the automatic
parsing is disabled by setting the SSH_BIND_OPTIONS_PROCESS_CONFIG
option with false.

This adds an explicit call to ssh_bind_options_parse_config() before
setting the options to avoid them to be overridden.

Fixes #72

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
This commit is contained in:
Anderson Sasaki 2020-04-28 01:54:26 +02:00 committed by GitHub
parent f0c32a14a4
commit 97d20249be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -405,6 +405,12 @@ static ssh_bind prepare_ssh(const char *keys_dir, const char *bind_addr, int por
if (!bind) if (!bind)
tmate_fatal("Cannot initialize ssh"); tmate_fatal("Cannot initialize ssh");
#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,9,0)
/* Explicitly parse configuration to avoid automatic configuration file
* loading which could override options */
ssh_bind_options_parse_config(bind, NULL);
#endif
if (bind_addr) if (bind_addr)
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_BINDADDR, bind_addr); ssh_bind_options_set(bind, SSH_BIND_OPTIONS_BINDADDR, bind_addr);
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_BINDPORT, &port); ssh_bind_options_set(bind, SSH_BIND_OPTIONS_BINDPORT, &port);