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