Changeset 862 for trunk/server/source3/winbindd/winbindd_msrpc.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_msrpc.c
r745 r862 36 36 #define DBGC_CLASS DBGC_WINBIND 37 37 38 static NTSTATUS winbindd_lookup_names(TALLOC_CTX *mem_ctx, 39 struct winbindd_domain *domain, 40 uint32_t num_names, 41 const char **names, 42 const char ***domains, 43 struct dom_sid **sids, 44 enum lsa_SidType **types); 38 45 39 46 /* Query display info for a domain. This returns enough information plus a … … 738 745 care of freeing the temporary arrays later on. */ 739 746 740 if (tmp_names.count != tmp_types.count) { 741 return NT_STATUS_UNSUCCESSFUL; 747 if (tmp_names.count != num_lookup_rids) { 748 return NT_STATUS_INVALID_NETWORK_RESPONSE; 749 } 750 if (tmp_types.count != num_lookup_rids) { 751 return NT_STATUS_INVALID_NETWORK_RESPONSE; 742 752 } 743 753 … … 745 755 if (tmp_types.ids[r] == SID_NAME_UNKNOWN) { 746 756 continue; 757 } 758 if (total_names >= *num_names) { 759 break; 747 760 } 748 761 (*names)[total_names] = fill_domain_username_talloc( … … 938 951 939 952 status = cm_connect_lsa(domain, tmp_ctx, &lsa_pipe, &lsa_policy); 940 if (!NT_STATUS_IS_OK(status)) 941 return status; 953 if (!NT_STATUS_IS_OK(status)) { 954 goto done; 955 } 942 956 943 957 status = rpc_trusted_domains(tmp_ctx, … … 1057 1071 return status; 1058 1072 } 1059 1060 typedef NTSTATUS (*lookup_sids_fn_t)(struct dcerpc_binding_handle *h,1061 TALLOC_CTX *mem_ctx,1062 struct policy_handle *pol,1063 int num_sids,1064 const struct dom_sid *sids,1065 char ***pdomains,1066 char ***pnames,1067 enum lsa_SidType **ptypes,1068 NTSTATUS *result);1069 1073 1070 1074 NTSTATUS winbindd_lookup_sids(TALLOC_CTX *mem_ctx, … … 1082 1086 struct policy_handle lsa_policy; 1083 1087 unsigned int orig_timeout; 1084 lookup_sids_fn_t lookup_sids_fn = dcerpc_lsa_lookup_sids; 1085 1086 if (domain->can_do_ncacn_ip_tcp) { 1087 status = cm_connect_lsa_tcp(domain, mem_ctx, &cli); 1088 if (NT_STATUS_IS_OK(status)) { 1089 lookup_sids_fn = dcerpc_lsa_lookup_sids3; 1090 goto lookup; 1091 } 1092 domain->can_do_ncacn_ip_tcp = false; 1093 } 1094 status = cm_connect_lsa(domain, mem_ctx, &cli, &lsa_policy); 1095 1088 bool use_lookupsids3 = false; 1089 bool retried = false; 1090 1091 connect: 1092 status = cm_connect_lsat(domain, mem_ctx, &cli, &lsa_policy); 1096 1093 if (!NT_STATUS_IS_OK(status)) { 1097 1094 return status; 1098 1095 } 1099 1096 1100 lookup:1101 1097 b = cli->binding_handle; 1098 1099 if (cli->transport->transport == NCACN_IP_TCP) { 1100 use_lookupsids3 = true; 1101 } 1102 1102 1103 1103 /* … … 1108 1108 orig_timeout = dcerpc_binding_handle_set_timeout(b, 35000); 1109 1109 1110 status = lookup_sids_fn(b, 1111 mem_ctx, 1112 &lsa_policy, 1113 num_sids, 1114 sids, 1115 domains, 1116 names, 1117 types, 1118 &result); 1110 status = dcerpc_lsa_lookup_sids_generic(b, 1111 mem_ctx, 1112 &lsa_policy, 1113 num_sids, 1114 sids, 1115 domains, 1116 names, 1117 types, 1118 use_lookupsids3, 1119 &result); 1119 1120 1120 1121 /* And restore our original timeout. */ … … 1122 1123 1123 1124 if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) || 1124 NT_STATUS_EQUAL(status, NT_STATUS_RPC_SEC_PKG_ERROR)) { 1125 NT_STATUS_EQUAL(status, NT_STATUS_RPC_SEC_PKG_ERROR) || 1126 NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_ACCESS_DENIED)) { 1125 1127 /* 1126 1128 * This can happen if the schannel key is not … … 1130 1132 */ 1131 1133 invalidate_cm_connection(&domain->conn); 1134 domain->can_do_ncacn_ip_tcp = domain->active_directory; 1135 if (!retried) { 1136 retried = true; 1137 goto connect; 1138 } 1132 1139 status = NT_STATUS_ACCESS_DENIED; 1133 1140 } … … 1144 1151 } 1145 1152 1146 typedef NTSTATUS (*lookup_names_fn_t)(struct dcerpc_binding_handle *h, 1147 TALLOC_CTX *mem_ctx, 1148 struct policy_handle *pol, 1153 static NTSTATUS winbindd_lookup_names(TALLOC_CTX *mem_ctx, 1154 struct winbindd_domain *domain, 1149 1155 uint32_t num_names, 1150 1156 const char **names, 1151 const char ***dom_names, 1152 enum lsa_LookupNamesLevel level, 1157 const char ***domains, 1153 1158 struct dom_sid **sids, 1154 enum lsa_SidType **types, 1155 NTSTATUS *result); 1156 1157 NTSTATUS winbindd_lookup_names(TALLOC_CTX *mem_ctx, 1158 struct winbindd_domain *domain, 1159 uint32_t num_names, 1160 const char **names, 1161 const char ***domains, 1162 struct dom_sid **sids, 1163 enum lsa_SidType **types) 1159 enum lsa_SidType **types) 1164 1160 { 1165 1161 NTSTATUS status; … … 1169 1165 struct policy_handle lsa_policy; 1170 1166 unsigned int orig_timeout = 0; 1171 lookup_names_fn_t lookup_names_fn = dcerpc_lsa_lookup_names; 1172 1173 if (domain->can_do_ncacn_ip_tcp) { 1174 status = cm_connect_lsa_tcp(domain, mem_ctx, &cli); 1175 if (NT_STATUS_IS_OK(status)) { 1176 lookup_names_fn = dcerpc_lsa_lookup_names4; 1177 goto lookup; 1178 } 1179 domain->can_do_ncacn_ip_tcp = false; 1180 } 1181 status = cm_connect_lsa(domain, mem_ctx, &cli, &lsa_policy); 1182 1167 bool use_lookupnames4 = false; 1168 bool retried = false; 1169 1170 connect: 1171 status = cm_connect_lsat(domain, mem_ctx, &cli, &lsa_policy); 1183 1172 if (!NT_STATUS_IS_OK(status)) { 1184 1173 return status; 1185 1174 } 1186 1175 1187 lookup:1188 1176 b = cli->binding_handle; 1177 1178 if (cli->transport->transport == NCACN_IP_TCP) { 1179 use_lookupnames4 = true; 1180 } 1189 1181 1190 1182 /* … … 1195 1187 orig_timeout = dcerpc_binding_handle_set_timeout(b, 35000); 1196 1188 1197 status = lookup_names_fn(b, 1198 mem_ctx, 1199 &lsa_policy, 1200 num_names, 1201 (const char **) names, 1202 domains, 1203 1, 1204 sids, 1205 types, 1206 &result); 1189 status = dcerpc_lsa_lookup_names_generic(b, 1190 mem_ctx, 1191 &lsa_policy, 1192 num_names, 1193 (const char **) names, 1194 domains, 1195 1, 1196 sids, 1197 types, 1198 use_lookupnames4, 1199 &result); 1207 1200 1208 1201 /* And restore our original timeout. */ … … 1210 1203 1211 1204 if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) || 1212 NT_STATUS_EQUAL(status, NT_STATUS_RPC_SEC_PKG_ERROR)) { 1205 NT_STATUS_EQUAL(status, NT_STATUS_RPC_SEC_PKG_ERROR) || 1206 NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_ACCESS_DENIED)) { 1213 1207 /* 1214 1208 * This can happen if the schannel key is not … … 1218 1212 */ 1219 1213 invalidate_cm_connection(&domain->conn); 1214 if (!retried) { 1215 retried = true; 1216 goto connect; 1217 } 1220 1218 status = NT_STATUS_ACCESS_DENIED; 1221 1219 }
Note:
See TracChangeset
for help on using the changeset viewer.