[dovecot-cvs] dovecot/src/lib fdpass.c,1.13,1.14

cras at procontrol.fi cras at procontrol.fi
Fri Feb 14 12:51:55 EET 2003


Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv892/src/lib

Modified Files:
	fdpass.c 
Log Message:
fd_read(): make sure it's SCM_RIGHTS that was transferred so that login
process couldn't fool us to use some of our existing fds.



Index: fdpass.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/fdpass.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- fdpass.c	8 Feb 2003 09:11:54 -0000	1.13
+++ fdpass.c	14 Feb 2003 10:51:53 -0000	1.14
@@ -109,7 +109,8 @@
 	/* at least one byte transferred - we should have the fd now */
 	cmsg = CMSG_FIRSTHDR(&msg);
 	if (msg.msg_controllen < CMSG_SPACE(sizeof(int)) ||
-	    cmsg == NULL || cmsg->cmsg_len < CMSG_LEN(sizeof(int)))
+	    cmsg == NULL || cmsg->cmsg_len < CMSG_LEN(sizeof(int)) ||
+	    cmsg->cmsg_type != SCM_RIGHTS)
 		*fd = -1;
 	else
 		*fd = *((int *) CMSG_DATA(cmsg));




More information about the dovecot-cvs mailing list