https://rt.openpkg.org/Ticket/Display.html?id=285
USE_SOFTLIMITONLY kludge
Index: src/util/file_limit.c
--- src/util/file_limit.c.orig 2003-10-22 20:48:36 +0200
+++ src/util/file_limit.c 2005-02-06 13:34:59 +0100
@@ -80,12 +80,21 @@
void set_file_limit(off_t limit)
{
#ifdef USE_ULIMIT
+#ifdef USE_SOFTLIMITONLY
+#error "USE_ULIMIT and USE_SOFTLIMITONLY are mutual exclusive"
+#endif
if (ulimit(UL_SETFSIZE, limit / ULIMIT_BLOCK_SIZE) < 0)
msg_fatal("ulimit: %m");
#else
struct rlimit rlim;
+#ifdef USE_SOFTLIMITONLY
+ if (getrlimit(RLIMIT_FSIZE, &rlim) < 0)
+ rlim.rlim_max = RLIM_INFINITY;
+ rlim.rlim_cur = limit;
+#else
rlim.rlim_cur = rlim.rlim_max = limit;
+#endif
if (setrlimit(RLIMIT_FSIZE, &rlim) < 0)
msg_fatal("setrlimit: %m");
#ifdef SIGXFSZ
Index: src/util/msg_syslog.c
--- src/util/msg_syslog.c.orig 2004-01-04 17:14:58 +0100
+++ src/util/msg_syslog.c 2005-02-06 13:34:59 +0100
@@ -50,6 +50,11 @@
#include
#include
#include
+#ifdef USE_SOFTLIMITONLY
+#include
+#include
+#include
+#endif
/* Application-specific. */
@@ -144,6 +149,9 @@
static void msg_syslog_print(int level, const char *text)
{
+#ifdef USE_SOFTLIMITONLY
+ struct rlimit save, rlim;
+#endif
static int log_level[] = {
LOG_INFO, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_CRIT,
};
@@ -154,6 +162,15 @@
if (level < 0 || level >= (int) (sizeof(log_level) / sizeof(log_level[0])))
msg_panic("msg_syslog_print: invalid severity level: %d", level);
+#ifdef USE_SOFTLIMITONLY
+ if (getrlimit(RLIMIT_FSIZE, &save) < 0) {
+ save.rlim_cur = RLIM_INFINITY;
+ save.rlim_max = RLIM_INFINITY;
+ }
+ rlim.rlim_cur = save.rlim_max;
+ rlim.rlim_max = save.rlim_max;
+ (void)setrlimit(RLIMIT_FSIZE, &rlim);
+#endif
if (level == MSG_INFO) {
syslog(syslog_facility | log_level[level], "%.*s",
(int) MSG_SYSLOG_RECLEN, text);
@@ -161,6 +178,9 @@
syslog(syslog_facility | log_level[level], "%s: %.*s",
severity_name[level], (int) MSG_SYSLOG_RECLEN, text);
}
+#ifdef USE_SOFTLIMITONLY
+ (void)setrlimit(RLIMIT_FSIZE, &save);
+#endif
}
/* msg_syslog_init - initialize */
-----------------------------------------------------------------------------
Steffen Hansen has patched postfix-2.1.5 for making various client
information (ip, hostname etc.) available to processes run via the pipe
transport. The code has been accepted for postfix-2.2, but depending on
how far away from release that is, it might be a good idea to have the
patch in OpenPKG.
Index: man/man8/pipe.8
--- man/man8/pipe.8.orig 2004-08-09 16:51:07 +0200
+++ man/man8/pipe.8 2005-02-06 13:34:59 +0100
@@ -128,6 +128,22 @@
and replaced with corresponding information from the Postfix queue
manager delivery request:
.RS
+.IP \fB${\fBclient_address\fR}\fR
+This macro expands to the remote client network address.
+.sp
+This is available in Postfix 2.2 and later.
+.IP \fB${\fBclient_helo\fR}\fR
+This macro expands to the remote client HELO command parameter.
+.sp
+This is available in Postfix 2.2 and later.
+.IP \fB${\fBclient_hostname\fR}\fR
+This macro expands to the remote client hostname.
+.sp
+This is available in Postfix 2.2 and later.
+.IP \fB${\fBclient_protocol\fR}\fR
+This macro expands to the remote client protocol.
+.sp
+This is available in Postfix 2.2 and later.
.IP \fB${\fBextension\fR}\fR
This macro expands to the extension part of a recipient address.
For example, with an address \fIuser+foo@domain\fR the extension is
Index: src/pipe/pipe.c
--- src/pipe/pipe.c.orig 2004-07-24 01:09:21 +0200
+++ src/pipe/pipe.c 2005-02-06 13:34:59 +0100
@@ -332,6 +332,10 @@
#define PIPE_DICT_EXTENSION "extension" /* key */
#define PIPE_DICT_MAILBOX "mailbox" /* key */
#define PIPE_DICT_SIZE "size" /* key */
+#define PIPE_DICT_CLIENT_ADDR "client_address" /* key */
+#define PIPE_DICT_CLIENT_NAME "client_hostname" /* key */
+#define PIPE_DICT_CLIENT_PROTO "client_protocol" /* key */
+#define PIPE_DICT_CLIENT_HELO "client_helo" /* key */
/*
* Flags used to pass back the type of special parameter found by
@@ -412,6 +416,10 @@
PIPE_DICT_EXTENSION, PIPE_FLAG_EXTENSION,
PIPE_DICT_MAILBOX, PIPE_FLAG_MAILBOX,
PIPE_DICT_SIZE, 0,
+ PIPE_DICT_CLIENT_ADDR, 0,
+ PIPE_DICT_CLIENT_NAME, 0,
+ PIPE_DICT_CLIENT_PROTO, 0,
+ PIPE_DICT_CLIENT_HELO, 0,
0, 0,
};
struct cmd_flags *p;
@@ -954,6 +962,15 @@
dict_update(PIPE_DICT_TABLE, PIPE_DICT_SIZE, STR(buf));
vstring_free(buf);
+ dict_update(PIPE_DICT_TABLE, PIPE_DICT_CLIENT_ADDR,
+ request->client_addr);
+ dict_update(PIPE_DICT_TABLE, PIPE_DICT_CLIENT_HELO,
+ request->client_helo);
+ dict_update(PIPE_DICT_TABLE, PIPE_DICT_CLIENT_NAME,
+ request->client_name);
+ dict_update(PIPE_DICT_TABLE, PIPE_DICT_CLIENT_PROTO,
+ request->client_proto);
+
if ((expanded_argv = expand_argv(service, attr.command,
rcpt_list, attr.flags)) == 0) {
deliver_status = eval_command_status(PIPE_STAT_DEFER, service,
-----------------------------------------------------------------------------
Index: makedefs
--- makedefs.orig 2004-04-14 20:59:43 +0200
+++ makedefs 2005-02-06 13:34:59 +0100
@@ -93,6 +93,8 @@
;;
FreeBSD.5*) SYSTYPE=FREEBSD5
;;
+ FreeBSD.6*) SYSTYPE=FREEBSD6
+ ;;
OpenBSD.2*) SYSTYPE=OPENBSD2
;;
OpenBSD.3*) SYSTYPE=OPENBSD3
Index: src/util/sys_defs.h
--- src/util/sys_defs.h.orig 2004-08-01 23:05:23 +0200
+++ src/util/sys_defs.h 2005-02-06 13:34:59 +0100
@@ -24,7 +24,7 @@
* 4.4BSD and close derivatives.
*/
#if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \
- || defined(FREEBSD5) \
+ || defined(FREEBSD5) || defined(FREEBSD6) \
|| defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \
|| defined(OPENBSD2) || defined(OPENBSD3) \
|| defined(NETBSD1) || defined(NETBSD2) \