[SCM] Samba Shared Repository - branch master updated

[email protected] (Andreas Schneider)
Newsgroups gmane.network.samba.cvs
Message-ID <[email protected]>
The branch, master has been updated
       via  5ca59a1 s3:libsmb: don't pass 'passlen' to cli_tree_connect[_send]() and allow pass=NULL
       via  75aa174 s3:libsmb: avoid using cli->{use_kerberos,...} in remote_password_change()
       via  77a7e72 s3:client: avoid using cli->{use_kerberos,...} for cli_session_creds_init() in smbspool.c
       via  9bf8805 s3:client: make use of cli_tree_connect_creds() in smbspool.c
       via  bae607a s3:libsmb: add cli_tree_connect_creds()
       via  d0d17cd s3:libsmb: fix 'client lanman auth = no' DEBUG message in cli_session_setup_creds_send()
       via  d6216b8 s3:libsmb: fix memory leak in cli_raw_ntlm_smb_encryption_start()
       via  3c8e9a0 s3:torture: make use of cli_full_connection_creds() in torture.c
       via  182d5e7 auth/credentials: clear all unused blobs in cli_credentials_get_ntlm_response()
       via  4c9462f auth/credentials: fix cut'n'paste error in cli_credentials_get_principal_and_obtained()
       via  5d4aa22 auth/credentials: let cli_credentials_parse_string() handle the "winbind separator"
      from  f5536ce ctdb: add test script for ctdb_mutex_ceph_rados_helper

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


- Log -----------------------------------------------------------------
commit 5ca59a1772afb6c8b4ec06d1b92b7ad6d2d149d1
Author: Stefan Metzmacher <[email protected]>
Date:   Thu Dec 8 07:13:57 2016 +0100

    s3:libsmb: don't pass 'passlen' to cli_tree_connect[_send]() and allow pass=NULL
    
    There're no callers which try to pass a raw lm_response directly anymore.
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>
    
    Autobuild-User(master): Andreas Schneider <[email protected]>
    Autobuild-Date(master): Fri Dec  9 13:09:37 CET 2016 on sn-devel-144

commit 75aa174e8df5b34e4b9745c9da5f164573f513c3
Author: Stefan Metzmacher <[email protected]>
Date:   Sun Oct 30 16:10:03 2016 +0100

    s3:libsmb: avoid using cli->{use_kerberos,...} in remote_password_change()
    
    As we pass flags=0 to cli_connect_nb() all values can only be false,
    so we can use false directly.
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>

commit 77a7e72f8823119be29f3f52cf073d8d721d04ec
Author: Stefan Metzmacher <[email protected]>
Date:   Sun Oct 30 16:21:31 2016 +0100

    s3:client: avoid using cli->{use_kerberos,...} for cli_session_creds_init() in smbspool.c
    
    CLI_FULL_CONNECTION_USE_KERBEROS is the only possible flag the
    caller of smb_complete_connection() will pass, so we can avoid
    use it directly instead of going via cli_start_connection()
    to use cli->use_kerberos.
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>

commit 9bf8805ee98e39310dd54d5e666d7abcc2ebe1ff
Author: Stefan Metzmacher <[email protected]>
Date:   Thu Dec 8 06:54:29 2016 +0100

    s3:client: make use of cli_tree_connect_creds() in smbspool.c
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>

commit bae607af36786acac4454b49fc0d36ad92e4c715
Author: Stefan Metzmacher <[email protected]>
Date:   Wed Dec 7 17:32:58 2016 +0100

    s3:libsmb: add cli_tree_connect_creds()
    
    This can be used with a valid creds structure in order
    to do a share level authentication or with NULL in the cases
    we assume a modern server already.
    
    Later we can change the ordering and implement
    cli_tree_connect() on top of cli_tree_connect_creds().
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>

commit d0d17cdb777df668ca57344907a58fbfe295b511
Author: Stefan Metzmacher <[email protected]>
Date:   Wed Dec 7 17:18:01 2016 +0100

    s3:libsmb: fix 'client lanman auth = no' DEBUG message in cli_session_setup_creds_send()
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>

commit d6216b8f375fe553a1dbe9b85da3b994384ac392
Author: Stefan Metzmacher <[email protected]>
Date:   Thu Nov 3 13:49:43 2016 +0100

    s3:libsmb: fix memory leak in cli_raw_ntlm_smb_encryption_start()
    
    smb_trans_enc_state is a talloc pointer now, so we can talloc_move()
    the gensec_security to the correct talloc parent.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12408
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>

