summaryrefslogtreecommitdiff
path: root/gnu/usr.sbin/sendmail/contrib
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-04-18 00:49:30 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-04-18 00:49:30 +0000
commit3001c6f5135796bf49346dd969e8445342d2251b (patch)
treed710aec0cc173e2b9a67ff56f56f47a1f3b32bc0 /gnu/usr.sbin/sendmail/contrib
parent7bc62683b217ae48e11df50f14c39728b723a832 (diff)
update to sendmail 8.12.3
Diffstat (limited to 'gnu/usr.sbin/sendmail/contrib')
-rw-r--r--gnu/usr.sbin/sendmail/contrib/buildvirtuser15
-rw-r--r--gnu/usr.sbin/sendmail/contrib/qtool.811
-rw-r--r--gnu/usr.sbin/sendmail/contrib/qtool.pl35
-rw-r--r--gnu/usr.sbin/sendmail/contrib/smcontrol.pl46
4 files changed, 91 insertions, 16 deletions
diff --git a/gnu/usr.sbin/sendmail/contrib/buildvirtuser b/gnu/usr.sbin/sendmail/contrib/buildvirtuser
index da606c69bdf..9b534d2f51d 100644
--- a/gnu/usr.sbin/sendmail/contrib/buildvirtuser
+++ b/gnu/usr.sbin/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.
-# $Sendmail: buildvirtuser,v 1.3 2001/02/12 02:58:20 gshapiro Exp $
+# $Sendmail: 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/gnu/usr.sbin/sendmail/contrib/qtool.8 b/gnu/usr.sbin/sendmail/contrib/qtool.8
index fc0c847c96b..6497f7be11f 100644
--- a/gnu/usr.sbin/sendmail/contrib/qtool.8
+++ b/gnu/usr.sbin/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.
.\"
.\"
-.\" $Sendmail: qtool.8,v 8.16 2001/11/21 19:21:20 gshapiro Exp $
+.\" $Sendmail: qtool.8,v 8.17 2002/01/29 21:55:49 ca Exp $
.\"
-.TH QTOOL 8 "$Date: 2002/01/14 03:21:39 $"
+.TH QTOOL 8 "$Date: 2002/04/18 00:49:26 $"
.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/gnu/usr.sbin/sendmail/contrib/qtool.pl b/gnu/usr.sbin/sendmail/contrib/qtool.pl
index 14211349775..6854e857076 100644
--- a/gnu/usr.sbin/sendmail/contrib/qtool.pl
+++ b/gnu/usr.sbin/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.
##
-## $Sendmail: qtool.pl,v 8.26 2001/11/21 19:26:17 gshapiro Exp $
+## $Sendmail: 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/gnu/usr.sbin/sendmail/contrib/smcontrol.pl b/gnu/usr.sbin/sendmail/contrib/smcontrol.pl
index 58b5d7c2855..a69fb278ea4 100644
--- a/gnu/usr.sbin/sendmail/contrib/smcontrol.pl
+++ b/gnu/usr.sbin/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;
@@ -162,7 +165,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)
@@ -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);