[SCM] Samba Shared Repository - branch v3-3-stable updated

Karolin Seeger kseeger at samba.org
Thu Oct 8 07:24:56 MDT 2009


The branch, v3-3-stable has been updated
       via  8468e58... WHATSNEW: Add more coherent explanation for bug #6680.
       via  410d1ca... s3-pamsmbpass: copy _pam_get_item and _pam_get_data from pam_winbind.
       via  2dcc87e... WHATSNEW: List major enhancements.
       via  38091cd... WHATSNEW: Update release notes.
       via  1a27b1c... s3-{u}mount.cifs: remove unrequired dependency on popt.
       via  59021d0... s3:winbind: Only ever handle one event after a select call
       via  f35684b... Fix bug 6776 - Running overlapping Byte Lock test will core dump Samba daemon. Re-write core of POSIX locking logic. Jeremy. (cherry picked from commit faf7197b3b4ac9fefeb0fca31a888c9e84bed92f)
       via  e88b357... s3:smbd: Fix bug 6690, wrong error check (cherry picked from commit 076e24cbaf9009f744978b03ddf6ef593d90e9c1)
       via  3e2c963... s3:winbindd_cm: don't invalidate the whole connection when just samr gave ACCCESS_DENIED
       via  680d49b... s3:rpc_server: we need to make a copy of my_name in serverinfo_to_SamInfo3()
       via  e04a4e0... s3-rpc_client: fix rpccli_set_timeout to cope with abstract transport.
       via  74b9484... s3:winbind: Fix an uninitialized variable (cherry picked from commit 0724649a8a7c04d015317d9dc2ae43ee87c1bd25) (cherry picked from commit b50ae28be07b93eef04e6e4b9eeb9fc440e21bd4)
       via  f1f1570... s3-winbindd: Fix Bug #6711: trusts to windows 2008 (2008 r2) not working.
       via  7ee94fa... s3-winbindd: add cm_connect_lsa_tcp().
       via  eea4d44... s3-rpc_client: fix non initialized structure in rpccli_lsa_lookup_sids_noalloc.
       via  9ff99ef... s3-rpc_client: add rpccli_lsa_lookup_sids3 wrapper.
       via  c9a5cfe... s3-rpc_client: add rpccli_lsa_lookup_names4 wrapper.
       via  3b5b7e4... s3-winbindd: add and use winbindd_lookup_names().
       via  fa49b74... s3-winbindd: add and use winbindd_lookup_sids().
       via  82d6e70... s3-rpc_client: add dcerpc_transport_t to cli_rpc_pipe_open_schannel().
       via  13d9141... s3-rpc_client: add dcerpc_transport_t to cli_rpc_pipe_open_spnego_ntlmssp and cli_rpc_pipe_open_ntlmssp.
       via  62a2cf0... s3-rpc_client: add cli_rpc_pipe_open_noauth_transport.
      from  702ad7e... WHATSNEW: Prepare release notes for Samba 3.3.9.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-stable


- Log -----------------------------------------------------------------
commit 8468e58b449914474116c8b13a8008fe02fc37ba
Author: Karolin Seeger <kseeger at samba.org>
Date:   Thu Oct 8 15:21:00 2009 +0200

    WHATSNEW: Add more coherent explanation for bug #6680.
    
    Karolin
    (cherry picked from commit 6c4fe1086020d7bc278d84c56b6cbcc6e3a64b5d)

commit 410d1ca0d90f1296351315ff4f09ebae38998b9b
Author: Günther Deschner <gd at samba.org>
Date:   Thu Oct 8 15:16:25 2009 +0200

    s3-pamsmbpass: copy _pam_get_item and _pam_get_data from pam_winbind.
    
    Fix bug #6790.
    
    Guenther
    (cherry picked from commit baa2c10b11a960dd70b3d32b4868a303d85ca9b2)

commit 2dcc87e48c1df6e83a001b8cbadf6c53293b491c
Author: Karolin Seeger <kseeger at samba.org>
Date:   Thu Oct 8 15:12:27 2009 +0200

    WHATSNEW: List major enhancements.
    
    Karolin
    (cherry picked from commit 113e33cc8d9cb4f68345a39081580db18c0468d8)

