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