Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/lib/netapi/user.c

    r594 r740  
    2424#include "lib/netapi/netapi_private.h"
    2525#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"
    2733
    2834/****************************************************************
     
    109115        info21->lm_owf_password         = zero_parameters;
    110116        info21->nt_owf_password         = zero_parameters;
    111         info21->unknown3.string         = NULL;
     117        info21->     = NULL;
    112118        info21->buf_count               = 0;
    113119        info21->buffer                  = NULL;
     
    124130        info21->nt_password_set         = 0;
    125131        info21->password_expired        = infoX->usriX_password_expired;
    126         info21->unknown4                = 0;
     132        info21->  = 0;
    127133}
    128134
     
    293299        union samr_UserInfo user_info;
    294300        struct samr_UserInfo21 info21;
    295         NTSTATUS status;
     301        NTSTATUS status, result;
     302        struct dcerpc_binding_handle *b = pipe_cli->binding_handle;
    296303
    297304        if (!uX) {
     
    311318                                          &user_info.info25.password);
    312319
    313                 status = rpccli_samr_SetUserInfo2(pipe_cli, talloc_tos(),
     320                status = , talloc_tos(),
    314321                                                  user_handle,
    315322                                                  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)) {
    319326
    320327                        user_info.info23.info = info21;
     
    324331                                                &user_info.info23.password);
    325332
    326                         status = rpccli_samr_SetUserInfo2(pipe_cli, talloc_tos(),
     333                        status = , talloc_tos(),
    327334                                                          user_handle,
    328335                                                          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;
    330345                }
    331346        } else {
     
    333348                user_info.info21 = info21;
    334349
    335                 status = rpccli_samr_SetUserInfo(pipe_cli, talloc_tos(),
     350                status = , talloc_tos(),
    336351                                                 user_handle,
    337352                                                 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;
    342361}
    343362
     
    349368{
    350369        struct rpc_pipe_client *pipe_cli = NULL;
    351         NTSTATUS status;
     370        NTSTATUS status;
    352371        WERROR werr;
    353372        struct policy_handle connect_handle, domain_handle, user_handle;
     
    359378        uint32_t rid = 0;
    360379        struct USER_INFO_X uX;
     380
     381
    361382
    362383        ZERO_STRUCT(connect_handle);
     
    385406                goto done;
    386407        }
     408
     409
    387410
    388411        status = construct_USER_INFO_X(r->in.level, r->in.buffer, &uX);
     
    407430        init_lsa_String(&lsa_account_name, uX.usriX_name);
    408431
    409         status = rpccli_samr_CreateUser2(pipe_cli, talloc_tos(),
     432        status = , talloc_tos(),
    410433                                         &domain_handle,
    411434                                         &lsa_account_name,
     
    418441                                         &user_handle,
    419442                                         &access_granted,
    420                                          &rid);
     443                                         &rid,
     444                                         &result);
    421445        if (!NT_STATUS_IS_OK(status)) {
    422446                werr = ntstatus_to_werror(status);
    423447                goto done;
    424448        }
    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(),
    427455                                           &user_handle,
    428456                                           16,
    429                                            &user_info);
     457                                           &user_info,
     458                                           &result);
    430459        if (!NT_STATUS_IS_OK(status)) {
    431460                werr = ntstatus_to_werror(status);
     461
     462
     463
     464
    432465                goto done;
    433466        }
     
    438471        }
    439472
    440         status = rpccli_samr_GetUserPwInfo(pipe_cli, talloc_tos(),
     473        status = , talloc_tos(),
    441474                                           &user_handle,
    442                                            &pw_info);
     475                                           &pw_info,
     476                                           &result);
    443477        if (!NT_STATUS_IS_OK(status)) {
    444478                werr = ntstatus_to_werror(status);
    445479                goto done;
    446480        }
     481
     482
     483
     484
     485
     486
     487
     488
     489
     490
    447491
    448492        uX.usriX_flags |= ACB_NORMAL;
    449493
    450494        status = set_user_info_USER_INFO_X(ctx, pipe_cli,
    451                                            &pipe_cli->auth->user_session_key,
     495                                           &session_key,
    452496                                           &user_handle,
    453497                                           &uX);
     
    461505
    462506 failed:
    463         rpccli_samr_DeleteUser(pipe_cli, talloc_tos(),
    464                                &user_handle);
     507        dcerpc_samr_DeleteUser(b, talloc_tos(),
     508                               &user_handle,
     509                               &result);
    465510
    466511 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                );
    469514        }
    470515
     
    493538{
    494539        struct rpc_pipe_client *pipe_cli = NULL;
    495         NTSTATUS status;
     540        NTSTATUS status;
    496541        WERROR werr;
    497542        struct policy_handle connect_handle, builtin_handle, domain_handle, user_handle;
     
    500545        struct dom_sid2 *domain_sid = NULL;
    501546        struct dom_sid2 user_sid;
     547
    502548
    503549        ZERO_STRUCT(connect_handle);
     
    513559                goto done;
    514560        }
     561
     562
    515563
    516564        werr = libnetapi_samr_open_domain(ctx, pipe_cli,
     
    525573        }
    526574
    527         status = rpccli_samr_OpenDomain(pipe_cli, talloc_tos(),
     575        status = , talloc_tos(),
    528576                                        &connect_handle,
    529577                                        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);
    532581        if (!NT_STATUS_IS_OK(status)) {
    533582                werr = ntstatus_to_werror(status);
    534583                goto done;
    535584        }
     585
     586
     587
     588
    536589
    537590        init_lsa_String(&lsa_account_name, r->in.user_name);
    538591
    539         status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
     592        status = , talloc_tos(),
    540593                                         &domain_handle,
    541594                                         1,
    542595                                         &lsa_account_name,
    543596                                         &user_rids,
    544                                          &name_types);
     597                                         &name_types,
     598                                         &result);
    545599        if (!NT_STATUS_IS_OK(status)) {
    546600                werr = ntstatus_to_werror(status);
    547601                goto done;
    548602        }
    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(),
    551609                                      &domain_handle,
    552610                                      SEC_STD_DELETE,
    553611                                      user_rids.ids[0],
    554                                       &user_handle);
     612                                      &user_handle,
     613                                      &result);
    555614        if (!NT_STATUS_IS_OK(status)) {
    556615                werr = ntstatus_to_werror(status);
    557616                goto done;
    558617        }
     618
     619
     620
     621
    559622
    560623        sid_compose(&user_sid, domain_sid, user_rids.ids[0]);
    561624
    562         status = rpccli_samr_RemoveMemberFromForeignDomain(pipe_cli, talloc_tos(),
     625        status = , talloc_tos(),
    563626                                                           &builtin_handle,
    564                                                            &user_sid);
     627                                                           &user_sid,
     628                                                           &result);
    565629        if (!NT_STATUS_IS_OK(status)) {
    566630                werr = ntstatus_to_werror(status);
    567631                goto done;
    568632        }
    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);
    572641        if (!NT_STATUS_IS_OK(status)) {
    573642                werr = ntstatus_to_werror(status);
     643
     644
     645
     646
    574647                goto done;
    575648        }
     
    579652 done:
    580653        if (is_valid_policy_hnd(&user_handle)) {
    581                 rpccli_samr_Close(pipe_cli, talloc_tos(), &user_handle);
     654                );
    582655        }
    583656
     
    615688                                           uint32_t *auth_flag_p)
    616689{
    617         NTSTATUS status;
     690        NTSTATUS status;
    618691
    619692        struct policy_handle user_handle;
     
    623696                               SAMR_USER_ACCESS_GET_ATTRIBUTES |
    624697                               SAMR_USER_ACCESS_GET_NAME_ETC;
     698
    625699
    626700        ZERO_STRUCT(user_handle);
     
    653727        }
    654728
    655         status = rpccli_samr_OpenUser(pipe_cli, mem_ctx,
     729        status = , mem_ctx,
    656730                                      domain_handle,
    657731                                      access_mask,
    658732                                      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,
    665744                                           &user_handle,
    666745                                           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,
    673757                                           &user_handle,
    674758                                           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;
    677766                goto done;
    678767        }
     
    686775                struct dom_sid sid;
    687776
    688                 status = rpccli_samr_GetGroupsForUser(pipe_cli, mem_ctx,
     777                status = , mem_ctx,
    689778                                                      &user_handle,
    690                                                       &rid_array);
     779                                                      &rid_array,
     780                                                      &result);
    691781                if (!NT_STATUS_IS_OK(status)) {
     782
     783
     784
     785
    692786                        goto done;
    693787                }
     
    700794                for (i=0; i<rid_array->count; i++) {
    701795                        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);
    703797                        NT_STATUS_HAVE_NO_MEMORY(sid_array.sids[i].sid);
    704798                }
    705799
    706800                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);
    708802                NT_STATUS_HAVE_NO_MEMORY(sid_array.sids[i].sid);
    709803
    710                 status = rpccli_samr_GetAliasMembership(pipe_cli, mem_ctx,
     804                status = , mem_ctx,
    711805                                                        builtin_handle,
    712806                                                        &sid_array,
    713                                                         &alias_rids);
     807                                                        &alias_rids,
     808                                                        &result);
    714809                if (!NT_STATUS_IS_OK(status)) {
     810
     811
     812
     813
    715814                        goto done;
    716815                }
     
    741840 done:
    742841        if (is_valid_policy_hnd(&user_handle)) {
    743                 rpccli_samr_Close(pipe_cli, mem_ctx, &user_handle);
     842                );
    744843        }
    745844
     
    9181017                return NT_STATUS_NO_MEMORY;
    9191018        }
    920         i->usri4_user_sid       = (struct domsid *)sid_dup_talloc(mem_ctx, &sid);
     1019        i->usri4_user_sid       = (struct domsid *)(mem_ctx, &sid);
    9211020        i->usri4_primary_group_id = i21->primary_gid;
    9221021        i->usri4_profile        = talloc_strdup(mem_ctx, i21->profile_path.string);
     
    10191118                return NT_STATUS_NO_MEMORY;
    10201119        }
    1021         i->usri23_user_sid      = (struct domsid *)sid_dup_talloc(mem_ctx, &sid);
     1120        i->usri23_user_sid      = (struct domsid *)(mem_ctx, &sid);
    10221121
    10231122        return NT_STATUS_OK;
     
    11851284
    11861285        NTSTATUS status = NT_STATUS_OK;
     1286
    11871287        WERROR werr;
     1288
    11881289
    11891290        ZERO_STRUCT(connect_handle);
     
    12201321        }
    12211322
     1323
     1324
    12221325        werr = libnetapi_samr_open_builtin_domain(ctx, pipe_cli,
    12231326                                                  SAMR_ACCESS_ENUM_DOMAINS |
     
    12641367        }
    12651368
    1266         status = rpccli_samr_EnumDomainUsers(pipe_cli,
     1369        status = ,
    12671370                                             ctx,
    12681371                                             &domain_handle,
     
    12711374                                             &sam,
    12721375                                             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)) {
    12761384                goto done;
    12771385        }
     
    12961404 done:
    12971405        /* 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()) {
    13001408
    13011409                if (ctx->disable_policy_handle_cache) {
     
    14901598        struct policy_handle domain_handle;
    14911599        union samr_DispInfo info;
     1600
    14921601
    14931602        uint32_t total_size = 0;
     
    14951604
    14961605        NTSTATUS status = NT_STATUS_OK;
     1606
    14971607        WERROR werr;
    14981608        WERROR werr_tmp;
     
    15181628                goto done;
    15191629        }
     1630
     1631
    15201632
    15211633        werr = libnetapi_samr_open_domain(ctx, pipe_cli,
     
    15321644        }
    15331645
    1534         status = rpccli_samr_QueryDisplayInfo2(pipe_cli,
     1646        status = ,
    15351647                                               ctx,
    15361648                                               &domain_handle,
     
    15411653                                               &total_size,
    15421654                                               &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)) {
    15461663                goto done;
    15471664        }
     
    15561673 done:
    15571674        /* 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()) {
    15601677
    15611678                if (ctx->disable_policy_handle_cache) {
     
    16041721{
    16051722        struct rpc_pipe_client *pipe_cli = NULL;
    1606         NTSTATUS status;
     1723        NTSTATUS status;
    16071724        WERROR werr;
    16081725
     
    16121729        struct samr_Ids user_rids, name_types;
    16131730        uint32_t num_entries = 0;
     1731
    16141732
    16151733        ZERO_STRUCT(connect_handle);
     
    16451763        }
    16461764
     1765
     1766
    16471767        werr = libnetapi_samr_open_domain(ctx, pipe_cli,
    16481768                                          SAMR_ACCESS_ENUM_DOMAINS |
     
    16691789        init_lsa_String(&lsa_account_name, r->in.user_name);
    16701790
    1671         status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
     1791        status = , talloc_tos(),
    16721792                                         &domain_handle,
    16731793                                         1,
    16741794                                         &lsa_account_name,
    16751795                                         &user_rids,
    1676                                          &name_types);
     1796                                         &name_types,
     1797                                         &result);
    16771798        if (!NT_STATUS_IS_OK(status)) {
    16781799                werr = ntstatus_to_werror(status);
     1800
     1801
     1802
     1803
    16791804                goto done;
    16801805        }
     
    16951820
    16961821 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                );
    16991824        }
    17001825
     
    17231848{
    17241849        struct rpc_pipe_client *pipe_cli = NULL;
    1725         NTSTATUS status;
     1850        NTSTATUS status;
    17261851        WERROR werr;
    17271852
     
    17331858
    17341859        struct USER_INFO_X uX;
     1860
     1861
    17351862
    17361863        ZERO_STRUCT(connect_handle);
     
    17671894                        break;
    17681895                case 3:
    1769                         user_mask = STD_RIGHT_READ_CONTROL_ACCESS |
    1770                                     STD_RIGHT_WRITE_DAC_ACCESS |
     1896                        user_mask = S |
     1897                                    S |
    17711898                                    SAMR_USER_ACCESS_GET_GROUPS |
    17721899                                    SAMR_USER_ACCESS_SET_PASSWORD |
     
    17991926        }
    18001927
     1928
     1929
    18011930        werr = libnetapi_samr_open_domain(ctx, pipe_cli,
    18021931                                          SAMR_ACCESS_ENUM_DOMAINS |
     
    18241953        init_lsa_String(&lsa_account_name, r->in.user_name);
    18251954
    1826         status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
     1955        status = , talloc_tos(),
    18271956                                         &domain_handle,
    18281957                                         1,
    18291958                                         &lsa_account_name,
    18301959                                         &user_rids,
    1831                                          &name_types);
     1960                                         &name_types,
     1961                                         &result);
    18321962        if (!NT_STATUS_IS_OK(status)) {
    18331963                werr = ntstatus_to_werror(status);
    18341964                goto done;
    18351965        }
    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(),
    18381972                                      &domain_handle,
    18391973                                      user_mask,
    18401974                                      user_rids.ids[0],
    1841                                       &user_handle);
     1975                                      &user_handle,
     1976                                      &result);
    18421977        if (!NT_STATUS_IS_OK(status)) {
    18431978                werr = ntstatus_to_werror(status);
    18441979                goto done;
    18451980        }
     1981
     1982
     1983
     1984
    18461985
    18471986        status = construct_USER_INFO_X(r->in.level, r->in.buffer, &uX);
     
    18511990        }
    18521991
     1992
     1993
     1994
     1995
     1996
     1997
    18531998        status = set_user_info_USER_INFO_X(ctx, pipe_cli,
    1854                                            &pipe_cli->auth->user_session_key,
     1999                                           &session_key,
    18552000                                           &user_handle,
    18562001                                           &uX);
     
    18632008
    18642009 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                );
    18672012        }
    18682013
     
    18982043                                           struct samr_DomInfo12 *info12)
    18992044{
    1900         NTSTATUS status;
     2045        NTSTATUS status;
    19012046        union samr_DomainInfo *dom_info = NULL;
     2047
    19022048
    19032049        if (info1) {
    1904                 status = rpccli_samr_QueryDomainInfo(pipe_cli, mem_ctx,
     2050                status = , mem_ctx,
    19052051                                                     domain_handle,
    19062052                                                     1,
    1907                                                      &dom_info);
     2053                                                     &dom_info,
     2054                                                     &result);
    19082055                NT_STATUS_NOT_OK_RETURN(status);
     2056
    19092057
    19102058                *info1 = dom_info->info1;
     
    19122060
    19132061        if (info3) {
    1914                 status = rpccli_samr_QueryDomainInfo(pipe_cli, mem_ctx,
     2062                status = , mem_ctx,
    19152063                                                     domain_handle,
    19162064                                                     3,
    1917                                                      &dom_info);
     2065                                                     &dom_info,
     2066                                                     &result);
    19182067                NT_STATUS_NOT_OK_RETURN(status);
     2068
    19192069
    19202070                *info3 = dom_info->info3;
     
    19222072
    19232073        if (info5) {
    1924                 status = rpccli_samr_QueryDomainInfo(pipe_cli, mem_ctx,
     2074                status = , mem_ctx,
    19252075                                                     domain_handle,
    19262076                                                     5,
    1927                                                      &dom_info);
     2077                                                     &dom_info,
     2078                                                     &result);
    19282079                NT_STATUS_NOT_OK_RETURN(status);
     2080
    19292081
    19302082                *info5 = dom_info->info5;
     
    19322084
    19332085        if (info6) {
    1934                 status = rpccli_samr_QueryDomainInfo(pipe_cli, mem_ctx,
     2086                status = , mem_ctx,
    19352087                                                     domain_handle,
    19362088                                                     6,
    1937                                                      &dom_info);
     2089                                                     &dom_info,
     2090                                                     &result);
    19382091                NT_STATUS_NOT_OK_RETURN(status);
     2092
    19392093
    19402094                *info6 = dom_info->info6;
     
    19422096
    19432097        if (info7) {
    1944                 status = rpccli_samr_QueryDomainInfo(pipe_cli, mem_ctx,
     2098                status = , mem_ctx,
    19452099                                                     domain_handle,
    19462100                                                     7,
    1947                                                      &dom_info);
     2101                                                     &dom_info,
     2102                                                     &result);
    19482103                NT_STATUS_NOT_OK_RETURN(status);
     2104
    19492105
    19502106                *info7 = dom_info->info7;
     
    19522108
    19532109        if (info12) {
    1954                 status = rpccli_samr_QueryDomainInfo2(pipe_cli, mem_ctx,
     2110                status = , mem_ctx,
    19552111                                                      domain_handle,
    19562112                                                      12,
    1957                                                       &dom_info);
     2113                                                      &dom_info,
     2114                                                      &result);
    19582115                NT_STATUS_NOT_OK_RETURN(status);
     2116
    19592117
    19602118                *info12 = dom_info->info12;
     
    20612219                talloc_strdup(mem_ctx, dom_info5.domain_name.string);
    20622220        info2->usrmod2_domain_id =
    2063                 (struct domsid *)sid_dup_talloc(mem_ctx, domain_sid);
     2221                (struct domsid *)(mem_ctx, domain_sid);
    20642222
    20652223        NT_STATUS_HAVE_NO_MEMORY(info2->usrmod2_domain_name);
     
    22742432                                         struct samr_DomInfo12 *info12)
    22752433{
    2276         NTSTATUS status;
     2434        NTSTATUS status;
    22772435        union samr_DomainInfo dom_info;
     2436
    22782437
    22792438        if (info1) {
     
    22832442                dom_info.info1 = *info1;
    22842443
    2285                 status = rpccli_samr_SetDomainInfo(pipe_cli, mem_ctx,
     2444                status = , mem_ctx,
    22862445                                                   domain_handle,
    22872446                                                   1,
    2288                                                    &dom_info);
     2447                                                   &dom_info,
     2448                                                   &result);
    22892449                NT_STATUS_NOT_OK_RETURN(status);
     2450
    22902451        }
    22912452
     
    22962457                dom_info.info3 = *info3;
    22972458
    2298                 status = rpccli_samr_SetDomainInfo(pipe_cli, mem_ctx,
     2459                status = , mem_ctx,
    22992460                                                   domain_handle,
    23002461                                                   3,
    2301                                                    &dom_info);
     2462                                                   &dom_info,
     2463                                                   &result);
    23022464
    23032465                NT_STATUS_NOT_OK_RETURN(status);
     2466
    23042467        }
    23052468
     
    23102473                dom_info.info12 = *info12;
    23112474
    2312                 status = rpccli_samr_SetDomainInfo(pipe_cli, mem_ctx,
     2475                status = , mem_ctx,
    23132476                                                   domain_handle,
    23142477                                                   12,
    2315                                                    &dom_info);
     2478                                                   &dom_info,
     2479                                                   &result);
    23162480
    23172481                NT_STATUS_NOT_OK_RETURN(status);
     2482
    23182483        }
    23192484
     
    28022967
    28032968        NTSTATUS status = NT_STATUS_OK;
     2969
    28042970        WERROR werr;
     2971
    28052972
    28062973        ZERO_STRUCT(connect_handle);
     
    28292996                goto done;
    28302997        }
     2998
     2999
    28313000
    28323001        werr = libnetapi_samr_open_domain(ctx, pipe_cli,
     
    28433012        init_lsa_String(&lsa_account_name, r->in.user_name);
    28443013
    2845         status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
     3014        status = , talloc_tos(),
    28463015                                         &domain_handle,
    28473016                                         1,
    28483017                                         &lsa_account_name,
    28493018                                         &user_rids,
    2850                                          &name_types);
     3019                                         &name_types,
     3020                                         &result);
    28513021        if (!NT_STATUS_IS_OK(status)) {
    28523022                werr = ntstatus_to_werror(status);
    28533023                goto done;
    28543024        }
    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(),
    28573031                                      &domain_handle,
    28583032                                      SAMR_USER_ACCESS_GET_GROUPS,
    28593033                                      user_rids.ids[0],
    2860                                       &user_handle);
     3034                                      &user_handle,
     3035                                      &result);
    28613036        if (!NT_STATUS_IS_OK(status)) {
    28623037                werr = ntstatus_to_werror(status);
    28633038                goto done;
    28643039        }
    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(),
    28673046                                              &user_handle,
    2868                                               &rid_array);
     3047                                              &rid_array,
     3048                                              &result);
    28693049        if (!NT_STATUS_IS_OK(status)) {
    28703050                werr = ntstatus_to_werror(status);
     3051
     3052
     3053
     3054
    28713055                goto done;
    28723056        }
     
    28823066        }
    28833067
    2884         status = rpccli_samr_LookupRids(pipe_cli, talloc_tos(),
     3068        status = , talloc_tos(),
    28853069                                        &domain_handle,
    28863070                                        rid_array->count,
    28873071                                        rids,
    28883072                                        &names,
    2889                                         &types);
    2890         if (!NT_STATUS_IS_OK(status) &&
    2891             !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) {
     3073                                        &types
     3074       
     3075        )) {
    28923076                werr = ntstatus_to_werror(status);
     3077
     3078
     3079
     3080
     3081
    28933082                goto done;
    28943083        }
     
    29573146
    29583147        NTSTATUS status = NT_STATUS_OK;
     3148
    29593149        WERROR werr;
     3150
    29603151
    29613152        ZERO_STRUCT(connect_handle);
     
    29803171                goto done;
    29813172        }
     3173
     3174
    29823175
    29833176        werr = libnetapi_samr_open_domain(ctx, pipe_cli,
     
    29943187        init_lsa_String(&lsa_account_name, r->in.user_name);
    29953188
    2996         status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
     3189        status = , talloc_tos(),
    29973190                                         &domain_handle,
    29983191                                         1,
    29993192                                         &lsa_account_name,
    30003193                                         &user_rids,
    3001                                          &name_types);
     3194                                         &name_types,
     3195                                         &result);
    30023196        if (!NT_STATUS_IS_OK(status)) {
    30033197                werr = ntstatus_to_werror(status);
    30043198                goto done;
    30053199        }
    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(),
    30083206                                      &domain_handle,
    30093207                                      SAMR_USER_ACCESS_GET_GROUPS,
    30103208                                      user_rids.ids[0],
    3011                                       &user_handle);
     3209                                      &user_handle,
     3210                                      &result);
    30123211        if (!NT_STATUS_IS_OK(status)) {
    30133212                werr = ntstatus_to_werror(status);
     3213
     3214
     3215
     3216
    30143217                goto done;
    30153218        }
     
    30443247        }
    30453248
    3046         status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
     3249        status = , talloc_tos(),
    30473250                                         &domain_handle,
    30483251                                         r->in.num_entries,
    30493252                                         lsa_names,
    30503253                                         &group_rids,
    3051                                          &name_types);
     3254                                         &name_types,
     3255                                         &result);
    30523256        if (!NT_STATUS_IS_OK(status)) {
    30533257                werr = ntstatus_to_werror(status);
     3258
     3259
     3260
     3261
    30543262                goto done;
    30553263        }
     
    30583266        num_member_rids = group_rids.count;
    30593267
    3060         status = rpccli_samr_GetGroupsForUser(pipe_cli, talloc_tos(),
     3268        status = , talloc_tos(),
    30613269                                              &user_handle,
    3062                                               &rid_array);
     3270                                              &rid_array,
     3271                                              &result);
    30633272        if (!NT_STATUS_IS_OK(status)) {
    30643273                werr = ntstatus_to_werror(status);
     3274
     3275
     3276
     3277
    30653278                goto done;
    30663279        }
     
    31093322
    31103323        for (i=0; i < num_add_rids; i++) {
    3111                 status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(),
     3324                status = , talloc_tos(),
    31123325                                               &domain_handle,
    31133326                                               SAMR_GROUP_ACCESS_ADD_MEMBER,
    31143327                                               add_rids[i],
    3115                                                &group_handle);
     3328                                               &group_handle,
     3329                                               &result);
    31163330                if (!NT_STATUS_IS_OK(status)) {
    31173331                        werr = ntstatus_to_werror(status);
    31183332                        goto done;
    31193333                }
    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(),
    31223340                                                    &group_handle,
    31233341                                                    user_rids.ids[0],
    3124                                                     7 /* ? */);
     3342                                                    7 /* ? */,
     3343                                                    &result);
    31253344                if (!NT_STATUS_IS_OK(status)) {
    31263345                        werr = ntstatus_to_werror(status);
    31273346                        goto done;
    31283347                }
     3348
     3349
     3350
     3351
    31293352
    31303353                if (is_valid_policy_hnd(&group_handle)) {
    3131                         rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);
     3354                        );
    31323355                }
    31333356        }
     
    31363359
    31373360        for (i=0; i < num_del_rids; i++) {
    3138                 status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(),
     3361                status = , talloc_tos(),
    31393362                                               &domain_handle,
    31403363                                               SAMR_GROUP_ACCESS_REMOVE_MEMBER,
    31413364                                               del_rids[i],
    3142                                                &group_handle);
     3365                                               &group_handle,
     3366                                               &result);
    31433367                if (!NT_STATUS_IS_OK(status)) {
    31443368                        werr = ntstatus_to_werror(status);
    31453369                        goto done;
    31463370                }
    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(),
    31493377                                                       &group_handle,
    3150                                                        user_rids.ids[0]);
     3378                                                       user_rids.ids[0],
     3379                                                       &result);
    31513380                if (!NT_STATUS_IS_OK(status)) {
    31523381                        werr = ntstatus_to_werror(status);
    31533382                        goto done;
    31543383                }
     3384
     3385
     3386
     3387
    31553388
    31563389                if (is_valid_policy_hnd(&group_handle)) {
    3157                         rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);
     3390                        );
    31583391                }
    31593392        }
     
    31633396 done:
    31643397        if (is_valid_policy_hnd(&group_handle)) {
    3165                 rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle);
     3398                );
    31663399        }
    31673400
     
    32353468
    32363469        NTSTATUS status = NT_STATUS_OK;
     3470
    32373471        WERROR werr;
     3472
    32383473
    32393474        ZERO_STRUCT(connect_handle);
     
    32623497                goto done;
    32633498        }
     3499
     3500
    32643501
    32653502        werr = libnetapi_samr_open_domain(ctx, pipe_cli,
     
    32883525        init_lsa_String(&lsa_account_name, r->in.user_name);
    32893526
    3290         status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(),
     3527        status = , talloc_tos(),
    32913528                                         &domain_handle,
    32923529                                         1,
    32933530                                         &lsa_account_name,
    32943531                                         &user_rids,
    3295                                          &name_types);
     3532                                         &name_types,
     3533                                         &result);
    32963534        if (!NT_STATUS_IS_OK(status)) {
    32973535                werr = ntstatus_to_werror(status);
    32983536                goto done;
    32993537        }
    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(),
    33023544                                      &domain_handle,
    33033545                                      SAMR_USER_ACCESS_GET_GROUPS,
    33043546                                      user_rids.ids[0],
    3305                                       &user_handle);
     3547                                      &user_handle,
     3548                                      &result);
    33063549        if (!NT_STATUS_IS_OK(status)) {
    33073550                werr = ntstatus_to_werror(status);
    33083551                goto done;
    33093552        }
    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(),
    33123559                                              &user_handle,
    3313                                               &rid_array);
     3560                                              &rid_array,
     3561                                              &result);
    33143562        if (!NT_STATUS_IS_OK(status)) {
    33153563                werr = ntstatus_to_werror(status);
     3564
     3565
     3566
     3567
    33163568                goto done;
    33173569        }
     
    33293581        }
    33303582
    3331         sid_array.sids[0].sid = sid_dup_talloc(ctx, &user_sid);
     3583        sid_array.sids[0].sid = (ctx, &user_sid);
    33323584        if (!sid_array.sids[0].sid) {
    33333585                werr = WERR_NOMEM;
     
    33433595                }
    33443596
    3345                 sid_array.sids[i+1].sid = sid_dup_talloc(ctx, &sid);
     3597                sid_array.sids[i+1].sid = (ctx, &sid);
    33463598                if (!sid_array.sids[i+1].sid) {
    33473599                        werr = WERR_NOMEM;
     
    33503602        }
    33513603
    3352         status = rpccli_samr_GetAliasMembership(pipe_cli, talloc_tos(),
     3604        status = , talloc_tos(),
    33533605                                                &domain_handle,
    33543606                                                &sid_array,
    3355                                                 &domain_rids);
     3607                                                &domain_rids,
     3608                                                &result);
    33563609        if (!NT_STATUS_IS_OK(status)) {
    33573610                werr = ntstatus_to_werror(status);
     3611
     3612
     3613
     3614
    33583615                goto done;
    33593616        }
     
    33673624        }
    33683625
    3369         status = rpccli_samr_GetAliasMembership(pipe_cli, talloc_tos(),
     3626        status = , talloc_tos(),
    33703627                                                &builtin_handle,
    33713628                                                &sid_array,
    3372                                                 &builtin_rids);
     3629                                                &builtin_rids,
     3630                                                &result);
    33733631        if (!NT_STATUS_IS_OK(status)) {
    33743632                werr = ntstatus_to_werror(status);
     3633
     3634
     3635
     3636
    33753637                goto done;
    33763638        }
     
    33843646        }
    33853647
    3386         status = rpccli_samr_LookupRids(pipe_cli, talloc_tos(),
     3648        status = , talloc_tos(),
    33873649                                        &builtin_handle,
    33883650                                        num_rids,
    33893651                                        rids,
    33903652                                        &names,
    3391                                         &types);
     3653                                        &types,
     3654                                        &result);
    33923655        if (!NT_STATUS_IS_OK(status)) {
    33933656                werr = ntstatus_to_werror(status);
     3657
     3658
     3659
     3660
    33943661                goto done;
    33953662        }
Note: See TracChangeset for help on using the changeset viewer.