summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/contrib
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2002-04-10 03:05:00 +0000
committergshapiro <gshapiro@FreeBSD.org>2002-04-10 03:05:00 +0000
commit9e3bd35cd79720a6547b183a6a6fb97ab1ae7b84 (patch)
tree348e6162af337e0b74db963f6e4dcc567e2f99e9 /contrib/sendmail/contrib
parent1a7e50d796833cbb4346a251bc88555ea2c58e94 (diff)
downloadFreeBSD-src-9e3bd35cd79720a6547b183a6a6fb97ab1ae7b84.zip
FreeBSD-src-9e3bd35cd79720a6547b183a6a6fb97ab1ae7b84.tar.gz
Import sendmail 8.12.3
Diffstat (limited to 'contrib/sendmail/contrib')
-rwxr-xr-xcontrib/sendmail/contrib/buildvirtuser15
-rw-r--r--contrib/sendmail/contrib/qtool.811
-rwxr-xr-xcontrib/sendmail/contrib/qtool.pl35
-rwxr-xr-xcontrib/sendmail/contrib/smcontrol.pl44
4 files changed, 90 insertions, 15 deletions
diff --git a/contrib/sendmail/contrib/buildvirtuser b/contrib/sendmail/contrib/buildvirtuser
index 2fe469b..dcf6d44 100755
--- a/contrib/sendmail/contrib/buildvirtuser
+++ b/contrib/sendmail/contrib/buildvirtuser
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
-# Copyright (c) 1999-2001 Gregory Neil Shapiro. All Rights Reserved.
+# Copyright (c) 1999-2002 Gregory Neil Shapiro. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -27,7 +27,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
-# $Id: buildvirtuser,v 1.3 2001/02/12 02:58:20 gshapiro Exp $
+# $Id: buildvirtuser,v 1.5 2002/02/08 08:10:59 gshapiro Exp $
=head1 NAME
@@ -35,7 +35,7 @@ buildvirtuser - Build virtusertable support from a directory of files
=head1 SYNOPSIS
- buildvirtuser
+ buildvirtuser [-f]
=head1 DESCRIPTION
@@ -50,6 +50,9 @@ $DOMAIN in the file are replaced by the current domain being processed.
Occurrences of $LHS in the right hand side are replaced by the address on
the left hand side.
+The -f option forces the database to be rebuilt regardless of whether
+any file changes were detected.
+
=head1 CONFIGURATION
In order to function properly, sendmail must be configured to use these
@@ -96,6 +99,7 @@ Gregory Neil Shapiro E<lt>F<gshapiro@gshapiro.net>E<gt>
=cut
use strict;
+use Getopt::Std;
my $makemap = "/usr/sbin/makemap";
my $dbtype = "hash";
@@ -108,6 +112,9 @@ my $virt = "$maildir/virtusertable.db";
my %virt = ();
my $newest = 0;
my ($lhs, $domain, $key, $value);
+my $opts = {};
+
+getopts('f', $opts) || die "Usage: $0 [-f]\n";
opendir(VIRTS, $virts) || die "Could not open directory $virts: $!\n";
my @virts = grep { -f "$virts/$_" } readdir(VIRTS);
@@ -157,7 +164,7 @@ LINE: while (<DOMAIN>)
}
my $virtmtime = (stat($virt))[9] || 0;
-if ($virtmtime < $newest)
+if ($opts->{f} || $virtmtime < $newest)
{
print STDOUT "Rebuilding $virt\n";
# logger -s -t ${prog} -p mail.info "Rebuilding ${basedir}/virtusertable"
diff --git a/contrib/sendmail/contrib/qtool.8 b/contrib/sendmail/contrib/qtool.8
index 5c40142..fbc90fac 100644
--- a/contrib/sendmail/contrib/qtool.8
+++ b/contrib/sendmail/contrib/qtool.8
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1999, 2001 Sendmail, Inc. and its suppliers.
+.\" Copyright (c) 1999, 2001-2002 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\"
.\" By using this file, you agree to the terms and conditions set
@@ -6,9 +6,9 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: qtool.8,v 8.16 2001/11/21 19:21:20 gshapiro Exp $
+.\" $Id: qtool.8,v 8.17 2002/01/29 21:55:49 ca Exp $
.\"
-.TH QTOOL 8 "$Date: 2001/11/21 19:21:20 $"
+.TH QTOOL 8 "$Date: 2002/01/29 21:55:49 $"
.SH NAME
qtool
\- manipulate sendmail queues
@@ -25,6 +25,11 @@ source [source ...]
moves the queue files used by sendmail between queues. It uses the same
locking mechanism as sendmail so can be safely used while sendmail is
running.
+However, it should not be used when queue groups have been configured
+to move queue files into directories to which they do not belong according
+to the queue group selections made in the sendmail.cf file.
+Unless you are absolutely sure you do not interfere with the queue group
+selection mechanism, do not move queue files around.
.PP
With no options,
.B qtool
diff --git a/contrib/sendmail/contrib/qtool.pl b/contrib/sendmail/contrib/qtool.pl
index d93f743a..08f808b 100755
--- a/contrib/sendmail/contrib/qtool.pl
+++ b/contrib/sendmail/contrib/qtool.pl
@@ -1,9 +1,9 @@
#!/usr/bin/env perl
##
-## Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+## Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
## All rights reserved.
##
-## $Id: qtool.pl,v 8.26 2001/11/21 19:26:17 gshapiro Exp $
+## $Id: qtool.pl,v 8.27 2002/01/29 21:55:49 ca Exp $
##
use strict;
use File::Basename;
@@ -18,6 +18,11 @@ use Getopt::Std;
## pretty similar to just moving the files manually, but it locks the files
## the same way sendmail does to prevent problems.
##
+## NOTICE: Do not use this program to move queue files around
+## if you use sendmail 8.12 and multiple queue groups. It may interfere
+## with sendmail's internal queue group selection strategy and can cause
+## mail to be not delivered.
+##
## The syntax is the reverse of mv (ie. the target argument comes
## first). This lets you pick the files you want to move using find and
## xargs.
@@ -62,6 +67,7 @@ my $result;
my $action;
my $new_condition;
my $qprefix;
+my $queuegroups = 0;
my $conditions = new Compound();
Getopt::Std::getopts('bC:de:Qs:', \%opts);
@@ -147,6 +153,10 @@ my $queue_root;
my $line;
open(CONFIG_FILE, $config_file) or die "$config_file: $!";
+
+ ## Notice: we can only break out of this loop (using last)
+ ## when both entries (queue directory and group group)
+ ## have been found.
while ($line = <CONFIG_FILE>)
{
chomp $line;
@@ -157,7 +167,26 @@ my $queue_root;
{
$queue_root = $1;
}
- last;
+ # found also queue groups?
+ if ($queuegroups)
+ {
+ last;
+ }
+ }
+ if ($line =~ m/^Q.*/)
+ {
+ $queuegroups = 1;
+ if ($action == \&move_action)
+ {
+ print("WARNING: moving queue files around " .
+ "when queue groups are used may\n" .
+ "result in undelivered mail!\n");
+ }
+ # found also queue directory?
+ if (defined $queue_root)
+ {
+ last;
+ }
}
}
close(CONFIG_FILE);
diff --git a/contrib/sendmail/contrib/smcontrol.pl b/contrib/sendmail/contrib/smcontrol.pl
index 3ecfee1..a69fb27 100755
--- a/contrib/sendmail/contrib/smcontrol.pl
+++ b/contrib/sendmail/contrib/smcontrol.pl
@@ -1,9 +1,11 @@
#!/usr/local/bin/perl -w
+use strict;
+use Getopt::Std;
use FileHandle;
use Socket;
-$sendmailDaemon = "/usr/sbin/sendmail -q30m -bd";
+my $sendmailDaemon = "/usr/sbin/sendmail -q30m -bd";
##########################################################################
#
@@ -70,6 +72,7 @@ sub do_command
my $command = shift;
my $proto = getprotobyname('ip');
my @reply;
+ my $i;
socket(SOCK, PF_UNIX, SOCK_STREAM, $proto) or return undef;
@@ -216,7 +219,7 @@ sub start_daemon
}
elsif (defined $pid)
{
- exec($main::sendmailDaemon);
+ exec($sendmailDaemon);
die "Unable to start sendmail daemon: $!.\n";
}
else
@@ -274,6 +277,29 @@ sub restart_daemon
##########################################################################
#
+# &memdump -- get memdump from the daemon using the control socket
+#
+# Parameters:
+# control -- control socket name
+#
+# Returns:
+# Error message or status message
+#
+
+sub memdump
+{
+ my $control = shift;
+ my $status;
+
+ if (not defined $control)
+ {
+ return "The control socket is not configured so the daemon can not be queried for memdump.";
+ }
+ return &do_command($control, "MEMDUMP");
+}
+
+##########################################################################
+#
# &help -- get help from the daemon using the control socket
#
# Parameters:
@@ -295,10 +321,14 @@ sub help
return &do_command($control, "HELP");
}
-my $command = shift;
-my $control = &get_controlname;
my $status = undef;
my $daemonStatus = undef;
+my $opts = {};
+
+getopts('f:', $opts) || die "Usage: $0 [-f /path/to/control/socket] command\n";
+
+my $control = $opts->{f} || &get_controlname;
+my $command = shift;
if (not defined $control)
{
@@ -306,7 +336,7 @@ if (not defined $control)
}
if (not defined $command)
{
- die "Usage: $0 command\n";
+ die "Usage: $0 [-f /path/to/control/socket] command\n";
}
if ($command eq "status")
{
@@ -341,6 +371,10 @@ elsif (lc($command) eq "start")
{
$status = &start_daemon($control);
}
+elsif (lc($command) eq "memdump")
+{
+ $status = &memdump($control);
+}
elsif (lc($command) eq "help")
{
$status = &help($control);
OpenPOWER on IntegriCloud