2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-22 09:57:34 +00:00

postfix-2.9-20120117

This commit is contained in:
Wietse Venema 2012-01-17 00:00:00 -05:00 committed by Viktor Dukhovni
parent beab543c46
commit ce7eb1e2fe
23 changed files with 465 additions and 40 deletions

1
postfix/.indent.pro vendored
View File

@ -192,6 +192,7 @@
-TNAME_CODE
-TNAME_MASK
-TNBBIO
-TPC_DBMS_INFO
-TPC_MASTER_ENT
-TPC_PARAM_NODE
-TPC_SERVICE_DEF

View File

@ -17557,3 +17557,13 @@ Apologies for any names omitted.
Cleanup: tiny memory leaks after surrogate database opens.
Files: util/dict_cidr.c, util/dict_db.c.
20111217
Cleanup: support for legacy-style database configuration
where parameter names are generated by appending suffixes
to the database name. Files: postconf/postconf_dbms.c.
Other: build without Berkeley DB support (make makefiles
"CCARGS=$CCARGS -DNO_DB"). Files: makedefs, util/sys_defs.h,
proto/DB_README.html, proto/INSTALL.html.

View File

@ -14,16 +14,33 @@ Note: Berkeley DB version 4 is not supported by Postfix versions before 2.0.
This document describes:
1. How to build Postfix on systems without Berkeley DB library.
1. How to build Postfix without Berkeley DB support even if the system comes
with Berkeley DB.
2. How to build Postfix on BSD or Linux systems with multiple Berkeley DB
2. How to build Postfix on systems that normally have no Berkeley DB library.
3. How to build Postfix on BSD or Linux systems with multiple Berkeley DB
versions.
3. How to tweak performance.
4. How to tweak performance.
4. Missing pthread library trouble.
5. Missing pthread library trouble.
BBuuiillddiinngg PPoossttffiixx oonn ssyysstteemmss wwiitthhoouutt BBeerrkkeelleeyy DDBB
BBuuiillddiinngg PPoossttffiixx wwiitthhoouutt BBeerrkkeelleeyy DDBB ssuuppppoorrtt eevveenn iiff tthhee ssyysstteemm ccoommeess wwiitthh
BBeerrkkeelleeyy DDBB
Note: The following instructions apply to Postfix 2.9 and later.
Postfix will normally enable Berkeley DB support if the system is known to have
it. To build Postfix without Berkeley DB support, build the makefiles as
follows:
% make makefiles CCARGS="-DNO_DB"
% make
This will disable support for "hash" and "btree" files.
BBuuiillddiinngg PPoossttffiixx oonn ssyysstteemmss tthhaatt nnoorrmmaallllyy hhaavvee nnoo BBeerrkkeelleeyy DDBB lliibbrraarryy
Some UNIXes ship without Berkeley DB support; for historical reasons these use
DBM files instead. A problem with DBM files is that they can store only limited
@ -44,14 +61,12 @@ way to keep things from falling apart.
To build Postfix after you installed the Berkeley DB from source code, use
something like:
% make tidy
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
AUXLIBS="-L/usr/local/BerkeleyDB/lib -ldb"
% make
Solaris needs this:
% make tidy
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
AUXLIBS="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -ldb"
% make
@ -78,7 +93,6 @@ Postfix builds with the default DB version that ships with the system.
To build Postfix on BSD systems with a non-default DB version, use a variant of
the following commands:
% make tidy
% make makefiles CCARGS=-I/usr/include/db3 AUXLIBS=-ldb3
% make

View File

@ -246,6 +246,11 @@ The following is an extensive list of names and values.
| |following directives turn off Postfix features|
| |at compile time: |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|| |Do not build with Berkeley DB support. By |
||-DNO_DB |default, Berkeley DB support is compiled in on|
|| |platforms that are known to support this |
|| |feature. |
|_|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|| |Do not build with Solaris /dev/poll support. |
||-DNO_DEVPOLL |By default, /dev/poll support is compiled in |
|| |on Solaris versions that are known to support |

View File

