[SCM] Samba Shared Repository - branch v4-1-test updated

Karolin Seeger kseeger at samba.org
Tue May 6 05:29:03 MDT 2014


The branch, v4-1-test has been updated
       via  15a2d25 s3: smbd - smb1 - fix read of deleted memory in reply_writeclose().
       via  7346e39 idmap_autorid: fix failure in reverse lookup if ID is from domain range index #0
       via  c573720 dsdb: Do checks for invalid renames in samldb, before repl_meta_data
       via  423987a build: fix ordering problems with lib-provided and internal RPATHs
       via  cebdd0d s4:torture/netlogon: Test netlogon with additional attrs
       via  b81797c s4:torture/ldap: Add test for netlogon over tcp
       via  11a9d8c libcli/cldap: Add utility to create netlogon filter
       via  2e10364 s4:dsdb: Move cldap netlogon functions into samdb/ldb_modules
       via  bb6fda9 s4:cldap_server: Do not handle netlogon ourself anymore
       via  a7a61ec s4:dsdb/rootdse: Support netlogon request
       via  19a5ac2 s4:dsdb/rootdse: Pass rootdse context to rootdse_add_dynamic
       via  1e75825 provision: Fix string replacement ordering
       via  2c82031 s4:cldap_server: Move netlogon parsing into utility function
       via  161699f s4:torture/cldap: Fix a typo
       via  aa82073 s3-lib/util: fix logic inside set_namearray loops.
       via  9dbafdc s3-lib/util: fix read across end of namelist string
       via  bb79bdb s3-nmbd: reset debug settings after reading config file (bug #10239)
      from  675782c VERSION: Bump version number up to 4.1.8...

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-1-test


- Log -----------------------------------------------------------------
commit 15a2d25e8d6a484f7beade36d6794294579528c1
Author: Noel Power <nopower at suse.com>
Date:   Thu Feb 27 12:07:11 2014 -0800

    s3: smbd - smb1 - fix read of deleted memory in reply_writeclose().
    
    While running smbtorture test raw.write under valgrind an "Invalid read"
    was reported in methid reply_writeclose, it seems after closing a file
    sometime later we try to access it again.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Mon Mar  3 20:42:40 CET 2014 on sn-devel-104
    (cherry picked from commit 04e434661fa6b5f13776f925b0a7cbadb6b6d006)
    
    Fix bug #10554 - request backport for 'smb1 - fix read of deleted memory in
    reply_writeclose()'.
    
    Autobuild-User(v4-1-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-1-test): Tue May  6 13:28:35 CEST 2014 on sn-devel-104

commit 7346e39f5407d0b5d4fc949f8c291ac4e8ed4411
Author: Abhidnya Joshi <achirmul at in.ibm.com>
Date:   Fri Oct 25 07:06:01 2013 +0200

    idmap_autorid: fix failure in reverse lookup if ID is from domain range index #0
    
    Domain range index #0 is not included in the database record.
    So in this special case we only have the SID, not SID#IDX...
    
    Signed-off-by: Abhidnya Joshi <achirmul at in.ibm.com>
    Reviewed-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit ebc9ff616fefbf10b31e4e097f28fa17a1abc2f8)
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10547

commit c5737207a0ad59eecfa54e05e4cc9198a08189e3
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Mar 24 17:15:19 2014 +1300

    dsdb: Do checks for invalid renames in samldb, before repl_meta_data
    
    This ensures that conflict objects can be created in CN=System, and
    that we do not stop replication just because some other DC allowed a
    rename we do not like.
    
    This is achived by doing the work in the samldb module, which is above
    repl_meta_data in the stack.
    
    Andrew Bartlett
    
    Change-Id: I8c1a7d3e0fbd5a470cf1326cc055044ca885f7d9
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Guenter Kukkukk <kukks at samba.org>
    Tested-by: Guenter Kukkukk <kukks at samba.org>
    (cherry picked from commit d3cd9f1575af18a6765a6b6a31811c9976f9c11e)
    
    Fix bug #10569 - Rename checks prevent conflict resolution and create DRS
    lockups.

