diff options
author | Anderson Toshiyuki Sasaki <ansasaki@redhat.com> | 2019-03-11 17:07:20 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-04-01 08:38:17 +0200 |
commit | 25af8641b31bb471ef957b0cfc2bb1066796a83c (patch) | |
tree | 8e5871b030bd9a3bde79c676be92f42ea8780b8c /src/bind.c | |
parent | d6d9b56bb9c96eb15329b5530b41e742cef04dde (diff) | |
download | libssh-25af8641b31bb471ef957b0cfc2bb1066796a83c.tar.gz libssh-25af8641b31bb471ef957b0cfc2bb1066796a83c.tar.xz libssh-25af8641b31bb471ef957b0cfc2bb1066796a83c.zip |
bind: Apply global configuration automatically
Apply the global bind configuration from the file pointed by
BIND_GLOBAL_CONFIG when a bind_new() is called.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/bind.c')
-rw-r--r-- | src/bind.c | 26 |
1 files changed, 17 insertions, 9 deletions
@@ -130,17 +130,25 @@ static socket_t bind_socket(ssh_bind sshbind, const char *hostname, } ssh_bind ssh_bind_new(void) { - ssh_bind ptr; + ssh_bind ptr; + int rc; - ptr = calloc(1, sizeof(struct ssh_bind_struct)); - if (ptr == NULL) { - return NULL; - } - ptr->bindfd = SSH_INVALID_SOCKET; - ptr->bindport= 22; - ptr->common.log_verbosity = 0; + ptr = calloc(1, sizeof(struct ssh_bind_struct)); + if (ptr == NULL) { + return NULL; + } + ptr->bindfd = SSH_INVALID_SOCKET; + ptr->bindport = 22; + ptr->common.log_verbosity = 0; + + /* Apply global bind configurations */ + rc = ssh_bind_options_parse_config(ptr, NULL); + if (rc != 0) { + ssh_bind_free(ptr); + ptr = NULL; + } - return ptr; + return ptr; } static int ssh_bind_import_keys(ssh_bind sshbind) { |