changeset 21992:466eeebe3fc1

auth: Fixed dovecot/auth hanging when child ntlm_auth crashes while processing an authentication request
author Andriy Syrovenko <andriys@gmail.com>
date Mon, 17 Apr 2017 01:14:02 +0300
parents e4f497e58288
children 2cf6728ef766
files src/auth/mech-winbind.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/mech-winbind.c	Wed Apr 26 14:20:49 2017 +0300
+++ b/src/auth/mech-winbind.c	Mon Apr 17 01:14:02 2017 +0300
@@ -187,12 +187,18 @@
 	request->continued = FALSE;
 
 	while ((answer = i_stream_read_next_line(in_pipe)) == NULL) {
-		if (in_pipe->stream_errno != 0)
+		if (in_pipe->stream_errno != 0 || in_pipe->eof)
 			break;
 	}
 	if (answer == NULL) {
-		auth_request_log_error(auth_request, AUTH_SUBSYS_MECH,
-				       "read(in_pipe) failed: %m");
+		if (in_pipe->stream_errno != 0) {
+			auth_request_log_error(auth_request, AUTH_SUBSYS_MECH,
+					       "read(in_pipe) failed: %m");
+		} else {
+			auth_request_log_error(auth_request, AUTH_SUBSYS_MECH,
+					       "read(in_pipe) failed: "
+					       "unexpected end of file");
+		}
 		return HR_RESTART;
 	}