crypt32: Fix a string test.
This commit is contained in:
parent
7d5099e4fc
commit
a0207c88a7
|
@ -1074,7 +1074,8 @@ BOOL WINAPI CertStrToNameW(DWORD dwCertEncodingType, LPCWSTR pszX500,
|
|||
static const WCHAR commaSep[] = { ',',0 };
|
||||
static const WCHAR semiSep[] = { ';',0 };
|
||||
static const WCHAR crlfSep[] = { '\r','\n',0 };
|
||||
static const WCHAR allSeps[] = { ',',';','\r','\n',0 };
|
||||
static const WCHAR allSepsWithoutPlus[] = { ',',';','\r','\n',0 };
|
||||
static const WCHAR allSeps[] = { '+',',',';','\r','\n',0 };
|
||||
LPCWSTR sep;
|
||||
|
||||
str++;
|
||||
|
@ -1084,6 +1085,8 @@ BOOL WINAPI CertStrToNameW(DWORD dwCertEncodingType, LPCWSTR pszX500,
|
|||
sep = semiSep;
|
||||
else if (dwStrType & CERT_NAME_STR_CRLF_FLAG)
|
||||
sep = crlfSep;
|
||||
else if (dwStrType & CERT_NAME_STR_NO_PLUS_FLAG)
|
||||
sep = allSepsWithoutPlus;
|
||||
else
|
||||
sep = allSeps;
|
||||
ret = CRYPT_GetNextValueW(str, dwStrType, sep, &token,
|
||||
|
|
|
@ -800,8 +800,36 @@ static void test_CertStrToNameA(void)
|
|||
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
|
||||
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=1+2", 0, NULL, buf,
|
||||
&size, NULL);
|
||||
todo_wine ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
|
||||
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
|
||||
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
|
||||
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=1+2", CERT_NAME_STR_NO_PLUS_FLAG, NULL, buf,
|
||||
&size, NULL);
|
||||
ok(ret && GetLastError() == ERROR_SUCCESS,
|
||||
"Expected ERROR_SUCCESS, got %08x\n", GetLastError());
|
||||
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=1,2", CERT_NAME_STR_NO_QUOTING_FLAG, NULL, buf,
|
||||
&size, NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
|
||||
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
|
||||
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=\"1,2;3,4\"", CERT_NAME_STR_NO_QUOTING_FLAG, NULL, buf,
|
||||
&size, NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
|
||||
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
|
||||
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=abc", 0, NULL, buf,
|
||||
&size, NULL);
|
||||
ok(ret && GetLastError() == ERROR_SUCCESS,
|
||||
"Expected ERROR_SUCCESS, got %08x\n", GetLastError());
|
||||
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=abc", CERT_NAME_STR_NO_QUOTING_FLAG, NULL, buf,
|
||||
&size, NULL);
|
||||
ok(ret && GetLastError() == ERROR_SUCCESS,
|
||||
"Expected ERROR_SUCCESS, got %08x\n", GetLastError());
|
||||
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=\"abc\"", 0, NULL, buf,
|
||||
&size, NULL);
|
||||
ok(ret && GetLastError() == ERROR_SUCCESS,
|
||||
"Expected ERROR_SUCCESS, got %08x\n", GetLastError());
|
||||
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=\"abc\"", CERT_NAME_STR_NO_QUOTING_FLAG, NULL, buf,
|
||||
&size, NULL);
|
||||
todo_wine ok(!ret && GetLastError() == ERROR_MORE_DATA,
|
||||
"Expected ERROR_MORE_DATA, got %08x\n", GetLastError());
|
||||
for (i = 0; i < sizeof(namesA) / sizeof(namesA[0]); i++)
|
||||
{
|
||||
size = sizeof(buf);
|
||||
|
|
Loading…
Reference in New Issue