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_LDAP, dict_ldap_open,
264 DICT_TYPE_PCRE, dict_pcre_open,
266 +#endif /* MAX_DYNAMIC_MAPS */
267 #ifdef HAS_POSIX_REGEXP
268 DICT_TYPE_REGEXP, dict_regexp_open,
272 if (dict_open_hash == 0)
274 - if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0)
275 - msg_fatal("unsupported dictionary type: %s", dict_type);
276 + if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0) {
277 +#ifndef NO_DYNAMIC_MAPS
279 + VSTRING *lib, *func;
281 + DICT *(*open) (const char *, int, int);
282 + DLINFO *dl=dict_open_dlfind(dict_type);
285 + msg_fatal("%s: unsupported dictionary type: %s", myname, dict_type);
286 +#ifndef NO_DYNAMIC_MAPS
287 + lib=vstring_alloc(1);
288 + vstring_sprintf(lib,dl->soname,dict_type);
289 + if (stat(vstring_str(lib),&st) < 0) {
290 + msg_fatal("%s: unsupported dictionary type: %s (%s not found. Is the postfix-%s package installed?)",
291 + myname, dict_type, vstring_str(lib), dict_type);
293 + func=vstring_alloc(1);
294 + vstring_sprintf(func,dl->openfunc,dict_type);
295 + fn[0].name = vstring_str(func);
296 + fn[0].ptr = (void**)&open;
298 + load_library_symbols(vstring_str(lib), fn, NULL);
299 + dict_open_register(dict_type, open);
300 + dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type);
302 + vstring_free(func);
305 + if (msg_verbose>1) {
306 + msg_info("%s: calling %s open routine",myname,dict_type);
308 if ((dict = dp->open(dict_name, open_flags, dict_flags)) == 0)
309 msg_fatal("opening %s:%s %m", dict_type, dict_name);
315 +#ifndef NO_DYNAMIC_MAPS
316 +static DLINFO *dict_dlinfo;
318 +void dict_open_dlinfo(const char *path)
320 + char *myname="dict_open_dlinfo";
321 + VSTREAM *conf_fp=vstream_fopen(path,O_RDONLY,0);
322 + VSTRING *buf = vstring_alloc(100);
329 + dict_dlinfo=(DLINFO*)mvect_alloc(&vector,sizeof(DLINFO),3,NULL,NULL);
332 + msg_warn("%s: cannot open %s. No dynamic maps will be allowed.",
335 + while (vstring_get_nonl(buf,conf_fp) != VSTREAM_EOF) {
336 + cp = vstring_str(buf);
338 + if (*cp == '#' || *cp == '\0')
340 + argv = argv_split(cp, " \t");
341 + if (argv->argc != 3) {
342 + msg_fatal("%s: Expected \"pattern .so-name function\" at line %d",
345 + if (argv->argv[1][0] != '/') {
346 + msg_fatal("%s: .so name must begin with a \"/\" at line %d",
349 + if (nelm >= vector.nelm) {
350 + dict_dlinfo=(DLINFO*)mvect_realloc(&vector,vector.nelm+3);
352 + dict_dlinfo[nelm].pattern = mystrdup(argv->argv[0]);
353 + dict_dlinfo[nelm].soname = mystrdup(argv->argv[1]);
354 + dict_dlinfo[nelm].openfunc = mystrdup(argv->argv[2]);
359 + if (nelm >= vector.nelm) {
360 + dict_dlinfo=(DLINFO*)mvect_realloc(&vector,vector.nelm+1);
362 + dict_dlinfo[nelm].pattern = NULL;
363 + dict_dlinfo[nelm].soname = NULL;
364 + dict_dlinfo[nelm].openfunc = NULL;
366 + vstream_fclose(conf_fp);
370 +DLINFO *dict_open_dlfind(const char *type)
377 + for (dp=dict_dlinfo; dp->pattern; dp++) {
378 + if (strcmp(dp->pattern,type)==0 || strcmp(dp->pattern,"*")==0)
383 +#endif /* !NO_DYNAMIC_MAPS */
388 --- postfix-2.0.16.orig/src/util/load_lib.c 1970-01-01 01:00:00.000000000 +0100
389 +++ postfix-2.0.16/src/util/load_lib.c 2003-11-08 19:52:14.000000000 +0100
395 +/* library loading wrappers
397 +/* #include <load_lib.h>
399 +/* extern int load_library_symbols(const char *, LIB_FN *, LIB_FN *);
400 +/* const char *libname;
401 +/* LIB_FN *libfuncs;
405 +/* This module loads functions from libraries, returnine pointers
406 +/* to the named functions.
408 +/* load_library_symbols() loads all of the desired functions, and
409 +/* returns zero for success, or exits via msg_fatal().
412 +/* msg(3) diagnostics interface
414 +/* Problems are reported via the msg(3) diagnostics routines:
415 +/* library not found, symbols not found, other fatal errors.
419 +/* The Secure Mailer license must be distributed with this software.
422 +/* Hewlett-Packard Company
423 +/* 3404 Harmony Road
424 +/* Fort Collins, CO 80528, USA
427 +/* IBM T.J. Watson Research
429 +/* Yorktown Heights, NY 10598, USA
432 +/* System libraries. */
434 +#include "sys_defs.h"
438 +#if defined(HAS_DLOPEN)
440 +#elif defined(HAS_SHL_LOAD)
444 +/* Application-specific. */
447 +#include "load_lib.h"
449 +extern int load_library_symbols(const char * libname, LIB_FN * libfuncs, LIB_FN * libdata)
451 + char *myname = "load_library_symbols";
454 +#if defined(HAS_DLOPEN)
458 + handle=dlopen(libname,RTLD_NOW);
461 + msg_fatal("%s: dlopen failure loading %s: %s", myname, libname, emsg);
465 + for (fn=libfuncs; fn->name; fn++) {
466 + *(fn->ptr) = dlsym(handle,fn->name);
469 + msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname,
470 + fn->name, libname, emsg);
472 + if (msg_verbose>1) {
473 + msg_info("loaded %s = %lx",fn->name, *((long*)(fn->ptr)));
479 + for (fn=libdata; fn->name; fn++) {
480 + *(fn->ptr) = dlsym(handle,fn->name);
483 + msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname,
484 + fn->name, libname, emsg);
486 + if (msg_verbose>1) {
487 + msg_info("loaded %s = %lx",fn->name, *((long*)(fn->ptr)));
491 +#elif defined(HAS_SHL_LOAD)
494 + handle = shl_load(libname,BIND_IMMEDIATE,0);
497 + for (fn=libfuncs; fn->name; fn++) {
498 + if (shl_findsym(&handle,fn->name,TYPE_PROCEDURE,fn->ptr) != 0) {
499 + msg_fatal("%s: shl_findsym failure looking up %s in %s: %m",
500 + myname, fn->name, libname);
502 + if (msg_verbose>1) {
503 + msg_info("loaded %s = %x",fn->name, *((long*)(fn->ptr)));
509 + for (fn=libdata; fn->name; fn++) {
510 + if (shl_findsym(&handle,fn->name,TYPE_DATA,fn->ptr) != 0) {
511 + msg_fatal("%s: shl_findsym failure looking up %s in %s: %m",
512 + myname, fn->name, libname);
514 + if (msg_verbose>1) {
515 + msg_info("loaded %s = %x",fn->name, *((long*)(fn->ptr)));
521 + msg_fatal("%s: need dlopen or shl_load support for dynamic libraries",
526 --- postfix-2.0.16.orig/src/util/load_lib.h 1970-01-01 01:00:00.000000000 +0100
527 +++ postfix-2.0.16/src/util/load_lib.h 2003-11-08 19:52:14.000000000 +0100
529 +#ifndef _LOAD_LIB_H_INCLUDED_
530 +#define _LOAD_LIB_H_INCLUDED_
536 +/* library loading wrappers
538 +/* #include "load_lib.h"
543 + * External interface.
545 +/* NULL name terminates list */
546 +typedef struct LIB_FN {
551 +extern int load_library_symbols(const char *, LIB_FN *, LIB_FN *);
556 +/* The Secure Mailer license must be distributed with this software.
559 +/* Hewlett-Packard Company
560 +/* 3404 Harmony Road
561 +/* Fort Collins, CO 80528, USA
564 +/* IBM T.J. Watson Research
566 +/* Yorktown Heights, NY 10598, USA
570 --- postfix-2.0.16.orig/src/util/Makefile.in 2003-11-08 19:49:41.000000000 +0100
571 +++ postfix-2.0.16/src/util/Makefile.in 2003-11-08 19:55:55.000000000 +0100
573 attr_scan0.c attr_scan64.c base64_code.c basename.c binhash.c \
574 chroot_uid.c clean_env.c close_on_exec.c concatenate.c ctable.c \
575 dict.c dict_alloc.c dict_db.c dict_dbm.c dict_debug.c dict_env.c \
576 - dict_ht.c dict_ldap.c dict_mysql.c dict_ni.c dict_nis.c \
577 + dict_ht.c dict_mysql.c dict_ni.c dict_nis.c \
578 dict_nisplus.c dict_open.c dict_pcre.c dict_regexp.c dict_static.c \
579 dict_tcp.c dict_unix.c dir_forest.c doze.c duplex_pipe.c \
580 environ.c events.c exec_command.c fifo_listen.c fifo_trigger.c \
582 valid_hostname.c vbuf.c vbuf_print.c vstream.c vstream_popen.c \
583 vstring.c vstring_vstream.c watchdog.c writable.c write_buf.c \
584 write_wait.c strcasecmp.c nvtable.c host_port.c sane_connect.c \
586 + dict_sdbm.c sdbm.c load_lib.c
587 OBJS = alldig.o argv.o argv_split.o attr_print0.o attr_print64.o \
588 attr_scan0.o attr_scan64.o base64_code.o basename.o binhash.o \
589 chroot_uid.o clean_env.o close_on_exec.o concatenate.o ctable.o \
590 dict.o dict_alloc.o dict_db.o dict_dbm.o dict_debug.o dict_env.o \
591 - dict_ht.o dict_ldap.o dict_mysql.o dict_ni.o dict_nis.o \
592 - dict_nisplus.o dict_open.o dict_pcre.o dict_regexp.o dict_static.o \
593 + dict_ht.o dict_ni.o dict_nis.o \
594 + dict_nisplus.o dict_open.o dict_regexp.o dict_static.o \
595 dict_tcp.o dict_unix.o dir_forest.o doze.o duplex_pipe.o \
596 environ.o events.o exec_command.o fifo_listen.o fifo_trigger.o \
597 file_limit.o find_inet.o fsspace.o fullname.o get_domainname.o \
599 valid_hostname.o vbuf.o vbuf_print.o vstream.o vstream_popen.o \
600 vstring.o vstring_vstream.o watchdog.o writable.o write_buf.o \
601 write_wait.o nvtable.o host_port.o sane_connect.o \
602 - dict_sdbm.o sdbm.o $(STRCASE)
603 + dict_sdbm.o sdbm.o load_lib.o $(STRCASE)
604 HDRS = argv.h attr.h base64_code.h binhash.h chroot_uid.h clean_env.h \
605 connect.h ctable.h dict.h dict_db.h dict_dbm.h dict_env.h \
606 dict_ht.h dict_ldap.h dict_mysql.h dict_ni.h dict_nis.h \
608 split_at.h stat_as.h stringops.h sys_defs.h timed_connect.h \
609 timed_wait.h trigger.h username.h valid_hostname.h vbuf.h \
610 vbuf_print.h vstream.h vstring.h vstring_vstream.h watchdog.h \
611 - nvtable.h host_port.h sane_connect.h dict_sdbm.h sdbm.h
612 + load_lib.h nvtable.h host_port.h sane_connect.h dict_sdbm.h sdbm.h
613 TESTSRC = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \
614 stream_test.c dup2_pass_on_exec.c
615 WARN = -W -Wformat -Wimplicit -Wmissing-prototypes \
617 CFLAGS = $(DEBUG) $(OPT) $(DEFS)
618 FILES = Makefile $(SRCS) $(HDRS)
620 +PCRESO = dict_pcre.so
621 +MYSQLSO = dict_mysql.so
623 TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
624 fifo_rdonly_bug fifo_rdwr_bug fifo_trigger fsspace fullname \
628 INC_DIR = ../../include
629 +LIBS = $(LIB_DIR)/$(LIB) $(LIB_DIR)/$(PCRESO) $(LIB_DIR)/$(MYSQLSO)
631 -.c.o:; $(CC) $(CFLAGS) -c $*.c
632 +.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
636 @@ -106,15 +109,25 @@
640 +$(PCRESO): dict_pcre.o
641 + gcc -shared -Wl,-soname,dict_pcre.so -o $@ $? -lpcre -L. -lutil
643 +$(MYSQLSO): dict_mysql.o
644 + gcc -shared -Wl,-soname,dict_mysql.so -o $@ $? -lmysqlclient -L. -lutil
647 - $(AR) $(ARFL) $(LIB) $?
649 + gcc -shared -Wl,-soname,libpostfix-util.so.1 -o $(LIB) $(OBJS) -ldl
651 $(LIB_DIR)/$(LIB): $(LIB)
653 - $(RANLIB) $(LIB_DIR)/$(LIB)
655 -update: $(LIB_DIR)/$(LIB) $(HDRS)
656 +$(LIB_DIR)/$(PCRESO): $(PCRESO)
657 + cp $(PCRESO) $(LIB_DIR)
659 +$(LIB_DIR)/$(MYSQLSO): $(MYSQLSO)
660 + cp $(MYSQLSO) $(LIB_DIR)
662 +update: $(LIBS) $(HDRS)
665 cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
670 - rm -f *.o $(LIB) *core $(TESTPROG) junk $(MAKES) *.tmp
671 + rm -f *.o $(LIB) $(PCRESO) $(MYSQLSO) *core $(TESTPROG) \
672 + junk $(MAKES) *.tmp
676 --- postfix-2.0.16.orig/src/util/sys_defs.h 2003-11-08 19:49:41.000000000 +0100
677 +++ postfix-2.0.16/src/util/sys_defs.h 2003-11-08 19:52:14.000000000 +0100
679 #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
680 #define PREPEND_PLUS_TO_OPTSTRING
681 #define HAS_POSIX_REGEXP
683 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
684 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
685 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
687 #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT /* unverified */
688 #define PREPEND_PLUS_TO_OPTSTRING
689 #define HAS_POSIX_REGEXP
691 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
692 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
693 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
696 #define STATFS_IN_SYS_VFS_H
697 #define HAS_POSIX_REGEXP
698 +#define HAS_SHL_LOAD
699 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
700 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
701 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
704 #define STATFS_IN_SYS_VFS_H
705 #define HAS_POSIX_REGEXP
706 +#define HAS_SHL_LOAD
707 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
708 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
709 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"