[SCM] Samba Shared Repository - branch v3-4-test updated

Karolin Seeger kseeger at samba.org
Thu Oct 8 01:40:02 MDT 2009


The branch, v3-4-test has been updated
       via  722ba56... s3:winbindd: only notify the client when we exist, if the connection isn't dead already
       via  53a4269... s3:winbindd_cm: don't invalidate the whole connection when just samr gave ACCCESS_DENIED
       via  10ff61b... s3:rpc_client: don't randomly fragment rpc pdu's in developer mode
       via  8d8bcfb... s3:lib/select: don't overwrite errno in the signal handler
       via  017586b... tevent: make sure we don't set errno within the signal handler function.
       via  dd5519d... s3:rpc_server: we need to make a copy of my_name in serverinfo_to_SamInfo_base()
       via  d6af2a5... s3:winbind: Fix an uninitialized variable (cherry picked from commit 0724649a8a7c04d015317d9dc2ae43ee87c1bd25)
       via  3bd3663... s3-winbindd: Fix Bug #6711: trusts to windows 2008 (2008 r2) not working.
       via  b35d5cf... s3-winbindd: add cm_connect_lsa_tcp().
       via  27219ad... s3-rpc_client: fix non initialized structure in rpccli_lsa_lookup_sids_noalloc.
       via  e867d3d... s3-rpc_client: add rpccli_lsa_lookup_sids3 wrapper.
       via  99627d8... s3-rpc_client: add rpccli_lsa_lookup_names4 wrapper.
       via  6bcf24a... s3-winbindd: add and use winbindd_lookup_names().
       via  faa6a8d... s3-winbindd: add and use winbindd_lookup_sids().
       via  5b44f54... s3-rpc_client: add dcerpc_transport_t to cli_rpc_pipe_open_schannel().
       via  cd88742... s3-rpc_client: add dcerpc_transport_t to cli_rpc_pipe_open_spnego_ntlmssp and cli_rpc_pipe_open_ntlmssp.
       via  18b8928... s3-rpc_client: add cli_rpc_pipe_open_noauth_transport.
       via  ef11ccb... s3-rpc_client: add enum dcerpc_transport_t to rpc_cli_transport struct.
      from  f3f9dfd... Second part of a fix for bug #6235.

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


- Log -----------------------------------------------------------------
commit 722ba568d79451a527976181b360de82b87b68e8
Author: Stefan Metzmacher <metze at sernet.de>
Date:   Fri Sep 25 06:20:33 2009 +0200

    s3:winbindd: only notify the client when we exist, if the connection isn't dead already
    
    This is similar to commit 83edf3e43e86781872a07d8eb53084f59ad7384c.
    
    metze

commit 53a426986a0ead7903ff6cf576b3d5501210e379
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 bfd3a6f13aa935950142a24bf331feb98f987bde)

commit 10ff61b24f0604c9686e728ac92c1a2987a31aed
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sun Sep 20 23:29:11 2009 +0200

    s3:rpc_client: don't randomly fragment rpc pdu's in developer mode
    
    This is really confusing and also breaks against windows,
    as it doesn't accept fragmented bind requests.
    
    metze
    (cherry picked from commit 68b8149d1fb26b2fe1138c99d971754b0a30378b)

commit 8d8bcfbfbe95f1623870b54cfc9329187a06d526
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sun Sep 20 23:29:34 2009 +0200

    s3:lib/select: don't overwrite errno in the signal handler
    
    metze
    (cherry picked from commit 00e378f17c39c52689601bc622b9cd78a0cdce12)

commit 017586bb84a073f03a04ade6fb0bbe26af4112c1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Sep 21 03:16:18 2009 +0200

    tevent: make sure we don't set errno within the signal handler function.
    
    metze
    (cherry picked from commit d13dfbeb6c6ab5b20277439da5b95f1a7f2850eb)

commit dd5519d926ecdccc38f488d9a6d5138bfd871aa0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Sep 24 06:38:08 2009 +0200

    s3:rpc_server: we need to make a copy of my_name in serverinfo_to_SamInfo_base()
    
    This is important for the case the server_info already contains a logon_server.
    
    metze
    (This is similar to commit 9ef39406d8072a1a102813fb4448af76e9020fcd)

commit d6af2a5ff4e4f723e521a3f708751b3155f870fc
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)

commit 3bd36630e402b6215a46f8b0ba98e9e2b18b44eb
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)

commit b35d5cf97fd610874583f0d03c6cda4def0cf0f5
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)

commit 27219ada4ec86544ceb8488850293b07f1ea7a10
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)

