Commit 7790bf4c authored by Franco Fichtner's avatar Franco Fichtner

services: align openvpn stop

(cherry picked from commit d9810025)
parent 11c82822
...@@ -117,23 +117,20 @@ function service_control_start($name, $extras) ...@@ -117,23 +117,20 @@ function service_control_start($name, $extras)
function service_control_stop($name, $extras) function service_control_stop($name, $extras)
{ {
$msg = sprintf(gettext("%s has been stopped."), htmlspecialchars($name)); $msg = sprintf(gettext("%s has been stopped."), htmlspecialchars($name));
$filter = array();
/* XXX openvpn is handled special at the moment */
if ($name == 'openvpn') {
$vpnmode = htmlspecialchars($extras['vpnmode']);
if (($vpnmode == "server") or ($vpnmode == "client")) {
$id = htmlspecialchars($extras['id']);
$pidfile = "/var/run/openvpn_{$vpnmode}{$id}.pid";
killbypid($pidfile);
}
return $msg;
/* XXX extra argument is extra tricky */ /* XXX extra argument is extra tricky */
} elseif ($name == 'miniupnpd') { if ($name == 'miniupnpd') {
upnp_action('stop'); upnp_action('stop');
return $msg; return $msg;
} }
$service = find_service_by_name($name); if ($name == 'openvpn') {
$filter['mode'] = $extras['vpnmode']; /* XXX I think mode is spurious */
$filter['vpnid'] = $extras['id'];
}
$service = find_service_by_name($name, $filter);
if (!isset($service['name'])) { if (!isset($service['name'])) {
return sprintf(gettext("Could not stop unknown service `%s'"), htmlspecialchars($name)); return sprintf(gettext("Could not stop unknown service `%s'"), htmlspecialchars($name));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment