libssh/fix-proxycomand-parsing1.diff
Stephan Kulow 753c926479 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
2013-07-27 13:47:28 +00:00

57 lines
1.3 KiB
Diff

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