forked from pool/libssh
Accepting request 1272585 from devel:libraries:c_c++
OBS-URL: https://build.opensuse.org/request/show/1272585 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libssh?expand=0&rev=77
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
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)
|
||||||
61
libssh-misc-Fix-OpenSSH-banner-parsing.patch
Normal file
61
libssh-misc-Fix-OpenSSH-banner-parsing.patch
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
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
|
||||||
|
|
||||||
@@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Apr 23 19:59:55 UTC 2025 - Lucas Mulling <lucas.mulling@suse.com>
|
||||||
|
|
||||||
|
- Fix build and tests with OpenSSH >= 10.0
|
||||||
|
* Use %make_build instead of naked make
|
||||||
|
* Add patches:
|
||||||
|
- libssh-CmakeLists-Fix-multiple-digit-major-version-for-OpenSSH.patch
|
||||||
|
- libssh-misc-Fix-OpenSSH-banner-parsing.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Feb 18 19:08:10 UTC 2025 - Lucas Mulling <lucas.mulling@suse.com>
|
Tue Feb 18 19:08:10 UTC 2025 - Lucas Mulling <lucas.mulling@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ Source4: libssh_server.config
|
|||||||
Source99: baselibs.conf
|
Source99: baselibs.conf
|
||||||
# PATCH-FIX-UPSTREAM: libssh tries to read config from wrong crypto-policies location (bsc#1222716)
|
# PATCH-FIX-UPSTREAM: libssh tries to read config from wrong crypto-policies location (bsc#1222716)
|
||||||
Patch0: libssh-cmake-Add-option-WITH_HERMETIC_USR.patch
|
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
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
BuildRequires: krb5-devel
|
BuildRequires: krb5-devel
|
||||||
@@ -124,7 +128,7 @@ Development headers for the SSH library.
|
|||||||
-DGLOBAL_CLIENT_CONFIG="%{_sysconfdir}/libssh/libssh_client.config" \
|
-DGLOBAL_CLIENT_CONFIG="%{_sysconfdir}/libssh/libssh_client.config" \
|
||||||
-DGLOBAL_BIND_CONFIG="%{_sysconfdir}/libssh/libssh_server.config"
|
-DGLOBAL_BIND_CONFIG="%{_sysconfdir}/libssh/libssh_server.config"
|
||||||
|
|
||||||
make %{?_smp_mflags}
|
%make_build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%if !%{with test}
|
%if !%{with test}
|
||||||
|
|||||||
Reference in New Issue
Block a user