Mercurial > dovecot > core-2.2
changeset 17515:38cd37cea8b1
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.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 20 Jun 2014 12:18:32 +0300 |
parents | 5138932352d3 |
children | 705fd8f3f485 |
files | src/lib/fdpass.c |
diffstat | 1 files changed, 3 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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));