[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Mon Dec 16 19:51:03 MST 2013


The branch, master has been updated
       via  970a6ef share_ldb: Fix a memleak
       via  20efaf9 share_ldb: Fix CID 1138336 Dereference null return value
       via  b067f1e share_ldb: Fix a memleak
       via  ec270cf share_ldb: Fix CID 1138337 Dereference null return value
       via  e8b0726 ldb: Fix 1138330 Dereference null return value
       via  f25e2b9 smbd: Fix CID 1138328 Logically dead code
       via  5677c63 scannedonly: Fix CID 242109 Unchecked return value from library
       via  65d0dce ntvfs: Fix CID 241291 Argument cannot be negative
       via  91ef262 tevent: Fix CID 1138326 Unchecked return value
       via  c943937 Fix CID 1138340 Resource leak
       via  b2937fd Fix CID 1138341 Resource leak
       via  b263bfe tdb_util: Fix whitespace
       via  677056c tdb_util: Fix CID 1138343 Uninitialized scalar variable
      from  92257ee s3: Handle stat call with capability in vfs_gpfs

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


- Log -----------------------------------------------------------------
commit 970a6efa3b5fc11aa4ff79049738bb971a129a62
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 21:28:08 2013 +0100

    share_ldb: Fix a memleak
    
    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): Tue Dec 17 03:50:58 CET 2013 on sn-devel-104

commit 20efaf9ea74f6c5ed7554aab2a0e687ed5a2f717
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 21:28:08 2013 +0100

    share_ldb: Fix CID 1138336 Dereference null return value
    
    False positive, but this way we avoid another strchr
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b067f1e35bd3e3fa886aae3b0011e1585664f11e
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 21:29:59 2013 +0100

    share_ldb: Fix a memleak
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ec270cf6a81d0c9349649ce0945d4da1df320871
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 21:28:08 2013 +0100

    share_ldb: Fix CID 1138337 Dereference null return value
    
    False positive, but this way we avoid another strchr
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e8b0726411213acb133a25c14ab42020e4a8de68
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 21:23:59 2013 +0100

    ldb: Fix 1138330 Dereference null return value
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f25e2b93d30e9884dee30e97ca02fd35b0eb99d3
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 21:18:07 2013 +0100

    smbd: Fix CID 1138328 Logically dead code
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5677c63f1cafec833aa2f77d1b20f575ec2f3eeb
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 21:07:00 2013 +0100

    scannedonly: Fix CID 242109 Unchecked return value from library
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 65d0dceea53035d379eb125cdd78e43501709e4e
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 21:00:04 2013 +0100

    ntvfs: Fix CID 241291 Argument cannot be negative
    
    getgroups can return -1, which talloc_array won't be happy about
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 91ef262c633aebd0da8ab7c4b51e2aa9d55b7ddb
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 20:40:06 2013 +0100

    tevent: Fix CID 1138326 Unchecked return value
    
    For this case we explicitly have added tevent_req_oom
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c943937ec69f6547533f34ae83a268960395b521
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 20:28:53 2013 +0100

    Fix CID 1138340 Resource leak
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b2937fd6186003740f3bef3c2f4fd54a4d3cf335
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 20:28:04 2013 +0100

    Fix CID 1138341 Resource leak
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b263bfef2f873637ff5d83f3e78fa98902abe5c5
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 20:23:16 2013 +0100

    tdb_util: Fix whitespace
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 677056c55bc7e5c182ccb146955bb1314ed6a1d5
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 15 20:22:36 2013 +0100

    tdb_util: Fix CID 1138343 Uninitialized scalar variable
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 ctdb/lib/replace/test/testsuite.c |    3 +++
 lib/ldb/common/ldb.c              |    4 ++++
 lib/tdb_wrap/tdb_wrap.c           |   18 ++++++++++--------
 lib/tevent/tevent_queue.c         |    2 +-
 source3/modules/vfs_scannedonly.c |   10 ++++++----
 source3/smbd/smb2_server.c        |    2 ++
 source4/ntvfs/posix/pvfs_acl.c    |    2 +-
 source4/param/share_ldb.c         |   20 ++++++++++++--------
 8 files changed, 39 insertions(+), 22 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/lib/replace/test/testsuite.c b/ctdb/lib/replace/test/testsuite.c
