From c30a1e992b159f4bf752538d8bd0a87273ed19a2 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 10 Feb 2003 09:30:57 +0200 Subject: [PATCH] Auth process communication was a bit broken --HG-- branch : HEAD --- src/master/auth-process.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/master/auth-process.c b/src/master/auth-process.c index 01c20f3c9d..ec25d524bb 100644 --- a/src/master/auth-process.c +++ b/src/master/auth-process.c @@ -67,7 +67,7 @@ static int handle_reply(struct auth_process *process, } if (data[nul_pos] != '\0') { - i_error("Auth process %s sent invalid reply", + i_panic("Auth process %s sent invalid reply", dec2str(process->pid)); return FALSE; } @@ -152,25 +152,28 @@ static void auth_process_input(void *context) p->initialized = TRUE; } - if (!p->in_auth_reply) { - data = i_stream_get_data(p->input, &size); - if (size < sizeof(p->auth_reply)) - return; + for (;;) { + if (!p->in_auth_reply) { + data = i_stream_get_data(p->input, &size); + if (size < sizeof(p->auth_reply)) + break; - p->in_auth_reply = TRUE; - memcpy(&p->auth_reply, data, sizeof(p->auth_reply)); + p->in_auth_reply = TRUE; + memcpy(&p->auth_reply, data, sizeof(p->auth_reply)); - i_stream_skip(p->input, sizeof(p->auth_reply)); - } + i_stream_skip(p->input, sizeof(p->auth_reply)); + } - data = i_stream_get_data(p->input, &size); - if (p->auth_reply.data_size < size) - return; + data = i_stream_get_data(p->input, &size); + if (size < p->auth_reply.data_size) + break; + + /* reply is now read */ + if (!handle_reply(p, &p->auth_reply, data)) { + auth_process_destroy(p); + break; + } - /* reply is now read */ - if (!handle_reply(p, &p->auth_reply, data)) - auth_process_destroy(p); - else { p->in_auth_reply = FALSE; i_stream_skip(p->input, p->auth_reply.data_size); } -- 2.47.3