Changeset 221 for branches/samba-3.3.x/source/auth/auth_util.c
- Timestamp:
- May 24, 2009, 7:17:10 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/auth/auth_util.c
r206 r221 556 556 gid_t *gids; 557 557 auth_serversupplied_info *result; 558 int i;559 size_t num_gids;560 DOM_SID unix_group_sid;561 558 const char *username = pdb_get_username(sampass); 562 559 NTSTATUS status; … … 574 571 575 572 result->sam_account = sampass; 576 /* Ensure thaat the sampass will be freed with the result */577 talloc_steal(result, sampass);578 573 result->unix_name = pwd->pw_name; 579 574 /* Ensure that we keep pwd->pw_name, because we will free pwd below */ … … 632 627 } 633 628 634 /* Add the "Unix Group" SID for each gid to catch mapped groups635 and their Unix equivalent. This is to solve the backwards636 compatibility problem of 'valid users = +ntadmin' where637 ntadmin has been paired with "Domain Admins" in the group638 mapping table. Otherwise smb.conf would need to be changed639 to 'valid user = "Domain Admins"'. --jerry */640 641 num_gids = result->num_sids;642 for ( i=0; i<num_gids; i++ ) {643 if ( !gid_to_unix_groups_sid( gids[i], &unix_group_sid ) ) {644 DEBUG(1,("make_server_info_sam: Failed to create SID "645 "for gid %d!\n", gids[i]));646 continue;647 }648 status = add_sid_to_array_unique(result, &unix_group_sid,649 &result->sids,650 &result->num_sids);651 if (!NT_STATUS_IS_OK(status)) {652 result->sam_account = NULL; /* Don't free on error exit. */653 TALLOC_FREE(result);654 return status;655 }656 }657 658 629 /* For now we throw away the gids and convert via sid_to_gid 659 630 * later. This needs fixing, but I'd like to get the code straight and … … 666 637 667 638 *server_info = result; 639 /* Ensure thaat the sampass will be freed with the result */ 640 talloc_steal(result, sampass); 668 641 669 642 return NT_STATUS_OK; … … 720 693 NTSTATUS status; 721 694 size_t i; 695 struct dom_sid tmp_sid; 722 696 723 697 /* … … 772 746 } 773 747 748 /* 749 * Add the "Unix Group" SID for each gid to catch mapped groups 750 * and their Unix equivalent. This is to solve the backwards 751 * compatibility problem of 'valid users = +ntadmin' where 752 * ntadmin has been paired with "Domain Admins" in the group 753 * mapping table. Otherwise smb.conf would need to be changed 754 * to 'valid user = "Domain Admins"'. --jerry 755 * 756 * For consistency we also add the "Unix User" SID, 757 * so that the complete unix token is represented within 758 * the nt token. 759 */ 760 761 if (!uid_to_unix_users_sid(server_info->utok.uid, &tmp_sid)) { 762 DEBUG(1,("create_local_token: Failed to create SID " 763 "for uid %d!\n", server_info->utok.uid)); 764 } 765 add_sid_to_array_unique(server_info->ptok, &tmp_sid, 766 &server_info->ptok->user_sids, 767 &server_info->ptok->num_sids); 768 769 for ( i=0; i<server_info->utok.ngroups; i++ ) { 770 if (!gid_to_unix_groups_sid( server_info->utok.groups[i], &tmp_sid ) ) { 771 DEBUG(1,("create_local_token: Failed to create SID " 772 "for gid %d!\n", server_info->utok.groups[i])); 773 continue; 774 } 775 add_sid_to_array_unique(server_info->ptok, &tmp_sid, 776 &server_info->ptok->user_sids, 777 &server_info->ptok->num_sids); 778 } 779 774 780 debug_nt_user_token(DBGC_AUTH, 10, server_info->ptok); 781 debug_unix_user_token(DBGC_AUTH, 10, 782 server_info->utok.uid, 783 server_info->utok.gid, 784 server_info->utok.ngroups, 785 server_info->utok.groups); 775 786 776 787 status = log_nt_token(server_info->ptok);
Note:
See TracChangeset
for help on using the changeset viewer.