@ -33,8 +33,11 @@ before 2.0. </p>
<ol>
<li> <p> How to build Postfix on <a href="#no_db">systems without
Berkeley DB library</a>. </p>
<li> <p> How to build Postfix <a href="#disable_db">without Berkeley
DB support</a> even if the system comes with Berkeley DB. </p>
<li> <p> How to build Postfix on <a href="#no_db">systems that
normally have no Berkeley DB library</a>. </p>
<li> <p> How to build Postfix on <a href="#bsd">BSD</a> or <a
href="#linux">Linux</a> systems with multiple Berkeley DB
@ -46,8 +49,26 @@ versions. </p>
</ol>
<h2><a name="no_db">Building Postfix on systems without Berkeley
DB</a></h2>
<h2><a name="disable_db">Building Postfix without Berkeley
DB support even if the system comes with Berkeley DB</a></h2>
<p> Note: The following instructions apply to Postfix 2.9 and later. </p>
<p> Postfix will normally enable Berkeley DB support if the system
is known to have it. To build Postfix without Berkeley DB support,
build the makefiles as follows: </p>
<blockquote>
<pre>
% make makefiles CCARGS="-DNO_DB"
% make
</pre>
</blockquote>
<p> This will disable support for "hash" and "btree" files. </p>
<h2><a name="no_db">Building Postfix on systems that normally have
no Berkeley DB library</a></h2>
<p> Some UNIXes ship without Berkeley DB support; for historical
reasons these use DBM files instead. A problem with DBM files is
@ -73,7 +94,6 @@ source code, use something like: </p>
<blockquote>
<pre>
% make tidy
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
AUXLIBS="-L/usr/local/BerkeleyDB/lib -ldb"
% make
@ -84,7 +104,6 @@ source code, use something like: </p>
<blockquote>
<pre>
% make tidy
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
AUXLIBS="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -ldb"
% make
@ -119,7 +138,6 @@ use a variant of the following commands: </p>
<blockquote>
<pre>
% make tidy
% make makefiles CCARGS=-I/usr/include/db3 AUXLIBS=-ldb3
% make
</pre>

View File

@ -372,6 +372,10 @@ Specifies non-default compiler arguments, for example, a non-default
<tt>include</tt> directory. The following directives turn
off Postfix features at compile time:</td> </tr>
<tr> <td> </td> <td> -DNO_DB </td> <td> Do not build with Berkeley
DB support. By default, Berkeley DB support is compiled in on
platforms that are known to support this feature. </td> </tr>
<tr> <td> </td> <td> -DNO_DEVPOLL </td> <td> Do not build with
Solaris <tt>/dev/poll</tt> support. By default, <tt>/dev/poll</tt>
support is compiled in on Solaris versions that are known to support

View File

@ -181,11 +181,13 @@ MEMCACHE_TABLE(5) MEMCACHE_TABLE(5)
<b>max_try (default: 2)</b>
The number of times to try a memcache command
before giving up.
before giving up. The memcache client does not
retry a command when the memcache server accepts no
connection.
<b>retry_pause (default: 1)</b>
The time in seconds to wait after a memcache com-
mand fails.
The time in seconds before retrying a failed mem-
cache command.
<b>timeout (default: 2)</b>
The time limit for sending a memcache command and

View File

@ -25,6 +25,8 @@
# \fIinclude\fR directory.
# The following directives are special:
# .RS
# .IP \fB-DNO_DB\fR
# Do not build with Berkeley DB support.
# .IP \fB-DNO_DEVPOLL\fR
# Do not build with Solaris /dev/poll support.
# By default, /dev/poll support is compiled in on platforms that

View File

@ -182,9 +182,11 @@ The maximal memcache reply data length in bytes.
.IP "\fBline_size_limit (default: 1024)\fR"
The maximal memcache reply line length in bytes.
.IP "\fBmax_try (default: 2)\fR"
The number of times to try a memcache command before giving up.
The number of times to try a memcache command before giving
up. The memcache client does not retry a command when the
memcache server accepts no connection.
.IP "\fBretry_pause (default: 1)\fR"
The time in seconds to wait after a memcache command fails.
The time in seconds before retrying a failed memcache command.
.IP "\fBtimeout (default: 2)\fR"
The time limit for sending a memcache command and for
receiving a memcache reply.

