[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Thu Oct 17 11:03:02 MDT 2013


The branch, master has been updated
       via  2474455 s3:libsmb: call smbXcli_tcon_set_fs_attributes() directly
       via  307abd6 s3:libsmb: remove unused cli_state->case_sensitive
       via  e20c66d s3:libsmb: remove unused cli_state->dfsroot
       via  c5c717f s3:libsmb: add SMB2/3 support to cli_dfs_get_referral()
       via  37f0e37 s3/libsmb: make use of smbXcli_tcon_is_dfs_share()
       via  114e337 s3/libsmb: Use smbXcli_conn_dfs_supported instead of test on CAP_DFS
       via  451b112 s3:libsmb: don't pass down FLAG_CASELESS_PATHNAMES and FLAGS2_DFS_PATHNAMES anymore
       via  226dde2 s3:libsmb: call smbXcli_tcon_{get,set}_fs_attributes() from cli_set_case_sensitive()
       via  60f16ba libcli/smb: add SMB2_HDR_FLAG_DFS for SMB2 Create operations on dfs shares
       via  b16b469 libcli/smb: add FLAG_CASELESS_PATHNAMES based on FILE_CASE_SENSITIVE_SEARCH to smb1 requests
       via  e6eb6b9 libcli/smb: move Filesystem Attributes defines to smb_constants.h
       via  44224cd libcli/smb: add FLAGS2_DFS_PATHNAMES for SMB1 operations against dfs shares
       via  1c4e95c libcli/smb: add smbXcli_tcon_{set,get}_fs_attributes()
       via  e0fe97c libcli/smb: add smbXcli_tcon_is_dfs_share()
       via  24e7be8 libcli/smb: Introduce smbXcli_conn_dfs_supported
       via  a2b38e0 s3:libsmb: make use of smb1cli_tcon_set_values()
       via  d9d5744 s3/libsmb: Use smbXcli_conn_use_unicode instead of smb1 specific test
      from  556f66b auth:credentials: avoid talloc_reference in cli_credentials_set_netlogon_creds()

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


- Log -----------------------------------------------------------------
commit 2474455b7f924ae19ea8897d5e506076f7e77419
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 27 06:06:32 2013 +0200

    s3:libsmb: call smbXcli_tcon_set_fs_attributes() directly
    
    We should try to set all attributes we got and not just
    FILE_CASE_SENSITIVE_SEARCH.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Thu Oct 17 19:02:03 CEST 2013 on sn-devel-104

commit 307abd61df586baac6cb0bef4272c633c526a7bf
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 27 05:45:21 2013 +0200

    s3:libsmb: remove unused cli_state->case_sensitive
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit e20c66d78099bcf5d965bd9d59669fe393481517
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Sep 18 09:40:08 2013 +0200

    s3:libsmb: remove unused cli_state->dfsroot
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit c5c717fe3157224a8aba48a30bace889e7956d31
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sun Oct 13 16:54:18 2013 +0200

    s3:libsmb: add SMB2/3 support to cli_dfs_get_referral()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 37f0e3722cea3ff433d2c95d697e38693c676ae0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 27 05:44:33 2013 +0200

    s3/libsmb: make use of smbXcli_tcon_is_dfs_share()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 114e33717df8b49239ac08399a379a8363d33b85
Author: Luk Claes <luk at debian.org>
Date:   Fri May 17 20:46:24 2013 +0200

    s3/libsmb: Use smbXcli_conn_dfs_supported instead of test on CAP_DFS
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Luk Claes <luk at debian.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 451b11251f7f3a517f94c5d57dab327a30bab52f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 27 05:34:12 2013 +0200

    s3:libsmb: don't pass down FLAG_CASELESS_PATHNAMES and FLAGS2_DFS_PATHNAMES anymore
    
    They're now handled at the smbXcli_conn and smbXcli_tcon layer.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 226dde2879ff8b4b366bf3d9f44f59e7fdc343c0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 27 05:11:45 2013 +0200

    s3:libsmb: call smbXcli_tcon_{get,set}_fs_attributes() from cli_set_case_sensitive()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 60f16bacdc242a8512df352dcdd625661e4b25ad
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Sep 18 03:50:42 2013 +0200

    libcli/smb: add SMB2_HDR_FLAG_DFS for SMB2 Create operations on dfs shares
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit b16b469f3fa3766c19ca30f377cc7de6782c05e6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 27 05:31:07 2013 +0200

    libcli/smb: add FLAG_CASELESS_PATHNAMES based on FILE_CASE_SENSITIVE_SEARCH to smb1 requests
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit e6eb6b9e9494d1c8db311e5b967b0da4d75c45aa
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 27 05:30:03 2013 +0200

    libcli/smb: move Filesystem Attributes defines to smb_constants.h
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 44224cd40fcec262085423577de9eede27a4a22a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Sep 18 03:31:33 2013 +0200

    libcli/smb: add FLAGS2_DFS_PATHNAMES for SMB1 operations against dfs shares
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 1c4e95cbd88e6122c1e2fb07b119abf225c94fff
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 27 05:02:09 2013 +0200

    libcli/smb: add smbXcli_tcon_{set,get}_fs_attributes()
    
    These are the attributes returned from the FileFsAttributeInformation
    request.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit e0fe97c543b2845e3515ffc2c638e4252164beed
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 13 11:07:32 2013 +0200

    libcli/smb: add smbXcli_tcon_is_dfs_share()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 24e7be87d17910c1f4170ecd5fe2d2a8b1419ba5
Author: Luk Claes <luk at debian.org>
Date:   Fri May 17 20:41:45 2013 +0200

    libcli/smb: Introduce smbXcli_conn_dfs_supported
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Luk Claes <luk at debian.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit a2b38e0bc94d329963cdad76e6861d3234ede8d4
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 13 09:10:42 2013 +0200

    s3:libsmb: make use of smb1cli_tcon_set_values()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit d9d5744bc3dd7e18ac6dc23917d903d5e991ab8d
Author: Luk Claes <luk at debian.org>
Date:   Fri May 17 20:13:50 2013 +0200

    s3/libsmb: Use smbXcli_conn_use_unicode instead of smb1 specific test
    
    Signed-off-by: Luk Claes <luk at debian.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

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

Summary of changes:
 libcli/smb/smb2cli_create.c    |   10 ++++-
 libcli/smb/smbXcli_base.c      |   62 ++++++++++++++++++++++++++
 libcli/smb/smbXcli_base.h      |    6 +++
 libcli/smb/smb_constants.h     |   19 ++++++++
 source3/include/client.h       |    3 -
 source3/include/smb.h          |   19 --------
 source3/libsmb/async_smb.c     |   22 ---------
 source3/libsmb/cliconnect.c    |   25 +++++++---
 source3/libsmb/clidfs.c        |   95 +++++++++++++++++++++++++++++++---------
 source3/libsmb/clientgen.c     |   26 ++++++++++-
 source3/libsmb/clitrans.c      |   21 ---------
 source3/libsmb/libsmb_server.c |   14 ++++--
 source3/libsmb/libsmb_stat.c   |   11 ++++-
 source4/libcli/raw/smb.h       |   14 ------
 14 files changed, 229 insertions(+), 118 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smb2cli_create.c b/libcli/smb/smb2cli_create.c
index 3f8d672..9cb94b1 100644
--- a/libcli/smb/smb2cli_create.c
+++ b/libcli/smb/smb2cli_create.c
@@ -63,6 +63,8 @@ struct tevent_req *smb2cli_create_send(
 	uint8_t *dyn;
 	size_t dyn_len;
 	size_t max_dyn_len;
+	uint32_t additional_flags = 0;
+	uint32_t clear_flags = 0;
 
 	req = tevent_req_create(mem_ctx, &state,
 				struct smb2cli_create_state);
@@ -130,6 +132,12 @@ struct tevent_req *smb2cli_create_send(
 		data_blob_free(&blob);
 	}
 
+	if (smbXcli_conn_dfs_supported(conn) &&
+	    smbXcli_tcon_is_dfs_share(tcon))
+	{
+		additional_flags |= SMB2_HDR_FLAG_DFS;
+	}
+
 	/*
 	 * We use max_dyn_len = 0
 	 * as we don't explicitly ask for any output length.
@@ -140,7 +148,7 @@ struct tevent_req *smb2cli_create_send(
 	max_dyn_len = 0;
 
 	subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CREATE,
-				  0, 0, /* flags */
+				  additional_flags, clear_flags,
 				  timeout_msec,
 				  tcon,
 				  session,
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 9e5891a..082b626 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -167,6 +167,9 @@ struct smbXcli_session {
 };
 
 struct smbXcli_tcon {
+	bool is_smb1;
+	uint32_t fs_attributes;
+
 	struct {
 		uint16_t tcon_id;
 		uint16_t optional_support;
@@ -1269,6 +1272,19 @@ struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
 
 	if (tcon) {
 		tid = tcon->smb1.tcon_id;
+
+		if (tcon->fs_attributes & FILE_CASE_SENSITIVE_SEARCH) {
+			clear_flags |= FLAG_CASELESS_PATHNAMES;
+		} else {
+			/* Default setting, case insensitive. */
+			additional_flags |= FLAG_CASELESS_PATHNAMES;
+		}
+
+		if (smbXcli_conn_dfs_supported(conn) &&
+		    smbXcli_tcon_is_dfs_share(tcon))
+		{
+			additional_flags2 |= FLAGS2_DFS_PATHNAMES;
+		}
 	}
 
 	state->smb1.recv_cmd = 0xFF;
@@ -2461,6 +2477,15 @@ bool smbXcli_conn_has_async_calls(struct smbXcli_conn *conn)
 		|| (talloc_array_length(conn->pending) != 0));
 }
 
+bool smbXcli_conn_dfs_supported(struct smbXcli_conn *conn)
+{
+	if (conn->protocol >= PROTOCOL_SMB2_02) {
+		return (smb2cli_conn_server_capabilities(conn) & SMB2_CAP_DFS);
+	}
+
+	return (smb1cli_conn_capabilities(conn) & CAP_DFS);
+}
+
 bool smb2cli_conn_req_possible(struct smbXcli_conn *conn, uint32_t *max_dyn_len)
 {
 	uint16_t credits = 1;
@@ -5016,6 +5041,38 @@ struct smbXcli_tcon *smbXcli_tcon_create(TALLOC_CTX *mem_ctx)
 	return tcon;
 }
 
+void smbXcli_tcon_set_fs_attributes(struct smbXcli_tcon *tcon,
+				    uint32_t fs_attributes)
+{
+	tcon->fs_attributes = fs_attributes;
+}
+
+uint32_t smbXcli_tcon_get_fs_attributes(struct smbXcli_tcon *tcon)
+{
+	return tcon->fs_attributes;
+}
+
+bool smbXcli_tcon_is_dfs_share(struct smbXcli_tcon *tcon)
+{
+	if (tcon == NULL) {
+		return false;
+	}
+
+	if (tcon->is_smb1) {
+		if (tcon->smb1.optional_support & SMB_SHARE_IN_DFS) {
+			return true;
+		}
+
+		return false;
+	}
+
+	if (tcon->smb2.capabilities & SMB2_SHARE_CAP_DFS) {
+		return true;
+	}
+
+	return false;
+}
+
 uint16_t smb1cli_tcon_current_id(struct smbXcli_tcon *tcon)
 {
 	return tcon->smb1.tcon_id;
@@ -5023,6 +5080,7 @@ uint16_t smb1cli_tcon_current_id(struct smbXcli_tcon *tcon)
 
 void smb1cli_tcon_set_id(struct smbXcli_tcon *tcon, uint16_t tcon_id)
 {
+	tcon->is_smb1 = true;
 	tcon->smb1.tcon_id = tcon_id;
 }
 
@@ -5034,6 +5092,8 @@ bool smb1cli_tcon_set_values(struct smbXcli_tcon *tcon,
 			     const char *service,
 			     const char *fs_type)
 {
+	tcon->is_smb1 = true;
+	tcon->fs_attributes = 0;
 	tcon->smb1.tcon_id = tcon_id;
 	tcon->smb1.optional_support = optional_support;
 	tcon->smb1.maximal_access = maximal_access;
@@ -5072,6 +5132,8 @@ void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon,
 			     uint32_t capabilities,
 			     uint32_t maximal_access)
 {
+	tcon->is_smb1 = false;
+	tcon->fs_attributes = 0;
 	tcon->smb2.tcon_id = tcon_id;
 	tcon->smb2.type = type;
 	tcon->smb2.flags = flags;
diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
index 852fc71..11dbf21 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -43,6 +43,8 @@ void smbXcli_conn_disconnect(struct smbXcli_conn *conn, NTSTATUS status);
 
 bool smbXcli_conn_has_async_calls(struct smbXcli_conn *conn);
 
+bool smbXcli_conn_dfs_supported(struct smbXcli_conn *conn);
+
 enum protocol_types smbXcli_conn_protocol(struct smbXcli_conn *conn);
 bool smbXcli_conn_use_unicode(struct smbXcli_conn *conn);
 
@@ -297,6 +299,10 @@ NTSTATUS smb2cli_session_set_channel_key(struct smbXcli_session *session,
 NTSTATUS smb2cli_session_encryption_on(struct smbXcli_session *session);
 
 struct smbXcli_tcon *smbXcli_tcon_create(TALLOC_CTX *mem_ctx);
+void smbXcli_tcon_set_fs_attributes(struct smbXcli_tcon *tcon,
+				    uint32_t fs_attributes);
+uint32_t smbXcli_tcon_get_fs_attributes(struct smbXcli_tcon *tcon);
+bool smbXcli_tcon_is_dfs_share(struct smbXcli_tcon *tcon);
 uint16_t smb1cli_tcon_current_id(struct smbXcli_tcon *tcon);
 void smb1cli_tcon_set_id(struct smbXcli_tcon *tcon, uint16_t tcon_id);
 bool smb1cli_tcon_set_values(struct smbXcli_tcon *tcon,
diff --git a/libcli/smb/smb_constants.h b/libcli/smb/smb_constants.h
index e1d888f..b38c489 100644
--- a/libcli/smb/smb_constants.h
+++ b/libcli/smb/smb_constants.h
@@ -364,6 +364,25 @@ enum csc_policy {
 #define OPLOCK_BREAK_TO_NONE     0
 #define OPLOCK_BREAK_TO_LEVEL_II 1
 
+/* Filesystem Attributes. */
+#define FILE_CASE_SENSITIVE_SEARCH      0x00000001
+#define FILE_CASE_PRESERVED_NAMES       0x00000002
+#define FILE_UNICODE_ON_DISK            0x00000004
+/* According to cifs9f, this is 4, not 8 */
+/* Acconding to testing, this actually sets the security attribute! */
+#define FILE_PERSISTENT_ACLS            0x00000008
+#define FILE_FILE_COMPRESSION           0x00000010
+#define FILE_VOLUME_QUOTAS              0x00000020
+#define FILE_SUPPORTS_SPARSE_FILES      0x00000040
+#define FILE_SUPPORTS_REPARSE_POINTS    0x00000080
+#define FILE_SUPPORTS_REMOTE_STORAGE    0x00000100
+#define FS_LFN_APIS                     0x00004000
+#define FILE_VOLUME_IS_COMPRESSED       0x00008000
+#define FILE_SUPPORTS_OBJECT_IDS        0x00010000
+#define FILE_SUPPORTS_ENCRYPTION        0x00020000
+#define FILE_NAMED_STREAMS              0x00040000
+#define FILE_READ_ONLY_VOLUME           0x00080000
+
 
 /* ioctl codes */
 #define IOCTL_QUERY_JOB_INFO      0x530060
diff --git a/source3/include/client.h b/source3/include/client.h
index f6a4a81..35fa2f1 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -76,7 +76,6 @@ struct cli_state {
 	uint32_t server_posix_capabilities;
 	/* What the client requested. */
 	uint32_t requested_posix_capabilities;
-	bool dfsroot;
 	bool backup_intent;
 
 	/* The list of pipes currently open on this connection. */
@@ -90,8 +89,6 @@ struct cli_state {
 
 	bool use_oplocks; /* should we use oplocks? */
 
-	bool case_sensitive; /* False by default. */
-
 	/* Where (if anywhere) this is mounted under DFS. */
 	char *dfs_mountpoint;
 
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 5c0dfdc..52e1d7d 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -513,25 +513,6 @@ Offset  Data			length.
 #define RENAME_FLAG_RENAME                   0x104
 #define RENAME_FLAG_COPY                     0x105
 
-/* Filesystem Attributes. */
-#define FILE_CASE_SENSITIVE_SEARCH      0x00000001
-#define FILE_CASE_PRESERVED_NAMES       0x00000002
-#define FILE_UNICODE_ON_DISK            0x00000004
-/* According to cifs9f, this is 4, not 8 */
-/* Acconding to testing, this actually sets the security attribute! */
-#define FILE_PERSISTENT_ACLS            0x00000008
-#define FILE_FILE_COMPRESSION           0x00000010
-#define FILE_VOLUME_QUOTAS              0x00000020
-#define FILE_SUPPORTS_SPARSE_FILES      0x00000040
-#define FILE_SUPPORTS_REPARSE_POINTS    0x00000080
-#define FILE_SUPPORTS_REMOTE_STORAGE    0x00000100
-#define FS_LFN_APIS                     0x00004000
-#define FILE_VOLUME_IS_COMPRESSED       0x00008000
-#define FILE_SUPPORTS_OBJECT_IDS        0x00010000
-#define FILE_SUPPORTS_ENCRYPTION        0x00020000
-#define FILE_NAMED_STREAMS              0x00040000
-#define FILE_READ_ONLY_VOLUME           0x00080000
-
 /* ChangeNotify flags. */
 #define FILE_NOTIFY_CHANGE_FILE_NAME   0x001
 #define FILE_NOTIFY_CHANGE_DIR_NAME    0x002
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index ed68a5d..8d5c3d4 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -76,17 +76,6 @@ struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
 	}
 	*state->ptr = state;
 
-	if (cli->case_sensitive) {
-		clear_flags |= FLAG_CASELESS_PATHNAMES;
-	} else {
-		/* Default setting, case insensitive. */
-		additional_flags |= FLAG_CASELESS_PATHNAMES;
-	}
-
-	if ((smb1cli_conn_capabilities(cli->conn) & CAP_DFS) && cli->dfsroot) {
-		additional_flags2 |= FLAGS2_DFS_PATHNAMES;
-	}
-
 	state->req = smb1cli_req_create(state, ev, cli->conn, smb_command,
 					additional_flags, clear_flags,
 					additional_flags2, clear_flags2,
@@ -134,17 +123,6 @@ struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx,
 	}
 	*state->ptr = state;
 
-	if (cli->case_sensitive) {
-		clear_flags |= FLAG_CASELESS_PATHNAMES;
-	} else {
-		/* Default setting, case insensitive. */
-		additional_flags |= FLAG_CASELESS_PATHNAMES;
-	}
-
-	if ((smb1cli_conn_capabilities(cli->conn) & CAP_DFS) && cli->dfsroot) {
-		additional_flags2 |= FLAGS2_DFS_PATHNAMES;
-	}
-
 	state->req = smb1cli_req_send(state, ev, cli->conn, smb_command,
 				additional_flags, clear_flags,
 				additional_flags2, clear_flags2,
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 7bf4187..81bc028 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -2570,21 +2570,22 @@ static void cli_tcon_andx_done(struct tevent_req *subreq)
 	 * Avoids issues when connecting to Win9x boxes sharing files
 	 */
 
-	cli->dfsroot = false;
-
 	if ((wct > 2) && (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_LANMAN2)) {
 		optional_support = SVAL(vwv+2, 0);
 	}
 
-	if (optional_support & SMB_SHARE_IN_DFS) {
-		cli->dfsroot = true;
-	}
-
 	if (optional_support & SMB_EXTENDED_SIGNATURES) {
 		smb1cli_session_protect_session_key(cli->smb1.session);
 	}
 
-	cli_state_set_tid(cli, SVAL(inhdr, HDR_TID));
+	smb1cli_tcon_set_values(state->cli->smb1.tcon,
+				SVAL(inhdr, HDR_TID),
+				optional_support,
+				0, /* maximal_access */
+				0, /* guest_maximal_access */
+				NULL, /* service */
+				NULL); /* fs_type */
+
 	tevent_req_done(req);
 }
 
@@ -2718,7 +2719,15 @@ static void cli_tree_connect_raw_done(struct tevent_req *subreq)
 	if (tevent_req_nterror(req, status)) {
 		return;
 	}
-	cli_state_set_tid(state->cli, tid);
+
+	smb1cli_tcon_set_values(state->cli->smb1.tcon,
+				tid,
+				0, /* optional_support */
+				0, /* maximal_access */
+				0, /* guest_maximal_access */
+				NULL, /* service */
+				NULL); /* fs_type */
+
 	tevent_req_done(req);
 }
 
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 57126e6..ff48719 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -234,7 +234,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 	   here before trying to connect to the original share.
 	   cli_check_msdfs_proxy() will fail if it is a normal share. */
 
-	if ((smb1cli_conn_capabilities(c->conn) & CAP_DFS) &&
+	if (smbXcli_conn_dfs_supported(c->conn) &&
 			cli_check_msdfs_proxy(ctx, c, sharename,
 				&newserver, &newshare,
 				force_encrypt,
@@ -622,7 +622,7 @@ static bool cli_dfs_check_error(struct cli_state *cli, NTSTATUS expected,
 {
 	/* only deal with DS when we negotiated NT_STATUS codes and UNICODE */
 
-	if (!(smb1cli_conn_capabilities(cli->conn) & CAP_UNICODE)) {
+	if (!(smbXcli_conn_use_unicode(cli->conn))) {
 		return false;
 	}
 	if (!(smb1cli_conn_capabilities(cli->conn) & CAP_STATUS32)) {
@@ -645,9 +645,7 @@ NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
 			size_t *num_refs,
 			size_t *consumed)
 {
-	unsigned int data_len = 0;
 	unsigned int param_len = 0;
-	uint16_t setup[1];
 	uint16_t recv_flags2;
 	uint8_t *param = NULL;
 	uint8_t *rdata = NULL;
@@ -664,8 +662,6 @@ NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
 	*num_refs = 0;
 	*refs = NULL;
 
-	SSVAL(setup, 0, TRANSACT2_GET_DFS_REFERRAL);
-
 	param = talloc_array(talloc_tos(), uint8_t, 2);
 	if (!param) {
 		status = NT_STATUS_NO_MEMORY;
@@ -683,20 +679,63 @@ NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
 	param_len = talloc_get_size(param);
 	path_ucs = (smb_ucs2_t *)&param[2];
 
-	status = cli_trans(talloc_tos(), cli, SMBtrans2,
-			   NULL, 0xffff, 0, 0,
-			   setup, 1, 0,
-			   param, param_len, 2,
-			   NULL, 0, CLI_BUFFER_SIZE,
-			   &recv_flags2,
-			   NULL, 0, NULL, /* rsetup */
-			   NULL, 0, NULL,
-			   &rdata, 4, &data_len);
-	if (!NT_STATUS_IS_OK(status)) {
-		goto out;
-	}
+	if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
+		DATA_BLOB in_input_buffer;
+		DATA_BLOB in_output_buffer = data_blob_null;
+		DATA_BLOB out_input_buffer = data_blob_null;
+		DATA_BLOB out_output_buffer = data_blob_null;
+
+		in_input_buffer.data = param;
+		in_input_buffer.length = param_len;
+
+		status = smb2cli_ioctl(cli->conn,
+				       cli->timeout,
+				       cli->smb2.session,
+				       cli->smb2.tcon,
+				       UINT64_MAX, /* in_fid_persistent */
+				       UINT64_MAX, /* in_fid_volatile */
+				       FSCTL_DFS_GET_REFERRALS,
+				       0, /* in_max_input_length */
+				       &in_input_buffer,
+				       CLI_BUFFER_SIZE, /* in_max_output_length */
+				       &in_output_buffer,
+				       SMB2_IOCTL_FLAG_IS_FSCTL,
+				       talloc_tos(),
+				       &out_input_buffer,
+				       &out_output_buffer);
+		if (!NT_STATUS_IS_OK(status)) {
+			goto out;
+		}
 
-	endp = (char *)rdata + data_len;
+		if (out_output_buffer.length < 4) {
+			status = NT_STATUS_INVALID_NETWORK_RESPONSE;
+			goto out;
+		}
+
+		recv_flags2 = FLAGS2_UNICODE_STRINGS;
+		rdata = out_output_buffer.data;
+		endp = (char *)rdata + out_output_buffer.length;
+	} else {
+		unsigned int data_len = 0;
+		uint16_t setup[1];
+
+		SSVAL(setup, 0, TRANSACT2_GET_DFS_REFERRAL);
+
+		status = cli_trans(talloc_tos(), cli, SMBtrans2,
+				   NULL, 0xffff, 0, 0,
+				   setup, 1, 0,
+				   param, param_len, 2,
+				   NULL, 0, CLI_BUFFER_SIZE,
+				   &recv_flags2,
+				   NULL, 0, NULL, /* rsetup */
+				   NULL, 0, NULL,
+				   &rdata, 4, &data_len);
+		if (!NT_STATUS_IS_OK(status)) {
+			goto out;
+		}
+
+		endp = (char *)rdata + data_len;
+	}
 
 	consumed_ucs  = SVAL(rdata, 0);
 	num_referrals = SVAL(rdata, 2);
@@ -822,6 +861,8 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
 	SMB_STRUCT_STAT sbuf;
 	uint32 attributes;
 	NTSTATUS status;
+	struct smbXcli_tcon *root_tcon = NULL;
+	struct smbXcli_tcon *target_tcon = NULL;
 
 	if ( !rootcli || !path || !targetcli ) {
 		return NT_STATUS_INVALID_PARAMETER;
@@ -829,7 +870,13 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
 
 	/* Don't do anything if this is not a DFS root. */
 
-	if ( !rootcli->dfsroot) {
+	if (smbXcli_conn_protocol(rootcli->conn) >= PROTOCOL_SMB2_02) {
+		root_tcon = rootcli->smb2.tcon;
+	} else {
+		root_tcon = rootcli->smb1.tcon;
+	}
+
+	if (!smbXcli_tcon_is_dfs_share(root_tcon)) {
 		*targetcli = rootcli;
 		*pp_targetpath = talloc_strdup(ctx, path);
 		if (!*pp_targetpath) {
@@ -1029,8 +1076,14 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
 
   done:
 
+	if (smbXcli_conn_protocol((*targetcli)->conn) >= PROTOCOL_SMB2_02) {
+		target_tcon = (*targetcli)->smb2.tcon;
+	} else {
+		target_tcon = (*targetcli)->smb1.tcon;
+	}
+
 	/* If returning true ensure we return a dfs root full path. */
-	if ((*targetcli)->dfsroot) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list