commit e867d3d9bb6494cde621f8f951f7aece5798f5fe
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)

commit 99627d8e38a28759095b6704e8314c931ca638a0
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)

commit 6bcf24a2affb4798840e5cc49aeeb6c78d0265d0
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)

commit faa6a8de595ea38d3291dc7fb80d314a3b3f05cc
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)

commit 5b44f54a18b60fe3814623f351025335a0273916
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)

commit cd8874214dba810e60faca155611dbcf2f1351f7
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_spnego_ntlmssp and cli_rpc_pipe_open_ntlmssp.
    
    Guenther
    (cherry picked from commit 032e01e7c13724d057b5744d7d79613449c2f24f)

commit 18b8928c8cb12d2f56efcc61df5b74db3caec29c
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)

commit ef11ccb47db899603a100e67c3ca9ecd3298e347
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 10 19:59:37 2009 +0200

    s3-rpc_client: add enum dcerpc_transport_t to rpc_cli_transport struct.
    
    Guenther
    (cherry picked from commit 393a1f594d5f03a51448cdc465f92c599a93904c)

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

Summary of changes:
 lib/tevent/tevent_signal.c         |    3 +
 source3/auth/auth_domain.c         |    2 +-
 source3/include/client.h           |    2 +
 source3/include/proto.h            |   26 +++++
 source3/lib/select.c               |    4 +
 source3/libnet/libnet_join.c       |    3 +-
 source3/libsmb/passchange.c        |    1 +
 source3/rpc_client/cli_lsarpc.c    |  191 +++++++++++++++++++++++++-------
 source3/rpc_client/cli_pipe.c      |   67 ++++++++---
 source3/rpc_client/init_netlogon.c |    2 +-
 source3/rpcclient/rpcclient.c      |    3 +
 source3/utils/net.h                |    1 +
 source3/utils/net_rpc.c            |    4 +-
 source3/utils/net_rpc_join.c       |    5 +-
 source3/utils/net_rpc_samsync.c    |    2 +-
 source3/winbindd/winbindd.c        |   12 +-
 source3/winbindd/winbindd.h        |    3 +
 source3/winbindd/winbindd_ads.c    |   64 +++---------
 source3/winbindd/winbindd_cm.c     |   84 +++++++++++++-
 source3/winbindd/winbindd_proto.h  |   19 +++
 source3/winbindd/winbindd_rpc.c    |  215 +++++++++++++++++++++++++-----------
 21 files changed, 521 insertions(+), 192 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index ef9c0cf..0ca2a27 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -85,6 +85,7 @@ static void tevent_common_signal_handler(int signum)
 	ssize_t res;
 	struct tevent_common_signal_list *sl;
 	struct tevent_context *ev = NULL;
+	int saved_errno = errno;
 
 	SIG_INCREMENT(sig_state->signal_count[signum]);
 	SIG_INCREMENT(sig_state->got_signal);
@@ -103,6 +104,8 @@ static void tevent_common_signal_handler(int signum)
 			ev = sl->se->event_ctx;
 		}
 	}
+
+	errno = saved_errno;
 }
 
 #ifdef SA_SIGINFO
diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c
index f11dbe6..45150ab 100644
--- a/source3/auth/auth_domain.c
+++ b/source3/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/source3/include/client.h b/source3/include/client.h
index 320a90e..1914210 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -68,6 +68,8 @@ struct cli_pipe_auth_data {
 
 struct rpc_cli_transport {
 
+	enum dcerpc_transport_t transport;
+
 	/**
 	 * Trigger an async read from the server. May return a short read.
 	 */
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 802c2ed..e489224 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5177,6 +5177,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,
 				 struct policy_handle *pol, int num_names,
@@ -5185,6 +5193,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  */
@@ -5289,8 +5306,13 @@ NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id
 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,
@@ -5298,6 +5320,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,
@@ -5309,12 +5332,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,
@@ -5322,6 +5347,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/source3/lib/select.c b/source3/lib/select.c
index a58530a..b5443ff 100644
--- a/source3/lib/select.c
+++ b/source3/lib/select.c
@@ -39,11 +39,15 @@ static volatile unsigned pipe_written, pipe_read;
 
 void sys_select_signal(char c)
 {
+	int saved_errno = errno;
+
 	if (!initialised) return;
 
 	if (pipe_written > pipe_read+256) return;
 
 	if (write(select_pipe[1], &c, 1) == 1) pipe_written++;
+
+	errno = saved_errno;
 }
 
 /*******************************************************************
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 5309452..03832cf 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/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/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index f3cb9d6..d73b34c 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -176,6 +176,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,
 						   domain, user,
 						   old_passwd,
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index 68fd96f..d49fa47 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -114,7 +114,8 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli,
 					       const DOM_SID *sids,
 					       char **domains,
 					       char **names,
-					       enum lsa_SidType *types)
+					       enum lsa_SidType *types,
+					       bool use_lookupsids3)
 {
 	NTSTATUS result = NT_STATUS_OK;
 	TALLOC_CTX *tmp_ctx = NULL;
@@ -147,13 +148,43 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli,
 		}
 	}
 
-	result = rpccli_lsa_LookupSids(cli, mem_ctx,
-				       pol,
-				       &sid_array,
-				       &ref_domains,
-				       &lsa_names,
-				       level,
-				       &count);
+	if (use_lookupsids3) {
+		struct lsa_TransNameArray2 lsa_names2;
+		uint32_t n;
+
+		ZERO_STRUCT(lsa_names2);
+
+		result = rpccli_lsa_LookupSids3(cli, mem_ctx,
+						&sid_array,
+						&ref_domains,
+						&lsa_names2,
+						level,
+						&count,
+						0,
+						0);
+
+		if (!NT_STATUS_IS_ERR(result)) {
+			lsa_names.count	= lsa_names2.count;
+			lsa_names.names = talloc_array(mem_ctx, struct lsa_TranslatedName, lsa_names.count);
+			if (!lsa_names.names) {
+				return NT_STATUS_NO_MEMORY;
+			}
+			for (n=0; n < lsa_names.count; n++) {
+				lsa_names.names[n].sid_type	= lsa_names2.names[n].sid_type;
+				lsa_names.names[n].name		= lsa_names2.names[n].name;
+				lsa_names.names[n].sid_index	= lsa_names2.names[n].sid_index;
+			}
+		}
+
+	} else {
+		result = rpccli_lsa_LookupSids(cli, mem_ctx,
+					       pol,
+					       &sid_array,
+					       &ref_domains,
+					       &lsa_names,
+					       level,
+					       &count);
+	}
 
 	DEBUG(10, ("LSA_LOOKUPSIDS returned '%s', mapped count = %d'\n",
 		   nt_errstr(result), count));
@@ -233,14 +264,15 @@ done:
  * at 20480 for win2k3, but we keep it at a save 1000 for now. */
 #define LOOKUP_SIDS_HUNK_SIZE 1000
 
-NTSTATUS rpccli_lsa_lookup_sids(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)
+static NTSTATUS rpccli_lsa_lookup_sids_generic(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,
+					       bool use_lookupsids3)
 {
 	NTSTATUS result = NT_STATUS_OK;
 	int sids_left = 0;
@@ -299,7 +331,8 @@ NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
 							     hunk_sids,
 							     hunk_domains,
 							     hunk_names,
-							     hunk_types);
+							     hunk_types,
+							     use_lookupsids3);
 
 		if (!NT_STATUS_IS_OK(hunk_result) &&
 		    !NT_STATUS_EQUAL(hunk_result, STATUS_SOME_UNMAPPED) &&
@@ -340,25 +373,54 @@ fail:
 	return result;
 }
 
-/** Lookup a list of names */
+NTSTATUS rpccli_lsa_lookup_sids(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)
+{
+	return rpccli_lsa_lookup_sids_generic(cli, mem_ctx, pol, num_sids, sids,
+					      pdomains, pnames, ptypes, false);
+}
 
-NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
+NTSTATUS rpccli_lsa_lookup_sids3(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)
+				 struct policy_handle *pol,
+				 int num_sids,
+				 const DOM_SID *sids,
+				 char ***pdomains,
+				 char ***pnames,
+				 enum lsa_SidType **ptypes)
+{
+	return rpccli_lsa_lookup_sids_generic(cli, mem_ctx, pol, num_sids, sids,
+					      pdomains, pnames, ptypes, true);
+}
+
+/** Lookup a list of names */
+
+static NTSTATUS rpccli_lsa_lookup_names_generic(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 use_lookupnames4)
 {
 	NTSTATUS result;
 	int i;
 	struct lsa_String *lsa_names = NULL;
 	struct lsa_RefDomainList *domains = NULL;
 	struct lsa_TransSidArray sid_array;
+	struct lsa_TransSidArray3 sid_array3;
 	uint32_t count = 0;
 
 	ZERO_STRUCT(sid_array);
+	ZERO_STRUCT(sid_array3);
 
 	lsa_names = TALLOC_ARRAY(mem_ctx, struct lsa_String, num_names);
 	if (!lsa_names) {
@@ -369,14 +431,26 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
 		init_lsa_String(&lsa_names[i], names[i]);
 	}
 
-	result = rpccli_lsa_LookupNames(cli, mem_ctx,
-				        pol,
-					num_names,
-					lsa_names,
-					&domains,
-					&sid_array,
-					level,
-					&count);
+	if (use_lookupnames4) {
+		result = rpccli_lsa_LookupNames4(cli, mem_ctx,
+						 num_names,
+						 lsa_names,
+						 &domains,
+						 &sid_array3,
+						 level,
+						 &count,
+						 0,
+						 0);
+	} else {
+		result = rpccli_lsa_LookupNames(cli, mem_ctx,
+					        pol,
+						num_names,
+						lsa_names,
+						&domains,
+						&sid_array,
+						level,
+						&count);
+	}
 
 	if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) !=
 	    NT_STATUS_V(STATUS_SOME_UNMAPPED)) {
@@ -423,10 +497,17 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
 	}
 
 	for (i = 0; i < num_names; i++) {
-		uint32_t dom_idx = sid_array.sids[i].sid_index;
-		uint32_t dom_rid = sid_array.sids[i].rid;
+		uint32_t dom_idx;
 		DOM_SID *sid = &(*sids)[i];
 
+		if (use_lookupnames4) {
+			dom_idx		= sid_array3.sids[i].sid_index;
+			(*types)[i]	= sid_array3.sids[i].sid_type;
+		} else {
+			dom_idx		= sid_array.sids[i].sid_index;
+			(*types)[i]	= sid_array.sids[i].sid_type;
+		}
+
 		/* Translate optimised sid through domain index array */
 
 		if (dom_idx == 0xffffffff) {
@@ -436,14 +517,16 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
 			continue;
 		}
 
-		sid_copy(sid, domains->domains[dom_idx].sid);
+		if (use_lookupnames4) {
+			sid_copy(sid, sid_array3.sids[i].sid);
+		} else {
+			sid_copy(sid, domains->domains[dom_idx].sid);
 
-		if (dom_rid != 0xffffffff) {
-			sid_append_rid(sid, dom_rid);
+			if (sid_array.sids[i].rid != 0xffffffff) {
+				sid_append_rid(sid, sid_array.sids[i].rid);
+			}
 		}
 
-		(*types)[i] = sid_array.sids[i].sid_type;
-
 		if (dom_names == NULL) {
 			continue;
 		}
@@ -455,3 +538,31 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
 
 	return result;
 }
+
+NTSTATUS rpccli_lsa_lookup_names(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)
+{
+	return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names,
+					       names, dom_names, level, sids,
+					       types, false);
+}
+
+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)
+{
+	return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names,
+					       names, dom_names, level, sids,
+					       types, true);
+}
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 9aba938..0d1d5e8 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -1280,7 +1280,7 @@ static struct async_req *rpc_api_pipe_send(TALLOC_CTX *mem_ctx,
 
 	max_recv_frag = cli->max_recv_frag;
 
-#ifdef DEVELOPER
+#if 0
 	max_recv_frag = RPC_HEADER_LEN + 10 + (sys_random() % 32);
 #endif
 
@@ -1966,7 +1966,7 @@ static uint32 calculate_data_len_tosend(struct rpc_pipe_client *cli,
 {
 	uint32 data_space, data_len;
 
-#ifdef DEVELOPER
+#if 0
 	if ((data_left > 0) && (sys_random() % 2)) {
 		data_left = MAX(data_left/2, 1);
 	}
@@ -3233,6 +3233,8 @@ static NTSTATUS rpc_pipe_open_tcp_port(TALLOC_CTX *mem_ctx, const char *host,
 		goto fail;
 	}
 
+	result->transport->transport = NCACN_IP_TCP;
+
 	*presult = result;
 	return NT_STATUS_OK;
 
@@ -3451,6 +3453,8 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
 		goto fail;
 	}
 
+	result->transport->transport = NCALRPC;
+
 	*presult = result;
 	return NT_STATUS_OK;
 
@@ -3523,6 +3527,8 @@ static NTSTATUS rpc_pipe_open_np(struct cli_state *cli,
 		return status;
 	}
 
+	result->transport->transport = NCACN_NP;
+
 	DLIST_ADD(cli->pipe_list, result);
 	talloc_set_destructor(result, rpc_pipe_client_np_destructor);
 
@@ -3581,6 +3587,8 @@ NTSTATUS rpc_pipe_open_local(TALLOC_CTX *mem_ctx,
 		return status;
 	}
 
+	result->transport->transport = NCACN_INTERNAL;
+
 	*presult = result;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list