index 52629ec..df8b71f 100644
--- a/ctdb/lib/replace/test/testsuite.c
+++ b/ctdb/lib/replace/test/testsuite.c
@@ -166,6 +166,7 @@ static int test_strdup(void)
 	if (strcmp("bla", x) != 0) {
 		printf("failure: strdup [\nfailed: expected \"bla\", got \"%s\"\n]\n",
 			   x);
+		free(x);
 		return false;
 	}
 	free(x);
@@ -266,12 +267,14 @@ static int test_strndup(void)
 	x = strndup("bla", 2);
 	if (strcmp(x, "bl") != 0) {
 		printf("failure: strndup [\ninvalid\n]\n");
+		free(x);
 		return false;
 	}
 	free(x);
 	x = strndup("bla", 10);
 	if (strcmp(x, "bla") != 0) {
 		printf("failure: strndup [\ninvalid\n]\n");
+		free(x);
 		return false;
 	}
 	free(x);
diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c
index d2b873f..e5fa819 100644
--- a/lib/ldb/common/ldb.c
+++ b/lib/ldb/common/ldb.c
@@ -112,6 +112,10 @@ struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx)
 	 * having to provide their own private one explicitly */
 	if (ev_ctx == NULL) {
 		ev_ctx = tevent_context_init(ldb);
+		if (ev_ctx == NULL) {
+			talloc_free(ldb);
+			return NULL;
+		}
 		tevent_set_debug(ev_ctx, ldb_tevent_debug, ldb);
 		tevent_loop_allow_nesting(ev_ctx);
 	}
diff --git a/lib/tdb_wrap/tdb_wrap.c b/lib/tdb_wrap/tdb_wrap.c
index 0f49be1..312d17f 100644
--- a/lib/tdb_wrap/tdb_wrap.c
+++ b/lib/tdb_wrap/tdb_wrap.c
@@ -1,20 +1,20 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    TDB wrap functions
 
    Copyright (C) Andrew Tridgell 2004
    Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2007
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -28,10 +28,10 @@
 /*
  Log tdb messages via DEBUG().
 */
