From: Wietse Venema Date: Sun, 5 Oct 2014 05:00:00 +0000 (-0500) Subject: postfix-2.12-20141005 X-Git-Tag: v3.0.0-RC1~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=362062060eaf95f2081afef9b249403fef5cb5df;p=thirdparty%2Fpostfix.git postfix-2.12-20141005 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index ca551051e..a1e04fd5c 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -20553,3 +20553,23 @@ Apologies for any names omitted. RELEASE_NOTES to postconf(5) manpage, and changed the wording of the BC messages. Files: RELEASE_NOTES, proto/postconf.proto, master/master_ent.c, smtpd/smtpd.c, trivial-rewrite/rewrite.c. + +20141003 + + Workaround: kludge for multiple paragraphs of text in indented + paragraphs. Files: mantools/postconf2html, mantools/postconf2man, + proto/Makefile.in, proto/postconf.proto + +20141005 + + Cleanup: CHARSET_COMMA_SP, CHARSET_SPACE and CHARSET_BRACE + to prepare for the elimination of ad-hoc string constants. + File: util/sys_defs.h. + + Cleanup: allow "{ name=value }" to protect whitespace in + import_environment and export_environment. Files: + proto/postconf.proto, global/mail_parm_split.c, global + /mail_parm_split.h, global/mail_stream.c, local/command.c, + master/master.c, pipe/pipe.c, postdrop/postdrop.c, + postfix/postfix.c, postmulti/postmulti.c, postqueue/postqueue.c, + spawn/spawn.c. diff --git a/postfix/WISHLIST b/postfix/WISHLIST index f83de8edd..866327014 100644 --- a/postfix/WISHLIST +++ b/postfix/WISHLIST @@ -11,6 +11,10 @@ Wish list: Things to do after the stable release: + Other things that we might want to break: relay_domains, + parent_domain_matches_subdomains. This requires a new + compatibility_level. + Update smtputf8_enable in postconf(5) use "static const char myname[] ..." diff --git a/postfix/html/master.5.html b/postfix/html/master.5.html index 91fd30ae5..537fa9ad3 100644 --- a/postfix/html/master.5.html +++ b/postfix/html/master.5.html @@ -124,7 +124,7 @@ MASTER(5) MASTER(5) The local(8), pipe(8), spawn(8), and virtual(8) daemons require privileges. - Chroot (default: Postfix >= 2.12: y, Postfix <2.12: n) + Chroot (default: Postfix >= 2.12: n, Postfix <2.12: y) Whether or not the service runs chrooted to the mail queue directory (pathname is controlled by the queue_directory config- uration variable in the main.cf file). @@ -180,16 +180,19 @@ MASTER(5) MASTER(5) with the debugger_command variable in the main.cf config- uration file. See DEBUG_README for hints and tips. - -o name=value (short form) + -o { name = value } (long form, Postfix >= 2.12) - -o { name = value } (Postfix 2.12 and later) + -o name=value (short form) Override the named main.cf configuration parameter. The parameter value can refer to other parameters as $name etc., just like in main.cf. See postconf(5) for syntax. - NOTE 1: with the "short form" shown above, do not specify - whitespace around the "=" or in parameter values. To - specify a parameter value that contains whitespace, use + NOTE 1: With the "long form" shown above, whitespace + after "{" and before "}" is ignored. + + NOTE 2: with the "short form" shown above, do not specify + whitespace around the "=" or in parameter values. To + specify a parameter value that contains whitespace, use commas instead of spaces, or specify the value in main.cf. Example: @@ -200,20 +203,20 @@ MASTER(5) MASTER(5) /etc/postfix/main.cf submission_mumble = text with whitespace... - NOTE 2: Over-zealous use of parameter overrides makes the - Postfix configuration hard to understand and maintain. - At a certain point, it might be easier to configure mul- + NOTE 3: Over-zealous use of parameter overrides makes the + Postfix configuration hard to understand and maintain. + At a certain point, it might be easier to configure mul- tiple instances of Postfix, instead of configuring multi- ple personalities via master.cf. - -v Increase the verbose logging level. Specify multiple -v - options to make a Postfix daemon process increasingly + -v Increase the verbose logging level. Specify multiple -v + options to make a Postfix daemon process increasingly verbose. Other command-line arguments Specify "{" and "}" around command arguments that contain - whitespace (Postfix 2.12 and later). Whitespace immedi- - ately after "{" and before "}" is ignored. + whitespace (Postfix 2.12 and later). Whitespace after "{" + and before "}" is ignored. SEE ALSO master(8), process manager diff --git a/postfix/html/pipe.8.html b/postfix/html/pipe.8.html index 3e22d84a2..4ac8e5d7c 100644 --- a/postfix/html/pipe.8.html +++ b/postfix/html/pipe.8.html @@ -192,8 +192,8 @@ PIPE(8) PIPE(8) interpreter. Specify "{" and "}" around command arguments that contain white- - space (Postfix 2.12 and later). Whitespace immediately after "{" - and before "}" is ignored. + space (Postfix 2.12 and later). Whitespace after "{" and before + "}" is ignored. In the command argument vector, the following macros are recog- nized and replaced with corresponding information from the Post- diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index c395b5c39..480bed9a6 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -61,10 +61,12 @@ with "value1" when "$name" is non-empty, and with "value2" when "value2". This form is supported with Postfix versions ≥ 2.12.

