2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-29 13:18:12 +00:00

postfix-2.10-20121226

This commit is contained in:
Wietse Venema 2012-12-26 00:00:00 -05:00 committed by Viktor Dukhovni
parent 1d2c74f605
commit e3c22452c5
11 changed files with 85 additions and 53 deletions

View File

@ -17203,6 +17203,7 @@ Apologies for any names omitted.
smtp/smtp_params.c, smtp/smtp_proto.c, smtpd/smtpd.c, smtp/smtp_params.c, smtp/smtp_proto.c, smtpd/smtpd.c,
tls/tls.h, tls/tls_client.c, tls/tls_misc.c, tls/tls_server.c, tls/tls.h, tls/tls_client.c, tls/tls_misc.c, tls/tls_server.c,
tlsmgr/tlsmgr.c, tlsproxy/tlsproxy.c. tlsmgr/tlsmgr.c, tlsproxy/tlsproxy.c.
20111203 20111203
Cleanup: time-dependent sender addresses of address Cleanup: time-dependent sender addresses of address
@ -18181,3 +18182,12 @@ Apologies for any names omitted.
Feature: "postconf -Mn" support to print only master.cf Feature: "postconf -Mn" support to print only master.cf
entries that have "-o name=value" parameter setttings. entries that have "-o name=value" parameter setttings.
Files: postconf/postconf_master.c. Files: postconf/postconf_master.c.
20121226
Miscellaneous cleanups of postconf internal APIs,
identifiers and comments. No changes in behavior.
Bugfix (omission in feature 20111203): the SMTP server
supported time-dependent address-verification sender addresses
only with RCPT TO but not with MAIL FROM. File: smtpd/smtpd.c.

View File

@ -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 "20121224" #define MAIL_RELEASE_DATE "20121226"
#define MAIL_VERSION_NUMBER "2.10" #define MAIL_VERSION_NUMBER "2.10"
#ifdef SNAPSHOT #ifdef SNAPSHOT

View File

@ -56,7 +56,7 @@ update: ../../bin/$(PROG) $(SAMPLES)
$(MAKES): makes_dummy $(MAKES): makes_dummy
makes_dummy: $(INC_DIR)/mail_params.h ../global/mail_params.c makes_dummy: $(INC_DIR)/mail_params.h ../global/mail_params.c extract.awk Makefile.in
$(AWK) -f extract.awk ../*/*.c | $(SHELL) $(AWK) -f extract.awk ../*/*.c | $(SHELL)
touch makes_dummy touch makes_dummy

View File

