Author: ekohl
Date: Mon Jan 28 23:18:10 2013
New Revision: 58250
URL:
http://svn.reactos.org/svn/reactos?rev=58250&view=rev
Log:
[SAMSRV]
Create user routines:
- Set fixed user attribute explicitly.
- Add missing Parameters attribute.
- Add empty (zero-sized) password and password history attributes.
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] Mon Jan 28 23:18:10 2013
@@ -2165,6 +2165,7 @@
/* Initialize fixed user data */
memset(&FixedUserData, 0, sizeof(SAM_USER_FIXED_DATA));
FixedUserData.Version = 1;
+ FixedUserData.Reserved = 0;
FixedUserData.LastLogon.QuadPart = 0;
FixedUserData.LastLogoff.QuadPart = 0;
FixedUserData.PasswordLastSet.QuadPart = 0;
@@ -2176,6 +2177,12 @@
FixedUserData.UserAccountControl = USER_ACCOUNT_DISABLED |
USER_PASSWORD_NOT_REQUIRED |
USER_NORMAL_ACCOUNT;
+ FixedUserData.CountryCode = 0;
+ FixedUserData.CodePage = 0;
+ FixedUserData.BadPasswordCount = 0;
+ FixedUserData.LogonCount = 0;
+ FixedUserData.AdminCount = 0;
+ FixedUserData.OperatorCount = 0;
/* Set fixed user data attribute */
Status = SampSetObjectAttribute(UserObject,
@@ -2309,7 +2316,58 @@
return Status;
}
- /* FIXME: Set default user attributes */
+ /* FIXME: Set LogonHours attribute*/
+ /* FIXME: Set Groups attribute*/
+
+ /* Set LMPwd attribute*/
+ Status = SampSetObjectAttribute(UserObject,
+ L"LMPwd",
+ REG_BINARY,
+ NULL,
+ 0);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ return Status;
+ }
+
+ /* Set NTPwd attribute*/
+ Status = SampSetObjectAttribute(UserObject,
+ L"NTPwd",
+ REG_BINARY,
+ NULL,
+ 0);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ return Status;
+ }
+
+ /* Set LMPwdHistory attribute*/
+ Status = SampSetObjectAttribute(UserObject,
+ L"LMPwdHistory",
+ REG_BINARY,
+ NULL,
+ 0);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ return Status;
+ }
+
+ /* Set NTPwdHistory attribute*/
+ Status = SampSetObjectAttribute(UserObject,
+ L"NTPwdHistory",
+ REG_BINARY,
+ NULL,
+ 0);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ return Status;
+ }
+
+ /* FIXME: Set SecDesc attribute*/
if (NT_SUCCESS(Status))
{
@@ -6811,7 +6869,7 @@
TRACE("SamrGetGroupsForUser(%p %p)\n",
UserHandle, Groups);
- /* Validate the domain handle */
+ /* Validate the user handle */
Status = SampValidateDbObject(UserHandle,
SamDbUserObject,
USER_LIST_GROUPS,
@@ -7158,8 +7216,8 @@
}
/* Initialize fixed user data */
- memset(&FixedUserData, 0, sizeof(SAM_USER_FIXED_DATA));
FixedUserData.Version = 1;
+ FixedUserData.Reserved = 0;
FixedUserData.LastLogon.QuadPart = 0;
FixedUserData.LastLogoff.QuadPart = 0;
FixedUserData.PasswordLastSet.QuadPart = 0;
@@ -7171,6 +7229,12 @@
FixedUserData.UserAccountControl = USER_ACCOUNT_DISABLED |
USER_PASSWORD_NOT_REQUIRED |
AccountType;
+ FixedUserData.CountryCode = 0;
+ FixedUserData.CodePage = 0;
+ FixedUserData.BadPasswordCount = 0;
+ FixedUserData.LogonCount = 0;
+ FixedUserData.AdminCount = 0;
+ FixedUserData.OperatorCount = 0;
/* Set fixed user data attribute */
Status = SampSetObjectAttribute(UserObject,
@@ -7292,7 +7356,70 @@
return Status;
}
- /* FIXME: Set default user attributes */
+ /* Set the Parameters attribute */
+ Status = SampSetObjectAttribute(UserObject,
+ L"Parameters",
+ REG_SZ,
+ EmptyString.Buffer,
+ EmptyString.MaximumLength);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ return Status;
+ }
+
+ /* FIXME: Set LogonHours attribute*/
+ /* FIXME: Set Groups attribute*/
+
+ /* Set LMPwd attribute*/
+ Status = SampSetObjectAttribute(UserObject,
+ L"LMPwd",
+ REG_BINARY,
+ NULL,
+ 0);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ return Status;
+ }
+
+ /* Set NTPwd attribute*/
+ Status = SampSetObjectAttribute(UserObject,
+ L"NTPwd",
+ REG_BINARY,
+ NULL,
+ 0);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ return Status;
+ }
+
+ /* Set LMPwdHistory attribute*/
+ Status = SampSetObjectAttribute(UserObject,
+ L"LMPwdHistory",
+ REG_BINARY,
+ NULL,
+ 0);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ return Status;
+ }
+
+ /* Set NTPwdHistory attribute*/
+ Status = SampSetObjectAttribute(UserObject,
+ L"NTPwdHistory",
+ REG_BINARY,
+ NULL,
+ 0);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ return Status;
+ }
+
+ /* FIXME: Set SecDesc attribute*/
if (NT_SUCCESS(Status))
{
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] Mon Jan 28 23:18:10 2013
@@ -232,11 +232,23 @@
HKEY hNamesKey = NULL;
/* Initialize fixed user data */
- memset(&FixedUserData, 0, sizeof(SAM_USER_FIXED_DATA));
FixedUserData.Version = 1;
-
+ FixedUserData.Reserved = 0;
+ FixedUserData.LastLogon.QuadPart = 0;
+ FixedUserData.LastLogoff.QuadPart = 0;
+ FixedUserData.PasswordLastSet.QuadPart = 0;
+ FixedUserData.AccountExpires.LowPart = MAXULONG;
+ FixedUserData.AccountExpires.HighPart = MAXLONG;
+ FixedUserData.LastBadPasswordTime.QuadPart = 0;
FixedUserData.UserId = ulRelativeId;
+ FixedUserData.PrimaryGroupId = DOMAIN_GROUP_RID_USERS;
FixedUserData.UserAccountControl = UserAccountControl;
+ FixedUserData.CountryCode = 0;
+ FixedUserData.CodePage = 0;
+ FixedUserData.BadPasswordCount = 0;
+ FixedUserData.LogonCount = 0;
+ FixedUserData.AdminCount = 0;
+ FixedUserData.OperatorCount = 0;
swprintf(szAccountKeyName, L"Users\\%08lX", ulRelativeId);
@@ -326,6 +338,43 @@
REG_SZ,
(LPVOID)lpEmptyString,
sizeof(WCHAR));
+
+ /* FIXME: Set LogonHours attribute*/
+ /* FIXME: Set Groups attribute*/
+
+ /* Set LMPwd attribute*/
+ RegSetValueEx(hAccountKey,
+ L"LMPwd",
+ 0,
+ REG_BINARY,
+ NULL,
+ 0);
+
+ /* Set NTPwd attribute*/
+ RegSetValueEx(hAccountKey,
+ L"NTPwd",
+ 0,
+ REG_BINARY,
+ NULL,
+ 0);
+
+ /* Set LMPwdHistory attribute*/
+ RegSetValueEx(hAccountKey,
+ L"LMPwdHistory",
+ 0,
+ REG_BINARY,
+ NULL,
+ 0);
+
+ /* Set NTPwdHistory attribute*/
+ RegSetValueEx(hAccountKey,
+ L"NTPwdHistory",
+ 0,
+ REG_BINARY,
+ NULL,
+ 0);
+
+ /* FIXME: Set SecDesc attribute*/
RegCloseKey(hAccountKey);
}