From ea5daeae1664d7d73a9d2970b3782f1dcf2e3224 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Thu, 12 Mar 2026 14:32:22 +0100 Subject: [PATCH] openvpn: proto handler; trim white-space from append 'append' inserts white-space by default (3rd parameter) Signed-off-by: Paul Donald --- net/openvpn/files/lib/netifd/proto/openvpn.sh | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/net/openvpn/files/lib/netifd/proto/openvpn.sh b/net/openvpn/files/lib/netifd/proto/openvpn.sh index bf93a5cdee..6694b49a7c 100755 --- a/net/openvpn/files/lib/netifd/proto/openvpn.sh +++ b/net/openvpn/files/lib/netifd/proto/openvpn.sh @@ -41,16 +41,16 @@ option_builder() { case "$opt_type" in bool) json_get_var v "$f" - [ "$v" = 1 ] && append exec_params " --${f//_/-}" + [ "$v" = 1 ] && append exec_params "--${f//_/-}" ;; uinteger|integer|string) json_get_var v "$f" - [ -n "$v" ] && append exec_params " --${f//_/-} $v" + [ -n "$v" ] && append exec_params "--${f//_/-} $v" ;; file) json_get_var v "$f" [ -f "$v" ] || continue - [ -n "$v" ] && append exec_params " --${f//_/-} \"$v\"" + [ -n "$v" ] && append exec_params "--${f//_/-} \"$v\"" ;; list) local type @@ -62,7 +62,7 @@ option_builder() { json_get_keys keys for key in $keys; do json_get_var val "$key" - append exec_params " --${f//_/-} \"$val\"" + append exec_params "--${f//_/-} \"$val\"" done json_select .. ;; @@ -116,19 +116,19 @@ proto_openvpn_setup() { exec_params= json_get_var dev_type dev_type - [ -z "$dev_type" ] && append exec_params " --dev-type tun" + [ -z "$dev_type" ] && append exec_params "--dev-type tun" json_get_var ovpnproto ovpnproto - [ -n "$ovpnproto" ] && append exec_params " --proto $ovpnproto" + [ -n "$ovpnproto" ] && append exec_params "--proto $ovpnproto" json_get_var config_file config # shellcheck disable=SC2154 cd_dir="${config_file%/*}" [ "$cd_dir" = "$config_file" ] && cd_dir="/" - append exec_params " --cd $cd_dir" - append exec_params " --status /var/run/openvpn.$config.status" - append exec_params " --syslog openvpn_$config" - append exec_params " --tmp-dir /var/run" - [ -n "$config_file" ] && append exec_params " --config \"$config_file\"" + append exec_params "--cd $cd_dir" + append exec_params "--status /var/run/openvpn.$config.status" + append exec_params "--syslog openvpn_$config" + append exec_params "--tmp-dir /var/run" + [ -n "$config_file" ] && append exec_params "--config \"$config_file\"" json_get_var ALLOW_DEPRECATED allow_deprecated [ -z "$ALLOW_DEPRECATED" ] && ALLOW_DEPRECATED=0 @@ -152,9 +152,9 @@ proto_openvpn_setup() { umask 077 printf '%s\n' "${cert_password:-}" > "$cp_file" umask 022 - append exec_params " --askpass $cp_file" + append exec_params "--askpass $cp_file" elif [ -n "$askpass" ]; then - append exec_params " --askpass $askpass" + append exec_params "--askpass $askpass" fi # combine into --auth-user-pass: @@ -163,9 +163,9 @@ proto_openvpn_setup() { umask 077 printf '%s\n' "${username:-}" "${password:-}" > "$auth_file" umask 022 - append exec_params " --auth-user-pass $auth_file" + append exec_params "--auth-user-pass $auth_file" elif [ -n "$auth_user_pass" ]; then - append exec_params " --auth-user-pass $auth_user_pass" + append exec_params "--auth-user-pass $auth_user_pass" fi # Testing option @@ -187,8 +187,8 @@ proto_openvpn_setup() { logger -t "openvpn(proto)" \ -p daemon.info "Enabled default hotplug processing, as the openvpn configuration 'script_security' is '3'" - append exec_params " --setenv INTERFACE $config" - append exec_params " --script-security 3" + append exec_params "--setenv INTERFACE $config" + append exec_params "--script-security 3" json_get_vars up down route_up route_pre_down json_get_vars tls_crypt_v2_verify mode learn_address client_connect