2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-30 05:38:06 +00:00

snapshot-20010524

This commit is contained in:
Wietse Venema 2001-05-24 00:00:00 -05:00 committed by Viktor Dukhovni
parent 92370560ec
commit ca0dd40ea2
12 changed files with 805 additions and 408 deletions

View File

@ -5187,13 +5187,18 @@ Apologies for any names omitted.
20010522
Feature: "postsuper -r queueID" re-queues a message. The
message is moved to the maildrop queue so that the pickup
daemon will copy it to a new file with the "right" name
that matches the queue file inode number, and so that
address rewriting will be done again. This is useful after
changes of address rewriting or virtual mappings.
Feature: "postsuper -r queueID" re-queues a message, and
"postsuper -R" re-queues all mail. The message is moved to
the maildrop queue so that the pickup daemon will copy it
to a new queue file, and so that address rewriting will be
done again. This is useful after changes of address rewriting
or virtual mappings.
Feature: "postsuper -R" re-queues all mail. This is useful
after restoring a Postfix queue from another machine, or
from backup.
20010523
Feature: "postsuper -s" (which is done by default) renames
queue files whose queue ID does not match the message file
inode number.
Bugfix: memory leak in the LDAP client module. Alain
Thivillon,France Teaser - Groupe Firstream.

View File

@ -12,20 +12,22 @@ server state just like RSET. This behavior cannot be disabled.
Major changes with snapshot-20010522
====================================
Revision of some fine details in the light of the new RFC 2821 and
RFC 2822 standards. Changes that may affect interoperability are
listed above under "incompatible changes".
This release contains revisions of some fine details in the light
of the new RFC 2821 and RFC 2822 standards. Changes that may affect
interoperability are listed above under "incompatible changes".
The postsuper tool can rename files whose queue ID does not match
the queue file inode number. This is necessary when a Postfix mail
queue is restored from another machine or from backups. The feature
is selected with the -s option, which is the default.
The postsuper queue maintenance tool was extended with options to
read queue IDs from standard input (which makes it easier to drive
the tool from scripts).
read queue IDs from standard input. This makes the tool easier to
drive from scripts.
The postsuper queue maintenance tool has a new -r (requeue) option
for subjecting queue files to another iteration of address rewriting.
The postsuper -R option requeues all mail. This is necessary after
restoring Postfix queues from another machine or from backups.
Major changes with snapshot-20010502
====================================

View File

