Allow quoting using single or double quotes inside inetd.conf. Closes

PR 24192 by Tyler Retzlaff.
This commit is contained in:
cube 2004-01-25 10:00:17 +00:00
parent 24e7e49ae8
commit 6894b27b47
2 changed files with 22 additions and 6 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: inetd.8,v 1.40 2003/08/07 11:25:21 agc Exp $
.\" $NetBSD: inetd.8,v 1.41 2004/01/25 10:00:17 cube Exp $
.\"
.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -64,7 +64,7 @@
.\"
.\" from: @(#)inetd.8 8.4 (Berkeley) 6/1/94
.\"
.Dd March 10, 2001
.Dd January 25, 2004
.Dt INETD 8
.Os
.Sh NAME
@ -366,6 +366,8 @@ If the service is provided internally, the
word
.Dq internal
should take the place of this entry.
It is possible to quote an argument using either single or double quotes.
This allows you to have, e.g., spaces in paths and parameters.
.Ss Internal Services
.Nm
provides several

View File

@ -1,4 +1,4 @@
/* $NetBSD: inetd.c,v 1.94 2003/10/21 02:43:37 fvdl Exp $ */
/* $NetBSD: inetd.c,v 1.95 2004/01/25 10:00:17 cube Exp $ */
/*-
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@ -73,7 +73,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1991, 1993, 1994\n\
#if 0
static char sccsid[] = "@(#)inetd.c 8.4 (Berkeley) 4/13/94";
#else
__RCSID("$NetBSD: inetd.c,v 1.94 2003/10/21 02:43:37 fvdl Exp $");
__RCSID("$NetBSD: inetd.c,v 1.95 2004/01/25 10:00:17 cube Exp $");
#endif
#endif /* not lint */
@ -1698,6 +1698,7 @@ skip(char **cpp)
{
char *cp = *cpp;
char *start;
char quote;
if (*cpp == NULL)
return (NULL);
@ -1717,8 +1718,21 @@ again:
return (NULL);
}
start = cp;
while (*cp && *cp != ' ' && *cp != '\t')
cp++;
quote = '\0';
while (*cp && (quote || (*cp != ' ' && *cp != '\t'))) {
if (*cp == '\'' || *cp == '"') {
if (quote && *cp != quote)
cp++;
else {
if (quote)
quote = '\0';
else
quote = *cp;
memmove(cp, cp+1, strlen(cp));
}
} else
cp++;
}
if (*cp != '\0')
*cp++ = '\0';
*cpp = cp;