commit 423987a4610d27fa60e5d2e47e9a5ae411997031
Author: Michael Adam <obnox at samba.org>
Date:   Wed Oct 16 15:17:18 2013 +0200

    build: fix ordering problems with lib-provided and internal RPATHs
    
    When a library or system (like cups) provides an RPATH,
    e.g. with -Wl,-R or -Wl,-rpath, this was added by waf
    to the LINKFLAGS, wich was later prepended to our RPATH.
    But if the path by chance contains an older version of
    one of our internal libraries like talloc, this would lead
    to linking the too old talloc into our binaries.
    
    This has been observed on, e.g., FreeBSD, but it is a general
    problem.
    
    This patch fixes the problem by specially parsing the RPATH
    linker options from the pkg-config(, cups-config, ....) output
    and putting the paths into the RPATH_<lib> container, which
    is then later correctly appended to our internal RPATH.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 64f5e24100a764ec198cab9a8d2c43fa86e7027c)
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10548

commit cebdd0d7a3eb246cff9c8900409848cb2939ce01
Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Thu Oct 31 21:23:57 2013 +0100

    s4:torture/netlogon: Test netlogon with additional attrs
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
    
    se enter the commit message for your changes. Lines starting
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Tue Nov 12 00:57:19 CET 2013 on sn-devel-104
    
    (cherry picked from commit 0dd512eead6dc999511e9e21f5304a224653db85)
    
    The last 10 patches address bug #10524 - samba returns 0 results to the LDAP
    query with filter
    (&(&(DnsDomain=NETAPP.TEST)(Host=STORE-SIM))(NtVer=0x00000006)).

commit b81797c4cac62f7b71e88dd9524697d0c33ecb04
Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Mon Oct 28 14:21:20 2013 +0100

    s4:torture/ldap: Add test for netlogon over tcp
    
    This patch moves the udp netlogon tests from cldap.c
    to netlogon.c and passes a generic netlogon-send
    function as parameter.
    
    Therefore a tcp replacement for cldap_netlogon is also added.
    The two variants tcp and udp are added as 2 new torture tests:
    
    ldap.netlogon-udp & ldap.netlogon-tcp
    Both tests succeed.
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
    (cherry picked from commit 767bd6a4d49efce1c554bb0bc8130d74331b0bd8)

commit 11a9d8cf6fd9c0a11b0563e7d6ee9cc994654baf
Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Mon Oct 28 14:19:57 2013 +0100

    libcli/cldap: Add utility to create netlogon filter
    
    This utility is splitted of from cldap_netlogon_send.
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
    (cherry picked from commit e306250a250d20a43cbe4c72ece34ebd475fa39c)

commit 2e103640c7e383bf335f96c5aadc4fd3d07d2929
Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Tue Nov 5 20:39:56 2013 +0100

    s4:dsdb: Move cldap netlogon functions into samdb/ldb_modules
    
    As netlogon is handled by the samdb now,
    the corresponding functions should live there as well.
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
    (cherry picked from commit 68ebb09193e73cff4389ccb9e3b190b12ee0a84a)

commit bb6fda902f11f9d7c645cd8c93e442a0714aca73
Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Fri Nov 1 10:52:02 2013 +0100

    s4:cldap_server: Do not handle netlogon ourself anymore
    
    Netlogon is now handled by the ldb rootdse module.
    
    The netlogon files will be moved to dsdb in the next commit.
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
    (cherry picked from commit 7106dcf2b8525ec653f24e417d846f9d00172b6d)