commit 3c8e9a0ad3e6d23494cf4707b1e1f8be2972eb45
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Oct 28 12:44:51 2016 +0200

    s3:torture: make use of cli_full_connection_creds() in torture.c
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>

commit 182d5e73a9f0435c19a1723af785cae0d410d697
Author: Stefan Metzmacher <[email protected]>
Date:   Wed Dec 7 17:17:44 2016 +0100

    auth/credentials: clear all unused blobs in cli_credentials_get_ntlm_response()
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>

commit 4c9462f93b2e88c2da39320ababfb95d20b02185
Author: Stefan Metzmacher <[email protected]>
Date:   Tue Nov 8 07:19:11 2016 +0100

    auth/credentials: fix cut'n'paste error in cli_credentials_get_principal_and_obtained()
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>

commit 5d4aa22f559d051fe38992af8c17d1ae0ea11cf2
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Oct 28 15:55:48 2016 +0200

    auth/credentials: let cli_credentials_parse_string() handle the "winbind separator"
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>

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

Summary of changes:
 auth/credentials/credentials.c          | 16 ++++++++++--
 auth/credentials/credentials_internal.h |  2 ++
 auth/credentials/credentials_ntlm.c     | 16 +++++++++---
 source3/client/client.c                 |  2 +-
 source3/client/smbspool.c               | 16 +++++++-----
 source3/lib/util_sd.c                   |  4 +--
 source3/libsmb/cliconnect.c             | 39 +++++++++++++++++++-----------
 source3/libsmb/clidfs.c                 |  5 ++--
 source3/libsmb/clifsinfo.c              | 18 +++++++-------
 source3/libsmb/libsmb_server.c          |  6 ++---
 source3/libsmb/passchange.c             | 10 ++++----
 source3/libsmb/proto.h                  |  5 +++-
 source3/nmbd/nmbd_synclists.c           |  2 +-
 source3/torture/test_smb2.c             | 18 +++++++-------
 source3/torture/torture.c               | 43 ++++++++++++++++++---------------
 source3/utils/net_rpc.c                 |  4 +--
 source3/utils/smbcacls.c                |  2 +-
 source3/winbindd/winbindd_cm.c          |  2 +-
 18 files changed, 126 insertions(+), 84 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c
index b8171f3..c8f86ba 100644
--- a/auth/credentials/credentials.c
+++ b/auth/credentials/credentials.c
@@ -115,6 +115,8 @@ _PUBLIC_ struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx)
 
 	cred->forced_sasl_mech = NULL;
 
+	cred->winbind_separator = '\\';
+
 	return cred;
 }
 