commit 38091cdaaba39d975a976036c988bc54ba7e2241
Author: Karolin Seeger <kseeger at samba.org>
Date:   Thu Oct 8 15:09:46 2009 +0200

    WHATSNEW: Update release notes.
    
    Karolin
    (cherry picked from commit 30064fe10bab01bea629b0564078323725bdea03)

commit 1a27b1cbe1c5bdcc86f33421b51d0535609f5435
Author: Günther Deschner <gd at samba.org>
Date:   Fri Jun 19 17:43:57 2009 +0200

    s3-{u}mount.cifs: remove unrequired dependency on popt.
    
    Fixes bug #6789.
    
    Guenther
    (cherry picked from commit f8b2fc49937a72fe64c3e4310141f45fb7d679bf)

commit 59021d00c9f719755343a268e074cb153ce3d985
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 7 15:53:46 2009 +0200

    s3:winbind: Only ever handle one event after a select call
    
    While handling an fd event, the situation with other fds can change. I've just
    seen a winbind stuck in the accept() call on the privileged pipe. I can only
    imagine this happen because under high load we first handled other requests and
    meanwhile the client on the privileged pipe went away.
    (cherry picked from commit a4df4406f12281db60fd6612c6ebf93d77af9152)

commit f35684bf980ab397468ae194302e65a42928273e
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Oct 5 16:28:59 2009 -0700

    Fix bug 6776 - Running overlapping Byte Lock test will core dump Samba daemon. Re-write core of POSIX locking logic. Jeremy.
    (cherry picked from commit faf7197b3b4ac9fefeb0fca31a888c9e84bed92f)

commit e88b35716b3e6a2527243f563ce0440a9a65794b
Author: Andrew Klosterman <andrew.klosterman+samba_bugzilla at gmail.com>
Date:   Tue Sep 8 17:38:37 2009 +0200

    s3:smbd: Fix bug 6690, wrong error check
    (cherry picked from commit 076e24cbaf9009f744978b03ddf6ef593d90e9c1)

commit 3e2c96390a8840f4c6fcface8e3dfb161c53be21
Author: Stefan Metzmacher <metze at sernet.de>
Date:   Thu Sep 24 21:35:38 2009 +0200

    s3:winbindd_cm: don't invalidate the whole connection when just samr gave ACCCESS_DENIED
    
    metze
    (cherry picked from commit c6d485583aba69b38b2972224e27edb60c3bf09a)

commit 680d49b79e3f9a3831d08b9c981ea0c8518abaf6
Author: Günther Deschner <gd at samba.org>
Date:   Wed Oct 7 14:34:05 2009 +0200

    s3:rpc_server: we need to make a copy of my_name in serverinfo_to_SamInfo3()
    
    This is important for the case the server_info already contains a logon_server.
    
    metze
    (cherry picked from commit 855ac932cf86272aaf02bf68e1fbf0e0a2902982)

commit e04a4e08cca4b627f42f06d523272d164a451f0b
Author: Günther Deschner <gd at samba.org>
Date:   Tue Oct 6 11:10:47 2009 +0200

    s3-rpc_client: fix rpccli_set_timeout to cope with abstract transport.
    
    taken from: b7094c0b804984de8e0b50c17e7908a2685df557
    
    Guenther
    (cherry picked from commit 3ca4a7bb33c56aa813247d0ea51863d7ded2e5de)

commit 74b94843490fc4f03f94a7791881155e2bb2b533
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Sep 23 06:23:50 2009 +0200

    s3:winbind: Fix an uninitialized variable (cherry picked from commit 0724649a8a7c04d015317d9dc2ae43ee87c1bd25)
    (cherry picked from commit b50ae28be07b93eef04e6e4b9eeb9fc440e21bd4)

