[LEDE-DEV] [PATCH RFC 2/3] openvpn: use proper quoting of push option in openvpn.config

Magnus Kroken mkroken at gmail.com
Fri Dec 9 15:24:34 PST 2016


Hi P

On 09.12.2016 23.34, p.wassi at gmx.at wrote:
> What about doing the 'correct' quotation in the init script?
> I.e. removing the 'push' option from the append_params list
> and instead do the workaround for quoatition there.

Thanks for making me rethink this. I thought about it when I worked on 
this yesterday, couldn't figure out how, rethought it now that you 
asked, and figured I could just add a check for $p in append_params() in 
openvpn.init (patch format only for clarity, will submit properly if 
this fix is better):

--- a/package/network/services/openvpn/files/openvpn.init
+++ b/package/network/services/openvpn/files/openvpn.init
@@ -42,7 +42,8 @@ append_params() {
                 config_get v "$s" "$p"
                 IFS="$LIST_SEP"
                 for v in $v; do
-                       [ -n "$v" ] && append_param "$s" "$p" && echo " 
$v" >> "/var/etc/openvpn-$s.conf"
+                       [ -n "$v" ] && [ "$p" != "push" ] && 
append_param "$s" "$p" && echo " $v" >> "/var/etc/openvpn-$s.conf"
+                       [ -n "$v" ] && [ "$p" == "push" ] && 
append_param "$s" "$p" && echo " \"$v\"" >> "/var/etc/openvpn-$s.conf"
                 done
                 unset IFS
         done

This works, and at least I consider this cleaner than writing a special 
function for push parameters in openvpn.init.

/Magnus

> Best regards,
> P. Wassi
>



More information about the Lede-dev mailing list