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

s3:libsmb: add cli->smb1.vc_num and hide it behind cli_state_get_vc_num()

This makes it clearer, why we send the pid value in the session setup.

metze
This commit is contained in:
Stefan Metzmacher 2011-07-19 12:52:10 +02:00
parent 6c31b610e4
commit 9fb7e228f5
4 changed files with 11 additions and 3 deletions

View File

@ -134,6 +134,7 @@ struct cli_state {
struct {
uint16_t mid;
uint16_t vc_num;
} smb1;
struct {

View File

@ -418,7 +418,7 @@ struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
SSVAL(vwv+1, 0, 0);
SSVAL(vwv+2, 0, CLI_BUFFER_SIZE);
SSVAL(vwv+3, 0, 2);
SSVAL(vwv+4, 0, cli->pid);
SSVAL(vwv+4, 0, cli_state_get_vc_num(cli));
SIVAL(vwv+5, 0, cli->sesskey);
SSVAL(vwv+7, 0, 0);
SSVAL(vwv+8, 0, 0);
@ -637,7 +637,7 @@ static struct tevent_req *cli_session_setup_plain_send(
SSVAL(vwv+1, 0, 0);
SSVAL(vwv+2, 0, CLI_BUFFER_SIZE);
SSVAL(vwv+3, 0, 2);
SSVAL(vwv+4, 0, cli->pid);
SSVAL(vwv+4, 0, cli_state_get_vc_num(cli));
SIVAL(vwv+5, 0, cli->sesskey);
SSVAL(vwv+7, 0, 0);
SSVAL(vwv+8, 0, 0);
@ -985,7 +985,7 @@ static struct tevent_req *cli_session_setup_nt1_send(
SSVAL(vwv+1, 0, 0);
SSVAL(vwv+2, 0, CLI_BUFFER_SIZE);
SSVAL(vwv+3, 0, 2);
SSVAL(vwv+4, 0, cli->pid);
SSVAL(vwv+4, 0, cli_state_get_vc_num(cli));
SIVAL(vwv+5, 0, cli->sesskey);
SSVAL(vwv+7, 0, lm_response.length);
SSVAL(vwv+8, 0, nt_response.length);

View File

@ -240,6 +240,7 @@ struct cli_state *cli_initialise_ex(int signing_state)
cli->initialised = 1;
cli->smb1.mid = 1;
cli->smb1.vc_num = cli->pid;
return cli;
@ -342,6 +343,11 @@ void cli_sockopt(struct cli_state *cli, const char *options)
set_socket_options(cli->fd, options);
}
uint16_t cli_state_get_vc_num(struct cli_state *cli)
{
return cli->smb1.vc_num;
}
/****************************************************************************
Set the PID to use for smb messages. Return the old pid.
****************************************************************************/

View File

@ -164,6 +164,7 @@ struct cli_state *cli_initialise_ex(int signing_state);
void cli_nt_pipes_close(struct cli_state *cli);
void cli_shutdown(struct cli_state *cli);
void cli_sockopt(struct cli_state *cli, const char *options);
uint16_t cli_state_get_vc_num(struct cli_state *cli);
uint16 cli_setpid(struct cli_state *cli, uint16 pid);
bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,