1 /* 2 * tests 3 * 4 * Copyright 2006 Robert Reif 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 */ 20 #include <stdio.h> 21 #include <stdarg.h> 22 #include <windef.h> 23 #include <winbase.h> 24 #include <winnls.h> 25 #include <rpc.h> 26 #include <rpcdce.h> 27 #define SECURITY_WIN32 28 #include <security.h> 29 #include <schannel.h> 30 #include <wincred.h> 31 #include <winsock2.h> 32 33 #include "wine/test.h" 34 35 static HMODULE secdll; 36 37 static SECURITY_STATUS (SEC_ENTRY *pSspiEncodeAuthIdentityAsStrings) 38 (PSEC_WINNT_AUTH_IDENTITY_OPAQUE, PCWSTR *, PCWSTR *, PCWSTR *); 39 static SECURITY_STATUS (SEC_ENTRY *pSspiEncodeStringsAsAuthIdentity) 40 (PCWSTR, PCWSTR, PCWSTR, PSEC_WINNT_AUTH_IDENTITY_OPAQUE *); 41 static void (SEC_ENTRY *pSspiFreeAuthIdentity) 42 (PSEC_WINNT_AUTH_IDENTITY_OPAQUE); 43 static void (SEC_ENTRY *pSspiLocalFree) 44 (void *); 45 static SECURITY_STATUS (SEC_ENTRY *pSspiPrepareForCredWrite) 46 (PSEC_WINNT_AUTH_IDENTITY_OPAQUE, PCWSTR, PULONG, PCWSTR *, PCWSTR *, PUCHAR *, PULONG); 47 static void (SEC_ENTRY *pSspiZeroAuthIdentity) 48 (PSEC_WINNT_AUTH_IDENTITY_OPAQUE); 49 50 static BOOLEAN (WINAPI * pGetComputerObjectNameA)(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG lpnSize); 51 static BOOLEAN (WINAPI * pGetComputerObjectNameW)(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG lpnSize); 52 static BOOLEAN (WINAPI * pGetUserNameExA)(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG lpnSize); 53 static BOOLEAN (WINAPI * pGetUserNameExW)(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG lpnSize); 54 static PSecurityFunctionTableA (SEC_ENTRY * pInitSecurityInterfaceA)(void); 55 static PSecurityFunctionTableW (SEC_ENTRY * pInitSecurityInterfaceW)(void); 56 57 static EXTENDED_NAME_FORMAT formats[] = { 58 NameUnknown, NameFullyQualifiedDN, NameSamCompatible, NameDisplay, 59 NameUniqueId, NameCanonical, NameUserPrincipal, NameCanonicalEx, 60 NameServicePrincipal, NameDnsDomain 61 }; 62 63 static void testGetComputerObjectNameA(void) 64 { 65 char name[256]; 66 ULONG size; 67 BOOLEAN rc; 68 UINT i; 69 70 for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) { 71 size = 0; 72 SetLastError(0xdeadbeef); 73 rc = pGetComputerObjectNameA(formats[i], NULL, &size); 74 ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]); 75 switch (formats[i]) 76 { 77 case NameUnknown: 78 ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError()); 79 break; 80 default: 81 ok(GetLastError() == ERROR_NONE_MAPPED || 82 GetLastError() == ERROR_NO_SUCH_USER || 83 GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO || 84 GetLastError() == ERROR_INSUFFICIENT_BUFFER, 85 "%u: got %u\n", formats[i], GetLastError()); 86 break; 87 } 88 89 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) continue; 90 91 size = sizeof(name); 92 SetLastError(0xdeadbeef); 93 rc = pGetComputerObjectNameA(formats[i], name, &size); 94 switch (formats[i]) 95 { 96 case NameUnknown: 97 ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]); 98 ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError()); 99 break; 100 default: 101 ok(rc, "GetComputerObjectName(%u) error %u\n", formats[i], GetLastError()); 102 trace("GetComputerObjectName(%u) returned %s\n", formats[i], name); 103 break; 104 } 105 } 106 } 107 108 static void testGetComputerObjectNameW(void) 109 { 110 WCHAR nameW[256]; 111 ULONG size; 112 BOOLEAN rc; 113 UINT i; 114 115 for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) { 116 size = 0; 117 SetLastError(0xdeadbeef); 118 rc = pGetComputerObjectNameW(formats[i], NULL, &size); 119 ok(!rc || broken(rc) /* win10 */, "GetComputerObjectName(%u) should fail\n", formats[i]); 120 switch (formats[i]) 121 { 122 case NameUnknown: 123 ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError()); 124 break; 125 default: 126 ok(GetLastError() == ERROR_NONE_MAPPED || 127 GetLastError() == ERROR_NO_SUCH_USER || 128 GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO || 129 GetLastError() == WSAHOST_NOT_FOUND || 130 GetLastError() == ERROR_INSUFFICIENT_BUFFER, 131 "%u: got %u\n", formats[i], GetLastError()); 132 break; 133 } 134 135 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) continue; 136 137 size = sizeof(nameW)/sizeof(nameW[0]); 138 SetLastError(0xdeadbeef); 139 rc = pGetComputerObjectNameW(formats[i], nameW, &size); 140 switch (formats[i]) 141 { 142 case NameUnknown: 143 ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]); 144 ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError()); 145 break; 146 default: 147 ok(rc, "GetComputerObjectName(%u) error %u\n", formats[i], GetLastError()); 148 trace("GetComputerObjectName(%u) returned %s\n", formats[i], wine_dbgstr_w(nameW)); 149 break; 150 } 151 } 152 } 153 154 static void testGetUserNameExA(void) 155 { 156 char name[256]; 157 ULONG size; 158 BOOLEAN rc; 159 UINT i; 160 161 for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) { 162 size = sizeof(name); 163 ZeroMemory(name, sizeof(name)); 164 rc = pGetUserNameExA(formats[i], name, &size); 165 ok(rc || 166 (formats[i] == NameUnknown && 167 GetLastError() == ERROR_NO_SUCH_USER) || 168 GetLastError() == ERROR_NONE_MAPPED || 169 broken(formats[i] == NameDnsDomain && 170 GetLastError() == ERROR_INVALID_PARAMETER), 171 "GetUserNameExW(%d) failed: %d\n", 172 formats[i], GetLastError()); 173 } 174 175 if (0) /* Crashes on Windows */ 176 pGetUserNameExA(NameSamCompatible, NULL, NULL); 177 178 size = 0; 179 rc = pGetUserNameExA(NameSamCompatible, NULL, &size); 180 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); 181 ok(size != 0, "Expected size to be set to required size\n"); 182 183 if (0) /* Crashes on Windows with big enough size */ 184 { 185 /* Returned size is already big enough */ 186 pGetUserNameExA(NameSamCompatible, NULL, &size); 187 } 188 189 size = 0; 190 rc = pGetUserNameExA(NameSamCompatible, name, &size); 191 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); 192 ok(size != 0, "Expected size to be set to required size\n"); 193 size = 1; 194 name[0] = 0xff; 195 rc = pGetUserNameExA(NameSamCompatible, name, &size); 196 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); 197 ok(1 < size, "Expected size to be set to required size\n"); 198 ok(name[0] == (char) 0xff, "Expected unchanged buffer\n"); 199 } 200 201 static void testGetUserNameExW(void) 202 { 203 WCHAR nameW[256]; 204 ULONG size; 205 BOOLEAN rc; 206 UINT i; 207 208 for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) { 209 size = sizeof(nameW); 210 ZeroMemory(nameW, sizeof(nameW)); 211 rc = pGetUserNameExW(formats[i], nameW, &size); 212 ok(rc || 213 (formats[i] == NameUnknown && 214 GetLastError() == ERROR_NO_SUCH_USER) || 215 GetLastError() == ERROR_NONE_MAPPED || 216 broken(formats[i] == NameDnsDomain && 217 GetLastError() == ERROR_INVALID_PARAMETER), 218 "GetUserNameExW(%d) failed: %d\n", 219 formats[i], GetLastError()); 220 } 221 222 if (0) /* Crashes on Windows */ 223 pGetUserNameExW(NameSamCompatible, NULL, NULL); 224 225 size = 0; 226 rc = pGetUserNameExW(NameSamCompatible, NULL, &size); 227 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); 228 ok(size != 0, "Expected size to be set to required size\n"); 229 230 if (0) /* Crashes on Windows with big enough size */ 231 { 232 /* Returned size is already big enough */ 233 pGetUserNameExW(NameSamCompatible, NULL, &size); 234 } 235 236 size = 0; 237 rc = pGetUserNameExW(NameSamCompatible, nameW, &size); 238 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); 239 ok(size != 0, "Expected size to be set to required size\n"); 240 size = 1; 241 nameW[0] = 0xff; 242 rc = pGetUserNameExW(NameSamCompatible, nameW, &size); 243 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); 244 ok(1 < size, "Expected size to be set to required size\n"); 245 ok(nameW[0] == (WCHAR) 0xff, "Expected unchanged buffer\n"); 246 } 247 248 static void test_InitSecurityInterface(void) 249 { 250 PSecurityFunctionTableA sftA; 251 PSecurityFunctionTableW sftW; 252 253 sftA = pInitSecurityInterfaceA(); 254 ok(sftA != NULL, "pInitSecurityInterfaceA failed\n"); 255 ok(sftA->dwVersion == SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION, "wrong dwVersion %d in security function table\n", sftA->dwVersion); 256 ok(!sftA->Reserved2, 257 "Reserved2 should be NULL instead of %p in security function table\n", 258 sftA->Reserved2); 259 ok(sftA->Reserved3 == sftA->EncryptMessage, 260 "Reserved3 should be equal to EncryptMessage in the security function table\n"); 261 ok(sftA->Reserved4 == sftA->DecryptMessage, 262 "Reserved4 should be equal to DecryptMessage in the security function table\n"); 263 264 if (!pInitSecurityInterfaceW) 265 { 266 win_skip("InitSecurityInterfaceW not exported by secur32.dll\n"); 267 return; 268 } 269 270 sftW = pInitSecurityInterfaceW(); 271 ok(sftW != NULL, "pInitSecurityInterfaceW failed\n"); 272 ok(sftW->dwVersion == SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION, "wrong dwVersion %d in security function table\n", sftW->dwVersion); 273 ok(!sftW->Reserved2, "Reserved2 should be NULL instead of %p in security function table\n", sftW->Reserved2); 274 ok(sftW->Reserved3 == sftW->EncryptMessage, "Reserved3 should be equal to EncryptMessage in the security function table\n"); 275 ok(sftW->Reserved4 == sftW->DecryptMessage, "Reserved4 should be equal to DecryptMessage in the security function table\n"); 276 } 277 278 static void test_SspiEncodeStringsAsAuthIdentity(void) 279 { 280 static const WCHAR username[] = {'u','s','e','r','n','a','m','e',0}; 281 static const WCHAR domainname[] = {'d','o','m','a','i','n','n','a','m','e',0}; 282 static const WCHAR password[] = {'p','a','s','s','w','o','r','d',0}; 283 const WCHAR *username_ptr, *domainname_ptr, *password_ptr; 284 PSEC_WINNT_AUTH_IDENTITY_OPAQUE id; 285 SECURITY_STATUS status; 286 287 if (!pSspiEncodeStringsAsAuthIdentity) 288 { 289 win_skip( "SspiEncodeAuthIdentityAsStrings not exported by secur32.dll\n" ); 290 return; 291 } 292 293 status = pSspiEncodeStringsAsAuthIdentity( NULL, NULL, NULL, NULL ); 294 ok( status == SEC_E_INVALID_TOKEN, "got %08x\n", status ); 295 296 id = (PSEC_WINNT_AUTH_IDENTITY_OPAQUE)0xdeadbeef; 297 status = pSspiEncodeStringsAsAuthIdentity( NULL, NULL, NULL, &id ); 298 ok( status == SEC_E_INVALID_TOKEN, "got %08x\n", status ); 299 ok( id == (PSEC_WINNT_AUTH_IDENTITY_OPAQUE)0xdeadbeef, "id set\n" ); 300 301 id = NULL; 302 status = pSspiEncodeStringsAsAuthIdentity( NULL, NULL, password, &id ); 303 ok( status == SEC_E_OK, "got %08x\n", status ); 304 ok( id != NULL, "id not set\n" ); 305 pSspiFreeAuthIdentity( id ); 306 307 id = NULL; 308 status = pSspiEncodeStringsAsAuthIdentity( NULL, domainname, password, &id ); 309 ok( status == SEC_E_OK, "got %08x\n", status ); 310 ok( id != NULL, "id not set\n" ); 311 pSspiFreeAuthIdentity( id ); 312 313 id = NULL; 314 status = pSspiEncodeStringsAsAuthIdentity( username, NULL, password, &id ); 315 ok( status == SEC_E_OK, "got %08x\n", status ); 316 ok( id != NULL, "id not set\n" ); 317 pSspiFreeAuthIdentity( id ); 318 319 id = NULL; 320 status = pSspiEncodeStringsAsAuthIdentity( username, NULL, NULL, &id ); 321 ok( status == SEC_E_OK, "got %08x\n", status ); 322 ok( id != NULL, "id not set\n" ); 323 pSspiFreeAuthIdentity( id ); 324 325 id = NULL; 326 status = pSspiEncodeStringsAsAuthIdentity( username, domainname, password, &id ); 327 ok( status == SEC_E_OK, "got %08x\n", status ); 328 ok( id != NULL, "id not set\n" ); 329 330 username_ptr = domainname_ptr = password_ptr = NULL; 331 status = pSspiEncodeAuthIdentityAsStrings( id, &username_ptr, &domainname_ptr, &password_ptr ); 332 ok( status == SEC_E_OK, "got %08x\n", status ); 333 ok( !lstrcmpW( username, username_ptr ), "wrong username\n" ); 334 ok( !lstrcmpW( domainname, domainname_ptr ), "wrong domainname\n" ); 335 ok( !lstrcmpW( password, password_ptr ), "wrong password\n" ); 336 337 pSspiZeroAuthIdentity( id ); 338 339 pSspiLocalFree( (void *)username_ptr ); 340 pSspiLocalFree( (void *)domainname_ptr ); 341 pSspiLocalFree( (void *)password_ptr ); 342 pSspiFreeAuthIdentity( id ); 343 344 id = NULL; 345 status = pSspiEncodeStringsAsAuthIdentity( username, NULL, password, &id ); 346 ok( status == SEC_E_OK, "got %08x\n", status ); 347 ok( id != NULL, "id not set\n" ); 348 349 username_ptr = password_ptr = NULL; 350 domainname_ptr = (const WCHAR *)0xdeadbeef; 351 status = pSspiEncodeAuthIdentityAsStrings( id, &username_ptr, &domainname_ptr, &password_ptr ); 352 ok( status == SEC_E_OK, "got %08x\n", status ); 353 ok( !lstrcmpW( username, username_ptr ), "wrong username\n" ); 354 ok( domainname_ptr == NULL, "domainname_ptr not cleared\n" ); 355 ok( !lstrcmpW( password, password_ptr ), "wrong password\n" ); 356 357 pSspiLocalFree( (void *)username_ptr ); 358 pSspiLocalFree( (void *)password_ptr ); 359 pSspiFreeAuthIdentity( id ); 360 } 361 362 static void test_SspiPrepareForCredWrite(void) 363 { 364 static const WCHAR usernameW[] = 365 {'u','s','e','r','n','a','m','e',0}; 366 static const WCHAR domainnameW[] = 367 {'d','o','m','a','i','n','n','a','m','e',0}; 368 static const WCHAR passwordW[] = 369 {'p','a','s','s','w','o','r','d',0}; 370 static const WCHAR targetW[] = 371 {'d','o','m','a','i','n','n','a','m','e','\\','u','s','e','r','n','a','m','e',0}; 372 static const WCHAR target2W[] = 373 {'d','o','m','a','i','n','n','a','m','e','2','\\','u','s','e','r','n','a','m','e','2',0}; 374 const WCHAR *target, *username; 375 PSEC_WINNT_AUTH_IDENTITY_OPAQUE id; 376 SECURITY_STATUS status; 377 ULONG type, size; 378 UCHAR *blob; 379 380 if (!pSspiPrepareForCredWrite) 381 { 382 win_skip( "SspiPrepareForCredWrite not exported by secur32.dll\n" ); 383 return; 384 } 385 386 status = pSspiEncodeStringsAsAuthIdentity( usernameW, domainnameW, passwordW, &id ); 387 ok( status == SEC_E_OK, "got %08x\n", status ); 388 389 type = size = 0; 390 status = pSspiPrepareForCredWrite( id, NULL, &type, &target, &username, &blob, &size ); 391 ok( status == SEC_E_OK, "got %08x\n", status ); 392 ok( type == CRED_TYPE_DOMAIN_PASSWORD, "got %u\n", type ); 393 ok( !lstrcmpW( target, targetW ), "got %s\n", wine_dbgstr_w(target) ); 394 ok( !lstrcmpW( username, targetW ), "got %s\n", wine_dbgstr_w(username) ); 395 ok( !memcmp( blob, passwordW, sizeof(passwordW) - sizeof(WCHAR) ), "wrong data\n" ); 396 ok( size == sizeof(passwordW) - sizeof(WCHAR), "got %u\n", size ); 397 pSspiLocalFree( (void *)target ); 398 pSspiLocalFree( (void *)username ); 399 pSspiLocalFree( blob ); 400 401 type = size = 0; 402 status = pSspiPrepareForCredWrite( id, target2W, &type, &target, &username, &blob, &size ); 403 ok( status == SEC_E_OK, "got %08x\n", status ); 404 ok( type == CRED_TYPE_DOMAIN_PASSWORD, "got %u\n", type ); 405 ok( !lstrcmpW( target, target2W ), "got %s\n", wine_dbgstr_w(target) ); 406 ok( !lstrcmpW( username, targetW ), "got %s\n", wine_dbgstr_w(username) ); 407 ok( !memcmp( blob, passwordW, sizeof(passwordW) - sizeof(WCHAR) ), "wrong data\n" ); 408 ok( size == sizeof(passwordW) - sizeof(WCHAR), "got %u\n", size ); 409 pSspiLocalFree( (void *)target ); 410 pSspiLocalFree( (void *)username ); 411 pSspiLocalFree( blob ); 412 413 pSspiFreeAuthIdentity( id ); 414 } 415 416 static void test_kerberos(void) 417 { 418 SecPkgInfoA *info; 419 TimeStamp ttl; 420 CredHandle cred; 421 SECURITY_STATUS status; 422 423 SEC_CHAR provider[] = {'K','e','r','b','e','r','o','s',0}; 424 425 static const ULONG expected_flags = 426 SECPKG_FLAG_INTEGRITY 427 | SECPKG_FLAG_PRIVACY 428 | SECPKG_FLAG_TOKEN_ONLY 429 | SECPKG_FLAG_DATAGRAM 430 | SECPKG_FLAG_CONNECTION 431 | SECPKG_FLAG_MULTI_REQUIRED 432 | SECPKG_FLAG_EXTENDED_ERROR 433 | SECPKG_FLAG_IMPERSONATION 434 | SECPKG_FLAG_ACCEPT_WIN32_NAME 435 | SECPKG_FLAG_NEGOTIABLE 436 | SECPKG_FLAG_GSS_COMPATIBLE 437 | SECPKG_FLAG_LOGON 438 | SECPKG_FLAG_MUTUAL_AUTH 439 | SECPKG_FLAG_DELEGATION 440 | SECPKG_FLAG_READONLY_WITH_CHECKSUM; 441 static const ULONG optional_mask = 442 SECPKG_FLAG_RESTRICTED_TOKENS 443 | SECPKG_FLAG_APPCONTAINER_CHECKS; 444 445 status = QuerySecurityPackageInfoA(provider, &info); 446 ok(status == SEC_E_OK, "Kerberos package not installed, skipping test\n"); 447 if(status != SEC_E_OK) 448 return; 449 450 ok( (info->fCapabilities & ~optional_mask) == expected_flags, "got %08x, expected %08x\n", info->fCapabilities, expected_flags ); 451 ok( info->wVersion == 1, "got %u\n", info->wVersion ); 452 ok( info->wRPCID == RPC_C_AUTHN_GSS_KERBEROS, "got %u\n", info->wRPCID ); 453 ok( info->cbMaxToken >= 12000, "got %u\n", info->cbMaxToken ); 454 ok( !lstrcmpA( info->Name, "Kerberos" ), "got %s\n", info->Name ); 455 ok( !lstrcmpA( info->Comment, "Microsoft Kerberos V1.0" ), "got %s\n", info->Comment ); 456 FreeContextBuffer( info ); 457 458 status = AcquireCredentialsHandleA( NULL, provider, SECPKG_CRED_OUTBOUND, NULL, 459 NULL, NULL, NULL, &cred, &ttl ); 460 todo_wine ok( status == SEC_E_OK, "AcquireCredentialsHandleA returned %08x\n", status ); 461 if(status == SEC_E_OK) 462 FreeCredentialHandle( &cred ); 463 } 464 465 START_TEST(secur32) 466 { 467 secdll = LoadLibraryA("secur32.dll"); 468 469 if (!secdll) 470 secdll = LoadLibraryA("security.dll"); 471 472 if (secdll) 473 { 474 pSspiEncodeAuthIdentityAsStrings = (void *)GetProcAddress(secdll, "SspiEncodeAuthIdentityAsStrings"); 475 pSspiEncodeStringsAsAuthIdentity = (void *)GetProcAddress(secdll, "SspiEncodeStringsAsAuthIdentity"); 476 pSspiFreeAuthIdentity = (void *)GetProcAddress(secdll, "SspiFreeAuthIdentity"); 477 pSspiLocalFree = (void *)GetProcAddress(secdll, "SspiLocalFree"); 478 pSspiPrepareForCredWrite = (void *)GetProcAddress(secdll, "SspiPrepareForCredWrite"); 479 pSspiZeroAuthIdentity = (void *)GetProcAddress(secdll, "SspiZeroAuthIdentity"); 480 pGetComputerObjectNameA = (PVOID)GetProcAddress(secdll, "GetComputerObjectNameA"); 481 pGetComputerObjectNameW = (PVOID)GetProcAddress(secdll, "GetComputerObjectNameW"); 482 pGetUserNameExA = (PVOID)GetProcAddress(secdll, "GetUserNameExA"); 483 pGetUserNameExW = (PVOID)GetProcAddress(secdll, "GetUserNameExW"); 484 pInitSecurityInterfaceA = (PVOID)GetProcAddress(secdll, "InitSecurityInterfaceA"); 485 pInitSecurityInterfaceW = (PVOID)GetProcAddress(secdll, "InitSecurityInterfaceW"); 486 487 if (pGetComputerObjectNameA) 488 testGetComputerObjectNameA(); 489 else 490 win_skip("GetComputerObjectNameA not exported by secur32.dll\n"); 491 492 if (pGetComputerObjectNameW) 493 testGetComputerObjectNameW(); 494 else 495 win_skip("GetComputerObjectNameW not exported by secur32.dll\n"); 496 497 if (pGetUserNameExA) 498 testGetUserNameExA(); 499 else 500 win_skip("GetUserNameExA not exported by secur32.dll\n"); 501 502 if (pGetUserNameExW) 503 testGetUserNameExW(); 504 else 505 win_skip("GetUserNameExW not exported by secur32.dll\n"); 506 507 test_InitSecurityInterface(); 508 test_SspiEncodeStringsAsAuthIdentity(); 509 test_SspiPrepareForCredWrite(); 510 511 FreeLibrary(secdll); 512 } 513 514 test_kerberos(); 515 } 516