postfix/postfix.patch

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 147
13509f36148e
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     1 Index: makedefs
     2 --- makedefs.orig	2011-01-16 22:02:31.000000000 +0100
     3 +++ makedefs	2011-01-21 09:43:55.000000000 +0100
     4 @@ -153,6 +153,8 @@
     5  		;;
     6    FreeBSD.8*)	SYSTYPE=FREEBSD8
     7  		;;
     8 +  FreeBSD.9*)	SYSTYPE=FREEBSD9
     9 +		;;
    10    OpenBSD.2*)	SYSTYPE=OPENBSD2
    11  		;;
    12    OpenBSD.3*)	SYSTYPE=OPENBSD3
    13 Index: src/util/file_limit.c
    14 --- src/util/file_limit.c.orig	2003-10-22 20:48:36.000000000 +0200
    15 +++ src/util/file_limit.c	2011-01-21 09:43:55.000000000 +0100
    16 @@ -80,12 +80,21 @@
    17  void    set_file_limit(off_t limit)
    18  {
    19  #ifdef USE_ULIMIT
    20 +#ifdef USE_SOFTLIMITONLY
    21 +#error "USE_ULIMIT and USE_SOFTLIMITONLY are mutual exclusive"
    22 +#endif
    23      if (ulimit(UL_SETFSIZE, limit / ULIMIT_BLOCK_SIZE) < 0)
    24  	msg_fatal("ulimit: %m");
    25  #else
    26      struct rlimit rlim;
    28 +#ifdef USE_SOFTLIMITONLY
    29 +    if (getrlimit(RLIMIT_FSIZE, &rlim) < 0)
    30 +        rlim.rlim_max = RLIM_INFINITY;
    31 +    rlim.rlim_cur = limit;
    32 +#else
    33      rlim.rlim_cur = rlim.rlim_max = limit;
    34 +#endif
    35      if (setrlimit(RLIMIT_FSIZE, &rlim) < 0)
    36  	msg_fatal("setrlimit: %m");
    37  #ifdef SIGXFSZ
    38 Index: src/util/msg_syslog.c
    39 --- src/util/msg_syslog.c.orig	2006-06-15 20:07:16.000000000 +0200
    40 +++ src/util/msg_syslog.c	2011-01-21 09:43:55.000000000 +0100
    41 @@ -50,6 +50,11 @@
    42  #include <syslog.h>
    43  #include <string.h>
    44  #include <time.h>
    45 +#ifdef USE_SOFTLIMITONLY
    46 +#include <sys/time.h>
    47 +#include <sys/resource.h>
    48 +#include <signal.h>
    49 +#endif
    51  /* Application-specific. */
    53 @@ -144,6 +149,9 @@
    55  static void msg_syslog_print(int level, const char *text)
    56  {
    57 +#ifdef USE_SOFTLIMITONLY
    58 +    struct rlimit save, rlim;
    59 +#endif
    60      static int log_level[] = {
    61  	LOG_INFO, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_CRIT,
    62      };
    63 @@ -154,6 +162,15 @@
    64      if (level < 0 || level >= (int) (sizeof(log_level) / sizeof(log_level[0])))
    65  	msg_panic("msg_syslog_print: invalid severity level: %d", level);
    67 +#ifdef USE_SOFTLIMITONLY
    68 +    if (getrlimit(RLIMIT_FSIZE, &save) < 0) {
    69 +        save.rlim_cur = RLIM_INFINITY;
    70 +        save.rlim_max = RLIM_INFINITY;
    71 +    }
    72 +    rlim.rlim_cur = save.rlim_max;
    73 +    rlim.rlim_max = save.rlim_max;
    74 +    (void)setrlimit(RLIMIT_FSIZE, &rlim);
    75 +#endif
    76      if (level == MSG_INFO) {
    77  	syslog(syslog_facility | log_level[level], "%.*s",
    78  	       (int) MSG_SYSLOG_RECLEN, text);
    79 @@ -161,6 +178,9 @@
    80  	syslog(syslog_facility | log_level[level], "%s: %.*s",
    81  	       severity_name[level], (int) MSG_SYSLOG_RECLEN, text);
    82      }
    83 +#ifdef USE_SOFTLIMITONLY
    84 +    (void)setrlimit(RLIMIT_FSIZE, &save);
    85 +#endif
    86  }
    88  /* msg_syslog_init - initialize */
    89 Index: src/util/sys_defs.h
    90 --- src/util/sys_defs.h.orig	2011-01-17 15:44:25.000000000 +0100
    91 +++ src/util/sys_defs.h	2011-01-21 09:43:55.000000000 +0100
    92 @@ -25,7 +25,7 @@
    93    */
    94  #if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \
    95      || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \
    96 -    || defined(FREEBSD8) \
    97 +    || defined(FREEBSD8) || defined(FREEBSD9) \
    98      || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \
    99      || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \
   100      || defined(OPENBSD5) \
   101 @@ -117,6 +117,10 @@
   102  #define HAS_CLOSEFROM
   103  #endif
   105 +#if (__FreeBSD_version < 800000 && __FreeBSD_version >= 702104) || (__FreeBSD_version >= 800100)
   106 +#define HAS_CLOSEFROM
   107 +#endif
   108 +
   109  /* OpenBSD version is year+month */
   111  #if OpenBSD >= 199805			/* XXX */

mercurial