diff --git a/include/libssh/session.h b/include/libssh/session.h index 27da7a83..e0404878 100644 --- a/include/libssh/session.h +++ b/include/libssh/session.h @@ -248,8 +248,6 @@ struct ssh_session_struct { char *wanted_methods[SSH_KEX_METHODS]; char *pubkey_accepted_types; char *ProxyCommand; - char *custombanner; - char *moduli_file; char *agent_socket; unsigned long timeout; /* seconds */ unsigned long timeout_usec; @@ -272,6 +270,13 @@ struct ssh_session_struct { int control_master; char *control_path; } opts; + + /* server options */ + struct { + char *custombanner; + char *moduli_file; + } server_opts; + /* counters */ ssh_counter socket_counter; ssh_counter raw_counter; diff --git a/src/bind.c b/src/bind.c index c2917865..eb03088d 100644 --- a/src/bind.c +++ b/src/bind.c @@ -480,16 +480,16 @@ int ssh_bind_accept_fd(ssh_bind sshbind, ssh_session session, socket_t fd) session->common.log_verbosity = sshbind->common.log_verbosity; if (sshbind->banner != NULL) { - session->opts.custombanner = strdup(sshbind->banner); - if (session->opts.custombanner == NULL) { + session->server_opts.custombanner = strdup(sshbind->banner); + if (session->server_opts.custombanner == NULL) { ssh_set_error_oom(sshbind); return SSH_ERROR; } } if (sshbind->moduli_file != NULL) { - session->opts.moduli_file = strdup(sshbind->moduli_file); - if (session->opts.moduli_file == NULL) { + session->server_opts.moduli_file = strdup(sshbind->moduli_file); + if (session->server_opts.moduli_file == NULL) { ssh_set_error_oom(sshbind); return SSH_ERROR; } diff --git a/src/client.c b/src/client.c index b3d0fe62..140ab3e5 100644 --- a/src/client.c +++ b/src/client.c @@ -185,13 +185,13 @@ int ssh_send_banner(ssh_session session, int server) int rc = SSH_ERROR; if (server == 1) { - if (session->opts.custombanner == NULL){ + if (session->server_opts.custombanner == NULL) { session->serverbanner = strdup(banner); if (session->serverbanner == NULL) { goto end; } } else { - len = strlen(session->opts.custombanner); + len = strlen(session->server_opts.custombanner); session->serverbanner = malloc(len + 8 + 1); if(session->serverbanner == NULL) { goto end; @@ -199,7 +199,7 @@ int ssh_send_banner(ssh_session session, int server) snprintf(session->serverbanner, len + 8 + 1, "SSH-2.0-%s", - session->opts.custombanner); + session->server_opts.custombanner); } snprintf(buffer, diff --git a/src/dh-gex.c b/src/dh-gex.c index 4e59073f..e37fef00 100644 --- a/src/dh-gex.c +++ b/src/dh-gex.c @@ -643,7 +643,7 @@ static SSH_PACKET_CALLBACK(ssh_packet_server_dhgex_request) pn = pmin; } } - rc = ssh_retrieve_dhgroup(session->opts.moduli_file, + rc = ssh_retrieve_dhgroup(session->server_opts.moduli_file, pmin, pn, pmax, diff --git a/src/session.c b/src/session.c index b9efc6fa..9750b964 100644 --- a/src/session.c +++ b/src/session.c @@ -339,8 +339,6 @@ void ssh_free(ssh_session session) SAFE_FREE(session->opts.agent_socket); SAFE_FREE(session->opts.bindaddr); - SAFE_FREE(session->opts.custombanner); - SAFE_FREE(session->opts.moduli_file); SAFE_FREE(session->opts.username); SAFE_FREE(session->opts.host); SAFE_FREE(session->opts.sshdir); @@ -358,6 +356,9 @@ void ssh_free(ssh_session session) } } + SAFE_FREE(session->server_opts.custombanner); + SAFE_FREE(session->server_opts.moduli_file); + _ssh_remove_legacy_log_cb(); /* burn connection, it could contain sensitive data */