diff options
author | Luk Claes <luk@debian.org> | 2012-06-02 18:03:20 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-07-24 18:44:04 +0200 |
commit | 552dda970c6b665a36cf2af56142eb1456883528 (patch) | |
tree | fc1afcf84574694d478bb6e0163eb2e7f9705a0f /libcli/smb | |
parent | 20e4392b255b98c22e12b5dbe1727457b419fb28 (diff) | |
download | samba-552dda970c6b665a36cf2af56142eb1456883528.tar.gz samba-552dda970c6b665a36cf2af56142eb1456883528.tar.bz2 samba-552dda970c6b665a36cf2af56142eb1456883528.zip |
libcli/smb: add smbXcli_tcon structure
Signed-off-by: Luk Claes <luk@debian.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'libcli/smb')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 89 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.h | 19 |
2 files changed, 108 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index c41890d6df..e9592e78a2 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -35,6 +35,7 @@ struct smbXcli_conn; struct smbXcli_req; struct smbXcli_session; +struct smbXcli_tcon; struct smbXcli_conn { int read_fd; @@ -150,6 +151,25 @@ struct smbXcli_session { } smb2; }; +struct smbXcli_tcon { + struct { + uint16_t tcon_id; + uint16_t optional_support; + uint32_t maximal_access; + uint32_t guest_maximal_access; + char *service; + char *fs_type; + } smb1; + + struct { + uint32_t tcon_id; + uint8_t type; + uint32_t flags; + uint32_t capabilities; + uint32_t maximal_access; + } smb2; +}; + struct smbXcli_req_state { struct tevent_context *ev; struct smbXcli_conn *conn; @@ -4535,3 +4555,72 @@ NTSTATUS smb2cli_session_set_channel_key(struct smbXcli_session *session, return NT_STATUS_OK; } + +struct smbXcli_tcon *smbXcli_tcon_create(TALLOC_CTX *mem_ctx) +{ + struct smbXcli_tcon *tcon; + + tcon = talloc_zero(mem_ctx, struct smbXcli_tcon); + if (tcon == NULL) { + return NULL; + } + + return tcon; +} + +uint16_t smb1cli_tcon_current_id(struct smbXcli_tcon *tcon) +{ + return tcon->smb1.tcon_id; +} + +void smb1cli_tcon_set_id(struct smbXcli_tcon *tcon, uint16_t tcon_id) +{ + tcon->smb1.tcon_id = tcon_id; +} + +bool smb1cli_tcon_set_values(struct smbXcli_tcon *tcon, + uint16_t tcon_id, + uint16_t optional_support, + uint32_t maximal_access, + uint32_t guest_maximal_access, + const char *service, + const char *fs_type) +{ + tcon->smb1.tcon_id = tcon_id; + tcon->smb1.optional_support = optional_support; + tcon->smb1.maximal_access = maximal_access; + tcon->smb1.guest_maximal_access = guest_maximal_access; + + TALLOC_FREE(tcon->smb1.service); + tcon->smb1.service = talloc_strdup(tcon, service); + if (service != NULL && tcon->smb1.service == NULL) { + return false; + } + + TALLOC_FREE(tcon->smb1.fs_type); + tcon->smb1.fs_type = talloc_strdup(tcon, fs_type); + if (fs_type != NULL && tcon->smb1.fs_type == NULL) { + return false; + } + + return true; +} + +uint32_t smb2cli_tcon_current_id(struct smbXcli_tcon *tcon) +{ + return tcon->smb2.tcon_id; +} + +void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon, + uint32_t tcon_id, + uint8_t type, + uint32_t flags, + uint32_t capabilities, + uint32_t maximal_access) +{ + tcon->smb2.tcon_id = tcon_id; + tcon->smb2.type = type; + tcon->smb2.flags = flags; + tcon->smb2.capabilities = capabilities; + tcon->smb2.maximal_access = maximal_access; +} diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h index 9d4847c7d6..9f4c0bc340 100644 --- a/libcli/smb/smbXcli_base.h +++ b/libcli/smb/smbXcli_base.h @@ -23,6 +23,7 @@ struct smbXcli_conn; struct smbXcli_session; +struct smbXcli_tcon; struct smb_trans_enc_state; struct GUID; @@ -270,6 +271,24 @@ NTSTATUS smb2cli_session_set_channel_key(struct smbXcli_session *session, const DATA_BLOB channel_key, const struct iovec *recv_iov); +struct smbXcli_tcon *smbXcli_tcon_create(TALLOC_CTX *mem_ctx); +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, + uint16_t tcon_id, + uint16_t optional_support, + uint32_t maximal_access, + uint32_t guest_maximal_access, + const char *service, + const char *fs_type); +uint32_t smb2cli_tcon_current_id(struct smbXcli_tcon *tcon); +void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon, + uint32_t tcon_id, + uint8_t type, + uint32_t flags, + uint32_t capabilities, + uint32_t maximal_access); + struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct smbXcli_conn *conn, |