-static void tdb_wrap_log(TDB_CONTEXT *tdb, enum tdb_debug_level level, 
+static void tdb_wrap_log(TDB_CONTEXT *tdb, enum tdb_debug_level level,
 			 const char *format, ...) PRINTF_ATTRIBUTE(3,4);
 
-static void tdb_wrap_log(TDB_CONTEXT *tdb, enum tdb_debug_level level, 
+static void tdb_wrap_log(TDB_CONTEXT *tdb, enum tdb_debug_level level,
 			 const char *format, ...)
 {
 	va_list ap;
@@ -54,7 +54,7 @@ static void tdb_wrap_log(TDB_CONTEXT *tdb, enum tdb_debug_level level,
 		break;
 	default:
 		debuglevel = 0;
-	}		
+	}
 
 	va_start(ap, format);
 	ret = vasprintf(&ptr, format, ap);
@@ -81,7 +81,7 @@ static int tdb_wrap_private_destructor(struct tdb_wrap_private *w)
 	tdb_close(w->tdb);
 	DLIST_REMOVE(tdb_list, w);
 	return 0;
-}				 
+}
 
 static struct tdb_wrap_private *tdb_wrap_private_open(TALLOC_CTX *mem_ctx,
 						      const char *name,
@@ -120,6 +120,8 @@ static struct tdb_wrap_private *tdb_wrap_private_open(TALLOC_CTX *mem_ctx,
 	}
 
 	lctx.log_fn = tdb_wrap_log;
+	lctx.log_private = NULL;
+
 	result->tdb = tdb_open_ex(name, hash_size, tdb_flags,
 				  open_flags, mode, &lctx, NULL);
 	if (result->tdb == NULL) {
diff --git a/lib/tevent/tevent_queue.c b/lib/tevent/tevent_queue.c
index 0c5fe4e..930319c 100644
--- a/lib/tevent/tevent_queue.c
+++ b/lib/tevent/tevent_queue.c
@@ -325,7 +325,7 @@ struct tevent_req *tevent_queue_wait_send(TALLOC_CTX *mem_ctx,
 			      tevent_queue_wait_trigger,
 			      NULL);
 	if (!ok) {
-		tevent_req_nomem(NULL, req);
+		tevent_req_oom(req);
 		return tevent_req_post(req, ev);
 	}
 
diff --git a/source3/modules/vfs_scannedonly.c b/source3/modules/vfs_scannedonly.c
index 0d2e7cc..3cee511 100644
--- a/source3/modules/vfs_scannedonly.c
+++ b/source3/modules/vfs_scannedonly.c
@@ -228,10 +228,12 @@ static int connect_to_scanner(vfs_handle_struct * handle)
 	    large directory with lots of unscanned files. */
 		int sndsize;
 		socklen_t size = sizeof(int);
-		getsockopt(so->socket, SOL_SOCKET, SO_RCVBUF,
-			   (char *)&sndsize, &size);
-		DEBUG(SCANNEDONLY_DEBUG, ("current socket buffer size=%d\n",
-					  sndsize));
+		if (getsockopt(so->socket, SOL_SOCKET, SO_RCVBUF,
+			       (char *)&sndsize, &size) == 0) {
+			DEBUG(SCANNEDONLY_DEBUG,
+			      ("current socket buffer size=%d\n",
+			       sndsize));
+		}
 		sndsize = 262144;
 		if (setsockopt(so->socket, SOL_SOCKET, SO_RCVBUF,
 			       (char *)&sndsize,
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 768a9c8..fe42ac9 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -2963,11 +2963,13 @@ static int socket_error_from_errno(int ret,
 	}
 
 #ifdef EWOULDBLOCK
+#if EWOULDBLOCK != EAGAIN
 	if (sys_errno == EWOULDBLOCK) {
 		*retry = true;
 		return sys_errno;
 	}
 #endif
+#endif
 
 	return sys_errno;
 }
diff --git a/source4/ntvfs/posix/pvfs_acl.c b/source4/ntvfs/posix/pvfs_acl.c
index 4e9c1ac..730ad48 100644
--- a/source4/ntvfs/posix/pvfs_acl.c
+++ b/source4/ntvfs/posix/pvfs_acl.c
@@ -497,7 +497,7 @@ static bool pvfs_group_member(struct pvfs_state *pvfs, gid_t gid)
 		return true;
 	}
 	ngroups = getgroups(0, NULL);
-	if (ngroups == 0) {
+	if (ngroups <= 0) {
 		return false;
 	}
 	groups = talloc_array(pvfs, gid_t, ngroups);
diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c
index f4d02b2..0e27376 100644
--- a/source4/param/share_ldb.c
+++ b/source4/param/share_ldb.c
@@ -62,22 +62,24 @@ static const char *sldb_string_option(struct share_config *scfg, const char *opt
 {
 	struct ldb_message *msg;
 	struct ldb_message_element *el;
+	const char *colon;
 
 	if (scfg == NULL) return defval;
 
 	msg = talloc_get_type(scfg->opaque, struct ldb_message);
 
-	if (strchr(opt_name, ':')) {
-		char *name, *p;
+	colon = strchr(opt_name, ':');
+	if (colon != NULL) {
+		char *name;
 
 		name = talloc_strdup(scfg, opt_name);
 		if (!name) {
 			return NULL;
 		}
-		p = strchr(name, ':');
-		*p = '-';
+		name[colon-opt_name] = '-';
 
 		el = ldb_msg_find_element(msg, name);
+		TALLOC_FREE(name);
 	} else {
 		el = ldb_msg_find_element(msg, opt_name);
 	}
@@ -121,23 +123,25 @@ static const char **sldb_string_list_option(TALLOC_CTX *mem_ctx, struct share_co
 	struct ldb_message *msg;
 	struct ldb_message_element *el;
 	const char **list;
+	const char *colon;
 	int i;
 
 	if (scfg == NULL) return NULL;
 
 	msg = talloc_get_type(scfg->opaque, struct ldb_message);
 
-	if (strchr(opt_name, ':')) {
-		char *name, *p;
+	colon = strchr(opt_name, ':');
+	if (colon != NULL) {
+		char *name;
 
 		name = talloc_strdup(scfg, opt_name);
 		if (!name) {
 			return NULL;
 		}
-		p = strchr(name, ':');
-		*p = '-';
+		name[colon-opt_name] = '-';
 
 		el = ldb_msg_find_element(msg, name);
+		TALLOC_FREE(name);
 	} else {
 		el = ldb_msg_find_element(msg, opt_name);
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list