commit f1f157082fcdea90bea1bd7a4a1d7d9de94ce771
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 17 09:43:36 2009 +0200

    s3-winbindd: Fix Bug #6711: trusts to windows 2008 (2008 r2) not working.
    
    Winbindd should always try to use LSA via an schannel authenticated ncacn_ip_tcp
    connection when talking to AD for LSA lookup calls.
    
    In Samba <-> W2k8 interdomain trust scenarios, LookupSids3 and LookupNames4 via an
    schannel ncacn_ip_tcp LSA connection are the *only* options to successfully resolve
    sids and names.
    
    Guenther
    (cherry picked from commit 6a8ef6c424c52be861ed2a9806f917a64ec892a6)
    (cherry picked from commit acc5e6012adca290ddc067a4ed25a8161b74250e)

commit 7ee94fac38c1f8734b4ce869d817769beea96017
Author: Günther Deschner <gd at samba.org>
Date:   Sat Sep 12 23:30:39 2009 +0200

    s3-winbindd: add cm_connect_lsa_tcp().
    
    Guenther
    (cherry picked from commit 58f2deb94024f002e3c3df47f45454edc97f47e1)
    (cherry picked from commit 7e4e12f120c666f31af042ab59fd9478017740ea)

commit eea4d4481eecc1ffe03e5103de032b9acfd83c52
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 17 09:42:49 2009 +0200

    s3-rpc_client: fix non initialized structure in rpccli_lsa_lookup_sids_noalloc.
    
    Guenther
    (cherry picked from commit a4b5c792c55ef90648a528d279beec32f86a9b22)
    (cherry picked from commit bd2e674cc3ab0fb6f1d988b0b19b6ad5544512b3)

commit 9ff99efe89e0e31e66617f4b1f53340fa76cdce9
Author: Günther Deschner <gd at samba.org>
Date:   Sun Sep 13 00:28:49 2009 +0200

    s3-rpc_client: add rpccli_lsa_lookup_sids3 wrapper.
    
    Guenther
    (cherry picked from commit 2f9adf04e4b3e16c046cb371a428a8a70d5de041)
    (cherry picked from commit 18ba75b763a2fec8f7b05af0444212990753fe1b)

commit c9a5cfe79721301256d3dac489da84e2c3cac35f
Author: Günther Deschner <gd at samba.org>
Date:   Fri Sep 11 19:35:14 2009 +0200

    s3-rpc_client: add rpccli_lsa_lookup_names4 wrapper.
    
    Guenther
    (cherry picked from commit ff968712bab6c2635ef74723c6f52b0fdac4b424)
    (cherry picked from commit 0d4d3c8e1e5312a820fcaede65471566e75e272c)

commit 3b5b7e4e28a238531b301c320ebbb2c0bebf65b1
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 17 08:06:34 2009 +0200

    s3-winbindd: add and use winbindd_lookup_names().
    
    Guenther
    (cherry picked from commit 99c3fc19587431efda1ae6161453d84673b32071)
    (cherry picked from commit afbe7c3605edcb8f7dfc64399681f23fa947fe57)

commit fa49b74125258f7c4df236af5eb0e11ebc0c5ace
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 17 07:59:25 2009 +0200

    s3-winbindd: add and use winbindd_lookup_sids().
    
    Guenther
    (cherry picked from commit f0b52b8c3133e3696db361d9d0e7d1fff0fab991)
    (cherry picked from commit 5c2c17ffd62010f4590502f40aee9e40997a647a)

commit 82d6e70904d6e79f2625b770f3d40a92daefd85a
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 10 22:23:21 2009 +0200

    s3-rpc_client: add dcerpc_transport_t to cli_rpc_pipe_open_schannel().
    
    Guenther
    (cherry picked from commit bea8e5fa6038d5abd2ec1e12f9005c4a04abb79f)
    (cherry picked from commit 864c0b58aec55e37cf304b28c762a5259fc0ec67)

commit 13d914182965b31bf6a099bba2681e16403cc29e
Author: Günther Deschner <gd at samba.org>
Date:   Mon Oct 5 17:41:06 2009 +0200

    s3-rpc_client: add dcerpc_transport_t to cli_rpc_pipe_open_spnego_ntlmssp and cli_rpc_pipe_open_ntlmssp.
    
    Guenther
    (cherry picked from commit 41158d10cdad5b923d0bfa608f73c0daf8ccd352)

