summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-03-15 12:05:59 +1100
committerDamien Miller <djm@mindrot.org>2006-03-15 12:05:59 +1100
commit306d118f72670f0da447f28b7eec576dcb4a6e38 (patch)
tree0bff224f27fffa3159073c7c639f3ec0cc7fa5b7
parent8056a9d46ac2d75560c2fd9fc69c75ee46a43922 (diff)
- dtucker@cvs.openbsd.org 2006/03/13 10:14:29
[misc.c ssh_config.5 sshd_config.5] Allow config directives to contain whitespace by surrounding them by double quotes. mindrot #482, man page help from jmc@, ok djm@
-rw-r--r--ChangeLog6
-rw-r--r--misc.c17
-rw-r--r--ssh_config.55
-rw-r--r--sshd_config.55
4 files changed, 28 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 74ece7805..c72eeed41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -220,6 +220,10 @@
220 Make ssh-keygen handle CR and CRLF line termination when converting IETF 220 Make ssh-keygen handle CR and CRLF line termination when converting IETF
221 format keys, in adition to vanilla LF. mindrot #1157, tested by Chris 221 format keys, in adition to vanilla LF. mindrot #1157, tested by Chris
222 Pepper, ok djm@ 222 Pepper, ok djm@
223 - dtucker@cvs.openbsd.org 2006/03/13 10:14:29
224 [misc.c ssh_config.5 sshd_config.5]
225 Allow config directives to contain whitespace by surrounding them by double
226 quotes. mindrot #482, man page help from jmc@, ok djm@
223 227
22420060313 22820060313
225 - (dtucker) [configure.ac] Bug #1171: Don't use printf("%lld", longlong) 229 - (dtucker) [configure.ac] Bug #1171: Don't use printf("%lld", longlong)
@@ -4121,4 +4125,4 @@
4121 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 4125 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
4122 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 4126 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
4123 4127
4124$Id: ChangeLog,v 1.4202 2006/03/15 01:05:40 djm Exp $ 4128$Id: ChangeLog,v 1.4203 2006/03/15 01:05:59 djm Exp $
diff --git a/misc.c b/misc.c
index e1da651ef..662480e9e 100644
--- a/misc.c
+++ b/misc.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include "includes.h" 26#include "includes.h"
27RCSID("$OpenBSD: misc.c,v 1.45 2006/02/10 00:27:13 stevesk Exp $"); 27RCSID("$OpenBSD: misc.c,v 1.46 2006/03/13 10:14:29 dtucker Exp $");
28 28
29#include <sys/ioctl.h> 29#include <sys/ioctl.h>
30#include <netinet/tcp.h> 30#include <netinet/tcp.h>
@@ -128,6 +128,7 @@ set_nodelay(int fd)
128 128
129/* Characters considered whitespace in strsep calls. */ 129/* Characters considered whitespace in strsep calls. */
130#define WHITESPACE " \t\r\n" 130#define WHITESPACE " \t\r\n"
131#define QUOTE "\""
131 132
132/* return next token in configuration line */ 133/* return next token in configuration line */
133char * 134char *
@@ -141,15 +142,27 @@ strdelim(char **s)
141 142
142 old = *s; 143 old = *s;
143 144
144 *s = strpbrk(*s, WHITESPACE "="); 145 *s = strpbrk(*s, WHITESPACE QUOTE "=");
145 if (*s == NULL) 146 if (*s == NULL)
146 return (old); 147 return (old);
147 148
149 if (*s[0] == '\"') {
150 memmove(*s, *s + 1, strlen(*s)); /* move nul too */
151 /* Find matching quote */
152 if ((*s = strpbrk(*s, QUOTE)) == NULL) {
153 return (NULL); /* no matching quote */
154 } else {
155 *s[0] = '\0';
156 return (old);
157 }
158 }
159
148 /* Allow only one '=' to be skipped */ 160 /* Allow only one '=' to be skipped */
149 if (*s[0] == '=') 161 if (*s[0] == '=')
150 wspace = 1; 162 wspace = 1;
151 *s[0] = '\0'; 163 *s[0] = '\0';
152 164
165 /* Skip any extra whitespace after first token */
153 *s += strspn(*s + 1, WHITESPACE) + 1; 166 *s += strspn(*s + 1, WHITESPACE) + 1;
154 if (*s[0] == '=' && !wspace) 167 if (*s[0] == '=' && !wspace)
155 *s += strspn(*s + 1, WHITESPACE) + 1; 168 *s += strspn(*s + 1, WHITESPACE) + 1;
diff --git a/ssh_config.5 b/ssh_config.5
index ba8926e8e..f7c9f7145 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -34,7 +34,7 @@
34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.\" $OpenBSD: ssh_config.5,v 1.87 2006/02/26 18:03:10 jmc Exp $ 37.\" $OpenBSD: ssh_config.5,v 1.88 2006/03/13 10:14:29 dtucker Exp $
38.Dd September 25, 1999 38.Dd September 25, 1999
39.Dt SSH_CONFIG 5 39.Dt SSH_CONFIG 5
40.Os 40.Os
@@ -92,6 +92,9 @@ and
92.Nm sftp 92.Nm sftp
93.Fl o 93.Fl o
94option. 94option.
95Arguments may optionally be enclosed in double quotes
96.Pq \&"
97in order to represent arguments containing spaces.
95.Pp 98.Pp
96The possible 99The possible
97keywords and their meanings are as follows (note that 100keywords and their meanings are as follows (note that
diff --git a/sshd_config.5 b/sshd_config.5
index 446e59afd..1bd3a624f 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -34,7 +34,7 @@
34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.\" $OpenBSD: sshd_config.5,v 1.55 2006/02/26 18:01:13 jmc Exp $ 37.\" $OpenBSD: sshd_config.5,v 1.56 2006/03/13 10:14:29 dtucker Exp $
38.Dd September 25, 1999 38.Dd September 25, 1999
39.Dt SSHD_CONFIG 5 39.Dt SSHD_CONFIG 5
40.Os 40.Os
@@ -56,6 +56,9 @@ The file contains keyword-argument pairs, one per line.
56Lines starting with 56Lines starting with
57.Ql # 57.Ql #
58and empty lines are interpreted as comments. 58and empty lines are interpreted as comments.
59Arguments may optionally be enclosed in double quotes
60.Pq \&"
61in order to represent arguments containing spaces.
59.Pp 62.Pp
60The possible 63The possible
61keywords and their meanings are as follows (note that 64keywords and their meanings are as follows (note that