Permalink
Browse files

better error checking

  • Loading branch information...
1 parent d93f29d commit e7f635cb91f6242a310bef024f8e79c3bab2056d @jonoberheide jonoberheide committed Jan 25, 2012
Showing with 7 additions and 13 deletions.
  1. +7 −13 duo_openvpn.pl
View
@@ -16,12 +16,16 @@
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 @@
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();

0 comments on commit e7f635c

Please sign in to comment.