summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2006-03-13 10:14:30 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2006-03-13 10:14:30 +0000
commit0a4da4ac3b66b5ac2fe7f91cba3f6b643afb5a3a (patch)
treeb007eb696a650a858604f265928d48cf8a7c1186 /usr.bin
parentdd04fb31dcdfd5cdb8b83a194fb03880f0a4854b (diff)
Allow config directives to contain whitespace by surrounding them by double
quotes. mindrot #482, man page help from jmc@, ok djm@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/misc.c17
-rw-r--r--usr.bin/ssh/ssh_config.55
-rw-r--r--usr.bin/ssh/sshd_config.55
3 files changed, 23 insertions, 4 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index e58273f4821..2265fab55d2 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -24,7 +24,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: misc.c,v 1.45 2006/02/10 00:27:13 stevesk Exp $");
+RCSID("$OpenBSD: misc.c,v 1.46 2006/03/13 10:14:29 dtucker Exp $");
#include <sys/ioctl.h>
@@ -126,6 +126,7 @@ set_nodelay(int fd)
/* Characters considered whitespace in strsep calls. */
#define WHITESPACE " \t\r\n"
+#define QUOTE "\""
/* return next token in configuration line */
char *
@@ -139,15 +140,27 @@ strdelim(char **s)
old = *s;
- *s = strpbrk(*s, WHITESPACE "=");
+ *s = strpbrk(*s, WHITESPACE QUOTE "=");
if (*s == NULL)
return (old);
+ if (*s[0] == '\"') {
+ memmove(*s, *s + 1, strlen(*s)); /* move nul too */
+ /* Find matching quote */
+ if ((*s = strpbrk(*s, QUOTE)) == NULL) {
+ return (NULL); /* no matching quote */
+ } else {
+ *s[0] = '\0';
+ return (old);
+ }
+ }
+
/* Allow only one '=' to be skipped */
if (*s[0] == '=')
wspace = 1;
*s[0] = '\0';
+ /* Skip any extra whitespace after first token */
*s += strspn(*s + 1, WHITESPACE) + 1;
if (*s[0] == '=' && !wspace)
*s += strspn(*s + 1, WHITESPACE) + 1;
diff --git a/usr.bin/ssh/ssh_config.5 b/usr.bin/ssh/ssh_config.5
index ba8926e8ee8..f7c9f714555 100644
--- a/usr.bin/ssh/ssh_config.5
+++ b/usr.bin/ssh/ssh_config.5
@@ -34,7 +34,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: ssh_config.5,v 1.87 2006/02/26 18:03:10 jmc Exp $
+.\" $OpenBSD: ssh_config.5,v 1.88 2006/03/13 10:14:29 dtucker Exp $
.Dd September 25, 1999
.Dt SSH_CONFIG 5
.Os
@@ -92,6 +92,9 @@ and
.Nm sftp
.Fl o
option.
+Arguments may optionally be enclosed in double quotes
+.Pq \&"
+in order to represent arguments containing spaces.
.Pp
The possible
keywords and their meanings are as follows (note that
diff --git a/usr.bin/ssh/sshd_config.5 b/usr.bin/ssh/sshd_config.5
index 8925f7ac71d..175b8c7e976 100644
--- a/usr.bin/ssh/sshd_config.5
+++ b/usr.bin/ssh/sshd_config.5
@@ -34,7 +34,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: sshd_config.5,v 1.55 2006/02/26 18:01:13 jmc Exp $
+.\" $OpenBSD: sshd_config.5,v 1.56 2006/03/13 10:14:29 dtucker Exp $
.Dd September 25, 1999
.Dt SSHD_CONFIG 5
.Os
@@ -56,6 +56,9 @@ The file contains keyword-argument pairs, one per line.
Lines starting with
.Ql #
and empty lines are interpreted as comments.
+Arguments may optionally be enclosed in double quotes
+.Pq \&"
+in order to represent arguments containing spaces.
.Pp
The possible
keywords and their meanings are as follows (note that