aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openvpn.87
-rw-r--r--options.c17
2 files changed, 20 insertions, 4 deletions
diff --git a/openvpn.8 b/openvpn.8
index aa48e70..287e2e1 100644
--- a/openvpn.8
+++ b/openvpn.8
@@ -380,13 +380,14 @@ can be removed, and the command can be given as
Note that
configuration files can be nested to a reasonable depth.
-Double quotation characters ("") can be used
-to enclose single parameters containing whitespace,
+Double quotation or single quotation characters ("", '')
+can be used to enclose single parameters containing whitespace,
and "#" or ";" characters in the first column
can be used to denote comments.
Note that OpenVPN 2.0 and higher performs backslash-based shell
-escaping, so the following mappings should be observed:
+escaping for characters not in single quotations,
+so the following mappings should be observed:
.RS
.ft 3
diff --git a/options.c b/options.c
index f2310fc..5cc7f23 100644
--- a/options.c
+++ b/options.c
@@ -2577,6 +2577,7 @@ parse_line (const char *line,
const int STATE_READING_QUOTED_PARM = 1;
const int STATE_READING_UNQUOTED_PARM = 2;
const int STATE_DONE = 3;
+ const int STATE_READING_SQUOTED_PARM = 4;
const char *error_prefix = "";
@@ -2599,7 +2600,7 @@ parse_line (const char *line,
in = *c;
out = 0;
- if (!backslash && in == '\\')
+ if (!backslash && in == '\\' && state != STATE_READING_SQUOTED_PARM)
{
backslash = true;
}
@@ -2613,6 +2614,8 @@ parse_line (const char *line,
break;
if (!backslash && in == '\"')
state = STATE_READING_QUOTED_PARM;
+ else if (!backslash && in == '\'')
+ state = STATE_READING_SQUOTED_PARM;
else
{
out = in;
@@ -2634,6 +2637,13 @@ parse_line (const char *line,
else
out = in;
}
+ else if (state == STATE_READING_SQUOTED_PARM)
+ {
+ if (in == '\'')
+ state = STATE_DONE;
+ else
+ out = in;
+ }
if (state == STATE_DONE)
{
/* ASSERT (parm_len > 0); */
@@ -2681,6 +2691,11 @@ parse_line (const char *line,
msg (msglevel, "%sOptions error: No closing quotation (\") in %s:%d", error_prefix, file, line_num);
return 0;
}
+ if (state == STATE_READING_SQUOTED_PARM)
+ {
+ msg (msglevel, "%sOptions error: No closing single quotation (\') in %s:%d", error_prefix, file, line_num);
+ return 0;
+ }
if (state != STATE_INITIAL)
{
msg (msglevel, "%sOptions error: Residual parse state (%d) in %s:%d", error_prefix, state, file, line_num);