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

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified vendor/current/source3/rpc_client/cli_lsarpc.c

    r414 r740  
    2424
    2525#include "includes.h"
    26 #include "../librpc/gen_ndr/cli_lsa.h"
     26#include "rpc_client/rpc_client.h"
     27#include "../librpc/gen_ndr/ndr_lsa_c.h"
     28#include "rpc_client/cli_lsarpc.h"
     29#include "rpc_client/init_lsa.h"
     30#include "../libcli/security/security.h"
    2731
    2832/** @defgroup lsa LSA - Local Security Architecture
     
    3943 **/
    4044
    41 /** Open a LSA policy handle
    42  *
    43  * @param cli Handle on an initialised SMB connection */
    44 
    45 NTSTATUS rpccli_lsa_open_policy(struct rpc_pipe_client *cli,
     45NTSTATUS dcerpc_lsa_open_policy(struct dcerpc_binding_handle *h,
    4646                                TALLOC_CTX *mem_ctx,
    47                                 bool sec_qos, uint32 des_access,
    48                                 struct policy_handle *pol)
     47                                bool sec_qos,
     48                                uint32_t des_access,
     49                                struct policy_handle *pol,
     50                                NTSTATUS *result)
    4951{
    5052        struct lsa_ObjectAttribute attr;
     
    6567        }
    6668
    67         return rpccli_lsa_OpenPolicy(cli, mem_ctx,
     69        return dcerpc_lsa_OpenPolicy(h,
     70                                     mem_ctx,
    6871                                     &system_name,
    6972                                     &attr,
    7073                                     des_access,
    71                                      pol);
     74                                     pol,
     75                                     result);
    7276}
    7377
    7478/** Open a LSA policy handle
    75   *
    76   * @param cli Handle on an initialised SMB connection
    77   */
    78 
    79 NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
    80                                  TALLOC_CTX *mem_ctx, bool sec_qos,
    81                                  uint32 des_access, struct policy_handle *pol)
     79 *
     80 * @param cli Handle on an initialised SMB connection */
     81
     82NTSTATUS rpccli_lsa_open_policy(struct rpc_pipe_client *cli,
     83                                TALLOC_CTX *mem_ctx,
     84                                bool sec_qos, uint32 des_access,
     85                                struct policy_handle *pol)
     86{
     87        NTSTATUS status;
     88        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
     89
     90        status = dcerpc_lsa_open_policy(cli->binding_handle,
     91                                        mem_ctx,
     92                                        sec_qos,
     93                                        des_access,
     94                                        pol,
     95                                        &result);
     96        if (!NT_STATUS_IS_OK(status)) {
     97                return status;
     98        }
     99
     100        return result;
     101}
     102
     103NTSTATUS dcerpc_lsa_open_policy2(struct dcerpc_binding_handle *h,
     104                                 TALLOC_CTX *mem_ctx,
     105                                 const char *srv_name_slash,
     106                                 bool sec_qos,
     107                                 uint32_t des_access,
     108                                 struct policy_handle *pol,
     109                                 NTSTATUS *result)
    82110{
    83111        struct lsa_ObjectAttribute attr;
     
    97125        }
    98126
    99         return rpccli_lsa_OpenPolicy2(cli, mem_ctx,
    100                                       cli->srv_name_slash,
     127        return dcerpc_lsa_OpenPolicy2(h,
     128                                      mem_ctx,
     129                                      srv_name_slash,
    101130                                      &attr,
    102131                                      des_access,
    103                                       pol);
     132                                      pol,
     133                                      result);
     134}
     135
     136/** Open a LSA policy handle
     137  *
     138  * @param cli Handle on an initialised SMB connection
     139  */
     140
     141NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
     142                                 TALLOC_CTX *mem_ctx, bool sec_qos,
     143                                 uint32 des_access, struct policy_handle *pol)
     144{
     145        NTSTATUS status;
     146        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
     147
     148        status = dcerpc_lsa_open_policy2(cli->binding_handle,
     149                                         mem_ctx,
     150                                         cli->srv_name_slash,
     151                                         sec_qos,
     152                                         des_access,
     153                                         pol,
     154                                         &result);
     155        if (!NT_STATUS_IS_OK(status)) {
     156                return status;
     157        }
     158
     159        return result;
    104160}
    105161
     
    107163 *
    108164 * internal version withOUT memory allocation of the target arrays.
    109  * this assumes suffciently sized arrays to store domains, names and types. */
    110 
    111 static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli,
     165 * this assumes sufficiently sized arrays to store domains, names and types. */
     166
     167static NTSTATUS dcerpc_lsa_lookup_sids_noalloc(struct dcerpc_binding_handle *h,
    112168                                               TALLOC_CTX *mem_ctx,
    113169                                               struct policy_handle *pol,
    114170                                               int num_sids,
    115                                                const DOM_SID *sids,
     171                                               const struct dom_sid *sids,
    116172                                               char **domains,
    117173                                               char **names,
    118174                                               enum lsa_SidType *types,
    119                                                bool use_lookupsids3)
    120 {
    121         NTSTATUS result = NT_STATUS_OK;
    122         TALLOC_CTX *tmp_ctx = NULL;
    123         int i;
     175                                               bool use_lookupsids3,
     176                                               NTSTATUS *presult)
     177{
     178        NTSTATUS status = NT_STATUS_OK;
     179        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
    124180        struct lsa_SidArray sid_array;
    125181        struct lsa_RefDomainList *ref_domains = NULL;
    126182        struct lsa_TransNameArray lsa_names;
     183        enum lsa_LookupNamesLevel level = LSA_LOOKUP_NAMES_ALL;
    127184        uint32_t count = 0;
    128         uint16_t level = 1;
     185        int i;
    129186
    130187        ZERO_STRUCT(lsa_names);
    131 
    132         tmp_ctx = talloc_new(mem_ctx);
    133         if (!tmp_ctx) {
    134                 DEBUG(0, ("rpccli_lsa_lookup_sids_noalloc: out of memory!\n"));
    135                 result = NT_STATUS_UNSUCCESSFUL;
    136                 goto done;
    137         }
    138188
    139189        sid_array.num_sids = num_sids;
    140190        sid_array.sids = TALLOC_ARRAY(mem_ctx, struct lsa_SidPtr, num_sids);
    141         if (!sid_array.sids) {
     191        if (sid_array.sids == NULL) {
    142192                return NT_STATUS_NO_MEMORY;
    143193        }
    144194
    145195        for (i = 0; i<num_sids; i++) {
    146                 sid_array.sids[i].sid = sid_dup_talloc(mem_ctx, &sids[i]);
     196                sid_array.sids[i].sid = dom_sid_dup(mem_ctx, &sids[i]);
    147197                if (!sid_array.sids[i].sid) {
    148198                        return NT_STATUS_NO_MEMORY;
     
    156206                ZERO_STRUCT(lsa_names2);
    157207
    158                 result = rpccli_lsa_LookupSids3(cli, mem_ctx,
     208                status = dcerpc_lsa_LookupSids3(h,
     209                                                mem_ctx,
    159210                                                &sid_array,
    160211                                                &ref_domains,
     
    162213                                                level,
    163214                                                &count,
    164                                                 0,
    165                                                 0);
    166 
    167                 if (!NT_STATUS_IS_ERR(result)) {
    168                         lsa_names.count = lsa_names2.count;
    169                         lsa_names.names = talloc_array(mem_ctx, struct lsa_TranslatedName, lsa_names.count);
    170                         if (!lsa_names.names) {
     215                                                LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES,
     216                                                LSA_CLIENT_REVISION_2,
     217                                                &result);
     218                if (!NT_STATUS_IS_OK(status)) {
     219                        return status;
     220                }
     221
     222                if(!NT_STATUS_IS_ERR(result)) {
     223                        lsa_names.count = lsa_names2.count;
     224                        lsa_names.names = talloc_array(mem_ctx,
     225                                                       struct lsa_TranslatedName,
     226                                                       lsa_names.count);
     227                        if (lsa_names.names == NULL) {
    171228                                return NT_STATUS_NO_MEMORY;
    172229                        }
     
    179236
    180237        } else {
    181                 result = rpccli_lsa_LookupSids(cli, mem_ctx,
     238                status = dcerpc_lsa_LookupSids(h,
     239                                               mem_ctx,
    182240                                               pol,
    183241                                               &sid_array,
     
    185243                                               &lsa_names,
    186244                                               level,
    187                                                &count);
    188         }
    189 
    190         DEBUG(10, ("LSA_LOOKUPSIDS returned '%s', mapped count = %d'\n",
    191                    nt_errstr(result), count));
     245                                               &count,
     246                                               &result);
     247        }
     248
     249        DEBUG(10, ("LSA_LOOKUPSIDS returned status: '%s', result: '%s', "
     250                   "mapped count = %d'\n",
     251                   nt_errstr(status), nt_errstr(result), count));
     252
     253        if (!NT_STATUS_IS_OK(status)) {
     254                return status;
     255        }
    192256
    193257        if (!NT_STATUS_IS_OK(result) &&
     
    195259            !NT_STATUS_EQUAL(result, STATUS_SOME_UNMAPPED))
    196260        {
    197                 /* An actual error occured */
    198                 goto done;
     261                *presult = result;
     262                return status;
    199263        }
    200264
    201265        /* Return output parameters */
    202 
    203266        if (NT_STATUS_EQUAL(result, NT_STATUS_NONE_MAPPED) ||
    204267            (count == 0))
     
    209272                        (types)[i] = SID_NAME_UNKNOWN;
    210273                }
    211                 result = NT_STATUS_NONE_MAPPED;
    212                 goto done;
     274                *presult = NT_STATUS_NONE_MAPPED;
     275                return status;
    213276        }
    214277
     
    225288
    226289                        if (name) {
    227                                 (names)[i] = talloc_strdup(mem_ctx, name);
     290                                (names)[i] = talloc_strdup(names, name);
    228291                                if ((names)[i] == NULL) {
    229292                                        DEBUG(0, ("cli_lsa_lookup_sids_noalloc(): out of memory\n"));
    230                                         result = NT_STATUS_UNSUCCESSFUL;
    231                                         goto done;
     293                                        *presult = NT_STATUS_UNSUCCESSFUL;
     294                                        return status;
    232295                                }
    233296                        } else {
    234297                                (names)[i] = NULL;
    235298                        }
    236                         domains[i] = talloc_strdup(
    237                                 mem_ctx, dom_name ? dom_name : "");
     299                        domains[i] = talloc_strdup(domains,
     300                                                  dom_name ? dom_name : "");
    238301                        (types)[i] = lsa_names.names[i].sid_type;
    239302                        if (((domains)[i] == NULL)) {
    240303                                DEBUG(0, ("cli_lsa_lookup_sids_noalloc(): out of memory\n"));
    241                                 result = NT_STATUS_UNSUCCESSFUL;
    242                                 goto done;
     304                                *presult = NT_STATUS_UNSUCCESSFUL;
     305                                return status;
    243306                        }
    244307
     
    250313        }
    251314
    252 done:
    253         TALLOC_FREE(tmp_ctx);
    254         return result;
     315        *presult = NT_STATUS_OK;
     316        return status;
    255317}
    256318
     
    267329#define LOOKUP_SIDS_HUNK_SIZE 1000
    268330
    269 static NTSTATUS rpccli_lsa_lookup_sids_generic(struct rpc_pipe_client *cli,
     331static NTSTATUS dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle *h,
    270332                                               TALLOC_CTX *mem_ctx,
    271333                                               struct policy_handle *pol,
    272334                                               int num_sids,
    273                                                const DOM_SID *sids,
     335                                               const struct dom_sid *sids,
    274336                                               char ***pdomains,
    275337                                               char ***pnames,
    276338                                               enum lsa_SidType **ptypes,
    277                                                bool use_lookupsids3)
    278 {
     339                                               bool use_lookupsids3,
     340                                               NTSTATUS *presult)
     341{
     342        NTSTATUS status = NT_STATUS_OK;
    279343        NTSTATUS result = NT_STATUS_OK;
    280344        int sids_left = 0;
    281345        int sids_processed = 0;
    282         const DOM_SID *hunk_sids = sids;
     346        const struct dom_sid *hunk_sids = sids;
    283347        char **hunk_domains;
    284348        char **hunk_names;
     
    287351        char **names = NULL;
    288352        enum lsa_SidType *types = NULL;
     353        bool have_mapped = false;
     354        bool have_unmapped = false;
    289355
    290356        if (num_sids) {
    291357                if (!(domains = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
    292358                        DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
    293                         result = NT_STATUS_NO_MEMORY;
     359                        status = NT_STATUS_NO_MEMORY;
    294360                        goto fail;
    295361                }
     
    297363                if (!(names = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
    298364                        DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
    299                         result = NT_STATUS_NO_MEMORY;
     365                        status = NT_STATUS_NO_MEMORY;
    300366                        goto fail;
    301367                }
     
    303369                if (!(types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) {
    304370                        DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
    305                         result = NT_STATUS_NO_MEMORY;
     371                        status = NT_STATUS_NO_MEMORY;
    306372                        goto fail;
    307373                }
     
    315381        while (sids_left > 0) {
    316382                int hunk_num_sids;
    317                 NTSTATUS hunk_result = NT_STATUS_OK;
     383                NTSTATUS hunk_result = NT_STATUS_UNSUCCESSFUL;
    318384
    319385                hunk_num_sids = ((sids_left > LOOKUP_SIDS_HUNK_SIZE)
     
    327393                           num_sids));
    328394
    329                 hunk_result = rpccli_lsa_lookup_sids_noalloc(cli,
    330                                                              mem_ctx,
    331                                                              pol,
    332                                                              hunk_num_sids,
    333                                                              hunk_sids,
    334                                                              hunk_domains,
    335                                                              hunk_names,
    336                                                              hunk_types,
    337                                                              use_lookupsids3);
     395                status = dcerpc_lsa_lookup_sids_noalloc(h,
     396                                                        mem_ctx,
     397                                                        pol,
     398                                                        hunk_num_sids,
     399                                                        hunk_sids,
     400                                                        hunk_domains,
     401                                                        hunk_names,
     402                                                        hunk_types,
     403                                                        use_lookupsids3,
     404                                                        &hunk_result);
     405                if (!NT_STATUS_IS_OK(status)) {
     406                        goto fail;
     407                }
    338408
    339409                if (!NT_STATUS_IS_OK(hunk_result) &&
     
    342412                {
    343413                        /* An actual error occured */
    344                         result = hunk_result;
     414                        *presult = hunk_result;
    345415                        goto fail;
    346416                }
    347417
    348                 /* adapt overall result */
    349                 if (( NT_STATUS_IS_OK(result) &&
    350                      !NT_STATUS_IS_OK(hunk_result))
    351                     ||
    352                     ( NT_STATUS_EQUAL(result, NT_STATUS_NONE_MAPPED) &&
    353                      !NT_STATUS_EQUAL(hunk_result, NT_STATUS_NONE_MAPPED)))
    354                 {
    355                         result = STATUS_SOME_UNMAPPED;
     418                if (NT_STATUS_IS_OK(hunk_result)) {
     419                        have_mapped = true;
     420                }
     421                if (NT_STATUS_EQUAL(hunk_result, NT_STATUS_NONE_MAPPED)) {
     422                        have_unmapped = true;
     423                }
     424                if (NT_STATUS_EQUAL(hunk_result, STATUS_SOME_UNMAPPED)) {
     425                        int i;
     426                        for (i=0; i<hunk_num_sids; i++) {
     427                                if (hunk_types[i] == SID_NAME_UNKNOWN) {
     428                                        have_unmapped = true;
     429                                } else {
     430                                        have_mapped = true;
     431                                }
     432                        }
    356433                }
    357434
     
    367444        *pnames = names;
    368445        *ptypes = types;
    369         return result;
     446
     447        if (!have_mapped) {
     448                result = NT_STATUS_NONE_MAPPED;
     449        }
     450        if (have_unmapped) {
     451                result = STATUS_SOME_UNMAPPED;
     452        }
     453        *presult = result;
     454
     455        return status;
    370456
    371457fail:
     
    373459        TALLOC_FREE(names);
    374460        TALLOC_FREE(types);
    375         return result;
     461
     462        return status;
     463}
     464
     465NTSTATUS dcerpc_lsa_lookup_sids(struct dcerpc_binding_handle *h,
     466                                TALLOC_CTX *mem_ctx,
     467                                struct policy_handle *pol,
     468                                int num_sids,
     469                                const struct dom_sid *sids,
     470                                char ***pdomains,
     471                                char ***pnames,
     472                                enum lsa_SidType **ptypes,
     473                                NTSTATUS *result)
     474{
     475        return dcerpc_lsa_lookup_sids_generic(h,
     476                                              mem_ctx,
     477                                              pol,
     478                                              num_sids,
     479                                              sids,
     480                                              pdomains,
     481                                              pnames,
     482                                              ptypes,
     483                                              false,
     484                                              result);
    376485}
    377486
     
    380489                                struct policy_handle *pol,
    381490                                int num_sids,
    382                                 const DOM_SID *sids,
     491                                const struct dom_sid *sids,
    383492                                char ***pdomains,
    384493                                char ***pnames,
    385494                                enum lsa_SidType **ptypes)
    386495{
    387         return rpccli_lsa_lookup_sids_generic(cli, mem_ctx, pol, num_sids, sids,
    388                                               pdomains, pnames, ptypes, false);
     496        NTSTATUS status;
     497        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
     498
     499        status = dcerpc_lsa_lookup_sids_generic(cli->binding_handle,
     500                                                mem_ctx,
     501                                                pol,
     502                                                num_sids,
     503                                                sids,
     504                                                pdomains,
     505                                                pnames,
     506                                                ptypes,
     507                                                false,
     508                                                &result);
     509        if (!NT_STATUS_IS_OK(status)) {
     510                return status;
     511        }
     512
     513        return result;
     514}
     515
     516NTSTATUS dcerpc_lsa_lookup_sids3(struct dcerpc_binding_handle *h,
     517                                 TALLOC_CTX *mem_ctx,
     518                                 struct policy_handle *pol,
     519                                 int num_sids,
     520                                 const struct dom_sid *sids,
     521                                 char ***pdomains,
     522                                 char ***pnames,
     523                                 enum lsa_SidType **ptypes,
     524                                 NTSTATUS *result)
     525{
     526        return dcerpc_lsa_lookup_sids_generic(h,
     527                                              mem_ctx,
     528                                              pol,
     529                                              num_sids,
     530                                              sids,
     531                                              pdomains,
     532                                              pnames,
     533                                              ptypes,
     534                                              true,
     535                                              result);
    389536}
    390537
     
    393540                                 struct policy_handle *pol,
    394541                                 int num_sids,
    395                                  const DOM_SID *sids,
     542                                 const struct dom_sid *sids,
    396543                                 char ***pdomains,
    397544                                 char ***pnames,
    398545                                 enum lsa_SidType **ptypes)
    399546{
    400         return rpccli_lsa_lookup_sids_generic(cli, mem_ctx, pol, num_sids, sids,
    401                                               pdomains, pnames, ptypes, true);
     547        NTSTATUS status;
     548        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
     549
     550        status = dcerpc_lsa_lookup_sids_generic(cli->binding_handle,
     551                                                mem_ctx,
     552                                                pol,
     553                                                num_sids,
     554                                                sids,
     555                                                pdomains,
     556                                                pnames,
     557                                                ptypes,
     558                                                true,
     559                                                &result);
     560        if (!NT_STATUS_IS_OK(status)) {
     561                return status;
     562        }
     563
     564        return result;
    402565}
    403566
    404567/** Lookup a list of names */
    405568
    406 static NTSTATUS rpccli_lsa_lookup_names_generic(struct rpc_pipe_client *cli,
     569static NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h,
    407570                                                TALLOC_CTX *mem_ctx,
    408                                                 struct policy_handle *pol, int num_names,
     571                                                struct policy_handle *pol,
     572                                                uint32_t num_names,
    409573                                                const char **names,
    410574                                                const char ***dom_names,
    411                                                 int level,
    412                                                 DOM_SID **sids,
     575                                                enum lsa_LookupNamesLevel level,
     576                                                struct dom_sid **sids,
    413577                                                enum lsa_SidType **types,
    414                                                 bool use_lookupnames4)
    415 {
    416         NTSTATUS result;
    417         int i;
     578                                                bool use_lookupnames4,
     579                                                NTSTATUS *presult)
     580{
     581        NTSTATUS status;
    418582        struct lsa_String *lsa_names = NULL;
    419583        struct lsa_RefDomainList *domains = NULL;
     
    421585        struct lsa_TransSidArray3 sid_array3;
    422586        uint32_t count = 0;
     587        uint32_t i;
    423588
    424589        ZERO_STRUCT(sid_array);
     
    426591
    427592        lsa_names = TALLOC_ARRAY(mem_ctx, struct lsa_String, num_names);
    428         if (!lsa_names) {
     593        if (lsa_names == NULL) {
    429594                return NT_STATUS_NO_MEMORY;
    430595        }
    431596
    432         for (i=0; i<num_names; i++) {
     597        for (i = 0; i < num_names; i++) {
    433598                init_lsa_String(&lsa_names[i], names[i]);
    434599        }
    435600
    436601        if (use_lookupnames4) {
    437                 result = rpccli_lsa_LookupNames4(cli, mem_ctx,
     602                status = dcerpc_lsa_LookupNames4(h,
     603                                                 mem_ctx,
    438604                                                 num_names,
    439605                                                 lsa_names,
     
    442608                                                 level,
    443609                                                 &count,
    444                                                  0,
    445                                                  0);
     610                                                 LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES,
     611                                                 LSA_CLIENT_REVISION_2,
     612                                                 presult);
    446613        } else {
    447                 result = rpccli_lsa_LookupNames(cli, mem_ctx,
    448                                                 pol,
     614                status = dcerpc_lsa_LookupNames(h,
     615                                                mem_ctx,
     616                                                pol,
    449617                                                num_names,
    450618                                                lsa_names,
     
    452620                                                &sid_array,
    453621                                                level,
    454                                                 &count);
    455         }
    456 
    457         if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) !=
    458             NT_STATUS_V(STATUS_SOME_UNMAPPED)) {
    459 
     622                                                &count,
     623                                                presult);
     624        }
     625        if (!NT_STATUS_IS_OK(status)) {
     626                goto done;
     627        }
     628
     629        if (!NT_STATUS_IS_OK(*presult) &&
     630            !NT_STATUS_EQUAL(*presult, STATUS_SOME_UNMAPPED)) {
    460631                /* An actual error occured */
    461 
    462632                goto done;
    463633        }
    464634
    465635        /* Return output parameters */
    466 
    467636        if (count == 0) {
    468                 result = NT_STATUS_NONE_MAPPED;
     637                *presult = NT_STATUS_NONE_MAPPED;
    469638                goto done;
    470639        }
    471640
    472641        if (num_names) {
    473                 if (!((*sids = TALLOC_ARRAY(mem_ctx, DOM_SID, num_names)))) {
     642                if (!((*sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, num_names)))) {
    474643                        DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
    475                         result = NT_STATUS_NO_MEMORY;
     644                        *presult = NT_STATUS_NO_MEMORY;
    476645                        goto done;
    477646                }
     
    479648                if (!((*types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_names)))) {
    480649                        DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
    481                         result = NT_STATUS_NO_MEMORY;
     650                        *presult = NT_STATUS_NO_MEMORY;
    482651                        goto done;
    483652                }
     
    487656                        if (*dom_names == NULL) {
    488657                                DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
    489                                 result = NT_STATUS_NO_MEMORY;
     658                                *presult = NT_STATUS_NO_MEMORY;
    490659                                goto done;
    491660                        }
     
    501670        for (i = 0; i < num_names; i++) {
    502671                uint32_t dom_idx;
    503                 DOM_SID *sid = &(*sids)[i];
     672                struct dom_sid *sid = &(*sids)[i];
    504673
    505674                if (use_lookupnames4) {
     
    538707
    539708 done:
    540 
    541         return result;
     709        return status;
     710}
     711
     712NTSTATUS dcerpc_lsa_lookup_names(struct dcerpc_binding_handle *h,
     713                                 TALLOC_CTX *mem_ctx,
     714                                 struct policy_handle *pol,
     715                                 uint32_t num_names,
     716                                 const char **names,
     717                                 const char ***dom_names,
     718                                 enum lsa_LookupNamesLevel level,
     719                                 struct dom_sid **sids,
     720                                 enum lsa_SidType **types,
     721                                 NTSTATUS *result)
     722{
     723        return dcerpc_lsa_lookup_names_generic(h,
     724                                               mem_ctx,
     725                                               pol,
     726                                               num_names,
     727                                               names,
     728                                               dom_names,
     729                                               level,
     730                                               sids,
     731                                               types,
     732                                               false,
     733                                               result);
    542734}
    543735
    544736NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
    545737                                 TALLOC_CTX *mem_ctx,
    546                                  struct policy_handle *pol, int num_names,
     738                                 struct policy_handle *pol,
     739                                 int num_names,
    547740                                 const char **names,
    548741                                 const char ***dom_names,
    549742                                 int level,
    550                                  DOM_SID **sids,
     743                                 struct dom_sid **sids,
    551744                                 enum lsa_SidType **types)
    552745{
    553         return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names,
    554                                                names, dom_names, level, sids,
    555                                                types, false);
     746        NTSTATUS status;
     747        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
     748
     749        status = dcerpc_lsa_lookup_names(cli->binding_handle,
     750                                         mem_ctx,
     751                                         pol,
     752                                         num_names,
     753                                         names,
     754                                         dom_names,
     755                                         level,
     756                                         sids,
     757                                         types,
     758                                         &result);
     759        if (!NT_STATUS_IS_OK(status)) {
     760                return status;
     761        }
     762
     763        return result;
     764}
     765
     766NTSTATUS dcerpc_lsa_lookup_names4(struct dcerpc_binding_handle *h,
     767                                  TALLOC_CTX *mem_ctx,
     768                                  struct policy_handle *pol,
     769                                  uint32_t num_names,
     770                                  const char **names,
     771                                  const char ***dom_names,
     772                                  enum lsa_LookupNamesLevel level,
     773                                  struct dom_sid **sids,
     774                                  enum lsa_SidType **types,
     775                                  NTSTATUS *result)
     776{
     777        return dcerpc_lsa_lookup_names_generic(h,
     778                                               mem_ctx,
     779                                               pol,
     780                                               num_names,
     781                                               names,
     782                                               dom_names,
     783                                               level,
     784                                               sids,
     785                                               types,
     786                                               true,
     787                                               result);
    556788}
    557789
    558790NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli,
    559791                                  TALLOC_CTX *mem_ctx,
    560                                   struct policy_handle *pol, int num_names,
     792                                  struct policy_handle *pol,
     793                                  int num_names,
    561794                                  const char **names,
    562795                                  const char ***dom_names,
    563796                                  int level,
    564                                   DOM_SID **sids,
     797                                  struct dom_sid **sids,
    565798                                  enum lsa_SidType **types)
    566799{
    567         return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names,
    568                                                names, dom_names, level, sids,
    569                                                types, true);
    570 }
     800        NTSTATUS status;
     801        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
     802
     803        status = dcerpc_lsa_lookup_names4(cli->binding_handle,
     804                                          mem_ctx,
     805                                          pol,
     806                                          num_names,
     807                                          names,
     808                                          dom_names,
     809                                          level,
     810                                          sids,
     811                                          types,
     812                                          &result);
     813        if (!NT_STATUS_IS_OK(status)) {
     814                return status;
     815        }
     816
     817        return result;
     818}
Note: See TracChangeset for help on using the changeset viewer.