static SECURITY_STATUS (SEC_ENTRY * pQuerySecurityPackageInfoA)(SEC_CHAR*, PSecPkgInfoA*);
static SECURITY_STATUS (SEC_ENTRY * pAcquireCredentialsHandleA)(SEC_CHAR*, SEC_CHAR*,
ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID, PCredHandle, PTimeStamp);
+static SECURITY_STATUS (SEC_ENTRY * pAcquireCredentialsHandleW)(SEC_CHAR*, SEC_WCHAR*,
+ ULONG, PLUID, void*, SEC_GET_KEY_FN, void*, CredHandle*, TimeStamp*);
static SECURITY_STATUS (SEC_ENTRY * pInitializeSecurityContextA)(PCredHandle, PCtxtHandle,
SEC_CHAR*, ULONG, ULONG, ULONG, PSecBufferDesc, ULONG,
PCtxtHandle, PSecBufferDesc, PULONG, PTimeStamp);
{0xc8, 0xf2, 0x39, 0x7f, 0x0c, 0xaf, 0xf5, 0x5d, 0xef, 0x0c,
0x8b, 0x5f, 0x82};
+static char test_user[] = "testuser",
+ workgroup[] = "WORKGROUP",
+ test_pass[] = "testpass",
+ sec_pkg_name[] = "NTLM";
+
static void InitFunctionPtrs(void)
{
secdll = LoadLibraryA("secur32.dll");
pFreeContextBuffer = (PVOID)GetProcAddress(secdll, "FreeContextBuffer");
pQuerySecurityPackageInfoA = (PVOID)GetProcAddress(secdll, "QuerySecurityPackageInfoA");
pAcquireCredentialsHandleA = (PVOID)GetProcAddress(secdll, "AcquireCredentialsHandleA");
+ pAcquireCredentialsHandleW = (void*)GetProcAddress(secdll, "AcquireCredentialsHandleW");
pInitializeSecurityContextA = (PVOID)GetProcAddress(secdll, "InitializeSecurityContextA");
pCompleteAuthToken = (PVOID)GetProcAddress(secdll, "CompleteAuthToken");
pAcceptSecurityContext = (PVOID)GetProcAddress(secdll, "AcceptSecurityContext");
trace("AcquireCredentialsHandle() returned %s\n", getSecError(ret));
}
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
return ret;
trace("AcquireCredentialsHandle() returned %s\n", getSecError(ret));
}
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
return ret;
PSecPkgInfoA pkg_info = NULL;
SspiData client;
SEC_WINNT_AUTH_IDENTITY_A id;
- static char sec_pkg_name[] = "NTLM",
- test_user[] = "testuser",
- workgroup[] = "WORKGROUP",
- test_pass[] = "testpass";
ULONG req_attr, ctxt_attr;
TimeStamp ttl;
PBYTE packet;
SspiData client, server;
SEC_WINNT_AUTH_IDENTITY_A id;
SecPkgContext_Sizes ctxt_sizes;
- static char sec_pkg_name[] = "NTLM",
- test_user[] = "testuser",
- workgroup[] = "WORKGROUP",
- test_pass[] = "testpass";
if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info)!= SEC_E_OK)
{
SecBuffer data[2], fake_data[2], complex_data[4];
ULONG qop = 0xdeadbeef;
SecPkgContext_Sizes ctxt_sizes;
- static char test_user[] = "testuser",
- workgroup[] = "WORKGROUP",
- test_pass[] = "testpass";
complex_data[1].pvBuffer = complex_data[3].pvBuffer = NULL;
{
CredHandle cred;
TimeStamp ttl;
- static char test_user[] = "testuser",
- workgroup[] = "WORKGROUP",
- test_pass[] = "testpass",
- sec_pkg_name[] = "NTLM";
SECURITY_STATUS ret;
SEC_WINNT_AUTH_IDENTITY_A id;
PSecPkgInfoA pkg_info = NULL;
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
pFreeCredentialsHandle(&cred);
id.DomainLength = 0;
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
pFreeCredentialsHandle(&cred);
id.Domain = NULL;
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
pFreeCredentialsHandle(&cred);
id.User = NULL;
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
pFreeCredentialsHandle(&cred);
id.PasswordLength = 0;
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
pFreeCredentialsHandle(&cred);
return TRUE;
}
+static void testAcquireCredentialsHandleW(void)
+{
+ CredHandle cred;
+ TimeStamp ttl;
+ static WCHAR sec_pkg_nameW[] = {'N','T','L','M',0 };
+ static WCHAR test_userW[] = {'t','e','s','t','u','s','e','r',0 };
+ static WCHAR workgroupW[] = {'W','O','R','K','G','R','O','U','P',0};
+ static WCHAR test_passW[] = {'t','e','s','t','p','a','s','s',0};
+ SECURITY_STATUS ret;
+ SEC_WINNT_AUTH_IDENTITY_A idA;
+ SEC_WINNT_AUTH_IDENTITY_W id;
+ PSecPkgInfoA pkg_info = NULL;
+
+ if(!pAcquireCredentialsHandleW)
+ {
+ win_skip("AcquireCredentialsHandleW not available\n");
+ return;
+ }
+
+ if(pQuerySecurityPackageInfoA(sec_pkg_name, &pkg_info) != SEC_E_OK)
+ {
+ ok(0, "NTLM package not installed, skipping test\n");
+ return;
+ }
+ pFreeContextBuffer(pkg_info);
+
+ id.User = test_userW;
+ id.UserLength = lstrlenW(test_userW);
+ id.Domain = workgroupW;
+ id.DomainLength = lstrlenW(workgroupW);
+ id.Password = test_passW;
+ id.PasswordLength = lstrlenW(test_passW);
+ id.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
+
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &id, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+
+ id.DomainLength = 0;
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &id, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+
+ id.Domain = NULL;
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &id, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+
+ id.Domain = workgroupW;
+ id.DomainLength = lstrlenW(workgroupW);
+ id.UserLength = 0;
+ id.User = NULL;
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &id, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+
+ id.User = test_userW;
+ id.UserLength = lstrlenW(test_userW);
+ id.Password = test_passW; /* NULL string causes a crash. */
+ id.PasswordLength = 0;
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &id, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+
+ /* Test using the ASCII structure. */
+ idA.User = (unsigned char*) test_user;
+ idA.UserLength = strlen(test_user);
+ idA.Domain = (unsigned char *) workgroup;
+ idA.DomainLength = strlen(workgroup);
+ idA.Password = (unsigned char*) test_pass;
+ idA.PasswordLength = strlen(test_pass);
+ idA.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
+
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &idA, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+}
+
static void test_cred_multiple_use(void)
{
- static char test_user[] = "testuser",
- workgroup[] = "WORKGROUP",
- test_pass[] = "testpass",
- sec_pkg_name[] = "NTLM";
SECURITY_STATUS ret;
SEC_WINNT_AUTH_IDENTITY_A id;
PSecPkgInfoA pkg_info = NULL;
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
buffer_desc.ulVersion = SECBUFFER_VERSION;
status = pAcquireCredentialsHandleA(NULL, (SEC_CHAR *)"NTLM", SECPKG_CRED_OUTBOUND,
NULL, NULL, NULL, NULL, &cred, &ttl);
- ok(status == SEC_E_OK, "AcquireCredentialsHande() failed %s\n", getSecError(status));
+ ok(status == SEC_E_OK, "AcquireCredentialsHandle() failed %s\n", getSecError(status));
buffers[0].cbBuffer = info->cbMaxToken;
buffers[0].BufferType = SECBUFFER_TOKEN;
pAcquireCredentialsHandleA && pInitializeSecurityContextA &&
pCompleteAuthToken && pQuerySecurityPackageInfoA)
{
+ testAcquireCredentialsHandleW();
+
if(!testAcquireCredentialsHandle())
goto cleanup;
testInitializeSecurityContextFlags();