Allow plugin and push directives to have multiple
parameters specified instead of only 1 quoted
parameter.
Allow plugin and push directives to have multi-line
parameter lists, such as:
<plugin>
my-plugin.so
parm1
parm2
</plugin>
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@785 e7ae566f-a301-0410-adde-c780ea21d3b5
| ... | ... |
@@ -398,6 +398,19 @@ buf_chomp (struct buffer *buf) |
| 398 | 398 |
buf_null_terminate (buf); |
| 399 | 399 |
} |
| 400 | 400 |
|
| 401 |
+const char * |
|
| 402 |
+skip_leading_whitespace (const char *str) |
|
| 403 |
+{
|
|
| 404 |
+ while (*str) |
|
| 405 |
+ {
|
|
| 406 |
+ const char c = *str; |
|
| 407 |
+ if (!(c == ' ' || c == '\t')) |
|
| 408 |
+ break; |
|
| 409 |
+ ++str; |
|
| 410 |
+ } |
|
| 411 |
+ return str; |
|
| 412 |
+} |
|
| 413 |
+ |
|
| 401 | 414 |
/* |
| 402 | 415 |
* like buf_null_terminate, but operate on strings |
| 403 | 416 |
*/ |
| ... | ... |
@@ -475,6 +488,42 @@ string_clear (char *str) |
| 475 | 475 |
} |
| 476 | 476 |
|
| 477 | 477 |
/* |
| 478 |
+ * Return the length of a string array |
|
| 479 |
+ */ |
|
| 480 |
+int |
|
| 481 |
+string_array_len (const char **array) |
|
| 482 |
+{
|
|
| 483 |
+ int i = 0; |
|
| 484 |
+ if (array) |
|
| 485 |
+ {
|
|
| 486 |
+ while (array[i]) |
|
| 487 |
+ ++i; |
|
| 488 |
+ } |
|
| 489 |
+ return i; |
|
| 490 |
+} |
|
| 491 |
+ |
|
| 492 |
+char * |
|
| 493 |
+print_argv (const char **p, struct gc_arena *gc, const unsigned int flags) |
|
| 494 |
+{
|
|
| 495 |
+ struct buffer out = alloc_buf_gc (256, gc); |
|
| 496 |
+ int i = 0; |
|
| 497 |
+ for (;;) |
|
| 498 |
+ {
|
|
| 499 |
+ const char *cp = *p++; |
|
| 500 |
+ if (!cp) |
|
| 501 |
+ break; |
|
| 502 |
+ if (i) |
|
| 503 |
+ buf_printf (&out, " "); |
|
| 504 |
+ if (flags & PA_BRACKET) |
|
| 505 |
+ buf_printf (&out, "[%s]", cp); |
|
| 506 |
+ else |
|
| 507 |
+ buf_printf (&out, "%s", cp); |
|
| 508 |
+ ++i; |
|
| 509 |
+ } |
|
| 510 |
+ return BSTR (&out); |
|
| 511 |
+} |
|
| 512 |
+ |
|
| 513 |
+/* |
|
| 478 | 514 |
* Allocate a string inside a buffer |
| 479 | 515 |
*/ |
| 480 | 516 |
struct buffer |
| ... | ... |
@@ -84,6 +84,10 @@ void free_buf (struct buffer *buf); |
| 84 | 84 |
bool buf_assign (struct buffer *dest, const struct buffer *src); |
| 85 | 85 |
|
| 86 | 86 |
void string_clear (char *str); |
| 87 |
+int string_array_len (const char **array); |
|
| 88 |
+ |
|
| 89 |
+#define PA_BRACKET (1<<0) |
|
| 90 |
+char *print_argv (const char **p, struct gc_arena *gc, const unsigned int flags); |
|
| 87 | 91 |
|
| 88 | 92 |
/* for dmalloc debugging */ |
| 89 | 93 |
|
| ... | ... |
@@ -220,6 +224,7 @@ void buf_rmtail (struct buffer *buf, uint8_t remove); |
| 220 | 220 |
* non-buffer string functions |
| 221 | 221 |
*/ |
| 222 | 222 |
void chomp (char *str); |
| 223 |
+const char *skip_leading_whitespace (const char *str); |
|
| 223 | 224 |
void string_null_terminate (char *str, int len, int capacity); |
| 224 | 225 |
|
| 225 | 226 |
/* |
| ... | ... |
@@ -1368,6 +1368,73 @@ make_arg_array (const char *first, const char *parms, struct gc_arena *gc) |
| 1368 | 1368 |
return (const char **)ret; |
| 1369 | 1369 |
} |
| 1370 | 1370 |
|
| 1371 |
+#if ENABLE_INLINE_FILES |
|
| 1372 |
+static const char ** |
|
| 1373 |
+make_inline_array (const char *str, struct gc_arena *gc) |
|
| 1374 |
+{
|
|
| 1375 |
+ char line[OPTION_LINE_SIZE]; |
|
| 1376 |
+ struct buffer buf; |
|
| 1377 |
+ int len = 0; |
|
| 1378 |
+ char **ret = NULL; |
|
| 1379 |
+ int i = 0; |
|
| 1380 |
+ |
|
| 1381 |
+ buf_set_read (&buf, str, strlen (str)); |
|
| 1382 |
+ while (buf_parse (&buf, '\n', line, sizeof (line))) |
|
| 1383 |
+ ++len; |
|
| 1384 |
+ |
|
| 1385 |
+ /* alloc return array */ |
|
| 1386 |
+ ALLOC_ARRAY_CLEAR_GC (ret, char *, len + 1, gc); |
|
| 1387 |
+ |
|
| 1388 |
+ buf_set_read (&buf, str, strlen(str)); |
|
| 1389 |
+ while (buf_parse (&buf, '\n', line, sizeof (line))) |
|
| 1390 |
+ {
|
|
| 1391 |
+ chomp (line); |
|
| 1392 |
+ ASSERT (i < len); |
|
| 1393 |
+ ret[i] = string_alloc (skip_leading_whitespace (line), gc); |
|
| 1394 |
+ ++i; |
|
| 1395 |
+ } |
|
| 1396 |
+ ASSERT (i <= len); |
|
| 1397 |
+ ret[i] = NULL; |
|
| 1398 |
+ return (const char **)ret; |
|
| 1399 |
+} |
|
| 1400 |
+#endif |
|
| 1401 |
+ |
|
| 1402 |
+static const char ** |
|
| 1403 |
+make_arg_copy (char **p, struct gc_arena *gc) |
|
| 1404 |
+{
|
|
| 1405 |
+ char **ret = NULL; |
|
| 1406 |
+ const int len = string_array_len ((const char **)p); |
|
| 1407 |
+ const int max_parms = len + 1; |
|
| 1408 |
+ int i; |
|
| 1409 |
+ |
|
| 1410 |
+ /* alloc return array */ |
|
| 1411 |
+ ALLOC_ARRAY_CLEAR_GC (ret, char *, max_parms, gc); |
|
| 1412 |
+ |
|
| 1413 |
+ for (i = 0; i < len; ++i) |
|
| 1414 |
+ ret[i] = p[i]; |
|
| 1415 |
+ |
|
| 1416 |
+ return (const char **)ret; |
|
| 1417 |
+} |
|
| 1418 |
+ |
|
| 1419 |
+const char ** |
|
| 1420 |
+make_extended_arg_array (char **p, struct gc_arena *gc) |
|
| 1421 |
+{
|
|
| 1422 |
+ const int argc = string_array_len ((const char **)p); |
|
| 1423 |
+#if ENABLE_INLINE_FILES |
|
| 1424 |
+ if (!strcmp (p[0], INLINE_FILE_TAG) && argc == 2) |
|
| 1425 |
+ return make_inline_array (p[1], gc); |
|
| 1426 |
+ else |
|
| 1427 |
+#endif |
|
| 1428 |
+ if (argc == 0) |
|
| 1429 |
+ return make_arg_array (NULL, NULL, gc); |
|
| 1430 |
+ else if (argc == 1) |
|
| 1431 |
+ return make_arg_array (p[0], NULL, gc); |
|
| 1432 |
+ else if (argc == 2) |
|
| 1433 |
+ return make_arg_array (p[0], p[1], gc); |
|
| 1434 |
+ else |
|
| 1435 |
+ return make_arg_copy (p, gc); |
|
| 1436 |
+} |
|
| 1437 |
+ |
|
| 1371 | 1438 |
void |
| 1372 | 1439 |
openvpn_sleep (const int n) |
| 1373 | 1440 |
{
|
| ... | ... |
@@ -180,6 +180,7 @@ void env_set_remove_from_environment (const struct env_set *es); |
| 180 | 180 |
|
| 181 | 181 |
const char **make_env_array (const struct env_set *es, struct gc_arena *gc); |
| 182 | 182 |
const char **make_arg_array (const char *first, const char *parms, struct gc_arena *gc); |
| 183 |
+const char **make_extended_arg_array (char **p, struct gc_arena *gc); |
|
| 183 | 184 |
|
| 184 | 185 |
/* convert netmasks for iproute2 */ |
| 185 | 186 |
int count_netmask_bits(const char *); |
| ... | ... |
@@ -2718,9 +2718,8 @@ check_inline_file_via_buf (struct buffer *multiline, char *p[], struct gc_arena |
| 2718 | 2718 |
|
| 2719 | 2719 |
#endif |
| 2720 | 2720 |
|
| 2721 |
-static int |
|
| 2721 |
+static void |
|
| 2722 | 2722 |
add_option (struct options *options, |
| 2723 |
- int i, |
|
| 2724 | 2723 |
char *p[], |
| 2725 | 2724 |
const char *file, |
| 2726 | 2725 |
int line, |
| ... | ... |
@@ -2764,7 +2763,7 @@ read_config_file (struct options *options, |
| 2764 | 2764 |
#if ENABLE_INLINE_FILES |
| 2765 | 2765 |
check_inline_file_via_fp (fp, p, &options->gc); |
| 2766 | 2766 |
#endif |
| 2767 |
- add_option (options, 0, p, file, line_num, level, msglevel, permission_mask, option_types_found, es); |
|
| 2767 |
+ add_option (options, p, file, line_num, level, msglevel, permission_mask, option_types_found, es); |
|
| 2768 | 2768 |
} |
| 2769 | 2769 |
} |
| 2770 | 2770 |
fclose (fp); |
| ... | ... |
@@ -2808,7 +2807,7 @@ read_config_string (struct options *options, |
| 2808 | 2808 |
#if ENABLE_INLINE_FILES |
| 2809 | 2809 |
check_inline_file_via_buf (&multiline, p, &options->gc); |
| 2810 | 2810 |
#endif |
| 2811 |
- add_option (options, 0, p, NULL, line_num, 0, msglevel, permission_mask, option_types_found, es); |
|
| 2811 |
+ add_option (options, p, NULL, line_num, 0, msglevel, permission_mask, option_types_found, es); |
|
| 2812 | 2812 |
} |
| 2813 | 2813 |
CLEAR (p); |
| 2814 | 2814 |
} |
| ... | ... |
@@ -2837,7 +2836,7 @@ parse_argv (struct options *options, |
| 2837 | 2837 |
CLEAR (p); |
| 2838 | 2838 |
p[0] = "config"; |
| 2839 | 2839 |
p[1] = argv[1]; |
| 2840 |
- add_option (options, 0, p, NULL, 0, 0, msglevel, permission_mask, option_types_found, es); |
|
| 2840 |
+ add_option (options, p, NULL, 0, 0, msglevel, permission_mask, option_types_found, es); |
|
| 2841 | 2841 |
} |
| 2842 | 2842 |
else |
| 2843 | 2843 |
{
|
| ... | ... |
@@ -2865,7 +2864,8 @@ parse_argv (struct options *options, |
| 2865 | 2865 |
break; |
| 2866 | 2866 |
} |
| 2867 | 2867 |
} |
| 2868 |
- i = add_option (options, i, p, NULL, 0, 0, msglevel, permission_mask, option_types_found, es); |
|
| 2868 |
+ add_option (options, p, NULL, 0, 0, msglevel, permission_mask, option_types_found, es); |
|
| 2869 |
+ i += j - 1; |
|
| 2869 | 2870 |
} |
| 2870 | 2871 |
} |
| 2871 | 2872 |
} |
| ... | ... |
@@ -2889,7 +2889,7 @@ apply_push_options (struct options *options, |
| 2889 | 2889 |
++line_num; |
| 2890 | 2890 |
if (parse_line (line, p, SIZE (p), file, line_num, msglevel, &options->gc)) |
| 2891 | 2891 |
{
|
| 2892 |
- add_option (options, 0, p, file, line_num, 0, msglevel, permission_mask, option_types_found, es); |
|
| 2892 |
+ add_option (options, p, file, line_num, 0, msglevel, permission_mask, option_types_found, es); |
|
| 2893 | 2893 |
} |
| 2894 | 2894 |
} |
| 2895 | 2895 |
return true; |
| ... | ... |
@@ -2960,21 +2960,6 @@ verify_permission (const char *name, |
| 2960 | 2960 |
#endif |
| 2961 | 2961 |
|
| 2962 | 2962 |
/* |
| 2963 |
- * Return the length of a string array |
|
| 2964 |
- */ |
|
| 2965 |
-static int |
|
| 2966 |
-string_array_len (char *array[]) |
|
| 2967 |
-{
|
|
| 2968 |
- int i = 0; |
|
| 2969 |
- if (array) |
|
| 2970 |
- {
|
|
| 2971 |
- while (array[i]) |
|
| 2972 |
- ++i; |
|
| 2973 |
- } |
|
| 2974 |
- return i; |
|
| 2975 |
-} |
|
| 2976 |
- |
|
| 2977 |
-/* |
|
| 2978 | 2963 |
* Check that an option doesn't have too |
| 2979 | 2964 |
* many parameters. |
| 2980 | 2965 |
*/ |
| ... | ... |
@@ -2987,7 +2972,7 @@ no_more_than_n_args (const int msglevel, |
| 2987 | 2987 |
const int max, |
| 2988 | 2988 |
const unsigned int flags) |
| 2989 | 2989 |
{
|
| 2990 |
- const int len = string_array_len (p); |
|
| 2990 |
+ const int len = string_array_len ((const char **)p); |
|
| 2991 | 2991 |
|
| 2992 | 2992 |
if (!len) |
| 2993 | 2993 |
return false; |
| ... | ... |
@@ -3005,9 +2990,8 @@ no_more_than_n_args (const int msglevel, |
| 3005 | 3005 |
return true; |
| 3006 | 3006 |
} |
| 3007 | 3007 |
|
| 3008 |
-static int |
|
| 3008 |
+static void |
|
| 3009 | 3009 |
add_option (struct options *options, |
| 3010 |
- int i, |
|
| 3011 | 3010 |
char *p[], |
| 3012 | 3011 |
const char *file, |
| 3013 | 3012 |
int line, |
| ... | ... |
@@ -3037,7 +3021,6 @@ add_option (struct options *options, |
| 3037 | 3037 |
} |
| 3038 | 3038 |
else if (streq (p[0], "config") && p[1]) |
| 3039 | 3039 |
{
|
| 3040 |
- ++i; |
|
| 3041 | 3040 |
VERIFY_PERMISSION (OPT_P_CONFIG); |
| 3042 | 3041 |
|
| 3043 | 3042 |
/* save first config file only in options */ |
| ... | ... |
@@ -3058,7 +3041,6 @@ add_option (struct options *options, |
| 3058 | 3058 |
{
|
| 3059 | 3059 |
if (!p[j]) |
| 3060 | 3060 |
break; |
| 3061 |
- ++i; |
|
| 3062 | 3061 |
if (j > 1) |
| 3063 | 3062 |
buf_printf (&string, " "); |
| 3064 | 3063 |
buf_printf (&string, "%s", p[j]); |
| ... | ... |
@@ -3076,7 +3058,6 @@ add_option (struct options *options, |
| 3076 | 3076 |
{
|
| 3077 | 3077 |
int port; |
| 3078 | 3078 |
|
| 3079 |
- i += 2; |
|
| 3080 | 3079 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3081 | 3080 |
port = atoi (p[2]); |
| 3082 | 3081 |
if (!legal_ipv4_port (port)) |
| ... | ... |
@@ -3089,7 +3070,6 @@ add_option (struct options *options, |
| 3089 | 3089 |
options->management_port = port; |
| 3090 | 3090 |
if (p[3]) |
| 3091 | 3091 |
{
|
| 3092 |
- ++i; |
|
| 3093 | 3092 |
options->management_user_pass = p[3]; |
| 3094 | 3093 |
} |
| 3095 | 3094 |
} |
| ... | ... |
@@ -3107,7 +3087,6 @@ add_option (struct options *options, |
| 3107 | 3107 |
{
|
| 3108 | 3108 |
int cache; |
| 3109 | 3109 |
|
| 3110 |
- ++i; |
|
| 3111 | 3110 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3112 | 3111 |
cache = atoi (p[1]); |
| 3113 | 3112 |
if (cache < 1) |
| ... | ... |
@@ -3121,15 +3100,10 @@ add_option (struct options *options, |
| 3121 | 3121 |
#ifdef ENABLE_PLUGIN |
| 3122 | 3122 |
else if (streq (p[0], "plugin") && p[1]) |
| 3123 | 3123 |
{
|
| 3124 |
- ++i; |
|
| 3125 | 3124 |
VERIFY_PERMISSION (OPT_P_PLUGIN); |
| 3126 |
- if (p[2]) |
|
| 3127 |
- ++i; |
|
| 3128 |
- if (!no_more_than_n_args (msglevel, p, 3, NM_QUOTE_HINT)) |
|
| 3129 |
- goto err; |
|
| 3130 | 3125 |
if (!options->plugin_list) |
| 3131 | 3126 |
options->plugin_list = plugin_option_list_new (&options->gc); |
| 3132 |
- if (!plugin_option_list_add (options->plugin_list, p[1], p[2])) |
|
| 3127 |
+ if (!plugin_option_list_add (options->plugin_list, &p[1], &options->gc)) |
|
| 3133 | 3128 |
{
|
| 3134 | 3129 |
msg (msglevel, "plugin add failed: %s", p[1]); |
| 3135 | 3130 |
goto err; |
| ... | ... |
@@ -3138,7 +3112,6 @@ add_option (struct options *options, |
| 3138 | 3138 |
#endif |
| 3139 | 3139 |
else if (streq (p[0], "mode") && p[1]) |
| 3140 | 3140 |
{
|
| 3141 |
- ++i; |
|
| 3142 | 3141 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3143 | 3142 |
if (streq (p[1], "p2p")) |
| 3144 | 3143 |
options->mode = MODE_POINT_TO_POINT; |
| ... | ... |
@@ -3154,25 +3127,21 @@ add_option (struct options *options, |
| 3154 | 3154 |
} |
| 3155 | 3155 |
else if (streq (p[0], "dev") && p[1]) |
| 3156 | 3156 |
{
|
| 3157 |
- ++i; |
|
| 3158 | 3157 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3159 | 3158 |
options->dev = p[1]; |
| 3160 | 3159 |
} |
| 3161 | 3160 |
else if (streq (p[0], "dev-type") && p[1]) |
| 3162 | 3161 |
{
|
| 3163 |
- ++i; |
|
| 3164 | 3162 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3165 | 3163 |
options->dev_type = p[1]; |
| 3166 | 3164 |
} |
| 3167 | 3165 |
else if (streq (p[0], "dev-node") && p[1]) |
| 3168 | 3166 |
{
|
| 3169 |
- ++i; |
|
| 3170 | 3167 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3171 | 3168 |
options->dev_node = p[1]; |
| 3172 | 3169 |
} |
| 3173 | 3170 |
else if (streq (p[0], "topology") && p[1]) |
| 3174 | 3171 |
{
|
| 3175 |
- ++i; |
|
| 3176 | 3172 |
VERIFY_PERMISSION (OPT_P_UP); |
| 3177 | 3173 |
options->topology = parse_topology (p[1], msglevel); |
| 3178 | 3174 |
} |
| ... | ... |
@@ -3183,7 +3152,6 @@ add_option (struct options *options, |
| 3183 | 3183 |
} |
| 3184 | 3184 |
else if (streq (p[0], "ifconfig") && p[1] && p[2]) |
| 3185 | 3185 |
{
|
| 3186 |
- i += 2; |
|
| 3187 | 3186 |
VERIFY_PERMISSION (OPT_P_UP); |
| 3188 | 3187 |
options->ifconfig_local = p[1]; |
| 3189 | 3188 |
options->ifconfig_remote_netmask = p[2]; |
| ... | ... |
@@ -3200,7 +3168,6 @@ add_option (struct options *options, |
| 3200 | 3200 |
} |
| 3201 | 3201 |
else if (streq (p[0], "local") && p[1]) |
| 3202 | 3202 |
{
|
| 3203 |
- ++i; |
|
| 3204 | 3203 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3205 | 3204 |
options->local = p[1]; |
| 3206 | 3205 |
} |
| ... | ... |
@@ -3214,7 +3181,6 @@ add_option (struct options *options, |
| 3214 | 3214 |
struct remote_list *l; |
| 3215 | 3215 |
struct remote_entry e; |
| 3216 | 3216 |
|
| 3217 |
- ++i; |
|
| 3218 | 3217 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3219 | 3218 |
if (!options->remote_list) |
| 3220 | 3219 |
ALLOC_OBJ_CLEAR_GC (options->remote_list, struct remote_list, &options->gc); |
| ... | ... |
@@ -3227,7 +3193,6 @@ add_option (struct options *options, |
| 3227 | 3227 |
e.hostname = p[1]; |
| 3228 | 3228 |
if (p[2]) |
| 3229 | 3229 |
{
|
| 3230 |
- ++i; |
|
| 3231 | 3230 |
e.port = atoi (p[2]); |
| 3232 | 3231 |
if (!legal_ipv4_port (e.port)) |
| 3233 | 3232 |
{
|
| ... | ... |
@@ -3241,7 +3206,6 @@ add_option (struct options *options, |
| 3241 | 3241 |
} |
| 3242 | 3242 |
else if (streq (p[0], "resolv-retry") && p[1]) |
| 3243 | 3243 |
{
|
| 3244 |
- ++i; |
|
| 3245 | 3244 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3246 | 3245 |
if (streq (p[1], "infinite")) |
| 3247 | 3246 |
options->resolve_retry_seconds = RESOLV_RETRY_INFINITE; |
| ... | ... |
@@ -3250,14 +3214,12 @@ add_option (struct options *options, |
| 3250 | 3250 |
} |
| 3251 | 3251 |
else if (streq (p[0], "connect-retry") && p[1]) |
| 3252 | 3252 |
{
|
| 3253 |
- ++i; |
|
| 3254 | 3253 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3255 | 3254 |
options->connect_retry_seconds = positive_atoi (p[1]); |
| 3256 | 3255 |
options->connect_retry_defined = true; |
| 3257 | 3256 |
} |
| 3258 | 3257 |
else if (streq (p[0], "ipchange") && p[1]) |
| 3259 | 3258 |
{
|
| 3260 |
- ++i; |
|
| 3261 | 3259 |
VERIFY_PERMISSION (OPT_P_SCRIPT); |
| 3262 | 3260 |
if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT)) |
| 3263 | 3261 |
goto err; |
| ... | ... |
@@ -3271,20 +3233,17 @@ add_option (struct options *options, |
| 3271 | 3271 |
#ifdef ENABLE_DEBUG |
| 3272 | 3272 |
else if (streq (p[0], "gremlin") && p[1]) |
| 3273 | 3273 |
{
|
| 3274 |
- ++i; |
|
| 3275 | 3274 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3276 | 3275 |
options->gremlin = positive_atoi (p[1]); |
| 3277 | 3276 |
} |
| 3278 | 3277 |
#endif |
| 3279 | 3278 |
else if (streq (p[0], "chroot") && p[1]) |
| 3280 | 3279 |
{
|
| 3281 |
- ++i; |
|
| 3282 | 3280 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3283 | 3281 |
options->chroot_dir = p[1]; |
| 3284 | 3282 |
} |
| 3285 | 3283 |
else if (streq (p[0], "cd") && p[1]) |
| 3286 | 3284 |
{
|
| 3287 |
- ++i; |
|
| 3288 | 3285 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3289 | 3286 |
if (openvpn_chdir (p[1])) |
| 3290 | 3287 |
{
|
| ... | ... |
@@ -3295,13 +3254,11 @@ add_option (struct options *options, |
| 3295 | 3295 |
} |
| 3296 | 3296 |
else if (streq (p[0], "writepid") && p[1]) |
| 3297 | 3297 |
{
|
| 3298 |
- ++i; |
|
| 3299 | 3298 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3300 | 3299 |
options->writepid = p[1]; |
| 3301 | 3300 |
} |
| 3302 | 3301 |
else if (streq (p[0], "up") && p[1]) |
| 3303 | 3302 |
{
|
| 3304 |
- ++i; |
|
| 3305 | 3303 |
VERIFY_PERMISSION (OPT_P_SCRIPT); |
| 3306 | 3304 |
if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT)) |
| 3307 | 3305 |
goto err; |
| ... | ... |
@@ -3309,7 +3266,6 @@ add_option (struct options *options, |
| 3309 | 3309 |
} |
| 3310 | 3310 |
else if (streq (p[0], "down") && p[1]) |
| 3311 | 3311 |
{
|
| 3312 |
- ++i; |
|
| 3313 | 3312 |
VERIFY_PERMISSION (OPT_P_SCRIPT); |
| 3314 | 3313 |
if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT)) |
| 3315 | 3314 |
goto err; |
| ... | ... |
@@ -3333,8 +3289,6 @@ add_option (struct options *options, |
| 3333 | 3333 |
else if (streq (p[0], "syslog")) |
| 3334 | 3334 |
{
|
| 3335 | 3335 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3336 |
- if (p[1]) |
|
| 3337 |
- ++i; |
|
| 3338 | 3336 |
open_syslog (p[1], false); |
| 3339 | 3337 |
} |
| 3340 | 3338 |
else if (streq (p[0], "daemon")) |
| ... | ... |
@@ -3348,7 +3302,6 @@ add_option (struct options *options, |
| 3348 | 3348 |
} |
| 3349 | 3349 |
if (p[1]) |
| 3350 | 3350 |
{
|
| 3351 |
- ++i; |
|
| 3352 | 3351 |
if (!didit) |
| 3353 | 3352 |
{
|
| 3354 | 3353 |
msg (M_WARN, "WARNING: Multiple --daemon directives specified, ignoring --daemon %s. (Note that initscripts sometimes add their own --daemon directive.)", p[1]); |
| ... | ... |
@@ -3371,7 +3324,6 @@ add_option (struct options *options, |
| 3371 | 3371 |
{
|
| 3372 | 3372 |
if (p[z]) |
| 3373 | 3373 |
{
|
| 3374 |
- ++i; |
|
| 3375 | 3374 |
if (streq (p[z], "wait")) |
| 3376 | 3375 |
{
|
| 3377 | 3376 |
if (options->inetd != -1) |
| ... | ... |
@@ -3414,21 +3366,18 @@ add_option (struct options *options, |
| 3414 | 3414 |
} |
| 3415 | 3415 |
else if (streq (p[0], "log") && p[1]) |
| 3416 | 3416 |
{
|
| 3417 |
- ++i; |
|
| 3418 | 3417 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3419 | 3418 |
options->log = true; |
| 3420 | 3419 |
redirect_stdout_stderr (p[1], false); |
| 3421 | 3420 |
} |
| 3422 | 3421 |
else if (streq (p[0], "suppress-timestamps")) |
| 3423 | 3422 |
{
|
| 3424 |
- ++i; |
|
| 3425 | 3423 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3426 | 3424 |
options->suppress_timestamps = true; |
| 3427 | 3425 |
set_suppress_timestamps(true); |
| 3428 | 3426 |
} |
| 3429 | 3427 |
else if (streq (p[0], "log-append") && p[1]) |
| 3430 | 3428 |
{
|
| 3431 |
- ++i; |
|
| 3432 | 3429 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3433 | 3430 |
options->log = true; |
| 3434 | 3431 |
redirect_stdout_stderr (p[1], true); |
| ... | ... |
@@ -3447,24 +3396,20 @@ add_option (struct options *options, |
| 3447 | 3447 |
#endif |
| 3448 | 3448 |
else if (streq (p[0], "verb") && p[1]) |
| 3449 | 3449 |
{
|
| 3450 |
- ++i; |
|
| 3451 | 3450 |
VERIFY_PERMISSION (OPT_P_MESSAGES); |
| 3452 | 3451 |
options->verbosity = positive_atoi (p[1]); |
| 3453 | 3452 |
} |
| 3454 | 3453 |
else if (streq (p[0], "mute") && p[1]) |
| 3455 | 3454 |
{
|
| 3456 |
- ++i; |
|
| 3457 | 3455 |
VERIFY_PERMISSION (OPT_P_MESSAGES); |
| 3458 | 3456 |
options->mute = positive_atoi (p[1]); |
| 3459 | 3457 |
} |
| 3460 | 3458 |
else if (streq (p[0], "status") && p[1]) |
| 3461 | 3459 |
{
|
| 3462 |
- ++i; |
|
| 3463 | 3460 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3464 | 3461 |
options->status_file = p[1]; |
| 3465 | 3462 |
if (p[2]) |
| 3466 | 3463 |
{
|
| 3467 |
- ++i; |
|
| 3468 | 3464 |
options->status_file_update_freq = positive_atoi (p[2]); |
| 3469 | 3465 |
} |
| 3470 | 3466 |
} |
| ... | ... |
@@ -3472,7 +3417,6 @@ add_option (struct options *options, |
| 3472 | 3472 |
{
|
| 3473 | 3473 |
int version; |
| 3474 | 3474 |
|
| 3475 |
- ++i; |
|
| 3476 | 3475 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3477 | 3476 |
version = atoi (p[1]); |
| 3478 | 3477 |
if (version < 1 || version > 2) |
| ... | ... |
@@ -3484,7 +3428,6 @@ add_option (struct options *options, |
| 3484 | 3484 |
} |
| 3485 | 3485 |
else if (streq (p[0], "remap-usr1") && p[1]) |
| 3486 | 3486 |
{
|
| 3487 |
- ++i; |
|
| 3488 | 3487 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3489 | 3488 |
if (streq (p[1], "SIGHUP")) |
| 3490 | 3489 |
options->remap_sigusr1 = SIGHUP; |
| ... | ... |
@@ -3498,21 +3441,18 @@ add_option (struct options *options, |
| 3498 | 3498 |
} |
| 3499 | 3499 |
else if ((streq (p[0], "link-mtu") || streq (p[0], "udp-mtu")) && p[1]) |
| 3500 | 3500 |
{
|
| 3501 |
- ++i; |
|
| 3502 | 3501 |
VERIFY_PERMISSION (OPT_P_MTU); |
| 3503 | 3502 |
options->link_mtu = positive_atoi (p[1]); |
| 3504 | 3503 |
options->link_mtu_defined = true; |
| 3505 | 3504 |
} |
| 3506 | 3505 |
else if (streq (p[0], "tun-mtu") && p[1]) |
| 3507 | 3506 |
{
|
| 3508 |
- ++i; |
|
| 3509 | 3507 |
VERIFY_PERMISSION (OPT_P_MTU); |
| 3510 | 3508 |
options->tun_mtu = positive_atoi (p[1]); |
| 3511 | 3509 |
options->tun_mtu_defined = true; |
| 3512 | 3510 |
} |
| 3513 | 3511 |
else if (streq (p[0], "tun-mtu-extra") && p[1]) |
| 3514 | 3512 |
{
|
| 3515 |
- ++i; |
|
| 3516 | 3513 |
VERIFY_PERMISSION (OPT_P_MTU); |
| 3517 | 3514 |
options->tun_mtu_extra = positive_atoi (p[1]); |
| 3518 | 3515 |
options->tun_mtu_extra_defined = true; |
| ... | ... |
@@ -3526,14 +3466,12 @@ add_option (struct options *options, |
| 3526 | 3526 |
} |
| 3527 | 3527 |
else if (streq (p[0], "fragment") && p[1]) |
| 3528 | 3528 |
{
|
| 3529 |
- ++i; |
|
| 3530 | 3529 |
VERIFY_PERMISSION (OPT_P_MTU); |
| 3531 | 3530 |
options->fragment = positive_atoi (p[1]); |
| 3532 | 3531 |
} |
| 3533 | 3532 |
#endif |
| 3534 | 3533 |
else if (streq (p[0], "mtu-disc") && p[1]) |
| 3535 | 3534 |
{
|
| 3536 |
- ++i; |
|
| 3537 | 3535 |
VERIFY_PERMISSION (OPT_P_MTU); |
| 3538 | 3536 |
options->mtu_discover_type = translate_mtu_discover_type_name (p[1]); |
| 3539 | 3537 |
} |
| ... | ... |
@@ -3546,19 +3484,16 @@ add_option (struct options *options, |
| 3546 | 3546 |
#endif |
| 3547 | 3547 |
else if (streq (p[0], "nice") && p[1]) |
| 3548 | 3548 |
{
|
| 3549 |
- ++i; |
|
| 3550 | 3549 |
VERIFY_PERMISSION (OPT_P_NICE); |
| 3551 | 3550 |
options->nice = atoi (p[1]); |
| 3552 | 3551 |
} |
| 3553 | 3552 |
else if (streq (p[0], "rcvbuf") && p[1]) |
| 3554 | 3553 |
{
|
| 3555 |
- ++i; |
|
| 3556 | 3554 |
VERIFY_PERMISSION (OPT_P_SOCKBUF); |
| 3557 | 3555 |
options->rcvbuf = positive_atoi (p[1]); |
| 3558 | 3556 |
} |
| 3559 | 3557 |
else if (streq (p[0], "sndbuf") && p[1]) |
| 3560 | 3558 |
{
|
| 3561 |
- ++i; |
|
| 3562 | 3559 |
VERIFY_PERMISSION (OPT_P_SOCKBUF); |
| 3563 | 3560 |
options->sndbuf = positive_atoi (p[1]); |
| 3564 | 3561 |
} |
| ... | ... |
@@ -3568,7 +3503,6 @@ add_option (struct options *options, |
| 3568 | 3568 |
VERIFY_PERMISSION (OPT_P_SOCKFLAGS); |
| 3569 | 3569 |
for (j = 1; j < MAX_PARMS && p[j]; ++j) |
| 3570 | 3570 |
{
|
| 3571 |
- ++i; |
|
| 3572 | 3571 |
if (streq (p[j], "TCP_NODELAY")) |
| 3573 | 3572 |
options->sockflags |= SF_TCP_NODELAY; |
| 3574 | 3573 |
else |
| ... | ... |
@@ -3577,7 +3511,6 @@ add_option (struct options *options, |
| 3577 | 3577 |
} |
| 3578 | 3578 |
else if (streq (p[0], "txqueuelen") && p[1]) |
| 3579 | 3579 |
{
|
| 3580 |
- ++i; |
|
| 3581 | 3580 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3582 | 3581 |
#ifdef TARGET_LINUX |
| 3583 | 3582 |
options->tuntap_options.txqueuelen = positive_atoi (p[1]); |
| ... | ... |
@@ -3589,7 +3522,6 @@ add_option (struct options *options, |
| 3589 | 3589 |
#ifdef USE_PTHREAD |
| 3590 | 3590 |
else if (streq (p[0], "nice-work") && p[1]) |
| 3591 | 3591 |
{
|
| 3592 |
- ++i; |
|
| 3593 | 3592 |
VERIFY_PERMISSION (OPT_P_NICE); |
| 3594 | 3593 |
options->nice_work = atoi (p[1]); |
| 3595 | 3594 |
} |
| ... | ... |
@@ -3597,7 +3529,6 @@ add_option (struct options *options, |
| 3597 | 3597 |
{
|
| 3598 | 3598 |
int n_threads; |
| 3599 | 3599 |
|
| 3600 |
- ++i; |
|
| 3601 | 3600 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3602 | 3601 |
n_threads = positive_atoi (p[1]); |
| 3603 | 3602 |
if (n_threads < 1) |
| ... | ... |
@@ -3613,7 +3544,6 @@ add_option (struct options *options, |
| 3613 | 3613 |
#ifdef HAVE_GETTIMEOFDAY |
| 3614 | 3614 |
int shaper; |
| 3615 | 3615 |
|
| 3616 |
- ++i; |
|
| 3617 | 3616 |
VERIFY_PERMISSION (OPT_P_SHAPER); |
| 3618 | 3617 |
shaper = atoi (p[1]); |
| 3619 | 3618 |
if (shaper < SHAPER_MIN || shaper > SHAPER_MAX) |
| ... | ... |
@@ -3633,7 +3563,6 @@ add_option (struct options *options, |
| 3633 | 3633 |
{
|
| 3634 | 3634 |
int port; |
| 3635 | 3635 |
|
| 3636 |
- ++i; |
|
| 3637 | 3636 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3638 | 3637 |
port = atoi (p[1]); |
| 3639 | 3638 |
if (!legal_ipv4_port (port)) |
| ... | ... |
@@ -3648,7 +3577,6 @@ add_option (struct options *options, |
| 3648 | 3648 |
{
|
| 3649 | 3649 |
int port; |
| 3650 | 3650 |
|
| 3651 |
- ++i; |
|
| 3652 | 3651 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3653 | 3652 |
port = atoi (p[1]); |
| 3654 | 3653 |
if (!legal_ipv4_port (port)) |
| ... | ... |
@@ -3664,7 +3592,6 @@ add_option (struct options *options, |
| 3664 | 3664 |
{
|
| 3665 | 3665 |
int port; |
| 3666 | 3666 |
|
| 3667 |
- ++i; |
|
| 3668 | 3667 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3669 | 3668 |
port = atoi (p[1]); |
| 3670 | 3669 |
if (!legal_ipv4_port (port)) |
| ... | ... |
@@ -3692,14 +3619,12 @@ add_option (struct options *options, |
| 3692 | 3692 |
} |
| 3693 | 3693 |
else if (streq (p[0], "inactive") && p[1]) |
| 3694 | 3694 |
{
|
| 3695 |
- ++i; |
|
| 3696 | 3695 |
VERIFY_PERMISSION (OPT_P_TIMER); |
| 3697 | 3696 |
options->inactivity_timeout = positive_atoi (p[1]); |
| 3698 | 3697 |
} |
| 3699 | 3698 |
else if (streq (p[0], "proto") && p[1]) |
| 3700 | 3699 |
{
|
| 3701 | 3700 |
int proto; |
| 3702 |
- ++i; |
|
| 3703 | 3701 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3704 | 3702 |
proto = ascii2proto (p[1]); |
| 3705 | 3703 |
if (proto < 0) |
| ... | ... |
@@ -3717,7 +3642,6 @@ add_option (struct options *options, |
| 3717 | 3717 |
int port; |
| 3718 | 3718 |
struct http_proxy_options *ho; |
| 3719 | 3719 |
|
| 3720 |
- i += 2; |
|
| 3721 | 3720 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3722 | 3721 |
port = atoi (p[2]); |
| 3723 | 3722 |
if (!legal_ipv4_port (port)) |
| ... | ... |
@@ -3732,13 +3656,11 @@ add_option (struct options *options, |
| 3732 | 3732 |
ho->port = port; |
| 3733 | 3733 |
if (p[3]) |
| 3734 | 3734 |
{
|
| 3735 |
- ++i; |
|
| 3736 | 3735 |
ho->auth_method_string = "basic"; |
| 3737 | 3736 |
ho->auth_file = p[3]; |
| 3738 | 3737 |
|
| 3739 | 3738 |
if (p[4]) |
| 3740 | 3739 |
{
|
| 3741 |
- ++i; |
|
| 3742 | 3740 |
ho->auth_method_string = p[4]; |
| 3743 | 3741 |
} |
| 3744 | 3742 |
} |
| ... | ... |
@@ -3758,7 +3680,6 @@ add_option (struct options *options, |
| 3758 | 3758 |
{
|
| 3759 | 3759 |
struct http_proxy_options *ho; |
| 3760 | 3760 |
|
| 3761 |
- ++i; |
|
| 3762 | 3761 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3763 | 3762 |
ho = init_http_options_if_undefined (options); |
| 3764 | 3763 |
ho->timeout = positive_atoi (p[1]); |
| ... | ... |
@@ -3767,10 +3688,6 @@ add_option (struct options *options, |
| 3767 | 3767 |
{
|
| 3768 | 3768 |
struct http_proxy_options *ho; |
| 3769 | 3769 |
|
| 3770 |
- ++i; |
|
| 3771 |
- if (p[2]) |
|
| 3772 |
- ++i; |
|
| 3773 |
- |
|
| 3774 | 3770 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3775 | 3771 |
ho = init_http_options_if_undefined (options); |
| 3776 | 3772 |
|
| ... | ... |
@@ -3791,13 +3708,11 @@ add_option (struct options *options, |
| 3791 | 3791 |
#ifdef ENABLE_SOCKS |
| 3792 | 3792 |
else if (streq (p[0], "socks-proxy") && p[1]) |
| 3793 | 3793 |
{
|
| 3794 |
- ++i; |
|
| 3795 | 3794 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3796 | 3795 |
|
| 3797 | 3796 |
if (p[2]) |
| 3798 | 3797 |
{
|
| 3799 | 3798 |
int port; |
| 3800 |
- ++i; |
|
| 3801 | 3799 |
port = atoi (p[2]); |
| 3802 | 3800 |
if (!legal_ipv4_port (port)) |
| 3803 | 3801 |
{
|
| ... | ... |
@@ -3820,27 +3735,23 @@ add_option (struct options *options, |
| 3820 | 3820 |
#endif |
| 3821 | 3821 |
else if (streq (p[0], "keepalive") && p[1] && p[2]) |
| 3822 | 3822 |
{
|
| 3823 |
- i += 2; |
|
| 3824 | 3823 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3825 | 3824 |
options->keepalive_ping = atoi (p[1]); |
| 3826 | 3825 |
options->keepalive_timeout = atoi (p[2]); |
| 3827 | 3826 |
} |
| 3828 | 3827 |
else if (streq (p[0], "ping") && p[1]) |
| 3829 | 3828 |
{
|
| 3830 |
- ++i; |
|
| 3831 | 3829 |
VERIFY_PERMISSION (OPT_P_TIMER); |
| 3832 | 3830 |
options->ping_send_timeout = positive_atoi (p[1]); |
| 3833 | 3831 |
} |
| 3834 | 3832 |
else if (streq (p[0], "ping-exit") && p[1]) |
| 3835 | 3833 |
{
|
| 3836 |
- ++i; |
|
| 3837 | 3834 |
VERIFY_PERMISSION (OPT_P_TIMER); |
| 3838 | 3835 |
options->ping_rec_timeout = positive_atoi (p[1]); |
| 3839 | 3836 |
options->ping_rec_timeout_action = PING_EXIT; |
| 3840 | 3837 |
} |
| 3841 | 3838 |
else if (streq (p[0], "ping-restart") && p[1]) |
| 3842 | 3839 |
{
|
| 3843 |
- ++i; |
|
| 3844 | 3840 |
VERIFY_PERMISSION (OPT_P_TIMER); |
| 3845 | 3841 |
options->ping_rec_timeout = positive_atoi (p[1]); |
| 3846 | 3842 |
options->ping_rec_timeout_action = PING_RESTART; |
| ... | ... |
@@ -3856,7 +3767,6 @@ add_option (struct options *options, |
| 3856 | 3856 |
VERIFY_PERMISSION (OPT_P_EXPLICIT_NOTIFY); |
| 3857 | 3857 |
if (p[1]) |
| 3858 | 3858 |
{
|
| 3859 |
- ++i; |
|
| 3860 | 3859 |
options->explicit_exit_notification = positive_atoi (p[1]); |
| 3861 | 3860 |
} |
| 3862 | 3861 |
else |
| ... | ... |
@@ -3887,20 +3797,12 @@ add_option (struct options *options, |
| 3887 | 3887 |
} |
| 3888 | 3888 |
else if (streq (p[0], "route") && p[1]) |
| 3889 | 3889 |
{
|
| 3890 |
- ++i; |
|
| 3891 | 3890 |
VERIFY_PERMISSION (OPT_P_ROUTE); |
| 3892 |
- if (p[2]) |
|
| 3893 |
- ++i; |
|
| 3894 |
- if (p[3]) |
|
| 3895 |
- ++i; |
|
| 3896 |
- if (p[4]) |
|
| 3897 |
- ++i; |
|
| 3898 | 3891 |
rol_check_alloc (options); |
| 3899 | 3892 |
add_route_to_option_list (options->routes, p[1], p[2], p[3], p[4]); |
| 3900 | 3893 |
} |
| 3901 | 3894 |
else if (streq (p[0], "route-gateway") && p[1]) |
| 3902 | 3895 |
{
|
| 3903 |
- ++i; |
|
| 3904 | 3896 |
VERIFY_PERMISSION (OPT_P_ROUTE_EXTRAS); |
| 3905 | 3897 |
options->route_default_gateway = p[1]; |
| 3906 | 3898 |
} |
| ... | ... |
@@ -3910,11 +3812,9 @@ add_option (struct options *options, |
| 3910 | 3910 |
options->route_delay_defined = true; |
| 3911 | 3911 |
if (p[1]) |
| 3912 | 3912 |
{
|
| 3913 |
- ++i; |
|
| 3914 | 3913 |
options->route_delay = positive_atoi (p[1]); |
| 3915 | 3914 |
if (p[2]) |
| 3916 | 3915 |
{
|
| 3917 |
- ++i; |
|
| 3918 | 3916 |
options->route_delay_window = positive_atoi (p[2]); |
| 3919 | 3917 |
} |
| 3920 | 3918 |
} |
| ... | ... |
@@ -3925,7 +3825,6 @@ add_option (struct options *options, |
| 3925 | 3925 |
} |
| 3926 | 3926 |
else if (streq (p[0], "route-up") && p[1]) |
| 3927 | 3927 |
{
|
| 3928 |
- ++i; |
|
| 3929 | 3928 |
VERIFY_PERMISSION (OPT_P_SCRIPT); |
| 3930 | 3929 |
if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT)) |
| 3931 | 3930 |
goto err; |
| ... | ... |
@@ -3948,7 +3847,6 @@ add_option (struct options *options, |
| 3948 | 3948 |
rol_check_alloc (options); |
| 3949 | 3949 |
for (j = 1; j < MAX_PARMS && p[j] != NULL; ++j) |
| 3950 | 3950 |
{
|
| 3951 |
- ++i; |
|
| 3952 | 3951 |
if (streq (p[j], "local")) |
| 3953 | 3952 |
options->routes->flags |= RG_LOCAL; |
| 3954 | 3953 |
else if (streq (p[j], "def1")) |
| ... | ... |
@@ -3967,7 +3865,6 @@ add_option (struct options *options, |
| 3967 | 3967 |
} |
| 3968 | 3968 |
else if (streq (p[0], "setenv") && p[1] && p[2]) |
| 3969 | 3969 |
{
|
| 3970 |
- i += 2; |
|
| 3971 | 3970 |
VERIFY_PERMISSION (OPT_P_SETENV); |
| 3972 | 3971 |
setenv_str (es, p[1], p[2]); |
| 3973 | 3972 |
} |
| ... | ... |
@@ -3976,7 +3873,6 @@ add_option (struct options *options, |
| 3976 | 3976 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 3977 | 3977 |
if (p[1]) |
| 3978 | 3978 |
{
|
| 3979 |
- ++i; |
|
| 3980 | 3979 |
options->mssfix = positive_atoi (p[1]); |
| 3981 | 3980 |
} |
| 3982 | 3981 |
else |
| ... | ... |
@@ -3998,7 +3894,6 @@ add_option (struct options *options, |
| 3998 | 3998 |
bool error = false; |
| 3999 | 3999 |
in_addr_t network, netmask; |
| 4000 | 4000 |
|
| 4001 |
- i += 2; |
|
| 4002 | 4001 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4003 | 4002 |
network = get_ip_addr (p[1], lev, &error); |
| 4004 | 4003 |
netmask = get_ip_addr (p[2], lev, &error); |
| ... | ... |
@@ -4013,7 +3908,6 @@ add_option (struct options *options, |
| 4013 | 4013 |
|
| 4014 | 4014 |
if (p[3]) |
| 4015 | 4015 |
{
|
| 4016 |
- ++i; |
|
| 4017 | 4016 |
if (streq (p[3], "nopool")) |
| 4018 | 4017 |
options->server_flags |= SF_NOPOOL; |
| 4019 | 4018 |
else |
| ... | ... |
@@ -4029,7 +3923,6 @@ add_option (struct options *options, |
| 4029 | 4029 |
bool error = false; |
| 4030 | 4030 |
in_addr_t ip, netmask, pool_start, pool_end; |
| 4031 | 4031 |
|
| 4032 |
- i += 4; |
|
| 4033 | 4032 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4034 | 4033 |
ip = get_ip_addr (p[1], lev, &error); |
| 4035 | 4034 |
netmask = get_ip_addr (p[2], lev, &error); |
| ... | ... |
@@ -4048,11 +3941,8 @@ add_option (struct options *options, |
| 4048 | 4048 |
} |
| 4049 | 4049 |
else if (streq (p[0], "push") && p[1]) |
| 4050 | 4050 |
{
|
| 4051 |
- ++i; |
|
| 4052 | 4051 |
VERIFY_PERMISSION (OPT_P_PUSH); |
| 4053 |
- push_option (options, p[1], msglevel); |
|
| 4054 |
- if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT)) |
|
| 4055 |
- goto err; |
|
| 4052 |
+ push_options (options, &p[1], msglevel, &options->gc); |
|
| 4056 | 4053 |
} |
| 4057 | 4054 |
else if (streq (p[0], "push-reset")) |
| 4058 | 4055 |
{
|
| ... | ... |
@@ -4065,13 +3955,11 @@ add_option (struct options *options, |
| 4065 | 4065 |
bool error = false; |
| 4066 | 4066 |
in_addr_t start, end, netmask=0; |
| 4067 | 4067 |
|
| 4068 |
- i += 2; |
|
| 4069 | 4068 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4070 | 4069 |
start = get_ip_addr (p[1], lev, &error); |
| 4071 | 4070 |
end = get_ip_addr (p[2], lev, &error); |
| 4072 | 4071 |
if (p[3]) |
| 4073 | 4072 |
{
|
| 4074 |
- ++i; |
|
| 4075 | 4073 |
netmask = get_ip_addr (p[3], lev, &error); |
| 4076 | 4074 |
} |
| 4077 | 4075 |
if (error) |
| ... | ... |
@@ -4098,12 +3986,10 @@ add_option (struct options *options, |
| 4098 | 4098 |
} |
| 4099 | 4099 |
else if (streq (p[0], "ifconfig-pool-persist") && p[1]) |
| 4100 | 4100 |
{
|
| 4101 |
- ++i; |
|
| 4102 | 4101 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4103 | 4102 |
options->ifconfig_pool_persist_filename = p[1]; |
| 4104 | 4103 |
if (p[2]) |
| 4105 | 4104 |
{
|
| 4106 |
- ++i; |
|
| 4107 | 4105 |
options->ifconfig_pool_persist_refresh_freq = positive_atoi (p[2]); |
| 4108 | 4106 |
} |
| 4109 | 4107 |
} |
| ... | ... |
@@ -4116,7 +4002,6 @@ add_option (struct options *options, |
| 4116 | 4116 |
{
|
| 4117 | 4117 |
int real, virtual; |
| 4118 | 4118 |
|
| 4119 |
- i += 2; |
|
| 4120 | 4119 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4121 | 4120 |
real = atoi (p[1]); |
| 4122 | 4121 |
virtual = atoi (p[2]); |
| ... | ... |
@@ -4132,7 +4017,6 @@ add_option (struct options *options, |
| 4132 | 4132 |
{
|
| 4133 | 4133 |
int cf_max, cf_per; |
| 4134 | 4134 |
|
| 4135 |
- i += 2; |
|
| 4136 | 4135 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4137 | 4136 |
cf_max = atoi (p[1]); |
| 4138 | 4137 |
cf_per = atoi (p[2]); |
| ... | ... |
@@ -4148,7 +4032,6 @@ add_option (struct options *options, |
| 4148 | 4148 |
{
|
| 4149 | 4149 |
int max_clients; |
| 4150 | 4150 |
|
| 4151 |
- i += 1; |
|
| 4152 | 4151 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4153 | 4152 |
max_clients = atoi (p[1]); |
| 4154 | 4153 |
if (max_clients < 0) |
| ... | ... |
@@ -4160,7 +4043,6 @@ add_option (struct options *options, |
| 4160 | 4160 |
} |
| 4161 | 4161 |
else if (streq (p[0], "max-routes-per-client") && p[1]) |
| 4162 | 4162 |
{
|
| 4163 |
- i += 1; |
|
| 4164 | 4163 |
VERIFY_PERMISSION (OPT_P_INHERIT); |
| 4165 | 4164 |
options->max_routes_per_client = max_int (atoi (p[1]), 1); |
| 4166 | 4165 |
} |
| ... | ... |
@@ -4176,13 +4058,11 @@ add_option (struct options *options, |
| 4176 | 4176 |
} |
| 4177 | 4177 |
else if (streq (p[0], "auth-user-pass-verify") && p[1]) |
| 4178 | 4178 |
{
|
| 4179 |
- ++i; |
|
| 4180 | 4179 |
VERIFY_PERMISSION (OPT_P_SCRIPT); |
| 4181 | 4180 |
if (!no_more_than_n_args (msglevel, p, 3, NM_QUOTE_HINT)) |
| 4182 | 4181 |
goto err; |
| 4183 | 4182 |
if (p[2]) |
| 4184 | 4183 |
{
|
| 4185 |
- ++i; |
|
| 4186 | 4184 |
if (streq (p[2], "via-env")) |
| 4187 | 4185 |
options->auth_user_pass_verify_script_via_file = false; |
| 4188 | 4186 |
else if (streq (p[2], "via-file")) |
| ... | ... |
@@ -4202,7 +4082,6 @@ add_option (struct options *options, |
| 4202 | 4202 |
} |
| 4203 | 4203 |
else if (streq (p[0], "client-connect") && p[1]) |
| 4204 | 4204 |
{
|
| 4205 |
- ++i; |
|
| 4206 | 4205 |
VERIFY_PERMISSION (OPT_P_SCRIPT); |
| 4207 | 4206 |
if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT)) |
| 4208 | 4207 |
goto err; |
| ... | ... |
@@ -4210,7 +4089,6 @@ add_option (struct options *options, |
| 4210 | 4210 |
} |
| 4211 | 4211 |
else if (streq (p[0], "client-disconnect") && p[1]) |
| 4212 | 4212 |
{
|
| 4213 |
- ++i; |
|
| 4214 | 4213 |
VERIFY_PERMISSION (OPT_P_SCRIPT); |
| 4215 | 4214 |
if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT)) |
| 4216 | 4215 |
goto err; |
| ... | ... |
@@ -4218,7 +4096,6 @@ add_option (struct options *options, |
| 4218 | 4218 |
} |
| 4219 | 4219 |
else if (streq (p[0], "learn-address") && p[1]) |
| 4220 | 4220 |
{
|
| 4221 |
- ++i; |
|
| 4222 | 4221 |
VERIFY_PERMISSION (OPT_P_SCRIPT); |
| 4223 | 4222 |
if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT)) |
| 4224 | 4223 |
goto err; |
| ... | ... |
@@ -4226,13 +4103,11 @@ add_option (struct options *options, |
| 4226 | 4226 |
} |
| 4227 | 4227 |
else if (streq (p[0], "tmp-dir") && p[1]) |
| 4228 | 4228 |
{
|
| 4229 |
- ++i; |
|
| 4230 | 4229 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4231 | 4230 |
options->tmp_dir = p[1]; |
| 4232 | 4231 |
} |
| 4233 | 4232 |
else if (streq (p[0], "client-config-dir") && p[1]) |
| 4234 | 4233 |
{
|
| 4235 |
- ++i; |
|
| 4236 | 4234 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4237 | 4235 |
options->client_config_dir = p[1]; |
| 4238 | 4236 |
} |
| ... | ... |
@@ -4245,7 +4120,6 @@ add_option (struct options *options, |
| 4245 | 4245 |
{
|
| 4246 | 4246 |
int n_bcast_buf; |
| 4247 | 4247 |
|
| 4248 |
- ++i; |
|
| 4249 | 4248 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4250 | 4249 |
n_bcast_buf = atoi (p[1]); |
| 4251 | 4250 |
if (n_bcast_buf < 1) |
| ... | ... |
@@ -4256,7 +4130,6 @@ add_option (struct options *options, |
| 4256 | 4256 |
{
|
| 4257 | 4257 |
int tcp_queue_limit; |
| 4258 | 4258 |
|
| 4259 |
- ++i; |
|
| 4260 | 4259 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4261 | 4260 |
tcp_queue_limit = atoi (p[1]); |
| 4262 | 4261 |
if (tcp_queue_limit < 1) |
| ... | ... |
@@ -4277,11 +4150,9 @@ add_option (struct options *options, |
| 4277 | 4277 |
{
|
| 4278 | 4278 |
const char *netmask = NULL; |
| 4279 | 4279 |
|
| 4280 |
- ++i; |
|
| 4281 | 4280 |
VERIFY_PERMISSION (OPT_P_INSTANCE); |
| 4282 | 4281 |
if (p[2]) |
| 4283 | 4282 |
{
|
| 4284 |
- ++i; |
|
| 4285 | 4283 |
netmask = p[2]; |
| 4286 | 4284 |
} |
| 4287 | 4285 |
option_iroute (options, p[1], netmask, msglevel); |
| ... | ... |
@@ -4290,7 +4161,6 @@ add_option (struct options *options, |
| 4290 | 4290 |
{
|
| 4291 | 4291 |
in_addr_t local, remote_netmask; |
| 4292 | 4292 |
|
| 4293 |
- i += 2; |
|
| 4294 | 4293 |
VERIFY_PERMISSION (OPT_P_INSTANCE); |
| 4295 | 4294 |
local = getaddr (GETADDR_HOST_ORDER|GETADDR_RESOLVE, p[1], 0, NULL, NULL); |
| 4296 | 4295 |
remote_netmask = getaddr (GETADDR_HOST_ORDER|GETADDR_RESOLVE, p[2], 0, NULL, NULL); |
| ... | ... |
@@ -4310,7 +4180,6 @@ add_option (struct options *options, |
| 4310 | 4310 |
{
|
| 4311 | 4311 |
in_addr_t network, netmask; |
| 4312 | 4312 |
|
| 4313 |
- i += 2; |
|
| 4314 | 4313 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4315 | 4314 |
network = getaddr (GETADDR_HOST_ORDER|GETADDR_RESOLVE, p[1], 0, NULL, NULL); |
| 4316 | 4315 |
netmask = getaddr (GETADDR_HOST_ORDER, p[2], 0, NULL, NULL); |
| ... | ... |
@@ -4348,7 +4217,6 @@ add_option (struct options *options, |
| 4348 | 4348 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4349 | 4349 |
if (p[1]) |
| 4350 | 4350 |
{
|
| 4351 |
- ++i; |
|
| 4352 | 4351 |
options->auth_user_pass_file = p[1]; |
| 4353 | 4352 |
} |
| 4354 | 4353 |
else |
| ... | ... |
@@ -4356,7 +4224,6 @@ add_option (struct options *options, |
| 4356 | 4356 |
} |
| 4357 | 4357 |
else if (streq (p[0], "auth-retry") && p[1]) |
| 4358 | 4358 |
{
|
| 4359 |
- ++i; |
|
| 4360 | 4359 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4361 | 4360 |
auth_retry_set (msglevel, p[1]); |
| 4362 | 4361 |
} |
| ... | ... |
@@ -4364,7 +4231,6 @@ add_option (struct options *options, |
| 4364 | 4364 |
#ifdef WIN32 |
| 4365 | 4365 |
else if (streq (p[0], "route-method") && p[1]) |
| 4366 | 4366 |
{
|
| 4367 |
- ++i; |
|
| 4368 | 4367 |
VERIFY_PERMISSION (OPT_P_ROUTE_EXTRAS); |
| 4369 | 4368 |
if (streq (p[1], "ipapi")) |
| 4370 | 4369 |
options->route_method = ROUTE_METHOD_IPAPI; |
| ... | ... |
@@ -4381,7 +4247,6 @@ add_option (struct options *options, |
| 4381 | 4381 |
const int index = ascii2ipset (p[1]); |
| 4382 | 4382 |
struct tuntap_options *to = &options->tuntap_options; |
| 4383 | 4383 |
|
| 4384 |
- ++i; |
|
| 4385 | 4384 |
VERIFY_PERMISSION (OPT_P_IPWIN32); |
| 4386 | 4385 |
|
| 4387 | 4386 |
if (index < 0) |
| ... | ... |
@@ -4400,7 +4265,6 @@ add_option (struct options *options, |
| 4400 | 4400 |
{
|
| 4401 | 4401 |
if (p[2]) |
| 4402 | 4402 |
{
|
| 4403 |
- ++i; |
|
| 4404 | 4403 |
if (!streq (p[2], "default")) |
| 4405 | 4404 |
{
|
| 4406 | 4405 |
int offset = atoi (p[2]); |
| ... | ... |
@@ -4419,7 +4283,6 @@ add_option (struct options *options, |
| 4419 | 4419 |
{
|
| 4420 | 4420 |
const int min_lease = 30; |
| 4421 | 4421 |
int lease_time; |
| 4422 |
- ++i; |
|
| 4423 | 4422 |
lease_time = atoi (p[3]); |
| 4424 | 4423 |
if (lease_time < min_lease) |
| 4425 | 4424 |
{
|
| ... | ... |
@@ -4436,23 +4299,19 @@ add_option (struct options *options, |
| 4436 | 4436 |
else if (streq (p[0], "dhcp-option") && p[1]) |
| 4437 | 4437 |
{
|
| 4438 | 4438 |
struct tuntap_options *o = &options->tuntap_options; |
| 4439 |
- ++i; |
|
| 4440 | 4439 |
VERIFY_PERMISSION (OPT_P_IPWIN32); |
| 4441 | 4440 |
|
| 4442 | 4441 |
if (streq (p[1], "DOMAIN") && p[2]) |
| 4443 | 4442 |
{
|
| 4444 |
- ++i; |
|
| 4445 | 4443 |
o->domain = p[2]; |
| 4446 | 4444 |
} |
| 4447 | 4445 |
else if (streq (p[1], "NBS") && p[2]) |
| 4448 | 4446 |
{
|
| 4449 |
- ++i; |
|
| 4450 | 4447 |
o->netbios_scope = p[2]; |
| 4451 | 4448 |
} |
| 4452 | 4449 |
else if (streq (p[1], "NBT") && p[2]) |
| 4453 | 4450 |
{
|
| 4454 | 4451 |
int t; |
| 4455 |
- ++i; |
|
| 4456 | 4452 |
t = atoi (p[2]); |
| 4457 | 4453 |
if (!(t == 1 || t == 2 || t == 4 || t == 8)) |
| 4458 | 4454 |
{
|
| ... | ... |
@@ -4463,22 +4322,18 @@ add_option (struct options *options, |
| 4463 | 4463 |
} |
| 4464 | 4464 |
else if (streq (p[1], "DNS") && p[2]) |
| 4465 | 4465 |
{
|
| 4466 |
- ++i; |
|
| 4467 | 4466 |
dhcp_option_address_parse ("DNS", p[2], o->dns, &o->dns_len, msglevel);
|
| 4468 | 4467 |
} |
| 4469 | 4468 |
else if (streq (p[1], "WINS") && p[2]) |
| 4470 | 4469 |
{
|
| 4471 |
- ++i; |
|
| 4472 | 4470 |
dhcp_option_address_parse ("WINS", p[2], o->wins, &o->wins_len, msglevel);
|
| 4473 | 4471 |
} |
| 4474 | 4472 |
else if (streq (p[1], "NTP") && p[2]) |
| 4475 | 4473 |
{
|
| 4476 |
- ++i; |
|
| 4477 | 4474 |
dhcp_option_address_parse ("NTP", p[2], o->ntp, &o->ntp_len, msglevel);
|
| 4478 | 4475 |
} |
| 4479 | 4476 |
else if (streq (p[1], "NBDD") && p[2]) |
| 4480 | 4477 |
{
|
| 4481 |
- ++i; |
|
| 4482 | 4478 |
dhcp_option_address_parse ("NBDD", p[2], o->nbdd, &o->nbdd_len, msglevel);
|
| 4483 | 4479 |
} |
| 4484 | 4480 |
else if (streq (p[1], "DISABLE-NBT")) |
| ... | ... |
@@ -4513,7 +4368,6 @@ add_option (struct options *options, |
| 4513 | 4513 |
else if (streq (p[0], "tap-sleep") && p[1]) |
| 4514 | 4514 |
{
|
| 4515 | 4515 |
int s; |
| 4516 |
- ++i; |
|
| 4517 | 4516 |
VERIFY_PERMISSION (OPT_P_IPWIN32); |
| 4518 | 4517 |
s = atoi (p[1]); |
| 4519 | 4518 |
if (s < 0 || s >= 256) |
| ... | ... |
@@ -4551,59 +4405,47 @@ add_option (struct options *options, |
| 4551 | 4551 |
} |
| 4552 | 4552 |
else if (streq (p[0], "service") && p[1]) |
| 4553 | 4553 |
{
|
| 4554 |
- ++i; |
|
| 4555 | 4554 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4556 | 4555 |
options->exit_event_name = p[1]; |
| 4557 | 4556 |
if (p[2]) |
| 4558 | 4557 |
{
|
| 4559 |
- ++i; |
|
| 4560 | 4558 |
options->exit_event_initial_state = (atoi(p[2]) != 0); |
| 4561 | 4559 |
} |
| 4562 | 4560 |
} |
| 4563 | 4561 |
else if (streq (p[0], "allow-nonadmin")) |
| 4564 | 4562 |
{
|
| 4565 | 4563 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4566 |
- if (p[1]) |
|
| 4567 |
- ++i; |
|
| 4568 | 4564 |
tap_allow_nonadmin_access (p[1]); |
| 4569 | 4565 |
openvpn_exit (OPENVPN_EXIT_STATUS_GOOD); /* exit point */ |
| 4570 | 4566 |
} |
| 4571 | 4567 |
else if (streq (p[0], "user") && p[1]) |
| 4572 | 4568 |
{
|
| 4573 |
- ++i; |
|
| 4574 | 4569 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4575 | 4570 |
msg (M_WARN, "NOTE: --user option is not implemented on Windows"); |
| 4576 | 4571 |
} |
| 4577 | 4572 |
else if (streq (p[0], "group") && p[1]) |
| 4578 | 4573 |
{
|
| 4579 |
- ++i; |
|
| 4580 | 4574 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4581 | 4575 |
msg (M_WARN, "NOTE: --group option is not implemented on Windows"); |
| 4582 | 4576 |
} |
| 4583 | 4577 |
#else |
| 4584 | 4578 |
else if (streq (p[0], "user") && p[1]) |
| 4585 | 4579 |
{
|
| 4586 |
- ++i; |
|
| 4587 | 4580 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4588 | 4581 |
options->username = p[1]; |
| 4589 | 4582 |
} |
| 4590 | 4583 |
else if (streq (p[0], "group") && p[1]) |
| 4591 | 4584 |
{
|
| 4592 |
- ++i; |
|
| 4593 | 4585 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4594 | 4586 |
options->groupname = p[1]; |
| 4595 | 4587 |
} |
| 4596 | 4588 |
else if (streq (p[0], "dhcp-option") && p[1]) |
| 4597 | 4589 |
{
|
| 4598 |
- ++i; |
|
| 4599 | 4590 |
VERIFY_PERMISSION (OPT_P_IPWIN32); |
| 4600 |
- if (p[2]) |
|
| 4601 |
- ++i; |
|
| 4602 | 4591 |
foreign_option (options, p, 3, es); |
| 4603 | 4592 |
} |
| 4604 | 4593 |
else if (streq (p[0], "route-method") && p[1]) /* ignore when pushed to non-Windows OS */ |
| 4605 | 4594 |
{
|
| 4606 |
- ++i; |
|
| 4607 | 4595 |
VERIFY_PERMISSION (OPT_P_ROUTE_EXTRAS); |
| 4608 | 4596 |
} |
| 4609 | 4597 |
#endif |
| ... | ... |
@@ -4620,7 +4462,6 @@ add_option (struct options *options, |
| 4620 | 4620 |
VERIFY_PERMISSION (OPT_P_COMP); |
| 4621 | 4621 |
if (p[1]) |
| 4622 | 4622 |
{
|
| 4623 |
- ++i; |
|
| 4624 | 4623 |
if (streq (p[1], "yes")) |
| 4625 | 4624 |
options->lzo = LZO_SELECTED|LZO_ON; |
| 4626 | 4625 |
else if (streq (p[1], "no")) |
| ... | ... |
@@ -4660,13 +4501,11 @@ add_option (struct options *options, |
| 4660 | 4660 |
} |
| 4661 | 4661 |
else if (streq (p[0], "secret") && p[1]) |
| 4662 | 4662 |
{
|
| 4663 |
- ++i; |
|
| 4664 | 4663 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4665 | 4664 |
if (p[2]) |
| 4666 | 4665 |
{
|
| 4667 | 4666 |
int key_direction; |
| 4668 | 4667 |
|
| 4669 |
- ++i; |
|
| 4670 | 4668 |
key_direction = ascii2keydirection (msglevel, p[2]); |
| 4671 | 4669 |
if (key_direction >= 0) |
| 4672 | 4670 |
options->key_direction = key_direction; |
| ... | ... |
@@ -4682,7 +4521,6 @@ add_option (struct options *options, |
| 4682 | 4682 |
} |
| 4683 | 4683 |
else if (streq (p[0], "auth") && p[1]) |
| 4684 | 4684 |
{
|
| 4685 |
- ++i; |
|
| 4686 | 4685 |
VERIFY_PERMISSION (OPT_P_CRYPTO); |
| 4687 | 4686 |
options->authname_defined = true; |
| 4688 | 4687 |
options->authname = p[1]; |
| ... | ... |
@@ -4699,7 +4537,6 @@ add_option (struct options *options, |
| 4699 | 4699 |
} |
| 4700 | 4700 |
else if (streq (p[0], "cipher") && p[1]) |
| 4701 | 4701 |
{
|
| 4702 |
- ++i; |
|
| 4703 | 4702 |
VERIFY_PERMISSION (OPT_P_CRYPTO); |
| 4704 | 4703 |
options->ciphername_defined = true; |
| 4705 | 4704 |
options->ciphername = p[1]; |
| ... | ... |
@@ -4726,7 +4563,6 @@ add_option (struct options *options, |
| 4726 | 4726 |
{
|
| 4727 | 4727 |
int replay_window; |
| 4728 | 4728 |
|
| 4729 |
- ++i; |
|
| 4730 | 4729 |
replay_window = atoi (p[1]); |
| 4731 | 4730 |
if (!(MIN_SEQ_BACKTRACK <= replay_window && replay_window <= MAX_SEQ_BACKTRACK)) |
| 4732 | 4731 |
{
|
| ... | ... |
@@ -4742,7 +4578,6 @@ add_option (struct options *options, |
| 4742 | 4742 |
{
|
| 4743 | 4743 |
int replay_time; |
| 4744 | 4744 |
|
| 4745 |
- ++i; |
|
| 4746 | 4745 |
replay_time = atoi (p[2]); |
| 4747 | 4746 |
if (!(MIN_TIME_BACKTRACK <= replay_time && replay_time <= MAX_TIME_BACKTRACK)) |
| 4748 | 4747 |
{
|
| ... | ... |
@@ -4773,7 +4608,6 @@ add_option (struct options *options, |
| 4773 | 4773 |
} |
| 4774 | 4774 |
else if (streq (p[0], "replay-persist") && p[1]) |
| 4775 | 4775 |
{
|
| 4776 |
- ++i; |
|
| 4777 | 4776 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4778 | 4777 |
options->packet_id_file = p[1]; |
| 4779 | 4778 |
} |
| ... | ... |
@@ -4787,7 +4621,6 @@ add_option (struct options *options, |
| 4787 | 4787 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4788 | 4788 |
if (p[1]) |
| 4789 | 4789 |
{
|
| 4790 |
- ++i; |
|
| 4791 | 4790 |
options->engine = p[1]; |
| 4792 | 4791 |
} |
| 4793 | 4792 |
else |
| ... | ... |
@@ -4798,7 +4631,6 @@ add_option (struct options *options, |
| 4798 | 4798 |
{
|
| 4799 | 4799 |
int keysize; |
| 4800 | 4800 |
|
| 4801 |
- ++i; |
|
| 4802 | 4801 |
VERIFY_PERMISSION (OPT_P_CRYPTO); |
| 4803 | 4802 |
keysize = atoi (p[1]) / 8; |
| 4804 | 4803 |
if (keysize < 0 || keysize > MAX_CIPHER_KEY_LENGTH) |
| ... | ... |
@@ -4827,45 +4659,38 @@ add_option (struct options *options, |
| 4827 | 4827 |
} |
| 4828 | 4828 |
else if (streq (p[0], "ca") && p[1]) |
| 4829 | 4829 |
{
|
| 4830 |
- ++i; |
|
| 4831 | 4830 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4832 | 4831 |
options->ca_file = p[1]; |
| 4833 | 4832 |
#if ENABLE_INLINE_FILES |
| 4834 | 4833 |
if (streq (p[1], INLINE_FILE_TAG) && p[2]) |
| 4835 | 4834 |
{
|
| 4836 |
- ++i; |
|
| 4837 | 4835 |
options->ca_file_inline = p[2]; |
| 4838 | 4836 |
} |
| 4839 | 4837 |
#endif |
| 4840 | 4838 |
} |
| 4841 | 4839 |
else if (streq (p[0], "capath") && p[1]) |
| 4842 | 4840 |
{
|
| 4843 |
- ++i; |
|
| 4844 | 4841 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4845 | 4842 |
options->ca_path = p[1]; |
| 4846 | 4843 |
} |
| 4847 | 4844 |
else if (streq (p[0], "dh") && p[1]) |
| 4848 | 4845 |
{
|
| 4849 |
- ++i; |
|
| 4850 | 4846 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4851 | 4847 |
options->dh_file = p[1]; |
| 4852 | 4848 |
#if ENABLE_INLINE_FILES |
| 4853 | 4849 |
if (streq (p[1], INLINE_FILE_TAG) && p[2]) |
| 4854 | 4850 |
{
|
| 4855 |
- ++i; |
|
| 4856 | 4851 |
options->dh_file_inline = p[2]; |
| 4857 | 4852 |
} |
| 4858 | 4853 |
#endif |
| 4859 | 4854 |
} |
| 4860 | 4855 |
else if (streq (p[0], "cert") && p[1]) |
| 4861 | 4856 |
{
|
| 4862 |
- ++i; |
|
| 4863 | 4857 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4864 | 4858 |
options->cert_file = p[1]; |
| 4865 | 4859 |
#if ENABLE_INLINE_FILES |
| 4866 | 4860 |
if (streq (p[1], INLINE_FILE_TAG) && p[2]) |
| 4867 | 4861 |
{
|
| 4868 |
- ++i; |
|
| 4869 | 4862 |
options->cert_file_inline = p[2]; |
| 4870 | 4863 |
} |
| 4871 | 4864 |
#endif |
| ... | ... |
@@ -4873,27 +4698,23 @@ add_option (struct options *options, |
| 4873 | 4873 |
#ifdef WIN32 |
| 4874 | 4874 |
else if (streq (p[0], "cryptoapicert") && p[1]) |
| 4875 | 4875 |
{
|
| 4876 |
- ++i; |
|
| 4877 | 4876 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4878 | 4877 |
options->cryptoapi_cert = p[1]; |
| 4879 | 4878 |
} |
| 4880 | 4879 |
#endif |
| 4881 | 4880 |
else if (streq (p[0], "key") && p[1]) |
| 4882 | 4881 |
{
|
| 4883 |
- ++i; |
|
| 4884 | 4882 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4885 | 4883 |
options->priv_key_file = p[1]; |
| 4886 | 4884 |
#if ENABLE_INLINE_FILES |
| 4887 | 4885 |
if (streq (p[1], INLINE_FILE_TAG) && p[2]) |
| 4888 | 4886 |
{
|
| 4889 |
- ++i; |
|
| 4890 | 4887 |
options->priv_key_file_inline = p[2]; |
| 4891 | 4888 |
} |
| 4892 | 4889 |
#endif |
| 4893 | 4890 |
} |
| 4894 | 4891 |
else if (streq (p[0], "pkcs12") && p[1]) |
| 4895 | 4892 |
{
|
| 4896 |
- ++i; |
|
| 4897 | 4893 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4898 | 4894 |
options->pkcs12_file = p[1]; |
| 4899 | 4895 |
} |
| ... | ... |
@@ -4902,7 +4723,6 @@ add_option (struct options *options, |
| 4902 | 4902 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4903 | 4903 |
if (p[1]) |
| 4904 | 4904 |
{
|
| 4905 |
- ++i; |
|
| 4906 | 4905 |
options->key_pass_file = p[1]; |
| 4907 | 4906 |
} |
| 4908 | 4907 |
else |
| ... | ... |
@@ -4925,19 +4745,16 @@ add_option (struct options *options, |
| 4925 | 4925 |
} |
| 4926 | 4926 |
else if (streq (p[0], "tls-cipher") && p[1]) |
| 4927 | 4927 |
{
|
| 4928 |
- ++i; |
|
| 4929 | 4928 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4930 | 4929 |
options->cipher_list = p[1]; |
| 4931 | 4930 |
} |
| 4932 | 4931 |
else if (streq (p[0], "crl-verify") && p[1]) |
| 4933 | 4932 |
{
|
| 4934 |
- ++i; |
|
| 4935 | 4933 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4936 | 4934 |
options->crl_file = p[1]; |
| 4937 | 4935 |
} |
| 4938 | 4936 |
else if (streq (p[0], "tls-verify") && p[1]) |
| 4939 | 4937 |
{
|
| 4940 |
- ++i; |
|
| 4941 | 4938 |
VERIFY_PERMISSION (OPT_P_SCRIPT); |
| 4942 | 4939 |
if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT)) |
| 4943 | 4940 |
goto err; |
| ... | ... |
@@ -4945,13 +4762,11 @@ add_option (struct options *options, |
| 4945 | 4945 |
} |
| 4946 | 4946 |
else if (streq (p[0], "tls-remote") && p[1]) |
| 4947 | 4947 |
{
|
| 4948 |
- ++i; |
|
| 4949 | 4948 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4950 | 4949 |
options->tls_remote = p[1]; |
| 4951 | 4950 |
} |
| 4952 | 4951 |
else if (streq (p[0], "ns-cert-type") && p[1]) |
| 4953 | 4952 |
{
|
| 4954 |
- ++i; |
|
| 4955 | 4953 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 4956 | 4954 |
if (streq (p[1], "server")) |
| 4957 | 4955 |
options->ns_cert_type = NS_SSL_SERVER; |
| ... | ... |
@@ -4965,49 +4780,41 @@ add_option (struct options *options, |
| 4965 | 4965 |
} |
| 4966 | 4966 |
else if (streq (p[0], "tls-timeout") && p[1]) |
| 4967 | 4967 |
{
|
| 4968 |
- ++i; |
|
| 4969 | 4968 |
VERIFY_PERMISSION (OPT_P_TLS_PARMS); |
| 4970 | 4969 |
options->tls_timeout = positive_atoi (p[1]); |
| 4971 | 4970 |
} |
| 4972 | 4971 |
else if (streq (p[0], "reneg-bytes") && p[1]) |
| 4973 | 4972 |
{
|
| 4974 |
- ++i; |
|
| 4975 | 4973 |
VERIFY_PERMISSION (OPT_P_TLS_PARMS); |
| 4976 | 4974 |
options->renegotiate_bytes = positive_atoi (p[1]); |
| 4977 | 4975 |
} |
| 4978 | 4976 |
else if (streq (p[0], "reneg-pkts") && p[1]) |
| 4979 | 4977 |
{
|
| 4980 |
- ++i; |
|
| 4981 | 4978 |
VERIFY_PERMISSION (OPT_P_TLS_PARMS); |
| 4982 | 4979 |
options->renegotiate_packets = positive_atoi (p[1]); |
| 4983 | 4980 |
} |
| 4984 | 4981 |
else if (streq (p[0], "reneg-sec") && p[1]) |
| 4985 | 4982 |
{
|
| 4986 |
- ++i; |
|
| 4987 | 4983 |
VERIFY_PERMISSION (OPT_P_TLS_PARMS); |
| 4988 | 4984 |
options->renegotiate_seconds = positive_atoi (p[1]); |
| 4989 | 4985 |
} |
| 4990 | 4986 |
else if (streq (p[0], "hand-window") && p[1]) |
| 4991 | 4987 |
{
|
| 4992 |
- ++i; |
|
| 4993 | 4988 |
VERIFY_PERMISSION (OPT_P_TLS_PARMS); |
| 4994 | 4989 |
options->handshake_window = positive_atoi (p[1]); |
| 4995 | 4990 |
} |
| 4996 | 4991 |
else if (streq (p[0], "tran-window") && p[1]) |
| 4997 | 4992 |
{
|
| 4998 |
- ++i; |
|
| 4999 | 4993 |
VERIFY_PERMISSION (OPT_P_TLS_PARMS); |
| 5000 | 4994 |
options->transition_window = positive_atoi (p[1]); |
| 5001 | 4995 |
} |
| 5002 | 4996 |
else if (streq (p[0], "tls-auth") && p[1]) |
| 5003 | 4997 |
{
|
| 5004 |
- ++i; |
|
| 5005 | 4998 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5006 | 4999 |
if (p[2]) |
| 5007 | 5000 |
{
|
| 5008 | 5001 |
int key_direction; |
| 5009 | 5002 |
|
| 5010 |
- ++i; |
|
| 5011 | 5003 |
key_direction = ascii2keydirection (msglevel, p[2]); |
| 5012 | 5004 |
if (key_direction >= 0) |
| 5013 | 5005 |
options->key_direction = key_direction; |
| ... | ... |
@@ -5019,7 +4826,6 @@ add_option (struct options *options, |
| 5019 | 5019 |
else if (streq (p[0], "key-method") && p[1]) |
| 5020 | 5020 |
{
|
| 5021 | 5021 |
int key_method; |
| 5022 |
- ++i; |
|
| 5023 | 5022 |
|
| 5024 | 5023 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5025 | 5024 |
key_method = atoi (p[1]); |
| ... | ... |
@@ -5038,15 +4844,15 @@ add_option (struct options *options, |
| 5038 | 5038 |
#ifdef ENABLE_PKCS11 |
| 5039 | 5039 |
else if (streq (p[0], "show-pkcs11-slots") && p[1]) |
| 5040 | 5040 |
{
|
| 5041 |
- char *module = p[i++]; |
|
| 5041 |
+ char *module = p[1]; |
|
| 5042 | 5042 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5043 | 5043 |
show_pkcs11_slots (module); |
| 5044 | 5044 |
openvpn_exit (OPENVPN_EXIT_STATUS_GOOD); /* exit point */ |
| 5045 | 5045 |
} |
| 5046 | 5046 |
else if (streq (p[0], "show-pkcs11-objects") && p[1] && p[2]) |
| 5047 | 5047 |
{
|
| 5048 |
- char *provider = p[i++]; |
|
| 5049 |
- char *slot = p[i++]; |
|
| 5048 |
+ char *provider = p[1]; |
|
| 5049 |
+ char *slot = p[2]; |
|
| 5050 | 5050 |
struct gc_arena gc = gc_new (); |
| 5051 | 5051 |
struct buffer pass_prompt = alloc_buf_gc (128, &gc); |
| 5052 | 5052 |
char pin[256]; |
| ... | ... |
@@ -5069,7 +4875,7 @@ add_option (struct options *options, |
| 5069 | 5069 |
|
| 5070 | 5070 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5071 | 5071 |
|
| 5072 |
- for (j = 1; j < MAX_PARMS && p[j] != NULL; ++j, ++i) |
|
| 5072 |
+ for (j = 1; j < MAX_PARMS && p[j] != NULL; ++j) |
|
| 5073 | 5073 |
options->pkcs11_providers[j-1] = p[j]; |
| 5074 | 5074 |
} |
| 5075 | 5075 |
else if (streq (p[0], "pkcs11-sign-mode") && p[1]) |
| ... | ... |
@@ -5078,48 +4884,41 @@ add_option (struct options *options, |
| 5078 | 5078 |
|
| 5079 | 5079 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5080 | 5080 |
|
| 5081 |
- for (j = 1; j < MAX_PARMS && p[j] != NULL; ++j, ++i) |
|
| 5081 |
+ for (j = 1; j < MAX_PARMS && p[j] != NULL; ++j) |
|
| 5082 | 5082 |
options->pkcs11_sign_mode[j-1] = p[j]; |
| 5083 | 5083 |
} |
| 5084 | 5084 |
else if (streq (p[0], "pkcs11-slot-type") && p[1]) |
| 5085 | 5085 |
{
|
| 5086 |
- ++i; |
|
| 5087 | 5086 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5088 | 5087 |
options->pkcs11_slot_type = p[1]; |
| 5089 | 5088 |
} |
| 5090 | 5089 |
else if (streq (p[0], "pkcs11-slot") && p[1]) |
| 5091 | 5090 |
{
|
| 5092 |
- ++i; |
|
| 5093 | 5091 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5094 | 5092 |
options->pkcs11_slot = p[1]; |
| 5095 | 5093 |
} |
| 5096 | 5094 |
else if (streq (p[0], "pkcs11-id-type") && p[1]) |
| 5097 | 5095 |
{
|
| 5098 |
- ++i; |
|
| 5099 | 5096 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5100 | 5097 |
options->pkcs11_id_type = p[1]; |
| 5101 | 5098 |
} |
| 5102 | 5099 |
else if (streq (p[0], "pkcs11-id") && p[1]) |
| 5103 | 5100 |
{
|
| 5104 |
- ++i; |
|
| 5105 | 5101 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5106 | 5102 |
options->pkcs11_id = p[1]; |
| 5107 | 5103 |
} |
| 5108 | 5104 |
else if (streq (p[0], "pkcs11-pin-cache") && p[1]) |
| 5109 | 5105 |
{
|
| 5110 |
- ++i; |
|
| 5111 | 5106 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5112 | 5107 |
options->pkcs11_pin_cache_period = atoi (p[1]); |
| 5113 | 5108 |
} |
| 5114 | 5109 |
else if (streq (p[0], "pkcs11-protected-authentication")) |
| 5115 | 5110 |
{
|
| 5116 |
- ++i; |
|
| 5117 | 5111 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5118 | 5112 |
options->pkcs11_protected_authentication = true; |
| 5119 | 5113 |
} |
| 5120 | 5114 |
else if (streq (p[0], "pkcs11-cert-private")) |
| 5121 | 5115 |
{
|
| 5122 |
- ++i; |
|
| 5123 | 5116 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
| 5124 | 5117 |
options->pkcs11_cert_private = true; |
| 5125 | 5118 |
} |
| ... | ... |
@@ -5147,5 +4946,4 @@ add_option (struct options *options, |
| 5147 | 5147 |
} |
| 5148 | 5148 |
err: |
| 5149 | 5149 |
gc_free (&gc); |
| 5150 |
- return i; |
|
| 5151 | 5150 |
} |
| ... | ... |
@@ -127,13 +127,14 @@ plugin_option_list_new (struct gc_arena *gc) |
| 127 | 127 |
} |
| 128 | 128 |
|
| 129 | 129 |
bool |
| 130 |
-plugin_option_list_add (struct plugin_option_list *list, const char *so_pathname, const char *args) |
|
| 130 |
+plugin_option_list_add (struct plugin_option_list *list, char **p, struct gc_arena *gc) |
|
| 131 | 131 |
{
|
| 132 | 132 |
if (list->n < MAX_PLUGINS) |
| 133 | 133 |
{
|
| 134 | 134 |
struct plugin_option *o = &list->plugins[list->n++]; |
| 135 |
- o->so_pathname = so_pathname; |
|
| 136 |
- o->args = args; |
|
| 135 |
+ o->argv = make_extended_arg_array (p, gc); |
|
| 136 |
+ if (o->argv[0]) |
|
| 137 |
+ o->so_pathname = o->argv[0]; |
|
| 137 | 138 |
return true; |
| 138 | 139 |
} |
| 139 | 140 |
else |
| ... | ... |
@@ -145,11 +146,15 @@ void |
| 145 | 145 |
plugin_option_list_print (const struct plugin_option_list *list, int msglevel) |
| 146 | 146 |
{
|
| 147 | 147 |
int i; |
| 148 |
+ struct gc_arena gc = gc_new (); |
|
| 149 |
+ |
|
| 148 | 150 |
for (i = 0; i < list->n; ++i) |
| 149 | 151 |
{
|
| 150 | 152 |
const struct plugin_option *o = &list->plugins[i]; |
| 151 |
- msg (msglevel, " plugin[%d] %s '%s'", i, o->so_pathname, o->args); |
|
| 153 |
+ msg (msglevel, " plugin[%d] %s '%s'", i, o->so_pathname, print_argv (o->argv, &gc, PA_BRACKET)); |
|
| 152 | 154 |
} |
| 155 |
+ |
|
| 156 |
+ gc_free (&gc); |
|
| 153 | 157 |
} |
| 154 | 158 |
#endif |
| 155 | 159 |
|
| ... | ... |
@@ -256,24 +261,23 @@ plugin_open_item (struct plugin *p, |
| 256 | 256 |
if (!p->plugin_handle && init_point == p->requested_initialization_point) |
| 257 | 257 |
{
|
| 258 | 258 |
struct gc_arena gc = gc_new (); |
| 259 |
- const char **argv = make_arg_array (o->so_pathname, o->args, &gc); |
|
| 260 | 259 |
|
| 261 | 260 |
dmsg (D_PLUGIN_DEBUG, "PLUGIN_INIT: PRE"); |
| 262 |
- plugin_show_args_env (D_PLUGIN_DEBUG, argv, envp); |
|
| 261 |
+ plugin_show_args_env (D_PLUGIN_DEBUG, o->argv, envp); |
|
| 263 | 262 |
|
| 264 | 263 |
/* |
| 265 | 264 |
* Call the plugin initialization |
| 266 | 265 |
*/ |
| 267 | 266 |
if (p->open2) |
| 268 |
- p->plugin_handle = (*p->open2)(&p->plugin_type_mask, argv, envp, retlist); |
|
| 267 |
+ p->plugin_handle = (*p->open2)(&p->plugin_type_mask, o->argv, envp, retlist); |
|
| 269 | 268 |
else if (p->open1) |
| 270 |
- p->plugin_handle = (*p->open1)(&p->plugin_type_mask, argv, envp); |
|
| 269 |
+ p->plugin_handle = (*p->open1)(&p->plugin_type_mask, o->argv, envp); |
|
| 271 | 270 |
else |
| 272 | 271 |
ASSERT (0); |
| 273 | 272 |
|
| 274 | 273 |
msg (D_PLUGIN, "PLUGIN_INIT: POST %s '%s' intercepted=%s %s", |
| 275 | 274 |
p->so_pathname, |
| 276 |
- o->args ? o->args : "[NULL]", |
|
| 275 |
+ print_argv (o->argv, &gc, PA_BRACKET), |
|
| 277 | 276 |
plugin_mask_string (p->plugin_type_mask, &gc), |
| 278 | 277 |
(retlist && *retlist) ? "[RETLIST]" : ""); |
| 279 | 278 |
|
| ... | ... |
@@ -39,7 +39,7 @@ |
| 39 | 39 |
|
| 40 | 40 |
struct plugin_option {
|
| 41 | 41 |
const char *so_pathname; |
| 42 |
- const char *args; |
|
| 42 |
+ const char **argv; |
|
| 43 | 43 |
}; |
| 44 | 44 |
|
| 45 | 45 |
struct plugin_option_list {
|
| ... | ... |
@@ -98,7 +98,7 @@ struct plugin_return |
| 98 | 98 |
}; |
| 99 | 99 |
|
| 100 | 100 |
struct plugin_option_list *plugin_option_list_new (struct gc_arena *gc); |
| 101 |
-bool plugin_option_list_add (struct plugin_option_list *list, const char *so_pathname, const char *args); |
|
| 101 |
+bool plugin_option_list_add (struct plugin_option_list *list, char **p, struct gc_arena *gc); |
|
| 102 | 102 |
|
| 103 | 103 |
#ifdef ENABLE_DEBUG |
| 104 | 104 |
void plugin_option_list_print (const struct plugin_option_list *list, int msglevel); |
| ... | ... |
@@ -179,6 +179,14 @@ push_option (struct options *o, const char *opt, int msglevel) |
| 179 | 179 |
} |
| 180 | 180 |
|
| 181 | 181 |
void |
| 182 |
+push_options (struct options *o, char **p, int msglevel, struct gc_arena *gc) |
|
| 183 |
+{
|
|
| 184 |
+ const char **argv = make_extended_arg_array (p, gc); |
|
| 185 |
+ char *opt = print_argv (argv, gc, 0); |
|
| 186 |
+ push_option (o, opt, msglevel); |
|
| 187 |
+} |
|
| 188 |
+ |
|
| 189 |
+void |
|
| 182 | 190 |
push_reset (struct options *o) |
| 183 | 191 |
{
|
| 184 | 192 |
o->push_list = NULL; |
| ... | ... |
@@ -51,6 +51,7 @@ void receive_auth_failed (struct context *c, const struct buffer *buffer); |
| 51 | 51 |
#if P2MP_SERVER |
| 52 | 52 |
|
| 53 | 53 |
void push_option (struct options *o, const char *opt, int msglevel); |
| 54 |
+void push_options (struct options *o, char **p, int msglevel, struct gc_arena *gc); |
|
| 54 | 55 |
|
| 55 | 56 |
void push_reset (struct options *o); |
| 56 | 57 |
|