2 # Copyright (C) 1999,2003 Ian Jackson
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.
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.
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.
22 $fetchdir= "/var/lib/news/fetch";
23 chdir("/etc/news") || die $!;
25 open(CONF
,"nntp-merge.conf") || die $!;
27 next if m/^\#/ || !m/^\S/;
28 next if m/^(myfqdn|xref|server|server-nosearch|fetch|read|post|permit|believe|minreaddays)\s/;
29 if (m/^maxperuser\s+(\d+)\s+$/) {
31 } elsif (m/^extrarc\s+(\S+)\s+$/) {
38 open IGN
,"</etc/news/newsrc-ignoredusers" or die $!;
47 open PASS
,"</etc/userlist" or die $!;
53 open GL
,"userv -t 30 $user newsrc-listgroups |" or die $!;
55 close GL
; $?
and warn "getgroups: error getting groups for $user (code $?)";
60 open GL
,"< $f" or die $!;
65 chdir($fetchdir) || die $!;
66 open(NG
,">all-read-groups.new") || die $!;
67 print(NG
join("\n",sort keys %yes)."\n") || die $!;
69 rename("all-read-groups.new","all-read-groups") || die $!;
71 printf "total %d groups\n",scalar(keys %yes);
75 my ($where,$toomanyenf) = @_;
78 die "bad group in $where" unless m/^[-a-z0-9+]+\.[-a-z0-9+._]+$/i;
81 warn("too many from $where"), return if $toomanyenf && @g > $maxperuser;
82 map { $yes{$_}=1; } @g;
83 printf "%-20s - %4d groups\n",$where,scalar(@g);