crypt32: Implement CertGetNameStringW for CERT_NAME_DNS_TYPE.

This commit is contained in:
Juan Lang 2009-09-08 22:11:40 -07:00 committed by Alexandre Julliard
parent 6dfe7bc3a6
commit 2fe736d928

View File

@ -1130,6 +1130,30 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType,
cchNameString);
break;
}
case CERT_NAME_DNS_TYPE:
{
CERT_ALT_NAME_INFO *info;
PCERT_ALT_NAME_ENTRY entry = cert_find_alt_name_entry(pCertContext,
altNameOID, CERT_ALT_NAME_DNS_NAME, &info);
if (entry)
{
if (!pszNameString)
ret = strlenW(entry->pwszDNSName) + 1;
else
{
ret = min(strlenW(entry->pwszDNSName), cchNameString - 1);
memcpy(pszNameString, entry->pwszDNSName, ret * sizeof(WCHAR));
pszNameString[ret++] = 0;
}
}
if (info)
LocalFree(info);
if (!ret)
ret = cert_get_name_from_rdn_attr(pCertContext->dwCertEncodingType,
name, szOID_COMMON_NAME, pszNameString, cchNameString);
break;
}
default:
FIXME("unimplemented for type %d\n", dwType);
ret = 0;