~ruther/guix-local

3c42d9de374c3f433da53ca7b0e7d6a91e1ac918 — Yelninei 1 year, 2 months ago 4ec561b
gnu: libssh: Update to 0.11.2.

* gnu/packages/ssh.scm (libssh): Update to 0.11.2.
[origin]: Remove snippet and patch.
[#:configure-flags]: Remove custom CFLAGS.
[#:phases]: Remove prepare-for-tests phase.
* gnu/packages/patches/libssh-openssh-banner.patch: Delete patch.
* gnu/local.mk (dist_patch_DATA): Deregister patch.

Fixes: guix/guix#1679
Change-Id: Iad2c57353d3a9e8c6391e206f41bfb6deb821a8a
3 files changed, 4 insertions(+), 88 deletions(-)

M gnu/local.mk
D gnu/packages/patches/libssh-openssh-banner.patch
M gnu/packages/ssh.scm
M gnu/local.mk => gnu/local.mk +0 -1
@@ 1782,7 1782,6 @@ dist_patch_DATA =						\
  %D%/packages/patches/libsecret-fix-test-paths.patch		\
  %D%/packages/patches/libsepol-versioned-docbook.patch		\
  %D%/packages/patches/libskk-fix-invalid-escape.patch		\
  %D%/packages/patches/libssh-openssh-banner.patch		\
  %D%/packages/patches/libtar-CVE-2013-4420.patch 		\
  %D%/packages/patches/libtar-CVE-2021-33643-CVE-2021-33644.patch	\
  %D%/packages/patches/libtar-CVE-2021-33645-CVE-2021-33646.patch	\

D gnu/packages/patches/libssh-openssh-banner.patch => gnu/packages/patches/libssh-openssh-banner.patch +0 -61
@@ 1,61 0,0 @@
From 78d536c150bd7f327e0de45a1246bb1f03cd2f48 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 95512f0d3..b1ebc0c44 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 bd6bf96e8..b2320a94e 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);
 }
 
-- 
GitLab


M gnu/packages/ssh.scm => gnu/packages/ssh.scm +4 -26
@@ 137,7 137,7 @@ file names.
(define-public libssh
  (package
    (name "libssh")
    (version "0.11.1")
    (version "0.11.2")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://www.libssh.org/files/"


@@ 145,17 145,7 @@ file names.
                                  "/libssh-" version ".tar.xz"))
              (sha256
               (base32
                "0y8v5ihrqnjxchvjhz8fcczndchaaxxim64bqm8q3q4i5v3xrdql"))
              (modules '((guix build utils)))
              (snippet
               ;; 'PATH_MAX' is undefined on GNU/Hurd; work around it.
               #~(substitute* (find-files "examples" "\\.c$")
                   (("#include \"examples_common\\.h\"" all)
                    (string-append all "\n"
                                   "#ifndef PATH_MAX\n"
                                   "# define PATH_MAX 4096\n"
                                   "#endif\n"))))
              (patches (search-patches "libssh-openssh-banner.patch"))))
                "1rq4dnmaz7zi0y7myvqi5xgdy9mwl80lanhfmw5iyq2viz0rylk9"))))
    (build-system cmake-build-system)
    (outputs '("out" "debug"))
    (arguments


@@ 163,13 153,7 @@ file names.
      #:configure-flags
      #~(list #$@(if (%current-target-system)
                     #~()
                     #~("-DUNIT_TESTING=ON"))
              #$@(if (and (%current-target-system)
                          (not (target-64bit?)))
                     #~((string-append
                         "-DCMAKE_C_FLAGS=-g -O2"
                         " -Wno-error=incompatible-pointer-types"))
                     #~()))
                     #~("-DUNIT_TESTING=ON")))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'patch-commands


@@ 182,13 166,7 @@ file names.
              ;; Test sources.
              (substitute* '("tests/server/test_server/default_cb.c")
                (("\"/bin/sh\"")
                 (format #f "~s" (which "sh"))))))
          (add-before 'check 'prepare-for-tests
            ;; A few test rely on the assumption that HOME == user's pw_dir,
            ;; which is not satisfied in Guix, where `pw_dir' is '/' while
            ;; HOME is '/homeless-shelter'.
            (lambda _
              (setenv "HOME" "/"))))))
                 (format #f "~s" (which "sh")))))))))
    (native-inputs (list cmocka))
    (inputs (list bash-minimal mit-krb5 openssl zlib))
    (synopsis "SSH client library")