View File

@ -33,8 +33,11 @@ before 2.0. </p>
<ol>
<li> <p> How to build Postfix on <a href="#no_db">systems without
Berkeley DB library</a>. </p>
<li> <p> How to build Postfix <a href="#disable_db">without Berkeley
DB support</a> even if the system comes with Berkeley DB. </p>
<li> <p> How to build Postfix on <a href="#no_db">systems that
normally have no Berkeley DB library</a>. </p>
<li> <p> How to build Postfix on <a href="#bsd">BSD</a> or <a
href="#linux">Linux</a> systems with multiple Berkeley DB
@ -46,8 +49,26 @@ versions. </p>
</ol>
<h2><a name="no_db">Building Postfix on systems without Berkeley
DB</a></h2>
<h2><a name="disable_db">Building Postfix without Berkeley
DB support even if the system comes with Berkeley DB</a></h2>
<p> Note: The following instructions apply to Postfix 2.9 and later. </p>
<p> Postfix will normally enable Berkeley DB support if the system
is known to have it. To build Postfix without Berkeley DB support,
build the makefiles as follows: </p>
<blockquote>
<pre>
% make makefiles CCARGS="-DNO_DB"
% make
</pre>
</blockquote>
<p> This will disable support for "hash" and "btree" files. </p>
<h2><a name="no_db">Building Postfix on systems that normally have
no Berkeley DB library</a></h2>
<p> Some UNIXes ship without Berkeley DB support; for historical
reasons these use DBM files instead. A problem with DBM files is
@ -73,7 +94,6 @@ source code, use something like: </p>
<blockquote>
<pre>
% make tidy
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
AUXLIBS="-L/usr/local/BerkeleyDB/lib -ldb"
% make
@ -84,7 +104,6 @@ source code, use something like: </p>
<blockquote>
<pre>
% make tidy
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
AUXLIBS="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -ldb"
% make
@ -119,7 +138,6 @@ use a variant of the following commands: </p>
<blockquote>
<pre>
% make tidy
% make makefiles CCARGS=-I/usr/include/db3 AUXLIBS=-ldb3
% make
</pre>

View File

@ -372,6 +372,10 @@ Specifies non-default compiler arguments, for example, a non-default
<tt>include</tt> directory. The following directives turn
off Postfix features at compile time:</td> </tr>
<tr> <td> </td> <td> -DNO_DB </td> <td> Do not build with Berkeley
DB support. By default, Berkeley DB support is compiled in on
platforms that are known to support this feature. </td> </tr>
<tr> <td> </td> <td> -DNO_DEVPOLL </td> <td> Do not build with
Solaris <tt>/dev/poll</tt> support. By default, <tt>/dev/poll</tt>
support is compiled in on Solaris versions that are known to support

View File

@ -170,9 +170,11 @@
# .IP "\fBline_size_limit (default: 1024)\fR"
# The maximal memcache reply line length in bytes.
# .IP "\fBmax_try (default: 2)\fR"
# The number of times to try a memcache command before giving up.
# The number of times to try a memcache command before giving
# up. The memcache client does not retry a command when the
# memcache server accepts no connection.
# .IP "\fBretry_pause (default: 1)\fR"
# The time in seconds to wait after a memcache command fails.
# The time in seconds before retrying a failed memcache command.
# .IP "\fBtimeout (default: 2)\fR"
# The time limit for sending a memcache command and for
# receiving a memcache reply.

View File

@ -173,6 +173,7 @@
#include <safe.h>
#include <safe_open.h>
#include <mymalloc.h>
#include <dict.h>
#ifdef HAS_DB
#include <dict_db.h>
#endif

View File

@ -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 "20120115"
#define MAIL_RELEASE_DATE "20120117"
#define MAIL_VERSION_NUMBER "2.9"
#ifdef SNAPSHOT

View File

