[PATCH v2 2/5] secur32: Clear SECBUFFER_ALERT output buffer count in schan_InitializeSecurityContextW.
Hans Leidekker
hans at codeweavers.com
Thu Jan 27 04:11:27 CST 2022
From: Connor McAdams <cmcadams at codeweavers.com>
Since we write no data into this buffer, set the count to 0. Otherwise,
some applications assume there has been alert data written into the
buffer.
v2: Remove unneeded check.
Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
dlls/secur32/schannel.c | 6 ++++++
dlls/secur32/tests/schannel.c | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c
index f1b47a78d21..71993e1d2d6 100644
--- a/dlls/secur32/schannel.c
+++ b/dlls/secur32/schannel.c
@@ -894,6 +894,12 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
pInput->pBuffers[1].cbBuffer = pInput->pBuffers[0].cbBuffer-ctx->transport.in.offset;
}
+ for (i = 0; i < pOutput->cBuffers; i++)
+ {
+ SecBuffer *buffer = &pOutput->pBuffers[i];
+ if (buffer->BufferType == SECBUFFER_ALERT) buffer->cbBuffer = 0;
+ }
+
*pfContextAttr = ISC_RET_REPLAY_DETECT | ISC_RET_SEQUENCE_DETECT | ISC_RET_CONFIDENTIALITY | ISC_RET_STREAM;
if (ctx->req_ctx_attr & ISC_REQ_EXTENDED_ERROR) *pfContextAttr |= ISC_RET_EXTENDED_ERROR;
if (ctx->req_ctx_attr & ISC_REQ_DATAGRAM) *pfContextAttr |= ISC_RET_DATAGRAM;
diff --git a/dlls/secur32/tests/schannel.c b/dlls/secur32/tests/schannel.c
index 6c15addf2fc..6fbe0c34bd1 100644
--- a/dlls/secur32/tests/schannel.c
+++ b/dlls/secur32/tests/schannel.c
@@ -700,7 +700,7 @@ static void test_context_output_buffer_size(DWORD protocol, DWORD flags, ULONG c
status = InitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost", ctxt_flags_req,
0, 0, &in_buffers, 0, &context, &out_buffers, &attrs, NULL);
ok(status == SEC_I_CONTINUE_NEEDED, "%d: Expected SEC_I_CONTINUE_NEEDED, got %08x\n", i, status);
- if (i) todo_wine ok(!buffer->cbBuffer, "Expected SECBUFFER_ALERT buffer to be empty\n");
+ if (i) ok(!buffer->cbBuffer, "Expected SECBUFFER_ALERT buffer to be empty\n");
DeleteSecurityContext(&context);
}
@@ -1661,7 +1661,7 @@ static void test_dtls(void)
ok( !exp.LowPart, "got %08x\n", exp.LowPart );
ok( !exp.HighPart, "got %08x\n", exp.HighPart );
ok( buffers[1].pBuffers[1].BufferType == SECBUFFER_ALERT, "Expected buffertype SECBUFFER_ALERT, got %#x\n", buffers[1].pBuffers[1].BufferType);
- todo_wine ok( !buffers[1].pBuffers[1].cbBuffer, "Expected SECBUFFER_ALERT buffer to be empty, got %#x\n", buffers[1].pBuffers[1].cbBuffer);
+ ok( !buffers[1].pBuffers[1].cbBuffer, "Expected SECBUFFER_ALERT buffer to be empty, got %#x\n", buffers[1].pBuffers[1].cbBuffer);
prev_buf_len = buffers[1].pBuffers[0].cbBuffer;
/*
--
2.30.2
More information about the wine-devel
mailing list