From: Wietse Venema Date: Sun, 21 Jan 2018 05:00:00 +0000 (-0500) Subject: postfix-3.3-20180121 X-Git-Tag: v3.3.0-RC1~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a73be1136f12e2e10484cd8ffe81a4b14c0e775;p=thirdparty%2Fpostfix.git postfix-3.3-20180121 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 23cb174f5..05672bf41 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -23297,3 +23297,16 @@ Apologies for any names omitted. only to Postfix daemons configured in master.cf; hyperlink the parameter name in documentation. Files: proto/postconf.proto, mantools/postlink, daemon manpages. + + Cleanup: allow whitespace between $[{(], parameter name, + and [:?)}]. This allows making complex expressions more + readable with line breaks. File: util/mac_expand.c. + + Cleanup: don't initialize the service_name parameter with + the process_name value. Files: postconf/postconf.[hc], + postconf/postconf_builtin.c. + +20180121 + + Bugfix (introduced: 20180106): too many arguments for format + string. File: local/mailbox.c. diff --git a/postfix/conf/master.cf b/postfix/conf/master.cf index b67ed5986..5a75ae576 100644 --- a/postfix/conf/master.cf +++ b/postfix/conf/master.cf @@ -53,6 +53,7 @@ proxymap unix - - n - - proxymap proxywrite unix - - n - 1 proxymap smtp unix - - n - - smtp relay unix - - n - - smtp + -o syslog_name=postfix/$service_name # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5 showq unix n - n - - showq error unix - - n - - error diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index 859941dd0..6525088b9 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -10040,9 +10040,27 @@ submit mail into the Postfix queue.
service_name (read-only)
-

-The master.cf service name of a Postfix daemon process. -

+

The master.cf service name of a Postfix daemon process. This +can be used to distinguish the logging from different services that +use the same program name.

+ +

Example master.cf entries:

+ +
+# Distinguish inbound MTA logging from submission and smtps logging.
+smtp      inet  n       -       n       -       -       smtpd
+submission inet n       -       n       -       -       smtpd
+    -o syslog_name=postfix/$service_name
+smtps     inet  n       -       n       -       -       smtpd
+    -o syslog_name=postfix/$service_name
+
+ +
+# Distinguish outbound MTA logging from inbound relay logging.
+smtp      unix  -       -       n       -       -       smtp
+relay     unix  -       -       n       -       -       smtp
+    -o syslog_name=postfix/$service_name
+
diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index 6336691f6..6490d99f1 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -6240,7 +6240,35 @@ A Sendmail compatibility feature that specifies the location of the Postfix \fBsendmail\fR(1) command. This command can be used to submit mail into the Postfix queue. .SH service_name (read\-only) -The master.cf service name of a Postfix daemon process. +The master.cf service name of a Postfix daemon process. This +can be used to distinguish the logging from different services that +use the same program name. +.PP +Example master.cf entries: +.PP +.nf +.na +.ft C +# Distinguish inbound MTA logging from submission and smtps logging. +smtp inet n \- n \- \- smtpd +submission inet n \- n \- \- smtpd + \-o syslog_name=postfix/$service_name +smtps inet n \- n \- \- smtpd + \-o syslog_name=postfix/$service_name +.fi +.ad +.ft R +.PP +.nf +.na +.ft C +# Distinguish outbound MTA logging from inbound relay logging. +smtp unix \- \- n \- \- smtp +relay unix \- \- n \- \- smtp + \-o syslog_name=postfix/$service_name +.fi +.ad +.ft R .SH service_throttle_time (default: 60s) How long the Postfix \fBmaster\fR(8) waits before forking a server that appears to be malfunctioning. diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 1b1363aa5..a09abb1a5 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -8133,9 +8133,27 @@ The process name of a Postfix command or daemon process. %PARAM service_name read-only -

-The master.cf service name of a Postfix daemon process. -

+

The master.cf service name of a Postfix daemon process. This +can be used to distinguish the logging from different services that +use the same program name.

+ +

Example master.cf entries:

