45e019f4 |
1 | #!/usr/bin/perl |
711a0748 |
2 | # Copyright (C) 1999,2003 Ian Jackson |
49973d9a |
3 | # |
4 | # This is free software; you can redistribute it and/or modify it |
5 | # under the terms of the GNU General Public License as published by |
6 | # the Free Software Foundation; either version 2 of the License, or |
7 | # (at your option) any later version. |
8 | # |
9 | # This program is distributed in the hope that it will be useful, but |
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | # General Public License for more details. |
13 | # |
14 | # You should have received a copy of the GNU General Public License |
15 | # along with userv-utils; if not, write to the Free Software |
16 | # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | # |
18 | # $Id$ |
45e019f4 |
19 | |
20 | $minreaddays= 21; |
21 | $maxperuser= 250; |
22 | |
23 | open(CONF,"$ARGV[0]") or die $!; |
24 | while(<CONF>) { |
25 | next if m/^\#/ || !m/^\S/; |
26 | next if m/^(myfqdn|xref|server|server-nosearch|fetch|read|post|permit|believe|extrarc)\s/; |
27 | if (m/^minreaddays\s+(\d+)\s+$/) { |
28 | $minreaddays= $1; |
29 | } elsif (m/^maxperuser\s+(\d+)\s+$/) { |
30 | $maxperuser= $1; |
31 | } else { |
32 | die "$_ ?"; |
33 | } |
34 | } |
35 | |
36 | $newsrc= ".newsrc"; |
37 | exit 0 if -l $newsrc || ! -f _ || -M _ > $minreaddays; |
38 | |
39 | @g= (); |
40 | |
41 | open NEWSRC, $newsrc or die $!; |
42 | while (<NEWSRC>) { |
43 | next unless s/:.*\n$//; |
44 | next unless m/^[-a-z0-9+]+\.[-a-z0-9+._]+$/i; |
45 | push @g, "$_\n"; |
46 | } |
47 | close NEWSRC or die $!; |
48 | |
49 | exit 0 if @g > $maxperuser; |
50 | |
51 | print sort @g or die $!; |
52 | close STDOUT or die $!; |
53 | |
54 | exit 0; |