crypt32: Support add disposition CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES.

oldstable
Juan Lang 2008-12-22 10:55:43 -08:00 committed by Alexandre Julliard
parent f2b9832518
commit cefe88208d
2 changed files with 61 additions and 0 deletions

View File

@ -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;

View File

@ -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;