mirror of
https://github.com/vdukhovni/postfix
synced 2025-09-03 23:55:18 +00:00
postfix-2.3-20051109
This commit is contained in:
committed by
Viktor Dukhovni
parent
3b9aae9ea8
commit
7388a24979
@@ -11342,6 +11342,17 @@ Apologies for any names omitted.
|
|||||||
the same message ID. Found by Victor. Files: global/mail_stream.c,
|
the same message ID. Found by Victor. Files: global/mail_stream.c,
|
||||||
global/mail_queue.c.
|
global/mail_queue.c.
|
||||||
|
|
||||||
|
20051109
|
||||||
|
|
||||||
|
qshape.pl updated for extra microsecond time field in Postfix
|
||||||
|
queue files.
|
||||||
|
|
||||||
|
Cleanup: removed obsolete code that handles rejected/dropped
|
||||||
|
connections before the HELO handshake. File: smtp/smtp_connect.c.
|
||||||
|
|
||||||
|
Bugfix: XCLIENT broke when reverse hostname support was added.
|
||||||
|
Fix by Tomoyuki Sakurai. File: smtpd/smtpd.c.
|
||||||
|
|
||||||
Open problems:
|
Open problems:
|
||||||
|
|
||||||
"postsuper -r" no longer resets the message arrival time,
|
"postsuper -r" no longer resets the message arrival time,
|
||||||
@@ -11352,11 +11363,6 @@ Open problems:
|
|||||||
Is it safe to cache a connection after it has been used
|
Is it safe to cache a connection after it has been used
|
||||||
for more than some number of address verification probes?
|
for more than some number of address verification probes?
|
||||||
|
|
||||||
The code in smtp_connect() that catches server reject and
|
|
||||||
disconnect errors has become redundant. Connections that
|
|
||||||
fail before MAIL FROM no longer count towards the MX session
|
|
||||||
count limit per delivery attempt.
|
|
||||||
|
|
||||||
Access map actions such as FILTER and REDIRECT don't work
|
Access map actions such as FILTER and REDIRECT don't work
|
||||||
in smtpd_end_of_data_restrictions (or anything else that
|
in smtpd_end_of_data_restrictions (or anything else that
|
||||||
generates additional queue file records after the message
|
generates additional queue file records after the message
|
||||||
|
@@ -440,7 +440,7 @@ Example:
|
|||||||
|
|
||||||
/etc/postfix/master.cf:
|
/etc/postfix/master.cf:
|
||||||
:10026 inet n - n - - smtpd
|
:10026 inet n - n - - smtpd
|
||||||
-o receive_override_options=nso_address_mapping
|
-o receive_override_options=no_address_mappings
|
||||||
|
|
||||||
Note: do not specify whitespace around the "=" here.
|
Note: do not specify whitespace around the "=" here.
|
||||||
|
|
||||||
|
@@ -26,8 +26,11 @@ server port number as hostname[hostaddr]:port.
|
|||||||
Incompatibility with snapshot 20051105
|
Incompatibility with snapshot 20051105
|
||||||
======================================
|
======================================
|
||||||
|
|
||||||
|
qshape needs to be updated. See the file qshape-microsecond-patch.
|
||||||
|
|
||||||
All delay logging now has sub-second resolution, including the
|
All delay logging now has sub-second resolution, including the
|
||||||
over-all "delay=nnn" logging.
|
over-all "delay=nnn" logging.
|
||||||
|
|
||||||
At this point the Postfix logging for a recipient looks like this:
|
At this point the Postfix logging for a recipient looks like this:
|
||||||
|
|
||||||
Nov 3 16:04:31 myname postfix/smtp[30840]: 19B6B2900FE:
|
Nov 3 16:04:31 myname postfix/smtp[30840]: 19B6B2900FE:
|
||||||
@@ -39,6 +42,9 @@ At this point the Postfix logging for a recipient looks like this:
|
|||||||
Incompatibility with snapshot 20051103
|
Incompatibility with snapshot 20051103
|
||||||
======================================
|
======================================
|
||||||
|
|
||||||
|
pflogsumm needs to be updated. See the pflogsumm-conn-delays-dsn-patch
|
||||||
|
file.
|
||||||
|
|
||||||
The queue manager protocol has changed. You need to "postfix reload"
|
The queue manager protocol has changed. You need to "postfix reload"
|
||||||
after "make upgrade".
|
after "make upgrade".
|
||||||
|
|
||||||
|
@@ -204,7 +204,7 @@ sub qenv {
|
|||||||
$dlen = $1 if ($d =~ /^\s*(\d+)\s+\d+\s+\d+/);
|
$dlen = $1 if ($d =~ /^\s*(\d+)\s+\d+\s+\d+/);
|
||||||
($r, $l, $d) = rec_get($h);
|
($r, $l, $d) = rec_get($h);
|
||||||
return unless (defined $r && $r eq "T");
|
return unless (defined $r && $r eq "T");
|
||||||
$t = $d;
|
($t) = split(/\s+/, $d);
|
||||||
} elsif ($r eq "S" || $r eq "F") {
|
} elsif ($r eq "S" || $r eq "F") {
|
||||||
# For embryonic queue files in the "maildrop" directory the first
|
# For embryonic queue files in the "maildrop" directory the first
|
||||||
# record is either a REC_TYPE_FULL (F) followed by REC_TYPE_FROM
|
# record is either a REC_TYPE_FULL (F) followed by REC_TYPE_FROM
|
||||||
|
@@ -702,7 +702,7 @@ Postfix version 2.1 and later. </p>
|
|||||||
<pre>
|
<pre>
|
||||||
/etc/postfix/master.cf:
|
/etc/postfix/master.cf:
|
||||||
:10026 inet n - n - - smtpd
|
:10026 inet n - n - - smtpd
|
||||||
-o <a href="postconf.5.html#receive_override_options">receive_override_options</a>=nso_address_mapping
|
-o <a href="postconf.5.html#receive_override_options">receive_override_options</a>=<a href="postconf.5.html#no_address_mappings">no_address_mappings</a>
|
||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
|
@@ -702,7 +702,7 @@ Postfix version 2.1 and later. </p>
|
|||||||
<pre>
|
<pre>
|
||||||
/etc/postfix/master.cf:
|
/etc/postfix/master.cf:
|
||||||
:10026 inet n - n - - smtpd
|
:10026 inet n - n - - smtpd
|
||||||
-o receive_override_options=nso_address_mapping
|
-o receive_override_options=no_address_mappings
|
||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
|
22
postfix/qshape-microsecond-patch
Normal file
22
postfix/qshape-microsecond-patch
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
This patch adds support for microsecond time information in Postfix
|
||||||
|
queue files.
|
||||||
|
|
||||||
|
*** /var/tmp/postfix-2.3-20051103/auxiliary/qshape/qshape.pl Fri Feb 4 19:41:14 2005
|
||||||
|
--- auxiliary/qshape/qshape.pl Wed Nov 9 08:43:40 2005
|
||||||
|
***************
|
||||||
|
*** 204,210 ****
|
||||||
|
$dlen = $1 if ($d =~ /^\s*(\d+)\s+\d+\s+\d+/);
|
||||||
|
($r, $l, $d) = rec_get($h);
|
||||||
|
return unless (defined $r && $r eq "T");
|
||||||
|
! $t = $d;
|
||||||
|
} elsif ($r eq "S" || $r eq "F") {
|
||||||
|
# For embryonic queue files in the "maildrop" directory the first
|
||||||
|
# record is either a REC_TYPE_FULL (F) followed by REC_TYPE_FROM
|
||||||
|
--- 204,210 ----
|
||||||
|
$dlen = $1 if ($d =~ /^\s*(\d+)\s+\d+\s+\d+/);
|
||||||
|
($r, $l, $d) = rec_get($h);
|
||||||
|
return unless (defined $r && $r eq "T");
|
||||||
|
! ($t) = split(/\s+/, $d);
|
||||||
|
} elsif ($r eq "S" || $r eq "F") {
|
||||||
|
# For embryonic queue files in the "maildrop" directory the first
|
||||||
|
# record is either a REC_TYPE_FULL (F) followed by REC_TYPE_FROM
|
@@ -594,8 +594,8 @@ static void cleanup_header_done_callback(void *context)
|
|||||||
* XXX An arbitrary amount of time may pass between the start of the mail
|
* XXX An arbitrary amount of time may pass between the start of the mail
|
||||||
* transaction and the creation of a queue file. Since we guarantee queue
|
* transaction and the creation of a queue file. Since we guarantee queue
|
||||||
* ID uniqueness only within a second, we must ensure that the time in
|
* ID uniqueness only within a second, we must ensure that the time in
|
||||||
* the message ID matches the queue ID creation time, if we use the queue
|
* the message ID matches the queue ID creation time, as long as we use
|
||||||
* ID in the message ID.
|
* the queue ID in the message ID.
|
||||||
*/
|
*/
|
||||||
if ((state->headers_seen & (1 << (state->resent[0] ?
|
if ((state->headers_seen & (1 << (state->resent[0] ?
|
||||||
HDR_RESENT_MESSAGE_ID : HDR_MESSAGE_ID))) == 0) {
|
HDR_RESENT_MESSAGE_ID : HDR_MESSAGE_ID))) == 0) {
|
||||||
|
@@ -87,7 +87,7 @@ void log_adhoc(const char *id, MSG_STATS *stats, RECIPIENT *recipient,
|
|||||||
const char *status)
|
const char *status)
|
||||||
{
|
{
|
||||||
static VSTRING *buf;
|
static VSTRING *buf;
|
||||||
DELTA_TIME delay;
|
DELTA_TIME delay; /* end-to-end delay */
|
||||||
DELTA_TIME pdelay; /* time before queue manager */
|
DELTA_TIME pdelay; /* time before queue manager */
|
||||||
DELTA_TIME adelay; /* queue manager latency */
|
DELTA_TIME adelay; /* queue manager latency */
|
||||||
DELTA_TIME sdelay; /* connection set-up latency */
|
DELTA_TIME sdelay; /* connection set-up latency */
|
||||||
@@ -96,8 +96,8 @@ void log_adhoc(const char *id, MSG_STATS *stats, RECIPIENT *recipient,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Alas, we need an intermediate buffer for the pre-formatted result.
|
* Alas, we need an intermediate buffer for the pre-formatted result.
|
||||||
* There are several optional fields, and we want to tweak some
|
* There are several optional fields, and the delay fields are formatted
|
||||||
* formatting depending on delay values.
|
* in a manner that is not supported by vstring_sprintf().
|
||||||
*/
|
*/
|
||||||
if (buf == 0)
|
if (buf == 0)
|
||||||
buf = vstring_alloc(100);
|
buf = vstring_alloc(100);
|
||||||
@@ -167,7 +167,7 @@ void log_adhoc(const char *id, MSG_STATS *stats, RECIPIENT *recipient,
|
|||||||
DELTA(sdelay, stats->conn_setup_done, stats->agent_handoff);
|
DELTA(sdelay, stats->conn_setup_done, stats->agent_handoff);
|
||||||
DELTA(xdelay, now, stats->conn_setup_done);
|
DELTA(xdelay, now, stats->conn_setup_done);
|
||||||
} else {
|
} else {
|
||||||
/* Non-network delivery agent. */
|
/* No network client. */
|
||||||
DELTA(xdelay, now, stats->agent_handoff);
|
DELTA(xdelay, now, stats->agent_handoff);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -181,13 +181,14 @@ void log_adhoc(const char *id, MSG_STATS *stats, RECIPIENT *recipient,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Round off large time values to an integral number of seconds, and
|
* Round off large time values to an integral number of seconds, and
|
||||||
* display small numbers with only two digits as long as we stay above
|
* display small numbers with only two significant digits, as long as
|
||||||
* the time resolution.
|
* they do not exceed the time resolution.
|
||||||
*/
|
*/
|
||||||
|
#define SIG_DIGS 2
|
||||||
#define PRETTY_FORMAT(b, text, x) \
|
#define PRETTY_FORMAT(b, text, x) \
|
||||||
do { \
|
do { \
|
||||||
vstring_strcat((b), text); \
|
vstring_strcat((b), text); \
|
||||||
format_tv((b), (x).dt_sec, (x).dt_usec, 2, var_delay_max_res); \
|
format_tv((b), (x).dt_sec, (x).dt_usec, SIG_DIGS, var_delay_max_res); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
PRETTY_FORMAT(buf, ", delay=", delay);
|
PRETTY_FORMAT(buf, ", delay=", delay);
|
||||||
|
@@ -177,7 +177,9 @@ extern char *mail_pathname(const char *, const char *);
|
|||||||
#define XCLIENT_CMD "XCLIENT" /* XCLIENT command */
|
#define XCLIENT_CMD "XCLIENT" /* XCLIENT command */
|
||||||
#define XCLIENT_NAME "NAME" /* client name */
|
#define XCLIENT_NAME "NAME" /* client name */
|
||||||
#define XCLIENT_REVERSE_NAME "REVERSE_NAME" /* reverse client name */
|
#define XCLIENT_REVERSE_NAME "REVERSE_NAME" /* reverse client name */
|
||||||
|
#ifdef FORWARD_CLIENT_NAME
|
||||||
#define XCLIENT_FORWARD_NAME "FORWARD_NAME" /* forward client name */
|
#define XCLIENT_FORWARD_NAME "FORWARD_NAME" /* forward client name */
|
||||||
|
#endif
|
||||||
#define XCLIENT_ADDR "ADDR" /* client address */
|
#define XCLIENT_ADDR "ADDR" /* client address */
|
||||||
#define XCLIENT_PROTO "PROTO" /* client protocol */
|
#define XCLIENT_PROTO "PROTO" /* client protocol */
|
||||||
#define XCLIENT_HELO "HELO" /* client helo */
|
#define XCLIENT_HELO "HELO" /* client helo */
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
* Patches change both the patchlevel and the release date. Snapshots have no
|
* Patches change both the patchlevel and the release date. Snapshots have no
|
||||||
* patchlevel; they change the release date only.
|
* patchlevel; they change the release date only.
|
||||||
*/
|
*/
|
||||||
#define MAIL_RELEASE_DATE "20051108"
|
#define MAIL_RELEASE_DATE "20051109"
|
||||||
#define MAIL_VERSION_NUMBER "2.3"
|
#define MAIL_VERSION_NUMBER "2.3"
|
||||||
|
|
||||||
#ifdef SNAPSHOT
|
#ifdef SNAPSHOT
|
||||||
|
@@ -233,6 +233,14 @@ static SMTP_SESSION *smtp_connect_addr(const char *dest, DNS_RR *addr,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Following code is obsolete now that the SMTP client will connect to
|
||||||
|
* alternate hosts when a session fails before "MAIL FROM".
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
stream = vstream_fdopen(sock, O_RDWR);
|
||||||
|
#else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip this host if it takes no action within some time limit. XXX Some
|
* Skip this host if it takes no action within some time limit. XXX Some
|
||||||
* MTAs use 426 to indicate a timeout error.
|
* MTAs use 426 to indicate a timeout error.
|
||||||
@@ -261,6 +269,7 @@ static SMTP_SESSION *smtp_connect_addr(const char *dest, DNS_RR *addr,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
vstream_ungetc(stream, ch);
|
vstream_ungetc(stream, ch);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bundle up what we have into a nice SMTP_SESSION object.
|
* Bundle up what we have into a nice SMTP_SESSION object.
|
||||||
|
@@ -1226,8 +1226,7 @@ static int ehlo_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
|
|||||||
ENQUEUE_FIX_REPLY(state, reply_buf, XCLIENT_CMD
|
ENQUEUE_FIX_REPLY(state, reply_buf, XCLIENT_CMD
|
||||||
" " XCLIENT_NAME " " XCLIENT_ADDR
|
" " XCLIENT_NAME " " XCLIENT_ADDR
|
||||||
" " XCLIENT_PROTO " " XCLIENT_HELO
|
" " XCLIENT_PROTO " " XCLIENT_HELO
|
||||||
" " XCLIENT_REVERSE_NAME
|
" " XCLIENT_REVERSE_NAME);
|
||||||
" " XCLIENT_FORWARD_NAME);
|
|
||||||
if ((discard_mask & EHLO_MASK_XFORWARD) == 0)
|
if ((discard_mask & EHLO_MASK_XFORWARD) == 0)
|
||||||
if (xforward_allowed)
|
if (xforward_allowed)
|
||||||
ENQUEUE_FIX_REPLY(state, reply_buf, XFORWARD_CMD
|
ENQUEUE_FIX_REPLY(state, reply_buf, XFORWARD_CMD
|
||||||
@@ -2694,10 +2693,6 @@ static int xclient_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
|
|||||||
if (name_status == SMTPD_PEER_CODE_OK) {
|
if (name_status == SMTPD_PEER_CODE_OK) {
|
||||||
UPDATE_STR(state->reverse_name, attr_value);
|
UPDATE_STR(state->reverse_name, attr_value);
|
||||||
state->reverse_name_status = name_status;
|
state->reverse_name_status = name_status;
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
UPDATE_STR(state->forward_name, attr_value);
|
|
||||||
state->forward_name_status = name_status;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2705,7 +2700,7 @@ static int xclient_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
|
|||||||
* REVERSE_NAME=substitute SMTP client reverse hostname. Also updates
|
* REVERSE_NAME=substitute SMTP client reverse hostname. Also updates
|
||||||
* the client reverse hostname lookup status code.
|
* the client reverse hostname lookup status code.
|
||||||
*/
|
*/
|
||||||
if (STREQ(attr_name, XCLIENT_REVERSE_NAME)) {
|
else if (STREQ(attr_name, XCLIENT_REVERSE_NAME)) {
|
||||||
name_status = name_code(peer_codes, NAME_CODE_FLAG_NONE, attr_value);
|
name_status = name_code(peer_codes, NAME_CODE_FLAG_NONE, attr_value);
|
||||||
if (name_status != SMTPD_PEER_CODE_OK) {
|
if (name_status != SMTPD_PEER_CODE_OK) {
|
||||||
attr_value = CLIENT_NAME_UNKNOWN;
|
attr_value = CLIENT_NAME_UNKNOWN;
|
||||||
@@ -2721,28 +2716,6 @@ static int xclient_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
|
|||||||
UPDATE_STR(state->reverse_name, attr_value);
|
UPDATE_STR(state->reverse_name, attr_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* FORWARD_NAME=substitute SMTP client forward hostname. Also updates
|
|
||||||
* the client forward hostname lookup status code.
|
|
||||||
*/
|
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
if (STREQ(attr_name, XCLIENT_FORWARD_NAME)) {
|
|
||||||
name_status = name_code(peer_codes, NAME_CODE_FLAG_NONE, attr_value);
|
|
||||||
if (name_status != SMTPD_PEER_CODE_OK) {
|
|
||||||
attr_value = CLIENT_NAME_UNKNOWN;
|
|
||||||
} else {
|
|
||||||
if (!valid_hostname(attr_value, DONT_GRIPE)) {
|
|
||||||
state->error_mask |= MAIL_ERROR_PROTOCOL;
|
|
||||||
smtpd_chat_reply(state, "501 5.5.4 Bad %s syntax: %s",
|
|
||||||
XCLIENT_FORWARD_NAME, attr_value);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state->forward_name_status = name_status;
|
|
||||||
UPDATE_STR(state->forward_name, attr_value);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ADDR=substitute SMTP client network address.
|
* ADDR=substitute SMTP client network address.
|
||||||
*/
|
*/
|
||||||
|
@@ -77,18 +77,12 @@ typedef struct SMTPD_STATE {
|
|||||||
struct timeval arrival_time; /* start of MAIL FROM transaction */
|
struct timeval arrival_time; /* start of MAIL FROM transaction */
|
||||||
char *name; /* verified client hostname */
|
char *name; /* verified client hostname */
|
||||||
char *reverse_name; /* unverified client hostname */
|
char *reverse_name; /* unverified client hostname */
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
char *forward_name; /* unverified client hostname */
|
|
||||||
#endif
|
|
||||||
char *addr; /* client host address string */
|
char *addr; /* client host address string */
|
||||||
char *namaddr; /* combined name and address */
|
char *namaddr; /* combined name and address */
|
||||||
char *rfc_addr; /* address for RFC 2821 */
|
char *rfc_addr; /* address for RFC 2821 */
|
||||||
struct sockaddr_storage sockaddr; /* binary client endpoint */
|
struct sockaddr_storage sockaddr; /* binary client endpoint */
|
||||||
int name_status; /* 2=ok, 4=soft, 5=hard */
|
int name_status; /* 2=ok, 4=soft, 5=hard */
|
||||||
int reverse_name_status; /* 2=ok, 4=soft, 5=hard */
|
int reverse_name_status; /* 2=ok, 4=soft, 5=hard */
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
int forward_name_status; /* 2=ok, 4=soft, 5=hard */
|
|
||||||
#endif
|
|
||||||
int error_count; /* reset after DOT */
|
int error_count; /* reset after DOT */
|
||||||
int error_mask; /* client errors */
|
int error_mask; /* client errors */
|
||||||
int notify_mask; /* what to report to postmaster */
|
int notify_mask; /* what to report to postmaster */
|
||||||
|
@@ -933,28 +933,6 @@ static int reject_unknown_reverse_name(SMTPD_STATE *state)
|
|||||||
return (SMTPD_CHECK_DUNNO);
|
return (SMTPD_CHECK_DUNNO);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
|
|
||||||
/* reject_unknown_forward_name - fail if reverse client hostname is unknown */
|
|
||||||
|
|
||||||
static int reject_unknown_forward_name(SMTPD_STATE *state)
|
|
||||||
{
|
|
||||||
char *myname = "reject_unknown_forward_name";
|
|
||||||
|
|
||||||
if (msg_verbose)
|
|
||||||
msg_info("%s: %s", myname, state->forward_name);
|
|
||||||
|
|
||||||
if (state->forward_name_status != SMTPD_PEER_CODE_OK)
|
|
||||||
return (smtpd_check_reject(state, MAIL_ERROR_POLICY,
|
|
||||||
state->forward_name_status == SMTPD_PEER_CODE_PERM ?
|
|
||||||
var_unk_client_code : 450, "4.7.1",
|
|
||||||
"Client host rejected: cannot find your forward hostname, [%s]",
|
|
||||||
state->addr));
|
|
||||||
return (SMTPD_CHECK_DUNNO);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* reject_unknown_client - fail if client hostname is unknown */
|
/* reject_unknown_client - fail if client hostname is unknown */
|
||||||
|
|
||||||
static int reject_unknown_client(SMTPD_STATE *state)
|
static int reject_unknown_client(SMTPD_STATE *state)
|
||||||
@@ -2760,10 +2738,6 @@ static const char *smtpd_expand_lookup(const char *name, int unused_mode,
|
|||||||
return (state->name);
|
return (state->name);
|
||||||
} else if (STREQ(name, MAIL_ATTR_REVERSE_CLIENT_NAME)) {
|
} else if (STREQ(name, MAIL_ATTR_REVERSE_CLIENT_NAME)) {
|
||||||
return (state->reverse_name);
|
return (state->reverse_name);
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
} else if (STREQ(name, MAIL_ATTR_FORWARD_CLIENT_NAME)) {
|
|
||||||
return (state->forward_name);
|
|
||||||
#endif
|
|
||||||
} else if (STREQ(name, MAIL_ATTR_HELO_NAME)) {
|
} else if (STREQ(name, MAIL_ATTR_HELO_NAME)) {
|
||||||
return (state->helo_name ? state->helo_name : "");
|
return (state->helo_name ? state->helo_name : "");
|
||||||
} else if (STREQN(name, MAIL_ATTR_SENDER, CONST_LEN(MAIL_ATTR_SENDER))) {
|
} else if (STREQN(name, MAIL_ATTR_SENDER, CONST_LEN(MAIL_ATTR_SENDER))) {
|
||||||
@@ -3209,10 +3183,6 @@ static int check_policy_service(SMTPD_STATE *state, const char *server,
|
|||||||
ATTR_TYPE_STR, MAIL_ATTR_CLIENT_NAME, state->name,
|
ATTR_TYPE_STR, MAIL_ATTR_CLIENT_NAME, state->name,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_REVERSE_CLIENT_NAME,
|
ATTR_TYPE_STR, MAIL_ATTR_REVERSE_CLIENT_NAME,
|
||||||
state->reverse_name,
|
state->reverse_name,
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_FORWARD_CLIENT_NAME,
|
|
||||||
state->forward_name,
|
|
||||||
#endif
|
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_HELO_NAME,
|
ATTR_TYPE_STR, MAIL_ATTR_HELO_NAME,
|
||||||
state->helo_name ? state->helo_name : "",
|
state->helo_name ? state->helo_name : "",
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_SENDER,
|
ATTR_TYPE_STR, MAIL_ATTR_SENDER,
|
||||||
@@ -3431,10 +3401,6 @@ static int generic_checks(SMTPD_STATE *state, ARGV *restrictions,
|
|||||||
status = reject_unknown_client(state);
|
status = reject_unknown_client(state);
|
||||||
} else if (strcasecmp(name, REJECT_UNKNOWN_REVERSE_HOSTNAME) == 0) {
|
} else if (strcasecmp(name, REJECT_UNKNOWN_REVERSE_HOSTNAME) == 0) {
|
||||||
status = reject_unknown_reverse_name(state);
|
status = reject_unknown_reverse_name(state);
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
} else if (strcasecmp(name, REJECT_UNKNOWN_FORWARD_HOSTNAME) == 0) {
|
|
||||||
status = reject_unknown_forward_name(state);
|
|
||||||
#endif
|
|
||||||
} else if (strcasecmp(name, PERMIT_INET_INTERFACES) == 0) {
|
} else if (strcasecmp(name, PERMIT_INET_INTERFACES) == 0) {
|
||||||
status = permit_inet_interfaces(state);
|
status = permit_inet_interfaces(state);
|
||||||
} else if (strcasecmp(name, PERMIT_MYNETWORKS) == 0) {
|
} else if (strcasecmp(name, PERMIT_MYNETWORKS) == 0) {
|
||||||
@@ -4954,23 +4920,14 @@ int main(int argc, char **argv)
|
|||||||
state.where = "CONNECT";
|
state.where = "CONNECT";
|
||||||
UPDATE_STRING(state.name, args->argv[1]);
|
UPDATE_STRING(state.name, args->argv[1]);
|
||||||
UPDATE_STRING(state.reverse_name, args->argv[1]);
|
UPDATE_STRING(state.reverse_name, args->argv[1]);
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
UPDATE_STRING(state.forward_name, args->argv[1]);
|
|
||||||
#endif
|
|
||||||
UPDATE_STRING(state.addr, args->argv[2]);
|
UPDATE_STRING(state.addr, args->argv[2]);
|
||||||
if (args->argc == 4)
|
if (args->argc == 4)
|
||||||
state.name_status =
|
state.name_status =
|
||||||
state.reverse_name_status =
|
state.reverse_name_status =
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
state.forward_name_status =
|
|
||||||
#endif
|
|
||||||
atoi(args->argv[3]);
|
atoi(args->argv[3]);
|
||||||
else
|
else
|
||||||
state.name_status =
|
state.name_status =
|
||||||
state.reverse_name_status =
|
state.reverse_name_status =
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
state.forward_name_status =
|
|
||||||
#endif
|
|
||||||
SMTPD_PEER_CODE_OK;
|
SMTPD_PEER_CODE_OK;
|
||||||
if (state.namaddr)
|
if (state.namaddr)
|
||||||
myfree(state.namaddr);
|
myfree(state.namaddr);
|
||||||
|
@@ -149,16 +149,10 @@ void smtpd_peer_init(SMTPD_STATE *state)
|
|||||||
if (errno == ECONNRESET || errno == ECONNABORTED) {
|
if (errno == ECONNRESET || errno == ECONNABORTED) {
|
||||||
state->name = mystrdup(CLIENT_NAME_UNKNOWN);
|
state->name = mystrdup(CLIENT_NAME_UNKNOWN);
|
||||||
state->reverse_name = mystrdup(CLIENT_NAME_UNKNOWN);
|
state->reverse_name = mystrdup(CLIENT_NAME_UNKNOWN);
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
state->forward_name = mystrdup(CLIENT_NAME_UNKNOWN);
|
|
||||||
#endif
|
|
||||||
state->addr = mystrdup(CLIENT_ADDR_UNKNOWN);
|
state->addr = mystrdup(CLIENT_ADDR_UNKNOWN);
|
||||||
state->rfc_addr = mystrdup(CLIENT_ADDR_UNKNOWN);
|
state->rfc_addr = mystrdup(CLIENT_ADDR_UNKNOWN);
|
||||||
state->name_status = SMTPD_PEER_CODE_PERM;
|
state->name_status = SMTPD_PEER_CODE_PERM;
|
||||||
state->reverse_name_status = SMTPD_PEER_CODE_PERM;
|
state->reverse_name_status = SMTPD_PEER_CODE_PERM;
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
state->forward_name_status = SMTPD_PEER_CODE_PERM;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -255,29 +249,16 @@ void smtpd_peer_init(SMTPD_STATE *state)
|
|||||||
if (var_smtpd_peername_lookup == 0) {
|
if (var_smtpd_peername_lookup == 0) {
|
||||||
state->name = mystrdup(CLIENT_NAME_UNKNOWN);
|
state->name = mystrdup(CLIENT_NAME_UNKNOWN);
|
||||||
state->reverse_name = mystrdup(CLIENT_NAME_UNKNOWN);
|
state->reverse_name = mystrdup(CLIENT_NAME_UNKNOWN);
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
state->forward_name = mystrdup(CLIENT_NAME_UNKNOWN);
|
|
||||||
#endif
|
|
||||||
state->name_status = SMTPD_PEER_CODE_PERM;
|
state->name_status = SMTPD_PEER_CODE_PERM;
|
||||||
state->reverse_name_status = SMTPD_PEER_CODE_PERM;
|
state->reverse_name_status = SMTPD_PEER_CODE_PERM;
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
state->forward_name_status = SMTPD_PEER_CODE_PERM;
|
|
||||||
#endif
|
|
||||||
} else if ((aierr = sockaddr_to_hostname(sa, sa_len, &client_name,
|
} else if ((aierr = sockaddr_to_hostname(sa, sa_len, &client_name,
|
||||||
(MAI_SERVNAME_STR *) 0, 0)) != 0) {
|
(MAI_SERVNAME_STR *) 0, 0)) != 0) {
|
||||||
state->name = mystrdup(CLIENT_NAME_UNKNOWN);
|
state->name = mystrdup(CLIENT_NAME_UNKNOWN);
|
||||||
state->reverse_name = mystrdup(CLIENT_NAME_UNKNOWN);
|
state->reverse_name = mystrdup(CLIENT_NAME_UNKNOWN);
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
state->forward_name = mystrdup(CLIENT_NAME_UNKNOWN);
|
|
||||||
#endif
|
|
||||||
state->name_status = (TEMP_AI_ERROR(aierr) ?
|
state->name_status = (TEMP_AI_ERROR(aierr) ?
|
||||||
SMTPD_PEER_CODE_TEMP : SMTPD_PEER_CODE_PERM);
|
SMTPD_PEER_CODE_TEMP : SMTPD_PEER_CODE_PERM);
|
||||||
state->reverse_name_status = (TEMP_AI_ERROR(aierr) ?
|
state->reverse_name_status = (TEMP_AI_ERROR(aierr) ?
|
||||||
SMTPD_PEER_CODE_TEMP : SMTPD_PEER_CODE_PERM);
|
SMTPD_PEER_CODE_TEMP : SMTPD_PEER_CODE_PERM);
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
state->forward_name_status = (TEMP_AI_ERROR(aierr) ?
|
|
||||||
SMTPD_PEER_CODE_TEMP : SMTPD_PEER_CODE_PERM);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
struct addrinfo *res0;
|
struct addrinfo *res0;
|
||||||
struct addrinfo *res;
|
struct addrinfo *res;
|
||||||
@@ -297,23 +278,9 @@ void smtpd_peer_init(SMTPD_STATE *state)
|
|||||||
if (aierr) {
|
if (aierr) {
|
||||||
msg_warn("%s: hostname %s verification failed: %s",
|
msg_warn("%s: hostname %s verification failed: %s",
|
||||||
state->addr, state->name, MAI_STRERROR(aierr));
|
state->addr, state->name, MAI_STRERROR(aierr));
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
state->forward_name = mystrdup(CLIENT_NAME_UNKNOWN);
|
|
||||||
state->forward_name_status = (TEMP_AI_ERROR(aierr) ?
|
|
||||||
SMTPD_PEER_CODE_TEMP : SMTPD_PEER_CODE_PERM);
|
|
||||||
#endif
|
|
||||||
REJECT_PEER_NAME(state, (TEMP_AI_ERROR(aierr) ?
|
REJECT_PEER_NAME(state, (TEMP_AI_ERROR(aierr) ?
|
||||||
SMTPD_PEER_CODE_TEMP : SMTPD_PEER_CODE_PERM));
|
SMTPD_PEER_CODE_TEMP : SMTPD_PEER_CODE_PERM));
|
||||||
} else {
|
} else {
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
if (res0) {
|
|
||||||
state->forward_name = mystrdup(res0->ai_canonname);
|
|
||||||
state->forward_name_status = SMTPD_PEER_CODE_OK;
|
|
||||||
} else {
|
|
||||||
state->forward_name = mystrdup(CLIENT_NAME_UNKNOWN);
|
|
||||||
state->forward_name_status = SMTPD_PEER_CODE_PERM;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
for (res = res0; /* void */ ; res = res->ai_next) {
|
for (res = res0; /* void */ ; res = res->ai_next) {
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
msg_warn("%s: address not listed for hostname %s",
|
msg_warn("%s: address not listed for hostname %s",
|
||||||
@@ -341,16 +308,10 @@ void smtpd_peer_init(SMTPD_STATE *state)
|
|||||||
else {
|
else {
|
||||||
state->name = mystrdup("localhost");
|
state->name = mystrdup("localhost");
|
||||||
state->reverse_name = mystrdup("localhost");
|
state->reverse_name = mystrdup("localhost");
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
state->forward_name = mystrdup("localhost");
|
|
||||||
#endif
|
|
||||||
state->addr = mystrdup("127.0.0.1"); /* XXX bogus. */
|
state->addr = mystrdup("127.0.0.1"); /* XXX bogus. */
|
||||||
state->rfc_addr = mystrdup("127.0.0.1");/* XXX bogus. */
|
state->rfc_addr = mystrdup("127.0.0.1");/* XXX bogus. */
|
||||||
state->name_status = SMTPD_PEER_CODE_OK;
|
state->name_status = SMTPD_PEER_CODE_OK;
|
||||||
state->reverse_name_status = SMTPD_PEER_CODE_OK;
|
state->reverse_name_status = SMTPD_PEER_CODE_OK;
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
state->forward_name_status = SMTPD_PEER_CODE_OK;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -366,9 +327,6 @@ void smtpd_peer_reset(SMTPD_STATE *state)
|
|||||||
{
|
{
|
||||||
myfree(state->name);
|
myfree(state->name);
|
||||||
myfree(state->reverse_name);
|
myfree(state->reverse_name);
|
||||||
#ifdef FORWARD_CLIENT_NAME
|
|
||||||
myfree(state->forward_name);
|
|
||||||
#endif
|
|
||||||
myfree(state->addr);
|
myfree(state->addr);
|
||||||
myfree(state->namaddr);
|
myfree(state->namaddr);
|
||||||
myfree(state->rfc_addr);
|
myfree(state->rfc_addr);
|
||||||
|
@@ -2,43 +2,46 @@
|
|||||||
/* NAME
|
/* NAME
|
||||||
/* format_tv 3
|
/* format_tv 3
|
||||||
/* SUMMARY
|
/* SUMMARY
|
||||||
/* format time value with limited precision
|
/* format time value with sane precision
|
||||||
/* SYNOPSIS
|
/* SYNOPSIS
|
||||||
/* #include <format_tv.h>
|
/* #include <format_tv.h>
|
||||||
/*
|
/*
|
||||||
/* VSTRING *format_tv(buffer, sec, usec, width, max_pos)
|
/* VSTRING *format_tv(buffer, sec, usec, sig_dig, max_dig)
|
||||||
/* VSTRING *buffer;
|
/* VSTRING *buffer;
|
||||||
/* int sec;
|
/* int sec;
|
||||||
/* int usec;
|
/* int usec;
|
||||||
/* int width;
|
/* int sig_dig;
|
||||||
/* int max_pos;
|
/* int max_dig;
|
||||||
/* DESCRIPTION
|
/* DESCRIPTION
|
||||||
/* format_tv() formats the specified time while suppressing
|
/* format_tv() formats the specified time as a floating-point
|
||||||
/* irrelevant digits in the output. Large numbers are always
|
/* number while suppressing irrelevant digits in the output.
|
||||||
/* rounded up to an integral number of seconds. Small numbers
|
/* Large numbers are always rounded up to an integral number
|
||||||
/* are produced with a limited number of digits, provided that
|
/* of seconds. Small numbers are produced with a limited number
|
||||||
/* those digits don't exceed the limit on the number of positions
|
/* of significant digits, provided that the result does not
|
||||||
/* after the decimal point. Trailing zeros are always omitted
|
/* exceed the limit on the total number of digits after the
|
||||||
/* from the output.
|
/* decimal point. Trailing zeros are always omitted from the
|
||||||
|
/* output.
|
||||||
/*
|
/*
|
||||||
/* Arguments:
|
/* Arguments:
|
||||||
/* .IP buffer
|
/* .IP buffer
|
||||||
/* Buffer to which the result is appended.
|
/* The buffer to which the result is appended.
|
||||||
/* .IP sec
|
/* .IP sec
|
||||||
/* The seconds portion of the time value.
|
/* The seconds portion of the time value.
|
||||||
/* .IP usec
|
/* .IP usec
|
||||||
/* The microseconds portion of the time value.
|
/* The microseconds portion of the time value.
|
||||||
/* .IP width
|
/* .IP sig_dig
|
||||||
/* The maximal number of digits to produce when formatting
|
/* The maximal number of significant digits when formatting
|
||||||
/* small numbers. Trailing nulls are always omitted. Specify
|
/* small numbers. Leading nulls don't count as significant,
|
||||||
|
/* and trailing nulls are not included in the output. Specify
|
||||||
/* a number in the range 1..6.
|
/* a number in the range 1..6.
|
||||||
/* .IP max_pos
|
/* .IP max_dig
|
||||||
/* The maximal number of positions after the decimal point.
|
/* The maximal number of all digits after the decimal point.
|
||||||
/* Specify a number in the range 0..6.
|
/* Specify a number in the range 0..6.
|
||||||
/* LICENSE
|
/* LICENSE
|
||||||
/* .ad
|
/* .ad
|
||||||
/* .fi
|
/* fi
|
||||||
/* The Secure Mailer license must be distributed with this software.
|
/* The Secure Mailer license must be distributed with this
|
||||||
|
/* software.
|
||||||
/* AUTHOR(S)
|
/* AUTHOR(S)
|
||||||
/* Wietse Venema
|
/* Wietse Venema
|
||||||
/* IBM T.J. Watson Research
|
/* IBM T.J. Watson Research
|
||||||
@@ -59,7 +62,8 @@
|
|||||||
|
|
||||||
/* format_tv - print time with limited precision */
|
/* format_tv - print time with limited precision */
|
||||||
|
|
||||||
VSTRING *format_tv(VSTRING *buf, int sec, int usec, int width, int max)
|
VSTRING *format_tv(VSTRING *buf, int sec, int usec,
|
||||||
|
int sig_dig, int max_dig)
|
||||||
{
|
{
|
||||||
static int pow10[] = {1, 10, 100, 1000, 10000, 100000, 1000000};
|
static int pow10[] = {1, 10, 100, 1000, 10000, 100000, 1000000};
|
||||||
int n;
|
int n;
|
||||||
@@ -70,14 +74,14 @@ VSTRING *format_tv(VSTRING *buf, int sec, int usec, int width, int max)
|
|||||||
/*
|
/*
|
||||||
* Sanity check.
|
* Sanity check.
|
||||||
*/
|
*/
|
||||||
if (max < 0 || max > 6)
|
if (max_dig < 0 || max_dig > 6)
|
||||||
msg_panic("format_tv: bad max decimal count %d", max);
|
msg_panic("format_tv: bad maximum decimal count %d", max_dig);
|
||||||
if (sec < 0 || usec < 0 || usec > MILLION)
|
if (sec < 0 || usec < 0 || usec > MILLION)
|
||||||
msg_panic("format_tv: bad time %ds %dus", sec, usec);
|
msg_panic("format_tv: bad time %ds %dus", sec, usec);
|
||||||
if (width < 1 || width > 6)
|
if (sig_dig < 1 || sig_dig > 6)
|
||||||
msg_panic("format_tv: bad width %d", width);
|
msg_panic("format_tv: bad significant decimal count %d", sig_dig);
|
||||||
ures = MILLION / pow10[max];
|
ures = MILLION / pow10[max_dig];
|
||||||
wid = pow10[width];
|
wid = pow10[sig_dig];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adjust the resolution to suppress irrelevant digits.
|
* Adjust the resolution to suppress irrelevant digits.
|
||||||
@@ -132,19 +136,19 @@ int main(int argc, char **argv)
|
|||||||
double tval;
|
double tval;
|
||||||
int sec;
|
int sec;
|
||||||
int usec;
|
int usec;
|
||||||
int width;
|
int sig_dig;
|
||||||
int max_pos;
|
int max_dig;
|
||||||
|
|
||||||
while (vstring_get_nonl(in, VSTREAM_IN) > 0) {
|
while (vstring_get_nonl(in, VSTREAM_IN) > 0) {
|
||||||
vstream_printf(">> %s\n", vstring_str(in));
|
vstream_printf(">> %s\n", vstring_str(in));
|
||||||
if (vstring_str(in)[0] == 0 || vstring_str(in)[0] == '#')
|
if (vstring_str(in)[0] == 0 || vstring_str(in)[0] == '#')
|
||||||
continue;
|
continue;
|
||||||
if (sscanf(vstring_str(in), "%lf %d %d", &tval, &width, &max_pos) != 3)
|
if (sscanf(vstring_str(in), "%lf %d %d", &tval, &sig_dig, &max_dig) != 3)
|
||||||
msg_fatal("bad input: %s", vstring_str(in));
|
msg_fatal("bad input: %s", vstring_str(in));
|
||||||
sec = (int) tval; /* raw seconds */
|
sec = (int) tval; /* raw seconds */
|
||||||
usec = (tval - sec) * MILLION; /* raw microseconds */
|
usec = (tval - sec) * MILLION; /* raw microseconds */
|
||||||
VSTRING_RESET(out);
|
VSTRING_RESET(out);
|
||||||
format_tv(out, sec, usec, width, max_pos);
|
format_tv(out, sec, usec, sig_dig, max_dig);
|
||||||
vstream_printf("%s\n", vstring_str(out));
|
vstream_printf("%s\n", vstring_str(out));
|
||||||
vstream_fflush(VSTREAM_OUT);
|
vstream_fflush(VSTREAM_OUT);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user