From: Wietse Venema Date: Wed, 14 Feb 2007 05:00:00 +0000 (-0500) Subject: postfix-2.4-20070214 X-Git-Tag: v2.4.0-RC1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba49bcdc8dd5224a12467be5c08e74cbbcac783f;p=thirdparty%2Fpostfix.git postfix-2.4-20070214 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 613550be2..14cb15f59 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -13225,8 +13225,19 @@ Apologies for any names omitted. events.c handler, undid some unnecessary changes to the {read,write}{_wait,able}.c modules, and addressed Victor's paranoia for multi-client servers with a thousand clients - while linked with third-party libraries that can't handle - file descriptors >= FD_SETSIZE. + while linked with library routines that can't handle file + descriptors >= FD_SETSIZE. + + Cleanup: while debugging the new events.c handler, removed + an unnecessary "write after connect" call-back event. File: + global/post_mail.c. + +20070214 + + Robustness: in the queue manager keep a number of free file + descriptor slots at the low end, to work around library + routines that can't handle file descriptors >= FD_SETSIZE. + Files: *qmgr/qmgr_transport.c, util/vstream.[hc] Wish list: diff --git a/postfix/README_FILES/LMTP_README b/postfix/README_FILES/LMTP_README deleted file mode 100644 index 256bf4667..000000000 --- a/postfix/README_FILES/LMTP_README +++ /dev/null @@ -1,5 +0,0 @@ -PPoossttffiixx LLMMTTPP HHoowwttoo - -------------------------------------------------------------------------------- -This document will be made available via http://www.postfix.org/. - diff --git a/postfix/README_FILES/OVERVIEW b/postfix/README_FILES/OVERVIEW index 1d9ae180f..7331c2b1b 100644 --- a/postfix/README_FILES/OVERVIEW +++ b/postfix/README_FILES/OVERVIEW @@ -136,8 +136,7 @@ unnumbered names inside shaded areas represent Postfix queues. delivery to mailbox servers such as Cyrus. The advantage of this setup is that one Postfix machine can feed multiple mailbox servers over LMTP. The opposite is true as well: one mailbox server can be fed over LMTP by - multiple Postfix machines. The LMTP_README document gives examples of how - to use the lmtp(8) client. + multiple Postfix machines. * The local(8) delivery agent understands UNIX-style mailboxes, qmail- compatible maildir files, Sendmail-style system-wide aliases(5) databases, diff --git a/postfix/conf/postfix-files b/postfix/conf/postfix-files index b0a0bfe68..b483b9146 100644 --- a/postfix/conf/postfix-files +++ b/postfix/conf/postfix-files @@ -242,7 +242,6 @@ $readme_directory/INSTALL:f:root:-:644 $readme_directory/IPV6_README:f:root:-:644 $readme_directory/LDAP_README:f:root:-:644 $readme_directory/LINUX_README:f:root:-:644 -$readme_directory/LMTP_README:f:root:-:644 $readme_directory/LOCAL_RECIPIENT_README:f:root:-:644 $readme_directory/MACOSX_README:f:root:-:644:o $readme_directory/MAILDROP_README:f:root:-:644 @@ -292,7 +291,6 @@ $html_directory/INSTALL.html:f:root:-:644 $html_directory/IPV6_README.html:f:root:-:644 $html_directory/LDAP_README.html:f:root:-:644 $html_directory/LINUX_README.html:f:root:-:644 -$html_directory/LMTP_README.html:f:root:-:644 $html_directory/LOCAL_RECIPIENT_README.html:f:root:-:644 $html_directory/MAILDROP_README.html:f:root:-:644 $html_directory/MILTER_README.html:f:root:-:644 diff --git a/postfix/html/LMTP_README.html b/postfix/html/LMTP_README.html deleted file mode 100644 index 715c216e5..000000000 --- a/postfix/html/LMTP_README.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - -Postfix LMTP Howto - - - - - - - -

Postfix LMTP Howto

- -
- -

This document will be made available via http://www.postfix.org/.

- - - - diff --git a/postfix/html/OVERVIEW.html b/postfix/html/OVERVIEW.html index 9bdf973e6..015f6e940 100644 --- a/postfix/html/OVERVIEW.html +++ b/postfix/html/OVERVIEW.html @@ -359,8 +359,7 @@ is optimized for delivery to mailbox servers such as Cyrus. The advantage of this setup is that one Postfix machine can feed multiple mailbox servers over LMTP. The opposite is true as well: one mailbox server can be fed over LMTP by multiple Postfix machines. -The LMTP_README document gives examples of how to use the lmtp(8) -client.

