home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume43 / mailagent / patch10 < prev    next >
Internet Message Format  |  1994-07-24  |  46KB

  1. From: Raphael Manfredi <ram@acri.fr>
  2. Newsgroups: comp.sources.misc
  3. Subject: v43i127:  mailagent - Flexible mail filtering and processing package, v3.0, Patch10
  4. Date: 24 Jul 1994 19:41:26 -0500
  5. Organization: Advanced Computer Research Institute, Lyon, France
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <30v1nm$i4p@sparky.sterling.com>
  9. X-Md4-Signature: 8d110af6ec215184b4f7f975884744f1
  10.  
  11. Submitted-by: Raphael Manfredi <ram@acri.fr>
  12. Posting-number: Volume 43, Issue 127
  13. Archive-name: mailagent/patch10
  14. Environment: UNIX, Perl
  15. Patch-To: mailagent: Volume 41, Issue 1-26
  16.  
  17. [The latest patch for mailagent version 3.0 is #11.]
  18.  
  19. System: mailagent version 3.0
  20. Patch #: 10
  21. Priority: LOW
  22. Subject: patch #8, continued
  23. Date: Fri Jul 01 17:27:46 MET DST 1994
  24. From: Raphael Manfredi <ram@acri.fr>
  25.  
  26. Description:
  27.     See patch #8.
  28.  
  29.  
  30. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your mailagent source
  31.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  32.     If you don't have the patch program, apply the following by hand,
  33.     or get patch (version 2.0, latest patchlevel).
  34.  
  35.     After patching:
  36.         *** DO NOTHING--INSTALL ALL PATCHES UP THROUGH #11 FIRST ***
  37.  
  38.     If patch indicates that patchlevel is the wrong version, you may need
  39.     to apply one or more previous patches, or the patch may already
  40.     have been applied.  See the patchlevel.h file to find out what has or
  41.     has not been applied.  In any event, don't continue with the patch.
  42.  
  43.     If you are missing previous patches they can be obtained from me:
  44.  
  45.         Raphael Manfredi <ram@acri.fr>
  46.  
  47.     If you send a mail message of the following form it will greatly speed
  48.     processing:
  49.  
  50.         Subject: Command
  51.         @SH mailpatch PATH mailagent 3.0 LIST
  52.                ^ note the c
  53.  
  54.     where PATH is a return path FROM ME TO YOU either in Internet notation,
  55.     or in bang notation from some well-known host, and LIST is the number
  56.     of one or more patches you need, separated by spaces, commas, and/or
  57.     hyphens.  Saying 35- says everything from 35 to the end.
  58.  
  59.     To get some more detailed instructions, send me the following mail:
  60.  
  61.         Subject: Command
  62.         @SH mailhelp PATH
  63.  
  64.  
  65. Index: patchlevel.h
  66. Prereq: 9
  67. 4c4
  68. < #define PATCHLEVEL 9
  69. ---
  70. > #define PATCHLEVEL 10
  71.  
  72. Index: agent/files/mailagent.cf
  73. Prereq: 3.0.1.1
  74. *** agent/files/mailagent.cf.old    Fri Jul  1 17:16:02 1994
  75. --- agent/files/mailagent.cf    Fri Jul  1 17:16:02 1994
  76. ***************
  77. *** 2,8 ****
  78.   # Configuration file for mailagent
  79.   #
  80.   
  81. ! # $Id: mailagent.cf,v 3.0.1.1 1994/04/25 15:11:03 ram Exp $
  82.   #
  83.   #  Copyright (c) 1990-1993, Raphael Manfredi
  84.   #  
  85. --- 2,8 ----
  86.   # Configuration file for mailagent
  87.   #
  88.   
  89. ! # $Id: mailagent.cf,v 3.0.1.2 1994/07/01 14:51:36 ram Exp $
  90.   #
  91.   #  Copyright (c) 1990-1993, Raphael Manfredi
  92.   #  
  93. ***************
  94. *** 13,18 ****
  95. --- 13,21 ----
  96.   #  of the source tree for mailagent 3.0.
  97.   #
  98.   # $Log: mailagent.cf,v $
  99. + # Revision 3.0.1.2  1994/07/01  14:51:36  ram
  100. + # patch8: eleven new config variables for better tuning
  101. + #
  102.   # Revision 3.0.1.1  1994/04/25  15:11:03  ram
  103.   # patch7: added new 'fromesc' config variable for From line escapes
  104.   #
  105. ***************
  106. *** 61,66 ****
  107. --- 64,70 ----
  108.   #
  109.   
  110.   # Define main configuration parameters
  111. + umask    : 077                    # Default umask
  112.   spool    : ~/var/mailagent        # Spool directory
  113.   queue    : $spool/queue            # Queue directory (must exist)
  114.   logdir   : ~/var/log            # Where logfile is stored
  115. ***************
  116. *** 80,94 ****
  117. --- 84,112 ----
  118.   mmdf     : OFF                    # Allow MMDF-style mailbox delivery
  119.   mmdfbox  : OFF                    # Force new folders to MMDF format
  120.   fromesc  : ON                    # Escape leading From into >From
  121. + fromall  : OFF                    # Escape all From, even within paragraph
  122.   
  123.   # MH-style folders
  124.   mhprofile: ~/.mh_profile        # Name of the MH profile file (optional)
  125.   msgprefix: .msg_prefix            # File containing message name prefix
  126.   
  127. + # Locking parameters
  128. + lockmax  : 20                    # Maximum number of locking attempts
  129. + lockdelay: 2                    # Amount of seconds between two lock attempts
  130. + lockhold : 3600                    # Amount of seconds before breaking lock
  131. + # Timeout parameters
  132. + queuewait: 60                    # Delay for filter before calling mailagent
  133. + queuehold: 1800                    # Amount of seconds queued mail remains skipped
  134. + queuelost: 86400                # Timeout before flagging old queued mail
  135. + runmax   : 3600                    # Timeout for RUN command and friends
  136.   # Optional parameters (for experts...)
  137.   #compress : ~/.compress            # Folder compression list
  138.   #newcmd   : $spool/newcmd        # Definition of new filtering commands
  139.   #perlib   : pl                    # Extended perl library search path
  140. + #tome     : also-me                # Alternate logins for me
  141. + #rulemac  : ON                    # Macro substitution in rule patterns
  142.   
  143.   # Database hashing directory (in $spool) and other controls
  144.   hash     : dbr                    # Hashing directory
  145.  
  146. Index: agent/pl/listqueue.pl
  147. Prereq: 3.0
  148. *** agent/pl/listqueue.pl.old    Fri Jul  1 17:16:19 1994
  149. --- agent/pl/listqueue.pl    Fri Jul  1 17:16:19 1994
  150. ***************
  151. *** 1,4 ****
  152. ! ;# $Id: listqueue.pl,v 3.0 1993/11/29 13:48:56 ram Exp $
  153.   ;#
  154.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  155.   ;#  
  156. --- 1,4 ----
  157. ! ;# $Id: listqueue.pl,v 3.0.1.1 1994/07/01 15:01:45 ram Exp $
  158.   ;#
  159.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  160.   ;#  
  161. ***************
  162. *** 9,14 ****
  163. --- 9,17 ----
  164.   ;#  of the source tree for mailagent 3.0.
  165.   ;#
  166.   ;# $Log: listqueue.pl,v $
  167. + ;# Revision 3.0.1.1  1994/07/01  15:01:45  ram
  168. + ;# patch8: now honours new queuehold and queuelost config variables
  169. + ;#
  170.   ;# Revision 3.0  1993/11/29  13:48:56  ram
  171.   ;# Baseline for mailagent 3.0 netwide release.
  172.   ;#
  173. ***************
  174. *** 112,121 ****
  175.           # is an emergency saving done by the filter.
  176.           $file =~ s/^mbox\.// && ($status = 'Backup');
  177.           $file =~ s/^$cf'user\.// && ($status = 'Backup');
  178. !         if ($file =~ /^qm/ && (time - $mtime) < 1800) {
  179.               # Queue mails starting with 'qm' have been queued by the filter
  180.               # program. To avoid race conditions, those mails are skipped for
  181. !             # half an hour (cf to pqueue subroutine).
  182.               $status = 'Skipped' unless $status;        # Filter queued mail
  183.           } else {
  184.               # Processing of mail allowed (mailagent -q would flush it)
  185. --- 115,124 ----
  186.           # is an emergency saving done by the filter.
  187.           $file =~ s/^mbox\.// && ($status = 'Backup');
  188.           $file =~ s/^$cf'user\.// && ($status = 'Backup');
  189. !         if ($file =~ /^qm/ && (time - $mtime) < $cf'queuehold) {
  190.               # Queue mails starting with 'qm' have been queued by the filter
  191.               # program. To avoid race conditions, those mails are skipped for
  192. !             # some time (cf to pqueue subroutine).
  193.               $status = 'Skipped' unless $status;        # Filter queued mail
  194.           } else {
  195.               # Processing of mail allowed (mailagent -q would flush it)
  196. ***************
  197. *** 127,133 ****
  198.           $queued = 'Now' if (time - $mtime) < 60;
  199.           $star = '';
  200.           $star = '*' if $directory ne $cf'queue;    # Spot out-of-queue mails
  201. !         if ((time - $mtime) > 86400) {            # Also spot old mails
  202.               $star = '#';
  203.               $star = '@' if $directory ne $cf'queue;
  204.           }
  205. --- 130,136 ----
  206.           $queued = 'Now' if (time - $mtime) < 60;
  207.           $star = '';
  208.           $star = '*' if $directory ne $cf'queue;    # Spot out-of-queue mails
  209. !         if ((time - $mtime) > $cf'queuelost) {    # Also spot old mails
  210.               $star = '#';
  211.               $star = '@' if $directory ne $cf'queue;
  212.           }
  213.  
  214. Index: agent/test/pl/cmd.pl
  215. Prereq: 3.0
  216. *** agent/test/pl/cmd.pl.old    Fri Jul  1 17:16:29 1994
  217. --- agent/test/pl/cmd.pl    Fri Jul  1 17:16:29 1994
  218. ***************
  219. *** 1,37 ****
  220.   # Common actions at the top of each command test
  221.   
  222. ! # $Id: cmd.pl,v 3.0 1993/11/29 13:50:22 ram Exp $
  223. ! #
  224. ! #  Copyright (c) 1990-1993, Raphael Manfredi
  225. ! #  
  226. ! #  You may redistribute only under the terms of the Artistic License,
  227. ! #  as specified in the README file that comes with the distribution.
  228. ! #  You may reuse parts of this distribution only within the terms of
  229. ! #  that same Artistic License; a copy of which may be found at the root
  230. ! #  of the source tree for mailagent 3.0.
  231. ! #
  232. ! # $Log: cmd.pl,v $
  233.   ;# Revision 3.0  1993/11/29  13:50:22  ram
  234.   ;# Baseline for mailagent 3.0 netwide release.
  235.   ;#
  236.   
  237. ! do '../pl//init.pl';
  238.   chdir '../out';
  239.   do '../pl/mail.pl';
  240. ! &cp_mail;
  241.   $user = $ENV{'USER'};
  242.   unlink "$user", 'agentlog', 'send.mail', 'send.news';
  243.   $cmd = "$mailagent -L $ENV{'LEVEL'} -r ../actions mail 2>/dev/null";
  244.   
  245.   # We might need this
  246.   do '../pl/logfile.pl';
  247. - sub cp_mail {
  248. -     local($_);
  249. -     open(MAIL, '../mail');
  250. -     open(HERE, '>mail');
  251. -     print HERE while <MAIL>;
  252. -     close MAIL;
  253. -     close HERE;
  254. - }
  255.   
  256. --- 1,31 ----
  257.   # Common actions at the top of each command test
  258.   
  259. ! ;# $Id: cmd.pl,v 3.0.1.1 1994/07/01 15:09:44 ram Exp $
  260. ! ;#
  261. ! ;#  Copyright (c) 1990-1993, Raphael Manfredi
  262. ! ;#  
  263. ! ;#  You may redistribute only under the terms of the Artistic License,
  264. ! ;#  as specified in the README file that comes with the distribution.
  265. ! ;#  You may reuse parts of this distribution only within the terms of
  266. ! ;#  that same Artistic License; a copy of which may be found at the root
  267. ! ;#  of the source tree for mailagent 3.0.
  268. ! ;#
  269. ! ;# $Log: cmd.pl,v $
  270. ! ;# Revision 3.0.1.1  1994/07/01  15:09:44  ram
  271. ! ;# patch8: the cp_mail routine is now located in mail.pl
  272. ! ;#
  273.   ;# Revision 3.0  1993/11/29  13:50:22  ram
  274.   ;# Baseline for mailagent 3.0 netwide release.
  275.   ;#
  276.   
  277. ! do '../pl/init.pl';
  278.   chdir '../out';
  279.   do '../pl/mail.pl';
  280. ! &cp_mail;                # From mail.pl
  281.   $user = $ENV{'USER'};
  282.   unlink "$user", 'agentlog', 'send.mail', 'send.news';
  283.   $cmd = "$mailagent -L $ENV{'LEVEL'} -r ../actions mail 2>/dev/null";
  284.   
  285.   # We might need this
  286.   do '../pl/logfile.pl';
  287.   
  288.  
  289. Index: agent/test/cmd/perl.t
  290. Prereq: 3.0
  291. *** agent/test/cmd/perl.t.old    Fri Jul  1 17:16:26 1994
  292. --- agent/test/cmd/perl.t    Fri Jul  1 17:16:27 1994
  293. ***************
  294. *** 1,6 ****
  295.   # Test PERL command
  296.   
  297. ! # $Id: perl.t,v 3.0 1993/11/29 13:49:38 ram Exp $
  298.   #
  299.   #  Copyright (c) 1990-1993, Raphael Manfredi
  300.   #  
  301. --- 1,6 ----
  302.   # Test PERL command
  303.   
  304. ! # $Id: perl.t,v 3.0.1.1 1994/07/01 15:08:05 ram Exp $
  305.   #
  306.   #  Copyright (c) 1990-1993, Raphael Manfredi
  307.   #  
  308. ***************
  309. *** 11,22 ****
  310.   #  of the source tree for mailagent 3.0.
  311.   #
  312.   # $Log: perl.t,v $
  313.   # Revision 3.0  1993/11/29  13:49:38  ram
  314.   # Baseline for mailagent 3.0 netwide release.
  315.   #
  316.   
  317.   do '../pl/cmd.pl';
  318. ! unlink 'perl.1', 'perl.2', 'never', 'always';
  319.   
  320.   open(PERL, ">perl.1") || print "1\n";
  321.   print PERL <<'EOP';
  322. --- 11,25 ----
  323.   #  of the source tree for mailagent 3.0.
  324.   #
  325.   # $Log: perl.t,v $
  326. + # Revision 3.0.1.1  1994/07/01  15:08:05  ram
  327. + # patch8: added test for correct exit status propagation
  328. + #
  329.   # Revision 3.0  1993/11/29  13:49:38  ram
  330.   # Baseline for mailagent 3.0 netwide release.
  331.   #
  332.   
  333.   do '../pl/cmd.pl';
  334. ! unlink 'perl.1', 'perl.2', 'never', 'always', 'exit_ok';
  335.   
  336.   open(PERL, ">perl.1") || print "1\n";
  337.   print PERL <<'EOP';
  338. ***************
  339. *** 29,35 ****
  340.   open(PERL, ">perl.2") || print "2\n";
  341.   print PERL <<'EOP';
  342.   unlink 'always' if -d '../out';
  343. ! &exit(0) if $ARGV[1] != 'arg 1' || $ARGV[2] != 'arg 2';
  344.   &perl('perl.1');        # Recursion
  345.   &save('never');
  346.   EOP
  347. --- 32,38 ----
  348.   open(PERL, ">perl.2") || print "2\n";
  349.   print PERL <<'EOP';
  350.   unlink 'always' if -d '../out';
  351. ! &exit(1) if $ARGV[1] ne 'arg 1' || $ARGV[2] ne 'arg 2';
  352.   &perl('perl.1');        # Recursion
  353.   &save('never');
  354.   EOP
  355. ***************
  356. *** 42,47 ****
  357.   -f 'never' && print "5\n";
  358.   &get_log(6, 'always');
  359.   &check_log('^To: ram', 7) == 2 || print "8\n";
  360.   
  361. ! unlink 'mail', 'perl.1', 'perl.2', 'never', 'always';
  362.   print "0\n";
  363. --- 45,51 ----
  364.   -f 'never' && print "5\n";
  365.   &get_log(6, 'always');
  366.   &check_log('^To: ram', 7) == 2 || print "8\n";
  367. + -f 'exit_ok' || print "9\n";
  368.   
  369. ! unlink 'mail', 'perl.1', 'perl.2', 'never', 'always', 'exit_ok';
  370.   print "0\n";
  371.  
  372. Index: agent/test/cmd/umask.t
  373. *** agent/test/cmd/umask.t.old    Fri Jul  1 17:16:27 1994
  374. --- agent/test/cmd/umask.t    Fri Jul  1 17:16:27 1994
  375. ***************
  376. *** 0 ****
  377. --- 1,64 ----
  378. + # Test UMASK command
  379. + # $Id: umask.t,v 3.0.1.1 1994/07/01 15:08:10 ram Exp $
  380. + #
  381. + #  Copyright (c) 1990-1993, Raphael Manfredi
  382. + #  
  383. + #  You may redistribute only under the terms of the Artistic License,
  384. + #  as specified in the README file that comes with the distribution.
  385. + #  You may reuse parts of this distribution only within the terms of
  386. + #  that same Artistic License; a copy of which may be found at the root
  387. + #  of the source tree for mailagent 3.0.
  388. + #
  389. + # $Log: umask.t,v $
  390. + # Revision 3.0.1.1  1994/07/01  15:08:10  ram
  391. + # patch8: created
  392. + #
  393. + do '../pl/misc.pl';        # Uses &add_option
  394. + sub cleanup {
  395. +     unlink $user, 'ok.1', 'ok.2', 'ok.3', 'never';
  396. + }
  397. + open(PERL, ">umask_is") || print "1\n";
  398. + print PERL <<'EOP';
  399. + $mode = $ARGV[1];
  400. + $mode = oct($mode) if $mode =~ /^0/;
  401. + $umask = umask;
  402. + &exit($mode == $umask ? 0 : 1);
  403. + EOP
  404. + close PERL;
  405. + &add_header('X-Tag: umask #1');
  406. + `$cmd`;
  407. + $? == 0 || print "2\n";
  408. + -f $user && print "3\n";
  409. + -f 'never' && print "4\n";
  410. + -f 'ok.1' || print "5\n";
  411. + -f 'ok.2' || print "6\n";
  412. + &cleanup;
  413. + &replace_header('X-Tag: umask #3');
  414. + system '(cat mail; echo " "; cat mail) > mail2 && mv mail2 mail';
  415. + print "7\n" if $?;
  416. + $cmd =~ s/\bmail\b/-f mail/;
  417. + &add_option("-o 'umask: 027'");
  418. + &replace_header('X-Tag: umask #2');
  419. + # At this point, we're going to process two messages in mail. The first
  420. + # one is tagged 'umask #2' and the second is tagged 'umask #3'. We wish
  421. + # to make sure that mailagent restores the default umask before processing
  422. + # a new message.
  423. + `$cmd`;
  424. + $? == 0 || print "8\n";
  425. + -f $user && print "9\n";
  426. + -f 'never' && print "10\n";
  427. + -f 'ok.1' || print "11\n";
  428. + -f 'ok.2' || print "12\n";
  429. + -f 'ok.3' || print "13\n";
  430. + &cleanup;
  431. + unlink 'umask_is';
  432. + print "0\n";
  433.  
  434. Index: agent/pl/makedir.pl
  435. Prereq: 3.0
  436. *** agent/pl/makedir.pl.old    Fri Jul  1 17:16:19 1994
  437. --- agent/pl/makedir.pl    Fri Jul  1 17:16:19 1994
  438. ***************
  439. *** 1,4 ****
  440. ! ;# $Id: makedir.pl,v 3.0 1993/11/29 13:48:59 ram Exp $
  441.   ;#
  442.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  443.   ;#  
  444. --- 1,4 ----
  445. ! ;# $Id: makedir.pl,v 3.0.1.1 1994/07/01 15:02:07 ram Exp $
  446.   ;#
  447.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  448.   ;#  
  449. ***************
  450. *** 9,26 ****
  451.   ;#  of the source tree for mailagent 3.0.
  452.   ;#
  453.   ;# $Log: makedir.pl,v $
  454.   ;# Revision 3.0  1993/11/29  13:48:59  ram
  455.   ;# Baseline for mailagent 3.0 netwide release.
  456.   ;#
  457.   ;# 
  458.   # Make directories for files
  459. ! # E.g, for /usr/lib/perl/foo, it will check for all the
  460. ! # directories /usr, /usr/lib, /usr/lib/perl and make
  461. ! # them if they do not exist.
  462.   sub makedir {
  463.       local($dir, $mode) = @_;    # directory name, mode (optional)
  464.       local($parent);
  465. !     $mode = 0700 unless defined $mode;
  466.       if (!-d $dir && $dir ne '') {
  467.           # Make parent dir first
  468.           &makedir($parent, $mode) if ($parent = $dir) =~ s|(.*)/.*|\1|;
  469. --- 9,30 ----
  470.   ;#  of the source tree for mailagent 3.0.
  471.   ;#
  472.   ;# $Log: makedir.pl,v $
  473. + ;# Revision 3.0.1.1  1994/07/01  15:02:07  ram
  474. + ;# patch8: default mode is now 0777, relies on umask for proper setting
  475. + ;#
  476.   ;# Revision 3.0  1993/11/29  13:48:59  ram
  477.   ;# Baseline for mailagent 3.0 netwide release.
  478.   ;#
  479.   ;# 
  480.   # Make directories for files
  481. ! # E.g, for /usr/lib/perl/foo, it will check for all the directories /usr,
  482. ! # /usr/lib, /usr/lib/perl and make them if they do not exist.
  483. ! # Note: default mode is now 0777 since we have an umask config parameter.
  484.   sub makedir {
  485.       local($dir, $mode) = @_;    # directory name, mode (optional)
  486.       local($parent);
  487. !     $mode = 0777 unless defined $mode;
  488. !     $dir =~ s|/$||;                # no trailing / or we'll try to make dir twice
  489.       if (!-d $dir && $dir ne '') {
  490.           # Make parent dir first
  491.           &makedir($parent, $mode) if ($parent = $dir) =~ s|(.*)/.*|\1|;
  492.  
  493. Index: agent/pl/runcmd.pl
  494. Prereq: 3.0
  495. *** agent/pl/runcmd.pl.old    Fri Jul  1 17:16:23 1994
  496. --- agent/pl/runcmd.pl    Fri Jul  1 17:16:23 1994
  497. ***************
  498. *** 1,4 ****
  499. ! ;# $Id: runcmd.pl,v 3.0 1993/11/29 13:49:15 ram Exp $
  500.   ;#
  501.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  502.   ;#  
  503. --- 1,4 ----
  504. ! ;# $Id: runcmd.pl,v 3.0.1.1 1994/07/01 15:04:58 ram Exp $
  505.   ;#
  506.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  507.   ;#  
  508. ***************
  509. *** 9,14 ****
  510. --- 9,17 ----
  511.   ;#  of the source tree for mailagent 3.0.
  512.   ;#
  513.   ;# $Log: runcmd.pl,v $
  514. + ;# Revision 3.0.1.1  1994/07/01  15:04:58  ram
  515. + ;# patch8: new UMASK command
  516. + ;#
  517.   ;# Revision 3.0  1993/11/29  13:49:15  ram
  518.   ;# Baseline for mailagent 3.0 netwide release.
  519.   ;#
  520. ***************
  521. *** 57,62 ****
  522. --- 60,66 ----
  523.   ;#  STRIP header(s)          Removes the lines from the message's header
  524.   ;#  SUBST var //             Apply a substitution on variable
  525.   ;#  TR var //                Apply a translation on variable
  526. + ;#  UMASK value              Set a new umask for the process
  527.   ;#  UNIQUE                   Delete message if already in history and REJECT
  528.   ;#  VACATION on/off          Allow/disallow vacation messages
  529.   ;#  WRITE folder             Writes mail in folder (replaces, does not append)
  530. ***************
  531. *** 199,204 ****
  532. --- 203,209 ----
  533.           'STRIP', 'run_strip',        # Strip some header lines
  534.           'SUBST', 'run_subst',        # Substitution on variable
  535.           'TR', 'run_tr',                # Translation on variable
  536. +         'UMASK', 'run_umask',        # Set new umask
  537.           'UNIQUE', 'run_unique',        # Delete message if already in history
  538.           'VACATION', 'run_vacation',    # Allow or forbid vacation messages
  539.           'WRITE', 'run_write',        # Write mail in folder
  540. ***************
  541. *** 231,236 ****
  542. --- 236,242 ----
  543.           'RESTART', 1,
  544.           'RESYNC', 1,
  545.           'STRIP', 1,
  546. +         'UMASK', 1,
  547.           'VACATION', 1,
  548.       );
  549.   }
  550.  
  551. Index: agent/pl/parse.pl
  552. Prereq: 3.0.1.1
  553. *** agent/pl/parse.pl.old    Fri Jul  1 17:16:21 1994
  554. --- agent/pl/parse.pl    Fri Jul  1 17:16:21 1994
  555. ***************
  556. *** 1,4 ****
  557. ! ;# $Id: parse.pl,v 3.0.1.1 1994/04/25 15:18:14 ram Exp $
  558.   ;#
  559.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  560.   ;#  
  561. --- 1,4 ----
  562. ! ;# $Id: parse.pl,v 3.0.1.2 1994/07/01 15:04:02 ram Exp $
  563.   ;#
  564.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  565.   ;#  
  566. ***************
  567. *** 9,14 ****
  568. --- 9,17 ----
  569.   ;#  of the source tree for mailagent 3.0.
  570.   ;#
  571.   ;# $Log: parse.pl,v $
  572. + ;# Revision 3.0.1.2  1994/07/01  15:04:02  ram
  573. + ;# patch8: now systematically escape leading From if fromall is ON
  574. + ;#
  575.   ;# Revision 3.0.1.1  1994/04/25  15:18:14  ram
  576.   ;# patch7: global fix for From line escapes to make them configurable
  577.   ;#
  578. ***************
  579. *** 93,100 ****
  580.               $lines++;                                # One more line in body
  581.               $length += length($_);                    # Update length of message
  582.               # Protect potentially dangerous lines when asked to do so
  583.               s/^From(\s)/>From$1/ if $last_was_nl && $cf'fromesc =~ /on/i;
  584. !             $last_was_nl = /^$/;                    # Keep track of single '\n'
  585.               $Header{'Body'} .= $_;
  586.               chop;
  587.               # Deal with builtin commands
  588. --- 96,106 ----
  589.               $lines++;                                # One more line in body
  590.               $length += length($_);                    # Update length of message
  591.               # Protect potentially dangerous lines when asked to do so
  592. +             # From could normally be mis-interpreted only after a blank line,
  593. +             # but some "broken" User Agents also look for them everywhere...
  594. +             # That's where fromall must be set to ON to escape all of them.
  595.               s/^From(\s)/>From$1/ if $last_was_nl && $cf'fromesc =~ /on/i;
  596. !             $last_was_nl = /^$/ || $cf'fromall =~ /on/i;
  597.               $Header{'Body'} .= $_;
  598.               chop;
  599.               # Deal with builtin commands
  600.  
  601. Index: agent/pl/checklock.pl
  602. Prereq: 3.0
  603. *** agent/pl/checklock.pl.old    Fri Jul  1 17:16:16 1994
  604. --- agent/pl/checklock.pl    Fri Jul  1 17:16:16 1994
  605. ***************
  606. *** 1,4 ****
  607. ! ;# $Id: checklock.pl,v 3.0 1993/11/29 13:48:36 ram Exp $
  608.   ;#
  609.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  610.   ;#  
  611. --- 1,4 ----
  612. ! ;# $Id: checklock.pl,v 3.0.1.1 1994/07/01 15:00:20 ram Exp $
  613.   ;#
  614.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  615.   ;#  
  616. ***************
  617. *** 9,14 ****
  618. --- 9,17 ----
  619.   ;#  of the source tree for mailagent 3.0.
  620.   ;#
  621.   ;# $Log: checklock.pl,v $
  622. + ;# Revision 3.0.1.1  1994/07/01  15:00:20  ram
  623. + ;# patch8: now honours new lockhold config variable for lock breaking
  624. + ;#
  625.   ;# Revision 3.0  1993/11/29  13:48:36  ram
  626.   ;# Baseline for mailagent 3.0 netwide release.
  627.   ;#
  628. ***************
  629. *** 23,33 ****
  630.           # There is a lock file -- look for how long it's been there
  631.           ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
  632.               $atime,$mtime,$ctime,$blksize,$blocks) = stat($lockfile);
  633. !         if ((time - $mtime) > 3600) {
  634. !             # More than one hour !! Something must have gone wrong
  635.               unlink $lockfile;
  636.               $file =~ s|.*/(.*)|$1|;    # Keep only basename
  637. !             &add_log("UNLOCKED $file (lock older than one hour)")
  638.                   if $loglvl > 5;
  639.           }
  640.       }
  641. --- 26,36 ----
  642.           # There is a lock file -- look for how long it's been there
  643.           ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
  644.               $atime,$mtime,$ctime,$blksize,$blocks) = stat($lockfile);
  645. !         if ((time - $mtime) > $cf'lockhold) {
  646. !             # More than outdating time!! Something must have gone wrong
  647.               unlink $lockfile;
  648.               $file =~ s|.*/(.*)|$1|;    # Keep only basename
  649. !             &add_log("UNLOCKED $file (lock older than $cf'lockhold seconds)")
  650.                   if $loglvl > 5;
  651.           }
  652.       }
  653.  
  654. Index: agent/test/pl/init.pl
  655. Prereq: 3.0
  656. *** agent/test/pl/init.pl.old    Fri Jul  1 17:16:30 1994
  657. --- agent/test/pl/init.pl    Fri Jul  1 17:16:30 1994
  658. ***************
  659. *** 1,16 ****
  660.   # Set up mailagent and filter paths
  661.   
  662. ! # $Id: init.pl,v 3.0 1993/11/29 13:50:24 ram Exp $
  663. ! #
  664. ! #  Copyright (c) 1990-1993, Raphael Manfredi
  665. ! #  
  666. ! #  You may redistribute only under the terms of the Artistic License,
  667. ! #  as specified in the README file that comes with the distribution.
  668. ! #  You may reuse parts of this distribution only within the terms of
  669. ! #  that same Artistic License; a copy of which may be found at the root
  670. ! #  of the source tree for mailagent 3.0.
  671. ! #
  672. ! # $Log: init.pl,v $
  673.   ;# Revision 3.0  1993/11/29  13:50:24  ram
  674.   ;# Baseline for mailagent 3.0 netwide release.
  675.   ;#
  676. --- 1,19 ----
  677.   # Set up mailagent and filter paths
  678.   
  679. ! ;# $Id: init.pl,v 3.0.1.1 1994/07/01 15:10:38 ram Exp $
  680. ! ;#
  681. ! ;#  Copyright (c) 1990-1993, Raphael Manfredi
  682. ! ;#  
  683. ! ;#  You may redistribute only under the terms of the Artistic License,
  684. ! ;#  as specified in the README file that comes with the distribution.
  685. ! ;#  You may reuse parts of this distribution only within the terms of
  686. ! ;#  that same Artistic License; a copy of which may be found at the root
  687. ! ;#  of the source tree for mailagent 3.0.
  688. ! ;#
  689. ! ;# $Log: init.pl,v $
  690. ! ;# Revision 3.0.1.1  1994/07/01  15:10:38  ram
  691. ! ;# patch8: fixed RCS leading comment string
  692. ! ;#
  693.   ;# Revision 3.0  1993/11/29  13:50:24  ram
  694.   ;# Baseline for mailagent 3.0 netwide release.
  695.   ;#
  696. ***************
  697. *** 24,26 ****
  698. --- 27,30 ----
  699.   
  700.   # Make sure no lock were left by previous test
  701.   unlink "$pwd/out/filter.lock", "$pwd/out/perl.lock";
  702.  
  703. Index: agent/pl/matching.pl
  704. Prereq: 3.0.1.1
  705. *** agent/pl/matching.pl.old    Fri Jul  1 17:16:20 1994
  706. --- agent/pl/matching.pl    Fri Jul  1 17:16:20 1994
  707. ***************
  708. *** 1,4 ****
  709. ! ;# $Id: matching.pl,v 3.0.1.1 1994/04/25 15:17:49 ram Exp $
  710.   ;#
  711.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  712.   ;#  
  713. --- 1,4 ----
  714. ! ;# $Id: matching.pl,v 3.0.1.2 1994/07/01 15:02:33 ram Exp $
  715.   ;#
  716.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  717.   ;#  
  718. ***************
  719. *** 9,14 ****
  720. --- 9,17 ----
  721.   ;#  of the source tree for mailagent 3.0.
  722.   ;#
  723.   ;# $Log: matching.pl,v $
  724. + ;# Revision 3.0.1.2  1994/07/01  15:02:33  ram
  725. + ;# patch8: allow macro substitution on patterns if rulemac is ON
  726. + ;#
  727.   ;# Revision 3.0.1.1  1994/04/25  15:17:49  ram
  728.   ;# patch7: fixed selector combination logic and added some debug logs
  729.   ;#
  730. ***************
  731. *** 213,218 ****
  732. --- 216,223 ----
  733.   
  734.   # Attempt a match of a pattern against a selector, return boolean status.
  735.   # If pattern is preceded by a '!', the boolean status is negated.
  736. + # If the 'rulemac' configuration variable is set to ON, a macro substitution
  737. + # is performed on the search pattern.
  738.   sub selector_match {
  739.       local($selector) = shift(@_);    # The selector on which pattern applies
  740.       local($pattern) = shift(@_);    # The pattern to apply
  741. ***************
  742. *** 224,229 ****
  743. --- 229,235 ----
  744.       $matcher = $Matcher{$selector};
  745.       $matcher = 'match_var' unless $matcher;
  746.       $pattern =~ s/^!// && ($not = '!');
  747. +     ¯os_subst(*pattern) if $cf'rulemac =~ /on/i;    # Macro substitution
  748.       $matched = &$matcher($selector, $pattern, $range);
  749.       $matched = !$matched if $not;    # Revert matching status if ! pattern
  750.       if ($loglvl > 19) {
  751.  
  752. Index: agent/test/cmd/leave.t
  753. Prereq: 3.0
  754. *** agent/test/cmd/leave.t.old    Fri Jul  1 17:16:25 1994
  755. --- agent/test/cmd/leave.t    Fri Jul  1 17:16:25 1994
  756. ***************
  757. *** 1,6 ****
  758.   # Test LEAVE command
  759.   
  760. ! # $Id: leave.t,v 3.0 1993/11/29 13:49:33 ram Exp $
  761.   #
  762.   #  Copyright (c) 1990-1993, Raphael Manfredi
  763.   #  
  764. --- 1,6 ----
  765.   # Test LEAVE command
  766.   
  767. ! # $Id: leave.t,v 3.0.1.1 1994/07/01 15:07:21 ram Exp $
  768.   #
  769.   #  Copyright (c) 1990-1993, Raphael Manfredi
  770.   #  
  771. ***************
  772. *** 11,21 ****
  773.   #  of the source tree for mailagent 3.0.
  774.   #
  775.   # $Log: leave.t,v $
  776.   # Revision 3.0  1993/11/29  13:49:33  ram
  777.   # Baseline for mailagent 3.0 netwide release.
  778.   #
  779.   
  780. ! do '../pl/cmd.pl';
  781.   
  782.   &add_header('X-Tag: leave');
  783.   `$cmd`;
  784. --- 11,24 ----
  785.   #  of the source tree for mailagent 3.0.
  786.   #
  787.   # $Log: leave.t,v $
  788. + # Revision 3.0.1.1  1994/07/01  15:07:21  ram
  789. + # patch8: added tests for new fromall config option
  790. + #
  791.   # Revision 3.0  1993/11/29  13:49:33  ram
  792.   # Baseline for mailagent 3.0 netwide release.
  793.   #
  794.   
  795. ! do '../pl/misc.pl';        # Need &add_option also
  796.   
  797.   &add_header('X-Tag: leave');
  798.   `$cmd`;
  799. ***************
  800. *** 54,59 ****
  801. --- 57,72 ----
  802.   &get_log(11, $user);
  803.   &check_log('^>From', 12) == 2 || print "13\n";
  804.   &check_log('^From line', 14) == 1 || print "15\n";
  805. + # Make sure all From lines are escaped when fromall is activated.
  806. + &add_option('-o fromall:ON');
  807. + unlink "$user";
  808. + `$cmd`;
  809. + $? == 0 || print "16\n";
  810. + -f "$user" || print "17\n";
  811. + &get_log(18, $user);
  812. + &check_log('^>From', 19) == 3 || print "20\n";
  813. + ¬_log('^From line', 21);
  814.   
  815.   unlink <emerg/*>;
  816.   unlink "$user", 'mail', 'ok';
  817.  
  818. Index: agent/test/pl/logfile.pl
  819. Prereq: 3.0
  820. *** agent/test/pl/logfile.pl.old    Fri Jul  1 17:16:31 1994
  821. --- agent/test/pl/logfile.pl    Fri Jul  1 17:16:31 1994
  822. ***************
  823. *** 1,16 ****
  824.   # Get log file (by default) or any other file into @log
  825.   
  826. ! # $Id: logfile.pl,v 3.0 1993/11/29 13:50:24 ram Exp $
  827. ! #
  828. ! #  Copyright (c) 1990-1993, Raphael Manfredi
  829. ! #  
  830. ! #  You may redistribute only under the terms of the Artistic License,
  831. ! #  as specified in the README file that comes with the distribution.
  832. ! #  You may reuse parts of this distribution only within the terms of
  833. ! #  that same Artistic License; a copy of which may be found at the root
  834. ! #  of the source tree for mailagent 3.0.
  835. ! #
  836. ! # $Log: logfile.pl,v $
  837.   ;# Revision 3.0  1993/11/29  13:50:24  ram
  838.   ;# Baseline for mailagent 3.0 netwide release.
  839.   ;#
  840. --- 1,19 ----
  841.   # Get log file (by default) or any other file into @log
  842.   
  843. ! ;# $Id: logfile.pl,v 3.0.1.1 1994/07/01 15:10:42 ram Exp $
  844. ! ;#
  845. ! ;#  Copyright (c) 1990-1993, Raphael Manfredi
  846. ! ;#  
  847. ! ;#  You may redistribute only under the terms of the Artistic License,
  848. ! ;#  as specified in the README file that comes with the distribution.
  849. ! ;#  You may reuse parts of this distribution only within the terms of
  850. ! ;#  that same Artistic License; a copy of which may be found at the root
  851. ! ;#  of the source tree for mailagent 3.0.
  852. ! ;#
  853. ! ;# $Log: logfile.pl,v $
  854. ! ;# Revision 3.0.1.1  1994/07/01  15:10:42  ram
  855. ! ;# patch8: fixed RCS leading comment string
  856. ! ;#
  857.   ;# Revision 3.0  1993/11/29  13:50:24  ram
  858.   ;# Baseline for mailagent 3.0 netwide release.
  859.   ;#
  860.  
  861. Index: agent/pl/read_conf.pl
  862. Prereq: 3.0.1.1
  863. *** agent/pl/read_conf.pl.old    Fri Jul  1 17:16:22 1994
  864. --- agent/pl/read_conf.pl    Fri Jul  1 17:16:22 1994
  865. ***************
  866. *** 1,4 ****
  867. ! ;# $Id: read_conf.pl,v 3.0.1.1 1994/04/25 15:21:34 ram Exp $
  868.   ;#
  869.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  870.   ;#  
  871. --- 1,4 ----
  872. ! ;# $Id: read_conf.pl,v 3.0.1.2 1994/07/01 15:04:50 ram Exp $
  873.   ;#
  874.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  875.   ;#  
  876. ***************
  877. *** 9,14 ****
  878. --- 9,17 ----
  879.   ;#  of the source tree for mailagent 3.0.
  880.   ;#
  881.   ;# $Log: read_conf.pl,v $
  882. + ;# Revision 3.0.1.2  1994/07/01  15:04:50  ram
  883. + ;# patch8: set proper default values for new optional config variables
  884. + ;#
  885.   ;# Revision 3.0.1.1  1994/04/25  15:21:34  ram
  886.   ;# patch7: made sure new variable 'fromesc' has a meaningful default
  887.   ;#
  888. ***************
  889. *** 110,115 ****
  890. --- 113,128 ----
  891.   
  892.       # Backward compatibility -- RAM, 25/04/94
  893.       $fromesc = 'ON' unless defined $fromesc;    # If absent from ~/.mailagent
  894. +     $lockmax = 20 unless defined $lockmax;
  895. +     $lockdelay = 2 unless defined $lockdelay;
  896. +     $lockhold = 3600 unless defined $lockhold;
  897. +     $queuewait = 60 unless defined $queuewait;
  898. +     $queuehold = 1800 unless defined $queuehold;
  899. +     $queuelost = 86400 unless defined $queuelost;
  900. +     $runmax = 3600 unless defined $runmax;
  901. +     $umask = 077 unless defined $umask;
  902. +     $umask = oct($umask) if $umask =~ /^0/;     # Translate umask into decimal
  903.   
  904.       # Update @INC perlib search path with the perlib variable. Paths not
  905.       # starting by a '/' are supposed to be under the mailagent private lib
  906.  
  907. Index: MANIFEST
  908. *** MANIFEST.old    Fri Jul  1 17:16:34 1994
  909. --- MANIFEST    Fri Jul  1 17:16:34 1994
  910. ***************
  911. *** 148,153 ****
  912. --- 148,154 ----
  913.   agent/pl/sendfile.pl       Perl library to send files in shar / kit mode
  914.   agent/pl/stats.pl          Mailagent's statistics recording and printing
  915.   agent/pl/tilde.pl          Perl library to perform ~name expansion
  916. + agent/pl/umask.pl          Handles UMASK in local mode
  917.   agent/pl/unpack.pl         Perl library to unpack archive files
  918.   agent/pl/usrmac.pl         User-defined macros
  919.   agent/test/                Regression test suite
  920. ***************
  921. *** 200,205 ****
  922. --- 201,207 ----
  923.   agent/test/cmd/strip.t         Test STRIP command
  924.   agent/test/cmd/subst.t         Test SUBST command
  925.   agent/test/cmd/tr.t            Test TR command
  926. + agent/test/cmd/umask.t         Test UMASK command
  927.   agent/test/cmd/unique.t        Test UNIQUE command
  928.   agent/test/cmd/unknown.t       Make sure unknown command defaults correctly
  929.   agent/test/cmd/vacation.t      Test VACATION command
  930. ***************
  931. *** 213,218 ****
  932. --- 215,221 ----
  933.   agent/test/filter/hook.t       Ensure hooks are correctly invoked
  934.   agent/test/filter/list.t       Check matching on lists like To and Newsgroups
  935.   agent/test/filter/loop.t       Check loop detection
  936. + agent/test/filter/macros.t     Check optional macro subsitution in patterns
  937.   agent/test/filter/mode.t       Make sure mode selection logic works
  938.   agent/test/filter/multiple.t   Check multiple selectors
  939.   agent/test/filter/not.t        Negated pattern tests
  940.  
  941. Index: agent/test/pl/misc.pl
  942. Prereq: 3.0
  943. *** agent/test/pl/misc.pl.old    Fri Jul  1 17:16:32 1994
  944. --- agent/test/pl/misc.pl    Fri Jul  1 17:16:32 1994
  945. ***************
  946. *** 1,16 ****
  947.   # Common actions at the top of each misc test
  948.   
  949. ! # $Id: misc.pl,v 3.0 1993/11/29 13:50:26 ram Exp $
  950. ! #
  951. ! #  Copyright (c) 1990-1993, Raphael Manfredi
  952. ! #  
  953. ! #  You may redistribute only under the terms of the Artistic License,
  954. ! #  as specified in the README file that comes with the distribution.
  955. ! #  You may reuse parts of this distribution only within the terms of
  956. ! #  that same Artistic License; a copy of which may be found at the root
  957. ! #  of the source tree for mailagent 3.0.
  958. ! #
  959. ! # $Log: misc.pl,v $
  960.   ;# Revision 3.0  1993/11/29  13:50:26  ram
  961.   ;# Baseline for mailagent 3.0 netwide release.
  962.   ;#
  963. --- 1,19 ----
  964.   # Common actions at the top of each misc test
  965.   
  966. ! ;# $Id: misc.pl,v 3.0.1.1 1994/07/01 15:11:55 ram Exp $
  967. ! ;#
  968. ! ;#  Copyright (c) 1990-1993, Raphael Manfredi
  969. ! ;#  
  970. ! ;#  You may redistribute only under the terms of the Artistic License,
  971. ! ;#  as specified in the README file that comes with the distribution.
  972. ! ;#  You may reuse parts of this distribution only within the terms of
  973. ! ;#  that same Artistic License; a copy of which may be found at the root
  974. ! ;#  of the source tree for mailagent 3.0.
  975. ! ;#
  976. ! ;# $Log: misc.pl,v $
  977. ! ;# Revision 3.0.1.1  1994/07/01  15:11:55  ram
  978. ! ;# patch8: fixed RCS leading comment string
  979. ! ;#
  980.   ;# Revision 3.0  1993/11/29  13:50:26  ram
  981.   ;# Baseline for mailagent 3.0 netwide release.
  982.   ;#
  983.  
  984. Index: agent/pl/acs_rqst.pl
  985. Prereq: 3.0
  986. *** agent/pl/acs_rqst.pl.old    Fri Jul  1 17:16:11 1994
  987. --- agent/pl/acs_rqst.pl    Fri Jul  1 17:16:11 1994
  988. ***************
  989. *** 1,4 ****
  990. ! ;# $Id: acs_rqst.pl,v 3.0 1993/11/29 13:48:32 ram Exp $
  991.   ;#
  992.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  993.   ;#  
  994. --- 1,4 ----
  995. ! ;# $Id: acs_rqst.pl,v 3.0.1.1 1994/07/01 14:56:37 ram Exp $
  996.   ;#
  997.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  998.   ;#  
  999. ***************
  1000. *** 9,14 ****
  1001. --- 9,17 ----
  1002.   ;#  of the source tree for mailagent 3.0.
  1003.   ;#
  1004.   ;# $Log: acs_rqst.pl,v $
  1005. + ;# Revision 3.0.1.1  1994/07/01  14:56:37  ram
  1006. + ;# patch8: now uses lockmax and lockdelay config variables
  1007. + ;#
  1008.   ;# Revision 3.0  1993/11/29  13:48:32  ram
  1009.   ;# Baseline for mailagent 3.0 netwide release.
  1010.   ;#
  1011. ***************
  1012. *** 41,48 ****
  1013.   # process is written. It is checked afterwards.
  1014.   sub acs_rqst {
  1015.       local($file) = @_;    # file to be locked
  1016. !     local($max) = 30;    # max number of attempts
  1017. !     local($delay) = 2;    # seconds to wait between attempts
  1018.       local($mask);        # to save old umask
  1019.       local($stamp);        # string written in lock file
  1020.       &checklock($file);    # avoid long-lasting locks
  1021. --- 44,51 ----
  1022.   # process is written. It is checked afterwards.
  1023.   sub acs_rqst {
  1024.       local($file) = @_;    # file to be locked
  1025. !     local($max) = $cf'lockmax;        # max number of attempts
  1026. !     local($delay) = $cf'lockdelay;    # seconds to wait between attempts
  1027.       local($mask);        # to save old umask
  1028.       local($stamp);        # string written in lock file
  1029.       &checklock($file);    # avoid long-lasting locks
  1030.  
  1031. Index: agent/pl/umask.pl
  1032. *** agent/pl/umask.pl.old    Fri Jul  1 17:16:23 1994
  1033. --- agent/pl/umask.pl    Fri Jul  1 17:16:23 1994
  1034. ***************
  1035. *** 0 ****
  1036. --- 1,42 ----
  1037. + ;# $Id: umask.pl,v 3.0.1.1 1994/07/01 15:05:10 ram Exp $
  1038. + ;#
  1039. + ;#  Copyright (c) 1990-1993, Raphael Manfredi
  1040. + ;#  
  1041. + ;#  You may redistribute only under the terms of the Artistic License,
  1042. + ;#  as specified in the README file that comes with the distribution.
  1043. + ;#  You may reuse parts of this distribution only within the terms of
  1044. + ;#  that same Artistic License; a copy of which may be found at the root
  1045. + ;#  of the source tree for mailagent 3.0.
  1046. + ;#
  1047. + ;# $Log: umask.pl,v $
  1048. + ;# Revision 3.0.1.1  1994/07/01  15:05:10  ram
  1049. + ;# patch8: created
  1050. + ;#
  1051. + ;#
  1052. + package u_mask;
  1053. + # Handles the UMASK command. Since the umask may be set locally in rules,
  1054. + # we must record the previous global setting to be able to restore it when
  1055. + # we leave scope.
  1056. + # Initialize at rule entrance
  1057. + sub init {
  1058. +     $umask = -1;
  1059. + }
  1060. + # When leaving a rule, reset the umask if it has been set locally.
  1061. + # If a global setting has been used, then we do not wish to interfere.
  1062. + sub reset {
  1063. +     return if $umask == -1;        # Umask was not changed locally in rule
  1064. +     umask($umask);                # Restore previous umask
  1065. + }
  1066. + # Record a local umask settting
  1067. + sub set {
  1068. +     local($new) = @_;        # New umask wanted
  1069. +     $umask = umask($new);    # Set new umask, save previous one
  1070. +     # Failure of the umask() system call is unlikely.
  1071. + }
  1072. + package main;
  1073.  
  1074. Index: agent/magent.SH
  1075. Prereq: 3.0.1.1
  1076. *** agent/magent.SH.old    Fri Jul  1 17:16:06 1994
  1077. --- agent/magent.SH    Fri Jul  1 17:16:07 1994
  1078. ***************
  1079. *** 24,30 ****
  1080.   # via the filter. Mine looks like this:
  1081.   #   "|exec /users/ram/mail/filter >>/users/ram/.bak 2>&1"
  1082.   
  1083. ! # $Id: magent.SH,v 3.0.1.1 1994/01/26 09:27:56 ram Exp $
  1084.   #
  1085.   #  Copyright (c) 1990-1993, Raphael Manfredi
  1086.   #  
  1087. --- 24,30 ----
  1088.   # via the filter. Mine looks like this:
  1089.   #   "|exec /users/ram/mail/filter >>/users/ram/.bak 2>&1"
  1090.   
  1091. ! # $Id: magent.SH,v 3.0.1.2 1994/07/01 14:54:29 ram Exp $
  1092.   #
  1093.   #  Copyright (c) 1990-1993, Raphael Manfredi
  1094.   #  
  1095. ***************
  1096. *** 35,40 ****
  1097. --- 35,43 ----
  1098.   #  of the source tree for mailagent 3.0.
  1099.   #
  1100.   # $Log: magent.SH,v $
  1101. + # Revision 3.0.1.2  1994/07/01  14:54:29  ram
  1102. + # patch8: fixed leading From date format (spacing problem)
  1103. + #
  1104.   # Revision 3.0.1.1  1994/01/26  09:27:56  ram
  1105.   # patch5: new -F option to force procesing on filtered messages
  1106.   #
  1107. ***************
  1108. *** 426,431 ****
  1109. --- 429,435 ----
  1110.   
  1111.       # Faked leading From line (used for digest items, by SPLIT)
  1112.       local($now) = &ctime(time);
  1113. +     $now =~ s/\s(\d:\d\d:\d\d)\b/0$1/;    # Add leading 0 if hour < 10
  1114.       chop($now);
  1115.       $FAKE_FROM = "From mailagent " . $now;
  1116.   }
  1117. ***************
  1118. *** 633,637 ****
  1119. --- 637,642 ----
  1120.   $grep -v '^;#' pl/usrmac.pl >>magent
  1121.   $grep -v '^;#' pl/tilde.pl >>magent
  1122.   $grep -v '^;#' pl/mh.pl >>magent
  1123. + $grep -v '^;#' pl/umask.pl >>magent
  1124.   chmod 755 magent
  1125.   $eunicefix magent
  1126.  
  1127. Index: agent/pl/pqueue.pl
  1128. Prereq: 3.0
  1129. *** agent/pl/pqueue.pl.old    Fri Jul  1 17:16:21 1994
  1130. --- agent/pl/pqueue.pl    Fri Jul  1 17:16:21 1994
  1131. ***************
  1132. *** 1,4 ****
  1133. ! ;# $Id: pqueue.pl,v 3.0 1993/11/29 13:49:09 ram Exp $
  1134.   ;#
  1135.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  1136.   ;#  
  1137. --- 1,4 ----
  1138. ! ;# $Id: pqueue.pl,v 3.0.1.1 1994/07/01 15:04:20 ram Exp $
  1139.   ;#
  1140.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  1141.   ;#  
  1142. ***************
  1143. *** 9,14 ****
  1144. --- 9,17 ----
  1145.   ;#  of the source tree for mailagent 3.0.
  1146.   ;#
  1147.   ;# $Log: pqueue.pl,v $
  1148. + ;# Revision 3.0.1.1  1994/07/01  15:04:20  ram
  1149. + ;# patch8: now honours new queuehold config variable
  1150. + ;#
  1151.   ;# Revision 3.0  1993/11/29  13:49:09  ram
  1152.   ;# Baseline for mailagent 3.0 netwide release.
  1153.   ;#
  1154. ***************
  1155. *** 38,45 ****
  1156.       foreach $file (@filter_files) {
  1157.           ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
  1158.               $atime,$mtime,$ctime,$blksize,$blocks) = stat($file);
  1159. !         if ((time - $mtime) > 1800) {
  1160. !             # More than 30 minutes -- there must have been a failure
  1161.               push(@files, $file);        # Add file to the to-be-parsed list
  1162.           }
  1163.       }
  1164. --- 41,48 ----
  1165.       foreach $file (@filter_files) {
  1166.           ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
  1167.               $atime,$mtime,$ctime,$blksize,$blocks) = stat($file);
  1168. !         if ((time - $mtime) > $cf'queuehold) {
  1169. !             # More than queue timeout -- there must have been a failure
  1170.               push(@files, $file);        # Add file to the to-be-parsed list
  1171.           }
  1172.       }
  1173.  
  1174. Index: agent/pl/interface.pl
  1175. Prereq: 3.0
  1176. *** agent/pl/interface.pl.old    Fri Jul  1 17:16:18 1994
  1177. --- agent/pl/interface.pl    Fri Jul  1 17:16:18 1994
  1178. ***************
  1179. *** 1,4 ****
  1180. ! ;# $Id: interface.pl,v 3.0 1993/11/29 13:48:53 ram Exp $
  1181.   ;#
  1182.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  1183.   ;#  
  1184. --- 1,4 ----
  1185. ! ;# $Id: interface.pl,v 3.0.1.1 1994/07/01 15:01:19 ram Exp $
  1186.   ;#
  1187.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  1188.   ;#  
  1189. ***************
  1190. *** 9,14 ****
  1191. --- 9,18 ----
  1192.   ;#  of the source tree for mailagent 3.0.
  1193.   ;#
  1194.   ;# $Log: interface.pl,v $
  1195. + ;# Revision 3.0.1.1  1994/07/01  15:01:19  ram
  1196. + ;# patch8: new UMASK command
  1197. + ;# patch8: cannot dataload exit
  1198. + ;#
  1199.   ;# Revision 3.0  1993/11/29  13:48:53  ram
  1200.   ;# Baseline for mailagent 3.0 netwide release.
  1201.   ;#
  1202. ***************
  1203. *** 64,79 ****
  1204. --- 68,87 ----
  1205.   sub strip        { &interface'dispatch; }
  1206.   sub subst        { &interface'dispatch; }
  1207.   sub tr            { &interface'dispatch; }
  1208. + sub umask        { &interface'dispatch; }
  1209.   sub unique        { &interface'dispatch; }
  1210.   sub vacation    { &interface'dispatch; }
  1211.   sub write        { &interface'dispatch; }
  1212.   
  1213.   # A perl filtering script should call &exit and not exit directly.
  1214. + # Perload OFF
  1215. + # (Cannot be data-loaded or it will corrupt $@ expected by &main'perl)
  1216.   sub exit { 
  1217.       local($code) = @_;
  1218.       die "OK\n" unless $code;
  1219.       die "Exit $code\n";
  1220.   }
  1221. + # Perload ON
  1222.   
  1223.   package interface;
  1224.   
  1225.  
  1226. Index: agent/filter/parser.h
  1227. Prereq: 3.0
  1228. *** agent/filter/parser.h.old    Fri Jul  1 17:16:06 1994
  1229. --- agent/filter/parser.h    Fri Jul  1 17:16:06 1994
  1230. ***************
  1231. *** 11,17 ****
  1232.   */
  1233.   
  1234.   /*
  1235. !  * $Id: parser.h,v 3.0 1993/11/29 13:48:19 ram Exp $
  1236.    *
  1237.    *  Copyright (c) 1990-1993, Raphael Manfredi
  1238.    *  
  1239. --- 11,17 ----
  1240.   */
  1241.   
  1242.   /*
  1243. !  * $Id: parser.h,v 3.0.1.1 1994/07/01 14:54:06 ram Exp $
  1244.    *
  1245.    *  Copyright (c) 1990-1993, Raphael Manfredi
  1246.    *  
  1247. ***************
  1248. *** 22,27 ****
  1249. --- 22,30 ----
  1250.    *  of the source tree for mailagent 3.0.
  1251.    *
  1252.    * $Log: parser.h,v $
  1253. +  * Revision 3.0.1.1  1994/07/01  14:54:06  ram
  1254. +  * patch8: new routine get_confval to get integer config variables
  1255. +  *
  1256.    * Revision 3.0  1993/11/29  13:48:19  ram
  1257.    * Baseline for mailagent 3.0 netwide release.
  1258.    *
  1259. ***************
  1260. *** 34,38 ****
  1261. --- 37,50 ----
  1262.   extern void read_conf();            /* Read configuration file */
  1263.   extern void set_env_vars();            /* Set correct environment variables */
  1264.   extern char *homedir();                /* Location of the home directory */
  1265. + extern int get_confval();            /* Get configuration value */
  1266. + /*
  1267. +  * Parameters for get_confval().
  1268. +  */
  1269. + #define CF_MANDATORY    0            /* Must be there, or fatal error */
  1270. + #define CF_DEFAULT        1            /* Use default value if not there */
  1271.   
  1272.   #endif
  1273.  
  1274. Index: agent/filter/logfile.c
  1275. Prereq: 3.0
  1276. *** agent/filter/logfile.c.old    Fri Jul  1 17:16:04 1994
  1277. --- agent/filter/logfile.c    Fri Jul  1 17:16:04 1994
  1278. ***************
  1279. *** 11,17 ****
  1280.   */
  1281.   
  1282.   /*
  1283. !  * $Id: logfile.c,v 3.0 1993/11/29 13:48:14 ram Exp $
  1284.    *
  1285.    *  Copyright (c) 1990-1993, Raphael Manfredi
  1286.    *  
  1287. --- 11,17 ----
  1288.   */
  1289.   
  1290.   /*
  1291. !  * $Id: logfile.c,v 3.0.1.1 1994/07/01 14:53:21 ram Exp $
  1292.    *
  1293.    *  Copyright (c) 1990-1993, Raphael Manfredi
  1294.    *  
  1295. ***************
  1296. *** 22,27 ****
  1297. --- 22,30 ----
  1298.    *  of the source tree for mailagent 3.0.
  1299.    *
  1300.    * $Log: logfile.c,v $
  1301. +  * Revision 3.0.1.1  1994/07/01  14:53:21  ram
  1302. +  * patch8: metaconfig now defines Strerror instead of strerror
  1303. +  *
  1304.    * Revision 3.0  1993/11/29  13:48:14  ram
  1305.    * Baseline for mailagent 3.0 netwide release.
  1306.    *
  1307. ***************
  1308. *** 181,187 ****
  1309.       sprintf(where, "%s", strerror(errno));
  1310.   #else
  1311.   #ifdef HAS_SYS_ERRLIST
  1312. !     sprintf(where, "%s", strerror(errno));    /* Macro defined by Configure */
  1313.   #else
  1314.       sprintf(where, "error #%d", errno);
  1315.   #endif
  1316. --- 184,190 ----
  1317.       sprintf(where, "%s", strerror(errno));
  1318.   #else
  1319.   #ifdef HAS_SYS_ERRLIST
  1320. !     sprintf(where, "%s", Strerror(errno));    /* Macro defined by Configure */
  1321.   #else
  1322.       sprintf(where, "error #%d", errno);
  1323.   #endif
  1324.  
  1325. Index: agent/test/filter/macros.t
  1326. *** agent/test/filter/macros.t.old    Fri Jul  1 17:16:28 1994
  1327. --- agent/test/filter/macros.t    Fri Jul  1 17:16:28 1994
  1328. ***************
  1329. *** 0 ****
  1330. --- 1,36 ----
  1331. + # Test patterns with macros in them
  1332. + # $Id: macros.t,v 3.0.1.1 1994/07/01 15:09:17 ram Exp $
  1333. + #
  1334. + #  Copyright (c) 1990-1993, Raphael Manfredi
  1335. + #  
  1336. + #  You may redistribute only under the terms of the Artistic License,
  1337. + #  as specified in the README file that comes with the distribution.
  1338. + #  You may reuse parts of this distribution only within the terms of
  1339. + #  that same Artistic License; a copy of which may be found at the root
  1340. + #  of the source tree for mailagent 3.0.
  1341. + #
  1342. + # $Log: macros.t,v $
  1343. + # Revision 3.0.1.1  1994/07/01  15:09:17  ram
  1344. + # patch8: created
  1345. + #
  1346. + do '../pl/filter.pl';
  1347. + &add_header('X-Tag: macros');
  1348. + &replace_header("To: $user@eiffel.com");
  1349. + `$cmd`;
  1350. + $? == 0 || print "1\n";
  1351. + -f "$user" && print "2\n";        # Must have been deleted
  1352. + unlink $user;    # Just in case
  1353. + # Now check that macro susbstitution occurs in pattern when enabled
  1354. + $cmd =~ s/^(\S+)/$1 -o 'rulemac: ON'/;
  1355. + `$cmd`;
  1356. + $? == 0 || print "3\n";
  1357. + -f "$user" || print "4\n";        # This time, it has been leaved
  1358. + unlink $user;
  1359. + print "0\n";
  1360.  
  1361. Index: agent/test/rules
  1362. Prereq: 3.0.1.1
  1363. *** agent/test/rules.old    Fri Jul  1 17:16:32 1994
  1364. --- agent/test/rules    Fri Jul  1 17:16:33 1994
  1365. ***************
  1366. *** 2,8 ****
  1367.   # Mailagent rules for filter regression tests
  1368.   #
  1369.   
  1370. ! # $Id: rules,v 3.0.1.1 1994/04/25 15:26:12 ram Exp $
  1371.   #
  1372.   #  Copyright (c) 1990-1993, Raphael Manfredi
  1373.   #  
  1374. --- 2,8 ----
  1375.   # Mailagent rules for filter regression tests
  1376.   #
  1377.   
  1378. ! # $Id: rules,v 3.0.1.2 1994/07/01 15:12:23 ram Exp $
  1379.   #
  1380.   #  Copyright (c) 1990-1993, Raphael Manfredi
  1381.   #  
  1382. ***************
  1383. *** 13,18 ****
  1384. --- 13,21 ----
  1385.   #  of the source tree for mailagent 3.0.
  1386.   #
  1387.   # $Log: rules,v $
  1388. + # Revision 3.0.1.2  1994/07/01  15:12:23  ram
  1389. + # patch8: added test rules for macro substitution in patterns
  1390. + #
  1391.   # Revision 3.0.1.1  1994/04/25  15:26:12  ram
  1392.   # patch7: added three more tests in filter/group
  1393.   #
  1394. ***************
  1395. *** 146,149 ****
  1396. --- 149,157 ----
  1397.   <RANGE> Body <-3, ->: /request/        { SAVE never.5; REJECT };
  1398.   <RANGE> Cc <-1, ->: must            { SAVE never.6 };
  1399.   <RANGE>                             { DELETE };
  1400. + # filter/macros
  1401. + X-Tag: /macros/            { REJECT MACROS };
  1402. + <MACROS> To: %u            { LEAVE };
  1403. + <MACROS>                { DELETE };
  1404.   
  1405.  
  1406. Index: agent/pl/header.pl
  1407. Prereq: 3.0
  1408. *** agent/pl/header.pl.old    Fri Jul  1 17:16:17 1994
  1409. --- agent/pl/header.pl    Fri Jul  1 17:16:17 1994
  1410. ***************
  1411. *** 1,4 ****
  1412. ! ;# $Id: header.pl,v 3.0 1993/11/29 13:48:49 ram Exp $
  1413.   ;#
  1414.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  1415.   ;#  
  1416. --- 1,4 ----
  1417. ! ;# $Id: header.pl,v 3.0.1.1 1994/07/01 15:00:51 ram Exp $
  1418.   ;#
  1419.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  1420.   ;#  
  1421. ***************
  1422. *** 9,14 ****
  1423. --- 9,17 ----
  1424.   ;#  of the source tree for mailagent 3.0.
  1425.   ;#
  1426.   ;# $Log: header.pl,v $
  1427. + ;# Revision 3.0.1.1  1994/07/01  15:00:51  ram
  1428. + ;# patch8: fixed leading From date format (spacing problem)
  1429. + ;#
  1430.   ;# Revision 3.0  1993/11/29  13:48:49  ram
  1431.   ;# Baseline for mailagent 3.0 netwide release.
  1432.   ;#
  1433. ***************
  1434. *** 126,132 ****
  1435. --- 129,137 ----
  1436.       require 'ctime.pl';
  1437.       local($date) = &'ctime(time);
  1438.       # Traditionally, MTAs add a ',' right after week day
  1439. +     # Moreover, RFC-822 and RFC-1123 require a leading 0 if hour < 10
  1440.       $date =~ s/^(\w+)(\s)/$1,$2/;
  1441. +     $date =~ s/\s(\d:\d\d:\d\d)\b/0$1/;
  1442.       chop($date);                    # Ctime adds final new-line
  1443.       $date;
  1444.   }
  1445.  
  1446. *** End of Patch 10 ***
  1447.  
  1448. exit 0 # Just in case...
  1449.