@ -1,14 +1,14 @@
SHELL = /bin/sh
SRCS = postconf.c postconf_builtin.c postconf_edit.c postconf_main.c \
postconf_master.c postconf_misc.c postconf_node.c postconf_other.c \
postconf_service.c postconf_unused.c postconf_user.c
postconf_service.c postconf_unused.c postconf_user.c postconf_dbms.c
OBJS = postconf.o postconf_builtin.o postconf_edit.o postconf_main.o \
postconf_master.o postconf_misc.o postconf_node.o postconf_other.o \
postconf_service.o postconf_unused.o postconf_user.o
postconf_service.o postconf_unused.o postconf_user.o postconf_dbms.o
HDRS = postconf.h
TESTSRC =
DEFS = -I. -I$(INC_DIR) -D$(SYSTYPE)
CFLAGS = $(DEBUG) $(OPT) $(DEFS)
CFLAGS = $(DEBUG) $(OPT) $(DEFS) -DLEGACY_DBMS_SUPPORT
TESTPROG=
MAKES = bool_table.h bool_vars.h int_table.h int_vars.h str_table.h \
str_vars.h time_table.h time_vars.h raw_table.h raw_vars.h \
@ -42,7 +42,7 @@ test: $(TESTPROG)
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
test22 test23 test24 test25 test26 test27 test28 test29
root_tests:
@ -354,6 +354,50 @@ test27: $(PROG) test27.ref
diff test27.ref test27.tmp
rm -f main.cf master.cf test27.tmp
# Test macro expansion, type:table parsing and scoping.
test28: $(PROG) test28.ref
rm -f main.cf master.cf
touch main.cf master.cf
echo 'xx = proxy:ldap:foo' >> main.cf
echo 'foo_domain = bar' >> main.cf
echo 'header_checks = ldap:hh' >> main.cf
echo 'hh_domain = whatever' >> main.cf
echo 'zz = $$yy' >> main.cf
echo 'yy = aap' >> main.cf
echo 'db = memcache' >> main.cf
echo whatevershebrings unix - n n - 0 other >> master.cf
echo ' -o body_checks=$$db:zz' >> master.cf
echo 'zz_domain = whatever' >> main.cf
echo 'aa_domain = whatever' >> main.cf
./$(PROG) -nc . >test28.tmp 2>&1
diff test28.ref test28.tmp
rm -f main.cf master.cf test28.tmp
# Test the handling of known and unknown database-defined suffixes.
test29: $(PROG) test29.ref
rm -f main.cf master.cf
touch main.cf master.cf
echo 'ldapxx = proxy:ldap:ldapfoo' >> main.cf
echo 'ldapfoo_domain = bar' >> main.cf
echo 'ldapfoo_domainx = bar' >> main.cf
echo 'mysqlxx = proxy:mysql:mysqlfoo' >> main.cf
echo 'mysqlfoo_domain = bar' >> main.cf
echo 'mysqlfoo_domainx = bar' >> main.cf
echo 'pgsqlxx = proxy:pgsql:pgsqlfoo' >> main.cf
echo 'pgsqlfoo_domain = bar' >> main.cf
echo 'pgsqlfoo_domainx = bar' >> main.cf
echo 'sqlitexx = proxy:sqlite:sqlitefoo' >> main.cf
echo 'sqlitefoo_domain = bar' >> main.cf
echo 'sqlitefoo_domainx = bar' >> main.cf
echo 'memcachexx = proxy:memcache:memcachefoo' >> main.cf
echo 'memcachefoo_domain = bar' >> main.cf
echo 'memcachefoo_domainx = bar' >> main.cf
./$(PROG) -nc . >test29.tmp 2>&1
diff test29.ref test29.tmp
rm -f main.cf master.cf test29.tmp
printfck: $(OBJS) $(PROG)
rm -rf printfck
mkdir printfck
@ -441,6 +485,26 @@ postconf_builtin.o: str_table.h
postconf_builtin.o: str_vars.h
postconf_builtin.o: time_table.h
postconf_builtin.o: time_vars.h
postconf_dbms.o: ../../include/argv.h
postconf_dbms.o: ../../include/dict.h
postconf_dbms.o: ../../include/dict_ldap.h
postconf_dbms.o: ../../include/dict_memcache.h
postconf_dbms.o: ../../include/dict_mysql.h
postconf_dbms.o: ../../include/dict_pgsql.h
postconf_dbms.o: ../../include/dict_proxy.h
postconf_dbms.o: ../../include/dict_sqlite.h
postconf_dbms.o: ../../include/htable.h
postconf_dbms.o: ../../include/mac_expand.h
postconf_dbms.o: ../../include/mac_parse.h
postconf_dbms.o: ../../include/mail_conf.h
postconf_dbms.o: ../../include/split_at.h
postconf_dbms.o: ../../include/stringops.h
postconf_dbms.o: ../../include/sys_defs.h
postconf_dbms.o: ../../include/vbuf.h
postconf_dbms.o: ../../include/vstream.h
postconf_dbms.o: ../../include/vstring.h
postconf_dbms.o: postconf.h
postconf_dbms.o: postconf_dbms.c
postconf_edit.o: ../../include/argv.h
postconf_edit.o: ../../include/dict.h
postconf_edit.o: ../../include/edit_file.h

