Changeset 740 for vendor/current/source3/lib/netapi/user.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
-
vendor/current/source3/lib/netapi/user.c (modified) (81 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/lib/netapi/user.c
r594 r740 24 24 #include "lib/netapi/netapi_private.h" 25 25 #include "lib/netapi/libnetapi.h" 26 #include "../librpc/gen_ndr/cli_samr.h" 26 #include "../librpc/gen_ndr/ndr_samr_c.h" 27 #include "rpc_client/init_samr.h" 28 #include "../libds/common/flags.h" 29 #include "rpc_client/init_lsa.h" 30 #include "../libcli/security/security.h" 31 #include "../libds/common/flag_mapping.h" 32 #include "rpc_client/cli_pipe.h" 27 33 28 34 /**************************************************************** … … 109 115 info21->lm_owf_password = zero_parameters; 110 116 info21->nt_owf_password = zero_parameters; 111 info21-> unknown3.string= NULL;117 info21-> = NULL; 112 118 info21->buf_count = 0; 113 119 info21->buffer = NULL; … … 124 130 info21->nt_password_set = 0; 125 131 info21->password_expired = infoX->usriX_password_expired; 126 info21-> unknown4= 0;132 info21-> = 0; 127 133 } 128 134 … … 293 299 union samr_UserInfo user_info; 294 300 struct samr_UserInfo21 info21; 295 NTSTATUS status; 301 NTSTATUS status, result; 302 struct dcerpc_binding_handle *b = pipe_cli->binding_handle; 296 303 297 304 if (!uX) { … … 311 318 &user_info.info25.password); 312 319 313 status = rpccli_samr_SetUserInfo2(pipe_cli, talloc_tos(),320 status = , talloc_tos(), 314 321 user_handle, 315 322 25, 316 &user_info );317 318 if (NT_STATUS_EQUAL(status, NT_STATUS (DCERPC_FAULT_INVALID_TAG))) {323 &user_info 324 &result); 325 if (NT_STATUS_EQUAL(status, NT_STATUS)) { 319 326 320 327 user_info.info23.info = info21; … … 324 331 &user_info.info23.password); 325 332 326 status = rpccli_samr_SetUserInfo2(pipe_cli, talloc_tos(),333 status = , talloc_tos(), 327 334 user_handle, 328 335 23, 329 &user_info); 336 &user_info, 337 &result); 338 if (!NT_STATUS_IS_OK(status)) { 339 return status; 340 } 341 } 342 343 if (!NT_STATUS_IS_OK(status)) { 344 return status; 330 345 } 331 346 } else { … … 333 348 user_info.info21 = info21; 334 349 335 status = rpccli_samr_SetUserInfo(pipe_cli, talloc_tos(),350 status = , talloc_tos(), 336 351 user_handle, 337 352 21, 338 &user_info); 339 } 340 341 return status; 353 &user_info, 354 &result); 355 if (!NT_STATUS_IS_OK(status)) { 356 return status; 357 } 358 } 359 360 return result; 342 361 } 343 362 … … 349 368 { 350 369 struct rpc_pipe_client *pipe_cli = NULL; 351 NTSTATUS status ;370 NTSTATUS status; 352 371 WERROR werr; 353 372 struct policy_handle connect_handle, domain_handle, user_handle; … … 359 378 uint32_t rid = 0; 360 379 struct USER_INFO_X uX; 380 381 361 382 362 383 ZERO_STRUCT(connect_handle); … … 385 406 goto done; 386 407 } 408 409 387 410 388 411 status = construct_USER_INFO_X(r->in.level, r->in.buffer, &uX); … … 407 430 init_lsa_String(&lsa_account_name, uX.usriX_name); 408 431 409 status = rpccli_samr_CreateUser2(pipe_cli, talloc_tos(),432 status = , talloc_tos(), 410 433 &domain_handle, 411 434 &lsa_account_name, … … 418 441 &user_handle, 419 442 &access_granted, 420 &rid); 443 &rid, 444 &result); 421 445 if (!NT_STATUS_IS_OK(status)) { 422 446 werr = ntstatus_to_werror(status); 423 447 goto done; 424 448 } 425 426 status = rpccli_samr_QueryUserInfo(pipe_cli, talloc_tos(), 449 if (!NT_STATUS_IS_OK(result)) { 450 werr = ntstatus_to_werror(result); 451 goto done; 452 } 453 454 status = dcerpc_samr_QueryUserInfo(b, talloc_tos(), 427 455 &user_handle, 428 456 16, 429 &user_info); 457 &user_info, 458 &result); 430 459 if (!NT_STATUS_IS_OK(status)) { 431 460 werr = ntstatus_to_werror(status); 461 462 463 464 432 465 goto done; 433 466 } … … 438 471 } 439 472 440 status = rpccli_samr_GetUserPwInfo(pipe_cli, talloc_tos(),473 status = , talloc_tos(), 441 474 &user_handle, 442 &pw_info); 475 &pw_info, 476 &result); 443 477 if (!NT_STATUS_IS_OK(status)) { 444 478 werr = ntstatus_to_werror(status); 445 479 goto done; 446 480 } 481 482 483 484 485 486 487 488 489 490 447 491 448 492 uX.usriX_flags |= ACB_NORMAL; 449 493 450 494 status = set_user_info_USER_INFO_X(ctx, pipe_cli, 451 & pipe_cli->auth->user_session_key,495 &session_key, 452 496 &user_handle, 453 497 &uX); … … 461 505 462 506 failed: 463 rpccli_samr_DeleteUser(pipe_cli, talloc_tos(), 464 &user_handle); 507 dcerpc_samr_DeleteUser(b, talloc_tos(), 508 &user_handle, 509 &result); 465 510 466 511 done: 467 if (is_valid_policy_hnd(&user_handle) && pipe_cli) {468 rpccli_samr_Close(pipe_cli, talloc_tos(), &user_handle);512 if (is_valid_policy_hnd(&user_handle) && ) { 513 ); 469 514 } 470 515 … … 493 538 { 494 539 struct rpc_pipe_client *pipe_cli = NULL; 495 NTSTATUS status ;540 NTSTATUS status; 496 541 WERROR werr; 497 542 struct policy_handle connect_handle, builtin_handle, domain_handle, user_handle; … … 500 545 struct dom_sid2 *domain_sid = NULL; 501 546 struct dom_sid2 user_sid; 547 502 548 503 549 ZERO_STRUCT(connect_handle); … … 513 559 goto done; 514 560 } 561 562 515 563 516 564 werr = libnetapi_samr_open_domain(ctx, pipe_cli, … … 525 573 } 526 574 527 status = rpccli_samr_OpenDomain(pipe_cli, talloc_tos(),575 status = , talloc_tos(), 528 576 &connect_handle, 529 577 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT, 530 CONST_DISCARD(DOM_SID *, &global_sid_Builtin), 531 &builtin_handle); 578 CONST_DISCARD(struct dom_sid *, &global_sid_Builtin), 579 &builtin_handle, 580 &result); 532 581 if (!NT_STATUS_IS_OK(status)) { 533 582 werr = ntstatus_to_werror(status); 534 583 goto done; 535 584 } 585 586 587 588 536 589 537 590 init_lsa_String(&lsa_account_name, r->in.user_name); 538 591 539 status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),592 status = , talloc_tos(), 540 593 &domain_handle, 541 594 1, 542 595 &lsa_account_name, 543 596 &user_rids, 544 &name_types); 597 &name_types, 598 &result); 545 599 if (!NT_STATUS_IS_OK(status)) { 546 600 werr = ntstatus_to_werror(status); 547 601 goto done; 548 602 } 549 550 status = rpccli_samr_OpenUser(pipe_cli, talloc_tos(), 603 if (!NT_STATUS_IS_OK(result)) { 604 werr = ntstatus_to_werror(result); 605 goto done; 606 } 607 608 status = dcerpc_samr_OpenUser(b, talloc_tos(), 551 609 &domain_handle, 552 610 SEC_STD_DELETE, 553 611 user_rids.ids[0], 554 &user_handle); 612 &user_handle, 613 &result); 555 614 if (!NT_STATUS_IS_OK(status)) { 556 615 werr = ntstatus_to_werror(status); 557 616 goto done; 558 617 } 618 619 620 621 559 622 560 623 sid_compose(&user_sid, domain_sid, user_rids.ids[0]); 561 624 562 status = rpccli_samr_RemoveMemberFromForeignDomain(pipe_cli, talloc_tos(),625 status = , talloc_tos(), 563 626 &builtin_handle, 564 &user_sid); 627 &user_sid, 628 &result); 565 629 if (!NT_STATUS_IS_OK(status)) { 566 630 werr = ntstatus_to_werror(status); 567 631 goto done; 568 632 } 569 570 status = rpccli_samr_DeleteUser(pipe_cli, talloc_tos(), 571 &user_handle); 633 if (!NT_STATUS_IS_OK(result)) { 634 werr = ntstatus_to_werror(result); 635 goto done; 636 } 637 638 status = dcerpc_samr_DeleteUser(b, talloc_tos(), 639 &user_handle, 640 &result); 572 641 if (!NT_STATUS_IS_OK(status)) { 573 642 werr = ntstatus_to_werror(status); 643 644 645 646 574 647 goto done; 575 648 } … … 579 652 done: 580 653 if (is_valid_policy_hnd(&user_handle)) { 581 rpccli_samr_Close(pipe_cli, talloc_tos(), &user_handle);654 ); 582 655 } 583 656 … … 615 688 uint32_t *auth_flag_p) 616 689 { 617 NTSTATUS status ;690 NTSTATUS status; 618 691 619 692 struct policy_handle user_handle; … … 623 696 SAMR_USER_ACCESS_GET_ATTRIBUTES | 624 697 SAMR_USER_ACCESS_GET_NAME_ETC; 698 625 699 626 700 ZERO_STRUCT(user_handle); … … 653 727 } 654 728 655 status = rpccli_samr_OpenUser(pipe_cli, mem_ctx,729 status = , mem_ctx, 656 730 domain_handle, 657 731 access_mask, 658 732 rid, 659 &user_handle); 660 if (!NT_STATUS_IS_OK(status)) { 661 goto done; 662 } 663 664 status = rpccli_samr_QueryUserInfo(pipe_cli, mem_ctx, 733 &user_handle, 734 &result); 735 if (!NT_STATUS_IS_OK(status)) { 736 goto done; 737 } 738 if (!NT_STATUS_IS_OK(result)) { 739 status = result; 740 goto done; 741 } 742 743 status = dcerpc_samr_QueryUserInfo(b, mem_ctx, 665 744 &user_handle, 666 745 21, 667 &user_info); 668 if (!NT_STATUS_IS_OK(status)) { 669 goto done; 670 } 671 672 status = rpccli_samr_QuerySecurity(pipe_cli, mem_ctx, 746 &user_info, 747 &result); 748 if (!NT_STATUS_IS_OK(status)) { 749 goto done; 750 } 751 if (!NT_STATUS_IS_OK(result)) { 752 status = result; 753 goto done; 754 } 755 756 status = dcerpc_samr_QuerySecurity(b, mem_ctx, 673 757 &user_handle, 674 758 SECINFO_DACL, 675 sec_desc); 676 if (!NT_STATUS_IS_OK(status)) { 759 sec_desc, 760 &result); 761 if (!NT_STATUS_IS_OK(status)) { 762 goto done; 763 } 764 if (!NT_STATUS_IS_OK(result)) { 765 status = result; 677 766 goto done; 678 767 } … … 686 775 struct dom_sid sid; 687 776 688 status = rpccli_samr_GetGroupsForUser(pipe_cli, mem_ctx,777 status = , mem_ctx, 689 778 &user_handle, 690 &rid_array); 779 &rid_array, 780 &result); 691 781 if (!NT_STATUS_IS_OK(status)) { 782 783 784 785 692 786 goto done; 693 787 } … … 700 794 for (i=0; i<rid_array->count; i++) { 701 795 sid_compose(&sid, domain_sid, rid_array->rids[i].rid); 702 sid_array.sids[i].sid = sid_dup_talloc(mem_ctx, &sid);796 sid_array.sids[i].sid = (mem_ctx, &sid); 703 797 NT_STATUS_HAVE_NO_MEMORY(sid_array.sids[i].sid); 704 798 } 705 799 706 800 sid_compose(&sid, domain_sid, rid); 707 sid_array.sids[i].sid = sid_dup_talloc(mem_ctx, &sid);801 sid_array.sids[i].sid = (mem_ctx, &sid); 708 802 NT_STATUS_HAVE_NO_MEMORY(sid_array.sids[i].sid); 709 803 710 status = rpccli_samr_GetAliasMembership(pipe_cli, mem_ctx,804 status = , mem_ctx, 711 805 builtin_handle, 712 806 &sid_array, 713 &alias_rids); 807 &alias_rids, 808 &result); 714 809 if (!NT_STATUS_IS_OK(status)) { 810 811 812 813 715 814 goto done; 716 815 } … … 741 840 done: 742 841 if (is_valid_policy_hnd(&user_handle)) { 743 rpccli_samr_Close(pipe_cli, mem_ctx, &user_handle);842 ); 744 843 } 745 844 … … 918 1017 return NT_STATUS_NO_MEMORY; 919 1018 } 920 i->usri4_user_sid = (struct domsid *) sid_dup_talloc(mem_ctx, &sid);1019 i->usri4_user_sid = (struct domsid *)(mem_ctx, &sid); 921 1020 i->usri4_primary_group_id = i21->primary_gid; 922 1021 i->usri4_profile = talloc_strdup(mem_ctx, i21->profile_path.string); … … 1019 1118 return NT_STATUS_NO_MEMORY; 1020 1119 } 1021 i->usri23_user_sid = (struct domsid *) sid_dup_talloc(mem_ctx, &sid);1120 i->usri23_user_sid = (struct domsid *)(mem_ctx, &sid); 1022 1121 1023 1122 return NT_STATUS_OK; … … 1185 1284 1186 1285 NTSTATUS status = NT_STATUS_OK; 1286 1187 1287 WERROR werr; 1288 1188 1289 1189 1290 ZERO_STRUCT(connect_handle); … … 1220 1321 } 1221 1322 1323 1324 1222 1325 werr = libnetapi_samr_open_builtin_domain(ctx, pipe_cli, 1223 1326 SAMR_ACCESS_ENUM_DOMAINS | … … 1264 1367 } 1265 1368 1266 status = rpccli_samr_EnumDomainUsers(pipe_cli,1369 status = , 1267 1370 ctx, 1268 1371 &domain_handle, … … 1271 1374 &sam, 1272 1375 r->in.prefmaxlen, 1273 &entries_read); 1274 werr = ntstatus_to_werror(status); 1275 if (NT_STATUS_IS_ERR(status)) { 1376 &entries_read, 1377 &result); 1378 if (!NT_STATUS_IS_OK(status)) { 1379 werr = ntstatus_to_werror(status); 1380 goto done; 1381 } 1382 werr = ntstatus_to_werror(result); 1383 if (NT_STATUS_IS_ERR(result)) { 1276 1384 goto done; 1277 1385 } … … 1296 1404 done: 1297 1405 /* if last query */ 1298 if (NT_STATUS_IS_OK( status) ||1299 NT_STATUS_IS_ERR( status)) {1406 if (NT_STATUS_IS_OK() || 1407 NT_STATUS_IS_ERR()) { 1300 1408 1301 1409 if (ctx->disable_policy_handle_cache) { … … 1490 1598 struct policy_handle domain_handle; 1491 1599 union samr_DispInfo info; 1600 1492 1601 1493 1602 uint32_t total_size = 0; … … 1495 1604 1496 1605 NTSTATUS status = NT_STATUS_OK; 1606 1497 1607 WERROR werr; 1498 1608 WERROR werr_tmp; … … 1518 1628 goto done; 1519 1629 } 1630 1631 1520 1632 1521 1633 werr = libnetapi_samr_open_domain(ctx, pipe_cli, … … 1532 1644 } 1533 1645 1534 status = rpccli_samr_QueryDisplayInfo2(pipe_cli,1646 status = , 1535 1647 ctx, 1536 1648 &domain_handle, … … 1541 1653 &total_size, 1542 1654 &returned_size, 1543 &info); 1544 werr = ntstatus_to_werror(status); 1545 if (NT_STATUS_IS_ERR(status)) { 1655 &info, 1656 &result); 1657 if (!NT_STATUS_IS_OK(status)) { 1658 werr = ntstatus_to_werror(status); 1659 goto done; 1660 } 1661 werr = ntstatus_to_werror(result); 1662 if (NT_STATUS_IS_ERR(result)) { 1546 1663 goto done; 1547 1664 } … … 1556 1673 done: 1557 1674 /* if last query */ 1558 if (NT_STATUS_IS_OK( status) ||1559 NT_STATUS_IS_ERR( status)) {1675 if (NT_STATUS_IS_OK() || 1676 NT_STATUS_IS_ERR()) { 1560 1677 1561 1678 if (ctx->disable_policy_handle_cache) { … … 1604 1721 { 1605 1722 struct rpc_pipe_client *pipe_cli = NULL; 1606 NTSTATUS status ;1723 NTSTATUS status; 1607 1724 WERROR werr; 1608 1725 … … 1612 1729 struct samr_Ids user_rids, name_types; 1613 1730 uint32_t num_entries = 0; 1731 1614 1732 1615 1733 ZERO_STRUCT(connect_handle); … … 1645 1763 } 1646 1764 1765 1766 1647 1767 werr = libnetapi_samr_open_domain(ctx, pipe_cli, 1648 1768 SAMR_ACCESS_ENUM_DOMAINS | … … 1669 1789 init_lsa_String(&lsa_account_name, r->in.user_name); 1670 1790 1671 status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),1791 status = , talloc_tos(), 1672 1792 &domain_handle, 1673 1793 1, 1674 1794 &lsa_account_name, 1675 1795 &user_rids, 1676 &name_types); 1796 &name_types, 1797 &result); 1677 1798 if (!NT_STATUS_IS_OK(status)) { 1678 1799 werr = ntstatus_to_werror(status); 1800 1801 1802 1803 1679 1804 goto done; 1680 1805 } … … 1695 1820 1696 1821 done: 1697 if (is_valid_policy_hnd(&user_handle) && pipe_cli) {1698 rpccli_samr_Close(pipe_cli, talloc_tos(), &user_handle);1822 if (is_valid_policy_hnd(&user_handle) && ) { 1823 ); 1699 1824 } 1700 1825 … … 1723 1848 { 1724 1849 struct rpc_pipe_client *pipe_cli = NULL; 1725 NTSTATUS status ;1850 NTSTATUS status; 1726 1851 WERROR werr; 1727 1852 … … 1733 1858 1734 1859 struct USER_INFO_X uX; 1860 1861 1735 1862 1736 1863 ZERO_STRUCT(connect_handle); … … 1767 1894 break; 1768 1895 case 3: 1769 user_mask = S TD_RIGHT_READ_CONTROL_ACCESS|1770 S TD_RIGHT_WRITE_DAC_ACCESS|1896 user_mask = S | 1897 S | 1771 1898 SAMR_USER_ACCESS_GET_GROUPS | 1772 1899 SAMR_USER_ACCESS_SET_PASSWORD | … … 1799 1926 } 1800 1927 1928 1929 1801 1930 werr = libnetapi_samr_open_domain(ctx, pipe_cli, 1802 1931 SAMR_ACCESS_ENUM_DOMAINS | … … 1824 1953 init_lsa_String(&lsa_account_name, r->in.user_name); 1825 1954 1826 status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),1955 status = , talloc_tos(), 1827 1956 &domain_handle, 1828 1957 1, 1829 1958 &lsa_account_name, 1830 1959 &user_rids, 1831 &name_types); 1960 &name_types, 1961 &result); 1832 1962 if (!NT_STATUS_IS_OK(status)) { 1833 1963 werr = ntstatus_to_werror(status); 1834 1964 goto done; 1835 1965 } 1836 1837 status = rpccli_samr_OpenUser(pipe_cli, talloc_tos(), 1966 if (!NT_STATUS_IS_OK(result)) { 1967 werr = ntstatus_to_werror(result); 1968 goto done; 1969 } 1970 1971 status = dcerpc_samr_OpenUser(b, talloc_tos(), 1838 1972 &domain_handle, 1839 1973 user_mask, 1840 1974 user_rids.ids[0], 1841 &user_handle); 1975 &user_handle, 1976 &result); 1842 1977 if (!NT_STATUS_IS_OK(status)) { 1843 1978 werr = ntstatus_to_werror(status); 1844 1979 goto done; 1845 1980 } 1981 1982 1983 1984 1846 1985 1847 1986 status = construct_USER_INFO_X(r->in.level, r->in.buffer, &uX); … … 1851 1990 } 1852 1991 1992 1993 1994 1995 1996 1997 1853 1998 status = set_user_info_USER_INFO_X(ctx, pipe_cli, 1854 & pipe_cli->auth->user_session_key,1999 &session_key, 1855 2000 &user_handle, 1856 2001 &uX); … … 1863 2008 1864 2009 done: 1865 if (is_valid_policy_hnd(&user_handle) && pipe_cli) {1866 rpccli_samr_Close(pipe_cli, talloc_tos(), &user_handle);2010 if (is_valid_policy_hnd(&user_handle) && ) { 2011 ); 1867 2012 } 1868 2013 … … 1898 2043 struct samr_DomInfo12 *info12) 1899 2044 { 1900 NTSTATUS status ;2045 NTSTATUS status; 1901 2046 union samr_DomainInfo *dom_info = NULL; 2047 1902 2048 1903 2049 if (info1) { 1904 status = rpccli_samr_QueryDomainInfo(pipe_cli, mem_ctx,2050 status = , mem_ctx, 1905 2051 domain_handle, 1906 2052 1, 1907 &dom_info); 2053 &dom_info, 2054 &result); 1908 2055 NT_STATUS_NOT_OK_RETURN(status); 2056 1909 2057 1910 2058 *info1 = dom_info->info1; … … 1912 2060 1913 2061 if (info3) { 1914 status = rpccli_samr_QueryDomainInfo(pipe_cli, mem_ctx,2062 status = , mem_ctx, 1915 2063 domain_handle, 1916 2064 3, 1917 &dom_info); 2065 &dom_info, 2066 &result); 1918 2067 NT_STATUS_NOT_OK_RETURN(status); 2068 1919 2069 1920 2070 *info3 = dom_info->info3; … … 1922 2072 1923 2073 if (info5) { 1924 status = rpccli_samr_QueryDomainInfo(pipe_cli, mem_ctx,2074 status = , mem_ctx, 1925 2075 domain_handle, 1926 2076 5, 1927 &dom_info); 2077 &dom_info, 2078 &result); 1928 2079 NT_STATUS_NOT_OK_RETURN(status); 2080 1929 2081 1930 2082 *info5 = dom_info->info5; … … 1932 2084 1933 2085 if (info6) { 1934 status = rpccli_samr_QueryDomainInfo(pipe_cli, mem_ctx,2086 status = , mem_ctx, 1935 2087 domain_handle, 1936 2088 6, 1937 &dom_info); 2089 &dom_info, 2090 &result); 1938 2091 NT_STATUS_NOT_OK_RETURN(status); 2092 1939 2093 1940 2094 *info6 = dom_info->info6; … … 1942 2096 1943 2097 if (info7) { 1944 status = rpccli_samr_QueryDomainInfo(pipe_cli, mem_ctx,2098 status = , mem_ctx, 1945 2099 domain_handle, 1946 2100 7, 1947 &dom_info); 2101 &dom_info, 2102 &result); 1948 2103 NT_STATUS_NOT_OK_RETURN(status); 2104 1949 2105 1950 2106 *info7 = dom_info->info7; … … 1952 2108 1953 2109 if (info12) { 1954 status = rpccli_samr_QueryDomainInfo2(pipe_cli, mem_ctx,2110 status = , mem_ctx, 1955 2111 domain_handle, 1956 2112 12, 1957 &dom_info); 2113 &dom_info, 2114 &result); 1958 2115 NT_STATUS_NOT_OK_RETURN(status); 2116 1959 2117 1960 2118 *info12 = dom_info->info12; … … 2061 2219 talloc_strdup(mem_ctx, dom_info5.domain_name.string); 2062 2220 info2->usrmod2_domain_id = 2063 (struct domsid *) sid_dup_talloc(mem_ctx, domain_sid);2221 (struct domsid *)(mem_ctx, domain_sid); 2064 2222 2065 2223 NT_STATUS_HAVE_NO_MEMORY(info2->usrmod2_domain_name); … … 2274 2432 struct samr_DomInfo12 *info12) 2275 2433 { 2276 NTSTATUS status ;2434 NTSTATUS status; 2277 2435 union samr_DomainInfo dom_info; 2436 2278 2437 2279 2438 if (info1) { … … 2283 2442 dom_info.info1 = *info1; 2284 2443 2285 status = rpccli_samr_SetDomainInfo(pipe_cli, mem_ctx,2444 status = , mem_ctx, 2286 2445 domain_handle, 2287 2446 1, 2288 &dom_info); 2447 &dom_info, 2448 &result); 2289 2449 NT_STATUS_NOT_OK_RETURN(status); 2450 2290 2451 } 2291 2452 … … 2296 2457 dom_info.info3 = *info3; 2297 2458 2298 status = rpccli_samr_SetDomainInfo(pipe_cli, mem_ctx,2459 status = , mem_ctx, 2299 2460 domain_handle, 2300 2461 3, 2301 &dom_info); 2462 &dom_info, 2463 &result); 2302 2464 2303 2465 NT_STATUS_NOT_OK_RETURN(status); 2466 2304 2467 } 2305 2468 … … 2310 2473 dom_info.info12 = *info12; 2311 2474 2312 status = rpccli_samr_SetDomainInfo(pipe_cli, mem_ctx,2475 status = , mem_ctx, 2313 2476 domain_handle, 2314 2477 12, 2315 &dom_info); 2478 &dom_info, 2479 &result); 2316 2480 2317 2481 NT_STATUS_NOT_OK_RETURN(status); 2482 2318 2483 } 2319 2484 … … 2802 2967 2803 2968 NTSTATUS status = NT_STATUS_OK; 2969 2804 2970 WERROR werr; 2971 2805 2972 2806 2973 ZERO_STRUCT(connect_handle); … … 2829 2996 goto done; 2830 2997 } 2998 2999 2831 3000 2832 3001 werr = libnetapi_samr_open_domain(ctx, pipe_cli, … … 2843 3012 init_lsa_String(&lsa_account_name, r->in.user_name); 2844 3013 2845 status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),3014 status = , talloc_tos(), 2846 3015 &domain_handle, 2847 3016 1, 2848 3017 &lsa_account_name, 2849 3018 &user_rids, 2850 &name_types); 3019 &name_types, 3020 &result); 2851 3021 if (!NT_STATUS_IS_OK(status)) { 2852 3022 werr = ntstatus_to_werror(status); 2853 3023 goto done; 2854 3024 } 2855 2856 status = rpccli_samr_OpenUser(pipe_cli, talloc_tos(), 3025 if (!NT_STATUS_IS_OK(result)) { 3026 werr = ntstatus_to_werror(result); 3027 goto done; 3028 } 3029 3030 status = dcerpc_samr_OpenUser(b, talloc_tos(), 2857 3031 &domain_handle, 2858 3032 SAMR_USER_ACCESS_GET_GROUPS, 2859 3033 user_rids.ids[0], 2860 &user_handle); 3034 &user_handle, 3035 &result); 2861 3036 if (!NT_STATUS_IS_OK(status)) { 2862 3037 werr = ntstatus_to_werror(status); 2863 3038 goto done; 2864 3039 } 2865 2866 status = rpccli_samr_GetGroupsForUser(pipe_cli, talloc_tos(), 3040 if (!NT_STATUS_IS_OK(result)) { 3041 werr = ntstatus_to_werror(result); 3042 goto done; 3043 } 3044 3045 status = dcerpc_samr_GetGroupsForUser(b, talloc_tos(), 2867 3046 &user_handle, 2868 &rid_array); 3047 &rid_array, 3048 &result); 2869 3049 if (!NT_STATUS_IS_OK(status)) { 2870 3050 werr = ntstatus_to_werror(status); 3051 3052 3053 3054 2871 3055 goto done; 2872 3056 } … … 2882 3066 } 2883 3067 2884 status = rpccli_samr_LookupRids(pipe_cli, talloc_tos(),3068 status = , talloc_tos(), 2885 3069 &domain_handle, 2886 3070 rid_array->count, 2887 3071 rids, 2888 3072 &names, 2889 &types );2890 if (!NT_STATUS_IS_OK(status) &&2891 !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) {3073 &types 3074 3075 )) { 2892 3076 werr = ntstatus_to_werror(status); 3077 3078 3079 3080 3081 2893 3082 goto done; 2894 3083 } … … 2957 3146 2958 3147 NTSTATUS status = NT_STATUS_OK; 3148 2959 3149 WERROR werr; 3150 2960 3151 2961 3152 ZERO_STRUCT(connect_handle); … … 2980 3171 goto done; 2981 3172 } 3173 3174 2982 3175 2983 3176 werr = libnetapi_samr_open_domain(ctx, pipe_cli, … … 2994 3187 init_lsa_String(&lsa_account_name, r->in.user_name); 2995 3188 2996 status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),3189 status = , talloc_tos(), 2997 3190 &domain_handle, 2998 3191 1, 2999 3192 &lsa_account_name, 3000 3193 &user_rids, 3001 &name_types); 3194 &name_types, 3195 &result); 3002 3196 if (!NT_STATUS_IS_OK(status)) { 3003 3197 werr = ntstatus_to_werror(status); 3004 3198 goto done; 3005 3199 } 3006 3007 status = rpccli_samr_OpenUser(pipe_cli, talloc_tos(), 3200 if (!NT_STATUS_IS_OK(result)) { 3201 werr = ntstatus_to_werror(result); 3202 goto done; 3203 } 3204 3205 status = dcerpc_samr_OpenUser(b, talloc_tos(), 3008 3206 &domain_handle, 3009 3207 SAMR_USER_ACCESS_GET_GROUPS, 3010 3208 user_rids.ids[0], 3011 &user_handle); 3209 &user_handle, 3210 &result); 3012 3211 if (!NT_STATUS_IS_OK(status)) { 3013 3212 werr = ntstatus_to_werror(status); 3213 3214 3215 3216 3014 3217 goto done; 3015 3218 } … … 3044 3247 } 3045 3248 3046 status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),3249 status = , talloc_tos(), 3047 3250 &domain_handle, 3048 3251 r->in.num_entries, 3049 3252 lsa_names, 3050 3253 &group_rids, 3051 &name_types); 3254 &name_types, 3255 &result); 3052 3256 if (!NT_STATUS_IS_OK(status)) { 3053 3257 werr = ntstatus_to_werror(status); 3258 3259 3260 3261 3054 3262 goto done; 3055 3263 } … … 3058 3266 num_member_rids = group_rids.count; 3059 3267 3060 status = rpccli_samr_GetGroupsForUser(pipe_cli, talloc_tos(),3268 status = , talloc_tos(), 3061 3269 &user_handle, 3062 &rid_array); 3270 &rid_array, 3271 &result); 3063 3272 if (!NT_STATUS_IS_OK(status)) { 3064 3273 werr = ntstatus_to_werror(status); 3274 3275 3276 3277 3065 3278 goto done; 3066 3279 } … … 3109 3322 3110 3323 for (i=0; i < num_add_rids; i++) { 3111 status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(),3324 status = , talloc_tos(), 3112 3325 &domain_handle, 3113 3326 SAMR_GROUP_ACCESS_ADD_MEMBER, 3114 3327 add_rids[i], 3115 &group_handle); 3328 &group_handle, 3329 &result); 3116 3330 if (!NT_STATUS_IS_OK(status)) { 3117 3331 werr = ntstatus_to_werror(status); 3118 3332 goto done; 3119 3333 } 3120 3121 status = rpccli_samr_AddGroupMember(pipe_cli, talloc_tos(), 3334 if (!NT_STATUS_IS_OK(result)) { 3335 werr = ntstatus_to_werror(result); 3336 goto done; 3337 } 3338 3339 status = dcerpc_samr_AddGroupMember(b, talloc_tos(), 3122 3340 &group_handle, 3123 3341 user_rids.ids[0], 3124 7 /* ? */); 3342 7 /* ? */, 3343 &result); 3125 3344 if (!NT_STATUS_IS_OK(status)) { 3126 3345 werr = ntstatus_to_werror(status); 3127 3346 goto done; 3128 3347 } 3348 3349 3350 3351 3129 3352 3130 3353 if (is_valid_policy_hnd(&group_handle)) { 3131 rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);3354 ); 3132 3355 } 3133 3356 } … … 3136 3359 3137 3360 for (i=0; i < num_del_rids; i++) { 3138 status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(),3361 status = , talloc_tos(), 3139 3362 &domain_handle, 3140 3363 SAMR_GROUP_ACCESS_REMOVE_MEMBER, 3141 3364 del_rids[i], 3142 &group_handle); 3365 &group_handle, 3366 &result); 3143 3367 if (!NT_STATUS_IS_OK(status)) { 3144 3368 werr = ntstatus_to_werror(status); 3145 3369 goto done; 3146 3370 } 3147 3148 status = rpccli_samr_DeleteGroupMember(pipe_cli, talloc_tos(), 3371 if (!NT_STATUS_IS_OK(result)) { 3372 werr = ntstatus_to_werror(result); 3373 goto done; 3374 } 3375 3376 status = dcerpc_samr_DeleteGroupMember(b, talloc_tos(), 3149 3377 &group_handle, 3150 user_rids.ids[0]); 3378 user_rids.ids[0], 3379 &result); 3151 3380 if (!NT_STATUS_IS_OK(status)) { 3152 3381 werr = ntstatus_to_werror(status); 3153 3382 goto done; 3154 3383 } 3384 3385 3386 3387 3155 3388 3156 3389 if (is_valid_policy_hnd(&group_handle)) { 3157 rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);3390 ); 3158 3391 } 3159 3392 } … … 3163 3396 done: 3164 3397 if (is_valid_policy_hnd(&group_handle)) { 3165 rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);3398 ); 3166 3399 } 3167 3400 … … 3235 3468 3236 3469 NTSTATUS status = NT_STATUS_OK; 3470 3237 3471 WERROR werr; 3472 3238 3473 3239 3474 ZERO_STRUCT(connect_handle); … … 3262 3497 goto done; 3263 3498 } 3499 3500 3264 3501 3265 3502 werr = libnetapi_samr_open_domain(ctx, pipe_cli, … … 3288 3525 init_lsa_String(&lsa_account_name, r->in.user_name); 3289 3526 3290 status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),3527 status = , talloc_tos(), 3291 3528 &domain_handle, 3292 3529 1, 3293 3530 &lsa_account_name, 3294 3531 &user_rids, 3295 &name_types); 3532 &name_types, 3533 &result); 3296 3534 if (!NT_STATUS_IS_OK(status)) { 3297 3535 werr = ntstatus_to_werror(status); 3298 3536 goto done; 3299 3537 } 3300 3301 status = rpccli_samr_OpenUser(pipe_cli, talloc_tos(), 3538 if (!NT_STATUS_IS_OK(result)) { 3539 werr = ntstatus_to_werror(result); 3540 goto done; 3541 } 3542 3543 status = dcerpc_samr_OpenUser(b, talloc_tos(), 3302 3544 &domain_handle, 3303 3545 SAMR_USER_ACCESS_GET_GROUPS, 3304 3546 user_rids.ids[0], 3305 &user_handle); 3547 &user_handle, 3548 &result); 3306 3549 if (!NT_STATUS_IS_OK(status)) { 3307 3550 werr = ntstatus_to_werror(status); 3308 3551 goto done; 3309 3552 } 3310 3311 status = rpccli_samr_GetGroupsForUser(pipe_cli, talloc_tos(), 3553 if (!NT_STATUS_IS_OK(result)) { 3554 werr = ntstatus_to_werror(result); 3555 goto done; 3556 } 3557 3558 status = dcerpc_samr_GetGroupsForUser(b, talloc_tos(), 3312 3559 &user_handle, 3313 &rid_array); 3560 &rid_array, 3561 &result); 3314 3562 if (!NT_STATUS_IS_OK(status)) { 3315 3563 werr = ntstatus_to_werror(status); 3564 3565 3566 3567 3316 3568 goto done; 3317 3569 } … … 3329 3581 } 3330 3582 3331 sid_array.sids[0].sid = sid_dup_talloc(ctx, &user_sid);3583 sid_array.sids[0].sid = (ctx, &user_sid); 3332 3584 if (!sid_array.sids[0].sid) { 3333 3585 werr = WERR_NOMEM; … … 3343 3595 } 3344 3596 3345 sid_array.sids[i+1].sid = sid_dup_talloc(ctx, &sid);3597 sid_array.sids[i+1].sid = (ctx, &sid); 3346 3598 if (!sid_array.sids[i+1].sid) { 3347 3599 werr = WERR_NOMEM; … … 3350 3602 } 3351 3603 3352 status = rpccli_samr_GetAliasMembership(pipe_cli, talloc_tos(),3604 status = , talloc_tos(), 3353 3605 &domain_handle, 3354 3606 &sid_array, 3355 &domain_rids); 3607 &domain_rids, 3608 &result); 3356 3609 if (!NT_STATUS_IS_OK(status)) { 3357 3610 werr = ntstatus_to_werror(status); 3611 3612 3613 3614 3358 3615 goto done; 3359 3616 } … … 3367 3624 } 3368 3625 3369 status = rpccli_samr_GetAliasMembership(pipe_cli, talloc_tos(),3626 status = , talloc_tos(), 3370 3627 &builtin_handle, 3371 3628 &sid_array, 3372 &builtin_rids); 3629 &builtin_rids, 3630 &result); 3373 3631 if (!NT_STATUS_IS_OK(status)) { 3374 3632 werr = ntstatus_to_werror(status); 3633 3634 3635 3636 3375 3637 goto done; 3376 3638 } … … 3384 3646 } 3385 3647 3386 status = rpccli_samr_LookupRids(pipe_cli, talloc_tos(),3648 status = , talloc_tos(), 3387 3649 &builtin_handle, 3388 3650 num_rids, 3389 3651 rids, 3390 3652 &names, 3391 &types); 3653 &types, 3654 &result); 3392 3655 if (!NT_STATUS_IS_OK(status)) { 3393 3656 werr = ntstatus_to_werror(status); 3657 3658 3659 3660 3394 3661 goto done; 3395 3662 }
Note:
See TracChangeset
for help on using the changeset viewer.
