Ignore:
Timestamp:
May 12, 2014, 8:58:38 PM (11 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.6: updated vendor to latest version

Location:
vendor/current/source3/rpc_client
Files:
4 edited

Legend:

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

    r746 r860  
    280280        for (i = 0; i < num_sids; i++) {
    281281                const char *name, *dom_name;
    282                 uint32_t dom_idx = lsa_names.names[i].sid_index;
     282                uint32_t dom_idx;
     283
     284                if (i >= lsa_names.count) {
     285                        *presult = NT_STATUS_INVALID_NETWORK_RESPONSE;
     286                        return status;
     287                }
     288
     289                dom_idx = lsa_names.names[i].sid_index;
    283290
    284291                /* Translate optimised name through domain index array */
    285292
    286293                if (dom_idx != 0xffffffff) {
     294                        if (ref_domains == NULL) {
     295                                *presult = NT_STATUS_INVALID_NETWORK_RESPONSE;
     296                                return status;
     297                        }
     298                        if (dom_idx >= ref_domains->count) {
     299                                *presult = NT_STATUS_INVALID_NETWORK_RESPONSE;
     300                                return status;
     301                        }
    287302
    288303                        dom_name = ref_domains->domains[dom_idx].name.string;
     
    331346#define LOOKUP_SIDS_HUNK_SIZE 1000
    332347
    333 static NTSTATUS dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle *h,
    334                                                TALLOC_CTX *mem_ctx,
    335                                                struct policy_handle *pol,
    336                                                int num_sids,
    337                                                const struct dom_sid *sids,
    338                                                char ***pdomains,
    339                                                char ***pnames,
    340                                                enum lsa_SidType **ptypes,
    341                                                bool use_lookupsids3,
    342                                                NTSTATUS *presult)
     348NTSTATUS dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle *h,
     349                                        TALLOC_CTX *mem_ctx,
     350                                        struct policy_handle *pol,
     351                                        int num_sids,
     352                                        const struct dom_sid *sids,
     353                                        char ***pdomains,
     354                                        char ***pnames,
     355                                        enum lsa_SidType **ptypes,
     356                                        bool use_lookupsids3,
     357                                        NTSTATUS *presult)
    343358{
    344359        NTSTATUS status = NT_STATUS_OK;
     
    540555}
    541556
    542 NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli,
    543                                  TALLOC_CTX *mem_ctx,
    544                                  struct policy_handle *pol,
    545                                  int num_sids,
    546                                  const struct dom_sid *sids,
    547                                  char ***pdomains,
    548                                  char ***pnames,
    549                                  enum lsa_SidType **ptypes)
    550 {
    551         NTSTATUS status;
    552         NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
    553 
    554         status = dcerpc_lsa_lookup_sids_generic(cli->binding_handle,
    555                                                 mem_ctx,
    556                                                 pol,
    557                                                 num_sids,
    558                                                 sids,
    559                                                 pdomains,
    560                                                 pnames,
    561                                                 ptypes,
    562                                                 true,
    563                                                 &result);
    564         if (!NT_STATUS_IS_OK(status)) {
    565                 return status;
    566         }
    567 
    568         return result;
    569 }
    570 
    571557/** Lookup a list of names */
    572558
    573 static NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h,
    574                                                 TALLOC_CTX *mem_ctx,
    575                                                 struct policy_handle *pol,
    576                                                 uint32_t num_names,
    577                                                 const char **names,
    578                                                 const char ***dom_names,
    579                                                 enum lsa_LookupNamesLevel level,
    580                                                 struct dom_sid **sids,
    581                                                 enum lsa_SidType **types,
    582                                                 bool use_lookupnames4,
    583                                                 NTSTATUS *presult)
     559NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h,
     560                                         TALLOC_CTX *mem_ctx,
     561                                         struct policy_handle *pol,
     562                                         uint32_t num_names,
     563                                         const char **names,
     564                                         const char ***dom_names,
     565                                         enum lsa_LookupNamesLevel level,
     566                                         struct dom_sid **sids,
     567                                         enum lsa_SidType **types,
     568                                         bool use_lookupnames4,
     569                                         NTSTATUS *presult)
    584570{
    585571        NTSTATUS status;
     
    677663
    678664                if (use_lookupnames4) {
     665                        if (i >= sid_array3.count) {
     666                                *presult = NT_STATUS_INVALID_NETWORK_RESPONSE;
     667                                goto done;
     668                        }
     669
    679670                        dom_idx         = sid_array3.sids[i].sid_index;
    680671                        (*types)[i]     = sid_array3.sids[i].sid_type;
    681672                } else {
     673                        if (i >= sid_array.count) {
     674                                *presult = NT_STATUS_INVALID_NETWORK_RESPONSE;
     675                                goto done;
     676                        }
     677
    682678                        dom_idx         = sid_array.sids[i].sid_index;
    683679                        (*types)[i]     = sid_array.sids[i].sid_type;
     
    691687                        (*types)[i] = SID_NAME_UNKNOWN;
    692688                        continue;
     689                }
     690                if (domains == NULL) {
     691                        *presult = NT_STATUS_INVALID_NETWORK_RESPONSE;
     692                        goto done;
     693                }
     694                if (dom_idx >= domains->count) {
     695                        *presult = NT_STATUS_INVALID_NETWORK_RESPONSE;
     696                        goto done;
    693697                }
    694698
     
    791795                                               result);
    792796}
    793 
    794 NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli,
    795                                   TALLOC_CTX *mem_ctx,
    796                                   struct policy_handle *pol,
    797                                   int num_names,
    798                                   const char **names,
    799                                   const char ***dom_names,
    800                                   int level,
    801                                   struct dom_sid **sids,
    802                                   enum lsa_SidType **types)
    803 {
    804         NTSTATUS status;
    805         NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
    806 
    807         status = dcerpc_lsa_lookup_names4(cli->binding_handle,
    808                                           mem_ctx,
    809                                           pol,
    810                                           num_names,
    811                                           names,
    812                                           dom_names,
    813                                           level,
    814                                           sids,
    815                                           types,
    816                                           &result);
    817         if (!NT_STATUS_IS_OK(status)) {
    818                 return status;
    819         }
    820 
    821         return result;
    822 }
  • vendor/current/source3/rpc_client/cli_lsarpc.h

    r740 r860  
    126126                                char ***pnames,
    127127                                enum lsa_SidType **ptypes);
    128 
     128NTSTATUS dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle *h,
     129                                        TALLOC_CTX *mem_ctx,
     130                                        struct policy_handle *pol,
     131                                        int num_sids,
     132                                        const struct dom_sid *sids,
     133                                        char ***pdomains,
     134                                        char ***pnames,
     135                                        enum lsa_SidType **ptypes,
     136                                        bool use_lookupsids3,
     137                                        NTSTATUS *presult);
    129138/**
    130139 * @brief Look up the names that correspond to an array of sids.
     
    159168                                 enum lsa_SidType **ptypes,
    160169                                 NTSTATUS *result);
    161 NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli,
    162                                  TALLOC_CTX *mem_ctx,
    163                                  struct policy_handle *pol,
    164                                  int num_sids,
    165                                  const struct dom_sid *sids,
    166                                  char ***pdomains,
    167                                  char ***pnames,
    168                                  enum lsa_SidType **ptypes);
    169 
    170170NTSTATUS dcerpc_lsa_lookup_names(struct dcerpc_binding_handle *h,
    171171                                 TALLOC_CTX *mem_ctx,
     
    197197                                  enum lsa_SidType **types,
    198198                                  NTSTATUS *result);
    199 NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli,
    200                                   TALLOC_CTX *mem_ctx,
    201                                   struct policy_handle *pol, int num_names,
    202                                   const char **names,
    203                                   const char ***dom_names,
    204                                   int level,
    205                                   struct dom_sid **sids,
    206                                   enum lsa_SidType **types);
     199NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h,
     200                                         TALLOC_CTX *mem_ctx,
     201                                         struct policy_handle *pol,
     202                                         uint32_t num_names,
     203                                         const char **names,
     204                                         const char ***dom_names,
     205                                         enum lsa_LookupNamesLevel level,
     206                                         struct dom_sid **sids,
     207                                         enum lsa_SidType **types,
     208                                         bool use_lookupnames4,
     209                                         NTSTATUS *presult);
    207210
    208211bool fetch_domain_sid( char *domain, char *remote_machine, struct dom_sid *psid);
  • vendor/current/source3/rpc_client/cli_netlogon.c

    r740 r860  
    626626
    627627                struct netr_CryptPassword new_password;
     628                uint32_t old_timeout;
    628629
    629630                init_netr_CryptPassword(new_trust_pwd_cleartext,
    630631                                        cli->dc->session_key,
    631632                                        &new_password);
     633
     634                old_timeout = dcerpc_binding_handle_set_timeout(b, 600000);
    632635
    633636                status = dcerpc_netr_ServerPasswordSet2(b, mem_ctx,
     
    640643                                                        &new_password,
    641644                                                        &result);
     645
     646                dcerpc_binding_handle_set_timeout(b, old_timeout);
     647
    642648                if (!NT_STATUS_IS_OK(status)) {
    643649                        DEBUG(0,("dcerpc_netr_ServerPasswordSet2 failed: %s\n",
     
    648654
    649655                struct samr_Password new_password;
     656                uint32_t old_timeout;
     657
    650658                memcpy(new_password.hash, new_trust_passwd_hash, sizeof(new_password.hash));
    651659                netlogon_creds_des_encrypt(cli->dc, &new_password);
     660
     661                old_timeout = dcerpc_binding_handle_set_timeout(b, 600000);
    652662
    653663                status = dcerpc_netr_ServerPasswordSet(b, mem_ctx,
     
    660670                                                       &new_password,
    661671                                                       &result);
     672
     673                dcerpc_binding_handle_set_timeout(b, old_timeout);
     674
    662675                if (!NT_STATUS_IS_OK(status)) {
    663676                        DEBUG(0,("dcerpc_netr_ServerPasswordSet failed: %s\n",
  • vendor/current/source3/rpc_client/cli_pipe.c

    r740 r860  
    236236        struct rpc_pipe_client *cli;
    237237        uint16_t frag_len;
     238        uint32_t call_id;
    238239        DATA_BLOB *pdu;
    239240};
     
    245246                                                 struct event_context *ev,
    246247                                                 struct rpc_pipe_client *cli,
     248                                                 uint32_t call_id,
    247249                                                 DATA_BLOB *pdu)
    248250{
     
    260262        state->cli = cli;
    261263        state->frag_len = RPC_HEADER_LEN;
     264        state->call_id = call_id;
    262265        state->pdu = pdu;
    263266
     
    282285
    283286        state->frag_len = dcerpc_get_frag_length(pdu);
     287        if (state->frag_len < RPC_HEADER_LEN) {
     288                tevent_req_nterror(req, NT_STATUS_RPC_PROTOCOL_ERROR);
     289                return tevent_req_post(req, ev);
     290        }
     291
     292        if (state->call_id != dcerpc_get_call_id(pdu)) {
     293                tevent_req_nterror(req, NT_STATUS_RPC_PROTOCOL_ERROR);
     294                return tevent_req_post(req, ev);
     295        }
    284296
    285297        /*
     
    330342
    331343        state->frag_len = dcerpc_get_frag_length(state->pdu);
     344        if (state->frag_len < RPC_HEADER_LEN) {
     345                tevent_req_nterror(req, NT_STATUS_RPC_PROTOCOL_ERROR);
     346                return;
     347        }
     348
     349        if (state->call_id != dcerpc_get_call_id(state->pdu)) {
     350                tevent_req_nterror(req, NT_STATUS_RPC_PROTOCOL_ERROR);
     351                return;
     352        }
    332353
    333354        if (!data_blob_realloc(NULL, state->pdu, state->frag_len)) {
     
    691712        struct rpc_pipe_client *cli;
    692713        uint8_t expected_pkt_type;
     714        uint32_t call_id;
    693715
    694716        DATA_BLOB incoming_frag;
     
    709731                                            struct rpc_pipe_client *cli,
    710732                                            DATA_BLOB *data, /* Outgoing PDU */
    711                                             uint8_t expected_pkt_type)
     733                                            uint8_t expected_pkt_type,
     734                                            uint32_t call_id)
    712735{
    713736        struct tevent_req *req, *subreq;
     
    723746        state->cli = cli;
    724747        state->expected_pkt_type = expected_pkt_type;
     748        state->call_id = call_id;
    725749        state->incoming_frag = data_blob_null;
    726750        state->reply_pdu = data_blob_null;
     
    822846        /* Ensure we have enough data for a pdu. */
    823847        subreq = get_complete_frag_send(state, state->ev, state->cli,
     848                                        state->call_id,
    824849                                        &state->incoming_frag);
    825850        if (tevent_req_nomem(subreq, req)) {
     
    941966
    942967        subreq = get_complete_frag_send(state, state->ev, state->cli,
     968                                        state->call_id,
    943969                                        &state->incoming_frag);
    944970        if (tevent_req_nomem(subreq, req)) {
     
    12931319                subreq = rpc_api_pipe_send(state, ev, state->cli,
    12941320                                           &state->rpc_out,
    1295                                            DCERPC_PKT_RESPONSE);
     1321                                           DCERPC_PKT_RESPONSE,
     1322                                           state->call_id);
    12961323                if (subreq == NULL) {
    12971324                        goto fail;
     
    14291456                subreq = rpc_api_pipe_send(state, state->ev, state->cli,
    14301457                                           &state->rpc_out,
    1431                                            DCERPC_PKT_RESPONSE);
     1458                                           DCERPC_PKT_RESPONSE,
     1459                                           state->call_id);
    14321460                if (tevent_req_nomem(subreq, req)) {
    14331461                        return;
     
    16681696
    16691697        subreq = rpc_api_pipe_send(state, ev, cli, &state->rpc_out,
    1670                                    DCERPC_PKT_BIND_ACK);
     1698                                   DCERPC_PKT_BIND_ACK, state->rpc_call_id);
    16711699        if (subreq == NULL) {
    16721700                goto fail;
     
    18661894
    18671895        subreq = rpc_api_pipe_send(state, state->ev, state->cli,
    1868                                    &state->rpc_out, DCERPC_PKT_ALTER_RESP);
     1896                                   &state->rpc_out, DCERPC_PKT_ALTER_RESP,
     1897                                   state->rpc_call_id);
    18691898        if (subreq == NULL) {
    18701899                return NT_STATUS_NO_MEMORY;
     
    18981927
    18991928        subreq = rpc_api_pipe_send(state, state->ev, state->cli,
    1900                                    &state->rpc_out, DCERPC_PKT_AUTH3);
     1929                                   &state->rpc_out, DCERPC_PKT_AUTH3,
     1930                                   state->rpc_call_id);
    19011931        if (subreq == NULL) {
    19021932                return NT_STATUS_NO_MEMORY;
     
    24512481        result->max_recv_frag = RPC_MAX_PDU_FRAG_LEN;
    24522482
    2453         if (!resolve_name(host, &addr, 0, false)) {
     2483        if (!resolve_name(host, &addr, NBT_NAME_SERVER, false)) {
    24542484                status = NT_STATUS_NOT_FOUND;
    24552485                goto fail;
Note: See TracChangeset for help on using the changeset viewer.