Sync from SUSE:SLFO:Main libssh revision 33227782e5fde10dcc235c60c91bb589
This commit is contained in:
@@ -1,3 +1,31 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 24 14:36:44 UTC 2025 - Andreas Schneider <asn@cryptomilk.org>
|
||||
|
||||
- Update to version 0.11.2
|
||||
* Security:
|
||||
* CVE-2025-4877 - Write beyond bounds in binary to base64 conversion (bsc#1245309)
|
||||
* CVE-2025-4878 - Use of uninitialized variable in privatekey_from_file() (bsc#1245310)
|
||||
* CVE-2025-5318 - Likely read beyond bounds in sftp server handle management (bsc#1245311)
|
||||
* CVE-2025-5351 - Double free in functions exporting keys (bsc#1245312)
|
||||
* CVE-2025-5372 - ssh_kdf() returns a success code on certain failures (bsc#1245314)
|
||||
* CVE-2025-5449 - Likely read beyond bounds in sftp server message decoding (bsc#1245316)
|
||||
* CVE-2025-5987 - Invalid return code for chacha20 poly1305 with OpenSSL (bsc#1245317)
|
||||
* Compatibility
|
||||
* Fixed compatibility with CPM.cmake
|
||||
* Compatibility with OpenSSH 10.0
|
||||
* Tests compatibility with new Dropbear releases
|
||||
* Removed p11-kit remoting from the pkcs11 testsuite
|
||||
* Bugfixes
|
||||
* Implement missing packet filter for DH GEX
|
||||
* Properly process the SSH2_MSG_DEBUG message
|
||||
* Allow escaping quotes in quoted arguments to ssh configuration
|
||||
* Do not fail with unknown match keywords in ssh configuration
|
||||
* Process packets before selecting signature algorithm during authentication
|
||||
* Do not fail hard when the SFTP status message is not sent by noncompliant
|
||||
servers
|
||||
- Removed libssh-CmakeLists-Fix-multiple-digit-major-version-for-OpenSSH.patch
|
||||
- Removed libssh-misc-Fix-OpenSSH-banner-parsing.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 29 19:31:17 UTC 2025 - Lucas Mulling <lucas.mulling@suse.com>
|
||||
|
||||
|
||||
+2
-6
@@ -32,7 +32,7 @@
|
||||
%endif
|
||||
|
||||
Name: libssh%{pkg_suffix}
|
||||
Version: 0.11.1
|
||||
Version: 0.11.2
|
||||
Release: 0
|
||||
Summary: The SSH library
|
||||
License: LGPL-2.1-or-later
|
||||
@@ -46,12 +46,8 @@ Source4: libssh_server.config
|
||||
Source99: baselibs.conf
|
||||
# PATCH-FIX-UPSTREAM: libssh tries to read config from wrong crypto-policies location (bsc#1222716)
|
||||
Patch0: libssh-cmake-Add-option-WITH_HERMETIC_USR.patch
|
||||
# PATCH-FIX-UPSTREAM: fix build with OpenSSH >= 10.0
|
||||
Patch1: libssh-CmakeLists-Fix-multiple-digit-major-version-for-OpenSSH.patch
|
||||
# PATCH-FIX-UPSTREAM: fix OpenSSH banner parsing
|
||||
Patch2: libssh-misc-Fix-OpenSSH-banner-parsing.patch
|
||||
# PATCH-FIX-SUSE: fix hang in torture_channel tests (bsc#1243799)
|
||||
Patch3: libssh-tests-Fix-an-issue-where-torture_session-request-a-SIGTERM-too-early.patch
|
||||
Patch1: libssh-tests-Fix-an-issue-where-torture_session-request-a-SIGTERM-too-early.patch
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: krb5-devel
|
||||
|
||||
BIN
Binary file not shown.
@@ -1,16 +0,0 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCAAdFiEEiKIo2JsHwsd9DHgJA9XfjP3T6OcFAmbRl74ACgkQA9XfjP3T
|
||||
6OdnSw/+IrXAbSSpjVNG5Wjz3WQjqXkWInCT+qNhcS5w+qasGW5i6mktoNJkg2Fd
|
||||
P4iRCeJEuZbOHZLWXdUaDKjmlOUIda2xA8U01uw2VrleEu05JV/s5tS1MpVOPfDi
|
||||
8+CTxPesFQ9uX9q+OojTr4QXqBDqv15sldwRVTKegNpLkk3xHUUaMjwikWKKxXG+
|
||||
ypD4UCJWKVVhen9HPRSUOtruliZFPxQSLYvj4XKJxpr/QVaORS0EsTpdYP0h1+18
|
||||
6epynp4e1/9GRTmrKa8/JcCd/4c2UnHBFpw0DU1YirLK+54/qD76o63MTbo7mKru
|
||||
cgfypfA/sdeklGTZYLrCyizcrSc2poaTznczUZC6gi3FxivLoldFyDgXeSQWEieB
|
||||
QTGgnaLkB2Y2XuBl9F9MatqFC35TBuUUwHBoEa31acQhmotui5tF4oq/JxRtZi8v
|
||||
OyrTYc/xfmDh4SbWuEVqr6B2SZjhxrIvEGEe4adJQ/tVN2wweoNgTHt8XjBb1amB
|
||||
M9RPeXG5Uon+gIXDVzjgx+DZ85FweCEngv+OdjHPIBWsJUEc722L/gypIFnBfaPV
|
||||
JgM84wxQz2J8xyk2zEANog9M8ae5jG9TVJORO8to+gbRlKB2ZRDdDne0cgRUSWaj
|
||||
0IKsnehsxjF2OqChjRqRMBhfVAA0hrYU1ngxwCcdAcdlbfgs5L0=
|
||||
=P/pw
|
||||
-----END PGP SIGNATURE-----
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCgAdFiEEiKIo2JsHwsd9DHgJA9XfjP3T6OcFAmhaqdkACgkQA9XfjP3T
|
||||
6Oe5xA/+LkbLEPKgNRKMFbXZX2UIyotnFUbZ2o0bujswAxGPqY2paYDHuA5njjKD
|
||||
b9I7WGKstrlywyDr3c+fBSak4uRkLgV7vb6GfjSTXwUoqCwXkUqjVMSO58iSnblZ
|
||||
gjuRglsL0dgTd6jF+LCGqD5JMDNk2spvK0xD/8i53MCqaLv2ysevR1Q2osaw8Hca
|
||||
AM3kHoCRK1TR2gDMLDoX9zSh0UrbHj7o5yG7KBTFoXJsJeR6OtTir72RVTuro8v7
|
||||
8rT1nWbEcgIk/W9+5k7fVuIZc7w1wHqkX8Rj3aubKsLLPPRRJ0Yy7eCRJ26i3d5J
|
||||
51NlmkjrXzmAVd80DOfcd8Ux4I3p85QFXqkgd3J5TgzeV1r0/xJ0Qer612pSPTXq
|
||||
7UPZmyD914ak0EUdiBmud9OIKNmS+szAW2gAtz3Es59aK3LrLO/wgSi09Jq0wqfZ
|
||||
yyvG4/a9dkHaNk0+cSy5YsL0truGCoIPYfKe5ESy5OdzYSYbCdymS8cQRVH3t0is
|
||||
inVV5PbfymbPtscYAliTOMhSYL6VktRBOf5kFA/8EG4+SPI6ingTecc0GqOMPhVu
|
||||
gYuj6G+bmschKkhHcMpbkmo7HN+sDBpdOWyPqs68RvytNWjng0x5jAFdDvA/I/6b
|
||||
ZNmiDlTUfTgsNqBLMNkQ+cx+mRzpp4L87Xvm4ZQhDl3MwxvY048=
|
||||
=aw47
|
||||
-----END PGP SIGNATURE-----
|
||||
@@ -1,47 +0,0 @@
|
||||
From af10857aa3216f40c5c2e5d7116803fb03c166f9 Mon Sep 17 00:00:00 2001
|
||||
From: Norbert Pocs <norbertpocs0@gmail.com>
|
||||
Date: Fri, 11 Apr 2025 09:04:40 +0200
|
||||
Subject: [PATCH] CmakeLists: Fix multiple digit major version for OpenSSH
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Norbert Pocs <norbertpocs0@gmail.com>
|
||||
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
|
||||
Signed-off-by: Lucas Mülling <lucas.mulling@suse.com>
|
||||
---
|
||||
tests/CMakeLists.txt | 13 +++----------
|
||||
1 file changed, 3 insertions(+), 10 deletions(-)
|
||||
|
||||
Index: libssh-0.11.1/tests/CMakeLists.txt
|
||||
===================================================================
|
||||
--- libssh-0.11.1.orig/tests/CMakeLists.txt
|
||||
+++ libssh-0.11.1/tests/CMakeLists.txt
|
||||
@@ -100,9 +100,10 @@ add_subdirectory(unittests)
|
||||
find_program(SSH_EXECUTABLE NAMES ssh)
|
||||
if (SSH_EXECUTABLE)
|
||||
execute_process(COMMAND ${SSH_EXECUTABLE} -V ERROR_VARIABLE OPENSSH_VERSION_STR)
|
||||
- string(REGEX REPLACE "^.*OpenSSH_([0-9]).[0-9].*$" "\\1" OPENSSH_VERSION_MAJOR "${OPENSSH_VERSION_STR}")
|
||||
- string(REGEX REPLACE "^.*OpenSSH_[0-9].([0-9]).*$" "\\1" OPENSSH_VERSION_MINOR "${OPENSSH_VERSION_STR}")
|
||||
+ string(REGEX REPLACE "^.*OpenSSH_([0-9]+).[0-9].*$" "\\1" OPENSSH_VERSION_MAJOR "${OPENSSH_VERSION_STR}")
|
||||
+ string(REGEX REPLACE "^.*OpenSSH_[0-9]+.([0-9]).*$" "\\1" OPENSSH_VERSION_MINOR "${OPENSSH_VERSION_STR}")
|
||||
set(OPENSSH_VERSION "${OPENSSH_VERSION_MAJOR}.${OPENSSH_VERSION_MINOR}")
|
||||
+ add_definitions(-DOPENSSH_VERSION_MAJOR=${OPENSSH_VERSION_MAJOR} -DOPENSSH_VERSION_MINOR=${OPENSSH_VERSION_MINOR})
|
||||
if("${OPENSSH_VERSION}" VERSION_LESS "6.3")
|
||||
# ssh - Q was introduced in 6.3
|
||||
message("Version less than 6.3, hardcoding cipher list")
|
||||
@@ -209,14 +210,6 @@ if (CLIENT_TESTING OR SERVER_TESTING)
|
||||
endif (WITH_PKCS11_PROVIDER)
|
||||
endif (WITH_PKCS11_URI)
|
||||
|
||||
- find_program(SSH_EXECUTABLE NAMES ssh)
|
||||
- if (SSH_EXECUTABLE)
|
||||
- execute_process(COMMAND ${SSH_EXECUTABLE} -V ERROR_VARIABLE OPENSSH_VERSION_STR)
|
||||
- string(REGEX REPLACE "^.*OpenSSH_([0-9]).[0-9].*$" "\\1" OPENSSH_VERSION_MAJOR "${OPENSSH_VERSION_STR}")
|
||||
- string(REGEX REPLACE "^.*OpenSSH_[0-9].([0-9]).*$" "\\1" OPENSSH_VERSION_MINOR "${OPENSSH_VERSION_STR}")
|
||||
- add_definitions(-DOPENSSH_VERSION_MAJOR=${OPENSSH_VERSION_MAJOR} -DOPENSSH_VERSION_MINOR=${OPENSSH_VERSION_MINOR})
|
||||
- endif()
|
||||
-
|
||||
set(LOCAL_USER "nobody")
|
||||
set(LOCAL_UID "65533")
|
||||
find_program(ID_EXECUTABLE NAMES id)
|
||||
@@ -1,24 +1,31 @@
|
||||
From ae314e4a23178a355fb3e85e8a501efcbc1b9a74 Mon Sep 17 00:00:00 2001
|
||||
From d88dbc1e0fa6dab2de359f211792c0b5c3ec7664 Mon Sep 17 00:00:00 2001
|
||||
From: Lucas Mulling <lucas.mulling@suse.com>
|
||||
Date: Mon, 17 Feb 2025 14:13:53 -0300
|
||||
Subject: [PATCH] cmake: Add option WITH_HERMETIC_USR
|
||||
|
||||
Add a cmake option to enable hermetic-usr, i.e., use of config files in /usr/.
|
||||
If turned on, GLOBAL_*_CONFIG is prepended with /usr/ and defined as
|
||||
USR_GLOBAL_*_CONFIG. Config lookup follows this path GLOBAL_*_CONFIG ->
|
||||
USR_GLOBAL_*_CONFIG.
|
||||
|
||||
Introduce a ssh_config_parse primitive. This avoids convoluted checks for file
|
||||
presence (without modifing the behaviour of ssh_config_parse_file) and allows
|
||||
marking whether the config is global at the call site.
|
||||
|
||||
Signed-off-by: Lucas Mulling <lucas.mulling@suse.com>
|
||||
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
|
||||
---
|
||||
CMakeLists.txt | 8 +++++-
|
||||
DefineOptions.cmake | 6 +++++
|
||||
config.h.cmake | 2 ++
|
||||
include/libssh/options.h | 1 +
|
||||
src/config.c | 57 ++++++++++++++++++++++++++++------------
|
||||
src/options.c | 28 +++++++++++++++++++-
|
||||
6 files changed, 83 insertions(+), 19 deletions(-)
|
||||
CMakeLists.txt | 8 ++-
|
||||
DefineOptions.cmake | 6 +++
|
||||
config.h.cmake | 2 +
|
||||
include/libssh/libssh.h | 3 +-
|
||||
include/libssh/options.h | 1 +
|
||||
src/config.c | 56 ++++++++++++++-------
|
||||
src/options.c | 106 ++++++++++++++++++++++++---------------
|
||||
7 files changed, 122 insertions(+), 60 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index d484bdfa..fee994cd 100644
|
||||
index 9877cd70..9a4ea9e3 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -249,9 +249,15 @@ message(STATUS "Benchmarks: ${WITH_BENCHMARKS}")
|
||||
@@ -78,6 +85,22 @@ index 8dce5273..b61ce1db 100644
|
||||
#cmakedefine GLOBAL_CLIENT_CONFIG "${GLOBAL_CLIENT_CONFIG}"
|
||||
|
||||
/************************** HEADER FILES *************************/
|
||||
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
|
||||
index 3bddb019..28fe7396 100644
|
||||
--- a/include/libssh/libssh.h
|
||||
+++ b/include/libssh/libssh.h
|
||||
@@ -49,9 +49,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
+#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
-#include <inttypes.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef int mode_t;
|
||||
diff --git a/include/libssh/options.h b/include/libssh/options.h
|
||||
index d32e1589..63b207fa 100644
|
||||
--- a/include/libssh/options.h
|
||||
@@ -91,25 +114,30 @@ index d32e1589..63b207fa 100644
|
||||
int ssh_config_parse_string(ssh_session session, const char *input);
|
||||
int ssh_options_set_algo(ssh_session session,
|
||||
diff --git a/src/config.c b/src/config.c
|
||||
index 7bb0f50f..7ad3b620 100644
|
||||
index b4171efd..611c0349 100644
|
||||
--- a/src/config.c
|
||||
+++ b/src/config.c
|
||||
@@ -1449,6 +1449,31 @@ ssh_config_parse_line(ssh_session session,
|
||||
@@ -1451,45 +1451,67 @@ ssh_config_parse_line(ssh_session session,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-/* @brief Parse configuration file and set the options to the given session
|
||||
+/* @brief Parse configuration from a file pointer
|
||||
+ *
|
||||
+ * @params[in] session The ssh session
|
||||
*
|
||||
* @params[in] session The ssh session
|
||||
- * @params[in] filename The path to the ssh configuration file
|
||||
+ * @params[in] fp A valid file pointer
|
||||
+ * @params[in] global Whether the config is global or not
|
||||
+ *
|
||||
+ * @returns 0 on successful parsing the configuration file, -1 on error
|
||||
+ */
|
||||
+int ssh_config_parse(ssh_session session, FILE *fp, bool global) {
|
||||
+ char line[MAX_LINE_SIZE] = {0};
|
||||
+ unsigned int count = 0;
|
||||
+ int parsing, rv;
|
||||
*
|
||||
* @returns 0 on successful parsing the configuration file, -1 on error
|
||||
*/
|
||||
-int ssh_config_parse_file(ssh_session session, const char *filename)
|
||||
+int ssh_config_parse(ssh_session session, FILE *fp, bool global)
|
||||
{
|
||||
char line[MAX_LINE_SIZE] = {0};
|
||||
unsigned int count = 0;
|
||||
- FILE *f = NULL;
|
||||
int parsing, rv;
|
||||
+
|
||||
+ parsing = 1;
|
||||
+ while (fgets(line, sizeof(line), fp)) {
|
||||
@@ -123,18 +151,16 @@ index 7bb0f50f..7ad3b620 100644
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* @brief Parse configuration file and set the options to the given session
|
||||
*
|
||||
* @params[in] session The ssh session
|
||||
@@ -1458,36 +1483,34 @@ ssh_config_parse_line(ssh_session session,
|
||||
*/
|
||||
int ssh_config_parse_file(ssh_session session, const char *filename)
|
||||
{
|
||||
- char line[MAX_LINE_SIZE] = {0};
|
||||
- unsigned int count = 0;
|
||||
- FILE *f;
|
||||
- int parsing, rv;
|
||||
+ FILE *fp;
|
||||
+/* @brief Parse configuration file and set the options to the given session
|
||||
+ *
|
||||
+ * @params[in] session The ssh session
|
||||
+ * @params[in] filename The path to the ssh configuration file
|
||||
+ *
|
||||
+ * @returns 0 on successful parsing the configuration file, -1 on error
|
||||
+ */
|
||||
+int ssh_config_parse_file(ssh_session session, const char *filename)
|
||||
+{
|
||||
+ FILE *fp = NULL;
|
||||
+ int rv;
|
||||
bool global = 0;
|
||||
|
||||
@@ -145,13 +171,11 @@ index 7bb0f50f..7ad3b620 100644
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifdef USR_GLOBAL_CLIENT_CONFIG
|
||||
+ rv = strcmp(filename, USR_GLOBAL_CLIENT_CONFIG);
|
||||
+ if (rv != 0) {
|
||||
+ rv = strcmp(filename, GLOBAL_CLIENT_CONFIG);
|
||||
+ }
|
||||
+#else
|
||||
rv = strcmp(filename, GLOBAL_CLIENT_CONFIG);
|
||||
+#ifdef USR_GLOBAL_CLIENT_CONFIG
|
||||
+ if (rv != 0) {
|
||||
+ rv = strcmp(filename, USR_GLOBAL_CLIENT_CONFIG);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (rv == 0) {
|
||||
@@ -179,7 +203,7 @@ index 7bb0f50f..7ad3b620 100644
|
||||
|
||||
/* @brief Parse configuration string and set the options to the given session
|
||||
diff --git a/src/options.c b/src/options.c
|
||||
index 55c7be39..45346fd1 100644
|
||||
index 785296dd..6a72e0e2 100644
|
||||
--- a/src/options.c
|
||||
+++ b/src/options.c
|
||||
@@ -26,6 +26,7 @@
|
||||
@@ -199,53 +223,125 @@ index 55c7be39..45346fd1 100644
|
||||
*
|
||||
* @return 0 on success, < 0 on error.
|
||||
*
|
||||
@@ -1823,6 +1826,9 @@ int ssh_options_parse_config(ssh_session session, const char *filename)
|
||||
@@ -1821,48 +1824,63 @@ int ssh_options_getopt(ssh_session session, int *argcptr, char **argv)
|
||||
*/
|
||||
int ssh_options_parse_config(ssh_session session, const char *filename)
|
||||
{
|
||||
char *expanded_filename;
|
||||
int r;
|
||||
+#ifdef USR_GLOBAL_CLIENT_CONFIG
|
||||
+ FILE *fp;
|
||||
+#endif
|
||||
- char *expanded_filename = NULL;
|
||||
- int r;
|
||||
+ char *expanded_filename = NULL;
|
||||
+ int r;
|
||||
+ FILE *fp = NULL;
|
||||
|
||||
if (session == NULL) {
|
||||
return -1;
|
||||
@@ -1855,7 +1861,19 @@ int ssh_options_parse_config(ssh_session session, const char *filename)
|
||||
goto out;
|
||||
}
|
||||
if (filename == NULL) {
|
||||
- if (session == NULL) {
|
||||
- return -1;
|
||||
- }
|
||||
- if (session->opts.host == NULL) {
|
||||
- ssh_set_error_invalid(session);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (session->opts.sshdir == NULL) {
|
||||
- r = ssh_options_set(session, SSH_OPTIONS_SSH_DIR, NULL);
|
||||
- if (r < 0) {
|
||||
- ssh_set_error_oom(session);
|
||||
- return -1;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /* set default filename */
|
||||
- if (filename == NULL) {
|
||||
- expanded_filename = ssh_path_expand_escape(session, "%d/config");
|
||||
- } else {
|
||||
- expanded_filename = ssh_path_expand_escape(session, filename);
|
||||
- }
|
||||
- if (expanded_filename == NULL) {
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- r = ssh_config_parse_file(session, expanded_filename);
|
||||
- if (r < 0) {
|
||||
- goto out;
|
||||
- }
|
||||
- if (filename == NULL) {
|
||||
- r = ssh_config_parse_file(session, GLOBAL_CLIENT_CONFIG);
|
||||
+#ifdef USR_GLOBAL_CLIENT_CONFIG
|
||||
+ if ((fp = fopen(GLOBAL_CLIENT_CONFIG, "r")) != NULL) {
|
||||
+ SSH_LOG(SSH_LOG_PACKET, "Reading configuration data from %s", GLOBAL_CLIENT_CONFIG);
|
||||
+ r = ssh_config_parse(session, fp, true);
|
||||
+ fclose(fp);
|
||||
+ } else if ((fp = fopen(USR_GLOBAL_CLIENT_CONFIG, "r")) != NULL) {
|
||||
+ SSH_LOG(SSH_LOG_PACKET, "Reading configuration data from %s", USR_GLOBAL_CLIENT_CONFIG);
|
||||
+ r = ssh_config_parse(session, fp, true);
|
||||
+ fclose(fp);
|
||||
- }
|
||||
-
|
||||
- /* Do not process the default configuration as part of connection again */
|
||||
- session->opts.config_processed = true;
|
||||
+ if (session == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+#else
|
||||
+ r = ssh_config_parse_file(session, GLOBAL_CLIENT_CONFIG);
|
||||
+ if (session->opts.host == NULL) {
|
||||
+ ssh_set_error_invalid(session);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (session->opts.sshdir == NULL) {
|
||||
+ r = ssh_options_set(session, SSH_OPTIONS_SSH_DIR, NULL);
|
||||
+ if (r < 0) {
|
||||
+ ssh_set_error_oom(session);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* set default filename */
|
||||
+ if (filename == NULL) {
|
||||
+ expanded_filename = ssh_path_expand_escape(session, "%d/config");
|
||||
+ } else {
|
||||
+ expanded_filename = ssh_path_expand_escape(session, filename);
|
||||
+ }
|
||||
+ if (expanded_filename == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ r = ssh_config_parse_file(session, expanded_filename);
|
||||
+ if (r < 0) {
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (filename == NULL) {
|
||||
+ if ((fp = fopen(GLOBAL_CLIENT_CONFIG, "r")) != NULL) {
|
||||
+ filename = GLOBAL_CLIENT_CONFIG;
|
||||
+#ifdef USR_GLOBAL_CLIENT_CONFIG
|
||||
+ } else if ((fp = fopen(USR_GLOBAL_CLIENT_CONFIG, "r")) != NULL) {
|
||||
+ filename = USR_GLOBAL_CLIENT_CONFIG;
|
||||
+#endif
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ if (fp) {
|
||||
+ SSH_LOG(SSH_LOG_PACKET,
|
||||
+ "Reading configuration data from %s",
|
||||
+ filename);
|
||||
+ r = ssh_config_parse(session, fp, true);
|
||||
+ fclose(fp);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Do not process the default configuration as part of connection again */
|
||||
+ session->opts.config_processed = true;
|
||||
out:
|
||||
- free(expanded_filename);
|
||||
- return r;
|
||||
+ free(expanded_filename);
|
||||
+ return r;
|
||||
}
|
||||
|
||||
/* Do not process the default configuration as part of connection again */
|
||||
@@ -2706,7 +2724,15 @@ int ssh_bind_options_parse_config(ssh_bind sshbind, const char *filename)
|
||||
int ssh_options_apply(ssh_session session)
|
||||
@@ -2706,7 +2724,13 @@ int ssh_bind_options_parse_config(ssh_bind sshbind, const char *filename)
|
||||
/* If the global default configuration hasn't been processed yet, process it
|
||||
* before the provided configuration. */
|
||||
if (!(sshbind->config_processed)) {
|
||||
+#ifdef USR_GLOBAL_BIND_CONFIG
|
||||
- rc = ssh_bind_config_parse_file(sshbind, GLOBAL_BIND_CONFIG);
|
||||
+ if (access(GLOBAL_BIND_CONFIG, F_OK) == 0) {
|
||||
+ rc = ssh_bind_config_parse_file(sshbind, GLOBAL_BIND_CONFIG);
|
||||
+#ifdef USR_GLOBAL_BIND_CONFIG
|
||||
+ } else {
|
||||
+ rc = ssh_bind_config_parse_file(sshbind, USR_GLOBAL_BIND_CONFIG);
|
||||
+ }
|
||||
+#else
|
||||
rc = ssh_bind_config_parse_file(sshbind, GLOBAL_BIND_CONFIG);
|
||||
+#endif
|
||||
+ }
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
2.50.0
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
From bf7b04b1665167e6bac527428c874150c6366df2 Mon Sep 17 00:00:00 2001
|
||||
From: Lucas Mulling <lucas.mulling@suse.com>
|
||||
Date: Thu, 24 Apr 2025 15:48:32 -0300
|
||||
Subject: [PATCH] misc: Fix OpenSSH banner parsing
|
||||
|
||||
Signed-off-by: Lucas Mulling <lucas.mulling@suse.com>
|
||||
---
|
||||
src/misc.c | 6 ++++--
|
||||
tests/unittests/torture_misc.c | 5 +++++
|
||||
2 files changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/misc.c b/src/misc.c
|
||||
index 95512f0d..c18aac93 100644
|
||||
--- a/src/misc.c
|
||||
+++ b/src/misc.c
|
||||
@@ -1426,6 +1426,7 @@ int ssh_analyze_banner(ssh_session session, int server)
|
||||
char *tmp = NULL;
|
||||
unsigned long int major = 0UL;
|
||||
unsigned long int minor = 0UL;
|
||||
+ int off = 0;
|
||||
|
||||
/*
|
||||
* The banner is typical:
|
||||
@@ -1445,8 +1446,9 @@ int ssh_analyze_banner(ssh_session session, int server)
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
- minor = strtoul(openssh + 10, &tmp, 10);
|
||||
- if ((tmp == (openssh + 10)) ||
|
||||
+ off = major >= 10 ? 11: 10;
|
||||
+ minor = strtoul(openssh + off, &tmp, 10);
|
||||
+ if ((tmp == (openssh + off)) ||
|
||||
((errno == ERANGE) && (major == ULONG_MAX)) ||
|
||||
((errno != 0) && (major == 0)) ||
|
||||
(minor > 100)) {
|
||||
diff --git a/tests/unittests/torture_misc.c b/tests/unittests/torture_misc.c
|
||||
index bd6bf96e..b2320a94 100644
|
||||
--- a/tests/unittests/torture_misc.c
|
||||
+++ b/tests/unittests/torture_misc.c
|
||||
@@ -448,6 +448,7 @@ static void torture_ssh_analyze_banner(void **state) {
|
||||
assert_server_banner_accepted("SSH-2.0-OpenSSH");
|
||||
assert_int_equal(0, session->openssh);
|
||||
|
||||
+
|
||||
/* OpenSSH banners: big enough to extract major and minor versions */
|
||||
assert_client_banner_accepted("SSH-2.0-OpenSSH_5.9p1");
|
||||
assert_int_equal(SSH_VERSION_INT(5, 9, 0), session->openssh);
|
||||
@@ -487,6 +488,10 @@ static void torture_ssh_analyze_banner(void **state) {
|
||||
assert_server_banner_accepted("SSH-2.0-OpenSSH-keyscan");
|
||||
assert_int_equal(0, session->openssh);
|
||||
|
||||
+ /* OpenSSH banners: Double digit in major version */
|
||||
+ assert_server_banner_accepted("SSH-2.0-OpenSSH_10.0p1");
|
||||
+ assert_int_equal(SSH_VERSION_INT(10, 0, 0), session->openssh);
|
||||
+
|
||||
ssh_free(session);
|
||||
}
|
||||
|
||||
--
|
||||
2.49.0
|
||||
|
||||
@@ -10,10 +10,10 @@ Signed-off-by: Lucas Mulling <lucas.mulling@suse.com>
|
||||
1 file changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tests/client/torture_session.c b/tests/client/torture_session.c
|
||||
index f95002f4..93d86995 100644
|
||||
index cc83578f..6c10dee1 100644
|
||||
--- a/tests/client/torture_session.c
|
||||
+++ b/tests/client/torture_session.c
|
||||
@@ -447,15 +447,25 @@ static void torture_channel_exit_signal(void **state)
|
||||
@@ -447,6 +447,16 @@ static void torture_channel_exit_signal(void **state)
|
||||
/* Make the request, read parts with close */
|
||||
rc = ssh_channel_request_exec(channel, request);
|
||||
assert_ssh_return_code(session, rc);
|
||||
@@ -30,17 +30,6 @@ index f95002f4..93d86995 100644
|
||||
rc = ssh_channel_request_send_signal(channel, "TERM");
|
||||
assert_ssh_return_code(session, rc);
|
||||
|
||||
- exit_status = ssh_channel_get_exit_state(channel,
|
||||
+ rc = ssh_channel_get_exit_state(channel,
|
||||
&exit_status,
|
||||
&exit_signal,
|
||||
&core_dumped);
|
||||
assert_ssh_return_code(session, rc);
|
||||
- assert_int_equal(exit_status, 0);
|
||||
+ assert_int_equal(exit_status, (uint32_t)-1);
|
||||
assert_string_equal(exit_signal, "TERM");
|
||||
SAFE_FREE(exit_signal);
|
||||
}
|
||||
--
|
||||
2.49.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user