Package: libssh-4
Version: 0.5.4-1
Severity: normal
Tags: upstream patch

Hello.

As you may already know there is a bug affecting all versions
(oldstable, stable, testing, ex) which forbid to use SFTP via libssh
when a ProxyCommand is defined in .ssh/config.

This was fixed in upstream (for git/master only) with this two patchs:
http://git.libssh.org/projects/libssh.git/commit/?id=fcf8af20f81f196cff69a32d7a38a0e193e07d54
http://git.libssh.org/projects/libssh.git/commit/?id=e52cc613e4127d419b79aca5db9e5493f62a5593

I'm currently using Wheezy so I patched the second one to make it work
with 0.5.4 (first one is already working).
Please find it attached.

For reference here is the bug in upstream:
https://red.libssh.org/issues/103#change-247


I think it could be great to make a new version of the package with
both patchs applied.

Thanks.


Thomas


-- System Information:
Debian Release: 7.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-4-686-pae (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libssh-4 depends on:
ii  libc6              2.13-38
ii  libssl1.0.0        1.0.1e-2
ii  multiarch-support  2.13-38
ii  zlib1g             1:1.2.7.dfsg-13

libssh-4 recommends no packages.

libssh-4 suggests no packages.

-- no debconf information

*** /tmp/002_fix-proxy-command-none.patch
diff -rupN a/src/options.c b/src/options.c 
--- a/options.c 2013-01-22 11:38:30.000000000 +0100
+++ b/src/options.c     2013-07-15 09:45:28.000000000 +0200
@@ -655,11 +655,15 @@ int ssh_options_set(ssh_session session,
         return -1;
       } else {
         SAFE_FREE(session->ProxyCommand);
-        q = strdup(value);
-        if (q == NULL) {
-            return -1;
+               /* Setting the command to 'none' disables this option. */
+               rc = strcasecmp(value, "none");
+               if (rc != 0) {
+                       q = strdup(value);
+                       if (q == NULL) {
+                               return -1;
+                       }
+                       session->ProxyCommand = q;
         }
-        session->ProxyCommand = q;
       }
       break;
     default:
diff -rupN a/tests/unittests/torture_options.c 
b/tests/unittests/torture_options.c
--- a/tests/unittests/torture_options.c
+++ b/tests/unittests/torture_options.c
@@ -176,6 +176,23 @@ static void torture_options_get_identity(void **state) {
     free(identity);
 }
 
+static void torture_options_proxycommand(void **state) {
+    ssh_session session = *state;
+    int rc;
+
+    /* Enable ProxyCommand */
+    rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, "ssh -q -A -X -W 
%h:%p JUMPHOST");
+    assert_int_equal(rc, 0);
+
+    assert_string_equal(session->opts.ProxyCommand, "ssh -q -A -X -W %h:%p 
JUMPHOST");
+
+    /* Disable ProxyCommand */
+    rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, "none");
+    assert_int_equal(rc, 0);
+
+    assert_null(session->opts.ProxyCommand);
+}
+
 int torture_run_tests(void) {
     int rc;
     const UnitTest tests[] = {
@@ -127,6 +144,7 @@ int torture_run_tests(void) {
         unit_test_setup_teardown(torture_options_set_fd, setup, teardown),
         unit_test_setup_teardown(torture_options_set_user, setup, teardown),
         unit_test_setup_teardown(torture_options_set_identity, setup, 
teardown),
+        unit_test_setup_teardown(torture_options_proxycommand, setup, 
teardown),
     };
 
     ssh_init();


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to