Thread View: news.software.nntp
2 messages
2 total messages
Started by Brian Murrell
Wed, 05 Feb 1997 00:00
how to "re-inject" control messages?
Author: Brian Murrell
Date: Wed, 05 Feb 1997 00:00
Date: Wed, 05 Feb 1997 00:00
19 lines
1312 bytes
1312 bytes
I was perusing my "newgroup" log and noticed some newgroup cmsgs got skipped for authentication reasons (not sent from an approved address). I corrected (or added as the case may be) the address in my control.ctl file. I want to be able to cut the specific control message out of the newgroup log (remove the leading whitespace) and reinject the control message for processing by innd->parsecontrol. Any ideas on how to do this? b. -- Brian J. Murrell Brian_Murrell@bctel.net BCTel Advanced Communications brian@ilinx.com Vancouver, B.C. brian@wimsey.com 604 454 5279
Re: how to "re-inject" control messages?
Author: Wolfgang Schelongowski
Date: Sun, 09 Feb 1997 00:00
Date: Sun, 09 Feb 1997 00:00
120 lines
4518 bytes
4518 bytes
In <5fk1ot.sbn.hgoldste@bbs.mpcs.com>
hgoldste@mpcs.com (Howard Goldstein) writes:
>Here's a little script I use weekly to process control messages for
>hierarchies not covered by control.ctl . It massages the control
...
I had a look at it and apart from a few minor nitpicks I found
that it always results in an article with Sender: set to the
user who runs that script, and which must have an entry in
control.ctl. That opens the server to attacks from the outside ...
So I wrote the appended Perl script and tested it under Perl 4.036.
If you can not even trust your local users to keep some things secret
(I can :-) you must take measures to allow automatic new-/rmgroups
from $i_am only when you want them to happen.
Note
# YOU MUST CHANGE the first three lines
because you wouldn't somebody calling himself "lorbass" to modify your
active / newsgroups file without your consent ;-) Utilize your
imagination.
If Dave Barr or his successor wants to add this script to his
collection of INN tools s/he is free to do so.
----------------------8<--------------------
#!/usr/bin/perl
#
# reinjectctl.pl ws (at) xivic.ruhr.de 09.02.1997 GNU-Copyleft
#
# Pipe message from nn/elm, this strips off the crap and sends
# it to rnews to do newgroup/rmgroup/whatever.
#
# If the first argument begins with [eE] it is discarded and the
# mail headers up to and including $junkelm are deleted.
# Then, if the first (remaining) argument is 1, 2, or 3, merely
# debugging data is produced.
#
# YOU MUST CHANGE the first three lines and _append_ a line like
# "all:lorbass@xivic.ruhr.de:*:doit=locctl"
# to your control.ctl.
# You may need to edit the next two lines ($gruppe/$rnews).
$host = "xivic";
$domain = "ruhr.de";
$name = "lorbass";
$gruppe = "$host.control";
$rnews = "rnews "; # maybe /usr/bin/rnews or similar
$fqhost = "$host.$domain";
$i_am = "$name@$fqhost";
$msghdr = "From: $i_am\nSender: $i_am\nApproved: $i_am\n"
. "Distribution: local\n";
$nukem = "^("
. "From|Sender|Approved|Distribution|Message-ID|Date"
. '):\s';
$junkelm = "^The original article was:";
if ($ARGV[0] =~ /^e/i){ # snipping Elm's headers
shift; # discard argv0
while (<STDIN>){
last if /$junkelm/;
};
};
$zeit = time;
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
gmtime($zeit);
$msghdr .= sprintf("Date: %d %s %4d %02d:%02d:%02d GMT\n", $mday
, (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon]
, $year+1900, $hour, $min, $sec);
$msg1 = $msghdr . "Message-ID: <do.$zeit.$$@$fqhost>\n";
$msg2 = $msghdr . "Message-ID: <note.$zeit.$$@$fqhost>\n";
while (<STDIN>){ # Header
last if /^$/;
$msg0 .= $_;
s/$nukem/X-\1: /io;
s/^Newsgroups:\s.*$/Newsgroups: $gruppe/io;
$msg1 .= $_;
next if /^Control:\s/;
s/^Subject:\s/Subject: control msg processed: /; # to log it later
$msg2 .= $_;
};
do { # rest, begins with ^$
$msg0 .= $_;
$msg1 .= $_;
$msg2 .= $_;
} while (<STDIN>);
if ($ARGV[0]){ # == testing only
print $msg0 if $ARGV[0] == 1; # the original data after junk stripping
print $msg1 if $ARGV[0] == 2;
print $msg2 if $ARGV[0] == 3;
exit;
};
# Changes active / newsgroups:
open (RNEWS, "| $rnews") || die "Couldn't execute $rnews (1.) $!\n";
print (RNEWS "#! rnews ", length($msg1), "\n", $msg1);
close (RNEWS);
# let everybody know in a local newsgroup:
open (RNEWS, "| $rnews") || die "Couldn't execute $rnews (2.) $!\n";
print (RNEWS "#! rnews ", length($msg2), "\n", $msg2);
close (RNEWS);
exit (0);
--
Wolfgang Schelongowski Check _all_ headers for sending email.
Teifi, Teifi, Sakradie, do geht er dahin!
-- EAV, Alpenrap
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads