mirror of
https://github.com/wine-mirror/wine
synced 2024-07-08 20:06:18 +00:00
crypt32: Simplified getting context expiration.
This commit is contained in:
parent
70628f80c0
commit
e739f040c0
|
@ -1424,61 +1424,24 @@ static BOOL CRYPT_GetCreateFunction(LPCSTR pszObjectOid,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef BOOL (*get_object_expiration_func)(const void *pvContext,
|
static BOOL CRYPT_GetExpiration(const void *object, const char *pszObjectOid, FILETIME *expiration)
|
||||||
FILETIME *expiration);
|
|
||||||
|
|
||||||
static BOOL CRYPT_GetExpirationFromCert(const void *pvObject, FILETIME *expiration)
|
|
||||||
{
|
{
|
||||||
PCCERT_CONTEXT cert = pvObject;
|
if (!IS_INTOID(pszObjectOid))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
*expiration = cert->pCertInfo->NotAfter;
|
switch (LOWORD(pszObjectOid)) {
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL CRYPT_GetExpirationFromCRL(const void *pvObject, FILETIME *expiration)
|
|
||||||
{
|
|
||||||
PCCRL_CONTEXT cert = pvObject;
|
|
||||||
|
|
||||||
*expiration = cert->pCrlInfo->NextUpdate;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL CRYPT_GetExpirationFromCTL(const void *pvObject, FILETIME *expiration)
|
|
||||||
{
|
|
||||||
PCCTL_CONTEXT cert = pvObject;
|
|
||||||
|
|
||||||
*expiration = cert->pCtlInfo->NextUpdate;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL CRYPT_GetExpirationFunction(LPCSTR pszObjectOid,
|
|
||||||
get_object_expiration_func *getExpiration)
|
|
||||||
{
|
|
||||||
BOOL ret;
|
|
||||||
|
|
||||||
if (IS_INTOID(pszObjectOid))
|
|
||||||
{
|
|
||||||
switch (LOWORD(pszObjectOid))
|
|
||||||
{
|
|
||||||
case LOWORD(CONTEXT_OID_CERTIFICATE):
|
case LOWORD(CONTEXT_OID_CERTIFICATE):
|
||||||
*getExpiration = CRYPT_GetExpirationFromCert;
|
*expiration = ((const CERT_CONTEXT*)object)->pCertInfo->NotAfter;
|
||||||
ret = TRUE;
|
return TRUE;
|
||||||
break;
|
|
||||||
case LOWORD(CONTEXT_OID_CRL):
|
case LOWORD(CONTEXT_OID_CRL):
|
||||||
*getExpiration = CRYPT_GetExpirationFromCRL;
|
*expiration = ((const CRL_CONTEXT*)object)->pCrlInfo->NextUpdate;
|
||||||
ret = TRUE;
|
return TRUE;
|
||||||
break;
|
|
||||||
case LOWORD(CONTEXT_OID_CTL):
|
case LOWORD(CONTEXT_OID_CTL):
|
||||||
*getExpiration = CRYPT_GetExpirationFromCTL;
|
*expiration = ((const CTL_CONTEXT*)object)->pCtlInfo->NextUpdate;
|
||||||
ret = TRUE;
|
return TRUE;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ret = FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
return FALSE;
|
||||||
ret = FALSE;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -1511,21 +1474,17 @@ BOOL WINAPI CryptRetrieveObjectByUrlW(LPCWSTR pszURL, LPCSTR pszObjectOid,
|
||||||
CRYPT_BLOB_ARRAY object = { 0, NULL };
|
CRYPT_BLOB_ARRAY object = { 0, NULL };
|
||||||
PFN_FREE_ENCODED_OBJECT_FUNC freeObject;
|
PFN_FREE_ENCODED_OBJECT_FUNC freeObject;
|
||||||
void *freeContext;
|
void *freeContext;
|
||||||
|
FILETIME expires;
|
||||||
|
|
||||||
ret = retrieve(pszURL, pszObjectOid, dwRetrievalFlags, dwTimeout,
|
ret = retrieve(pszURL, pszObjectOid, dwRetrievalFlags, dwTimeout,
|
||||||
&object, &freeObject, &freeContext, hAsyncRetrieve, pCredentials,
|
&object, &freeObject, &freeContext, hAsyncRetrieve, pCredentials,
|
||||||
pAuxInfo);
|
pAuxInfo);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
get_object_expiration_func getExpiration;
|
|
||||||
|
|
||||||
ret = create(pszObjectOid, dwRetrievalFlags, &object, ppvObject);
|
ret = create(pszObjectOid, dwRetrievalFlags, &object, ppvObject);
|
||||||
if (ret && !(dwRetrievalFlags & CRYPT_DONT_CACHE_RESULT) &&
|
if (ret && !(dwRetrievalFlags & CRYPT_DONT_CACHE_RESULT) &&
|
||||||
CRYPT_GetExpirationFunction(pszObjectOid, &getExpiration))
|
CRYPT_GetExpiration(*ppvObject, pszObjectOid, &expires))
|
||||||
{
|
{
|
||||||
FILETIME expires;
|
|
||||||
|
|
||||||
if (getExpiration(*ppvObject, &expires))
|
|
||||||
CRYPT_CacheURL(pszURL, &object, dwRetrievalFlags, expires);
|
CRYPT_CacheURL(pszURL, &object, dwRetrievalFlags, expires);
|
||||||
}
|
}
|
||||||
freeObject(pszObjectOid, &object, freeContext);
|
freeObject(pszObjectOid, &object, freeContext);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user