When spliting EDITOR check for escaped quote characters.
Also add check_editor to sudoers "make check".
This commit is contained in:
@@ -657,6 +657,7 @@ check: $(TEST_PROGS) visudo testsudoers cvtsudoers check-fuzzer
|
|||||||
./check_digest > regress/parser/check_digest.out; \
|
./check_digest > regress/parser/check_digest.out; \
|
||||||
diff regress/parser/check_digest.out $(srcdir)/regress/parser/check_digest.out.ok || rval=`expr $$rval + $$?`; \
|
diff regress/parser/check_digest.out $(srcdir)/regress/parser/check_digest.out.ok || rval=`expr $$rval + $$?`; \
|
||||||
fi; \
|
fi; \
|
||||||
|
./check_editor || rval=`expr $$rval + $$?`; \
|
||||||
./check_env_pattern $(srcdir)/regress/env_match/data || rval=`expr $$rval + $$?`; \
|
./check_env_pattern $(srcdir)/regress/env_match/data || rval=`expr $$rval + $$?`; \
|
||||||
./check_exptilde || rval=`expr $$rval + $$?`; \
|
./check_exptilde || rval=`expr $$rval + $$?`; \
|
||||||
./check_fill || rval=`expr $$rval + $$?`; \
|
./check_fill || rval=`expr $$rval + $$?`; \
|
||||||
|
@@ -63,10 +63,16 @@ wordsplit(const char *str, const char *endstr, const char **last)
|
|||||||
|
|
||||||
/* If word is quoted, skip to end quote and return. */
|
/* If word is quoted, skip to end quote and return. */
|
||||||
if (*str == '"' || *str == '\'') {
|
if (*str == '"' || *str == '\'') {
|
||||||
const char *endquote = memchr(str + 1, *str, endstr - str);
|
const char *endquote;
|
||||||
if (endquote != NULL) {
|
for (cp = str + 1; cp < endstr; cp = endquote + 1) {
|
||||||
*last = endquote;
|
endquote = memchr(cp, *str, endstr - cp);
|
||||||
debug_return_const_ptr(str + 1);
|
if (endquote == NULL)
|
||||||
|
break;
|
||||||
|
/* ignore escaped quotes */
|
||||||
|
if (endquote[-1] != '\\') {
|
||||||
|
*last = endquote;
|
||||||
|
debug_return_const_ptr(str + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,6 +45,15 @@ struct test_data {
|
|||||||
5,
|
5,
|
||||||
{ "sh", "-c", "vi $1", "--", "/etc/motd", NULL }
|
{ "sh", "-c", "vi $1", "--", "/etc/motd", NULL }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
/* Try connecting to the emacs server, falling back on plain emacs. */
|
||||||
|
"VISUAL=sh -c \"emacsclient -a emacs -n \\\"\\$@\\\" || emacs \\\"\\$@\\\"\"",
|
||||||
|
1,
|
||||||
|
{ "/etc/motd", NULL },
|
||||||
|
"/usr/bin/sh",
|
||||||
|
5,
|
||||||
|
{ "sh", "-c", "emacsclient -a emacs -n \"$@\" || emacs \"$@\"", "--", "/etc/motd", NULL }
|
||||||
|
},
|
||||||
{
|
{
|
||||||
/* GitHub issue #99 */
|
/* GitHub issue #99 */
|
||||||
"EDITOR=/usr/bin/vi\\",
|
"EDITOR=/usr/bin/vi\\",
|
||||||
|
Reference in New Issue
Block a user