[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Tue Sep 13 04:40:02 MDT 2011


The branch, master has been updated
       via  e63d0c5 s3: Fix Coverity ID 2613 -- UNINIT
       via  67605bf s3: Fix Coverity ID 2614 -- UNINIT
       via  ad85bd8 s3: Make saf_join_key() use talloc
       via  0e5a876 s3: Make saf_key() use talloc
       via  f55f4b8 s3: Disentangle resolve_name() a bit
       via  6344482 s3: Remove a reference to smbd_server_conn
       via  3e8a8d08 s3: Remove a reference to smbd_server_conn
       via  d911bd5 s3: Remove a reference to smbd_server_conn
       via  d08885b s3: Remove a reference to smbd_server_conn
       via  2b32918 s3: Remove a reference to smbd_server_conn
       via  f6fa51d s3: Fix some nonempty blank lines
      from  85598e6 s3-selftest use a more portable shell syntax

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


- Log -----------------------------------------------------------------
commit e63d0c5f0c5546707b10217f709f6c7a5d5ae9f9
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Sep 13 10:47:15 2011 +0200

    s3: Fix Coverity ID 2613 -- UNINIT
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Tue Sep 13 12:39:10 CEST 2011 on sn-devel-104

commit 67605bfc55cc106de99d318f0c1d484261926b3b
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Sep 13 10:46:32 2011 +0200

    s3: Fix Coverity ID 2614 -- UNINIT

commit ad85bd8003fdbefb5f9186408721c766b5e813eb
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 21:11:57 2011 +0200

    s3: Make saf_join_key() use talloc

commit 0e5a876aa7820bdd5b32f84ff7a6a7d254df8073
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 21:07:16 2011 +0200

    s3: Make saf_key() use talloc

commit f55f4b8ce5b8d925304ae27e3e24283f4c22f3b3
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 20:56:13 2011 +0200

    s3: Disentangle resolve_name() a bit

commit 6344482f00fa0ca6887fc7a5fe145df74687c6a7
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 17:33:26 2011 +0200

    s3: Remove a reference to smbd_server_conn

commit 3e8a8d08e3e36e5d36b93e4d515c7905907ef314
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 17:32:39 2011 +0200

    s3: Remove a reference to smbd_server_conn

commit d911bd5c69db0b374e61cb474c3536f925369dc6
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 17:30:51 2011 +0200

    s3: Remove a reference to smbd_server_conn

commit d08885b0c43e86ceece8e0ce92e7419de4b65ea9
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 17:30:40 2011 +0200

    s3: Remove a reference to smbd_server_conn

commit 2b32918117a042d36be79042f0ceaed35042489b
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 17:23:07 2011 +0200

    s3: Remove a reference to smbd_server_conn

commit f6fa51ddf71dac374b42e5a7849623120eee7fb1
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 17:19:27 2011 +0200

    s3: Fix some nonempty blank lines

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

Summary of changes:
 source3/include/ads.h            |    2 +-
 source3/include/messages.h       |    6 ++--
 source3/libsmb/namequery.c       |   72 +++++++++++++++++++++++--------------
 source3/rpc_client/util_lsarpc.c |    2 +
 source3/smbd/msg_idmap.c         |   12 +++++-
 source3/smbd/oplock_linux.c      |    6 ++--
 source3/smbd/process.c           |    5 ++-
 source3/smbd/server.c            |    7 ++--
 8 files changed, 71 insertions(+), 41 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/ads.h b/source3/include/ads.h
index 8a8ce28..bbe8671 100644
--- a/source3/include/ads.h
+++ b/source3/include/ads.h
@@ -26,7 +26,7 @@ enum ads_saslwrap_type {
 
 typedef struct ads_struct {
 	int is_mine;	/* do I own this structure's memory? */
-	
+
 	/* info needed to find the server */
 	struct {
 		char *realm;
diff --git a/source3/include/messages.h b/source3/include/messages.h
index c15dadc..5ea27f3 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -3,17 +3,17 @@
    messages.c header
    Copyright (C) Andrew Tridgell 2000
    Copyright (C) 2001, 2002 by Martin Pool
-   
+
    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/>.
 */
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index dca740d..c70e68b 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -43,22 +43,14 @@ bool global_in_nmbd = False;
 #define SAFJOINKEY_FMT	"SAFJOIN/DOMAIN/%s"
 #define SAFJOIN_TTL	3600
 
-static char *saf_key(const char *domain)
+static char *saf_key(TALLOC_CTX *mem_ctx, const char *domain)
 {
-	char *keystr;
-
-	asprintf_strupper_m(&keystr, SAFKEY_FMT, domain);
-
-	return keystr;
+	return talloc_asprintf_strupper_m(mem_ctx, SAFKEY_FMT, domain);
 }
 
-static char *saf_join_key(const char *domain)
+static char *saf_join_key(TALLOC_CTX *mem_ctx, const char *domain)
 {
-	char *keystr;
-
-	asprintf_strupper_m(&keystr, SAFJOINKEY_FMT, domain);
-
-	return keystr;
+	return talloc_asprintf_strupper_m(mem_ctx, SAFJOINKEY_FMT, domain);
 }
 
 /****************************************************************************
@@ -82,7 +74,11 @@ bool saf_store( const char *domain, const char *servername )
 		return False;
 	}
 
-	key = saf_key( domain );
+	key = saf_key(talloc_tos(), domain);
+	if (key == NULL) {
+		DEBUG(1, ("saf_key() failed\n"));
+		return false;
+	}
 	expire = time( NULL ) + lp_parm_int(-1, "saf","ttl", SAF_TTL);
 
 	DEBUG(10,("saf_store: domain = [%s], server = [%s], expire = [%u]\n",
@@ -90,7 +86,7 @@ bool saf_store( const char *domain, const char *servername )
 
 	ret = gencache_set( key, servername, expire );
 
-	SAFE_FREE( key );
+	TALLOC_FREE( key );
 
 	return ret;
 }
@@ -111,7 +107,11 @@ bool saf_join_store( const char *domain, const char *servername )
 		return False;
 	}
 
-	key = saf_join_key( domain );
+	key = saf_join_key(talloc_tos(), domain);
+	if (key == NULL) {
+		DEBUG(1, ("saf_join_key() failed\n"));
+		return false;
+	}
 	expire = time( NULL ) + lp_parm_int(-1, "saf","join ttl", SAFJOIN_TTL);
 
 	DEBUG(10,("saf_join_store: domain = [%s], server = [%s], expire = [%u]\n",
@@ -119,7 +119,7 @@ bool saf_join_store( const char *domain, const char *servername )
 
 	ret = gencache_set( key, servername, expire );
 
-	SAFE_FREE( key );
+	TALLOC_FREE( key );
 
 	return ret;
 }
@@ -134,17 +134,25 @@ bool saf_delete( const char *domain )
 		return False;
 	}
 
-	key = saf_join_key(domain);
+	key = saf_join_key(talloc_tos(), domain);
+	if (key == NULL) {
+		DEBUG(1, ("saf_join_key() failed\n"));
+		return false;
+	}
 	ret = gencache_del(key);
-	SAFE_FREE(key);
+	TALLOC_FREE(key);
 
 	if (ret) {
 		DEBUG(10,("saf_delete[join]: domain = [%s]\n", domain ));
 	}
 
-	key = saf_key(domain);
+	key = saf_key(talloc_tos(), domain);
+	if (key == NULL) {
+		DEBUG(1, ("saf_key() failed\n"));
+		return false;
+	}
 	ret = gencache_del(key);
-	SAFE_FREE(key);
+	TALLOC_FREE(key);
 
 	if (ret) {
 		DEBUG(10,("saf_delete: domain = [%s]\n", domain ));
@@ -168,11 +176,15 @@ char *saf_fetch( const char *domain )
 		return NULL;
 	}
 
-	key = saf_join_key( domain );
+	key = saf_join_key(talloc_tos(), domain);
+	if (key == NULL) {
+		DEBUG(1, ("saf_join_key() failed\n"));
+		return NULL;
+	}
 
 	ret = gencache_get( key, &server, &timeout );
 
-	SAFE_FREE( key );
+	TALLOC_FREE( key );
 
 	if ( ret ) {
 		DEBUG(5,("saf_fetch[join]: Returning \"%s\" for \"%s\" domain\n",
@@ -180,11 +192,15 @@ char *saf_fetch( const char *domain )
 		return server;
 	}
 
-	key = saf_key( domain );
+	key = saf_key(talloc_tos(), domain);
+	if (key == NULL) {
+		DEBUG(1, ("saf_key() failed\n"));
+		return NULL;
+	}
 
 	ret = gencache_get( key, &server, &timeout );
 
-	SAFE_FREE( key );
+	TALLOC_FREE( key );
 
 	if ( !ret ) {
 		DEBUG(5,("saf_fetch: failed to find server for \"%s\" domain\n",
@@ -2699,6 +2715,7 @@ bool resolve_name(const char *name,
 	struct ip_service *ss_list = NULL;
 	char *sitename = NULL;
 	int count = 0;
+	NTSTATUS status;
 
 	if (is_ipaddress(name)) {
 		return interpret_string_addr(return_ss, name, AI_NUMERICHOST);
@@ -2706,9 +2723,10 @@ bool resolve_name(const char *name,
 
 	sitename = sitename_fetch(lp_realm()); /* wild guess */
 
-	if (NT_STATUS_IS_OK(internal_resolve_name(name, name_type, sitename,
-						  &ss_list, &count,
-						  lp_name_resolve_order()))) {
+	status = internal_resolve_name(name, name_type, sitename,
+				       &ss_list, &count,
+				       lp_name_resolve_order());
+	if (NT_STATUS_IS_OK(status)) {
 		int i;
 
 		if (prefer_ipv4) {
diff --git a/source3/rpc_client/util_lsarpc.c b/source3/rpc_client/util_lsarpc.c
index e607a0c..169c10b 100644
--- a/source3/rpc_client/util_lsarpc.c
+++ b/source3/rpc_client/util_lsarpc.c
@@ -65,6 +65,7 @@ static NTSTATUS ai_array_2_trust_domain_info_buffer(TALLOC_CTX *mem_ctx,
 							   ai->array[i].AuthInfo.clear.size,
 							   &b[i].data.data,
 							   &size)) {
+					status = NT_STATUS_INVALID_PARAMETER;
 					goto fail;
 				}
 				b[i].data.size = size;
@@ -222,6 +223,7 @@ static NTSTATUS trust_domain_info_buffer_2_ai_array(TALLOC_CTX *mem_ctx,
 							   b[i].data.size,
 							   &ai->array[i].AuthInfo.clear.password,
 							   &size)) {
+					status = NT_STATUS_INVALID_PARAMETER;
 					goto fail;
 				}
 				ai->array[i].AuthInfo.clear.size = size;
diff --git a/source3/smbd/msg_idmap.c b/source3/smbd/msg_idmap.c
index dbd151d..e4a5652 100644
--- a/source3/smbd/msg_idmap.c
+++ b/source3/smbd/msg_idmap.c
@@ -112,10 +112,18 @@ static void id_cache_kill(struct messaging_context *msg_ctx,
 {
 	const char *msg = (data && data->data)
 		? (const char *)data->data : "<NULL>";
-	struct user_struct *validated_users =
-		smbd_server_conn->smb1.sessions.validated_users;
+	struct smbd_server_connection *sconn;
+	struct user_struct *validated_users;
 	struct id_cache_ref id;
 
+	sconn = msg_ctx_to_sconn(msg_ctx);
+	if (sconn == NULL) {
+		DEBUG(1, ("could not find sconn\n"));
+		return;
+	}
+
+	validated_users = sconn->smb1.sessions.validated_users;
+
 	if (!id_cache_ref_parse(msg, &id)) {
 		DEBUG(0, ("Invalid ?ID: %s\n", msg));
 		return;
diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c
index 19f4d6e..a455707 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -2,17 +2,17 @@
    Unix SMB/CIFS implementation.
    kernel oplock processing for Linux
    Copyright (C) Andrew Tridgell 2000
-   
+
    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/>.
 */
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index a60d77e..c7f0ade 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2355,7 +2355,8 @@ static int client_get_tcp_info(int sock, struct sockaddr_storage *server,
  */
 static bool keepalive_fn(const struct timeval *now, void *private_data)
 {
-	struct smbd_server_connection *sconn = smbd_server_conn;
+	struct smbd_server_connection *sconn = talloc_get_type_abort(
+		private_data, struct smbd_server_connection);
 	bool ret;
 
 	if (sconn->using_smb2) {
@@ -3115,7 +3116,7 @@ void smbd_process(struct tevent_context *ev_ctx,
 	    && !(event_add_idle(ev_ctx, NULL,
 				timeval_set(lp_keepalive(), 0),
 				"keepalive", keepalive_fn,
-				NULL))) {
+				sconn))) {
 		DEBUG(0, ("Could not add keepalive event\n"));
 		exit(1);
 	}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index ecda47c..668cafd 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -63,11 +63,12 @@ static void smb_conf_updated(struct messaging_context *msg,
 {
 	struct tevent_context *ev_ctx =
 		talloc_get_type_abort(private_data, struct tevent_context);
+	struct smbd_server_connection *sconn = msg_ctx_to_sconn(msg);
 
 	DEBUG(10,("smb_conf_updated: Got message saying smb.conf was "
 		  "updated. Reloading.\n"));
 	change_to_root_user();
-	reload_services(msg, smbd_server_conn->sock, False);
+	reload_services(msg, sconn->sock, False);
 	if (am_parent) {
 		printing_subsystem_update(ev_ctx, msg, false);
 	}
@@ -373,10 +374,10 @@ static void smbd_accept_connection(struct tevent_context *ev,
 				   uint16_t flags,
 				   void *private_data)
 {
-	struct smbd_server_connection *sconn = smbd_server_conn;
 	struct smbd_open_socket *s = talloc_get_type_abort(private_data,
 				     struct smbd_open_socket);
 	struct messaging_context *msg_ctx = s->msg_ctx;
+	struct smbd_server_connection *sconn = msg_ctx_to_sconn(msg_ctx);
 	struct sockaddr_storage addr;
 	socklen_t in_addrlen = sizeof(addr);
 	int fd;
@@ -474,7 +475,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
 					    "serverid.tdb");
 		}
 
-		smbd_process(ev, smbd_server_conn);
+		smbd_process(ev, sconn);
 	 exit:
 		exit_server_cleanly("end of child");
 		return;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list