Set default group membership for new users.

svn path=/trunk/; revision=59107
This commit is contained in:
Eric Kohl 2013-05-29 16:09:10 +00:00
parent 6379d95ae2
commit 4569c1ab96
2 changed files with 47 additions and 3 deletions

View file

@ -2096,6 +2096,7 @@ SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle,
SAM_USER_FIXED_DATA FixedUserData;
PSAM_DB_OBJECT DomainObject;
PSAM_DB_OBJECT UserObject;
GROUP_MEMBERSHIP GroupMembership;
UCHAR LogonHours[23];
ULONG ulSize;
ULONG ulRid;
@ -2365,7 +2366,22 @@ SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle,
return Status;
}
/* FIXME: Set Groups attribute*/
/* Set Groups attribute*/
GroupMembership.RelativeId = DOMAIN_GROUP_RID_USERS;
GroupMembership.Attributes = SE_GROUP_MANDATORY |
SE_GROUP_ENABLED |
SE_GROUP_ENABLED_BY_DEFAULT;
Status = SampSetObjectAttribute(UserObject,
L"Groups",
REG_BINARY,
&GroupMembership,
sizeof(GROUP_MEMBERSHIP));
if (!NT_SUCCESS(Status))
{
TRACE("failed with status 0x%08lx\n", Status);
return Status;
}
/* Set LMPwd attribute*/
Status = SampSetObjectAttribute(UserObject,
@ -7638,6 +7654,7 @@ SamrCreateUser2InDomain(IN SAMPR_HANDLE DomainHandle,
SAM_USER_FIXED_DATA FixedUserData;
PSAM_DB_OBJECT DomainObject;
PSAM_DB_OBJECT UserObject;
GROUP_MEMBERSHIP GroupMembership;
UCHAR LogonHours[23];
ULONG ulSize;
ULONG ulRid;
@ -7914,7 +7931,22 @@ SamrCreateUser2InDomain(IN SAMPR_HANDLE DomainHandle,
return Status;
}
/* FIXME: Set Groups attribute*/
/* Set Groups attribute*/
GroupMembership.RelativeId = DOMAIN_GROUP_RID_USERS;
GroupMembership.Attributes = SE_GROUP_MANDATORY |
SE_GROUP_ENABLED |
SE_GROUP_ENABLED_BY_DEFAULT;
Status = SampSetObjectAttribute(UserObject,
L"Groups",
REG_BINARY,
&GroupMembership,
sizeof(GROUP_MEMBERSHIP));
if (!NT_SUCCESS(Status))
{
TRACE("failed with status 0x%08lx\n", Status);
return Status;
}
/* Set LMPwd attribute*/
Status = SampSetObjectAttribute(UserObject,

View file

@ -168,6 +168,7 @@ SampSetupCreateUserAccount(HKEY hDomainKey,
ULONG UserAccountControl)
{
SAM_USER_FIXED_DATA FixedUserData;
GROUP_MEMBERSHIP GroupMembership;
UCHAR LogonHours[23];
LPWSTR lpEmptyString = L"";
DWORD dwDisposition;
@ -294,7 +295,18 @@ SampSetupCreateUserAccount(HKEY hDomainKey,
(LPVOID)LogonHours,
sizeof(LogonHours));
/* FIXME: Set Groups attribute*/
/* Set Groups attribute*/
GroupMembership.RelativeId = DOMAIN_GROUP_RID_USERS;
GroupMembership.Attributes = SE_GROUP_MANDATORY |
SE_GROUP_ENABLED |
SE_GROUP_ENABLED_BY_DEFAULT;
RegSetValueEx(hAccountKey,
L"Groups",
0,
REG_BINARY,
(LPVOID)&GroupMembership,
sizeof(GROUP_MEMBERSHIP));
/* Set LMPwd attribute*/
RegSetValueEx(hAccountKey,