#!/usr/bin/perl # # showallowed # smtp-poplock package by David Harris # use IO::File; use strict; BEGIN: { require "/etc/smtp-poplock.conf" }; &main; sub main { my $time = time; print "ipaddr (and netmask) access window expires\n"; print "-------------------------------- ----------------------------\n"; my $fh; my $value; if ( $fh = new IO::File "< $Conf::dbfile" ) { while ( <$fh> ) { next unless /^(\S+)\s(\S+)$/; my $ipaddr = $1; my $expires = $2; my $expires_printable = $expires < $time ? "expired" : localtime $expires; $ipaddr = $ipaddr . " " x ( 32 - length($ipaddr) ); print "$ipaddr $expires_printable\n"; } } else { print STDERR "could not open database file\n"; } if ( $fh = new IO::File "< $Conf::static_allowed_file" ) { while ( <$fh> ) { s/#.*$//; next unless /^\s*(\S+)\s*$/; my $ipaddr = $1; $ipaddr = $ipaddr . " " x ( 32 - length($ipaddr) ); print "$ipaddr never\n"; } } else { print STDERR "could not open static_allowed_file\n"; } }