head 1.2; access; symbols PETIDOMO_4_0b6:1.2 PETIDOMO_4_0b5:1.2 PETIDOMO_4_0b4:1.2 PETIDOMO_4_0b3:1.2 BEFORETHL:1.2; locks; strict; comment @# @; 1.2 date 2001.01.21.12.00.35; author rse; state Exp; branches; next 1.1; 1.1 date 2001.01.18.15.31.30; author simons; state Exp; branches; next ; desc @@ 1.2 log @Provide a "petidomo --mode=dump " and use this in petidomo-kickout instead of directly fiddling with Petidomo's files. @ text @: eval 'exec perl -S $0 ${1+"$@@"}' if $running_under_some_shell; ## ## petidomo-kickout -- Petidomo kickout tool ## Copyright (c) 2000 Ralf S. Engelschall ## my $pattern = $ARGV[0] || die "Usage: petidomo-kickout "; # locate the file with the approval passwords my $config = "$ENV{HOME}/.petidomo"; # locate the Sendmail program my $sendmail = "sendmail"; foreach my $dir (split(/:/, "$ENV{PATH}:/bin:/sbin:/usr/bin:/usr/sbin:/lib:/usr/lib")) { if (-x "$dir/sendmail") { $sendmail = "$dir/sendmail"; last; } } # read config my $list = {}; open(FP, "<$config") || die "No ~/.petidomo file found"; while () { next if (m|^\s*#.*| or m|^\s*$|); if (m|^\s*(\S+)\s+(\S+)|) { my ($l, $pw) = ($1, $2); $l =~ s|@@[^@@]+$||; $list->{$l} = {}; $list->{$l}->{PASSWORD} = $pw; $list->{$l}->{MEMBERS} = []; next if ($l eq 'petidomo'); open(DUMP, "./petidomo --masterconf=../test/petidomo.conf --mode=dump $l |") || die "fuck"; while () { s|\n$||s; push(@@{$list->{$l}->{MEMBERS}}, $_); } close(DUMP); } } close(FP); # iterate over all mailing lists foreach my $l (keys(%{$list})) { foreach my $m (@@{$list->{$l}->{MEMBERS}}) { if ($m =~ m|$pattern|) { print "petidomo-kickout: $l: <$m> Kickout? [Y/n] "; my $yn = ; $yn =~ s|\n$||s; $yn = "y" if ($yn eq ''); $yn = lc($yn); if ($yn eq 'y') { open(SM, "|$sendmail petidomo") || die "cannot spawn $sendmail"; print SM "To: petidomo\n" . "\n" . "password ".$list->{$l}->{PASSWORD}."\n" . "unsubscribe $l $m\n"; "password ".$list->{petidomo}->{PASSWORD}."\n" . "subscribe bounces $m\n"; close(SM); print "petidomo-kickout: kicked out <$m>\n"; } } } } exit(0); @ 1.1 log @Add old RSE admin scripts @ text @a22 4 # locate the Petidomo basedir my $basedir = `petidomo --version 2>&1`; $basedir =~ s|^.+\((\S+)\).*$|$1|s; d31 8 a38 10 if (-f "$basedir/$l.list") { $list->{$l} = {}; $list->{$l}->{PASSWORD} = $pw; $list->{$l}->{MEMBERS} = []; open(LST, "<$basedir/$l.list"); while () { s|\n$||s; push(@@{$list->{$l}->{MEMBERS}}, $_); } close(LST); d40 1 a67 1 sleep(1); @