1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
/*++
/* NAME
/* mail_dict 3
/* SUMMARY
/* register application-specific dictionaries
/* SYNOPSIS
/* #include <mail_dict.h>
/*
/* void mail_dict_init()
/* DESCRIPTION
/* This module registers dictionary types that depend on higher-level
/* Postfix-specific interfaces and protocols.
/*
/* This also initializes the support for run-time loading of
/* lookup tables, if applicable.
/*
/* The latter requires basic parameter initialization
/* by either mail_conf_read() or mail_params_init().
/* 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>
/* Utility library. */
#include <dict.h>
#include <msg.h>
#include <mymalloc.h>
#include <stringops.h>
#include <dynamicmaps.h>
/* Global library. */
#include <dict_proxy.h>
#include <dict_ldap.h>
#include <dict_mysql.h>
#include <dict_pgsql.h>
#include <dict_sqlite.h>
#include <dict_memcache.h>
#include <mail_dict.h>
#include <mail_params.h>
#include <mail_dict.h>
typedef struct {
char *type;
struct DICT *(*open) (const char *, int, int);
} DICT_OPEN_INFO;
static const DICT_OPEN_INFO dict_open_info[] = {
DICT_TYPE_PROXY, dict_proxy_open,
#ifndef USE_DYNAMIC_MAPS
#ifdef HAS_LDAP
DICT_TYPE_LDAP, dict_ldap_open,
#endif
#ifdef HAS_MYSQL
DICT_TYPE_MYSQL, dict_mysql_open,
#endif
#ifdef HAS_PGSQL
DICT_TYPE_PGSQL, dict_pgsql_open,
#endif
#ifdef HAS_SQLITE
DICT_TYPE_SQLITE, dict_sqlite_open,
#endif
#endif /* !USE_DYNAMIC_MAPS */
DICT_TYPE_MEMCACHE, dict_memcache_open,
0,
};
/* mail_dict_init - dictionaries that depend on Postfix-specific interfaces */
void mail_dict_init(void)
{
const DICT_OPEN_INFO *dp;
#ifdef USE_DYNAMIC_MAPS
char *path;
path = concatenate(var_meta_dir, "/", "dynamicmaps.cf",
#ifdef SHLIB_VERSION
".", SHLIB_VERSION,
#endif
(char *) 0);
dymap_init(path, var_shlib_dir);
myfree(path);
#endif
for (dp = dict_open_info; dp->type; dp++)
dict_open_register(dp->type, dp->open);
}
#ifdef TEST
/*
* Proof-of-concept test program.
*/
#include <mail_proto.h>
#include <mail_params.h>
int main(int argc, char **argv)
{
var_queue_dir = DEF_QUEUE_DIR;
var_proxymap_service = DEF_PROXYMAP_SERVICE;
var_proxywrite_service = DEF_PROXYWRITE_SERVICE;
var_ipc_timeout = 3600;
mail_dict_init();
dict_test(argc, argv);
return (0);
}
#endif
|