commit a7a61ec8726585e32dd8cc48d304a77fb3c4713a
Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Sun Oct 27 06:55:48 2013 +0100

    s4:dsdb/rootdse: Support netlogon request
    
    This patch adds support for a netlogon ldap style request
    over the tcp socket.  This is available since win2k3+ [1].
    
    The automatic client join & configuration daemon "realmd" makes
    use of this ability.
    Realmd can now be used to join a computer to a samba 4 domain.
    (See also:
    https://lists.samba.org/archive/samba-technical/2013-October/095606.html)
    
    Tested with:
    ldapsearch -h samba-srv -x -b '' -s base "(&(NtVer=\06\00\00\00)(AAC=\00\00\00\00))" NetLogon
    
    And compared the result in wireshark with cldap request issued by
    examples/misc/cldap.pl.
    
    [1]: http://wiki.wireshark.org/MS-CLDAP?action=recall&rev=8
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
    (cherry picked from commit 0620c79d76b69811fd6c00d912db05477d894724)

commit 19a5ac283f3125a0c17d43a9561e395612f87437
Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Fri Nov 1 06:55:41 2013 +0100

    s4:dsdb/rootdse: Pass rootdse context to rootdse_add_dynamic
    
    This replaced the *module parameter, and uses ac->module in the function
    instead, same for *req and *attrs.
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
    (cherry picked from commit 7a5a62547bc10053fb1e4850e0acacb6a837f36f)

commit 1e75825a0705576550cb0b7d8d723a650ec4073c
Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Fri Sep 6 16:20:43 2013 +0200

    provision: Fix string replacement ordering
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
    (cherry picked from commit ca8acb681a1ccaddf85376ff30c9b13b1a4c943d)

commit 2c82031bc12dff2852440737480bc73f0753c52d
Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Sun Oct 27 16:07:04 2013 +0100

    s4:cldap_server: Move netlogon parsing into utility function
    
    To be used later by netlogon-request over ldap.
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
    (cherry picked from commit 372127416825a8a947cd976f8a4165611c006c43)

commit 161699fdb41f7ddbe8c846f58ce1c043e4b168a8
Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Fri Nov 1 10:24:43 2013 +0100

    s4:torture/cldap: Fix a typo
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at symas.com>
    (cherry picked from commit 32ee231da590d7b8aee74728a423b282ae845bce)

commit aa8207302488d13db17d56884c619ac03442c1ca
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Apr 8 10:38:33 2014 -0700

    s3-lib/util: fix logic inside set_namearray loops.
    
    Additional fix for bug #10544 - s3-lib/util: set_namearray reads across end of namelist string.
    
    Not strictly needed as the initial fix addresses
    the problem, but corrects the internal logic
    inside the loops.
    
    https://bugzilla.samba.org/show_bug.cgi?id=10544
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Michael Adam <obnox at samba.org>
    (cherry picked from commit 4f59580331b934b183c3344da57f2002d88d4512)

commit 9dbafdc0bfb10b386415c304727fd64e9c35c956
Author: Björn Baumbach <bb at sernet.de>
Date:   Mon Apr 7 13:46:42 2014 +0200

    s3-lib/util: fix read across end of namelist string
    
    If the namelist is not terminated with a '/', we try to read
    the next character after the string termination '\0'.
    
    Signed-off-by: Björn Baumbach <bb at sernet.de>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Apr  8 21:44:16 CEST 2014 on sn-devel-104
    (cherry picked from commit 8f46b130c5c796d66d26982f5cd99c52f7c8ece1)
    
    Fix bug #10544 - s3-lib/util: set_namearray reads across end of namelist
    string.

commit bb79bdb97b97c72a79727d3dbbd67c26f4938bec
Author: Björn Baumbach <bb at sernet.de>
Date:   Wed Mar 19 15:01:11 2014 +0100

    s3-nmbd: reset debug settings after reading config file (bug #10239)
    
    Signed-off-by: Björn Baumbach <bb at sernet.de>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Mar 25 18:29:06 CET 2014 on sn-devel-104
    
    (cherry picked from commit a7df00c82049547129f063a40a842b156c8aead4)

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

Summary of changes:
 buildtools/wafadmin/Tools/config_c.py              |   13 +
 libcli/cldap/cldap.c                               |   90 +++--
 libcli/cldap/cldap.h                               |    2 +
 python/samba/provision/__init__.py                 |    2 +-
 source3/lib/util.c                                 |   33 +-
 source3/nmbd/nmbd.c                                |    4 +
 source3/smbd/reply.c                               |   24 +-
 source3/winbindd/idmap_autorid.c                   |    2 +-
 source4/cldap_server/cldap_server.c                |   12 -
 source4/cldap_server/cldap_server.h                |   15 -
 source4/cldap_server/rootdse.c                     |    5 +
 source4/cldap_server/wscript_build                 |    2 +-
 .../samdb/ldb_modules}/netlogon.c                  |   94 ++---
 source4/dsdb/samdb/ldb_modules/rootdse.c           |  122 +++++--
 source4/dsdb/samdb/ldb_modules/samldb.c            |  261 +++++++++++++-
 source4/dsdb/samdb/ldb_modules/subtree_rename.c    |  248 +------------
 source4/dsdb/samdb/ldb_modules/util.h              |    2 +
 source4/dsdb/samdb/ldb_modules/wscript_build       |    2 +-
 source4/ldap_server/ldap_backend.c                 |    3 +
 source4/nbt_server/dgram/netlogon.c                |    2 +-
 source4/nbt_server/wscript_build                   |    2 +-
 source4/rpc_server/netlogon/dcerpc_netlogon.c      |    2 +-
 source4/rpc_server/wscript_build                   |    2 +-
 source4/torture/ldap/cldap.c                       |  331 +----------------
 source4/torture/ldap/common.c                      |    2 +
 source4/torture/ldap/{cldap.c => netlogon.c}       |  394 ++++++++++++--------
 source4/torture/wscript_build                      |    2 +-
 27 files changed, 772 insertions(+), 901 deletions(-)
 rename source4/{cldap_server => dsdb/samdb/ldb_modules}/netlogon.c (87%)
 copy source4/torture/ldap/{cldap.c => netlogon.c} (61%)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafadmin/Tools/config_c.py b/buildtools/wafadmin/Tools/config_c.py
index a32d8aa..d0bc617 100644
--- a/buildtools/wafadmin/Tools/config_c.py
+++ b/buildtools/wafadmin/Tools/config_c.py
@@ -73,6 +73,19 @@ def parse_flags(line, uselib, env):
 			app('CCFLAGS_' + uselib, x)
 			app('CXXFLAGS_' + uselib, x)
 			app('LINKFLAGS_' + uselib, x)
+		#
+		# NOTE on special treatment of -Wl,-R and -Wl,-rpath:
+		#
+		# It is important to not put a library provided RPATH
+		# into the LINKFLAGS but in the RPATH instead, since
+		# the provided LINKFLAGS get prepended to our own internal
+		# RPATH later, and hence can potentially lead to linking
+		# in too old versions of our internal libs.
+		#
+		elif x.startswith('-Wl,-R'):
+			app('RPATH_' + uselib, x[6:])
+		elif x.startswith('-Wl,-rpath,'):
+			app('RPATH_' + uselib, x[11:])
 		elif x.startswith('-Wl'):
 			app('LINKFLAGS_' + uselib, x)
 		elif x.startswith('-m') or x.startswith('-f'):
diff --git a/libcli/cldap/cldap.c b/libcli/cldap/cldap.c
index 24ce39f..e543091 100644
--- a/libcli/cldap/cldap.c
+++ b/libcli/cldap/cldap.c
@@ -882,81 +882,91 @@ struct cldap_netlogon_state {
 	struct cldap_search search;
 };
 
-static void cldap_netlogon_state_done(struct tevent_req *subreq);
-/*
-  queue a cldap netlogon for send
-*/
-struct tevent_req *cldap_netlogon_send(TALLOC_CTX *mem_ctx,
-				       struct tevent_context *ev,
-				       struct cldap_socket *cldap,
-				       const struct cldap_netlogon *io)
+char *cldap_netlogon_create_filter(TALLOC_CTX *mem_ctx,
+				   const struct cldap_netlogon *io)
 {
-	struct tevent_req *req, *subreq;
-	struct cldap_netlogon_state *state;
 	char *filter;
-	static const char * const attr[] = { "NetLogon", NULL };
 
-	req = tevent_req_create(mem_ctx, &state,
-				struct cldap_netlogon_state);
-	if (!req) {
+	filter = talloc_asprintf(mem_ctx, "(&(NtVer=%s)",
+				 ldap_encode_ndr_uint32(mem_ctx, io->in.version));
+	if (filter == NULL)
 		return NULL;
-	}
 
-	filter = talloc_asprintf(state, "(&(NtVer=%s)", 
-				 ldap_encode_ndr_uint32(state, io->in.version));
-	if (tevent_req_nomem(filter, req)) {
-		goto post;
-	}
 	if (io->in.user) {
 		filter = talloc_asprintf_append_buffer(filter, "(User=%s)", io->in.user);
-		if (tevent_req_nomem(filter, req)) {
-			goto post;
+		if (filter == NULL) {
+			return NULL;
 		}
 	}
 	if (io->in.host) {
 		filter = talloc_asprintf_append_buffer(filter, "(Host=%s)", io->in.host);
-		if (tevent_req_nomem(filter, req)) {
-			goto post;
+		if (filter == NULL) {
+			return NULL;
 		}
 	}
 	if (io->in.realm) {
 		filter = talloc_asprintf_append_buffer(filter, "(DnsDomain=%s)", io->in.realm);
-		if (tevent_req_nomem(filter, req)) {
-			goto post;
+		if (filter == NULL) {
+			return NULL;
 		}
 	}
 	if (io->in.acct_control != -1) {
 		filter = talloc_asprintf_append_buffer(filter, "(AAC=%s)", 
-						ldap_encode_ndr_uint32(state, io->in.acct_control));
-		if (tevent_req_nomem(filter, req)) {
-			goto post;
+						ldap_encode_ndr_uint32(mem_ctx, io->in.acct_control));
+		if (filter == NULL) {
+			return NULL;
 		}
 	}
 	if (io->in.domain_sid) {
-		struct dom_sid *sid = dom_sid_parse_talloc(state, io->in.domain_sid);
-		if (tevent_req_nomem(sid, req)) {
-			goto post;
+		struct dom_sid *sid = dom_sid_parse_talloc(mem_ctx, io->in.domain_sid);
+		if (filter == NULL) {
+			return NULL;
 		}
 		filter = talloc_asprintf_append_buffer(filter, "(domainSid=%s)",
-						ldap_encode_ndr_dom_sid(state, sid));
-		if (tevent_req_nomem(filter, req)) {
-			goto post;
+						ldap_encode_ndr_dom_sid(mem_ctx, sid));
+		if (filter == NULL) {
+			return NULL;
 		}
 	}
 	if (io->in.domain_guid) {
 		struct GUID guid;
 		NTSTATUS status;
 		status = GUID_from_string(io->in.domain_guid, &guid);
-		if (tevent_req_nterror(req, status)) {
-			goto post;
+		if (filter == NULL) {
+			return NULL;
 		}
 		filter = talloc_asprintf_append_buffer(filter, "(DomainGuid=%s)",
-						ldap_encode_ndr_GUID(state, &guid));
-		if (tevent_req_nomem(filter, req)) {
-			goto post;
+						ldap_encode_ndr_GUID(mem_ctx, &guid));
+		if (filter == NULL) {
+			return NULL;
 		}
 	}
 	filter = talloc_asprintf_append_buffer(filter, ")");
+
+	return filter;
+}
+
+static void cldap_netlogon_state_done(struct tevent_req *subreq);
+/*
+  queue a cldap netlogon for send
+*/
+struct tevent_req *cldap_netlogon_send(TALLOC_CTX *mem_ctx,
+				       struct tevent_context *ev,
+				       struct cldap_socket *cldap,
+				       const struct cldap_netlogon *io)
+{
+	struct tevent_req *req, *subreq;
+	struct cldap_netlogon_state *state;
+	char *filter;
+	static const char * const attr[] = { "NetLogon", NULL };
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct cldap_netlogon_state);
+	if (!req) {
+		return NULL;
+	}
+
+	filter = cldap_netlogon_create_filter(state, io);
 	if (tevent_req_nomem(filter, req)) {
 		goto post;
 	}
diff --git a/libcli/cldap/cldap.h b/libcli/cldap/cldap.h
index 0bc9454..cd76fee 100644
--- a/libcli/cldap/cldap.h
+++ b/libcli/cldap/cldap.h
@@ -123,6 +123,8 @@ NTSTATUS cldap_netlogon_recv(struct tevent_req *req,
 NTSTATUS cldap_netlogon(struct cldap_socket *cldap,
 			TALLOC_CTX *mem_ctx,
 			struct cldap_netlogon *io);
+char *cldap_netlogon_create_filter(TALLOC_CTX *mem_ctx,
+				   const struct cldap_netlogon *io);
 
 NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap,
 			      uint32_t message_id,
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index 4af6b69..46d2cbc 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -595,7 +595,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None,
         raise ProvisioningError("guess_names: 'realm =' was not specified in supplied %s.  Please remove the smb.conf file and let provision generate it" % lp.configfile)
 
     if lp.get("realm").upper() != realm:
-        raise ProvisioningError("guess_names: 'realm=%s' in %s must match chosen realm '%s'!  Please remove the smb.conf file and let provision generate it" % (lp.get("realm").upper(), realm, lp.configfile))
+        raise ProvisioningError("guess_names: 'realm=%s' in %s must match chosen realm '%s'!  Please remove the smb.conf file and let provision generate it" % (lp.get("realm").upper(), lp.configfile, realm))
 
     if lp.get("server role").lower() != serverrole:
         raise ProvisioningError("guess_names: 'server role=%s' in %s must match chosen server role '%s'!  Please remove the smb.conf file and let provision generate it" % (lp.get("server role"), lp.configfile, serverrole))
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 551beab..f64e2a3 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1035,6 +1035,7 @@ void set_namearray(name_compare_entry **ppname_array, const char *namelist_in)
 {
 	char *name_end;
 	char *namelist;
+	char *namelist_end;
 	char *nameptr;
 	int num_entries = 0;
 	int i;
@@ -1051,12 +1052,14 @@ void set_namearray(name_compare_entry **ppname_array, const char *namelist_in)
 	}
 	nameptr = namelist;
 
+	namelist_end = &namelist[strlen(namelist)];
+
 	/* We need to make two passes over the string. The
 		first to count the number of elements, the second
 		to split it.
 	*/
 
-	while(*nameptr) {
+	while(nameptr <= namelist_end) {
 		if ( *nameptr == '/' ) {
 			/* cope with multiple (useless) /s) */
 			nameptr++;
@@ -1068,11 +1071,13 @@ void set_namearray(name_compare_entry **ppname_array, const char *namelist_in)
 
 		/* find the next '/' or consume remaining */
 		name_end = strchr_m(nameptr, '/');
-		if (name_end == NULL)
-			name_end = (char *)nameptr + strlen(nameptr);
-
-		/* next segment please */
-		nameptr = name_end + 1;
+		if (name_end == NULL) {
+			/* Point nameptr at the terminating '\0' */
+			nameptr += strlen(nameptr);
+		} else {
+			/* next segment please */
+			nameptr = name_end + 1;
+		}
 		num_entries++;
 	}
 
@@ -1090,7 +1095,7 @@ void set_namearray(name_compare_entry **ppname_array, const char *namelist_in)
 	/* Now copy out the names */
 	nameptr = namelist;
 	i = 0;
-	while(*nameptr) {
+	while(nameptr <= namelist_end) {
 		if ( *nameptr == '/' ) {
 			/* cope with multiple (useless) /s) */
 			nameptr++;
@@ -1102,10 +1107,9 @@ void set_namearray(name_compare_entry **ppname_array, const char *namelist_in)
 
 		/* find the next '/' or consume remaining */
 		name_end = strchr_m(nameptr, '/');
-		if (name_end)
+		if (name_end != NULL) {
 			*name_end = '\0';
-		else
-			name_end = nameptr + strlen(nameptr);
+		}
 
 		(*ppname_array)[i].is_wild = ms_has_wild(nameptr);
 		if(((*ppname_array)[i].name = SMB_STRDUP(nameptr)) == NULL) {
@@ -1114,8 +1118,13 @@ void set_namearray(name_compare_entry **ppname_array, const char *namelist_in)
 			return;
 		}
 
-		/* next segment please */
-		nameptr = name_end + 1;
+		if (name_end == NULL) {
+			/* Point nameptr at the terminating '\0' */
+			nameptr += strlen(nameptr);
+		} else {
+			/* next segment please */
+			nameptr = name_end + 1;
+		}
 		i++;
 	}
 
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index ec0e7d0..8084e58 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -414,6 +414,8 @@ static bool reload_nmbd_services(bool test)
 		reload_nmbd_services( True );
 	}
 
+	reopen_logs();
+
 	return(ret);
 }
 
@@ -907,6 +909,8 @@ static bool open_sockets(bool isdaemon, int port)
 		exit(1);
 	}
 
+	reopen_logs();
+
 	if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC
 	    && !lp_parm_bool(-1, "server role check", "inhibit", false)) {
 		/* TODO: when we have a merged set of defaults for
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 055efd3..76d3ed1 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -5194,7 +5194,7 @@ void reply_writeclose(struct smb_request *req)
 	mtime = convert_time_t_to_timespec(srv_make_unix_date3(req->vwv+4));
 	data = (const char *)req->buf + 1;
 
-	if (!fsp->print_file) {
+	if (fsp->print_file == NULL) {
 		init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
 		    (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
 		    &lock);
@@ -5208,6 +5208,10 @@ void reply_writeclose(struct smb_request *req)
 
 	nwritten = write_file(req,fsp,data,startpos,numtowrite);
 
+	if (fsp->print_file == NULL) {
+		SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
+	}
+
 	set_close_write_time(fsp, mtime);
 
 	/*
@@ -5215,34 +5219,32 @@ void reply_writeclose(struct smb_request *req)
 	 * JRA.
 	 */
 
+	DEBUG(3,("writeclose %s num=%d wrote=%d (numopen=%d)\n",
+		fsp_fnum_dbg(fsp), (int)numtowrite, (int)nwritten,
+		(numtowrite) ? conn->num_files_open - 1 : conn->num_files_open));
+
 	if (numtowrite) {
 		DEBUG(3,("reply_writeclose: zero length write doesn't close "
 			 "file %s\n", fsp_str_dbg(fsp)));
 		close_status = close_file(req, fsp, NORMAL_CLOSE);
+		fsp = NULL;
 	}
 
-	DEBUG(3,("writeclose %s num=%d wrote=%d (numopen=%d)\n",
-		 fsp_fnum_dbg(fsp), (int)numtowrite, (int)nwritten,
-		 conn->num_files_open));
-
 	if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) {
 		reply_nterror(req, NT_STATUS_DISK_FULL);
-		goto strict_unlock;
+		goto out;
 	}
 
 	if(!NT_STATUS_IS_OK(close_status)) {
 		reply_nterror(req, close_status);
-		goto strict_unlock;
+		goto out;
 	}
 
 	reply_outbuf(req, 1, 0);
 
 	SSVAL(req->outbuf,smb_vwv0,nwritten);
 
-strict_unlock:
-	if (numtowrite && !fsp->print_file) {
-		SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
-	}
+out:
 
 	END_PROFILE(SMBwriteclose);
 	return;
diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c
index 391a314..57d952e 100644
--- a/source3/winbindd/idmap_autorid.c
+++ b/source3/winbindd/idmap_autorid.c
@@ -379,7 +379,7 @@ static NTSTATUS idmap_autorid_id_to_sid(struct autorid_global_config *cfg,
 		map->status = ID_UNKNOWN;
 		return NT_STATUS_OK;
 	}
-	if (q != NULL)
+	if ((q != NULL) && (*q != '\0'))
 		if (sscanf(q+1, "%"SCNu32, &domain_range_index) != 1) {
 			DEBUG(10, ("Domain range index not found, "
 				   "ignoring mapping request\n"));
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c
index ff8fe13..eb72b5b 100644
--- a/source4/cldap_server/cldap_server.c
+++ b/source4/cldap_server/cldap_server.c
@@ -80,18 +80,6 @@ static void cldapd_request_handler(struct cldap_socket *cldap,
 		return;
 	}
 
-	if (search->num_attributes == 1 &&
-	    strcasecmp(search->attributes[0], "netlogon") == 0) {
-		cldapd_netlogon_request(cldap,
-					cldapd,
-					in,
-					in->ldap_msg->messageid,
-					search->tree,
-					in->src);
-		talloc_free(in);
-		return;
-	}
-
 	cldapd_rootdse_request(cldap, cldapd, in,
 			       in->ldap_msg->messageid,
 			       search, in->src);
diff --git a/source4/cldap_server/cldap_server.h b/source4/cldap_server/cldap_server.h
index fe7788f..0725284 100644
--- a/source4/cldap_server/cldap_server.h
+++ b/source4/cldap_server/cldap_server.h
@@ -32,19 +32,4 @@ struct cldapd_server {
 
 struct ldap_SearchRequest;
 
-/* used by netlogon DCE/RPC server */
-NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
-                                         TALLOC_CTX *mem_ctx,
-                                         const char *domain,
-                                         const char *netbios_domain,
-                                         struct dom_sid *domain_sid,
-                                         const char *domain_guid,
-                                         const char *user,
-                                         uint32_t acct_control,
-                                         const char *src_address,
-                                         uint32_t version,
-                                         struct loadparm_context *lp_ctx,
-                                         struct netlogon_samlogon_response *netlogon,
-					 bool fill_on_blank_request);
-
 #include "cldap_server/proto.h"
diff --git a/source4/cldap_server/rootdse.c b/source4/cldap_server/rootdse.c
index b895616..3f389ce 100644
--- a/source4/cldap_server/rootdse.c
+++ b/source4/cldap_server/rootdse.c
@@ -158,6 +158,11 @@ void cldapd_rootdse_request(struct cldap_socket *cldap,
 	reply.response		= NULL;
 	reply.result		= &result;
 
+	/* Note: The remoteAddress should rather be set on a ldb request.
+	 * We can set this savely on the context here,
+	 * since cldapd_rootdse_fill operates synchronously. */
+	ldb_set_opaque(cldapd->samctx, "remoteAddress", src);
+
 	cldapd_rootdse_fill(cldapd, tmp_ctx, search, &reply.response,
 			    reply.result);
 
diff --git a/source4/cldap_server/wscript_build b/source4/cldap_server/wscript_build
index 6ffdb4a..928b91b 100644
--- a/source4/cldap_server/wscript_build
+++ b/source4/cldap_server/wscript_build
@@ -10,7 +10,7 @@ bld.SAMBA_MODULE('service_cldap',
 
 
 bld.SAMBA_SUBSYSTEM('CLDAPD',
-	source='netlogon.c rootdse.c',
+	source='rootdse.c',
 	autoproto='proto.h',
 	deps='cli_cldap ldbsamba'
 	)
diff --git a/source4/cldap_server/netlogon.c b/source4/dsdb/samdb/ldb_modules/netlogon.c
similarity index 87%
rename from source4/cldap_server/netlogon.c
rename to source4/dsdb/samdb/ldb_modules/netlogon.c
index 6d5efb5..a381da8 100644
--- a/source4/cldap_server/netlogon.c
+++ b/source4/dsdb/samdb/ldb_modules/netlogon.c
@@ -25,11 +25,11 @@
 #include <ldb_errors.h>
 #include "lib/events/events.h"
 #include "smbd/service_task.h"
-#include "cldap_server/cldap_server.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 #include "libcli/ldap/ldap_ndr.h"
 #include "libcli/security/security.h"
 #include "dsdb/samdb/samdb.h"
+#include "dsdb/samdb/ldb_modules/util.h"
 #include "auth/auth.h"
 #include "ldb_wrap.h"
 #include "system/network.h"
@@ -369,27 +369,26 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
 	return NT_STATUS_OK;
 }
 
-
-/*
-  handle incoming cldap requests
-*/
-void cldapd_netlogon_request(struct cldap_socket *cldap,
-			     struct cldapd_server *cldapd,
-			     TALLOC_CTX *tmp_ctx,
-			     uint32_t message_id,
-			     struct ldb_parse_tree *tree,
-			     struct tsocket_address *src)
+NTSTATUS parse_netlogon_request(struct ldb_parse_tree *tree,
+				struct loadparm_context *lp_ctx,
+				TALLOC_CTX *tmp_ctx,
+				const char **domain,
+				const char **host,
+				const char **user,
+				const char **domain_guid,
+				struct dom_sid **domain_sid,
+				int *acct_control,
+				int *version)
 {
 	unsigned int i;
-	const char *domain = NULL;
-	const char *host = NULL;
-	const char *user = NULL;
-	const char *domain_guid = NULL;
-	struct dom_sid *domain_sid = NULL;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list