#! /usr/local/bin/perl use strict; our %attributes; my $MAX = 4; my $FILE = '/etc/news/users'; sub auth_init { # } sub authenticate { my $oc = 0; my $ok = 0; open(P, '/bin/ps -ax |') && do { while(
) {
if(/nnrpd: (\S*)/) {
if($1 eq $attributes{hostname}) {
$oc++;
}
}
}
close(P);
};
if($oc > $MAX) {
sleep(2);
return ( '502', 'Too many connections from your host' );
}
my $p;
open(F, $FILE) && do {
while(