diff options
author | Jo-Philipp Wich <jo@mein.io> | 2018-04-05 09:32:22 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2018-04-05 09:37:43 +0200 |
commit | c0d9c4f3ce7bda19081d0da01a599bec067338a3 (patch) | |
tree | a46fcf6c6a594ad1a2ab3fe09f2e4860355a27fb /applications/luci-app-openvpn/luasrc/model/cbi | |
parent | 45cefe71f6069b088e14dd913eb382816acb945c (diff) |
treewide: filter shell arguments through shellquote() where applicable
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-openvpn/luasrc/model/cbi')
-rw-r--r-- | applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua index 719145b887..ccad531513 100644 --- a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua +++ b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua @@ -26,9 +26,9 @@ uci:foreach( "openvpn_recipes", "openvpn_recipe", ) function s.getPID(section) -- Universal function which returns valid pid # or nil - local pid = sys.exec("%s | grep -w %s | grep openvpn | grep -v grep | awk '{print $1}'" % { psstring,section} ) - if pid and #pid > 0 and tonumber(pid) ~= nil then - return tonumber(pid) + local pid = sys.exec("%s | grep -w [o]penvpn(%s)" % { psstring, section }) + if pid and #pid > 0 then + return tonumber(pid:match("^%d+")) else return nil end |