mirror of
https://github.com/vdukhovni/postfix
synced 2025-08-22 01:49:47 +00:00
postfix-3.9-20240129
This commit is contained in:
parent
261ef16d2f
commit
36c1c0967b
@ -27772,3 +27772,18 @@ Apologies for any names omitted.
|
||||
postdrop/postdrop.c, postsuper/postsuper.c, sendmail/sendmail.c,
|
||||
dnsblog/dnsblog.c, postkick/postkick.c, postlock/postlock.c,
|
||||
qmgr/qmgr.c, qmqpd/qmqpd.c, trivial-rewrite/trivial-rewrite.c.
|
||||
|
||||
20240129
|
||||
|
||||
Documentation: be more precise about server lookups with
|
||||
MX or SRV records. File: smtp/smtp.c.
|
||||
|
||||
Documentation: postlogd is not a short-running process. It
|
||||
wil keep running until it reaches the max_idle limit. File:
|
||||
postlogd/postlogd.c.
|
||||
|
||||
Cleanup (no semantic change): in the mysql: and pgsql:
|
||||
clients, made the hard-coded idle and retry timer settings
|
||||
configurable, and updated the mysql_table(5) and pgsql_table(5)
|
||||
manpages. Files: global/dict_mysql.c, global/dict_pgsql.c,
|
||||
proto/mysql_table, proto/pgsql_table.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -80,6 +80,18 @@ MYSQL_TABLE(5) MYSQL_TABLE(5)
|
||||
earlier Postfix versions, the default was chosen by the MySQL
|
||||
implementation (<b>utf8mb4</b> as of MySQL 8.0, <b>latin1</b> historically).
|
||||
|
||||
<b>idle_interval (default: 60)</b>
|
||||
The number of seconds after which an idle database connection
|
||||
will be closed.
|
||||
|
||||
This feature is available in Postfix 3.9 and later.
|
||||
|
||||
<b>retry_interval (default: 60)</b>
|
||||
The number of seconds that a database connection will be skipped
|
||||
after an error.
|
||||
|
||||
This feature is available in Postfix 3.9 and later.
|
||||
|
||||
<b>query</b> The SQL query template used to search the database, where <b>%s</b> is
|
||||
a substitute for the address Postfix is trying to resolve, e.g.
|
||||
query = SELECT replacement FROM aliases WHERE mailbox = '%s'
|
||||
|
@ -72,11 +72,24 @@ PGSQL_TABLE(5) PGSQL_TABLE(5)
|
||||
The encoding used by the database client. The default setting
|
||||
is:
|
||||
encoding = UTF8
|
||||
|
||||
Historically, the database client was hard coded to use LATIN1
|
||||
in an attempt to disable multibyte character support.
|
||||
|
||||
This feature is available in Postfix 3.8 and later.
|
||||
|
||||
<b>idle_interval (default: 60)</b>
|
||||
The number of seconds after which an idle database connection
|
||||
will be closed.
|
||||
|
||||
This feature is available in Postfix 3.9 and later.
|
||||
|
||||
<b>retry_interval (default: 60)</b>
|
||||
The number of seconds that a database connection will be skipped
|
||||
after an error.
|
||||
|
||||
This feature is available in Postfix 3.9 and later.
|
||||
|
||||
<b>query</b> The SQL query template used to search the database, where <b>%s</b> is
|
||||
a substitute for the address Postfix is trying to resolve, e.g.
|
||||
query = SELECT replacement FROM aliases WHERE mailbox = '%s'
|
||||
|
@ -10313,11 +10313,12 @@ gateway host instead.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In the case of SMTP or LMTP delivery, specify one or more destinations
|
||||
in the form of a domain name, hostname, hostname:port, [hostname]:port,
|
||||
[hostaddress] or [hostaddress]:port, separated by comma or whitespace.
|
||||
The form [hostname] turns off MX lookups. Multiple destinations are
|
||||
supported in Postfix 3.5 and later.
|
||||
In the case of SMTP delivery, specify one or more destinations in
|
||||
the form of a domain name, hostname, hostname:service, [hostname]:service,
|
||||
[hostaddress] or [hostaddress]:service, separated by comma or whitespace.
|
||||
The form [hostname] turns off MX or SRV lookups. Multiple destinations
|
||||
are supported in Postfix 3.5 and later. Each destination is tried
|
||||
in the specified order.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@ -36,9 +36,9 @@ POSTLOGD(8) POSTLOGD(8)
|
||||
<a href="postqueue.1.html"><b>postqueue</b>(1)</a> and (Postfix >= 3.7) <a href="postlog.1.html"><b>postlog</b>(1)</a>.
|
||||
|
||||
<b>CONFIGURATION PARAMETERS</b>
|
||||
Changes to <a href="postconf.5.html"><b>main.cf</b></a> are picked up automatically, as <a href="postlogd.8.html"><b>postlogd</b>(8)</a> pro-
|
||||
cesses run for only a limited amount of time. Use the command "<b>postfix</b>
|
||||
<b>reload</b>" to speed up a change.
|
||||
Changes to <a href="postconf.5.html"><b>main.cf</b></a> are not picked up automatically, because <a href="postlogd.8.html"><b>postlogd</b>(8)</a>
|
||||
terminates only after reaching the <b><a href="postconf.5.html#max_idle">max_idle</a></b> time limit. Use the com-
|
||||
mand "<b>postfix reload</b>" to speed up a change.
|
||||
|
||||
The text below provides only a parameter summary. See <a href="postconf.5.html"><b>postconf</b>(5)</a> for
|
||||
more details including examples.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -97,6 +97,16 @@ This parameter is available with Postfix 3.9 and later.
|
||||
With earlier Postfix versions, the default was chosen by
|
||||
the MySQL implementation (\fButf8mb4\fR as of MySQL 8.0,
|
||||
\fBlatin1\fR historically).
|
||||
.IP "\fBidle_interval (default: 60)\fR"
|
||||
The number of seconds after which an idle database connection
|
||||
will be closed.
|
||||
|
||||
This feature is available in Postfix 3.9 and later.
|
||||
.IP "\fBretry_interval (default: 60)\fR"
|
||||
The number of seconds that a database connection will be
|
||||
skipped after an error.
|
||||
|
||||
This feature is available in Postfix 3.9 and later.
|
||||
.IP "\fBquery\fR"
|
||||
The SQL query template used to search the database, where \fB%s\fR
|
||||
is a substitute for the address Postfix is trying to resolve,
|
||||
|
@ -90,10 +90,21 @@ is:
|
||||
.nf
|
||||
encoding = UTF8
|
||||
.fi
|
||||
|
||||
Historically, the database client was hard coded to use
|
||||
LATIN1 in an attempt to disable multibyte character support.
|
||||
|
||||
This feature is available in Postfix 3.8 and later.
|
||||
.IP "\fBidle_interval (default: 60)\fR"
|
||||
The number of seconds after which an idle database connection
|
||||
will be closed.
|
||||
|
||||
This feature is available in Postfix 3.9 and later.
|
||||
.IP "\fBretry_interval (default: 60)\fR"
|
||||
The number of seconds that a database connection will be
|
||||
skipped after an error.
|
||||
|
||||
This feature is available in Postfix 3.9 and later.
|
||||
.IP "\fBquery\fR"
|
||||
The SQL query template used to search the database, where \fB%s\fR
|
||||
is a substitute for the address Postfix is trying to resolve,
|
||||
|
@ -6531,11 +6531,12 @@ On an intranet, specify the organizational domain name. If your
|
||||
internal DNS uses no MX records, specify the name of the intranet
|
||||
gateway host instead.
|
||||
.PP
|
||||
In the case of SMTP or LMTP delivery, specify one or more destinations
|
||||
in the form of a domain name, hostname, hostname:port, [hostname]:port,
|
||||
[hostaddress] or [hostaddress]:port, separated by comma or whitespace.
|
||||
The form [hostname] turns off MX lookups. Multiple destinations are
|
||||
supported in Postfix 3.5 and later.
|
||||
In the case of SMTP delivery, specify one or more destinations in
|
||||
the form of a domain name, hostname, hostname:service, [hostname]:service,
|
||||
[hostaddress] or [hostaddress]:service, separated by comma or whitespace.
|
||||
The form [hostname] turns off MX or SRV lookups. Multiple destinations
|
||||
are supported in Postfix 3.5 and later. Each destination is tried
|
||||
in the specified order.
|
||||
.PP
|
||||
If you're connected via UUCP, see the UUCP_README file for useful
|
||||
information.
|
||||
|
@ -41,10 +41,10 @@ set this permission on programs other than \fBpostdrop\fR(1),
|
||||
.nf
|
||||
.ad
|
||||
.fi
|
||||
Changes to \fBmain.cf\fR are picked up automatically, as
|
||||
\fBpostlogd\fR(8) processes run for only a limited amount
|
||||
of time. Use the command "\fBpostfix reload\fR" to speed
|
||||
up a change.
|
||||
Changes to \fBmain.cf\fR are not picked up automatically,
|
||||
because \fBpostlogd\fR(8) terminates only after reaching
|
||||
the \fBmax_idle\fR time limit.
|
||||
Use the command "\fBpostfix reload\fR" to speed up a change.
|
||||
|
||||
The text below provides only a parameter summary. See
|
||||
\fBpostconf\fR(5) for more details including examples.
|
||||
|
@ -29,13 +29,9 @@ be tried again at a later time. Delivery status reports are sent
|
||||
to the \fBbounce\fR(8), \fBdefer\fR(8) or \fBtrace\fR(8) daemon as
|
||||
appropriate.
|
||||
|
||||
The SMTP+LMTP client looks up a list of mail exchanger addresses for
|
||||
the destination host, sorts the list by preference, and connects
|
||||
to each listed address until it finds a server that responds.
|
||||
|
||||
When a server is not reachable, or when mail delivery fails due
|
||||
to a recoverable error condition, the SMTP+LMTP client will try to
|
||||
deliver the mail to an alternate host.
|
||||
The server lookup strategy is different for SMTP and LMTP.
|
||||
The details are given below under in the sections "SMTP
|
||||
DESTINATION SYNTAX" and "LMTP DESTINATION SYNTAX".
|
||||
|
||||
After a successful mail transaction, a connection may be saved
|
||||
to the \fBscache\fR(8) connection cache server, so that it
|
||||
@ -50,43 +46,57 @@ specific destinations.
|
||||
.nf
|
||||
.ad
|
||||
.fi
|
||||
The Postfix SMTP+LMTP client supports multiple destinations
|
||||
The Postfix SMTP client supports multiple destinations
|
||||
separated by comma or whitespace (Postfix 3.5 and later).
|
||||
Each destination is tried in the specified order.
|
||||
|
||||
SMTP destinations have the following form:
|
||||
.IP \fIdomainname\fR
|
||||
.IP \fIdomainname\fR:\fIport\fR
|
||||
.IP \fIdomainname\fR:\fIservice\fR
|
||||
Look up the mail exchangers for the specified domain, and
|
||||
connect to the specified port (default: \fBsmtp\fR).
|
||||
connect to the specified service (default: \fBsmtp\fR).
|
||||
Optionally, mail exchangers may be looked up with SRV queries
|
||||
instead of MX; this requires that \fIservice\fR is given
|
||||
in symbolic form.
|
||||
.IP [\fIhostname\fR]
|
||||
.IP [\fIhostname\fR]:\fIport\fR
|
||||
Look up the address(es) of the specified host, and connect to
|
||||
the specified port (default: \fBsmtp\fR).
|
||||
.IP [\fIhostname\fR]:\fIservice\fR
|
||||
Look up the address(es) for the specified host, and connect to
|
||||
the specified service (default: \fBsmtp\fR).
|
||||
.IP [\fIaddress\fR]
|
||||
.IP [\fIaddress\fR]:\fIport\fR
|
||||
.IP [\fIaddress\fR]:\fIservice\fR
|
||||
Connect to the host at the specified address, and connect
|
||||
to the specified port (default: \fBsmtp\fR). An IPv6 address
|
||||
to the specified service (default: \fBsmtp\fR). An IPv6 address
|
||||
must be formatted as [\fBipv6\fR:\fIaddress\fR].
|
||||
.SH "LMTP DESTINATION SYNTAX"
|
||||
.na
|
||||
.nf
|
||||
.ad
|
||||
.fi
|
||||
The Postfix SMTP+LMTP client supports multiple destinations
|
||||
The Postfix LMTP client supports multiple destinations
|
||||
separated by comma or whitespace (Postfix 3.5 and later).
|
||||
Each destination is tried in the specified order.
|
||||
|
||||
LMTP destinations have the following form:
|
||||
.IP \fBunix\fR:\fIpathname\fR
|
||||
Connect to the local UNIX\-domain server that is bound to the specified
|
||||
\fIpathname\fR. If the process runs chrooted, an absolute pathname
|
||||
is interpreted relative to the Postfix queue directory.
|
||||
.IP \fBinet\fR:\fIdomainname\fR
|
||||
.IP \fBinet\fR:\fIdomainname\fR:\fIservice\fR
|
||||
Look up the LMTP servers for the specified domain and service
|
||||
(default: \fBlmtp\fR).
|
||||
This form is supported when SRV lookups are enabled, and
|
||||
requires that \fIservice\fR is in symbolic form.
|
||||
.IP \fBinet\fR:\fIhostname\fR
|
||||
.IP \fBinet\fR:\fIhostname\fR:\fIport\fR
|
||||
.IP \fBinet\fR:\fIhostname\fR:\fIservice\fR
|
||||
Look up the address(es) for the specified host, and connect to
|
||||
the specified service (default: \fBlmtp\fR). When SRV lookups
|
||||
are enabled, use the form \fB[\fIhostname\fB]\fR to force
|
||||
address lookups.
|
||||
.IP \fBinet\fR:[\fIaddress\fR]
|
||||
.IP \fBinet\fR:[\fIaddress\fR]:\fIport\fR
|
||||
Connect to the specified TCP port on the specified local or
|
||||
remote host. If no port is specified, connect to the port defined as
|
||||
\fBlmtp\fR in \fBservices\fR(4).
|
||||
If no such service is found, the \fBlmtp_tcp_port\fR configuration
|
||||
parameter (default value of 24) will be used.
|
||||
.IP \fBinet\fR:[\fIaddress\fR]:\fIservice\fR
|
||||
Connect to the specified local or remote host and service
|
||||
(default: \fBlmtp\fR).
|
||||
An IPv6 address must be formatted as [\fBipv6\fR:\fIaddress\fR].
|
||||
.SH "SINGLE-RECIPIENT DELIVERY"
|
||||
.na
|
||||
@ -150,6 +160,8 @@ This feature is available as of Postfix 3.5.
|
||||
.SH "SECURITY"
|
||||
.na
|
||||
.nf
|
||||
.ad
|
||||
.fi
|
||||
The SMTP+LMTP client is moderately security\-sensitive. It
|
||||
talks to SMTP or LMTP servers and to DNS servers on the
|
||||
network. The SMTP+LMTP client can be run chrooted at fixed
|
||||
|
@ -87,6 +87,16 @@
|
||||
# With earlier Postfix versions, the default was chosen by
|
||||
# the MySQL implementation (\fButf8mb4\fR as of MySQL 8.0,
|
||||
# \fBlatin1\fR historically).
|
||||
# .IP "\fBidle_interval (default: 60)\fR"
|
||||
# The number of seconds after which an idle database connection
|
||||
# will be closed.
|
||||
#
|
||||
# This feature is available in Postfix 3.9 and later.
|
||||
# .IP "\fBretry_interval (default: 60)\fR"
|
||||
# The number of seconds that a database connection will be
|
||||
# skipped after an error.
|
||||
#
|
||||
# This feature is available in Postfix 3.9 and later.
|
||||
# .IP "\fBquery\fR"
|
||||
# The SQL query template used to search the database, where \fB%s\fR
|
||||
# is a substitute for the address Postfix is trying to resolve,
|
||||
|
@ -80,10 +80,21 @@
|
||||
# .nf
|
||||
# encoding = UTF8
|
||||
# .fi
|
||||
#
|
||||
# Historically, the database client was hard coded to use
|
||||
# LATIN1 in an attempt to disable multibyte character support.
|
||||
#
|
||||
# This feature is available in Postfix 3.8 and later.
|
||||
# .IP "\fBidle_interval (default: 60)\fR"
|
||||
# The number of seconds after which an idle database connection
|
||||
# will be closed.
|
||||
#
|
||||
# This feature is available in Postfix 3.9 and later.
|
||||
# .IP "\fBretry_interval (default: 60)\fR"
|
||||
# The number of seconds that a database connection will be
|
||||
# skipped after an error.
|
||||
#
|
||||
# This feature is available in Postfix 3.9 and later.
|
||||
# .IP "\fBquery\fR"
|
||||
# The SQL query template used to search the database, where \fB%s\fR
|
||||
# is a substitute for the address Postfix is trying to resolve,
|
||||
|
@ -3930,11 +3930,12 @@ gateway host instead.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In the case of SMTP or LMTP delivery, specify one or more destinations
|
||||
in the form of a domain name, hostname, hostname:port, [hostname]:port,
|
||||
[hostaddress] or [hostaddress]:port, separated by comma or whitespace.
|
||||
The form [hostname] turns off MX lookups. Multiple destinations are
|
||||
supported in Postfix 3.5 and later.
|
||||
In the case of SMTP delivery, specify one or more destinations in
|
||||
the form of a domain name, hostname, hostname:service, [hostname]:service,
|
||||
[hostaddress] or [hostaddress]:service, separated by comma or whitespace.
|
||||
The form [hostname] turns off MX or SRV lookups. Multiple destinations
|
||||
are supported in Postfix 3.5 and later. Each destination is tried
|
||||
in the specified order.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@ -100,3 +100,10 @@ proto proto aliases proto virtual proto ADDRESS_REWRITING_README html
|
||||
names Files smtpd smtpd hc
|
||||
or access control limitations Files smtpd smtpd hc
|
||||
spam the log with a warning message File tlsmgr tlsmgr c
|
||||
Cleanup tlsmgr c fix 20240124 File tlsmgr tlsmgr c
|
||||
MX or SRV records File smtp smtp c
|
||||
a list of comma separated names Files smtpd smtpd hc
|
||||
dnsblog dnsblog c postkick postkick c postlock postlock c
|
||||
postdrop postdrop c postsuper postsuper c sendmail sendmail c
|
||||
postlogd postlogd c
|
||||
qmgr qmgr c qmqpd qmqpd c trivial rewrite trivial rewrite c
|
||||
|
@ -353,3 +353,5 @@ standard lt CR gt lt LF gt br br This maintains compatibility
|
||||
br br This will also reject email from services that use BDAT
|
||||
RFC 2045 Sections 2 7 and 2 8 br br Such clients can be
|
||||
to become a list of comma separated names br br This feature
|
||||
the form of a domain name hostname hostname service hostname service
|
||||
expected to become a list of comma separated names br br This
|
||||
|
@ -152,6 +152,8 @@ typedef struct {
|
||||
char *password;
|
||||
char *dbname;
|
||||
char *charset;
|
||||
int retry_interval;
|
||||
int idle_interval;
|
||||
ARGV *hosts;
|
||||
PLMYSQL *pldb;
|
||||
HOST *active_host;
|
||||
@ -174,15 +176,15 @@ typedef struct {
|
||||
#define TYPEINET (1<<1)
|
||||
|
||||
#define RETRY_CONN_MAX 100
|
||||
#define RETRY_CONN_INTV 60 /* 1 minute */
|
||||
#define IDLE_CONN_INTV 60 /* 1 minute */
|
||||
#define DEF_RETRY_INTV 60 /* 1 minute */
|
||||
#define DEF_IDLE_INTV 60 /* 1 minute */
|
||||
|
||||
/* internal function declarations */
|
||||
static PLMYSQL *plmysql_init(ARGV *);
|
||||
static int plmysql_query(DICT_MYSQL *, const char *, VSTRING *, MYSQL_RES **);
|
||||
static void plmysql_dealloc(PLMYSQL *);
|
||||
static void plmysql_close_host(HOST *);
|
||||
static void plmysql_down_host(HOST *);
|
||||
static void plmysql_down_host(HOST *, int);
|
||||
static void plmysql_connect_single(DICT_MYSQL *, HOST *);
|
||||
static const char *dict_mysql_lookup(DICT *, const char *);
|
||||
DICT *dict_mysql_open(const char *, int, int);
|
||||
@ -476,7 +478,7 @@ static int plmysql_query(DICT_MYSQL *dict_mysql,
|
||||
name, 0, query, dict_mysql_quote);
|
||||
/* Check for potential dict_mysql_quote() failure. */
|
||||
if (host->stat == STATFAIL) {
|
||||
plmysql_down_host(host);
|
||||
plmysql_down_host(host, dict_mysql->retry_interval);
|
||||
continue;
|
||||
}
|
||||
if (msg_verbose)
|
||||
@ -561,7 +563,7 @@ static int plmysql_query(DICT_MYSQL *dict_mysql,
|
||||
* See what we got.
|
||||
*/
|
||||
if (query_error) {
|
||||
plmysql_down_host(host);
|
||||
plmysql_down_host(host, dict_mysql->retry_interval);
|
||||
if (errno == 0)
|
||||
errno = ENOTSUP;
|
||||
if (first_result) {
|
||||
@ -574,7 +576,7 @@ static int plmysql_query(DICT_MYSQL *dict_mysql,
|
||||
dict_mysql->dict.type, dict_mysql->dict.name,
|
||||
host->hostname);
|
||||
event_request_timer(dict_mysql_event, (void *) host,
|
||||
IDLE_CONN_INTV);
|
||||
dict_mysql->idle_interval);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -618,7 +620,7 @@ static void plmysql_connect_single(DICT_MYSQL *dict_mysql, HOST *host)
|
||||
if (mysql_set_character_set(host->db, dict_mysql->charset) != 0) {
|
||||
msg_warn("dict_mysql: mysql_set_character_set '%s' failed: %s",
|
||||
dict_mysql->charset, mysql_error(host->db));
|
||||
plmysql_down_host(host);
|
||||
plmysql_down_host(host, dict_mysql->retry_interval);
|
||||
return;
|
||||
}
|
||||
if (msg_verbose)
|
||||
@ -628,7 +630,7 @@ static void plmysql_connect_single(DICT_MYSQL *dict_mysql, HOST *host)
|
||||
} else {
|
||||
msg_warn("connect to mysql server %s: %s",
|
||||
host->hostname, mysql_error(host->db));
|
||||
plmysql_down_host(host);
|
||||
plmysql_down_host(host, dict_mysql->retry_interval);
|
||||
}
|
||||
}
|
||||
|
||||
@ -644,11 +646,11 @@ static void plmysql_close_host(HOST *host)
|
||||
* plmysql_down_host - close a failed connection AND set a "stay away from
|
||||
* this host" timer
|
||||
*/
|
||||
static void plmysql_down_host(HOST *host)
|
||||
static void plmysql_down_host(HOST *host, int retry_interval)
|
||||
{
|
||||
mysql_close(host->db);
|
||||
host->db = 0;
|
||||
host->ts = time((time_t *) 0) + RETRY_CONN_INTV;
|
||||
host->ts = time((time_t *) 0) + retry_interval;
|
||||
host->stat = STATFAIL;
|
||||
event_cancel_timer(dict_mysql_event, (void *) host);
|
||||
}
|
||||
@ -666,6 +668,10 @@ static void mysql_parse_config(DICT_MYSQL *dict_mysql, const char *mysqlcf)
|
||||
dict_mysql->password = cfg_get_str(p, "password", "", 0, 0);
|
||||
dict_mysql->dbname = cfg_get_str(p, "dbname", "", 1, 0);
|
||||
dict_mysql->charset = cfg_get_str(p, "charset", "utf8mb4", 1, 0);
|
||||
dict_mysql->retry_interval = cfg_get_int(p, "retry_interval",
|
||||
DEF_RETRY_INTV, 1, 0);
|
||||
dict_mysql->idle_interval = cfg_get_int(p, "idle_interval",
|
||||
DEF_IDLE_INTV, 1, 0);
|
||||
dict_mysql->result_format = cfg_get_str(p, "result_format", "%s", 1, 0);
|
||||
dict_mysql->option_file = cfg_get_str(p, "option_file", NULL, 0, 0);
|
||||
dict_mysql->option_group = cfg_get_str(p, "option_group", "client", 0, 0);
|
||||
|
@ -111,8 +111,8 @@
|
||||
#define TYPECONNSTR (1<<2)
|
||||
|
||||
#define RETRY_CONN_MAX 100
|
||||
#define RETRY_CONN_INTV 60 /* 1 minute */
|
||||
#define IDLE_CONN_INTV 60 /* 1 minute */
|
||||
#define DEF_RETRY_INTV 60 /* 1 minute */
|
||||
#define DEF_IDLE_INTV 60 /* 1 minute */
|
||||
|
||||
typedef struct {
|
||||
PGconn *db;
|
||||
@ -140,6 +140,8 @@ typedef struct {
|
||||
char *password;
|
||||
char *dbname;
|
||||
char *encoding;
|
||||
int retry_interval;
|
||||
int idle_interval;
|
||||
char *table;
|
||||
ARGV *hosts;
|
||||
PLPGSQL *pldb;
|
||||
@ -155,7 +157,7 @@ static PLPGSQL *plpgsql_init(ARGV *);
|
||||
static PGSQL_RES *plpgsql_query(DICT_PGSQL *, const char *, VSTRING *);
|
||||
static void plpgsql_dealloc(PLPGSQL *);
|
||||
static void plpgsql_close_host(HOST *);
|
||||
static void plpgsql_down_host(HOST *);
|
||||
static void plpgsql_down_host(HOST *, int);
|
||||
static void plpgsql_connect_single(DICT_PGSQL *, HOST *);
|
||||
static const char *dict_pgsql_lookup(DICT *, const char *);
|
||||
DICT *dict_pgsql_open(const char *, int, int);
|
||||
@ -480,7 +482,7 @@ static PGSQL_RES *plpgsql_query(DICT_PGSQL *dict_pgsql,
|
||||
|
||||
/* Check for potential dict_pgsql_quote() failure. */
|
||||
if (host->stat == STATFAIL) {
|
||||
plpgsql_down_host(host);
|
||||
plpgsql_down_host(host, dict_pgsql->retry_interval);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -518,7 +520,7 @@ static PGSQL_RES *plpgsql_query(DICT_PGSQL *dict_pgsql,
|
||||
msg_info("dict_pgsql: successful query from host %s",
|
||||
host->hostname);
|
||||
event_request_timer(dict_pgsql_event, (void *) host,
|
||||
IDLE_CONN_INTV);
|
||||
dict_pgsql->idle_interval);
|
||||
return (res);
|
||||
case PGRES_FATAL_ERROR:
|
||||
msg_warn("pgsql query failed: fatal error from host %s: %s",
|
||||
@ -549,7 +551,7 @@ static PGSQL_RES *plpgsql_query(DICT_PGSQL *dict_pgsql,
|
||||
*/
|
||||
if (res != 0)
|
||||
PQclear(res);
|
||||
plpgsql_down_host(host);
|
||||
plpgsql_down_host(host, dict_pgsql->retry_interval);
|
||||
}
|
||||
|
||||
return (0);
|
||||
@ -572,13 +574,13 @@ static void plpgsql_connect_single(DICT_PGSQL *dict_pgsql, HOST *host)
|
||||
if (host->db == NULL || PQstatus(host->db) != CONNECTION_OK) {
|
||||
msg_warn("connect to pgsql server %s: %s",
|
||||
host->hostname, PQerrorMessage(host->db));
|
||||
plpgsql_down_host(host);
|
||||
plpgsql_down_host(host, dict_pgsql->retry_interval);
|
||||
return;
|
||||
}
|
||||
if (PQsetClientEncoding(host->db, dict_pgsql->encoding) != 0) {
|
||||
msg_warn("dict_pgsql: cannot set the encoding to %s, skipping %s",
|
||||
dict_pgsql->encoding, host->hostname);
|
||||
plpgsql_down_host(host);
|
||||
plpgsql_down_host(host, dict_pgsql->retry_interval);
|
||||
return;
|
||||
}
|
||||
if (msg_verbose)
|
||||
@ -602,12 +604,12 @@ static void plpgsql_close_host(HOST *host)
|
||||
* plpgsql_down_host - close a failed connection AND set a "stay away from
|
||||
* this host" timer.
|
||||
*/
|
||||
static void plpgsql_down_host(HOST *host)
|
||||
static void plpgsql_down_host(HOST *host, int retry_interval)
|
||||
{
|
||||
if (host->db)
|
||||
PQfinish(host->db);
|
||||
host->db = 0;
|
||||
host->ts = time((time_t *) 0) + RETRY_CONN_INTV;
|
||||
host->ts = time((time_t *) 0) + retry_interval;
|
||||
host->stat = STATFAIL;
|
||||
event_cancel_timer(dict_pgsql_event, (void *) host);
|
||||
}
|
||||
@ -626,6 +628,10 @@ static void pgsql_parse_config(DICT_PGSQL *dict_pgsql, const char *pgsqlcf)
|
||||
dict_pgsql->password = cfg_get_str(p, "password", "", 0, 0);
|
||||
dict_pgsql->dbname = cfg_get_str(p, "dbname", "", 1, 0);
|
||||
dict_pgsql->encoding = cfg_get_str(p, "encoding", "UTF8", 1, 0);
|
||||
dict_pgsql->retry_interval = cfg_get_int(p, "retry_interval",
|
||||
DEF_RETRY_INTV, 1, 0);
|
||||
dict_pgsql->idle_interval = cfg_get_int(p, "idle_interval",
|
||||
DEF_IDLE_INTV, 1, 0);
|
||||
dict_pgsql->result_format = cfg_get_str(p, "result_format", "%s", 1, 0);
|
||||
|
||||
/*
|
||||
|
@ -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 "20240125"
|
||||
#define MAIL_RELEASE_DATE "20240129"
|
||||
#define MAIL_VERSION_NUMBER "3.9"
|
||||
|
||||
#ifdef SNAPSHOT
|
||||
|
@ -31,10 +31,10 @@
|
||||
/* CONFIGURATION PARAMETERS
|
||||
/* .ad
|
||||
/* .fi
|
||||
/* Changes to \fBmain.cf\fR are picked up automatically, as
|
||||
/* \fBpostlogd\fR(8) processes run for only a limited amount
|
||||
/* of time. Use the command "\fBpostfix reload\fR" to speed
|
||||
/* up a change.
|
||||
/* Changes to \fBmain.cf\fR are not picked up automatically,
|
||||
/* because \fBpostlogd\fR(8) terminates only after reaching
|
||||
/* the \fBmax_idle\fR time limit.
|
||||
/* Use the command "\fBpostfix reload\fR" to speed up a change.
|
||||
/*
|
||||
/* The text below provides only a parameter summary. See
|
||||
/* \fBpostconf\fR(5) for more details including examples.
|
||||
|
@ -23,13 +23,9 @@
|
||||
/* to the \fBbounce\fR(8), \fBdefer\fR(8) or \fBtrace\fR(8) daemon as
|
||||
/* appropriate.
|
||||
/*
|
||||
/* The SMTP+LMTP client looks up a list of mail exchanger addresses for
|
||||
/* the destination host, sorts the list by preference, and connects
|
||||
/* to each listed address until it finds a server that responds.
|
||||
/*
|
||||
/* When a server is not reachable, or when mail delivery fails due
|
||||
/* to a recoverable error condition, the SMTP+LMTP client will try to
|
||||
/* deliver the mail to an alternate host.
|
||||
/* The server lookup strategy is different for SMTP and LMTP.
|
||||
/* The details are given below under in the sections "SMTP
|
||||
/* DESTINATION SYNTAX" and "LMTP DESTINATION SYNTAX".
|
||||
/*
|
||||
/* After a successful mail transaction, a connection may be saved
|
||||
/* to the \fBscache\fR(8) connection cache server, so that it
|
||||
@ -42,41 +38,55 @@
|
||||
/* SMTP DESTINATION SYNTAX
|
||||
/* .ad
|
||||
/* .fi
|
||||
/* The Postfix SMTP+LMTP client supports multiple destinations
|
||||
/* The Postfix SMTP client supports multiple destinations
|
||||
/* separated by comma or whitespace (Postfix 3.5 and later).
|
||||
/* Each destination is tried in the specified order.
|
||||
/*
|
||||
/* SMTP destinations have the following form:
|
||||
/* .IP \fIdomainname\fR
|
||||
/* .IP \fIdomainname\fR:\fIport\fR
|
||||
/* .IP \fIdomainname\fR:\fIservice\fR
|
||||
/* Look up the mail exchangers for the specified domain, and
|
||||
/* connect to the specified port (default: \fBsmtp\fR).
|
||||
/* connect to the specified service (default: \fBsmtp\fR).
|
||||
/* Optionally, mail exchangers may be looked up with SRV queries
|
||||
/* instead of MX; this requires that \fIservice\fR is given
|
||||
/* in symbolic form.
|
||||
/* .IP [\fIhostname\fR]
|
||||
/* .IP [\fIhostname\fR]:\fIport\fR
|
||||
/* Look up the address(es) of the specified host, and connect to
|
||||
/* the specified port (default: \fBsmtp\fR).
|
||||
/* .IP [\fIhostname\fR]:\fIservice\fR
|
||||
/* Look up the address(es) for the specified host, and connect to
|
||||
/* the specified service (default: \fBsmtp\fR).
|
||||
/* .IP [\fIaddress\fR]
|
||||
/* .IP [\fIaddress\fR]:\fIport\fR
|
||||
/* .IP [\fIaddress\fR]:\fIservice\fR
|
||||
/* Connect to the host at the specified address, and connect
|
||||
/* to the specified port (default: \fBsmtp\fR). An IPv6 address
|
||||
/* to the specified service (default: \fBsmtp\fR). An IPv6 address
|
||||
/* must be formatted as [\fBipv6\fR:\fIaddress\fR].
|
||||
/* LMTP DESTINATION SYNTAX
|
||||
/* .ad
|
||||
/* .fi
|
||||
/* The Postfix SMTP+LMTP client supports multiple destinations
|
||||
/* The Postfix LMTP client supports multiple destinations
|
||||
/* separated by comma or whitespace (Postfix 3.5 and later).
|
||||
/* Each destination is tried in the specified order.
|
||||
/*
|
||||
/* LMTP destinations have the following form:
|
||||
/* .IP \fBunix\fR:\fIpathname\fR
|
||||
/* Connect to the local UNIX-domain server that is bound to the specified
|
||||
/* \fIpathname\fR. If the process runs chrooted, an absolute pathname
|
||||
/* is interpreted relative to the Postfix queue directory.
|
||||
/* .IP \fBinet\fR:\fIdomainname\fR
|
||||
/* .IP \fBinet\fR:\fIdomainname\fR:\fIservice\fR
|
||||
/* Look up the LMTP servers for the specified domain and service
|
||||
/* (default: \fBlmtp\fR).
|
||||
/* This form is supported when SRV lookups are enabled, and
|
||||
/* requires that \fIservice\fR is in symbolic form.
|
||||
/* .IP \fBinet\fR:\fIhostname\fR
|
||||
/* .IP \fBinet\fR:\fIhostname\fR:\fIport\fR
|
||||
/* .IP \fBinet\fR:\fIhostname\fR:\fIservice\fR
|
||||
/* Look up the address(es) for the specified host, and connect to
|
||||
/* the specified service (default: \fBlmtp\fR). When SRV lookups
|
||||
/* are enabled, use the form \fB[\fIhostname\fB]\fR to force
|
||||
/* address lookups.
|
||||
/* .IP \fBinet\fR:[\fIaddress\fR]
|
||||
/* .IP \fBinet\fR:[\fIaddress\fR]:\fIport\fR
|
||||
/* Connect to the specified TCP port on the specified local or
|
||||
/* remote host. If no port is specified, connect to the port defined as
|
||||
/* \fBlmtp\fR in \fBservices\fR(4).
|
||||
/* If no such service is found, the \fBlmtp_tcp_port\fR configuration
|
||||
/* parameter (default value of 24) will be used.
|
||||
/* .IP \fBinet\fR:[\fIaddress\fR]:\fIservice\fR
|
||||
/* Connect to the specified local or remote host and service
|
||||
/* (default: \fBlmtp\fR).
|
||||
/* An IPv6 address must be formatted as [\fBipv6\fR:\fIaddress\fR].
|
||||
/* SINGLE-RECIPIENT DELIVERY
|
||||
/* .ad
|
||||
@ -134,6 +144,8 @@
|
||||
/* This feature is available as of Postfix 3.5.
|
||||
/* .RE
|
||||
/* SECURITY
|
||||
/* .ad
|
||||
/* .fi
|
||||
/* The SMTP+LMTP client is moderately security-sensitive. It
|
||||
/* talks to SMTP or LMTP servers and to DNS servers on the
|
||||
/* network. The SMTP+LMTP client can be run chrooted at fixed
|
||||
|
Loading…
x
Reference in New Issue
Block a user