Skip to content

Conversation

@compnerd
Copy link
Member

While we can enumerate the users using NetUserEnum, that does not guarantee that we get the full user information. Perform an explicit NetUserGetInfo to query the user information to get the home directory.

Additionally, correct the CFString handling within the function where we were improperly using CFStringCreateWithBytesNoCopy which requires that the string is 8-bit encoded. We now use
CFStringCreateWithCharacters[NoCopy] to properly create the CFString with unicode characters.

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

CC: @parkera @lorentey

Prefer to use `NetUserGetInfo` over enumerating all users as that is
unnecessary.  Correct the string handling where we used
`CFStringCreateWithBytesNoCopy` which expects the input to be in an
8-bit encoding which we do not use (nor does Windows support for the SAM
access).  This corrects the string manipulation which improves the test
suite pass rate though some errors still remain.
@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test Linux platform

@compnerd compnerd merged commit 0236364 into swiftlang:main Jan 20, 2023
@compnerd compnerd deleted the home-sweet-home branch January 20, 2023 22:05
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.

2 participants