commit 62a2cf0033eec42dc8bf4e36fec1031c614ce35b
Author: Günther Deschner <gd at samba.org>
Date:   Tue Nov 4 18:40:24 2008 +0100

    s3-rpc_client: add cli_rpc_pipe_open_noauth_transport.
    
    Guenther
    (cherry picked from commit 87f61a144b8d25c90b847940ca03ced1f77b036c)
    (cherry picked from commit c968714f7910ba90c2e989e46d18c265d9f9b549)

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

Summary of changes:
 WHATSNEW.txt                        |   20 ++-
 source/Makefile.in                  |    8 +-
 source/auth/auth_domain.c           |    2 +-
 source/include/proto.h              |   26 +++
 source/libnet/libnet_join.c         |    3 +-
 source/libsmb/passchange.c          |    1 +
 source/locking/brlock.c             |  351 +++++++++++++++++++++--------------
 source/pam_smbpass/pam_smb_auth.c   |    4 +-
 source/pam_smbpass/pam_smb_passwd.c |    8 +-
 source/pam_smbpass/support.c        |   38 +++-
 source/pam_smbpass/support.h        |    7 +
 source/profile/profile.c            |    2 +-
 source/rpc_client/cli_lsarpc.c      |  191 +++++++++++++++----
 source/rpc_client/cli_pipe.c        |   65 +++++--
 source/rpc_client/init_netlogon.c   |    2 +-
 source/rpcclient/rpcclient.c        |    3 +
 source/utils/net.h                  |    1 +
 source/utils/net_rpc.c              |   10 +-
 source/utils/net_rpc_join.c         |    5 +-
 source/utils/net_rpc_samsync.c      |    2 +-
 source/winbindd/winbindd.c          |    8 +-
 source/winbindd/winbindd.h          |    3 +
 source/winbindd/winbindd_ads.c      |   64 ++-----
 source/winbindd/winbindd_cm.c       |   84 ++++++++-
 source/winbindd/winbindd_proto.h    |   19 ++
 source/winbindd/winbindd_rpc.c      |  215 +++++++++++++++-------
 26 files changed, 787 insertions(+), 355 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 1c207dc..81a325c 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,6 +1,6 @@
                    =============================
                    Release Notes for Samba 3.3.9
-		          October, 8  2009
+		         October, 15  2009
                    =============================
 
 
@@ -8,7 +8,9 @@ This is the latest bugfix release of the Samba 3.3 series.
 
 Major enhancements in Samba 3.3.9 include:
 
