[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Fri Oct 30 21:54:03 UTC 2015


The branch, master has been updated
       via  9e87465 smbd: Fix/simplify scavenger routines
      from  db9e10d s3-smbd: Fix use after issue in smbd_smb2_request_dispatch()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9e87465a750e625e8a3801346922981cb4871547
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Oct 29 14:27:32 2015 +0100

    smbd: Fix/simplify scavenger routines
    
    Use read_data/write_data, "ofs" was not incremented
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Oct 30 22:53:56 CET 2015 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/scavenger.c | 47 ++++++++++++++++++++---------------------------
 1 file changed, 20 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/scavenger.c b/source3/smbd/scavenger.c
index 6171c29..9f58f62 100644
--- a/source3/smbd/scavenger.c
+++ b/source3/smbd/scavenger.c
@@ -26,7 +26,7 @@
 #include "smbd/scavenger.h"
 #include "locking/proto.h"
 #include "lib/util/util_process.h"
-#include "lib/util/sys_rw.h"
+#include "lib/util/sys_rw_data.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_SCAVENGER
@@ -144,21 +144,17 @@ static int smbd_scavenger_server_id_destructor(struct server_id *id)
 
 static bool scavenger_say_hello(int fd, struct server_id self)
 {
-	const uint8_t *msg = (const uint8_t *)&self;
-	size_t remaining = sizeof(self);
-	size_t ofs = 0;
+	ssize_t ret;
 	struct server_id_buf tmp;
 
-	while (remaining > 0) {
-		ssize_t ret;
-
-		ret = sys_write(fd, msg + ofs, remaining);
-		if (ret == -1) {
-			DEBUG(2, ("Failed to write to pipe: %s\n",
-				  strerror(errno)));
-			return false;
-		}
-		remaining -= ret;
+	ret = write_data(fd, &self, sizeof(self));
+	if (ret == -1) {
+		DEBUG(2, ("Failed to write to pipe: %s\n", strerror(errno)));
+		return false;
+	}
+	if (ret < sizeof(self)) {
+		DBG_WARNING("Could not write serverid\n");
+		return false;
 	}
 
 	DEBUG(4, ("scavenger_say_hello: self[%s]\n",
@@ -168,21 +164,18 @@ static bool scavenger_say_hello(int fd, struct server_id self)
 
 static bool scavenger_wait_hello(int fd, struct server_id *child)
 {
-	uint8_t *msg = (uint8_t *)child;
-	size_t remaining = sizeof(*child);
-	size_t ofs = 0;
 	struct server_id_buf tmp;
+	ssize_t ret;
 
-	while (remaining > 0) {
-		ssize_t ret;
-
-		ret = sys_read(fd, msg + ofs, remaining);
-		if (ret == -1) {
-			DEBUG(2, ("Failed to read from pipe: %s\n",
-				  strerror(errno)));
-			return false;
-		}
-		remaining -= ret;
+	ret = read_data(fd, child, sizeof(struct server_id));
+	if (ret == -1) {
+		DEBUG(2, ("Failed to read from pipe: %s\n",
+			  strerror(errno)));
+		return false;
+	}
+	if (ret < sizeof(struct server_id)) {
+		DBG_WARNING("Could not read serverid\n");
+		return false;
 	}
 
 	DEBUG(4, ("scavenger_say_hello: child[%s]\n",


-- 
Samba Shared Repository



More information about the samba-cvs mailing list