-
  • Instead of a parameter name, the first item inside "${...}" -may be a logical expression of the form: "{value3} == {value4}" -(equality) or "{value3} != {value4}" (inequality). This form is -supported with Postfix versions ≥ 2.12.

    +
  • The first item inside "${...}" may be a logical expression +of the form: "{value3} == {value4}". Besides the "==" (equality) +operator Postfix supports "!=" (inequality), "<", "≤", "≥", +and ">". The comparison is numerical when both operands are all +digits, otherwise the comparison is lexicographical. These forms +are supported with Postfix versions ≥ 2.12.

  • Each "value" is subject to recursive named parameter and logical expression evaluation, except where noted.

    @@ -1543,13 +1545,22 @@ global ipc_timeout parameter as well. main.cf and master.cf default settings after an upgrade to a newer but incompatible Postfix version.

    -

    While the backwards-compatible default settings are in effect, -Postfix logs what services or what email would be affected by -the incompatible change.

    +

    While backwards compatibility is in effect, Postfix logs what +services or what email would be affected by the incompatible change. +

    + +

    As detailed below, based on this logging the system administrator +can determine whether or not a backwards-compatible default setting +needs to be made permanent in main.cf or master.cf.

    -

    Based on this logging the system administrator can determine -whether or not a backwards-compatible default setting needs to be -made permanent in main.cf or master.cf.

    +

    When no more backwards-compatible settings need to be made +permanent, the administrator should turn off backwards compatibility +by updating the compatibility_level setting in main.cf.

    + +
    +# postconf compatibility_level=1
    +# postfix reload
    +

    Changes introduced with Postfix 2.12 (compatibility level 1):

    @@ -1632,19 +1643,6 @@ setting "smtputf8_enable = no" per -

    When no more backwards-compatible settings need to be made -permanent, the administrator should turn off the backwards-compatible -default settings by updating the compatibility_level setting in -main.cf.

    - -
    -# postconf compatibility_level=1
    -# postfix reload
    -
    - -

    Future incompatible changes will require setting "compatibility_level -= 2", and so on.

    -

    This feature is available in Postfix 2.12 and later.

    @@ -3234,9 +3232,11 @@ time keeping on System-V-ish systems.

    Specify a list of names and/or name=value pairs, separated by -whitespace or comma. The name=value form is supported with -Postfix version 2.1 and later. -

    +whitespace or comma. Specify "{ name=value }" to protect whitespace +or comma in parameter values (whitespace after "{" and before "}" +is ignored). The form name=value is supported with Postfix version +2.1 and later; the use of {} is supported with Postfix 2.12 and +later.

    Example: @@ -3762,8 +3762,11 @@ parameters:

    Specify a list of names and/or name=value pairs, separated by -whitespace or comma. The name=value form is supported with -Postfix version 2.1 and later.

    +whitespace or comma. Specify "{ name=value }" to protect whitespace +or comma in parameter values (whitespace after "{" and before "}" +is ignored). The form name=value is supported with Postfix version +2.1 and later; the use of {} is supported with Postfix 2.12 and +later.

    diff --git a/postfix/man/man5/master.5 b/postfix/man/man5/master.5 index 47f3937fc..3d2f21ea5 100644 --- a/postfix/man/man5/master.5 +++ b/postfix/man/man5/master.5 @@ -126,7 +126,7 @@ main.cf file). .sp The \fBlocal\fR(8), \fBpipe\fR(8), \fBspawn\fR(8), and \fBvirtual\fR(8) daemons require privileges. -.IP "\fBChroot (default: Postfix >= 2.12: y, Postfix <2.12: n)\fR" +.IP "\fBChroot (default: Postfix >= 2.12: n, Postfix <2.12: y)\fR" Whether or not the service runs chrooted to the mail queue directory (pathname is controlled by the \fBqueue_directory\fR configuration variable in the main.cf file). @@ -182,14 +182,17 @@ all daemon programs: Run the daemon under control by the command specified with the \fBdebugger_command\fR variable in the main.cf configuration file. See DEBUG_README for hints and tips. +.IP "\fB-o { \fIname\fR = \fIvalue\fB }\fR (long form, Postfix >= 2.12)" .IP "\fB-o \fIname\fR=\fIvalue\fR (short form)" -.IP "\fB-o { \fIname\fR = \fIvalue\fB }\fR (Postfix 2.12 and later)" Override the named main.cf configuration parameter. The parameter value can refer to other parameters as \fI$name\fR etc., just like in main.cf. See \fBpostconf\fR(5) for syntax. .sp -NOTE 1: with the "short form" shown above, do not specify +NOTE 1: With the "long form" shown above, whitespace +after "{" and before "}" is ignored. +.sp +NOTE 2: with the "short form" shown above, do not specify whitespace around the "=" or in parameter values. To specify a parameter value that contains whitespace, use commas instead of spaces, or specify the @@ -204,7 +207,7 @@ value in main.cf. Example: submission_mumble = text with whitespace... .fi .sp -NOTE 2: Over-zealous use of parameter overrides makes the +NOTE 3: Over-zealous use of parameter overrides makes the Postfix configuration hard to understand and maintain. At a certain point, it might be easier to configure multiple instances of Postfix, instead of configuring multiple @@ -214,7 +217,7 @@ Increase the verbose logging level. Specify multiple \fB-v\fR options to make a Postfix daemon process increasingly verbose. .IP "Other command-line arguments" Specify "{" and "}" around command arguments that contain -whitespace (Postfix 2.12 and later). Whitespace immediately +whitespace (Postfix 2.12 and later). Whitespace after "{" and before "}" is ignored. .SH "SEE ALSO" .na diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index 87ba293d7..ccbb1039d 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -49,10 +49,12 @@ when "$name" is non-empty, and with "value2" when "$name" is empty. The "{}" is required for "value1", optional for "value2". This form is supported with Postfix versions >= 2.12. .IP \(bu -Instead of a parameter name, the first item inside "${...}" may be -a logical expression of the form: "{value3} == {value4}" (equality) -or "{value3} != {value4}" (inequality). This form is supported -with Postfix versions >= 2.12. +The first item inside "${...}" may be a logical expression of the +form: "{value3} == {value4}". Besides the "==" (equality) operator +Postfix supports "!=" (inequality), "<", "<=", ">=", and ">". The +comparison is numerical when both operands are all digits, otherwise +the comparison is lexicographical. These forms are supported with +Postfix versions >= 2.12. .IP \(bu Each "value" is subject to recursive named parameter and logical expression evaluation, except where noted. @@ -894,13 +896,25 @@ A safety net that forces Postfix to run with backwards-compatible main.cf and master.cf default settings after an upgrade to a newer but incompatible Postfix version. .PP -While the backwards-compatible default settings are in effect, -Postfix logs what services or what email would be affected by -the incompatible change. +While backwards compatibility is in effect, Postfix logs what +services or what email would be affected by the incompatible change. .PP -Based on this logging the system administrator can determine -whether or not a backwards-compatible default setting needs to be -made permanent in main.cf or master.cf. +As detailed below, based on this logging the system administrator +can determine whether or not a backwards-compatible default setting +needs to be made permanent in main.cf or master.cf. +.PP +When no more backwards-compatible settings need to be made +permanent, the administrator should turn off backwards compatibility +by updating the compatibility_level setting in main.cf. +.PP +.nf +.na +.ft C +# \fBpostconf compatibility_level=1\fR +# \fBpostfix reload\fR +.fi +.ad +.ft R .PP Changes introduced with Postfix 2.12 (compatibility level 1): .IP \(bu @@ -1007,23 +1021,6 @@ setting "smtputf8_enable = no" permanent in main.cf: .ft R .br .PP -When no more backwards-compatible settings need to be made -permanent, the administrator should turn off the backwards-compatible -default settings by updating the compatibility_level setting in -main.cf. -.PP -.nf -.na -.ft C -# \fBpostconf compatibility_level=1\fR -# \fBpostfix reload\fR -.fi -.ad -.ft R -.PP -Future incompatible changes will require setting "compatibility_level -= 2", and so on. -.PP This feature is available in Postfix 2.12 and later. .SH config_directory (default: see "postconf -d" output) The default location of the Postfix main.cf and master.cf @@ -2038,8 +2035,11 @@ to non-Postfix processes. The TZ variable is needed for sane time keeping on System-V-ish systems. .PP Specify a list of names and/or name=value pairs, separated by -whitespace or comma. The name=value form is supported with -Postfix version 2.1 and later. +whitespace or comma. Specify "{ name=value }" to protect whitespace +or comma in parameter values (whitespace after "{" and before "}" +is ignored). The form name=value is supported with Postfix version +2.1 and later; the use of {} is supported with Postfix 2.12 and +later. .PP Example: .PP @@ -2335,8 +2335,11 @@ Needed to make "\fBpostfix -c\fR" work. .br .PP Specify a list of names and/or name=value pairs, separated by -whitespace or comma. The name=value form is supported with -Postfix version 2.1 and later. +whitespace or comma. Specify "{ name=value }" to protect whitespace +or comma in parameter values (whitespace after "{" and before "}" +is ignored). The form name=value is supported with Postfix version +2.1 and later; the use of {} is supported with Postfix 2.12 and +later. .SH in_flow_delay (default: 1s) Time to pause before accepting a new message, when the message arrival rate exceeds the message delivery rate. This feature is diff --git a/postfix/man/man8/pipe.8 b/postfix/man/man8/pipe.8 index 41ef3f20f..e2951ed95 100644 --- a/postfix/man/man8/pipe.8 +++ b/postfix/man/man8/pipe.8 @@ -200,7 +200,7 @@ The command is executed directly, i.e. without interpretation of shell meta characters by a shell command interpreter. .sp Specify "{" and "}" around command arguments that contain -whitespace (Postfix 2.12 and later). Whitespace immediately +whitespace (Postfix 2.12 and later). Whitespace after "{" and before "}" is ignored. .sp In the command argument vector, the following macros are recognized diff --git a/postfix/proto/master b/postfix/proto/master index a817b508b..c6e145a5b 100644 --- a/postfix/proto/master +++ b/postfix/proto/master @@ -120,7 +120,7 @@ # .sp # The \fBlocal\fR(8), \fBpipe\fR(8), \fBspawn\fR(8), and # \fBvirtual\fR(8) daemons require privileges. -# .IP "\fBChroot (default: Postfix >= 2.12: y, Postfix <2.12: n)\fR" +# .IP "\fBChroot (default: Postfix >= 2.12: n, Postfix <2.12: y)\fR" # Whether or not the service runs chrooted to the mail queue # directory (pathname is controlled by the \fBqueue_directory\fR # configuration variable in the main.cf file). @@ -176,14 +176,17 @@ # Run the daemon under control by the command specified with # the \fBdebugger_command\fR variable in the main.cf # configuration file. See DEBUG_README for hints and tips. +# .IP "\fB-o { \fIname\fR = \fIvalue\fB }\fR (long form, Postfix >= 2.12)" # .IP "\fB-o \fIname\fR=\fIvalue\fR (short form)" -# .IP "\fB-o { \fIname\fR = \fIvalue\fB }\fR (Postfix 2.12 and later)" # Override the named main.cf configuration parameter. The # parameter value can refer to other parameters as \fI$name\fR # etc., just like in main.cf. See \fBpostconf\fR(5) for # syntax. # .sp -# NOTE 1: with the "short form" shown above, do not specify +# NOTE 1: With the "long form" shown above, whitespace +# after "{" and before "}" is ignored. +# .sp +# NOTE 2: with the "short form" shown above, do not specify # whitespace around the "=" or in # parameter values. To specify a parameter value that contains # whitespace, use commas instead of spaces, or specify the @@ -198,7 +201,7 @@ # submission_mumble = text with whitespace... # .fi # .sp -# NOTE 2: Over-zealous use of parameter overrides makes the +# NOTE 3: Over-zealous use of parameter overrides makes the # Postfix configuration hard to understand and maintain. At # a certain point, it might be easier to configure multiple # instances of Postfix, instead of configuring multiple @@ -208,7 +211,7 @@ # options to make a Postfix daemon process increasingly verbose. # .IP "Other command-line arguments" # Specify "{" and "}" around command arguments that contain -# whitespace (Postfix 2.12 and later). Whitespace immediately +# whitespace (Postfix 2.12 and later). Whitespace # after "{" and before "}" is ignored. # SEE ALSO # master(8), process manager diff --git a/postfix/proto/postconf.html.prolog b/postfix/proto/postconf.html.prolog index a1661f4cd..a8b415ca1 100644 --- a/postfix/proto/postconf.html.prolog +++ b/postfix/proto/postconf.html.prolog @@ -61,10 +61,12 @@ with "value1" when "$name" is non-empty, and with "value2" when "value2". This form is supported with Postfix versions ≥ 2.12.

    -
  • Instead of a parameter name, the first item inside "${...}" -may be a logical expression of the form: "{value3} == {value4}" -(equality) or "{value3} != {value4}" (inequality). This form is -supported with Postfix versions ≥ 2.12.

    +
  • The first item inside "${...}" may be a logical expression +of the form: "{value3} == {value4}". Besides the "==" (equality) +operator Postfix supports "!=" (inequality), "<", "≤", "≥", +and ">". The comparison is numerical when both operands are all +digits, otherwise the comparison is lexicographical. These forms +are supported with Postfix versions ≥ 2.12.

  • Each "value" is subject to recursive named parameter and logical expression evaluation, except where noted.

    diff --git a/postfix/proto/postconf.man.prolog b/postfix/proto/postconf.man.prolog index ac915824c..47c2d8560 100644 --- a/postfix/proto/postconf.man.prolog +++ b/postfix/proto/postconf.man.prolog @@ -49,10 +49,12 @@ when "$name" is non-empty, and with "value2" when "$name" is empty. The "{}" is required for "value1", optional for "value2". This form is supported with Postfix versions >= 2.12. .IP \(bu -Instead of a parameter name, the first item inside "${...}" may be -a logical expression of the form: "{value3} == {value4}" (equality) -or "{value3} != {value4}" (inequality). This form is supported -with Postfix versions >= 2.12. +The first item inside "${...}" may be a logical expression of the +form: "{value3} == {value4}". Besides the "==" (equality) operator +Postfix supports "!=" (inequality), "<", "<=", ">=", and ">". The +comparison is numerical when both operands are all digits, otherwise +the comparison is lexicographical. These forms are supported with +Postfix versions >= 2.12. .IP \(bu Each "value" is subject to recursive named parameter and logical expression evaluation, except where noted. diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 72d91bea2..c32fd994c 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -1429,9 +1429,11 @@ time keeping on System-V-ish systems.

    Specify a list of names and/or name=value pairs, separated by -whitespace or comma. The name=value form is supported with -Postfix version 2.1 and later. -

    +whitespace or comma. Specify "{ name=value }" to protect whitespace +or comma in parameter values (whitespace after "{" and before "}" +is ignored). The form name=value is supported with Postfix version +2.1 and later; the use of {} is supported with Postfix 2.12 and +later.

    Example: @@ -1878,8 +1880,11 @@ parameters:

    Specify a list of names and/or name=value pairs, separated by -whitespace or comma. The name=value form is supported with -Postfix version 2.1 and later.

    +whitespace or comma. Specify "{ name=value }" to protect whitespace +or comma in parameter values (whitespace after "{" and before "}" +is ignored). The form name=value is supported with Postfix version +2.1 and later; the use of {} is supported with Postfix 2.12 and +later.

    %PARAM in_flow_delay 1s @@ -16206,13 +16211,22 @@ mail. main.cf and master.cf default settings after an upgrade to a newer but incompatible Postfix version.

    -

    While the backwards-compatible default settings are in effect, -Postfix logs what services or what email would be affected by -the incompatible change.

    +

    While backwards compatibility is in effect, Postfix logs what +services or what email would be affected by the incompatible change. +

    + +

    As detailed below, based on this logging the system administrator +can determine whether or not a backwards-compatible default setting +needs to be made permanent in main.cf or master.cf.

    -

    Based on this logging the system administrator can determine -whether or not a backwards-compatible default setting needs to be -made permanent in main.cf or master.cf.

    +

    When no more backwards-compatible settings need to be made +permanent, the administrator should turn off backwards compatibility +by updating the compatibility_level setting in main.cf.

    + +
    +# postconf compatibility_level=1
    +# postfix reload
    +

    Changes introduced with Postfix 2.12 (compatibility level 1):

    @@ -16309,17 +16323,4 @@ setting "smtputf8_enable = no" permanent in main.cf: -

    When no more backwards-compatible settings need to be made -permanent, the administrator should turn off the backwards-compatible -default settings by updating the compatibility_level setting in -main.cf.

    - -
    -# postconf compatibility_level=1
    -# postfix reload
    -
    - -

    Future incompatible changes will require setting "compatibility_level -= 2", and so on.

    -

    This feature is available in Postfix 2.12 and later.

    diff --git a/postfix/src/global/Makefile.in b/postfix/src/global/Makefile.in index dcedc08a3..ae1c93386 100644 --- a/postfix/src/global/Makefile.in +++ b/postfix/src/global/Makefile.in @@ -33,7 +33,7 @@ SRCS = abounce.c anvil_clnt.c been_here.c bounce.c bounce_log.c \ smtp_reply_footer.c safe_ultostr.c verify_sender_addr.c \ dict_memcache.c mail_version.c memcache_proto.c server_acl.c \ mkmap_fail.c haproxy_srvr.c dsn_filter.c dynamicmaps.c uxtext.c \ - smtputf8.c mail_conf_over.c + smtputf8.c mail_conf_over.c mail_parm_split.c OBJS = abounce.o anvil_clnt.o been_here.o bounce.o bounce_log.o \ canon_addr.o cfg_parser.o cleanup_strerror.o cleanup_strflags.o \ clnt_stream.o conv_time.o db_common.o debug_peer.o debug_process.o \ @@ -68,7 +68,7 @@ OBJS = abounce.o anvil_clnt.o been_here.o bounce.o bounce_log.o \ smtp_reply_footer.o safe_ultostr.o verify_sender_addr.o \ dict_memcache.o mail_version.o memcache_proto.o server_acl.o \ mkmap_fail.o haproxy_srvr.o dsn_filter.o dynamicmaps.o uxtext.o \ - smtputf8.o attr_override.o $(NON_PLUGIN_MAP_OBJ) + smtputf8.o attr_override.o mail_parm_split.o $(NON_PLUGIN_MAP_OBJ) # MAP_OBJ is for maps that may be dynamically loaded with dynamicmaps.cf. # When hard-linking these maps, makedefs sets NON_PLUGIN_MAP_OBJ=$(MAP_OBJ), # otherwise it sets the PLUGIN_* macros. @@ -101,7 +101,7 @@ HDRS = abounce.h anvil_clnt.h been_here.h bounce.h bounce_log.h \ addr_match_list.h smtp_reply_footer.h safe_ultostr.h \ verify_sender_addr.h dict_memcache.h memcache_proto.h server_acl.h \ haproxy_srvr.h dsn_filter.h dynamicmaps.h uxtext.h smtputf8.h \ - attr_override.h + attr_override.h mail_parm_split.h TESTSRC = rec2stream.c stream2rec.c recdump.c DEFS = -I. -I$(INC_DIR) -D$(SYSTYPE) CFLAGS = $(DEBUG) $(OPT) $(DEFS) @@ -115,7 +115,7 @@ TESTPROG= domain_list dot_lockfile mail_addr_crunch mail_addr_find \ verify_clnt xtext anvil_clnt scache ehlo_mask \ valid_mailhost_addr own_inet_addr header_body_checks \ data_redirect addr_match_list safe_ultostr verify_sender_addr \ - mail_version mail_dict server_acl uxtext + mail_version mail_dict server_acl uxtext mail_parm_split LIBS = ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX) LIB_DIR = ../../lib @@ -365,11 +365,14 @@ mail_dict: mail_dict.c $(LIB) $(LIBS) server_acl: server_acl.c $(LIB) $(LIBS) $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(LIBS) $(SYSLIBS) +mail_parm_split: mail_parm_split.c $(LIB) $(LIBS) + $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(LIBS) $(SYSLIBS) + tests: tok822_test mime_tests strip_addr_test tok822_limit_test \ xtext_test scache_multi_test ehlo_mask_test \ namadr_list_test mail_conf_time_test header_body_checks_tests \ mail_version_test server_acl_test resolve_local_test maps_test \ - safe_ultostr_test + safe_ultostr_test mail_parm_split_test mime_tests: mime_test mime_nest mime_8bit mime_dom mime_trunc mime_cvt \ mime_cvt2 mime_cvt3 mime_garb1 mime_garb2 mime_garb3 mime_garb4 @@ -629,6 +632,11 @@ header_body_checks_replace_test: header_body_checks header_body_checks_replace.r cmp header_body_checks_replace.ref header_body_checks_replace.tmp rm -f header_body_checks_replace.tmp header_body_checks_head header_body_checks_mime header_body_checks_nest header_body_checks_body +mail_parm_split_test: mail_parm_split mail_parm_split.in mail_parm_split.ref + $(SHLIB_ENV) ./mail_parm_split mail_parm_split.tmp 2>&1 + diff mail_parm_split.ref mail_parm_split.tmp + rm -f mail_parm_split.tmp + printfck: $(OBJS) $(PROG) rm -rf printfck mkdir printfck @@ -996,8 +1004,26 @@ dict_memcache.o: dict_memcache.c dict_memcache.o: dict_memcache.h dict_memcache.o: memcache_proto.h dict_memcache.o: string_list.h +dict_mysql.o: ../../include/argv.h +dict_mysql.o: ../../include/dict.h +dict_mysql.o: ../../include/events.h +dict_mysql.o: ../../include/find_inet.h +dict_mysql.o: ../../include/match_list.h +dict_mysql.o: ../../include/msg.h +dict_mysql.o: ../../include/myflock.h +dict_mysql.o: ../../include/mymalloc.h +dict_mysql.o: ../../include/myrand.h +dict_mysql.o: ../../include/split_at.h +dict_mysql.o: ../../include/stringops.h dict_mysql.o: ../../include/sys_defs.h +dict_mysql.o: ../../include/vbuf.h +dict_mysql.o: ../../include/vstream.h +dict_mysql.o: ../../include/vstring.h +dict_mysql.o: cfg_parser.h +dict_mysql.o: db_common.h dict_mysql.o: dict_mysql.c +dict_mysql.o: dict_mysql.h +dict_mysql.o: string_list.h dict_pgsql.o: ../../include/argv.h dict_pgsql.o: ../../include/dict.h dict_pgsql.o: ../../include/events.h @@ -1559,6 +1585,16 @@ mail_params.o: mynetworks.h mail_params.o: own_inet_addr.h mail_params.o: recipient_list.h mail_params.o: verp_sender.h +mail_parm_split.o: ../../include/argv.h +mail_parm_split.o: ../../include/msg.h +mail_parm_split.o: ../../include/mymalloc.h +mail_parm_split.o: ../../include/stringops.h +mail_parm_split.o: ../../include/sys_defs.h +mail_parm_split.o: ../../include/vbuf.h +mail_parm_split.o: ../../include/vstring.h +mail_parm_split.o: mail_params.h +mail_parm_split.o: mail_parm_split.c +mail_parm_split.o: mail_parm_split.h mail_pathname.o: ../../include/attr.h mail_pathname.o: ../../include/iostuff.h mail_pathname.o: ../../include/stringops.h @@ -1612,6 +1648,7 @@ mail_stream.o: ../../include/vstring.h mail_stream.o: ../../include/warn_stat.h mail_stream.o: cleanup_user.h mail_stream.o: mail_params.h +mail_stream.o: mail_parm_split.h mail_stream.o: mail_proto.h mail_stream.o: mail_queue.h mail_stream.o: mail_stream.c diff --git a/postfix/src/global/attr_override.c b/postfix/src/global/attr_override.c index 57f0aa111..8976d2c03 100644 --- a/postfix/src/global/attr_override.c +++ b/postfix/src/global/attr_override.c @@ -102,7 +102,7 @@ void attr_override(char *cp, const char *sep, const char *parens,...) * Get the lookup tables and assignment targets. */ va_start(ap, parens); - while ((idx = va_arg(ap, int)) != 0) { + while ((idx = va_arg(ap, int)) != ATTR_OVER_END) { switch (idx) { case ATTR_OVER_INT_TABLE: if (int_table) @@ -146,7 +146,7 @@ void attr_override(char *cp, const char *sep, const char *parens,...) */ /* { name = value } */ if (*nameval == parens[0] - && (err = extpar(&nameval, parens, EXPAR_FLAG_NONE)) != 0) + && (err = extpar(&nameval, parens, EXTPAR_FLAG_NONE)) != 0) msg_fatal("%s in \"%s\"", err, nameval); if ((err = split_nameval(nameval, &key, &value)) != 0) msg_fatal("malformed option: %s: \"...%s...\"", err, nameval); diff --git a/postfix/src/global/mail_params.c b/postfix/src/global/mail_params.c index 318fbe2cd..36a268321 100644 --- a/postfix/src/global/mail_params.c +++ b/postfix/src/global/mail_params.c @@ -567,9 +567,14 @@ static void check_legacy_defaults(void) * when the compatibility level changed for the first time, from 0 to 1. */ if (var_compat_level < 1) { - /* Should inet_protocols also be listed here? */ if (mail_conf_lookup(VAR_APP_DOT_MYDOMAIN) == 0) warn_compat_break_app_dot_mydomain = 1; + + /* + * Not: #ifndef NO_EAI. They must configure SMTPUTF8_ENABLE=no if a + * warning message is logged, so that they don't suddenly start to + * lose mail after Postfix is built with EAI support. + */ if (mail_conf_lookup(VAR_SMTPUTF8_ENABLE) == 0) warn_compat_break_smtputf8_enable = 1; warn_compat_break_chroot = 1; diff --git a/postfix/src/global/mail_parm_split.c b/postfix/src/global/mail_parm_split.c new file mode 100644 index 000000000..0b206d059 --- /dev/null +++ b/postfix/src/global/mail_parm_split.c @@ -0,0 +1,123 @@ +/*++ +/* NAME +/* mail_parm_split 3 +/* SUMMARY +/* split parameter list value +/* SYNOPSIS +/* #include +/* +/* ARGV *mail_parm_split( +/* cost char *name, +/* const char *value) +/* DESCRIPTION +/* mail_parm_split() splits a parameter list value into its +/* elements, and extracts text from inside {}. It uses +/* CHARS_COMMA_SP as list element delimiters, and CHARS_BRACE +/* for grouping. +/* +/* Arguments: +/* .IP name +/* Parameter name. This is used to privode context for +/* error messages. +/* .IP value +/* Parameter value. +/* DIAGNOSTICS +/* fatal: syntax error while extracting text from {}. +/* SEE ALSO +/* argv_splitq(3), string array utilities +/* extpar(3), extract text from parentheses +/* LICENSE +/* .ad +/* .fi +/* The Secure Mailer license must be distributed with this software. +/* AUTHOR(S) +/* Wietse Venema +/* IBM T.J. Watson Research +/* P.O. Box 704 +/* Yorktown Heights, NY 10598, USA +/*--*/ + + /* + * System library. + */ +#include + + /* + * Utility library. + */ +#include +#include +#include + + /* + * Global library. + */ +#include +#include + + /* + * While testing, do not terminate the program after a syntax error. + */ +#ifdef TEST +#undef msg_fatal +#define msg_fatal msg_warn +#endif + +/* mail_parm_split - split list, extract {text}, errors are fatal */ + +ARGV *mail_parm_split(const char *name, const char *value) +{ + ARGV *argvp = argv_alloc(1); + char *saved_string = mystrdup(value); + char *bp = saved_string; + char *arg; + const char *err; + + /* + * The code that detects the error shall either signal or handle the + * error. In this case, mystrtokq() detects no error, extpar() signals + * the error to its caller, and this function handles the error. + */ + while ((arg = mystrtokq(&bp, CHARS_COMMA_SP, CHARS_BRACE)) != 0) { + if (*arg == CHARS_BRACE[0] + && (err = extpar(&arg, CHARS_BRACE, EXTPAR_FLAG_STRIP)) != 0) + msg_fatal("%s: %s", name, err); + argv_add(argvp, arg, (char *) 0); + } + argv_terminate(argvp); + myfree(saved_string); + return (argvp); +} + +#ifdef TEST + + /* + * This function is security-critical so it better have a unit-test driver. + */ +#include +#include +#include +#include + +int main(void) +{ + VSTRING *vp = vstring_alloc(100); + ARGV *argv; + char *start; + char *str; + char **cpp; + + while (vstring_fgets_nonl(vp, VSTREAM_IN) && VSTRING_LEN(vp) > 0) { + start = vstring_str(vp); + vstream_printf("Input:\t>%s<\n", start); + vstream_fflush(VSTREAM_OUT); + argv = mail_parm_split("stdin", start); + for (cpp = argv->argv; (str = *cpp) != 0; cpp++) + vstream_printf("Output:\t>%s<\n", str); + argv_free(argv); + vstream_fflush(VSTREAM_OUT); + } + return (0); +} + +#endif diff --git a/postfix/src/global/mail_parm_split.h b/postfix/src/global/mail_parm_split.h new file mode 100644 index 000000000..cc278d8e8 --- /dev/null +++ b/postfix/src/global/mail_parm_split.h @@ -0,0 +1,42 @@ +#ifndef _MAIL_PARM_SPLIT_H_INCLUDED_ +#define _MAIL_PARM_SPLIT_H_INCLUDED_ + +/*++ +/* NAME +/* mail_parm_split 3h +/* SUMMARY +/* split parameter list value +/* SYNOPSIS +/* #include +/* DESCRIPTION +/* .nf + +#endif + + /* + * Utility library. + */ +#include + + /* + * External interface. For consistency, the separator and grouping character + * sets are not passed as parameters. + */ +extern ARGV *mail_parm_split(const char *, const char *); + +#define MAIL_PARM_FLAG_NONE 0 +#define MAIL_PARM_FLAG_EXTRACT (1<<0) +#define MAIL_PARM_FLAG_ALL (1<<0) + +/* LICENSE +/* .ad +/* .fi +/* The Secure Mailer license must be distributed with this software. +/* AUTHOR(S) +/* Wietse Venema +/* IBM T.J. Watson Research +/* P.O. Box 704 +/* Yorktown Heights, NY 10598, USA +/*--*/ + +#endif diff --git a/postfix/src/global/mail_parm_split.in b/postfix/src/global/mail_parm_split.in new file mode 100644 index 000000000..22e0d2b46 --- /dev/null +++ b/postfix/src/global/mail_parm_split.in @@ -0,0 +1,6 @@ +TZ PATH=/bin:/usr/bin XAUTHORITY +TZ { LESS=-m -C -s -f -e } XAUTHORITY +{ LESS=-m -C -s -f -e } TZ XAUTHORITY +TZ XAUTHORITY { LESS=-m -C -s -f -e } +TZ { LESS=-m -C -s -f -e XAUTHORITY +TZ { LESS=-m -C -s -f -e }x XAUTHORITY diff --git a/postfix/src/global/mail_parm_split.ref b/postfix/src/global/mail_parm_split.ref new file mode 100644 index 000000000..e85adeb96 --- /dev/null +++ b/postfix/src/global/mail_parm_split.ref @@ -0,0 +1,25 @@ +Input: >TZ PATH=/bin:/usr/bin XAUTHORITY< +Output: >TZ< +Output: >PATH=/bin:/usr/bin< +Output: >XAUTHORITY< +Input: >TZ { LESS=-m -C -s -f -e } XAUTHORITY< +Output: >TZ< +Output: >LESS=-m -C -s -f -e< +Output: >XAUTHORITY< +Input: >{ LESS=-m -C -s -f -e } TZ XAUTHORITY< +Output: >LESS=-m -C -s -f -e< +Output: >TZ< +Output: >XAUTHORITY< +Input: >TZ XAUTHORITY { LESS=-m -C -s -f -e }< +Output: >TZ< +Output: >XAUTHORITY< +Output: >LESS=-m -C -s -f -e< +Input: >TZ { LESS=-m -C -s -f -e XAUTHORITY< +unknown: warning: stdin: missing '}' in "{ LESS=-m -C -s -f -e XAUTHORITY" +Output: >TZ< +Output: >LESS=-m -C -s -f -e XAUTHORITY< +Input: >TZ { LESS=-m -C -s -f -e }x XAUTHORITY< +unknown: warning: stdin: syntax error after '}' in "{ LESS=-m -C -s -f -e }x" +Output: >TZ< +Output: >LESS=-m -C -s -f -e< +Output: >XAUTHORITY< diff --git a/postfix/src/global/mail_stream.c b/postfix/src/global/mail_stream.c index 401262a58..40a644f47 100644 --- a/postfix/src/global/mail_stream.c +++ b/postfix/src/global/mail_stream.c @@ -136,6 +136,7 @@ #include #include #include +#include /* Application-specific. */ @@ -478,7 +479,7 @@ MAIL_STREAM *mail_stream_command(const char *command) * talking a Postfix-internal protocol there is no way we can tell what * is being executed except by duplicating a lot of existing code. */ - export_env = argv_split(var_export_environ, ", \t\r\n"); + export_env = mail_parm_split(VAR_EXPORT_ENVIRON, var_export_environ); while ((stream = vstream_popen(O_RDWR, VSTREAM_POPEN_COMMAND, command, VSTREAM_POPEN_EXPORT, export_env->argv, diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 66d55e7fc..6ac508a4b 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 "20141002" +#define MAIL_RELEASE_DATE "20141005" #define MAIL_VERSION_NUMBER "2.12" #ifdef SNAPSHOT diff --git a/postfix/src/local/Makefile.in b/postfix/src/local/Makefile.in index 552b00efc..041513f05 100644 --- a/postfix/src/local/Makefile.in +++ b/postfix/src/local/Makefile.in @@ -154,6 +154,7 @@ command.o: ../../include/htable.h command.o: ../../include/mac_parse.h command.o: ../../include/mail_copy.h command.o: ../../include/mail_params.h +command.o: ../../include/mail_parm_split.h command.o: ../../include/maps.h command.o: ../../include/mbox_conf.h command.o: ../../include/msg.h @@ -163,6 +164,7 @@ command.o: ../../include/pipe_command.h command.o: ../../include/recipient_list.h command.o: ../../include/resolve_clnt.h command.o: ../../include/sent.h +command.o: ../../include/stringops.h command.o: ../../include/sys_defs.h command.o: ../../include/tok822.h command.o: ../../include/vbuf.h diff --git a/postfix/src/local/command.c b/postfix/src/local/command.c index b27556799..04fcc0d43 100644 --- a/postfix/src/local/command.c +++ b/postfix/src/local/command.c @@ -74,6 +74,7 @@ #include #include #include +#include /* Application-specific. */ @@ -193,7 +194,7 @@ int deliver_command(LOCAL_STATE state, USER_ATTR usr_attr, const char *comma * Evaluate the command execution directory. Defer delivery if expansion * fails. */ - export_env = argv_split(var_export_environ, ", \t\r\n"); + export_env = mail_parm_split(VAR_EXPORT_ENVIRON, var_export_environ); exec_dir = vstring_alloc(10); expand_status = local_expand(exec_dir, var_exec_directory, &state, &usr_attr, var_exec_exp_filter); diff --git a/postfix/src/master/Makefile.in b/postfix/src/master/Makefile.in index 32e969d6b..dff0db248 100644 --- a/postfix/src/master/Makefile.in +++ b/postfix/src/master/Makefile.in @@ -142,6 +142,7 @@ master.o: ../../include/inet_proto.h master.o: ../../include/iostuff.h master.o: ../../include/mail_conf.h master.o: ../../include/mail_params.h +master.o: ../../include/mail_parm_split.h master.o: ../../include/mail_task.h master.o: ../../include/mail_version.h master.o: ../../include/msg.h diff --git a/postfix/src/master/master.c b/postfix/src/master/master.c index a9d5d1b2f..488e8ed4c 100644 --- a/postfix/src/master/master.c +++ b/postfix/src/master/master.c @@ -212,6 +212,7 @@ #include #include #include +#include /* Application-specific. */ @@ -428,7 +429,7 @@ int main(int argc, char **argv) * Environment import filter, to enforce consistent behavior whether * Postfix is started by hand, or at system boot time. */ - import_env = argv_split(var_import_environ, ", \t\r\n"); + import_env = mail_parm_split(VAR_IMPORT_ENVIRON, var_import_environ); clean_env(import_env->argv); argv_free(import_env); diff --git a/postfix/src/master/master_ent.c b/postfix/src/master/master_ent.c index 25fa26823..5671e5e28 100644 --- a/postfix/src/master/master_ent.c +++ b/postfix/src/master/master_ent.c @@ -557,7 +557,7 @@ MASTER_SERV *get_master_ent() vstring_str(vstring_sprintf(junk, "%d", serv->listen_fd_count)), (char *) 0); while ((cp = mystrtokq(&bufp, master_blanks, "{}")) != 0) { - if (*cp == '{' && (err = extpar(&cp, "{}", EXPAR_FLAG_STRIP)) != 0) + if (*cp == '{' && (err = extpar(&cp, "{}", EXTPAR_FLAG_STRIP)) != 0) msg_fatal("%s: line %d: %s", VSTREAM_PATH(master_fp), master_line, err); argv_add(serv->args, cp, (char *) 0); diff --git a/postfix/src/milter/milter.c b/postfix/src/milter/milter.c index addd436df..87dad812a 100644 --- a/postfix/src/milter/milter.c +++ b/postfix/src/milter/milter.c @@ -614,7 +614,7 @@ MILTERS *milter_new(const char *names, my_def_action = def_action; if (name[0] == '{') { /* } */ op = name; - if ((err = extpar(&op, parens, EXPAR_FLAG_NONE)) != 0) + if ((err = extpar(&op, parens, EXTPAR_FLAG_NONE)) != 0) msg_fatal("milter service syntax error: %s", err); if ((name = mystrtok(&op, sep)) == 0) msg_fatal("empty milter definition: \"%s\"", names); diff --git a/postfix/src/pipe/Makefile.in b/postfix/src/pipe/Makefile.in index 9763faa49..4818d7644 100644 --- a/postfix/src/pipe/Makefile.in +++ b/postfix/src/pipe/Makefile.in @@ -80,6 +80,7 @@ pipe.o: ../../include/mail_addr.h pipe.o: ../../include/mail_conf.h pipe.o: ../../include/mail_copy.h pipe.o: ../../include/mail_params.h +pipe.o: ../../include/mail_parm_split.h pipe.o: ../../include/mail_server.h pipe.o: ../../include/mail_version.h pipe.o: ../../include/msg.h diff --git a/postfix/src/pipe/pipe.c b/postfix/src/pipe/pipe.c index 8baa662ed..0bd460650 100644 --- a/postfix/src/pipe/pipe.c +++ b/postfix/src/pipe/pipe.c @@ -190,7 +190,7 @@ /* shell meta characters by a shell command interpreter. /* .sp /* Specify "{" and "}" around command arguments that contain -/* whitespace (Postfix 2.12 and later). Whitespace immediately +/* whitespace (Postfix 2.12 and later). Whitespace /* after "{" and before "}" is ignored. /* .sp /* In the command argument vector, the following macros are recognized @@ -490,6 +490,7 @@ #include #include #include +#include /* Single server skeleton. */ @@ -1266,7 +1267,7 @@ static int deliver_message(DELIVER_REQUEST *request, char *service, char **argv) DELIVER_MSG_CLEANUP(); return (deliver_status); } - export_env = argv_split(var_export_environ, ", \t\r\n"); + export_env = mail_parm_split(VAR_EXPORT_ENVIRON, var_export_environ); command_status = pipe_command(request->fp, why, PIPE_CMD_UID, attr.uid, diff --git a/postfix/src/postconf/postconf_dbms.c b/postfix/src/postconf/postconf_dbms.c index 2f747912f..97405194e 100644 --- a/postfix/src/postconf/postconf_dbms.c +++ b/postfix/src/postconf/postconf_dbms.c @@ -181,7 +181,7 @@ static void pcf_register_dbms_helper(char *str_value, */ if (prefix != 0 && *prefix != '/' && *prefix != '.') { if (*prefix == '{') { /* } */ - if ((err = extpar(&prefix, "{}", EXPAR_FLAG_NONE)) != 0) { + if ((err = extpar(&prefix, "{}", EXTPAR_FLAG_NONE)) != 0) { /* XXX Encapsulate this in pcf_warn() function. */ if (local_scope) msg_warn("%s:%s: %s", diff --git a/postfix/src/postconf/postconf_master.c b/postfix/src/postconf/postconf_master.c index ac4feed44..481c35730 100644 --- a/postfix/src/postconf/postconf_master.c +++ b/postfix/src/postconf/postconf_master.c @@ -199,7 +199,7 @@ static void pcf_extract_field(ARGV *argv, int field, const char *parens) char *arg = argv->argv[field]; char *err; - if ((err = extpar(&arg, parens, EXPAR_FLAG_STRIP)) != 0) { + if ((err = extpar(&arg, parens, EXTPAR_FLAG_STRIP)) != 0) { msg_warn("%s: %s", MASTER_CONF_FILE, err); myfree(err); } diff --git a/postfix/src/postdrop/Makefile.in b/postfix/src/postdrop/Makefile.in index 955994335..4f99efb5f 100644 --- a/postfix/src/postdrop/Makefile.in +++ b/postfix/src/postdrop/Makefile.in @@ -66,6 +66,7 @@ postdrop.o: ../../include/iostuff.h postdrop.o: ../../include/mail_conf.h postdrop.o: ../../include/mail_dict.h postdrop.o: ../../include/mail_params.h +postdrop.o: ../../include/mail_parm_split.h postdrop.o: ../../include/mail_proto.h postdrop.o: ../../include/mail_queue.h postdrop.o: ../../include/mail_stream.h diff --git a/postfix/src/postdrop/postdrop.c b/postfix/src/postdrop/postdrop.c index 24a0f117d..437e8b3a4 100644 --- a/postfix/src/postdrop/postdrop.c +++ b/postfix/src/postdrop/postdrop.c @@ -138,6 +138,7 @@ #include #include #include +#include /* Application-specific. */ @@ -329,7 +330,7 @@ int main(int argc, char **argv) * This program is installed with setgid privileges. Strip the process * environment so that we don't have to trust the C library. */ - import_env = argv_split(var_import_environ, ", \t\r\n"); + import_env = mail_parm_split(VAR_IMPORT_ENVIRON, var_import_environ); clean_env(import_env->argv); argv_free(import_env); diff --git a/postfix/src/postfix/Makefile.in b/postfix/src/postfix/Makefile.in index 4b72df12f..2b4281d35 100644 --- a/postfix/src/postfix/Makefile.in +++ b/postfix/src/postfix/Makefile.in @@ -66,6 +66,7 @@ postfix.o: ../../include/argv.h postfix.o: ../../include/clean_env.h postfix.o: ../../include/mail_conf.h postfix.o: ../../include/mail_params.h +postfix.o: ../../include/mail_parm_split.h postfix.o: ../../include/mail_version.h postfix.o: ../../include/msg.h postfix.o: ../../include/msg_syslog.h diff --git a/postfix/src/postfix/postfix.c b/postfix/src/postfix/postfix.c index c9c0e435b..b36a07fe9 100644 --- a/postfix/src/postfix/postfix.c +++ b/postfix/src/postfix/postfix.c @@ -372,6 +372,7 @@ #include #include #include +#include /* Additional installation parameters. */ @@ -515,7 +516,7 @@ int main(int argc, char **argv) * because some shell scripts use environment settings to override * main.cf settings. */ - import_env = argv_split(var_import_environ, ", \t\r\n"); + import_env = mail_parm_split(VAR_IMPORT_ENVIRON, var_import_environ); clean_env(import_env->argv); argv_free(import_env); diff --git a/postfix/src/postmulti/Makefile.in b/postfix/src/postmulti/Makefile.in index b37583ef8..059fcfea5 100644 --- a/postfix/src/postmulti/Makefile.in +++ b/postfix/src/postmulti/Makefile.in @@ -67,6 +67,7 @@ postmulti.o: ../../include/clean_env.h postmulti.o: ../../include/htable.h postmulti.o: ../../include/mail_conf.h postmulti.o: ../../include/mail_params.h +postmulti.o: ../../include/mail_parm_split.h postmulti.o: ../../include/mail_version.h postmulti.o: ../../include/msg.h postmulti.o: ../../include/msg_syslog.h diff --git a/postfix/src/postmulti/postmulti.c b/postfix/src/postmulti/postmulti.c index 1dd13997b..3c24d33c0 100644 --- a/postfix/src/postmulti/postmulti.c +++ b/postfix/src/postmulti/postmulti.c @@ -436,6 +436,7 @@ #include #include #include +#include /* Application-specific. */ @@ -1207,7 +1208,7 @@ static void export_helper_environment(INSTANCE *target, int export_flags) * because some shell scripts use environment settings to override * main.cf settings. */ - import_env = argv_split(var_import_environ, ", \t\r\n"); + import_env = mail_parm_split(VAR_IMPORT_ENVIRON, var_import_environ); clean_env(import_env->argv); argv_free(import_env); diff --git a/postfix/src/postqueue/Makefile.in b/postfix/src/postqueue/Makefile.in index 6ba697223..4c4c3d4d5 100644 --- a/postfix/src/postqueue/Makefile.in +++ b/postfix/src/postqueue/Makefile.in @@ -69,6 +69,7 @@ postqueue.o: ../../include/mail_conf.h postqueue.o: ../../include/mail_dict.h postqueue.o: ../../include/mail_flush.h postqueue.o: ../../include/mail_params.h +postqueue.o: ../../include/mail_parm_split.h postqueue.o: ../../include/mail_proto.h postqueue.o: ../../include/mail_queue.h postqueue.o: ../../include/mail_run.h @@ -80,6 +81,7 @@ postqueue.o: ../../include/msg_vstream.h postqueue.o: ../../include/mymalloc.h postqueue.o: ../../include/safe.h postqueue.o: ../../include/smtp_stream.h +postqueue.o: ../../include/stringops.h postqueue.o: ../../include/sys_defs.h postqueue.o: ../../include/user_acl.h postqueue.o: ../../include/valid_hostname.h diff --git a/postfix/src/postqueue/postqueue.c b/postfix/src/postqueue/postqueue.c index 15308367e..c12b3ffda 100644 --- a/postfix/src/postqueue/postqueue.c +++ b/postfix/src/postqueue/postqueue.c @@ -204,6 +204,7 @@ #include #include #include +#include /* Application-specific. */ @@ -547,7 +548,7 @@ int main(int argc, char **argv) * directory info when the mail system is down. */ if (geteuid() != 0) { - import_env = argv_split(var_import_environ, ", \t\r\n"); + import_env = mail_parm_split(VAR_IMPORT_ENVIRON, var_import_environ); clean_env(import_env->argv); argv_free(import_env); } diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 38b67a7c1..2e48c4fa1 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -2491,10 +2491,16 @@ static int mail_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) "send unicode address"); return (-1); } + + /* + * Not: #ifndef NO_EAI. They must configure SMTPUTF8_ENABLE=no if a + * warning message is logged, so that they don't suddenly start to + * lose mail after Postfix is built with EAI support. + */ if (warn_compat_break_smtputf8_enable) - msg_info("using backwards-compatible default setting " + msg_info("using backwards-compatible default setting " VAR_SMTPUTF8_ENABLE "=no to accept non-ASCII sender " - "address \"%s\" from %s (" VAR_COMPAT_LEVEL "<1)", + "address \"%s\" from %s (" VAR_COMPAT_LEVEL "<1)", STR(state->addr_buf), state->namaddr); } @@ -2749,10 +2755,16 @@ static int rcpt_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) "send unicode address"); return (-1); } + + /* + * Not: #ifndef NO_EAI. They must configure SMTPUTF8_ENABLE=no if a + * warning message is logged, so that they don't suddenly start to + * lose mail after Postfix is built with EAI support. + */ if (warn_compat_break_smtputf8_enable) - msg_info("using backwards-compatible default setting " + msg_info("using backwards-compatible default setting " VAR_SMTPUTF8_ENABLE "=no to accept non-ASCII recipient " - "address \"%s\" from %s (" VAR_COMPAT_LEVEL "<1)", + "address \"%s\" from %s (" VAR_COMPAT_LEVEL "<1)", STR(state->addr_buf), state->namaddr); } if (SMTPD_STAND_ALONE(state) == 0) { diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index 94a06e0a1..15784e737 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -538,7 +538,7 @@ static void policy_client_register(const char *name) if (*name == '{') { /* } */ cp = saved_name = mystrdup(name); - if ((err = extpar(&cp, parens, EXPAR_FLAG_NONE)) != 0) + if ((err = extpar(&cp, parens, EXTPAR_FLAG_NONE)) != 0) msg_fatal("policy service syntax error: %s", cp); if ((policy_name = mystrtok(&cp, sep)) == 0) msg_fatal("empty policy service: \"%s\"", name); diff --git a/postfix/src/spawn/Makefile.in b/postfix/src/spawn/Makefile.in index b48005563..6636fac59 100644 --- a/postfix/src/spawn/Makefile.in +++ b/postfix/src/spawn/Makefile.in @@ -63,6 +63,7 @@ spawn.o: ../../include/argv.h spawn.o: ../../include/dict.h spawn.o: ../../include/mail_conf.h spawn.o: ../../include/mail_params.h +spawn.o: ../../include/mail_parm_split.h spawn.o: ../../include/mail_server.h spawn.o: ../../include/mail_version.h spawn.o: ../../include/msg.h @@ -71,6 +72,7 @@ spawn.o: ../../include/mymalloc.h spawn.o: ../../include/set_eugid.h spawn.o: ../../include/spawn_command.h spawn.o: ../../include/split_at.h +spawn.o: ../../include/stringops.h spawn.o: ../../include/sys_defs.h spawn.o: ../../include/timed_wait.h spawn.o: ../../include/vbuf.h diff --git a/postfix/src/spawn/spawn.c b/postfix/src/spawn/spawn.c index 37fdcac74..c44ebcdfc 100644 --- a/postfix/src/spawn/spawn.c +++ b/postfix/src/spawn/spawn.c @@ -157,6 +157,7 @@ #include #include #include +#include /* Application-specific. */ @@ -296,7 +297,7 @@ static void spawn_service(VSTREAM *client_stream, char *service, char **argv) /* * Execute the command. */ - export_env = argv_split(var_export_environ, ", \t\r\n"); + export_env = mail_parm_split(VAR_EXPORT_ENVIRON, var_export_environ); status = spawn_command(SPAWN_CMD_STDIN, vstream_fileno(client_stream), SPAWN_CMD_STDOUT, vstream_fileno(client_stream), SPAWN_CMD_STDERR, vstream_fileno(client_stream), diff --git a/postfix/src/util/Makefile.in b/postfix/src/util/Makefile.in index 9d85f46dc..a77c94603 100644 --- a/postfix/src/util/Makefile.in +++ b/postfix/src/util/Makefile.in @@ -574,31 +574,31 @@ attr_scan0_test: attr_print0 attr_scan0 attr_scan0.ref dict_test: dict_open testdb dict_test.in dict_test.ref rm -f testdb.db testdb.dir testdb.pag $(SHLIB_ENV) ../postmap/postmap -N hash:testdb - $(SHLIB_ENV) ./dict_open hash:testdb write < dict_test.in > dict_test.tmp 2>&1 + $(SHLIB_ENV) ./dict_open hash:testdb write < dict_test.in 2>&1 | sed 's/uid=[0-9][0-9][0-9]*/uid=USER/' >dict_test.tmp diff dict_test.ref dict_test.tmp $(SHLIB_ENV) ../postmap/postmap -n hash:testdb - $(SHLIB_ENV) ./dict_open hash:testdb write < dict_test.in > dict_test.tmp 2>&1 + $(SHLIB_ENV) ./dict_open hash:testdb write < dict_test.in 2>&1 | sed 's/uid=[0-9][0-9][0-9]*/uid=USER/' >dict_test.tmp diff dict_test.ref dict_test.tmp rm -f testdb.db testdb.dir testdb.pag dict_test.tmp dict_pcre_test: dict_open dict_pcre.in dict_pcre.map dict_pcre.ref - $(SHLIB_ENV) ./dict_open pcre:dict_pcre.map read dict_pcre.tmp 2>&1 + $(SHLIB_ENV) ./dict_open pcre:dict_pcre.map read &1 | sed 's/uid=[0-9][0-9][0-9]*/uid=USER/' >dict_pcre.tmp diff dict_pcre.ref dict_pcre.tmp rm -f dict_pcre.tmp dict_regexp_test: dict_open dict_regexp.in dict_regexp.map dict_regexp.ref - $(SHLIB_ENV) ./dict_open regexp:dict_regexp.map read dict_regexp.tmp 2>&1 + $(SHLIB_ENV) ./dict_open regexp:dict_regexp.map read dict_regexp.tmp diff dict_regexp.ref dict_regexp.tmp rm -f dict_regexp.tmp dict_cidr_test: dict_open dict_cidr.in dict_cidr.map dict_cidr.ref - $(SHLIB_ENV) ./dict_open cidr:dict_cidr.map read dict_cidr.tmp 2>&1 + $(SHLIB_ENV) ./dict_open cidr:dict_cidr.map read &1 | sed 's/uid=[0-9][0-9][0-9]*/uid=USER/' >dict_cidr.tmp diff dict_cidr.ref dict_cidr.tmp rm -f dict_cidr.tmp dict_seq_test: dict_open testdb dict_seq.in dict_seq.ref rm -f testdb.db testdb.dir testdb.pag - $(SHLIB_ENV) ./dict_open hash:testdb create sync < dict_seq.in > dict_seq.tmp 2>&1 + $(SHLIB_ENV) ./dict_open hash:testdb create sync < dict_seq.in 2>&1 | sed 's/uid=[0-9][0-9][0-9]*/uid=USER/' > dict_seq.tmp diff dict_seq.ref dict_seq.tmp rm -f testdb.db testdb.dir testdb.pag dict_seq.tmp @@ -1368,6 +1368,7 @@ exec_command.o: exec_command.h exec_command.o: msg.h exec_command.o: sys_defs.h extpar.o: extpar.c +extpar.o: msg.h extpar.o: stringops.h extpar.o: sys_defs.h extpar.o: vbuf.h @@ -1560,8 +1561,6 @@ load_file.o: vbuf.h load_file.o: vstream.h load_file.o: warn_stat.h load_lib.o: load_lib.c -load_lib.o: load_lib.h -load_lib.o: msg.h load_lib.o: sys_defs.h lowercase.o: lowercase.c lowercase.o: stringops.h diff --git a/postfix/src/util/dict_cidr.ref b/postfix/src/util/dict_cidr.ref index 0597441df..4a1853928 100644 --- a/postfix/src/util/dict_cidr.ref +++ b/postfix/src/util/dict_cidr.ref @@ -8,6 +8,7 @@ ./dict_open: warning: cidr map dict_cidr.map, line 16: missing ']' character after "[1234": skipping this rule ./dict_open: warning: cidr map dict_cidr.map, line 17: garbage after "[1234]": skipping this rule ./dict_open: warning: cidr map dict_cidr.map, line 18: bad net/mask pattern: "172.16.1.3/3x": skipping this rule +owner=untrusted (uid=USER) > get 172.16.0.0 172.16.0.0=554 match bad netblock 172.16.0.0/21 > get 172.16.0.1 diff --git a/postfix/src/util/dict_pcre.ref b/postfix/src/util/dict_pcre.ref index 1dc5393b1..29e9dfb5f 100644 --- a/postfix/src/util/dict_pcre.ref +++ b/postfix/src/util/dict_pcre.ref @@ -6,6 +6,7 @@ ./dict_open: warning: pcre map dict_pcre.map, line 10: out of range replacement index "5": skipping this rule ./dict_open: warning: pcre map dict_pcre.map, line 17: $number found in negative match replacement text: skipping this rule ./dict_open: warning: pcre map dict_pcre.map, line 22: no regexp: skipping this rule +owner=untrusted (uid=USER) > get true true: not found > get true1 diff --git a/postfix/src/util/dict_test.ref b/postfix/src/util/dict_test.ref index 1cda83600..0872fb09a 100644 --- a/postfix/src/util/dict_test.ref +++ b/postfix/src/util/dict_test.ref @@ -1,3 +1,4 @@ +owner=untrusted (uid=USER) > del bar bar: deleted > get bar diff --git a/postfix/src/util/extpar.c b/postfix/src/util/extpar.c index 148ef3e0c..24708f74b 100644 --- a/postfix/src/util/extpar.c +++ b/postfix/src/util/extpar.c @@ -22,9 +22,13 @@ /* .IP parens /* One matching pair of parentheses, opening parenthesis first. /* .IP flags -/* EXPAR_FLAG_NONE, or the bitwise OR of one or more flags: +/* EXTPAR_FLAG_NONE, or the bitwise OR of one or more flags: /* .RS -/* .IP EXPAR_FLAG_STRIP +/* .IP EXTPAR_FLAG_EXTRACT +/* This flag is intended to instruct expar() callers that +/* expar() should be invoked. It has no effect on expar() +/* itself. +/* .IP EXTPAR_FLAG_STRIP /* Skip whitespace after the opening parenthesis, and trim /* whitespace before the closing parenthesis. /* .RE @@ -38,8 +42,8 @@ /* be destroyed with myfree(). The following decribes the errors /* and the state of the buffer and buffer pointer. /* .IP "missing closing parenthesis" -/* The buffer pointer points to text as if the closing parenthesis -/* were present. +/* The buffer pointer points to text as if a closing parenthesis +/* were present at the end of the input. /* .IP "text after closing parenthesis" /* The buffer pointer points to text as if the offending text /* were not present. @@ -70,7 +74,7 @@ /* extpar - extract text from parentheses */ -char *extpar(char **bp, const char *parens, int strip) +char *extpar(char **bp, const char *parens, int flags) { char *cp = *bp; char *err = 0; @@ -89,7 +93,7 @@ char *extpar(char **bp, const char *parens, int strip) cp += 1; cp[len -= 2] = 0; } - if (strip) { + if (flags & EXTPAR_FLAG_STRIP) { trimblanks(cp, len)[0] = 0; while (ISSPACE(*cp)) cp++; diff --git a/postfix/src/util/mac_expand.c b/postfix/src/util/mac_expand.c index 0e4cd7cdf..16b7b6cbf 100644 --- a/postfix/src/util/mac_expand.c +++ b/postfix/src/util/mac_expand.c @@ -50,14 +50,15 @@ /* named attribute expansion and logical expression evaluation. /* Whitespace before or after {text1} or {text2} is ignored. /* .IP "${{text1} == ${text2} ? {text3} : {text4}}" -/* .IP "${{text1} != ${text2} ? {text3} : {text4}}" /* Logical expression-based substition. First, the content /* of {text1} and ${text2} is subjected to named attribute and /* logical expression-based substitution. Next, the logical /* expression is evaluated. If it evaluates to "true", the /* result is the content of {text3}, otherwise it is the content /* of {text4}, after named attribute and logical expression-based -/* substitution. +/* substitution. In addition to ==, this supports !=, <, <=, +/* >=, and >. Comparisons are numerical when both operands are +/* all digits, otherwise the comparisons are lexicographical. /* /* Arguments: /* .IP result @@ -170,7 +171,7 @@ typedef struct { #define MAC_EXP_BVAL_FALSE "" /* - * Relational operator. For now, we test only for (in)equality. + * Relational operators. */ #define MAC_EXP_OP_STR_EQ "==" #define MAC_EXP_OP_STR_NE "!=" diff --git a/postfix/src/util/stringops.h b/postfix/src/util/stringops.h index e583badb3..43b97fcb5 100644 --- a/postfix/src/util/stringops.h +++ b/postfix/src/util/stringops.h @@ -47,8 +47,16 @@ extern int valid_utf8_string(const char *, ssize_t); extern size_t balpar(const char *, const char *); extern char *extpar(char **, const char *, int); -#define EXPAR_FLAG_NONE (0) -#define EXPAR_FLAG_STRIP (1<<0) +#define EXTPAR_FLAG_NONE (0) +#define EXTPAR_FLAG_STRIP (1<<0) /* "{ text }" -> "text" */ +#define EXTPAR_FLAG_EXTRACT (1<<1) /* hint from caller's caller */ + + /* + * Character sets for parsing. + */ +#define CHARS_COMMA_SP ", \t\r\n" /* list separator */ +#define CHARS_SPACE " \t\r\n" /* word separator */ +#define CHARS_BRACE "{}" /* grouping */ /* LICENSE /* .ad diff --git a/postfix/src/util/surrogate.ref b/postfix/src/util/surrogate.ref index 2b8429b9b..6b2251305 100644 --- a/postfix/src/util/surrogate.ref +++ b/postfix/src/util/surrogate.ref @@ -1,44 +1,55 @@ ./dict_open: error: cidr:/xx map requires O_RDONLY access mode +owner=trusted (uid=-1) > get foo ./dict_open: warning: cidr:/xx is unavailable. cidr:/xx map requires O_RDONLY access mode foo: error ./dict_open: error: open /xx: No such file or directory +owner=trusted (uid=-1) > get foo ./dict_open: warning: cidr:/xx is unavailable. open /xx: No such file or directory foo: error ./dict_open: error: pcre:/xx map requires O_RDONLY access mode +owner=trusted (uid=-1) > get foo ./dict_open: warning: pcre:/xx is unavailable. pcre:/xx map requires O_RDONLY access mode foo: error ./dict_open: error: open /xx: No such file or directory +owner=trusted (uid=-1) > get foo ./dict_open: warning: pcre:/xx is unavailable. open /xx: No such file or directory foo: error ./dict_open: error: regexp:/xx map requires O_RDONLY access mode +owner=trusted (uid=-1) > get foo ./dict_open: warning: regexp:/xx is unavailable. regexp:/xx map requires O_RDONLY access mode foo: error ./dict_open: error: open /xx: No such file or directory +owner=trusted (uid=-1) > get foo ./dict_open: warning: regexp:/xx is unavailable. open /xx: No such file or directory foo: error ./dict_open: error: unix:xx map requires O_RDONLY access mode +owner=trusted (uid=-1) > get foo ./dict_open: warning: unix:xx is unavailable. unix:xx map requires O_RDONLY access mode foo: error ./dict_open: error: unknown table: unix:xx +owner=trusted (uid=-1) > get foo ./dict_open: warning: unix:xx is unavailable. unknown table: unix:xx foo: error ./dict_open: error: texthash:/xx map requires O_RDONLY access mode +owner=trusted (uid=-1) > get foo ./dict_open: warning: texthash:/xx is unavailable. texthash:/xx map requires O_RDONLY access mode foo: error ./dict_open: error: open database /xx: No such file or directory +owner=trusted (uid=-1) > get foo ./dict_open: warning: texthash:/xx is unavailable. open database /xx: No such file or directory foo: error ./dict_open: error: open database /xx.db: No such file or directory +owner=trusted (uid=-1) > get foo ./dict_open: warning: hash:/xx is unavailable. open database /xx.db: No such file or directory foo: error