Ignore:
Timestamp:
May 13, 2014, 11:39:04 AM (11 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update trunk to 3.6.23

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/winbindd/winbindd_rpc.c

    r745 r862  
    872872        /* Copy result into array.  The talloc system will take
    873873           care of freeing the temporary arrays later on. */
    874         if (tmp_names.count != tmp_types.count) {
    875                 return NT_STATUS_UNSUCCESSFUL;
     874        if (tmp_names.count != num_names) {
     875                return NT_STATUS_INVALID_NETWORK_RESPONSE;
     876        }
     877        if (tmp_types.count != num_names) {
     878                return NT_STATUS_INVALID_NETWORK_RESPONSE;
    876879        }
    877880
     
    879882                if (tmp_types.ids[r] == SID_NAME_UNKNOWN) {
    880883                        continue;
     884                }
     885                if (total_names >= num_names) {
     886                        break;
    881887                }
    882888                names[total_names] = fill_domain_username_talloc(names,
     
    10341040static NTSTATUS rpc_try_lookup_sids3(TALLOC_CTX *mem_ctx,
    10351041                                     struct winbindd_domain *domain,
     1042                                     struct rpc_pipe_client *cli,
    10361043                                     struct lsa_SidArray *sids,
    10371044                                     struct lsa_RefDomainList **pdomains,
     
    10391046{
    10401047        struct lsa_TransNameArray2 lsa_names2;
    1041         struct lsa_TransNameArray *names;
     1048        struct lsa_TransNameArray *names = *pnames;
    10421049        uint32_t i, count;
    1043         struct rpc_pipe_client *cli;
    10441050        NTSTATUS status, result;
    1045 
    1046         status = cm_connect_lsa_tcp(domain, talloc_tos(), &cli);
    1047         if (!NT_STATUS_IS_OK(status)) {
    1048                 domain->can_do_ncacn_ip_tcp = false;
    1049                 return status;
    1050         }
    10511051
    10521052        ZERO_STRUCT(lsa_names2);
     
    10671067                return result;
    10681068        }
    1069         names = TALLOC_ZERO_P(mem_ctx, struct lsa_TransNameArray);
    1070         if (names == NULL) {
    1071                 return NT_STATUS_NO_MEMORY;
    1072         }
     1069        if (sids->num_sids != lsa_names2.count) {
     1070                return NT_STATUS_INVALID_NETWORK_RESPONSE;
     1071        }
     1072
    10731073        names->count = lsa_names2.count;
    10741074        names->names = talloc_array(names, struct lsa_TranslatedName,
     
    10821082                        names->names, &lsa_names2.names[i].name.string);
    10831083                names->names[i].sid_index = lsa_names2.names[i].sid_index;
    1084         }
    1085         *pnames = names;
     1084
     1085                if (names->names[i].sid_index == UINT32_MAX) {
     1086                        continue;
     1087                }
     1088                if ((*pdomains) == NULL) {
     1089                        return NT_STATUS_INVALID_NETWORK_RESPONSE;
     1090                }
     1091                if (names->names[i].sid_index >= (*pdomains)->count) {
     1092                        return NT_STATUS_INVALID_NETWORK_RESPONSE;
     1093                }
     1094        }
    10861095        return result;
    10871096}
     
    10931102                         struct lsa_TransNameArray **pnames)
    10941103{
    1095         struct lsa_TransNameArray *names;
     1104        struct lsa_TransNameArray *names = *pnames;
    10961105        struct rpc_pipe_client *cli = NULL;
    10971106        struct policy_handle lsa_policy;
    10981107        uint32_t count;
     1108        uint32_t i;
    10991109        NTSTATUS status, result;
    11001110
    1101         if (domain->can_do_ncacn_ip_tcp) {
    1102                 status = rpc_try_lookup_sids3(mem_ctx, domain, sids,
    1103                                               pdomains, pnames);
    1104                 if (!NT_STATUS_IS_ERR(status)) {
    1105                         return status;
    1106                 }
    1107         }
    1108 
    1109         status = cm_connect_lsa(domain, mem_ctx, &cli, &lsa_policy);
     1111        status = cm_connect_lsat(domain, mem_ctx, &cli, &lsa_policy);
    11101112        if (!NT_STATUS_IS_OK(status)) {
    11111113                return status;
    11121114        }
    11131115
    1114         names = TALLOC_ZERO_P(mem_ctx, struct lsa_TransNameArray);
    1115         if (names == NULL) {
    1116                 return NT_STATUS_NO_MEMORY;
    1117         }
     1116        if (cli->transport->transport == NCACN_IP_TCP) {
     1117                return rpc_try_lookup_sids3(mem_ctx, domain, cli, sids,
     1118                                            pdomains, pnames);
     1119        }
     1120
    11181121        status = dcerpc_lsa_LookupSids(cli->binding_handle, mem_ctx,
    11191122                                       &lsa_policy, sids, pdomains,
     
    11261129                return result;
    11271130        }
    1128         *pnames = names;
     1131
     1132        if (sids->num_sids != names->count) {
     1133                return NT_STATUS_INVALID_NETWORK_RESPONSE;
     1134        }
     1135
     1136        for (i=0; i < names->count; i++) {
     1137                if (names->names[i].sid_index == UINT32_MAX) {
     1138                        continue;
     1139                }
     1140                if ((*pdomains) == NULL) {
     1141                        return NT_STATUS_INVALID_NETWORK_RESPONSE;
     1142                }
     1143                if (names->names[i].sid_index >= (*pdomains)->count) {
     1144                        return NT_STATUS_INVALID_NETWORK_RESPONSE;
     1145                }
     1146        }
     1147
    11291148        return result;
    11301149}
Note: See TracChangeset for help on using the changeset viewer.