changeset 1131:817718515e5f HEAD

Auth process communication was a bit broken
author Timo Sirainen <tss@iki.fi>
date Mon, 10 Feb 2003 09:30:57 +0200
parents 64ebf1b58b53
children 50727d444717
files src/master/auth-process.c
diffstat 1 files changed, 19 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/master/auth-process.c	Sun Feb 09 22:12:56 2003 +0200
+++ b/src/master/auth-process.c	Mon Feb 10 09:30:57 2003 +0200
@@ -67,7 +67,7 @@
 	}
 
 	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 @@
 		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 (size < p->auth_reply.data_size)
+			break;
 
-	data = i_stream_get_data(p->input, &size);
-	if (p->auth_reply.data_size < size)
-		return;
+		/* 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);
 	}