Changeset 342 for branches/samba-3.3.x/source/rpc_client
- Timestamp:
- Oct 30, 2009, 9:39:05 AM (16 years ago)
- Location:
- branches/samba-3.3.x/source/rpc_client
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/rpc_client/cli_lsarpc.c
r206 r342 127 127 char **domains, 128 128 char **names, 129 enum lsa_SidType *types) 129 enum lsa_SidType *types, 130 bool use_lookupsids3) 130 131 { 131 132 NTSTATUS result = NT_STATUS_OK; … … 160 161 } 161 162 162 result = rpccli_lsa_LookupSids(cli, mem_ctx, 163 pol, 164 &sid_array, 165 &ref_domains, 166 &lsa_names, 167 level, 168 &count); 163 if (use_lookupsids3) { 164 struct lsa_TransNameArray2 lsa_names2; 165 uint32_t n; 166 167 ZERO_STRUCT(lsa_names2); 168 169 result = rpccli_lsa_LookupSids3(cli, mem_ctx, 170 &sid_array, 171 &ref_domains, 172 &lsa_names2, 173 level, 174 &count, 175 0, 176 0); 177 178 if (!NT_STATUS_IS_ERR(result)) { 179 lsa_names.count = lsa_names2.count; 180 lsa_names.names = talloc_array(mem_ctx, struct lsa_TranslatedName, lsa_names.count); 181 if (!lsa_names.names) { 182 return NT_STATUS_NO_MEMORY; 183 } 184 for (n=0; n < lsa_names.count; n++) { 185 lsa_names.names[n].sid_type = lsa_names2.names[n].sid_type; 186 lsa_names.names[n].name = lsa_names2.names[n].name; 187 lsa_names.names[n].sid_index = lsa_names2.names[n].sid_index; 188 } 189 } 190 191 } else { 192 result = rpccli_lsa_LookupSids(cli, mem_ctx, 193 pol, 194 &sid_array, 195 &ref_domains, 196 &lsa_names, 197 level, 198 &count); 199 } 169 200 170 201 DEBUG(10, ("LSA_LOOKUPSIDS returned '%s', mapped count = %d'\n", … … 246 277 #define LOOKUP_SIDS_HUNK_SIZE 1000 247 278 248 NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli, 249 TALLOC_CTX *mem_ctx, 250 POLICY_HND *pol, 251 int num_sids, 252 const DOM_SID *sids, 253 char ***pdomains, 254 char ***pnames, 255 enum lsa_SidType **ptypes) 279 static NTSTATUS rpccli_lsa_lookup_sids_generic(struct rpc_pipe_client *cli, 280 TALLOC_CTX *mem_ctx, 281 struct policy_handle *pol, 282 int num_sids, 283 const DOM_SID *sids, 284 char ***pdomains, 285 char ***pnames, 286 enum lsa_SidType **ptypes, 287 bool use_lookupsids3) 256 288 { 257 289 NTSTATUS result = NT_STATUS_OK; … … 312 344 hunk_domains, 313 345 hunk_names, 314 hunk_types); 346 hunk_types, 347 use_lookupsids3); 315 348 316 349 if (!NT_STATUS_IS_OK(hunk_result) && … … 353 386 } 354 387 388 NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli, 389 TALLOC_CTX *mem_ctx, 390 struct policy_handle *pol, 391 int num_sids, 392 const DOM_SID *sids, 393 char ***pdomains, 394 char ***pnames, 395 enum lsa_SidType **ptypes) 396 { 397 return rpccli_lsa_lookup_sids_generic(cli, mem_ctx, pol, num_sids, sids, 398 pdomains, pnames, ptypes, false); 399 } 400 401 NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli, 402 TALLOC_CTX *mem_ctx, 403 struct policy_handle *pol, 404 int num_sids, 405 const DOM_SID *sids, 406 char ***pdomains, 407 char ***pnames, 408 enum lsa_SidType **ptypes) 409 { 410 return rpccli_lsa_lookup_sids_generic(cli, mem_ctx, pol, num_sids, sids, 411 pdomains, pnames, ptypes, true); 412 } 413 355 414 /** Lookup a list of names */ 356 415 357 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, 358 TALLOC_CTX *mem_ctx, 359 POLICY_HND *pol, int num_names, 360 const char **names, 361 const char ***dom_names, 362 int level, 363 DOM_SID **sids, 364 enum lsa_SidType **types) 416 static NTSTATUS rpccli_lsa_lookup_names_generic(struct rpc_pipe_client *cli, 417 TALLOC_CTX *mem_ctx, 418 struct policy_handle *pol, int num_names, 419 const char **names, 420 const char ***dom_names, 421 int level, 422 DOM_SID **sids, 423 enum lsa_SidType **types, 424 bool use_lookupnames4) 365 425 { 366 426 NTSTATUS result; … … 369 429 struct lsa_RefDomainList *domains = NULL; 370 430 struct lsa_TransSidArray sid_array; 431 struct lsa_TransSidArray3 sid_array3; 371 432 uint32_t count = 0; 372 433 373 434 ZERO_STRUCT(sid_array); 435 ZERO_STRUCT(sid_array3); 374 436 375 437 lsa_names = TALLOC_ARRAY(mem_ctx, struct lsa_String, num_names); … … 382 444 } 383 445 384 result = rpccli_lsa_LookupNames(cli, mem_ctx, 385 pol, 386 num_names, 387 lsa_names, 388 &domains, 389 &sid_array, 390 level, 391 &count); 446 if (use_lookupnames4) { 447 result = rpccli_lsa_LookupNames4(cli, mem_ctx, 448 num_names, 449 lsa_names, 450 &domains, 451 &sid_array3, 452 level, 453 &count, 454 0, 455 0); 456 } else { 457 result = rpccli_lsa_LookupNames(cli, mem_ctx, 458 pol, 459 num_names, 460 lsa_names, 461 &domains, 462 &sid_array, 463 level, 464 &count); 465 } 392 466 393 467 if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) != … … 436 510 437 511 for (i = 0; i < num_names; i++) { 438 uint32_t dom_idx = sid_array.sids[i].sid_index; 439 uint32_t dom_rid = sid_array.sids[i].rid; 512 uint32_t dom_idx; 440 513 DOM_SID *sid = &(*sids)[i]; 514 515 if (use_lookupnames4) { 516 dom_idx = sid_array3.sids[i].sid_index; 517 (*types)[i] = sid_array3.sids[i].sid_type; 518 } else { 519 dom_idx = sid_array.sids[i].sid_index; 520 (*types)[i] = sid_array.sids[i].sid_type; 521 } 441 522 442 523 /* Translate optimised sid through domain index array */ … … 449 530 } 450 531 451 sid_copy(sid, domains->domains[dom_idx].sid); 452 453 if (dom_rid != 0xffffffff) { 454 sid_append_rid(sid, dom_rid); 455 } 456 457 (*types)[i] = sid_array.sids[i].sid_type; 532 if (use_lookupnames4) { 533 sid_copy(sid, sid_array3.sids[i].sid); 534 } else { 535 sid_copy(sid, domains->domains[dom_idx].sid); 536 537 if (sid_array.sids[i].rid != 0xffffffff) { 538 sid_append_rid(sid, sid_array.sids[i].rid); 539 } 540 } 458 541 459 542 if (dom_names == NULL) { … … 468 551 return result; 469 552 } 553 554 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, 555 TALLOC_CTX *mem_ctx, 556 struct policy_handle *pol, int num_names, 557 const char **names, 558 const char ***dom_names, 559 int level, 560 DOM_SID **sids, 561 enum lsa_SidType **types) 562 { 563 return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names, 564 names, dom_names, level, sids, 565 types, false); 566 } 567 568 NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli, 569 TALLOC_CTX *mem_ctx, 570 struct policy_handle *pol, int num_names, 571 const char **names, 572 const char ***dom_names, 573 int level, 574 DOM_SID **sids, 575 enum lsa_SidType **types) 576 { 577 return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names, 578 names, dom_names, level, sids, 579 types, true); 580 } -
branches/samba-3.3.x/source/rpc_client/cli_netlogon.c
r206 r342 602 602 struct samr_Password new_password; 603 603 604 cred_hash3(new_password.hash,605 606 604 des_crypt112_16(new_password.hash, 605 new_trust_passwd_hash, 606 cli->dc->sess_key, 1); 607 607 608 608 result = rpccli_netr_ServerPasswordSet(cli, mem_ctx, -
branches/samba-3.3.x/source/rpc_client/cli_pipe.c
r206 r342 491 491 } 492 492 493 if (auth_len !=RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN) {493 if (auth_len < RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN) { 494 494 DEBUG(0,("cli_pipe_verify_schannel: auth_len %u.\n", (unsigned int)auth_len )); 495 495 return NT_STATUS_INVALID_PARAMETER; … … 2320 2320 return NT_STATUS_OK; 2321 2321 } 2322 2323 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli, 2322 unsigned int rpccli_set_timeout(struct rpc_pipe_client *rpc_cli, 2324 2323 unsigned int timeout) 2325 2324 { 2326 return cli_set_timeout(cli->trans.np.cli, timeout); 2325 struct cli_state *cli = rpc_pipe_np_smb_conn(rpc_cli); 2326 2327 if (cli == NULL) { 2328 return 0; 2329 } 2330 return cli_set_timeout(cli, timeout); 2327 2331 } 2328 2332 … … 2932 2936 2933 2937 static NTSTATUS cli_rpc_pipe_open(struct cli_state *cli, 2938 enum dcerpc_transport_t transport, 2934 2939 const struct ndr_syntax_id *interface, 2935 2940 struct rpc_pipe_client **presult) 2936 2941 { 2937 if (ndr_syntax_id_equal(interface, &ndr_table_drsuapi.syntax_id)) { 2938 /* 2939 * We should have a better way to figure out this drsuapi 2940 * speciality... 2941 */ 2942 switch (transport) { 2943 case NCACN_IP_TCP: 2942 2944 return rpc_pipe_open_tcp(NULL, cli->desthost, interface, 2943 2945 presult); 2944 } 2945 2946 return rpc_pipe_open_np(cli, interface, presult); 2946 case NCACN_NP: 2947 return rpc_pipe_open_np(cli, interface, presult); 2948 default: 2949 return NT_STATUS_NOT_IMPLEMENTED; 2950 } 2947 2951 } 2948 2952 … … 2951 2955 ****************************************************************************/ 2952 2956 2953 NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli, 2954 const struct ndr_syntax_id *interface, 2955 struct rpc_pipe_client **presult) 2957 NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli, 2958 enum dcerpc_transport_t transport, 2959 const struct ndr_syntax_id *interface, 2960 struct rpc_pipe_client **presult) 2956 2961 { 2957 2962 struct rpc_pipe_client *result; … … 2959 2964 NTSTATUS status; 2960 2965 2961 status = cli_rpc_pipe_open(cli, interface, &result);2966 status = cli_rpc_pipe_open(cli, transport, interface, &result); 2962 2967 if (!NT_STATUS_IS_OK(status)) { 2963 2968 return status; … … 3016 3021 3017 3022 /**************************************************************************** 3023 ****************************************************************************/ 3024 3025 NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli, 3026 const struct ndr_syntax_id *interface, 3027 struct rpc_pipe_client **presult) 3028 { 3029 return cli_rpc_pipe_open_noauth_transport(cli, NCACN_NP, 3030 interface, presult); 3031 } 3032 3033 /**************************************************************************** 3018 3034 Open a named pipe to an SMB server and bind using NTLMSSP or SPNEGO NTLMSSP 3019 3035 ****************************************************************************/ … … 3021 3037 static NTSTATUS cli_rpc_pipe_open_ntlmssp_internal(struct cli_state *cli, 3022 3038 const struct ndr_syntax_id *interface, 3039 enum dcerpc_transport_t transport, 3023 3040 enum pipe_auth_type auth_type, 3024 3041 enum pipe_auth_level auth_level, … … 3032 3049 NTSTATUS status; 3033 3050 3034 status = cli_rpc_pipe_open(cli, interface, &result);3051 status = cli_rpc_pipe_open(cli, transport, interface, &result); 3035 3052 if (!NT_STATUS_IS_OK(status)) { 3036 3053 return status; … … 3074 3091 NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli, 3075 3092 const struct ndr_syntax_id *interface, 3093 enum dcerpc_transport_t transport, 3076 3094 enum pipe_auth_level auth_level, 3077 3095 const char *domain, … … 3082 3100 return cli_rpc_pipe_open_ntlmssp_internal(cli, 3083 3101 interface, 3102 transport, 3084 3103 PIPE_AUTH_TYPE_NTLMSSP, 3085 3104 auth_level, … … 3097 3116 NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli, 3098 3117 const struct ndr_syntax_id *interface, 3118 enum dcerpc_transport_t transport, 3099 3119 enum pipe_auth_level auth_level, 3100 3120 const char *domain, … … 3105 3125 return cli_rpc_pipe_open_ntlmssp_internal(cli, 3106 3126 interface, 3127 transport, 3107 3128 PIPE_AUTH_TYPE_SPNEGO_NTLMSSP, 3108 3129 auth_level, … … 3202 3223 NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli, 3203 3224 const struct ndr_syntax_id *interface, 3225 enum dcerpc_transport_t transport, 3204 3226 enum pipe_auth_level auth_level, 3205 3227 const char *domain, … … 3211 3233 NTSTATUS status; 3212 3234 3213 status = cli_rpc_pipe_open(cli, interface, &result);3235 status = cli_rpc_pipe_open(cli, transport, interface, &result); 3214 3236 if (!NT_STATUS_IS_OK(status)) { 3215 3237 return status; … … 3271 3293 3272 3294 status = cli_rpc_pipe_open_spnego_ntlmssp( 3273 cli, &ndr_table_netlogon.syntax_id, PIPE_AUTH_LEVEL_PRIVACY, 3295 cli, &ndr_table_netlogon.syntax_id, NCACN_NP, 3296 PIPE_AUTH_LEVEL_PRIVACY, 3274 3297 domain, username, password, &netlogon_pipe); 3275 3298 if (!NT_STATUS_IS_OK(status)) { … … 3296 3319 NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli, 3297 3320 const struct ndr_syntax_id *interface, 3321 enum dcerpc_transport_t transport, 3298 3322 enum pipe_auth_level auth_level, 3299 3323 const char *domain, … … 3317 3341 3318 3342 status = cli_rpc_pipe_open_schannel_with_key( 3319 cli, interface, auth_level, domain, netlogon_pipe->dc,3343 cli, interface, transport, auth_level, domain, netlogon_pipe->dc, 3320 3344 &result); 3321 3345 … … 3336 3360 NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli, 3337 3361 const struct ndr_syntax_id *interface, 3362 enum dcerpc_transport_t transport, 3338 3363 enum pipe_auth_level auth_level, 3339 3364 const char *domain, … … 3355 3380 3356 3381 status = cli_rpc_pipe_open_schannel_with_key( 3357 cli, interface, auth_level, domain, netlogon_pipe->dc,3382 cli, interface, transport, auth_level, domain, netlogon_pipe->dc, 3358 3383 &result); 3359 3384 … … 3387 3412 NTSTATUS status; 3388 3413 3389 status = cli_rpc_pipe_open(cli, interface, &result);3414 status = cli_rpc_pipe_open(cli, NCACN_NP, interface, &result); 3390 3415 if (!NT_STATUS_IS_OK(status)) { 3391 3416 return status; -
branches/samba-3.3.x/source/rpc_client/init_netlogon.c
r206 r342 297 297 NETLOGON_EXTRA_SIDS, 298 298 user_session_key, 299 my_name,299 talloc_strdup(sam3, my_name), 300 300 talloc_strdup(sam3, pdb_get_domain(sampw)), 301 301 sid,
Note:
See TracChangeset
for help on using the changeset viewer.