View File

@ -161,6 +161,13 @@ extern void register_service_parameters(void);
*/
extern void register_user_parameters(void);
/*
* postconf_dbms.c
*/
extern void register_dbms_parameters(const char *,
const char *(*) (const char *, int, char *),
PC_MASTER_ENT *);
/*
* postconf_unused.c.
*/

View File

@ -335,7 +335,7 @@ void register_builtin_parameters(void)
/*
* Add the built-in parameters to the global name space. The class
* (built-i) is tentative; some parameters are actually service-defined,
* (built-in) is tentative; some parameters are actually service-defined,
* but they have their own default value.
*/
for (ctt = time_table; ctt->name; ctt++)

View File

@ -0,0 +1,231 @@
/*++
/* NAME
/* postconf_dbms 3
/* SUMMARY
/* legacy support for database-defined main.cf parameter names
/* SYNOPSIS
/* #include <postconf.h>
/*
/* void register_dbms_parameters(param_value, flag_parameter,
/* local_scope)
/* const char *param_value;
/* const char *(flag_parameter) (const char *, int, char *);
/* PC_MASTER_ENT *local_scope;
/* DESCRIPTION
/* This module implements legacy support for database configuration
/* where main.cf parameter names are generated by prepending
/* the database name to a database-defined suffix.
/*
/* Arguments:
/* .IP param_value
/* A parameter value to be searched for "type:table" strings.
/* When a database type is found that supports legacy-style
/* configuration, the table name is combined with each of the
/* database-defined suffixes to generate candidate parameter
/* names for that database type.
/* .IP flag_parameter
/* A function that takes as arguments a candidate parameter
/* name, an unused value, and a local namespace pointer. The
/* function will flag the parameter as "used" if it has a
/* "name=value" entry in the local or global namespace.
/* .IP local_scope
/* The local namespace.
/* DIAGNOSTICS
/* No explicit diagnostics.
/* 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 <sys_defs.h>
#include <string.h>
/* Utility library. */
#include <stringops.h>
#include <split_at.h>
#include <mac_expand.h>
#include <dict.h>
/* Global library. */
#include <mail_conf.h>
#include <dict_proxy.h>
#include <dict_ldap.h>
#include <dict_mysql.h>
#include <dict_pgsql.h>
#include <dict_sqlite.h>
#include <dict_memcache.h>
/* Application-specific. */
#include <postconf.h>
/*
* SLMs.
*/
#define STR(x) vstring_str(x)
#ifdef LEGACY_DBMS_SUPPORT
/*
* The legacy database interface automagically instantiates a list of
* parameters by prepending the table name to database-specific suffixes.
*/
/* See ldap_table(5). */
static const char *ldap_suffixes[] = {
"bind", "bind_dn", "bind_pw", "cache", "cache_expiry", "cache_size",
"chase_referrals", "debuglevel", "dereference", "domain",
"expansion_limit", "leaf_result_attribute", "query_filter",
"recursion_limit", "result_attribute", "result_format", "scope",
"search_base", "server_host", "server_port", "size_limit",
"special_result_attribute", "terminal_result_attribute",
"timeout", "version", 0,
};
/* See mysql_table(5). */
static const char *mysql_suffixes[] = {
"additional_conditions", "dbname", "domain", "expansion_limit",
"hosts", "password", "query", "result_format", "select_field",
"table", "user", "where_field", 0,
};
/* See pgsql_table(5). */
static const char *pgsql_suffixes[] = {
"additional_conditions", "dbname", "domain", "expansion_limit",
"hosts", "password", "query", "result_format", "select_field",
"select_function", "table", "user", "where_field", 0,
};
/* See sqlite_table(5). */
static const char *sqlite_suffixes[] = {
"additional_conditions", "dbpath", "domain", "expansion_limit",
"query", "result_format", "select_field", "table", "where_field",
0,
};
/* See memcache_table(5). */
static const char *memcache_suffixes[] = {
"backup", "data_size_limit", "domain", "flags", "key_format",
"line_size_limit", "max_try", "memcache", "retry_pause",
"timeout", "ttl", 0,
};
/*
* Bundle up the database types and their suffix lists.
*/
typedef struct {
const char *db_type;
const char **db_suffixes;
} PC_DBMS_INFO;
static const PC_DBMS_INFO dbms_info[] = {
DICT_TYPE_LDAP, ldap_suffixes,
DICT_TYPE_MYSQL, mysql_suffixes,
DICT_TYPE_PGSQL, pgsql_suffixes,
DICT_TYPE_SQLITE, sqlite_suffixes,
DICT_TYPE_MEMCACHE, memcache_suffixes,
0,
};
/* register_dbms_parameters_cb - mac_expand() call-back */
static const char *register_dbms_parameters_cb(const char *mac_name,
int unused_mode,
char *context)
{
PC_MASTER_ENT *local_scope = (PC_MASTER_ENT *) context;
const char *mac_val;
/*
* Local namespace "name=value" settings are always explicit. They have
* precedence over global namespace "name=value" settings which are
* either explicit or defined by their default value.
*/
if (local_scope == 0
|| (mac_val = dict_get(local_scope->all_params, mac_name)) == 0)
mac_val = mail_conf_lookup(mac_name);
return (mac_val);
}
/* register_dbms_parameters - look for database_type:prefix_name */
void register_dbms_parameters(const char *param_value,
const char *(flag_parameter) (const char *, int, char *),
PC_MASTER_ENT *local_scope)
{
const PC_DBMS_INFO *dp;
char *bufp;
char *db_type;
char *prefix;
static VSTRING *buffer = 0;
static VSTRING *candidate = 0;
const char **cpp;
/*
* Emulate Postfix parameter value expansion, prepending the appropriate
* local (master.cf "-o name-value") namespace to the global (main.cf
* "name=value") namespace.
*
* XXX This does not examine both sides of conditional macro expansion, and
* may expand the "wrong" conditional macros. This is the best we can do
* for legacy database configuration support.
*/
#define NO_SCAN_FILTER ((char *) 0)
(void) mac_expand(buffer ? buffer : (buffer = vstring_alloc(100)),
param_value, MAC_EXP_FLAG_RECURSE, NO_SCAN_FILTER,
register_dbms_parameters_cb, (char *) local_scope);
/*
* Naive parsing. We don't really know if the parameter specifies free
* text or a list of databases.
*/
bufp = STR(buffer);
while ((db_type = mystrtok(&bufp, " ,\t\r\n")) != 0) {
/*
* Skip over "proxy:" indirections.
*/
while ((prefix = split_at(db_type, ':')) != 0
&& strcmp(db_type, DICT_TYPE_PROXY) == 0)
db_type = prefix;
/*
* Look for database:prefix where the prefix is not a pathname and
* the database is a known type. Synthesize candidate parameter names
* from the user-defined prefix and from the database-defined suffix
* list, and see if those parameters have a "name=value" entry in the
* local or global namespace.
*/
if (prefix != 0 && *prefix != '/' && *prefix != '.') {
for (dp = dbms_info; dp->db_type != 0; dp++) {
if (strcmp(db_type, dp->db_type) == 0) {
for (cpp = dp->db_suffixes; *cpp; cpp++) {
vstring_sprintf(candidate ? candidate :
(candidate = vstring_alloc(30)),
"%s_%s", prefix, *cpp);
flag_parameter(STR(candidate), 0, (char *) local_scope);
}
break;
}
}
}
}
}
#endif