@ -174,9 +174,6 @@ check)
\( -perm -020 -o -perm -002 \) \
-exec $WARN group or other writable: {} \;
find $queue_directory/* $config_directory/* -name '*core' \
-exec $WARN core file: {} \; 2>/dev/null
test -d maildrop || {
$WARN creating missing Postfix maildrop directory
mkdir maildrop || exit 1
@ -254,10 +251,11 @@ EOF
$command_directory/postconf -e hash_queue_names="$found$missing"
}
# See if all queue files are in the right place.
# See if all queue files are in the right place. This is slow.
# We must scan all queues for mis-named queue files before the
# mail system can run.
$command_directory/postsuper active
$command_directory/postsuper &
$command_directory/postsuper || exit 1
find corrupt -type f -exec $WARN damaged message: {} \;

View File

@ -174,9 +174,6 @@ check)
\( -perm -020 -o -perm -002 \) \
-exec $WARN group or other writable: {} \;
find $queue_directory/* $config_directory/* -name '*core' \
-exec $WARN core file: {} \; 2>/dev/null
test -d maildrop || {
$WARN creating missing Postfix maildrop directory
mkdir maildrop || exit 1
@ -255,10 +252,11 @@ EOF
$command_directory/postconf -e hash_queue_names="$found$missing"
}
# See if all queue files are in the right place.
# See if all queue files are in the right place. This is slow.
# We must scan all queues for mis-named queue files before the
# mail system can run.
$command_directory/postsuper active
$command_directory/postsuper &
$command_directory/postsuper || exit 1
find corrupt -type f -exec $WARN damaged message: {} \;

View File

@ -3063,13 +3063,61 @@ that the file name will collide with another queue file.
<p>
To avoid queue file name collisions when copying queue files,
restore the incoming, active and deferred queue files under the
maildrop directory instead.
<ul>
<li>If your Postfix queue is empty, and if you run a Postfix release
after 20010524, you can use this procedure to copy a Postfix
queue from another machine or to restore it from backup.
<p>
As of late 2000, Postfix queues are all hashed (for example, file
<ul>
<li> Stop Postfix, if it was running.
<p>
<li> Execute the <b>mailq</b> command. If there is any output, do
not complete this procedure, but use the second procedure instead.
<p>
<li> Copy or restore the queue to the usual place.
<p>
<li> Run the <b>postsuper</b> command. This command will rename
queue files so that the name matches the message file inode number.
</ul>
<p>
<li> If your Postfix queue is not empty, or if you are running a
Postfix release prior to 20010524, use the following procedure
instead.
<p>
<ul>
<li>Stop Postfix, if it was running.
<p>
<li> To avoid queue file name collisions when restoring queue files,
copy or restore the incoming, active and deferred queue files under
the maildrop directory instead.
<p>
<li>While the next step is going on, don't submit new mail locally,
because that could collide with the files you are restoring under
the maildrop directory.
<p>
<li>As of late 2000, Postfix queues are all hashed (for example, file
ABCDEF is stored as A/B/ABCDEF), so you need an additional step to
move files down from their subdirectories.
@ -3083,15 +3131,15 @@ move files down from their subdirectories.
# postfix start
</pre>
While all this is going on, don't submit new mail locally, because
that could collide with the files you are restoring under the
maildrop directory.
<p>
When Postfix is started, it will pick up queue files from the
<li>When Postfix is started, it will pick up queue files from the
maildrop directory and will give them proper queue file names.
</ul>
</ul>
<hr>
<a name="bind"><h3>Undefined symbols: ___dn_expand, ___res_init etc.</h3></a>

View File

@ -6,59 +6,59 @@ POSTSUPER(1) POSTSUPER(1)
<b>NAME</b>
postsuper - Postfix super intendent
postsuper - Postfix superintendent
<b>SYNOPSIS</b>
<b>postsuper</b> [<b>-psv</b>] [<b>-d</b> <i>queue_id</i>] [<b>-r</b> <i>queue_id</i>] [<i>directory</i>
<i>...</i>]
<b>DESCRIPTION</b>
The <b>postsuper</b> command does small maintenance jobs. Use of
the command is restricted to the super-user.
The <b>postsuper</b> command does maintenance jobs on the Postfix
queue. Use of the command is restricted to the super-user.
By default, <b>postsuper</b> performs the operations requested
with the <b>-s</b> and <b>-p</b> command-line options on the named Post-
fix queue directories (default: all). Directory names are
relative to the Postfix top-level queue directory.
By default, <b>postsuper</b> performs the operations requested
with the <b>-s</b> and <b>-p</b> command-line options on all Postfix
queue directories - this includes the <b>incoming</b>, <b>active</b> and
<b>deferred</b> directories with mail files and the <b>bounce</b>, <b>defer</b>
and <b>flush</b> directories with log files.
Options:
<b>-d</b> This option ignores any <i>directory</i> argument(s).
Delete one message queue file with the named queue
ID. Specify multiple <b>-d</b> options to delete multiple
queue files by name.
Alternatively, if a <i>queue_id</i> of <b>-</b> is specified, the
<b>-d</b> <i>queue_id</i>
Delete one message with the named queue ID from the
named mail queue(s) (default: <b>incoming</b>, <b>active</b> and
<b>deferred</b>). If a <i>queue_id</i> of <b>-</b> is specified, the
program reads queue IDs from standard input.
The <b>postsuper</b> exit status is non-zero when no mes-
sage queue file was deleted.
Specify <b>-d</b> <b>ALL</b> to remove all messages; for example,
specify <b>-d</b> <b>ALL</b> <b>deferred</b> to delete mail in the
<b>deferred</b> queue. As a safety measure, the word <b>ALL</b>
must be specified in upper case.
<b>There</b> <b>is</b> <b>a</b> <b>very</b> <b>small</b> <b>possibility</b> <b>that</b> <b>postsuper</b>
<b>deletes</b> <b>the</b> <b>wrong</b> <b>message</b> <b>file</b> <b>when</b> <b>it</b> <b>is</b> <b>executed</b>
<b>while</b> <b>the</b> <b>Postfix</b> <b>mail</b> <b>system</b> <b>is</b> <b>running.</b>
<b>Postfix</b> <b>queue</b> <b>IDs</b> <b>are</b> <b>reused.</b> <b>There</b> <b>is</b> <b>a</b> <b>very</b>
<b>small</b> <b>possibility</b> <b>that</b> <b>postsuper</b> <b>deletes</b> <b>the</b> <b>wrong</b>
<b>message</b> <b>file</b> <b>when</b> <b>it</b> <b>is</b> <b>executed</b> <b>while</b> <b>the</b> <b>Postfix</b>
<b>mail</b> <b>system</b> <b>is</b> <b>running.</b>
The scenario is as follows:
<b>o</b> The Postfix queue manager deletes the file
that <b>postsuper</b> was supposed to delete,
because Postfix was finished with the mes-
1) The Postfix queue manager deletes the mes-
sage that <b>postsuper</b> is supposed to delete,
because Postfix is finished with the mes-
sage.
<b>o</b> New mail arrives, and the new message is
2) New mail arrives, and the new message is
given the same queue ID as the message that
<b>postsuper</b> was supposed to delete. The prob-
ability for reusing a deleted queue ID is
<b>postsuper</b> is supposed to delete. The proba-
bility for reusing a deleted queue ID is
about 1 in 2**15 (the number of different
microsecond values that the system clock can
distinguish within a second).
<b>o</b> <b>postsuper</b> deletes the new message file,
instead of the old file that should have
been deleted.
3) <b>postsuper</b> deletes the new message, instead
of the old message that it should have
deleted.
<b>-r</b> This option ignores any <i>directory</i> argument(s).
Requeue one message queue file with the named queue
@ -71,33 +71,49 @@ POSTSUPER(1) POSTSUPER(1)
POSTSUPER(1) POSTSUPER(1)
ID. Specify multiple <b>-r</b> options to requeue multi-
ple queue files by name.
<b>-p</b> Purge old temporary files that are left over after
system or software crashes.
Alternatively, if a <i>queue_id</i> of <b>-</b> is specified, the
program reads queue IDs from standard input.
<b>-r</b> <i>queue_id</i>
Requeue the message with the named queue ID from
the named mail queue(s) (default: <b>incoming</b>, <b>active</b>
and <b>deferred</b>). To requeue multiple messages, spec-
ify multiple <b>-r</b> command-line options. Alterna-
tively, if a <i>queue_id</i> of <b>-</b> is specified, the pro-
gram reads queue IDs from standard input.
The queue file is moved to the maildrop queue, from
where it is copied by the pickup daemon to a new
file whose name is guaranteed to match the queue
file inode number. This feature is useful for queue
files from another machine or for files restored
from backup. The new queue file is subjected again
to address rewriting and substitution.
Specify <b>-r</b> <b>ALL</b> to requeue all messages. As a safety
measure, the word <b>ALL</b> must be specified in upper
case.
The <b>postsuper</b> exit status is non-zero when no mes-
sage queue file was requeued.
A requeued message is moved to the <b>maildrop</b> queue,
from where it is copied by the pickup daemon to a
new file whose name is guaranteed to match the new
queue file inode number. The new queue file is sub-
jected again to mail address rewriting and substi-
tution. This is useful when rewriting rules or vir-
tual mappings have changed.
<b>-s</b> Structure check. Move queue files that are in the
wrong place in the file system hierarchy and remove
subdirectories that are no longer needed. File
rearrangements are necessary after a change in the
<b>hash</b><i>_</i><b>queue</b><i>_</i><b>names</b> and/or <b>hash</b><i>_</i><b>queue</b><i>_</i><b>depth</b> configura-
tion parameters. It is highly recommended to run
this check once before Postfix startup.
Postfix queue IDs are reused. There is a very
small possibility that <b>postsuper</b> requeues the wrong
message file when it is executed while the Postfix
mail system is running, but no harm should be done.
<b>-p</b> Purge stale files (files that are left over after
system or software crashes).
<b>-s</b> Structure check and structure repair. It is highly
recommended to perform this operation once before
Postfix startup.
<b>o</b> Rename files whose name does not match the
message file inode number. This operation is
necessary after restoring a mail queue from
a different machine, or from backup media.
<b>o</b> Move queue files that are in the wrong place
in the file system hierarchy and remove sub-
directories that are no longer needed. File
position rearrangements are necessary after
a change in the <b>hash</b><i>_</i><b>queue</b><i>_</i><b>names</b> and/or
<b>hash</b><i>_</i><b>queue</b><i>_</i><b>depth</b> configuration parameters.
<b>-v</b> Enable verbose logging for debugging purposes. Mul-
tiple <b>-v</b> options make the software increasingly
@ -107,6 +123,24 @@ POSTSUPER(1) POSTSUPER(1)
Problems are reported to the standard error stream and to
<b>syslogd</b>.
<b>postsuper</b> reports the number of messages deleted with <b>-d</b>,
the number of messages requeued with <b>-r</b>, and the number of
2
POSTSUPER(1) POSTSUPER(1)
messages whose queue file name was fixed with <b>-s</b>. The
report is written to the standard error stream and to <b>sys-</b>
<b>logd</b>.
<b>CONFIGURATION</b> <b>PARAMETERS</b>
See the Postfix <b>main.cf</b> file for syntax details and for
default values.
@ -125,18 +159,6 @@ POSTSUPER(1) POSTSUPER(1)
<b>AUTHOR(S)</b>
Wietse Venema
IBM T.J. Watson Research
2
POSTSUPER(1) POSTSUPER(1)
P.O. Box 704
Yorktown Heights, NY 10598, USA
@ -151,28 +173,6 @@ POSTSUPER(1) POSTSUPER(1)

View File

@ -4,7 +4,7 @@
.SH NAME
postsuper
\-
Postfix super intendent
Postfix superintendent
.SH SYNOPSIS
.na
.nf
@ -14,27 +14,30 @@ Postfix super intendent
.SH DESCRIPTION
.ad
.fi
The \fBpostsuper\fR command does small maintenance jobs. Use of
the command is restricted to the super-user.
The \fBpostsuper\fR command does maintenance jobs on the Postfix
queue. Use of the command is restricted to the super-user.
By default, \fBpostsuper\fR performs the operations requested with the
\fB-s\fR and \fB-p\fR command-line options on the named Postfix queue
directories (default: all).
Directory names are relative to the Postfix top-level queue directory.
\fB-s\fR and \fB-p\fR command-line options on all Postfix queue
directories - this includes the \fBincoming\fR, \fBactive\fR and
\fBdeferred\fR directories with mail files and the \fBbounce\fR,
\fBdefer\fR and \fBflush\fR directories with log files.
Options:
.IP \fB-d \fIqueue_id\fR
This option ignores any \fIdirectory\fR argument(s).
Delete one message queue file with the named queue ID. Specify
multiple \fB-d\fR options to delete multiple queue files by name.
.IP "\fB-d \fIqueue_id\fR"
Delete one message with the named queue ID from the named
mail queue(s) (default: \fBincoming\fR, \fBactive\fR and
\fBdeferred\fR).
If a \fIqueue_id\fR of \fB-\fR is specified, the program reads
queue IDs from standard input.
.sp
Alternatively, if a \fIqueue_id\fR of \fB-\fR is specified, the
program reads queue IDs from standard input.
.sp
The \fBpostsuper\fR exit status is non-zero when no message queue
file was deleted.
Specify \fB-d ALL\fR to remove all messages; for example, specify
\fB-d ALL deferred\fR to delete mail in the \fBdeferred\fR queue.
As a safety measure, the word \fBALL\fR must be specified in upper
case.
.sp
.ft B
Postfix queue IDs are reused.
There is a very small possibility that postsuper deletes the
wrong message file when it is executed while the Postfix mail
system is running.
@ -42,47 +45,61 @@ system is running.
.sp
The scenario is as follows:
.RS
.IP \(bu
The Postfix queue manager deletes the file that \fBpostsuper\fR
was supposed to delete, because Postfix was finished with the
.IP 1)
The Postfix queue manager deletes the message that \fBpostsuper\fR
is supposed to delete, because Postfix is finished with the
message.
.IP \(bu
.IP 2)
New mail arrives, and the new message is given the same queue ID
as the message that \fBpostsuper\fR was supposed to delete.
as the message that \fBpostsuper\fR is supposed to delete.
The probability for reusing a deleted queue ID is about 1 in 2**15
(the number of different microsecond values that the system clock
can distinguish within a second).
.IP \(bu
\fBpostsuper\fR deletes the new message file, instead of the
old file that should have been deleted.
.IP 3)
\fBpostsuper\fR deletes the new message, instead of the old
message that it should have deleted.
.RE
.IP \fB-r \fIqueue_id\fR
This option ignores any \fIdirectory\fR argument(s).
Requeue one message queue file with the named queue ID. Specify
multiple \fB-r\fR options to requeue multiple queue files by name.
.sp
Alternatively, if a \fIqueue_id\fR of \fB-\fR is specified, the
program reads queue IDs from standard input.
.sp
The queue file is moved to the maildrop queue, from where
it is copied by the pickup daemon to a new file whose name
is guaranteed to match the queue file inode number. This
feature is useful for queue files from another machine or
for files restored from backup. The new queue file is
subjected again to address rewriting and substitution.
.sp
The \fBpostsuper\fR exit status is non-zero when no message queue
file was requeued.
.IP \fB-s\fR
Structure check. Move queue files that are in the wrong place
in the file system hierarchy and remove subdirectories that are
no longer needed. File rearrangements are necessary after a change
in the \fBhash_queue_names\fR and/or \fBhash_queue_depth\fR
configuration parameters. It is highly recommended to run this
check once before Postfix startup.
.IP \fB-p\fR
Purge stale files (files that are left over after system or
software crashes).
Purge old temporary files that are left over after system or
software crashes.
.IP "\fB-r \fIqueue_id\fR"
Requeue the message with the named queue ID from the named
mail queue(s) (default: \fBincoming\fR, \fBactive\fR and
\fBdeferred\fR).
To requeue multiple messages, specify multiple \fB-r\fR
command-line options.
Alternatively, if a \fIqueue_id\fR of \fB-\fR is specified,
the program reads queue IDs from standard input.
.sp
Specify \fB-r ALL\fR to requeue all messages. As a safety
measure, the word \fBALL\fR must be specified in upper case.
.sp
A requeued message is moved to the \fBmaildrop\fR queue, from
where it is copied by the pickup daemon to a new file whose name
is guaranteed to match the new queue file inode number. The
new queue file is subjected again to mail address rewriting and
substitution. This is useful when rewriting rules or virtual
mappings have changed.
.sp
Postfix queue IDs are reused.
There is a very small possibility that \fBpostsuper\fR requeues
the wrong message file when it is executed while the Postfix mail
system is running, but no harm should be done.
.IP \fB-s\fR
Structure check and structure repair. It is highly recommended
to perform this operation once before Postfix startup.
.RS
.IP \(bu
Rename files whose name does not match the message file inode
number. This operation is necessary after restoring a mail queue
from a different machine, or from backup media.
.IP \(bu
Move queue files that are in the wrong place in the file system
hierarchy and remove subdirectories that are no longer needed.
File position rearrangements are necessary after a change in the
\fBhash_queue_names\fR and/or \fBhash_queue_depth\fR
configuration parameters.
.RE
.IP \fB-v\fR
Enable verbose logging for debugging purposes. Multiple \fB-v\fR
options make the software increasingly verbose.
@ -91,6 +108,11 @@ options make the software increasingly verbose.
.fi
Problems are reported to the standard error stream and to
\fBsyslogd\fR.
\fBpostsuper\fR reports the number of messages deleted with \fB-d\fR,
the number of messages requeued with \fB-r\fR, and the number of
messages whose queue file name was fixed with \fB-s\fR. The report
is written to the standard error stream and to \fBsyslogd\fR.
.SH CONFIGURATION PARAMETERS
.na
.nf

View File

@ -65,7 +65,7 @@ const char *get_file_id(int fd)
result = vstring_alloc(1);
if (fstat(fd, &st) < 0)
msg_fatal("fstat: %m");
vstring_sprintf(result, "%X", (int) st.st_ino);
vstring_sprintf(result, "%lX", (long) st.st_ino);
return (vstring_str(result));
}

View File

@ -388,11 +388,13 @@ VSTREAM *mail_queue_enter(const char *queue_name, int mode)
for (count = 0;; count++) {
vstring_sprintf(id_buf, "%05X%s", (int) tv.tv_usec, file_id);
mail_queue_path(path_buf, queue_name, STR(id_buf));
#if 0
if (access(STR(path_buf), X_OK) == 0) { /* collision. */
if ((int) ++tv.tv_usec < 0)
tv.tv_usec = 0;
continue;
}
#endif
if (sane_rename(STR(temp_path), STR(path_buf)) == 0) /* success */
break;
if (errno == EPERM || errno == EISDIR) {/* collision. weird. */

View File

@ -15,7 +15,7 @@
* Version of this program.
*/
#define VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "Snapshot-20010522"
#define DEF_MAIL_VERSION "Snapshot-20010524"
extern char *var_mail_version;
/* LICENSE

File diff suppressed because it is too large Load Diff

View File

@ -584,6 +584,8 @@ static const char *dict_ldap_lookup(DICT *dict, const char *name)
ldap_msgfree(res);
if (filter_buf != 0)
vstring_free(filter_buf);
if (escaped_name != 0)
vstring_free(escaped_name);
/*
* If we had an error, return nothing, Otherwise, return the result, if