dovecot-2.2: lib: fd_recv() no longer checks for msghdr.msg_cont...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jun 20 09:20:54 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/38cd37cea8b1
changeset: 17515:38cd37cea8b1
user: Timo Sirainen <tss at iki.fi>
date: Fri Jun 20 12:18:32 2014 +0300
description:
lib: fd_recv() no longer checks for msghdr.msg_controllen
It doesn't work at least in OpenBSD and Tru64, and apparently it shouldn't
really be needed anyway, so don't bother with it. We'll still keep checking
the cmsghdr since that appears to work everywhere now.
diffstat:
src/lib/fdpass.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
diffs (30 lines):
diff -r 5138932352d3 -r 38cd37cea8b1 src/lib/fdpass.c
--- a/src/lib/fdpass.c Thu Jun 19 17:16:24 2014 +0300
+++ b/src/lib/fdpass.c Fri Jun 20 12:18:32 2014 +0300
@@ -140,12 +140,6 @@
return sendmsg(handle, &msg, 0);
}
-#ifdef __osf__
-# define CHECK_MSG(msg) TRUE /* Tru64 */
-#else
-# define CHECK_MSG(msg) ((msg).msg_controllen >= CMSG_SPACE(sizeof(int)))
-#endif
-
#ifdef LINUX20
/* Linux 2.0.x doesn't set any cmsg fields. Note that this might make some
attacks possible so don't do it unless you really have to. */
@@ -188,10 +182,10 @@
/* at least one byte transferred - we should have the fd now.
do extra checks to make sure it really is an fd that is being
transferred to avoid potential DoS conditions. some systems don't
- set all these values correctly however so CHECK_MSG() and
- CHECK_CMSG() are somewhat system dependent */
+ set all these values correctly however so CHECK_CMSG() is somewhat
+ system dependent */
cmsg = CMSG_FIRSTHDR(&msg);
- if (!CHECK_MSG(msg) || !CHECK_CMSG(cmsg))
+ if (!CHECK_CMSG(cmsg))
*fd = -1;
else
memcpy(fd, CMSG_DATA(cmsg), sizeof(*fd));
More information about the dovecot-cvs
mailing list