summaryrefslogtreecommitdiff
path: root/source4/libcli/auth/ntlmssp_sign.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli/auth/ntlmssp_sign.c')
-rw-r--r--source4/libcli/auth/ntlmssp_sign.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/source4/libcli/auth/ntlmssp_sign.c b/source4/libcli/auth/ntlmssp_sign.c
index d680da9495..385ea18cd2 100644
--- a/source4/libcli/auth/ntlmssp_sign.c
+++ b/source4/libcli/auth/ntlmssp_sign.c
@@ -117,6 +117,8 @@ static NTSTATUS ntlmssp_make_packet_signature(struct ntlmssp_state *ntlmssp_stat
enum ntlmssp_direction direction,
DATA_BLOB *sig)
{
+ NTSTATUS nt_status;
+
if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) {
HMACMD5Context ctx;
@@ -155,9 +157,18 @@ static NTSTATUS ntlmssp_make_packet_signature(struct ntlmssp_state *ntlmssp_stat
} else {
uint32_t crc;
+
crc = crc32_calc_buffer((const char *)data, length);
- if (!msrpc_gen(sig_mem_ctx, sig, "dddd", NTLMSSP_SIGN_VERSION, 0, crc, ntlmssp_state->ntlmssp_seq_num)) {
- return NT_STATUS_NO_MEMORY;
+
+ nt_status = ndr_push_format_blob(sig, sig_mem_ctx,
+ "dddd",
+ NTLMSSP_SIGN_VERSION,
+ 0,
+ crc,
+ ntlmssp_state->ntlmssp_seq_num);
+
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ return nt_status;
}
dump_data_pw("ntlmssp hash:\n", ntlmssp_state->ntlmssp_hash,
@@ -264,7 +275,9 @@ NTSTATUS ntlmssp_seal_packet(struct ntlmssp_state *ntlmssp_state,
TALLOC_CTX *sig_mem_ctx,
uint8_t *data, size_t length,
DATA_BLOB *sig)
-{
+{
+ NTSTATUS nt_status;
+
if (!ntlmssp_state->session_key.length) {
DEBUG(3, ("NO session key, cannot seal packet\n"));
return NT_STATUS_NO_USER_SESSION_KEY;
@@ -300,9 +313,18 @@ NTSTATUS ntlmssp_seal_packet(struct ntlmssp_state *ntlmssp_state,
memcpy(sig->data + 12, seq_num, 4);
} else {
uint32_t crc;
+
crc = crc32_calc_buffer((const char *)data, length);
- if (!msrpc_gen(sig_mem_ctx, sig, "dddd", NTLMSSP_SIGN_VERSION, 0, crc, ntlmssp_state->ntlmssp_seq_num)) {
- return NT_STATUS_NO_MEMORY;
+
+ nt_status = ndr_push_format_blob(sig, sig_mem_ctx,
+ "dddd",
+ NTLMSSP_SIGN_VERSION,
+ 0,
+ crc,
+ ntlmssp_state->ntlmssp_seq_num);
+
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ return nt_status;
}
/* The order of these two operations matters - we must first seal the packet,