@@ -291,7 +293,7 @@ _PUBLIC_ const char *cli_credentials_get_principal_and_obtained(struct cli_crede
 					       cli_credentials_get_username(cred),
 					       cli_credentials_get_domain(cred));
 		} else {
-			*obtained = MIN(cred->domain_obtained, cred->username_obtained);
+			*obtained = MIN(cred->realm_obtained, cred->username_obtained);
 			return talloc_asprintf(mem_ctx, "%s@%s", 
 					       cli_credentials_get_username(cred),
 					       cli_credentials_get_realm(cred));
@@ -746,7 +748,10 @@ _PUBLIC_ void cli_credentials_parse_string(struct cli_credentials *credentials,
 		*p = 0;
 		cli_credentials_set_realm(credentials, p+1, obtained);
 		return;
-	} else if ((p = strchr_m(uname,'\\')) || (p = strchr_m(uname, '/'))) {
+	} else if ((p = strchr_m(uname,'\\'))
+		   || (p = strchr_m(uname, '/'))
+		   || (p = strchr_m(uname, credentials->winbind_separator)))
+	{
 		*p = 0;
 		cli_credentials_set_domain(credentials, uname, obtained);
 		uname = p+1;
@@ -794,6 +799,8 @@ _PUBLIC_ const char *cli_credentials_get_unparsed_name(struct cli_credentials *c
 _PUBLIC_ void cli_credentials_set_conf(struct cli_credentials *cred, 
 			      struct loadparm_context *lp_ctx)
 {
+	const char *sep = NULL;
+
 	cli_credentials_set_username(cred, "", CRED_UNINITIALISED);
 	if (lpcfg_parm_is_cmdline(lp_ctx, "workgroup")) {
 		cli_credentials_set_domain(cred, lpcfg_workgroup(lp_ctx), CRED_SPECIFIED);
@@ -810,6 +817,11 @@ _PUBLIC_ void cli_credentials_set_conf(struct cli_credentials *cred,
 	} else {
 		cli_credentials_set_realm(cred, lpcfg_realm(lp_ctx), CRED_UNINITIALISED);
 	}
+
+	sep = lpcfg_winbind_separator(lp_ctx);
+	if (sep != NULL && sep[0] != '\0') {
+		cred->winbind_separator = *lpcfg_winbind_separator(lp_ctx);
+	}
 }
 
 /**
diff --git a/auth/credentials/credentials_internal.h b/auth/credentials/credentials_internal.h
index aa01ccc..f88ae70 100644
--- a/auth/credentials/credentials_internal.h
+++ b/auth/credentials/credentials_internal.h
@@ -113,6 +113,8 @@ struct cli_credentials {
 
 	/* Whether any callback is currently running */
 	bool callback_running;
+
+	char winbind_separator;
 };
 
 #endif /* __CREDENTIALS_INTERNAL_H__ */
diff --git a/auth/credentials/credentials_ntlm.c b/auth/credentials/credentials_ntlm.c
index 3603647..2a4c141 100644
--- a/auth/credentials/credentials_ntlm.c
+++ b/auth/credentials/credentials_ntlm.c
@@ -261,21 +261,29 @@ _PUBLIC_ NTSTATUS cli_credentials_get_ntlm_response(struct cli_credentials *cred
 	}
 
 done:
-	if (_lm_response) {
+	if (_lm_response != NULL) {
 		talloc_steal(mem_ctx, lm_response.data);
 		*_lm_response = lm_response;
+	} else {
+		data_blob_clear(&lm_response);
 	}
-	if (_nt_response) {
+	if (_nt_response != NULL) {
 		talloc_steal(mem_ctx, nt_response.data);
 		*_nt_response = nt_response;
+	} else {
+		data_blob_clear(&nt_response);
 	}
-	if (_lm_session_key) {
+	if (_lm_session_key != NULL) {
 		talloc_steal(mem_ctx, lm_session_key.data);
 		*_lm_session_key = lm_session_key;
+	} else {
+		data_blob_clear(&lm_session_key);
 	}
-	if (_session_key) {
+	if (_session_key != NULL) {
 		talloc_steal(mem_ctx, session_key.data);
 		*_session_key = session_key;
+	} else {
+		data_blob_clear(&session_key);
 	}
 	TALLOC_FREE(frame);
 	return NT_STATUS_OK;
diff --git a/source3/client/client.c b/source3/client/client.c
index 65696f9..224ec07 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4638,7 +4638,7 @@ static int cmd_tcon(void)
 		return 1;
 	}
 
-	status = cli_tree_connect(cli, sharename, "?????", "", 0);
+	status = cli_tree_connect(cli, sharename, "?????", NULL);
 	if (!NT_STATUS_IS_OK(status)) {
 		d_printf("tcon failed: %s\n", nt_errstr(status));
 		return -1;
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 7448b47..a447836 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -406,6 +406,7 @@ smb_complete_connection(const char *myname,
 	struct cli_state *cli;	/* New connection */
 	NTSTATUS        nt_status;
 	struct cli_credentials *creds = NULL;
+	bool use_kerberos = false;
 
 	/* Start the SMB connection */
 	*need_auth = false;
@@ -425,15 +426,19 @@ smb_complete_connection(const char *myname,
 		return NULL;
 	}
 
+	if (flags & CLI_FULL_CONNECTION_USE_KERBEROS) {
+		use_kerberos = true;
+	}
+
 	creds = cli_session_creds_init(cli,
 				       username,
 				       workgroup,
 				       NULL, /* realm */
 				       password,
-				       cli->use_kerberos,
-				       cli->fallback_after_kerberos,
-				       cli->use_ccache,
-				       cli->pw_nt_hash);
+				       use_kerberos,
+				       false, /* fallback_after_kerberos */
+				       false, /* use_ccache */
+				       false); /* password_is_nt_hash */
 	if (creds == NULL) {
 		fprintf(stderr, "ERROR: cli_session_creds_init failed\n");
 		cli_shutdown(cli);
@@ -453,8 +458,7 @@ smb_complete_connection(const char *myname,
 		return NULL;
 	}
 
-	nt_status = cli_tree_connect(cli, share, "?????", password,
-				     strlen(password) + 1);
+	nt_status = cli_tree_connect_creds(cli, share, "?????", creds);
 	if (!NT_STATUS_IS_OK(nt_status)) {
 		fprintf(stderr, "ERROR: Tree connect failed (%s)\n",
 			nt_errstr(nt_status));
diff --git a/source3/lib/util_sd.c b/source3/lib/util_sd.c
index 9a7b34f..d79fe79 100644
--- a/source3/lib/util_sd.c
+++ b/source3/lib/util_sd.c
@@ -93,7 +93,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli,
 	char **domains;
 	char **names;
 
-	status = cli_tree_connect(cli, "IPC$", "?????", "", 0);
+	status = cli_tree_connect(cli, "IPC$", "?????", NULL);
 	if (!NT_STATUS_IS_OK(status)) {
 		goto tcon_fail;
 	}
@@ -173,7 +173,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli,
 	struct dom_sid *sids;
 	enum lsa_SidType *types;
 
-	status = cli_tree_connect(cli, "IPC$", "?????", "", 0);
+	status = cli_tree_connect(cli, "IPC$", "?????", NULL);
 	if (!NT_STATUS_IS_OK(status)) {
 		goto tcon_fail;
 	}
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index a32d378..559712e 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1502,9 +1502,8 @@ struct tevent_req *cli_session_setup_creds_send(TALLOC_CTX *mem_ctx,
 		}
 	} else {
 		if (!lp_client_lanman_auth()) {
-			DEBUG(1, ("Server requested LM password but "
-				  "'client lanman auth = no' "
-				  "or 'client ntlmv2 auth = yes' is set\n"));
+			DEBUG(1, ("Server requested user level LM password but "
+				  "'client lanman auth = no' is set.\n"));
 			tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
 			return tevent_req_post(req, ev);
 		}
@@ -2205,10 +2204,16 @@ static void cli_tree_connect_raw_done(struct tevent_req *subreq);
 
 static struct tevent_req *cli_tree_connect_send(
 	TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
-	const char *share, const char *dev, const char *pass, int passlen)
+	const char *share, const char *dev, const char *pass)
 {
 	struct tevent_req *req, *subreq;
 	struct cli_tree_connect_state *state;
+	int passlen;
+
+	if (pass == NULL) {
+		pass = "";
+	}
+	passlen = strlen(pass) + 1;
 
 	req = tevent_req_create(mem_ctx, &state,
 				struct cli_tree_connect_state);
@@ -2313,7 +2318,7 @@ static NTSTATUS cli_tree_connect_recv(struct tevent_req *req)
 }
 
 NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
-			  const char *dev, const char *pass, int passlen)
+			  const char *dev, const char *pass)
 {
 	struct tevent_context *ev;
 	struct tevent_req *req;
@@ -2326,7 +2331,7 @@ NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
 	if (ev == NULL) {
 		goto fail;
 	}
-	req = cli_tree_connect_send(ev, ev, cli, share, dev, pass, passlen);
+	req = cli_tree_connect_send(ev, ev, cli, share, dev, pass);
 	if (req == NULL) {
 		goto fail;
 	}
@@ -2339,6 +2344,19 @@ fail:
 	return status;
 }
 
+NTSTATUS cli_tree_connect_creds(struct cli_state *cli,
+				const char *share, const char *dev,
+				struct cli_credentials *creds)
+{
+	const char *pw = NULL;
+
+	if (creds != NULL) {
+		pw = cli_credentials_get_password(creds);
+	}
+
+	return cli_tree_connect(cli, share, dev, pw);
+}
+
 /****************************************************************************
  Send a tree disconnect.
 ****************************************************************************/
@@ -2991,7 +3009,6 @@ static void cli_full_connection_creds_tcon_start(struct tevent_req *req)
 		req, struct cli_full_connection_creds_state);
 	struct tevent_req *subreq = NULL;
 	const char *password = NULL;
-	int pw_len = 0;
 
 	if (state->service == NULL) {
 		tevent_req_done(req);
@@ -2999,18 +3016,12 @@ static void cli_full_connection_creds_tcon_start(struct tevent_req *req)
 	}
 
 	password = cli_credentials_get_password(state->creds);
-	if (password == NULL) {
-		password = "";
-		pw_len = 0;
-	} else {
-		pw_len = strlen(password) + 1;
-	}
 
 	subreq = cli_tree_connect_send(state, state->ev,
 				       state->cli,
 				       state->service,
 				       state->service_type,
-				       password, pw_len);
+				       password);
 	if (tevent_req_nomem(subreq, req)) {
 		return;
 	}
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 86a74ec..b44bbef 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -254,8 +254,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 
 	/* must be a normal share */
 
-	status = cli_tree_connect(c, sharename, "?????",
-				  password, strlen(password)+1);
+	status = cli_tree_connect(c, sharename, "?????", password);
 	if (!NT_STATUS_IS_OK(status)) {
 		d_printf("tree connect failed: %s\n", nt_errstr(status));
 		cli_shutdown(c);
@@ -1203,7 +1202,7 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
 
 	/* check for the referral */
 
-	if (!NT_STATUS_IS_OK(cli_tree_connect(cli, "IPC$", "IPC", NULL, 0))) {
+	if (!NT_STATUS_IS_OK(cli_tree_connect(cli, "IPC$", "IPC", NULL))) {
 		return false;
 	}
 
diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c
index 31a2c02..ca4dc38 100644
--- a/source3/libsmb/clifsinfo.c
+++ b/source3/libsmb/clifsinfo.c
@@ -642,11 +642,11 @@ NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
 
 	if (NT_STATUS_IS_OK(status)) {
 		es->enc_on = true;
-		/* Replace the old state, if any. */
-		/* We only need the gensec_security part from here.
-		 * es is a malloc()ed pointer, so we cannot make
-		 * gensec_security a talloc child */
-		es->gensec_security = talloc_move(NULL,
+		/*
+		 * Replace the old state, if any.
+		 * We only need the gensec_security part from here.
+		 */
+		es->gensec_security = talloc_move(es,
 						  &auth_generic_state->gensec_security);
 		smb1cli_conn_set_encryption(cli->conn, es);
 		es = NULL;
@@ -727,10 +727,10 @@ NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli)
 
 	if (NT_STATUS_IS_OK(status)) {
 		es->enc_on = true;
-		/* Replace the old state, if any. */
-		/* We only need the gensec_security part from here.
-		 * es is a malloc()ed pointer, so we cannot make
-		 * gensec_security a talloc child */
+		/*
+		 * Replace the old state, if any.
+		 * We only need the gensec_security part from here.
+		 */
 		es->gensec_security = talloc_move(es,
 						  &auth_generic_state->gensec_security);
 		smb1cli_conn_set_encryption(cli->conn, es);
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 591d646..438b7e6 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -344,8 +344,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 			status = cli_tree_connect(srv->cli,
 						  srv->cli->share,
 						  "?????",
-						  *pp_password,
-						  strlen(*pp_password)+1);
+						  *pp_password);
 			if (!NT_STATUS_IS_OK(status)) {
                                 errno = map_errno_from_nt_status(status);
                                 cli_shutdown(srv->cli);
@@ -542,8 +541,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 
 	/* must be a normal share */
 
-	status = cli_tree_connect(c, share, "?????", *pp_password,
-				  strlen(*pp_password)+1);
+	status = cli_tree_connect(c, share, "?????", *pp_password);
 	if (!NT_STATUS_IS_OK(status)) {
 		errno = map_errno_from_nt_status(status);
 		cli_shutdown(c);
diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index 927c7ae..c89b7ca 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -58,10 +58,10 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
 				       NULL, /* domain */
 				       NULL, /* realm */
 				       old_passwd,
-				       cli->use_kerberos,
-				       cli->fallback_after_kerberos,
-				       cli->use_ccache,
-				       cli->pw_nt_hash);
+				       false, /* use_kerberos */
+				       false, /* fallback_after_kerberos */
+				       false, /* use_ccache */
+				       false); /* password_is_nt_hash */
 	SMB_ASSERT(creds != NULL);
 
 	result = smbXcli_negprot(cli->conn, cli->timeout,
@@ -120,7 +120,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
 		}
 	}
 
-	result = cli_tree_connect(cli, "IPC$", "IPC", "", 1);
+	result = cli_tree_connect(cli, "IPC$", "IPC", NULL);
 	if (!NT_STATUS_IS_OK(result)) {
 		if (asprintf(err_str, "machine %s rejected the tconX on the "
 			     "IPC$ share. Error was : %s.\n",
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 107579c..e1cd185 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -78,8 +78,11 @@ struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
 		       const char *dev, const char *pass, int passlen);
+NTSTATUS cli_tree_connect_creds(struct cli_state *cli,
+				const char *share, const char *dev,
+				struct cli_credentials *creds);
 NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
-			  const char *dev, const char *pass, int passlen);
+			  const char *dev, const char *pass);
 NTSTATUS cli_tdis(struct cli_state *cli);
 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
 			uint16_t port, int name_type, const char *myname,
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index 1c2b04d..d69d6f9 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -101,7 +101,7 @@ static void sync_child(char *name, int nm_type,
 		return;
 	}
 
-	if (!NT_STATUS_IS_OK(cli_tree_connect(cli, "IPC$", "IPC", "", 1))) {
+	if (!NT_STATUS_IS_OK(cli_tree_connect(cli, "IPC$", "IPC", NULL))) {
 		cli_shutdown(cli);
 		return;
 	}
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index 3eee2ac..7819bc2 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -64,7 +64,7 @@ bool run_smb2_basic(int dummy)
 		return false;
 	}
 
-	status = cli_tree_connect(cli, share, "?????", "", 0);
+	status = cli_tree_connect(cli, share, "?????", NULL);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("cli_tree_connect returned %s\n", nt_errstr(status));
 		return false;
@@ -336,7 +336,7 @@ bool run_smb2_session_reconnect(int dummy)
 		return false;
 	}
 
-	status = cli_tree_connect(cli1, share, "?????", "", 0);
+	status = cli_tree_connect(cli1, share, "?????", NULL);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("cli_tree_connect returned %s\n", nt_errstr(status));
 		return false;
@@ -527,7 +527,7 @@ bool run_smb2_session_reconnect(int dummy)
 		return false;
 	}
 
-	status = cli_tree_connect(cli1, share, "?????", "", 0);
+	status = cli_tree_connect(cli1, share, "?????", NULL);
 	if (!NT_STATUS_EQUAL(status, NT_STATUS_USER_SESSION_DELETED)) {
 		printf("cli_tree_connect returned %s\n", nt_errstr(status));
 		return false;
@@ -651,7 +651,7 @@ bool run_smb2_session_reconnect(int dummy)
 
 	/* now do a new tcon and test file calls again */
 
-	status = cli_tree_connect(cli2, share, "?????", "", 0);
+	status = cli_tree_connect(cli2, share, "?????", NULL);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("cli_tree_connect returned %s\n", nt_errstr(status));
 		return false;
@@ -744,7 +744,7 @@ bool run_smb2_tcon_dependence(int dummy)
 		return false;
 	}
 
-	status = cli_tree_connect(cli, share, "?????", "", 0);
+	status = cli_tree_connect(cli, share, "?????", NULL);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("cli_tree_connect returned %s\n", nt_errstr(status));
 		return false;
@@ -896,7 +896,7 @@ bool run_smb2_multi_channel(int dummy)
 		return false;
 	}
 
-	status = cli_tree_connect(cli1, share, "?????", "", 0);
+	status = cli_tree_connect(cli1, share, "?????", NULL);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("cli_tree_connect returned %s\n", nt_errstr(status));
 		return false;
@@ -1453,7 +1453,7 @@ bool run_smb2_session_reauth(int dummy)
 		return false;
 	}
 
-	status = cli_tree_connect(cli, share, "?????", "", 0);
+	status = cli_tree_connect(cli, share, "?????", NULL);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("cli_tree_connect returned %s\n", nt_errstr(status));
 		return false;
@@ -1702,7 +1702,7 @@ bool run_smb2_session_reauth(int dummy)
 				0, /* flags */
 				0, /* capabilities */
 				0  /* maximal_access */);
-	status = cli_tree_connect(cli, share, "?????", "", 0);


-- 
Samba Shared Repository
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.