mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-25 23:05:21 +02:00
upstream: revert recent strdelim() change, it causes problems with
some configs. revision 1.124 date: 2018/03/02 03:02:11; author: djm; state: Exp; lines: +19 -8; commitid: nNRsCijZiGG6SUTT; Allow escaped quotes \" and \' in ssh_config and sshd_config quotes option strings. bz#1596 ok markus@ OpenBSD-Commit-ID: 59c40b1b81206d713c06b49d8477402c86babda5
This commit is contained in:
parent
0bcd871ccd
commit
c7c458e826
27
misc.c
27
misc.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: misc.c,v 1.125 2018/03/03 03:15:51 djm Exp $ */
|
/* $OpenBSD: misc.c,v 1.126 2018/03/07 23:53:08 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000 Markus Friedl. All rights reserved.
|
* Copyright (c) 2000 Markus Friedl. All rights reserved.
|
||||||
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
|
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
|
||||||
@ -242,7 +242,7 @@ set_rdomain(int fd, const char *name)
|
|||||||
char *
|
char *
|
||||||
strdelim(char **s)
|
strdelim(char **s)
|
||||||
{
|
{
|
||||||
char *old, *cp;
|
char *old;
|
||||||
int wspace = 0;
|
int wspace = 0;
|
||||||
|
|
||||||
if (*s == NULL)
|
if (*s == NULL)
|
||||||
@ -256,24 +256,13 @@ strdelim(char **s)
|
|||||||
|
|
||||||
if (*s[0] == '\"') {
|
if (*s[0] == '\"') {
|
||||||
memmove(*s, *s + 1, strlen(*s)); /* move nul too */
|
memmove(*s, *s + 1, strlen(*s)); /* move nul too */
|
||||||
|
|
||||||
/* Find matching quote */
|
/* Find matching quote */
|
||||||
for (cp = *s; ; cp++) {
|
if ((*s = strpbrk(*s, QUOTE)) == NULL) {
|
||||||
if (*cp == '\0')
|
return (NULL); /* no matching quote */
|
||||||
return NULL; /* no matching quote */
|
} else {
|
||||||
if (*cp == '\\') {
|
*s[0] = '\0';
|
||||||
/* Escape sequence */
|
*s += strspn(*s + 1, WHITESPACE) + 1;
|
||||||
if (cp[1] == '\"' || cp[1] == '\'' ||
|
return (old);
|
||||||
cp[1] == '\\') {
|
|
||||||
memmove(cp, cp + 1, strlen(cp));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
return NULL; /* invalid escape */
|
|
||||||
} else if (*cp == '\"') {
|
|
||||||
*(cp++) = '\0';
|
|
||||||
*s += strspn(cp, WHITESPACE);
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user