#!/usr/bin/perl

# user disconnect script
# Executes each time user disconnects
# 
# Sends all variables passed by OpenVPN subsystem to the verification server
#

use File::Basename;
use lib dirname (__FILE__);

use NVPNLog;
use NVPNApi;

# setting up syslog
nvpn_log_init;

my ($username, $internalip, $externalip) = ($ENV{"username"}, $ENV{"ifconfig_pool_remote_ip"}, $ENV{"local_1"});
my $ret = nvpn_handle_disconnect($username, $internalip, $externalip, "openvpn");

nvpn_log_close;

exit(!$ret);
