Mercurial > dovecot > original-hg > dovecot-1.2
changeset 1103:0f7ff293c414 HEAD
Some extra checks to make sure we notice if auth process ID is 0.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 08 Feb 2003 10:07:31 +0200 |
parents | fcc3a3b4aec9 |
children | 95ef12ebc953 |
files | src/auth/login-connection.c src/login-common/auth-connection.c src/login-common/master.c |
diffstat | 3 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/login-connection.c Sat Feb 08 09:48:22 2003 +0200 +++ b/src/auth/login-connection.c Sat Feb 08 10:07:31 2003 +0200 @@ -284,13 +284,18 @@ void login_connections_init(void) { const char *env; + unsigned int pid; env = getenv("AUTH_PROCESS"); if (env == NULL) i_fatal("AUTH_PROCESS environment is unset"); + pid = atoi(env); + if (pid == 0) + i_fatal("AUTH_PROCESS can't be 0"); + memset(&handshake_output, 0, sizeof(handshake_output)); - handshake_output.pid = atoi(env); + handshake_output.pid = pid; handshake_output.auth_mechanisms = auth_mechanisms; connections = NULL;
--- a/src/login-common/auth-connection.c Sat Feb 08 09:48:22 2003 +0200 +++ b/src/login-common/auth-connection.c Sat Feb 08 10:07:31 2003 +0200 @@ -189,6 +189,12 @@ static void auth_handle_handshake(struct auth_connection *conn, struct auth_login_handshake_output *handshake) { + if (handshake->pid == 0) { + i_error("BUG: Auth process said it's PID 0"); + auth_connection_destroy(conn); + return; + } + conn->pid = handshake->pid; conn->available_auth_mechs = handshake->auth_mechanisms; conn->handshake_received = TRUE;