[PATCH] Fix / slightly simplify smbd/scavenger

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Oct 30 15:57:39 UTC 2015


On Fri, Oct 30, 2015 at 08:34:45AM -0700, Jeremy Allison wrote:
> On Fri, Oct 30, 2015 at 07:46:39AM +0100, Ralph Boehme wrote:
> > On Thu, Oct 29, 2015 at 03:26:53PM -0700, Jeremy Allison wrote:
> > > On Thu, Oct 29, 2015 at 08:23:26PM +0200, Uri Simchoni wrote:
> > > > 
> > > > 
> > > > On 10/29/2015 06:02 PM, Volker Lendecke wrote:
> > > > >+	ret = read_data(fd, child, sizeof(child));
> > > > >+	if (ret == -1) {
> > > > Doesn't seem to take EOF into account, but neither does the original
> > > > code. How come?
> > > 
> > > fd's are created by socketpair() and not set non-blocking,
> > > so shouldn't get a zero return.
> > 
> > But wouldn't one side get 0 when the other does a close?
> 
> Yeah, but I thought these were long-lived sockets (only
> closed on shutdown). I'll look again.

Ok, this goes too far. Attached find a minimal patch that
just fixes the very obvious bug.

Maybe that's a bit less controversial.

Review&push appreciated!

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

Besuchen Sie uns vom 10.-11.11.15 auf der ISSE!
Information Security Solutions Europe Conference
Hotel Palace Berlin, 20%-Rabattcode: "ISSE15SP"

Meet us at Information Security Conference ISSE!
November 10th - 11th 2015 in Hotel Palace Berlin
For 20% discount take voucher code:  "ISSE15SP"
-------------- next part --------------
From 618e519eb74365c84c599a8e5fe232ed06e2ecd9 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 30 Oct 2015 16:56:42 +0100
Subject: [PATCH] smbd: Fix scavenger hello routines

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/smbd/scavenger.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/smbd/scavenger.c b/source3/smbd/scavenger.c
index 6171c29..67fa28c 100644
--- a/source3/smbd/scavenger.c
+++ b/source3/smbd/scavenger.c
@@ -159,6 +159,7 @@ static bool scavenger_say_hello(int fd, struct server_id self)
 			return false;
 		}
 		remaining -= ret;
+		ofs += ret;
 	}
 
 	DEBUG(4, ("scavenger_say_hello: self[%s]\n",
@@ -183,6 +184,7 @@ static bool scavenger_wait_hello(int fd, struct server_id *child)
 			return false;
 		}
 		remaining -= ret;
+		ofs += ret;
 	}
 
 	DEBUG(4, ("scavenger_say_hello: child[%s]\n",
-- 
1.9.1



More information about the samba-technical mailing list