diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-12-17 07:39:55 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-12-17 07:39:55 -0500 |
commit | a43edc8cc00352e60b6ab7b61bc5a3d67c237543 (patch) | |
tree | 8a0ef3415949af63f20d4820fa9a5abe5335801d /src/usr/local/www/widgets | |
parent | 860c4a00d7cba51e576bea6e4534ca31c50b0212 (diff) | |
parent | 61fce4a6f6f61f25356708df4175d28892a04b4c (diff) | |
download | pfsense-a43edc8cc00352e60b6ab7b61bc5a3d67c237543.zip pfsense-a43edc8cc00352e60b6ab7b61bc5a3d67c237543.tar.gz |
Merge pull request #2263 from phil-davis/r016
Diffstat (limited to 'src/usr/local/www/widgets')
-rw-r--r-- | src/usr/local/www/widgets/widgets/openvpn.widget.php | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/src/usr/local/www/widgets/widgets/openvpn.widget.php b/src/usr/local/www/widgets/widgets/openvpn.widget.php index 8a02f3d..2d34401 100644 --- a/src/usr/local/www/widgets/widgets/openvpn.widget.php +++ b/src/usr/local/www/widgets/widgets/openvpn.widget.php @@ -65,7 +65,7 @@ if ($_GET['action']) { $port = $_GET['port']; $remipp = $_GET['remipp']; if (!empty($port) and !empty($remipp)) { - $retval = kill_client($port, $remipp); + $retval = openvpn_kill_client($port, $remipp); echo htmlentities("|{$port}|{$remipp}|{$retval}|"); } else { echo gettext("invalid input"); @@ -74,43 +74,6 @@ if ($_GET['action']) { } } - -function kill_client($port, $remipp) { - global $g; - - //$tcpsrv = "tcp://127.0.0.1:{$port}"; - $tcpsrv = "unix://{$g['varetc_path']}/openvpn/{$port}.sock"; - $errval = null; - $errstr = null; - - /* open a tcp connection to the management port of each server */ - $fp = @stream_socket_client($tcpsrv, $errval, $errstr, 1); - $killed = -1; - if ($fp) { - stream_set_timeout($fp, 1); - fputs($fp, "kill {$remipp}\n"); - while (!feof($fp)) { - $line = fgets($fp, 1024); - - $info = stream_get_meta_data($fp); - if ($info['timed_out']) { - break; - } - - /* parse header list line */ - if (strpos($line, "INFO:") !== false) { - continue; - } - if (strpos($line, "SUCCESS") !== false) { - $killed = 0; - } - break; - } - fclose($fp); - } - return $killed; -} - $servers = openvpn_get_active_servers(); $sk_servers = openvpn_get_active_servers("p2p"); $clients = openvpn_get_active_clients(); |