|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Subject: Re: [PATCH] postconf feature
From: Wietse Venema (wietse
porcupine.org)Date: Thu Dec 21 2000 - 10:34:24 CST
- Next message: joshua stein: "Re: Mail not being sent"
- Previous message: R. Scott Coats: "Mail not being sent"
- In reply to: Matthias Andree: "[PATCH] postconf feature"
- Next in thread: Wietse Venema: "Re: [PATCH] postconf feature"
- Reply: Wietse Venema: "Re: [PATCH] postconf feature"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Alas, this feature almost works. It is incomplete.
Some main.cf parameters are expanded after Postfix has looked up
the recipient's username and home directory information. An example
is forward_path. The result from "postconf -r" would be incorrect.
Other main.cf parameters contain shell environment variables that
depend on recipient and message information. An example is
mailbox_path.
So, in order to make "postconf -r" work correctly, it would have
to know what main.cf parameters must not be expanded. Like any part
of Postfix, that does not involve rocket science. It just takes
another action in the AWK script and a bit of postconf.c code to
access the right table.
Just for the heck of it I'll post a patch today.
Wietse
Matthias Andree:
> While updating my SASL_README, I stumbled across this:
>
> ma> /usr/sbin/postconf -h smtpd_sasl_local_domain
> $myhostname
>
> I'd like to contribute a patch, but I'm missing "postlink", so I cannot
> currently provide an updated postconf.1.html page.
>
> I am putting this patch under the MIT-style license and ask to include
> this (trivial) patch into the next snapshot release of Postfix.
>
> The patch is also available at
> http://mandree.home.pages.de/postfix/
> http://postfix.iswhatyouneed.com/
> (actually, these point to the same server)
>
> diff -Ncr snapshot-20001217/man/man1/postconf.1 snapshot-20001217-ma1/man/man1/postconf.1
> *** snapshot-20001217/man/man1/postconf.1 Fri Dec 15 18:32:02 2000
> --- snapshot-20001217-ma1/man/man1/postconf.1 Thu Dec 21 14:58:20 2000
> ***************
> *** 9,15 ****
> .na
> .nf
> .fi
> ! \fBpostconf\fR [\fB-dhmlnv\fR] [\fB-c \fIconfig_dir\fR]
> [\fIparameter ...\fR]
>
> \fBpostconf\fR [\fB-ev\fR] [\fB-c \fIconfig_dir\fR]
> --- 9,15 ----
> .na
> .nf
> .fi
> ! \fBpostconf\fR [\fB-dhmlnrv\fR] [\fB-c \fIconfig_dir\fR]
> [\fIparameter ...\fR]
>
> \fBpostconf\fR [\fB-ev\fR] [\fB-c \fIconfig_dir\fR]
> ***************
> *** 42,47 ****
> --- 42,49 ----
> List the names of all supported mailbox locking methods.
> .IP \fB-n\fR
> Print non-default parameter settings only.
> + .IP \fB-r\fR
> + Resolve (evaluate) parameters.
> .IP \fB-v\fR
> Enable verbose logging for debugging purposes. Multiple \fB-v\fR
> options make the software increasingly verbose.
> diff -Ncr snapshot-20001217/src/postconf/postconf.c snapshot-20001217-ma1/src/postconf/postconf.c
> *** snapshot-20001217/src/postconf/postconf.c Fri Dec 15 17:13:02 2000
> --- snapshot-20001217-ma1/src/postconf/postconf.c Thu Dec 21 15:01:14 2000
> ***************
> *** 30,41 ****
> /* .IP \fB-h\fR
> /* Show parameter values only, not the ``name = '' label
> /* that normally precedes the value.
> - /* .IP \fB-m\fR
> - /* List the names of all supported lookup table types.
> /* .IP \fB-l\fR
> /* List the names of all supported mailbox locking methods.
> /* .IP \fB-n\fR
> /* Print non-default parameter settings only.
> /* .IP \fB-v\fR
> /* Enable verbose logging for debugging purposes. Multiple \fB-v\fR
> /* options make the software increasingly verbose.
> --- 30,43 ----
> /* .IP \fB-h\fR
> /* Show parameter values only, not the ``name = '' label
> /* that normally precedes the value.
> /* .IP \fB-l\fR
> /* List the names of all supported mailbox locking methods.
> + /* .IP \fB-m\fR
> + /* List the names of all supported lookup table types.
> /* .IP \fB-n\fR
> /* Print non-default parameter settings only.
> + /* .IP \fB-r\fR
> + /* Resolve parameters recursively.
> /* .IP \fB-v\fR
> /* Enable verbose logging for debugging purposes. Multiple \fB-v\fR
> /* options make the software increasingly verbose.
> ***************
> *** 106,111 ****
> --- 108,114 ----
> #define SHOW_MAPS (1<<3) /* show map types */
> #define EDIT_MAIN (1<<4) /* edit main.cf */
> #define SHOW_LOCKS (1<<5) /* show mailbox lock methods */
> + #define RECURSE (1<<6) /* resolve recursively */
>
> /*
> * Lookup table for in-core parameter info.
> ***************
> *** 430,435 ****
> --- 433,440 ----
>
> static void show_strval(int mode, const char *name, const char *value)
> {
> + if (mode & RECURSE) value = mail_conf_eval(value);
> +
> if (mode & SHOW_NAME) {
> vstream_printf("%s = %s\n", name, value);
> } else {
> ***************
> *** 713,719 ****
> /*
> * Parse JCL.
> */
> ! while ((ch = GETOPT(argc, argv, "c:dehmlnv")) > 0) {
> switch (ch) {
> case 'c':
> if (setenv(CONF_ENV_PATH, optarg, 1) < 0)
> --- 718,724 ----
> /*
> * Parse JCL.
> */
> ! while ((ch = GETOPT(argc, argv, "c:dehmlnrv")) > 0) {
> switch (ch) {
> case 'c':
> if (setenv(CONF_ENV_PATH, optarg, 1) < 0)
> ***************
> *** 736,741 ****
> --- 741,749 ----
> break;
> case 'n':
> mode |= SHOW_NONDEF;
> + break;
> + case 'r':
> + mode |= RECURSE;
> break;
> case 'v':
> msg_verbose++;
>
>
> --
> Matthias Andree
>
>
>
- Next message: joshua stein: "Re: Mail not being sent"
- Previous message: R. Scott Coats: "Mail not being sent"
- In reply to: Matthias Andree: "[PATCH] postconf feature"
- Next in thread: Wietse Venema: "Re: [PATCH] postconf feature"
- Reply: Wietse Venema: "Re: [PATCH] postconf feature"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]