View File

@ -77,6 +77,11 @@
*/
static HTABLE *rest_class_table;
/*
* SLMs.
*/
#define STR(x) vstring_str(x)
/*
* Macros to make code with obscure constants more readable.
*/
@ -206,6 +211,10 @@ static void scan_user_parameter_namespace(const char *dict_name,
&& PC_RAW_PARAMETER(node))
continue;
SCAN_USER_PARAMETER_VALUE(cparam_value, local_scope);
#ifdef LEGACY_DBMS_SUPPORT
register_dbms_parameters(cparam_value, flag_user_parameter,
local_scope);
#endif
}
}
@ -233,6 +242,7 @@ static void scan_default_parameter_values(HTABLE *valid_params,
msg_panic("%s: parameter %s has no default value",
myname, PC_PARAM_INFO_NAME(*ht));
SCAN_USER_PARAMETER_VALUE(param_value, local_scope);
/* No need to scan default values for legacy DBMS configuration. */
}
myfree((char *) list);
}

View File

@ -0,0 +1,10 @@
config_directory = .
db = memcache
foo_domain = bar
header_checks = ldap:hh
hh_domain = whatever
yy = aap
zz_domain = whatever
./postconf: warning: ./main.cf: unused parameter: zz=$yy
./postconf: warning: ./main.cf: unused parameter: aa_domain=whatever
./postconf: warning: ./main.cf: unused parameter: xx=proxy:ldap:foo

