Mercurial > dovecot > original-hg > dovecot-1.2
changeset 1338:04ed7a2536cc HEAD
Tru64 fixes. More comments.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 08 Apr 2003 16:12:47 +0300 |
parents | 0f2e0b39a747 |
children | 379509d0c196 |
files | src/lib/fdpass.c src/master/login-process.c |
diffstat | 2 files changed, 23 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/fdpass.c Sun Apr 06 00:15:01 2003 +0300 +++ b/src/lib/fdpass.c Tue Apr 08 16:12:47 2003 +0300 @@ -1,7 +1,15 @@ /* - fdpass.c - FD passing + fdpass.c - File descriptor passing between processes via UNIX sockets + + This isn't fully portable, but pretty much all UNIXes nowadays should + support this. If you're having runtime problems, check the end of fd_read() + and play with the if condition. - Copyright (c) 2002 Timo Sirainen + If this file doesn't compile at all, you should check if this is supported + in your system at all. It may require some extra #define to enable it. + If not, you're pretty much out of luck. Cygwin didn't last I checked. + + Copyright (c) 2002-2003 Timo Sirainen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -107,9 +115,18 @@ return ret; } - /* at least one byte transferred - we should have the fd now */ + /* 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: + + Linux 2.0.x - cmsg_len, cmsg_level, cmsg_type are not set + Tru64 - msg_controllen isn't set */ cmsg = CMSG_FIRSTHDR(&msg); - if (msg.msg_controllen < CMSG_SPACE(sizeof(int)) || + if ( +#ifndef __osf__ + msg.msg_controllen < CMSG_SPACE(sizeof(int)) || +#endif cmsg == NULL || cmsg->cmsg_len < CMSG_LEN(sizeof(int)) || cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) *fd = -1;
--- a/src/master/login-process.c Sun Apr 06 00:15:01 2003 +0300 +++ b/src/master/login-process.c Tue Apr 08 16:12:47 2003 +0300 @@ -138,7 +138,8 @@ { if (!p->listening) { i_error("login: received another \"not listening\" " - "notification"); + "notification (if you can't login at all, " + "see src/lib/fdpass.c)"); return; }