1 --- postfix-2.0.16.orig/conf/dynamicmaps.cf 1970-01-01 01:00:00.000000000 +0100
2 +++ postfix-2.0.16/conf/dynamicmaps.cf 2003-11-08 19:52:14.000000000 +0100
4 +# Postfix dynamic maps configuration file.
6 +# The first match found is the one that is used. The only wildcard
7 +# allowed is '*', which matches everything. The first %s is expanded
10 +#type location of .so file name of open function
11 +#==== ================================ =====================
12 +* /usr/lib/postfix/dict_%s.so dict_%s_open
13 --- postfix-2.0.16.orig/src/dns/Makefile.in 2003-09-14 02:03:59.000000000 +0200
14 +++ postfix-2.0.16/src/dns/Makefile.in 2003-11-08 19:52:14.000000000 +0100
17 INC_DIR = ../../include
19 -.c.o:; $(CC) $(CFLAGS) -c $*.c
20 +.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
28 - $(AR) $(ARFL) $(LIB) $?
30 + gcc -shared -Wl,-soname,libpostfix-dns.so.1 -o $(LIB) $(OBJS)
32 $(LIB_DIR)/$(LIB): $(LIB)
34 - $(RANLIB) $(LIB_DIR)/$(LIB)
36 update: $(LIB_DIR)/$(LIB) $(HDRS)
38 --- postfix-2.0.16.orig/src/global/mail_conf.c 2002-01-14 17:24:35.000000000 +0100
39 +++ postfix-2.0.16/src/global/mail_conf.c 2003-11-08 19:52:14.000000000 +0100
41 path = concatenate(var_config_dir, "/", "main.cf", (char *) 0);
42 dict_load_file(CONFIG_DICT, path);
45 +#ifndef NO_DYNAMIC_MAPS
46 + path = concatenate(var_config_dir, "/", "dynamicmaps.cf", (char *) 0);
47 + dict_open_dlinfo(path);
53 /* mail_conf_eval - expand macros in string */
54 --- postfix-2.0.16.orig/src/global/mail_params.c 2003-11-08 19:49:41.000000000 +0100
55 +++ postfix-2.0.16/src/global/mail_params.c 2003-11-08 19:52:14.000000000 +0100
60 +#include <safe_open.h>
61 +#include <mymalloc.h>
66 char *var_debug_peer_list;
67 int var_debug_peer_level;
68 char *var_reject_reply_msg_access_denied;
69 +int var_command_maxtime;
70 int var_fault_inj_code;
71 char *var_bounce_service;
72 char *var_cleanup_service;
77 +static char *read_file(const char *name)
80 + VSTRING *why=vstring_alloc(1);
81 + VSTRING *new_name=vstring_alloc(1);
82 + VSTREAM *vp=safe_open(name, O_RDONLY, 0, NULL, -1, -1, why);
85 + * Ugly macros to make complex expressions less unreadable.
87 +#define SKIP(start, var, cond) \
88 + for (var = start; *var && (cond); var++);
92 + for (p = (s) + strlen(s); p > (s) && ISSPACE(p[-1]); p--); \
97 + msg_fatal("%s: unable to open: %s",name,vstring_str(why));
99 + vstring_get_nonl(new_name,vp);
100 + vstream_fclose(vp);
101 + SKIP(vstring_str(new_name),ret,ISSPACE(*ret));
105 + vstring_free(new_name);
109 /* mail_params_init - configure built-in parameters */
111 void mail_params_init()
113 * Variables that are needed by almost every program.
115 get_mail_conf_str_table(other_str_defaults);
116 + if (*var_myorigin=='/') {
117 + var_myorigin=read_file(var_myorigin);
119 get_mail_conf_int_table(other_int_defaults);
120 get_mail_conf_bool_table(bool_defaults);
121 get_mail_conf_time_table(time_defaults);
122 --- postfix-2.0.16.orig/src/global/Makefile.in 2003-11-08 19:49:41.000000000 +0100
123 +++ postfix-2.0.16/src/global/Makefile.in 2003-11-08 19:52:14.000000000 +0100
126 INC_DIR = ../../include
128 +LDAPSO = dict_ldap.so
130 -.c.o:; $(CC) $(CFLAGS) -c $*.c
131 +.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
139 - $(AR) $(ARFL) $(LIB) $?
141 + gcc -shared -Wl,-soname,libpostfix-global.so.1 -o $(LIB) $(OBJS)
143 +$(LDAPSO): dict_ldap.o
144 + gcc -shared -Wl,-soname,dict_ldap.so -o $@ $? -lldap -llber -L../../lib -lutil -L. -lglobal
146 +dict_ldap.c: ../util/dict_ldap.c
149 $(LIB_DIR)/$(LIB): $(LIB)
151 - $(RANLIB) $(LIB_DIR)/$(LIB)
153 -update: $(LIB_DIR)/$(LIB) $(HDRS)
154 +$(LIB_DIR)/$(LDAPSO): $(LDAPSO)
155 + cp $(LDAPSO) $(LIB_DIR)
157 +update: $(LIB_DIR)/$(LIB) $(LIB_DIR)/${LDAPSO} $(HDRS)
160 cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
162 lint $(DEFS) $(SRCS) $(LINTFIX)
165 - rm -f *.o $(LIB) *core $(TESTPROG) junk
166 + rm -f *.o $(LIB) $(LDAPSO) dict_ldap.c *core $(TESTPROG) junk
171 dict_proxy.o: mail_params.h
172 dict_proxy.o: clnt_stream.h
173 dict_proxy.o: dict_proxy.h
174 +dict_ldap.o: dict_ldap.c
175 +dict_ldap.o: ../../include/sys_defs.h
176 domain_list.o: domain_list.c
177 domain_list.o: ../../include/sys_defs.h
178 domain_list.o: ../../include/match_list.h
179 --- postfix-2.0.16.orig/src/master/Makefile.in 2003-09-14 02:04:02.000000000 +0200
180 +++ postfix-2.0.16/src/master/Makefile.in 2003-11-08 19:52:14.000000000 +0100
182 INC_DIR = ../../include
183 BIN_DIR = ../../libexec
185 -.c.o:; $(CC) $(CFLAGS) -c $*.c
186 +.c.o:; $(CC) `for i in $(LIB_OBJ); do [ $$i = $@ ] && echo -fPIC; done` $(CFLAGS) -c $*.c
194 - $(AR) $(ARFL) $(LIB) $?
196 + gcc -shared -Wl,-soname,libpostfix-master.so.1 -o $(LIB) $(LIB_OBJ)
198 $(LIB_DIR)/$(LIB): $(LIB)
199 cp $(LIB) $(LIB_DIR)/$(LIB)
200 - $(RANLIB) $(LIB_DIR)/$(LIB)
202 $(BIN_DIR)/$(PROG): $(PROG)
203 cp $(PROG) $(BIN_DIR)
204 --- postfix-2.0.16.orig/src/util/dict.h 2003-01-05 02:03:28.000000000 +0100
205 +++ postfix-2.0.16/src/util/dict.h 2003-11-08 19:52:14.000000000 +0100
208 extern ARGV *dict_mapnames(void);
210 +#ifndef NO_DYNAMIC_MAPS
212 + * Interface for dynamic map loading.
215 + const char *pattern;
216 + const char *soname;
217 + const char *openfunc;
220 +extern void dict_open_dlinfo(const char *path);
221 +extern DLINFO *dict_open_dlfind(const char *type);
225 * High-level interface, with logical dictionary names.
227 --- postfix-2.0.16.orig/src/util/dict_open.c 2003-11-08 19:49:41.000000000 +0100
228 +++ postfix-2.0.16/src/util/dict_open.c 2003-11-08 19:52:14.000000000 +0100
233 +#include <sys/stat.h>
236 /* Utility library. */
240 #include <split_at.h>
243 +#ifndef NO_DYNAMIC_MAPS
244 +#include <load_lib.h>
245 +#include <vstring.h>
246 +#include <vstream.h>
247 +#include <vstring_vstream.h>
252 * lookup table for available map types.
256 DICT_TYPE_NETINFO, dict_ni_open,
258 +#ifndef MAX_DYNAMIC_MAPS
260 DICT_TYPE_PCRE, dict_pcre_open,
262 +#endif /* MAX_DYNAMIC_MAPS */
263 #ifdef HAS_POSIX_REGEXP
264 DICT_TYPE_REGEXP, dict_regexp_open,
268 if (dict_open_hash == 0)
270 - if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0)
271 - msg_fatal("unsupported dictionary type: %s", dict_type);
272 + if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0) {
273 +#ifndef NO_DYNAMIC_MAPS
275 + VSTRING *lib, *func;
277 + DICT *(*open) (const char *, int, int);
278 + DLINFO *dl=dict_open_dlfind(dict_type);
281 + msg_fatal("%s: unsupported dictionary type: %s", myname, dict_type);
282 +#ifndef NO_DYNAMIC_MAPS
283 + lib=vstring_alloc(1);
284 + vstring_sprintf(lib,dl->soname,dict_type);
285 + if (stat(vstring_str(lib),&st) < 0) {
286 + msg_fatal("%s: unsupported dictionary type: %s (%s not found. Is the postfix-%s package installed?)",
287 + myname, dict_type, vstring_str(lib), dict_type);
289 + func=vstring_alloc(1);
290 + vstring_sprintf(func,dl->openfunc,dict_type);
291 + fn[0].name = vstring_str(func);
292 + fn[0].ptr = (void**)&open;
294 + load_library_symbols(vstring_str(lib), fn, NULL);
295 + dict_open_register(dict_type, open);
296 + dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type);
298 + vstring_free(func);
301 + if (msg_verbose>1) {
302 + msg_info("%s: calling %s open routine",myname,dict_type);
304 if ((dict = dp->open(dict_name, open_flags, dict_flags)) == 0)
305 msg_fatal("opening %s:%s %m", dict_type, dict_name);
311 +#ifndef NO_DYNAMIC_MAPS
312 +static DLINFO *dict_dlinfo;
314 +void dict_open_dlinfo(const char *path)
316 + char *myname="dict_open_dlinfo";
317 + VSTREAM *conf_fp=vstream_fopen(path,O_RDONLY,0);
318 + VSTRING *buf = vstring_alloc(100);
325 + dict_dlinfo=(DLINFO*)mvect_alloc(&vector,sizeof(DLINFO),3,NULL,NULL);
328 + msg_warn("%s: cannot open %s. No dynamic maps will be allowed.",
331 + while (vstring_get_nonl(buf,conf_fp) != VSTREAM_EOF) {
332 + cp = vstring_str(buf);
334 + if (*cp == '#' || *cp == '\0')
336 + argv = argv_split(cp, " \t");
337 + if (argv->argc != 3) {
338 + msg_fatal("%s: Expected \"pattern .so-name function\" at line %d",
341 + if (argv->argv[1][0] != '/') {
342 + msg_fatal("%s: .so name must begin with a \"/\" at line %d",
345 + if (nelm >= vector.nelm) {
346 + dict_dlinfo=(DLINFO*)mvect_realloc(&vector,vector.nelm+3);
348 + dict_dlinfo[nelm].pattern = mystrdup(argv->argv[0]);
349 + dict_dlinfo[nelm].soname = mystrdup(argv->argv[1]);
350 + dict_dlinfo[nelm].openfunc = mystrdup(argv->argv[2]);
355 + if (nelm >= vector.nelm) {
356 + dict_dlinfo=(DLINFO*)mvect_realloc(&vector,vector.nelm+1);
358 + dict_dlinfo[nelm].pattern = NULL;
359 + dict_dlinfo[nelm].soname = NULL;
360 + dict_dlinfo[nelm].openfunc = NULL;
362 + vstream_fclose(conf_fp);
366 +DLINFO *dict_open_dlfind(const char *type)
373 + for (dp=dict_dlinfo; dp->pattern; dp++) {
374 + if (strcmp(dp->pattern,type)==0 || strcmp(dp->pattern,"*")==0)
379 +#endif /* !NO_DYNAMIC_MAPS */
384 --- postfix-2.0.16.orig/src/util/load_lib.c 1970-01-01 01:00:00.000000000 +0100
385 +++ postfix-2.0.16/src/util/load_lib.c 2003-11-08 19:52:14.000000000 +0100
391 +/* library loading wrappers
393 +/* #include <load_lib.h>
395 +/* extern int load_library_symbols(const char *, LIB_FN *, LIB_FN *);
396 +/* const char *libname;
397 +/* LIB_FN *libfuncs;
401 +/* This module loads functions from libraries, returnine pointers
402 +/* to the named functions.
404 +/* load_library_symbols() loads all of the desired functions, and
405 +/* returns zero for success, or exits via msg_fatal().
408 +/* msg(3) diagnostics interface
410 +/* Problems are reported via the msg(3) diagnostics routines:
411 +/* library not found, symbols not found, other fatal errors.
415 +/* The Secure Mailer license must be distributed with this software.
418 +/* Hewlett-Packard Company
419 +/* 3404 Harmony Road
420 +/* Fort Collins, CO 80528, USA
423 +/* IBM T.J. Watson Research
425 +/* Yorktown Heights, NY 10598, USA
428 +/* System libraries. */
430 +#include "sys_defs.h"
434 +#if defined(HAS_DLOPEN)
436 +#elif defined(HAS_SHL_LOAD)
440 +/* Application-specific. */
443 +#include "load_lib.h"
445 +extern int load_library_symbols(const char * libname, LIB_FN * libfuncs, LIB_FN * libdata)
447 + char *myname = "load_library_symbols";
450 +#if defined(HAS_DLOPEN)
454 + handle=dlopen(libname,RTLD_NOW);
457 + msg_fatal("%s: dlopen failure loading %s: %s", myname, libname, emsg);
461 + for (fn=libfuncs; fn->name; fn++) {
462 + *(fn->ptr) = dlsym(handle,fn->name);
465 + msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname,
466 + fn->name, libname, emsg);
468 + if (msg_verbose>1) {
469 + msg_info("loaded %s = %lx",fn->name, *((long*)(fn->ptr)));
475 + for (fn=libdata; fn->name; fn++) {
476 + *(fn->ptr) = dlsym(handle,fn->name);
479 + msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname,
480 + fn->name, libname, emsg);
482 + if (msg_verbose>1) {
483 + msg_info("loaded %s = %lx",fn->name, *((long*)(fn->ptr)));
487 +#elif defined(HAS_SHL_LOAD)
490 + handle = shl_load(libname,BIND_IMMEDIATE,0);
493 + for (fn=libfuncs; fn->name; fn++) {
494 + if (shl_findsym(&handle,fn->name,TYPE_PROCEDURE,fn->ptr) != 0) {
495 + msg_fatal("%s: shl_findsym failure looking up %s in %s: %m",
496 + myname, fn->name, libname);
498 + if (msg_verbose>1) {
499 + msg_info("loaded %s = %x",fn->name, *((long*)(fn->ptr)));
505 + for (fn=libdata; fn->name; fn++) {
506 + if (shl_findsym(&handle,fn->name,TYPE_DATA,fn->ptr) != 0) {
507 + msg_fatal("%s: shl_findsym failure looking up %s in %s: %m",
508 + myname, fn->name, libname);
510 + if (msg_verbose>1) {
511 + msg_info("loaded %s = %x",fn->name, *((long*)(fn->ptr)));
517 + msg_fatal("%s: need dlopen or shl_load support for dynamic libraries",
522 --- postfix-2.0.16.orig/src/util/load_lib.h 1970-01-01 01:00:00.000000000 +0100
523 +++ postfix-2.0.16/src/util/load_lib.h 2003-11-08 19:52:14.000000000 +0100
525 +#ifndef _LOAD_LIB_H_INCLUDED_
526 +#define _LOAD_LIB_H_INCLUDED_
532 +/* library loading wrappers
534 +/* #include "load_lib.h"
539 + * External interface.
541 +/* NULL name terminates list */
542 +typedef struct LIB_FN {
547 +extern int load_library_symbols(const char *, LIB_FN *, LIB_FN *);
552 +/* The Secure Mailer license must be distributed with this software.
555 +/* Hewlett-Packard Company
556 +/* 3404 Harmony Road
557 +/* Fort Collins, CO 80528, USA
560 +/* IBM T.J. Watson Research
562 +/* Yorktown Heights, NY 10598, USA
566 --- postfix-2.0.16.orig/src/util/Makefile.in 2003-11-08 19:49:41.000000000 +0100
567 +++ postfix-2.0.16/src/util/Makefile.in 2003-11-08 19:55:55.000000000 +0100
569 attr_scan0.c attr_scan64.c base64_code.c basename.c binhash.c \
570 chroot_uid.c clean_env.c close_on_exec.c concatenate.c ctable.c \
571 dict.c dict_alloc.c dict_db.c dict_dbm.c dict_debug.c dict_env.c \
572 - dict_ht.c dict_ldap.c dict_mysql.c dict_ni.c dict_nis.c \
573 + dict_ht.c dict_mysql.c dict_ni.c dict_nis.c \
574 dict_nisplus.c dict_open.c dict_pcre.c dict_regexp.c dict_static.c \
575 dict_tcp.c dict_unix.c dir_forest.c doze.c duplex_pipe.c \
576 environ.c events.c exec_command.c fifo_listen.c fifo_trigger.c \
578 valid_hostname.c vbuf.c vbuf_print.c vstream.c vstream_popen.c \
579 vstring.c vstring_vstream.c watchdog.c writable.c write_buf.c \
580 write_wait.c strcasecmp.c nvtable.c host_port.c sane_connect.c \
582 + dict_sdbm.c sdbm.c load_lib.c
583 OBJS = alldig.o argv.o argv_split.o attr_print0.o attr_print64.o \
584 attr_scan0.o attr_scan64.o base64_code.o basename.o binhash.o \
585 chroot_uid.o clean_env.o close_on_exec.o concatenate.o ctable.o \
586 dict.o dict_alloc.o dict_db.o dict_dbm.o dict_debug.o dict_env.o \
587 - dict_ht.o dict_ldap.o dict_mysql.o dict_ni.o dict_nis.o \
588 - dict_nisplus.o dict_open.o dict_pcre.o dict_regexp.o dict_static.o \
589 + dict_ht.o dict_ni.o dict_nis.o \
590 + dict_nisplus.o dict_open.o dict_regexp.o dict_static.o \
591 dict_tcp.o dict_unix.o dir_forest.o doze.o duplex_pipe.o \
592 environ.o events.o exec_command.o fifo_listen.o fifo_trigger.o \
593 file_limit.o find_inet.o fsspace.o fullname.o get_domainname.o \
595 valid_hostname.o vbuf.o vbuf_print.o vstream.o vstream_popen.o \
596 vstring.o vstring_vstream.o watchdog.o writable.o write_buf.o \
597 write_wait.o nvtable.o host_port.o sane_connect.o $(STRCASE) \
599 + dict_sdbm.o sdbm.o load_lib.o
600 HDRS = argv.h attr.h base64_code.h binhash.h chroot_uid.h clean_env.h \
601 connect.h ctable.h dict.h dict_db.h dict_dbm.h dict_env.h \
602 dict_ht.h dict_ldap.h dict_mysql.h dict_ni.h dict_nis.h \
604 timed_wait.h trigger.h username.h valid_hostname.h vbuf.h \
605 vbuf_print.h vstream.h vstring.h vstring_vstream.h watchdog.h \
606 nvtable.h host_port.h sane_connect.h \
608 + dict_sdbm.h sdbm.h load_lib.h
609 TESTSRC = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \
610 stream_test.c dup2_pass_on_exec.c
611 WARN = -W -Wformat -Wimplicit -Wmissing-prototypes \
613 CFLAGS = $(DEBUG) $(OPT) $(DEFS)
614 FILES = Makefile $(SRCS) $(HDRS)
616 +PCRESO = dict_pcre.so
617 +MYSQLSO = dict_mysql.so
619 TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
620 fifo_rdonly_bug fifo_rdwr_bug fifo_trigger fsspace fullname \
624 INC_DIR = ../../include
625 +LIBS = $(LIB_DIR)/$(LIB) $(LIB_DIR)/$(PCRESO) $(LIB_DIR)/$(MYSQLSO)
627 -.c.o:; $(CC) $(CFLAGS) -c $*.c
628 +.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
632 @@ -106,15 +109,25 @@
636 +$(PCRESO): dict_pcre.o
637 + gcc -shared -Wl,-soname,dict_pcre.so -o $@ $? -lpcre -L. -lutil
639 +$(MYSQLSO): dict_mysql.o
640 + gcc -shared -Wl,-soname,dict_mysql.so -o $@ $? -lmysqlclient -L. -lutil
643 - $(AR) $(ARFL) $(LIB) $?
645 + gcc -shared -Wl,-soname,libpostfix-util.so.1 -o $(LIB) $(OBJS) -ldl
647 $(LIB_DIR)/$(LIB): $(LIB)
649 - $(RANLIB) $(LIB_DIR)/$(LIB)
651 -update: $(LIB_DIR)/$(LIB) $(HDRS)
652 +$(LIB_DIR)/$(PCRESO): $(PCRESO)
653 + cp $(PCRESO) $(LIB_DIR)
655 +$(LIB_DIR)/$(MYSQLSO): $(MYSQLSO)
656 + cp $(MYSQLSO) $(LIB_DIR)
658 +update: $(LIBS) $(HDRS)
661 cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
666 - rm -f *.o $(LIB) *core $(TESTPROG) junk $(MAKES) *.tmp
667 + rm -f *.o $(LIB) $(PCRESO) $(MYSQLSO) *core $(TESTPROG) \
668 + junk $(MAKES) *.tmp
672 --- postfix-2.0.16.orig/src/util/sys_defs.h 2003-11-08 19:49:41.000000000 +0100
673 +++ postfix-2.0.16/src/util/sys_defs.h 2003-11-08 19:52:14.000000000 +0100
675 #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
676 #define PREPEND_PLUS_TO_OPTSTRING
677 #define HAS_POSIX_REGEXP
679 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
680 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
681 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
683 #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT /* unverified */
684 #define PREPEND_PLUS_TO_OPTSTRING
685 #define HAS_POSIX_REGEXP
687 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
688 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
689 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
692 #define STATFS_IN_SYS_VFS_H
693 #define HAS_POSIX_REGEXP
694 +#define HAS_SHL_LOAD
695 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
696 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
697 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
700 #define STATFS_IN_SYS_VFS_H
701 #define HAS_POSIX_REGEXP
702 +#define HAS_SHL_LOAD
703 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
704 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
705 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"