Changeset 138 for trunk/samba/source/auth
- Timestamp:
- Jul 3, 2008, 11:23:12 AM (17 years ago)
- Location:
- trunk/samba/source/auth
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/samba/source/auth/auth_sam.c
r133 r138 167 167 time_t last_set_time = pdb_get_pass_last_set_time(sampass); 168 168 169 /* check for immediate expiry "must change at next logon" */ 170 if (last_set_time == 0) { 169 /* check for immediate expiry "must change at next logon" 170 * for a user account. */ 171 if (((acct_ctrl & (ACB_WSTRUST|ACB_SVRTRUST)) == 0) && (last_set_time == 0)) { 171 172 DEBUG(1,("sam_account_ok: Account for user '%s' password must change!.\n", pdb_get_username(sampass))); 172 173 return NT_STATUS_PASSWORD_MUST_CHANGE; -
trunk/samba/source/auth/auth_util.c
r133 r138 487 487 488 488 /*************************************************************************** 489 Is the incoming username our own machine account ? 490 If so, the connection is almost certainly from winbindd. 491 ***************************************************************************/ 492 493 static bool is_our_machine_account(const char *username) 494 { 495 bool ret; 496 char *truncname = NULL; 497 size_t ulen = strlen(username); 498 499 if (ulen == 0 || username[ulen-1] != '$') { 500 return false; 501 } 502 truncname = SMB_STRDUP(username); 503 if (!truncname) { 504 return false; 505 } 506 truncname[ulen-1] = '\0'; 507 ret = strequal(truncname, global_myname()); 508 SAFE_FREE(truncname); 509 return ret; 510 } 511 512 /*************************************************************************** 489 513 Make (and fill) a user_info struct from a struct samu 490 514 ***************************************************************************/ 491 515 492 NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info, 516 NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info, 493 517 struct samu *sampass) 494 518 { 495 NTSTATUS status;496 519 struct passwd *pwd; 497 520 gid_t *gids; … … 500 523 size_t num_gids; 501 524 DOM_SID unix_group_sid; 502 525 const char *username = pdb_get_username(sampass); 526 NTSTATUS status; 503 527 504 528 if ( !(result = make_server_info(NULL)) ) { … … 506 530 } 507 531 508 if ( !(pwd = getpwnam_alloc(result, pdb_get_username(sampass))) ) {532 if ( !(pwd = getpwnam_alloc(result, username)) ) { 509 533 DEBUG(1, ("User %s in passdb, but getpwnam() fails!\n", 510 534 pdb_get_username(sampass))); … … 521 545 result->gid = pwd->pw_gid; 522 546 result->uid = pwd->pw_uid; 523 547 524 548 TALLOC_FREE(pwd); 525 549 526 status = pdb_enum_group_memberships(result, sampass, 550 if (IS_DC && is_our_machine_account(username)) { 551 /* 552 * Ensure for a connection from our own 553 * machine account (from winbindd on a DC) 554 * there are no supplementary groups. 555 * Prevents loops in calling gid_to_sid(). 556 */ 557 result->sids = NULL; 558 gids = NULL; 559 result->num_sids = 0; 560 561 /* 562 * This is a hack of monstrous proportions. 563 * If we know it's winbindd talking to us, 564 * we know we must never recurse into it, 565 * so turn off contacting winbindd for this 566 * entire process. This will get fixed when 567 * winbindd doesn't need to talk to smbd on 568 * a PDC. JRA. 569 */ 570 571 (void)winbind_off(); 572 573 DEBUG(10, ("make_server_info_sam: our machine account %s " 574 "setting supplementary group list empty and " 575 "turning off winbindd requests.\n", 576 username)); 577 } else { 578 status = pdb_enum_group_memberships(result, sampass, 527 579 &result->sids, &gids, 528 580 &result->num_sids); 529 581 530 if (!NT_STATUS_IS_OK(status)) { 531 DEBUG(10, ("pdb_enum_group_memberships failed: %s\n", 532 nt_errstr(status))); 533 result->sam_account = NULL; /* Don't free on error exit. */ 534 TALLOC_FREE(result); 535 return status; 536 } 537 582 if (!NT_STATUS_IS_OK(status)) { 583 DEBUG(10, ("pdb_enum_group_memberships failed: %s\n", 584 nt_errstr(status))); 585 result->sam_account = NULL; /* Don't free on error exit. */ 586 TALLOC_FREE(result); 587 return status; 588 } 589 } 590 538 591 /* Add the "Unix Group" SID for each gid to catch mapped groups 539 592 and their Unix equivalent. This is to solve the backwards
Note:
See TracChangeset
for help on using the changeset viewer.