]>
Commit | Line | Data |
---|---|---|
bf21c84b JK |
1 | diff -durN postfix-2.1.3.orig/src/dns/Makefile.in postfix-2.1.3/src/dns/Makefile.in |
2 | --- postfix-2.1.3.orig/src/dns/Makefile.in 2004-04-22 21:37:34.000000000 +0200 | |
3 | +++ postfix-2.1.3/src/dns/Makefile.in 2004-06-22 15:39:24.242860389 +0200 | |
4 | @@ -12,7 +12,7 @@ | |
9d756e3c JB |
5 | LIB_DIR = ../../lib |
6 | INC_DIR = ../../include | |
7 | ||
8 | -.c.o:; $(CC) $(CFLAGS) -c $*.c | |
9 | +.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c | |
10 | ||
11 | all: $(LIB) | |
12 | ||
bf21c84b | 13 | @@ -24,12 +24,10 @@ |
0b72d562 | 14 | tests: test |
9d756e3c JB |
15 | |
16 | $(LIB): $(OBJS) | |
17 | - $(AR) $(ARFL) $(LIB) $? | |
18 | - $(RANLIB) $(LIB) | |
19 | + gcc -shared -Wl,-soname,libpostfix-dns.so.1 -o $(LIB) $(OBJS) | |
20 | ||
21 | $(LIB_DIR)/$(LIB): $(LIB) | |
22 | cp $(LIB) $(LIB_DIR) | |
23 | - $(RANLIB) $(LIB_DIR)/$(LIB) | |
24 | ||
25 | update: $(LIB_DIR)/$(LIB) $(HDRS) | |
26 | -for i in $(HDRS); \ | |
bf21c84b JK |
27 | diff -durN postfix-2.1.3.orig/src/global/Makefile.in postfix-2.1.3/src/global/Makefile.in |
28 | --- postfix-2.1.3.orig/src/global/Makefile.in 2004-06-22 15:38:56.931476412 +0200 | |
29 | +++ postfix-2.1.3/src/global/Makefile.in 2004-06-22 15:39:56.167971280 +0200 | |
30 | @@ -29,7 +29,7 @@ | |
31 | canon_addr.o cfg_parser.o cleanup_strerror.o cleanup_strflags.o \ | |
32 | clnt_stream.o debug_peer.o debug_process.o defer.o \ | |
33 | deliver_completed.o deliver_flock.o deliver_pass.o deliver_request.o \ | |
34 | - dict_ldap.o dict_mysql.o dict_pgsql.o dict_proxy.o domain_list.o \ | |
35 | + dict_proxy.o domain_list.o \ | |
36 | dot_lockfile.o dot_lockfile_as.o ext_prop.o file_id.o flush_clnt.o \ | |
37 | header_opts.o header_token.o hold_message.o input_transp.o \ | |
38 | is_header.o log_adhoc.o mail_addr.o mail_addr_crunch.o \ | |
39 | @@ -90,8 +90,11 @@ | |
40 | LIB_DIR = ../../lib | |
41 | INC_DIR = ../../include | |
42 | MAKES = | |
43 | +LDAPSO = dict_ldap.so | |
44 | +MYSQLSO = dict_mysql.so | |
45 | +PGSQLSO = dict_pgsql.so | |
46 | ||
47 | -.c.o:; $(CC) $(CFLAGS) -c $*.c | |
48 | +.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c | |
49 | ||
50 | all: $(LIB) | |
51 | ||
52 | @@ -101,14 +104,30 @@ | |
53 | test: $(TESTPROG) | |
54 | ||
55 | $(LIB): $(OBJS) | |
56 | - $(AR) $(ARFL) $(LIB) $? | |
57 | - $(RANLIB) $(LIB) | |
58 | + gcc -shared -Wl,-soname,libpostfix-global.so.1 -o $(LIB) $(OBJS) | |
59 | + | |
60 | +$(LDAPSO): dict_ldap.o | |
61 | + gcc -shared -Wl,-soname,dict_ldap.so -o $@ $? -lldap -llber -L../../lib -lutil -L. -lglobal | |
62 | + | |
63 | +$(MYSQLSO): dict_mysql.o | |
64 | + gcc -shared -Wl,-soname,dict_ldap.so -o $@ $? -lmysqlclient -L../../lib -lutil -L. -lglobal | |
65 | + | |
66 | +$(PGSQLSO): dict_pgsql.o | |
67 | + gcc -shared -Wl,-soname,dict_ldap.so -o $@ $? -lpq -L../../lib -lutil -L. -lglobal | |
68 | ||
69 | $(LIB_DIR)/$(LIB): $(LIB) | |
70 | cp $(LIB) $(LIB_DIR) | |
71 | - $(RANLIB) $(LIB_DIR)/$(LIB) | |
72 | ||
73 | -update: $(LIB_DIR)/$(LIB) $(HDRS) | |
74 | +$(LIB_DIR)/$(LDAPSO): $(LDAPSO) | |
75 | + cp $(LDAPSO) $(LIB_DIR) | |
76 | + | |
77 | +$(LIB_DIR)/$(MYSQLSO): $(MYSQLSO) | |
78 | + cp $(MYSQLSO) $(LIB_DIR) | |
79 | + | |
80 | +$(LIB_DIR)/$(PGSQLSO): $(PGSQLSO) | |
81 | + cp $(PGSQLSO) $(LIB_DIR) | |
82 | + | |
83 | +update: $(LIB_DIR)/$(LIB) $(LIB_DIR)/${LDAPSO} $(LIB_DIR)/${MYSQLSO} $(LIB_DIR)/${PGSQLSO} $(HDRS) | |
84 | -for i in $(HDRS); \ | |
85 | do \ | |
86 | cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \ | |
87 | @@ -360,7 +379,7 @@ | |
88 | lint $(DEFS) $(SRCS) $(LINTFIX) | |
89 | ||
90 | clean: | |
91 | - rm -f *.o $(LIB) *core $(TESTPROG) junk | |
92 | + rm -f *.o $(LIB) $(LDAPSO) $(MYSQLSO) $(PGSQLSO) *core $(TESTPROG) junk | |
93 | rm -rf printfck | |
94 | ||
95 | tidy: clean | |
96 | @@ -575,6 +594,8 @@ | |
97 | dict_proxy.o: mail_params.h | |
98 | dict_proxy.o: clnt_stream.h | |
99 | dict_proxy.o: dict_proxy.h | |
100 | +dict_ldap.o: dict_ldap.c | |
101 | +dict_ldap.o: ../../include/sys_defs.h | |
102 | domain_list.o: domain_list.c | |
103 | domain_list.o: ../../include/sys_defs.h | |
104 | domain_list.o: ../../include/match_list.h | |
105 | diff -durN postfix-2.1.3.orig/src/global/mail_conf.c postfix-2.1.3/src/global/mail_conf.c | |
106 | --- postfix-2.1.3.orig/src/global/mail_conf.c 2004-04-10 16:52:51.000000000 +0200 | |
107 | +++ postfix-2.1.3/src/global/mail_conf.c 2004-06-22 15:39:24.247860093 +0200 | |
9d756e3c JB |
108 | @@ -175,6 +175,13 @@ |
109 | path = concatenate(var_config_dir, "/", "main.cf", (char *) 0); | |
110 | dict_load_file(CONFIG_DICT, path); | |
111 | myfree(path); | |
112 | + | |
113 | +#ifndef NO_DYNAMIC_MAPS | |
114 | + path = concatenate(var_config_dir, "/", "dynamicmaps.cf", (char *) 0); | |
115 | + dict_open_dlinfo(path); | |
116 | + myfree(path); | |
117 | +#endif | |
118 | + | |
119 | } | |
120 | ||
121 | /* mail_conf_eval - expand macros in string */ | |
bf21c84b JK |
122 | diff -durN postfix-2.1.3.orig/src/global/mail_params.c postfix-2.1.3/src/global/mail_params.c |
123 | --- postfix-2.1.3.orig/src/global/mail_params.c 2004-06-22 15:38:57.219459372 +0200 | |
124 | +++ postfix-2.1.3/src/global/mail_params.c 2004-06-22 15:39:24.248860034 +0200 | |
125 | @@ -154,6 +154,8 @@ | |
7e195e4d TO |
126 | #ifdef HAS_DB |
127 | #include <dict_db.h> | |
128 | #endif | |
9d756e3c JB |
129 | +#include <safe_open.h> |
130 | +#include <mymalloc.h> | |
0b72d562 | 131 | |
9d756e3c | 132 | /* Global library. */ |
0b72d562 | 133 | |
bf21c84b | 134 | @@ -270,6 +272,7 @@ |
9d756e3c JB |
135 | char *var_debug_peer_list; |
136 | int var_debug_peer_level; | |
137 | char *var_reject_reply_msg_access_denied; | |
138 | +int var_command_maxtime; | |
139 | int var_fault_inj_code; | |
0b72d562 | 140 | char *var_bounce_service; |
141 | char *var_cleanup_service; | |
bf21c84b | 142 | @@ -456,6 +459,38 @@ |
9d756e3c JB |
143 | (long) var_sgid_gid); |
144 | } | |
145 | ||
146 | +static char *read_file(const char *name) | |
147 | +{ | |
148 | + char *ret; | |
149 | + VSTRING *why=vstring_alloc(1); | |
150 | + VSTRING *new_name=vstring_alloc(1); | |
151 | + VSTREAM *vp=safe_open(name, O_RDONLY, 0, NULL, -1, -1, why); | |
152 | + | |
153 | + /* | |
154 | + * Ugly macros to make complex expressions less unreadable. | |
155 | + */ | |
156 | +#define SKIP(start, var, cond) \ | |
157 | + for (var = start; *var && (cond); var++); | |
158 | + | |
159 | +#define TRIM(s) { \ | |
160 | + char *p; \ | |
161 | + for (p = (s) + strlen(s); p > (s) && ISSPACE(p[-1]); p--); \ | |
162 | + *p = 0; \ | |
163 | + } | |
164 | + | |
165 | + if (!vp) { | |
166 | + msg_fatal("%s: unable to open: %s",name,vstring_str(why)); | |
167 | + } | |
168 | + vstring_get_nonl(new_name,vp); | |
169 | + vstream_fclose(vp); | |
170 | + SKIP(vstring_str(new_name),ret,ISSPACE(*ret)); | |
171 | + ret=mystrdup(ret); | |
172 | + TRIM(ret); | |
173 | + vstring_free(why); | |
174 | + vstring_free(new_name); | |
175 | + return ret; | |
176 | +} | |
177 | + | |
178 | /* mail_params_init - configure built-in parameters */ | |
179 | ||
180 | void mail_params_init() | |
bf21c84b | 181 | @@ -632,6 +667,9 @@ |
9d756e3c JB |
182 | * Variables that are needed by almost every program. |
183 | */ | |
184 | get_mail_conf_str_table(other_str_defaults); | |
185 | + if (*var_myorigin=='/') { | |
186 | + var_myorigin=read_file(var_myorigin); | |
187 | + } | |
188 | get_mail_conf_int_table(other_int_defaults); | |
189 | get_mail_conf_bool_table(bool_defaults); | |
190 | get_mail_conf_time_table(time_defaults); | |
bf21c84b JK |
191 | diff -durN postfix-2.1.3.orig/src/master/Makefile.in postfix-2.1.3/src/master/Makefile.in |
192 | --- postfix-2.1.3.orig/src/master/Makefile.in 2004-04-22 21:37:35.000000000 +0200 | |
193 | +++ postfix-2.1.3/src/master/Makefile.in 2004-06-22 15:39:24.249859975 +0200 | |
194 | @@ -20,7 +20,7 @@ | |
195 | INC_DIR = ../../include | |
196 | BIN_DIR = ../../libexec | |
197 | ||
198 | -.c.o:; $(CC) $(CFLAGS) -c $*.c | |
199 | +.c.o:; $(CC) `for i in $(LIB_OBJ); do [ $$i = $@ ] && echo -fPIC; done` $(CFLAGS) -c $*.c | |
200 | ||
201 | all: $(PROG) $(LIB) | |
202 | ||
203 | @@ -35,12 +35,10 @@ | |
204 | tests: test | |
205 | ||
206 | $(LIB): $(LIB_OBJ) | |
207 | - $(AR) $(ARFL) $(LIB) $? | |
208 | - $(RANLIB) $(LIB) | |
209 | + gcc -shared -Wl,-soname,libpostfix-master.so.1 -o $(LIB) $(LIB_OBJ) | |
210 | ||
211 | $(LIB_DIR)/$(LIB): $(LIB) | |
212 | cp $(LIB) $(LIB_DIR)/$(LIB) | |
213 | - $(RANLIB) $(LIB_DIR)/$(LIB) | |
214 | ||
215 | $(BIN_DIR)/$(PROG): $(PROG) | |
216 | cp $(PROG) $(BIN_DIR) | |
f00c1e4c JB |
217 | --- postfix-2.2.2/src/util/Makefile.in.orig 2005-03-11 16:14:00.000000000 +0100 |
218 | +++ postfix-2.2.2/src/util/Makefile.in 2005-04-26 11:45:19.000000000 +0200 | |
219 | @@ -30,13 +30,13 @@ | |
bf21c84b | 220 | attr_print_plain.c sane_connect.c neuter.c name_code.c \ |
f00c1e4c JB |
221 | uppercase.c unix_recv_fd.c stream_recv_fd.c unix_send_fd.c \ |
222 | stream_send_fd.c dict_sdbm.c hex_code.c dummy_read.c dummy_write.c \ | |
223 | - myaddrinfo.c sock_addr.c inet_proto.c cidr_match.c mask_addr.c | |
224 | + myaddrinfo.c sock_addr.c inet_proto.c cidr_match.c mask_addr.c load_lib.c | |
bf21c84b JK |
225 | OBJS = alldig.o argv.o argv_split.o attr_print0.o attr_print64.o \ |
226 | attr_scan0.o attr_scan64.o base64_code.o basename.o binhash.o \ | |
227 | chroot_uid.o clean_env.o close_on_exec.o concatenate.o ctable.o \ | |
f00c1e4c | 228 | dict.o dict_alloc.o dict_db.o dict_cdb.o dict_dbm.o dict_debug.o dict_env.o \ |
bf21c84b JK |
229 | dict_cidr.o dict_ht.o dict_ni.o dict_nis.o \ |
230 | - dict_nisplus.o dict_open.o dict_pcre.o dict_regexp.o \ | |
231 | + dict_nisplus.o dict_open.o dict_regexp.o \ | |
232 | dict_static.o dict_tcp.o dict_unix.o dir_forest.o doze.o \ | |
233 | duplex_pipe.o environ.o events.o exec_command.o fifo_listen.o \ | |
234 | fifo_trigger.o file_limit.o find_inet.o fsspace.o fullname.o \ | |
f00c1e4c | 235 | @@ -62,7 +62,7 @@ |
bf21c84b | 236 | attr_print_plain.o sane_connect.o $(STRCASE) neuter.o name_code.o \ |
f00c1e4c JB |
237 | uppercase.o unix_recv_fd.o stream_recv_fd.o unix_send_fd.o \ |
238 | stream_send_fd.o dict_sdbm.o hex_code.o dummy_read.o dummy_write.o \ | |
239 | - myaddrinfo.o sock_addr.o inet_proto.o cidr_match.o mask_addr.o | |
240 | + myaddrinfo.o sock_addr.o inet_proto.o cidr_match.o mask_addr.o load_lib.o | |
bf21c84b | 241 | HDRS = argv.h attr.h base64_code.h binhash.h chroot_uid.h clean_env.h \ |
f00c1e4c | 242 | connect.h ctable.h dict.h dict_db.h dict_cdb.h dict_dbm.h dict_env.h \ |
bf21c84b | 243 | dict_cidr.h dict_ht.h dict_ni.h dict_nis.h \ |
f00c1e4c | 244 | @@ -83,13 +83,14 @@ |
bf21c84b | 245 | vbuf_print.h vstream.h vstring.h vstring_vstream.h watchdog.h \ |
f00c1e4c JB |
246 | auto_clnt.h attr_clnt.h sane_connect.h name_code.h dict_sdbm.h \ |
247 | hex_code.h myaddrinfo.h sock_addr.h inet_proto.h cidr_match.h \ | |
248 | - mask_addr.h | |
249 | + mask_addr.h load_lib.h | |
bf21c84b JK |
250 | TESTSRC = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \ |
251 | stream_test.c dup2_pass_on_exec.c | |
252 | DEFS = -I. -D$(SYSTYPE) | |
253 | CFLAGS = $(DEBUG) $(OPT) $(DEFS) | |
254 | FILES = Makefile $(SRCS) $(HDRS) | |
255 | INCL = | |
f00c1e4c | 256 | +PCRESO = dict_pcre.so |
bf21c84b JK |
257 | LIB = libutil.a |
258 | TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \ | |
259 | fifo_rdonly_bug fifo_rdwr_bug fifo_trigger fsspace fullname \ | |
f00c1e4c | 260 | @@ -104,8 +105,9 @@ |
bf21c84b | 261 | |
9d756e3c JB |
262 | LIB_DIR = ../../lib |
263 | INC_DIR = ../../include | |
bf21c84b | 264 | +LIBS = $(LIB_DIR)/$(LIB) $(LIB_DIR)/$(PCRESO) |
9d756e3c JB |
265 | |
266 | -.c.o:; $(CC) $(CFLAGS) -c $*.c | |
267 | +.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c | |
268 | ||
269 | all: $(LIB) | |
270 | ||
f00c1e4c | 271 | @@ -114,15 +116,19 @@ |
bf21c84b | 272 | |
9d756e3c JB |
273 | test: $(TESTPROG) |
274 | ||
bf21c84b JK |
275 | +$(PCRESO): dict_pcre.o |
276 | + gcc -shared -Wl,-soname,dict_pcre.so -o $@ $? -lpcre -L. -lutil | |
277 | + | |
9d756e3c JB |
278 | $(LIB): $(OBJS) |
279 | - $(AR) $(ARFL) $(LIB) $? | |
280 | - $(RANLIB) $(LIB) | |
bf21c84b | 281 | + gcc -shared -Wl,-soname,libpostfix-util.so.1 -o $(LIB) $(OBJS) -ldl |
9d756e3c JB |
282 | |
283 | $(LIB_DIR)/$(LIB): $(LIB) | |
284 | cp $(LIB) $(LIB_DIR) | |
285 | - $(RANLIB) $(LIB_DIR)/$(LIB) | |
286 | ||
287 | -update: $(LIB_DIR)/$(LIB) $(HDRS) | |
bf21c84b JK |
288 | +$(LIB_DIR)/$(PCRESO): $(PCRESO) |
289 | + cp $(PCRESO) $(LIB_DIR) | |
9d756e3c | 290 | + |
bf21c84b | 291 | +update: $(LIBS) $(HDRS) |
9d756e3c JB |
292 | -for i in $(HDRS); \ |
293 | do \ | |
294 | cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \ | |
f00c1e4c | 295 | @@ -144,7 +150,8 @@ |
bf21c84b | 296 | lint $(SRCS) |
9d756e3c JB |
297 | |
298 | clean: | |
bf21c84b JK |
299 | - rm -f *.o $(LIB) *core $(TESTPROG) junk $(MAKES) *.tmp |
300 | + rm -f *.o $(LIB) $(PCRESO) *core $(TESTPROG) \ | |
301 | + junk $(MAKES) *.tmp | |
9d756e3c JB |
302 | rm -rf printfck |
303 | ||
304 | tidy: clean | |
bf21c84b JK |
305 | diff -durN postfix-2.1.3.orig/src/util/dict.h postfix-2.1.3/src/util/dict.h |
306 | --- postfix-2.1.3.orig/src/util/dict.h 2003-07-03 17:04:13.000000000 +0200 | |
307 | +++ postfix-2.1.3/src/util/dict.h 2004-06-22 15:39:24.253859738 +0200 | |
308 | @@ -82,6 +82,20 @@ | |
9d756e3c JB |
309 | */ |
310 | extern ARGV *dict_mapnames(void); | |
311 | ||
312 | +#ifndef NO_DYNAMIC_MAPS | |
313 | + /* | |
314 | + * Interface for dynamic map loading. | |
315 | + */ | |
316 | +typedef struct { | |
317 | + const char *pattern; | |
318 | + const char *soname; | |
319 | + const char *openfunc; | |
320 | +} DLINFO; | |
321 | + | |
322 | +extern void dict_open_dlinfo(const char *path); | |
323 | +extern DLINFO *dict_open_dlfind(const char *type); | |
324 | +#endif | |
325 | + | |
326 | /* | |
327 | * High-level interface, with logical dictionary names. | |
328 | */ | |
bf21c84b JK |
329 | diff -durN postfix-2.1.3.orig/src/util/dict_open.c postfix-2.1.3/src/util/dict_open.c |
330 | --- postfix-2.1.3.orig/src/util/dict_open.c 2004-06-22 15:38:57.069468247 +0200 | |
331 | +++ postfix-2.1.3/src/util/dict_open.c 2004-06-22 15:39:24.254859679 +0200 | |
0b72d562 | 332 | @@ -158,6 +158,9 @@ |
9d756e3c JB |
333 | #include <strings.h> |
334 | #endif | |
335 | ||
336 | +#include <sys/stat.h> | |
337 | +#include <unistd.h> | |
338 | + | |
339 | /* Utility library. */ | |
340 | ||
341 | #include <argv.h> | |
d3456591 | 342 | @@ -181,6 +184,14 @@ |
9d756e3c JB |
343 | #include <split_at.h> |
344 | #include <htable.h> | |
345 | ||
346 | +#ifndef NO_DYNAMIC_MAPS | |
347 | +#include <load_lib.h> | |
348 | +#include <vstring.h> | |
349 | +#include <vstream.h> | |
350 | +#include <vstring_vstream.h> | |
351 | +#include <mvect.h> | |
352 | +#endif | |
353 | + | |
354 | /* | |
355 | * lookup table for available map types. | |
356 | */ | |
d3456591 | 357 | @@ -212,9 +223,11 @@ |
9d756e3c JB |
358 | #ifdef HAS_NETINFO |
359 | DICT_TYPE_NETINFO, dict_ni_open, | |
360 | #endif | |
361 | +#ifndef MAX_DYNAMIC_MAPS | |
9d756e3c JB |
362 | #ifdef HAS_PCRE |
363 | DICT_TYPE_PCRE, dict_pcre_open, | |
364 | #endif | |
365 | +#endif /* MAX_DYNAMIC_MAPS */ | |
366 | #ifdef HAS_POSIX_REGEXP | |
367 | DICT_TYPE_REGEXP, dict_regexp_open, | |
368 | #endif | |
d3456591 | 369 | @@ -269,8 +282,38 @@ |
9d756e3c JB |
370 | |
371 | if (dict_open_hash == 0) | |
372 | dict_open_init(); | |
373 | - if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0) | |
374 | - msg_fatal("unsupported dictionary type: %s", dict_type); | |
375 | + if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0) { | |
376 | +#ifndef NO_DYNAMIC_MAPS | |
377 | + struct stat st; | |
378 | + VSTRING *lib, *func; | |
379 | + LIB_FN fn[2]; | |
380 | + DICT *(*open) (const char *, int, int); | |
381 | + DLINFO *dl=dict_open_dlfind(dict_type); | |
382 | + if (!dl) | |
383 | +#endif | |
384 | + msg_fatal("%s: unsupported dictionary type: %s", myname, dict_type); | |
385 | +#ifndef NO_DYNAMIC_MAPS | |
386 | + lib=vstring_alloc(1); | |
387 | + vstring_sprintf(lib,dl->soname,dict_type); | |
388 | + if (stat(vstring_str(lib),&st) < 0) { | |
389 | + msg_fatal("%s: unsupported dictionary type: %s (%s not found. Is the postfix-%s package installed?)", | |
390 | + myname, dict_type, vstring_str(lib), dict_type); | |
391 | + } | |
392 | + func=vstring_alloc(1); | |
393 | + vstring_sprintf(func,dl->openfunc,dict_type); | |
394 | + fn[0].name = vstring_str(func); | |
395 | + fn[0].ptr = (void**)&open; | |
396 | + fn[1].name = NULL; | |
397 | + load_library_symbols(vstring_str(lib), fn, NULL); | |
398 | + dict_open_register(dict_type, open); | |
399 | + dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type); | |
400 | + vstring_free(lib); | |
401 | + vstring_free(func); | |
402 | +#endif | |
403 | + } | |
404 | + if (msg_verbose>1) { | |
405 | + msg_info("%s: calling %s open routine",myname,dict_type); | |
406 | + } | |
407 | if ((dict = dp->open(dict_name, open_flags, dict_flags)) == 0) | |
408 | msg_fatal("opening %s:%s %m", dict_type, dict_name); | |
409 | if (msg_verbose) | |
d3456591 | 410 | @@ -317,6 +360,76 @@ |
9d756e3c JB |
411 | return mapnames; |
412 | } | |
0b72d562 | 413 | |
9d756e3c JB |
414 | +#ifndef NO_DYNAMIC_MAPS |
415 | +static DLINFO *dict_dlinfo; | |
416 | + | |
417 | +void dict_open_dlinfo(const char *path) | |
418 | +{ | |
419 | + char *myname="dict_open_dlinfo"; | |
420 | + VSTREAM *conf_fp=vstream_fopen(path,O_RDONLY,0); | |
421 | + VSTRING *buf = vstring_alloc(100); | |
422 | + char *cp; | |
423 | + ARGV *argv; | |
424 | + MVECT vector; | |
425 | + int nelm=0; | |
426 | + int linenum=0; | |
427 | + | |
428 | + dict_dlinfo=(DLINFO*)mvect_alloc(&vector,sizeof(DLINFO),3,NULL,NULL); | |
429 | + | |
430 | + if (!conf_fp) { | |
431 | + msg_warn("%s: cannot open %s. No dynamic maps will be allowed.", | |
432 | + myname, path); | |
433 | + } else { | |
434 | + while (vstring_get_nonl(buf,conf_fp) != VSTREAM_EOF) { | |
435 | + cp = vstring_str(buf); | |
436 | + linenum++; | |
437 | + if (*cp == '#' || *cp == '\0') | |
438 | + continue; | |
439 | + argv = argv_split(cp, " \t"); | |
440 | + if (argv->argc != 3) { | |
441 | + msg_fatal("%s: Expected \"pattern .so-name function\" at line %d", | |
442 | + myname, linenum); | |
443 | + } | |
444 | + if (argv->argv[1][0] != '/') { | |
445 | + msg_fatal("%s: .so name must begin with a \"/\" at line %d", | |
446 | + myname, linenum); | |
447 | + } | |
448 | + if (nelm >= vector.nelm) { | |
449 | + dict_dlinfo=(DLINFO*)mvect_realloc(&vector,vector.nelm+3); | |
450 | + } | |
451 | + dict_dlinfo[nelm].pattern = mystrdup(argv->argv[0]); | |
452 | + dict_dlinfo[nelm].soname = mystrdup(argv->argv[1]); | |
453 | + dict_dlinfo[nelm].openfunc = mystrdup(argv->argv[2]); | |
454 | + nelm++; | |
455 | + argv_free(argv); | |
456 | + } | |
457 | + } | |
458 | + if (nelm >= vector.nelm) { | |
459 | + dict_dlinfo=(DLINFO*)mvect_realloc(&vector,vector.nelm+1); | |
460 | + } | |
461 | + dict_dlinfo[nelm].pattern = NULL; | |
462 | + dict_dlinfo[nelm].soname = NULL; | |
463 | + dict_dlinfo[nelm].openfunc = NULL; | |
464 | + if (conf_fp) | |
465 | + vstream_fclose(conf_fp); | |
466 | + vstring_free(buf); | |
467 | +} | |
468 | + | |
469 | +DLINFO *dict_open_dlfind(const char *type) | |
470 | +{ | |
471 | + DLINFO *dp; | |
472 | + | |
473 | + if (!dict_dlinfo) | |
474 | + return NULL; | |
475 | + | |
476 | + for (dp=dict_dlinfo; dp->pattern; dp++) { | |
477 | + if (strcmp(dp->pattern,type)==0 || strcmp(dp->pattern,"*")==0) | |
478 | + return dp; | |
479 | + } | |
480 | + return NULL; | |
481 | +} | |
482 | +#endif /* !NO_DYNAMIC_MAPS */ | |
0b72d562 | 483 | + |
9d756e3c JB |
484 | #ifdef TEST |
485 | ||
0b72d562 | 486 | /* |
bf21c84b JK |
487 | diff -durN postfix-2.1.3.orig/src/util/load_lib.c postfix-2.1.3/src/util/load_lib.c |
488 | --- postfix-2.1.3.orig/src/util/load_lib.c 1970-01-01 01:00:00.000000000 +0100 | |
489 | +++ postfix-2.1.3/src/util/load_lib.c 2004-06-22 15:39:24.257859501 +0200 | |
9d756e3c JB |
490 | @@ -0,0 +1,135 @@ |
491 | +/*++ | |
492 | +/* NAME | |
493 | +/* load_lib 3 | |
494 | +/* SUMMARY | |
495 | +/* library loading wrappers | |
496 | +/* SYNOPSIS | |
497 | +/* #include <load_lib.h> | |
498 | +/* | |
499 | +/* extern int load_library_symbols(const char *, LIB_FN *, LIB_FN *); | |
500 | +/* const char *libname; | |
501 | +/* LIB_FN *libfuncs; | |
502 | +/* LIB_FN *libdata; | |
503 | +/* | |
504 | +/* DESCRIPTION | |
505 | +/* This module loads functions from libraries, returnine pointers | |
506 | +/* to the named functions. | |
507 | +/* | |
508 | +/* load_library_symbols() loads all of the desired functions, and | |
509 | +/* returns zero for success, or exits via msg_fatal(). | |
510 | +/* | |
511 | +/* SEE ALSO | |
512 | +/* msg(3) diagnostics interface | |
513 | +/* DIAGNOSTICS | |
514 | +/* Problems are reported via the msg(3) diagnostics routines: | |
515 | +/* library not found, symbols not found, other fatal errors. | |
516 | +/* LICENSE | |
517 | +/* .ad | |
518 | +/* .fi | |
519 | +/* The Secure Mailer license must be distributed with this software. | |
520 | +/* AUTHOR(S) | |
521 | +/* LaMont Jones | |
522 | +/* Hewlett-Packard Company | |
523 | +/* 3404 Harmony Road | |
524 | +/* Fort Collins, CO 80528, USA | |
525 | +/* | |
526 | +/* Wietse Venema | |
527 | +/* IBM T.J. Watson Research | |
528 | +/* P.O. Box 704 | |
529 | +/* Yorktown Heights, NY 10598, USA | |
530 | +/*--*/ | |
531 | + | |
532 | +/* System libraries. */ | |
533 | + | |
534 | +#include "sys_defs.h" | |
535 | +#include <stdlib.h> | |
536 | +#include <stddef.h> | |
537 | +#include <string.h> | |
538 | +#if defined(HAS_DLOPEN) | |
539 | +#include <dlfcn.h> | |
540 | +#elif defined(HAS_SHL_LOAD) | |
541 | +#include <dl.h> | |
542 | +#endif | |
543 | + | |
544 | +/* Application-specific. */ | |
545 | + | |
546 | +#include "msg.h" | |
547 | +#include "load_lib.h" | |
548 | + | |
549 | +extern int load_library_symbols(const char * libname, LIB_FN * libfuncs, LIB_FN * libdata) | |
550 | +{ | |
551 | + char *myname = "load_library_symbols"; | |
552 | + LIB_FN *fn; | |
553 | + | |
554 | +#if defined(HAS_DLOPEN) | |
555 | + void *handle; | |
556 | + char *emsg; | |
557 | + | |
558 | + handle=dlopen(libname,RTLD_NOW); | |
559 | + emsg=dlerror(); | |
560 | + if (emsg) { | |
561 | + msg_fatal("%s: dlopen failure loading %s: %s", myname, libname, emsg); | |
562 | + } | |
563 | + | |
564 | + if (libfuncs) { | |
565 | + for (fn=libfuncs; fn->name; fn++) { | |
566 | + *(fn->ptr) = dlsym(handle,fn->name); | |
567 | + emsg=dlerror(); | |
568 | + if (emsg) { | |
569 | + msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname, | |
570 | + fn->name, libname, emsg); | |
571 | + } | |
572 | + if (msg_verbose>1) { | |
573 | + msg_info("loaded %s = %lx",fn->name, *((long*)(fn->ptr))); | |
574 | + } | |
575 | + } | |
576 | + } | |
577 | + | |
578 | + if (libdata) { | |
579 | + for (fn=libdata; fn->name; fn++) { | |
580 | + *(fn->ptr) = dlsym(handle,fn->name); | |
581 | + emsg=dlerror(); | |
582 | + if (emsg) { | |
583 | + msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname, | |
584 | + fn->name, libname, emsg); | |
585 | + } | |
586 | + if (msg_verbose>1) { | |
587 | + msg_info("loaded %s = %lx",fn->name, *((long*)(fn->ptr))); | |
588 | + } | |
589 | + } | |
590 | + } | |
591 | +#elif defined(HAS_SHL_LOAD) | |
592 | + shl_t handle; | |
593 | + | |
594 | + handle = shl_load(libname,BIND_IMMEDIATE,0); | |
595 | + | |
596 | + if (libfuncs) { | |
597 | + for (fn=libfuncs; fn->name; fn++) { | |
598 | + if (shl_findsym(&handle,fn->name,TYPE_PROCEDURE,fn->ptr) != 0) { | |
599 | + msg_fatal("%s: shl_findsym failure looking up %s in %s: %m", | |
600 | + myname, fn->name, libname); | |
601 | + } | |
602 | + if (msg_verbose>1) { | |
603 | + msg_info("loaded %s = %x",fn->name, *((long*)(fn->ptr))); | |
604 | + } | |
605 | + } | |
606 | + } | |
607 | + | |
608 | + if (libdata) { | |
609 | + for (fn=libdata; fn->name; fn++) { | |
610 | + if (shl_findsym(&handle,fn->name,TYPE_DATA,fn->ptr) != 0) { | |
611 | + msg_fatal("%s: shl_findsym failure looking up %s in %s: %m", | |
612 | + myname, fn->name, libname); | |
613 | + } | |
614 | + if (msg_verbose>1) { | |
615 | + msg_info("loaded %s = %x",fn->name, *((long*)(fn->ptr))); | |
616 | + } | |
617 | + } | |
618 | + } | |
619 | + | |
620 | +#else | |
621 | + msg_fatal("%s: need dlopen or shl_load support for dynamic libraries", | |
622 | + myname); | |
623 | +#endif | |
624 | + return 0; | |
625 | +} | |
bf21c84b JK |
626 | diff -durN postfix-2.1.3.orig/src/util/load_lib.h postfix-2.1.3/src/util/load_lib.h |
627 | --- postfix-2.1.3.orig/src/util/load_lib.h 1970-01-01 01:00:00.000000000 +0100 | |
628 | +++ postfix-2.1.3/src/util/load_lib.h 2004-06-22 15:39:24.257859501 +0200 | |
9d756e3c JB |
629 | @@ -0,0 +1,41 @@ |
630 | +#ifndef _LOAD_LIB_H_INCLUDED_ | |
631 | +#define _LOAD_LIB_H_INCLUDED_ | |
632 | + | |
633 | +/*++ | |
634 | +/* NAME | |
635 | +/* load_lib 3h | |
636 | +/* SUMMARY | |
637 | +/* library loading wrappers | |
638 | +/* SYNOPSIS | |
639 | +/* #include "load_lib.h" | |
640 | +/* DESCRIPTION | |
641 | +/* .nf | |
642 | + | |
643 | + /* | |
644 | + * External interface. | |
645 | + */ | |
646 | +/* NULL name terminates list */ | |
647 | +typedef struct LIB_FN { | |
648 | + const char *name; | |
649 | + void **ptr; | |
650 | +} LIB_FN; | |
651 | + | |
652 | +extern int load_library_symbols(const char *, LIB_FN *, LIB_FN *); | |
653 | + | |
654 | +/* LICENSE | |
655 | +/* .ad | |
656 | +/* .fi | |
657 | +/* The Secure Mailer license must be distributed with this software. | |
658 | +/* AUTHOR(S) | |
659 | +/* LaMont Jones | |
660 | +/* Hewlett-Packard Company | |
661 | +/* 3404 Harmony Road | |
662 | +/* Fort Collins, CO 80528, USA | |
663 | +/* | |
664 | +/* Wietse Venema | |
665 | +/* IBM T.J. Watson Research | |
666 | +/* P.O. Box 704 | |
667 | +/* Yorktown Heights, NY 10598, USA | |
668 | +/*--*/ | |
669 | + | |
670 | +#endif | |
bf21c84b JK |
671 | diff -durN postfix-2.1.3.orig/src/util/sys_defs.h postfix-2.1.3/src/util/sys_defs.h |
672 | --- postfix-2.1.3.orig/src/util/sys_defs.h 2004-06-22 15:38:57.190461088 +0200 | |
673 | +++ postfix-2.1.3/src/util/sys_defs.h 2004-06-22 15:39:24.255859620 +0200 | |
674 | @@ -560,6 +560,7 @@ | |
9d756e3c JB |
675 | #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT |
676 | #define PREPEND_PLUS_TO_OPTSTRING | |
677 | #define HAS_POSIX_REGEXP | |
678 | +#define HAS_DLOPEN | |
7e195e4d TO |
679 | #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" |
680 | #define NATIVE_MAILQ_PATH "/usr/bin/mailq" | |
681 | #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" | |
bf21c84b | 682 | @@ -596,6 +597,7 @@ |
7e195e4d TO |
683 | #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT /* unverified */ |
684 | #define PREPEND_PLUS_TO_OPTSTRING | |
9d756e3c JB |
685 | #define HAS_POSIX_REGEXP |
686 | +#define HAS_DLOPEN | |
7e195e4d TO |
687 | #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" |
688 | #define NATIVE_MAILQ_PATH "/usr/bin/mailq" | |
689 | #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" | |
bf21c84b | 690 | @@ -638,6 +640,7 @@ |
9d756e3c JB |
691 | #define USE_STATFS |
692 | #define STATFS_IN_SYS_VFS_H | |
693 | #define HAS_POSIX_REGEXP | |
694 | +#define HAS_SHL_LOAD | |
7e195e4d TO |
695 | #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" |
696 | #define NATIVE_MAILQ_PATH "/usr/bin/mailq" | |
697 | #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" | |
bf21c84b | 698 | @@ -673,6 +676,7 @@ |
9d756e3c JB |
699 | #define USE_STATFS |
700 | #define STATFS_IN_SYS_VFS_H | |
701 | #define HAS_POSIX_REGEXP | |
702 | +#define HAS_SHL_LOAD | |
7e195e4d TO |
703 | #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" |
704 | #define NATIVE_MAILQ_PATH "/usr/bin/mailq" | |
705 | #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" | |
bf21c84b JK |
706 | diff -dur postfix-2.1.3.orig/src/global/mail_dict.c postfix-2.1.3/src/global/mail_dict.c |
707 | --- postfix-2.1.3.orig/src/global/mail_dict.c 2004-01-04 19:53:27.000000000 +0100 | |
708 | +++ postfix-2.1.3/src/global/mail_dict.c 2004-06-22 15:47:45.259202712 +0200 | |
709 | @@ -45,15 +45,6 @@ | |
710 | ||
711 | static DICT_OPEN_INFO dict_open_info[] = { | |
712 | DICT_TYPE_PROXY, dict_proxy_open, | |
713 | -#ifdef HAS_LDAP | |
714 | - DICT_TYPE_LDAP, dict_ldap_open, | |
715 | -#endif | |
716 | -#ifdef HAS_MYSQL | |
717 | - DICT_TYPE_MYSQL, dict_mysql_open, | |
718 | -#endif | |
719 | -#ifdef HAS_PGSQL | |
720 | - DICT_TYPE_PGSQL, dict_pgsql_open, | |
721 | -#endif | |
722 | 0, | |
723 | }; | |
724 | ||
725 | ||
726 | --- postfix-2.0.16.orig/conf/dynamicmaps.cf 1970-01-01 01:00:00.000000000 +0100 | |
727 | +++ postfix-2.0.16/conf/dynamicmaps.cf 2003-11-08 19:52:14.000000000 +0100 | |
728 | @@ -0,0 +1,9 @@ | |
729 | +# Postfix dynamic maps configuration file. | |
730 | +# | |
731 | +# The first match found is the one that is used. The only wildcard | |
732 | +# allowed is '*', which matches everything. The first %s is expanded | |
733 | +# to the map type. | |
734 | +# | |
735 | +#type location of .so file name of open function | |
736 | +#==== ================================ ===================== | |
737 | +* /usr/lib/postfix/dict_%s.so dict_%s_open |