Module: wine Branch: master Commit: cefe88208df878bd0d237c1b433ea453e4404438 URL: http://source.winehq.org/git/wine.git/?a=commit;h=cefe88208df878bd0d237c1b43...
Author: Juan Lang juan.lang@gmail.com Date: Mon Dec 22 10:55:43 2008 -0800
crypt32: Support add disposition CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES.
---
dlls/crypt32/ctl.c | 21 +++++++++++++++++++++ dlls/crypt32/store.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c index ffac667..65691bb 100644 --- a/dlls/crypt32/ctl.c +++ b/dlls/crypt32/ctl.c @@ -82,6 +82,27 @@ BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore, else toAdd = CertDuplicateCTLContext(pCtlContext); break; + case CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES: + if (existing) + { + LONG newer = CompareFileTime(&existing->pCtlInfo->ThisUpdate, + &pCtlContext->pCtlInfo->ThisUpdate); + + if (newer < 0) + { + toAdd = CertDuplicateCTLContext(pCtlContext); + CtlContext_CopyProperties(existing, pCtlContext); + } + else + { + TRACE("existing CTL is newer, not adding\n"); + SetLastError(CRYPT_E_EXISTS); + ret = FALSE; + } + } + else + toAdd = CertDuplicateCTLContext(pCtlContext); + break; case CERT_STORE_ADD_REPLACE_EXISTING: toAdd = CertDuplicateCTLContext(pCtlContext); break; diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 1519c96..3b42893 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -893,6 +893,25 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, else toAdd = CertDuplicateCertificateContext(pCertContext); break; + case CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES: + if (existing) + { + if (CompareFileTime(&existing->pCertInfo->NotBefore, + &pCertContext->pCertInfo->NotBefore) >= 0) + { + TRACE("existing certificate is newer, not adding\n"); + SetLastError(CRYPT_E_EXISTS); + ret = FALSE; + } + else + { + toAdd = CertDuplicateCertificateContext(pCertContext); + CertContext_CopyProperties(toAdd, existing); + } + } + else + toAdd = CertDuplicateCertificateContext(pCertContext); + break; default: FIXME("Unimplemented add disposition %d\n", dwAddDisposition); SetLastError(E_INVALIDARG); @@ -1016,6 +1035,27 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, else toAdd = CertDuplicateCRLContext(pCrlContext); break; + case CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES: + if (existing) + { + LONG newer = CompareFileTime(&existing->pCrlInfo->ThisUpdate, + &pCrlContext->pCrlInfo->ThisUpdate); + + if (newer < 0) + { + toAdd = CertDuplicateCRLContext(pCrlContext); + CrlContext_CopyProperties(toAdd, existing); + } + else + { + TRACE("existing CRL is newer, not adding\n"); + SetLastError(CRYPT_E_EXISTS); + ret = FALSE; + } + } + else + toAdd = CertDuplicateCRLContext(pCrlContext); + break; case CERT_STORE_ADD_REPLACE_EXISTING: toAdd = CertDuplicateCRLContext(pCrlContext); break;