Factor out the master.cf line parser so that it can be
reused for "postconf -Me". File: postconf/postconf_master.c.
-20130113
+20130121
- Start of work on integrating a pile of new code.
+ Bugfix (introduced 20120307): the postconf -X option erased
+ other options. File: postconf/postconf.c.
+
+20130131
+
+ Bugfix: the local(8) delivery agent dereferenced a null
+ pointer while delivering to null command (for example, "|"
+ in a .forward file). Reported by Gilles Chehade.
If you upgrade from Postfix 2.8 or earlier, read RELEASE_NOTES-2.9
before proceeding.
+Major changes with snapshot 20130201
+====================================
+
+The "postconf -Mn" feature is withdrawn, in favor of a better design
+that not only supports queries but also updates of named properties
+of a master.cf service entry. But there is not enough time to finish
+that for Postfix 2.10.
+
Incompatible changes with snapshot 20121224
===========================================
<b>Managing <a href="master.5.html">master.cf</a>:</b>
- <b>postconf</b> [<b>-fMnovx</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>service ...</i>]
+ <b>postconf</b> [<b>-fMovx</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>service ...</i>]
<b>Managing bounce message templates:</b>
later.
<b>-n</b> Show only configuration parameters that have
- explicit <i>name=value</i> settings in <a href="postconf.5.html"><b>main.cf</b></a>. When
- specified with <b>-M</b>, show only services that have
- explicit "-o <i>name=value</i>" settings in <a href="master.5.html"><b>master.cf</b></a>
- (Postfix 2.10 and later). Specify <b>-nf</b> to fold long
- lines for human readability (Postfix 2.9 and
- later).
+ explicit <i>name=value</i> settings in <a href="postconf.5.html"><b>main.cf</b></a>. Specify
+ <b>-nf</b> to fold long lines for human readability (Post-
+ fix 2.9 and later).
<b>-o</b> <i>name=value</i>
Override <a href="postconf.5.html"><b>main.cf</b></a> parameter settings.
- This feature is available with Postfix 2.10 and
+ This feature is available with Postfix 2.10 and
later.
<b>-t</b> [<i>template</i><b>_</b><i>file</i>]
- Display the templates for text that appears at the
- beginning of delivery status notification (DSN)
+ Display the templates for text that appears at the
+ beginning of delivery status notification (DSN)
messages, without expanding $<b>name</b> expressions.
- To override the built-in templates, specify a tem-
- plate file name at the end of the <a href="postconf.1.html"><b>postconf</b>(1)</a> com-
- mand line, or specify a file name in <a href="postconf.5.html"><b>main.cf</b></a> with
+ To override the built-in templates, specify a tem-
+ plate file name at the end of the <a href="postconf.1.html"><b>postconf</b>(1)</a> com-
+ mand line, or specify a file name in <a href="postconf.5.html"><b>main.cf</b></a> with
the <b><a href="postconf.5.html#bounce_template_file">bounce_template_file</a></b> parameter.
To force selection of the built-in templates, spec-
- ify an empty template file name on the <a href="postconf.1.html"><b>postconf</b>(1)</a>
+ ify an empty template file name on the <a href="postconf.1.html"><b>postconf</b>(1)</a>
command line (in shell language: "").
- This feature is available with Postfix 2.3 and
+ This feature is available with Postfix 2.3 and
later.
<b>-v</b> Enable verbose logging for debugging purposes. Mul-
- tiple <b>-v</b> options make the software increasingly
+ tiple <b>-v</b> options make the software increasingly
verbose.
<b>-x</b> Expand <i>$name</i> in <a href="postconf.5.html"><b>main.cf</b></a> or <a href="master.5.html"><b>master.cf</b></a> parameter val-
ues. The expansion is recursive.
- This feature is available with Postfix 2.10 and
+ This feature is available with Postfix 2.10 and
later.
<b>-X</b> Edit the <a href="postconf.5.html"><b>main.cf</b></a> configuration file, and remove the
- parameters named on the <a href="postconf.1.html"><b>postconf</b>(1)</a> command line.
+ parameters named on the <a href="postconf.1.html"><b>postconf</b>(1)</a> command line.
The file is copied to a temporary file then renamed
into place. Specify a list of parameter names, not
- "<i>name=value</i>" pairs. There is no <a href="postconf.1.html"><b>postconf</b>(1)</a> com-
+ "<i>name=value</i>" pairs. There is no <a href="postconf.1.html"><b>postconf</b>(1)</a> com-
mand to perform the reverse operation.
- This feature is available with Postfix 2.10 and
+ This feature is available with Postfix 2.10 and
later.
- <b>-#</b> Edit the <a href="postconf.5.html"><b>main.cf</b></a> configuration file, and comment
+ <b>-#</b> Edit the <a href="postconf.5.html"><b>main.cf</b></a> configuration file, and comment
out the parameters named on the <a href="postconf.1.html"><b>postconf</b>(1)</a> command
- line, so that those parameters revert to their
- default values. The file is copied to a temporary
- file then renamed into place. Specify a list of
- parameter names, not "<i>name=value</i>" pairs. There is
+ line, so that those parameters revert to their
+ default values. The file is copied to a temporary
+ file then renamed into place. Specify a list of
+ parameter names, not "<i>name=value</i>" pairs. There is
no <a href="postconf.1.html"><b>postconf</b>(1)</a> command to perform the reverse oper-
ation.
- This feature is available with Postfix 2.6 and
+ This feature is available with Postfix 2.6 and
later.
<b>DIAGNOSTICS</b>
Directory with Postfix configuration files.
<b>CONFIGURATION PARAMETERS</b>
- The following <a href="postconf.5.html"><b>main.cf</b></a> parameters are especially relevant
+ The following <a href="postconf.5.html"><b>main.cf</b></a> parameters are especially relevant
to this program.
- The text below provides only a parameter summary. See
+ The text below provides only a parameter summary. See
<a href="postconf.5.html"><b>postconf</b>(5)</a> for more details including examples.
<b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
- The default location of the Postfix <a href="postconf.5.html">main.cf</a> and
+ The default location of the Postfix <a href="postconf.5.html">main.cf</a> and
<a href="master.5.html">master.cf</a> configuration files.
<b><a href="postconf.5.html#bounce_template_file">bounce_template_file</a> (empty)</b>
- Pathname of a configuration file with bounce mes-
+ Pathname of a configuration file with bounce mes-
sage templates.
<b>FILES</b>
<a href="DATABASE_README.html">DATABASE_README</a>, Postfix lookup table overview
<b>LICENSE</b>
- The Secure Mailer license must be distributed with this
+ The Secure Mailer license must be distributed with this
software.
<b>AUTHOR(S)</b>
\fBManaging master.cf:\fR
-\fBpostconf\fR [\fB-fMnovx\fR] [\fB-c \fIconfig_dir\fR]
+\fBpostconf\fR [\fB-fMovx\fR] [\fB-c \fIconfig_dir\fR]
[\fIservice ...\fR]
\fBManaging bounce message templates:\fR
.IP \fB-n\fR
Show only configuration parameters that have explicit
\fIname=value\fR settings in \fBmain.cf\fR.
-When specified with \fB-M\fR, show only services that have
-explicit "-o \fIname=value\fR" settings in \fBmaster.cf\fR
-(Postfix 2.10 and later).
Specify \fB-nf\fR to fold long lines for human readability
(Postfix 2.9 and later).
.IP "\fB-o \fIname=value\fR"
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20130113"
+#define MAIL_RELEASE_DATE "20130201"
#define MAIL_VERSION_NUMBER "2.10"
#ifdef SNAPSHOT
tests: test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 \
test12 test13 test14 test15 test16 test17 test18 test19 test20 test21 \
test22 test23 test24 test25 test26 test27 test28 test29 test30 test4b \
- test31 test32 test33 test34 test35 test36 test37 test38 test39 test40
+ test31 test32 test33 test34 test35 test36 test37 test39 test40
root_tests:
diff test37.ref test37.tmp
rm -f main.cf master.cf test37.tmp
-test38: $(PROG) test38.ref
- rm -f main.cf master.cf
- touch main.cf master.cf
- echo foo unix - n n - 0 other >> master.cf
- echo bar unix - n n - 0 other >> master.cf
- echo ' -o aaa=ccc' >> master.cf
- ./$(PROG) -Mnfxc . >test38.tmp 2>&1
- diff test38.ref test38.tmp
- rm -f main.cf master.cf test38.tmp
-
test39: $(PROG) test39.ref
rm -f main.cf master.cf
touch main.cf master.cf
/*
/* \fBManaging master.cf:\fR
/*
-/* \fBpostconf\fR [\fB-fMnovx\fR] [\fB-c \fIconfig_dir\fR]
+/* \fBpostconf\fR [\fB-fMovx\fR] [\fB-c \fIconfig_dir\fR]
/* [\fIservice ...\fR]
/*
/* \fBManaging bounce message templates:\fR
/* .IP \fB-n\fR
/* Show only configuration parameters that have explicit
/* \fIname=value\fR settings in \fBmain.cf\fR.
-/* When specified with \fB-M\fR, show only services that have
-/* explicit "-o \fIname=value\fR" settings in \fBmaster.cf\fR
-/* (Postfix 2.10 and later).
/* Specify \fB-nf\fR to fold long lines for human readability
/* (Postfix 2.9 and later).
/* .IP "\fB-o \fIname=value\fR"
break;
case 'X':
/* This is irreversible, therefore require two-finger action. */
- cmd_mode = EDIT_EXCL;
+ cmd_mode |= EDIT_EXCL;
break;
case 'v':
msg_verbose++;
msg_fatal("specify one of -a, -A, -b, -d, -e, -#, -l, -m, -M, and -X");
if ((cmd_mode & SHOW_EVAL) != 0 && junk != 0 && junk != SHOW_DEFS && junk != SHOW_MASTER)
msg_fatal("do not specify -x with -a, -A, -b, -e, -#, -l, -m, or -X");
- if ((cmd_mode & SHOW_NONDEF) != 0 && junk != 0 && junk != SHOW_MASTER)
- msg_fatal("do not specify -n with -a, -A, -b, -d, -e, -#, -l, -m, or -X");
+ if ((cmd_mode & SHOW_NONDEF) != 0 && junk != 0)
+ msg_fatal("do not specify -n with -a, -A, -b, -d, -e, -#, -l, -m, -M, or -X");
if (override_params != 0 && junk != 0 && junk != SHOW_MASTER)
msg_fatal("do not specify -o with -a, -A, -b, -d, -e, -#, -l, -m, or -X");
/* parse_master_line - parse one master line */
-static void parse_master_line(PC_MASTER_ENT *masterp, const char *buf,
- const char *path, int line_count)
+static const char *parse_master_line(PC_MASTER_ENT *masterp, const char *buf)
{
ARGV *argv;
argv = argv_split(buf, MASTER_BLANKS);
if (argv->argc < PC_MASTER_MIN_FIELDS)
- msg_fatal("file %s: line %d: bad field count",
- path, line_count);
+ return ("bad field count");
normalize_options(argv);
masterp->name_space =
concatenate(argv->argv[0], ".", argv->argv[1], (char *) 0);
masterp->argv = argv;
masterp->valid_names = 0;
masterp->all_params = 0;
+ return (0);
}
/* read_master - read and digest the master.cf file */
char *path;
VSTRING *buf;
VSTREAM *fp;
+ const char *err;
int entry_count = 0;
int line_count = 0;
while (readlline(buf, fp, &line_count) != 0) {
master_table = (PC_MASTER_ENT *) myrealloc((char *) master_table,
(entry_count + 2) * sizeof(*master_table));
- parse_master_line(master_table + entry_count, STR(buf),
- path, line_count);
+ if ((err = parse_master_line(master_table + entry_count,
+ STR(buf))) != 0)
+ msg_fatal("file %s: line %d: %s", path, line_count, err);
entry_count += 1;
}
vstream_fclose(fp);
/*
* See if this command contains any shell magic characters.
*/
- if (command[strspn(command, ok_chars)] == 0) {
+ if (command[strspn(command, ok_chars)] == 0
+ && command[strspn(command, SPACE_TAB)] != 0) {
/*
* No shell meta characters found, so we can try to avoid the overhead