Windows: default credentials / fallback credential handling#4743
Windows: default credentials / fallback credential handling#4743ethomson merged 3 commits intolibgit2:masterfrom
Conversation
…nly be one of the supported schemes.
…previously been set to a different mode.
Indeed, the documentation seems clear that this is a single scheme to select. From the MSDN documentation for
I'm surprised that I didn't catch this in testing. 😕 Thanks for the report.
This change makes me more nervous. Ideally, we shouldn't be changing the COM mode out from under our containing process. PythonWin may have selected that carefully and is relying on it for their COM interactions. I'd propose that instead of calling |
|
I don't quite get the problem with the COM initialization. There is no call to As far as I can see there are four different states:
The change is to accept that some other code already set the concurrency model to something else and just go with it. |
Sorry; I misspoke and meant Looking at the MSDN docs, it says that
So my concern is that there's an opportunity here somewhere to change the model out from underneath somebody. However, it's not clear what the "neutral-threaded apartment" is, and reading this article only made me more confused. |
|
😊 I know this one gave me a lot of trouble as well. In the remarks section of the same entry it says:
This sounds a lot more plausible. Otherwise it would be possible to change the model when calling |
|
Cool, thanks @Agent00Log! |
While trying to use pygit2 with my TFS Git I stumbled accross two problems.
Whenever the server reports that it supports the NTLM and Negotiate authentication schemes both of the enum values are combined with the bitwise or assignment and the subsequent call to WinHttpSetCredentials fails.
The second problem was due to the fact that I had the python code running in PythonWin and it seems that PythonWin is setting the apartment state of the thread to single threaded. In this case the call to CoInitializeEx in the fallback credential function fails with the RPC_E_CHANGED_MODE and the fallback default credentials are never set.