[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Sat Nov 18 03:08:03 UTC 2017


The branch, master has been updated
       via  050ca45 winbind: Remove winbind_messaging_context
       via  d8a01d0 winbind: winbind_messaging_context -> server_messaging_context
       via  e1f12ac winbind: Remove winbind_event_context
       via  7e83d14 winbind: Replace winbind_event_context with server_event_context
       via  d27f38d libnet_join: fix "net rpc oldjoin"
       via  9466796 s3:selftest: add samba3.blackbox.net_rpc_oldjoin test
       via  d74c608 nsswitch: Slightly simplify winbindd_request_response
       via  ffbf393 ntlm_auth: Use libwbclient in get_winbind_netbios_name()
       via  403003b ntlm_auth: Use libwbclient in get_require_membership_sid()
       via  25e85a4 ntlm_auth: Use libwbclient in get_winbind_domain()
       via  5781cef ntlm_auth: Use libwbclient in winbind_separator()
       via  87c4432 libwbclient: Fix two signed/unsigned hickups
       via  e83f389 lib: Save a few bytes of .text
       via  73533b9 lib: Fix a false/NULL hickup
       via  98dd651 lib: Simplify is_ipaddress_v6
       via  2a86876 lib: Avoid a pointless static variable
       via  03be840 winbindd: Fix some signed/unsigned warnings
       via  df5a534 nsswitch: Fix a typo
       via  c19b49b tevent: Fix typos
       via  625d27d libsmb: Fix a typo
      from  993fa57 lib: tevent: Minor cleanup. wakeup_fd can always be gotten from the event context.

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


- Log -----------------------------------------------------------------
commit 050ca45dc7fc5bbab6e1c60b919ac0b1e9661e27
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 17 11:47:37 2017 +0100

    winbind: Remove winbind_messaging_context
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13150
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sat Nov 18 04:07:24 CET 2017 on sn-devel-144

commit d8a01d09c13728f36107f6eb94ecb7653706a4db
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 17 11:42:34 2017 +0100

    winbind: winbind_messaging_context -> server_messaging_context
    
    Don't use winbind_messaging_context anymore.
    
    This fixes a bug analysed by Peter Somogyi <PSOMOGYI at hu.ibm.com>: If a
    parent winbind forks, it only called reinit_after_fork on
    winbind_messaging_context. On the other hand, deep in dbwrap_open we use
    server_messaging_context(). This is not reinitialized by
    winbind_reinit_after fork, so the parent and child share a ctdb
    connection. This is invalid, because replies from ctdb end up in the
    wrong process.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13150
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e1f12acc13a3cc004518ac3460c6000ea0b95115
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 17 11:37:30 2017 +0100

    winbind: Remove winbind_event_context
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13150
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7e83d1489406cd53d72097e40bf02295c88ea61e
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 17 11:35:19 2017 +0100

    winbind: Replace winbind_event_context with server_event_context
    
    There's no point in having two global event contexts
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13150
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d27f38d35bf111a5c0a898a5ef8b7dd0b320da0d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Nov 16 21:09:20 2017 +0000

    libnet_join: fix "net rpc oldjoin"
    
    We need to open the ncacn_np (smb) transport connection with
    anonymous credentials.
    
    In order to do netr_ServerPasswordSet*() we need to
    establish a 2nd netlogon connection using dcerpc schannel
    authentication.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13149
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9466796c87cc4ca8d32da553421cd8ecef1bb8e4
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Nov 17 15:51:36 2017 +0100

    s3:selftest: add samba3.blackbox.net_rpc_oldjoin test
    
    This demonstrates that "net rpc oldjoin" is currently broken.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13149
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d74c60807cdaec2835c400a6de0fa5e381cc1392
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jul 15 11:54:14 2017 +0200

    nsswitch: Slightly simplify winbindd_request_response
    
    We don't need a separate variable, C passes a copy on the stack
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ffbf393fba69d715d150fbc4f147bf0a97fbb69a
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jul 15 10:56:47 2017 +0200

    ntlm_auth: Use libwbclient in get_winbind_netbios_name()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 403003b528a2445ac128db5750b87de3967372bd
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jul 15 11:06:38 2017 +0200

    ntlm_auth: Use libwbclient in get_require_membership_sid()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 25e85a4507d959a922ffc9f2eea144fbe02c37d2
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jul 15 10:55:09 2017 +0200

    ntlm_auth: Use libwbclient in get_winbind_domain()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5781cefc427b3f9f89b4470c1504ab941fa5334e
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jul 15 10:52:17 2017 +0200

    ntlm_auth: Use libwbclient in winbind_separator()
    
    Avoid direct winbindd_request_response()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 87c443256223a91192b8ea3db94fbd40557be881
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 13 15:52:15 2017 +0200

    libwbclient: Fix two signed/unsigned hickups
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e83f3891b2f6a105d30120c2f6917fa7cc8ae969
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 15 13:12:05 2017 +0100

    lib: Save a few bytes of .text
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 73533b90cc60d684c60ffb5c18e9d940e2ce3c32
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 13 16:21:31 2017 +0100

    lib: Fix a false/NULL hickup
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 98dd651f8dd728aaeb09aa53c4c38d132b02fa50
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 13 16:54:09 2017 +0100

    lib: Simplify is_ipaddress_v6
    
    Do an early return, avoid an "else", avoid an indentation level
    
    Review with git show -b
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2a86876c223aca33865fcb11ba59af1faf91f86c
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 13 16:15:42 2017 +0100

    lib: Avoid a pointless static variable
    
    Saves a few bytes of .text
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 03be840a7a59d8e443f0d6c3a3f071fc6fcf340b
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 6 18:04:12 2017 +0200

    winbindd: Fix some signed/unsigned warnings
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit df5a5341987eee1ef4666ab01d7e714159388a75
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jul 17 15:40:11 2017 +0200

    nsswitch: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c19b49bad8071bc33089e5b3c053fcb890a8ea11
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Oct 30 13:51:25 2017 +0100

    tevent: Fix typos
    
    While there, fix comment formatting
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 625d27d3fc5b5dbddb43d21aa467431f2043d89d
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 7 13:04:21 2017 +0100

    libsmb: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 lib/tevent/tevent.h                                |   4 +-
 lib/util/util_net.c                                | 114 ++++++++++-----------
 nsswitch/libwbclient/wbc_pam.c                     |   4 +-
 nsswitch/wb_common.c                               |  14 ++-
 nsswitch/winbind_struct_protocol.h                 |   2 +-
 source3/libnet/libnet_join.c                       |  53 ++++++++--
 source3/libsmb/namequery.c                         |   2 +-
 source3/script/tests/test_net_rpc_oldjoin.sh       |  32 ++++++
 source3/selftest/tests.py                          |   4 +
 source3/torture/torture.c                          |   9 --
 source3/utils/ntlm_auth.c                          |  64 ++++++------
 source3/winbindd/idmap_ldap.c                      |   2 +-
 source3/winbindd/idmap_rfc2307.c                   |   2 +-
 source3/winbindd/winbindd.c                        | 110 +++++++-------------
 source3/winbindd/winbindd_cache.c                  |   6 +-
 source3/winbindd/winbindd_cm.c                     |  36 +++----
 source3/winbindd/winbindd_cred_cache.c             |  14 +--
 source3/winbindd/winbindd_dual.c                   |  50 ++++-----
 source3/winbindd/winbindd_dual_srv.c               |   6 +-
 source3/winbindd/winbindd_irpc.c                   |  10 +-
 source3/winbindd/winbindd_misc.c                   |   2 +-
 source3/winbindd/winbindd_pam_auth.c               |   2 +-
 source3/winbindd/winbindd_pam_auth_crap.c          |   2 +-
 source3/winbindd/winbindd_pam_chauthtok.c          |   2 +-
 .../winbindd/winbindd_pam_chng_pswd_auth_crap.c    |   2 +-
 source3/winbindd/winbindd_pam_logoff.c             |   2 +-
 source3/winbindd/winbindd_proto.h                  |   2 -
 source3/winbindd/winbindd_util.c                   |   2 +-
 28 files changed, 288 insertions(+), 266 deletions(-)
 create mode 100755 source3/script/tests/test_net_rpc_oldjoin.sh


Changeset truncated at 500 lines:

diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index 728cf62..7284a85 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -936,8 +936,8 @@ void tevent_req_set_cancel_fn(struct tevent_req *req, tevent_req_cancel_fn fn);
  *
  * @param[in]  req      The request to use.
  *
- * @return              This function returns true is the request is cancelable,
- *                      othererwise false is returned.
+ * @return              This function returns true if the request is
+ *                      cancelable, otherwise false is returned.
  *
  * @note Even if the function returns true, the caller need to wait
  *       for the function to complete normally.
diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index cbc836c..f0a3016 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -36,15 +36,14 @@
 
 void zero_sockaddr(struct sockaddr_storage *pss)
 {
-	ZERO_STRUCTP(pss);
 	/* Ensure we're at least a valid sockaddr-storage. */
-	pss->ss_family = AF_INET;
+	*pss = (struct sockaddr_storage) { .ss_family = AF_INET };
 }
 
 static char *normalize_ipv6_literal(const char *str, char *buf, size_t *_len)
 {
 #define IPv6_LITERAL_NET ".ipv6-literal.net"
-	static const size_t llen = sizeof(IPv6_LITERAL_NET) - 1;
+	const size_t llen = sizeof(IPv6_LITERAL_NET) - 1;
 	size_t len = *_len;
 	int cmp;
 	size_t i;
@@ -53,7 +52,7 @@ static char *normalize_ipv6_literal(const char *str, char *buf, size_t *_len)
 	size_t cnt_chars = 0;
 
 	if (len <= llen) {
-		return false;
+		return NULL;
 	}
 
 	/* ignore a trailing '.' */
@@ -490,76 +489,75 @@ bool is_ipaddress_v6(const char *str)
 #if defined(HAVE_IPV6)
 	int ret = -1;
 	char *p = NULL;
+	char buf[INET6_ADDRSTRLEN] = { 0, };
+	size_t len;
+	const char *addr = str;
+	const char *idxs = NULL;
+	unsigned int idx = 0;
+	struct in6_addr ip6;
 
 	p = strchr_m(str, ':');
 	if (p == NULL) {
 		return is_ipv6_literal(str);
-	} else {
-		char buf[INET6_ADDRSTRLEN] = { 0, };
-		size_t len;
-		const char *addr = str;
-		const char *idxs = NULL;
-		unsigned int idx = 0;
-		struct in6_addr ip6;
-
-		p = strchr_m(str, SCOPE_DELIMITER);
-		if (p && (p > str)) {
-			len = PTR_DIFF(p, str);
-			idxs = p + 1;
-		} else {
-			len = strlen(str);
-		}
+	}
 
-		if (len >= sizeof(buf)) {
-			return false;
-		}
-		if (idxs != NULL) {
-			strncpy(buf, str, len);
-			addr = buf;
-		}
+	p = strchr_m(str, SCOPE_DELIMITER);
+	if (p && (p > str)) {
+		len = PTR_DIFF(p, str);
+		idxs = p + 1;
+	} else {
+		len = strlen(str);
+	}
 
-		/*
-		 * Cope with link-local.
-		 * This is IP:v6:addr%ifidx.
-		 */
-		if (idxs != NULL) {
-			char c;
+	if (len >= sizeof(buf)) {
+		return false;
+	}
+	if (idxs != NULL) {
+		strncpy(buf, str, len);
+		addr = buf;
+	}
 
-			ret = sscanf(idxs, "%5u%c", &idx, &c);
-			if (ret != 1) {
-				idx = 0;
-			}
+	/*
+	 * Cope with link-local.
+	 * This is IP:v6:addr%ifidx.
+	 */
+	if (idxs != NULL) {
+		char c;
 
-			if (idx > 0 && idx < UINT16_MAX) {
-				/* a valid index */
-				idxs = NULL;
-			}
+		ret = sscanf(idxs, "%5u%c", &idx, &c);
+		if (ret != 1) {
+			idx = 0;
 		}
 
-		/*
-		 * Cope with link-local.
-		 * This is IP:v6:addr%ifname.
-		 */
-		if (idxs != NULL) {
-			idx = if_nametoindex(idxs);
-
-			if (idx > 0) {
-				/* a valid index */
-				idxs = NULL;
-			}
+		if (idx > 0 && idx < UINT16_MAX) {
+			/* a valid index */
+			idxs = NULL;
 		}
+	}
 
-		if (idxs != NULL) {
-			return false;
-		}
+	/*
+	 * Cope with link-local.
+	 * This is IP:v6:addr%ifname.
+	 */
+	if (idxs != NULL) {
+		idx = if_nametoindex(idxs);
 
-		ret = inet_pton(AF_INET6, addr, &ip6);
-		if (ret <= 0) {
-			return false;
+		if (idx > 0) {
+			/* a valid index */
+			idxs = NULL;
 		}
+	}
 
-		return true;
+	if (idxs != NULL) {
+		return false;
 	}
+
+	ret = inet_pton(AF_INET6, addr, &ip6);
+	if (ret <= 0) {
+		return false;
+	}
+
+	return true;
 #endif
 	return false;
 }
diff --git a/nsswitch/libwbclient/wbc_pam.c b/nsswitch/libwbclient/wbc_pam.c
index cb2d5a0..c31220a 100644
--- a/nsswitch/libwbclient/wbc_pam.c
+++ b/nsswitch/libwbclient/wbc_pam.c
@@ -727,7 +727,7 @@ wbcErr wbcCtxLogoffUserEx(struct wbcContext *ctx,
 	struct winbindd_request request;
 	struct winbindd_response response;
 	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
-	int i;
+	size_t i;
 
 	/* validate input */
 
@@ -1269,7 +1269,7 @@ wbcErr wbcCtxCredentialCache(struct wbcContext *ctx,
 	struct winbindd_response response;
 	struct wbcNamedBlob *initial_blob = NULL;
 	struct wbcNamedBlob *challenge_blob = NULL;
-	int i;
+	size_t i;
 
 	ZERO_STRUCT(request);
 	ZERO_STRUCT(response);
diff --git a/nsswitch/wb_common.c b/nsswitch/wb_common.c
index 262181a..d6746b4 100644
--- a/nsswitch/wb_common.c
+++ b/nsswitch/wb_common.c
@@ -719,16 +719,15 @@ NSS_STATUS winbindd_request_response(struct winbindd_context *ctx,
 				     struct winbindd_response *response)
 {
 	NSS_STATUS status = NSS_STATUS_UNAVAIL;
-	struct winbindd_context *wb_ctx = ctx;
 
 	if (ctx == NULL) {
-		wb_ctx = &wb_global_ctx;
+		ctx = &wb_global_ctx;
 	}
 
-	status = winbindd_send_request(wb_ctx, req_type, 0, request);
+	status = winbindd_send_request(ctx, req_type, 0, request);
 	if (status != NSS_STATUS_SUCCESS)
 		return (status);
-	status = winbindd_get_response(wb_ctx, response);
+	status = winbindd_get_response(ctx, response);
 
 	return status;
 }
@@ -739,16 +738,15 @@ NSS_STATUS winbindd_priv_request_response(struct winbindd_context *ctx,
 					  struct winbindd_response *response)
 {
 	NSS_STATUS status = NSS_STATUS_UNAVAIL;
-	struct winbindd_context *wb_ctx = ctx;
 
 	if (ctx == NULL) {
-		wb_ctx = &wb_global_ctx;
+		ctx = &wb_global_ctx;
 	}
 
-	status = winbindd_send_request(wb_ctx, req_type, 1, request);
+	status = winbindd_send_request(ctx, req_type, 1, request);
 	if (status != NSS_STATUS_SUCCESS)
 		return (status);
-	status = winbindd_get_response(wb_ctx, response);
+	status = winbindd_get_response(ctx, response);
 
 	return status;
 }
diff --git a/nsswitch/winbind_struct_protocol.h b/nsswitch/winbind_struct_protocol.h
index a2e7d4c..9100dbc 100644
--- a/nsswitch/winbind_struct_protocol.h
+++ b/nsswitch/winbind_struct_protocol.h
@@ -258,7 +258,7 @@ struct winbindd_request {
 		gid_t gid;           /* getgrgid, gid_to_sid */
 		uint32_t ndrcmd;
 		struct {
-			/* We deliberatedly don't split into domain/user to
+			/* We deliberately don't split into domain/user to
                            avoid having the client know what the separator
                            character is. */
 			fstring user;
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index eb6b894..0595cfe 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -1044,12 +1044,23 @@ static NTSTATUS libnet_join_lookup_dc_rpc(TALLOC_CTX *mem_ctx,
 	NTSTATUS status, result;
 	union lsa_PolicyInformation *info = NULL;
 	struct dcerpc_binding_handle *b;
+	const char *account = r->in.admin_account;
+	const char *domain = r->in.admin_domain;
+	const char *password = r->in.admin_password;
+	bool use_kerberos = r->in.use_kerberos;
+
+	if (r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE) {
+		account = "";
+		domain = "";
+		password = NULL;
+		use_kerberos = false;
+	}
 
 	status = libnet_join_connect_dc_ipc(r->in.dc_name,
-					    r->in.admin_account,
-					    r->in.admin_domain,
-					    r->in.admin_password,
-					    r->in.use_kerberos,
+					    account,
+					    domain,
+					    password,
+					    use_kerberos,
 					    cli);
 	if (!NT_STATUS_IS_OK(status)) {
 		goto done;
@@ -1121,16 +1132,19 @@ static NTSTATUS libnet_join_joindomain_rpc_unsecure(TALLOC_CTX *mem_ctx,
 						    struct cli_state *cli)
 {
 	TALLOC_CTX *frame = talloc_stackframe();
-	struct rpc_pipe_client *netlogon_pipe = NULL;
+	struct rpc_pipe_client *authenticate_pipe = NULL;
+	struct rpc_pipe_client *passwordset_pipe = NULL;
 	struct cli_credentials *cli_creds;
 	struct netlogon_creds_cli_context *netlogon_creds = NULL;
+	struct netlogon_creds_CredentialState *creds = NULL;
+	uint32_t netlogon_flags = 0;
 	size_t len = 0;
 	bool ok;
 	DATA_BLOB new_trust_blob = data_blob_null;
 	NTSTATUS status;
 
 	status = cli_rpc_pipe_open_noauth(cli, &ndr_table_netlogon,
-					  &netlogon_pipe);
+					  &authenticate_pipe);
 	if (!NT_STATUS_IS_OK(status)) {
 		TALLOC_FREE(frame);
 		return status;
@@ -1167,7 +1181,7 @@ static NTSTATUS libnet_join_joindomain_rpc_unsecure(TALLOC_CTX *mem_ctx,
 				     CRED_SPECIFIED);
 
 	status = rpccli_create_netlogon_creds_ctx(
-		cli_creds, netlogon_pipe->desthost, r->in.msg_ctx,
+		cli_creds, authenticate_pipe->desthost, r->in.msg_ctx,
 		frame, &netlogon_creds);
 	if (!NT_STATUS_IS_OK(status)) {
 		TALLOC_FREE(frame);
@@ -1182,6 +1196,29 @@ static NTSTATUS libnet_join_joindomain_rpc_unsecure(TALLOC_CTX *mem_ctx,
 		return status;
 	}
 
+	status = netlogon_creds_cli_get(netlogon_creds, frame, &creds);
+	if (!NT_STATUS_IS_OK(status)) {
+		TALLOC_FREE(frame);
+		return status;
+	}
+
+	netlogon_flags = creds->negotiate_flags;
+	TALLOC_FREE(creds);
+
+	if (netlogon_flags & NETLOGON_NEG_AUTHENTICATED_RPC) {
+		status = cli_rpc_pipe_open_schannel_with_creds(cli,
+							       &ndr_table_netlogon,
+							       NCACN_NP,
+							       netlogon_creds,
+							       &passwordset_pipe);
+		if (!NT_STATUS_IS_OK(status)) {
+			TALLOC_FREE(frame);
+			return status;
+		}
+	} else {
+		passwordset_pipe = authenticate_pipe;
+	}
+
 	len = strlen(r->in.machine_password);
 	ok = convert_string_talloc(frame, CH_UNIX, CH_UTF16,
 				   r->in.machine_password, len,
@@ -1197,7 +1234,7 @@ static NTSTATUS libnet_join_joindomain_rpc_unsecure(TALLOC_CTX *mem_ctx,
 	}
 
 	status = netlogon_creds_cli_ServerPasswordSet(netlogon_creds,
-						      netlogon_pipe->binding_handle,
+						      passwordset_pipe->binding_handle,
 						      &new_trust_blob,
 						      NULL); /* new_version */
 	if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index e39d761..afc2bc0 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -2556,7 +2556,7 @@ static NTSTATUS resolve_ads(const char *name,
 				freeaddrinfo(res);
 			}
 		} else {
-			/* use all the IP addresses from the SRV sresponse */
+			/* use all the IP addresses from the SRV response */
 			int j;
 			for (j = 0; j < dcs[i].num_ips; j++) {
 				(*return_iplist)[*return_count].port = dcs[i].port;
diff --git a/source3/script/tests/test_net_rpc_oldjoin.sh b/source3/script/tests/test_net_rpc_oldjoin.sh
new file mode 100755
index 0000000..070fcc1
--- /dev/null
+++ b/source3/script/tests/test_net_rpc_oldjoin.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+if [ $# -lt 3 ]; then
+cat <<EOF
+Usage: test_net_rpc_oldjoin.sh SERVER PREFIX SMB_CONF_PATH
+EOF
+exit 1;
+fi
+
+SERVER="$1"
+PREFIX="$2"
+SMB_CONF_PATH="$3"
+shift 3
+
+incdir=`dirname $0`/../../../testprogs/blackbox
+. $incdir/subunit.sh
+maccount="OLDJOINTEST"
+privatedir="$PREFIX/private"
+
+UID_WRAPPER_ROOT=1
+export UID_WRAPPER_ROOT
+
+OPTIONS="--configfile $SMB_CONF_PATH --option=netbiosname=$maccount --option=security=domain --option=domainlogons=no --option=privatedir=$privatedir"
+
+testit "mkdir -p $privatedir" mkdir -p $privatedir || failed=`expr $failed + 1`
+testit "smbpasswd -a -m" $VALGRIND $BINDIR/smbpasswd -L -c $SMB_CONF_PATH -a -m "$maccount" || failed=`expr $failed + 1`
+testit "net_rpc_oldjoin" $VALGRIND $BINDIR/net rpc oldjoin -S $SERVER $OPTIONS || failed=`expr $failed + 1`
+testit "net_rpc_testjoin1" $VALGRIND $BINDIR/net rpc testjoin -S $SERVER $OPTIONS || failed=`expr $failed + 1`
+testit "net_rpc_changetrustpw" $VALGRIND $BINDIR/net rpc changetrustpw -S $SERVER $OPTIONS || failed=`expr $failed + 1`
+testit "net_rpc_testjoin2" $VALGRIND $BINDIR/net rpc testjoin -S $SERVER $OPTIONS || failed=`expr $failed + 1`
+
+testok $0 $failed
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 5b12355..3e5cffd 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -588,6 +588,10 @@ plantestsuite("samba3.blackbox.net_rpc_join", "nt4_dc",
               [os.path.join(samba3srcdir, "script/tests/test_net_rpc_join.sh"),
                "$USERNAME", "$PASSWORD", "$SERVER", "$PREFIX/net_rpc_join",
                configuration])
+plantestsuite("samba3.blackbox.net_rpc_oldjoin", "nt4_dc:local",
+              [os.path.join(samba3srcdir, "script/tests/test_net_rpc_oldjoin.sh"),
+               "$SERVER", "$PREFIX/net_rpc_oldjoin",
+               "$SMB_CONF_PATH"])
 
 plantestsuite("samba3.blackbox.rpcclient_srvsvc", "simpleserver",
               [os.path.join(samba3srcdir, "script/tests/test_rpcclientsrvsvc.sh"),
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 360adad..481154f 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -11588,15 +11588,6 @@ static struct {
 	{ "qpathinfo-bufsize", run_qpathinfo_bufsize, 0 },
 	{NULL, NULL, 0}};
 
-/*
- * dummy function to satisfy linker dependency
- */
-struct tevent_context *winbind_event_context(void);
-struct tevent_context *winbind_event_context(void)
-{
-	return NULL;
-}
-
 /****************************************************************************
 run a specified test or "ALL"
 ****************************************************************************/
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index 5a10e27..3f54490 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -280,24 +280,24 @@ static void gensec_want_feature_list(struct gensec_security *state, char* featur
 
 static char winbind_separator(void)
 {
-	struct winbindd_response response;
+	struct wbcInterfaceDetails *details;
+	wbcErr ret;
 	static bool got_sep;
 	static char sep;
 
 	if (got_sep)
 		return sep;
 
-	ZERO_STRUCT(response);
-
-	/* Send off request */
-
-	if (winbindd_request_response(NULL, WINBINDD_INFO, NULL, &response) !=
-	    NSS_STATUS_SUCCESS) {
+	ret = wbcInterfaceDetails(&details);
+	if (!WBC_ERROR_IS_OK(ret)) {
 		d_fprintf(stderr, "could not obtain winbind separator!\n");
 		return *lp_winbind_separator();
 	}
 
-	sep = response.data.info.winbind_separator;
+	sep = details->winbind_separator;
+
+	wbcFreeMemory(details);
+
 	got_sep = True;
 
 	if (!sep) {
@@ -310,24 +310,25 @@ static char winbind_separator(void)
 
 const char *get_winbind_domain(void)
 {
-	struct winbindd_response response;
+	struct wbcInterfaceDetails *details;
+	wbcErr ret;
 
 	static fstring winbind_domain;
 	if (*winbind_domain) {
 		return winbind_domain;
 	}
 
-	ZERO_STRUCT(response);
-
 	/* Send off request */
 
-	if (winbindd_request_response(NULL, WINBINDD_DOMAIN_NAME, NULL, &response) !=
-	    NSS_STATUS_SUCCESS) {
+	ret = wbcInterfaceDetails(&details);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list