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