]> git.pld-linux.org Git - packages/postfix.git/blob - postfix-dynamicmaps.patch
- updated for 2.3.12
[packages/postfix.git] / postfix-dynamicmaps.patch
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 @@
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  
13 @@ -24,12 +24,10 @@
14  tests: test
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); \
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
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
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
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 */
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)
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 @@
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    */
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
157 @@ -158,6 +158,9 @@
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>
167 @@ -181,6 +184,14 @@
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    */
182 @@ -212,9 +223,11 @@
183  #ifdef HAS_NETINFO
184      DICT_TYPE_NETINFO, dict_ni_open,
185  #endif
186 +#ifndef MAX_DYNAMIC_MAPS
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
194 @@ -269,8 +282,38 @@
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)
235 @@ -317,6 +360,76 @@
236      return mapnames;
237  }
238  
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 */
308 +
309  #ifdef TEST
310  
311   /*
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
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 +}
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
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
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 @@
500  #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
501  #define PREPEND_PLUS_TO_OPTSTRING
502  #define HAS_POSIX_REGEXP
503 +#define HAS_DLOPEN
504  #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
505  #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
506  #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
507 @@ -596,6 +597,7 @@
508  #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT  /* unverified */
509  #define PREPEND_PLUS_TO_OPTSTRING
510  #define HAS_POSIX_REGEXP
511 +#define HAS_DLOPEN
512  #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
513  #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
514  #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
515 @@ -638,6 +640,7 @@
516  #define USE_STATFS
517  #define STATFS_IN_SYS_VFS_H
518  #define HAS_POSIX_REGEXP
519 +#define HAS_SHL_LOAD
520  #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
521  #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
522  #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
523 @@ -673,6 +676,7 @@
524  #define USE_STATFS
525  #define STATFS_IN_SYS_VFS_H
526  #define HAS_POSIX_REGEXP
527 +#define HAS_SHL_LOAD
528  #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
529  #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
530  #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
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
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.0/src/global/Makefile.in        2006-07-17 03:28:25.732653648 +0200
632 +++ postfix-2.3.0/src/global/Makefile.in-new    2006-07-17 03:29:31.805609032 +0200
633 @@ -32,7 +32,7 @@
634         canon_addr.o cfg_parser.o cleanup_strerror.o cleanup_strflags.o \
635         clnt_stream.o conv_time.o db_common.o debug_peer.o debug_process.o \
636         defer.o deliver_completed.o deliver_flock.o deliver_pass.o \
637 -       deliver_request.o dict_ldap.o dict_mysql.o dict_pgsql.o \
638 +       deliver_request.o \
639         dict_proxy.o domain_list.o dot_lockfile.o dot_lockfile_as.o \
640         dsb_scan.o dsn.o dsn_buf.o dsn_mask.o dsn_print.o dsn_util.o \
641         ehlo_mask.o ext_prop.o file_id.o flush_clnt.o header_opts.o \
642 --- postfix-2.3.12/src/util/Makefile.in.orig    2007-07-31 01:18:35.000000000 +0200
643 +++ postfix-2.3.12/src/util/Makefile.in 2007-08-26 17:34:55.300706718 +0200
644 @@ -30,14 +30,14 @@
645         username.c valid_hostname.c vbuf.c vbuf_print.c vstream.c \
646         vstream_popen.c vstring.c vstring_vstream.c watchdog.c writable.c \
647         write_buf.c write_wait.c sane_basename.c format_tv.c allspace.c \
648 -       allascii.c load_file.c vstream_tweak.c
649 +       allascii.c load_file.c vstream_tweak.c load_lib.c
650  OBJS   = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
651         attr_print64.o attr_print_plain.o attr_scan0.o attr_scan64.o \
652         attr_scan_plain.o auto_clnt.o base64_code.o basename.o binhash.o \
653         chroot_uid.o cidr_match.o clean_env.o close_on_exec.o concatenate.o \
654         ctable.o dict.o dict_alloc.o dict_cdb.o dict_cidr.o dict_db.o \
655         dict_dbm.o dict_debug.o dict_env.o dict_ht.o dict_ni.o dict_nis.o \
656 -       dict_nisplus.o dict_open.o dict_pcre.o dict_regexp.o dict_sdbm.o \
657 +       dict_nisplus.o dict_open.o dict_regexp.o dict_sdbm.o \
658         dict_static.o dict_tcp.o dict_unix.o dir_forest.o doze.o dummy_read.o \
659         dummy_write.o duplex_pipe.o environ.o events.o exec_command.o \
660         fifo_listen.o fifo_trigger.o file_limit.o find_inet.o fsspace.o \
661 @@ -62,7 +62,7 @@
662         username.o valid_hostname.o vbuf.o vbuf_print.o vstream.o \
663         vstream_popen.o vstring.o vstring_vstream.o watchdog.o writable.o \
664         write_buf.o write_wait.o sane_basename.o format_tv.o allspace.o \
665 -       allascii.o load_file.o vstream_tweak.o
666 +       allascii.o load_file.o vstream_tweak.o load_lib.o 
667  HDRS   = argv.h attr.h attr_clnt.h auto_clnt.h base64_code.h binhash.h \
668         chroot_uid.h cidr_match.h clean_env.h connect.h ctable.h dict.h \
669         dict_cdb.h dict_cidr.h dict_db.h dict_dbm.h dict_env.h dict_ht.h \
670 @@ -81,13 +81,14 @@
671         sigdelay.h sock_addr.h spawn_command.h split_at.h stat_as.h \
672         stringops.h sys_defs.h timed_connect.h timed_wait.h trigger.h \
673         username.h valid_hostname.h vbuf.h vbuf_print.h vstream.h vstring.h \
674 -       vstring_vstream.h watchdog.h format_tv.h load_file.h
675 +       vstring_vstream.h watchdog.h format_tv.h load_file.h load_lib.h
676  TESTSRC        = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \
677         stream_test.c dup2_pass_on_exec.c
678  DEFS   = -I. -D$(SYSTYPE)
679  CFLAGS = $(DEBUG) $(OPT) $(DEFS)
680  FILES  = Makefile $(SRCS) $(HDRS)
681  INCL   =
682 +PCRESO = dict_pcre.so
683  LIB    = libutil.a
684  TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
685         fifo_rdonly_bug fifo_rdwr_bug fifo_trigger fsspace fullname \
686 @@ -102,8 +103,9 @@
687  
688  LIB_DIR        = ../../lib
689  INC_DIR        = ../../include
690 +LIBS    = $(LIB_DIR)/$(LIB) $(LIB_DIR)/$(PCRESO)
691  
692 -.c.o:; $(CC) $(CFLAGS) -c $*.c
693 +.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
694  
695  all: $(LIB)
696  
697 @@ -114,15 +116,19 @@
698  
699  test:  $(TESTPROG)
700  
701 +$(PCRESO): dict_pcre.o
702 +       gcc -shared -Wl,-soname,dict_pcre.so -o $@ $? -lpcre -L. -lutil
703 +
704  $(LIB):        $(OBJS)
705 -       $(AR) $(ARFL) $(LIB) $?
706 -       $(RANLIB) $(LIB)
707 +       gcc -shared -Wl,-soname,libpostfix-util.so.1 -o $(LIB) $(OBJS) -ldl
708  
709  $(LIB_DIR)/$(LIB): $(LIB)
710         cp $(LIB) $(LIB_DIR)
711 -       $(RANLIB) $(LIB_DIR)/$(LIB)
712  
713 -update: $(LIB_DIR)/$(LIB) $(HDRS)
714 +$(LIB_DIR)/$(PCRESO): $(PCRESO)
715 +       cp $(PCRESO) $(LIB_DIR)
716 +
717 +update: $(LIBS) $(HDRS)
718         -for i in $(HDRS); \
719         do \
720           cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
721 @@ -144,7 +150,8 @@
722         lint $(SRCS)
723  
724  clean:
725 -       rm -f *.o $(LIB) *core $(TESTPROG) junk $(MAKES) *.tmp
726 +       rm -f *.o $(LIB) $(PCRESO) *core $(TESTPROG) \
727 +               junk $(MAKES) *.tmp
728         rm -rf printfck
729  
730  tidy:  clean
This page took 0.163594 seconds and 4 git commands to generate.