Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(NODE-2129): fix sporadic AcquireCredentialsHandle error #133

Merged
merged 1 commit into from
Jul 16, 2021

Conversation

rose-m
Copy link
Contributor

@rose-m rose-m commented Jul 14, 2021

Fixes a sporadic error that occurred when calling the AcquireCredentialsHandleW SSPI function. This was caused by uninitialized struct members. The authIdentity variable was allocated on the stack but not initialized. Depending on the stack's state, that caused the authIdentity.DomainLength or potentially the authIdentity.Domain members to have unpredictable content. Ensuring proper nulled initialization fixes this.

This PR also includes a fix for a memory leak in the to_wstring function. The allocated output array was never deleteed.

We tested this fix as part of mongosh in a Windows environment with Kerberos.

@addaleax 🙇

@rose-m rose-m self-assigned this Jul 14, 2021
Copy link
Contributor

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@emadum emadum self-requested a review July 15, 2021 21:18
@emadum emadum requested review from dariakp and nbbeeken July 16, 2021 16:28
Copy link
Collaborator

@dariakp dariakp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I defer to people more well-versed in C to review this code

Copy link
Collaborator

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@emadum emadum merged commit adf8346 into master Jul 16, 2021
@emadum emadum deleted the NODE-2129-fix-sporadic-failures-on-windows branch July 16, 2021 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants