Accepting request 184375 from network:synchronization:files
Add two patches (which will be in libssh 0.5.5) to properly handle ProxyCommand parsing in ssh configuration files: - Add fix-proxycomand-parsing1.diff: fix ProxyCommand parsing in libssh (upstream libssh bug 103) - Add fix-proxy-command-none.diff: fix ProxyCommand when it is "none" (upstream libssh bug 103) (forwarded request 184365 from luca_b) OBS-URL: https://build.opensuse.org/request/show/184375 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libssh?expand=0&rev=27
This commit is contained in:
parent
b6956148a4
commit
753c926479
50
fix-proxy-command-none.diff
Normal file
50
fix-proxy-command-none.diff
Normal file
@ -0,0 +1,50 @@
|
||||
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:
|
||||
--- a/tests/unittests/torture_options.c.orig 2013-07-25 22:06:19.016024956 +0200
|
||||
+++ b/tests/unittests/torture_options.c 2013-07-25 22:11:28.941507282 +0200
|
||||
@@ -119,6 +119,24 @@
|
||||
assert_string_equal(session->identity->root->next->data, "identity1");
|
||||
}
|
||||
|
||||
+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[] = {
|
56
fix-proxycomand-parsing1.diff
Normal file
56
fix-proxycomand-parsing1.diff
Normal file
@ -0,0 +1,56 @@
|
||||
From fcf8af20f81f196cff69a32d7a38a0e193e07d54 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schneider <asn@cryptomilk.org>
|
||||
Date: Sun, 02 Jun 2013 17:06:33 +0000
|
||||
Subject: BUG 103: Fix ProxyCommand parsing.
|
||||
|
||||
---
|
||||
diff --git a/src/config.c b/src/config.c
|
||||
index cb98a60..632a50b 100644
|
||||
--- a/src/config.c
|
||||
+++ b/src/config.c
|
||||
@@ -82,7 +82,7 @@ static enum ssh_config_opcode_e ssh_config_get_opcode(char *keyword) {
|
||||
return SOC_UNSUPPORTED;
|
||||
}
|
||||
|
||||
-static char *ssh_config_get_token(char **str) {
|
||||
+static char *ssh_config_get_cmd(char **str) {
|
||||
register char *c;
|
||||
char *r;
|
||||
|
||||
@@ -103,6 +103,25 @@ static char *ssh_config_get_token(char **str) {
|
||||
}
|
||||
|
||||
for (r = c; *c; c++) {
|
||||
+ if (*c == '\n') {
|
||||
+ *c = '\0';
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ *str = c + 1;
|
||||
+
|
||||
+ return r;
|
||||
+}
|
||||
+
|
||||
+static char *ssh_config_get_token(char **str) {
|
||||
+ register char *c;
|
||||
+ char *r;
|
||||
+
|
||||
+ c = ssh_config_get_cmd(str);
|
||||
+
|
||||
+ for (r = c; *c; c++) {
|
||||
if (isblank(*c)) {
|
||||
*c = '\0';
|
||||
goto out;
|
||||
@@ -299,7 +318,7 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
|
||||
}
|
||||
break;
|
||||
case SOC_PROXYCOMMAND:
|
||||
- p = ssh_config_get_str(&s, NULL);
|
||||
+ p = ssh_config_get_cmd(&s);
|
||||
if (p && *parsing) {
|
||||
ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, p);
|
||||
}
|
||||
--
|
||||
cgit v0.9.1
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 25 19:56:12 UTC 2013 - lbeltrame@kde.org
|
||||
|
||||
- Add fix-proxycomand-parsing1.diff: fix ProxyCommand parsing in
|
||||
libssh (upstream libssh bug 103)
|
||||
- Add fix-proxy-command-none.diff: fix ProxyCommand when it is
|
||||
"none" (upstream libssh bug 103)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 22 15:03:51 UTC 2013 - asn@cryptomilk.org
|
||||
|
||||
|
@ -31,6 +31,10 @@ License: LGPL-2.1+
|
||||
Group: System/Libraries
|
||||
Source0: %{name}-%{version}.tar.bz2
|
||||
Patch1: remove-pedantic-errors.diff
|
||||
#PATCH-FIX-UPSTREAM: Parse ProxyCommand correctly (libssh bug 103)
|
||||
Patch2: fix-proxycomand-parsing1.diff
|
||||
#PATCH-FIX-UPSTREAM: Parse ProxyCommand when it is "none" (libssh bug 103)
|
||||
Patch3: fix-proxy-command-none.diff
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%description
|
||||
@ -81,6 +85,8 @@ Documentation for libssh development.
|
||||
%prep
|
||||
%setup -q
|
||||
%patch -P 1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
||||
%build
|
||||
if test ! -e "build"; then
|
||||
|
Loading…
Reference in New Issue
Block a user