summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authoritojun <itojun@NetBSD.org>2000-07-23 14:07:40 +0000
committeritojun <itojun@NetBSD.org>2000-07-23 14:07:40 +0000
commit2ffe59611ddd4aa62ebf2dafb89fb03f98728fe7 (patch)
tree5444a4e7a09a2b5c3b478202c5d3601ec627cda7 /gnu
parent6f6272c9e909a1de1c73b25fcaf8c5421c0a6f28 (diff)
sendmail 8.11.0
Diffstat (limited to 'gnu')
-rw-r--r--gnu/dist/sendmail/cf/ostype/darwin.m417
-rw-r--r--gnu/dist/sendmail/contrib/bitdomain.c8
-rw-r--r--gnu/dist/sendmail/contrib/cidrexpand137
-rw-r--r--gnu/dist/sendmail/contrib/link_hash.sh36
-rw-r--r--gnu/dist/sendmail/contrib/movemail.conf35
-rw-r--r--gnu/dist/sendmail/contrib/movemail.pl106
-rwxr-xr-xgnu/dist/sendmail/contrib/passwd-to-alias.pl13
-rw-r--r--gnu/dist/sendmail/contrib/re-mqueue.pl32
-rwxr-xr-xgnu/dist/sendmail/contrib/smcontrol.pl2
-rw-r--r--gnu/dist/sendmail/devtools/OS/SunOS.5.919
-rw-r--r--gnu/dist/sendmail/smrsh/Makefile.m43
-rw-r--r--gnu/dist/sendmail/test/t_setuid.c2
-rw-r--r--gnu/dist/sendmail/test/t_snprintf.c24
13 files changed, 416 insertions, 18 deletions
diff --git a/gnu/dist/sendmail/cf/ostype/darwin.m4 b/gnu/dist/sendmail/cf/ostype/darwin.m4
new file mode 100644
index 00000000000..ccddbbc37e7
--- /dev/null
+++ b/gnu/dist/sendmail/cf/ostype/darwin.m4
@@ -0,0 +1,17 @@
+divert(-1)
+#
+# Copyright (c) 2000 Sendmail, Inc. and its suppliers.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set
+# forth in the LICENSE file which can be found at the top level of
+# the sendmail distribution.
+#
+#
+#
+
+divert(0)
+VERSIONID(`Id: darwin.m4,v 8.1.2.1 2000/06/15 06:37:04 gshapiro Exp')
+ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')')dnl
+ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/libexec/mail.local)')dnl
+ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -z -a$g $h!rmail ($u)')')dnl
diff --git a/gnu/dist/sendmail/contrib/bitdomain.c b/gnu/dist/sendmail/contrib/bitdomain.c
index 28fe287cd95..0b7073d3921 100644
--- a/gnu/dist/sendmail/contrib/bitdomain.c
+++ b/gnu/dist/sendmail/contrib/bitdomain.c
@@ -51,7 +51,7 @@ char **argv;
{
int opt;
- while ((opt = getopt(argc, argv, "o:")) != EOF) {
+ while ((opt = getopt(argc, argv, "o:")) != -1) {
switch (opt) {
case 'o':
if (!freopen(optarg, "w", stdout)) {
@@ -187,7 +187,7 @@ char *domainlen;
case NO_DATA:
err = "registered in DNS, but not mailable";
break;
-
+
default:
err = "unknown nameserver error";
break;
@@ -210,7 +210,7 @@ valhost(host, hbsize)
int hbsize;
{
register u_char *eom, *ap;
- register int n;
+ register int n;
HEADER *hp;
querybuf answer;
int ancount, qdcount;
@@ -406,4 +406,4 @@ finish()
}
}
}
-
+
diff --git a/gnu/dist/sendmail/contrib/cidrexpand b/gnu/dist/sendmail/contrib/cidrexpand
new file mode 100644
index 00000000000..b61fc2e38c6
--- /dev/null
+++ b/gnu/dist/sendmail/contrib/cidrexpand
@@ -0,0 +1,137 @@
+#!/usr/local/bin/perl -w
+
+# v 0.2-very-very-beta
+#
+# 17 July 2000 Derek J. Balling (dredd@megacity.org)
+#
+# The $SENDMAIL flag tells the code to lump networks in sendmail format
+# if applicable. If this flag is disabled, cidrexpand will literally create
+# a single line for each entry, which may or may not be what you want. :)
+# makes for a rather large hash table...
+#
+# Acts as a preparser on /etc/mail/access_db to allow you to use address/bit
+# notation. Caveat: the address portion MUST be the start address or your
+# results will NOT be what what you want.
+#
+#
+# usage:
+# cidrexpand < /etc/mail/access | makemap hash /etc/mail/access
+#
+#
+# Report bugs to: dredd@megacity.org
+#
+
+my $spaceregex = '\s+';
+
+while (my $arg = shift @ARGV)
+{
+ if ($arg eq '-t')
+ {
+ $spaceregex = shift;
+ }
+}
+
+use strict;
+
+my $SENDMAIL = 1;
+
+while (<>)
+{
+ my ($left,$right,$space);
+
+ if (! /^(\d+\.){3}\d+\/\d\d?$spaceregex.*/ )
+ {
+ print;
+ }
+ else
+ {
+ ($left,$space,$right) = /^((?:\d+\.){3}\d+\/\d\d?)($spaceregex)(.*)$/;
+
+ my @new_lefts = expand_network($left);
+ foreach my $nl (@new_lefts)
+ {
+ print "$nl$space$right\n";
+ }
+
+ }
+}
+
+sub expand_network
+{
+ my ($network,$mask) = split /\//, shift;
+ my @diffs = calc_changes($network,$mask);
+ my ($first,$second,$third,$fourth) = split /\./, $network;
+
+ my @rc = ();
+
+ for my $f ($first..($first+$diffs[0]))
+ {
+ if ( ( $SENDMAIL ) and ($diffs[1] == 255))
+ {
+ push @rc, "$f";
+ }
+ else
+ {
+ for my $s ($second..($second+$diffs[1]))
+ {
+ if ( ($SENDMAIL) and ($diffs[2] == 255) )
+ {
+ push @rc,"$f\.$s";
+ }
+ else
+ {
+ for my $t ($third..($third+$diffs[2]))
+ {
+ if ( ($SENDMAIL) and ($diffs[3] == 255))
+ {
+ push @rc, "$f\.$s\.$t";
+ }
+ else
+ {
+ for my $fr ($fourth..($fourth+$diffs[3]))
+ {
+ push @rc, "$f\.$s\.$t\.$fr";
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return @rc;
+}
+
+sub calc_changes
+{
+ my ($network,$mask) = @_;
+
+ my @octs = split /\./, $network;
+
+ my ($first,$second,$third,$fourth) = (0,0,0,0);
+
+ my $power = 32 - $mask;
+
+ if ($mask > 24)
+ {
+ $fourth = 2**$power - 1;
+ }
+ elsif ($mask > 16)
+ {
+ $fourth = 255;
+ $third = 2**($power-8) - 1;
+ }
+ elsif ($mask > 8)
+ {
+ $fourth = 255;
+ $third = 255;
+ $second = 2**($power-16) - 1;
+ }
+ elsif ($mask > 0)
+ {
+ $fourth = 255;
+ $third = 255;
+ $second = 255;
+ $first = 2**($power-24) - 1;
+ }
+ return ($first,$second,$third,$fourth);
+}
diff --git a/gnu/dist/sendmail/contrib/link_hash.sh b/gnu/dist/sendmail/contrib/link_hash.sh
new file mode 100644
index 00000000000..21f1c2cfc9a
--- /dev/null
+++ b/gnu/dist/sendmail/contrib/link_hash.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+##
+## Copyright (c) 2000 Sendmail, Inc. and its suppliers.
+## All rights reserved.
+##
+## Id: link_hash.sh,v 1.1.2.1 2000/04/25 00:10:47 ca Exp
+##
+#
+# ln a certificate to its hash
+#
+SSL=openssl
+if test $# -ge 1
+then
+ for i in $@
+ do
+ C=$i.pem
+ test -f $C || C=$i
+ if test -f $C
+ then
+ H=`$SSL x509 -noout -hash < $C`.0
+ if test -h $H -o -f $H
+ then
+ echo link $H to $C exists
+ else
+ ln -s $C $H
+ fi
+ else
+ echo "$0: cannot open $C"
+ exit 2
+ fi
+ done
+else
+ echo "$0: missing name"
+ exit 1
+fi
+exit 0
diff --git a/gnu/dist/sendmail/contrib/movemail.conf b/gnu/dist/sendmail/contrib/movemail.conf
new file mode 100644
index 00000000000..17009b81b0e
--- /dev/null
+++ b/gnu/dist/sendmail/contrib/movemail.conf
@@ -0,0 +1,35 @@
+# Configuration script for movemail.pl
+
+my $minutes = 60;
+my $hours = 3600;
+
+# Queue directories first..last
+
+@queues = qw(
+ /var/spool/mqueue/q1
+ /var/spool/mqueue/q2
+ /var/spool/mqueue/q3
+);
+
+# Base of subqueue name (optional).
+# If used, queue directories are $queues[n]/$subqbase*
+# Separate qf/df/xf directories are not supported.
+
+$subqbase = "subq";
+
+# Age of mail when moved. Each element of the array must be greater than the
+# previous element.
+
+@ages = (
+ 30*$minutes, # q1 to q2
+ 6*$hours # q2 to q3
+);
+
+# Location of script to move the mail
+
+$remqueue = "/usr/local/bin/re-mqueue.pl";
+
+# Lock file to prevent more than one instance running (optional)
+# Useful when running from cron
+
+$lockfile = "/var/spool/mqueue/movemail.lock";
diff --git a/gnu/dist/sendmail/contrib/movemail.pl b/gnu/dist/sendmail/contrib/movemail.pl
new file mode 100644
index 00000000000..86bcb20118e
--- /dev/null
+++ b/gnu/dist/sendmail/contrib/movemail.pl
@@ -0,0 +1,106 @@
+#!/usr/bin/perl -w
+#
+# Move old mail messages between queues by calling re-mqueue.pl.
+#
+# movemail.pl [config-script]
+#
+# Default config script is /usr/local/etc/movemail.conf.
+#
+# Graeme Hewson <graeme.hewson@oracle.com>, June 2000
+#
+
+use strict;
+
+# Load external program as subroutine to avoid
+# compilation overhead on each call
+
+sub loadsub {
+ my $fn = shift
+ or die "Filename not specified";
+ my $len = (stat($fn))[7]
+ or die "Can't stat $fn: $!";
+ open PROG, "< $fn"
+ or die "Can't open $fn: $!";
+ my $prog;
+ read PROG, $prog, $len
+ or die "Can't read $fn: $!";
+ close PROG;
+ eval join "",
+ 'return sub { my @ARGV = @_; $0 = $fn; no strict;',
+ "$prog",
+ '};';
+}
+
+my $progname = $0;
+my $lastage = -1;
+my $LOCK_EX = 2;
+my $LOCK_NB = 4;
+
+# Load and eval config script
+
+my $conffile = shift || "/usr/local/etc/movemail.conf";
+my $len = (stat($conffile))[7]
+ or die "Can't stat $conffile: $!";
+open CONF, "< $conffile"
+ or die "Can't open $conffile: $!";
+my $conf;
+read CONF, $conf, $len
+ or die "Can't read $conffile: $!";
+close CONF;
+use vars qw(@queues $subqbase @ages $remqueue $lockfile);
+eval $conf;
+
+if ($#queues < 1) {
+ print "$progname: there must be at least two queues\n";
+ exit 1;
+}
+
+if ($#ages != ($#queues - 1)) {
+ print "$progname: wrong number of ages (should be one less than number of queues)\n";
+ exit 1;
+}
+
+# Get lock or exit quietly. Useful when running from cron.
+
+if ($lockfile) {
+ open LOCK, ">>$lockfile"
+ or die "Can't open lock file: $!";
+ unless (flock LOCK, $LOCK_EX|$LOCK_NB) {
+ close LOCK;
+ exit 0;
+ }
+}
+
+my $remsub = loadsub($remqueue);
+
+# Go through directories in reverse order so as to check spool files only once
+
+for (my $n = $#queues - 1; $n >= 0; $n--) {
+ unless ($ages[$n] =~ /^\d+$/) {
+ print "$progname: invalid number $ages[$n] in ages array\n";
+ exit 1;
+ }
+ unless ($lastage < 0 || $ages[$n] < $lastage) {
+ print "$progname: age $lastage is not > previous value $ages[$n]\n";
+ exit 1;
+ }
+ $lastage = $ages[$n];
+ if ($subqbase) {
+ my $subdir;
+ opendir(DIR, $queues[$n])
+ or die "Can't open $queues[$n]: $!";
+ foreach $subdir ( grep { /^$subqbase/ } readdir DIR) {
+ &$remsub("$queues[$n]/$subdir", "$queues[$n+1]/$subdir",
+ $ages[$n]);
+ }
+ closedir(DIR);
+ } else {
+ # Not using subdirectories
+ &$remsub($queues[$n], $queues[$n+1], $ages[$n]);
+ }
+}
+
+if ($lockfile) {
+ unlink $lockfile;
+ close LOCK;
+}
diff --git a/gnu/dist/sendmail/contrib/passwd-to-alias.pl b/gnu/dist/sendmail/contrib/passwd-to-alias.pl
index 05a51b93496..24bb7a1c544 100755
--- a/gnu/dist/sendmail/contrib/passwd-to-alias.pl
+++ b/gnu/dist/sendmail/contrib/passwd-to-alias.pl
@@ -8,22 +8,23 @@
print "# Generated from passwd by $0\n";
+$wordpat = '([a-zA-Z]+?[a-zA-Z0-9-]*)?[a-zA-Z0-9]'; # 'DB2'
while (@a = getpwent) {
($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = @a;
($fullname = $gcos) =~ s/,.*$//;
- if (!-d $dir || !-x $shell) {
- print "$name: root\n";
+ if (!-d $dir || !-x $shell || $shell =~ m!/bin/(false|true)$!) {
+ print "$name: root\n"; # handle pseudo user
}
$fullname =~ s/\.*[ _]+\.*/./g;
- $fullname =~ tr [åäöÅÄÖé] [aaoAAOe]; # <hakan@af.lu.se> 1997-06-15
- if ($fullname =~ /^[a-zA-Z][a-zA-Z-]+(\.[a-zA-Z][a-zA-Z-]+)+$/) {
-# if ($fullname =~ /^[a-zA-Z]+(\.[a-zA-Z]+)+$/) { # Kari E. Hurtta
+ $fullname =~ tr [åäéöüÅÄÖÜ] [aaeouAAOU]; # <hakan@af.lu.se> 1997-06-15
+ next if (!$fullname || lc($fullname) eq $name); # avoid nonsense
+ if ($fullname =~ /^$wordpat(\.$wordpat)*$/o) { # Ulrich Windl
print "$fullname: $name\n";
} else {
- print "# $fullname: $name\n";
+ print "# $fullname: $name\n"; # avoid strange names
}
};
diff --git a/gnu/dist/sendmail/contrib/re-mqueue.pl b/gnu/dist/sendmail/contrib/re-mqueue.pl
index d2af5144b89..9f8d819eb18 100644
--- a/gnu/dist/sendmail/contrib/re-mqueue.pl
+++ b/gnu/dist/sendmail/contrib/re-mqueue.pl
@@ -93,6 +93,17 @@
# Allow zero-length df files (empty message body)
# Preserve $! for error messages
#
+# Updated by Graeme Hewson <ghewson@uk.oracle.com> April 2000
+#
+# Improve handling of race between re-mqueue and sendmail
+#
+# Updated by Graeme Hewson <graeme.hewson@oracle.com> June 2000
+#
+# Don't exit(0) at end so can be called as subroutine
+#
+# NB This program can't handle separate qf/df/xf subdirectories
+# as introduced in sendmail 8.10.0.
+#
use Sys::Syslog;
@@ -136,18 +147,17 @@ while ($dfile = pop(@dfiles)) {
($qfile = $dfile) =~ s/^d/q/;
($xfile = $dfile) =~ s/^d/x/;
($mfile = $dfile) =~ s/^df//;
- if (! -e $dfile) {
- print "$dfile is gone - skipping\n" if ($debug);
- next;
- }
if (! -e $qfile || -z $qfile) {
print "$qfile is gone or zero bytes - skipping\n" if ($debug);
next;
}
- $mtime = $now;
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = stat($dfile);
+ if (! defined $mtime) {
+ print "$dfile is gone - skipping\n" if ($debug);
+ next;
+ }
# Compare timestamps
if (($mtime + $age) > $now) {
@@ -182,6 +192,17 @@ while ($dfile = pop(@dfiles)) {
}
print "$qfile now flock()ed\n" if ($debug);
+ # Check df* file again in case sendmail got in
+ if (! -e $dfile) {
+ print "$mfile sent - skipping\n" if ($debug);
+ # qf* file created by ourselves at open? (Almost certainly)
+ if (-z $qfile) {
+ unlink($qfile);
+ }
+ close(QF);
+ next;
+ }
+
# Show time! Do the link()s
if (link("$dfile", "$queueB/$dfile") == 0) {
$bang = $!;
@@ -235,4 +256,3 @@ while ($dfile = pop(@dfiles)) {
&syslog('info', '%s moved to %s', $mfile, $queueB);
print "Done with $dfile $qfile\n\n" if ($debug);
}
-exit 0;
diff --git a/gnu/dist/sendmail/contrib/smcontrol.pl b/gnu/dist/sendmail/contrib/smcontrol.pl
index 58b5d7c2855..3ecfee1dc49 100755
--- a/gnu/dist/sendmail/contrib/smcontrol.pl
+++ b/gnu/dist/sendmail/contrib/smcontrol.pl
@@ -162,7 +162,7 @@ sub munge_status
my $cooked = "";
my $daemonStatus = "";
- if ($raw =~ /^(\d+)\/(\d+)\/(\d+)\/(\d+)$/mg)
+ if ($raw =~ /^(\d+)\/(\d+)\/(\d+)\/(\d+)/mg)
{
$cooked .= "Current number of children: $1";
if ($2 > 0)
diff --git a/gnu/dist/sendmail/devtools/OS/SunOS.5.9 b/gnu/dist/sendmail/devtools/OS/SunOS.5.9
new file mode 100644
index 00000000000..4df9673a1c1
--- /dev/null
+++ b/gnu/dist/sendmail/devtools/OS/SunOS.5.9
@@ -0,0 +1,19 @@
+# Id: SunOS.5.9,v 8.1.2.1 2000/07/14 04:27:07 gshapiro Exp
+define(`confCC', `gcc')
+define(`confBEFORE', `sysexits.h')
+define(`confMAPDEF', `-DNDBM -DNIS -DNISPLUS -DMAP_REGEX -DLDAPMAP')
+define(`confENVDEF', `-DSOLARIS=20900')
+define(`confLIBS', `-lsocket -lnsl -lldap')
+define(`confMTLDOPTS', `-lpthread')
+define(`confMBINDIR', `/usr/lib')
+define(`confEBINDIR', `/usr/lib')
+define(`confSBINGRP', `sys')
+define(`confINSTALL', `${BUILDBIN}/install.sh')
+define(`confDEPEND_TYPE', `CC-M')
+PUSHDIVERT(3)
+sysexits.h:
+ if [ -r /usr/include/sysexits.h ]; \
+ then \
+ ln -s /usr/include/sysexits.h; \
+ fi
+POPDIVERT
diff --git a/gnu/dist/sendmail/smrsh/Makefile.m4 b/gnu/dist/sendmail/smrsh/Makefile.m4
index 2174431577a..7e4718ffa62 100644
--- a/gnu/dist/sendmail/smrsh/Makefile.m4
+++ b/gnu/dist/sendmail/smrsh/Makefile.m4
@@ -1,6 +1,9 @@
include(confBUILDTOOLSDIR`/M4/switch.m4')
+# sendmail dir
+SMSRCDIR= ifdef(`confSMSRCDIR', `confSMSRCDIR', `${SRCDIR}/sendmail')
PREPENDDEF(`confENVDEF', `confMAPDEF')
+PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ')
bldPRODUCT_START(`executable', `smrsh')
define(`bldINSTALL_DIR', `E')
diff --git a/gnu/dist/sendmail/test/t_setuid.c b/gnu/dist/sendmail/test/t_setuid.c
index 55628dee426..f3cf5f871bc 100644
--- a/gnu/dist/sendmail/test/t_setuid.c
+++ b/gnu/dist/sendmail/test/t_setuid.c
@@ -15,7 +15,7 @@
#include <stdio.h>
#ifndef lint
-static char id[] = "@(#)Id: t_setuid.c,v 8.2.4.1 2000/05/31 00:34:30 gshapiro Exp";
+static char id[] = "@(#)Id: t_setuid.c,v 8.2.2.1 2000/05/31 00:29:47 gshapiro Exp";
#endif /* ! lint */
static void
diff --git a/gnu/dist/sendmail/test/t_snprintf.c b/gnu/dist/sendmail/test/t_snprintf.c
new file mode 100644
index 00000000000..4789f4974f0
--- /dev/null
+++ b/gnu/dist/sendmail/test/t_snprintf.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <sysexits.h>
+
+#define TEST_STRING "1234567890"
+
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ int r;
+ char buf[5];
+
+ r = snprintf(buf, sizeof buf, "%s", TEST_STRING);
+
+ if (buf[sizeof buf - 1] != '\0')
+ {
+ fprintf(stderr, "Add the following to devtools/Site/site.config.m4:\n\n");
+ fprintf(stderr, "APPENDDEF(`confENVDEF', `-DSNPRINTF_IS_BROKEN=1')\n\n");
+ exit(EX_OSERR);
+ }
+ fprintf(stderr, "snprintf() appears to work properly\n");
+ exit(EX_OK);
+}