[CRYPT32]

sync to wine 1.2 RC2

svn path=/trunk/; revision=47410
This commit is contained in:
Christoph von Wittich 2010-05-29 13:14:05 +00:00
parent c60e69763c
commit c5d6cf73b0
5 changed files with 82 additions and 11 deletions

View file

@ -113,9 +113,21 @@ BOOL WINAPI CertAddCertificateLinkToStore(HCERTSTORE hCertStore,
PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition,
PCCERT_CONTEXT *ppCertContext) PCCERT_CONTEXT *ppCertContext)
{ {
FIXME("(%p, %p, %08x, %p)\n", hCertStore, pCertContext, dwAddDisposition, static int calls;
ppCertContext); PWINECRYPT_CERTSTORE store = (PWINECRYPT_CERTSTORE)hCertStore;
if (!(calls++))
FIXME("(%p, %p, %08x, %p): semi-stub\n", hCertStore, pCertContext,
dwAddDisposition, ppCertContext);
if (store->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
return FALSE; return FALSE;
if (store->type == StoreTypeCollection)
{
SetLastError(E_INVALIDARG);
return FALSE;
}
return CertAddCertificateContextToStore(hCertStore, pCertContext,
dwAddDisposition, ppCertContext);
} }
PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType,

View file

@ -152,6 +152,20 @@ HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root,
return engine; return engine;
} }
typedef struct _CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT
{
DWORD cbSize;
HCERTSTORE hRestrictedRoot;
HCERTSTORE hRestrictedTrust;
HCERTSTORE hRestrictedOther;
DWORD cAdditionalStore;
HCERTSTORE *rghAdditionalStore;
DWORD dwFlags;
DWORD dwUrlRetrievalTimeout;
DWORD MaximumCachedCertificates;
DWORD CycleDetectionModulus;
} CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT;
BOOL WINAPI CertCreateCertificateChainEngine(PCERT_CHAIN_ENGINE_CONFIG pConfig, BOOL WINAPI CertCreateCertificateChainEngine(PCERT_CHAIN_ENGINE_CONFIG pConfig,
HCERTCHAINENGINE *phChainEngine) HCERTCHAINENGINE *phChainEngine)
{ {
@ -159,7 +173,8 @@ BOOL WINAPI CertCreateCertificateChainEngine(PCERT_CHAIN_ENGINE_CONFIG pConfig,
TRACE("(%p, %p)\n", pConfig, phChainEngine); TRACE("(%p, %p)\n", pConfig, phChainEngine);
if (pConfig->cbSize != sizeof(*pConfig)) if (pConfig->cbSize != sizeof(CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT)
&& pConfig->cbSize != sizeof(CERT_CHAIN_ENGINE_CONFIG))
{ {
SetLastError(E_INVALIDARG); SetLastError(E_INVALIDARG);
return FALSE; return FALSE;
@ -171,7 +186,10 @@ BOOL WINAPI CertCreateCertificateChainEngine(PCERT_CHAIN_ENGINE_CONFIG pConfig,
HCERTSTORE root; HCERTSTORE root;
HCERTCHAINENGINE engine; HCERTCHAINENGINE engine;
if (pConfig->hRestrictedRoot) if (pConfig->cbSize >= sizeof(CERT_CHAIN_ENGINE_CONFIG) &&
pConfig->hExclusiveRoot)
root = CertDuplicateStore(pConfig->hExclusiveRoot);
else if (pConfig->hRestrictedRoot)
root = CertDuplicateStore(pConfig->hRestrictedRoot); root = CertDuplicateStore(pConfig->hRestrictedRoot);
else else
root = CertOpenSystemStoreW(0, rootW); root = CertOpenSystemStoreW(0, rootW);
@ -3017,7 +3035,31 @@ static BOOL match_dns_to_subject_alt_name(PCERT_EXTENSION ext,
{ {
TRACE_(chain)("dNSName: %s\n", debugstr_w( TRACE_(chain)("dNSName: %s\n", debugstr_w(
subjectName->rgAltEntry[i].u.pwszDNSName)); subjectName->rgAltEntry[i].u.pwszDNSName));
if (!strcmpiW(server_name, if (subjectName->rgAltEntry[i].u.pwszDNSName[0] == '*')
{
LPCWSTR server_name_dot;
/* Matching a wildcard: a wildcard matches a single name
* component, which is terminated by a dot. RFC 1034
* doesn't define whether multiple wildcards are allowed,
* but I will assume that they are not until proven
* otherwise. RFC 1034 also states that 'the "*" label
* always matches at least one whole label and sometimes
* more, but always whole labels.' Native crypt32 does not
* match more than one label with a wildcard, so I do the
* same here. Thus, a wildcard only accepts the first
* label, then requires an exact match of the remaining
* string.
*/
server_name_dot = strchrW(server_name, '.');
if (server_name_dot)
{
if (!strcmpiW(server_name_dot,
subjectName->rgAltEntry[i].u.pwszDNSName + 1))
matches = TRUE;
}
}
else if (!strcmpiW(server_name,
subjectName->rgAltEntry[i].u.pwszDNSName)) subjectName->rgAltEntry[i].u.pwszDNSName))
matches = TRUE; matches = TRUE;
} }

View file

@ -479,6 +479,10 @@ static BOOL WINAPI CRYPT_RegControl(HCERTSTORE hCertStore, DWORD dwFlags,
ret = CRYPT_RegFlushStore(store, ret = CRYPT_RegFlushStore(store,
dwFlags & CERT_STORE_CTRL_COMMIT_FORCE_FLAG); dwFlags & CERT_STORE_CTRL_COMMIT_FORCE_FLAG);
break; break;
case CERT_STORE_CTRL_AUTO_RESYNC:
FIXME("CERT_STORE_CTRL_AUTO_RESYNC: stub\n");
ret = TRUE;
break;
default: default:
FIXME("%d: stub\n", dwCtrlType); FIXME("%d: stub\n", dwCtrlType);
ret = FALSE; ret = FALSE;

View file

@ -855,7 +855,16 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore,
TRACE("(%p, %p, %08x, %p)\n", hCertStore, pCertContext, TRACE("(%p, %p, %08x, %p)\n", hCertStore, pCertContext,
dwAddDisposition, ppStoreContext); dwAddDisposition, ppStoreContext);
if (dwAddDisposition != CERT_STORE_ADD_ALWAYS) switch (dwAddDisposition)
{
case CERT_STORE_ADD_ALWAYS:
break;
case CERT_STORE_ADD_NEW:
case CERT_STORE_ADD_REPLACE_EXISTING:
case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES:
case CERT_STORE_ADD_USE_EXISTING:
case CERT_STORE_ADD_NEWER:
case CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES:
{ {
BYTE hashToAdd[20]; BYTE hashToAdd[20];
DWORD size = sizeof(hashToAdd); DWORD size = sizeof(hashToAdd);
@ -870,6 +879,12 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore,
pCertContext->dwCertEncodingType, 0, CERT_FIND_SHA1_HASH, &blob, pCertContext->dwCertEncodingType, 0, CERT_FIND_SHA1_HASH, &blob,
NULL); NULL);
} }
break;
}
default:
FIXME("Unimplemented add disposition %d\n", dwAddDisposition);
SetLastError(E_INVALIDARG);
ret = FALSE;
} }
switch (dwAddDisposition) switch (dwAddDisposition)
@ -940,10 +955,6 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore,
else else
toAdd = CertDuplicateCertificateContext(pCertContext); toAdd = CertDuplicateCertificateContext(pCertContext);
break; break;
default:
FIXME("Unimplemented add disposition %d\n", dwAddDisposition);
SetLastError(E_INVALIDARG);
ret = FALSE;
} }
if (toAdd) if (toAdd)

View file

@ -3389,6 +3389,8 @@ typedef struct _CERT_CHAIN_ENGINE_CONFIG
DWORD dwUrlRetrievalTimeout; DWORD dwUrlRetrievalTimeout;
DWORD MaximumCachedCertificates; DWORD MaximumCachedCertificates;
DWORD CycleDetectionModulus; DWORD CycleDetectionModulus;
HCERTSTORE hExclusiveRoot;
HCERTSTORE hExclusiveRootTrustedPeople;
} CERT_CHAIN_ENGINE_CONFIG, *PCERT_CHAIN_ENGINE_CONFIG; } CERT_CHAIN_ENGINE_CONFIG, *PCERT_CHAIN_ENGINE_CONFIG;
/* message-related definitions */ /* message-related definitions */