[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Feb 20 14:59:04 MST 2014


The branch, master has been updated
       via  72696c3 lib: Fix a typo
       via  eb4b319 messaging: Fix a memleak on error in messaging_tdb_init
       via  69300c0 lib: Avoid a strlen call in xx_path()
       via  efed82c krb5_locator: Slightly simplify code
       via  30cd122 winbindd: Avoid using deallocated memory
       via  bd55fdb messaging: Enforce just one messaging context
       via  fb35d17 vfstext: Use just one messaging_context in vfstest
       via  a93aaec spoolssd: Use only one messaging_context per process
      from  8f0d06f heimdal_build: only enable libintl functions if everything was found

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


- Log -----------------------------------------------------------------
commit 72696c3f5a01da5ba07ee3495bd01c8288cb1b6d
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Dec 31 15:28:04 2013 +0100

    lib: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Kai Blin <kai at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Feb 20 22:58:59 CET 2014 on sn-devel-104

commit eb4b319a8e4226ae6cdc017078a029d9a6a3e143
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 28 14:18:32 2013 +0100

    messaging: Fix a memleak on error in messaging_tdb_init
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Kai Blin <kai at samba.org>

commit 69300c034f64e86439d2898a5832a400a8ee319a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jan 1 11:38:52 2014 +0100

    lib: Avoid a strlen call in xx_path()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Kai Blin <kai at samba.org>

commit efed82cb69499f6d7ed09b7263689e47e25a9d94
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Feb 13 13:19:26 2014 +0000

    krb5_locator: Slightly simplify code
    
    This makes it a bit easier to read for me
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Kai Blin <kai at samba.org>

commit 30cd122beb32d0935afcd5bc2f3192f3c25aaeea
Author: Santosh Kumar Pradhan <spradhan at redhat.com>
Date:   Thu Feb 20 15:51:37 2014 +0530

    winbindd: Avoid using deallocated memory
    
    Failure in ads_search_retry() deallocates the memory occupied
    by "ads" which should not be used after.
    
    CID: 242096
    
    Signed-off-by: Santosh Kumar Pradhan <spradhan at redhat.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>

commit bd55fdbf09bd91351e097d4b71925c84de7b2a6e
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Feb 18 20:51:23 2014 +0100

    messaging: Enforce just one messaging context
    
    The current messaging implementation is based on a tdb indexed by server_id. If
    we have more than one messaging context in a process, messages might not arrive
    at the right context and be dropped, depending on which signal handler is
    triggered first.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit fb35d17e438772a357c442f15932986affb7c927
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Feb 18 20:51:57 2014 +0100

    vfstext: Use just one messaging_context in vfstest
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a93aaec77e114fb46f8873e943244b2542f9292a
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Feb 18 20:51:43 2014 +0100

    spoolssd: Use only one messaging_context per process
    
    After the fork, the code created a fresh messaging_context before doing the
    reinit_after_fork. This means to have two initialized messaging contexts in
    that process. This patch aligns spoolssd with lsad.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 nsswitch/winbind_krb5_locator.c |    3 +--
 source3/lib/cbuf.h              |    4 ++--
 source3/lib/messages_local.c    |   21 +++++++++++++++++++++
 source3/lib/util.c              |    2 +-
 source3/printing/spoolssd.c     |    2 +-
 source3/torture/vfstest.c       |    6 ++++--
 source3/winbindd/winbindd_ads.c |    2 +-
 7 files changed, 31 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/nsswitch/winbind_krb5_locator.c b/nsswitch/winbind_krb5_locator.c
index 385a156..91a2d64 100644
--- a/nsswitch/winbind_krb5_locator.c
+++ b/nsswitch/winbind_krb5_locator.c
@@ -142,11 +142,10 @@ static int smb_krb5_locator_lookup_sanity_check(enum locate_service_type svc,
 	switch (family) {
 		case AF_UNSPEC:
 		case AF_INET:
-			break;
 #if defined(HAVE_IPV6)
 		case AF_INET6:
-			break;
 #endif
+			break;
 		default:
 			return EINVAL;
 	}
diff --git a/source3/lib/cbuf.h b/source3/lib/cbuf.h
index b9c5552..3a1524c 100644
--- a/source3/lib/cbuf.h
+++ b/source3/lib/cbuf.h
@@ -222,7 +222,7 @@ char* cbuf_gets(cbuf* b, size_t idx);
  * @param[out] ost outstream
  * @param[in]  s '\0' terminated string of printable characters.
  *
- * @return numner of bytes written, -1 on error
+ * @return number of bytes written, -1 on error
  */
 int cbuf_print_quoted_string(cbuf* ost, const char* s);
 
@@ -237,7 +237,7 @@ int cbuf_print_quoted_string(cbuf* ost, const char* s);
  * @param[in]  s string of bytes
  * @param[in]  len number of bytes
  *
- * @return numner of bytes written, -1 on error
+ * @return number of bytes written, -1 on error
  */
 int cbuf_print_quoted(cbuf* ost, const char* s, size_t len);
 
diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c
index 6b9c251..acc5ba6 100644
--- a/source3/lib/messages_local.c
+++ b/source3/lib/messages_local.c
@@ -53,6 +53,7 @@ struct messaging_tdb_context {
 	struct tdb_wrap *tdb;
 	struct tevent_signal *se;
 	int received_messages;
+	bool *have_context;
 };
 
 static NTSTATUS messaging_tdb_send(struct messaging_context *msg_ctx,
@@ -77,6 +78,8 @@ static void messaging_tdb_signal_handler(struct tevent_context *ev_ctx,
 	message_dispatch(ctx->msg_ctx);
 }
 
+static int messaging_tdb_context_destructor(struct messaging_tdb_context *ctx);
+
 /****************************************************************************
  Initialise the messaging functions. 
 ****************************************************************************/
@@ -88,6 +91,12 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx,
 	struct messaging_backend *result;
 	struct messaging_tdb_context *ctx;
 	struct loadparm_context *lp_ctx;
+	static bool have_context = false;
+
+	if (have_context) {
+		DEBUG(0, ("No two messaging contexts per process\n"));
+		return NT_STATUS_OBJECT_NAME_COLLISION;
+	}
 
 	if (!(result = talloc(mem_ctx, struct messaging_backend))) {
 		DEBUG(0, ("talloc failed\n"));
@@ -97,6 +106,7 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx,
 	lp_ctx = loadparm_init_s3(result, loadparm_s3_helpers());
 	if (lp_ctx == NULL) {
 		DEBUG(0, ("loadparm_init_s3 failed\n"));
+		TALLOC_FREE(result);
 		return NT_STATUS_INTERNAL_ERROR;
 	}
 
@@ -110,6 +120,7 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx,
 	result->send_fn = messaging_tdb_send;
 
 	ctx->msg_ctx = msg_ctx;
+	ctx->have_context = &have_context;
 
 	ctx->tdb = tdb_wrap_open(ctx, lock_path("messages.tdb"), 0,
 				 TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_VOLATILE|TDB_INCOMPATIBLE_HASH,
@@ -139,10 +150,20 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx,
 
 	sec_init();
 
+	have_context = true;
+	talloc_set_destructor(ctx, messaging_tdb_context_destructor);
+
 	*presult = result;
 	return NT_STATUS_OK;
 }
 
+static int messaging_tdb_context_destructor(struct messaging_tdb_context *ctx)
+{
+	SMB_ASSERT(*ctx->have_context);
+	*ctx->have_context = false;
+	return 0;
+}
+
 bool messaging_tdb_parent_init(TALLOC_CTX *mem_ctx)
 {
 	struct tdb_wrap *db;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 374bc5d..07daad2 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1504,7 +1504,7 @@ static char *xx_path(const char *name, const char *rootpath)
 		}
 	}
 
-	return talloc_asprintf_append(fname, "/%s", name);
+	return talloc_asprintf_append_buffer(fname, "/%s", name);
 }
 
 /**
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index 0b6980a..1bf87b3 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -285,7 +285,7 @@ static bool spoolss_child_init(struct tevent_context *ev_ctx,
 {
 	NTSTATUS status;
 	struct rpc_srv_callbacks spoolss_cb;
-	struct messaging_context *msg_ctx = messaging_init(NULL, ev_ctx);
+	struct messaging_context *msg_ctx = server_messaging_context();
 	bool ok;
 
 	status = reinit_after_fork(msg_ctx, ev_ctx,
diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c
index 2cec687..40d44c3 100644
--- a/source3/torture/vfstest.c
+++ b/source3/torture/vfstest.c
@@ -464,7 +464,7 @@ int main(int argc, char *argv[])
 	char *filename = NULL;
 	char cwd[MAXPATHLEN];
 	TALLOC_CTX *frame = talloc_stackframe();
-	struct tevent_context *ev = samba_tevent_context_init(NULL);
+	struct tevent_context *ev;
 	struct auth_session_info *session_info = NULL;
 	NTSTATUS status = NT_STATUS_OK;
 
@@ -537,9 +537,11 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
+	ev = server_event_context();
+
 	status = create_conn_struct(vfs,
 				ev,
-				messaging_init(vfs, ev),
+				server_messaging_context(),
                                 &vfs->conn,
                                 -1,
                                 getcwd(cwd, sizeof(cwd)),
diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
index 18749c9..4f149a7 100644
--- a/source3/winbindd/winbindd_ads.c
+++ b/source3/winbindd/winbindd_ads.c
@@ -297,9 +297,9 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
 	if (!ADS_ERR_OK(rc)) {
 		DEBUG(1,("query_user_list ads_search: %s\n", ads_errstr(rc)));
 		status = ads_ntstatus(rc);
+		goto done;
 	} else if (!res) {
 		DEBUG(1,("query_user_list ads_search returned NULL res\n"));
-
 		goto done;
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list