[dovecot-cvs] dovecot/src/master auth-process.c,1.34,1.35

cras at procontrol.fi cras at procontrol.fi
Mon Feb 10 09:31:00 EET 2003


Update of /home/cvs/dovecot/src/master
In directory danu:/tmp/cvs-serv28246

Modified Files:
	auth-process.c 
Log Message:
Auth process communication was a bit broken



Index: auth-process.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/auth-process.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- auth-process.c	8 Feb 2003 15:42:46 -0000	1.34
+++ auth-process.c	10 Feb 2003 07:30:57 -0000	1.35
@@ -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 (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);
 	}




More information about the dovecot-cvs mailing list