mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
Add explicit buf arg to cli_encrypt_message and cli_calculate_sign_mac
This commit is contained in:
parent
5d30e9f9fe
commit
db6ae9ed23
@ -757,7 +757,7 @@ static NTSTATUS cli_session_setup_ntlmssp(struct cli_state *cli, const char *use
|
||||
|
||||
/* 'resign' the last message, so we get the right sequence numbers
|
||||
for checking the first reply from the server */
|
||||
cli_calculate_sign_mac(cli);
|
||||
cli_calculate_sign_mac(cli, cli->outbuf);
|
||||
|
||||
if (!cli_check_sign_mac(cli)) {
|
||||
nt_status = NT_STATUS_ACCESS_DENIED;
|
||||
|
@ -343,10 +343,11 @@ bool cli_send_smb(struct cli_state *cli)
|
||||
if (cli->fd == -1)
|
||||
return false;
|
||||
|
||||
cli_calculate_sign_mac(cli);
|
||||
cli_calculate_sign_mac(cli, cli->outbuf);
|
||||
|
||||
if (enc_on) {
|
||||
NTSTATUS status = cli_encrypt_message(cli, &buf_out);
|
||||
NTSTATUS status = cli_encrypt_message(cli, cli->outbuf,
|
||||
&buf_out);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
close(cli->fd);
|
||||
cli->fd = -1;
|
||||
|
@ -483,15 +483,15 @@ NTSTATUS cli_decrypt_message(struct cli_state *cli)
|
||||
Encrypt an outgoing buffer. Return the encrypted pointer in buf_out.
|
||||
******************************************************************************/
|
||||
|
||||
NTSTATUS cli_encrypt_message(struct cli_state *cli, char **buf_out)
|
||||
NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out)
|
||||
{
|
||||
/* Ignore non-session messages. */
|
||||
if(CVAL(cli->outbuf,0)) {
|
||||
if (CVAL(buf,0)) {
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/* If we supported multiple encrytion contexts
|
||||
* here we'd look up based on tid.
|
||||
*/
|
||||
return common_encrypt_buffer(cli->trans_enc_state, cli->outbuf, buf_out);
|
||||
return common_encrypt_buffer(cli->trans_enc_state, buf, buf_out);
|
||||
}
|
||||
|
@ -573,9 +573,9 @@ void cli_free_signing_context(struct cli_state *cli)
|
||||
* Sign a packet with the current mechanism
|
||||
*/
|
||||
|
||||
void cli_calculate_sign_mac(struct cli_state *cli)
|
||||
void cli_calculate_sign_mac(struct cli_state *cli, char *buf)
|
||||
{
|
||||
cli->sign_info.sign_outgoing_message(cli->outbuf, &cli->sign_info);
|
||||
cli->sign_info.sign_outgoing_message(buf, &cli->sign_info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user