Changeset 860 for vendor/current/source3/rpc_client
- Timestamp:
- May 12, 2014, 8:58:38 PM (11 years ago)
- Location:
- vendor/current/source3/rpc_client
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/rpc_client/cli_lsarpc.c
r746 r860 280 280 for (i = 0; i < num_sids; i++) { 281 281 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; 283 290 284 291 /* Translate optimised name through domain index array */ 285 292 286 293 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 } 287 302 288 303 dom_name = ref_domains->domains[dom_idx].name.string; … … 331 346 #define LOOKUP_SIDS_HUNK_SIZE 1000 332 347 333 staticNTSTATUS dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle *h,334 335 336 337 338 339 340 341 342 348 NTSTATUS 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) 343 358 { 344 359 NTSTATUS status = NT_STATUS_OK; … … 540 555 } 541 556 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 571 557 /** Lookup a list of names */ 572 558 573 staticNTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h,574 575 576 577 578 579 580 581 582 583 559 NTSTATUS 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) 584 570 { 585 571 NTSTATUS status; … … 677 663 678 664 if (use_lookupnames4) { 665 if (i >= sid_array3.count) { 666 *presult = NT_STATUS_INVALID_NETWORK_RESPONSE; 667 goto done; 668 } 669 679 670 dom_idx = sid_array3.sids[i].sid_index; 680 671 (*types)[i] = sid_array3.sids[i].sid_type; 681 672 } else { 673 if (i >= sid_array.count) { 674 *presult = NT_STATUS_INVALID_NETWORK_RESPONSE; 675 goto done; 676 } 677 682 678 dom_idx = sid_array.sids[i].sid_index; 683 679 (*types)[i] = sid_array.sids[i].sid_type; … … 691 687 (*types)[i] = SID_NAME_UNKNOWN; 692 688 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; 693 697 } 694 698 … … 791 795 result); 792 796 } 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 126 126 char ***pnames, 127 127 enum lsa_SidType **ptypes); 128 128 NTSTATUS 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); 129 138 /** 130 139 * @brief Look up the names that correspond to an array of sids. … … 159 168 enum lsa_SidType **ptypes, 160 169 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 170 170 NTSTATUS dcerpc_lsa_lookup_names(struct dcerpc_binding_handle *h, 171 171 TALLOC_CTX *mem_ctx, … … 197 197 enum lsa_SidType **types, 198 198 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); 199 NTSTATUS 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); 207 210 208 211 bool fetch_domain_sid( char *domain, char *remote_machine, struct dom_sid *psid); -
vendor/current/source3/rpc_client/cli_netlogon.c
r740 r860 626 626 627 627 struct netr_CryptPassword new_password; 628 uint32_t old_timeout; 628 629 629 630 init_netr_CryptPassword(new_trust_pwd_cleartext, 630 631 cli->dc->session_key, 631 632 &new_password); 633 634 old_timeout = dcerpc_binding_handle_set_timeout(b, 600000); 632 635 633 636 status = dcerpc_netr_ServerPasswordSet2(b, mem_ctx, … … 640 643 &new_password, 641 644 &result); 645 646 dcerpc_binding_handle_set_timeout(b, old_timeout); 647 642 648 if (!NT_STATUS_IS_OK(status)) { 643 649 DEBUG(0,("dcerpc_netr_ServerPasswordSet2 failed: %s\n", … … 648 654 649 655 struct samr_Password new_password; 656 uint32_t old_timeout; 657 650 658 memcpy(new_password.hash, new_trust_passwd_hash, sizeof(new_password.hash)); 651 659 netlogon_creds_des_encrypt(cli->dc, &new_password); 660 661 old_timeout = dcerpc_binding_handle_set_timeout(b, 600000); 652 662 653 663 status = dcerpc_netr_ServerPasswordSet(b, mem_ctx, … … 660 670 &new_password, 661 671 &result); 672 673 dcerpc_binding_handle_set_timeout(b, old_timeout); 674 662 675 if (!NT_STATUS_IS_OK(status)) { 663 676 DEBUG(0,("dcerpc_netr_ServerPasswordSet failed: %s\n", -
vendor/current/source3/rpc_client/cli_pipe.c
r740 r860 236 236 struct rpc_pipe_client *cli; 237 237 uint16_t frag_len; 238 uint32_t call_id; 238 239 DATA_BLOB *pdu; 239 240 }; … … 245 246 struct event_context *ev, 246 247 struct rpc_pipe_client *cli, 248 uint32_t call_id, 247 249 DATA_BLOB *pdu) 248 250 { … … 260 262 state->cli = cli; 261 263 state->frag_len = RPC_HEADER_LEN; 264 state->call_id = call_id; 262 265 state->pdu = pdu; 263 266 … … 282 285 283 286 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 } 284 296 285 297 /* … … 330 342 331 343 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 } 332 353 333 354 if (!data_blob_realloc(NULL, state->pdu, state->frag_len)) { … … 691 712 struct rpc_pipe_client *cli; 692 713 uint8_t expected_pkt_type; 714 uint32_t call_id; 693 715 694 716 DATA_BLOB incoming_frag; … … 709 731 struct rpc_pipe_client *cli, 710 732 DATA_BLOB *data, /* Outgoing PDU */ 711 uint8_t expected_pkt_type) 733 uint8_t expected_pkt_type, 734 uint32_t call_id) 712 735 { 713 736 struct tevent_req *req, *subreq; … … 723 746 state->cli = cli; 724 747 state->expected_pkt_type = expected_pkt_type; 748 state->call_id = call_id; 725 749 state->incoming_frag = data_blob_null; 726 750 state->reply_pdu = data_blob_null; … … 822 846 /* Ensure we have enough data for a pdu. */ 823 847 subreq = get_complete_frag_send(state, state->ev, state->cli, 848 state->call_id, 824 849 &state->incoming_frag); 825 850 if (tevent_req_nomem(subreq, req)) { … … 941 966 942 967 subreq = get_complete_frag_send(state, state->ev, state->cli, 968 state->call_id, 943 969 &state->incoming_frag); 944 970 if (tevent_req_nomem(subreq, req)) { … … 1293 1319 subreq = rpc_api_pipe_send(state, ev, state->cli, 1294 1320 &state->rpc_out, 1295 DCERPC_PKT_RESPONSE); 1321 DCERPC_PKT_RESPONSE, 1322 state->call_id); 1296 1323 if (subreq == NULL) { 1297 1324 goto fail; … … 1429 1456 subreq = rpc_api_pipe_send(state, state->ev, state->cli, 1430 1457 &state->rpc_out, 1431 DCERPC_PKT_RESPONSE); 1458 DCERPC_PKT_RESPONSE, 1459 state->call_id); 1432 1460 if (tevent_req_nomem(subreq, req)) { 1433 1461 return; … … 1668 1696 1669 1697 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); 1671 1699 if (subreq == NULL) { 1672 1700 goto fail; … … 1866 1894 1867 1895 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); 1869 1898 if (subreq == NULL) { 1870 1899 return NT_STATUS_NO_MEMORY; … … 1898 1927 1899 1928 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); 1901 1931 if (subreq == NULL) { 1902 1932 return NT_STATUS_NO_MEMORY; … … 2451 2481 result->max_recv_frag = RPC_MAX_PDU_FRAG_LEN; 2452 2482 2453 if (!resolve_name(host, &addr, 0, false)) {2483 if (!resolve_name(host, &addr, NBT_NAME_SERVER, false)) { 2454 2484 status = NT_STATUS_NOT_FOUND; 2455 2485 goto fail;
Note:
See TracChangeset
for help on using the changeset viewer.