mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
[SAMSRV]
Implement the set LogonHours attribute code for all user set functions. svn path=/trunk/; revision=58715
This commit is contained in:
parent
30f64b59ea
commit
d8217043cd
|
@ -2349,7 +2349,18 @@ SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle,
|
|||
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 @@ SampSetUserAll(PSAM_DB_OBJECT UserObject,
|
|||
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 @@ SampSetUserAll(PSAM_DB_OBJECT UserObject,
|
|||
|
||||
/*
|
||||
FIXME:
|
||||
USER_ALL_LOGONHOURS
|
||||
USER_ALL_NTPASSWORDPRESENT
|
||||
USER_ALL_LMPASSWORDPRESENT
|
||||
USER_ALL_PASSWORDEXPIRED
|
||||
|
@ -7232,12 +7252,12 @@ SamrSetInformationUser(IN SAMPR_HANDLE UserHandle,
|
|||
Status = SampSetUserPreferences(UserObject,
|
||||
Buffer);
|
||||
break;
|
||||
/*
|
||||
|
||||
case UserLogonHoursInformation:
|
||||
Status = SampSetUserLogonHours(UserObject,
|
||||
Buffer);
|
||||
Status = SampSetLogonHoursAttrbute(UserObject,
|
||||
&Buffer->LogonHours.LogonHours);
|
||||
break;
|
||||
*/
|
||||
|
||||
case UserNameInformation:
|
||||
Status = SampSetObjectAttribute(UserObject,
|
||||
L"Name",
|
||||
|
|
|
@ -328,6 +328,10 @@ SampSetUserPassword(IN PSAM_DB_OBJECT UserObject,
|
|||
|
||||
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 */
|
||||
|
|
|
@ -584,7 +584,7 @@ done:
|
|||
|
||||
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 @@ done:
|
|||
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 */
|
||||
|
|
Loading…
Reference in a new issue