-   o
+   o Fix trust relationships to windows 2008 (2008 r2) (bug #6711).
+   o Fix Windows 7 share access (which defaults to NTLMv2) (bug #6680).
+   o Fix SAMR server for Winbind access (bug #6504).
 
 
 ######################################################################
@@ -24,6 +26,7 @@ o   Michael Adam <obnox at samba.org>
 
 o   Jeremy Allison <jra at samba.org>
     * BUG 6504: Fix SAMR server for Winbind access.
+    * BUG 6776: Fix core dump when running overlapping Byte Lock test.
 
 
 o   Yannick Bergeron <burgergold at hotmail.com>
@@ -31,10 +34,15 @@ o   Yannick Bergeron <burgergold at hotmail.com>
 
 
 o   Günther Deschner <gd at samba.org>
-    * BUG 6700: Use DNS domain name when needing to guess server principal.
-    * BUG 6680: Always activate handling of large (> 256 byte) ntlmv2 blobs
-      in wbcAuthenticateUserEx().
+    * BUG 6680: Fix Windows 7 share access (which defaults to NTLMv2).
     * BUG 6697: Fix interdomain trusts with Windows 2008 R2 DCs.
+    * BUG 6700: Use DNS domain name when needing to guess server principal.
+    * BUG 6711: Fix trust relationships to windows 2008 (2008 r2).
+    * BUG 6789: Remove unrequired dependency on popt for [u]mount.cifs.
+
+
+o   Andrew Klosterman <andrew.klosterman+samba_bugzilla at gmail.com>
+    * BUG 6690: Fix error check.
 
 
 o   Volker Lendecke <vl at samba.org>
@@ -42,6 +50,7 @@ o   Volker Lendecke <vl at samba.org>
     * BUG 6349: Initialize domain info struct.
     * BUG 6585: Fix unqualified "net join".
     * BUG 6646: Correctly chew keepalive packets.
+    * BUG 6785: Only ever handle one event after a select call.
 
 
 o   Derrell Lipman <derrell.lipman at unwireduniverse.com>
@@ -52,6 +61,7 @@ o   Stefan Metzmacher <metze at samba.org>
     * BUG 6627: Raise the timeout for lsa_Lookup*() calls
       from 10 to 35 seconds.
     * BUG 6664: Make sure we don't truncate the session key to 8 bytes.
+    * BUG 6711: Fix trust relationships to windows 2008 (2008 r2).
 
 
 o   Simo Sorce <idra at samba.org>
diff --git a/source/Makefile.in b/source/Makefile.in
index 792943b..474bc1e 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -1378,13 +1378,13 @@ bin/smbspool at EXEEXT@: $(BINARY_PREREQS) $(CUPS_OBJ) @BUILD_POPT@ @LIBTALLOC_SHAR
 	@$(CC) $(FLAGS) -o $@ $(CUPS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
 		$(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
 
-bin/mount.cifs at EXEEXT@: $(BINARY_PREREQS) $(CIFS_MOUNT_OBJ) @BUILD_POPT@
+bin/mount.cifs at EXEEXT@: $(BINARY_PREREQS) $(CIFS_MOUNT_OBJ)
 	@echo Linking $@
-	@$(CC) $(FLAGS) -o $@ $(CIFS_MOUNT_OBJ) $(DYNEXP) $(LDFLAGS) $(POPT_LIBS)
+	@$(CC) $(FLAGS) -o $@ $(CIFS_MOUNT_OBJ) $(DYNEXP) $(LDFLAGS)
 
-bin/umount.cifs at EXEEXT@: $(BINARY_PREREQS) $(CIFS_UMOUNT_OBJ) @BUILD_POPT@
+bin/umount.cifs at EXEEXT@: $(BINARY_PREREQS) $(CIFS_UMOUNT_OBJ)
 	@echo Linking $@
-	@$(CC) $(FLAGS) -o $@ $(CIFS_UMOUNT_OBJ) $(DYNEXP) $(LDFLAGS) $(POPT_LIBS)
+	@$(CC) $(FLAGS) -o $@ $(CIFS_UMOUNT_OBJ) $(DYNEXP) $(LDFLAGS)
 
 bin/cifs.upcall at EXEEXT@: $(BINARY_PREREQS) $(CIFS_UPCALL_OBJ) $(LIBSMBCLIENT_OBJ1) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
 	@echo Linking $@
diff --git a/source/auth/auth_domain.c b/source/auth/auth_domain.c
index f11dbe6..45150ab 100644
--- a/source/auth/auth_domain.c
+++ b/source/auth/auth_domain.c
@@ -175,7 +175,7 @@ static NTSTATUS connect_to_domain_password_server(struct cli_state **cli,
 	if (lp_client_schannel()) {
 		/* We also setup the creds chain in the open_schannel call. */
 		result = cli_rpc_pipe_open_schannel(
-			*cli, &ndr_table_netlogon.syntax_id,
+			*cli, &ndr_table_netlogon.syntax_id, NCACN_NP,
 			PIPE_AUTH_LEVEL_PRIVACY, domain, &netlogon_pipe);
 	} else {
 		result = cli_rpc_pipe_open_noauth(
diff --git a/source/include/proto.h b/source/include/proto.h
index ec8637b..8dbab9a 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -6891,6 +6891,14 @@ NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
 				char ***pdomains,
 				char ***pnames,
 				enum lsa_SidType **ptypes);
+NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli,
+				 TALLOC_CTX *mem_ctx,
+				 struct policy_handle *pol,
+				 int num_sids,
+				 const DOM_SID *sids,
+				 char ***pdomains,
+				 char ***pnames,
+				 enum lsa_SidType **ptypes);
 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
 				 TALLOC_CTX *mem_ctx,
 				 POLICY_HND *pol, int num_names,
@@ -6899,6 +6907,15 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
 				 int level,
 				 DOM_SID **sids,
 				 enum lsa_SidType **types);
+NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli,
+				  TALLOC_CTX *mem_ctx,
+				  struct policy_handle *pol, int num_names,
+				  const char **names,
+				  const char ***dom_names,
+				  int level,
+				  DOM_SID **sids,
+				  enum lsa_SidType **types);
+
 bool fetch_domain_sid( char *domain, char *remote_machine, DOM_SID *psid);
 
 /* The following definitions come from rpc_client/cli_netlogon.c  */
@@ -6988,8 +7005,13 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
 NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
 				  const struct ndr_syntax_id *interface,
 				  struct rpc_pipe_client **presult);
+NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
+					    enum dcerpc_transport_t transport,
+					    const struct ndr_syntax_id *interface,
+					    struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
 				   const struct ndr_syntax_id *interface,
+				   enum dcerpc_transport_t transport,
 				   enum pipe_auth_level auth_level,
 				   const char *domain,
 				   const char *username,
@@ -6997,6 +7019,7 @@ NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
 				   struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
 					  const struct ndr_syntax_id *interface,
+					  enum dcerpc_transport_t transport,
 					  enum pipe_auth_level auth_level,
 					  const char *domain,
 					  const char *username,
@@ -7008,12 +7031,14 @@ NTSTATUS get_schannel_session_key(struct cli_state *cli,
 				  struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli,
 					     const struct ndr_syntax_id *interface,
+					     enum dcerpc_transport_t transport,
 					     enum pipe_auth_level auth_level,
 					     const char *domain,
 					     const struct dcinfo *pdc,
 					     struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
 						 const struct ndr_syntax_id *interface,
+						 enum dcerpc_transport_t transport,
 						 enum pipe_auth_level auth_level,
 						 const char *domain,
 						 const char *username,
@@ -7021,6 +7046,7 @@ NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
 						 struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
 				    const struct ndr_syntax_id *interface,
+				    enum dcerpc_transport_t transport,
 				    enum pipe_auth_level auth_level,
 				    const char *domain,
 				    struct rpc_pipe_client **presult);
diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c
index 9029d61..915c66b 100644
--- a/source/libnet/libnet_join.c
+++ b/source/libnet/libnet_join.c
@@ -1070,7 +1070,8 @@ NTSTATUS libnet_join_ok(const char *netbios_domain_name,
 	}
 
 	status = cli_rpc_pipe_open_schannel_with_key(
-		cli, &ndr_table_netlogon.syntax_id, PIPE_AUTH_LEVEL_PRIVACY,
+		cli, &ndr_table_netlogon.syntax_id, NCACN_NP,
+		PIPE_AUTH_LEVEL_PRIVACY,
 		netbios_domain_name, netlogon_pipe->dc, &pipe_hnd);
 
 	cli_shutdown(cli);
diff --git a/source/libsmb/passchange.c b/source/libsmb/passchange.c
index 299d98d..e202d19 100644
--- a/source/libsmb/passchange.c
+++ b/source/libsmb/passchange.c
@@ -152,6 +152,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
 	if (!pass_must_change) {
 		result = cli_rpc_pipe_open_ntlmssp(cli,
 						   &ndr_table_samr.syntax_id,
+						   NCACN_NP,
 						   PIPE_AUTH_LEVEL_PRIVACY,
 						   "", /* what domain... ? */
 						   user_name,
diff --git a/source/locking/brlock.c b/source/locking/brlock.c
index cd9a203..e436aa6 100644
--- a/source/locking/brlock.c
+++ b/source/locking/brlock.c
@@ -371,10 +371,9 @@ static NTSTATUS brl_lock_windows(struct byte_range_lock *br_lck,
  Cope with POSIX range splits and merges.
 ****************************************************************************/
 
-static unsigned int brlock_posix_split_merge(struct lock_struct *lck_arr,		/* Output array. */
-						const struct lock_struct *ex,		/* existing lock. */
-						const struct lock_struct *plock,	/* proposed lock. */
-						bool *lock_was_added)
+static unsigned int brlock_posix_split_merge(struct lock_struct *lck_arr,	/* Output array. */
+						struct lock_struct *ex,		/* existing lock. */
+						struct lock_struct *plock)	/* proposed lock. */
 {
 	bool lock_types_differ = (ex->lock_type != plock->lock_type);
 
@@ -391,21 +390,23 @@ static unsigned int brlock_posix_split_merge(struct lock_struct *lck_arr,		/* Ou
 	/* Did we overlap ? */
 
 /*********************************************
-                                             +---------+
-                                             | ex      |
-                                             +---------+
-                              +-------+
-                              | plock |
-                              +-------+
+                                        +---------+
+                                        | ex      |
+                                        +---------+
+                         +-------+
+                         | plock |
+                         +-------+
 OR....
-             +---------+
-             |  ex     |
-             +---------+
+        +---------+
+        |  ex     |
+        +---------+
 **********************************************/
 
 	if ( (ex->start > (plock->start + plock->size)) ||
-			(plock->start > (ex->start + ex->size))) {
+		(plock->start > (ex->start + ex->size))) {
+
 		/* No overlap with this lock - copy existing. */
+
 		memcpy(&lck_arr[0], ex, sizeof(struct lock_struct));
 		return 1;
 	}
@@ -417,26 +418,109 @@ OR....
         +---------------------------+
         |       plock               | -> replace with plock.
         +---------------------------+
+OR
+             +---------------+
+             |       ex      |
+             +---------------+
+        +---------------------------+
+        |       plock               | -> replace with plock.
+        +---------------------------+
+
 **********************************************/
 
 	if ( (ex->start >= plock->start) &&
-			(ex->start + ex->size <= plock->start + plock->size) ) {
-		memcpy(&lck_arr[0], plock, sizeof(struct lock_struct));
-		*lock_was_added = True;
-		return 1;
+		(ex->start + ex->size <= plock->start + plock->size) ) {
+
+		/* Replace - discard existing lock. */
+
+		return 0;
 	}
 
 /*********************************************
+Adjacent after.
+                        +-------+
+                        |  ex   |
+                        +-------+
+        +---------------+
+        |   plock       |
+        +---------------+
+
+BECOMES....
+        +---------------+-------+
+        |   plock       | ex    | - different lock types.
+        +---------------+-------+
+OR.... (merge)
+        +-----------------------+
+        |   plock               | - same lock type.
+        +-----------------------+
+**********************************************/
+
+	if (plock->start + plock->size == ex->start) {
+
+		/* If the lock types are the same, we merge, if different, we
+		   add the remainder of the old lock. */
+
+		if (lock_types_differ) {
+			/* Add existing. */
+			memcpy(&lck_arr[0], ex, sizeof(struct lock_struct));
+			return 1;
+		} else {
+			/* Merge - adjust incoming lock as we may have more
+			 * merging to come. */
+			plock->size += ex->size;
+			return 0;
+		}
+	}
+
+/*********************************************
+Adjacent before.
+        +-------+
+        |  ex   |
+        +-------+
+                +---------------+
+                |   plock       |
+                +---------------+
+BECOMES....
+        +-------+---------------+
+        | ex    |   plock       | - different lock types
+        +-------+---------------+
+
+OR.... (merge)
+        +-----------------------+
+        |      plock            | - same lock type.
+        +-----------------------+
+
+**********************************************/
+
+	if (ex->start + ex->size == plock->start) {
+
+		/* If the lock types are the same, we merge, if different, we
+		   add the existing lock. */
+
+		if (lock_types_differ) {
+			memcpy(&lck_arr[0], ex, sizeof(struct lock_struct));
+			return 1;
+		} else {
+			/* Merge - adjust incoming lock as we may have more
+			 * merging to come. */
+			plock->start = ex->start;
+			plock->size += ex->size;
+			return 0;
+		}
+	}
+
+/*********************************************
+Overlap after.
         +-----------------------+
         |          ex           |
         +-----------------------+
         +---------------+
         |   plock       |
         +---------------+
-OR....
-                        +-------+
-                        |  ex   |
-                        +-------+
+OR
+               +----------------+
+               |       ex       |
+               +----------------+
         +---------------+
         |   plock       |
         +---------------+
@@ -447,60 +531,57 @@ BECOMES....
         +---------------+-------+
 OR.... (merge)
         +-----------------------+
-        |   ex                  | - same lock type.
+        |   plock               | - same lock type.
         +-----------------------+
 **********************************************/
 
 	if ( (ex->start >= plock->start) &&
-				(ex->start <= plock->start + plock->size) &&
-				(ex->start + ex->size > plock->start + plock->size) ) {
-
-		*lock_was_added = True;
+		(ex->start <= plock->start + plock->size) &&
+		(ex->start + ex->size > plock->start + plock->size) ) {
 
 		/* If the lock types are the same, we merge, if different, we
-		   add the new lock before the old. */
+		   add the remainder of the old lock. */
 
 		if (lock_types_differ) {
-			/* Add new. */
-			memcpy(&lck_arr[0], plock, sizeof(struct lock_struct));
-			memcpy(&lck_arr[1], ex, sizeof(struct lock_struct));
+			/* Add remaining existing. */
+			memcpy(&lck_arr[0], ex, sizeof(struct lock_struct));
 			/* Adjust existing start and size. */
-			lck_arr[1].start = plock->start + plock->size;
-			lck_arr[1].size = (ex->start + ex->size) - (plock->start + plock->size);
-			return 2;
-		} else {
-			/* Merge. */
-			memcpy(&lck_arr[0], plock, sizeof(struct lock_struct));
-			/* Set new start and size. */
-			lck_arr[0].start = plock->start;
-			lck_arr[0].size = (ex->start + ex->size) - plock->start;
+			lck_arr[0].start = plock->start + plock->size;
+			lck_arr[0].size = (ex->start + ex->size) - (plock->start + plock->size);
 			return 1;
+		} else {
+			/* Merge - adjust incoming lock as we may have more
+			 * merging to come. */
+			plock->size += (ex->start + ex->size) - (plock->start + plock->size);
+			return 0;
 		}
 	}
 
 /*********************************************
-   +-----------------------+
-   |  ex                   |
-   +-----------------------+
-           +---------------+
-           |   plock       |
-           +---------------+
-OR....
-   +-------+        
-   |  ex   |
-   +-------+
-           +---------------+
-           |   plock       |
-           +---------------+
+Overlap before.
+        +-----------------------+
+        |  ex                   |
+        +-----------------------+
+                +---------------+
+                |   plock       |
+                +---------------+
+OR
+        +-------------+
+        |  ex         |
+        +-------------+
+                +---------------+
+                |   plock       |
+                +---------------+
+
 BECOMES....
-   +-------+---------------+
-   | ex    |   plock       | - different lock types
-   +-------+---------------+
+        +-------+---------------+
+        | ex    |   plock       | - different lock types
+        +-------+---------------+
 
 OR.... (merge)
-   +-----------------------+
-   | ex                    | - same lock type.
-   +-----------------------+
+        +-----------------------+
+        |      plock            | - same lock type.
+        +-----------------------+
 
 **********************************************/
 
@@ -508,27 +589,25 @@ OR.... (merge)
 			(ex->start + ex->size >= plock->start) &&
 			(ex->start + ex->size <= plock->start + plock->size) ) {
 
-		*lock_was_added = True;
-
 		/* If the lock types are the same, we merge, if different, we
-		   add the new lock after the old. */
+		   add the truncated old lock. */
 
 		if (lock_types_differ) {
 			memcpy(&lck_arr[0], ex, sizeof(struct lock_struct));
-			memcpy(&lck_arr[1], plock, sizeof(struct lock_struct));
 			/* Adjust existing size. */
 			lck_arr[0].size = plock->start - ex->start;
-			return 2;
-		} else {
-			/* Merge. */
-			memcpy(&lck_arr[0], ex, sizeof(struct lock_struct));
-			/* Adjust existing size. */
-			lck_arr[0].size = (plock->start + plock->size) - ex->start;
 			return 1;
+		} else {
+			/* Merge - adjust incoming lock as we may have more
+			 * merging to come. MUST ADJUST plock SIZE FIRST ! */
+			plock->size += (plock->start - ex->start);
+			plock->start = ex->start;
+			return 0;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list