+

  • The local(8) delivery agent understands UNIX-style mailboxes, qmail-compatible maildir files, Sendmail-style system-wide aliases(5) diff --git a/postfix/makedefs b/postfix/makedefs index 4e80525dc..3a6842861 100644 --- a/postfix/makedefs +++ b/postfix/makedefs @@ -33,6 +33,10 @@ # Do not build with Linux EPOLL support. # By default, EPOLL support is compiled in on platforms that # are known to support it. +# .IP \fB-DNO_KQUEUE\fR +# Do not build with FreeBSD/NetBSD/OpenBSD KQUEUE support. +# By default, KQUEUE support is compiled in on platforms that +# are known to support it. # .IP \fB-DNO_IPV6\fR # Do not build with IPv6 support. # By default, IPv6 support is compiled in on platforms that @@ -162,7 +166,7 @@ case "$SYSTEM.$RELEASE" in SunOS.5*) SYSTYPE=SUNOS5 RANLIB=echo SYSLIBS="-lresolv -lsocket -lnsl" - # Solaris 8 added usleep() and POSIX regular expressions + # Solaris 5 added usleep() and POSIX regular expressions case $RELEASE in 5.[0-4]) CCARGS="$CCARGS -DMISSING_USLEEP -DNO_POSIX_REGEXP";; esac diff --git a/postfix/proto/LMTP_README.html b/postfix/proto/LMTP_README.html deleted file mode 100644 index 1cf2b7c09..000000000 --- a/postfix/proto/LMTP_README.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - -Postfix LMTP Howto - - - - - - - -

    Postfix LMTP Howto

    - -
    - -

    This document will be made available via http://www.postfix.org/.

    - - - - diff --git a/postfix/proto/Makefile.in b/postfix/proto/Makefile.in index 17b3e41e8..594b32bae 100644 --- a/postfix/proto/Makefile.in +++ b/postfix/proto/Makefile.in @@ -22,7 +22,7 @@ HTML = ../html/ADDRESS_CLASS_README.html \ ../html/ETRN_README.html ../html/FILTER_README.html \ ../html/INSTALL.html ../html/IPV6_README.html \ ../html/LDAP_README.html \ - ../html/LINUX_README.html ../html/LMTP_README.html \ + ../html/LINUX_README.html \ ../html/LOCAL_RECIPIENT_README.html ../html/MAILDROP_README.html \ ../html/MILTER_README.html \ ../html/MYSQL_README.html ../html/NFS_README.html \ @@ -58,7 +58,7 @@ README = ../README_FILES/ADDRESS_CLASS_README \ ../README_FILES/ETRN_README ../README_FILES/FILTER_README \ ../README_FILES/INSTALL ../README_FILES/IPV6_README \ ../README_FILES/LDAP_README \ - ../README_FILES/LINUX_README ../README_FILES/LMTP_README \ + ../README_FILES/LINUX_README \ ../README_FILES/LOCAL_RECIPIENT_README ../README_FILES/MAILDROP_README \ ../README_FILES/MILTER_README \ ../README_FILES/MYSQL_README ../README_FILES/NFS_README \ @@ -183,9 +183,6 @@ clobber: ../html/LINUX_README.html: LINUX_README.html $(POSTLINK) $? >$@ -../html/LMTP_README.html: LMTP_README.html - $(POSTLINK) $? >$@ - ../html/LOCAL_RECIPIENT_README.html: LOCAL_RECIPIENT_README.html $(POSTLINK) $? >$@ @@ -327,9 +324,6 @@ clobber: ../README_FILES/LINUX_README: LINUX_README.html $(HT2READ) $? >$@ -../README_FILES/LMTP_README: LMTP_README.html - $(HT2READ) $? >$@ - ../README_FILES/LOCAL_RECIPIENT_README: LOCAL_RECIPIENT_README.html $(HT2READ) $? >$@ diff --git a/postfix/proto/OVERVIEW.html b/postfix/proto/OVERVIEW.html index c6a83be83..946837d15 100644 --- a/postfix/proto/OVERVIEW.html +++ b/postfix/proto/OVERVIEW.html @@ -359,8 +359,7 @@ is optimized for delivery to mailbox servers such as Cyrus. The advantage of this setup is that one Postfix machine can feed multiple mailbox servers over LMTP. The opposite is true as well: one mailbox server can be fed over LMTP by multiple Postfix machines. -The LMTP_README document gives examples of how to use the lmtp(8) -client.

    +

  • The local(8) delivery agent understands UNIX-style mailboxes, qmail-compatible maildir files, Sendmail-style system-wide aliases(5) diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 8742a07dd..4a9f60a5d 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20070212" +#define MAIL_RELEASE_DATE "20070214" #define MAIL_VERSION_NUMBER "2.4" #ifdef SNAPSHOT diff --git a/postfix/src/oqmgr/qmgr_transport.c b/postfix/src/oqmgr/qmgr_transport.c index 7ff31c57f..768c39bfe 100644 --- a/postfix/src/oqmgr/qmgr_transport.c +++ b/postfix/src/oqmgr/qmgr_transport.c @@ -71,6 +71,14 @@ #include #include +#include /* FD_SETSIZE */ +#include /* FD_SETSIZE */ +#include /* FD_SETSIZE */ + +#ifdef USE_SYS_SELECT_H +#include /* FD_SETSIZE */ +#endif + /* Utility library. */ #include @@ -333,6 +341,11 @@ void qmgr_transport_alloc(QMGR_TRANSPORT *transport, QMGR_TRANSPORT_ALLOC_NOT event_request_timer(qmgr_transport_event, (char *) alloc, 0); return; } +#if !defined(USE_SELECT_EVENTS) && defined(VSTREAM_CTL_DUPFD) + vstream_control(alloc->stream, + VSTREAM_CTL_DUPFD, FD_SETSIZE / 8, + VSTREAM_CTL_END); +#endif event_enable_read(vstream_fileno(alloc->stream), qmgr_transport_event, (char *) alloc); diff --git a/postfix/src/qmgr/qmgr_transport.c b/postfix/src/qmgr/qmgr_transport.c index de04bd192..862979dd2 100644 --- a/postfix/src/qmgr/qmgr_transport.c +++ b/postfix/src/qmgr/qmgr_transport.c @@ -76,6 +76,14 @@ #include #include +#include /* FD_SETSIZE */ +#include /* FD_SETSIZE */ +#include /* FD_SETSIZE */ + +#ifdef USE_SYS_SELECT_H +#include /* FD_SETSIZE */ +#endif + /* Utility library. */ #include @@ -338,6 +346,11 @@ void qmgr_transport_alloc(QMGR_TRANSPORT *transport, QMGR_TRANSPORT_ALLOC_NOT event_request_timer(qmgr_transport_event, (char *) alloc, 0); return; } +#if !defined(USE_SELECT_EVENTS) && defined(VSTREAM_CTL_DUPFD) + vstream_control(alloc->stream, + VSTREAM_CTL_DUPFD, FD_SETSIZE / 8, + VSTREAM_CTL_END); +#endif event_enable_read(vstream_fileno(alloc->stream), qmgr_transport_event, (char *) alloc); diff --git a/postfix/src/util/events.c b/postfix/src/util/events.c index e12f4bcda..81f2e6b80 100644 --- a/postfix/src/util/events.c +++ b/postfix/src/util/events.c @@ -328,6 +328,7 @@ typedef struct kevent EVENT_BUFFER; (event_count) = kevent(event_kq, (struct kevent *) 0, 0, (event_buf), \ (buflen), (tsp)); \ } while (0) +#define EVENT_BUFFER_READ_TEXT "kevent" /* * Macros to process event buffers from the kernel; see event_loop(). @@ -396,6 +397,7 @@ typedef struct pollfd EVENT_BUFFER; dvpoll.dp_timeout = (delay) < 0 ? -1 : (delay) * 1000; \ (event_count) = ioctl(event_pollfd, DP_POLL, &dvpoll); \ } while (0) +#define EVENT_BUFFER_READ_TEXT "ioctl DP_POLL" /* * Macros to process event buffers from the kernel; see event_loop(). @@ -465,6 +467,7 @@ typedef struct epoll_event EVENT_BUFFER; (event_count) = epoll_wait(event_epollfd, (event_buf), (buflen), \ (delay) < 0 ? -1 : (delay) * 1000); \ } while (0) +#define EVENT_BUFFER_READ_TEXT "epoll_wait" /* * Macros to process event buffers from the kernel; see event_loop(). @@ -918,9 +921,9 @@ void event_loop(int delay) #else EVENT_BUFFER event_buf[100]; EVENT_BUFFER *bp; - int event_count; #endif + int event_count; EVENT_TIMER *timer; int fd; EVENT_FDTABLE *fdp; @@ -982,7 +985,8 @@ void event_loop(int delay) wmask = event_wmask; xmask = event_xmask; - if (select(event_max_fd + 1, &rmask, &wmask, &xmask, tvp) < 0) { + event_count = select(event_max_fd + 1, &rmask, &wmask, &xmask, tvp); + if (event_count < 0) { if (errno != EINTR) msg_fatal("event_loop: select: %m"); return; @@ -993,7 +997,7 @@ void event_loop(int delay) select_delay); if (event_count < 0) { if (errno != EINTR) - msg_fatal("event_loop: kevent: %m"); + msg_fatal("event_loop: " EVENT_BUFFER_READ_TEXT ": %m"); return; } #endif @@ -1034,7 +1038,7 @@ void event_loop(int delay) * application to determine when a read or write is complete. */ #ifdef USE_SELECT_EVENTS - for (fd = 0; fd <= event_max_fd; fd++) { + for (fd = 0; event_count > 0 && fd <= event_max_fd; fd++) { if (FD_ISSET(fd, &event_xmask)) { /* In case event_fdtable is updated. */ fdp = event_fdtable + fd; diff --git a/postfix/src/util/sys_defs.h b/postfix/src/util/sys_defs.h index 6d4b8e4c2..e4e5af3a4 100644 --- a/postfix/src/util/sys_defs.h +++ b/postfix/src/util/sys_defs.h @@ -157,10 +157,12 @@ # define USE_SYSV_POLL #endif -#if (defined(__FreeBSD_version) && __FreeBSD_version >= 410000) \ +#ifndef NO_KQUEUE +# if (defined(__FreeBSD_version) && __FreeBSD_version >= 410000) \ || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 200000000) \ || (defined(OpenBSD) && OpenBSD >= 200105) /* OpenBSD 2.9 */ -# define USE_KQUEUE_EVENTS +# define USE_KQUEUE_EVENTS +# endif #endif #endif diff --git a/postfix/src/util/vstream.c b/postfix/src/util/vstream.c index 602d659d3..90d3ab2ed 100644 --- a/postfix/src/util/vstream.c +++ b/postfix/src/util/vstream.c @@ -260,6 +260,12 @@ /* The argument specifies the file descriptor to be used for writing. /* This feature is limited to double-buffered streams, and makes the /* stream non-seekable. +/* .IP "VSTREAM_CTL_DUPFD (int)" +/* The argument specifies a minimum file descriptor value. If +/* the actual stream's file descriptors are below the minimum, +/* reallocate the descriptors to the first free value greater +/* than or equal to the minimum. The VSTREAM_CTL_DUPFD macro +/* is defined only on systems with fcntl() F_DUPFD support. /* .IP "VSTREAM_CTL_WAITPID_FN (int (*)(pid_t, WAIT_STATUS_T *, int))" /* A pointer to function that behaves like waitpid(). This information /* is used by the vstream_pclose() routine. @@ -1163,6 +1169,8 @@ void vstream_control(VSTREAM *stream, int name,...) { const char *myname = "vstream_control"; va_list ap; + int floor; + int old_fd; for (va_start(ap, name); name != VSTREAM_CTL_END; name = va_arg(ap, int)) { switch (name) { @@ -1216,6 +1224,30 @@ void vstream_control(VSTREAM *stream, int name,...) if (stream->jbuf == 0) stream->jbuf = (jmp_buf *) mymalloc(sizeof(jmp_buf)); break; + +#ifdef VSTREAM_CTL_DUPFD + +#define VSTREAM_TRY_DUPFD(backup, fd, floor) do { \ + if (((backup) = (fd)) < floor) { \ + if (((fd) = fcntl((backup), F_DUPFD, (floor))) < 0) \ + msg_fatal("fcntl F_DUPFD %d: %m", (floor)); \ + (void) close(backup); \ + } \ + } while (0) + + case VSTREAM_CTL_DUPFD: + floor = va_arg(ap, int); + if (stream->buf.flags & VSTREAM_FLAG_DOUBLE) { + VSTREAM_TRY_DUPFD(old_fd, stream->read_fd, floor); + if (stream->write_fd == old_fd) + stream->write_fd = stream->read_fd; + else + VSTREAM_TRY_DUPFD(old_fd, stream->write_fd, floor); + } else { + VSTREAM_TRY_DUPFD(old_fd, stream->fd, floor); + } + break; +#endif default: msg_panic("%s: bad name %d", myname, name); } diff --git a/postfix/src/util/vstream.h b/postfix/src/util/vstream.h index 625309298..dc2ebb9f8 100644 --- a/postfix/src/util/vstream.h +++ b/postfix/src/util/vstream.h @@ -120,6 +120,9 @@ extern void vstream_control(VSTREAM *, int,...); #define VSTREAM_CTL_TIMEOUT 8 #define VSTREAM_CTL_EXCEPT 9 #define VSTREAM_CTL_CONTEXT 10 +#ifdef F_DUPFD +#define VSTREAM_CTL_DUPFD 11 +#endif extern VSTREAM *PRINTFLIKE(1, 2) vstream_printf(const char *,...); extern VSTREAM *PRINTFLIKE(2, 3) vstream_fprintf(VSTREAM *, const char *,...);