7
7
/* #include <postconf.h>
9
/* void register_dbms_parameters(param_value, flag_parameter,
9
/* void pcf_register_dbms_parameters(param_value, flag_parameter,
11
11
/* const char *param_value;
12
/* const char *(flag_parameter) (const char *, int, PC_MASTER_ENT *);
13
/* PC_MASTER_ENT *local_scope;
12
/* const char *(flag_parameter) (const char *, int, PCF_MASTER_ENT *);
13
/* PCF_MASTER_ENT *local_scope;
15
15
/* This module implements legacy support for database configuration
16
16
/* where main.cf parameter names are generated by prepending
25
25
/* names for that database type.
26
26
/* .IP flag_parameter
27
27
/* A function that takes as arguments a candidate parameter
28
/* name, parameter flags, and a PC_MASTER_ENT pointer. The
28
/* name, parameter flags, and a PCF_MASTER_ENT pointer. The
29
29
/* function will flag the parameter as "used" if it has a
30
30
/* "name=value" entry in the local or global namespace.
84
84
/* See ldap_table(5). */
86
static const char *ldap_suffixes[] = {
86
static const char *pcf_ldap_suffixes[] = {
87
87
"bind", "bind_dn", "bind_pw", "cache", "cache_expiry", "cache_size",
88
88
"chase_referrals", "debuglevel", "dereference", "domain",
89
89
"expansion_limit", "leaf_result_attribute", "query_filter",
96
96
/* See mysql_table(5). */
98
static const char *mysql_suffixes[] = {
98
static const char *pcf_mysql_suffixes[] = {
99
99
"additional_conditions", "dbname", "domain", "expansion_limit",
100
100
"hosts", "password", "query", "result_format", "select_field",
101
101
"table", "user", "where_field", 0,
104
104
/* See pgsql_table(5). */
106
static const char *pgsql_suffixes[] = {
106
static const char *pcf_pgsql_suffixes[] = {
107
107
"additional_conditions", "dbname", "domain", "expansion_limit",
108
108
"hosts", "password", "query", "result_format", "select_field",
109
109
"select_function", "table", "user", "where_field", 0,
112
112
/* See sqlite_table(5). */
114
static const char *sqlite_suffixes[] = {
114
static const char *pcf_sqlite_suffixes[] = {
115
115
"additional_conditions", "dbpath", "domain", "expansion_limit",
116
116
"query", "result_format", "select_field", "table", "where_field",
120
120
/* See memcache_table(5). */
122
static const char *memcache_suffixes[] = {
122
static const char *pcf_memcache_suffixes[] = {
123
123
"backup", "data_size_limit", "domain", "flags", "key_format",
124
124
"line_size_limit", "max_try", "memcache", "retry_pause",
125
125
"timeout", "ttl", 0,
132
132
const char *db_type;
133
133
const char **db_suffixes;
136
static const PC_DBMS_INFO dbms_info[] = {
137
DICT_TYPE_LDAP, ldap_suffixes,
138
DICT_TYPE_MYSQL, mysql_suffixes,
139
DICT_TYPE_PGSQL, pgsql_suffixes,
140
DICT_TYPE_SQLITE, sqlite_suffixes,
141
DICT_TYPE_MEMCACHE, memcache_suffixes,
136
static const PCF_DBMS_INFO pcf_dbms_info[] = {
137
DICT_TYPE_LDAP, pcf_ldap_suffixes,
138
DICT_TYPE_MYSQL, pcf_mysql_suffixes,
139
DICT_TYPE_PGSQL, pcf_pgsql_suffixes,
140
DICT_TYPE_SQLITE, pcf_sqlite_suffixes,
141
DICT_TYPE_MEMCACHE, pcf_memcache_suffixes,
145
/* register_dbms_parameters - look for database_type:prefix_name */
145
/* pcf_register_dbms_parameters - look for database_type:prefix_name */
147
void register_dbms_parameters(const char *param_value,
148
const char *(flag_parameter) (const char *, int, PC_MASTER_ENT *),
149
PC_MASTER_ENT *local_scope)
147
void pcf_register_dbms_parameters(const char *param_value,
148
const char *(flag_parameter) (const char *, int, PCF_MASTER_ENT *),
149
PCF_MASTER_ENT *local_scope)
151
const PC_DBMS_INFO *dp;
151
const PCF_DBMS_INFO *dp;
165
165
buffer = vstring_alloc(100);
166
bufp = expand_parameter_value(buffer, SHOW_EVAL, param_value, local_scope);
166
bufp = pcf_expand_parameter_value(buffer, PCF_SHOW_EVAL, param_value,
169
170
* Naive parsing. We don't really know if the parameter specifies free
187
188
* local or global namespace.
189
190
if (prefix != 0 && *prefix != '/' && *prefix != '.') {
190
for (dp = dbms_info; dp->db_type != 0; dp++) {
191
for (dp = pcf_dbms_info; dp->db_type != 0; dp++) {
191
192
if (strcmp(db_type, dp->db_type) == 0) {
192
193
for (cpp = dp->db_suffixes; *cpp; cpp++) {
193
194
vstring_sprintf(candidate ? candidate :
194
195
(candidate = vstring_alloc(30)),
195
196
"%s_%s", prefix, *cpp);
196
197
flag_parameter(STR(candidate),
197
PC_PARAM_FLAG_DBMS | PC_PARAM_FLAG_USER,
198
PCF_PARAM_FLAG_DBMS | PCF_PARAM_FLAG_USER,