mirror of
https://github.com/vdukhovni/postfix
synced 2025-08-31 14:17:41 +00:00
postfix-2.3-20050630
This commit is contained in:
committed by
Viktor Dukhovni
parent
1b2211aa09
commit
7ec5fd0f11
@@ -10935,13 +10935,13 @@ Apologies for any names omitted.
|
||||
the base64 and plain attribute I/O encodings. Files:
|
||||
util/attr_scan_plain.c util/attr_print_plain.c.
|
||||
|
||||
20040624
|
||||
20050624
|
||||
|
||||
Added "." to the list commands that smtp-sink can "break"
|
||||
(by disconnecting, or by responding with a 4XX or 5XX reply
|
||||
code). File: smtpstone/smtp-sink.c.
|
||||
|
||||
20040625
|
||||
20050625
|
||||
|
||||
Safety: allow only 4.x.x and 5.x.x enhanced status codes
|
||||
in header/body_checks REJECT actions. File:
|
||||
@@ -10959,6 +10959,14 @@ Apologies for any names omitted.
|
||||
to complete the TCP, SMTP, EHLO or TLS handshake (was: TCP
|
||||
and SMTP). File: smtp/smtp_proto.c.
|
||||
|
||||
20050630
|
||||
|
||||
Updated the example spf.pl script to version 1.06.
|
||||
|
||||
Portability: the file descriptor passing code broke on LP64
|
||||
systems (inherited from Stevens Network Programming). Files:
|
||||
util/unix_send_fd.c, util/unix_recv_fd.c.
|
||||
|
||||
Open problems:
|
||||
|
||||
Look for systems with XPG basename() declared in <libgen.h>,
|
||||
|
@@ -33,7 +33,7 @@ disabled by default. The new limit prevents Postfix from spending
|
||||
lots of time trying to connect to lots of bogus MX servers.
|
||||
|
||||
The Postfix SMTP error handling of [45]XX server greetings was
|
||||
cleaned up. The server reply is now properly reported.
|
||||
cleaned up. The server reply is now properly reported.
|
||||
|
||||
Incompatibility with snapshot 20050615
|
||||
======================================
|
||||
|
23
postfix/examples/smtpd-policy/spf.pl
Executable file → Normal file
23
postfix/examples/smtpd-policy/spf.pl
Executable file → Normal file
@@ -3,7 +3,7 @@
|
||||
# mengwong@pobox.com
|
||||
# Wed Dec 10 03:52:04 EST 2003
|
||||
# postfix-policyd-spf
|
||||
# version 1.03
|
||||
# version 1.06
|
||||
# see http://spf.pobox.com/
|
||||
|
||||
use Fcntl;
|
||||
@@ -15,11 +15,10 @@ use strict;
|
||||
# ----------------------------------------------------------
|
||||
|
||||
# to use SPF, install Mail::SPF::Query from CPAN or from the SPF website at http://spf.pobox.com/downloads.html
|
||||
# then uncomment the SPF line.
|
||||
|
||||
my @HANDLERS;
|
||||
push @HANDLERS, "testing";
|
||||
# push @HANDLERS, "sender_permitted_from"; use Mail::SPF::Query;
|
||||
push @HANDLERS, "sender_permitted_from"; use Mail::SPF::Query;
|
||||
|
||||
my $VERBOSE = 1;
|
||||
|
||||
@@ -72,6 +71,7 @@ my $syslog_ident = "postfix/policy-spf";
|
||||
#
|
||||
# smtpd_recipient_restrictions =
|
||||
# ...
|
||||
# reject_unknown_sender_domain
|
||||
# reject_unauth_destination
|
||||
# check_policy_service unix:private/policy
|
||||
# ...
|
||||
@@ -123,7 +123,7 @@ my $syslog_ident = "postfix/policy-spf";
|
||||
#
|
||||
sub fatal_exit {
|
||||
syslog(err => "fatal_exit: @_");
|
||||
syslog(warn => "fatal_exit: @_");
|
||||
syslog(warning => "fatal_exit: @_");
|
||||
syslog(info => "fatal_exit: @_");
|
||||
die "fatal: @_";
|
||||
}
|
||||
@@ -151,7 +151,7 @@ my %attr;
|
||||
while (<STDIN>) {
|
||||
chomp;
|
||||
if (/=/) { my ($k, $v) = split (/=/, $_, 2); $attr{$k} = $v; next }
|
||||
elsif (length) { syslog(warn=>sprintf("warning: ignoring garbage: %.100s", $_)); next; }
|
||||
elsif (length) { syslog(warning=>sprintf("warning: ignoring garbage: %.100s", $_)); next; }
|
||||
|
||||
if ($VERBOSE) {
|
||||
for (sort keys %attr) {
|
||||
@@ -186,9 +186,14 @@ sub sender_permitted_from {
|
||||
local %_ = @_;
|
||||
my %attr = %{ $_{attr} };
|
||||
|
||||
my $query = new Mail::SPF::Query (ip =>$attr{client_address},
|
||||
sender=>$attr{sender},
|
||||
helo =>$attr{helo_name});
|
||||
my $query = eval { new Mail::SPF::Query (ip =>$attr{client_address},
|
||||
sender=>$attr{sender},
|
||||
helo =>$attr{helo_name}) };
|
||||
if ($@) {
|
||||
syslog(info=>"%s: Mail::SPF::Query->new(%s, %s, %s) failed: %s",
|
||||
$attr{queue_id}, $attr{client_address}, $attr{sender}, $attr{helo_name}, $@);
|
||||
return "DUNNO";
|
||||
}
|
||||
my ($result, $smtp_comment, $header_comment) = $query->result();
|
||||
|
||||
syslog(info=>"%s: SPF %s: smtp_comment=%s, header_comment=%s",
|
||||
@@ -198,7 +203,7 @@ sub sender_permitted_from {
|
||||
elsif ($result eq "fail") { return "REJECT " . ($smtp_comment || $header_comment); }
|
||||
elsif ($result eq "error") { return "450 temporary failure: $smtp_comment"; }
|
||||
else { return "DUNNO"; }
|
||||
# unknown, softfail, and none all return DUNNO
|
||||
# unknown, softfail, neutral and none all return DUNNO
|
||||
|
||||
# TODO XXX: prepend Received-SPF header. Wietse says he will add that functionality soon.
|
||||
}
|
||||
|
@@ -37,8 +37,9 @@ SMTP-SINK(1) SMTP-SINK(1)
|
||||
|
||||
<b>-a</b> Do not announce SASL authentication support.
|
||||
|
||||
<b>-c</b> Display a running counter that is updated whenever
|
||||
an SMTP QUIT command is executed.
|
||||
<b>-c</b> Display running counters that are updated whenever
|
||||
an SMTP session ends, a QUIT command is executed,
|
||||
or when "." is received.
|
||||
|
||||
<b>-C</b> Disable XCLIENT support.
|
||||
|
||||
@@ -47,20 +48,20 @@ SMTP-SINK(1) SMTP-SINK(1)
|
||||
<b>-E</b> Do not announce ENHANCEDSTATUSCODES support.
|
||||
|
||||
<b>-f</b> <i>command,command,...</i>
|
||||
Reject the specified commands with a hard (5xx)
|
||||
Reject the specified commands with a hard (5xx)
|
||||
error code. This option implies <b>-p</b>.
|
||||
|
||||
Examples of commands are HELO, EHLO, LHLO, MAIL,
|
||||
Examples of commands are HELO, EHLO, LHLO, MAIL,
|
||||
RCPT, VRFY, DATA, ., RSET, NOOP, and QUIT. Separate
|
||||
command names by white space or commas, and use
|
||||
quotes to protect white space from the shell. Com-
|
||||
command names by white space or commas, and use
|
||||
quotes to protect white space from the shell. Com-
|
||||
mand names are case-insensitive.
|
||||
|
||||
<b>-F</b> Disable XFORWARD support.
|
||||
|
||||
<b>-h</b> <i>hostname</i>
|
||||
Use <i>hostname</i> in the SMTP greeting, in the HELO
|
||||
response, and in the EHLO response. The default
|
||||
Use <i>hostname</i> in the SMTP greeting, in the HELO
|
||||
response, and in the EHLO response. The default
|
||||
hostname is "smtp-sink".
|
||||
|
||||
<b>-L</b> Enable LMTP instead of SMTP.
|
||||
@@ -69,44 +70,44 @@ SMTP-SINK(1) SMTP-SINK(1)
|
||||
Terminate after <i>count</i> sessions. This is for testing
|
||||
purposes.
|
||||
|
||||
<b>-p</b> Do not announce support for ESMTP command pipelin-
|
||||
<b>-p</b> Do not announce support for ESMTP command pipelin-
|
||||
ing.
|
||||
|
||||
<b>-P</b> Change the server greeting so that it appears to
|
||||
<b>-P</b> Change the server greeting so that it appears to
|
||||
come through a CISCO PIX system. Implies <b>-e</b>.
|
||||
|
||||
<b>-q</b> <i>command,command,...</i>
|
||||
Disconnect (without replying) after receiving one
|
||||
Disconnect (without replying) after receiving one
|
||||
of the specified commands.
|
||||
|
||||
Examples of commands are HELO, EHLO, LHLO, MAIL,
|
||||
RCPT, VRFY, DATA, ., RSET, NOOP, and QUIT. Separate
|
||||
command names by white space or commas, and use
|
||||
quotes to protect white space from the shell. Com-
|
||||
mand names are case-insensitive.
|
||||
|
||||
<b>-r</b> <i>command,command,...</i>
|
||||
Reject the specified commands with a soft (4xx)
|
||||
error code. This option implies <b>-p</b>.
|
||||
|
||||
Examples of commands are HELO, EHLO, LHLO, MAIL,
|
||||
RCPT, VRFY, DATA, ., RSET, NOOP, and QUIT. Separate
|
||||
command names by white space or commas, and use
|
||||
quotes to protect white space from the shell. Com-
|
||||
mand names are case-insensitive.
|
||||
|
||||
<b>-r</b> <i>command,command,...</i>
|
||||
Reject the specified commands with a soft (4xx)
|
||||
error code. This option implies <b>-p</b>.
|
||||
|
||||
Examples of commands are HELO, EHLO, LHLO, MAIL,
|
||||
RCPT, VRFY, DATA, ., RSET, NOOP, and QUIT. Separate
|
||||
command names by white space or commas, and use
|
||||
quotes to protect white space from the shell. Com-
|
||||
mand names are case-insensitive.
|
||||
|
||||
<b>-s</b> <i>command,command,...</i>
|
||||
Log the named commands to syslogd.
|
||||
|
||||
Examples of commands are HELO, EHLO, LHLO, MAIL,
|
||||
Examples of commands are HELO, EHLO, LHLO, MAIL,
|
||||
RCPT, VRFY, DATA, ., RSET, NOOP, and QUIT. Separate
|
||||
command names by white space or commas, and use
|
||||
quotes to protect white space from the shell. Com-
|
||||
command names by white space or commas, and use
|
||||
quotes to protect white space from the shell. Com-
|
||||
mand names are case-insensitive.
|
||||
|
||||
<b>-t</b> <i>timeout</i> (default: 100)
|
||||
Limit the time for receiving a command or sending a
|
||||
response. The time limit is specified in seconds.
|
||||
response. The time limit is specified in seconds.
|
||||
|
||||
<b>-v</b> Show the SMTP conversations.
|
||||
|
||||
@@ -115,7 +116,7 @@ SMTP-SINK(1) SMTP-SINK(1)
|
||||
mand.
|
||||
|
||||
[<b>inet:</b>][<i>host</i>]:<i>port</i>
|
||||
Listen on network interface <i>host</i> (default: any
|
||||
Listen on network interface <i>host</i> (default: any
|
||||
interface) TCP port <i>port</i>. Both <i>host</i> and <i>port</i> may be
|
||||
specified in numeric or symbolic form.
|
||||
|
||||
@@ -123,14 +124,14 @@ SMTP-SINK(1) SMTP-SINK(1)
|
||||
Listen on the UNIX-domain socket at <i>pathname</i>.
|
||||
|
||||
<i>backlog</i>
|
||||
The maximum length the queue of pending connec-
|
||||
The maximum length the queue of pending connec-
|
||||
tions, as defined by the <b>listen</b>(2) system call.
|
||||
|
||||
<b>SEE ALSO</b>
|
||||
<a href="smtp-source.1.html">smtp-source(1)</a>, SMTP/LMTP message generator
|
||||
|
||||
<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>
|
||||
|
@@ -38,8 +38,9 @@ Do not announce 8BITMIME support.
|
||||
.IP \fB-a\fR
|
||||
Do not announce SASL authentication support.
|
||||
.IP \fB-c\fR
|
||||
Display a running counter that is updated whenever an SMTP
|
||||
QUIT command is executed.
|
||||
Display running counters that are updated whenever an SMTP
|
||||
session ends, a QUIT command is executed, or when "." is
|
||||
received.
|
||||
.IP \fB-C\fR
|
||||
Disable XCLIENT support.
|
||||
.IP \fB-e\fR
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* Patches change both the patchlevel and the release date. Snapshots have no
|
||||
* patchlevel; they change the release date only.
|
||||
*/
|
||||
#define MAIL_RELEASE_DATE "20050629"
|
||||
#define MAIL_RELEASE_DATE "20050630"
|
||||
#define MAIL_VERSION_NUMBER "2.3"
|
||||
|
||||
#define VAR_MAIL_VERSION "mail_version"
|
||||
|
@@ -240,7 +240,7 @@ static void scache_save_endp_service(VSTREAM *client_stream)
|
||||
||
|
||||
#endif
|
||||
(fd = LOCAL_RECV_FD(vstream_fileno(client_stream))) < 0) {
|
||||
msg_warn("%s: unable to receive file descriptor", myname);
|
||||
msg_warn("%s: unable to receive file descriptor: %m", myname);
|
||||
attr_print(client_stream, ATTR_FLAG_NONE,
|
||||
ATTR_TYPE_NUM, MAIL_ATTR_STATUS, SCACHE_STAT_FAIL,
|
||||
ATTR_TYPE_END);
|
||||
|
@@ -32,8 +32,9 @@
|
||||
/* .IP \fB-a\fR
|
||||
/* Do not announce SASL authentication support.
|
||||
/* .IP \fB-c\fR
|
||||
/* Display a running counter that is updated whenever an SMTP
|
||||
/* QUIT command is executed.
|
||||
/* Display running counters that are updated whenever an SMTP
|
||||
/* session ends, a QUIT command is executed, or when "." is
|
||||
/* received.
|
||||
/* .IP \fB-C\fR
|
||||
/* Disable XCLIENT support.
|
||||
/* .IP \fB-e\fR
|
||||
@@ -178,8 +179,10 @@ static int command_read(SINK_STATE *);
|
||||
static int data_read(SINK_STATE *);
|
||||
static void disconnect(SINK_STATE *);
|
||||
static int count;
|
||||
static int counter;
|
||||
static int max_count;
|
||||
static int sess_count;
|
||||
static int quit_count;
|
||||
static int mesg_count;
|
||||
static int max_quit_count;
|
||||
static int disable_pipelining;
|
||||
static int disable_8bitmime;
|
||||
static int fixed_delay;
|
||||
@@ -194,6 +197,15 @@ static int disable_enh_status;
|
||||
#define SOFT_ERROR_RESP "450 4.3.0 Error: command failed"
|
||||
#define HARD_ERROR_RESP "500 5.3.0 Error: command failed"
|
||||
|
||||
/* do_stats - show counters */
|
||||
|
||||
static void do_stats(void)
|
||||
{
|
||||
vstream_printf("sess=%d quit=%d mesg=%d\r",
|
||||
sess_count, quit_count, mesg_count);
|
||||
vstream_fflush(VSTREAM_OUT);
|
||||
}
|
||||
|
||||
/* hard_err_resp - generic hard error response */
|
||||
|
||||
static void hard_err_resp(SINK_STATE *state)
|
||||
@@ -329,11 +341,8 @@ static void quit_response(SINK_STATE *state)
|
||||
{
|
||||
smtp_printf(state->stream, "221 Bye");
|
||||
smtp_flush(state->stream);
|
||||
if (count) {
|
||||
counter++;
|
||||
vstream_printf("%d\r", counter);
|
||||
vstream_fflush(VSTREAM_OUT);
|
||||
}
|
||||
if (count)
|
||||
quit_count++;
|
||||
}
|
||||
|
||||
/* data_read - read data from socket */
|
||||
@@ -381,6 +390,10 @@ static int data_read(SINK_STATE *state)
|
||||
PUSH_BACK_SET(state, ".\r\n");
|
||||
state->read_fn = command_read;
|
||||
state->data_state = ST_ANY;
|
||||
if (count) {
|
||||
mesg_count++;
|
||||
do_stats();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -665,10 +678,14 @@ static void disconnect(SINK_STATE *state)
|
||||
{
|
||||
event_disable_readwrite(vstream_fileno(state->stream));
|
||||
event_cancel_timer(read_timeout, (char *) state);
|
||||
if (count) {
|
||||
sess_count++;
|
||||
do_stats();
|
||||
}
|
||||
vstream_fclose(state->stream);
|
||||
vstring_free(state->buffer);
|
||||
myfree((char *) state);
|
||||
if (max_count > 0 && counter >= max_count)
|
||||
if (max_quit_count > 0 && quit_count >= max_quit_count)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -805,7 +822,7 @@ int main(int argc, char **argv)
|
||||
enable_lmtp = 1;
|
||||
break;
|
||||
case 'n':
|
||||
if ((max_count = atoi(optarg)) <= 0)
|
||||
if ((max_quit_count = atoi(optarg)) <= 0)
|
||||
msg_fatal("bad count: %s", optarg);
|
||||
break;
|
||||
case 'p':
|
||||
|
@@ -61,17 +61,18 @@ int unix_recv_fd(int fd)
|
||||
|
||||
/*
|
||||
* Adapted from: W. Richard Stevens, UNIX Network Programming, Volume 1,
|
||||
* Second edition.
|
||||
* Second edition. Except that we use CMSG_LEN instead of CMSG_SPACE, for
|
||||
* portability to LP64 environments.
|
||||
*/
|
||||
#if defined(CMSG_SPACE) && !defined(NO_MSGHDR_MSG_CONTROL)
|
||||
union {
|
||||
struct msghdr just_for_alignment;
|
||||
struct cmsghdr just_for_alignment;
|
||||
char control[CMSG_SPACE(sizeof(newfd))];
|
||||
} control_un;
|
||||
struct cmsghdr *cmptr;
|
||||
|
||||
msg.msg_control = control_un.control;
|
||||
msg.msg_controllen = sizeof(control_un.control);
|
||||
msg.msg_controllen = CMSG_LEN(sizeof(newfd)); /* Fix 200506 */
|
||||
#else
|
||||
msg.msg_accrights = (char *) &newfd;
|
||||
msg.msg_accrightslen = sizeof(newfd);
|
||||
@@ -123,6 +124,8 @@ int unix_recv_fd(int fd)
|
||||
* unix_send_fd test program) and copy its content until EOF.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <split_at.h>
|
||||
#include <listen.h>
|
||||
|
||||
|
@@ -63,17 +63,18 @@ int unix_send_fd(int fd, int sendfd)
|
||||
|
||||
/*
|
||||
* Adapted from: W. Richard Stevens, UNIX Network Programming, Volume 1,
|
||||
* Second edition.
|
||||
* Second edition. Except that we use CMSG_LEN instead of CMSG_SPACE; the
|
||||
* latter breaks on LP64 systems.
|
||||
*/
|
||||
#if defined(CMSG_SPACE) && !defined(NO_MSGHDR_MSG_CONTROL)
|
||||
union {
|
||||
struct msghdr just_for_alignment;
|
||||
struct cmsghdr just_for_alignment;
|
||||
char control[CMSG_SPACE(sizeof(sendfd))];
|
||||
} control_un;
|
||||
struct cmsghdr *cmptr;
|
||||
|
||||
msg.msg_control = control_un.control;
|
||||
msg.msg_controllen = sizeof(control_un.control);
|
||||
msg.msg_controllen = CMSG_LEN(sizeof(sendfd)); /* Fix 200506 */
|
||||
|
||||
cmptr = CMSG_FIRSTHDR(&msg);
|
||||
cmptr->cmsg_len = CMSG_LEN(sizeof(sendfd));
|
||||
@@ -109,6 +110,8 @@ int unix_send_fd(int fd, int sendfd)
|
||||
* to the unix_recv_fd test program.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <split_at.h>
|
||||
#include <connect.h>
|
||||
|
Reference in New Issue
Block a user