Fix getting and setting credentials from Windows - #7
Open
hawkeye116477 wants to merge 2 commits into
Open
Conversation
| return credential?.CredentialBlobSize == 0 | ||
| ? null | ||
| : Marshal.PtrToStringUni(credential?.CredentialBlob ?? IntPtr.Zero); | ||
| : Marshal.PtrToStringUni(credential?.CredentialBlob ?? IntPtr.Zero, (int)(credential?.CredentialBlobSize ?? 0) / 2).TrimEnd('\0'); |
Member
There was a problem hiding this comment.
Can you please add a unit test that demonstrates the need for this change?
Also, why divide by 2, and trim the null character at the end?
Author
There was a problem hiding this comment.
I added trimming null character, cuz Sil when setting password for some reason always added it, while that shouldn't happen (#8 fixes that case).
Dividing by 2 is needed, cuz we need amount of characters to read and each character takes up 2 bytes.
I done that change, cuz had problem with getting some values by Sil set from python's keyring.
So earlier implementation in some cases would require adding null character at the end to read correctly, which I think shouldn't be done, at least didn't saw that at other implementations.
ermshiperete
added a commit
to ermshiperete/SIL.PasswordStore
that referenced
this pull request
Aug 13, 2026
Using passwords with non-latin characters sometimes failed. Supersedes: sillsdev#7
ermshiperete
added a commit
that referenced
this pull request
Aug 13, 2026
Using passwords with non-latin characters sometimes failed. Co-authored-by: hawkeye116477 <hawkeye116477@gmail.com> Supersedes: #7
ermshiperete
added a commit
that referenced
this pull request
Aug 14, 2026
Using passwords with non-latin characters sometimes failed. Co-authored-by: hawkeye116477 <hawkeye116477@gmail.com> Supersedes: #7
ermshiperete
added a commit
that referenced
this pull request
Aug 14, 2026
Using passwords with non-latin characters sometimes failed. Co-authored-by: hawkeye116477 <hawkeye116477@gmail.com> Supersedes: #7
ermshiperete
added a commit
that referenced
this pull request
Aug 14, 2026
Using passwords with non-latin characters sometimes failed. Co-authored-by: hawkeye116477 <hawkeye116477@gmail.com> Supersedes: #7
ermshiperete
added a commit
that referenced
this pull request
Aug 14, 2026
Using passwords with non-latin characters sometimes failed. Co-authored-by: hawkeye116477 <hawkeye116477@gmail.com> Supersedes: #7
ermshiperete
added a commit
that referenced
this pull request
Aug 18, 2026
Using passwords with non-latin characters sometimes failed. Co-authored-by: hawkeye116477 <hawkeye116477@gmail.com> Supersedes: #7
ermshiperete
added a commit
that referenced
this pull request
Aug 19, 2026
Using passwords with non-latin characters sometimes failed. Co-authored-by: hawkeye116477 <hawkeye116477@gmail.com> Supersedes: #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sometimes it could read too much if no null sign specified at the end, so exact length to read is needed.