1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

libcli/smb: add smbXcli_tcon structure

Signed-off-by: Luk Claes <luk@debian.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Luk Claes 2012-06-02 18:03:20 +02:00 committed by Stefan Metzmacher
parent 20e4392b25
commit 552dda970c
2 changed files with 108 additions and 0 deletions

View File

@ -35,6 +35,7 @@
struct smbXcli_conn; struct smbXcli_conn;
struct smbXcli_req; struct smbXcli_req;
struct smbXcli_session; struct smbXcli_session;
struct smbXcli_tcon;
struct smbXcli_conn { struct smbXcli_conn {
int read_fd; int read_fd;
@ -150,6 +151,25 @@ struct smbXcli_session {
} smb2; } 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 smbXcli_req_state {
struct tevent_context *ev; struct tevent_context *ev;
struct smbXcli_conn *conn; struct smbXcli_conn *conn;
@ -4535,3 +4555,72 @@ NTSTATUS smb2cli_session_set_channel_key(struct smbXcli_session *session,
return NT_STATUS_OK; 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;
}

View File

@ -23,6 +23,7 @@
struct smbXcli_conn; struct smbXcli_conn;
struct smbXcli_session; struct smbXcli_session;
struct smbXcli_tcon;
struct smb_trans_enc_state; struct smb_trans_enc_state;
struct GUID; struct GUID;
@ -270,6 +271,24 @@ NTSTATUS smb2cli_session_set_channel_key(struct smbXcli_session *session,
const DATA_BLOB channel_key, const DATA_BLOB channel_key,
const struct iovec *recv_iov); 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_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev, struct tevent_context *ev,
struct smbXcli_conn *conn, struct smbXcli_conn *conn,