]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Auth process communication was a bit broken
authorTimo Sirainen <tss@iki.fi>
Mon, 10 Feb 2003 07:30:57 +0000 (09:30 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 10 Feb 2003 07:30:57 +0000 (09:30 +0200)
--HG--
branch : HEAD

src/master/auth-process.c

index 01c20f3c9dbbdfb4118772cd392152b4198e2064..ec25d524bb92cc5a29b8e3bb01da0c1d99e3c3d5 100644 (file)
@@ -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);
        }