@ -185,7 +185,7 @@ extern void register_user_parameters(void);
* postconf_dbms.c * postconf_dbms.c
*/ */
extern void register_dbms_parameters(const char *, extern void register_dbms_parameters(const char *,
const char *(*) (const char *, int, char *), const char *(*) (const char *, int, PC_MASTER_ENT *),
PC_MASTER_ENT *); PC_MASTER_ENT *);
/* /*
@ -193,7 +193,8 @@ extern void register_dbms_parameters(const char *,
*/ */
const char *lookup_parameter_value(int, const char *, PC_MASTER_ENT *, const char *lookup_parameter_value(int, const char *, PC_MASTER_ENT *,
PC_PARAM_NODE *); PC_PARAM_NODE *);
const char *expand_parameter_value(int, const char *, PC_MASTER_ENT *);
char *expand_parameter_value(VSTRING *, int, const char *, PC_MASTER_ENT *);
/* /*
* postconf_unused.c. * postconf_unused.c.

View File

@ -143,8 +143,8 @@ static const CONFIG_STR_TABLE legacy_str_table[] = {
* function. We direct the calls to our own versions of those functions * function. We direct the calls to our own versions of those functions
* because the run-time conditions are slightly different. * because the run-time conditions are slightly different.
* *
* Important: if the evaluation of these parameters has any side effects, then * Important: if the evaluation of a parameter default value has any side
* those side effects must happen only once. * effects, then those side effects must happen only once.
*/ */
static const char *pc_check_myhostname(void); static const char *pc_check_myhostname(void);
static const char *pc_check_mydomainname(void); static const char *pc_check_mydomainname(void);
@ -162,8 +162,8 @@ static const CONFIG_STR_FN_TABLE str_fn_table[] = {
* The AWK script cannot identify these parameters or values, so we provide * The AWK script cannot identify these parameters or values, so we provide
* our own. * our own.
* *
* Important: if the evaluation of these parameters has any side effects, then * Important: if the evaluation of a parameter default value has any side
* those side effects must happen only once. * effects, then those side effects must happen only once.
*/ */
static CONFIG_STR_TABLE adhoc_procname = {VAR_PROCNAME}; static CONFIG_STR_TABLE adhoc_procname = {VAR_PROCNAME};
static CONFIG_INT_TABLE adhoc_pid = {VAR_PID}; static CONFIG_INT_TABLE adhoc_pid = {VAR_PID};
@ -205,7 +205,7 @@ static void get_myhostname(void)
if ((name = mail_conf_lookup_eval(VAR_MYHOSTNAME)) == 0) if ((name = mail_conf_lookup_eval(VAR_MYHOSTNAME)) == 0)
name = pc_check_myhostname(); name = pc_check_myhostname();
var_mynetworks = mystrdup(name); var_myhostname = mystrdup(name);
} }
/* pc_check_mydomainname - lookup domain name and validate */ /* pc_check_mydomainname - lookup domain name and validate */
@ -225,9 +225,9 @@ static const char *pc_check_mydomainname(void)
* Use the hostname when it is not a FQDN ("foo"), or when the hostname * Use the hostname when it is not a FQDN ("foo"), or when the hostname
* actually is a domain name ("foo.com"). * actually is a domain name ("foo.com").
*/ */
if (var_mynetworks == 0) if (var_myhostname == 0)
get_myhostname(); get_myhostname();
if ((dot = strchr(var_mynetworks, '.')) == 0 || strchr(dot + 1, '.') == 0) if ((dot = strchr(var_myhostname, '.')) == 0 || strchr(dot + 1, '.') == 0)
return (domain = DEF_MYDOMAIN); return (domain = DEF_MYDOMAIN);
return (domain = mystrdup(dot + 1)); return (domain = mystrdup(dot + 1));
} }
@ -373,7 +373,7 @@ void register_builtin_parameters(const char *procname, pid_t pid)
/* /*
* Initialize the global parameter table. * Initialize the global parameter table.
*/ */
param_table = PC_PARAM_TABLE_CREATE(100); param_table = PC_PARAM_TABLE_CREATE(1000);
/* /*
* Add the built-in parameters to the global name space. The class * Add the built-in parameters to the global name space. The class

View File

@ -9,7 +9,7 @@
/* void register_dbms_parameters(param_value, flag_parameter, /* void register_dbms_parameters(param_value, flag_parameter,
/* local_scope) /* local_scope)
/* const char *param_value; /* const char *param_value;
/* const char *(flag_parameter) (const char *, int, char *); /* const char *(flag_parameter) (const char *, int, PC_MASTER_ENT *);
/* PC_MASTER_ENT *local_scope; /* PC_MASTER_ENT *local_scope;
/* DESCRIPTION /* DESCRIPTION
/* This module implements legacy support for database configuration /* This module implements legacy support for database configuration
@ -25,7 +25,7 @@
/* names for that database type. /* names for that database type.
/* .IP flag_parameter /* .IP flag_parameter
/* A function that takes as arguments a candidate parameter /* A function that takes as arguments a candidate parameter
/* name, an unused value, and a PC_PARAM_CTX pointer. The /* name, parameter flags, and a PC_MASTER_ENT pointer. The
/* function will flag the parameter as "used" if it has a /* function will flag the parameter as "used" if it has a
/* "name=value" entry in the local or global namespace. /* "name=value" entry in the local or global namespace.
/* .IP local_scope /* .IP local_scope
@ -145,7 +145,7 @@ static const PC_DBMS_INFO dbms_info[] = {
/* register_dbms_parameters - look for database_type:prefix_name */ /* register_dbms_parameters - look for database_type:prefix_name */
void register_dbms_parameters(const char *param_value, void register_dbms_parameters(const char *param_value,
const char *(flag_parameter) (const char *, int, char *), const char *(flag_parameter) (const char *, int, PC_MASTER_ENT *),
PC_MASTER_ENT *local_scope) PC_MASTER_ENT *local_scope)
{ {
const PC_DBMS_INFO *dp; const PC_DBMS_INFO *dp;
@ -155,18 +155,15 @@ void register_dbms_parameters(const char *param_value,
static VSTRING *buffer = 0; static VSTRING *buffer = 0;
static VSTRING *candidate = 0; static VSTRING *candidate = 0;
const char **cpp; const char **cpp;
PC_PARAM_CTX param_ctx;
param_ctx.local_scope = local_scope;
param_ctx.param_class = PC_PARAM_FLAG_DBMS | PC_PARAM_FLAG_USER;
/* /*
* XXX This does not examine both sides of conditional macro expansion, * XXX This does not examine both sides of conditional macro expansion,
* and may expand the "wrong" conditional macros. This is the best we can * and may expand the "wrong" conditional macros. This is the best we can
* do for legacy database configuration support. * do for legacy database configuration support.
*/ */
bufp = STR(vstring_strcpy(buffer ? buffer : (buffer = vstring_alloc(100)), if (buffer == 0)
expand_parameter_value(SHOW_EVAL, param_value, local_scope))); buffer = vstring_alloc(100);
bufp = expand_parameter_value(buffer, SHOW_EVAL, param_value, local_scope);
/* /*
* Naive parsing. We don't really know if the parameter specifies free * Naive parsing. We don't really know if the parameter specifies free
@ -192,7 +189,9 @@ void register_dbms_parameters(const char *param_value,
vstring_sprintf(candidate ? candidate : vstring_sprintf(candidate ? candidate :
(candidate = vstring_alloc(30)), (candidate = vstring_alloc(30)),
"%s_%s", prefix, *cpp); "%s_%s", prefix, *cpp);
flag_parameter(STR(candidate), 0, (char *) &param_ctx); flag_parameter(STR(candidate),
PC_PARAM_FLAG_DBMS | PC_PARAM_FLAG_USER,
local_scope);
} }
break; break;
} }

View File

@ -12,7 +12,8 @@
/* PC_MASTER_ENT *local_scope; /* PC_MASTER_ENT *local_scope;
/* PC_PARAM_NODE *node; /* PC_PARAM_NODE *node;
/* /*
/* const char *expand_parameter_value(mode, value, local_scope) /* char *expand_parameter_value(buf, mode, value, local_scope)
/* VSTRING *buf;
/* int mode; /* int mode;
/* const char *value; /* const char *value;
/* PC_MASTER_ENT *local_scope; /* PC_MASTER_ENT *local_scope;
@ -38,6 +39,8 @@
/* each call. /* each call.
/* /*
/* Arguments: /* Arguments:
/* .IP buf
/* Null pointer, or pointer to output storage.
/* .IP mode /* .IP mode
/* Bit-wise OR of zero or one of the following (other flags /* Bit-wise OR of zero or one of the following (other flags
/* are ignored): /* are ignored):
@ -54,9 +57,9 @@
/* The parameter value where $name should be expanded. /* The parameter value where $name should be expanded.
/* .IP local_scope /* .IP local_scope
/* Null pointer, or pointer to master.cf entry with local /* Null pointer, or pointer to master.cf entry with local
/* parameter definitions. /* name=value settings.
/* .IP node /* .IP node
/* Null pointer, or global default settings for the named /* Null pointer, or global default setting for the named
/* parameter. /* parameter.
/* DIAGNOSTICS /* DIAGNOSTICS
/* Problems are reported to the standard error stream. /* Problems are reported to the standard error stream.
@ -128,9 +131,9 @@ typedef struct {
PC_MASTER_ENT *local_scope; PC_MASTER_ENT *local_scope;
} PC_EVAL_CTX; } PC_EVAL_CTX;
/* expand_parameter_value_helper - macro parser call-back routine */ /* lookup_parameter_value_wrapper - macro parser call-back routine */
static const char *expand_parameter_value_helper(const char *key, static const char *lookup_parameter_value_wrapper(const char *key,
int unused_type, int unused_type,
char *context) char *context)
{ {
@ -142,19 +145,22 @@ static const char *expand_parameter_value_helper(const char *key,
/* expand_parameter_value - expand $name in parameter value */ /* expand_parameter_value - expand $name in parameter value */
const char *expand_parameter_value(int mode, const char *value, char *expand_parameter_value(VSTRING *buf, int mode, const char *value,
PC_MASTER_ENT *local_scope) PC_MASTER_ENT *local_scope)
{ {
const char *myname = "expand_parameter_value"; const char *myname = "expand_parameter_value";
static VSTRING *buf; static VSTRING *local_buf;
int status; int status;
PC_EVAL_CTX eval_ctx; PC_EVAL_CTX eval_ctx;
/* /*
* Initialize. * Initialize.
*/ */
if (buf == 0) if (buf == 0) {
buf = vstring_alloc(10); if (local_buf == 0)
local_buf = vstring_alloc(10);
buf = local_buf;
}
/* /*
* Expand macros recursively. * Expand macros recursively.
@ -170,7 +176,7 @@ const char *expand_parameter_value(int mode, const char *value,
eval_ctx.mode = (mode & ~SHOW_NONDEF); eval_ctx.mode = (mode & ~SHOW_NONDEF);
eval_ctx.local_scope = local_scope; eval_ctx.local_scope = local_scope;
status = mac_expand(buf, value, MAC_EXP_FLAG_RECURSE, DONT_FILTER, status = mac_expand(buf, value, MAC_EXP_FLAG_RECURSE, DONT_FILTER,
expand_parameter_value_helper, (char *) &eval_ctx); lookup_parameter_value_wrapper, (char *) &eval_ctx);
if (status & MAC_PARSE_ERROR) if (status & MAC_PARSE_ERROR)
msg_fatal("macro processing error"); msg_fatal("macro processing error");
if (msg_verbose > 1) { if (msg_verbose > 1) {

View File

@ -177,7 +177,8 @@ static void print_parameter(int mode, const char *name,
*/ */
if (value != 0) { if (value != 0) {
if ((mode & SHOW_EVAL) != 0 && PC_RAW_PARAMETER(node) == 0) if ((mode & SHOW_EVAL) != 0 && PC_RAW_PARAMETER(node) == 0)
value = expand_parameter_value(mode, value, (PC_MASTER_ENT *) 0); value = expand_parameter_value((VSTRING *) 0, mode, value,
(PC_MASTER_ENT *) 0);
if (mode & SHOW_NAME) { if (mode & SHOW_NAME) {
print_line(mode, "%s = %s\n", name, value); print_line(mode, "%s = %s\n", name, value);
} else { } else {

View File

@ -245,7 +245,8 @@ static void print_master_line(int mode, PC_MASTER_ENT *masterp)
if (strcmp(arg, "-o") == 0 if (strcmp(arg, "-o") == 0
&& (aval = argv[field + 1]) != 0 && (aval = argv[field + 1]) != 0
&& (mode & SHOW_EVAL) != 0) && (mode & SHOW_EVAL) != 0)
aval = expand_parameter_value(mode, aval, masterp); aval = expand_parameter_value((VSTRING *) 0, mode,
aval, masterp);
/* /*
* Keep option and value on the same line. * Keep option and value on the same line.

View File

@ -96,16 +96,7 @@ static HTABLE *rest_class_table;
_ctx.local_scope = (scope); \ _ctx.local_scope = (scope); \
_ctx.param_class = (class); \ _ctx.param_class = (class); \
(void) mac_expand(NO_SCAN_RESULT, (value), MAC_EXP_FLAG_SCAN, \ (void) mac_expand(NO_SCAN_RESULT, (value), MAC_EXP_FLAG_SCAN, \
NO_SCAN_FILTER, flag_user_parameter, (char *) &_ctx); \ NO_SCAN_FILTER, flag_user_parameter_wrapper, (char *) &_ctx); \
} while (0)
/* FLAG_USER_PARAMETER - flag user-defined name "valid" if it has name=value */
#define FLAG_USER_PARAMETER(name, class, scope) do { \
PC_PARAM_CTX _ctx; \
_ctx.local_scope = (scope); \
_ctx.param_class = (class); \
flag_user_parameter((name), NO_SCAN_MODE, (char *) &_ctx); \
} while (0) } while (0)
/* convert_user_parameter - get user-defined parameter string value */ /* convert_user_parameter - get user-defined parameter string value */
@ -118,12 +109,9 @@ static const char *convert_user_parameter(char *unused_ptr)
/* flag_user_parameter - flag user-defined name "valid" if it has name=value */ /* flag_user_parameter - flag user-defined name "valid" if it has name=value */
static const char *flag_user_parameter(const char *mac_name, static const char *flag_user_parameter(const char *mac_name,
int unused_mode, int param_class,
char *context) PC_MASTER_ENT *local_scope)
{ {
PC_PARAM_CTX *param_ctx = (PC_PARAM_CTX *) context;
PC_MASTER_ENT *local_scope = param_ctx->local_scope;
int param_class = param_ctx->param_class;
const char *source = local_scope ? MASTER_CONF_FILE : MAIN_CONF_FILE; const char *source = local_scope ? MASTER_CONF_FILE : MAIN_CONF_FILE;
int user_supplied = 0; int user_supplied = 0;
@ -201,6 +189,17 @@ static const char *flag_user_parameter(const char *mac_name,
return (0); return (0);
} }
/* flag_user_parameter_wrapper - max_expand call-back helper */
static const char *flag_user_parameter_wrapper(const char *mac_name,
int unused_mode,
char *context)
{
PC_PARAM_CTX *ctx = (PC_PARAM_CTX *) context;
return (flag_user_parameter(mac_name, ctx->param_class, ctx->local_scope));
}
/* pc_lookup_eval - generalized mail_conf_lookup_eval */ /* pc_lookup_eval - generalized mail_conf_lookup_eval */
static const char *pc_lookup_eval(const char *dict_name, const char *name) static const char *pc_lookup_eval(const char *dict_name, const char *name)
@ -243,7 +242,7 @@ static void scan_user_parameter_namespace(const char *dict_name,
if (local_scope == 0 if (local_scope == 0
&& htable_locate(rest_class_table, param_name) == 0) && htable_locate(rest_class_table, param_name) == 0)
htable_enter(rest_class_table, param_name, ""); htable_enter(rest_class_table, param_name, "");
FLAG_USER_PARAMETER(param_name, PC_PARAM_FLAG_USER, local_scope); flag_user_parameter(param_name, PC_PARAM_FLAG_USER, local_scope);
} }
myfree(saved_class_list); myfree(saved_class_list);
} }

View File

@ -2352,6 +2352,21 @@ static int mail_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
VERP_CMD); VERP_CMD);
return (-1); return (-1);
} }
if (SMTPD_STAND_ALONE(state) == 0) {
const char *verify_sender;
/*
* XXX Don't reject the address when we're probed with our own
* address verification sender address. Otherwise, some timeout or
* some UCE block may result in mutual negative caching, making it
* painful to get the mail through. Unfortunately we still have to
* send the address to the Milters otherwise they may bail out with a
* "missing recipient" protocol error.
*/
verify_sender = valid_verify_sender_addr(STR(state->addr_buf));
if (verify_sender != 0)
vstring_strcpy(state->addr_buf, verify_sender);
}
if (SMTPD_STAND_ALONE(state) == 0 if (SMTPD_STAND_ALONE(state) == 0
&& var_smtpd_delay_reject == 0 && var_smtpd_delay_reject == 0
&& (err = smtpd_check_mail(state, STR(state->addr_buf))) != 0) { && (err = smtpd_check_mail(state, STR(state->addr_buf))) != 0) {