+ +
+# Distinguish inbound MTA logging from submission and smtps logging.
+smtp      inet  n       -       n       -       -       smtpd
+submission inet n       -       n       -       -       smtpd
+    -o syslog_name=postfix/$service_name
+smtps     inet  n       -       n       -       -       smtpd
+    -o syslog_name=postfix/$service_name
+
+ +
+# Distinguish outbound MTA logging from inbound relay logging.
+smtp      unix  -       -       n       -       -       smtp
+relay     unix  -       -       n       -       -       smtp
+    -o syslog_name=postfix/$service_name
+
%PARAM process_id read-only diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 6a8f2a05b..18b4c59b7 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -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 "20180114" +#define MAIL_RELEASE_DATE "20180121" #define MAIL_VERSION_NUMBER "3.3" #ifdef SNAPSHOT diff --git a/postfix/src/local/mailbox.c b/postfix/src/local/mailbox.c index 1fbbd9c77..d4f01bf71 100644 --- a/postfix/src/local/mailbox.c +++ b/postfix/src/local/mailbox.c @@ -97,7 +97,7 @@ static int deliver_mailbox_file(LOCAL_STATE state, USER_ATTR usr_attr) int deliver_status; int copy_flags; VSTRING *biff; - off_t end; + off_t end; struct stat st; uid_t spool_uid; gid_t spool_gid; @@ -202,8 +202,8 @@ static int deliver_mailbox_file(LOCAL_STATE state, USER_ATTR usr_attr) msg_warn("specify \"%s = no\" to ignore mailbox ownership mismatch", VAR_STRICT_MBOX_OWNER); } else { - if ((end = vstream_fseek(mp->fp, (off_t) 0, SEEK_END)) < 0) - msg_fatal("seek mailbox file %s: %m", myname, mailbox); + if ((end = vstream_fseek(mp->fp, (off_t) 0, SEEK_END)) < 0) + msg_fatal("seek mailbox file %s: %m", mailbox); mail_copy_status = mail_copy(COPY_ATTR(state.msg_attr), mp->fp, copy_flags, "\n", why); } diff --git a/postfix/src/postconf/postconf.c b/postfix/src/postconf/postconf.c index 44c1d5697..9544c0a3a 100644 --- a/postfix/src/postconf/postconf.c +++ b/postfix/src/postconf/postconf.c @@ -1000,8 +1000,7 @@ int main(int argc, char **argv) pcf_read_parameters(); if (override_params) pcf_set_parameters(override_params->argv); - pcf_register_builtin_parameters(basename(argv[0]), basename(argv[0]), - getpid()); + pcf_register_builtin_parameters(basename(argv[0]), getpid()); pcf_register_service_parameters(); pcf_register_user_parameters(); if (pcf_cmd_mode & PCF_MASTER_FLD) @@ -1054,8 +1053,7 @@ int main(int argc, char **argv) if (override_params) pcf_set_parameters(override_params->argv); } - pcf_register_builtin_parameters(basename(argv[0]), basename(argv[0]), - getpid()); + pcf_register_builtin_parameters(basename(argv[0]), getpid()); /* * Add service-dependent parameters (service names from master.cf) diff --git a/postfix/src/postconf/postconf.h b/postfix/src/postconf/postconf.h index 7f391df68..814e597d3 100644 --- a/postfix/src/postconf/postconf.h +++ b/postfix/src/postconf/postconf.h @@ -251,7 +251,7 @@ extern NAME_CODE pcf_field_name_offset[]; /* * postconf_builtin.c. */ -extern void pcf_register_builtin_parameters(const char *, const char *, pid_t); +extern void pcf_register_builtin_parameters(const char *, pid_t); /* * postconf_service.c. diff --git a/postfix/src/postconf/postconf_builtin.c b/postfix/src/postconf/postconf_builtin.c index 311c362da..a673df134 100644 --- a/postfix/src/postconf/postconf_builtin.c +++ b/postfix/src/postconf/postconf_builtin.c @@ -6,9 +6,8 @@ /* SYNOPSIS /* #include /* -/* void pcf_register_builtin_parameters(procname, servname, pid) +/* void pcf_register_builtin_parameters(procname, pid) /* const char *procname; -/* const char *servname; /* pid_t pid; /* DESCRIPTION /* pcf_register_builtin_parameters() initializes the global @@ -18,8 +17,6 @@ /* Arguments: /*.IP procname /* Provides the default value for the "process_name" parameter. -/*.IP servname -/* Provides the default value for the "service_name" parameter. /*.IP pid /* Provides the default value for the "process_id" parameter. /* DIAGNOSTICS @@ -366,8 +363,7 @@ static const char *pcf_conv_long_parameter(void *ptr) /* pcf_register_builtin_parameters - add built-ins to the global name space */ -void pcf_register_builtin_parameters(const char *procname, - const char *servname, pid_t pid) +void pcf_register_builtin_parameters(const char *procname, pid_t pid) { const char *myname = "pcf_register_builtin_parameters"; const CONFIG_TIME_TABLE *ctt; @@ -450,7 +446,7 @@ void pcf_register_builtin_parameters(const char *procname, PCF_PARAM_TABLE_ENTER(pcf_param_table, pcf_adhoc_procname.name, PCF_PARAM_FLAG_BUILTIN | PCF_PARAM_FLAG_READONLY, (void *) &pcf_adhoc_procname, pcf_conv_str_parameter); - pcf_adhoc_servname.defval = mystrdup(servname); + pcf_adhoc_servname.defval = mystrdup(""); PCF_PARAM_TABLE_ENTER(pcf_param_table, pcf_adhoc_servname.name, PCF_PARAM_FLAG_BUILTIN | PCF_PARAM_FLAG_READONLY, (void *) &pcf_adhoc_servname, pcf_conv_str_parameter); diff --git a/postfix/src/util/mac_expand.c b/postfix/src/util/mac_expand.c index 8d02f32d9..8ba0071bc 100644 --- a/postfix/src/util/mac_expand.c +++ b/postfix/src/util/mac_expand.c @@ -472,21 +472,26 @@ static int mac_expand_callback(int type, VSTRING *buf, void *ptr) * Named parameter. */ else { + char *start; /* * Look for the ? or : operator. In case of a syntax error, * return without doing damage, and issue a warning instead. */ + start = (cp += strspn(cp, MAC_EXP_WHITESPACE)); for ( /* void */ ; /* void */ ; cp++) { - if ((ch = *cp) == 0) { + if ((ch = cp[tmp_len = strspn(cp, MAC_EXP_WHITESPACE)]) == 0) { + *cp = 0; lookup_mode = MAC_EXP_MODE_USE; break; } if (ch == '?' || ch == ':') { *cp++ = 0; + cp += tmp_len; lookup_mode = MAC_EXP_MODE_TEST; break; } + ch = *cp; if (!ISALNUM(ch) && ch != '_') { MAC_EXP_ERR_RETURN(mc, "attribute name syntax error at: " "\"...%.*s>>>%.20s\"", @@ -499,7 +504,7 @@ static int mac_expand_callback(int type, VSTRING *buf, void *ptr) * Look up the named parameter. Todo: allow the lookup function * to specify if the result is safe for $name expanson. */ - lookup = mc->lookup(vstring_str(buf), lookup_mode, mc->context); + lookup = mc->lookup(start, lookup_mode, mc->context); } /* diff --git a/postfix/src/util/mac_expand.in b/postfix/src/util/mac_expand.in index 29f78f20f..dbc583c0f 100644 --- a/postfix/src/util/mac_expand.in +++ b/postfix/src/util/mac_expand.in @@ -1,7 +1,12 @@ name1 = name1-value +$name1 $(name1 -$(name ) +$(name1) +$( name1) +$(name1 ) +$(na me1) +${na me1} ${${name1} != {}?name 1 defined, |$name1|$name2|} ${ ${name1} != {}?name 1 defined, |$name1|$name2|} ${ ${name1} ?name 1 defined, |$name1|$name2|} diff --git a/postfix/src/util/mac_expand.ref b/postfix/src/util/mac_expand.ref index 973dc50ba..9ffcb410f 100644 --- a/postfix/src/util/mac_expand.ref +++ b/postfix/src/util/mac_expand.ref @@ -1,19 +1,30 @@ << name1 = name1-value << +<< $name1 +stat=0 result=name1-value << $(name1 unknown: warning: truncated macro reference: "$(name1" stat=1 result= -<< $(name ) -unknown: warning: attribute name syntax error at: "...name>>> " +<< $(name1) +stat=0 result=name1-value +<< $( name1) +stat=0 result=name1-value +<< $(name1 ) +stat=0 result=name1-value +<< $(na me1) +unknown: warning: attribute name syntax error at: "...na>>> me1" +stat=1 result= +<< ${na me1} +unknown: warning: attribute name syntax error at: "...na>>> me1" stat=1 result= << ${${name1} != {}?name 1 defined, |$name1|$name2|} unknown: warning: attribute name syntax error at: "...>>>${name1} != {}?name " stat=1 result= << ${ ${name1} != {}?name 1 defined, |$name1|$name2|} -unknown: warning: attribute name syntax error at: "...>>> ${name1} != {}?name" +unknown: warning: attribute name syntax error at: "... >>>${name1} != {}?name " stat=1 result= << ${ ${name1} ?name 1 defined, |$name1|$name2|} -unknown: warning: attribute name syntax error at: "...>>> ${name1} ?name 1 de" +unknown: warning: attribute name syntax error at: "... >>>${name1} ?name 1 def" stat=1 result= << ${{$name1} ? {name 1 defined, |$name1|$name2|} : {name 1 undefined, |$name1|$name2|} } unknown: warning: "==" or "!="" or "<"" or "<="" or ">="" or ">" expected at: "...$name1}>>>? {name 1 defined, |" @@ -51,16 +62,13 @@ stat=1 result= unknown: warning: "==" or "!="" or "<"" or "<="" or ">="" or ">" expected at: "...text}>>>= {}" stat=1 result= << ${{${ name1}} == {}} -unknown: warning: attribute name syntax error at: "...>>> name1" -stat=1 result= +stat=0 result= << ${name1?{${ name1}}:{${name2}}} -unknown: warning: attribute name syntax error at: "...>>> name1" -stat=1 result= +stat=0 result=name1-value << ${name2?{${ name1}}:{${name2}}} stat=2 result= << ${name2?{${name1}}:{${ name2}}} -unknown: warning: attribute name syntax error at: "...>>> name2" -stat=1 result= +stat=2 result= << ${name2:{${name1}}:{${name2}}} unknown: warning: unexpected input at: "...${name1}}>>>:{${name2}}" stat=1 result=name1-value