summaryrefslogtreecommitdiff
path: root/libcli/smb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-09-13 11:07:32 +0200
committerMichael Adam <obnox@samba.org>2013-10-17 16:03:25 +0200
commite0fe97c543b2845e3515ffc2c638e4252164beed (patch)
tree16a4a4c32f66cbd2e9dec879cc4b615da290aa3a /libcli/smb
parent24e7be87d17910c1f4170ecd5fe2d2a8b1419ba5 (diff)
downloadsamba-e0fe97c543b2845e3515ffc2c638e4252164beed.tar.gz
samba-e0fe97c543b2845e3515ffc2c638e4252164beed.tar.bz2
samba-e0fe97c543b2845e3515ffc2c638e4252164beed.zip
libcli/smb: add smbXcli_tcon_is_dfs_share()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10200 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'libcli/smb')
-rw-r--r--libcli/smb/smbXcli_base.c26
-rw-r--r--libcli/smb/smbXcli_base.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index f1ac0d5396..1f31bdb48c 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -167,6 +167,8 @@ struct smbXcli_session {
};
struct smbXcli_tcon {
+ bool is_smb1;
+
struct {
uint16_t tcon_id;
uint16_t optional_support;
@@ -5025,6 +5027,27 @@ struct smbXcli_tcon *smbXcli_tcon_create(TALLOC_CTX *mem_ctx)
return tcon;
}
+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;
@@ -5032,6 +5055,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;
}
@@ -5043,6 +5067,7 @@ bool smb1cli_tcon_set_values(struct smbXcli_tcon *tcon,
const char *service,
const char *fs_type)
{
+ tcon->is_smb1 = true;
tcon->smb1.tcon_id = tcon_id;
tcon->smb1.optional_support = optional_support;
tcon->smb1.maximal_access = maximal_access;
@@ -5081,6 +5106,7 @@ void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon,
uint32_t capabilities,
uint32_t maximal_access)
{
+ tcon->is_smb1 = false;
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 e2de07333c..fc21fdc71c 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -299,6 +299,7 @@ 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);
+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,