Changeset 988 for vendor/current/nsswitch/libwbclient/tests
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/nsswitch/libwbclient/tests/wbclient.c
r740 r988 23 23 #include "lib/util/data_blob.h" 24 24 #include "lib/util/time.h" 25 #include "libcli/resolve/resolve.h" 25 26 #include "nsswitch/libwbclient/wbclient.h" 26 27 #include "torture/smbtorture.h" … … 29 30 #include "lib/util/charset/charset.h" 30 31 #include "libcli/auth/libcli_auth.h" 31 #include " source4/param/param.h"32 #include "lib/util/ util.h"32 #include "lib/param/param.h" 33 #include "lib/util/samba_util.h" 33 34 #include "lib/crypto/arcfour.h" 35 #include "auth/credentials/credentials.h" 36 #include "lib/cmdline/popt_common.h" 34 37 35 38 #define WBC_ERROR_EQUAL(x,y) (x == y) 36 39 37 #define torture_assert_wbc_equal(torture_ctx, got, expected, cmt )\40 #define torture_assert_wbc_equal(torture_ctx, got, expected, cmt, cmt_arg) \ 38 41 do { wbcErr __got = got, __expected = expected; \ 39 42 if (!WBC_ERROR_EQUAL(__got, __expected)) { \ 40 torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: %s", wbcErrorString(__got), wbcErrorString(__expected), cmt); \43 torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: " cmt, wbcErrorString(__got), wbcErrorString(__expected), cmt_arg); \ 41 44 return false; \ 42 45 } \ 43 46 } while (0) 44 47 45 #define torture_assert_wbc_ok(torture_ctx,expr,cmt )\46 torture_assert_wbc_equal(torture_ctx,expr,WBC_ERR_SUCCESS,cmt)48 #define torture_assert_wbc_ok(torture_ctx,expr,cmt,cmt_arg) \ 49 torture_assert_wbc_equal(torture_ctx,expr,WBC_ERR_SUCCESS,cmt,cmt_arg) 47 50 48 51 static bool test_wbc_ping(struct torture_context *tctx) 49 52 { 50 53 torture_assert_wbc_ok(tctx, wbcPing(), 51 " wbcPing failed");54 "%s", "wbcPing failed"); 52 55 53 56 return true; … … 56 59 static bool test_wbc_pingdc(struct torture_context *tctx) 57 60 { 58 torture_assert_wbc_equal(tctx, wbcPingDc("random_string", NULL), WBC_ERR_NOT_IMPLEMENTED, 59 "wbcPingDc failed"); 61 struct wbcInterfaceDetails *details; 62 63 torture_assert_wbc_equal(tctx, wbcPingDc("random_string", NULL), WBC_ERR_DOMAIN_NOT_FOUND, 64 "%s", "wbcPingDc failed"); 60 65 torture_assert_wbc_ok(tctx, wbcPingDc(NULL, NULL), 61 "wbcPingDc failed"); 66 "%s", "wbcPingDc failed"); 67 68 torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details), 69 "%s", "wbcInterfaceDetails failed"); 70 torture_assert(tctx, details, 71 "wbcInterfaceDetails returned NULL pointer"); 72 torture_assert(tctx, details->netbios_domain, 73 "wbcInterfaceDetails returned NULL netbios_domain"); 74 75 torture_assert_wbc_ok(tctx, wbcPingDc(details->netbios_domain, NULL), 76 "wbcPingDc(%s) failed", details->netbios_domain); 77 78 torture_assert_wbc_ok(tctx, wbcPingDc("BUILTIN", NULL), 79 "%s", "wbcPingDc(BUILTIN) failed"); 80 81 wbcFreeMemory(details); 82 return true; 83 } 84 85 static bool test_wbc_pingdc2(struct torture_context *tctx) 86 { 87 struct wbcInterfaceDetails *details; 88 char *name = NULL; 89 90 torture_assert_wbc_equal(tctx, wbcPingDc2("random_string", NULL, &name), 91 WBC_ERR_DOMAIN_NOT_FOUND, "%s", 92 "wbcPingDc2 failed"); 93 torture_assert_wbc_ok(tctx, wbcPingDc2(NULL, NULL, &name), "%s", 94 "wbcPingDc2 failed"); 95 96 wbcFreeMemory(name); 97 98 torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details), 99 "%s", "wbcInterfaceDetails failed"); 100 torture_assert(tctx, details, 101 "wbcInterfaceDetails returned NULL pointer"); 102 torture_assert(tctx, details->netbios_domain, 103 "wbcInterfaceDetails returned NULL netbios_domain"); 104 105 torture_assert_wbc_ok(tctx, wbcPingDc2(details->netbios_domain, NULL, &name), 106 "wbcPingDc2(%s) failed", details->netbios_domain); 107 wbcFreeMemory(name); 108 109 torture_assert_wbc_ok(tctx, wbcPingDc2("BUILTIN", NULL, &name), 110 "%s", "wbcPingDc2(BUILTIN) failed"); 111 wbcFreeMemory(name); 112 113 wbcFreeMemory(details); 62 114 63 115 return true; … … 69 121 70 122 torture_assert_wbc_ok(tctx, wbcLibraryDetails(&details), 71 " wbcLibraryDetails failed");123 "%s", "wbcLibraryDetails failed"); 72 124 torture_assert(tctx, details, 73 125 "wbcLibraryDetails returned NULL pointer"); … … 83 135 84 136 torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details), 85 " wbcInterfaceDetails failed");137 "%s", "wbcInterfaceDetails failed"); 86 138 torture_assert(tctx, details, 87 "wbcInterfaceDetails returned NULL pointer");139 "wbcInterfaceDetails returned NULL pointer"); 88 140 89 141 wbcFreeMemory(details); … … 113 165 "SID_UNKNOWN", "SID_UNKNOWN failed"); 114 166 torture_assert_str_equal(tctx, wbcSidTypeString(WBC_SID_NAME_COMPUTER), 115 "SID_COMPUTER", "SID_COMPUTER failed");167 "SID_COMPUTER", "SID_COMPUTER failed"); 116 168 return true; 117 169 } … … 124 176 125 177 torture_assert_wbc_ok(tctx, wbcStringToSid(sid_string, &sid), 126 "wbcStringToSid failed");178 "wbcStringToSid of %s failed", sid_string); 127 179 torture_assert_wbc_ok(tctx, wbcSidToString(&sid, &sid_string2), 128 "wbcSidToString failed");180 "wbcSidToString of %s failed", sid_string); 129 181 torture_assert_str_equal(tctx, sid_string, sid_string2, 130 182 "sid strings differ"); … … 141 193 142 194 torture_assert_wbc_ok(tctx, wbcStringToGuid(guid_string, &guid), 143 "wbcStringToGuid failed");195 "wbcStringToGuid of %s failed", guid_string); 144 196 torture_assert_wbc_ok(tctx, wbcGuidToString(&guid, &guid_string2), 145 "wbcGuidToString failed");197 "wbcGuidToString of %s failed", guid_string); 146 198 torture_assert_str_equal(tctx, guid_string, guid_string2, 147 "guid strings differ");199 "guid strings differ"); 148 200 wbcFreeMemory(guid_string2); 149 201 … … 157 209 158 210 torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details), 159 " wbcInterfaceDetails failed");211 "%s", "wbcInterfaceDetails failed"); 160 212 torture_assert_wbc_ok( 161 213 tctx, wbcDomainInfo(details->netbios_domain, &info), 162 " wbcDomainInfo failed");214 "%s", "wbcDomainInfo failed"); 163 215 wbcFreeMemory(details); 164 216 … … 179 231 180 232 torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details), 181 " wbcInterfaceDetails failed");233 "%s", "wbcInterfaceDetails failed"); 182 234 183 235 domain_name = talloc_strdup(tctx, details->netbios_domain); … … 185 237 186 238 torture_assert_wbc_ok(tctx, wbcListUsers(domain_name, &num_users, &users), 187 " wbcListUsers failed");239 "%s", "wbcListUsers failed"); 188 240 torture_assert(tctx, !(num_users > 0 && !users), 189 241 "wbcListUsers returned invalid results"); … … 195 247 char *domain; 196 248 char *name; 249 char *sid_string; 197 250 uint32_t num_sids; 198 251 199 252 torture_assert_wbc_ok(tctx, wbcLookupName(domain_name, users[i], &sid, &name_type), 200 "wbcLookupName failed");253 "wbcLookupName of %s failed", users[i]); 201 254 torture_assert_int_equal(tctx, name_type, WBC_SID_NAME_USER, 202 "wbcLookupName expected WBC_SID_NAME_USER"); 255 "wbcLookupName expected WBC_SID_NAME_USER"); 256 wbcSidToString(&sid, &sid_string); 203 257 torture_assert_wbc_ok(tctx, wbcLookupSid(&sid, &domain, &name, &name_type), 204 "wbcLookupSid failed");258 "wbcLookupSid of %s failed", sid_string); 205 259 torture_assert_int_equal(tctx, name_type, WBC_SID_NAME_USER, 206 "wbcLookupSidexpected WBC_SID_NAME_USER");260 "wbcLookupSid of expected WBC_SID_NAME_USER"); 207 261 torture_assert(tctx, name, 208 262 "wbcLookupSid returned no name"); … … 210 264 wbcFreeMemory(name); 211 265 torture_assert_wbc_ok(tctx, wbcLookupUserSids(&sid, true, &num_sids, &sids), 212 "wbcLookupUserSids failed");266 "wbcLookupUserSids of %s failed", sid_string); 213 267 torture_assert_wbc_ok( 214 268 tctx, wbcGetDisplayName(&sid, &domain, &name, 215 269 &name_type), 216 "wbcGetDisplayName failed");270 "wbcGetDisplayName of %s failed", sid_string); 217 271 wbcFreeMemory(domain); 218 272 wbcFreeMemory(name); 219 273 wbcFreeMemory(sids); 274 wbcFreeMemory(sid_string); 220 275 } 221 276 wbcFreeMemory(users); … … 233 288 234 289 torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details), 235 "wbcInterfaceDetails failed");290 "%s", "wbcInterfaceDetails failed"); 236 291 237 292 domain_name = talloc_strdup(tctx, details->netbios_domain); … … 239 294 240 295 torture_assert_wbc_ok(tctx, wbcListGroups(domain_name, &num_groups, &groups), 241 "wbcListGroups failed");296 "wbcListGroups in %s failed", domain_name); 242 297 torture_assert(tctx, !(num_groups > 0 && !groups), 243 "wbcListGroups returned invalid results");298 "wbcListGroups returned invalid results"); 244 299 245 300 for (i=0; i < MIN(num_groups,100); i++) { … … 249 304 char *domain; 250 305 char *name; 306 char *sid_string; 251 307 252 308 torture_assert_wbc_ok(tctx, wbcLookupName(domain_name, groups[i], &sid, &name_type), 253 "wbcLookupName failed"); 309 "wbcLookupName for %s failed", domain_name); 310 wbcSidToString(&sid, &sid_string); 254 311 torture_assert_wbc_ok(tctx, wbcLookupSid(&sid, &domain, &name, &name_type), 255 "wbcLookupSid failed"); 312 "wbcLookupSid of %s failed", sid_string); 313 wbcFreeMemory(sid_string); 256 314 torture_assert(tctx, name, 257 315 "wbcLookupSid returned no name"); … … 269 327 270 328 torture_assert_wbc_ok(tctx, wbcListTrusts(&domains, &num_domains), 271 "wbcListTrusts failed");329 "%s", "wbcListTrusts failed"); 272 330 torture_assert(tctx, !(num_domains > 0 && !domains), 273 331 "wbcListTrusts returned invalid results"); … … 283 341 */ 284 342 torture_assert_wbc_ok(tctx, wbcCheckTrustCredentials(domains[i].short_name, &error), 285 "wbcCheckTrustCredentials failed");343 "%s", "wbcCheckTrustCredentials failed"); 286 344 /* 287 345 torture_assert_wbc_ok(tctx, wbcLookupName(domains[i].short_name, NULL, &sid, &name_type), … … 309 367 310 368 torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details), 311 " wbcInterfaceDetails failed");369 "%s", "wbcInterfaceDetails failed"); 312 370 313 371 domain_name = talloc_strdup(tctx, details->netbios_domain); … … 315 373 316 374 torture_assert_wbc_ok(tctx, wbcLookupDomainController(domain_name, 0, &dc_info), 317 "wbcLookupDomainController failed");375 "wbcLookupDomainController for %s failed", domain_name); 318 376 wbcFreeMemory(dc_info); 319 377 … … 328 386 329 387 torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details), 330 " wbcInterfaceDetails failed");388 "%s", "wbcInterfaceDetails failed"); 331 389 332 390 domain_name = talloc_strdup(tctx, details->netbios_domain); … … 334 392 335 393 torture_assert_wbc_ok(tctx, wbcLookupDomainControllerEx(domain_name, NULL, NULL, 0, &dc_info), 336 "wbcLookupDomainControllerEx f ailed");394 "wbcLookupDomainControllerEx for %s failed", domain_name); 337 395 wbcFreeMemory(dc_info); 338 396 … … 348 406 name = torture_setting_string(tctx, "host", NULL); 349 407 408 torture_comment(tctx, "test-WinsByName: host='%s'\n", name); 409 350 410 ret = wbcResolveWinsByName(name, &ip); 351 411 352 412 if (is_ipaddress(name)) { 353 torture_assert_wbc_equal(tctx, ret, WBC_ERR_DOMAIN_NOT_FOUND, "wbcResolveWinsByName failed");413 torture_assert_wbc_equal(tctx, ret, WBC_ERR_DOMAIN_NOT_FOUND, "wbcResolveWinsByName of %s failed", name); 354 414 } else { 355 torture_assert_wbc_ok(tctx, ret, "wbcResolveWinsByName f ailed");415 torture_assert_wbc_ok(tctx, ret, "wbcResolveWinsByName for %s failed", name); 356 416 } 357 417 … … 362 422 { 363 423 const char *ip; 424 const char *host; 425 struct nbt_name nbt_name; 364 426 char *name; 365 427 wbcErr ret; 366 367 ip = torture_setting_string(tctx, "host", NULL); 428 NTSTATUS status; 429 430 host = torture_setting_string(tctx, "host", NULL); 431 432 torture_comment(tctx, "test-WinsByIp: host='%s'\n", host); 433 434 make_nbt_name_server(&nbt_name, host); 435 436 status = resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx), 437 0, 0, &nbt_name, tctx, &ip, tctx->ev); 438 torture_assert_ntstatus_ok(tctx, status, 439 talloc_asprintf(tctx,"Failed to resolve %s: %s", 440 nbt_name.name, nt_errstr(status))); 441 442 torture_comment(tctx, "test-WinsByIp: ip='%s'\n", ip); 368 443 369 444 ret = wbcResolveWinsByIP(ip, &name); 370 445 371 torture_assert_wbc_ok(tctx, ret, "wbcResolveWinsByIP f ailed");446 torture_assert_wbc_ok(tctx, ret, "wbcResolveWinsByIP for %s failed", ip); 372 447 373 448 wbcFreeMemory(name); … … 388 463 ret = wbcLookupRids(&builtin, 2, rids, &domain_name, &names, 389 464 &types); 390 torture_assert_wbc_ok(tctx, ret, " wbcLookupRidsfailed");465 torture_assert_wbc_ok(tctx, ret, "%s", "wbcLookupRids for 544 and 545 failed"); 391 466 392 467 torture_assert_str_equal( … … 396 471 tctx, names[1], "Users", "S-1-5-32-545 not mapped to 'Users'"); 397 472 398 wbcFreeMemory( (char *)domain_name);473 wbcFreeMemory(discard_const_p(char ,domain_name)); 399 474 wbcFreeMemory(names); 400 475 wbcFreeMemory(types); … … 414 489 415 490 torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details), 416 "wbcInterfaceDetails failed");491 "%s", "wbcInterfaceDetails failed"); 417 492 torture_assert_wbc_ok( 418 493 tctx, wbcDomainInfo(details->netbios_domain, &info), 419 "wbcDomainInfo failed");494 "wbcDomainInfo of %s failed", details->netbios_domain); 420 495 wbcFreeMemory(details); 421 496 … … 428 503 torture_assert_wbc_ok( 429 504 tctx, wbcStringToSid("S-1-5-32", &builtin), 430 "wbcStringToSid failed");505 "wbcStringToSid of %s failed", "S-1-5-32"); 431 506 432 507 ret = wbcGetSidAliases(&builtin, sids, 2, &rids, &num_rids); 433 torture_assert_wbc_ok(tctx, ret, " wbcGetSidAliases failed");508 torture_assert_wbc_ok(tctx, ret, "%s", "wbcGetSidAliases failed"); 434 509 435 510 wbcFreeMemory(rids); … … 446 521 wbcErr ret; 447 522 448 ret = wbcAuthenticateUser(getenv("USERNAME"), correct_password); 449 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 450 "wbcAuthenticateUser failed"); 523 ret = wbcAuthenticateUser(cli_credentials_get_username(cmdline_credentials), correct_password); 524 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 525 "wbcAuthenticateUser of %s failed", 526 cli_credentials_get_username(cmdline_credentials)); 451 527 452 528 ZERO_STRUCT(params); 453 params.account_name = getenv("USERNAME");529 params.account_name = cli_credentials_get_username(cmdline_credentials); 454 530 params.level = WBC_AUTH_USER_LEVEL_PLAIN; 455 531 params.password.plaintext = correct_password; … … 457 533 ret = wbcAuthenticateUserEx(¶ms, &info, &error); 458 534 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 459 "wbcAuthenticateUserEx failed");535 "wbcAuthenticateUserEx of %s failed", params.account_name); 460 536 wbcFreeMemory(info); 461 537 info = NULL; … … 467 543 ret = wbcAuthenticateUserEx(¶ms, &info, &error); 468 544 torture_assert_wbc_equal(tctx, ret, WBC_ERR_AUTH_ERROR, 469 "wbcAuthenticateUserEx succeeded where it "470 "should have failed" );545 "wbcAuthenticateUserEx for %s succeeded where it " 546 "should have failed", params.account_name); 471 547 wbcFreeMemory(info); 472 548 info = NULL; … … 480 556 static bool test_wbc_authenticate_user(struct torture_context *tctx) 481 557 { 482 return test_wbc_authenticate_user_int(tctx, getenv("PASSWORD"));558 return test_wbc_authenticate_user_int(tctx, cli_credentials_get_password(cmdline_credentials)); 483 559 } 484 560 … … 486 562 { 487 563 wbcErr ret; 488 const char *oldpass = getenv("PASSWORD");489 const char *newpass = "Koo8irei ";564 const char *oldpass = cli_credentials_get_password(cmdline_credentials); 565 const char *newpass = "Koo8irei%$"; 490 566 491 567 struct samr_CryptPassword new_nt_password; … … 551 627 552 628 params.level = WBC_CHANGE_PASSWORD_LEVEL_RESPONSE; 553 params.account_name = getenv("USERNAME");554 params.domain_name = "SAMBA-TEST";629 params.account_name = cli_credentials_get_username(cmdline_credentials); 630 params.domain_name = cli_credentials_get_domain(cmdline_credentials); 555 631 556 632 ret = wbcChangeUserPasswordEx(¶ms, NULL, NULL, NULL); 557 633 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 558 "wbcChangeUserPassword f ailed");559 560 if (!test_wbc_authenticate_user_int(tctx, "Koo8irei")) {634 "wbcChangeUserPassword for %s failed", params.account_name); 635 636 if (!test_wbc_authenticate_user_int(tctx, newpass)) { 561 637 return false; 562 638 } 563 639 564 ret = wbcChangeUserPassword( getenv("USERNAME"), "Koo8irei",565 getenv("PASSWORD"));566 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 567 "wbcChangeUserPassword f ailed");568 569 return test_wbc_authenticate_user_int(tctx, getenv("PASSWORD"));640 ret = wbcChangeUserPassword(cli_credentials_get_username(cmdline_credentials), newpass, 641 cli_credentials_get_password(cmdline_credentials)); 642 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 643 "wbcChangeUserPassword for %s failed", params.account_name); 644 645 return test_wbc_authenticate_user_int(tctx, cli_credentials_get_password(cmdline_credentials)); 570 646 } 571 647 … … 586 662 ret = wbcLogonUser(¶ms, &info, &error, &policy); 587 663 torture_assert_wbc_equal(tctx, ret, WBC_ERR_INVALID_PARAM, 588 " wbcLogonUser succeededwhere it should "664 "%s", "wbcLogonUser succeeded for NULL where it should " 589 665 "have failed"); 590 666 591 params.username = getenv("USERNAME");592 params.password = getenv("PASSWORD");667 params.username = cli_credentials_get_username(cmdline_credentials); 668 params.password = cli_credentials_get_password(cmdline_credentials); 593 669 594 670 ret = wbcAddNamedBlob(¶ms.num_blobs, ¶ms.blobs, 595 671 "foo", 0, discard_const_p(uint8_t, "bar"), 4); 596 672 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 597 " wbcAddNamedBlob failed");673 "%s", "wbcAddNamedBlob failed"); 598 674 599 675 ret = wbcLogonUser(¶ms, &info, &error, &policy); 600 676 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 601 "wbcLogonUser f ailed");677 "wbcLogonUser for %s failed", params.username); 602 678 wbcFreeMemory(info); info = NULL; 603 679 wbcFreeMemory(error); error = NULL; … … 608 684 ret = wbcLogonUser(¶ms, &info, &error, &policy); 609 685 torture_assert_wbc_equal(tctx, ret, WBC_ERR_AUTH_ERROR, 610 "wbcLogonUser should have failed with "611 "WBC_ERR_AUTH_ERROR" );686 "wbcLogonUser for %s should have failed with " 687 "WBC_ERR_AUTH_ERROR", params.username); 612 688 wbcFreeMemory(info); info = NULL; 613 689 wbcFreeMemory(error); error = NULL; … … 619 695 strlen("S-1-2-3-4")+1); 620 696 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 621 " wbcAddNamedBlob failed");622 params.password = getenv("PASSWORD");697 "%s", "wbcAddNamedBlob failed"); 698 params.password = cli_credentials_get_password(cmdline_credentials); 623 699 ret = wbcLogonUser(¶ms, &info, &error, &policy); 624 700 torture_assert_wbc_equal(tctx, ret, WBC_ERR_AUTH_ERROR, 625 "wbcLogonUser should have failed with "626 "WBC_ERR_AUTH_ERROR" );701 "wbcLogonUser for %s should have failed with " 702 "WBC_ERR_AUTH_ERROR", params.username); 627 703 wbcFreeMemory(info); info = NULL; 628 704 wbcFreeMemory(error); error = NULL; … … 633 709 ret = wbcInterfaceDetails(&iface); 634 710 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 635 " wbcInterfaceDetails failed");636 637 ret = wbcLookupName(iface->netbios_domain, getenv("USERNAME"), &sid,711 "%s", "wbcInterfaceDetails failed"); 712 713 ret = wbcLookupName(iface->netbios_domain, cli_credentials_get_username(cmdline_credentials), &sid, 638 714 &sidtype); 639 715 wbcFreeMemory(iface); 640 716 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 641 "wbcLookupName f ailed");717 "wbcLookupName for %s failed", cli_credentials_get_username(cmdline_credentials)); 642 718 643 719 ret = wbcSidToString(&sid, &sidstr); 644 720 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 645 " wbcSidToString failed");721 "%s", "wbcSidToString failed"); 646 722 647 723 ret = wbcAddNamedBlob(¶ms.num_blobs, ¶ms.blobs, … … 649 725 (uint8_t *)sidstr, strlen(sidstr)+1); 650 726 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 651 " wbcAddNamedBlob failed");727 "%s", "wbcAddNamedBlob failed"); 652 728 wbcFreeMemory(sidstr); 653 params.password = getenv("PASSWORD");729 params.password = cli_credentials_get_password(cmdline_credentials); 654 730 ret = wbcLogonUser(¶ms, &info, &error, &policy); 655 731 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 656 "wbcLogonUser f ailed");732 "wbcLogonUser for %s failed", params.username); 657 733 wbcFreeMemory(info); info = NULL; 658 734 wbcFreeMemory(error); error = NULL; … … 670 746 gid_t *groups; 671 747 672 ret = wbcGetGroups( getenv("USERNAME"), &num_groups, &groups);673 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 674 "wbcGetGroups f ailed");748 ret = wbcGetGroups(cli_credentials_get_username(cmdline_credentials), &num_groups, &groups); 749 torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS, 750 "wbcGetGroups for %s failed", cli_credentials_get_username(cmdline_credentials)); 675 751 wbcFreeMemory(groups); 676 752 return true; … … 683 759 torture_suite_add_simple_test(suite, "wbcPing", test_wbc_ping); 684 760 torture_suite_add_simple_test(suite, "wbcPingDc", test_wbc_pingdc); 761 torture_suite_add_simple_test(suite, "wbcPingDc2", test_wbc_pingdc2); 685 762 torture_suite_add_simple_test(suite, "wbcLibraryDetails", test_wbc_library_details); 686 763 torture_suite_add_simple_test(suite, "wbcInterfaceDetails", test_wbc_interface_details);
Note:
See TracChangeset
for help on using the changeset viewer.