-h" to get the message header only. With large messages,
"postcat -h" is much faster than manually stripping the
message body from the output. File: postcat/postcat.c.
+
+20090528
+
+ Bugfix (introduced: Postfix 2.6 change 20080629): with
+ plaintext sessions, smtpd_tls_auth_only=yes caused spurious
+ warnings with reject_authenticated_sender_login_mismatch,
+ and broke reject_unauthenticated_sender_login_mismatch and
+ reject_sender_login_mismatch. Based on fix by Victor
+ Duchovni. File: smtpd/smtpd_check.c.
postcat - show Postfix queue file contents
<b>SYNOPSIS</b>
- <b>postcat</b> [<b>-bhmoqv</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>files</i>...]
+ <b>postcat</b> [<b>-bdehnoqv</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>files</i>...]
<b>DESCRIPTION</b>
The <a href="postcat.1.html"><b>postcat</b>(1)</a> command prints the contents of the named
in Postfix queue file format. If no <i>files</i> are specified on
the command line, the program reads from standard input.
- By default, <a href="postcat.1.html"><b>postcat</b>(1)</a> behaves as if all three options <b>-b</b>,
- <b>-e</b>, and <b>-h</b> are given. To view message content only, spec-
- ify <b>-bh</b> (Postfix 2.7 and later).
+ By default, <a href="postcat.1.html"><b>postcat</b>(1)</a> shows the envelope and message con-
+ tent, as if the options <b>-beh</b> were specified. To view mes-
+ sage content only, specify <b>-bh</b> (Postfix 2.7 and later).
Options:
output at the first non-header line, and stops when
the end of the message is reached.
- This feature is available in Postfix version 2.7
- and later.
+ This feature is available in Postfix 2.7 and later.
<b>-c</b> <i>config</i><b>_</b><i>dir</i>
The <a href="postconf.5.html"><b>main.cf</b></a> configuration file is in the named
directory instead of the default configuration
directory.
+ <b>-d</b> Print the decimal type of each record.
+
<b>-e</b> Show message envelope content.
- This feature is available in Postfix version 2.7
- and later.
+ This feature is available in Postfix 2.7 and later.
<b>-h</b> Show message header content. The <b>-h</b> option pro-
duces output from the beginning of the message up
to, but not including, the first non-header line.
- This feature is available in Postfix version 2.7
- and later.
+ This feature is available in Postfix 2.7 and later.
<b>-o</b> Print the queue file offset of each record.
<b>-q</b> Search the Postfix queue for the named <i>files</i>
instead of taking the names literally.
- Available in Postfix version 2.0 and later.
+ This feature is available in Postfix 2.0 and later.
<b>-v</b> Enable verbose logging for debugging purposes. Mul-
- tiple <b>-v</b> options make the software increasingly
+ tiple <b>-v</b> options make the software increasingly
verbose.
<b>DIAGNOSTICS</b>
Directory with Postfix configuration files.
<b>CONFIGURATION PARAMETERS</b>
- The following <a href="postconf.5.html"><b>main.cf</b></a> parameters are especially relevant
+ The following <a href="postconf.5.html"><b>main.cf</b></a> parameters are especially relevant
to this program.
- The text below provides only a parameter summary. See
+ The text below provides only a parameter summary. See
<a href="postconf.5.html"><b>postconf</b>(5)</a> for more details including examples.
<b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
- The default location of the Postfix <a href="postconf.5.html">main.cf</a> and
+ The default location of the Postfix <a href="postconf.5.html">main.cf</a> and
<a href="master.5.html">master.cf</a> configuration files.
<b><a href="postconf.5.html#queue_directory">queue_directory</a> (see 'postconf -d' output)</b>
- The location of the Postfix top-level queue direc-
+ The location of the Postfix top-level queue direc-
tory.
<b>FILES</b>
<a href="postconf.5.html">postconf(5)</a>, Postfix configuration
<b>LICENSE</b>
- The Secure Mailer license must be distributed with this
+ The Secure Mailer license must be distributed with this
software.
<b>AUTHOR(S)</b>
<p>
The name of the directory with example Postfix configuration files.
+Starting with Postfix 2.1, these files have been replaced with the
+<a href="postconf.5.html">postconf(5)</a> manual page.
</p>
.SH "SYNOPSIS"
.na
.nf
-\fBpostcat\fR [\fB-bhmoqv\fR] [\fB-c \fIconfig_dir\fR] [\fIfiles\fR...]
+\fBpostcat\fR [\fB-bdehnoqv\fR] [\fB-c \fIconfig_dir\fR] [\fIfiles\fR...]
.SH DESCRIPTION
.ad
.fi
-The \fBpostcat\fR(1) command prints the contents of the named
-\fIfiles\fR in human-readable form. The files are expected
-to be in Postfix queue file format. If no
-\fIfiles\fR are specified on the command line, the program
-reads from standard input.
+The \fBpostcat\fR(1) command prints the contents of the
+named \fIfiles\fR in human-readable form. The files are
+expected to be in Postfix queue file format. If no \fIfiles\fR
+are specified on the command line, the program reads from
+standard input.
-By default, \fBpostcat\fR(1) behaves as if all three options
-\fB-b\fR, \fB-e\fR, and \fB-h\fR are given. To view message
-content only, specify \fB-bh\fR (Postfix 2.7 and later).
+By default, \fBpostcat\fR(1) shows the envelope and message
+content, as if the options \fB-beh\fR were specified. To
+view message content only, specify \fB-bh\fR (Postfix 2.7
+and later).
Options:
.IP \fB-b\fR
output at the first non-header line, and stops when the end
of the message is reached.
.sp
-This feature is available in Postfix version 2.7 and later.
+This feature is available in Postfix 2.7 and later.
.IP "\fB-c \fIconfig_dir\fR"
The \fBmain.cf\fR configuration file is in the named directory
instead of the default configuration directory.
+.IP \fB-d\fR
+Print the decimal type of each record.
.IP \fB-e\fR
Show message envelope content.
.sp
-This feature is available in Postfix version 2.7 and later.
+This feature is available in Postfix 2.7 and later.
.IP \fB-h\fR
Show message header content. The \fB-h\fR option produces
output from the beginning of the message up to, but not
including, the first non-header line.
.sp
-This feature is available in Postfix version 2.7 and later.
+This feature is available in Postfix 2.7 and later.
.IP \fB-o\fR
Print the queue file offset of each record.
.IP \fB-q\fR
Search the Postfix queue for the named \fIfiles\fR instead
of taking the names literally.
-Available in Postfix version 2.0 and later.
+This feature is available in Postfix 2.0 and later.
.IP \fB-v\fR
Enable verbose logging for debugging purposes. Multiple \fB-v\fR
options make the software increasingly verbose.
This feature is available in Postfix 2.0 and later.
.SH sample_directory (default: /etc/postfix)
The name of the directory with example Postfix configuration files.
+Starting with Postfix 2.1, these files have been replaced with the
+\fBpostconf\fR(5) manual page.
.SH send_cyrus_sasl_authzid (default: no)
When authenticating to a remote SMTP or LMTP server with the
default setting "no", send no SASL authoriZation ID (authzid); send
<p>
The name of the directory with example Postfix configuration files.
+Starting with Postfix 2.1, these files have been replaced with the
+postconf(5) manual page.
</p>
%PARAM sender_based_routing no
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20090524"
+#define MAIL_RELEASE_DATE "20090528"
#define MAIL_VERSION_NUMBER "2.7"
#ifdef SNAPSHOT
/* SUMMARY
/* show Postfix queue file contents
/* SYNOPSIS
-/* \fBpostcat\fR [\fB-bhmoqv\fR] [\fB-c \fIconfig_dir\fR] [\fIfiles\fR...]
+/* \fBpostcat\fR [\fB-bdehnoqv\fR] [\fB-c \fIconfig_dir\fR] [\fIfiles\fR...]
/* DESCRIPTION
-/* The \fBpostcat\fR(1) command prints the contents of the named
-/* \fIfiles\fR in human-readable form. The files are expected
-/* to be in Postfix queue file format. If no
-/* \fIfiles\fR are specified on the command line, the program
-/* reads from standard input.
+/* The \fBpostcat\fR(1) command prints the contents of the
+/* named \fIfiles\fR in human-readable form. The files are
+/* expected to be in Postfix queue file format. If no \fIfiles\fR
+/* are specified on the command line, the program reads from
+/* standard input.
/*
-/* By default, \fBpostcat\fR(1) behaves as if all three options
-/* \fB-b\fR, \fB-e\fR, and \fB-h\fR are given. To view message
-/* content only, specify \fB-bh\fR (Postfix 2.7 and later).
+/* By default, \fBpostcat\fR(1) shows the envelope and message
+/* content, as if the options \fB-beh\fR were specified. To
+/* view message content only, specify \fB-bh\fR (Postfix 2.7
+/* and later).
/*
/* Options:
/* .IP \fB-b\fR
/* output at the first non-header line, and stops when the end
/* of the message is reached.
/* .sp
-/* This feature is available in Postfix version 2.7 and later.
+/* This feature is available in Postfix 2.7 and later.
/* .IP "\fB-c \fIconfig_dir\fR"
/* The \fBmain.cf\fR configuration file is in the named directory
/* instead of the default configuration directory.
+/* .IP \fB-d\fR
+/* Print the decimal type of each record.
/* .IP \fB-e\fR
/* Show message envelope content.
/* .sp
-/* This feature is available in Postfix version 2.7 and later.
+/* This feature is available in Postfix 2.7 and later.
/* .IP \fB-h\fR
/* Show message header content. The \fB-h\fR option produces
/* output from the beginning of the message up to, but not
/* including, the first non-header line.
/* .sp
-/* This feature is available in Postfix version 2.7 and later.
+/* This feature is available in Postfix 2.7 and later.
/* .IP \fB-o\fR
/* Print the queue file offset of each record.
/* .IP \fB-q\fR
/* Search the Postfix queue for the named \fIfiles\fR instead
/* of taking the names literally.
/*
-/* Available in Postfix version 2.0 and later.
+/* This feature is available in Postfix 2.0 and later.
/* .IP \fB-v\fR
/* Enable verbose logging for debugging purposes. Multiple \fB-v\fR
/* options make the software increasingly verbose.
#define PC_FLAG_PRINT_ENV (1<<2) /* print envelope records */
#define PC_FLAG_PRINT_HEADER (1<<3) /* print header records */
#define PC_FLAG_PRINT_BODY (1<<4) /* print body records */
+#define PC_FLAG_PRINT_RTYPE_DEC (1<<5) /* print decimal record type */
+#define PC_FLAG_PRINT_RTYPE_SYM (1<<6) /* print symbolic record type */
#define PC_MASK_PRINT_TEXT (PC_FLAG_PRINT_HEADER | PC_FLAG_PRINT_BODY)
#define PC_MASK_PRINT_ALL (PC_FLAG_PRINT_ENV | PC_MASK_PRINT_TEXT)
* likely need to be revised when the queue file organization is
* changed.
*/
-#define PRINT_MARKER(flags, fp, offset, text) do { \
+#define PRINT_MARKER(flags, fp, offset, type, text) do { \
if ((flags) & PC_FLAG_PRINT_OFFSET) \
vstream_printf("%9lu ", (unsigned long) (offset)); \
+ if (flags & PC_FLAG_PRINT_RTYPE_DEC) \
+ vstream_printf("%3d ", (type)); \
vstream_printf("*** %s %s ***\n", (text), VSTREAM_PATH(fp)); \
vstream_fflush(VSTREAM_OUT); \
} while (0)
#define PRINT_RECORD(flags, offset, type, value) do { \
if ((flags) & PC_FLAG_PRINT_OFFSET) \
vstream_printf("%9lu ", (unsigned long) (offset)); \
+ if (flags & PC_FLAG_PRINT_RTYPE_DEC) \
+ vstream_printf("%3d ", (type)); \
vstream_printf("%s: %s\n", rec_type_name(rec_type), (value)); \
vstream_fflush(VSTREAM_OUT); \
} while (0)
VSTREAM_PATH(fp));
/* Optional output. */
if (flags & PC_FLAG_PRINT_ENV)
- PRINT_MARKER(flags, fp, offset, "MESSAGE CONTENTS");
+ PRINT_MARKER(flags, fp, offset, rec_type, "MESSAGE CONTENTS");
/* Optimization: skip to extracted segment marker. */
if ((flags & PC_MASK_PRINT_TEXT) == 0
&& data_offset >= 0 && data_size >= 0
if (do_print && prev_type == REC_TYPE_CONT)
VSTREAM_PUTCHAR('\n');
if (flags & PC_FLAG_PRINT_ENV)
- PRINT_MARKER(flags, fp, offset, "HEADER EXTRACTED");
+ PRINT_MARKER(flags, fp, offset, rec_type, "HEADER EXTRACTED");
/* Update the state machine. */
state = PC_STATE_ENV;
do_print = (flags & PC_FLAG_PRINT_ENV);
VSTREAM_PATH(fp));
/* Optional output. */
if (flags & PC_FLAG_PRINT_ENV)
- PRINT_MARKER(flags, fp, offset, "MESSAGE FILE END");
+ PRINT_MARKER(flags, fp, offset, rec_type, "MESSAGE FILE END");
/* Terminate the state machine. */
break;
} else if (rec_type == REC_TYPE_PTR) {
msg_fatal("bad pointer record, or input is not seekable");
continue;
} else if (rec_type == REC_TYPE_SIZE) {
+ /* Optional output (here before we update the state machine). */
+ if (do_print)
+ PRINT_RECORD(flags, offset, rec_type, STR(buffer));
+ /* Read the message size/offset for the state machine optimizer. */
if (data_size >= 0 || data_offset >= 0) {
msg_warn("file contains multiple size records");
} else {
if (sscanf(STR(buffer), "%ld %ld", &data_size, &data_offset) != 2
|| data_offset <= 0 || data_size <= 0)
msg_fatal("invalid size record: %.100s", STR(buffer));
- /* Optional output (here since we update the state machine). */
- if (do_print)
- PRINT_RECORD(flags, offset, rec_type, STR(buffer));
/* Optimization: skip to the message header. */
if ((flags & PC_FLAG_PRINT_ENV) == 0) {
if (vstream_fseek(fp, data_offset, SEEK_SET) < 0)
continue;
if (flags & PC_FLAG_PRINT_OFFSET)
vstream_printf("%9lu ", (unsigned long) offset);
+ if (flags & PC_FLAG_PRINT_RTYPE_DEC)
+ vstream_printf("%3d ", rec_type);
switch (rec_type) {
case REC_TYPE_TIME:
REC_TYPE_TIME_SCAN(STR(buffer), tv);
static NORETURN usage(char *myname)
{
- msg_fatal("usage: %s [-c config_dir] [-q (access queue)] [-v] [file(s)...]",
+ msg_fatal("usage: %s [-b (body text)] [-c config_dir] [-d (decimal record type)] [-e (envelope records)] [-h (header text)] [-q (access queue)] [-v] [file(s)...]",
myname);
}
/*
* Parse JCL.
*/
- while ((ch = GETOPT(argc, argv, "bc:ehoqv")) > 0) {
+ while ((ch = GETOPT(argc, argv, "bc:dehoqv")) > 0) {
switch (ch) {
case 'b':
flags |= PC_FLAG_PRINT_BODY;
if (setenv(CONF_ENV_PATH, optarg, 1) < 0)
msg_fatal("out of memory");
break;
+ case 'd':
+ flags |= PC_FLAG_PRINT_RTYPE_DEC;
+ break;
case 'e':
flags |= PC_FLAG_PRINT_ENV;
break;
char *name;
int found = 0;
+ /*
+ * Replace obscure code by self-evident code.
+ */
+#define SMTPD_SASL_AUTHENTICATED(state) \
+ (smtpd_sasl_is_active(state) && state->sasl_username != 0)
+
/*
* Reject if the client is logged in and does not own the sender address.
*/
- if (smtpd_sasl_is_active(state) && state->sasl_username != 0) {
+ if (var_smtpd_sasl_enable && SMTPD_SASL_AUTHENTICATED(state)) {
reply = smtpd_resolve_addr(sender);
if (reply->flags & RESOLVE_FLAG_FAIL)
reject_dict_retry(state, sender);
* Reject if the client is not logged in and the sender address has an
* owner.
*/
- if (smtpd_sasl_is_active(state) && state->sasl_username == 0) {
+ if (var_smtpd_sasl_enable && !SMTPD_SASL_AUTHENTICATED(state)) {
reply = smtpd_resolve_addr(sender);
if (reply->flags & RESOLVE_FLAG_FAIL)
reject_dict_retry(state, sender);
state->sender, SMTPD_NAME_SENDER);
} else if (strcasecmp(name, REJECT_AUTH_SENDER_LOGIN_MISMATCH) == 0) {
#ifdef USE_SASL_AUTH
- if (smtpd_sasl_is_active(state)) {
+ if (var_smtpd_sasl_enable) {
if (state->sender && *state->sender)
status = reject_auth_sender_login_mismatch(state, state->sender);
} else
msg_warn("restriction `%s' ignored: no SASL support", name);
} else if (strcasecmp(name, REJECT_UNAUTH_SENDER_LOGIN_MISMATCH) == 0) {
#ifdef USE_SASL_AUTH
- if (smtpd_sasl_is_active(state)) {
+ if (var_smtpd_sasl_enable) {
if (state->sender && *state->sender)
status = reject_unauth_sender_login_mismatch(state, state->sender);
} else