*** resend.orig Fri Nov 3 23:06:30 2000 --- resend2 Sat Oct 30 21:42:53 2004 *************** *** 579,601 **** sub parse_header { local($gonna_bounce); local($kept_last) = 0; # our return flag/string. print STDERR "$0: parse_header: enter.\n" if $DEBUG; print STDERR "$0: parse_header: taboo_headers = $is_taboo_header\n" if $DEBUG; print STDERR "$0: parse_header: global_taboo_headers = $is_global_taboo_header\n" if $DEBUG; print STDERR "$0: parse_header: admin_headers = $is_admin_header\n" if $DEBUG; ! ! while () { print STDERR "$0: parse_header: [$.: $_]" if $DEBUG; - last if /^$/; # stop when we hit the end. RFC822. next unless /\S/; # skip leading blank lines; usually only ! # there if this is a restart after an ! # in-body "Approved:" line ! print STDERR "$0: parse_header: [$.] taboo_header check\n" ! if $DEBUG; # check for taboo_headers or approved header # if ($#taboo_headers >= $[ && !$approved && --- 579,599 ---- sub parse_header { local($gonna_bounce); local($kept_last) = 0; # our return flag/string. + local($subject_flag) = 0; print STDERR "$0: parse_header: enter.\n" if $DEBUG; print STDERR "$0: parse_header: taboo_headers = $is_taboo_header\n" if $DEBUG; print STDERR "$0: parse_header: global_taboo_headers = $is_global_taboo_header\n" if $DEBUG; print STDERR "$0: parse_header: admin_headers = $is_admin_header\n" if $DEBUG; ! while () { print STDERR "$0: parse_header: [$.: $_]" if $DEBUG; last if /^$/; # stop when we hit the end. RFC822. next unless /\S/; # skip leading blank lines; usually only ! # there if this is a restart after an ! # in-body "Approved:" line ! print STDERR "$0: parse_header: [$.] taboo_header check\n" if $DEBUG; # check for taboo_headers or approved header # if ($#taboo_headers >= $[ && !$approved && *************** *** 649,676 **** # password. if (/^approved:\s*(.*)/i && defined($opt_a)) { ! if (!$approved) { ! print STDERR "$0: parse_header: found an approved header\n" if $DEBUG; ! $approved = &chop_nl($1); ! if ($approved ne $opt_a # check the p/w given against approve_passwd ! && !(&main'valid_passwd($listdir, $opt_l, $approved))) { # and also against admin_passwd ') ! if (defined($opt_A)) { # bounce only if list is moderated ! $gonna_bounce .= "Invalid 'Approved:' header "; ! print STDERR "$0: parse_header: [$.: boing: $gonna_bounce\n" if $DEBUG; ! } ! undef $approved; ! } else { ! # reset the bounce counter, so that we return cleanly. ! # this allows a message with a taboo_header or admin_header ! # but with a valid Approved line to be posted. ! $gonna_bounce = ''; ! next; # gotta remove that approved line, dontcha know } - } - else { - # We have already been approved, so skip this header - next; - } } print STDERR "$0: parse_header: skipping headers\n" if $DEBUG; --- 647,674 ---- # password. if (/^approved:\s*(.*)/i && defined($opt_a)) { ! if (!$approved) { ! print STDERR "$0: parse_header: found an approved header\n" if $DEBUG; ! $approved = &chop_nl($1); ! if ($approved ne $opt_a # check the p/w given against approve_passwd ! && !(&main'valid_passwd($listdir, $opt_l, $approved))) { # and also against admin_passwd ') ! if (defined($opt_A)) { # bounce only if list is moderated ! $gonna_bounce .= "Invalid 'Approved:' header "; ! print STDERR "$0: parse_header: [$.: boing: $gonna_bounce\n" if $DEBUG; ! } ! undef $approved; ! } else { ! # reset the bounce counter, so that we return cleanly. ! # this allows a message with a taboo_header or admin_header ! # but with a valid Approved line to be posted. ! $gonna_bounce = ''; ! next; # gotta remove that approved line, dontcha know ! } ! } ! else { ! # We have already been approved, so skip this header ! next; } } print STDERR "$0: parse_header: skipping headers\n" if $DEBUG; *************** *** 700,705 **** --- 698,729 ---- # prepend subject prefix # + + # ----------- PREFIX+COUNTER ----- Begin + if (/^subject:\s*/i) { + s/\[$opt_l:\d*\][ \t]*//g; + while(/RE:\s*RE:/i) { + s/\s*RE:\s*RE:[ \t]*/ Re: /i; + } + + $counter=0; + $counter_file=$homedir."/lists/".$opt_l.".counter"; + if (open(F1, "+< $counter_file")) { + flock(F1, 2); + $counter = ; + # close F1 + } + chomp($counter); + $counter++; + # $counter_subject=1000000+$counter; + # $counter_subject=substr $counter,1,6; + # $counter_subject="[$counter]"; + $counter_subject="[".$opt_l.":$counter]"; + s/^subject:\s*/Subject: $counter_subject /i; + $subject_flag = 1; + } + # ----------- PREFIX+COUNTER ----- End + if ( (/^subject:\s*/i) && ($config_opts{$opt_l,"subject_prefix"} ne '')) { *************** *** 734,739 **** --- 758,789 ---- &check_hdr_line($_); # check for length & balance on from, cc, and to fields. print OUT $_; } + + # ----------- PREFIX+COUNTER ----- Start + # if non Subject + if($subject_flag == 0) { + $counter=0; + $counter_file=$homedir."/lists/".$opt_l.".counter"; + if (open(F1, "+< $counter_file")) { + flock(F1, 2); + $counter = ; + # close F1; + } + $counter++; + $counter_subject="[".$opt_l.":$counter]"; + print OUT "Subject: $counter_subject (no subject)\n"; + } + + # if non taboo count save + if(length($gonna_bounce) == 0) { + seek(F1, 0, 0); + print F1 $counter; + close F1; + } else { + close F1; + } + + # ----------- PREFIX+COUNTER ----- End # finished with the header. # Now, we aren't going to bounce yet, even if it looks bad,