[System]: Fix `MonoBtlsProvider.CheckValidationResult ()` logic. (#10396)
commit8ac5b8e5441f8f2b26b56161a4962c997872a9d2
authorMartin Baulig <mabaul@microsoft.com>
Fri, 31 Aug 2018 15:12:16 +0000 (31 17:12 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Fri, 31 Aug 2018 15:12:16 +0000 (31 17:12 +0200)
treeab7af92a91a58b303673400f22f13a7fd2e62030
parent0d7f5778ec9c6f33b94a182f27e22059909af31b
[System]: Fix `MonoBtlsProvider.CheckValidationResult ()` logic. (#10396)

See my comments in https://github.com/mono/mono/pull/10134 for details.

The problem was that
1. It is wrong to assume that `chain != null`.  In fact, it likely won't be if `wantsChain == false`.
2. Similarly, the `storeCtx` should only be used if `storeCtx != NULL && wantsChain == true`.
3. It was missing `MonoBtlsX509Error.HOSTNAME_MISMATCH`.
4. I reformatted and re-indented the method to match Mono's style.
mcs/class/System/Mono.Btls/MonoBtlsProvider.cs