InitializeSecurityContext(Schannel)不改变BufferType

所以我有以下代码:

SecBuffer input_buffers[2]; SecBuffer output_buffers[2]; ULONG context_attributes; /* we need to try and perform the second (next) step of the init */ input_buffers[0].cbBuffer = tls_io_instance->received_byte_count; input_buffers[0].BufferType = SECBUFFER_TOKEN; input_buffers[0].pvBuffer = (void*)tls_io_instance->received_bytes; input_buffers[1].cbBuffer = 0; input_buffers[1].BufferType = SECBUFFER_EMPTY; input_buffers[1].pvBuffer = 0; SecBufferDesc input_buffers_desc; input_buffers_desc.cBuffers = 2; input_buffers_desc.pBuffers = input_buffers; input_buffers_desc.ulVersion = SECBUFFER_VERSION; output_buffers[0].cbBuffer = 0; output_buffers[0].BufferType = SECBUFFER_TOKEN; output_buffers[0].pvBuffer = NULL; output_buffers[1].cbBuffer = 0; output_buffers[1].BufferType = SECBUFFER_EMPTY; output_buffers[1].pvBuffer = 0; SecBufferDesc output_buffers_desc; output_buffers_desc.cBuffers = 2; output_buffers_desc.pBuffers = output_buffers; output_buffers_desc.ulVersion = SECBUFFER_VERSION; unsigned long flags = ISC_REQ_EXTENDED_ERROR | ISC_REQ_STREAM | ISC_REQ_ALLOCATE_MEMORY | ISC_REQ_USE_SUPPLIED_CREDS; SECURITY_STATUS status = InitializeSecurityContext(&tls_io_instance->credential_handle, &tls_io_instance->security_context, (SEC_CHAR*)tls_io_instance->host_name, flags, 0, 0, &input_buffers_desc, 0, &tls_io_instance->security_context, &output_buffers_desc, &context_attributes, NULL); 

问题是,在Windows 8.1Windows 10平台上执行此代码后, input_buffers[1].BufferType设置为4 。 如果它在Windows Server 2012 R2上执行, input_buffers[1].BufferType保持0(SECBUFFER_MISSING),并最终出现错误。 有谁知道为什么InitializeSecurityContext(Schannel)函数不改变Windows Server上的input_buffers[1]的types?

我真的很感激你可以提供任何帮助。

在两个平台(-2146893032)上返回的编辑1状态是相同的,只是在Win 8.1 / 10函数中改变了input_buffers[1].BufferType为4。

编辑2在Win 8.1 / 10它进入这种情况下的其他分支选项,并在Win Server 2012 R2中进入如果分支..在所有平台上状态设置为SEC_E_INCOMPLETE_MESSAGE(-2146893032)

  switch (status) { case SEC_E_INCOMPLETE_MESSAGE: if (input_buffers[1].BufferType != SECBUFFER_MISSING) { tls_io_instance->tlsio_state = TLSIO_STATE_ERROR; if (tls_io_instance->on_io_open_complete != NULL) { tls_io_instance->on_io_open_complete(tls_io_instance->open_callback_context, IO_OPEN_ERROR); } } else { tls_io_instance->needed_bytes = input_buffers[1].cbBuffer; tls_io_instance->consumed_bytes += tls_io_instance->needed_bytes; if (resize_receive_buffer(tls_io_instance, tls_io_instance->received_byte_count + tls_io_instance->needed_bytes) != 0) { tls_io_instance->tlsio_state = TLSIO_STATE_ERROR; if (tls_io_instance->on_io_open_complete != NULL) { tls_io_instance->on_io_open_complete(tls_io_instance->open_callback_context, IO_OPEN_ERROR); } } } 

Solutions Collecting From Web of "InitializeSecurityContext(Schannel)不改变BufferType"

好的,所以我联系了创作者,看起来这是他们的实用程序库代码中的一个错误,他们在实用程序库的开发者分支中修正了它们,并且正在对它进行测试。 谢谢大家的回复!