Implement the set LogonHours attribute code for all user set functions.

svn path=/trunk/; revision=58715
This commit is contained in:
Eric Kohl 2013-04-07 17:58:11 +00:00
parent 30f64b59ea
commit d8217043cd
3 changed files with 74 additions and 7 deletions

View file

@ -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",

View file

@ -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 */

View file

@ -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 */