Module: wine Branch: master Commit: 5b029479379da1a53d76b751de212ed02501f25d URL: http://source.winehq.org/git/wine.git/?a=commit;h=5b029479379da1a53d76b751de...
Author: Juan Lang juan.lang@gmail.com Date: Thu Sep 6 10:00:59 2007 -0700
crypt32: Add special case for certificates with no signature algorithm.
---
dlls/crypt32/chain.c | 5 +++++ dlls/crypt32/tests/chain.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c index 3759877..5af49e6 100644 --- a/dlls/crypt32/chain.c +++ b/dlls/crypt32/chain.c @@ -651,6 +651,11 @@ BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine, SetLastError(E_INVALIDARG); return FALSE; } + if (!pCertContext->pCertInfo->SignatureAlgorithm.pszObjId) + { + SetLastError(ERROR_INVALID_DATA); + return FALSE; + } if (!hChainEngine) hChainEngine = CRYPT_GetDefaultChainEngine(); /* FIXME: what about HCCE_LOCAL_MACHINE? */ diff --git a/dlls/crypt32/tests/chain.c b/dlls/crypt32/tests/chain.c index bf8a1c5..f713c1d 100644 --- a/dlls/crypt32/tests/chain.c +++ b/dlls/crypt32/tests/chain.c @@ -1668,13 +1668,17 @@ static void testGetCertChain(void) */
/* Tests with an invalid cert (one whose signature is bad) */ + SetLastError(0xdeadbeef); ret = CertGetCertificateChain(NULL, cert, NULL, NULL, ¶, 0, NULL, &chain); - ok(!ret, "Expected failure\n"); + ok(!ret && GetLastError() == ERROR_INVALID_DATA, + "Expected ERROR_INVALID_DATA, got %d\n", GetLastError()); para.cbSize = sizeof(para); + SetLastError(0xdeadbeef); ret = CertGetCertificateChain(NULL, cert, NULL, NULL, ¶, 0, NULL, &chain); - ok(!ret, "Expected failure\n"); + ok(!ret && GetLastError() == ERROR_INVALID_DATA, + "Expected ERROR_INVALID_DATA, got %d\n", GetLastError()); CertFreeCertificateContext(cert);
for (i = 0; i < sizeof(chainCheck) / sizeof(chainCheck[0]); i++)