Группа :: Система/Серверы
Пакет: postfix
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: postfix-2.2.4-alt-dynamicmaps.patch
diff -upk.orig postfix-2.2.4.orig/src/global/Makefile.in postfix-2.2.4/src/global/Makefile.in
--- postfix-2.2.4.orig/src/global/Makefile.in 2005-04-29 21:08:44 +0000
+++ postfix-2.2.4/src/global/Makefile.in 2005-06-23 12:47:30 +0000
@@ -30,7 +30,7 @@ OBJS = abounce.o anvil_clnt.o been_here.
canon_addr.o cfg_parser.o cleanup_strerror.o cleanup_strflags.o \
clnt_stream.o debug_peer.o debug_process.o defer.o db_common.o \
deliver_completed.o deliver_flock.o deliver_pass.o deliver_request.o \
- dict_ldap.o dict_mysql.o dict_pgsql.o dict_proxy.o domain_list.o \
+ dict_proxy.o domain_list.o \
dot_lockfile.o dot_lockfile_as.o ext_prop.o file_id.o flush_clnt.o \
header_opts.o header_token.o hold_message.o input_transp.o \
is_header.o log_adhoc.o mail_addr.o mail_addr_crunch.o \
@@ -79,6 +79,11 @@ TESTSRC = rec2stream.c stream2rec.c recd
DEFS = -I. -I$(INC_DIR) -D$(SYSTYPE)
CFLAGS = $(DEBUG) $(OPT) $(DEFS)
INCL =
+DEF_MAIL_VERSION = unknown
+DICT_LDAP = dict_ldap-$(DEF_MAIL_VERSION).so
+DICT_MYSQL = dict_mysql-$(DEF_MAIL_VERSION).so
+DICT_PGSQL = dict_pgsql-$(DEF_MAIL_VERSION).so
+DICTS = $(DICT_LDAP) $(DICT_MYSQL) $(DICT_PGSQL)
LIB = libglobal.a
TESTPROG= domain_list dot_lockfile mail_addr_crunch mail_addr_find \
mail_addr_map mail_date maps mynetworks mypwd namadr_list \
@@ -104,6 +109,17 @@ Makefile: Makefile.in
test: $(TESTPROG)
+dicts: $(DICTS)
+
+$(DICT_LDAP): dict_ldap.o
+ gcc -shared -Wl,-soname,$@ -o $@ $? -lldap -llber $(LIBS) $(SYSLIBS)
+
+$(DICT_MYSQL): dict_mysql.o
+ gcc -shared -Wl,-soname,$@ -o $@ $? -lmysqlclient $(LIBS) $(SYSLIBS)
+
+$(DICT_PGSQL): dict_pgsql.o
+ gcc -shared -Wl,-soname,$@ -o $@ $? -lpq $(LIBS) $(SYSLIBS)
+
$(LIB): $(OBJS)
$(AR) $(ARFL) $(LIB) $?
$(RANLIB) $(LIB)
@@ -392,7 +408,7 @@ lint:
lint $(DEFS) $(SRCS) $(LINTFIX)
clean:
- rm -f *.o $(LIB) *core $(TESTPROG) junk
+ rm -f *.o $(LIB) $(DICTS) *core $(TESTPROG) junk
rm -rf printfck
tidy: clean
diff -upk.orig postfix-2.2.4.orig/src/global/mail_dict.c postfix-2.2.4/src/global/mail_dict.c
--- postfix-2.2.4.orig/src/global/mail_dict.c 2004-01-04 18:53:27 +0000
+++ postfix-2.2.4/src/global/mail_dict.c 2005-02-26 23:58:15 +0000
@@ -45,6 +45,7 @@ typedef struct {
static DICT_OPEN_INFO dict_open_info[] = {
DICT_TYPE_PROXY, dict_proxy_open,
+#ifdef NO_DYNAMIC_MAPS
#ifdef HAS_LDAP
DICT_TYPE_LDAP, dict_ldap_open,
#endif
@@ -54,6 +55,7 @@ static DICT_OPEN_INFO dict_open_info[] =
#ifdef HAS_PGSQL
DICT_TYPE_PGSQL, dict_pgsql_open,
#endif
+#endif /* NO_DYNAMIC_MAPS */
0,
};
diff -upk.orig postfix-2.2.4.orig/src/global/mail_params.c postfix-2.2.4/src/global/mail_params.c
--- postfix-2.2.4.orig/src/global/mail_params.c 2005-01-19 01:22:02 +0000
+++ postfix-2.2.4/src/global/mail_params.c 2005-06-23 12:47:30 +0000
@@ -640,7 +640,8 @@ void mail_params_init()
check_sgid_group();
check_overlap();
#ifdef HAS_DB
- dict_db_cache_size = var_db_read_buf;
+#pragma weak dict_db_cache_size
+ if (&dict_db_cache_size) dict_db_cache_size = var_db_read_buf;
#endif
/*
diff -upk.orig postfix-2.2.4.orig/src/postconf/Makefile.in postfix-2.2.4/src/postconf/Makefile.in
--- postfix-2.2.4.orig/src/postconf/Makefile.in 2005-04-29 21:09:17 +0000
+++ postfix-2.2.4/src/postconf/Makefile.in 2005-06-23 12:47:30 +0000
@@ -23,7 +23,7 @@ $(PROG): $(OBJS) $(LIBS)
(echo "# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE"; \
echo "# TEXT HERE JUST SHOWS DEFAULT SETTINGS BUILT INTO POSTFIX."; \
echo "#"; \
- ./$(PROG) -d) |egrep -v '^(myhostname|mydomain|mynetworks) ' >$@
+ LD_LIBRARY_PATH=../../lib ./$(PROG) -d) |egrep -v '^(myhostname|mydomain|mynetworks) ' >$@
$(OBJS): ../../conf/makedefs.out
diff -upk.orig postfix-2.2.4.orig/src/util/Makefile.in postfix-2.2.4/src/util/Makefile.in
--- postfix-2.2.4.orig/src/util/Makefile.in 2005-04-29 21:12:46 +0000
+++ postfix-2.2.4/src/util/Makefile.in 2005-06-23 12:47:30 +0000
@@ -36,7 +36,7 @@ OBJS = alldig.o argv.o argv_split.o attr
chroot_uid.o clean_env.o close_on_exec.o concatenate.o ctable.o \
dict.o dict_alloc.o dict_db.o dict_cdb.o dict_dbm.o dict_debug.o dict_env.o \
dict_cidr.o dict_ht.o dict_ni.o dict_nis.o \
- dict_nisplus.o dict_open.o dict_pcre.o dict_regexp.o \
+ dict_nisplus.o dict_open.o dict_regexp.o \
dict_static.o dict_tcp.o dict_unix.o dir_forest.o doze.o \
duplex_pipe.o environ.o events.o exec_command.o fifo_listen.o \
fifo_trigger.o file_limit.o find_inet.o fsspace.o fullname.o \
@@ -90,6 +90,9 @@ DEFS = -I. -D$(SYSTYPE)
CFLAGS = $(DEBUG) $(OPT) $(DEFS)
FILES = Makefile $(SRCS) $(HDRS)
INCL =
+DEF_MAIL_VERSION = unknown
+DICT_PCRE = dict_pcre-$(DEF_MAIL_VERSION).so
+DICTS = $(DICT_PCRE)
LIB = libutil.a
TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
fifo_rdonly_bug fifo_rdwr_bug fifo_trigger fsspace fullname \
@@ -116,6 +119,11 @@ Makefile: Makefile.in
test: $(TESTPROG)
+dicts: $(DICTS)
+
+$(DICT_PCRE): dict_pcre.o
+ gcc -shared -Wl,-soname,$@ -o $@ $? -lpcre $(LIBS) $(SYSLIBS)
+
$(LIB): $(OBJS)
$(AR) $(ARFL) $(LIB) $?
$(RANLIB) $(LIB)
@@ -146,7 +154,7 @@ lint:
lint $(SRCS)
clean:
- rm -f *.o $(LIB) *core $(TESTPROG) junk $(MAKES) *.tmp
+ rm -f *.o $(LIB) $(DICTS) *core $(TESTPROG) junk $(MAKES) *.tmp
rm -rf printfck
tidy: clean
diff -upk.orig postfix-2.2.4.orig/src/util/dict_open.c postfix-2.2.4/src/util/dict_open.c
--- postfix-2.2.4.orig/src/util/dict_open.c 2005-03-17 16:33:02 +0000
+++ postfix-2.2.4/src/util/dict_open.c 2005-06-23 12:47:30 +0000
@@ -169,6 +169,12 @@
#include <strings.h>
#endif
+#ifndef NO_DYNAMIC_MAPS
+#include <dlfcn.h>
+#include "../global/mail_version.h"
+#include "../global/mail_params.h"
+#endif /* ! NO_DYNAMIC_MAPS */
+
/* Utility library. */
#include <argv.h>
@@ -229,9 +235,11 @@ static DICT_OPEN_INFO dict_open_info[] =
#ifdef HAS_NETINFO
DICT_TYPE_NETINFO, dict_ni_open,
#endif
+#ifdef NO_DYNAMIC_MAPS
#ifdef HAS_PCRE
DICT_TYPE_PCRE, dict_pcre_open,
#endif
+#endif /* NO_DYNAMIC_MAPS */
#ifdef HAS_POSIX_REGEXP
DICT_TYPE_REGEXP, dict_regexp_open,
#endif
@@ -290,6 +298,47 @@ DICT *dict_open3(const char *dict_type
if (dict_open_hash == 0)
dict_open_init();
if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0)
+#ifndef NO_DYNAMIC_MAPS
+ {
+ VSTRING *libname;
+ void *handle;
+
+ libname = vstring_alloc(38);
+ vstring_sprintf(libname, "%s/dict_%s-%s.so",
+ var_daemon_dir, dict_type, DEF_MAIL_VERSION);
+
+ if ((handle = dlopen(vstring_str(libname), RTLD_NOW)) == 0)
+ {
+ msg_warn("%s: dlopen failure loading %s: %s",
+ myname, vstring_str(libname), dlerror());
+ } else
+ {
+ VSTRING *funcname;
+ DICT *(*open_fptr) (const char *, int, int);
+ char *dlerrmsg;
+
+ funcname = vstring_alloc(16);
+ vstring_sprintf(funcname, "dict_%s_open", dict_type);
+
+ open_fptr = dlsym(handle, vstring_str(funcname));
+ if ((dlerrmsg = dlerror()) != 0)
+ {
+ msg_warn("%s: dlsym failure looking up \"%s\" in %s: %s",
+ myname, vstring_str(funcname),
+ vstring_str(libname), dlerrmsg);
+ } else
+ {
+ dict_open_register(dict_type, open_fptr);
+ }
+
+ vstring_free(funcname);
+ }
+
+ vstring_free(libname);
+ dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type);
+ }
+ if (dp == 0)
+#endif /* ! NO_DYNAMIC_MAPS */
msg_fatal("unsupported dictionary type: %s", dict_type);
if ((dict = dp->open(dict_name, open_flags, dict_flags)) == 0)
msg_fatal("opening %s:%s %m", dict_type, dict_name);