2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-30 13:48:06 +00:00

postfix-2.10-20120713

This commit is contained in:
Wietse Venema
2012-07-13 00:00:00 -05:00
committed by Viktor Dukhovni
parent deb9a91c56
commit 38d3295b38
10 changed files with 67 additions and 41 deletions

View File

@@ -17877,3 +17877,20 @@ Apologies for any names omitted.
20120629 20120629
Workaround: "sendmail -bl" emulation. File: sendmail/sendmail.c. Workaround: "sendmail -bl" emulation. File: sendmail/sendmail.c.
20120630
Cleanup: sub-optimal hash performance on systems where the
"char" type is signed. Files: util/htable.c, util/binhash.c.
20120702
Bugfix (introduced: 19990127): the BIFF client leaked an
unprivileged UDP socket. Fix by Jaroslav Skarvada. File:
local/biff_notify.c.
20120713
Bugfix (introduced: 20120527-8): infrastructure to specify
a smaller-than-default VSTREAM buffer, without the complex
run-time checks. File: util/vstream.c, vstream_tweak.c.

View File

@@ -367,7 +367,7 @@ EOF
esac esac
for name in nsl resolv for name in nsl resolv
do do
for lib in /usr/lib64 /lib64 /usr/lib /lib for lib in /usr/lib64 /lib64 /usr/lib /usr/lib/* /lib /lib/*
do do
test -e $lib/lib$name.a -o -e $lib/lib$name.so && { test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
SYSLIBS="$SYSLIBS -l$name" SYSLIBS="$SYSLIBS -l$name"

View File

@@ -1,2 +1,2 @@
spike.porcupine.org -> 168.100.189.2
spike.porcupine.org -> 2604:8d00:189::2 spike.porcupine.org -> 2604:8d00:189::2
spike.porcupine.org -> 168.100.189.2

View File

@@ -20,7 +20,7 @@
* Patches change both the patchlevel and the release date. Snapshots have no * Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only. * patchlevel; they change the release date only.
*/ */
#define MAIL_RELEASE_DATE "20120630" #define MAIL_RELEASE_DATE "20120713"
#define MAIL_VERSION_NUMBER "2.10" #define MAIL_VERSION_NUMBER "2.10"
#ifdef SNAPSHOT #ifdef SNAPSHOT

View File

