Author: ekohl
Date: Sun Apr 7 17:58:11 2013
New Revision: 58715
URL:
http://svn.reactos.org/svn/reactos?rev=58715&view=rev
Log:
[SAMSRV]
Implement the set LogonHours attribute code for all user set functions.
Modified:
trunk/reactos/dll/win32/samsrv/samrpc.c
trunk/reactos/dll/win32/samsrv/samsrv.h
trunk/reactos/dll/win32/samsrv/user.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] Sun Apr 7 17:58:11 2013
@@ -2349,7 +2349,18 @@
return Status;
}
- /* FIXME: Set LogonHours attribute*/
+ /* Set LogonHours attribute*/
+ Status = SampSetObjectAttribute(UserObject,
+ L"LogonHours",
+ REG_BINARY,
+ NULL,
+ 0);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ return Status;
+ }
+
/* FIXME: Set Groups attribute*/
/* Set LMPwd attribute*/
@@ -7098,6 +7109,16 @@
REG_SZ,
Buffer->All.Parameters.Buffer,
Buffer->All.Parameters.MaximumLength);
+ if (!NT_SUCCESS(Status))
+ goto done;
+ }
+
+ if (WhichFields & USER_ALL_LOGONHOURS)
+ {
+ Status = SampSetLogonHoursAttrbute(UserObject,
+ &Buffer->All.LogonHours);
+ if (!NT_SUCCESS(Status))
+ goto done;
}
if (WhichFields & (USER_ALL_PRIMARYGROUPID |
@@ -7144,7 +7165,6 @@
/*
FIXME:
- USER_ALL_LOGONHOURS
USER_ALL_NTPASSWORDPRESENT
USER_ALL_LMPASSWORDPRESENT
USER_ALL_PASSWORDEXPIRED
@@ -7232,12 +7252,12 @@
Status = SampSetUserPreferences(UserObject,
Buffer);
break;
-/*
+
case UserLogonHoursInformation:
- Status = SampSetUserLogonHours(UserObject,
- Buffer);
- break;
-*/
+ Status = SampSetLogonHoursAttrbute(UserObject,
+ &Buffer->LogonHours.LogonHours);
+ break;
+
case UserNameInformation:
Status = SampSetObjectAttribute(UserObject,
L"Name",
Modified: trunk/reactos/dll/win32/samsrv/samsrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samsrv.h?…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] Sun Apr 7 17:58:11 2013
@@ -328,6 +328,10 @@
NTSTATUS
SampGetLogonHoursAttrbute(IN PSAM_DB_OBJECT UserObject,
+ IN OUT PSAMPR_LOGON_HOURS LogonHours);
+
+NTSTATUS
+SampSetLogonHoursAttrbute(IN PSAM_DB_OBJECT UserObject,
IN PSAMPR_LOGON_HOURS LogonHours);
/* EOF */
Modified: trunk/reactos/dll/win32/samsrv/user.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/user.c?re…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/user.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/user.c [iso-8859-1] Sun Apr 7 17:58:11 2013
@@ -584,7 +584,7 @@
NTSTATUS
SampGetLogonHoursAttrbute(IN PSAM_DB_OBJECT UserObject,
- IN PSAMPR_LOGON_HOURS LogonHours)
+ IN OUT PSAMPR_LOGON_HOURS LogonHours)
{
PUCHAR RawBuffer = NULL;
ULONG Length = 0;
@@ -651,4 +651,47 @@
return Status;
}
+
+NTSTATUS
+SampSetLogonHoursAttrbute(IN PSAM_DB_OBJECT UserObject,
+ IN PSAMPR_LOGON_HOURS LogonHours)
+{
+ PUCHAR RawBuffer = NULL;
+ ULONG BufferLength;
+ ULONG Length = 0;
+ NTSTATUS Status;
+
+ if (LogonHours->UnitsPerWeek > 0)
+ {
+ BufferLength = (((ULONG)LogonHours->UnitsPerWeek) + 7) / 8;
+
+ Length = BufferLength + sizeof(USHORT);
+
+ RawBuffer = midl_user_allocate(Length);
+ if (RawBuffer == NULL)
+ {
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto done;
+ }
+
+ *((PUSHORT)RawBuffer) = LogonHours->UnitsPerWeek;
+
+ memcpy(&(RawBuffer[2]),
+ LogonHours->LogonHours,
+ BufferLength);
+ }
+
+ Status = SampSetObjectAttribute(UserObject,
+ L"LogonHours",
+ REG_BINARY,
+ RawBuffer,
+ Length);
+
+done:
+ if (RawBuffer != NULL)
+ midl_user_free(RawBuffer);
+
+ return Status;
+}
+
/* EOF */