]> git.pld-linux.org Git - packages/postfix.git/blob - postfix-dynamicmaps.patch
- added german bounce templates
[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 -dur postfix-2.1.3.orig/src/global/mail_dict.c postfix-2.1.3/src/global/mail_dict.c
497 --- postfix-2.1.3.orig/src/global/mail_dict.c   2004-01-04 19:53:27.000000000 +0100
498 +++ postfix-2.1.3/src/global/mail_dict.c        2004-06-22 15:47:45.259202712 +0200
499 @@ -45,15 +45,6 @@
500  
501  static DICT_OPEN_INFO dict_open_info[] = {
502      DICT_TYPE_PROXY, dict_proxy_open,
503 -#ifdef HAS_LDAP
504 -    DICT_TYPE_LDAP, dict_ldap_open,
505 -#endif
506 -#ifdef HAS_MYSQL
507 -    DICT_TYPE_MYSQL, dict_mysql_open,
508 -#endif
509 -#ifdef HAS_PGSQL
510 -    DICT_TYPE_PGSQL, dict_pgsql_open,
511 -#endif
512      0,
513  };
514  
515
516 --- postfix-2.0.16.orig/conf/dynamicmaps.cf     1970-01-01 01:00:00.000000000 +0100
517 +++ postfix-2.0.16/conf/dynamicmaps.cf  2003-11-08 19:52:14.000000000 +0100
518 @@ -0,0 +1,9 @@
519 +# Postfix dynamic maps configuration file.
520 +#
521 +# The first match found is the one that is used.  The only wildcard
522 +# allowed is '*', which matches everything.  The first %s is expanded
523 +# to the map type.
524 +#
525 +#type  location of .so file                    name of open function
526 +#====  ================================        =====================
527 +*      /usr/lib/postfix/dict_%s.so             dict_%s_open
528 --- postfix-2.3-RC9/src/global/mail_params.c.orig       2006-07-11 19:37:10.708815544 +0200
529 +++ postfix-2.3-RC9/src/global/mail_params.c    2006-07-11 19:38:56.587719504 +0200
530 @@ -148,6 +148,8 @@
531  #ifdef STRCASECMP_IN_STRINGS_H
532  #include <strings.h>
533  #endif
534 +#include <safe_open.h>
535 +#include <mymalloc.h>
536  
537  /* Utility library. */
538  
539 @@ -248,6 +250,7 @@
540  char   *var_debug_peer_list;
541  int     var_debug_peer_level;
542  char   *var_reject_reply_msg_access_denied;
543 +int    var_command_maxtime;
544  int     var_fault_inj_code;
545  char   *var_bounce_service;
546  char   *var_cleanup_service;
547 @@ -433,6 +436,38 @@
548                   (long) var_sgid_gid);
549  }
550  
551 +static char *read_file(const char *name)
552 +{
553 +    char *ret;
554 +    VSTRING *why=vstring_alloc(1);
555 +    VSTRING *new_name=vstring_alloc(1);
556 +    VSTREAM *vp=safe_open(name, O_RDONLY, 0, NULL, -1, -1, why);
557 +
558 +    /*
559 +     * Ugly macros to make complex expressions less unreadable.
560 +     */
561 +#define SKIP(start, var, cond) \
562 +       for (var = start; *var && (cond); var++);
563 +
564 +#define TRIM(s) { \
565 +       char *p; \
566 +       for (p = (s) + strlen(s); p > (s) && ISSPACE(p[-1]); p--); \
567 +       *p = 0; \
568 +    }
569 +
570 +    if (!vp) {
571 +       msg_fatal("%s: unable to open: %s",name,vstring_str(why));
572 +    }
573 +    vstring_get_nonl(new_name,vp);
574 +    vstream_fclose(vp);
575 +    SKIP(vstring_str(new_name),ret,ISSPACE(*ret));
576 +    ret=mystrdup(ret);
577 +    TRIM(ret);
578 +    vstring_free(why);
579 +    vstring_free(new_name);
580 +    return ret;
581 +}
582 +
583  /* mail_params_init - configure built-in parameters */
584  
585  void    mail_params_init()
586 @@ -584,6 +619,9 @@
587       * Variables that are needed by almost every program.
588       */
589      get_mail_conf_str_table(other_str_defaults);
590 +    if (*var_myorigin=='/') {
591 +       var_myorigin=read_file(var_myorigin);
592 +    }
593      get_mail_conf_int_table(other_int_defaults);
594      get_mail_conf_bool_table(bool_defaults);
595      get_mail_conf_time_table(time_defaults);
596 --- postfix-2.3.0/src/global/Makefile.in        2006-07-17 03:28:25.732653648 +0200
597 +++ postfix-2.3.0/src/global/Makefile.in-new    2006-07-17 03:29:31.805609032 +0200
598 @@ -32,7 +32,7 @@
599         canon_addr.o cfg_parser.o cleanup_strerror.o cleanup_strflags.o \
600         clnt_stream.o conv_time.o db_common.o debug_peer.o debug_process.o \
601         defer.o deliver_completed.o deliver_flock.o deliver_pass.o \
602 -       deliver_request.o dict_ldap.o dict_mysql.o dict_pgsql.o \
603 +       deliver_request.o \
604         dict_proxy.o domain_list.o dot_lockfile.o dot_lockfile_as.o \
605         dsb_scan.o dsn.o dsn_buf.o dsn_mask.o dsn_print.o dsn_util.o \
606         ehlo_mask.o ext_prop.o file_id.o flush_clnt.o header_opts.o \
607 --- postfix-2.3.12/src/util/Makefile.in.orig    2007-07-31 01:18:35.000000000 +0200
608 +++ postfix-2.3.12/src/util/Makefile.in 2007-08-26 17:34:55.300706718 +0200
609 @@ -30,14 +30,14 @@
610         username.c valid_hostname.c vbuf.c vbuf_print.c vstream.c \
611         vstream_popen.c vstring.c vstring_vstream.c watchdog.c writable.c \
612         write_buf.c write_wait.c sane_basename.c format_tv.c allspace.c \
613 -       allascii.c load_file.c killme_after.c vstream_tweak.c
614 +       allascii.c load_file.c killme_after.c vstream_tweak.c load_lib.c
615  OBJS   = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
616         attr_print64.o attr_print_plain.o attr_scan0.o attr_scan64.o \
617         attr_scan_plain.o auto_clnt.o base64_code.o basename.o binhash.o \
618         chroot_uid.o cidr_match.o clean_env.o close_on_exec.o concatenate.o \
619         ctable.o dict.o dict_alloc.o dict_cdb.o dict_cidr.o dict_db.o \
620         dict_dbm.o dict_debug.o dict_env.o dict_ht.o dict_ni.o dict_nis.o \
621 -       dict_nisplus.o dict_open.o dict_pcre.o dict_regexp.o dict_sdbm.o \
622 +       dict_nisplus.o dict_open.o dict_regexp.o dict_sdbm.o \
623         dict_static.o dict_tcp.o dict_unix.o dir_forest.o doze.o dummy_read.o \
624         dummy_write.o duplex_pipe.o environ.o events.o exec_command.o \
625         fifo_listen.o fifo_trigger.o file_limit.o find_inet.o fsspace.o \
626 @@ -62,7 +62,7 @@
627         username.o valid_hostname.o vbuf.o vbuf_print.o vstream.o \
628         vstream_popen.o vstring.o vstring_vstream.o watchdog.o writable.o \
629         write_buf.o write_wait.o sane_basename.o format_tv.o allspace.o \
630 -       allascii.o load_file.o killme_after.o vstream_tweak.o
631 +       allascii.o load_file.o killme_after.o vstream_tweak.o load_lib.o
632  HDRS   = argv.h attr.h attr_clnt.h auto_clnt.h base64_code.h binhash.h \
633         chroot_uid.h cidr_match.h clean_env.h connect.h ctable.h dict.h \
634         dict_cdb.h dict_cidr.h dict_db.h dict_dbm.h dict_env.h dict_ht.h \
635 @@ -81,13 +81,14 @@
636         sigdelay.h sock_addr.h spawn_command.h split_at.h stat_as.h \
637         stringops.h sys_defs.h timed_connect.h timed_wait.h trigger.h \
638         username.h valid_hostname.h vbuf.h vbuf_print.h vstream.h vstring.h \
639 -       vstring_vstream.h watchdog.h format_tv.h load_file.h killme_after.h
640 +       vstring_vstream.h watchdog.h format_tv.h load_file.h killme_after.h load_lib.h
641  TESTSRC        = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \
642         stream_test.c dup2_pass_on_exec.c
643  DEFS   = -I. -D$(SYSTYPE)
644  CFLAGS = $(DEBUG) $(OPT) $(DEFS)
645  FILES  = Makefile $(SRCS) $(HDRS)
646  INCL   =
647 +PCRESO = dict_pcre.so
648  LIB    = libutil.a
649  TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
650         fifo_rdonly_bug fifo_rdwr_bug fifo_trigger fsspace fullname \
651 @@ -102,8 +103,9 @@
652  
653  LIB_DIR        = ../../lib
654  INC_DIR        = ../../include
655 +LIBS    = $(LIB_DIR)/$(LIB) $(LIB_DIR)/$(PCRESO)
656  
657 -.c.o:; $(CC) $(CFLAGS) -c $*.c
658 +.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
659  
660  all: $(LIB)
661  
662 @@ -114,15 +116,19 @@
663  
664  test:  $(TESTPROG)
665  
666 +$(PCRESO): dict_pcre.o
667 +       gcc -shared -Wl,-soname,dict_pcre.so -o $@ $? -lpcre -L. -lutil
668 +
669  $(LIB):        $(OBJS)
670 -       $(AR) $(ARFL) $(LIB) $?
671 -       $(RANLIB) $(LIB)
672 +       gcc -shared -Wl,-soname,libpostfix-util.so.1 -o $(LIB) $(OBJS) -ldl
673  
674  $(LIB_DIR)/$(LIB): $(LIB)
675         cp $(LIB) $(LIB_DIR)
676 -       $(RANLIB) $(LIB_DIR)/$(LIB)
677  
678 -update: $(LIB_DIR)/$(LIB) $(HDRS)
679 +$(LIB_DIR)/$(PCRESO): $(PCRESO)
680 +       cp $(PCRESO) $(LIB_DIR)
681 +
682 +update: $(LIBS) $(HDRS)
683         -for i in $(HDRS); \
684         do \
685           cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
686 @@ -144,7 +150,8 @@
687         lint $(SRCS)
688  
689  clean:
690 -       rm -f *.o $(LIB) *core $(TESTPROG) junk $(MAKES) *.tmp
691 +       rm -f *.o $(LIB) $(PCRESO) *core $(TESTPROG) \
692 +               junk $(MAKES) *.tmp
693         rm -rf printfck
694  
695  tidy:  clean
696 diff -durN postfix-2.1.3.orig/src/util/sys_defs.h postfix-2.1.3/src/util/sys_defs.h
697 --- postfix-2.1.3.orig/src/util/sys_defs.h      2004-06-22 15:38:57.190461088 +0200
698 +++ postfix-2.1.3/src/util/sys_defs.h   2004-06-22 15:39:24.255859620 +0200
699 @@ -700,6 +700,7 @@
700  #define STATFS_IN_SYS_VFS_H
701  #define PREPEND_PLUS_TO_OPTSTRING
702  #define HAS_POSIX_REGEXP
703 +#define HAS_DLOPEN
704  #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
705  #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
706  #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
707 @@ -754,6 +755,7 @@
708  #define STATFS_IN_SYS_VFS_H
709  #define PREPEND_PLUS_TO_OPTSTRING
710  #define HAS_POSIX_REGEXP
711 +#define HAS_DLOPEN
712  #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
713  #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
714  #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
715 @@ -638,6 +640,7 @@
716  #define USE_STATFS
717  #define STATFS_IN_SYS_VFS_H
718  #define HAS_POSIX_REGEXP
719 +#define HAS_SHL_LOAD
720  #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
721  #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
722  #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
723 @@ -673,6 +676,7 @@
724  #define USE_STATFS
725  #define STATFS_IN_SYS_VFS_H
726  #define HAS_POSIX_REGEXP
727 +#define HAS_SHL_LOAD
728  #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
729  #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
730  #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
This page took 0.136061 seconds and 3 git commands to generate.