mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s3: libsmb: Widen cli_state_get_tid() / cli_state_set_tid() to 32-bits.
Copes with SMB2 connections. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12831 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
This commit is contained in:
parent
5c0efc9a5e
commit
93fa0c8660
@ -4712,7 +4712,10 @@ static int cmd_tid(void)
|
||||
d_printf("no tcon currently\n");
|
||||
}
|
||||
} else {
|
||||
uint16_t tid = atoi(tid_str);
|
||||
uint32_t tid = atoi(tid_str);
|
||||
if (!cli_state_has_tcon(cli)) {
|
||||
d_printf("no tcon currently\n");
|
||||
}
|
||||
cli_state_set_tid(cli, tid);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli,
|
||||
enum lsa_SidType *type,
|
||||
char **domain, char **name)
|
||||
{
|
||||
uint16_t orig_cnum = cli_state_get_tid(cli);
|
||||
uint32_t orig_cnum = cli_state_get_tid(cli);
|
||||
struct rpc_pipe_client *p = NULL;
|
||||
struct policy_handle handle;
|
||||
NTSTATUS status;
|
||||
@ -165,7 +165,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli,
|
||||
enum lsa_SidType *type,
|
||||
struct dom_sid *sid)
|
||||
{
|
||||
uint16_t orig_cnum = cli_state_get_tid(cli);
|
||||
uint32_t orig_cnum = cli_state_get_tid(cli);
|
||||
struct rpc_pipe_client *p;
|
||||
struct policy_handle handle;
|
||||
NTSTATUS status;
|
||||
|
@ -1205,7 +1205,7 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
|
||||
size_t consumed = 0;
|
||||
char *fullpath = NULL;
|
||||
bool res;
|
||||
uint16_t cnum;
|
||||
uint32_t cnum;
|
||||
char *newextrapath = NULL;
|
||||
NTSTATUS status;
|
||||
const char *remote_name;
|
||||
|
@ -341,7 +341,7 @@ uint32_t cli_getpid(struct cli_state *cli)
|
||||
|
||||
bool cli_state_has_tcon(struct cli_state *cli)
|
||||
{
|
||||
uint16_t tid = cli_state_get_tid(cli);
|
||||
uint32_t tid = cli_state_get_tid(cli);
|
||||
|
||||
if (tid == UINT16_MAX) {
|
||||
return false;
|
||||
@ -350,15 +350,25 @@ bool cli_state_has_tcon(struct cli_state *cli)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16_t cli_state_get_tid(struct cli_state *cli)
|
||||
uint32_t cli_state_get_tid(struct cli_state *cli)
|
||||
{
|
||||
return smb1cli_tcon_current_id(cli->smb1.tcon);
|
||||
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
return smb2cli_tcon_current_id(cli->smb2.tcon);
|
||||
} else {
|
||||
return (uint32_t)smb1cli_tcon_current_id(cli->smb1.tcon);
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid)
|
||||
uint32_t cli_state_set_tid(struct cli_state *cli, uint32_t tid)
|
||||
{
|
||||
uint16_t ret = smb1cli_tcon_current_id(cli->smb1.tcon);
|
||||
smb1cli_tcon_set_id(cli->smb1.tcon, tid);
|
||||
uint32_t ret;
|
||||
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
ret = smb2cli_tcon_current_id(cli->smb2.tcon);
|
||||
smb2cli_tcon_set_id(cli->smb1.tcon, tid);
|
||||
} else {
|
||||
ret = smb1cli_tcon_current_id(cli->smb1.tcon);
|
||||
smb1cli_tcon_set_id(cli->smb1.tcon, tid);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -194,8 +194,8 @@ uint16_t cli_state_get_vc_num(struct cli_state *cli);
|
||||
uint32_t cli_setpid(struct cli_state *cli, uint32_t pid);
|
||||
uint32_t cli_getpid(struct cli_state *cli);
|
||||
bool cli_state_has_tcon(struct cli_state *cli);
|
||||
uint16_t cli_state_get_tid(struct cli_state *cli);
|
||||
uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
|
||||
uint32_t cli_state_get_tid(struct cli_state *cli);
|
||||
uint32_t cli_state_set_tid(struct cli_state *cli, uint32_t tid);
|
||||
struct smbXcli_tcon;
|
||||
struct smbXcli_tcon *cli_state_save_tcon(struct cli_state *cli);
|
||||
void cli_state_restore_tcon(struct cli_state *cli, struct smbXcli_tcon *tcon);
|
||||
|
@ -1301,7 +1301,7 @@ static bool run_tcon_test(int dummy)
|
||||
static struct cli_state *cli;
|
||||
const char *fname = "\\tcontest.tmp";
|
||||
uint16_t fnum1;
|
||||
uint16_t cnum1, cnum2, cnum3;
|
||||
uint32_t cnum1, cnum2, cnum3;
|
||||
uint16_t vuid1, vuid2;
|
||||
char buf[4];
|
||||
bool ret = True;
|
||||
@ -2764,8 +2764,8 @@ static bool run_fdsesstest(int dummy)
|
||||
struct cli_state *cli;
|
||||
uint16_t new_vuid;
|
||||
uint16_t saved_vuid;
|
||||
uint16_t new_cnum;
|
||||
uint16_t saved_cnum;
|
||||
uint32_t new_cnum;
|
||||
uint32_t saved_cnum;
|
||||
const char *fname = "\\fdsess.tst";
|
||||
const char *fname1 = "\\fdsess1.tst";
|
||||
uint16_t fnum1;
|
||||
@ -9015,7 +9015,7 @@ static bool run_uid_regression_test(int dummy)
|
||||
{
|
||||
static struct cli_state *cli;
|
||||
int16_t old_vuid;
|
||||
int16_t old_cnum;
|
||||
int32_t old_cnum;
|
||||
bool correct = True;
|
||||
NTSTATUS status;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user