did not eliminate virtual expansion duplicates with the
same original recipient. File: cleanup/cleanup_out_recipient.c.
+20030223
+
+ Cleanup: added postmap/postalias -p option (do not inherit
+ the source file permissions when creating a new file), for
+ completeness. A feature that can't be turned off is a bug.
+ Files: postmap/postmap.c, postalias/postalias.c.
+
+ Bugfix: smtpd_hard/soft_error_limit off-by-one error, so
+ that the real limit was one larger than the configured
+ value. File: smtpd/smtpd.c, smtpd/smtpd_chat.c.
+
+20030226
+
+ Safety: proxymap server defense against potential deadlock
+ when some library routine wants to open a proxied table.
+ Instead, proxymap opens the requested table directly. File:
+ proxymap/proxymap.c.
+
+ Portability: updated AIX 5.x system dependent definitions.
+ File: util/sys_defs.h.
+
+20030227
+
+ Bugfix: added mynetworks to the list of proxy_read_maps
+ parameter settings that are pre-authorized to use proxied
+ table lookups. File: global/mail_params.h.
+
+ Cleanup: daemons now log what table has changed before
+ restarting. Files: dict.c, and anything that invoked
+ dict_changed().
+
+ Cleanup: more consistency in the naming of lookup table
+ handles as generated by maps(3) and by match_list(3).
+
Open problems:
Med: make qmgr recipient bounce/defer activity asynchronous
# cleanup service (defined further below).
#
smtp inet n - n - - smtpd
- -o cleanup_service=pre-cleanup
+ -o cleanup_service_name=pre-cleanup
pickup fifo n - n 60 1 pickup
- -o cleanup_service=pre-cleanup
+ -o cleanup_service_name=pre-cleanup
#
# ------------------------------------------------------------------
#
date. Snapshots change only the release date, unless they include
the same bugfixes as a patch release.
+Incompatible changes with Postfix snapshot 2.0.3-20030227
+=========================================================
+
+The smtpd_hard_error_limit and smtpd_soft_error_limit values now
+behave as documented, that is, smtpd_hard_error_limit=1 causes
+Postfix to disconnect upon the first client error. Previously,
+there was an off-by-one error causing Postfix to change behavior
+after smtpd_hard/soft_error_limit+1 errors.
+
Incompatible changes with Postfix snapshot 2.0.3-20030125
=========================================================
# dependent. In the case of SMTP, specify host:service for a
# non-default server port, and use [host] or [host]:port in
# order to disable MX (mail exchanger) DNS lookups. The []
-# form can also be used with IP addresses instead of host-
-# names.
+# form is required when you specify an IP address instead of
+# a hostname.
#
# A null transport and null nexthop result means "do not
# change": use the delivery transport and nexthop informa-
postalias - Postfix alias database maintenance
<b>SYNOPSIS</b>
- <b>postalias</b> [<b>-Nfinorvw</b>] [<b>-c</b> <i>config_dir</i>] [<b>-d</b> <i>key</i>] [<b>-q</b> <i>key</i>]
+ <b>postalias</b> [<b>-Nfinoprvw</b>] [<b>-c</b> <i>config_dir</i>] [<b>-d</b> <i>key</i>] [<b>-q</b> <i>key</i>]
[<i>file_type</i>:]<i>file_name</i> ...
<b>DESCRIPTION</b>
the entire database, in order to avoid surprises in spec-
tator programs.
+ The format of Postfix alias input files is described in
+ <a href="aliases.5.html"><b>aliases</b>(5)</a>.
+
Options:
- <b>-N</b> Include the terminating null character that termi-
- nates lookup keys and values. By default, Postfix
+ <b>-N</b> Include the terminating null character that termi-
+ nates lookup keys and values. By default, Postfix
does whatever is the default for the host operating
system.
<b>-c</b> <i>config_dir</i>
- Read the <b>main.cf</b> configuration file in the named
+ Read the <b>main.cf</b> configuration file in the named
directory instead of the default configuration
directory.
- <b>-d</b> <i>key</i> Search the specified maps for <i>key</i> and remove one
- entry per map. The exit status is zero when the
+ <b>-d</b> <i>key</i> Search the specified maps for <i>key</i> and remove one
+ entry per map. The exit status is zero when the
requested information was found.
If a key value of <b>-</b> is specified, the program reads
key values from the standard input stream. The exit
- status is zero when at least one of the requested
+ status is zero when at least one of the requested
keys was found.
<b>-f</b> Do not fold the lookup key to lower case while cre-
ating or querying a map.
- <b>-i</b> Incremental mode. Read entries from standard input
+ <b>-i</b> Incremental mode. Read entries from standard input
and do not truncate an existing database. By
- default, <b>postalias</b> creates a new database from the
+ default, <b>postalias</b> creates a new database from the
entries in <i>file_name</i>.
- <b>-n</b> Don't include the terminating null character that
- terminates lookup keys and values. By default,
- Postfix does whatever is the default for the host
+ <b>-n</b> Don't include the terminating null character that
+ terminates lookup keys and values. By default,
+ Postfix does whatever is the default for the host
operating system.
- <b>-o</b> Do not release root privileges when processing a
- non-root input file. By default, <b>postalias</b> drops
- root privileges and runs as the source file owner
+ <b>-o</b> Do not release root privileges when processing a
+ non-root input file. By default, <b>postalias</b> drops
+ root privileges and runs as the source file owner
instead.
+ <b>-p</b> Do not inherit the file access permissions from the
+ input file when creating a new file. Instead, cre-
+ ate a new file with default access permissions
+ (mode 0644).
+
<b>-q</b> <i>key</i> Search the specified maps for <i>key</i> and print the
first value found on the standard output stream.
The exit status is zero when the requested informa-
<b>SEE</b> <b>ALSO</b>
<a href="aliases.5.html">aliases(5)</a> format of alias database input file.
+ local(5) Postfix local delivery agent.
<a href="sendmail.1.html">sendmail(1)</a> mail posting and compatibility interface.
<b>LICENSE</b>
postmap - Postfix lookup table management
<b>SYNOPSIS</b>
- <b>postmap</b> [<b>-Nfinorvw</b>] [<b>-c</b> <i>config_dir</i>] [<b>-d</b> <i>key</i>] [<b>-q</b> <i>key</i>]
+ <b>postmap</b> [<b>-Nfinoprvw</b>] [<b>-c</b> <i>config_dir</i>] [<b>-d</b> <i>key</i>] [<b>-q</b> <i>key</i>]
[<i>file_type</i>:]<i>file_name</i> ...
<b>DESCRIPTION</b>
the entire table, in order to avoid surprises in spectator
programs.
+<b>INPUT</b> <b>FILE</b> <b>FORMAT</b>
The format of a lookup table input file is as follows:
<b>o</b> A table entry has the form
whitespace. The <i>key</i> is mapped to lowercase to make mapping
lookups case insensitive.
- Options:
-
+<b>COMMAND-LINE</b> <b>ARGUMENTS</b>
<b>-N</b> Include the terminating null character that termi-
nates lookup keys and values. By default, Postfix
does whatever is the default for the host operating
privileges and runs as the source file owner
instead.
- <b>-q</b> <i>key</i> Search the specified maps for <i>key</i> and print the
- first value found on the standard output stream.
+ <b>-p</b> Do not inherit the file access permissions from the
+ input file when creating a new file. Instead, cre-
+ ate a new file with default access permissions
+ (mode 0644).
+
+ <b>-q</b> <i>key</i> Search the specified maps for <i>key</i> and print the
+ first value found on the standard output stream.
The exit status is zero when the requested informa-
tion was found.
If a key value of <b>-</b> is specified, the program reads
- key values from the standard input stream and
- prints one line of <i>key</i> <i>value</i> output for each key
- that was found. The exit status is zero when at
+ key values from the standard input stream and
+ prints one line of <i>key</i> <i>value</i> output for each key
+ that was found. The exit status is zero when at
least one of the requested keys was found.
- <b>-r</b> When updating a table, do not warn about duplicate
+ <b>-r</b> When updating a table, do not warn about duplicate
entries; silently replace them.
<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>-w</b> When updating a table, do not warn about duplicate
+ <b>-w</b> When updating a table, do not warn about duplicate
entries; silently ignore them.
Arguments:
<i>file_type</i>
The type of database to be produced.
- <b>btree</b> The output file is a btree file, named
- <i>file_name</i><b>.db</b>. This is available only on
+ <b>btree</b> The output file is a btree file, named
+ <i>file_name</i><b>.db</b>. This is available only on
systems with support for <b>db</b> databases.
- <b>dbm</b> The output consists of two files, named
- <i>file_name</i><b>.pag</b> and <i>file_name</i><b>.dir</b>. This is
- available only on systems with support for
+ <b>dbm</b> The output consists of two files, named
+ <i>file_name</i><b>.pag</b> and <i>file_name</i><b>.dir</b>. This is
+ available only on systems with support for
<b>dbm</b> databases.
- <b>hash</b> The output file is a hashed file, named
- <i>file_name</i><b>.db</b>. This is available only on
+ <b>hash</b> The output file is a hashed file, named
+ <i>file_name</i><b>.db</b>. This is available only on
systems with support for <b>db</b> databases.
- Use the command <b>postconf</b> <b>-m</b> to find out what types
- of database your Postfix installation can support.
+ Use the command <b>postconf</b> <b>-m</b> to find out what types
+ of database your Postfix installation can support.
- When no <i>file_type</i> is specified, the software uses
- the database type specified via the
+ When no <i>file_type</i> is specified, the software uses
+ the database type specified via the
<b>default</b><i>_</i><b>database</b><i>_</i><b>type</b> configuration parameter.
<i>file_name</i>
- The name of the lookup table source file when
+ The name of the lookup table source file when
rebuilding a database.
<b>DIAGNOSTICS</b>
stream. No output means no problems. Duplicate entries are
skipped and are flagged with a warning.
- <b>postmap</b> terminates with zero exit status in case of suc-
- cess (including successful <b>postmap</b> <b>-q</b> lookup) and termi-
+ <b>postmap</b> terminates with zero exit status in case of suc-
+ cess (including successful <b>postmap</b> <b>-q</b> lookup) and termi-
nates with non-zero exit status in case of failure.
<b>ENVIRONMENT</b>
<b>CONFIGURATION</b> <b>PARAMETERS</b>
<b>default</b><i>_</i><b>database</b><i>_</i><b>type</b>
- Default output database type. On many UNIX sys-
- tems, the default database type is either <b>hash</b> or
+ Default output database type. On many UNIX sys-
+ tems, the default database type is either <b>hash</b> or
<b>dbm</b>.
<b>berkeley</b><i>_</i><b>db</b><i>_</i><b>create</b><i>_</i><b>buffer</b><i>_</i><b>size</b>
- Amount of buffer memory to be used when creating a
+ Amount of buffer memory to be used when creating a
Berkeley DB <b>hash</b> or <b>btree</b> lookup table.
<b>berkeley</b><i>_</i><b>db</b><i>_</i><b>read</b><i>_</i><b>buffer</b><i>_</i><b>size</b>
- Amount of buffer memory to be used when reading a
+ Amount of buffer memory to be used when reading a
Berkeley DB <b>hash</b> or <b>btree</b> lookup table.
<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>
tions" errors. The solution:
virtual_alias_maps =
- proxy:mysql:/etc/postfix/virtual.cf
+ proxy:mysql:/etc/postfix/virtual_alias.cf
The total number of connections is limited by the
- number of proxymap server server processes.
+ number of proxymap server processes.
The proxymap server implements the following requests:
<html> <head> </head> <body> <pre>
-
SPAWN(8) SPAWN(8)
<b>NAME</b>
P.O. Box 704
Yorktown Heights, NY 10598, USA
- 1
-
+ SPAWN(8)
</pre> </body> </html>
dependent. In the case of SMTP, specify <i>host</i>:<i>service</i> for a
non-default server port, and use [<i>host</i>] or [<i>host</i>]:<i>port</i> in
order to disable MX (mail exchanger) DNS lookups. The []
- form can also be used with IP addresses instead of host-
- names.
+ form is required when you specify an IP address instead of
+ a hostname.
A null <i>transport</i> and null <i>nexthop</i> result means "do not
change": use the delivery transport and nexthop informa-
.na
.nf
.fi
-\fBpostalias\fR [\fB-Nfinorvw\fR] [\fB-c \fIconfig_dir\fR]
+\fBpostalias\fR [\fB-Nfinoprvw\fR] [\fB-c \fIconfig_dir\fR]
[\fB-d \fIkey\fR] [\fB-q \fIkey\fR]
[\fIfile_type\fR:]\fIfile_name\fR ...
.SH DESCRIPTION
entire database, in order to avoid surprises in spectator
programs.
+The format of Postfix alias input files is described in
+\fBaliases\fR(5).
+
Options:
.IP \fB-N\fR
Include the terminating null character that terminates lookup keys
Do not release root privileges when processing a non-root
input file. By default, \fBpostalias\fR drops root privileges
and runs as the source file owner instead.
+.IP \fB-p\fR
+Do not inherit the file access permissions from the input file
+when creating a new file. Instead, create a new file with default
+access permissions (mode 0644).
.IP "\fB-q \fIkey\fR"
Search the specified maps for \fIkey\fR and print the first value
found on the standard output stream. The exit status is zero
.na
.nf
aliases(5) format of alias database input file.
+local(5) Postfix local delivery agent.
sendmail(1) mail posting and compatibility interface.
.SH LICENSE
.na
.na
.nf
.fi
-\fBpostmap\fR [\fB-Nfinorvw\fR] [\fB-c \fIconfig_dir\fR]
+\fBpostmap\fR [\fB-Nfinoprvw\fR] [\fB-c \fIconfig_dir\fR]
[\fB-d \fIkey\fR] [\fB-q \fIkey\fR]
[\fIfile_type\fR:]\fIfile_name\fR ...
.SH DESCRIPTION
postponed, and an exclusive, advisory, lock is placed on the
entire table, in order to avoid surprises in spectator
programs.
-
+.SH INPUT FILE FORMAT
+.na
+.nf
+.ad
+.fi
The format of a lookup table input file is as follows:
.IP \(bu
A table entry has the form
databases, quotes cannot be used to protect lookup keys that contain
special characters such as `#' or whitespace. The \fIkey\fR is mapped
to lowercase to make mapping lookups case insensitive.
-
-Options:
+.SH COMMAND-LINE ARGUMENTS
+.na
+.nf
+.ad
+.fi
.IP \fB-N\fR
Include the terminating null character that terminates lookup keys
and values. By default, Postfix does whatever is the default for
Do not release root privileges when processing a non-root
input file. By default, \fBpostmap\fR drops root privileges
and runs as the source file owner instead.
+.IP \fB-p\fR
+Do not inherit the file access permissions from the input file
+when creating a new file. Instead, create a new file with default
+access permissions (mode 0644).
.IP "\fB-q \fIkey\fR"
Search the specified maps for \fIkey\fR and print the first value
found on the standard output stream. The exit status is zero
dependent. In the case of SMTP, specify \fIhost\fR:\fIservice\fR for a
non-default server port, and use [\fIhost\fR] or [\fIhost\fR]:\fIport\fR
in order to disable MX (mail exchanger) DNS lookups. The [] form
-can also be used with IP addresses instead of hostnames.
+is required when you specify an IP address instead of a hostname.
A null \fItransport\fR and null \fInexthop\fR result means "do
not change": use the delivery transport and nexthop information
.sp
virtual_alias_maps =
.ti +4
-proxy:mysql:/etc/postfix/virtual.cf
+proxy:mysql:/etc/postfix/virtual_alias.cf
.sp
The total number of connections is limited by the number of
-proxymap server server processes.
+proxymap server processes.
.PP
The proxymap server implements the following requests:
.IP "\fBPROXY_REQ_OPEN\fI maptype:mapname flags\fR"
# dependent. In the case of SMTP, specify \fIhost\fR:\fIservice\fR for a
# non-default server port, and use [\fIhost\fR] or [\fIhost\fR]:\fIport\fR
# in order to disable MX (mail exchanger) DNS lookups. The [] form
-# can also be used with IP addresses instead of hostnames.
+# is required when you specify an IP address instead of a hostname.
#
# A null \fItransport\fR and null \fInexthop\fR result means "do
# not change": use the delivery transport and nexthop information
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}
" $" VAR_SEND_CANON_MAPS \
" $" VAR_RCPT_CANON_MAPS \
" $" VAR_RELOCATED_MAPS \
- " $" VAR_TRANSPORT_MAPS
+ " $" VAR_TRANSPORT_MAPS \
+ " $" VAR_MYNETWORKS
extern char *var_proxy_read_maps;
/*
* Patches change the patchlevel and the release date. Snapshots change the
* release date only, unless they include the same bugfix as a patch release.
*/
-#define MAIL_RELEASE_DATE "20030219"
+#define MAIL_RELEASE_DATE "20030301"
#define VAR_MAIL_VERSION "mail_version"
-#define DEF_MAIL_VERSION "2.0.4-" MAIL_RELEASE_DATE
+#define DEF_MAIL_VERSION "2.0.5-" MAIL_RELEASE_DATE
extern char *var_mail_version;
/*
/* maps_create - initialize */
-MAPS *maps_create(const char *title, const char *map_names, int flags)
+MAPS *maps_create(const char *title, const char *map_names, int dict_flags)
{
const char *myname = "maps_create";
char *temp;
bufp = temp = mystrdup(map_names);
map_type_name_flags = vstring_alloc(10);
+#define OPEN_FLAGS O_RDONLY
+
while ((map_type_name = mystrtok(&bufp, sep)) != 0) {
- vstring_sprintf(map_type_name_flags, "%s:%o", map_type_name, flags);
+ vstring_sprintf(map_type_name_flags, "%s(%o,%o)",
+ map_type_name, OPEN_FLAGS, dict_flags);
if ((dict = dict_handle(vstring_str(map_type_name_flags))) == 0)
- dict = dict_open(map_type_name, O_RDONLY, flags);
- if ((dict->flags & flags) != flags)
+ dict = dict_open(map_type_name, OPEN_FLAGS, dict_flags);
+ if ((dict->flags & dict_flags) != dict_flags)
msg_panic("%s: map %s has flags 0%o, want flags 0%o",
- myname, map_type_name, dict->flags, flags);
+ myname, map_type_name, dict->flags, dict_flags);
dict_register(vstring_str(map_type_name_flags), dict);
argv_add(maps->argv, vstring_str(map_type_name_flags), ARGV_END);
}
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
cleanup();
exit(0);
}
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}
/* Postfix alias database maintenance
/* SYNOPSIS
/* .fi
-/* \fBpostalias\fR [\fB-Nfinorvw\fR] [\fB-c \fIconfig_dir\fR]
+/* \fBpostalias\fR [\fB-Nfinoprvw\fR] [\fB-c \fIconfig_dir\fR]
/* [\fB-d \fIkey\fR] [\fB-q \fIkey\fR]
/* [\fIfile_type\fR:]\fIfile_name\fR ...
/* DESCRIPTION
/* entire database, in order to avoid surprises in spectator
/* programs.
/*
+/* The format of Postfix alias input files is described in
+/* \fBaliases\fR(5).
+/*
/* Options:
/* .IP \fB-N\fR
/* Include the terminating null character that terminates lookup keys
/* Do not release root privileges when processing a non-root
/* input file. By default, \fBpostalias\fR drops root privileges
/* and runs as the source file owner instead.
+/* .IP \fB-p\fR
+/* Do not inherit the file access permissions from the input file
+/* when creating a new file. Instead, create a new file with default
+/* access permissions (mode 0644).
/* .IP "\fB-q \fIkey\fR"
/* Search the specified maps for \fIkey\fR and print the first value
/* found on the standard output stream. The exit status is zero
/* RFC 822 (ARPA Internet Text Messages)
/* SEE ALSO
/* aliases(5) format of alias database input file.
+/* local(5) Postfix local delivery agent.
/* sendmail(1) mail posting and compatibility interface.
/* LICENSE
/* .ad
#define STR vstring_str
#define POSTALIAS_FLAG_AS_OWNER (1<<0) /* open dest as owner of source */
+#define POSTALIAS_FLAG_SAVE_PERM (1<<1) /* copy access permission
+ * from source */
/* postalias - create or update alias database */
/*
* Turn off group/other read permissions as indicated in the source file.
*/
- if (S_ISREG(st.st_mode))
+ if ((postalias_flags & POSTALIAS_FLAG_SAVE_PERM) && S_ISREG(st.st_mode))
saved_mask = umask(022 | (~st.st_mode & 077));
/*
/*
* And restore the umask, in case it matters.
*/
- if (S_ISREG(st.st_mode))
+ if ((postalias_flags & POSTALIAS_FLAG_SAVE_PERM) && S_ISREG(st.st_mode))
umask(saved_mask);
/*
int fd;
char *slash;
struct stat st;
- int postalias_flags = POSTALIAS_FLAG_AS_OWNER;
+ int postalias_flags = POSTALIAS_FLAG_AS_OWNER | POSTALIAS_FLAG_SAVE_PERM;
int open_flags = O_RDWR | O_CREAT | O_TRUNC;
int dict_flags = DICT_FLAG_DUP_WARN | DICT_FLAG_FOLD_KEY;
char *query = 0;
/*
* Parse JCL.
*/
- while ((ch = GETOPT(argc, argv, "Nc:d:finoq:rvw")) > 0) {
+ while ((ch = GETOPT(argc, argv, "Nc:d:finopq:rvw")) > 0) {
switch (ch) {
default:
usage(argv[0]);
case 'o':
postalias_flags &= ~POSTALIAS_FLAG_AS_OWNER;
break;
+ case 'p':
+ postalias_flags &= ~POSTALIAS_FLAG_SAVE_PERM;
+ break;
case 'q':
if (query || delkey)
msg_fatal("specify only one of -q or -d");
/* Postfix lookup table management
/* SYNOPSIS
/* .fi
-/* \fBpostmap\fR [\fB-Nfinorvw\fR] [\fB-c \fIconfig_dir\fR]
+/* \fBpostmap\fR [\fB-Nfinoprvw\fR] [\fB-c \fIconfig_dir\fR]
/* [\fB-d \fIkey\fR] [\fB-q \fIkey\fR]
/* [\fIfile_type\fR:]\fIfile_name\fR ...
/* DESCRIPTION
/* postponed, and an exclusive, advisory, lock is placed on the
/* entire table, in order to avoid surprises in spectator
/* programs.
-/*
+/* INPUT FILE FORMAT
+/* .ad
+/* .fi
/* The format of a lookup table input file is as follows:
/* .IP \(bu
/* A table entry has the form
/* databases, quotes cannot be used to protect lookup keys that contain
/* special characters such as `#' or whitespace. The \fIkey\fR is mapped
/* to lowercase to make mapping lookups case insensitive.
-/*
-/* Options:
+/* COMMAND-LINE ARGUMENTS
+/* .ad
+/* .fi
/* .IP \fB-N\fR
/* Include the terminating null character that terminates lookup keys
/* and values. By default, Postfix does whatever is the default for
/* Do not release root privileges when processing a non-root
/* input file. By default, \fBpostmap\fR drops root privileges
/* and runs as the source file owner instead.
+/* .IP \fB-p\fR
+/* Do not inherit the file access permissions from the input file
+/* when creating a new file. Instead, create a new file with default
+/* access permissions (mode 0644).
/* .IP "\fB-q \fIkey\fR"
/* Search the specified maps for \fIkey\fR and print the first value
/* found on the standard output stream. The exit status is zero
#define STR vstring_str
#define POSTMAP_FLAG_AS_OWNER (1<<0) /* open dest as owner of source */
+#define POSTMAP_FLAG_SAVE_PERM (1<<1) /* copy access permission from source */
/* postmap - create or update mapping database */
/*
* Turn off group/other read permissions as indicated in the source file.
*/
- if (S_ISREG(st.st_mode))
+ if ((postmap_flags & POSTMAP_FLAG_SAVE_PERM) && S_ISREG(st.st_mode))
saved_mask = umask(022 | (~st.st_mode & 077));
/*
/*
* And restore the umask, in case it matters.
*/
- if (S_ISREG(st.st_mode))
+ if ((postmap_flags & POSTMAP_FLAG_SAVE_PERM) && S_ISREG(st.st_mode))
umask(saved_mask);
/*
int fd;
char *slash;
struct stat st;
- int postmap_flags = POSTMAP_FLAG_AS_OWNER;
+ int postmap_flags = POSTMAP_FLAG_AS_OWNER | POSTMAP_FLAG_SAVE_PERM;
int open_flags = O_RDWR | O_CREAT | O_TRUNC;
int dict_flags = DICT_FLAG_DUP_WARN | DICT_FLAG_FOLD_KEY;
char *query = 0;
/*
* Parse JCL.
*/
- while ((ch = GETOPT(argc, argv, "Nc:d:finoq:rvw")) > 0) {
+ while ((ch = GETOPT(argc, argv, "Nc:d:finopq:rvw")) > 0) {
switch (ch) {
default:
usage(argv[0]);
case 'o':
postmap_flags &= ~POSTMAP_FLAG_AS_OWNER;
break;
+ case 'p':
+ postmap_flags &= ~POSTMAP_FLAG_SAVE_PERM;
+ break;
case 'q':
if (query || delkey)
msg_fatal("specify only one of -q or -d");
/* .sp
/* virtual_alias_maps =
/* .ti +4
-/* proxy:mysql:/etc/postfix/virtual.cf
+/* proxy:mysql:/etc/postfix/virtual_alias.cf
/* .sp
/* The total number of connections is limited by the number of
-/* proxymap server server processes.
+/* proxymap server processes.
/* .PP
/* The proxymap server implements the following requests:
/* .IP "\fBPROXY_REQ_OPEN\fI maptype:mapname flags\fR"
vstream_fflush(client_stream);
}
+/* dict_proxy_open - intercept remote map request from inside library */
+
+DICT *dict_proxy_open(const char *map, int open_flags, int dict_flags)
+{
+ if (msg_verbose)
+ msg_info("dict_proxy_open(%s, 0%o, 0%o) called from internal routine",
+ map, open_flags, dict_flags);
+ while (strncmp(map, PROXY_COLON, PROXY_COLON_LEN) == 0)
+ map += PROXY_COLON_LEN;
+ return (dict_open(map, open_flags, dict_flags));
+}
+
/* post_jail_init - initialization after privilege drop */
static void post_jail_init(char *unused_name, char **unused_argv)
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("some lookup table has changed -- restarting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("lookup table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}
int prev_rec_type;
int first = 1;
VSTRING *why = 0;
+ int saved_err;
/*
* Sanity checks. With ESMTP command pipelining the client can send DATA
/*
* Cleanup. The client may send another MAIL command.
*/
+ saved_err = state->err;
chat_reset(state, var_smtpd_hist_thrsh);
mail_reset(state);
rcpt_reset(state);
if (why)
vstring_free(why);
- return (state->err);
+ return (saved_err);
}
/* rset_cmd - process RSET */
}
for (;;) {
- if (state->error_count > var_smtpd_hard_erlim) {
+ if (state->error_count >= var_smtpd_hard_erlim) {
state->reason = "too many errors";
state->error_mask |= MAIL_ERROR_PROTOCOL;
smtpd_chat_reply(state, "421 Error: too many errors");
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("lookup table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}
* sleep-on-anything slows down clients that make an excessive number of
* errors within a session.
*/
- if (state->error_count > var_smtpd_soft_erlim)
+ if (state->error_count >= var_smtpd_soft_erlim)
sleep(delay = (state->error_count > var_smtpd_err_sleep ?
state->error_count : var_smtpd_err_sleep));
else if (STR(state->buffer)[0] == '4' || STR(state->buffer)[0] == '5')
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}
/* void (*action)(dict_name, dict_handle, context)
/* char *context;
/*
-/* int dict_changed()
+/* const char *dict_changed_name()
/* AUXILIARY FUNCTIONS
/* void dict_load_file(dict_name, path)
/* const char *dict_name;
/* .IP "char *context"
/* Application context from the caller.
/* .PP
-/* dict_changed() returns non-zero when any dictionary needs to
+/* dict_changed_name() returns non-zero when any dictionary needs to
/* be re-opened because it has changed or because it was unlinked.
+/* A non-zero result is the name of a changed dictionary.
/*
/* dict_load_file() reads name-value entries from the named file.
/* Lines that begin with whitespace are concatenated to the preceding
myfree((char *) ht_info_list);
}
-/* dict_changed - see if any dictionary has changed */
+/* dict_changed_name - see if any dictionary has changed */
-int dict_changed(void)
+const char *dict_changed_name(void)
{
- char *myname = "dict_changed";
+ char *myname = "dict_changed_name";
struct stat st;
HTABLE_INFO **ht_info_list;
HTABLE_INFO **ht;
HTABLE_INFO *h;
- int status;
+ const char *status;
DICT *dict;
ht_info_list = htable_list(dict_table);
msg_warn("%s: table %s: null time stamp", myname, h->key);
if (fstat(dict->stat_fd, &st) < 0)
msg_fatal("%s: fstat: %m", myname);
- status = (st.st_mtime != dict->mtime || st.st_nlink == 0);
+ if (st.st_mtime != dict->mtime || st.st_nlink == 0)
+ status = h->key;
}
myfree((char *) ht_info_list);
return (status);
}
+
+/* dict_changed - backwards compatibility */
+
+int dict_changed(void)
+{
+ return (dict_changed_name() != 0);
+}
typedef void (*DICT_WALK_ACTION) (const char *, DICT *, char *);
extern void dict_walk(DICT_WALK_ACTION, char *);
extern int dict_changed(void);
+extern const char *dict_changed_name(void);
/* LICENSE
/* .ad
vstream_fflush(VSTREAM_OUT);
continue;
}
- if (dict_changed())
+ if (dict_changed_name())
msg_warn("dictionary has changed");
key = vstring_str(unescape(keybuf, mystrtok(&bufp, " =")));
value = mystrtok(&bufp, " =");
char *bp = string;
char *pattern;
char *cp;
+ char *map_type_name;
+ char *map_type_name_flags;
+ /*
+ * XXX We do not support ! before /filename, because the file contents
+ * are expanded in-line. Fixing this requires separating the operator (!)
+ * from its operands (file content) so that the operator can apply to a
+ * group of operands.
+ */
while ((pattern = mystrtok(&bp, delim)) != 0) {
if (*pattern == '/') { /* /file/name */
if (buf == 0)
if (vstream_fclose(fp))
msg_fatal("%s: read file %s: %m", myname, pattern);
} else if (strchr(pattern, ':') != 0) { /* type:table */
- for (cp = pattern; *cp == '!'; cp++)
+ if (buf == 0)
+ buf = vstring_alloc(10);
+#define OPEN_FLAGS O_RDONLY
+#define DICT_FLAGS DICT_FLAG_LOCK
+#define STR(x) vstring_str(x)
+ for (map_type_name = pattern; *map_type_name == '!'; map_type_name++)
/* void */ ;
- if (dict_handle(pattern) == 0)
- dict_register(pattern,
- dict_open(pattern, O_RDONLY, DICT_FLAG_LOCK));
- argv_add(list, pattern, (char *) 0);
+ vstring_sprintf(buf, "%s(%o,%o)", pattern, OPEN_FLAGS, DICT_FLAGS);
+ map_type_name_flags = STR(buf) + (map_type_name - pattern);
+ if (dict_handle(map_type_name_flags) == 0)
+ dict_register(map_type_name_flags,
+ dict_open(map_type_name, OPEN_FLAGS, DICT_FLAGS));
+ argv_add(list, STR(buf), (char *) 0);
} else { /* other pattern */
argv_add(list, pattern, (char *) 0);
}
#define SUPPORTED
#include <sys/types.h>
#define MISSING_SETENV
+#define USE_PATHS_H
+#ifndef _PATH_BSHELL
#define _PATH_BSHELL "/bin/sh"
+#endif
+#ifndef _PATH_MAILDIR
#define _PATH_MAILDIR "/var/spool/mail" /* paths.h lies */
+#endif
+#ifndef _PATH_DEFPATH
#define _PATH_DEFPATH "/usr/bin:/usr/ucb"
+#endif
+#ifndef _PATH_STDPATH
#define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/ucb"
+#endif
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define HAS_NIS
#define HAS_SA_LEN
#define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0)
-#define RESOLVE_H_NEEDS_STDIO_H
#define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
-#define SOCKADDR_SIZE size_t
-#define SOCKOPT_SIZE size_t
+#define SOCKADDR_SIZE socklen_t
+#define SOCKOPT_SIZE socklen_t
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
-#define STRCASECMP_IN_STRINGS_H
-#define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail"
+#define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
#define NATIVE_MAILQ_PATH "/usr/sbin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/sbin/newaliases"
#define NATIVE_COMMAND_DIR "/usr/sbin"
static void pre_accept(char *unused_name, char **unused_argv)
{
- if (dict_changed()) {
- msg_info("table has changed -- exiting");
+ const char *table;
+
+ if ((table = dict_changed_name()) != 0) {
+ msg_info("table %s has changed -- restarting", table);
exit(0);
}
}