Changeset 596 for trunk/server/source3/rpc_client
- Timestamp:
- Jul 2, 2011, 3:35:33 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/rpc_client/cli_netlogon.c
r414 r596 284 284 } 285 285 286 #define COPY_LSA_STRING(mem_ctx, in, out, name) do { \ 287 if (in->name.string) { \ 288 out->name.string = talloc_strdup(mem_ctx, in->name.string); \ 289 NT_STATUS_HAVE_NO_MEMORY(out->name.string); \ 290 } \ 291 } while (0) 292 293 static NTSTATUS copy_netr_SamBaseInfo(TALLOC_CTX *mem_ctx, 294 const struct netr_SamBaseInfo *in, 295 struct netr_SamBaseInfo *out) 296 { 297 /* first copy all, then realloc pointers */ 298 *out = *in; 299 300 COPY_LSA_STRING(mem_ctx, in, out, account_name); 301 COPY_LSA_STRING(mem_ctx, in, out, full_name); 302 COPY_LSA_STRING(mem_ctx, in, out, logon_script); 303 COPY_LSA_STRING(mem_ctx, in, out, profile_path); 304 COPY_LSA_STRING(mem_ctx, in, out, home_directory); 305 COPY_LSA_STRING(mem_ctx, in, out, home_drive); 306 307 if (in->groups.count) { 308 out->groups.rids = (struct samr_RidWithAttribute *) 309 talloc_memdup(mem_ctx, in->groups.rids, 310 (sizeof(struct samr_RidWithAttribute) * 311 in->groups.count)); 312 NT_STATUS_HAVE_NO_MEMORY(out->groups.rids); 313 } 314 315 COPY_LSA_STRING(mem_ctx, in, out, logon_server); 316 COPY_LSA_STRING(mem_ctx, in, out, domain); 317 318 if (in->domain_sid) { 319 out->domain_sid = sid_dup_talloc(mem_ctx, in->domain_sid); 320 NT_STATUS_HAVE_NO_MEMORY(out->domain_sid); 321 } 322 323 return NT_STATUS_OK; 324 } 325 326 static NTSTATUS map_validation_to_info3(TALLOC_CTX *mem_ctx, 327 uint16_t validation_level, 328 union netr_Validation *validation, 329 struct netr_SamInfo3 **info3_p) 330 { 331 struct netr_SamInfo3 *info3; 332 NTSTATUS status; 333 334 if (validation == NULL) { 335 return NT_STATUS_INVALID_PARAMETER; 336 } 337 338 switch (validation_level) { 339 case 3: 340 if (validation->sam3 == NULL) { 341 return NT_STATUS_INVALID_PARAMETER; 342 } 343 344 info3 = talloc_move(mem_ctx, &validation->sam3); 345 break; 346 case 6: 347 if (validation->sam6 == NULL) { 348 return NT_STATUS_INVALID_PARAMETER; 349 } 350 351 info3 = talloc_zero(mem_ctx, struct netr_SamInfo3); 352 if (info3 == NULL) { 353 return NT_STATUS_NO_MEMORY; 354 } 355 status = copy_netr_SamBaseInfo(info3, &validation->sam6->base, &info3->base); 356 if (!NT_STATUS_IS_OK(status)) { 357 TALLOC_FREE(info3); 358 return status; 359 } 360 361 info3->sidcount = validation->sam6->sidcount; 362 info3->sids = talloc_move(info3, &validation->sam6->sids); 363 break; 364 default: 365 return NT_STATUS_BAD_VALIDATION_CLASS; 366 } 367 368 *info3_p = info3; 369 370 return NT_STATUS_OK; 371 } 286 372 287 373 /** … … 299 385 const char *workstation, 300 386 const uint8 chal[8], 387 uint16_t validation_level, 301 388 DATA_BLOB lm_response, 302 389 DATA_BLOB nt_response, … … 304 391 { 305 392 NTSTATUS result = NT_STATUS_UNSUCCESSFUL; 306 int validation_level = 3;307 393 const char *workstation_name_slash; 308 394 const char *server_name_slash; … … 398 484 netlogon_creds_decrypt_samlogon(cli->dc, validation_level, &validation); 399 485 400 *info3 = validation.sam3; 486 result = map_validation_to_info3(mem_ctx, validation_level, &validation, info3); 487 if (!NT_STATUS_IS_OK(result)) { 488 return result; 489 } 401 490 402 491 return result; … … 411 500 const char *workstation, 412 501 const uint8 chal[8], 502 uint16_t validation_level, 413 503 DATA_BLOB lm_response, 414 504 DATA_BLOB nt_response, … … 416 506 { 417 507 NTSTATUS result = NT_STATUS_UNSUCCESSFUL; 418 int validation_level = 3;419 508 const char *workstation_name_slash; 420 509 const char *server_name_slash; … … 499 588 netlogon_creds_decrypt_samlogon(cli->dc, validation_level, &validation); 500 589 501 *info3 = validation.sam3; 590 result = map_validation_to_info3(mem_ctx, validation_level, &validation, info3); 591 if (!NT_STATUS_IS_OK(result)) { 592 return result; 593 } 502 594 503 595 return result;
Note:
See TracChangeset
for help on using the changeset viewer.