]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: fd_recv() no longer checks for msghdr.msg_controllen
authorTimo Sirainen <tss@iki.fi>
Fri, 20 Jun 2014 09:18:32 +0000 (12:18 +0300)
committerTimo Sirainen <tss@iki.fi>
Fri, 20 Jun 2014 09:18:32 +0000 (12:18 +0300)
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.

src/lib/fdpass.c

index 38e910b33a78cb2885c1d568f2e3b401bd9311e7..628e53ac7c4d83b2a7b549204761631d8197236a 100644 (file)
@@ -140,12 +140,6 @@ ssize_t fd_send(int handle, int send_fd, const void *data, size_t size)
        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 @@ ssize_t fd_read(int handle, void *data, size_t size, int *fd)
        /* 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));