App-SilverSplash
view release on metacpan or search on metacpan
bin/sl_splash_bouncer view on Meta::CPAN
# check data overage
my $overage = App::SilverSplash::IPTables->check_overage($user->[1], $user->[0]);
if ($overage) {
warn(sprintf("$$ mac %s, ip %s expired", $user->[1], $user->[0]))
if DEBUG;
App::SilverSplash::IPTables->delete_from_ads_chain($user->[1], $user->[0]);
}
# check timed overage
my $not_timed_out = App::SilverSplash->not_timed_out($user->[1], $user->[0]);
unless ($not_timed_out) {
warn(sprintf("$$ mac %s, ip %s expired", $user->[1], $user->[0]))
if DEBUG;
App::SilverSplash::IPTables->delete_from_ads_chain($user->[1], $user->[0]);
}
}
my @paid_users = App::SilverSplash::IPTables->paid_users;
foreach my $user (@paid_users) {
my $not_timed_out = App::SilverSplash->not_timed_out($user->[1], $user->[0]);
unless ($not_timed_out) {
warn(sprintf("$$ mac %s, ip %s expired, removing", $user->[1], $user->[0]));
App::SilverSplash::IPTables->delete_from_paid_chain($user->[1], $user->[0]);
}
}
lib/App/SilverSplash.pm view on Meta::CPAN
$Db{uc($key)} = $val;
untie %Db;
return 1;
}
# returns true if the mac address may pass
sub check_auth {
my ($class, $mac, $ip) = @_;
my $chain = $class->not_timed_out($mac, $ip);
return unless $chain;
# fixup the firewall rules based on the chain type
my $fixup = App::SilverSplash::IPTables->fixup_access($mac, $ip, $chain);
return unless $fixup;
return $fixup;
}
lib/App/SilverSplash.pm view on Meta::CPAN
return unless $client_ip;
warn("$$ found ip $client_ip for mac $client_mac") if DEBUG;
return $client_ip;
}
# returns the auth chain if the user is not timed out
sub not_timed_out {
my ($class, $mac, $ip) = @_;
my $exp = $class->get($mac);
return unless $exp;
my ($exp_time, $chain) = split(/\|/, $exp);
return if time() > $exp_time;
( run in 0.478 second using v1.01-cache-2.11-cpan-cc502c75498 )