postfix/postfix.patch

Fri, 03 Aug 2012 20:11:53 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 03 Aug 2012 20:11:53 +0200
changeset 470
f8813e60f168
parent 146
bc79b3740eb8
child 495
01294b31a79e
permissions
-rw-r--r--

Neutralize buggy code causing OpenPKG to have 'fatal problems' in
spite of correct installation, configuration, and operation. An
administrator suffering from this failure is even unable to
uninstall the flawed software.

     1 Index: makedefs
     2 --- makedefs.orig	2008-01-15 21:20:24 +0100
     3 +++ makedefs	2008-01-24 12:31:48 +0100
     4 @@ -132,6 +132,10 @@
     5  		;;
     6    FreeBSD.7*)	SYSTYPE=FREEBSD7
     7  		;;
     8 +  FreeBSD.7*)	SYSTYPE=FREEBSD7
     9 +		;;
    10 +  FreeBSD.8*)	SYSTYPE=FREEBSD8
    11 +		;;
    12    OpenBSD.2*)	SYSTYPE=OPENBSD2
    13  		;;
    14    OpenBSD.3*)	SYSTYPE=OPENBSD3
    15 Index: src/util/file_limit.c
    16 --- src/util/file_limit.c.orig	2003-10-22 20:48:36 +0200
    17 +++ src/util/file_limit.c	2008-01-24 12:31:48 +0100
    18 @@ -80,12 +80,21 @@
    19  void    set_file_limit(off_t limit)
    20  {
    21  #ifdef USE_ULIMIT
    22 +#ifdef USE_SOFTLIMITONLY
    23 +#error "USE_ULIMIT and USE_SOFTLIMITONLY are mutual exclusive"
    24 +#endif
    25      if (ulimit(UL_SETFSIZE, limit / ULIMIT_BLOCK_SIZE) < 0)
    26  	msg_fatal("ulimit: %m");
    27  #else
    28      struct rlimit rlim;
    30 +#ifdef USE_SOFTLIMITONLY
    31 +    if (getrlimit(RLIMIT_FSIZE, &rlim) < 0)
    32 +        rlim.rlim_max = RLIM_INFINITY;
    33 +    rlim.rlim_cur = limit;
    34 +#else
    35      rlim.rlim_cur = rlim.rlim_max = limit;
    36 +#endif
    37      if (setrlimit(RLIMIT_FSIZE, &rlim) < 0)
    38  	msg_fatal("setrlimit: %m");
    39  #ifdef SIGXFSZ
    40 Index: src/util/msg_syslog.c
    41 --- src/util/msg_syslog.c.orig	2006-06-15 20:07:16 +0200
    42 +++ src/util/msg_syslog.c	2008-01-24 12:31:48 +0100
    43 @@ -50,6 +50,11 @@
    44  #include <syslog.h>
    45  #include <string.h>
    46  #include <time.h>
    47 +#ifdef USE_SOFTLIMITONLY
    48 +#include <sys/time.h>
    49 +#include <sys/resource.h>
    50 +#include <signal.h>
    51 +#endif
    53  /* Application-specific. */
    55 @@ -144,6 +149,9 @@
    57  static void msg_syslog_print(int level, const char *text)
    58  {
    59 +#ifdef USE_SOFTLIMITONLY
    60 +    struct rlimit save, rlim;
    61 +#endif
    62      static int log_level[] = {
    63  	LOG_INFO, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_CRIT,
    64      };
    65 @@ -154,6 +162,15 @@
    66      if (level < 0 || level >= (int) (sizeof(log_level) / sizeof(log_level[0])))
    67  	msg_panic("msg_syslog_print: invalid severity level: %d", level);
    69 +#ifdef USE_SOFTLIMITONLY
    70 +    if (getrlimit(RLIMIT_FSIZE, &save) < 0) {
    71 +        save.rlim_cur = RLIM_INFINITY;
    72 +        save.rlim_max = RLIM_INFINITY;
    73 +    }
    74 +    rlim.rlim_cur = save.rlim_max;
    75 +    rlim.rlim_max = save.rlim_max;
    76 +    (void)setrlimit(RLIMIT_FSIZE, &rlim);
    77 +#endif
    78      if (level == MSG_INFO) {
    79  	syslog(syslog_facility | log_level[level], "%.*s",
    80  	       (int) MSG_SYSLOG_RECLEN, text);
    81 @@ -161,6 +178,9 @@
    82  	syslog(syslog_facility | log_level[level], "%s: %.*s",
    83  	       severity_name[level], (int) MSG_SYSLOG_RECLEN, text);
    84      }
    85 +#ifdef USE_SOFTLIMITONLY
    86 +    (void)setrlimit(RLIMIT_FSIZE, &save);
    87 +#endif
    88  }
    90  /* msg_syslog_init - initialize */
    91 Index: src/util/sys_defs.h
    92 --- src/util/sys_defs.h.orig	2008-01-15 01:51:44 +0100
    93 +++ src/util/sys_defs.h	2008-01-24 12:32:41 +0100
    94 @@ -24,7 +24,7 @@
    95    * 4.4BSD and close derivatives.
    96    */
    97  #if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \
    98 -    || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \
    99 +    || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) || defined(FREEBSD8) \
   100      || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \
   101      || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \
   102      || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \
   103 Index: src/smtp/smtp_reuse.c
   104 --- src/smtp/smtp_reuse.c.orig	2008-12-04 01:06:42.000000000 +0100
   105 +++ src/smtp/smtp_reuse.c	2009-04-06 20:38:18.974597344 +0200
   106 @@ -216,7 +216,9 @@
   107      /*
   108       * Avoid poor performance when TCP MSS > VSTREAM_BUFSIZE.
   109       */
   110 +#if 0
   111      vstream_tweak_sock(session->stream);
   112 +#endif
   114      /*
   115       * Update the list of used cached addresses.

mercurial