summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sendmail/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/sendmail/contrib')
-rw-r--r--usr.sbin/sendmail/contrib/bsdi.mc191
-rwxr-xr-xusr.sbin/sendmail/contrib/expn.pl86
-rw-r--r--usr.sbin/sendmail/contrib/mailprio297
-rw-r--r--usr.sbin/sendmail/contrib/rmail.oldsys.patch108
4 files changed, 640 insertions, 42 deletions
diff --git a/usr.sbin/sendmail/contrib/bsdi.mc b/usr.sbin/sendmail/contrib/bsdi.mc
new file mode 100644
index 0000000..231a7bc
--- /dev/null
+++ b/usr.sbin/sendmail/contrib/bsdi.mc
@@ -0,0 +1,191 @@
+Return-Path: sanders@austin.BSDI.COM
+Received: from hofmann.CS.Berkeley.EDU (hofmann.CS.Berkeley.EDU [128.32.34.35]) by orodruin.CS.Berkeley.EDU (8.6.9/8.7.0.Beta0) with ESMTP id KAA28278 for <eric@orodruin.CS.Berkeley.EDU>; Sat, 10 Dec 1994 10:49:08 -0800
+Received: from austin.BSDI.COM (austin.BSDI.COM [137.39.95.2]) by hofmann.CS.Berkeley.EDU (8.6.9/8.6.6.Beta11) with ESMTP id KAA09482 for <eric@cs.berkeley.edu>; Sat, 10 Dec 1994 10:49:03 -0800
+Received: from austin.BSDI.COM (sanders@localhost [127.0.0.1]) by austin.BSDI.COM (8.6.9/8.6.9) with ESMTP id MAA14919 for <eric@cs.berkeley.edu>; Sat, 10 Dec 1994 12:49:01 -0600
+Message-Id: <199412101849.MAA14919@austin.BSDI.COM>
+To: Eric Allman <eric@cs.berkeley.edu>
+Subject: Re: sorting mailings lists with fastest delivery users first
+In-reply-to: Your message of Sat, 10 Dec 1994 08:25:30 PST.
+References: <199412101625.IAA15407@mastodon.CS.Berkeley.EDU>
+From: Tony Sanders <sanders@bsdi.com>
+Organization: Berkeley Software Design, Inc.
+Date: Sat, 10 Dec 1994 12:49:00 -0600
+Sender: sanders@austin.BSDI.COM
+
+(some random text deleted)
+
+I'll send you something else I've hacked up. You are free to use this
+or do with it as you like (I hereby make all my parts public domain).
+It's a sample .mc file that has comments (mostly taken from the README)
+and examples describing most of the common things people need to setup.
+
+#
+# /usr/share/sendmail/cf/sample.mc
+#
+# Do not edit /etc/sendmail.cf directly unless you cannot do what you
+# want in the master config file (/usr/share/sendmail/cf/sample.mc).
+# To create /etc/sendmail.cf from the master:
+# cd /usr/share/sendmail/cf
+# mv /etc/sendmail.cf /etc/sendmail.cf.save
+# m4 < sample.mc > /etc/sendmail.cf
+#
+# Then kill and restart sendmail:
+# sh -c 'set `cat /var/run/sendmail.pid`; kill $1; shift; eval "$@"'
+#
+# See /usr/share/sendmail/README for help in building a configuration file.
+#
+include(`../m4/cf.m4')
+VERSIONID(`@(#)$Id$')
+
+dnl # Specify your OS type below
+OSTYPE(`bsd4.4')
+
+dnl # NOTE: `dnl' is the m4 command for delete-to-newline; these are
+dnl # used to prevent those lines from appearing in the sendmail.cf.
+dnl #
+dnl # UUCP-only sites should configure FEATURE(`nodns') and SMART_HOST.
+dnl # The uucp-dom mailer requires MAILER(smtp). For more info, see
+dnl # `UUCP Config' at the end of this file.
+
+dnl # If you are not running DNS at all, it is important to use
+dnl # FEATURE(nodns) to avoid having sendmail queue everything
+dnl # waiting for the name server to come up.
+dnl # Example:
+dnl FEATURE(`nodns')
+
+dnl # Use FEATURE(`nocanonify') to skip address canonification via $[ ... $].
+dnl # This would generally only be used by sites that only act as mail gateways
+dnl # or which have user agents that do full canonification themselves.
+dnl # You may also want to use:
+dnl # define(`confBIND_OPTS',`-DNSRCH -DEFNAMES')
+dnl # to turn off the usual resolver options that do a similar thing.
+dnl # Examples:
+dnl FEATURE(`nocanonify')
+dnl define(`confBIND_OPTS',`-DNSRCH -DEFNAMES')
+
+dnl # If /bin/hostname is not set to the FQDN (Full Qualified Domain Name;
+dnl # for example, foo.bar.com) *and* you are not running a nameserver
+dnl # (that is, you do not have an /etc/resolv.conf and are not running
+dnl # named) *and* the canonical name for your machine in /etc/hosts
+dnl # (the canonical name is the first name listed for a given IP Address)
+dnl # is not the FQDN version then define NEED_DOMAIN and specify your
+dnl # domain using `DD' (for example, if your hostname is `foo.bar.com'
+dnl # then use DDbar.com). If in doubt, just define it anyway; doesn't hurt.
+dnl # Examples:
+dnl define(`NEED_DOMAIN', `1')
+dnl DDyour.site.domain
+
+dnl # Define SMART_HOST if you want all outgoing mail to go to a central
+dnl # site. SMART_HOST applies to names qualified with non-local names.
+dnl # Example:
+dnl define(`SMART_HOST', `smtp:firewall.bar.com')
+
+dnl # Define MAIL_HUB if you want all incoming mail sent to a
+dnl # centralized hub, as for a shared /var/spool/mail scheme.
+dnl # MAIL_HUB applies to names qualified with the name of the
+dnl # local host (e.g., "eric@foo.bar.com").
+dnl # Example:
+dnl define(`MAIL_HUB', `smtp:mailhub.bar.com')
+
+dnl # LOCAL_RELAY is a site that will handle unqualified names, this is
+dnl # basically for site/company/department wide alias forwarding. By
+dnl # default mail is delivered on the local host.
+dnl # Example:
+dnl define(`LOCAL_RELAY', `smtp:mailgate.bar.com')
+
+dnl # Relay hosts for fake domains: .UUCP .BITNET .CSNET
+dnl # Examples:
+dnl define(`UUCP_RELAY', `mailer:your_relay_host')
+dnl define(`BITNET_RELAY', `mailer:your_relay_host')
+dnl define(`CSNET_RELAY', `mailer:your_relay_host')
+
+dnl # Define `MASQUERADE_AS' is used to hide behind a gateway.
+dnl # add any accounts you wish to be exposed (i.e., not hidden) to the
+dnl # `EXPOSED_USER' list.
+dnl # Example:
+dnl MASQUERADE_AS(`some.other.host')
+
+dnl # If masquerading, EXPOSED_USER defines the list of accounts
+dnl # that retain the local hostname in their address.
+dnl # Example:
+dnl EXPOSED_USER(`postmaster hostmaster webmaster')
+
+dnl # If masquerading is enabled (using MASQUERADE_AS above) then
+dnl # FEATURE(allmasquerade) will cause recipient addresses to
+dnl # masquerade as being from the masquerade host instead of
+dnl # getting the local hostname. Although this may be right for
+dnl # ordinary users, it breaks local aliases that aren't exposed
+dnl # using EXPOSED_USER.
+dnl # Example:
+dnl FEATURE(allmasquerade)
+
+dnl # Include any required mailers
+MAILER(local)
+MAILER(smtp)
+MAILER(uucp)
+
+LOCAL_CONFIG
+# If this machine should be accepting mail as local for other hostnames
+# that are MXed to this hostname then add those hostnames below using
+# a line like:
+# Cw bar.com
+# The most common case where you need this is if this machine is supposed
+# to be accepting mail for the domain. That is, if this machine is
+# foo.bar.com and you have an MX record in the DNS that looks like:
+# bar.com. IN MX 0 foo.bar.com.
+# Then you will need to add `Cw bar.com' to the config file for foo.bar.com.
+# DO NOT add Cw entries for hosts whom you simply store and forward mail
+# for or else it will attempt local delivery. So just because bubba.bar.com
+# is MXed to your machine you should not add a `Cw bubba.bar.com' entry
+# unless you want local delivery and your machine is the highest-priority
+# MX entry (that is is has the lowest preference value in the DNS.
+
+LOCAL_RULE_0
+# `LOCAL_RULE_0' can be used to introduce alternate delivery rules.
+# For example, let's say you accept mail via an MX record for widgets.com
+# (don't forget to add widgets.com to your Cw list, as above).
+#
+# If wigets.com only has an AOL address (widgetsinc) then you could use:
+# R$+ <@ widgets.com.> $#smtp $@aol.com. $:widgetsinc<@aol.com.>
+#
+# Or, if widgets.com was connected to you via UUCP as the UUCP host
+# widgets you might have:
+# R$+ <@ widgets.com.> $#uucp $@widgets $:$1<@widgets.com.>
+
+dnl ###
+dnl ### UUCP Config
+dnl ###
+
+dnl # `SITECONFIG(site_config_file, name_of_site, connection)'
+dnl # site_config_file the name of a file in the cf/siteconfig
+dnl # directory (less the `.m4')
+dnl # name_of_site the actual name of your UUCP site
+dnl # connection one of U, W, X, or Y; where U means the sites listed
+dnl # in the config file are connected locally; W, X, and Y
+dnl # build remote UUCP hub classes ($=W, etc).
+dnl # You will need to create the specific site_config_file in
+dnl # /usr/share/sendmail/siteconfig/site_config_file.m4
+dnl # The site_config_file contains a list of directly connected UUCP hosts,
+dnl # e.g., if you only connect to UUCP site gargoyle then you could just:
+dnl # echo 'SITE(gargoyle)' > /usr/share/sendmail/siteconfig/uucp.foobar.m4
+dnl # Example:
+dnl SITECONFIG(`uucp.foobar', `foobar', U)
+
+dnl # If you are on a local SMTP-based net that connects to the outside
+dnl # world via UUCP, you can use LOCAL_NET_CONFIG to add appropriate rules.
+dnl # For example:
+dnl # define(`SMART_HOST', suucp:uunet)
+dnl # LOCAL_NET_CONFIG
+dnl # R$* < @ $* .$m. > $* $#smtp $@ $2.$m. $: $1 < @ $2.$m. > $3
+dnl # This will cause all names that end in your domain name ($m) to be sent
+dnl # via SMTP; anything else will be sent via suucp (smart UUCP) to uunet.
+dnl # If you have FEATURE(nocanonify), you may need to omit the dots after
+dnl # the $m.
+dnl #
+dnl # If you are running a local DNS inside your domain which is not
+dnl # otherwise connected to the outside world, you probably want to use:
+dnl # define(`SMART_HOST', smtp:fire.wall.com)
+dnl # LOCAL_NET_CONFIG
+dnl # R$* < @ $* . > $* $#smtp $@ $2. $: $1 < @ $2. > $3
+dnl # That is, send directly only to things you found in your DNS lookup;
+dnl # anything else goes through SMART_HOST.
diff --git a/usr.sbin/sendmail/contrib/expn.pl b/usr.sbin/sendmail/contrib/expn.pl
index 495db73..270f483 100755
--- a/usr.sbin/sendmail/contrib/expn.pl
+++ b/usr.sbin/sendmail/contrib/expn.pl
@@ -1,20 +1,19 @@
-#!/usr/local/bin/perl
+#!/usr/bin/perl
'di ';
'ds 00 \\"';
-'ig00 ';
+'ig 00 ';
#
# THIS PROGRAM IS ITS OWN MANUAL PAGE. INSTALL IN man & bin.
#
# hardcoded constants, should work fine for BSD-based systems
-$AF_INET = 2;
-$SOCK_STREAM = 1;
+require 'sys/socket.ph';
$sockaddr = 'S n a4 x8';
# system requirements:
# must have 'nslookup' and 'hostname' programs.
-# $Header: /home/muir/bin/RCS/expn,v 3.6 1994/02/23 22:26:19 muir Exp muir $
+# $Header: /home/muir/bin/RCS/expn,v 3.9 1995/10/02 17:51:35 muir Exp muir $
# TODO:
# less magic should apply to command-line addresses
@@ -70,7 +69,7 @@ $sockaddr = 'S n a4 x8';
# ask each server in turn a whole bunch of questions, addresses to
# be expanded are queued up.
#
-# This means that all account w.r.t. an address must be stored in
+# This means that all accounting w.r.t. an address must be stored in
# various arrays. Generally these arrays are indexed by the
# string "$addr *** $server" where $addr is the address to be
# expanded "foo" or maybe "foo@bar" and $server is the hostname
@@ -102,13 +101,18 @@ $sockaddr = 'S n a4 x8';
$have_nslookup = 1; # we have the nslookup program
$port = 'smtp';
$av0 = $0;
-$0 = "$av0 - running hostname";
$ENV{'PATH'} .= ":/usr/etc" unless $ENV{'PATH'} =~ m,/usr/etc,;
-chop($hostname = `hostname`);
+$ENV{'PATH'} .= ":/usr/ucb" unless $ENV{'PATH'} =~ m,/usr/ucb,;
select(STDERR);
-$usage = "Usage: $av0 [-1avwd] user[@host] [user2[host2] ...]";
+$0 = "$av0 - running hostname";
+chop($name = `hostname || uname -n`);
+
+$0 = "$av0 - lookup host FQDN and IP addr";
+($hostname,$aliases,$type,$len,$thisaddr) = gethostbyname($name);
+
$0 = "$av0 - parsing args";
+$usage = "Usage: $av0 [-1avwd] user[\@host] [user2[host2] ...]";
for $a (@ARGV) {
die $usage if $a eq "-";
while ($a =~ s/^(-.*)([1avwd])/$1/) {
@@ -143,8 +147,7 @@ $0 = "$av0 - building local socket";
($name,$aliases,$proto) = getprotobyname('tcp');
($name,$aliases,$port) = getservbyname($port,'tcp')
unless $port =~ /^\d+/;
-($name,$aliases,$type,$len,$thisaddr) = gethostbyname($hostname);
-$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
+$this = pack($sockaddr, &AF_INET, 0, $thisaddr);
HOST:
while (@hosts) {
@@ -174,8 +177,8 @@ while (@hosts) {
# get a connection, or look for an mx
$0 = "$av0 - socket to $server";
- $that = pack($sockaddr, $AF_INET, $port, $thataddr);
- socket(S, $AF_INET, $SOCK_STREAM, $proto)
+ $that = pack($sockaddr, &AF_INET, $port, $thataddr);
+ socket(S, &AF_INET, &SOCK_STREAM, $proto)
|| die "socket: $!";
$0 = "$av0 - bind to $server";
bind(S, $this)
@@ -200,8 +203,8 @@ while (@hosts) {
print if $watch;
if (/^(\d+)([- ])/) {
if ($1 != 220) {
- $0 = "$av0 - bad numeric responce from $server";
- &alarm("giving up after bet responce from $server",'');
+ $0 = "$av0 - bad numeric response from $server";
+ &alarm("giving up after bad response from $server",'');
&read_response($2,$watch);
alarm(0);
print STDERR "$server: NOT 220 greeting: $_"
@@ -213,7 +216,7 @@ while (@hosts) {
}
last if ($2 eq " ");
} else {
- $0 = "$av0 - bad responce from $server";
+ $0 = "$av0 - bad response from $server";
print STDERR "$server: NOT 220 greeting: $_"
if ($debug || $vw);
unless (&mxlookup(0,$server,"$server: did not respond with SMTP codes",*users)) {
@@ -261,7 +264,9 @@ while (@hosts) {
@toExpn = ();
}
- ($ecode,@expansion) = &expn_vrfy($u,$server);
+# ($ecode,@expansion) = &expn_vrfy($u,$server);
+ (@foo) = &expn_vrfy($u,$server);
+ ($ecode,@expansion) = @foo;
if ($ecode) {
&giveup('',$ecode,$u);
last USER;
@@ -329,7 +334,7 @@ while (@hosts) {
# 550 is a known code... Should the be
# included in -a output? Might be a bug
# here. Does it matter? Can assume that
- # there won't be UNKNOWN USER responces
+ # there won't be UNKNOWN USER responses
# mixed with valid users?
if ($s =~ /^(550)([- ])/) {
if ($valid) {
@@ -414,6 +419,8 @@ sub giveup
{
local($redirect_okay,$reason,$user) = @_;
local($us,@so,$nh,@remaining_users);
+ local($pk,$file,$line);
+ ($pk, $file, $line) = caller;
$0 = "$av0 - giving up on $server: $reason";
#
@@ -427,7 +434,7 @@ sub giveup
$giveup{$server} = $reason;
print STDERR "$reason\n";
}
- print "Giveup!!! redirect okay = $redirect_okay; $reason\n" if $debug;
+ print "Giveup at $file:$line!!! redirect okay = $redirect_okay; $reason\n" if $debug;
#
# Wait!
# Before giving up, see if there is a chance that
@@ -486,7 +493,7 @@ sub try_fallback
if (defined $fellback{$us}) {
#
# Undo a previous fallback so that we can try again
- # Nest fallbacks are avoided because they could
+ # Nested fallbacks are avoided because they could
# lead to infinite loops
#
$fallhost = $fellback{$us};
@@ -579,7 +586,7 @@ sub do_validAddr
#
# Ranking of inputs: best: user@host.domain, okay: user
#
-# Return value: $error_string, @responces_from_server
+# Return value: $error_string, @responses_from_server
sub expn_vrfy
{
local($u,$server) = @_;
@@ -594,7 +601,7 @@ sub expn_vrfy
TRY:
for $c (@c) {
for $try_u (@try_u) {
- &alarm("$c'ing $try_u on $server",'',$u);
+ &alarm("${c}'ing $try_u on $server",'',$u);
&ps("$c $try_u");
alarm(0);
$s = <S>;
@@ -608,7 +615,7 @@ sub expn_vrfy
$code = 250;
@ret = ("",$s);
push(@ret,&read_response($2,$debug));
- return @ret;
+ return (@ret);
}
if ($1 == 551 || $1 == 251) {
$code = $1;
@@ -648,7 +655,7 @@ sub parse
}
# returns ($new_smtp_server,$new_address,$new_name)
-# given a responce from a SMTP server ($newaddr), the
+# given a response from a SMTP server ($newaddr), the
# current host ($server), the old "name" and a flag that
# indicates if it is being called during the initial
# command line parsing ($parsing_args)
@@ -672,13 +679,13 @@ sub parse2
#
if ($newaddr =~ /^\<(.*)\>$/) {
print "<A:$1>\n" if $debug;
- $newaddr = &trim($1);
+ ($newaddr) = &trim($1);
print "na = $newaddr\n" if $debug;
}
if ($newaddr =~ /^([^\<\>]*)\<([^\<\>]*)\>([^\<\>]*)$/) {
# address has a < > pair in it.
print "N:$1 <A:$2> N:$3\n" if $debug;
- $newaddr = &trim($2);
+ ($newaddr) = &trim($2);
unshift(@names, &trim($3,$1));
print "na = $newaddr\n" if $debug;
}
@@ -754,7 +761,7 @@ sub trim
}
# using the host part of an address, and the server name, add the
# servers' domain to the address if it doesn't already have a
-# domain. Since this sometimes failes, save a back reference so
+# domain. Since this sometimes fails, save a back reference so
# it can be unrolled.
sub domainify
{
@@ -1047,11 +1054,6 @@ sub mxlookup
# provide fallbacks in case $nserver doesn't work out
if (defined $fallback{$cpref}) {
-# for $u (@users) {
-# print "mx_secondary{$u *** $nserver} = ".$fallback{$cpref}."\n"
-# if $debug;
-# $mx_secondary{"$u *** $nserver"} = $fallback{$cpref};
-# }
$mx_secondary{$server} = $fallback{$cpref};
}
@@ -1191,15 +1193,15 @@ sub alarm
alarm(3600);
$SIG{ALRM} = 'handle_alarm';
}
-# this involves one GREAT hack.
-# the "next HOST" has to unwind the stack!
+# this involves one great big ugly hack.
+# the "next HOST" unwinds the stack!
sub handle_alarm
{
&giveup($alarm_redirect,"Timed out during $alarm_action",$alarm_user);
next HOST;
}
-# read the rest of the current smtp daemon's responce (and toss it away)
+# read the rest of the current smtp daemon's response (and toss it away)
sub read_response
{
local($done,$watch) = @_;
@@ -1227,11 +1229,11 @@ $flag_1;
%already_mx_fellback;
&handle_alarm;
################### BEGIN PERL/TROFF TRANSITION
-.00;
+.00 ;
-'di \\ " finish diversion--previous line must be blank
-.nr nl 0-1 \\ " fake up transition to first page again
-.nr % 0 \\ " start at page 1
+'di
+.nr nl 0-1
+.nr % 0
.\\"'; __END__
.\" ############## END PERL/TROFF TRANSITION
.TH EXPN 1 "March 11, 1993"
@@ -1359,7 +1361,7 @@ and Jon Broome has dropped off the face of the earth!
.SH AVAILABILITY
The latest version of
.B expn
-is available through anonymous ftp to
-.IR idiom.berkeley.ca.us .
+is available through anonymous ftp at
+.IR ftp://ftp.idiom.com/pub/muir-programs/expn .
.SH AUTHOR
-.I David Muir Sharnoff\ \ \ \ <muir@idiom.berkeley.ca.us>
+.I David Muir Sharnoff\ \ \ \ <muir@idiom.com>
diff --git a/usr.sbin/sendmail/contrib/mailprio b/usr.sbin/sendmail/contrib/mailprio
new file mode 100644
index 0000000..cdbc3b0
--- /dev/null
+++ b/usr.sbin/sendmail/contrib/mailprio
@@ -0,0 +1,297 @@
+Message-Id: <199412081919.NAA23234@austin.BSDI.COM>
+To: Eric Allman <eric@cs.berkeley.edu>
+Subject: Re: sorting mailings lists with fastest delivery users first
+In-reply-to: Your message of Thu, 08 Dec 1994 06:08:33 PST.
+References: <199412081408.GAA06210@mastodon.CS.Berkeley.EDU>
+From: Tony Sanders <sanders@bsdi.com>
+Organization: Berkeley Software Design, Inc.
+Date: Thu, 08 Dec 1994 13:19:39 -0600
+Sender: sanders@austin.BSDI.COM
+
+Eric Allman writes:
+> Nope, that's a new one, so far as I know. Any interest in
+> contributing it? For small lists it seems overkill, but for
+> large lists it could be a major win.
+
+Sure, I will contribute it; after I sent you mail last night I went ahead
+and finished up what I thought needed to be done. I would like to get
+some feedback from you on a few items, if you have time.
+
+There are two programs, mailprio_mkdb and mailprio (source below).
+
+mailprio_mkdb reads maillog files and creates a DB file of address vs.
+delay. I'm not too happy with how it does the averages right now but this
+is just a quick hack. However, it should at least order sites that take
+days vs. those that deliver on the first pass through. One thing that
+would make this information a lot more accurate is if sendmail could log
+a "transaction delay" (on failures also), as well as total delivery delay.
+Perhaps, as an option, it could maintain the DB file itself?
+
+mailprio then simply reads a list of addresses from stdin (the mailing
+list), and tries to prioritize them according to the info the database.
+It collects comment lines and other junk at the top of the file; all
+mailprio does is reorder lines, the actual text of the file should
+be unchanged to the extent that you can verify it with:
+ sort sorted_list > checkit; sort mailing-list | diff - checkit
+Users with no delay information are put next. The prioritized list is last.
+Of course, this function could also be built-into sendmail (eventually).
+
+Putting "new account" info at the top with the current averaging function
+probably adversly affects the prioritized list (at least in the short
+term), but putting it at the bottom would not really give the new accounts
+a fair chance. I suspect this isn't that big of a problem. I'm running
+this here on a list with 461 accounts and about 10 messages per day so
+I'll see how it goes. I'll keep some stats on delay times and see what
+happens.
+
+Another thing that would help this situation, is if sendmail had the queue
+ordered by site (but you already know this). If you ever get to do per
+site queuing you should consider "blocking" a queue for some short period
+of time if a connection fails to that site [sendmail does this inside a
+single process on a per account basis now right?]; this would allow multiple
+sendmails to quickly skip over those sites for people like me that run:
+
+ for i in 1 2 3 4 5 6 7 8 ; do daemon sendmail -q; done
+
+to flush a queue that has gotten behind. You could also do this inside
+sendmail with a parallelism option (when it is time to run the queue, how
+many processes to start).
+
+#! /bin/sh
+# This is a shell archive. Remove anything before this line, then unpack
+# it by saving it into a file and typing "sh file". To overwrite existing
+# files, type "sh file -c". You can also feed this as standard input via
+# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
+# will see the following message at the end:
+# "End of shell archive."
+# Contents: mailprio mailprio_mkdb
+# Wrapped by sanders@austin.BSDI.COM on Fri Dec 9 18:07:02 1994
+PATH=/bin:/usr/bin:/usr/ucb ; export PATH
+if test -f 'mailprio' -a "${1}" != "-c" ; then
+ echo shar: Will not clobber existing file \"'mailprio'\"
+else
+echo shar: Extracting \"'mailprio'\" \(3093 characters\)
+sed "s/^X//" >'mailprio' <<'END_OF_FILE'
+X#!/usr/bin/perl
+X#
+X# mailprio -- setup mail priorities for a mailing list
+X#
+X# Sort mailing list by mailprio database:
+X# mailprio < mailing-list > sorted_list
+X# Double check against orig:
+X# sort sorted_list > checkit; sort mailing-list | diff - checkit
+X# If it checks out, install it.
+X#
+X# TODO:
+X# option to process mqueue files so we can reorder files in the queue!
+X$usage = "Usage: mailprio [-p priodb]\n";
+X$home = "/home/sanders/lists";
+X$priodb = "$home/mailprio";
+X
+Xif ($main'ARGV[0] =~ /^-/) {
+X $args = shift;
+X if ($args =~ m/\?/) { print $usage; exit 0; }
+X if ($args =~ m/p/) {
+X $priodb = shift || die $usage, "-p requires argument\n"; }
+X}
+X
+X# In shell script, it goes something like this:
+X# old_mailprio > /tmp/a
+X# fgrep -f lists/inet-access /tmp/a | sed -e 's/^.......//' > /tmp/b
+X# ; /tmp/b contains list of known users, faster delivery first
+X# fgrep -v -f /tmp/b lists/inet-access > /tmp/c
+X# ; put all unknown stuff at the top of new list for now
+X# echo '# -----' >> /tmp/c
+X# cat /tmp/b >> /tmp/c
+X
+X# Setup %list and @list
+Xlocal($addr, $canon);
+Xwhile ($addr = <STDIN>) {
+X chop $addr;
+X next if $addr =~ /^# ----- /; # that's our line
+X push(@list, $addr), next if $addr =~ /^\s*#/; # save comments
+X $canon = &canonicalize((&simplify_address($addr))[0]);
+X unless (defined $canon) {
+X warn "no address found: $addr\n";
+X push(@list, $addr); # save it anyway
+X next;
+X }
+X if (defined $list{$canon}) {
+X warn "duplicate: ``$addr -> $canon''\n";
+X push(@list, $addr); # save it anyway
+X next;
+X }
+X $list{$canon} = $addr;
+X}
+X
+Xlocal(*prio);
+Xdbmopen(%prio, $priodb, 0644) || die "$priodb: $!\n";
+Xforeach $to (keys %list) {
+X if (defined $prio{$to}) {
+X # add to list of found users (%userprio) and remove from %list
+X # so that we know what users were not yet prioritized
+X $userprio{$to} = $prio{$to}; # priority
+X $useracct{$to} = $list{$to}; # string
+X delete $list{$to};
+X }
+X}
+Xdbmclose(%prio);
+X
+X# Put all the junk we found at the very top
+X# (this might not always be a feature)
+Xprint join("\n", @list), "\n";
+X
+X# unprioritized users go next, slow accounts will get moved down quickly
+Xprint '# ----- unprioritized users', "\n";
+Xforeach $to (keys %list) { print $list{$to}, "\n"; }
+X
+X# finally, our prioritized list of users
+Xprint '# ----- prioritized users', "\n";
+Xforeach $to (sort { $userprio{$a} <=> $userprio{$b}; } keys %userprio) {
+X die "Opps! Something is seriously wrong with useracct: $to\n"
+X unless defined $useracct{$to};
+X print $useracct{$to}, "\n";
+X}
+X
+Xexit(0);
+X
+X# REPL-LIB ---------------------------------------------------------------
+X
+Xsub canonicalize {
+X local($addr) = @_;
+X # lowercase, strip leading/trailing whitespace
+X $addr =~ y/A-Z/a-z/; $addr =~ s/^\s+//; $addr =~ s/\s+$//; $addr;
+X}
+X
+X# @addrs = simplify_address($addr);
+Xsub simplify_address {
+X local($_) = shift;
+X 1 while s/\([^\(\)]*\)//g; # strip comments
+X 1 while s/"[^"]*"//g; # strip comments
+X split(/,/); # split into parts
+X foreach (@_) {
+X 1 while s/.*<(.*)>.*/\1/;
+X s/^\s+//;
+X s/\s+$//;
+X }
+X @_;
+X}
+END_OF_FILE
+if test 3093 -ne `wc -c <'mailprio'`; then
+ echo shar: \"'mailprio'\" unpacked with wrong size!
+fi
+chmod +x 'mailprio'
+# end of 'mailprio'
+fi
+if test -f 'mailprio_mkdb' -a "${1}" != "-c" ; then
+ echo shar: Will not clobber existing file \"'mailprio_mkdb'\"
+else
+echo shar: Extracting \"'mailprio_mkdb'\" \(3504 characters\)
+sed "s/^X//" >'mailprio_mkdb' <<'END_OF_FILE'
+X#!/usr/bin/perl
+X#
+X# mailprio_mkdb -- make mail priority database based on delay times
+X#
+X$usage = "Usage: mailprio_mkdb [-l maillog] [-p priodb]\n";
+X$home = "/home/sanders/lists";
+X$maillog = "/var/log/maillog";
+X$priodb = "$home/mailprio";
+X
+Xif ($main'ARGV[0] =~ /^-/) {
+X $args = shift;
+X if ($args =~ m/\?/) { print $usage; exit 0; }
+X if ($args =~ m/l/) {
+X $maillog = shift || die $usage, "-l requires argument\n"; }
+X if ($args =~ m/p/) {
+X $priodb = shift || die $usage, "-p requires argument\n"; }
+X}
+X
+Xlocal(*prio);
+X# We'll merge with existing information if it's already there.
+Xdbmopen(%prio, $priodb, 0644) || die "$priodb: $!\n";
+X&getlog_stats($maillog, *prio);
+X# foreach $addr (sort { $prio{$a} <=> $prio{$b}; } keys %prio) {
+X# printf("%06d %s\n", $prio{$addr}, $addr); }
+Xdbmclose(%prio);
+Xexit(0);
+X
+Xsub getlog_stats {
+X local($maillog, *stats) = @_;
+X local($to, $delay);
+X local($h, $m, $s);
+X open(MAILLOG, "< $maillog") || die "$maillog: $!\n";
+X while (<MAILLOG>) {
+X ($delay) = (m/, delay=([^,]*), /);
+X $delay || next;
+X ($h, $m, $s) = split(/:/, $delay);
+X $delay = ($h * 60 * 60) + ($m * 60) + $s;
+X
+X # deleting everything after ", " seems safe enough, though
+X # it is possible that it was inside "..."'s and that we will
+X # miss some addresses because of it. However, I'm not willing
+X # to do full parsing just for that case. If this bothers you
+X # you could do something like: s/, (delay|ctladdr)=.*//;
+X # but you have to make sure you catch all the possible names.
+X $to = $_; $to =~ s/^.* to=//; $to =~ s/, .*//;
+X foreach $addr (&simplify_address($to)) {
+X next unless $addr;
+X $addr = &canonicalize($addr);
+X # print $delay, " ", $addr, "\n";
+X $stats{$addr} = $delay unless defined $stats{$addr}; # init
+X
+X # This average function moves the value around quite rapidly
+X # which may or may not be a feature.
+X #
+X # This has at least one odd behavior because we currently only
+X # use the delay information from maillog which is only logged
+X # on actual delivery. This works backwards from what we really
+X # want to happen when a fast host goes down for a while and then
+X # comes back up.
+X #
+X # I spoke with Eric and he suggested adding an xdelay statistic
+X # for a per transaction delay which would help that situation
+X # a lot. What I believe you want in that cases something like:
+X # delay fast, xdelay fast: smokin', these hosts go first
+X # delay slow, xdelay fast: put host high on the list (back up?)
+X # delay fast, xdelay slow: host is down/having problems/slow
+X # delay slow, xdelay slow: poorly connected sites, very last
+X # Of course, you have to reorder the distribution list fairly
+X # often for that to help. Come to think of it, you should
+X # also reorder /var/spool/mqueue files also (if they aren't
+X # locked of course). Hmmm....
+X $stats{$addr} = int(($stats{$addr} + $delay) / 2);
+X }
+X }
+X close(MAILLOG);
+X}
+X
+X# REPL-LIB ---------------------------------------------------------------
+X
+Xsub canonicalize {
+X local($addr) = @_;
+X # lowercase, strip leading/trailing whitespace
+X $addr =~ y/A-Z/a-z/; $addr =~ s/^\s+//; $addr =~ s/\s+$//; $addr;
+X}
+X
+X# @addrs = simplify_address($addr);
+Xsub simplify_address {
+X local($_) = shift;
+X 1 while s/\([^\(\)]*\)//g; # strip comments
+X 1 while s/"[^"]*"//g; # strip comments
+X split(/,/); # split into parts
+X foreach (@_) {
+X 1 while s/.*<(.*)>.*/\1/;
+X s/^\s+//;
+X s/\s+$//;
+X }
+X @_;
+X}
+END_OF_FILE
+if test 3504 -ne `wc -c <'mailprio_mkdb'`; then
+ echo shar: \"'mailprio_mkdb'\" unpacked with wrong size!
+fi
+chmod +x 'mailprio_mkdb'
+# end of 'mailprio_mkdb'
+fi
+echo shar: End of shell archive.
+exit 0
diff --git a/usr.sbin/sendmail/contrib/rmail.oldsys.patch b/usr.sbin/sendmail/contrib/rmail.oldsys.patch
new file mode 100644
index 0000000..856fcf1
--- /dev/null
+++ b/usr.sbin/sendmail/contrib/rmail.oldsys.patch
@@ -0,0 +1,108 @@
+From: Bill Gianopoulos <wag@sccux1.msd.ray.com>
+Message-Id: <199405191527.LAA03463@sccux1.msd.ray.com>
+Subject: Patch to rmail to elliminate need for snprintf
+To: sendmail@CS.Berkeley.EDU
+Date: Thu, 19 May 1994 11:27:16 -0400 (EDT)
+
+I have written the following patch to rmail which removes the requirement
+for snprintf while maintaining the protection from buffer overruns. It also
+fixes it to compile with compilers which don't understand ANSI function
+prototypes. Perhaps this should be included in the next version?
+
+*** rmail/rmail.c.orig Mon May 31 18:10:44 1993
+--- rmail/rmail.c Thu May 19 11:04:50 1994
+***************
+*** 78,86 ****
+--- 78,109 ----
+ #include <sysexits.h>
+ #include <unistd.h>
+
++ #ifdef __STDC__
+ void err __P((int, const char *, ...));
+ void usage __P((void));
++ #else
++ void err ();
++ void usage ();
++ #endif
+
++ #define strdup(s) strcpy(xalloc(strlen(s) + 1), s)
++
++ char *
++ xalloc(sz)
++ register int sz;
++ {
++ register char *p;
++
++ /* some systems can't handle size zero mallocs */
++ if (sz <= 0)
++ sz = 1;
++
++ p = malloc((unsigned) sz);
++ if (p == NULL)
++ err(EX_UNAVAILABLE, "Out of memory!!");
++ return (p);
++ }
++
+ int
+ main(argc, argv)
+ int argc;
+***************
+*** 230,250 ****
+ args[i++] = "-oi"; /* Ignore '.' on a line by itself. */
+
+ if (from_sys != NULL) { /* Set sender's host name. */
+! if (strchr(from_sys, '.') == NULL)
+! (void)snprintf(buf, sizeof(buf),
+ "-oMs%s.%s", from_sys, domain);
+! else
+! (void)snprintf(buf, sizeof(buf), "-oMs%s", from_sys);
+ if ((args[i++] = strdup(buf)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+ }
+ /* Set protocol used. */
+! (void)snprintf(buf, sizeof(buf), "-oMr%s", domain);
+ if ((args[i++] = strdup(buf)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+
+ /* Set name of ``from'' person. */
+! (void)snprintf(buf, sizeof(buf), "-f%s%s",
+ from_path ? from_path : "", from_user);
+ if ((args[i++] = strdup(buf)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+--- 253,285 ----
+ args[i++] = "-oi"; /* Ignore '.' on a line by itself. */
+
+ if (from_sys != NULL) { /* Set sender's host name. */
+! if (strchr(from_sys, '.') == NULL) {
+! if ((strlen(from_sys) + strlen(domain) + 6)
+! > sizeof(buf))
+! err(EX_DATAERR, "sender hostname too long");
+! (void)sprintf(buf,
+ "-oMs%s.%s", from_sys, domain);
+! }
+! else {
+! if ((strlen(from_sys) + 5) > sizeof(buf))
+! err(EX_DATAERR ,"sender hostname too long");
+! (void)sprintf(buf, "-oMs%s", from_sys);
+! }
+ if ((args[i++] = strdup(buf)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+ }
+ /* Set protocol used. */
+! if ((strlen(domain) + 5) > sizeof(buf))
+! err(EX_DATAERR, "protocol name too long");
+! (void)sprintf(buf, "-oMr%s", domain);
+ if ((args[i++] = strdup(buf)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+
+ /* Set name of ``from'' person. */
+! if (((from_path ? strlen(from_path) : 0) + strlen(from_user) + 3)
+! > sizeof(buf))
+! err(EX_DATAERR, "from address too long");
+! (void)sprintf(buf, "-f%s%s",
+ from_path ? from_path : "", from_user);
+ if ((args[i++] = strdup(buf)) == NULL)
+ err(EX_TEMPFAIL, NULL);
+--
+William A. Gianopoulos; Raytheon Missile Systems Division
+wag@sccux1.msd.ray.com
OpenPOWER on IntegriCloud