home *** CD-ROM | disk | FTP | other *** search
- From: Raphael Manfredi <ram@acri.fr>
- Newsgroups: comp.sources.misc
- Subject: v42i071: mailagent - Flexible mail filtering and processing package, v3.0, Patch07
- Date: 6 May 1994 13:45:23 -0500
- Organization: Advanced Computer Research Institute, Lyon, France
- Sender: kent@sparky.sterling.com
- Approved: kent@sparky.sterling.com
- Message-ID: <2qe383$t1s@sparky.sterling.com>
- X-Md4-Signature: 3d83d9cfd7bc03d0d9ffa63e9d88efa1
-
- Submitted-by: Raphael Manfredi <ram@acri.fr>
- Posting-number: Volume 42, Issue 71
- Archive-name: mailagent/patch07
- Environment: UNIX, Perl
- Patch-To: mailagent: Volume 41, Issue 1-26
-
- [The latest patch for mailagent version 3.0 is #7.]
-
- System: mailagent version 3.0
- Patch #: 7
- Priority: MEDIUM
- Subject: removed a duplicate address in credit list
- Subject: also extract system error messages from logfile
- Subject: added new 'fromesc' config variable for From line escapes
- Subject: removed incorrect sanity check for zcat (void when portable)
- Subject: documented new 'fromesc' config variable
- Subject: forgot to insert the new -F option in the synopsis line
- Subject: here and there fixes
- Subject: global fix for From line escapes to make them configurable
- Subject: fixed selector combination logic and added some debug logs
- Subject: made sure new variable 'fromesc' has a meaningful default
- Subject: now also understands @domain:user@other addresses
- Subject: more accurate for group name parsing
- Subject: added locking protections when updating rule cache
- Subject: check bug reported by Andy Seaborne <afs@hplb.hpl.hp.com>
- Subject: added commented 'fromesc' new variable
- Subject: now make sure From line escaping is correctly removed
- Subject: added three additional tests after a bug was found
- Subject: added three more tests in filter/group
- Subject: make sure unkit directory is not hidden by leading dot
- Date: Mon Apr 25 17:26:57 MET DST 1994
- From: Raphael Manfredi <ram@acri.fr>
-
- Description:
- Removed a duplicate address in credit list.
-
- Make sure the chkagent.sh script also extract system error
- messages from logfile (this script is intended to be run
- by cron every night).
-
- Added new 'fromesc' config variable for From line escapes. By
- setting this variable to OFF, mailagent will stop escaping the
- potentially dangerous From_ lines in your messages by prepending
- a '>' in front. If you don't add it to your ~/.mailagent, it
- will default to ON.
-
- Removed incorrect sanity check for zcat (void when portable)
- in the mailpatch script. When Configure told it to be portable,
- the $zcat variable is not holding the full path name...
-
- Documented new 'fromesc' config variable in manual page and
- added the new -F option in the synopsis line (miss reported
- by Shigeya Suzuki <shigeya@foretune.co.jp>.
-
- Fixed selector combination logic and added some debug logs.
- I found a bug in it, and therefore I added three more tests
- in the regression test suite to make sure they never reappear
- again...
-
- RFC-822 parser now also understands @domain:user@other addresses,
- which makes it possible to select on the user login name...
- Also made more accurate for group name parsing.
-
- Added locking protections when updating rule cache. Since the -r
- option may update the cache and no global mailagent locking is
- performed in that case, it was mandatory to fix it. Otherwise,
- the rule cache could have got corrupted in some way, resulting
- in incorrect filtering.
-
- Check bug reported by Andy Seaborne <afs@hplb.hpl.hp.com>. The
- From_ line escaping was not done properly. Sorry.
-
- Make sure unkit directory is not hidden by leading dot. The UNKIT
- command under the misc/ directory was updated to avoid the creation
- of an hidden archive (created from subject when someone runs a
- 'kit ./file'.
-
-
- Fix: From rn, say "| patch -p -N -d DIR", where DIR is your mailagent source
- directory. Outside of rn, say "cd DIR; patch -p -N <thisarticle".
- If you don't have the patch program, apply the following by hand,
- or get patch (version 2.0, latest patchlevel).
-
- After patching:
- Configure -ders
- make depend
- make
- make install
- make install.man
-
- If patch indicates that patchlevel is the wrong version, you may need
- to apply one or more previous patches, or the patch may already
- have been applied. See the patchlevel.h file to find out what has or
- has not been applied. In any event, don't continue with the patch.
-
- If you are missing previous patches they can be obtained from me:
-
- Raphael Manfredi <ram@acri.fr>
-
- If you send a mail message of the following form it will greatly speed
- processing:
-
- Subject: Command
- @SH mailpatch PATH mailagent 3.0 LIST
- ^ note the c
-
- where PATH is a return path FROM ME TO YOU either in Internet notation,
- or in bang notation from some well-known host, and LIST is the number
- of one or more patches you need, separated by spaces, commas, and/or
- hyphens. Saying 35- says everything from 35 to the end.
-
- To get some more detailed instructions, send me the following mail:
-
- Subject: Command
- @SH mailhelp PATH
-
-
- Index: patchlevel.h
- Prereq: 6
- 4c4
- < #define PATCHLEVEL 6
- ---
- > #define PATCHLEVEL 7
-
- Index: agent/pl/actions.pl
- Prereq: 3.0.1.1
- *** agent/pl/actions.pl.old Mon Apr 25 17:26:46 1994
- --- agent/pl/actions.pl Mon Apr 25 17:26:46 1994
- ***************
- *** 1,4 ****
- ! ;# $Id: actions.pl,v 3.0.1.1 1994/01/26 09:30:03 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- --- 1,4 ----
- ! ;# $Id: actions.pl,v 3.0.1.2 1994/04/25 15:16:53 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- ***************
- *** 9,14 ****
- --- 9,18 ----
- ;# of the source tree for mailagent 3.0.
- ;#
- ;# $Log: actions.pl,v $
- + ;# Revision 3.0.1.2 1994/04/25 15:16:53 ram
- + ;# patch7: here and there fixes
- + ;# patch7: global fix for From line escapes to make them configurable
- + ;#
- ;# Revision 3.0.1.1 1994/01/26 09:30:03 ram
- ;# patch5: restored ability to use Cc: and Bcc: in message files
- ;#
- ***************
- *** 886,899 ****
- open(STDIN, "<&READ"); # Redirect stdin to pipe
- close READ if $input == $NO_INPUT; # Close stdin if needed
- unless (open(STDOUT, ">$trace")) { # Where output goes
- ! &add_log("WARNING couldn't create $trace") if $loglvl > 5;
- if ($feedback == $FEEDBACK) { # Need trace if feedback
- kill 'SIGPIPE', $ppid; # Parent still waiting
- exit 1;
- }
- }
- open(STDERR, ">&STDOUT"); # Make it follow pipe
- ! exec "$program"; # Run the program now
- &add_log("ERROR couldn't exec '$program': $!") if $loglvl > 1;
- kill 'SIGPIPE', $ppid; # Parent still waiting
- exit 1;
- --- 890,903 ----
- open(STDIN, "<&READ"); # Redirect stdin to pipe
- close READ if $input == $NO_INPUT; # Close stdin if needed
- unless (open(STDOUT, ">$trace")) { # Where output goes
- ! &add_log("WARNING couldn't create $trace: $!") if $loglvl > 5;
- if ($feedback == $FEEDBACK) { # Need trace if feedback
- kill 'SIGPIPE', $ppid; # Parent still waiting
- exit 1;
- }
- }
- open(STDERR, ">&STDOUT"); # Make it follow pipe
- ! exec $program; # Run the program now
- &add_log("ERROR couldn't exec '$program': $!") if $loglvl > 1;
- kill 'SIGPIPE', $ppid; # Parent still waiting
- exit 1;
- ***************
- *** 1002,1010 ****
- }
- local($temp) = ' ' x 2000; # Temporary storage (pre-extended)
- $temp = '';
- if ($input == $BODY_INPUT) { # We have to feed back the body only
- while (<TRACE>) {
- ! s/^From\s/>From$1/; # Protect potentially dangerous lines
- $temp .= $_;
- }
- } else {
- --- 1006,1017 ----
- }
- local($temp) = ' ' x 2000; # Temporary storage (pre-extended)
- $temp = '';
- + local($last_was_nl) = 1; # True when previous line was blank
- if ($input == $BODY_INPUT) { # We have to feed back the body only
- while (<TRACE>) {
- ! # Protect potentially dangerous lines
- ! s/^From(\s)/>From$1/ if $last_was_nl && $cf'fromesc =~ /on/i;
- ! $last_was_nl = /^$/;
- $temp .= $_;
- }
- } else {
- ***************
- *** 1014,1020 ****
- if (1../^$/) {
- $head .= $_ unless /^$/;
- } else {
- ! s/^From\s/>From$1/; # Protect potentially dangerous lines
- $temp .= $_;
- }
- }
- --- 1021,1029 ----
- if (1../^$/) {
- $head .= $_ unless /^$/;
- } else {
- ! # Protect potentially dangerous lines
- ! s/^From(\s)/>From$1/ if $last_was_nl && $cf'fromesc =~ /on/i;
- ! $last_was_nl = /^$/;
- $temp .= $_;
- }
- }
- ***************
- *** 1369,1375 ****
- # escape all potentially dangerous From lines.
- local($last_was_space);
- foreach (@array) {
- ! s/^From\s+(\S+)/>From $1/ if $last_was_space;
- s/^- -/-/; # This is the EB escape in RFC-934
- $last_was_space = /^$/; # From is dangerous after blank line
- }
- --- 1378,1385 ----
- # escape all potentially dangerous From lines.
- local($last_was_space);
- foreach (@array) {
- ! # Protect potentially dangerous lines
- ! s/^From\s+(\S+)/>From $1/ if $last_was_space && $cf'fromesc =~ /on/i;
- s/^- -/-/; # This is the EB escape in RFC-934
- $last_was_space = /^$/; # From is dangerous after blank line
- }
-
- Index: agent/pl/rules.pl
- Prereq: 3.0
- *** agent/pl/rules.pl.old Mon Apr 25 17:26:50 1994
- --- agent/pl/rules.pl Mon Apr 25 17:26:51 1994
- ***************
- *** 1,4 ****
- ! ;# $Id: rules.pl,v 3.0 1993/11/29 13:49:14 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- --- 1,4 ----
- ! ;# $Id: rules.pl,v 3.0.1.1 1994/04/25 15:23:03 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- ***************
- *** 9,14 ****
- --- 9,17 ----
- ;# of the source tree for mailagent 3.0.
- ;#
- ;# $Log: rules.pl,v $
- + ;# Revision 3.0.1.1 1994/04/25 15:23:03 ram
- + ;# patch7: added locking protections when updating rule cache
- + ;#
- ;# Revision 3.0 1993/11/29 13:49:14 ram
- ;# Baseline for mailagent 3.0 netwide release.
- ;#
- ***************
- *** 290,295 ****
- --- 293,302 ----
- sub write_cache {
- return 0 unless defined $cf'rulecache;
- local(*CACHE); # File handle used to write the cache
- + if (0 != &'acs_rqst($cf'rulecache)) {
- + &'add_log("NOTICE unable to write-lock $cf'rulecache") if $'loglvl > 6;
- + return 0; # Cannot write
- + }
- unless (open(CACHE, ">$cf'rulecache")) {
- &'add_log("ERROR cannot create rule cache $cf'rulecache: $!")
- if $'loglvl;
- ***************
- *** 303,311 ****
- &write_fd(CACHE) || $error++; # Write rules
- &writevar_fd(CACHE) || $error++; # And XENV variables
- close(CACHE) || $error++;
- if ($error) {
- - &'add_log("WARNING could not cache rules") if $'loglvl > 5;
- unlink $cf'rulecache;
- return 0;
- }
- 1; # Success
- --- 310,319 ----
- &write_fd(CACHE) || $error++; # Write rules
- &writevar_fd(CACHE) || $error++; # And XENV variables
- close(CACHE) || $error++;
- + &'free_file($cf'rulecache); # Unlock cache
- if ($error) {
- unlink $cf'rulecache;
- + &'add_log("WARNING could not cache rules") if $'loglvl > 5;
- return 0;
- }
- 1; # Success
- ***************
- *** 313,322 ****
- --- 321,336 ----
-
- # Read cached rules into @Rules and %Rules and returns 1 if done, 0 when
- # the cache may not be read for whatever reason (e.g. out of date).
- + # Since the '-r' option may also need to cache rules and no mailagent lock
- + # is taken in that case, we need to lock the rule file before accessing it.
- sub read_cache {
- return 0 unless &cache_ok;
- local(*CACHE); # File handle used to read the cache
- local($_);
- + if (0 != &'acs_rqst($cf'rulecache)) {
- + &'add_log("NOTICE unable to read-lock $cf'rulecache") if $'loglvl > 6;
- + return 0; # Cannot read
- + }
- open(CACHE, $cf'rulecache) || return 0; # Cannot open, assume out of date
- $_ = <CACHE>; # Disregard top line
- while (<CACHE>) { # First read the @Rules
- ***************
- *** 336,341 ****
- --- 350,356 ----
- s/^\s*(\w+)\s*=\s*// && ($'XENV{$1} = $_);
- }
- close CACHE;
- + &'free_file($cf'rulecache); # Unlock cache
- 1; # Success
- }
-
-
- Index: agent/pl/analyze.pl
- Prereq: 3.0.1.1
- *** agent/pl/analyze.pl.old Mon Apr 25 17:26:47 1994
- --- agent/pl/analyze.pl Mon Apr 25 17:26:47 1994
- ***************
- *** 1,4 ****
- ! ;# $Id: analyze.pl,v 3.0.1.1 1994/01/26 09:30:23 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- --- 1,4 ----
- ! ;# $Id: analyze.pl,v 3.0.1.2 1994/04/25 15:17:24 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- ***************
- *** 9,14 ****
- --- 9,17 ----
- ;# of the source tree for mailagent 3.0.
- ;#
- ;# $Log: analyze.pl,v $
- + ;# Revision 3.0.1.2 1994/04/25 15:17:24 ram
- + ;# patch7: fixed selector combination logic and added some debug logs
- + ;#
- ;# Revision 3.0.1.1 1994/01/26 09:30:23 ram
- ;# patch5: now understands new -F option to force processing
- ;#
- ***************
- *** 245,251 ****
- # Here it is the OR which is guaranteed to be optimized. Do
- # not attempt the match if an identical selector already
- # matched sucessfully.
- ! unless ($Matched{$selist}) {
- $Matched{$selist} = &match($selector, $pattern, $range);
- }
- }
- --- 248,254 ----
- # Here it is the OR which is guaranteed to be optimized. Do
- # not attempt the match if an identical selector already
- # matched sucessfully.
- ! unless (defined $Matched{$selist} && $Matched{$selist}) {
- $Matched{$selist} = &match($selector, $pattern, $range);
- }
- }
- ***************
- *** 257,270 ****
-
- $matched = 1; # Assume everything matched
- foreach $key (keys %Matched) { # All entries must have matched
- ! $matched = 0 unless $Matched{$key};
- }
- if ($matched) { # If %Matched failed, all failed!
- foreach $key (keys %Inverted) { # Only one entry needs to match
- ! $matched = 0 unless $Inverted{$key};
- last if $matched;
- }
- }
-
- if ($matched) { # Execute action if pattern matched
- # Make sure the rule has not already been executed in that mode
- --- 260,281 ----
-
- $matched = 1; # Assume everything matched
- foreach $key (keys %Matched) { # All entries must have matched
- ! $matched = $Matched{$key} ? 1 : 0;
- ! &add_log("rule #$j: direct $key " . ($matched ? 'ok' : 'failed'))
- ! if $loglvl > 19;
- ! last unless $matched;
- }
- if ($matched) { # If %Matched failed, all failed!
- foreach $key (keys %Inverted) { # Only one entry needs to match
- ! $matched = $Inverted{$key} ? 1 : 0;
- ! &add_log("rule #$j: neg $key " . ($matched ? 'ok' : 'failed'))
- ! if $loglvl > 19;
- last if $matched;
- }
- }
- +
- + &add_log("matching summary rule #$j: " . ($matched ? 'ok' : 'failed'))
- + if $loglvl > 17;
-
- if ($matched) { # Execute action if pattern matched
- # Make sure the rule has not already been executed in that mode
-
- Index: agent/man/mailagent.SH
- Prereq: 3.0.1.2
- *** agent/man/mailagent.SH.old Mon Apr 25 17:26:43 1994
- --- agent/man/mailagent.SH Mon Apr 25 17:26:44 1994
- ***************
- *** 20,26 ****
- .TH MAILAGENT $manext "Version $VERSION PL$PATCHLEVEL"
- ''' @(#) Manual page for mailagent's filter -- (c) ram February 1991
- '''
- ! ''' $Id: mailagent.SH,v 3.0.1.2 1994/01/26 09:29:24 ram Exp $
- '''
- ''' Copyright (c) 1990-1993, Raphael Manfredi
- '''
- --- 20,26 ----
- .TH MAILAGENT $manext "Version $VERSION PL$PATCHLEVEL"
- ''' @(#) Manual page for mailagent's filter -- (c) ram February 1991
- '''
- ! ''' $Id: mailagent.SH,v 3.0.1.3 1994/04/25 15:15:56 ram Exp $
- '''
- ''' Copyright (c) 1990-1993, Raphael Manfredi
- '''
- ***************
- *** 31,36 ****
- --- 31,40 ----
- ''' of the source tree for mailagent 3.0.
- '''
- ''' $Log: mailagent.SH,v $
- + ''' Revision 3.0.1.3 1994/04/25 15:15:56 ram
- + ''' patch7: documented new 'fromesc' config variable
- + ''' patch7: forgot to insert the new -F option in the synopsis line
- + '''
- ''' Revision 3.0.1.2 1994/01/26 09:29:24 ram
- ''' patch5: documents new tag feature for UNIQUE and RECORD
- ''' patch5: documents new -F option
- ***************
- *** 55,61 ****
- .SH NAME
- mailagent \- an automatic mail-processing tool
- .SH SYNOPSIS
- ! \fBmailagent\fR [ \fB\-dhilqtV\fR ] [ \fB\-s{umary}\fR ] [ \fB\-f\fI file\fR ]
- [ \fB\-e\fI rule\fR ] [ \fB\-c\fI config\fR ] [ \fB\-L\fI loglevel\fR ]
- [ \fB\-r\fI rulefile\fR ] [ \fB\-o\fI override\fR ] [ \fImailfile\fR ]
- .SH DESCRIPTION
- --- 59,65 ----
- .SH NAME
- mailagent \- an automatic mail-processing tool
- .SH SYNOPSIS
- ! \fBmailagent\fR [ \fB\-dhilqtFV\fR ] [ \fB\-s{umary}\fR ] [ \fB\-f\fI file\fR ]
- [ \fB\-e\fI rule\fR ] [ \fB\-c\fI config\fR ] [ \fB\-L\fI loglevel\fR ]
- [ \fB\-r\fI rulefile\fR ] [ \fB\-o\fI override\fR ] [ \fImailfile\fR ]
- .SH DESCRIPTION
- ***************
- *** 225,230 ****
- --- 229,239 ----
- .I emergdir
- Name of the directory which should be used for dumps, preferably. This is
- optional. (suggested: ~/tmp/lost+mail)
- + .TP
- + .I fromesc
- + Whether or not \fImailagent\fR should escape potentially dangerous \fIFrom\fR
- + lines in mail messages. If you use MH or if your mail reader does not use
- + those lines to separate messages, then you may set it to OFF. (suggested: ON)
- .TP
- .I hash
- The directory used for name hashing by the built-in database used by ONCE,
-
- Index: agent/test/cmd/pass.t
- Prereq: 3.0
- *** agent/test/cmd/pass.t.old Mon Apr 25 17:26:53 1994
- --- agent/test/cmd/pass.t Mon Apr 25 17:26:53 1994
- ***************
- *** 1,6 ****
- # The PASS command
-
- ! # $Id: pass.t,v 3.0 1993/11/29 13:49:37 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- --- 1,6 ----
- # The PASS command
-
- ! # $Id: pass.t,v 3.0.1.1 1994/04/25 15:25:22 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- ***************
- *** 11,32 ****
- # of the source tree for mailagent 3.0.
- #
- # $Log: pass.t,v $
- # Revision 3.0 1993/11/29 13:49:37 ram
- # Baseline for mailagent 3.0 netwide release.
- #
-
- ! do '../pl/cmd.pl';
- unlink 'output';
-
- &add_header('X-Tag: pass');
- `$cmd`;
- $? == 0 || print "1\n";
- -f 'output' || print "2\n"; # Where mail is saved
- `grep -v X-Filter: output > comp`;
- $? == 0 || print "3\n";
- `grep -v and mail > ok`;
- ! ((-s 'comp') - 1) == -s 'ok' || print "4\n"; # SAVE adds extra final new-line
- -s 'comp' != -s 'output' || print "5\n"; # Casually check X-Filter was there
-
- unlink 'output', 'mail', 'ok', 'comp';
- print "0\n";
- --- 11,42 ----
- # of the source tree for mailagent 3.0.
- #
- # $Log: pass.t,v $
- + # Revision 3.0.1.1 1994/04/25 15:25:22 ram
- + # patch7: now make sure From line escaping is correctly removed
- + #
- # Revision 3.0 1993/11/29 13:49:37 ram
- # Baseline for mailagent 3.0 netwide release.
- #
-
- ! do '../pl/misc.pl';
- unlink 'output';
-
- &add_header('X-Tag: pass');
- + &add_option("-o 'fromesc: OFF'");
- + open(MAIL, '>>mail');
- + print MAIL "\n>From test bug reported by Andy Seaborne <afs@hplb.hpl.hp.com>\n";
- + close MAIL;
- `$cmd`;
- $? == 0 || print "1\n";
- -f 'output' || print "2\n"; # Where mail is saved
- `grep -v X-Filter: output > comp`;
- $? == 0 || print "3\n";
- `grep -v and mail > ok`;
- ! # SAVE adds extra final new-line, but the leading '>' from From is removed
- ! (-s 'comp') == -s 'ok' || print "4\n";
- -s 'comp' != -s 'output' || print "5\n"; # Casually check X-Filter was there
- + &get_log(6, 'output');
- + &check_log('^From test bug', 7) == 1 || print "8\n";
-
- unlink 'output', 'mail', 'ok', 'comp';
- print "0\n";
-
- Index: agent/test/filter/group.t
- Prereq: 3.0
- *** agent/test/filter/group.t.old Mon Apr 25 17:26:53 1994
- --- agent/test/filter/group.t Mon Apr 25 17:26:53 1994
- ***************
- *** 1,6 ****
- # Test grouping of selectors (mixing normal and inverted selections)
-
- ! # $Id: group.t,v 3.0 1993/11/29 13:49:59 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- --- 1,6 ----
- # Test grouping of selectors (mixing normal and inverted selections)
-
- ! # $Id: group.t,v 3.0.1.1 1994/04/25 15:25:47 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- ***************
- *** 11,24 ****
- # of the source tree for mailagent 3.0.
- #
- # $Log: group.t,v $
- # Revision 3.0 1993/11/29 13:49:59 ram
- # Baseline for mailagent 3.0 netwide release.
- #
-
- do '../pl/filter.pl';
- - unlink 'never', 'always', 'always.2', 'always.3';
-
- &add_header('X-Tag: group');
- `$cmd`;
- $? == 0 || print "1\n";
- -f "$user" && print "2\n"; # Mail has been deleted
- --- 11,34 ----
- # of the source tree for mailagent 3.0.
- #
- # $Log: group.t,v $
- + # Revision 3.0.1.1 1994/04/25 15:25:47 ram
- + # patch7: added three additional tests after a bug was found
- + #
- # Revision 3.0 1993/11/29 13:49:59 ram
- # Baseline for mailagent 3.0 netwide release.
- #
-
- do '../pl/filter.pl';
-
- + sub cleanup {
- + unlink 'never', 'never.2', 'always', 'always.2', 'always.3',
- + 'always.4', 'always.5';
- + }
- +
- + &add_header('Cc: guy_1@acri.fr, guy_2@eiffel.com, guy_3@inria.fr');
- &add_header('X-Tag: group');
- + &cleanup;
- +
- `$cmd`;
- $? == 0 || print "1\n";
- -f "$user" && print "2\n"; # Mail has been deleted
- ***************
- *** 26,31 ****
- -f 'always' || print "4\n"; # This one must have matched
- -f 'always.2' || print "5\n";
- -f 'always.3' || print "6\n";
-
- ! unlink 'never', 'always', 'always.2', 'always.3';
- print "0\n";
- --- 36,44 ----
- -f 'always' || print "4\n"; # This one must have matched
- -f 'always.2' || print "5\n";
- -f 'always.3' || print "6\n";
- + -f 'never.2' && print "7\n";
- + -f 'always.4' || print "8\n";
- + -f 'always.5' || print "9\n";
-
- ! &cleanup;
- print "0\n";
-
- Index: agent/test/rules
- Prereq: 3.0
- *** agent/test/rules.old Mon Apr 25 17:26:54 1994
- --- agent/test/rules Mon Apr 25 17:26:54 1994
- ***************
- *** 2,8 ****
- # Mailagent rules for filter regression tests
- #
-
- ! # $Id: rules,v 3.0 1993/11/29 13:50:27 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- --- 2,8 ----
- # Mailagent rules for filter regression tests
- #
-
- ! # $Id: rules,v 3.0.1.1 1994/04/25 15:26:12 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- ***************
- *** 13,18 ****
- --- 13,21 ----
- # of the source tree for mailagent 3.0.
- #
- # $Log: rules,v $
- + # Revision 3.0.1.1 1994/04/25 15:26:12 ram
- + # patch7: added three more tests in filter/group
- + #
- # Revision 3.0 1993/11/29 13:50:27 ram
- # Baseline for mailagent 3.0 netwide release.
- #
- ***************
- *** 97,103 ****
- <GROUP> !To !From: ram { SAVE never };
- <GROUP> To !From: !ram { SAVE never };
- <GROUP> !To !From: ram,
- ! !Subject !From: ram { SAVE never };
- <GROUP> !To: root, ram { SAVE never };
- <GROUP> !F.*: /compiler/ { SAVE never };
- <GROUP> !From: ram, !To: ram { SAVE always; REJECT };
- --- 100,106 ----
- <GROUP> !To !From: ram { SAVE never };
- <GROUP> To !From: !ram { SAVE never };
- <GROUP> !To !From: ram,
- ! !Subject !To: ram { SAVE never };
- <GROUP> !To: root, ram { SAVE never };
- <GROUP> !F.*: /compiler/ { SAVE never };
- <GROUP> !From: ram, !To: ram { SAVE always; REJECT };
- ***************
- *** 107,113 ****
- <GROUP> From !Cc !To: /compiler/,
- From !Cc !To: ram,
- !From To Cc: /eiffel/,
- ! !From To Cc: !/ice/ { SAVE always.3 };
-
- # filter/case
- X-Tag: case, Cc: root { STRIP Cc; SAVE always };
- --- 110,119 ----
- <GROUP> From !Cc !To: /compiler/,
- From !Cc !To: ram,
- !From To Cc: /eiffel/,
- ! !From To Cc: !/ice/ { SAVE always.3; REJECT };
- ! <GROUP> !To !Cc: guy_3 { SAVE never.2 };
- ! <GROUP> !To Cc: guy_3 { SAVE always.4; REJECT };
- ! <GROUP> !To: unknown, !Subject !From: ram { SAVE always.5 };
-
- # filter/case
- X-Tag: case, Cc: root { STRIP Cc; SAVE always };
-
- Index: agent/pl/rfc822.pl
- Prereq: 3.0
- *** agent/pl/rfc822.pl.old Mon Apr 25 17:26:50 1994
- --- agent/pl/rfc822.pl Mon Apr 25 17:26:50 1994
- ***************
- *** 1,4 ****
- ! ;# $Id: rfc822.pl,v 3.0 1993/11/29 13:49:13 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- --- 1,4 ----
- ! ;# $Id: rfc822.pl,v 3.0.1.1 1994/04/25 15:22:39 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- ***************
- *** 9,14 ****
- --- 9,18 ----
- ;# of the source tree for mailagent 3.0.
- ;#
- ;# $Log: rfc822.pl,v $
- + ;# Revision 3.0.1.1 1994/04/25 15:22:39 ram
- + ;# patch7: now also understands @domain:user@other addresses
- + ;# patch7: more accurate for group name parsing
- + ;#
- ;# Revision 3.0 1993/11/29 13:49:13 ram
- ;# Baseline for mailagent 3.0 netwide release.
- ;#
- ***************
- *** 55,65 ****
-
- # Parses an internet address and returns the login name of the sender. When
- # facing an RFC 822 group addressing (like To: group:;), it returns the group
- ! # name.
- sub login_name {
- local($_) = shift(@_); # The internet address
- ! if (/^(\S+):;/) { # rfc-822-group:;
- ! &last_name($1);
- } elsif (s/^"(\S+)"@\S+/$1/) { # "user@domain"@other
- &login_name($_); # parse user@domain
- } elsif (s/^(\S+)@\S+/$1/) { # user@domain.name
- --- 59,75 ----
-
- # Parses an internet address and returns the login name of the sender. When
- # facing an RFC 822 group addressing (like To: group:;), it returns the group
- ! # name when mailbox is not specified.
- sub login_name {
- local($_) = shift(@_); # The internet address
- ! if (/^(\S+):(\S*);/) { # rfc-822-group:mailbox;
- ! if ($2 eq '') {
- ! &last_name($1); # empty mailbox name, use phrase
- ! } else {
- ! &login_name($2); # mailbox name
- ! }
- ! } elsif (s/^@\S+://) { # @domain:user@other
- ! &login_name($_); # parse user@other
- } elsif (s/^"(\S+)"@\S+/$1/) { # "user@domain"@other
- &login_name($_); # parse user@domain
- } elsif (s/^(\S+)@\S+/$1/) { # user@domain.name
-
- Index: agent/pl/matching.pl
- Prereq: 3.0
- *** agent/pl/matching.pl.old Mon Apr 25 17:26:48 1994
- --- agent/pl/matching.pl Mon Apr 25 17:26:48 1994
- ***************
- *** 1,4 ****
- ! ;# $Id: matching.pl,v 3.0 1993/11/29 13:49:00 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- --- 1,4 ----
- ! ;# $Id: matching.pl,v 3.0.1.1 1994/04/25 15:17:49 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- ***************
- *** 9,14 ****
- --- 9,17 ----
- ;# of the source tree for mailagent 3.0.
- ;#
- ;# $Log: matching.pl,v $
- + ;# Revision 3.0.1.1 1994/04/25 15:17:49 ram
- + ;# patch7: fixed selector combination logic and added some debug logs
- + ;#
- ;# Revision 3.0 1993/11/29 13:49:00 ram
- ;# Baseline for mailagent 3.0 netwide release.
- ;#
- ***************
- *** 143,157 ****
- $match = &selector_match($select, $pattern, $range);
- }
- if ($not) { # Negated test
- ! $invert = !$match if $invert;
- ! $inverted = $invert if !$match; # '!' tests AND'ed
- } else {
- $matched = $match; # Normal tests OR'ed
- }
- last if $matched; # Stop when matching status known
- }
- }
- ! $matched || $inverted; # Return matching status
- }
-
- # Attempt a pattern match on a set of selectors, and set the special macro %&
- --- 146,166 ----
- $match = &selector_match($select, $pattern, $range);
- }
- if ($not) { # Negated test
- ! $invert = !$match if $invert; # '!' tests AND'ed
- ! $inverted = $invert; # Meaningful from now on
- } else {
- $matched = $match; # Normal tests OR'ed
- }
- last if $matched; # Stop when matching status known
- }
- }
- ! $matched = $matched || $inverted;
- ! if ($loglvl > 19) {
- ! local($logmsg) = "applied '$pattern' on '$selector' ($range) was ";
- ! $logmsg .= $matched ? "true" : "false";
- ! &add_log($logmsg);
- ! }
- ! $matched; # Return matching status
- }
-
- # Attempt a pattern match on a set of selectors, and set the special macro %&
-
- Index: agent/mailpatch.SH
- Prereq: 3.0
- *** agent/mailpatch.SH.old Mon Apr 25 17:26:41 1994
- --- agent/mailpatch.SH Mon Apr 25 17:26:41 1994
- ***************
- *** 20,26 ****
- eval "exec perl -S \$0 \$*"
- if \$running_under_some_shell;
-
- ! # $Id: mailpatch.SH,v 3.0 1993/11/29 13:48:25 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- --- 20,26 ----
- eval "exec perl -S \$0 \$*"
- if \$running_under_some_shell;
-
- ! # $Id: mailpatch.SH,v 3.0.1.1 1994/04/25 15:12:06 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- ***************
- *** 31,36 ****
- --- 31,39 ----
- # of the source tree for mailagent 3.0.
- #
- # $Log: mailpatch.SH,v $
- + # Revision 3.0.1.1 1994/04/25 15:12:06 ram
- + # patch7: removed incorrect sanity check for zcat (void when portable)
- + #
- # Revision 3.0 1993/11/29 13:48:25 ram
- # Baseline for mailagent 3.0 netwide release.
- #
- ***************
- *** 261,274 ****
- $append = $cat;
- $extent = '';
- } elsif (-f "$patchfile.Z") { # Compressed patch
- ! if ($zcat ne 'zcat') { # Zcat found by Configure
- ! $append = $zcat;
- ! $extent = '.Z';
- ! } else {
- ! &add_log("ERROR no zcat to uncompress patch #$num ($system)")
- ! if $loglvl > 1;
- ! next;
- ! }
- } else {
- &add_log("ERROR no patch #$num ($system)") if $loglvl > 1;
- next;
- --- 264,271 ----
- $append = $cat;
- $extent = '';
- } elsif (-f "$patchfile.Z") { # Compressed patch
- ! $append = $zcat;
- ! $extent = '.Z';
- } else {
- &add_log("ERROR no patch #$num ($system)") if $loglvl > 1;
- next;
- ***************
- *** 289,294 ****
- --- 286,298 ----
- ";
- close TMP;
- system "$append <$patchfile$extent >>$tmp/$patchfile";
- + if ($? && $loglvl > 1) {
- + &add_log("ERROR can't uncompress patch #$num ($system)")
- + if $append eq $zcat;
- + &add_log("ERROR can't copy patch #$num ($system)")
- + if $append eq $cat;
- + next;
- + }
- &add_log("copied file $patchfile into $tmp") if $loglvl > 17;
- }
-
-
- Index: agent/pl/parse.pl
- Prereq: 3.0
- *** agent/pl/parse.pl.old Mon Apr 25 17:26:48 1994
- --- agent/pl/parse.pl Mon Apr 25 17:26:48 1994
- ***************
- *** 1,4 ****
- ! ;# $Id: parse.pl,v 3.0 1993/11/29 13:49:05 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- --- 1,4 ----
- ! ;# $Id: parse.pl,v 3.0.1.1 1994/04/25 15:18:14 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- ***************
- *** 9,14 ****
- --- 9,17 ----
- ;# of the source tree for mailagent 3.0.
- ;#
- ;# $Log: parse.pl,v $
- + ;# Revision 3.0.1.1 1994/04/25 15:18:14 ram
- + ;# patch7: global fix for From line escapes to make them configurable
- + ;#
- ;# Revision 3.0 1993/11/29 13:49:05 ram
- ;# Baseline for mailagent 3.0 netwide release.
- ;#
- ***************
- *** 89,95 ****
- last if $head_only; # Stop parsing if only header wanted
- $lines++; # One more line in body
- $length += length($_); # Update length of message
- ! s/^From(\s)/>From$1/ if $last_was_nl; # Escape From keyword
- $last_was_nl = /^$/; # Keep track of single '\n'
- $Header{'Body'} .= $_;
- chop;
- --- 92,99 ----
- last if $head_only; # Stop parsing if only header wanted
- $lines++; # One more line in body
- $length += length($_); # Update length of message
- ! # Protect potentially dangerous lines when asked to do so
- ! s/^From(\s)/>From$1/ if $last_was_nl && $cf'fromesc =~ /on/i;
- $last_was_nl = /^$/; # Keep track of single '\n'
- $Header{'Body'} .= $_;
- chop;
-
- Index: agent/pl/read_conf.pl
- Prereq: 3.0
- *** agent/pl/read_conf.pl.old Mon Apr 25 17:26:49 1994
- --- agent/pl/read_conf.pl Mon Apr 25 17:26:49 1994
- ***************
- *** 1,4 ****
- ! ;# $Id: read_conf.pl,v 3.0 1993/11/29 13:49:12 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- --- 1,4 ----
- ! ;# $Id: read_conf.pl,v 3.0.1.1 1994/04/25 15:21:34 ram Exp $
- ;#
- ;# Copyright (c) 1990-1993, Raphael Manfredi
- ;#
- ***************
- *** 9,14 ****
- --- 9,17 ----
- ;# of the source tree for mailagent 3.0.
- ;#
- ;# $Log: read_conf.pl,v $
- + ;# Revision 3.0.1.1 1994/04/25 15:21:34 ram
- + ;# patch7: made sure new variable 'fromesc' has a meaningful default
- + ;#
- ;# Revision 3.0 1993/11/29 13:49:12 ram
- ;# Baseline for mailagent 3.0 netwide release.
- ;#
- ***************
- *** 104,109 ****
- --- 107,115 ----
- $sendmail = $'mailer if $sendmail eq ''; # No sendmail program specified
- $sendnews = $'inews if $sendnews eq ''; # No news posting program
- $mailopt = '-odq' if $mailopt eq '' && $sendmail =~ /sendmail/;
- +
- + # Backward compatibility -- RAM, 25/04/94
- + $fromesc = 'ON' unless defined $fromesc; # If absent from ~/.mailagent
-
- # Update @INC perlib search path with the perlib variable. Paths not
- # starting by a '/' are supposed to be under the mailagent private lib
-
- Index: agent/files/chkagent.sh
- Prereq: 3.0
- *** agent/files/chkagent.sh.old Mon Apr 25 17:26:40 1994
- --- agent/files/chkagent.sh Mon Apr 25 17:26:40 1994
- ***************
- *** 1,6 ****
- #!/bin/sh
- #
- ! # $Id: chkagent.sh,v 3.0 1993/11/29 13:47:49 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- --- 1,6 ----
- #!/bin/sh
- #
- ! # $Id: chkagent.sh,v 3.0.1.1 1994/04/25 15:10:32 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- ***************
- *** 11,22 ****
- # of the source tree for mailagent 3.0.
- #
- # $Log: chkagent.sh,v $
- # Revision 3.0 1993/11/29 13:47:49 ram
- # Baseline for mailagent 3.0 netwide release.
- #
-
- # Make sure the mailagent is working well
- ! lookat='ERROR|FAILED|WARNING|FATAL|DUMPED'
-
- trap "rm -f $report $output $todaylog $msg" 1 2 3 15
-
- --- 11,25 ----
- # of the source tree for mailagent 3.0.
- #
- # $Log: chkagent.sh,v $
- + # Revision 3.0.1.1 1994/04/25 15:10:32 ram
- + # patch7: also extract system error messages from logfile
- + #
- # Revision 3.0 1993/11/29 13:47:49 ram
- # Baseline for mailagent 3.0 netwide release.
- #
-
- # Make sure the mailagent is working well
- ! lookat='ERROR|FAILED|WARNING|FATAL|DUMPED|SYSERR'
-
- trap "rm -f $report $output $todaylog $msg" 1 2 3 15
-
-
- Index: agent/files/mailagent.cf
- Prereq: 3.0
- *** agent/files/mailagent.cf.old Mon Apr 25 17:26:40 1994
- --- agent/files/mailagent.cf Mon Apr 25 17:26:40 1994
- ***************
- *** 2,8 ****
- # Configuration file for mailagent
- #
-
- ! # $Id: mailagent.cf,v 3.0 1993/11/29 13:48:02 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- --- 2,8 ----
- # Configuration file for mailagent
- #
-
- ! # $Id: mailagent.cf,v 3.0.1.1 1994/04/25 15:11:03 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- ***************
- *** 13,18 ****
- --- 13,21 ----
- # of the source tree for mailagent 3.0.
- #
- # $Log: mailagent.cf,v $
- + # Revision 3.0.1.1 1994/04/25 15:11:03 ram
- + # patch7: added new 'fromesc' config variable for From line escapes
- + #
- # Revision 3.0 1993/11/29 13:48:02 ram
- # Baseline for mailagent 3.0 netwide release.
- #
- ***************
- *** 76,81 ****
- --- 79,85 ----
- mailbox : $user # Mailbox file name (optional)
- mmdf : OFF # Allow MMDF-style mailbox delivery
- mmdfbox : OFF # Force new folders to MMDF format
- + fromesc : ON # Escape leading From into >From
-
- # MH-style folders
- mhprofile: ~/.mh_profile # Name of the MH profile file (optional)
-
- Index: agent/test/basic/config.t
- Prereq: 3.0
- *** agent/test/basic/config.t.old Mon Apr 25 17:26:52 1994
- --- agent/test/basic/config.t Mon Apr 25 17:26:52 1994
- ***************
- *** 1,6 ****
- # This MUST be the first test ever run
-
- ! # $Id: config.t,v 3.0 1993/11/29 13:49:23 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- --- 1,6 ----
- # This MUST be the first test ever run
-
- ! # $Id: config.t,v 3.0.1.1 1994/04/25 15:24:33 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- ***************
- *** 11,16 ****
- --- 11,19 ----
- # of the source tree for mailagent 3.0.
- #
- # $Log: config.t,v $
- + # Revision 3.0.1.1 1994/04/25 15:24:33 ram
- + # patch7: added commented 'fromesc' new variable
- + #
- # Revision 3.0 1993/11/29 13:49:23 ram
- # Baseline for mailagent 3.0 netwide release.
- #
- ***************
- *** 49,54 ****
- --- 52,58 ----
- rulecache: ~/.cache
- maildrop : $pwd # Do not LEAVE messages in /usr/spool/mail
- mailbox : \$user # Use config variable, not current perl $user
- + #fromesc : ON # Backward compatibility -- should be ON when absent
- hash : dbr
- cleanlaps: 1M
- autoclean: OFF
-
- Index: misc/unkit/unkit.pl
- Prereq: 3.0
- *** misc/unkit/unkit.pl.old Mon Apr 25 17:26:55 1994
- --- misc/unkit/unkit.pl Mon Apr 25 17:26:56 1994
- ***************
- *** 1,4 ****
- ! # $Id: unkit.pl,v 3.0 1993/11/29 13:50:34 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- --- 1,4 ----
- ! # $Id: unkit.pl,v 3.0.1.1 1994/04/25 15:26:37 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- ***************
- *** 9,14 ****
- --- 9,17 ----
- # of the source tree for mailagent 3.0.
- #
- # $Log: unkit.pl,v $
- + # Revision 3.0.1.1 1994/04/25 15:26:37 ram
- + # patch7: make sure unkit directory is not hidden by leading dot
- + #
- # Revision 3.0 1993/11/29 13:50:34 ram
- # Baseline for mailagent 3.0 netwide release.
- #
- ***************
- *** 93,98 ****
- --- 96,102 ----
- $name =~ s/\s+/./g; # Escape all other spaces
- $name =~ s|/$||g; # Remove trailing /
- $name =~ s|/|_|g; # And transform all others into _
- + $name =~ s/^\.+//; # Avoid hidden directories
- $name = substr($name, 0, 14) if length($name) > 14;
-
- $kitdir .= "/$name"; # Directory where unkit will proceed
-
- Index: agent/test/actions
- Prereq: 3.0.1.3
- *** agent/test/actions.old Mon Apr 25 17:26:51 1994
- --- agent/test/actions Mon Apr 25 17:26:51 1994
- ***************
- *** 2,8 ****
- # Mailagent rules for action regression tests
- #
-
- ! # $Id: actions,v 3.0.1.3 1994/01/26 09:35:08 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- --- 2,8 ----
- # Mailagent rules for action regression tests
- #
-
- ! # $Id: actions,v 3.0.1.4 1994/04/25 15:24:12 ram Exp $
- #
- # Copyright (c) 1990-1993, Raphael Manfredi
- #
- ***************
- *** 13,18 ****
- --- 13,21 ----
- # of the source tree for mailagent 3.0.
- #
- # $Log: actions,v $
- + # Revision 3.0.1.4 1994/04/25 15:24:12 ram
- + # patch7: check bug reported by Andy Seaborne <afs@hplb.hpl.hp.com>
- + #
- # Revision 3.0.1.3 1994/01/26 09:35:08 ram
- # patch5: added new tests for UNIQUE and RECORD tags
- # patch5: ensure header-added recipients looked for in messages
- ***************
- *** 148,153 ****
- --- 151,157 ----
- X-Tag: /pass/
- {
- PASS grep -v and;
- + PASS perl -p -e 's/^\>From /From /';
- SAVE output;
- }
-
-
- Index: Credits
- *** Credits.old Mon Apr 25 17:26:39 1994
- --- Credits Mon Apr 25 17:26:39 1994
- ***************
- *** 139,145 ****
- rsmith@proteus.arc.nasa.gov
- s090@brems.ii.uib.no
- sondeen@ISI.EDU
- - wschmidt@iao.fhg.de
-
- If I forgot your name, please let me know, and accept my apologies -- not
- necessarily in that order ;-).
- --- 139,144 ----
-
- *** End of Patch 7 ***
-
- exit 0 # Just in case...
-