@@ -43,6 +43,7 @@
/* Utility library. */ /* Utility library. */
#include <msg.h> #include <msg.h>
#include <iostuff.h>
/* Application-specific. */ /* Application-specific. */
@@ -81,10 +82,13 @@ void biff_notify(const char *text, ssize_t len)
/* /*
* Open a socket, or re-use an existing one. * Open a socket, or re-use an existing one.
*/ */
if (sock < 0 && (sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { if (sock < 0) {
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
msg_warn("socket: %m"); msg_warn("socket: %m");
return; return;
} }
close_on_exec(sock, CLOSE_ON_EXEC);
}
/* /*
* Biff! * Biff!

View File

@@ -134,7 +134,7 @@ static unsigned binhash_hash(const char *key, int len, unsigned size)
*/ */
while (len-- > 0) { while (len-- > 0) {
h = (h << 4U) + *key++; h = (h << 4U) + *(unsigned const char *) key++;
if ((g = (h & 0xf0000000)) != 0) { if ((g = (h & 0xf0000000)) != 0) {
h ^= (g >> 24U); h ^= (g >> 24U);
h ^= g; h ^= g;

View File

@@ -138,7 +138,7 @@ static unsigned htable_hash(const char *s, unsigned size)
*/ */
while (*s) { while (*s) {
h = (h << 4U) + *s++; h = (h << 4U) + *(unsigned const char *) s++;
if ((g = (h & 0xf0000000)) != 0) { if ((g = (h & 0xf0000000)) != 0) {
h ^= (g >> 24U); h ^= (g >> 24U);
h ^= g; h ^= g;

View File

@@ -1,8 +1,8 @@
./myaddrinfo: === hostname belly.porcupine.org === ./myaddrinfo: === hostname belly.porcupine.org ===
./myaddrinfo: belly.porcupine.org -> family=2 sock=1 proto=6 168.100.189.6
./myaddrinfo: 168.100.189.6 -> belly.porcupine.org
./myaddrinfo: belly.porcupine.org -> family=28 sock=1 proto=6 2604:8d00:189::6 ./myaddrinfo: belly.porcupine.org -> family=28 sock=1 proto=6 2604:8d00:189::6
./myaddrinfo: 2604:8d00:189::6 -> belly.porcupine.org ./myaddrinfo: 2604:8d00:189::6 -> belly.porcupine.org
./myaddrinfo: belly.porcupine.org -> family=2 sock=1 proto=6 168.100.189.6
./myaddrinfo: 168.100.189.6 -> belly.porcupine.org
./myaddrinfo: === host address 168.100.189.2 === ./myaddrinfo: === host address 168.100.189.2 ===
./myaddrinfo: 168.100.189.2 -> family=2 sock=1 proto=6 168.100.189.2 ./myaddrinfo: 168.100.189.2 -> family=2 sock=1 proto=6 168.100.189.2
./myaddrinfo: 168.100.189.2 -> spike.porcupine.org ./myaddrinfo: 168.100.189.2 -> spike.porcupine.org

View File

@@ -324,17 +324,18 @@
/* This involves allocation of additional memory that normally isn't /* This involves allocation of additional memory that normally isn't
/* used. /* used.
/* .IP "VSTREAM_CTL_BUFSIZE (ssize_t)" /* .IP "VSTREAM_CTL_BUFSIZE (ssize_t)"
/* Specify a non-default buffer size, or zero to implement /* Specify a non-default write buffer size, or zero to implement
/* a no-op. Requests to resize a fixed-size buffer (stderr) /* a no-op. Requests to shrink an existing buffer size are
/* are not allowed. /* silently ignored. To get a buffer size smaller than
/* VSTREAM_BUFSIZE, make the VSTREAM_CTL_BUFSIZE before the
/* stream has been used. Requests to change a fixed-size buffer
/* (e.g., stderr) are not allowed.
/* /*
/* NOTE: the VSTREAM_CTL_BUFSIZE request specifies intent, not /* NOTE: the VSTREAM_CTL_BUFSIZE request specifies intent, not
/* reality. Actual buffer sizes are not updated immediately. /* reality. Actual buffer sizes are not updated immediately.
/* Instead, a write buffer size will be updated when writing /* Instead, an existing write buffer will be resized when it
/* to a stream for the first time, or when writing to a full /* is full, and an existing read buffer will be resized when
/* buffer, and a read buffer size will be updated when reading /* the buffer is filled.
/* from a stream for the first time, or when reading from an
/* empty buffer.
/* /*
/* NOTE: the vstream_*printf() routines may silently expand a /* NOTE: the vstream_*printf() routines may silently expand a
/* buffer, so that the result of some %letter specifiers can /* buffer, so that the result of some %letter specifiers can
@@ -503,13 +504,13 @@ VSTREAM vstream_fstd[] = {
0, 0, 0, 0, /* buffer */ 0, 0, 0, 0, /* buffer */
vstream_buf_get_ready, vstream_buf_put_ready, vstream_buf_space, vstream_buf_get_ready, vstream_buf_put_ready, vstream_buf_space,
}, STDIN_FILENO, (VSTREAM_FN) timed_read, (VSTREAM_FN) timed_write, }, STDIN_FILENO, (VSTREAM_FN) timed_read, (VSTREAM_FN) timed_write,
VSTREAM_BUFSIZE,}, 0,},
{{ {{
0, /* flags */ 0, /* flags */
0, 0, 0, 0, /* buffer */ 0, 0, 0, 0, /* buffer */
vstream_buf_get_ready, vstream_buf_put_ready, vstream_buf_space, vstream_buf_get_ready, vstream_buf_put_ready, vstream_buf_space,
}, STDOUT_FILENO, (VSTREAM_FN) timed_read, (VSTREAM_FN) timed_write, }, STDOUT_FILENO, (VSTREAM_FN) timed_read, (VSTREAM_FN) timed_write,
VSTREAM_BUFSIZE,}, 0,},
{{ {{
VBUF_FLAG_FIXED | VSTREAM_FLAG_WRITE, VBUF_FLAG_FIXED | VSTREAM_FLAG_WRITE,
vstream_fstd_buf, VSTREAM_BUFSIZE, VSTREAM_BUFSIZE, vstream_fstd_buf, vstream_fstd_buf, VSTREAM_BUFSIZE, VSTREAM_BUFSIZE, vstream_fstd_buf,
@@ -626,17 +627,10 @@ static void vstream_buf_alloc(VBUF *bp, ssize_t len)
ssize_t used = bp->ptr - bp->data; ssize_t used = bp->ptr - bp->data;
const char *myname = "vstream_buf_alloc"; const char *myname = "vstream_buf_alloc";
/* if (len < bp->len)
* Don't shrink a non-empty read buffer, or a non-flushed write buffer. msg_panic("%s: attempt to shrink buffer", myname);
*/
if (len <= 0)
msg_panic("%s: bad buffer length: %ld", myname, (long) len);
if (len < bp->len
&& (((bp->flags & VSTREAM_FLAG_READ) && bp->cnt != 0)
|| ((bp->flags & VSTREAM_FLAG_WRITE) && bp->cnt != bp->len)))
msg_panic("%s: attempt to shrink non-empty buffer", myname);
if (bp->flags & VSTREAM_FLAG_FIXED) if (bp->flags & VSTREAM_FLAG_FIXED)
msg_panic("%s: attempt to resize fixed-length buffer", myname); msg_panic("%s: unable to extend fixed-size buffer", myname);
/* /*
* Late buffer allocation allows the user to override the default policy. * Late buffer allocation allows the user to override the default policy.
@@ -853,8 +847,12 @@ static int vstream_buf_get_ready(VBUF *bp)
* If this is the first GET operation, allocate a buffer. Late buffer * If this is the first GET operation, allocate a buffer. Late buffer
* allocation gives the application a chance to override the default * allocation gives the application a chance to override the default
* buffering policy. * buffering policy.
*
* XXX Tricky code to set the preferred buffer size as late as possible.
*/ */
if (bp->len != stream->req_bufsize) if (stream->req_bufsize == 0)
stream->req_bufsize = VSTREAM_BUFSIZE;
if (bp->len < stream->req_bufsize)
vstream_buf_alloc(bp, stream->req_bufsize); vstream_buf_alloc(bp, stream->req_bufsize);
/* /*
@@ -961,15 +959,17 @@ static int vstream_buf_put_ready(VBUF *bp)
* stream or if the buffer is smaller than the requested size, allocate a * stream or if the buffer is smaller than the requested size, allocate a
* new buffer; obviously there is no data to be flushed yet. Otherwise, * new buffer; obviously there is no data to be flushed yet. Otherwise,
* flush the buffer. * flush the buffer.
*
* XXX Tricky code to set the preferred buffer size as late as possible.
*/ */
if (stream->req_bufsize == 0)
stream->req_bufsize = VSTREAM_BUFSIZE;
if (bp->len < stream->req_bufsize) { if (bp->len < stream->req_bufsize) {
vstream_buf_alloc(bp, stream->req_bufsize); vstream_buf_alloc(bp, stream->req_bufsize);
} else if (bp->cnt <= 0) { } else if (bp->cnt <= 0) {
if (VSTREAM_FFLUSH_SOME(stream)) if (VSTREAM_FFLUSH_SOME(stream))
return (VSTREAM_EOF); return (VSTREAM_EOF);
} }
if (bp->len > stream->req_bufsize)
vstream_buf_alloc(bp, stream->req_bufsize);
return (0); return (0);
} }
@@ -1014,10 +1014,14 @@ static int vstream_buf_space(VBUF *bp, ssize_t want)
* VSTREAM_BUFSIZE bytes and resize the buffer to a multiple of * VSTREAM_BUFSIZE bytes and resize the buffer to a multiple of
* VSTREAM_BUFSIZE. We flush multiples of VSTREAM_BUFSIZE in an attempt * VSTREAM_BUFSIZE. We flush multiples of VSTREAM_BUFSIZE in an attempt
* to keep file updates block-aligned for better performance. * to keep file updates block-aligned for better performance.
*
* XXX Tricky code to set the preferred buffer size as late as possible.
*/ */
#define VSTREAM_TRUNCATE(count, base) (((count) / (base)) * (base)) #define VSTREAM_TRUNCATE(count, base) (((count) / (base)) * (base))
#define VSTREAM_ROUNDUP(count, base) VSTREAM_TRUNCATE(count + base - 1, base) #define VSTREAM_ROUNDUP(count, base) VSTREAM_TRUNCATE(count + base - 1, base)
if (stream->req_bufsize == 0)
stream->req_bufsize = VSTREAM_BUFSIZE;
if (want > bp->cnt) { if (want > bp->cnt) {
if ((used = bp->len - bp->cnt) > stream->req_bufsize) if ((used = bp->len - bp->cnt) > stream->req_bufsize)
if (vstream_fflush_some(stream, VSTREAM_TRUNCATE(used, stream->req_bufsize))) if (vstream_fflush_some(stream, VSTREAM_TRUNCATE(used, stream->req_bufsize)))
@@ -1231,7 +1235,7 @@ VSTREAM *vstream_fdopen(int fd, int flags)
stream->jbuf = 0; stream->jbuf = 0;
stream->iotime.tv_sec = stream->iotime.tv_usec = 0; stream->iotime.tv_sec = stream->iotime.tv_usec = 0;
stream->time_limit.tv_sec = stream->time_limit.tv_usec = 0; stream->time_limit.tv_sec = stream->time_limit.tv_usec = 0;
stream->req_bufsize = VSTREAM_BUFSIZE; stream->req_bufsize = 0;
return (stream); return (stream);
} }
@@ -1482,7 +1486,8 @@ void vstream_control(VSTREAM *stream, int name,...)
if (req_bufsize < 0 || req_bufsize > INT_MAX) if (req_bufsize < 0 || req_bufsize > INT_MAX)
msg_panic("unreasonable VSTREAM_CTL_BUFSIZE request: %ld", msg_panic("unreasonable VSTREAM_CTL_BUFSIZE request: %ld",
(long) req_bufsize); (long) req_bufsize);
if (req_bufsize > 0 && stream != VSTREAM_ERR) if (stream != VSTREAM_ERR
&& req_bufsize > stream->req_bufsize)
stream->req_bufsize = req_bufsize; stream->req_bufsize = req_bufsize;
break; break;
@@ -1627,7 +1632,7 @@ int main(int argc, char **argv)
*/ */
copy_line(1); /* one-byte read/write */ copy_line(1); /* one-byte read/write */
copy_line(2); /* two-byte read/write */ copy_line(2); /* two-byte read/write */
copy_line(1); /* one-byte read/write */ copy_line(1); /* two-byte read/write */
printf_number(); /* multi-byte write */ printf_number(); /* multi-byte write */
exit(0); exit(0);
} }

View File

@@ -116,12 +116,12 @@ int vstream_tweak_tcp(VSTREAM *fp)
/* /*
* Fix for recent Postfix versions: increase the VSTREAM buffer size if * Fix for recent Postfix versions: increase the VSTREAM buffer size if
* the VSTREAM buffer is smaller than the MSS. Note: the MSS may change * the default VSTREAM buffer size is smaller than the MSS. Note: the MSS
* when the route changes and IP path MTU discovery is turned on, so we * may change when the route changes and IP path MTU discovery is turned
* choose a somewhat larger buffer. * on, so we choose a somewhat larger buffer.
*/ */
#ifdef VSTREAM_CTL_BUFSIZE #ifdef VSTREAM_CTL_BUFSIZE
if (mss > 0) { if (mss > VSTREAM_BUFSIZE) {
if (mss < INT_MAX / 2) if (mss < INT_MAX / 2)
mss *= 2; mss *= 2;
vstream_control(fp, vstream_control(fp,