Changeset 862 for trunk/server/source3/winbindd/winbindd_rpc.c
- Timestamp:
- May 13, 2014, 11:39:04 AM (11 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 860
- Property svn:mergeinfo changed
-
trunk/server/source3/winbindd/winbindd_rpc.c
r745 r862 872 872 /* Copy result into array. The talloc system will take 873 873 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; 876 879 } 877 880 … … 879 882 if (tmp_types.ids[r] == SID_NAME_UNKNOWN) { 880 883 continue; 884 } 885 if (total_names >= num_names) { 886 break; 881 887 } 882 888 names[total_names] = fill_domain_username_talloc(names, … … 1034 1040 static NTSTATUS rpc_try_lookup_sids3(TALLOC_CTX *mem_ctx, 1035 1041 struct winbindd_domain *domain, 1042 struct rpc_pipe_client *cli, 1036 1043 struct lsa_SidArray *sids, 1037 1044 struct lsa_RefDomainList **pdomains, … … 1039 1046 { 1040 1047 struct lsa_TransNameArray2 lsa_names2; 1041 struct lsa_TransNameArray *names ;1048 struct lsa_TransNameArray *names = *pnames; 1042 1049 uint32_t i, count; 1043 struct rpc_pipe_client *cli;1044 1050 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 }1051 1051 1052 1052 ZERO_STRUCT(lsa_names2); … … 1067 1067 return result; 1068 1068 } 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 1073 1073 names->count = lsa_names2.count; 1074 1074 names->names = talloc_array(names, struct lsa_TranslatedName, … … 1082 1082 names->names, &lsa_names2.names[i].name.string); 1083 1083 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 } 1086 1095 return result; 1087 1096 } … … 1093 1102 struct lsa_TransNameArray **pnames) 1094 1103 { 1095 struct lsa_TransNameArray *names ;1104 struct lsa_TransNameArray *names = *pnames; 1096 1105 struct rpc_pipe_client *cli = NULL; 1097 1106 struct policy_handle lsa_policy; 1098 1107 uint32_t count; 1108 uint32_t i; 1099 1109 NTSTATUS status, result; 1100 1110 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); 1110 1112 if (!NT_STATUS_IS_OK(status)) { 1111 1113 return status; 1112 1114 } 1113 1115 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 1118 1121 status = dcerpc_lsa_LookupSids(cli->binding_handle, mem_ctx, 1119 1122 &lsa_policy, sids, pdomains, … … 1126 1129 return result; 1127 1130 } 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 1129 1148 return result; 1130 1149 }
Note:
See TracChangeset
for help on using the changeset viewer.