View File

@ -0,0 +1,16 @@
config_directory = .
ldapfoo_domain = bar
memcachefoo_domain = bar
mysqlfoo_domain = bar
pgsqlfoo_domain = bar
sqlitefoo_domain = bar
./postconf: warning: ./main.cf: unused parameter: sqlitexx=proxy:sqlite:sqlitefoo
./postconf: warning: ./main.cf: unused parameter: pgsqlxx=proxy:pgsql:pgsqlfoo
./postconf: warning: ./main.cf: unused parameter: memcachefoo_domainx=bar
./postconf: warning: ./main.cf: unused parameter: sqlitefoo_domainx=bar
./postconf: warning: ./main.cf: unused parameter: memcachexx=proxy:memcache:memcachefoo
./postconf: warning: ./main.cf: unused parameter: mysqlxx=proxy:mysql:mysqlfoo
./postconf: warning: ./main.cf: unused parameter: ldapxx=proxy:ldap:ldapfoo
./postconf: warning: ./main.cf: unused parameter: ldapfoo_domainx=bar
./postconf: warning: ./main.cf: unused parameter: pgsqlfoo_domainx=bar
./postconf: warning: ./main.cf: unused parameter: mysqlfoo_domainx=bar

View File

@ -48,7 +48,7 @@
/* Expand macros in lookup results. This should never be done with
/* data whose origin is untrusted.
/* .IP MAC_EXP_FLAG_APPEND
/* Append text to the result buffer.
/* Append text to the result buffer without truncating it.
/* .IP MAC_EXP_FLAG_SCAN
/* Invoke the call-back function each macro name in the input
/* string, including macro names in the values of conditional

View File

@ -1432,6 +1432,10 @@ typedef int WAIT_STATUS_T;
#undef HAVE_POSIX_GETPW_R
#endif
#ifdef NO_DB
#undef HAS_DB
#endif
#ifndef OCTAL_TO_UNSIGNED
#define OCTAL_TO_UNSIGNED(res, str) ((res) = strtoul((str), (char **) 0, 8))
#endif