[PATCH] nsswitch: Fix short writes in winbind_write_sock

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon Oct 21 04:11:13 MDT 2013


Hi!

Attached find a bugfix for bug 10195. The reporter has
confirmed the 3.6 version of this does fix it.

Please review&push.

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 97cca6dbfd6a8e16ec88bb816a2bff483357bc50 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 15 Oct 2013 08:23:10 +0000
Subject: [PATCH] nsswitch: Fix short writes in winbind_write_sock

We set the socket to nonblocking and don't handle EAGAIN right. We do
a poll anyway, so wait for writability, which should fix this.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10195
Signed-off-by: Volker Lendecke <vl at samba.org>
---
 nsswitch/wb_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nsswitch/wb_common.c b/nsswitch/wb_common.c
index c56a76f..5fde8d0 100644
--- a/nsswitch/wb_common.c
+++ b/nsswitch/wb_common.c
@@ -395,9 +395,9 @@ static int winbind_write_sock(void *buffer, int count, int recursing,
 		   call would not block by calling poll(). */
 
 		pfd.fd = fd;
-		pfd.events = POLLIN|POLLHUP;
+		pfd.events = POLLIN|POLLOUT|POLLHUP;
 
-		ret = poll(&pfd, 1, 0);
+		ret = poll(&pfd, 1, -1);
 		if (ret == -1) {
 			winbind_close_sock();
 			return -1;                   /* poll error */
-- 
1.8.1.2



More information about the samba-technical mailing list