diff options
author | Jon Oberheide <jon@oberheide.org> | 2012-01-25 12:27:55 -0500 |
---|---|---|
committer | Jon Oberheide <jon@oberheide.org> | 2012-01-25 12:27:55 -0500 |
commit | e7f635cb91f6242a310bef024f8e79c3bab2056d (patch) | |
tree | 7b66cafe2644b2e48a1de3c633cccc21d8b318e6 | |
parent | d93f29d18c957b970310878dac0319c20455151d (diff) | |
download | openvpn-duo-plugin-e7f635cb91f6242a310bef024f8e79c3bab2056d.tar.gz openvpn-duo-plugin-e7f635cb91f6242a310bef024f8e79c3bab2056d.zip |
better error checking
-rwxr-xr-x | duo_openvpn.pl | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/duo_openvpn.pl b/duo_openvpn.pl index 08a0524..aaf962f 100755 --- a/duo_openvpn.pl +++ b/duo_openvpn.pl @@ -16,12 +16,16 @@ my $API_RESULT_AUTH = qr/^auth$/; my $API_RESULT_ALLOW = qr/^allow$/; my $API_RESULT_DENY = qr/^deny$/; my $API_RESULT_ENROLL = qr/^enroll$/; -my $control = $ENV{'control'}; openlog 'duo_openvpn.pl', 'pid', 'LOG_AUTH'; -if (not $control) { - logger('required control configuration'); +my $control = $ENV{'control'}; +my $username = $ENV{'username'}; +my $password = $ENV{'password'}; +my $ipaddr = $ENV{'ipaddr'} || '0.0.0.0'; + +if (not $control or not $username or not $password) { + logger('required environmental variables not found'); exit 1; } @@ -32,16 +36,6 @@ my $host = $ENV{'host'}; if (not $ikey or not $skey or not $host) { logger('required ikey/skey/host configuration'); failure(); - exit 1; -} - -my $username = $ENV{'username'}; -my $password = $ENV{'password'}; -my $ipaddr = $ENV{'ipaddr'} || '0.0.0.0'; - -if (not $control or not $username or not $host) { - logger('required environmental variables not found'); - failure(); } preauth(); |