Author: ekohl
Date: Wed May 29 16:09:10 2013
New Revision: 59107
URL:
http://svn.reactos.org/svn/reactos?rev=59107&view=rev
Log:
[SAMSRV]
Set default group membership for new users.
Modified:
trunk/reactos/dll/win32/samsrv/samrpc.c
trunk/reactos/dll/win32/samsrv/setup.c
Modified: trunk/reactos/dll/win32/samsrv/samrpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samrpc.c?…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] Wed May 29 16:09:10 2013
@@ -2096,6 +2096,7 @@
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 @@
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 @@
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 @@
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,
Modified: trunk/reactos/dll/win32/samsrv/setup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/setup.c?r…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] Wed May 29 16:09:10 2013
@@ -168,6 +168,7 @@
ULONG UserAccountControl)
{
SAM_USER_FIXED_DATA FixedUserData;
+ GROUP_MEMBERSHIP GroupMembership;
UCHAR LogonHours[23];
LPWSTR lpEmptyString = L"";
DWORD dwDisposition;
@@ -294,7 +295,18 @@
(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,