ReactOS 0.4.15-dev-7842-g558ab78
samrpc.c File Reference
#include "samsrv.h"
Include dependency graph for samrpc.c:

Go to the source code of this file.

Functions

static LARGE_INTEGER SampAddRelativeTimeToTime (IN LARGE_INTEGER AbsoluteTime, IN LARGE_INTEGER RelativeTime)
 
VOID SampStartRpcServer (VOID)
 
void __RPC_FAR *__RPC_USER midl_user_allocate (SIZE_T len)
 
void __RPC_USER midl_user_free (void __RPC_FAR *ptr)
 
void __RPC_USER SAMPR_HANDLE_rundown (SAMPR_HANDLE hHandle)
 
NTSTATUS NTAPI SamrConnect (IN PSAMPR_SERVER_NAME ServerName, OUT SAMPR_HANDLE *ServerHandle, IN ACCESS_MASK DesiredAccess)
 
NTSTATUS NTAPI SamrCloseHandle (IN OUT SAMPR_HANDLE *SamHandle)
 
NTSTATUS NTAPI SamrSetSecurityObject (IN SAMPR_HANDLE ObjectHandle, IN SECURITY_INFORMATION SecurityInformation, IN PSAMPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor)
 
NTSTATUS NTAPI SamrQuerySecurityObject (IN SAMPR_HANDLE ObjectHandle, IN SECURITY_INFORMATION SecurityInformation, OUT PSAMPR_SR_SECURITY_DESCRIPTOR *SecurityDescriptor)
 
NTSTATUS NTAPI SamrShutdownSamServer (IN SAMPR_HANDLE ServerHandle)
 
NTSTATUS NTAPI SamrLookupDomainInSamServer (IN SAMPR_HANDLE ServerHandle, IN PRPC_UNICODE_STRING Name, OUT PRPC_SID *DomainId)
 
NTSTATUS NTAPI SamrEnumerateDomainsInSamServer (IN SAMPR_HANDLE ServerHandle, IN OUT unsigned long *EnumerationContext, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN ULONG PreferedMaximumLength, OUT PULONG CountReturned)
 
NTSTATUS NTAPI SamrOpenDomain (IN SAMPR_HANDLE ServerHandle, IN ACCESS_MASK DesiredAccess, IN PRPC_SID DomainId, OUT SAMPR_HANDLE *DomainHandle)
 
static NTSTATUS SampQueryDomainPassword (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampGetNumberOfAccounts (PSAM_DB_OBJECT DomainObject, LPCWSTR AccountType, PULONG Count)
 
static NTSTATUS SampQueryDomainGeneral (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainLogoff (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainOem (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainName (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainReplication (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainServerRole (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainModified (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainState (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainGeneral2 (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainLockout (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainModified2 (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryInformationDomain (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampSetDomainPassword (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetDomainLogoff (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetDomainServerRole (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetDomainState (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetDomainLockout (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrSetInformationDomain (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, IN PSAMPR_DOMAIN_INFO_BUFFER DomainInformation)
 
NTSTATUS NTAPI SamrCreateGroupInDomain (IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING Name, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *GroupHandle, OUT unsigned long *RelativeId)
 
NTSTATUS NTAPI SamrEnumerateGroupsInDomain (IN SAMPR_HANDLE DomainHandle, IN OUT unsigned long *EnumerationContext, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN unsigned long PreferedMaximumLength, OUT unsigned long *CountReturned)
 
NTSTATUS NTAPI SamrCreateUserInDomain (IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING Name, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *UserHandle, OUT unsigned long *RelativeId)
 
NTSTATUS NTAPI SamrEnumerateUsersInDomain (IN SAMPR_HANDLE DomainHandle, IN OUT unsigned long *EnumerationContext, IN unsigned long UserAccountControl, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN unsigned long PreferedMaximumLength, OUT unsigned long *CountReturned)
 
NTSTATUS NTAPI SamrCreateAliasInDomain (IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING AccountName, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *AliasHandle, OUT unsigned long *RelativeId)
 
NTSTATUS NTAPI SamrEnumerateAliasesInDomain (IN SAMPR_HANDLE DomainHandle, IN OUT unsigned long *EnumerationContext, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN unsigned long PreferedMaximumLength, OUT unsigned long *CountReturned)
 
NTSTATUS NTAPI SamrGetAliasMembership (IN SAMPR_HANDLE DomainHandle, IN PSAMPR_PSID_ARRAY SidArray, OUT PSAMPR_ULONG_ARRAY Membership)
 
NTSTATUS NTAPI SamrLookupNamesInDomain (IN SAMPR_HANDLE DomainHandle, IN ULONG Count, IN RPC_UNICODE_STRING Names[], OUT PSAMPR_ULONG_ARRAY RelativeIds, OUT PSAMPR_ULONG_ARRAY Use)
 
NTSTATUS NTAPI SamrLookupIdsInDomain (IN SAMPR_HANDLE DomainHandle, IN ULONG Count, IN ULONG *RelativeIds, OUT PSAMPR_RETURNED_USTRING_ARRAY Names, OUT PSAMPR_ULONG_ARRAY Use)
 
NTSTATUS NTAPI SamrOpenGroup (IN SAMPR_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN unsigned long GroupId, OUT SAMPR_HANDLE *GroupHandle)
 
static NTSTATUS SampQueryGroupGeneral (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryGroupName (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryGroupAttribute (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryGroupAdminComment (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryInformationGroup (IN SAMPR_HANDLE GroupHandle, IN GROUP_INFORMATION_CLASS GroupInformationClass, OUT PSAMPR_GROUP_INFO_BUFFER *Buffer)
 
static NTSTATUS SampSetGroupName (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetGroupAttribute (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrSetInformationGroup (IN SAMPR_HANDLE GroupHandle, IN GROUP_INFORMATION_CLASS GroupInformationClass, IN PSAMPR_GROUP_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrAddMemberToGroup (IN SAMPR_HANDLE GroupHandle, IN unsigned long MemberId, IN unsigned long Attributes)
 
NTSTATUS NTAPI SamrDeleteGroup (IN OUT SAMPR_HANDLE *GroupHandle)
 
NTSTATUS NTAPI SamrRemoveMemberFromGroup (IN SAMPR_HANDLE GroupHandle, IN unsigned long MemberId)
 
NTSTATUS NTAPI SamrGetMembersInGroup (IN SAMPR_HANDLE GroupHandle, OUT PSAMPR_GET_MEMBERS_BUFFER *Members)
 
NTSTATUS NTAPI SamrSetMemberAttributesOfGroup (IN SAMPR_HANDLE GroupHandle, IN unsigned long MemberId, IN unsigned long Attributes)
 
NTSTATUS NTAPI SamrOpenAlias (IN SAMPR_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN ULONG AliasId, OUT SAMPR_HANDLE *AliasHandle)
 
static NTSTATUS SampQueryAliasGeneral (PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryAliasName (PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryAliasAdminComment (PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryInformationAlias (IN SAMPR_HANDLE AliasHandle, IN ALIAS_INFORMATION_CLASS AliasInformationClass, OUT PSAMPR_ALIAS_INFO_BUFFER *Buffer)
 
static NTSTATUS SampSetAliasName (PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrSetInformationAlias (IN SAMPR_HANDLE AliasHandle, IN ALIAS_INFORMATION_CLASS AliasInformationClass, IN PSAMPR_ALIAS_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrDeleteAlias (IN OUT SAMPR_HANDLE *AliasHandle)
 
NTSTATUS NTAPI SamrAddMemberToAlias (IN SAMPR_HANDLE AliasHandle, IN PRPC_SID MemberId)
 
NTSTATUS NTAPI SamrRemoveMemberFromAlias (IN SAMPR_HANDLE AliasHandle, IN PRPC_SID MemberId)
 
NTSTATUS NTAPI SamrGetMembersInAlias (IN SAMPR_HANDLE AliasHandle, OUT PSAMPR_PSID_ARRAY_OUT Members)
 
NTSTATUS NTAPI SamrOpenUser (IN SAMPR_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN unsigned long UserId, OUT SAMPR_HANDLE *UserHandle)
 
NTSTATUS NTAPI SamrDeleteUser (IN OUT SAMPR_HANDLE *UserHandle)
 
static NTSTATUS SampQueryUserGeneral (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserPreferences (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserLogon (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserAccount (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserLogonHours (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserName (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserAccountName (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserFullName (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserPrimaryGroup (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserHome (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserScript (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserProfile (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserAdminComment (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserWorkStations (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserControl (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserExpires (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserInternal1 (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserInternal2 (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserParameters (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserAll (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryInformationUser (IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, OUT PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampSetUserName (PSAM_DB_OBJECT UserObject, PRPC_UNICODE_STRING NewUserName)
 
static NTSTATUS SampSetUserGeneral (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserPreferences (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserPrimaryGroup (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserControl (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserExpires (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserInternal1 (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserInternal2 (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserAll (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrSetInformationUser (IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, IN PSAMPR_USER_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrChangePasswordUser (IN SAMPR_HANDLE UserHandle, IN unsigned char LmPresent, IN PENCRYPTED_LM_OWF_PASSWORD OldLmEncryptedWithNewLm, IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithOldLm, IN unsigned char NtPresent, IN PENCRYPTED_NT_OWF_PASSWORD OldNtEncryptedWithNewNt, IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithOldNt, IN unsigned char NtCrossEncryptionPresent, IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithNewLm, IN unsigned char LmCrossEncryptionPresent, IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithNewNt)
 
NTSTATUS NTAPI SamrGetGroupsForUser (IN SAMPR_HANDLE UserHandle, OUT PSAMPR_GET_GROUPS_BUFFER *Groups)
 
NTSTATUS NTAPI SamrQueryDisplayInformation (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN unsigned long Index, IN unsigned long EntryCount, IN unsigned long PreferredMaximumLength, OUT unsigned long *TotalAvailable, OUT unsigned long *TotalReturned, OUT PSAMPR_DISPLAY_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrGetDisplayEnumerationIndex (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN PRPC_UNICODE_STRING Prefix, OUT unsigned long *Index)
 
NTSTATUS NTAPI SamrTestPrivateFunctionsDomain (IN SAMPR_HANDLE DomainHandle)
 
NTSTATUS NTAPI SamrTestPrivateFunctionsUser (IN SAMPR_HANDLE UserHandle)
 
NTSTATUS NTAPI SamrGetUserDomainPasswordInformation (IN SAMPR_HANDLE UserHandle, OUT PUSER_DOMAIN_PASSWORD_INFORMATION PasswordInformation)
 
NTSTATUS NTAPI SamrRemoveMemberFromForeignDomain (IN SAMPR_HANDLE DomainHandle, IN PRPC_SID MemberSid)
 
NTSTATUS NTAPI SamrQueryInformationDomain2 (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryInformationUser2 (IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, OUT PSAMPR_USER_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryDisplayInformation2 (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN unsigned long Index, IN unsigned long EntryCount, IN unsigned long PreferredMaximumLength, OUT unsigned long *TotalAvailable, OUT unsigned long *TotalReturned, OUT PSAMPR_DISPLAY_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrGetDisplayEnumerationIndex2 (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN PRPC_UNICODE_STRING Prefix, OUT unsigned long *Index)
 
NTSTATUS NTAPI SamrCreateUser2InDomain (IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING Name, IN unsigned long AccountType, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *UserHandle, OUT unsigned long *GrantedAccess, OUT unsigned long *RelativeId)
 
NTSTATUS NTAPI SamrQueryDisplayInformation3 (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN unsigned long Index, IN unsigned long EntryCount, IN unsigned long PreferredMaximumLength, OUT unsigned long *TotalAvailable, OUT unsigned long *TotalReturned, OUT PSAMPR_DISPLAY_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrAddMultipleMembersToAlias (IN SAMPR_HANDLE AliasHandle, IN PSAMPR_PSID_ARRAY MembersBuffer)
 
NTSTATUS NTAPI SamrRemoveMultipleMembersFromAlias (IN SAMPR_HANDLE AliasHandle, IN PSAMPR_PSID_ARRAY MembersBuffer)
 
NTSTATUS NTAPI SamrOemChangePasswordUser2 (IN handle_t BindingHandle, IN PRPC_STRING ServerName, IN PRPC_STRING UserName, IN PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm, IN PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewLm)
 
NTSTATUS NTAPI SamrUnicodeChangePasswordUser2 (IN handle_t BindingHandle, IN PRPC_UNICODE_STRING ServerName, IN PRPC_UNICODE_STRING UserName, IN PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldNt, IN PENCRYPTED_NT_OWF_PASSWORD OldNtOwfPasswordEncryptedWithNewNt, IN unsigned char LmPresent, IN PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm, IN PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewNt)
 
NTSTATUS NTAPI SamrGetDomainPasswordInformation (IN handle_t BindingHandle, IN PRPC_UNICODE_STRING Unused, OUT PUSER_DOMAIN_PASSWORD_INFORMATION PasswordInformation)
 
NTSTATUS NTAPI SamrConnect2 (IN PSAMPR_SERVER_NAME ServerName, OUT SAMPR_HANDLE *ServerHandle, IN ACCESS_MASK DesiredAccess)
 
NTSTATUS NTAPI SamrSetInformationUser2 (IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, IN PSAMPR_USER_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrSetBootKeyInformation (IN handle_t BindingHandle)
 
NTSTATUS NTAPI SamrGetBootKeyInformation (IN handle_t BindingHandle)
 
NTSTATUS NTAPI SamrConnect3 (IN handle_t BindingHandle)
 
NTSTATUS NTAPI SamrConnect4 (IN PSAMPR_SERVER_NAME ServerName, OUT SAMPR_HANDLE *ServerHandle, IN unsigned long ClientRevision, IN ACCESS_MASK DesiredAccess)
 
NTSTATUS NTAPI SamrUnicodeChangePasswordUser3 (IN handle_t BindingHandle)
 
NTSTATUS NTAPI SamrConnect5 (IN PSAMPR_SERVER_NAME ServerName, IN ACCESS_MASK DesiredAccess, IN unsigned long InVersion, IN SAMPR_REVISION_INFO *InRevisionInfo, OUT unsigned long *OutVersion, OUT SAMPR_REVISION_INFO *OutRevisionInfo, OUT SAMPR_HANDLE *ServerHandle)
 
NTSTATUS NTAPI SamrRidToSid (IN SAMPR_HANDLE ObjectHandle, IN unsigned long Rid, OUT PRPC_SID *Sid)
 
NTSTATUS NTAPI SamrSetDSRMPassword (IN handle_t BindingHandle, IN PRPC_UNICODE_STRING Unused, IN unsigned long UserId, IN PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword)
 
NTSTATUS NTAPI SamrValidatePassword (IN handle_t Handle, IN PASSWORD_POLICY_VALIDATION_TYPE ValidationType, IN PSAM_VALIDATE_INPUT_ARG InputArg, OUT PSAM_VALIDATE_OUTPUT_ARG *OutputArg)
 

Variables

static SID_IDENTIFIER_AUTHORITY NtSidAuthority = {SECURITY_NT_AUTHORITY}
 
static GENERIC_MAPPING ServerMapping
 
static GENERIC_MAPPING DomainMapping
 
static GENERIC_MAPPING AliasMapping
 
static GENERIC_MAPPING GroupMapping
 
static GENERIC_MAPPING UserMapping
 
PGENERIC_MAPPING pServerMapping = &ServerMapping
 

Function Documentation

◆ midl_user_allocate()

void __RPC_FAR *__RPC_USER midl_user_allocate ( SIZE_T  len)

Definition at line 114 of file samrpc.c.

115{
117}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLenum GLsizei len
Definition: glext.h:6722

◆ midl_user_free()

void __RPC_USER midl_user_free ( void __RPC_FAR ptr)

Definition at line 120 of file samrpc.c.

121{
123}
#define HeapFree(x, y, z)
Definition: compat.h:735
static PVOID ptr
Definition: dispmode.c:27

◆ SampAddRelativeTimeToTime()

static LARGE_INTEGER SampAddRelativeTimeToTime ( IN LARGE_INTEGER  AbsoluteTime,
IN LARGE_INTEGER  RelativeTime 
)
static

Definition at line 63 of file samrpc.c.

65{
66 LARGE_INTEGER NewTime;
67
68 NewTime.QuadPart = AbsoluteTime.QuadPart - RelativeTime.QuadPart;
69
70 if (NewTime.QuadPart < 0)
71 NewTime.QuadPart = 0;
72
73 return NewTime;
74}
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by SampQueryUserAll(), and SampQueryUserLogon().

◆ SampGetNumberOfAccounts()

static NTSTATUS SampGetNumberOfAccounts ( PSAM_DB_OBJECT  DomainObject,
LPCWSTR  AccountType,
PULONG  Count 
)
static

Definition at line 960 of file samrpc.c.

963{
964 HANDLE AccountKeyHandle = NULL;
965 HANDLE NamesKeyHandle = NULL;
967
968 *Count = 0;
969
970 Status = SampRegOpenKey(DomainObject->KeyHandle,
971 AccountType,
972 KEY_READ,
973 &AccountKeyHandle);
974 if (!NT_SUCCESS(Status))
975 return Status;
976
977 Status = SampRegOpenKey(AccountKeyHandle,
978 L"Names",
979 KEY_READ,
980 &NamesKeyHandle);
981 if (!NT_SUCCESS(Status))
982 goto done;
983
984 Status = SampRegQueryKeyInfo(NamesKeyHandle,
985 NULL,
986 Count);
987
988done:
989 SampRegCloseKey(&NamesKeyHandle);
990 SampRegCloseKey(&AccountKeyHandle);
991
992 return Status;
993}
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampRegCloseKey(IN OUT PHANDLE KeyHandle)
Definition: registry.c:26
NTSTATUS SampRegQueryKeyInfo(IN HANDLE KeyHandle, OUT PULONG SubKeyCount, OUT PULONG ValueCount)
Definition: registry.c:181
NTSTATUS SampRegOpenKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle)
Definition: registry.c:158
Status
Definition: gdiplustypes.h:25
int Count
Definition: noreturn.cpp:7
#define KEY_READ
Definition: nt_native.h:1023
#define L(x)
Definition: ntvdm.h:50
HANDLE KeyHandle
Definition: samsrv.h:52

Referenced by SampQueryDomainGeneral(), and SampQueryDomainGeneral2().

◆ SampQueryAliasAdminComment()

static NTSTATUS SampQueryAliasAdminComment ( PSAM_DB_OBJECT  AliasObject,
PSAMPR_ALIAS_INFO_BUFFER Buffer 
)
static

Definition at line 5002 of file samrpc.c.

5004{
5005 PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
5007
5008 *Buffer = NULL;
5009
5010 InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
5011 if (InfoBuffer == NULL)
5013
5015 L"Description",
5016 &InfoBuffer->AdminComment.AdminComment);
5017 if (!NT_SUCCESS(Status))
5018 {
5019 TRACE("Status 0x%08lx\n", Status);
5020 goto done;
5021 }
5022
5023 *Buffer = InfoBuffer;
5024
5025done:
5026 if (!NT_SUCCESS(Status))
5027 {
5028 if (InfoBuffer != NULL)
5029 {
5030 if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
5032
5033 midl_user_free(InfoBuffer);
5034 }
5035 }
5036
5037 return Status;
5038}
Definition: bufpool.h:45
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:531
#define midl_user_free
Definition: rpc.h:45
#define midl_user_allocate
Definition: rpc.h:44
#define TRACE(s)
Definition: solgame.cpp:4
wchar_t * Buffer
Definition: msv1_0.h:24
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:429
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
SAMPR_ALIAS_ADM_COMMENT_INFORMATION AdminComment
Definition: sam.idl:445

Referenced by SamrQueryInformationAlias().

◆ SampQueryAliasGeneral()

static NTSTATUS SampQueryAliasGeneral ( PSAM_DB_OBJECT  AliasObject,
PSAMPR_ALIAS_INFO_BUFFER Buffer 
)
static

Definition at line 4879 of file samrpc.c.

4881{
4882 PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
4883 HANDLE MembersKeyHandle = NULL;
4885
4886 *Buffer = NULL;
4887
4888 InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
4889 if (InfoBuffer == NULL)
4891
4893 L"Name",
4894 &InfoBuffer->General.Name);
4895 if (!NT_SUCCESS(Status))
4896 {
4897 TRACE("Status 0x%08lx\n", Status);
4898 goto done;
4899 }
4900
4902 L"Description",
4903 &InfoBuffer->General.AdminComment);
4904 if (!NT_SUCCESS(Status))
4905 {
4906 TRACE("Status 0x%08lx\n", Status);
4907 goto done;
4908 }
4909
4910 /* Open the Members subkey */
4911 Status = SampRegOpenKey(AliasObject->KeyHandle,
4912 L"Members",
4913 KEY_READ,
4914 &MembersKeyHandle);
4915 if (NT_SUCCESS(Status))
4916 {
4917 /* Retrieve the number of members of the alias */
4918 Status = SampRegQueryKeyInfo(MembersKeyHandle,
4919 NULL,
4920 &InfoBuffer->General.MemberCount);
4921 if (!NT_SUCCESS(Status))
4922 {
4923 TRACE("Status 0x%08lx\n", Status);
4924 goto done;
4925 }
4926 }
4928 {
4929 InfoBuffer->General.MemberCount = 0;
4931 }
4932 else
4933 {
4934 TRACE("Status 0x%08lx\n", Status);
4935 goto done;
4936 }
4937
4938 *Buffer = InfoBuffer;
4939
4940done:
4941 SampRegCloseKey(&MembersKeyHandle);
4942
4943 if (!NT_SUCCESS(Status))
4944 {
4945 if (InfoBuffer != NULL)
4946 {
4947 if (InfoBuffer->General.Name.Buffer != NULL)
4948 midl_user_free(InfoBuffer->General.Name.Buffer);
4949
4950 if (InfoBuffer->General.AdminComment.Buffer != NULL)
4952
4953 midl_user_free(InfoBuffer);
4954 }
4955 }
4956
4957 return Status;
4958}
#define STATUS_SUCCESS
Definition: shellext.h:65
RPC_UNICODE_STRING Name
Definition: sam.idl:417
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:419
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
SAMPR_ALIAS_GENERAL_INFORMATION General
Definition: sam.idl:443

Referenced by SamrQueryInformationAlias().

◆ SampQueryAliasName()

static NTSTATUS SampQueryAliasName ( PSAM_DB_OBJECT  AliasObject,
PSAMPR_ALIAS_INFO_BUFFER Buffer 
)
static

Definition at line 4962 of file samrpc.c.

4964{
4965 PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
4967
4968 *Buffer = NULL;
4969
4970 InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
4971 if (InfoBuffer == NULL)
4973
4975 L"Name",
4976 &InfoBuffer->Name.Name);
4977 if (!NT_SUCCESS(Status))
4978 {
4979 TRACE("Status 0x%08lx\n", Status);
4980 goto done;
4981 }
4982
4983 *Buffer = InfoBuffer;
4984
4985done:
4986 if (!NT_SUCCESS(Status))
4987 {
4988 if (InfoBuffer != NULL)
4989 {
4990 if (InfoBuffer->Name.Name.Buffer != NULL)
4991 midl_user_free(InfoBuffer->Name.Name.Buffer);
4992
4993 midl_user_free(InfoBuffer);
4994 }
4995 }
4996
4997 return Status;
4998}
RPC_UNICODE_STRING Name
Definition: sam.idl:424
SAMPR_ALIAS_NAME_INFORMATION Name
Definition: sam.idl:444

Referenced by SamrQueryInformationAlias().

◆ SampQueryDomainGeneral()

static NTSTATUS SampQueryDomainGeneral ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 997 of file samrpc.c.

999{
1000 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1001 SAM_DOMAIN_FIXED_DATA FixedData;
1002 ULONG Length = 0;
1004
1005 *Buffer = NULL;
1006
1007 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1008 if (InfoBuffer == NULL)
1010
1011 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1012 Status = SampGetObjectAttribute(DomainObject,
1013 L"F",
1014 NULL,
1015 (PVOID)&FixedData,
1016 &Length);
1017 if (!NT_SUCCESS(Status))
1018 goto done;
1019
1020 InfoBuffer->General.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart;
1021 InfoBuffer->General.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart;
1024 InfoBuffer->General.DomainServerState = FixedData.DomainServerState;
1025 InfoBuffer->General.DomainServerRole = FixedData.DomainServerRole;
1027
1028 /* Get the OemInformation string */
1029 Status = SampGetObjectAttributeString(DomainObject,
1030 L"OemInformation",
1031 &InfoBuffer->General.OemInformation);
1032 if (!NT_SUCCESS(Status))
1033 {
1034 TRACE("Status 0x%08lx\n", Status);
1035 goto done;
1036 }
1037
1038 /* Get the Name string */
1039 Status = SampGetObjectAttributeString(DomainObject,
1040 L"Name",
1041 &InfoBuffer->General.DomainName);
1042 if (!NT_SUCCESS(Status))
1043 {
1044 TRACE("Status 0x%08lx\n", Status);
1045 goto done;
1046 }
1047
1048 /* Get the ReplicaSourceNodeName string */
1049 Status = SampGetObjectAttributeString(DomainObject,
1050 L"ReplicaSourceNodeName",
1051 &InfoBuffer->General.ReplicaSourceNodeName);
1052 if (!NT_SUCCESS(Status))
1053 {
1054 TRACE("Status 0x%08lx\n", Status);
1055 goto done;
1056 }
1057
1058 /* Get the number of Users in the Domain */
1059 Status = SampGetNumberOfAccounts(DomainObject,
1060 L"Users",
1061 &InfoBuffer->General.UserCount);
1062 if (!NT_SUCCESS(Status))
1063 {
1064 TRACE("Status 0x%08lx\n", Status);
1065 goto done;
1066 }
1067
1068 /* Get the number of Groups in the Domain */
1069 Status = SampGetNumberOfAccounts(DomainObject,
1070 L"Groups",
1071 &InfoBuffer->General.GroupCount);
1072 if (!NT_SUCCESS(Status))
1073 {
1074 TRACE("Status 0x%08lx\n", Status);
1075 goto done;
1076 }
1077
1078 /* Get the number of Aliases in the Domain */
1079 Status = SampGetNumberOfAccounts(DomainObject,
1080 L"Aliases",
1081 &InfoBuffer->General.AliasCount);
1082 if (!NT_SUCCESS(Status))
1083 {
1084 TRACE("Status 0x%08lx\n", Status);
1085 goto done;
1086 }
1087
1088 *Buffer = InfoBuffer;
1089
1090done:
1091 if (!NT_SUCCESS(Status))
1092 {
1093 if (InfoBuffer != NULL)
1094 {
1095 if (InfoBuffer->General.OemInformation.Buffer != NULL)
1097
1098 if (InfoBuffer->General.DomainName.Buffer != NULL)
1100
1101 if (InfoBuffer->General.ReplicaSourceNodeName.Buffer != NULL)
1103
1104 midl_user_free(InfoBuffer);
1105 }
1106 }
1107
1108 return Status;
1109}
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
struct _SAM_DOMAIN_FIXED_DATA SAM_DOMAIN_FIXED_DATA
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
static NTSTATUS SampGetNumberOfAccounts(PSAM_DB_OBJECT DomainObject, LPCWSTR AccountType, PULONG Count)
Definition: samrpc.c:960
unsigned long LowPart
Definition: msv1_0.h:32
RPC_UNICODE_STRING OemInformation
Definition: sam.idl:204
OLD_LARGE_INTEGER ForceLogoff
Definition: sam.idl:203
unsigned long DomainServerRole
Definition: sam.idl:209
unsigned char UasCompatibilityRequired
Definition: sam.idl:210
RPC_UNICODE_STRING ReplicaSourceNodeName
Definition: sam.idl:206
OLD_LARGE_INTEGER DomainModifiedCount
Definition: sam.idl:207
RPC_UNICODE_STRING DomainName
Definition: sam.idl:205
unsigned long DomainServerState
Definition: sam.idl:208
DOMAIN_SERVER_ENABLE_STATE DomainServerState
Definition: samsrv.h:85
DOMAIN_SERVER_ROLE DomainServerRole
Definition: samsrv.h:86
BOOLEAN UasCompatibilityRequired
Definition: samsrv.h:87
LARGE_INTEGER DomainModifiedCount
Definition: samsrv.h:73
LARGE_INTEGER ForceLogoff
Definition: samsrv.h:76
uint32_t ULONG
Definition: typedefs.h:59
ULONG LowPart
Definition: typedefs.h:106
SAMPR_DOMAIN_GENERAL_INFORMATION General
Definition: sam.idl:268

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainGeneral2()

static NTSTATUS SampQueryDomainGeneral2 ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1404 of file samrpc.c.

1406{
1407 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1408 SAM_DOMAIN_FIXED_DATA FixedData;
1409 ULONG Length = 0;
1411
1412 *Buffer = NULL;
1413
1414 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1415 if (InfoBuffer == NULL)
1417
1418 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1419 Status = SampGetObjectAttribute(DomainObject,
1420 L"F",
1421 NULL,
1422 (PVOID)&FixedData,
1423 &Length);
1424 if (!NT_SUCCESS(Status))
1425 goto done;
1426
1427 InfoBuffer->General2.I1.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart;
1428 InfoBuffer->General2.I1.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart;
1431 InfoBuffer->General2.I1.DomainServerState = FixedData.DomainServerState;
1432 InfoBuffer->General2.I1.DomainServerRole = FixedData.DomainServerRole;
1434
1435 InfoBuffer->General2.LockoutDuration = FixedData.LockoutDuration;
1437 InfoBuffer->General2.LockoutThreshold = FixedData.LockoutThreshold;
1438
1439 /* Get the OemInformation string */
1440 Status = SampGetObjectAttributeString(DomainObject,
1441 L"OemInformation",
1442 &InfoBuffer->General2.I1.OemInformation);
1443 if (!NT_SUCCESS(Status))
1444 {
1445 TRACE("Status 0x%08lx\n", Status);
1446 goto done;
1447 }
1448
1449 /* Get the Name string */
1450 Status = SampGetObjectAttributeString(DomainObject,
1451 L"Name",
1452 &InfoBuffer->General2.I1.DomainName);
1453 if (!NT_SUCCESS(Status))
1454 {
1455 TRACE("Status 0x%08lx\n", Status);
1456 goto done;
1457 }
1458
1459 /* Get the ReplicaSourceNodeName string */
1460 Status = SampGetObjectAttributeString(DomainObject,
1461 L"ReplicaSourceNodeName",
1462 &InfoBuffer->General2.I1.ReplicaSourceNodeName);
1463 if (!NT_SUCCESS(Status))
1464 {
1465 TRACE("Status 0x%08lx\n", Status);
1466 goto done;
1467 }
1468
1469 /* Get the number of Users in the Domain */
1470 Status = SampGetNumberOfAccounts(DomainObject,
1471 L"Users",
1472 &InfoBuffer->General2.I1.UserCount);
1473 if (!NT_SUCCESS(Status))
1474 {
1475 TRACE("Status 0x%08lx\n", Status);
1476 goto done;
1477 }
1478
1479 /* Get the number of Groups in the Domain */
1480 Status = SampGetNumberOfAccounts(DomainObject,
1481 L"Groups",
1482 &InfoBuffer->General2.I1.GroupCount);
1483 if (!NT_SUCCESS(Status))
1484 {
1485 TRACE("Status 0x%08lx\n", Status);
1486 goto done;
1487 }
1488
1489 /* Get the number of Aliases in the Domain */
1490 Status = SampGetNumberOfAccounts(DomainObject,
1491 L"Aliases",
1492 &InfoBuffer->General2.I1.AliasCount);
1493 if (!NT_SUCCESS(Status))
1494 {
1495 TRACE("Status 0x%08lx\n", Status);
1496 goto done;
1497 }
1498
1499 *Buffer = InfoBuffer;
1500
1501done:
1502 if (!NT_SUCCESS(Status))
1503 {
1504 if (InfoBuffer != NULL)
1505 {
1506 if (InfoBuffer->General2.I1.OemInformation.Buffer != NULL)
1508
1509 if (InfoBuffer->General2.I1.DomainName.Buffer != NULL)
1511
1512 if (InfoBuffer->General2.I1.ReplicaSourceNodeName.Buffer != NULL)
1514
1515 midl_user_free(InfoBuffer);
1516 }
1517 }
1518
1519 return Status;
1520}
LARGE_INTEGER LockoutObservationWindow
Definition: sam.idl:220
SAMPR_DOMAIN_GENERAL_INFORMATION I1
Definition: sam.idl:218
unsigned short LockoutThreshold
Definition: sam.idl:221
LARGE_INTEGER LockoutObservationWindow
Definition: samsrv.h:78
LARGE_INTEGER LockoutDuration
Definition: samsrv.h:77
USHORT LockoutThreshold
Definition: samsrv.h:84
SAMPR_DOMAIN_GENERAL_INFORMATION2 General2
Definition: sam.idl:276

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainLockout()

static NTSTATUS SampQueryDomainLockout ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1524 of file samrpc.c.

1526{
1527 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1528 SAM_DOMAIN_FIXED_DATA FixedData;
1529 ULONG Length = 0;
1531
1532 *Buffer = NULL;
1533
1534 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1535 if (InfoBuffer == NULL)
1537
1538 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1539 Status = SampGetObjectAttribute(DomainObject,
1540 L"F",
1541 NULL,
1542 (PVOID)&FixedData,
1543 &Length);
1544 if (!NT_SUCCESS(Status))
1545 goto done;
1546
1547 InfoBuffer->Lockout.LockoutDuration = FixedData.LockoutDuration;
1549 InfoBuffer->Lockout.LockoutThreshold = FixedData.LockoutThreshold;
1550
1551 *Buffer = InfoBuffer;
1552
1553done:
1554 if (!NT_SUCCESS(Status))
1555 {
1556 if (InfoBuffer != NULL)
1557 {
1558 midl_user_free(InfoBuffer);
1559 }
1560 }
1561
1562 return Status;
1563}
LARGE_INTEGER LockoutDuration
Definition: sam.idl:242
unsigned short LockoutThreshold
Definition: sam.idl:244
LARGE_INTEGER LockoutObservationWindow
Definition: sam.idl:243
SAMPR_DOMAIN_LOCKOUT_INFORMATION Lockout
Definition: sam.idl:277

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainLogoff()

static NTSTATUS SampQueryDomainLogoff ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1113 of file samrpc.c.

1115{
1116 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1117 SAM_DOMAIN_FIXED_DATA FixedData;
1118 ULONG Length = 0;
1120
1121 *Buffer = NULL;
1122
1123 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1124 if (InfoBuffer == NULL)
1126
1127 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1128 Status = SampGetObjectAttribute(DomainObject,
1129 L"F",
1130 NULL,
1131 (PVOID)&FixedData,
1132 &Length);
1133 if (!NT_SUCCESS(Status))
1134 goto done;
1135
1136 InfoBuffer->Logoff.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart;
1137 InfoBuffer->Logoff.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart;
1138
1139 *Buffer = InfoBuffer;
1140
1141done:
1142 if (!NT_SUCCESS(Status))
1143 {
1144 if (InfoBuffer != NULL)
1145 {
1146 midl_user_free(InfoBuffer);
1147 }
1148 }
1149
1150 return Status;
1151}
LARGE_INTEGER ForceLogoff
Definition: ntsam.h:399
DOMAIN_LOGOFF_INFORMATION Logoff
Definition: sam.idl:269

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainModified()

static NTSTATUS SampQueryDomainModified ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1319 of file samrpc.c.

1321{
1322 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1323 SAM_DOMAIN_FIXED_DATA FixedData;
1324 ULONG Length = 0;
1326
1327 *Buffer = NULL;
1328
1329 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1330 if (InfoBuffer == NULL)
1332
1333 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1334 Status = SampGetObjectAttribute(DomainObject,
1335 L"F",
1336 NULL,
1337 (PVOID)&FixedData,
1338 &Length);
1339 if (!NT_SUCCESS(Status))
1340 goto done;
1341
1344 InfoBuffer->Modified.CreationTime.LowPart = FixedData.CreationTime.LowPart;
1345 InfoBuffer->Modified.CreationTime.HighPart = FixedData.CreationTime.HighPart;
1346
1347 *Buffer = InfoBuffer;
1348
1349done:
1350 if (!NT_SUCCESS(Status))
1351 {
1352 if (InfoBuffer != NULL)
1353 {
1354 midl_user_free(InfoBuffer);
1355 }
1356 }
1357
1358 return Status;
1359}
LARGE_INTEGER DomainModifiedCount
Definition: ntsam.h:424
LARGE_INTEGER CreationTime
Definition: ntsam.h:425
LARGE_INTEGER CreationTime
Definition: samsrv.h:72
DOMAIN_MODIFIED_INFORMATION Modified
Definition: sam.idl:274

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainModified2()

static NTSTATUS SampQueryDomainModified2 ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1567 of file samrpc.c.

1569{
1570 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1571 SAM_DOMAIN_FIXED_DATA FixedData;
1572 ULONG Length = 0;
1574
1575 *Buffer = NULL;
1576
1577 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1578 if (InfoBuffer == NULL)
1580
1581 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1582 Status = SampGetObjectAttribute(DomainObject,
1583 L"F",
1584 NULL,
1585 (PVOID)&FixedData,
1586 &Length);
1587 if (!NT_SUCCESS(Status))
1588 goto done;
1589
1592 InfoBuffer->Modified2.CreationTime.LowPart = FixedData.CreationTime.LowPart;
1593 InfoBuffer->Modified2.CreationTime.HighPart = FixedData.CreationTime.HighPart;
1596
1597 *Buffer = InfoBuffer;
1598
1599done:
1600 if (!NT_SUCCESS(Status))
1601 {
1602 if (InfoBuffer != NULL)
1603 {
1604 midl_user_free(InfoBuffer);
1605 }
1606 }
1607
1608 return Status;
1609}
LARGE_INTEGER DomainModifiedCount
Definition: ntsam.h:457
LARGE_INTEGER ModifiedCountAtLastPromotion
Definition: ntsam.h:459
LARGE_INTEGER CreationTime
Definition: ntsam.h:458
LARGE_INTEGER ModifiedCountAtLastPromotion
Definition: samsrv.h:79
DOMAIN_MODIFIED_INFORMATION2 Modified2
Definition: sam.idl:278

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainName()

static NTSTATUS SampQueryDomainName ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1196 of file samrpc.c.

1198{
1199 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1201
1202 *Buffer = NULL;
1203
1204 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1205 if (InfoBuffer == NULL)
1207
1208 /* Get the Name string */
1209 Status = SampGetObjectAttributeString(DomainObject,
1210 L"Name",
1211 &InfoBuffer->Name.DomainName);
1212 if (!NT_SUCCESS(Status))
1213 {
1214 TRACE("Status 0x%08lx\n", Status);
1215 goto done;
1216 }
1217
1218 *Buffer = InfoBuffer;
1219
1220done:
1221 if (!NT_SUCCESS(Status))
1222 {
1223 if (InfoBuffer != NULL)
1224 {
1225 if (InfoBuffer->Name.DomainName.Buffer != NULL)
1226 midl_user_free(InfoBuffer->Name.DomainName.Buffer);
1227
1228 midl_user_free(InfoBuffer);
1229 }
1230 }
1231
1232 return Status;
1233}
RPC_UNICODE_STRING DomainName
Definition: sam.idl:232
SAMPR_DOMAIN_NAME_INFORMATION Name
Definition: sam.idl:271

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainOem()

static NTSTATUS SampQueryDomainOem ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1155 of file samrpc.c.

1157{
1158 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1160
1161 *Buffer = NULL;
1162
1163 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1164 if (InfoBuffer == NULL)
1166
1167 /* Get the OemInformation string */
1168 Status = SampGetObjectAttributeString(DomainObject,
1169 L"OemInformation",
1170 &InfoBuffer->Oem.OemInformation);
1171 if (!NT_SUCCESS(Status))
1172 {
1173 TRACE("Status 0x%08lx\n", Status);
1174 goto done;
1175 }
1176
1177 *Buffer = InfoBuffer;
1178
1179done:
1180 if (!NT_SUCCESS(Status))
1181 {
1182 if (InfoBuffer != NULL)
1183 {
1184 if (InfoBuffer->Oem.OemInformation.Buffer != NULL)
1186
1187 midl_user_free(InfoBuffer);
1188 }
1189 }
1190
1191 return Status;
1192}
RPC_UNICODE_STRING OemInformation
Definition: sam.idl:227
SAMPR_DOMAIN_OEM_INFORMATION Oem
Definition: sam.idl:270

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainPassword()

static NTSTATUS SampQueryDomainPassword ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 913 of file samrpc.c.

915{
916 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
917 SAM_DOMAIN_FIXED_DATA FixedData;
918 ULONG Length = 0;
920
921 *Buffer = NULL;
922
923 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
924 if (InfoBuffer == NULL)
926
928 Status = SampGetObjectAttribute(DomainObject,
929 L"F",
930 NULL,
931 (PVOID)&FixedData,
932 &Length);
933 if (!NT_SUCCESS(Status))
934 goto done;
935
936 InfoBuffer->Password.MinPasswordLength = FixedData.MinPasswordLength;
938 InfoBuffer->Password.PasswordProperties = FixedData.PasswordProperties;
939 InfoBuffer->Password.MaxPasswordAge.LowPart = FixedData.MaxPasswordAge.LowPart;
941 InfoBuffer->Password.MinPasswordAge.LowPart = FixedData.MinPasswordAge.LowPart;
943
944 *Buffer = InfoBuffer;
945
946done:
947 if (!NT_SUCCESS(Status))
948 {
949 if (InfoBuffer != NULL)
950 {
951 midl_user_free(InfoBuffer);
952 }
953 }
954
955 return Status;
956}
LARGE_INTEGER MinPasswordAge
Definition: ntsam.h:376
LARGE_INTEGER MaxPasswordAge
Definition: ntsam.h:375
USHORT PasswordHistoryLength
Definition: samsrv.h:83
LARGE_INTEGER MaxPasswordAge
Definition: samsrv.h:74
USHORT MinPasswordLength
Definition: samsrv.h:82
LARGE_INTEGER MinPasswordAge
Definition: samsrv.h:75
ULONG PasswordProperties
Definition: samsrv.h:81
DOMAIN_PASSWORD_INFORMATION Password
Definition: sam.idl:267

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainReplication()

static NTSTATUS SampQueryDomainReplication ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1237 of file samrpc.c.

1239{
1240 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1242
1243 *Buffer = NULL;
1244
1245 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1246 if (InfoBuffer == NULL)
1248
1249 /* Get the ReplicaSourceNodeName string */
1250 Status = SampGetObjectAttributeString(DomainObject,
1251 L"ReplicaSourceNodeName",
1252 &InfoBuffer->Replication.ReplicaSourceNodeName);
1253 if (!NT_SUCCESS(Status))
1254 {
1255 TRACE("Status 0x%08lx\n", Status);
1256 goto done;
1257 }
1258
1259 *Buffer = InfoBuffer;
1260
1261done:
1262 if (!NT_SUCCESS(Status))
1263 {
1264 if (InfoBuffer != NULL)
1265 {
1266 if (InfoBuffer->Replication.ReplicaSourceNodeName.Buffer != NULL)
1268
1269 midl_user_free(InfoBuffer);
1270 }
1271 }
1272
1273 return Status;
1274}
RPC_UNICODE_STRING ReplicaSourceNodeName
Definition: sam.idl:237
SAMPR_DOMAIN_REPLICATION_INFORMATION Replication
Definition: sam.idl:273

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainServerRole()

static NTSTATUS SampQueryDomainServerRole ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1278 of file samrpc.c.

1280{
1281 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1282 SAM_DOMAIN_FIXED_DATA FixedData;
1283 ULONG Length = 0;
1285
1286 *Buffer = NULL;
1287
1288 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1289 if (InfoBuffer == NULL)
1291
1292 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1293 Status = SampGetObjectAttribute(DomainObject,
1294 L"F",
1295 NULL,
1296 (PVOID)&FixedData,
1297 &Length);
1298 if (!NT_SUCCESS(Status))
1299 goto done;
1300
1301 InfoBuffer->Role.DomainServerRole = FixedData.DomainServerRole;
1302
1303 *Buffer = InfoBuffer;
1304
1305done:
1306 if (!NT_SUCCESS(Status))
1307 {
1308 if (InfoBuffer != NULL)
1309 {
1310 midl_user_free(InfoBuffer);
1311 }
1312 }
1313
1314 return Status;
1315}
DOMAIN_SERVER_ROLE DomainServerRole
Definition: ntsam.h:419
DOMAIN_SERVER_ROLE_INFORMATION Role
Definition: sam.idl:272

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainState()

static NTSTATUS SampQueryDomainState ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1363 of file samrpc.c.

1365{
1366 PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1367 SAM_DOMAIN_FIXED_DATA FixedData;
1368 ULONG Length = 0;
1370
1371 *Buffer = NULL;
1372
1373 InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1374 if (InfoBuffer == NULL)
1376
1377 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1378 Status = SampGetObjectAttribute(DomainObject,
1379 L"F",
1380 NULL,
1381 (PVOID)&FixedData,
1382 &Length);
1383 if (!NT_SUCCESS(Status))
1384 goto done;
1385
1386 InfoBuffer->State.DomainServerState = FixedData.DomainServerState;
1387
1388 *Buffer = InfoBuffer;
1389
1390done:
1391 if (!NT_SUCCESS(Status))
1392 {
1393 if (InfoBuffer != NULL)
1394 {
1395 midl_user_free(InfoBuffer);
1396 }
1397 }
1398
1399 return Status;
1400}
DOMAIN_SERVER_ENABLE_STATE DomainServerState
Definition: ntsam.h:430
DOMAIN_STATE_INFORMATION State
Definition: sam.idl:275

Referenced by SamrQueryInformationDomain2().

◆ SampQueryGroupAdminComment()

static NTSTATUS SampQueryGroupAdminComment ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER Buffer 
)
static

Definition at line 4210 of file samrpc.c.

4212{
4213 PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4215
4216 *Buffer = NULL;
4217
4218 InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4219 if (InfoBuffer == NULL)
4221
4223 L"AdminComment",
4224 &InfoBuffer->AdminComment.AdminComment);
4225 if (!NT_SUCCESS(Status))
4226 {
4227 TRACE("Status 0x%08lx\n", Status);
4228 goto done;
4229 }
4230
4231 *Buffer = InfoBuffer;
4232
4233done:
4234 if (!NT_SUCCESS(Status))
4235 {
4236 if (InfoBuffer != NULL)
4237 {
4238 if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
4240
4241 midl_user_free(InfoBuffer);
4242 }
4243 }
4244
4245 return Status;
4246}
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:392
SAMPR_GROUP_ADM_COMMENT_INFORMATION AdminComment
Definition: sam.idl:411

Referenced by SamrQueryInformationGroup().

◆ SampQueryGroupAttribute()

static NTSTATUS SampQueryGroupAttribute ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER Buffer 
)
static

Definition at line 4166 of file samrpc.c.

4168{
4169 PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4170 SAM_GROUP_FIXED_DATA FixedData;
4171 ULONG Length = 0;
4173
4174 *Buffer = NULL;
4175
4176 InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4177 if (InfoBuffer == NULL)
4179
4180 Length = sizeof(SAM_GROUP_FIXED_DATA);
4181 Status = SampGetObjectAttribute(GroupObject,
4182 L"F",
4183 NULL,
4184 (PVOID)&FixedData,
4185 &Length);
4186 if (!NT_SUCCESS(Status))
4187 {
4188 TRACE("Status 0x%08lx\n", Status);
4189 goto done;
4190 }
4191
4192 InfoBuffer->Attribute.Attributes = FixedData.Attributes;
4193
4194 *Buffer = InfoBuffer;
4195
4196done:
4197 if (!NT_SUCCESS(Status))
4198 {
4199 if (InfoBuffer != NULL)
4200 {
4201 midl_user_free(InfoBuffer);
4202 }
4203 }
4204
4205 return Status;
4206}
struct _SAM_GROUP_FIXED_DATA SAM_GROUP_FIXED_DATA
SAMPR_GROUP_ATTRIBUTE_INFORMATION Attribute
Definition: sam.idl:410

Referenced by SamrQueryInformationGroup().

◆ SampQueryGroupGeneral()

static NTSTATUS SampQueryGroupGeneral ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER Buffer 
)
static

Definition at line 4036 of file samrpc.c.

4038{
4039 PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4040 SAM_GROUP_FIXED_DATA FixedData;
4041 ULONG MembersLength = 0;
4042 ULONG Length = 0;
4044
4045 *Buffer = NULL;
4046
4047 InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4048 if (InfoBuffer == NULL)
4050
4052 L"Name",
4053 &InfoBuffer->General.Name);
4054 if (!NT_SUCCESS(Status))
4055 {
4056 TRACE("Status 0x%08lx\n", Status);
4057 goto done;
4058 }
4059
4061 L"AdminComment",
4062 &InfoBuffer->General.AdminComment);
4063 if (!NT_SUCCESS(Status))
4064 {
4065 TRACE("Status 0x%08lx\n", Status);
4066 goto done;
4067 }
4068
4069 Length = sizeof(SAM_GROUP_FIXED_DATA);
4070 Status = SampGetObjectAttribute(GroupObject,
4071 L"F",
4072 NULL,
4073 (PVOID)&FixedData,
4074 &Length);
4075 if (!NT_SUCCESS(Status))
4076 {
4077 TRACE("Status 0x%08lx\n", Status);
4078 goto done;
4079 }
4080
4081 InfoBuffer->General.Attributes = FixedData.Attributes;
4082
4083 Status = SampGetObjectAttribute(GroupObject,
4084 L"Members",
4085 NULL,
4086 NULL,
4087 &MembersLength);
4089 {
4090 TRACE("Status 0x%08lx\n", Status);
4091 goto done;
4092 }
4093
4095 {
4096 InfoBuffer->General.MemberCount = 0;
4098 }
4099 else
4100 {
4101 InfoBuffer->General.MemberCount = MembersLength / sizeof(ULONG);
4102 }
4103
4104 *Buffer = InfoBuffer;
4105
4106done:
4107 if (!NT_SUCCESS(Status))
4108 {
4109 if (InfoBuffer != NULL)
4110 {
4111 if (InfoBuffer->General.Name.Buffer != NULL)
4112 midl_user_free(InfoBuffer->General.Name.Buffer);
4113
4114 if (InfoBuffer->General.AdminComment.Buffer != NULL)
4116
4117 midl_user_free(InfoBuffer);
4118 }
4119 }
4120
4121 return Status;
4122}
RPC_UNICODE_STRING Name
Definition: sam.idl:379
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:382
SAMPR_GROUP_GENERAL_INFORMATION General
Definition: sam.idl:408

Referenced by SamrQueryInformationGroup().

◆ SampQueryGroupName()

static NTSTATUS SampQueryGroupName ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER Buffer 
)
static

Definition at line 4126 of file samrpc.c.

4128{
4129 PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4131
4132 *Buffer = NULL;
4133
4134 InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4135 if (InfoBuffer == NULL)
4137
4139 L"Name",
4140 &InfoBuffer->Name.Name);
4141 if (!NT_SUCCESS(Status))
4142 {
4143 TRACE("Status 0x%08lx\n", Status);
4144 goto done;
4145 }
4146
4147 *Buffer = InfoBuffer;
4148
4149done:
4150 if (!NT_SUCCESS(Status))
4151 {
4152 if (InfoBuffer != NULL)
4153 {
4154 if (InfoBuffer->Name.Name.Buffer != NULL)
4155 midl_user_free(InfoBuffer->Name.Name.Buffer);
4156
4157 midl_user_free(InfoBuffer);
4158 }
4159 }
4160
4161 return Status;
4162}
RPC_UNICODE_STRING Name
Definition: sam.idl:387
SAMPR_GROUP_NAME_INFORMATION Name
Definition: sam.idl:409

Referenced by SamrQueryInformationGroup().

◆ SampQueryUserAccount()

static NTSTATUS SampQueryUserAccount ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 5876 of file samrpc.c.

5878{
5879 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
5880 SAM_USER_FIXED_DATA FixedData;
5881 ULONG Length = 0;
5883
5884 *Buffer = NULL;
5885
5886 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
5887 if (InfoBuffer == NULL)
5889
5890 Length = sizeof(SAM_USER_FIXED_DATA);
5891 Status = SampGetObjectAttribute(UserObject,
5892 L"F",
5893 NULL,
5894 (PVOID)&FixedData,
5895 &Length);
5896 if (!NT_SUCCESS(Status))
5897 goto done;
5898
5899 InfoBuffer->Account.UserId = FixedData.UserId;
5900 InfoBuffer->Account.PrimaryGroupId = FixedData.PrimaryGroupId;
5901 InfoBuffer->Account.LastLogon.LowPart = FixedData.LastLogon.LowPart;
5902 InfoBuffer->Account.LastLogon.HighPart = FixedData.LastLogon.HighPart;
5903 InfoBuffer->Account.LastLogoff.LowPart = FixedData.LastLogoff.LowPart;
5904 InfoBuffer->Account.LastLogoff.HighPart = FixedData.LastLogoff.HighPart;
5905 InfoBuffer->Account.PasswordLastSet.LowPart = FixedData.PasswordLastSet.LowPart;
5907 InfoBuffer->Account.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
5908 InfoBuffer->Account.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
5909 InfoBuffer->Account.BadPasswordCount = FixedData.BadPasswordCount;
5910 InfoBuffer->Account.LogonCount = FixedData.LogonCount;
5911 InfoBuffer->Account.UserAccountControl = FixedData.UserAccountControl;
5912
5913 /* Get the Name string */
5915 L"Name",
5916 &InfoBuffer->Account.UserName);
5917 if (!NT_SUCCESS(Status))
5918 {
5919 TRACE("Status 0x%08lx\n", Status);
5920 goto done;
5921 }
5922
5923 /* Get the FullName string */
5925 L"FullName",
5926 &InfoBuffer->Account.FullName);
5927 if (!NT_SUCCESS(Status))
5928 {
5929 TRACE("Status 0x%08lx\n", Status);
5930 goto done;
5931 }
5932
5933 /* Get the HomeDirectory string */
5935 L"HomeDirectory",
5936 &InfoBuffer->Account.HomeDirectory);
5937 if (!NT_SUCCESS(Status))
5938 {
5939 TRACE("Status 0x%08lx\n", Status);
5940 goto done;
5941 }
5942
5943 /* Get the HomeDirectoryDrive string */
5945 L"HomeDirectoryDrive",
5946 &InfoBuffer->Account.HomeDirectoryDrive);
5947 if (!NT_SUCCESS(Status))
5948 {
5949 TRACE("Status 0x%08lx\n", Status);
5950 goto done;
5951 }
5952
5953 /* Get the ScriptPath string */
5955 L"ScriptPath",
5956 &InfoBuffer->Account.ScriptPath);
5957 if (!NT_SUCCESS(Status))
5958 {
5959 TRACE("Status 0x%08lx\n", Status);
5960 goto done;
5961 }
5962
5963 /* Get the ProfilePath string */
5965 L"ProfilePath",
5966 &InfoBuffer->Account.ProfilePath);
5967 if (!NT_SUCCESS(Status))
5968 {
5969 TRACE("Status 0x%08lx\n", Status);
5970 goto done;
5971 }
5972
5973 /* Get the AdminComment string */
5975 L"AdminComment",
5976 &InfoBuffer->Account.AdminComment);
5977 if (!NT_SUCCESS(Status))
5978 {
5979 TRACE("Status 0x%08lx\n", Status);
5980 goto done;
5981 }
5982
5983 /* Get the WorkStations string */
5985 L"WorkStations",
5986 &InfoBuffer->Account.WorkStations);
5987 if (!NT_SUCCESS(Status))
5988 {
5989 TRACE("Status 0x%08lx\n", Status);
5990 goto done;
5991 }
5992
5993 /* Get the LogonHours attribute */
5995 &InfoBuffer->Account.LogonHours);
5996 if (!NT_SUCCESS(Status))
5997 {
5998 TRACE("Status 0x%08lx\n", Status);
5999 goto done;
6000 }
6001
6002 *Buffer = InfoBuffer;
6003
6004done:
6005 if (!NT_SUCCESS(Status))
6006 {
6007 if (InfoBuffer != NULL)
6008 {
6009 if (InfoBuffer->Account.UserName.Buffer != NULL)
6011
6012 if (InfoBuffer->Account.FullName.Buffer != NULL)
6014
6015 if (InfoBuffer->Account.HomeDirectory.Buffer != NULL)
6017
6018 if (InfoBuffer->Account.HomeDirectoryDrive.Buffer != NULL)
6020
6021 if (InfoBuffer->Account.ScriptPath.Buffer != NULL)
6023
6024 if (InfoBuffer->Account.ProfilePath.Buffer != NULL)
6026
6027 if (InfoBuffer->Account.AdminComment.Buffer != NULL)
6029
6030 if (InfoBuffer->Account.WorkStations.Buffer != NULL)
6032
6033 if (InfoBuffer->Account.LogonHours.LogonHours != NULL)
6035
6036 midl_user_free(InfoBuffer);
6037 }
6038 }
6039
6040 return Status;
6041}
NTSTATUS SampGetLogonHoursAttribute(IN PSAM_DB_OBJECT UserObject, IN OUT PSAMPR_LOGON_HOURS LogonHours)
Definition: user.c:619
struct _SAM_USER_FIXED_DATA SAM_USER_FIXED_DATA
unsigned char * LogonHours
Definition: msv1_0.h:63
RPC_UNICODE_STRING FullName
Definition: sam.idl:565
SAMPR_LOGON_HOURS LogonHours
Definition: sam.idl:576
OLD_LARGE_INTEGER LastLogoff
Definition: sam.idl:575
RPC_UNICODE_STRING HomeDirectoryDrive
Definition: sam.idl:569
RPC_UNICODE_STRING ScriptPath
Definition: sam.idl:570
unsigned long UserAccountControl
Definition: sam.idl:581
OLD_LARGE_INTEGER PasswordLastSet
Definition: sam.idl:579
unsigned short BadPasswordCount
Definition: sam.idl:577
RPC_UNICODE_STRING ProfilePath
Definition: sam.idl:571
RPC_UNICODE_STRING HomeDirectory
Definition: sam.idl:568
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:572
OLD_LARGE_INTEGER AccountExpires
Definition: sam.idl:580
RPC_UNICODE_STRING UserName
Definition: sam.idl:564
unsigned short LogonCount
Definition: sam.idl:578
unsigned long PrimaryGroupId
Definition: sam.idl:567
RPC_UNICODE_STRING WorkStations
Definition: sam.idl:573
OLD_LARGE_INTEGER LastLogon
Definition: sam.idl:574
LARGE_INTEGER AccountExpires
Definition: samsrv.h:105
ULONG UserAccountControl
Definition: samsrv.h:109
LARGE_INTEGER LastLogon
Definition: samsrv.h:102
ULONG PrimaryGroupId
Definition: samsrv.h:108
LARGE_INTEGER PasswordLastSet
Definition: samsrv.h:104
USHORT BadPasswordCount
Definition: samsrv.h:112
LARGE_INTEGER LastLogoff
Definition: samsrv.h:103
SAMPR_USER_ACCOUNT_INFORMATION Account
Definition: sam.idl:725

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserAccountName()

static NTSTATUS SampQueryUserAccountName ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6145 of file samrpc.c.

6147{
6148 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6150
6151 *Buffer = NULL;
6152
6153 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6154 if (InfoBuffer == NULL)
6156
6157 /* Get the Name string */
6159 L"Name",
6160 &InfoBuffer->AccountName.UserName);
6161 if (!NT_SUCCESS(Status))
6162 {
6163 TRACE("Status 0x%08lx\n", Status);
6164 goto done;
6165 }
6166
6167 *Buffer = InfoBuffer;
6168
6169done:
6170 if (!NT_SUCCESS(Status))
6171 {
6172 if (InfoBuffer != NULL)
6173 {
6174 if (InfoBuffer->AccountName.UserName.Buffer != NULL)
6176
6177 midl_user_free(InfoBuffer);
6178 }
6179 }
6180
6181 return Status;
6182}
RPC_UNICODE_STRING UserName
Definition: sam.idl:586
SAMPR_USER_A_NAME_INFORMATION AccountName
Definition: sam.idl:727

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserAdminComment()

static NTSTATUS SampQueryUserAdminComment ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6405 of file samrpc.c.

6407{
6408 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6410
6411 *Buffer = NULL;
6412
6413 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6414 if (InfoBuffer == NULL)
6416
6417 /* Get the AdminComment string */
6419 L"AdminComment",
6420 &InfoBuffer->AdminComment.AdminComment);
6421 if (!NT_SUCCESS(Status))
6422 {
6423 TRACE("Status 0x%08lx\n", Status);
6424 goto done;
6425 }
6426
6427 *Buffer = InfoBuffer;
6428
6429done:
6430 if (!NT_SUCCESS(Status))
6431 {
6432 if (InfoBuffer != NULL)
6433 {
6434 if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
6436
6437 midl_user_free(InfoBuffer);
6438 }
6439 }
6440
6441 return Status;
6442}
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:618
SAMPR_USER_ADMIN_COMMENT_INFORMATION AdminComment
Definition: sam.idl:733

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserAll()

static NTSTATUS SampQueryUserAll ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6749 of file samrpc.c.

6751{
6752 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6753 SAM_DOMAIN_FIXED_DATA DomainFixedData;
6754 SAM_USER_FIXED_DATA FixedData;
6755 LARGE_INTEGER PasswordCanChange;
6756 LARGE_INTEGER PasswordMustChange;
6757 ULONG Length = 0;
6759
6760 *Buffer = NULL;
6761
6762 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6763 if (InfoBuffer == NULL)
6765
6766 /* Get the fixed size domain data */
6767 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
6769 L"F",
6770 NULL,
6771 (PVOID)&DomainFixedData,
6772 &Length);
6773 if (!NT_SUCCESS(Status))
6774 goto done;
6775
6776 /* Get the fixed size user data */
6777 Length = sizeof(SAM_USER_FIXED_DATA);
6778 Status = SampGetObjectAttribute(UserObject,
6779 L"F",
6780 NULL,
6781 (PVOID)&FixedData,
6782 &Length);
6783 if (!NT_SUCCESS(Status))
6784 goto done;
6785
6786 /* Set the fields to be returned */
6787 if (UserObject->Trusted)
6788 {
6794 }
6795 else
6796 {
6797 InfoBuffer->All.WhichFields = 0;
6798
6799 if (UserObject->Access & USER_READ_GENERAL)
6801
6802 if (UserObject->Access & USER_READ_LOGON)
6804
6805 if (UserObject->Access & USER_READ_ACCOUNT)
6807
6808 if (UserObject->Access & USER_READ_PREFERENCES)
6810 }
6811
6812 /* Fail, if no fields are to be returned */
6813 if (InfoBuffer->All.WhichFields == 0)
6814 {
6816 goto done;
6817 }
6818
6819 /* Get the UserName attribute */
6820 if (InfoBuffer->All.WhichFields & USER_ALL_USERNAME)
6821 {
6823 L"Name",
6824 &InfoBuffer->All.UserName);
6825 if (!NT_SUCCESS(Status))
6826 {
6827 TRACE("Status 0x%08lx\n", Status);
6828 goto done;
6829 }
6830 }
6831
6832 /* Get the FullName attribute */
6833 if (InfoBuffer->All.WhichFields & USER_ALL_FULLNAME)
6834 {
6836 L"FullName",
6837 &InfoBuffer->All.FullName);
6838 if (!NT_SUCCESS(Status))
6839 {
6840 TRACE("Status 0x%08lx\n", Status);
6841 goto done;
6842 }
6843 }
6844
6845 /* Get the UserId attribute */
6846 if (InfoBuffer->All.WhichFields & USER_ALL_USERID)
6847 {
6848 InfoBuffer->All.UserId = FixedData.UserId;
6849 }
6850
6851 /* Get the PrimaryGroupId attribute */
6852 if (InfoBuffer->All.WhichFields & USER_ALL_PRIMARYGROUPID)
6853 {
6854 InfoBuffer->All.PrimaryGroupId = FixedData.PrimaryGroupId;
6855 }
6856
6857 /* Get the AdminComment attribute */
6858 if (InfoBuffer->All.WhichFields & USER_ALL_ADMINCOMMENT)
6859 {
6861 L"AdminComment",
6862 &InfoBuffer->All.AdminComment);
6863 if (!NT_SUCCESS(Status))
6864 {
6865 TRACE("Status 0x%08lx\n", Status);
6866 goto done;
6867 }
6868 }
6869
6870 /* Get the UserComment attribute */
6871 if (InfoBuffer->All.WhichFields & USER_ALL_USERCOMMENT)
6872 {
6874 L"UserComment",
6875 &InfoBuffer->All.UserComment);
6876 if (!NT_SUCCESS(Status))
6877 {
6878 TRACE("Status 0x%08lx\n", Status);
6879 goto done;
6880 }
6881 }
6882
6883 /* Get the HomeDirectory attribute */
6884 if (InfoBuffer->All.WhichFields & USER_ALL_HOMEDIRECTORY)
6885 {
6887 L"HomeDirectory",
6888 &InfoBuffer->All.HomeDirectory);
6889 if (!NT_SUCCESS(Status))
6890 {
6891 TRACE("Status 0x%08lx\n", Status);
6892 goto done;
6893 }
6894 }
6895
6896 /* Get the HomeDirectoryDrive attribute */
6898 {
6900 L"HomeDirectoryDrive",
6901 &InfoBuffer->Home.HomeDirectoryDrive);
6902 if (!NT_SUCCESS(Status))
6903 {
6904 TRACE("Status 0x%08lx\n", Status);
6905 goto done;
6906 }
6907 }
6908
6909 /* Get the ScriptPath attribute */
6910 if (InfoBuffer->All.WhichFields & USER_ALL_SCRIPTPATH)
6911 {
6913 L"ScriptPath",
6914 &InfoBuffer->All.ScriptPath);
6915 if (!NT_SUCCESS(Status))
6916 {
6917 TRACE("Status 0x%08lx\n", Status);
6918 goto done;
6919 }
6920 }
6921
6922 /* Get the ProfilePath attribute */
6923 if (InfoBuffer->All.WhichFields & USER_ALL_PROFILEPATH)
6924 {
6926 L"ProfilePath",
6927 &InfoBuffer->All.ProfilePath);
6928 if (!NT_SUCCESS(Status))
6929 {
6930 TRACE("Status 0x%08lx\n", Status);
6931 goto done;
6932 }
6933 }
6934
6935 /* Get the WorkStations attribute */
6936 if (InfoBuffer->All.WhichFields & USER_ALL_WORKSTATIONS)
6937 {
6939 L"WorkStations",
6940 &InfoBuffer->All.WorkStations);
6941 if (!NT_SUCCESS(Status))
6942 {
6943 TRACE("Status 0x%08lx\n", Status);
6944 goto done;
6945 }
6946 }
6947
6948 /* Get the LastLogon attribute */
6949 if (InfoBuffer->All.WhichFields & USER_ALL_LASTLOGON)
6950 {
6951 InfoBuffer->All.LastLogon.LowPart = FixedData.LastLogon.LowPart;
6952 InfoBuffer->All.LastLogon.HighPart = FixedData.LastLogon.HighPart;
6953 }
6954
6955 /* Get the LastLogoff attribute */
6956 if (InfoBuffer->All.WhichFields & USER_ALL_LASTLOGOFF)
6957 {
6958 InfoBuffer->All.LastLogoff.LowPart = FixedData.LastLogoff.LowPart;
6959 InfoBuffer->All.LastLogoff.HighPart = FixedData.LastLogoff.HighPart;
6960 }
6961
6962 /* Get the LogonHours attribute */
6963 if (InfoBuffer->All.WhichFields & USER_ALL_LOGONHOURS)
6964 {
6966 &InfoBuffer->All.LogonHours);
6967 if (!NT_SUCCESS(Status))
6968 {
6969 TRACE("Status 0x%08lx\n", Status);
6970 goto done;
6971 }
6972 }
6973
6974 /* Get the BadPasswordCount attribute */
6975 if (InfoBuffer->All.WhichFields & USER_ALL_BADPASSWORDCOUNT)
6976 {
6977 InfoBuffer->All.BadPasswordCount = FixedData.BadPasswordCount;
6978 }
6979
6980 /* Get the LogonCount attribute */
6981 if (InfoBuffer->All.WhichFields & USER_ALL_LOGONCOUNT)
6982 {
6983 InfoBuffer->All.LogonCount = FixedData.LogonCount;
6984 }
6985
6986 /* Get the PasswordCanChange attribute */
6987 if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDCANCHANGE)
6988 {
6989 PasswordCanChange = SampAddRelativeTimeToTime(FixedData.PasswordLastSet,
6990 DomainFixedData.MinPasswordAge);
6991 InfoBuffer->All.PasswordCanChange.LowPart = PasswordCanChange.LowPart;
6992 InfoBuffer->All.PasswordCanChange.HighPart = PasswordCanChange.HighPart;
6993 }
6994
6995 /* Get the PasswordMustChange attribute */
6997 {
6998 PasswordMustChange = SampAddRelativeTimeToTime(FixedData.PasswordLastSet,
6999 DomainFixedData.MaxPasswordAge);
7000 InfoBuffer->All.PasswordMustChange.LowPart = PasswordMustChange.LowPart;
7001 InfoBuffer->All.PasswordMustChange.HighPart = PasswordMustChange.HighPart;
7002 }
7003
7004 /* Get the PasswordLastSet attribute */
7005 if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDLASTSET)
7006 {
7007 InfoBuffer->All.PasswordLastSet.LowPart = FixedData.PasswordLastSet.LowPart;
7008 InfoBuffer->All.PasswordLastSet.HighPart = FixedData.PasswordLastSet.HighPart;
7009 }
7010
7011 /* Get the AccountExpires attribute */
7012 if (InfoBuffer->All.WhichFields & USER_ALL_ACCOUNTEXPIRES)
7013 {
7014 InfoBuffer->All.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
7015 InfoBuffer->All.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
7016 }
7017
7018 /* Get the UserAccountControl attribute */
7020 {
7021 InfoBuffer->All.UserAccountControl = FixedData.UserAccountControl;
7022 }
7023
7024 /* Get the Parameters attribute */
7025 if (InfoBuffer->All.WhichFields & USER_ALL_PARAMETERS)
7026 {
7028 L"Parameters",
7029 &InfoBuffer->All.Parameters);
7030 if (!NT_SUCCESS(Status))
7031 {
7032 TRACE("Status 0x%08lx\n", Status);
7033 goto done;
7034 }
7035 }
7036
7037 /* Get the CountryCode attribute */
7038 if (InfoBuffer->All.WhichFields & USER_ALL_COUNTRYCODE)
7039 {
7040 InfoBuffer->All.CountryCode = FixedData.CountryCode;
7041 }
7042
7043 /* Get the CodePage attribute */
7044 if (InfoBuffer->All.WhichFields & USER_ALL_CODEPAGE)
7045 {
7046 InfoBuffer->All.CodePage = FixedData.CodePage;
7047 }
7048
7049 /* Get the LmPassword and NtPassword attributes */
7051 {
7052 InfoBuffer->All.LmPasswordPresent = FALSE;
7053 InfoBuffer->All.NtPasswordPresent = FALSE;
7054
7055 /* Get the NT password */
7056 Length = 0;
7057 SampGetObjectAttribute(UserObject,
7058 L"NTPwd",
7059 NULL,
7060 NULL,
7061 &Length);
7062
7063 if (Length == sizeof(ENCRYPTED_NT_OWF_PASSWORD))
7064 {
7066 if (InfoBuffer->All.NtOwfPassword.Buffer == NULL)
7067 {
7069 goto done;
7070 }
7071
7072 InfoBuffer->All.NtOwfPassword.Length = sizeof(ENCRYPTED_NT_OWF_PASSWORD);
7074
7075 Status = SampGetObjectAttribute(UserObject,
7076 L"NTPwd",
7077 NULL,
7078 (PVOID)InfoBuffer->All.NtOwfPassword.Buffer,
7079 &Length);
7080 if (!NT_SUCCESS(Status))
7081 goto done;
7082
7083 if (memcmp(InfoBuffer->All.NtOwfPassword.Buffer,
7084 &EmptyNtHash,
7086 InfoBuffer->All.NtPasswordPresent = TRUE;
7087 }
7088
7089 /* Get the LM password */
7090 Length = 0;
7091 SampGetObjectAttribute(UserObject,
7092 L"LMPwd",
7093 NULL,
7094 NULL,
7095 &Length);
7096
7097 if (Length == sizeof(ENCRYPTED_LM_OWF_PASSWORD))
7098 {
7100 if (InfoBuffer->All.LmOwfPassword.Buffer == NULL)
7101 {
7103 goto done;
7104 }
7105
7106 InfoBuffer->All.LmOwfPassword.Length = sizeof(ENCRYPTED_LM_OWF_PASSWORD);
7108
7109 Status = SampGetObjectAttribute(UserObject,
7110 L"LMPwd",
7111 NULL,
7112 (PVOID)InfoBuffer->All.LmOwfPassword.Buffer,
7113 &Length);
7114 if (!NT_SUCCESS(Status))
7115 goto done;
7116
7117 if (memcmp(InfoBuffer->All.LmOwfPassword.Buffer,
7118 &EmptyLmHash,
7120 InfoBuffer->All.LmPasswordPresent = TRUE;
7121 }
7122 }
7123
7124 if (InfoBuffer->All.WhichFields & USER_ALL_PRIVATEDATA)
7125 {
7127 L"PrivateData",
7128 &InfoBuffer->All.PrivateData);
7129 if (!NT_SUCCESS(Status))
7130 {
7131 TRACE("Status 0x%08lx\n", Status);
7132 goto done;
7133 }
7134 }
7135
7136 if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDEXPIRED)
7137 {
7138 /* FIXME */
7139 }
7140
7142 {
7143 Length = 0;
7144 SampGetObjectAttribute(UserObject,
7145 L"SecDesc",
7146 NULL,
7147 NULL,
7148 &Length);
7149
7150 if (Length > 0)
7151 {
7153 if (InfoBuffer->All.SecurityDescriptor.SecurityDescriptor == NULL)
7154 {
7156 goto done;
7157 }
7158
7159 InfoBuffer->All.SecurityDescriptor.Length = Length;
7160
7161 Status = SampGetObjectAttribute(UserObject,
7162 L"SecDesc",
7163 NULL,
7165 &Length);
7166 if (!NT_SUCCESS(Status))
7167 goto done;
7168 }
7169 }
7170
7171 *Buffer = InfoBuffer;
7172
7173done:
7174 if (!NT_SUCCESS(Status))
7175 {
7176 if (InfoBuffer != NULL)
7177 {
7178 if (InfoBuffer->All.UserName.Buffer != NULL)
7179 midl_user_free(InfoBuffer->All.UserName.Buffer);
7180
7181 if (InfoBuffer->All.FullName.Buffer != NULL)
7182 midl_user_free(InfoBuffer->All.FullName.Buffer);
7183
7184 if (InfoBuffer->All.AdminComment.Buffer != NULL)
7186
7187 if (InfoBuffer->All.UserComment.Buffer != NULL)
7188 midl_user_free(InfoBuffer->All.UserComment.Buffer);
7189
7190 if (InfoBuffer->All.HomeDirectory.Buffer != NULL)
7192
7193 if (InfoBuffer->All.HomeDirectoryDrive.Buffer != NULL)
7195
7196 if (InfoBuffer->All.ScriptPath.Buffer != NULL)
7197 midl_user_free(InfoBuffer->All.ScriptPath.Buffer);
7198
7199 if (InfoBuffer->All.ProfilePath.Buffer != NULL)
7200 midl_user_free(InfoBuffer->All.ProfilePath.Buffer);
7201
7202 if (InfoBuffer->All.WorkStations.Buffer != NULL)
7204
7205 if (InfoBuffer->All.LogonHours.LogonHours != NULL)
7207
7208 if (InfoBuffer->All.Parameters.Buffer != NULL)
7209 midl_user_free(InfoBuffer->All.Parameters.Buffer);
7210
7211 if (InfoBuffer->All.LmOwfPassword.Buffer != NULL)
7213
7214 if (InfoBuffer->All.NtOwfPassword.Buffer != NULL)
7216
7217 if (InfoBuffer->All.PrivateData.Buffer != NULL)
7218 midl_user_free(InfoBuffer->All.PrivateData.Buffer);
7219
7220 if (InfoBuffer->All.SecurityDescriptor.SecurityDescriptor != NULL)
7222
7223 midl_user_free(InfoBuffer);
7224 }
7225 }
7226
7227 return Status;
7228}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
struct _ENCRYPTED_LM_OWF_PASSWORD ENCRYPTED_NT_OWF_PASSWORD
struct _ENCRYPTED_LM_OWF_PASSWORD ENCRYPTED_LM_OWF_PASSWORD
#define USER_READ_GENERAL
Definition: ntsam.h:126
#define USER_ALL_READ_GENERAL_MASK
Definition: ntsam.h:228
#define USER_READ_LOGON
Definition: ntsam.h:129
#define USER_ALL_SCRIPTPATH
Definition: ntsam.h:204
#define USER_ALL_COUNTRYCODE
Definition: ntsam.h:218
#define USER_ALL_ADMINCOMMENT
Definition: ntsam.h:200
#define USER_ALL_PARAMETERS
Definition: ntsam.h:217
#define USER_ALL_WORKSTATIONS
Definition: ntsam.h:206
#define USER_READ_PREFERENCES
Definition: ntsam.h:127
#define USER_ALL_READ_LOGON_MASK
Definition: ntsam.h:229
#define USER_ALL_USERID
Definition: ntsam.h:198
#define USER_READ_ACCOUNT
Definition: ntsam.h:130
#define USER_ALL_HOMEDIRECTORY
Definition: ntsam.h:202
#define USER_ALL_USERNAME
Definition: ntsam.h:196
#define USER_ALL_PASSWORDCANCHANGE
Definition: ntsam.h:212
#define USER_ALL_PRIVATEDATA
Definition: ntsam.h:222
#define USER_ALL_LMPASSWORDPRESENT
Definition: ntsam.h:221
#define USER_ALL_HOMEDIRECTORYDRIVE
Definition: ntsam.h:203
#define USER_ALL_PASSWORDEXPIRED
Definition: ntsam.h:223
#define USER_ALL_USERCOMMENT
Definition: ntsam.h:201
#define USER_ALL_ACCOUNTEXPIRES
Definition: ntsam.h:215
#define USER_ALL_READ_PREFERENCES_MASK
Definition: ntsam.h:231
#define USER_ALL_READ_ACCOUNT_MASK
Definition: ntsam.h:230
#define USER_ALL_LASTLOGON
Definition: ntsam.h:207
#define USER_ALL_LOGONHOURS
Definition: ntsam.h:209
#define USER_ALL_PASSWORDLASTSET
Definition: ntsam.h:214
#define USER_ALL_PASSWORDMUSTCHANGE
Definition: ntsam.h:213
#define USER_ALL_PRIMARYGROUPID
Definition: ntsam.h:199
#define USER_ALL_USERACCOUNTCONTROL
Definition: ntsam.h:216
#define USER_ALL_FULLNAME
Definition: ntsam.h:197
#define USER_ALL_LASTLOGOFF
Definition: ntsam.h:208
#define USER_ALL_CODEPAGE
Definition: ntsam.h:219
#define USER_ALL_BADPASSWORDCOUNT
Definition: ntsam.h:210
#define USER_ALL_SECURITYDESCRIPTOR
Definition: ntsam.h:224
#define USER_ALL_LOGONCOUNT
Definition: ntsam.h:211
#define USER_ALL_PROFILEPATH
Definition: ntsam.h:205
#define USER_ALL_NTPASSWORDPRESENT
Definition: ntsam.h:220
#define USER_ALL_READ_TRUSTED_MASK
Definition: ntsam.h:232
static LARGE_INTEGER SampAddRelativeTimeToTime(IN LARGE_INTEGER AbsoluteTime, IN LARGE_INTEGER RelativeTime)
Definition: samrpc.c:63
ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash
Definition: samsrv.c:27
ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash
Definition: samsrv.c:26
unsigned short * Buffer
Definition: msv1_0.h:40
unsigned short MaximumLength
Definition: msv1_0.h:39
unsigned short Length
Definition: msv1_0.h:38
unsigned long Length
Definition: msv1_0.h:45
unsigned char * SecurityDescriptor
Definition: msv1_0.h:46
unsigned short BadPasswordCount
Definition: msv1_0.h:105
unsigned short LogonCount
Definition: msv1_0.h:106
OLD_LARGE_INTEGER PasswordMustChange
Definition: msv1_0.h:85
unsigned long PrimaryGroupId
Definition: msv1_0.h:101
OLD_LARGE_INTEGER PasswordLastSet
Definition: msv1_0.h:82
unsigned short CodePage
Definition: msv1_0.h:108
RPC_SHORT_BLOB NtOwfPassword
Definition: msv1_0.h:97
RPC_UNICODE_STRING UserName
Definition: msv1_0.h:86
OLD_LARGE_INTEGER PasswordCanChange
Definition: msv1_0.h:84
unsigned long WhichFields
Definition: msv1_0.h:103
OLD_LARGE_INTEGER LastLogon
Definition: msv1_0.h:80
RPC_UNICODE_STRING Parameters
Definition: msv1_0.h:95
RPC_UNICODE_STRING ProfilePath
Definition: msv1_0.h:91
RPC_UNICODE_STRING PrivateData
Definition: msv1_0.h:98
RPC_UNICODE_STRING FullName
Definition: msv1_0.h:87
RPC_UNICODE_STRING HomeDirectoryDrive
Definition: msv1_0.h:89
SAMPR_LOGON_HOURS LogonHours
Definition: msv1_0.h:104
unsigned short CountryCode
Definition: msv1_0.h:107
RPC_UNICODE_STRING UserComment
Definition: msv1_0.h:94
OLD_LARGE_INTEGER LastLogoff
Definition: msv1_0.h:81
RPC_UNICODE_STRING ScriptPath
Definition: msv1_0.h:90
RPC_UNICODE_STRING AdminComment
Definition: msv1_0.h:92
RPC_UNICODE_STRING HomeDirectory
Definition: msv1_0.h:88
unsigned long UserId
Definition: msv1_0.h:100
unsigned char LmPasswordPresent
Definition: msv1_0.h:109
SAMPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor
Definition: msv1_0.h:99
OLD_LARGE_INTEGER AccountExpires
Definition: msv1_0.h:83
unsigned long UserAccountControl
Definition: msv1_0.h:102
RPC_SHORT_BLOB LmOwfPassword
Definition: msv1_0.h:96
unsigned char NtPasswordPresent
Definition: msv1_0.h:110
RPC_UNICODE_STRING WorkStations
Definition: msv1_0.h:93
RPC_UNICODE_STRING HomeDirectoryDrive
Definition: sam.idl:603
BOOLEAN Trusted
Definition: samsrv.h:55
ACCESS_MASK Access
Definition: samsrv.h:50
struct _SAM_DB_OBJECT * ParentObject
Definition: samsrv.h:56
USHORT CountryCode
Definition: samsrv.h:110
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
SAMPR_USER_HOME_INFORMATION Home
Definition: sam.idl:730
SAMPR_USER_ALL_INFORMATION All
Definition: msv1_0.h:141

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserControl()

static NTSTATUS SampQueryUserControl ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6488 of file samrpc.c.

6490{
6491 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6492 SAM_USER_FIXED_DATA FixedData;
6493 ULONG Length = 0;
6495
6496 *Buffer = NULL;
6497
6498 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6499 if (InfoBuffer == NULL)
6501
6502 Length = sizeof(SAM_USER_FIXED_DATA);
6503 Status = SampGetObjectAttribute(UserObject,
6504 L"F",
6505 NULL,
6506 (PVOID)&FixedData,
6507 &Length);
6508 if (!NT_SUCCESS(Status))
6509 goto done;
6510
6511 InfoBuffer->Control.UserAccountControl = FixedData.UserAccountControl;
6512
6513 *Buffer = InfoBuffer;
6514
6515done:
6516 if (!NT_SUCCESS(Status))
6517 {
6518 if (InfoBuffer != NULL)
6519 {
6520 midl_user_free(InfoBuffer);
6521 }
6522 }
6523
6524 return Status;
6525}
USER_CONTROL_INFORMATION Control
Definition: sam.idl:736

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserExpires()

static NTSTATUS SampQueryUserExpires ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6530 of file samrpc.c.

6532{
6533 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6534 SAM_USER_FIXED_DATA FixedData;
6535 ULONG Length = 0;
6537
6538 *Buffer = NULL;
6539
6540 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6541 if (InfoBuffer == NULL)
6543
6544 Length = sizeof(SAM_USER_FIXED_DATA);
6545 Status = SampGetObjectAttribute(UserObject,
6546 L"F",
6547 NULL,
6548 (PVOID)&FixedData,
6549 &Length);
6550 if (!NT_SUCCESS(Status))
6551 goto done;
6552
6553 InfoBuffer->Expires.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
6554 InfoBuffer->Expires.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
6555
6556 *Buffer = InfoBuffer;
6557
6558done:
6559 if (!NT_SUCCESS(Status))
6560 {
6561 if (InfoBuffer != NULL)
6562 {
6563 midl_user_free(InfoBuffer);
6564 }
6565 }
6566
6567 return Status;
6568}
LARGE_INTEGER AccountExpires
Definition: ntsam.h:675
USER_EXPIRES_INFORMATION Expires
Definition: sam.idl:737

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserFullName()

static NTSTATUS SampQueryUserFullName ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6186 of file samrpc.c.

6188{
6189 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6191
6192 *Buffer = NULL;
6193
6194 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6195 if (InfoBuffer == NULL)
6197
6198 /* Get the FullName string */
6200 L"FullName",
6201 &InfoBuffer->FullName.FullName);
6202 if (!NT_SUCCESS(Status))
6203 {
6204 TRACE("Status 0x%08lx\n", Status);
6205 goto done;
6206 }
6207
6208 *Buffer = InfoBuffer;
6209
6210done:
6211 if (!NT_SUCCESS(Status))
6212 {
6213 if (InfoBuffer != NULL)
6214 {
6215 if (InfoBuffer->FullName.FullName.Buffer != NULL)
6217
6218 midl_user_free(InfoBuffer);
6219 }
6220 }
6221
6222 return Status;
6223}
RPC_UNICODE_STRING FullName
Definition: sam.idl:591
SAMPR_USER_F_NAME_INFORMATION FullName
Definition: sam.idl:728

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserGeneral()

static NTSTATUS SampQueryUserGeneral ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 5547 of file samrpc.c.

5549{
5550 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
5551 SAM_USER_FIXED_DATA FixedData;
5552 ULONG Length = 0;
5554
5555 *Buffer = NULL;
5556
5557 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
5558 if (InfoBuffer == NULL)
5560
5561 Length = sizeof(SAM_USER_FIXED_DATA);
5562 Status = SampGetObjectAttribute(UserObject,
5563 L"F",
5564 NULL,
5565 (PVOID)&FixedData,
5566 &Length);
5567 if (!NT_SUCCESS(Status))
5568 goto done;
5569
5570 InfoBuffer->General.PrimaryGroupId = FixedData.PrimaryGroupId;
5571
5572 /* Get the Name string */
5574 L"Name",
5575 &InfoBuffer->General.UserName);
5576 if (!NT_SUCCESS(Status))
5577 {
5578 TRACE("Status 0x%08lx\n", Status);
5579 goto done;
5580 }
5581
5582 /* Get the FullName string */
5584 L"FullName",
5585 &InfoBuffer->General.FullName);
5586 if (!NT_SUCCESS(Status))
5587 {
5588 TRACE("Status 0x%08lx\n", Status);
5589 goto done;
5590 }
5591
5592 /* Get the AdminComment string */
5594 L"AdminComment",
5595 &InfoBuffer->General.AdminComment);
5596 if (!NT_SUCCESS(Status))
5597 {
5598 TRACE("Status 0x%08lx\n", Status);
5599 goto done;
5600 }
5601
5602 /* Get the UserComment string */
5604 L"UserComment",
5605 &InfoBuffer->General.UserComment);
5606 if (!NT_SUCCESS(Status))
5607 {
5608 TRACE("Status 0x%08lx\n", Status);
5609 goto done;
5610 }
5611
5612 *Buffer = InfoBuffer;
5613
5614done:
5615 if (!NT_SUCCESS(Status))
5616 {
5617 if (InfoBuffer != NULL)
5618 {
5619 if (InfoBuffer->General.UserName.Buffer != NULL)
5621
5622 if (InfoBuffer->General.FullName.Buffer != NULL)
5624
5625 if (InfoBuffer->General.AdminComment.Buffer != NULL)
5627
5628 if (InfoBuffer->General.UserComment.Buffer != NULL)
5630
5631 midl_user_free(InfoBuffer);
5632 }
5633 }
5634
5635 return Status;
5636}
RPC_UNICODE_STRING UserName
Definition: sam.idl:520
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:523
unsigned long PrimaryGroupId
Definition: sam.idl:522
RPC_UNICODE_STRING UserComment
Definition: sam.idl:524
RPC_UNICODE_STRING FullName
Definition: sam.idl:521
SAMPR_USER_GENERAL_INFORMATION General
Definition: sam.idl:721

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserHome()

static NTSTATUS SampQueryUserHome ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6269 of file samrpc.c.

6271{
6272 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6274
6275 *Buffer = NULL;
6276
6277 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6278 if (InfoBuffer == NULL)
6280
6281 /* Get the HomeDirectory string */
6283 L"HomeDirectory",
6284 &InfoBuffer->Home.HomeDirectory);
6285 if (!NT_SUCCESS(Status))
6286 {
6287 TRACE("Status 0x%08lx\n", Status);
6288 goto done;
6289 }
6290
6291 /* Get the HomeDirectoryDrive string */
6293 L"HomeDirectoryDrive",
6294 &InfoBuffer->Home.HomeDirectoryDrive);
6295 if (!NT_SUCCESS(Status))
6296 {
6297 TRACE("Status 0x%08lx\n", Status);
6298 goto done;
6299 }
6300
6301 *Buffer = InfoBuffer;
6302
6303done:
6304 if (!NT_SUCCESS(Status))
6305 {
6306 if (InfoBuffer != NULL)
6307 {
6308 if (InfoBuffer->Home.HomeDirectory.Buffer != NULL)
6310
6311 if (InfoBuffer->Home.HomeDirectoryDrive.Buffer != NULL)
6313
6314 midl_user_free(InfoBuffer);
6315 }
6316 }
6317
6318 return Status;
6319}
RPC_UNICODE_STRING HomeDirectory
Definition: sam.idl:602

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserInternal1()

static NTSTATUS SampQueryUserInternal1 ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6573 of file samrpc.c.

6575{
6576 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6577 ULONG Length = 0;
6579
6580 /* Fail, if the caller is not a trusted caller */
6581 if (UserObject->Trusted == FALSE)
6583
6584 *Buffer = NULL;
6585
6586 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6587 if (InfoBuffer == NULL)
6589
6590 InfoBuffer->Internal1.LmPasswordPresent = FALSE;
6591 InfoBuffer->Internal1.NtPasswordPresent = FALSE;
6592
6593 /* Get the NT password */
6594 Length = 0;
6595 SampGetObjectAttribute(UserObject,
6596 L"NTPwd",
6597 NULL,
6598 NULL,
6599 &Length);
6600
6601 if (Length == sizeof(ENCRYPTED_NT_OWF_PASSWORD))
6602 {
6603 Status = SampGetObjectAttribute(UserObject,
6604 L"NTPwd",
6605 NULL,
6607 &Length);
6608 if (!NT_SUCCESS(Status))
6609 goto done;
6610
6611 if (memcmp(&InfoBuffer->Internal1.EncryptedNtOwfPassword,
6612 &EmptyNtHash,
6614 InfoBuffer->Internal1.NtPasswordPresent = TRUE;
6615 }
6616
6617
6618 /* Get the LM password */
6619 Length = 0;
6620 SampGetObjectAttribute(UserObject,
6621 L"LMPwd",
6622 NULL,
6623 NULL,
6624 &Length);
6625
6626 if (Length == sizeof(ENCRYPTED_LM_OWF_PASSWORD))
6627 {
6628 Status = SampGetObjectAttribute(UserObject,
6629 L"LMPwd",
6630 NULL,
6632 &Length);
6633 if (!NT_SUCCESS(Status))
6634 goto done;
6635
6636 if (memcmp(&InfoBuffer->Internal1.EncryptedLmOwfPassword,
6637 &EmptyLmHash,
6639 InfoBuffer->Internal1.LmPasswordPresent = TRUE;
6640 }
6641
6642 InfoBuffer->Internal1.PasswordExpired = FALSE;
6643
6644 *Buffer = InfoBuffer;
6645
6646done:
6647 if (!NT_SUCCESS(Status))
6648 {
6649 if (InfoBuffer != NULL)
6650 {
6651 midl_user_free(InfoBuffer);
6652 }
6653 }
6654
6655 return Status;
6656}
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:240
ENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword
Definition: sam.idl:640
ENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword
Definition: sam.idl:641
SAMPR_USER_INTERNAL1_INFORMATION Internal1
Definition: sam.idl:738

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserInternal2()

static NTSTATUS SampQueryUserInternal2 ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6661 of file samrpc.c.

6663{
6664 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6665 SAM_USER_FIXED_DATA FixedData;
6666 ULONG Length = 0;
6668
6669 *Buffer = NULL;
6670
6671 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6672 if (InfoBuffer == NULL)
6674
6675 Length = sizeof(SAM_USER_FIXED_DATA);
6676 Status = SampGetObjectAttribute(UserObject,
6677 L"F",
6678 NULL,
6679 (PVOID)&FixedData,
6680 &Length);
6681 if (!NT_SUCCESS(Status))
6682 goto done;
6683
6684 InfoBuffer->Internal2.Flags = 0;
6685 InfoBuffer->Internal2.LastLogon.LowPart = FixedData.LastLogon.LowPart;
6686 InfoBuffer->Internal2.LastLogon.HighPart = FixedData.LastLogon.HighPart;
6687 InfoBuffer->Internal2.LastLogoff.LowPart = FixedData.LastLogoff.LowPart;
6688 InfoBuffer->Internal2.LastLogoff.HighPart = FixedData.LastLogoff.HighPart;
6689 InfoBuffer->Internal2.BadPasswordCount = FixedData.BadPasswordCount;
6690 InfoBuffer->Internal2.LogonCount = FixedData.LogonCount;
6691
6692 *Buffer = InfoBuffer;
6693
6694done:
6695 if (!NT_SUCCESS(Status))
6696 {
6697 if (InfoBuffer != NULL)
6698 {
6699 midl_user_free(InfoBuffer);
6700 }
6701 }
6702
6703 return Status;
6704}
OLD_LARGE_INTEGER LastLogon
Definition: msv1_0.h:72
unsigned short BadPasswordCount
Definition: msv1_0.h:74
OLD_LARGE_INTEGER LastLogoff
Definition: msv1_0.h:73
SAMPR_USER_INTERNAL2_INFORMATION Internal2
Definition: msv1_0.h:137

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserLogon()

static NTSTATUS SampQueryUserLogon ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 5697 of file samrpc.c.

5699{
5700 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
5701 SAM_DOMAIN_FIXED_DATA DomainFixedData;
5702 SAM_USER_FIXED_DATA FixedData;
5703 LARGE_INTEGER PasswordCanChange;
5704 LARGE_INTEGER PasswordMustChange;
5705 ULONG Length = 0;
5707
5708 *Buffer = NULL;
5709
5710 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
5711 if (InfoBuffer == NULL)
5713
5714 /* Get the fixed size domain data */
5715 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
5717 L"F",
5718 NULL,
5719 (PVOID)&DomainFixedData,
5720 &Length);
5721 if (!NT_SUCCESS(Status))
5722 goto done;
5723
5724 /* Get the fixed size user data */
5725 Length = sizeof(SAM_USER_FIXED_DATA);
5726 Status = SampGetObjectAttribute(UserObject,
5727 L"F",
5728 NULL,
5729 (PVOID)&FixedData,
5730 &Length);
5731 if (!NT_SUCCESS(Status))
5732 goto done;
5733
5734 InfoBuffer->Logon.UserId = FixedData.UserId;
5735 InfoBuffer->Logon.PrimaryGroupId = FixedData.PrimaryGroupId;
5736 InfoBuffer->Logon.LastLogon.LowPart = FixedData.LastLogon.LowPart;
5737 InfoBuffer->Logon.LastLogon.HighPart = FixedData.LastLogon.HighPart;
5738 InfoBuffer->Logon.LastLogoff.LowPart = FixedData.LastLogoff.LowPart;
5739 InfoBuffer->Logon.LastLogoff.HighPart = FixedData.LastLogoff.HighPart;
5740 InfoBuffer->Logon.PasswordLastSet.LowPart = FixedData.PasswordLastSet.LowPart;
5741 InfoBuffer->Logon.PasswordLastSet.HighPart = FixedData.PasswordLastSet.HighPart;
5742 InfoBuffer->Logon.BadPasswordCount = FixedData.BadPasswordCount;
5743 InfoBuffer->Logon.LogonCount = FixedData.LogonCount;
5744 InfoBuffer->Logon.UserAccountControl = FixedData.UserAccountControl;
5745
5746 PasswordCanChange = SampAddRelativeTimeToTime(FixedData.PasswordLastSet,
5747 DomainFixedData.MinPasswordAge);
5748 InfoBuffer->Logon.PasswordCanChange.LowPart = PasswordCanChange.LowPart;
5749 InfoBuffer->Logon.PasswordCanChange.HighPart = PasswordCanChange.HighPart;
5750
5751 PasswordMustChange = SampAddRelativeTimeToTime(FixedData.PasswordLastSet,
5752 DomainFixedData.MaxPasswordAge);
5753 InfoBuffer->Logon.PasswordMustChange.LowPart = PasswordMustChange.LowPart;
5754 InfoBuffer->Logon.PasswordMustChange.HighPart = PasswordMustChange.HighPart;
5755
5756 /* Get the Name string */
5758 L"Name",
5759 &InfoBuffer->Logon.UserName);
5760 if (!NT_SUCCESS(Status))
5761 {
5762 TRACE("Status 0x%08lx\n", Status);
5763 goto done;
5764 }
5765
5766 /* Get the FullName string */
5768 L"FullName",
5769 &InfoBuffer->Logon.FullName);
5770 if (!NT_SUCCESS(Status))
5771 {
5772 TRACE("Status 0x%08lx\n", Status);
5773 goto done;
5774 }
5775
5776 /* Get the HomeDirectory string */
5778 L"HomeDirectory",
5779 &InfoBuffer->Logon.HomeDirectory);
5780 if (!NT_SUCCESS(Status))
5781 {
5782 TRACE("Status 0x%08lx\n", Status);
5783 goto done;
5784 }
5785
5786 /* Get the HomeDirectoryDrive string */
5788 L"HomeDirectoryDrive",
5789 &InfoBuffer->Logon.HomeDirectoryDrive);
5790 if (!NT_SUCCESS(Status))
5791 {
5792 TRACE("Status 0x%08lx\n", Status);
5793 goto done;
5794 }
5795
5796 /* Get the ScriptPath string */
5798 L"ScriptPath",
5799 &InfoBuffer->Logon.ScriptPath);
5800 if (!NT_SUCCESS(Status))
5801 {
5802 TRACE("Status 0x%08lx\n", Status);
5803 goto done;
5804 }
5805
5806 /* Get the ProfilePath string */
5808 L"ProfilePath",
5809 &InfoBuffer->Logon.ProfilePath);
5810 if (!NT_SUCCESS(Status))
5811 {
5812 TRACE("Status 0x%08lx\n", Status);
5813 goto done;
5814 }
5815
5816 /* Get the WorkStations string */
5818 L"WorkStations",
5819 &InfoBuffer->Logon.WorkStations);
5820 if (!NT_SUCCESS(Status))
5821 {
5822 TRACE("Status 0x%08lx\n", Status);
5823 goto done;
5824 }
5825
5826 /* Get the LogonHours attribute */
5828 &InfoBuffer->Logon.LogonHours);
5829 if (!NT_SUCCESS(Status))
5830 {
5831 TRACE("Status 0x%08lx\n", Status);
5832 goto done;
5833 }
5834
5835 *Buffer = InfoBuffer;
5836
5837done:
5838 if (!NT_SUCCESS(Status))
5839 {
5840 if (InfoBuffer != NULL)
5841 {
5842 if (InfoBuffer->Logon.UserName.Buffer != NULL)
5843 midl_user_free(InfoBuffer->Logon.UserName.Buffer);
5844
5845 if (InfoBuffer->Logon.FullName.Buffer != NULL)
5846 midl_user_free(InfoBuffer->Logon.FullName.Buffer);
5847
5848 if (InfoBuffer->Logon.HomeDirectory.Buffer != NULL)
5850
5851 if (InfoBuffer->Logon.HomeDirectoryDrive.Buffer != NULL)
5853
5854 if (InfoBuffer->Logon.ScriptPath.Buffer != NULL)
5856
5857 if (InfoBuffer->Logon.ProfilePath.Buffer != NULL)
5859
5860 if (InfoBuffer->Logon.WorkStations.Buffer != NULL)
5862
5863 if (InfoBuffer->Logon.LogonHours.LogonHours != NULL)
5865
5866 midl_user_free(InfoBuffer);
5867 }
5868 }
5869
5870 return Status;
5871}
RPC_UNICODE_STRING HomeDirectory
Definition: sam.idl:546
unsigned long PrimaryGroupId
Definition: sam.idl:545
RPC_UNICODE_STRING ProfilePath
Definition: sam.idl:549
unsigned long UserAccountControl
Definition: sam.idl:559
OLD_LARGE_INTEGER PasswordLastSet
Definition: sam.idl:553
unsigned short BadPasswordCount
Definition: sam.idl:557
OLD_LARGE_INTEGER LastLogon
Definition: sam.idl:551
SAMPR_LOGON_HOURS LogonHours
Definition: sam.idl:556
RPC_UNICODE_STRING UserName
Definition: sam.idl:542
RPC_UNICODE_STRING ScriptPath
Definition: sam.idl:548
OLD_LARGE_INTEGER PasswordMustChange
Definition: sam.idl:555
OLD_LARGE_INTEGER PasswordCanChange
Definition: sam.idl:554
unsigned short LogonCount
Definition: sam.idl:558
RPC_UNICODE_STRING FullName
Definition: sam.idl:543
OLD_LARGE_INTEGER LastLogoff
Definition: sam.idl:552
RPC_UNICODE_STRING WorkStations
Definition: sam.idl:550
unsigned long UserId
Definition: sam.idl:544
RPC_UNICODE_STRING HomeDirectoryDrive
Definition: sam.idl:547
SAMPR_USER_LOGON_INFORMATION Logon
Definition: sam.idl:723

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserLogonHours()

static NTSTATUS SampQueryUserLogonHours ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6046 of file samrpc.c.

6048{
6049 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6051
6052 TRACE("(%p %p)\n", UserObject, Buffer);
6053
6054 *Buffer = NULL;
6055
6056 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6057 if (InfoBuffer == NULL)
6058 {
6059 TRACE("Failed to allocate InfoBuffer!\n");
6061 }
6062
6064 &InfoBuffer->LogonHours.LogonHours);
6065 if (!NT_SUCCESS(Status))
6066 {
6067 TRACE("SampGetLogonHoursAttribute failed (Status 0x%08lx)\n", Status);
6068 goto done;
6069 }
6070
6071 *Buffer = InfoBuffer;
6072
6073done:
6074 if (!NT_SUCCESS(Status))
6075 {
6076 if (InfoBuffer != NULL)
6077 {
6078 if (InfoBuffer->LogonHours.LogonHours.LogonHours != NULL)
6080
6081 midl_user_free(InfoBuffer);
6082 }
6083 }
6084
6085 return Status;
6086}
SAMPR_LOGON_HOURS LogonHours
Definition: sam.idl:635
SAMPR_USER_LOGON_HOURS_INFORMATION LogonHours
Definition: sam.idl:724

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserName()

static NTSTATUS SampQueryUserName ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6091 of file samrpc.c.

6093{
6094 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6096
6097 *Buffer = NULL;
6098
6099 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6100 if (InfoBuffer == NULL)
6102
6103 /* Get the Name string */
6105 L"Name",
6106 &InfoBuffer->Name.UserName);
6107 if (!NT_SUCCESS(Status))
6108 {
6109 TRACE("Status 0x%08lx\n", Status);
6110 goto done;
6111 }
6112
6113 /* Get the FullName string */
6115 L"FullName",
6116 &InfoBuffer->Name.FullName);
6117 if (!NT_SUCCESS(Status))
6118 {
6119 TRACE("Status 0x%08lx\n", Status);
6120 goto done;
6121 }
6122
6123 *Buffer = InfoBuffer;
6124
6125done:
6126 if (!NT_SUCCESS(Status))
6127 {
6128 if (InfoBuffer != NULL)
6129 {
6130 if (InfoBuffer->Name.UserName.Buffer != NULL)
6131 midl_user_free(InfoBuffer->Name.UserName.Buffer);
6132
6133 if (InfoBuffer->Name.FullName.Buffer != NULL)
6134 midl_user_free(InfoBuffer->Name.FullName.Buffer);
6135
6136 midl_user_free(InfoBuffer);
6137 }
6138 }
6139
6140 return Status;
6141}
RPC_UNICODE_STRING FullName
Definition: sam.idl:597
RPC_UNICODE_STRING UserName
Definition: sam.idl:596
SAMPR_USER_NAME_INFORMATION Name
Definition: sam.idl:726

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserParameters()

static NTSTATUS SampQueryUserParameters ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6708 of file samrpc.c.

6710{
6711 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6713
6714 *Buffer = NULL;
6715
6716 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6717 if (InfoBuffer == NULL)
6719
6720 /* Get the Parameters string */
6722 L"Parameters",
6723 &InfoBuffer->Parameters.Parameters);
6724 if (!NT_SUCCESS(Status))
6725 {
6726 TRACE("Status 0x%08lx\n", Status);
6727 goto done;
6728 }
6729
6730 *Buffer = InfoBuffer;
6731
6732done:
6733 if (!NT_SUCCESS(Status))
6734 {
6735 if (InfoBuffer != NULL)
6736 {
6737 if (InfoBuffer->Parameters.Parameters.Buffer != NULL)
6739
6740 midl_user_free(InfoBuffer);
6741 }
6742 }
6743
6744 return Status;
6745}
RPC_UNICODE_STRING Parameters
Definition: sam.idl:537
SAMPR_USER_PARAMETERS_INFORMATION Parameters
Definition: sam.idl:740

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserPreferences()

static NTSTATUS SampQueryUserPreferences ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 5641 of file samrpc.c.

5643{
5644 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
5645 SAM_USER_FIXED_DATA FixedData;
5646 ULONG Length = 0;
5648
5649 *Buffer = NULL;
5650
5651 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
5652 if (InfoBuffer == NULL)
5654
5655 Length = sizeof(SAM_USER_FIXED_DATA);
5656 Status = SampGetObjectAttribute(UserObject,
5657 L"F",
5658 NULL,
5659 (PVOID)&FixedData,
5660 &Length);
5661 if (!NT_SUCCESS(Status))
5662 goto done;
5663
5664 InfoBuffer->Preferences.CountryCode = FixedData.CountryCode;
5665 InfoBuffer->Preferences.CodePage = FixedData.CodePage;
5666
5667 /* Get the UserComment string */
5669 L"UserComment",
5670 &InfoBuffer->Preferences.UserComment);
5671 if (!NT_SUCCESS(Status))
5672 {
5673 TRACE("Status 0x%08lx\n", Status);
5674 goto done;
5675 }
5676
5677 *Buffer = InfoBuffer;
5678
5679done:
5680 if (!NT_SUCCESS(Status))
5681 {
5682 if (InfoBuffer != NULL)
5683 {
5684 if (InfoBuffer->Preferences.UserComment.Buffer != NULL)
5686
5687 midl_user_free(InfoBuffer);
5688 }
5689 }
5690
5691 return Status;
5692}
RPC_UNICODE_STRING UserComment
Definition: sam.idl:529
SAMPR_USER_PREFERENCES_INFORMATION Preferences
Definition: sam.idl:722

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserPrimaryGroup()

static NTSTATUS SampQueryUserPrimaryGroup ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6228 of file samrpc.c.

6230{
6231 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6232 SAM_USER_FIXED_DATA FixedData;
6233 ULONG Length = 0;
6235
6236 *Buffer = NULL;
6237
6238 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6239 if (InfoBuffer == NULL)
6241
6242 Length = sizeof(SAM_USER_FIXED_DATA);
6243 Status = SampGetObjectAttribute(UserObject,
6244 L"F",
6245 NULL,
6246 (PVOID)&FixedData,
6247 &Length);
6248 if (!NT_SUCCESS(Status))
6249 goto done;
6250
6251 InfoBuffer->PrimaryGroup.PrimaryGroupId = FixedData.PrimaryGroupId;
6252
6253 *Buffer = InfoBuffer;
6254
6255done:
6256 if (!NT_SUCCESS(Status))
6257 {
6258 if (InfoBuffer != NULL)
6259 {
6260 midl_user_free(InfoBuffer);
6261 }
6262 }
6263
6264 return Status;
6265}
USER_PRIMARY_GROUP_INFORMATION PrimaryGroup
Definition: sam.idl:729

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserProfile()

static NTSTATUS SampQueryUserProfile ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6364 of file samrpc.c.

6366{
6367 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6369
6370 *Buffer = NULL;
6371
6372 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6373 if (InfoBuffer == NULL)
6375
6376 /* Get the ProfilePath string */
6378 L"ProfilePath",
6379 &InfoBuffer->Profile.ProfilePath);
6380 if (!NT_SUCCESS(Status))
6381 {
6382 TRACE("Status 0x%08lx\n", Status);
6383 goto done;
6384 }
6385
6386 *Buffer = InfoBuffer;
6387
6388done:
6389 if (!NT_SUCCESS(Status))
6390 {
6391 if (InfoBuffer != NULL)
6392 {
6393 if (InfoBuffer->Profile.ProfilePath.Buffer != NULL)
6395
6396 midl_user_free(InfoBuffer);
6397 }
6398 }
6399
6400 return Status;
6401}
RPC_UNICODE_STRING ProfilePath
Definition: sam.idl:613
SAMPR_USER_PROFILE_INFORMATION Profile
Definition: sam.idl:732

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserScript()

static NTSTATUS SampQueryUserScript ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6323 of file samrpc.c.

6325{
6326 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6328
6329 *Buffer = NULL;
6330
6331 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6332 if (InfoBuffer == NULL)
6334
6335 /* Get the ScriptPath string */
6337 L"ScriptPath",
6338 &InfoBuffer->Script.ScriptPath);
6339 if (!NT_SUCCESS(Status))
6340 {
6341 TRACE("Status 0x%08lx\n", Status);
6342 goto done;
6343 }
6344
6345 *Buffer = InfoBuffer;
6346
6347done:
6348 if (!NT_SUCCESS(Status))
6349 {
6350 if (InfoBuffer != NULL)
6351 {
6352 if (InfoBuffer->Script.ScriptPath.Buffer != NULL)
6354
6355 midl_user_free(InfoBuffer);
6356 }
6357 }
6358
6359 return Status;
6360}
RPC_UNICODE_STRING ScriptPath
Definition: sam.idl:608
SAMPR_USER_SCRIPT_INFORMATION Script
Definition: sam.idl:731

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserWorkStations()

static NTSTATUS SampQueryUserWorkStations ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6446 of file samrpc.c.

6448{
6449 PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6451
6452 *Buffer = NULL;
6453
6454 InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6455 if (InfoBuffer == NULL)
6457
6458 /* Get the WorkStations string */
6460 L"WorkStations",
6461 &InfoBuffer->WorkStations.WorkStations);
6462 if (!NT_SUCCESS(Status))
6463 {
6464 TRACE("Status 0x%08lx\n", Status);
6465 goto done;
6466 }
6467
6468 *Buffer = InfoBuffer;
6469
6470done:
6471 if (!NT_SUCCESS(Status))
6472 {
6473 if (InfoBuffer != NULL)
6474 {
6475 if (InfoBuffer->WorkStations.WorkStations.Buffer != NULL)
6477
6478 midl_user_free(InfoBuffer);
6479 }
6480 }
6481
6482 return Status;
6483}
RPC_UNICODE_STRING WorkStations
Definition: sam.idl:623
SAMPR_USER_WORKSTATIONS_INFORMATION WorkStations
Definition: sam.idl:734

Referenced by SamrQueryInformationUser2().

◆ SAMPR_HANDLE_rundown()

void __RPC_USER SAMPR_HANDLE_rundown ( SAMPR_HANDLE  hHandle)

Definition at line 126 of file samrpc.c.

127{
128 FIXME("SAMPR_HANDLE_rundown(%p)\n", hHandle);
129}
#define FIXME(fmt,...)
Definition: debug.h:111

◆ SampSetAliasName()

static NTSTATUS SampSetAliasName ( PSAM_DB_OBJECT  AliasObject,
PSAMPR_ALIAS_INFO_BUFFER  Buffer 
)
static

Definition at line 5095 of file samrpc.c.

5097{
5098 UNICODE_STRING OldAliasName = {0, 0, NULL};
5099 UNICODE_STRING NewAliasName;
5101
5103 L"Name",
5104 (PRPC_UNICODE_STRING)&OldAliasName);
5105 if (!NT_SUCCESS(Status))
5106 {
5107 TRACE("SampGetObjectAttributeString failed (Status 0x%08lx)\n", Status);
5108 goto done;
5109 }
5110
5111 /* Check the new account name */
5112 Status = SampCheckAccountName(&Buffer->Name.Name, 256);
5113 if (!NT_SUCCESS(Status))
5114 {
5115 TRACE("SampCheckAccountName failed (Status 0x%08lx)\n", Status);
5116 return Status;
5117 }
5118
5119 NewAliasName.Length = Buffer->Name.Name.Length;
5120 NewAliasName.MaximumLength = Buffer->Name.Name.MaximumLength;
5121 NewAliasName.Buffer = Buffer->Name.Name.Buffer;
5122
5123 if (!RtlEqualUnicodeString(&OldAliasName, &NewAliasName, TRUE))
5124 {
5126 NewAliasName.Buffer);
5127 if (!NT_SUCCESS(Status))
5128 {
5129 TRACE("Alias name \'%S\' already exists in domain (Status 0x%08lx)\n",
5130 NewAliasName.Buffer, Status);
5131 goto done;
5132 }
5133 }
5134
5136 L"Aliases",
5137 NewAliasName.Buffer,
5138 AliasObject->RelativeId);
5139 if (!NT_SUCCESS(Status))
5140 {
5141 TRACE("SampSetAccountNameInDomain failed (Status 0x%08lx)\n", Status);
5142 goto done;
5143 }
5144
5146 L"Aliases",
5147 OldAliasName.Buffer);
5148 if (!NT_SUCCESS(Status))
5149 {
5150 TRACE("SampRemoveAccountNameFromDomain failed (Status 0x%08lx)\n", Status);
5151 goto done;
5152 }
5153
5155 L"Name",
5156 (PRPC_UNICODE_STRING)&NewAliasName);
5157 if (!NT_SUCCESS(Status))
5158 {
5159 TRACE("SampSetObjectAttribute failed (Status 0x%08lx)\n", Status);
5160 }
5161
5162done:
5163 if (OldAliasName.Buffer != NULL)
5164 midl_user_free(OldAliasName.Buffer);
5165
5166 return Status;
5167}
NTSTATUS SampSetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:595
NTSTATUS SampSetAccountNameInDomain(IN PSAM_DB_OBJECT DomainObject, IN LPCWSTR lpContainerName, IN LPCWSTR lpAccountName, IN ULONG ulRelativeId)
Definition: domain.c:14
NTSTATUS SampRemoveAccountNameFromDomain(IN PSAM_DB_OBJECT DomainObject, IN LPCWSTR lpContainerName, IN LPCWSTR lpAccountName)
Definition: domain.c:57
NTSTATUS SampCheckAccountNameInDomain(IN PSAM_DB_OBJECT DomainObject, IN LPCWSTR lpAccountName)
Definition: domain.c:96
NTSTATUS SampCheckAccountName(IN PRPC_UNICODE_STRING AccountName, IN USHORT MaxLength)
Definition: utils.c:154
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
ULONG RelativeId
Definition: samsrv.h:54
USHORT MaximumLength
Definition: env_spec_w32.h:370

Referenced by SamrSetInformationAlias().

◆ SampSetDomainLockout()

static NTSTATUS SampSetDomainLockout ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER  Buffer 
)
static

Definition at line 1756 of file samrpc.c.

1758{
1759 SAM_DOMAIN_FIXED_DATA FixedData;
1760 ULONG Length = 0;
1762
1763 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1764 Status = SampGetObjectAttribute(DomainObject,
1765 L"F",
1766 NULL,
1767 (PVOID)&FixedData,
1768 &Length);
1769 if (!NT_SUCCESS(Status))
1770 goto done;
1771
1772 FixedData.LockoutDuration = Buffer->Lockout.LockoutDuration;
1773 FixedData.LockoutObservationWindow = Buffer->Lockout.LockoutObservationWindow;
1774 FixedData.LockoutThreshold = Buffer->Lockout.LockoutThreshold;
1775
1776 Status = SampSetObjectAttribute(DomainObject,
1777 L"F",
1778 REG_BINARY,
1779 &FixedData,
1780 Length);
1781
1782done:
1783 return Status;
1784}
NTSTATUS SampSetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, ULONG AttributeType, LPVOID AttributeData, ULONG AttributeSize)
Definition: database.c:501
#define REG_BINARY
Definition: nt_native.h:1496

Referenced by SamrSetInformationDomain().

◆ SampSetDomainLogoff()

static NTSTATUS SampSetDomainLogoff ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER  Buffer 
)
static

Definition at line 1665 of file samrpc.c.

1667{
1668 SAM_DOMAIN_FIXED_DATA FixedData;
1669 ULONG Length = 0;
1671
1672 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1673 Status = SampGetObjectAttribute(DomainObject,
1674 L"F",
1675 NULL,
1676 (PVOID)&FixedData,
1677 &Length);
1678 if (!NT_SUCCESS(Status))
1679 goto done;
1680
1681 FixedData.ForceLogoff.LowPart = Buffer->Logoff.ForceLogoff.LowPart;
1682 FixedData.ForceLogoff.HighPart = Buffer->Logoff.ForceLogoff.HighPart;
1683
1684 Status = SampSetObjectAttribute(DomainObject,
1685 L"F",
1686 REG_BINARY,
1687 &FixedData,
1688 Length);
1689
1690done:
1691 return Status;
1692}

Referenced by SamrSetInformationDomain().

◆ SampSetDomainPassword()

static NTSTATUS SampSetDomainPassword ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER  Buffer 
)
static

Definition at line 1629 of file samrpc.c.

1631{
1632 SAM_DOMAIN_FIXED_DATA FixedData;
1633 ULONG Length = 0;
1635
1636 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1637 Status = SampGetObjectAttribute(DomainObject,
1638 L"F",
1639 NULL,
1640 (PVOID)&FixedData,
1641 &Length);
1642 if (!NT_SUCCESS(Status))
1643 goto done;
1644
1645 FixedData.MinPasswordLength = Buffer->Password.MinPasswordLength;
1646 FixedData.PasswordHistoryLength = Buffer->Password.PasswordHistoryLength;
1647 FixedData.PasswordProperties = Buffer->Password.PasswordProperties;
1648 FixedData.MaxPasswordAge.LowPart = Buffer->Password.MaxPasswordAge.LowPart;
1649 FixedData.MaxPasswordAge.HighPart = Buffer->Password.MaxPasswordAge.HighPart;
1650 FixedData.MinPasswordAge.LowPart = Buffer->Password.MinPasswordAge.LowPart;
1651 FixedData.MinPasswordAge.HighPart = Buffer->Password.MinPasswordAge.HighPart;
1652
1653 Status = SampSetObjectAttribute(DomainObject,
1654 L"F",
1655 REG_BINARY,
1656 &FixedData,
1657 Length);
1658
1659done:
1660 return Status;
1661}

Referenced by SamrSetInformationDomain().

◆ SampSetDomainServerRole()

static NTSTATUS SampSetDomainServerRole ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER  Buffer 
)
static

Definition at line 1696 of file samrpc.c.

1698{
1699 SAM_DOMAIN_FIXED_DATA FixedData;
1700 ULONG Length = 0;
1702
1703 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1704 Status = SampGetObjectAttribute(DomainObject,
1705 L"F",
1706 NULL,
1707 (PVOID)&FixedData,
1708 &Length);
1709 if (!NT_SUCCESS(Status))
1710 goto done;
1711
1712 FixedData.DomainServerRole = Buffer->Role.DomainServerRole;
1713
1714 Status = SampSetObjectAttribute(DomainObject,
1715 L"F",
1716 REG_BINARY,
1717 &FixedData,
1718 Length);
1719
1720done:
1721 return Status;
1722}

Referenced by SamrSetInformationDomain().

◆ SampSetDomainState()

static NTSTATUS SampSetDomainState ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER  Buffer 
)
static

Definition at line 1726 of file samrpc.c.

1728{
1729 SAM_DOMAIN_FIXED_DATA FixedData;
1730 ULONG Length = 0;
1732
1733 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1734 Status = SampGetObjectAttribute(DomainObject,
1735 L"F",
1736 NULL,
1737 (PVOID)&FixedData,
1738 &Length);
1739 if (!NT_SUCCESS(Status))
1740 goto done;
1741
1742 FixedData.DomainServerState = Buffer->State.DomainServerState;
1743
1744 Status = SampSetObjectAttribute(DomainObject,
1745 L"F",
1746 REG_BINARY,
1747 &FixedData,
1748 Length);
1749
1750done:
1751 return Status;
1752}

Referenced by SamrSetInformationDomain().

◆ SampSetGroupAttribute()

static NTSTATUS SampSetGroupAttribute ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER  Buffer 
)
static

Definition at line 4384 of file samrpc.c.

4386{
4387 SAM_GROUP_FIXED_DATA FixedData;
4388 ULONG Length = 0;
4390
4391 Length = sizeof(SAM_GROUP_FIXED_DATA);
4392 Status = SampGetObjectAttribute(GroupObject,
4393 L"F",
4394 NULL,
4395 (PVOID)&FixedData,
4396 &Length);
4397 if (!NT_SUCCESS(Status))
4398 goto done;
4399
4400 FixedData.Attributes = Buffer->Attribute.Attributes;
4401
4402 Status = SampSetObjectAttribute(GroupObject,
4403 L"F",
4404 REG_BINARY,
4405 &FixedData,
4406 Length);
4407
4408done:
4409 return Status;
4410}

Referenced by SamrSetInformationGroup().

◆ SampSetGroupName()

static NTSTATUS SampSetGroupName ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER  Buffer 
)
static

Definition at line 4308 of file samrpc.c.

4310{
4311 UNICODE_STRING OldGroupName = {0, 0, NULL};
4312 UNICODE_STRING NewGroupName;
4314
4316 L"Name",
4317 (PRPC_UNICODE_STRING)&OldGroupName);
4318 if (!NT_SUCCESS(Status))
4319 {
4320 TRACE("SampGetObjectAttributeString failed (Status 0x%08lx)\n", Status);
4321 goto done;
4322 }
4323
4324 /* Check the new account name */
4325 Status = SampCheckAccountName(&Buffer->Name.Name, 256);
4326 if (!NT_SUCCESS(Status))
4327 {
4328 TRACE("SampCheckAccountName failed (Status 0x%08lx)\n", Status);
4329 return Status;
4330 }
4331
4332 NewGroupName.Length = Buffer->Name.Name.Length;
4333 NewGroupName.MaximumLength = Buffer->Name.Name.MaximumLength;
4334 NewGroupName.Buffer = Buffer->Name.Name.Buffer;
4335
4336 if (!RtlEqualUnicodeString(&OldGroupName, &NewGroupName, TRUE))
4337 {
4339 NewGroupName.Buffer);
4340 if (!NT_SUCCESS(Status))
4341 {
4342 TRACE("Group name \'%S\' already exists in domain (Status 0x%08lx)\n",
4343 NewGroupName.Buffer, Status);
4344 goto done;
4345 }
4346 }
4347
4349 L"Groups",
4350 NewGroupName.Buffer,
4351 GroupObject->RelativeId);
4352 if (!NT_SUCCESS(Status))
4353 {
4354 TRACE("SampSetAccountNameInDomain failed (Status 0x%08lx)\n", Status);
4355 goto done;
4356 }
4357
4359 L"Groups",
4360 OldGroupName.Buffer);
4361 if (!NT_SUCCESS(Status))
4362 {
4363 TRACE("SampRemoveAccountNameFromDomain failed (Status 0x%08lx)\n", Status);
4364 goto done;
4365 }
4366
4368 L"Name",
4369 (PRPC_UNICODE_STRING)&NewGroupName);
4370 if (!NT_SUCCESS(Status))
4371 {
4372 TRACE("SampSetObjectAttribute failed (Status 0x%08lx)\n", Status);
4373 }
4374
4375done:
4376 if (OldGroupName.Buffer != NULL)
4377 midl_user_free(OldGroupName.Buffer);
4378
4379 return Status;
4380}

Referenced by SamrSetInformationGroup().

◆ SampSetUserAll()

static NTSTATUS SampSetUserAll ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER  Buffer 
)
static

Definition at line 7608 of file samrpc.c.

7610{
7611 SAM_USER_FIXED_DATA FixedData;
7612 ULONG Length = 0;
7613 ULONG WhichFields;
7614 PENCRYPTED_NT_OWF_PASSWORD NtPassword = NULL;
7615 PENCRYPTED_LM_OWF_PASSWORD LmPassword = NULL;
7616 BOOLEAN NtPasswordPresent = FALSE;
7617 BOOLEAN LmPasswordPresent = FALSE;
7618 BOOLEAN WriteFixedData = FALSE;
7620
7621 WhichFields = Buffer->All.WhichFields;
7622
7623 /* Get the fixed size attributes */
7624 Length = sizeof(SAM_USER_FIXED_DATA);
7625 Status = SampGetObjectAttribute(UserObject,
7626 L"F",
7627 NULL,
7628 (PVOID)&FixedData,
7629 &Length);
7630 if (!NT_SUCCESS(Status))
7631 goto done;
7632
7633 if (WhichFields & USER_ALL_USERNAME)
7634 {
7635 Status = SampSetUserName(UserObject,
7636 &Buffer->All.UserName);
7637 if (!NT_SUCCESS(Status))
7638 goto done;
7639 }
7640
7641 if (WhichFields & USER_ALL_FULLNAME)
7642 {
7644 L"FullName",
7645 &Buffer->All.FullName);
7646 if (!NT_SUCCESS(Status))
7647 goto done;
7648 }
7649
7650 if (WhichFields & USER_ALL_ADMINCOMMENT)
7651 {
7653 L"AdminComment",
7654 &Buffer->All.AdminComment);
7655 if (!NT_SUCCESS(Status))
7656 goto done;
7657 }
7658
7659 if (WhichFields & USER_ALL_USERCOMMENT)
7660 {
7662 L"UserComment",
7663 &Buffer->All.UserComment);
7664 if (!NT_SUCCESS(Status))
7665 goto done;
7666 }
7667
7668 if (WhichFields & USER_ALL_HOMEDIRECTORY)
7669 {
7671 L"HomeDirectory",
7672 &Buffer->All.HomeDirectory);
7673 if (!NT_SUCCESS(Status))
7674 goto done;
7675 }
7676
7677 if (WhichFields & USER_ALL_HOMEDIRECTORYDRIVE)
7678 {
7680 L"HomeDirectoryDrive",
7681 &Buffer->All.HomeDirectoryDrive);
7682 if (!NT_SUCCESS(Status))
7683 goto done;
7684 }
7685
7686 if (WhichFields & USER_ALL_SCRIPTPATH)
7687 {
7689 L"ScriptPath",
7690 &Buffer->All.ScriptPath);
7691 if (!NT_SUCCESS(Status))
7692 goto done;
7693 }
7694
7695 if (WhichFields & USER_ALL_PROFILEPATH)
7696 {
7698 L"ProfilePath",
7699 &Buffer->All.ProfilePath);
7700 if (!NT_SUCCESS(Status))
7701 goto done;
7702 }
7703
7704 if (WhichFields & USER_ALL_WORKSTATIONS)
7705 {
7707 L"WorkStations",
7708 &Buffer->All.WorkStations);
7709 if (!NT_SUCCESS(Status))
7710 goto done;
7711 }
7712
7713 if (WhichFields & USER_ALL_PARAMETERS)
7714 {
7716 L"Parameters",
7717 &Buffer->All.Parameters);
7718 if (!NT_SUCCESS(Status))
7719 goto done;
7720 }
7721
7722 if (WhichFields & USER_ALL_LOGONHOURS)
7723 {
7725 &Buffer->All.LogonHours);
7726 if (!NT_SUCCESS(Status))
7727 goto done;
7728 }
7729
7730 if (WhichFields & USER_ALL_PRIMARYGROUPID)
7731 {
7732 FixedData.PrimaryGroupId = Buffer->All.PrimaryGroupId;
7733 WriteFixedData = TRUE;
7734 }
7735
7736 if (WhichFields & USER_ALL_ACCOUNTEXPIRES)
7737 {
7738 FixedData.AccountExpires.LowPart = Buffer->All.AccountExpires.LowPart;
7739 FixedData.AccountExpires.HighPart = Buffer->All.AccountExpires.HighPart;
7740 WriteFixedData = TRUE;
7741 }
7742
7743 if (WhichFields & USER_ALL_USERACCOUNTCONTROL)
7744 {
7745 FixedData.UserAccountControl = Buffer->All.UserAccountControl;
7746 WriteFixedData = TRUE;
7747 }
7748
7749 if (WhichFields & USER_ALL_COUNTRYCODE)
7750 {
7751 FixedData.CountryCode = Buffer->All.CountryCode;
7752 WriteFixedData = TRUE;
7753 }
7754
7755 if (WhichFields & USER_ALL_CODEPAGE)
7756 {
7757 FixedData.CodePage = Buffer->All.CodePage;
7758 WriteFixedData = TRUE;
7759 }
7760
7761 if (WhichFields & (USER_ALL_NTPASSWORDPRESENT |
7763 {
7764 if (WhichFields & USER_ALL_NTPASSWORDPRESENT)
7765 {
7766 NtPassword = (PENCRYPTED_NT_OWF_PASSWORD)Buffer->All.NtOwfPassword.Buffer;
7767 NtPasswordPresent = Buffer->All.NtPasswordPresent;
7768 }
7769
7770 if (WhichFields & USER_ALL_LMPASSWORDPRESENT)
7771 {
7772 LmPassword = (PENCRYPTED_LM_OWF_PASSWORD)Buffer->All.LmOwfPassword.Buffer;
7773 LmPasswordPresent = Buffer->All.LmPasswordPresent;
7774 }
7775
7776 Status = SampSetUserPassword(UserObject,
7777 NtPassword,
7778 NtPasswordPresent,
7779 LmPassword,
7780 LmPasswordPresent);
7781 if (!NT_SUCCESS(Status))
7782 goto done;
7783
7784 /* The password has just been set */
7786 if (!NT_SUCCESS(Status))
7787 goto done;
7788
7789 WriteFixedData = TRUE;
7790 }
7791
7792 if (WhichFields & USER_ALL_PRIVATEDATA)
7793 {
7795 L"PrivateData",
7796 &Buffer->All.PrivateData);
7797 if (!NT_SUCCESS(Status))
7798 goto done;
7799 }
7800
7801 if (WhichFields & USER_ALL_PASSWORDEXPIRED)
7802 {
7803 if (Buffer->All.PasswordExpired)
7804 {
7805 /* The password was last set ages ago */
7806 FixedData.PasswordLastSet.LowPart = 0;
7807 FixedData.PasswordLastSet.HighPart = 0;
7808 }
7809 else
7810 {
7811 /* The password was last set right now */
7813 if (!NT_SUCCESS(Status))
7814 goto done;
7815 }
7816
7817 WriteFixedData = TRUE;
7818 }
7819
7820 if (WhichFields & USER_ALL_SECURITYDESCRIPTOR)
7821 {
7822 Status = SampSetObjectAttribute(UserObject,
7823 L"SecDesc",
7824 REG_BINARY,
7825 Buffer->All.SecurityDescriptor.SecurityDescriptor,
7826 Buffer->All.SecurityDescriptor.Length);
7827 }
7828
7829 if (WriteFixedData != FALSE)
7830 {
7831 Status = SampSetObjectAttribute(UserObject,
7832 L"F",
7833 REG_BINARY,
7834 &FixedData,
7835 Length);
7836 if (!NT_SUCCESS(Status))
7837 goto done;
7838 }
7839
7840done:
7841 return Status;
7842}
unsigned char BOOLEAN
NTSTATUS SampSetLogonHoursAttribute(IN PSAM_DB_OBJECT UserObject, IN PSAMPR_LOGON_HOURS LogonHours)
Definition: user.c:689
NTSTATUS SampSetUserPassword(IN PSAM_DB_OBJECT UserObject, IN PENCRYPTED_NT_OWF_PASSWORD NtPassword, IN BOOLEAN NtPasswordPresent, IN PENCRYPTED_LM_OWF_PASSWORD LmPassword, IN BOOLEAN LmPasswordPresent)
Definition: user.c:399
struct _ENCRYPTED_LM_OWF_PASSWORD * PENCRYPTED_NT_OWF_PASSWORD
struct _ENCRYPTED_LM_OWF_PASSWORD * PENCRYPTED_LM_OWF_PASSWORD
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
Definition: time.c:483
static NTSTATUS SampSetUserName(PSAM_DB_OBJECT UserObject, PRPC_UNICODE_STRING NewUserName)
Definition: samrpc.c:7248

Referenced by SamrSetInformationUser2().

◆ SampSetUserControl()

static NTSTATUS SampSetUserControl ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER  Buffer 
)
static

Definition at line 7439 of file samrpc.c.

7441{
7442 SAM_USER_FIXED_DATA FixedData;
7443 ULONG Length = 0;
7445
7446 Length = sizeof(SAM_USER_FIXED_DATA);
7447 Status = SampGetObjectAttribute(UserObject,
7448 L"F",
7449 NULL,
7450 (PVOID)&FixedData,
7451 &Length);
7452 if (!NT_SUCCESS(Status))
7453 goto done;
7454
7455 FixedData.UserAccountControl = Buffer->Control.UserAccountControl;
7456
7457 Status = SampSetObjectAttribute(UserObject,
7458 L"F",
7459 REG_BINARY,
7460 &FixedData,
7461 Length);
7462
7463done:
7464 return Status;
7465}

Referenced by SamrSetInformationUser2().

◆ SampSetUserExpires()

static NTSTATUS SampSetUserExpires ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER  Buffer 
)
static

Definition at line 7469 of file samrpc.c.

7471{
7472 SAM_USER_FIXED_DATA FixedData;
7473 ULONG Length = 0;
7475
7476 Length = sizeof(SAM_USER_FIXED_DATA);
7477 Status = SampGetObjectAttribute(UserObject,
7478 L"F",
7479 NULL,
7480 (PVOID)&FixedData,
7481 &Length);
7482 if (!NT_SUCCESS(Status))
7483 goto done;
7484
7485 FixedData.AccountExpires.LowPart = Buffer->Expires.AccountExpires.LowPart;
7486 FixedData.AccountExpires.HighPart = Buffer->Expires.AccountExpires.HighPart;
7487
7488 Status = SampSetObjectAttribute(UserObject,
7489 L"F",
7490 REG_BINARY,
7491 &FixedData,
7492 Length);
7493
7494done:
7495 return Status;
7496}

Referenced by SamrSetInformationUser2().

◆ SampSetUserGeneral()

static NTSTATUS SampSetUserGeneral ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER  Buffer 
)
static

Definition at line 7319 of file samrpc.c.

7321{
7322 SAM_USER_FIXED_DATA FixedData;
7323 ULONG Length = 0;
7325
7326 Length = sizeof(SAM_USER_FIXED_DATA);
7327 Status = SampGetObjectAttribute(UserObject,
7328 L"F",
7329 NULL,
7330 (PVOID)&FixedData,
7331 &Length);
7332 if (!NT_SUCCESS(Status))
7333 goto done;
7334
7335 FixedData.PrimaryGroupId = Buffer->General.PrimaryGroupId;
7336
7337 Status = SampSetObjectAttribute(UserObject,
7338 L"F",
7339 REG_BINARY,
7340 &FixedData,
7341 Length);
7342 if (!NT_SUCCESS(Status))
7343 goto done;
7344
7345 Status = SampSetUserName(UserObject,
7346 &Buffer->General.UserName);
7347 if (!NT_SUCCESS(Status))
7348 goto done;
7349
7351 L"FullName",
7352 &Buffer->General.FullName);
7353 if (!NT_SUCCESS(Status))
7354 goto done;
7355
7357 L"AdminComment",
7358 &Buffer->General.AdminComment);
7359 if (!NT_SUCCESS(Status))
7360 goto done;
7361
7363 L"UserComment",
7364 &Buffer->General.UserComment);
7365
7366done:
7367 return Status;
7368}

Referenced by SamrSetInformationUser2().

◆ SampSetUserInternal1()

static NTSTATUS SampSetUserInternal1 ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER  Buffer 
)
static

Definition at line 7500 of file samrpc.c.

7502{
7503 SAM_USER_FIXED_DATA FixedData;
7504 ULONG Length = 0;
7506
7507 /* FIXME: Decrypt NT password */
7508 /* FIXME: Decrypt LM password */
7509
7510 Status = SampSetUserPassword(UserObject,
7511 &Buffer->Internal1.EncryptedNtOwfPassword,
7512 Buffer->Internal1.NtPasswordPresent,
7513 &Buffer->Internal1.EncryptedLmOwfPassword,
7514 Buffer->Internal1.LmPasswordPresent);
7515 if (!NT_SUCCESS(Status))
7516 goto done;
7517
7518 /* Get the fixed user attributes */
7519 Length = sizeof(SAM_USER_FIXED_DATA);
7520 Status = SampGetObjectAttribute(UserObject,
7521 L"F",
7522 NULL,
7523 (PVOID)&FixedData,
7524 &Length);
7525 if (!NT_SUCCESS(Status))
7526 goto done;
7527
7528 if (Buffer->Internal1.PasswordExpired)
7529 {
7530 /* The password was last set ages ago */
7531 FixedData.PasswordLastSet.LowPart = 0;
7532 FixedData.PasswordLastSet.HighPart = 0;
7533 }
7534 else
7535 {
7536 /* The password was last set right now */
7538 if (!NT_SUCCESS(Status))
7539 goto done;
7540 }
7541
7542 /* Set the fixed user attributes */
7543 Status = SampSetObjectAttribute(UserObject,
7544 L"F",
7545 REG_BINARY,
7546 &FixedData,
7547 Length);
7548
7549done:
7550 return Status;
7551}

Referenced by SamrSetInformationUser2().

◆ SampSetUserInternal2()

static NTSTATUS SampSetUserInternal2 ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER  Buffer 
)
static

Definition at line 7555 of file samrpc.c.

7557{
7558 SAM_USER_FIXED_DATA FixedData;
7559 ULONG Length = 0;
7561
7562 /* Get the fixed user attributes */
7563 Length = sizeof(SAM_USER_FIXED_DATA);
7564 Status = SampGetObjectAttribute(UserObject,
7565 L"F",
7566 NULL,
7567 (PVOID)&FixedData,
7568 &Length);
7569 if (!NT_SUCCESS(Status))
7570 goto done;
7571
7572 if ((Buffer->Internal2.Flags & USER_LOGON_SUCCESS) &&
7573 ((Buffer->Internal2.Flags & ~USER_LOGON_SUCCESS) == 0))
7574 {
7575 /* Update the LastLogon time */
7576 Status = NtQuerySystemTime(&FixedData.LastLogon);
7577 if (!NT_SUCCESS(Status))
7578 goto done;
7579
7580 FixedData.LogonCount++;
7581 FixedData.BadPasswordCount = 0;
7582 }
7583
7584 if ((Buffer->Internal2.Flags & USER_LOGON_BAD_PASSWORD) &&
7585 ((Buffer->Internal2.Flags & ~USER_LOGON_BAD_PASSWORD) == 0))
7586 {
7587 /* Update the LastBadPasswordTime */
7589 if (!NT_SUCCESS(Status))
7590 goto done;
7591
7592 FixedData.BadPasswordCount++;
7593 }
7594
7595 /* Set the fixed user attributes */
7596 Status = SampSetObjectAttribute(UserObject,
7597 L"F",
7598 REG_BINARY,
7599 &FixedData,
7600 Length);
7601
7602done:
7603 return Status;
7604}
#define USER_LOGON_SUCCESS
Definition: sam.idl:649
#define USER_LOGON_BAD_PASSWORD
Definition: sam.idl:648
LARGE_INTEGER LastBadPasswordTime
Definition: samsrv.h:106

Referenced by SamrSetInformationUser2().

◆ SampSetUserName()

static NTSTATUS SampSetUserName ( PSAM_DB_OBJECT  UserObject,
PRPC_UNICODE_STRING  NewUserName 
)
static

Definition at line 7248 of file samrpc.c.

7250{
7251 UNICODE_STRING OldUserName = {0, 0, NULL};
7253
7254 /* Check the account name */
7255 Status = SampCheckAccountName(NewUserName, 20);
7256 if (!NT_SUCCESS(Status))
7257 {
7258 TRACE("SampCheckAccountName failed (Status 0x%08lx)\n", Status);
7259 return Status;
7260 }
7261
7263 L"Name",
7264 (PRPC_UNICODE_STRING)&OldUserName);
7265 if (!NT_SUCCESS(Status))
7266 {
7267 TRACE("SampGetObjectAttributeString failed (Status 0x%08lx)\n", Status);
7268 goto done;
7269 }
7270
7271 if (!RtlEqualUnicodeString(&OldUserName, (PCUNICODE_STRING)NewUserName, TRUE))
7272 {
7274 NewUserName->Buffer);
7275 if (!NT_SUCCESS(Status))
7276 {
7277 TRACE("User name \'%S\' already exists in domain (Status 0x%08lx)\n",
7278 NewUserName->Buffer, Status);
7279 goto done;
7280 }
7281 }
7282
7284 L"Users",
7285 NewUserName->Buffer,
7286 UserObject->RelativeId);
7287 if (!NT_SUCCESS(Status))
7288 {
7289 TRACE("SampSetAccountNameInDomain failed (Status 0x%08lx)\n", Status);
7290 goto done;
7291 }
7292
7294 L"Users",
7295 OldUserName.Buffer);
7296 if (!NT_SUCCESS(Status))
7297 {
7298 TRACE("SampRemoveAccountNameFromDomain failed (Status 0x%08lx)\n", Status);
7299 goto done;
7300 }
7301
7303 L"Name",
7304 NewUserName);
7305 if (!NT_SUCCESS(Status))
7306 {
7307 TRACE("SampSetObjectAttribute failed (Status 0x%08lx)\n", Status);
7308 }
7309
7310done:
7311 if (OldUserName.Buffer != NULL)
7312 midl_user_free(OldUserName.Buffer);
7313
7314 return Status;
7315}

Referenced by SampSetUserAll(), SampSetUserGeneral(), and SamrSetInformationUser2().

◆ SampSetUserPreferences()

static NTSTATUS SampSetUserPreferences ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER  Buffer 
)
static

Definition at line 7372 of file samrpc.c.

7374{
7375 SAM_USER_FIXED_DATA FixedData;
7376 ULONG Length = 0;
7378
7379 Length = sizeof(SAM_USER_FIXED_DATA);
7380 Status = SampGetObjectAttribute(UserObject,
7381 L"F",
7382 NULL,
7383 (PVOID)&FixedData,
7384 &Length);
7385 if (!NT_SUCCESS(Status))
7386 goto done;
7387
7388 FixedData.CountryCode = Buffer->Preferences.CountryCode;
7389 FixedData.CodePage = Buffer->Preferences.CodePage;
7390
7391 Status = SampSetObjectAttribute(UserObject,
7392 L"F",
7393 REG_BINARY,
7394 &FixedData,
7395 Length);
7396 if (!NT_SUCCESS(Status))
7397 goto done;
7398
7400 L"UserComment",
7401 &Buffer->Preferences.UserComment);
7402
7403done:
7404 return Status;
7405}

Referenced by SamrSetInformationUser2().

◆ SampSetUserPrimaryGroup()

static NTSTATUS SampSetUserPrimaryGroup ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER  Buffer 
)
static

Definition at line 7409 of file samrpc.c.

7411{
7412 SAM_USER_FIXED_DATA FixedData;
7413 ULONG Length = 0;
7415
7416 Length = sizeof(SAM_USER_FIXED_DATA);
7417 Status = SampGetObjectAttribute(UserObject,
7418 L"F",
7419 NULL,
7420 (PVOID)&FixedData,
7421 &Length);
7422 if (!NT_SUCCESS(Status))
7423 goto done;
7424
7425 FixedData.PrimaryGroupId = Buffer->PrimaryGroup.PrimaryGroupId;
7426
7427 Status = SampSetObjectAttribute(UserObject,
7428 L"F",
7429 REG_BINARY,
7430 &FixedData,
7431 Length);
7432
7433done:
7434 return Status;
7435}

Referenced by SamrSetInformationUser2().

◆ SampStartRpcServer()

VOID SampStartRpcServer ( VOID  )

Definition at line 78 of file samrpc.c.

79{
81
82 TRACE("SampStartRpcServer() called\n");
83
86 L"\\pipe\\samr",
87 NULL);
88 if (Status != RPC_S_OK)
89 {
90 WARN("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
91 return;
92 }
93
94 Status = RpcServerRegisterIf(samr_v1_0_s_ifspec,
95 NULL,
96 NULL);
97 if (Status != RPC_S_OK)
98 {
99 WARN("RpcServerRegisterIf() failed (Status %lx)\n", Status);
100 return;
101 }
102
103 Status = RpcServerListen(1, 20, TRUE);
104 if (Status != RPC_S_OK)
105 {
106 WARN("RpcServerListen() failed (Status %lx)\n", Status);
107 return;
108 }
109
110 TRACE("SampStartRpcServer() done\n");
111}
#define WARN(fmt,...)
Definition: debug.h:112
RPC_STATUS WINAPI RpcServerListen(UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait)
Definition: rpc_server.c:1520
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
Definition: rpc_server.c:1116
RPC_STATUS WINAPI RpcServerUseProtseqEpW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:927
#define RPC_C_PROTSEQ_MAX_REQS_DEFAULT
Definition: rpcdce.h:123
#define RPC_S_OK
Definition: rpcnterr.h:22
long RPC_STATUS
Definition: rpc.h:52

Referenced by SamIInitialize().

◆ SamrAddMemberToAlias()

NTSTATUS NTAPI SamrAddMemberToAlias ( IN SAMPR_HANDLE  AliasHandle,
IN PRPC_SID  MemberId 
)

Definition at line 5280 of file samrpc.c.

5282{
5283 PSAM_DB_OBJECT AliasObject;
5285
5286 TRACE("SamrAddMemberToAlias(%p %p)\n",
5287 AliasHandle, MemberId);
5288
5290 TRUE);
5291
5292 /* Validate the alias handle */
5293 Status = SampValidateDbObject(AliasHandle,
5296 &AliasObject);
5297 if (!NT_SUCCESS(Status))
5298 {
5299 TRACE("failed with status 0x%08lx\n", Status);
5300 goto done;
5301 }
5302
5303 Status = SampAddMemberToAlias(AliasObject,
5304 MemberId);
5305 if (!NT_SUCCESS(Status))
5306 {
5307 TRACE("failed with status 0x%08lx\n", Status);
5308 }
5309
5310done:
5312
5313 return Status;
5314}
NTSTATUS SampAddMemberToAlias(IN PSAM_DB_OBJECT AliasObject, IN PRPC_SID MemberId)
Definition: alias.c:39
NTSTATUS SampValidateDbObject(SAMPR_HANDLE Handle, SAM_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PSAM_DB_OBJECT *DbObject)
Definition: database.c:301
@ SamDbAliasObject
Definition: samsrv.h:40
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
#define ALIAS_ADD_MEMBER
Definition: ntsam.h:9
RTL_RESOURCE SampResource
Definition: samsrv.c:28

Referenced by SamAddMemberToAlias(), and SamrAddMultipleMembersToAlias().

◆ SamrAddMemberToGroup()

NTSTATUS NTAPI SamrAddMemberToGroup ( IN SAMPR_HANDLE  GroupHandle,
IN unsigned long  MemberId,
IN unsigned long  Attributes 
)

Definition at line 4470 of file samrpc.c.

4473{
4474 PSAM_DB_OBJECT GroupObject;
4475 PSAM_DB_OBJECT UserObject = NULL;
4477
4478 TRACE("SamrAddMemberToGroup(%p %lu %lx)\n",
4479 GroupHandle, MemberId, Attributes);
4480
4482 TRUE);
4483
4484 /* Validate the group handle */
4485 Status = SampValidateDbObject(GroupHandle,
4488 &GroupObject);
4489 if (!NT_SUCCESS(Status))
4490 goto done;
4491
4492 /* Open the user object in the same domain */
4493 Status = SampOpenUserObject(GroupObject->ParentObject,
4494 MemberId,
4495 0,
4496 &UserObject);
4497 if (!NT_SUCCESS(Status))
4498 {
4499 TRACE("SampOpenUserObject() failed (Status 0x%08lx)\n", Status);
4500 goto done;
4501 }
4502
4503 /* Add group membership to the user object */
4505 GroupObject->RelativeId,
4506 Attributes);
4507 if (!NT_SUCCESS(Status))
4508 {
4509 TRACE("SampAddGroupMembershipToUser() failed (Status 0x%08lx)\n", Status);
4510 goto done;
4511 }
4512
4513 /* Add the member to the group object */
4514 Status = SampAddMemberToGroup(GroupObject,
4515 MemberId);
4516 if (!NT_SUCCESS(Status))
4517 {
4518 TRACE("SampAddMemberToGroup() failed (Status 0x%08lx)\n", Status);
4519 }
4520
4521done:
4522 if (UserObject)
4523 SampCloseDbObject(UserObject);
4524
4526
4527 return Status;
4528}
NTSTATUS SampCloseDbObject(PSAM_DB_OBJECT DbObject)
Definition: database.c:346
NTSTATUS SampAddMemberToGroup(IN PSAM_DB_OBJECT GroupObject, IN ULONG MemberId)
Definition: group.c:39
NTSTATUS SampAddGroupMembershipToUser(IN PSAM_DB_OBJECT UserObject, IN ULONG GroupId, IN ULONG Attributes)
Definition: user.c:39
NTSTATUS SampOpenUserObject(IN PSAM_DB_OBJECT DomainObject, IN ULONG UserId, IN ACCESS_MASK DesiredAccess, OUT PSAM_DB_OBJECT *UserObject)
Definition: user.c:14
@ SamDbGroupObject
Definition: samsrv.h:41
#define GROUP_ADD_MEMBER
Definition: ntsam.h:77
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes

Referenced by SamAddMemberToGroup().

◆ SamrAddMultipleMembersToAlias()

NTSTATUS NTAPI SamrAddMultipleMembersToAlias ( IN SAMPR_HANDLE  AliasHandle,
IN PSAMPR_PSID_ARRAY  MembersBuffer 
)

Definition at line 9292 of file samrpc.c.

9294{
9295 ULONG i;
9297
9298 TRACE("SamrAddMultipleMembersToAlias(%p %p)\n",
9299 AliasHandle, MembersBuffer);
9300
9301 for (i = 0; i < MembersBuffer->Count; i++)
9302 {
9303 Status = SamrAddMemberToAlias(AliasHandle,
9304 ((PSID *)MembersBuffer->Sids)[i]);
9305
9308
9309 if (!NT_SUCCESS(Status))
9310 break;
9311 }
9312
9313 return Status;
9314}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define STATUS_MEMBER_IN_ALIAS
Definition: ntstatus.h:575
NTSTATUS NTAPI SamrAddMemberToAlias(IN SAMPR_HANDLE AliasHandle, IN PRPC_SID MemberId)
Definition: samrpc.c:5280

Referenced by SamAddMultipleMembersToAlias().

◆ SamrChangePasswordUser()

NTSTATUS NTAPI SamrChangePasswordUser ( IN SAMPR_HANDLE  UserHandle,
IN unsigned char  LmPresent,
IN PENCRYPTED_LM_OWF_PASSWORD  OldLmEncryptedWithNewLm,
IN PENCRYPTED_LM_OWF_PASSWORD  NewLmEncryptedWithOldLm,
IN unsigned char  NtPresent,
IN PENCRYPTED_NT_OWF_PASSWORD  OldNtEncryptedWithNewNt,
IN PENCRYPTED_NT_OWF_PASSWORD  NewNtEncryptedWithOldNt,
IN unsigned char  NtCrossEncryptionPresent,
IN PENCRYPTED_NT_OWF_PASSWORD  NewNtEncryptedWithNewLm,
IN unsigned char  LmCrossEncryptionPresent,
IN PENCRYPTED_LM_OWF_PASSWORD  NewLmEncryptedWithNewNt 
)

Definition at line 7864 of file samrpc.c.

7875{
7876 ENCRYPTED_LM_OWF_PASSWORD StoredLmPassword;
7877 ENCRYPTED_NT_OWF_PASSWORD StoredNtPassword;
7878 LM_OWF_PASSWORD OldLmPassword;
7879 LM_OWF_PASSWORD NewLmPassword;
7880 NT_OWF_PASSWORD OldNtPassword;
7881 NT_OWF_PASSWORD NewNtPassword;
7882 BOOLEAN StoredLmPresent = FALSE;
7883 BOOLEAN StoredNtPresent = FALSE;
7884 BOOLEAN StoredLmEmpty = TRUE;
7885 BOOLEAN StoredNtEmpty = TRUE;
7886 PSAM_DB_OBJECT UserObject;
7887 ULONG Length;
7888 SAM_USER_FIXED_DATA UserFixedData;
7889 SAM_DOMAIN_FIXED_DATA DomainFixedData;
7890 LARGE_INTEGER SystemTime;
7892
7893 DBG_UNREFERENCED_LOCAL_VARIABLE(StoredLmPresent);
7894 DBG_UNREFERENCED_LOCAL_VARIABLE(StoredNtPresent);
7895 DBG_UNREFERENCED_LOCAL_VARIABLE(StoredLmEmpty);
7896
7897 TRACE("SamrChangePasswordUser(%p %u %p %p %u %p %p %u %p %u %p)\n",
7898 UserHandle, LmPresent, OldLmEncryptedWithNewLm, NewLmEncryptedWithOldLm,
7899 NtPresent, OldNtEncryptedWithNewNt, NewNtEncryptedWithOldNt, NtCrossEncryptionPresent,
7900 NewNtEncryptedWithNewLm, LmCrossEncryptionPresent, NewLmEncryptedWithNewNt);
7901
7903 TRUE);
7904
7905 /* Validate the user handle */
7906 Status = SampValidateDbObject(UserHandle,
7909 &UserObject);
7910 if (!NT_SUCCESS(Status))
7911 {
7912 TRACE("SampValidateDbObject failed with status 0x%08lx\n", Status);
7913 goto done;
7914 }
7915
7916 /* Get the current time */
7917 Status = NtQuerySystemTime(&SystemTime);
7918 if (!NT_SUCCESS(Status))
7919 {
7920 TRACE("NtQuerySystemTime failed (Status 0x%08lx)\n", Status);
7921 goto done;
7922 }
7923
7924 /* Retrieve the LM password */
7926 Status = SampGetObjectAttribute(UserObject,
7927 L"LMPwd",
7928 NULL,
7929 &StoredLmPassword,
7930 &Length);
7931 if (NT_SUCCESS(Status))
7932 {
7933 if (Length == sizeof(ENCRYPTED_LM_OWF_PASSWORD))
7934 {
7935 StoredLmPresent = TRUE;
7936 if (!RtlEqualMemory(&StoredLmPassword,
7937 &EmptyLmHash,
7939 StoredLmEmpty = FALSE;
7940 }
7941 }
7942
7943 /* Retrieve the NT password */
7945 Status = SampGetObjectAttribute(UserObject,
7946 L"NTPwd",
7947 NULL,
7948 &StoredNtPassword,
7949 &Length);
7950 if (NT_SUCCESS(Status))
7951 {
7952 if (Length == sizeof(ENCRYPTED_NT_OWF_PASSWORD))
7953 {
7954 StoredNtPresent = TRUE;
7955 if (!RtlEqualMemory(&StoredNtPassword,
7956 &EmptyNtHash,
7958 StoredNtEmpty = FALSE;
7959 }
7960 }
7961
7962 /* Retrieve the fixed size user data */
7963 Length = sizeof(SAM_USER_FIXED_DATA);
7964 Status = SampGetObjectAttribute(UserObject,
7965 L"F",
7966 NULL,
7967 &UserFixedData,
7968 &Length);
7969 if (!NT_SUCCESS(Status))
7970 {
7971 TRACE("SampGetObjectAttribute failed to retrieve the fixed user data (Status 0x%08lx)\n", Status);
7972 goto done;
7973 }
7974
7975 /* Check if we can change the password at this time */
7976 if ((StoredLmEmpty == FALSE) || (StoredNtEmpty == FALSE))
7977 {
7978 /* Get fixed domain data */
7979 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
7981 L"F",
7982 NULL,
7983 &DomainFixedData,
7984 &Length);
7985 if (!NT_SUCCESS(Status))
7986 {
7987 TRACE("SampGetObjectAttribute failed to retrieve the fixed domain data (Status 0x%08lx)\n", Status);
7988 goto done;
7989 }
7990
7991 if (DomainFixedData.MinPasswordAge.QuadPart > 0)
7992 {
7993 if (SystemTime.QuadPart < (UserFixedData.PasswordLastSet.QuadPart + DomainFixedData.MinPasswordAge.QuadPart))
7994 {
7996 goto done;
7997 }
7998 }
7999 }
8000
8001 /* Decrypt the LM passwords, if present */
8002 if (LmPresent)
8003 {
8004 Status = SystemFunction013((const BYTE *)NewLmEncryptedWithOldLm,
8005 (const BYTE *)&StoredLmPassword,
8006 (LPBYTE)&NewLmPassword);
8007 if (!NT_SUCCESS(Status))
8008 {
8009 TRACE("SystemFunction013 failed (Status 0x%08lx)\n", Status);
8010 goto done;
8011 }
8012
8013 Status = SystemFunction013((const BYTE *)OldLmEncryptedWithNewLm,
8014 (const BYTE *)&NewLmPassword,
8015 (LPBYTE)&OldLmPassword);
8016 if (!NT_SUCCESS(Status))
8017 {
8018 TRACE("SystemFunction013 failed (Status 0x%08lx)\n", Status);
8019 goto done;
8020 }
8021 }
8022
8023 /* Decrypt the NT passwords, if present */
8024 if (NtPresent)
8025 {
8026 Status = SystemFunction013((const BYTE *)NewNtEncryptedWithOldNt,
8027 (const BYTE *)&StoredNtPassword,
8028 (LPBYTE)&NewNtPassword);
8029 if (!NT_SUCCESS(Status))
8030 {
8031 TRACE("SystemFunction013 failed (Status 0x%08lx)\n", Status);
8032 goto done;
8033 }
8034
8035 Status = SystemFunction013((const BYTE *)OldNtEncryptedWithNewNt,
8036 (const BYTE *)&NewNtPassword,
8037 (LPBYTE)&OldNtPassword);
8038 if (!NT_SUCCESS(Status))
8039 {
8040 TRACE("SystemFunction013 failed (Status 0x%08lx)\n", Status);
8041 goto done;
8042 }
8043 }
8044
8045 /* Check if the old passwords match the stored ones */
8046 if (NtPresent)
8047 {
8048 if (LmPresent)
8049 {
8050 if (!RtlEqualMemory(&StoredLmPassword,
8051 &OldLmPassword,
8053 {
8054 TRACE("Old LM Password does not match!\n");
8056 }
8057 else
8058 {
8059 if (!RtlEqualMemory(&StoredNtPassword,
8060 &OldNtPassword,
8062 {
8063 TRACE("Old NT Password does not match!\n");
8065 }
8066 }
8067 }
8068 else
8069 {
8070 if (!RtlEqualMemory(&StoredNtPassword,
8071 &OldNtPassword,
8073 {
8074 TRACE("Old NT Password does not match!\n");
8076 }
8077 }
8078 }
8079 else
8080 {
8081 if (LmPresent)
8082 {
8083 if (!RtlEqualMemory(&StoredLmPassword,
8084 &OldLmPassword,
8086 {
8087 TRACE("Old LM Password does not match!\n");
8089 }
8090 }
8091 else
8092 {
8094 }
8095 }
8096
8097 /* Store the new password hashes */
8098 if (NT_SUCCESS(Status))
8099 {
8100 Status = SampSetUserPassword(UserObject,
8101 &NewNtPassword,
8102 NtPresent,
8103 &NewLmPassword,
8104 LmPresent);
8105 if (NT_SUCCESS(Status))
8106 {
8107 /* Update PasswordLastSet */
8108 UserFixedData.PasswordLastSet.QuadPart = SystemTime.QuadPart;
8109
8110 /* Set the fixed size user data */
8111 Length = sizeof(SAM_USER_FIXED_DATA);
8112 Status = SampSetObjectAttribute(UserObject,
8113 L"F",
8114 REG_BINARY,
8115 &UserFixedData,
8116 Length);
8117 }
8118 }
8119
8121 {
8122 /* Update BadPasswordCount and LastBadPasswordTime */
8123 UserFixedData.BadPasswordCount++;
8124 UserFixedData.LastBadPasswordTime.QuadPart = SystemTime.QuadPart;
8125
8126 /* Set the fixed size user data */
8127 Length = sizeof(SAM_USER_FIXED_DATA);
8128 Status = SampSetObjectAttribute(UserObject,
8129 L"F",
8130 REG_BINARY,
8131 &UserFixedData,
8132 Length);
8133 }
8134
8135done:
8137
8138 return Status;
8139}
@ SamDbUserObject
Definition: samsrv.h:42
#define RtlEqualMemory(a, b, c)
Definition: kdvm.h:18
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:319
#define USER_CHANGE_PASSWORD
Definition: ntsam.h:132
#define STATUS_WRONG_PASSWORD
Definition: ntstatus.h:342
#define STATUS_ACCOUNT_RESTRICTION
Definition: ntstatus.h:346
NTSTATUS WINAPI SystemFunction013(const BYTE *in, const BYTE *key, LPBYTE out)
Definition: sysfunc.c:383
unsigned char * LPBYTE
Definition: typedefs.h:53
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
unsigned char BYTE
Definition: xxhash.c:193

Referenced by MsvpChangePassword(), and SamChangePasswordUser().

◆ SamrCloseHandle()

NTSTATUS NTAPI SamrCloseHandle ( IN OUT SAMPR_HANDLE SamHandle)

Definition at line 161 of file samrpc.c.

162{
163 PSAM_DB_OBJECT DbObject;
165
166 TRACE("SamrCloseHandle(%p)\n", SamHandle);
167
169 TRUE);
170
171 Status = SampValidateDbObject(*SamHandle,
173 0,
174 &DbObject);
175 if (Status == STATUS_SUCCESS)
176 {
177 Status = SampCloseDbObject(DbObject);
178 *SamHandle = NULL;
179 }
180
182
183 TRACE("SamrCloseHandle done (Status 0x%08lx)\n", Status);
184
185 return Status;
186}
@ SamDbIgnoreObject
Definition: samsrv.h:37
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceShared(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)

Referenced by LsapLookupAccountDomainSids(), LsapLookupAccountNames(), LsapLookupBuiltinDomainSids(), LsapLookupBuiltinNames(), LsapLookupIsolatedAccountNames(), LsapLookupIsolatedBuiltinNames(), and SamrGetDomainPasswordInformation().

◆ SamrConnect()

NTSTATUS NTAPI SamrConnect ( IN PSAMPR_SERVER_NAME  ServerName,
OUT SAMPR_HANDLE ServerHandle,
IN ACCESS_MASK  DesiredAccess 
)

Definition at line 135 of file samrpc.c.

138{
139 SAMPR_REVISION_INFO InRevisionInfo, OutRevisionInfo;
140 ULONG OutVersion;
141
142 TRACE("SamrConnect(%p %p %lx)\n",
143 ServerName, ServerHandle, DesiredAccess);
144
145 InRevisionInfo.V1.Revision = 0;
146 InRevisionInfo.V1.SupportedFeatures = 0;
147
148 return SamrConnect5(ServerName,
150 1,
151 &InRevisionInfo,
152 &OutVersion,
153 &OutRevisionInfo,
154 ServerHandle);
155}
union @3429 SAMPR_REVISION_INFO
NTSTATUS NTAPI SamrConnect5(IN PSAMPR_SERVER_NAME ServerName, IN ACCESS_MASK DesiredAccess, IN unsigned long InVersion, IN SAMPR_REVISION_INFO *InRevisionInfo, OUT unsigned long *OutVersion, OUT SAMPR_REVISION_INFO *OutRevisionInfo, OUT SAMPR_HANDLE *ServerHandle)
Definition: samrpc.c:9738
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658

Referenced by LsapLookupAccountDomainSids(), LsapLookupAccountNames(), LsapLookupBuiltinDomainSids(), LsapLookupBuiltinNames(), LsapLookupIsolatedAccountNames(), LsapLookupIsolatedBuiltinNames(), SamConnect(), and SamrGetDomainPasswordInformation().

◆ SamrConnect2()

NTSTATUS NTAPI SamrConnect2 ( IN PSAMPR_SERVER_NAME  ServerName,
OUT SAMPR_HANDLE ServerHandle,
IN ACCESS_MASK  DesiredAccess 
)

Definition at line 9442 of file samrpc.c.

9445{
9446 SAMPR_REVISION_INFO InRevisionInfo, OutRevisionInfo;
9447 ULONG OutVersion;
9448
9449 TRACE("SamrConnect2(%p %p %lx)\n",
9450 ServerName, ServerHandle, DesiredAccess);
9451
9452 InRevisionInfo.V1.Revision = 1;
9453 InRevisionInfo.V1.SupportedFeatures = 0;
9454
9455 return SamrConnect5(ServerName,
9457 1,
9458 &InRevisionInfo,
9459 &OutVersion,
9460 &OutRevisionInfo,
9461 ServerHandle);
9462}

◆ SamrConnect3()

NTSTATUS NTAPI SamrConnect3 ( IN handle_t  BindingHandle)

Definition at line 9691 of file samrpc.c.

9692{
9695}
#define UNIMPLEMENTED
Definition: debug.h:115
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239

◆ SamrConnect4()

NTSTATUS NTAPI SamrConnect4 ( IN PSAMPR_SERVER_NAME  ServerName,
OUT SAMPR_HANDLE ServerHandle,
IN unsigned long  ClientRevision,
IN ACCESS_MASK  DesiredAccess 
)

Definition at line 9701 of file samrpc.c.

9705{
9706 SAMPR_REVISION_INFO InRevisionInfo, OutRevisionInfo;
9707 ULONG OutVersion;
9708
9709 TRACE("SamrConnect4(%p %p %lu 0x%lx)\n",
9710 ServerName, ServerHandle, ClientRevision, DesiredAccess);
9711
9712 InRevisionInfo.V1.Revision = 2;
9713 InRevisionInfo.V1.SupportedFeatures = 0;
9714
9715 return SamrConnect5(ServerName,
9717 1,
9718 &InRevisionInfo,
9719 &OutVersion,
9720 &OutRevisionInfo,
9721 ServerHandle);
9722}

◆ SamrConnect5()

NTSTATUS NTAPI SamrConnect5 ( IN PSAMPR_SERVER_NAME  ServerName,
IN ACCESS_MASK  DesiredAccess,
IN unsigned long  InVersion,
IN SAMPR_REVISION_INFO InRevisionInfo,
OUT unsigned long OutVersion,
OUT SAMPR_REVISION_INFO OutRevisionInfo,
OUT SAMPR_HANDLE ServerHandle 
)

Definition at line 9738 of file samrpc.c.

9745{
9746 PSAM_DB_OBJECT ServerObject;
9748
9749 TRACE("SamrConnect5(%p 0x%lx %lu %p %p %p %p)\n",
9750 ServerName, DesiredAccess, InVersion, InRevisionInfo,
9751 OutVersion, OutRevisionInfo, ServerHandle);
9752
9753 if (InVersion != 1)
9754 return STATUS_NOT_SUPPORTED;
9755
9757 TRUE);
9758
9759 /* Map generic access rights */
9761 &ServerMapping);
9762
9763 /* Open the Server Object */
9765 NULL,
9766 L"SAM",
9767 0,
9770 &ServerObject);
9771 if (NT_SUCCESS(Status))
9772 {
9773 *OutVersion = 1;
9774
9775 OutRevisionInfo->V1.Revision = 3;
9776 OutRevisionInfo->V1.SupportedFeatures = 0;
9777
9778 *ServerHandle = (SAMPR_HANDLE)ServerObject;
9779 }
9780
9782
9783 TRACE("SamrConnect5 done (Status 0x%08lx)\n", Status);
9784
9785 return Status;
9786}
void * SAMPR_HANDLE
Definition: authpackage.c:113
NTSTATUS SampOpenDbObject(IN PSAM_DB_OBJECT ParentObject, IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN ULONG RelativeId, IN SAM_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, OUT PSAM_DB_OBJECT *DbObject)
Definition: database.c:173
@ SamDbServerObject
Definition: samsrv.h:38
NTSYSAPI VOID NTAPI RtlMapGenericMask(PACCESS_MASK AccessMask, PGENERIC_MAPPING GenericMapping)
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
static GENERIC_MAPPING ServerMapping
Definition: samrpc.c:16

Referenced by SamrConnect(), SamrConnect2(), and SamrConnect4().

◆ SamrCreateAliasInDomain()

NTSTATUS NTAPI SamrCreateAliasInDomain ( IN SAMPR_HANDLE  DomainHandle,
IN PRPC_UNICODE_STRING  AccountName,
IN ACCESS_MASK  DesiredAccess,
OUT SAMPR_HANDLE AliasHandle,
OUT unsigned long RelativeId 
)

Definition at line 2909 of file samrpc.c.

2914{
2915 SAM_DOMAIN_FIXED_DATA FixedDomainData;
2916 PSAM_DB_OBJECT DomainObject;
2917 PSAM_DB_OBJECT AliasObject;
2919 ULONG SdSize = 0;
2920 ULONG ulSize;
2921 ULONG ulRid;
2922 WCHAR szRid[9];
2924
2925 TRACE("SamrCreateAliasInDomain(%p %p %lx %p %p)\n",
2926 DomainHandle, AccountName, DesiredAccess, AliasHandle, RelativeId);
2927
2928 /* Map generic access rights */
2930 &AliasMapping);
2931
2933 TRUE);
2934
2935 /* Validate the domain handle */
2936 Status = SampValidateDbObject(DomainHandle,
2939 &DomainObject);
2940 if (!NT_SUCCESS(Status))
2941 {
2942 TRACE("failed with status 0x%08lx\n", Status);
2943 goto done;
2944 }
2945
2946 /* Check the alias account name */
2947 Status = SampCheckAccountName(AccountName, 256);
2948 if (!NT_SUCCESS(Status))
2949 {
2950 TRACE("SampCheckAccountName failed (Status 0x%08lx)\n", Status);
2951 goto done;
2952 }
2953
2954 /* Check if the alias name already exists in the domain */
2955 Status = SampCheckAccountNameInDomain(DomainObject,
2956 AccountName->Buffer);
2957 if (!NT_SUCCESS(Status))
2958 {
2959 TRACE("Alias name \'%S\' already exists in domain (Status 0x%08lx)\n",
2960 AccountName->Buffer, Status);
2961 goto done;
2962 }
2963
2964 /* Create the security descriptor */
2966 &SdSize);
2967 if (!NT_SUCCESS(Status))
2968 {
2969 TRACE("SampCreateAliasSD failed (Status 0x%08lx)\n", Status);
2970 goto done;
2971 }
2972
2973 /* Get the fixed domain attributes */
2974 ulSize = sizeof(SAM_DOMAIN_FIXED_DATA);
2975 Status = SampGetObjectAttribute(DomainObject,
2976 L"F",
2977 NULL,
2978 (PVOID)&FixedDomainData,
2979 &ulSize);
2980 if (!NT_SUCCESS(Status))
2981 {
2982 TRACE("failed with status 0x%08lx\n", Status);
2983 goto done;
2984 }
2985
2986 /* Increment the NextRid attribute */
2987 ulRid = FixedDomainData.NextRid;
2988 FixedDomainData.NextRid++;
2989
2990 /* Store the fixed domain attributes */
2991 Status = SampSetObjectAttribute(DomainObject,
2992 L"F",
2993 REG_BINARY,
2994 &FixedDomainData,
2995 ulSize);
2996 if (!NT_SUCCESS(Status))
2997 {
2998 TRACE("failed with status 0x%08lx\n", Status);
2999 goto done;
3000 }
3001
3002 TRACE("RID: %lx\n", ulRid);
3003
3004 /* Convert the RID into a string (hex) */
3005 swprintf(szRid, L"%08lX", ulRid);
3006
3007 /* Create the alias object */
3008 Status = SampCreateDbObject(DomainObject,
3009 L"Aliases",
3010 szRid,
3011 ulRid,
3014 &AliasObject);
3015 if (!NT_SUCCESS(Status))
3016 {
3017 TRACE("failed with status 0x%08lx\n", Status);
3018 goto done;
3019 }
3020
3021 /* Add the account name for the alias object */
3022 Status = SampSetAccountNameInDomain(DomainObject,
3023 L"Aliases",
3024 AccountName->Buffer,
3025 ulRid);
3026 if (!NT_SUCCESS(Status))
3027 {
3028 TRACE("failed with status 0x%08lx\n", Status);
3029 goto done;
3030 }
3031
3032 /* Set the Name attribute */
3034 L"Name",
3035 AccountName);
3036 if (!NT_SUCCESS(Status))
3037 {
3038 TRACE("failed with status 0x%08lx\n", Status);
3039 goto done;
3040 }
3041
3042 /* Set the Description attribute */
3044 L"Description",
3045 NULL);
3046 if (!NT_SUCCESS(Status))
3047 {
3048 TRACE("failed with status 0x%08lx\n", Status);
3049 goto done;
3050 }
3051
3052 /* Set the SecDesc attribute*/
3053 Status = SampSetObjectAttribute(AliasObject,
3054 L"SecDesc",
3055 REG_BINARY,
3056 Sd,
3057 SdSize);
3058 if (!NT_SUCCESS(Status))
3059 {
3060 TRACE("failed with status 0x%08lx\n", Status);
3061 goto done;
3062 }
3063
3064 if (NT_SUCCESS(Status))
3065 {
3066 *AliasHandle = (SAMPR_HANDLE)AliasObject;
3067 *RelativeId = ulRid;
3068 }
3069
3070done:
3071 if (Sd != NULL)
3072 RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
3073
3075
3076 TRACE("returns with status 0x%08lx\n", Status);
3077
3078 return Status;
3079}
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
NTSTATUS SampCreateDbObject(IN PSAM_DB_OBJECT ParentObject, IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN ULONG RelativeId, IN SAM_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, OUT PSAM_DB_OBJECT *DbObject)
Definition: database.c:44
NTSTATUS SampCreateAliasSD(OUT PSECURITY_DESCRIPTOR *AliasSd, OUT PULONG Size)
Definition: security.c:859
@ SamDbDomainObject
Definition: samsrv.h:39
#define swprintf
Definition: precomp.h:40
#define DOMAIN_CREATE_ALIAS
Definition: ntsam.h:39
static GENERIC_MAPPING AliasMapping
Definition: samrpc.c:32
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by SamCreateAliasInDomain().

◆ SamrCreateGroupInDomain()

NTSTATUS NTAPI SamrCreateGroupInDomain ( IN SAMPR_HANDLE  DomainHandle,
IN PRPC_UNICODE_STRING  Name,
IN ACCESS_MASK  DesiredAccess,
OUT SAMPR_HANDLE GroupHandle,
OUT unsigned long RelativeId 
)

Definition at line 1894 of file samrpc.c.

1899{
1900 SAM_DOMAIN_FIXED_DATA FixedDomainData;
1901 SAM_GROUP_FIXED_DATA FixedGroupData;
1902 PSAM_DB_OBJECT DomainObject;
1903 PSAM_DB_OBJECT GroupObject;
1905 ULONG SdSize = 0;
1906 ULONG ulSize;
1907 ULONG ulRid;
1908 WCHAR szRid[9];
1910
1911 TRACE("SamrCreateGroupInDomain(%p %p %lx %p %p)\n",
1912 DomainHandle, Name, DesiredAccess, GroupHandle, RelativeId);
1913
1914 /* Map generic access rights */
1916 &GroupMapping);
1917
1919 TRUE);
1920
1921 /* Validate the domain handle */
1922 Status = SampValidateDbObject(DomainHandle,
1925 &DomainObject);
1926 if (!NT_SUCCESS(Status))
1927 {
1928 TRACE("failed with status 0x%08lx\n", Status);
1929 goto done;
1930 }
1931
1932 /* Check the group account name */
1934 if (!NT_SUCCESS(Status))
1935 {
1936 TRACE("SampCheckAccountName failed (Status 0x%08lx)\n", Status);
1937 goto done;
1938 }
1939
1940 /* Check if the group name already exists in the domain */
1941 Status = SampCheckAccountNameInDomain(DomainObject,
1942 Name->Buffer);
1943 if (!NT_SUCCESS(Status))
1944 {
1945 TRACE("Group name \'%S\' already exists in domain (Status 0x%08lx)\n",
1946 Name->Buffer, Status);
1947 goto done;
1948 }
1949
1950 /* Create the security descriptor */
1952 &SdSize);
1953 if (!NT_SUCCESS(Status))
1954 {
1955 TRACE("SampCreateGroupSD failed (Status 0x%08lx)\n", Status);
1956 goto done;
1957 }
1958
1959 /* Get the fixed domain attributes */
1960 ulSize = sizeof(SAM_DOMAIN_FIXED_DATA);
1961 Status = SampGetObjectAttribute(DomainObject,
1962 L"F",
1963 NULL,
1964 (PVOID)&FixedDomainData,
1965 &ulSize);
1966 if (!NT_SUCCESS(Status))
1967 {
1968 TRACE("failed with status 0x%08lx\n", Status);
1969 goto done;
1970 }
1971
1972 /* Increment the NextRid attribute */
1973 ulRid = FixedDomainData.NextRid;
1974 FixedDomainData.NextRid++;
1975
1976 /* Store the fixed domain attributes */
1977 Status = SampSetObjectAttribute(DomainObject,
1978 L"F",
1979 REG_BINARY,
1980 &FixedDomainData,
1981 ulSize);
1982 if (!NT_SUCCESS(Status))
1983 {
1984 TRACE("failed with status 0x%08lx\n", Status);
1985 goto done;
1986 }
1987
1988 TRACE("RID: %lx\n", ulRid);
1989
1990 /* Convert the RID into a string (hex) */
1991 swprintf(szRid, L"%08lX", ulRid);
1992
1993 /* Create the group object */
1994 Status = SampCreateDbObject(DomainObject,
1995 L"Groups",
1996 szRid,
1997 ulRid,
2000 &GroupObject);
2001 if (!NT_SUCCESS(Status))
2002 {
2003 TRACE("failed with status 0x%08lx\n", Status);
2004 goto done;
2005 }
2006
2007 /* Add the account name of the user object */
2008 Status = SampSetAccountNameInDomain(DomainObject,
2009 L"Groups",
2010 Name->Buffer,
2011 ulRid);
2012 if (!NT_SUCCESS(Status))
2013 {
2014 TRACE("failed with status 0x%08lx\n", Status);
2015 goto done;
2016 }
2017
2018 /* Initialize fixed user data */
2019 memset(&FixedGroupData, 0, sizeof(SAM_GROUP_FIXED_DATA));
2020 FixedGroupData.Version = 1;
2021 FixedGroupData.GroupId = ulRid;
2022
2023 /* Set fixed user data attribute */
2024 Status = SampSetObjectAttribute(GroupObject,
2025 L"F",
2026 REG_BINARY,
2027 (LPVOID)&FixedGroupData,
2028 sizeof(SAM_GROUP_FIXED_DATA));
2029 if (!NT_SUCCESS(Status))
2030 {
2031 TRACE("failed with status 0x%08lx\n", Status);
2032 goto done;
2033 }
2034
2035 /* Set the Name attribute */
2037 L"Name",
2038 Name);
2039 if (!NT_SUCCESS(Status))
2040 {
2041 TRACE("failed with status 0x%08lx\n", Status);
2042 goto done;
2043 }
2044
2045 /* Set the AdminComment attribute */
2047 L"AdminComment",
2048 NULL);
2049 if (!NT_SUCCESS(Status))
2050 {
2051 TRACE("failed with status 0x%08lx\n", Status);
2052 goto done;
2053 }
2054
2055 /* Set the SecDesc attribute*/
2056 Status = SampSetObjectAttribute(GroupObject,
2057 L"SecDesc",
2058 REG_BINARY,
2059 Sd,
2060 SdSize);
2061 if (!NT_SUCCESS(Status))
2062 {
2063 TRACE("failed with status 0x%08lx\n", Status);
2064 goto done;
2065 }
2066
2067 if (NT_SUCCESS(Status))
2068 {
2069 *GroupHandle = (SAMPR_HANDLE)GroupObject;
2070 *RelativeId = ulRid;
2071 }
2072
2073done:
2074 if (Sd != NULL)
2075 RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
2076
2078
2079 TRACE("returns with status 0x%08lx\n", Status);
2080
2081 return Status;
2082}
NTSTATUS SampCreateGroupSD(OUT PSECURITY_DESCRIPTOR *GroupSd, OUT PULONG Size)
Definition: security.c:1146
#define DOMAIN_CREATE_GROUP
Definition: ntsam.h:38
static GENERIC_MAPPING GroupMapping
Definition: samrpc.c:40
#define memset(x, y, z)
Definition: compat.h:39

Referenced by SamCreateGroupInDomain().

◆ SamrCreateUser2InDomain()

NTSTATUS NTAPI SamrCreateUser2InDomain ( IN SAMPR_HANDLE  DomainHandle,
IN PRPC_UNICODE_STRING  Name,
IN unsigned long  AccountType,
IN ACCESS_MASK  DesiredAccess,
OUT SAMPR_HANDLE UserHandle,
OUT unsigned long GrantedAccess,
OUT unsigned long RelativeId 
)

Definition at line 8825 of file samrpc.c.

8832{
8833 SAM_DOMAIN_FIXED_DATA FixedDomainData;
8834 SAM_USER_FIXED_DATA FixedUserData;
8835 PSAM_DB_OBJECT DomainObject;
8836 PSAM_DB_OBJECT UserObject;
8837 GROUP_MEMBERSHIP GroupMembership;
8838 UCHAR LogonHours[23];
8839 ULONG ulSize;
8840 ULONG ulRid;
8841 WCHAR szRid[9];
8843 ULONG SdSize = 0;
8844 PSID UserSid = NULL;
8846
8847 TRACE("SamrCreateUserInDomain(%p %p %lx %p %p)\n",
8848 DomainHandle, Name, DesiredAccess, UserHandle, RelativeId);
8849
8850 if (Name == NULL ||
8851 Name->Length == 0 ||
8852 Name->Buffer == NULL ||
8853 UserHandle == NULL ||
8854 RelativeId == NULL)
8856
8857 /* Check for valid account type */
8858 if (AccountType != USER_NORMAL_ACCOUNT &&
8859 AccountType != USER_WORKSTATION_TRUST_ACCOUNT &&
8860 AccountType != USER_INTERDOMAIN_TRUST_ACCOUNT &&
8861 AccountType != USER_SERVER_TRUST_ACCOUNT &&
8862 AccountType != USER_TEMP_DUPLICATE_ACCOUNT)
8864
8865 /* Map generic access rights */
8867 &UserMapping);
8868
8870 TRUE);
8871
8872 /* Validate the domain handle */
8873 Status = SampValidateDbObject(DomainHandle,
8876 &DomainObject);
8877 if (!NT_SUCCESS(Status))
8878 {
8879 TRACE("failed with status 0x%08lx\n", Status);
8880 goto done;
8881 }
8882
8883 /* Check the user account name */
8885 if (!NT_SUCCESS(Status))
8886 {
8887 TRACE("SampCheckAccountName failed (Status 0x%08lx)\n", Status);
8888 goto done;
8889 }
8890
8891 /* Check if the user name already exists in the domain */
8892 Status = SampCheckAccountNameInDomain(DomainObject,
8893 Name->Buffer);
8894 if (!NT_SUCCESS(Status))
8895 {
8896 TRACE("User name \'%S\' already exists in domain (Status 0x%08lx)\n",
8897 Name->Buffer, Status);
8898 goto done;
8899 }
8900
8901 /* Get the fixed domain attributes */
8902 ulSize = sizeof(SAM_DOMAIN_FIXED_DATA);
8903 Status = SampGetObjectAttribute(DomainObject,
8904 L"F",
8905 NULL,
8906 (PVOID)&FixedDomainData,
8907 &ulSize);
8908 if (!NT_SUCCESS(Status))
8909 {
8910 TRACE("failed with status 0x%08lx\n", Status);
8911 goto done;
8912 }
8913
8914 /* Increment the NextRid attribute */
8915 ulRid = FixedDomainData.NextRid;
8916 FixedDomainData.NextRid++;
8917
8918 TRACE("RID: %lx\n", ulRid);
8919
8920 /* Create the user SID */
8921 Status = SampCreateAccountSid(DomainObject,
8922 ulRid,
8923 &UserSid);
8924 if (!NT_SUCCESS(Status))
8925 {
8926 TRACE("SampCreateAccountSid failed (Status 0x%08lx)\n", Status);
8927 goto done;
8928 }
8929
8930 /* Create the security descriptor */
8931 Status = SampCreateUserSD(UserSid,
8932 &Sd,
8933 &SdSize);
8934 if (!NT_SUCCESS(Status))
8935 {
8936 TRACE("SampCreateUserSD failed (Status 0x%08lx)\n", Status);
8937 goto done;
8938 }
8939
8940 /* Store the fixed domain attributes */
8941 Status = SampSetObjectAttribute(DomainObject,
8942 L"F",
8943 REG_BINARY,
8944 &FixedDomainData,
8945 ulSize);
8946 if (!NT_SUCCESS(Status))
8947 {
8948 TRACE("failed with status 0x%08lx\n", Status);
8949 goto done;
8950 }
8951
8952 /* Convert the RID into a string (hex) */
8953 swprintf(szRid, L"%08lX", ulRid);
8954
8955 /* Create the user object */
8956 Status = SampCreateDbObject(DomainObject,
8957 L"Users",
8958 szRid,
8959 ulRid,
8962 &UserObject);
8963 if (!NT_SUCCESS(Status))
8964 {
8965 TRACE("failed with status 0x%08lx\n", Status);
8966 goto done;
8967 }
8968
8969 /* Add the account name for the user object */
8970 Status = SampSetAccountNameInDomain(DomainObject,
8971 L"Users",
8972 Name->Buffer,
8973 ulRid);
8974 if (!NT_SUCCESS(Status))
8975 {
8976 TRACE("failed with status 0x%08lx\n", Status);
8977 goto done;
8978 }
8979
8980 /* Initialize fixed user data */
8981 FixedUserData.Version = 1;
8982 FixedUserData.Reserved = 0;
8983 FixedUserData.LastLogon.QuadPart = 0;
8984 FixedUserData.LastLogoff.QuadPart = 0;
8985 FixedUserData.PasswordLastSet.QuadPart = 0;
8986 FixedUserData.AccountExpires.LowPart = MAXULONG;
8987 FixedUserData.AccountExpires.HighPart = MAXLONG;
8988 FixedUserData.LastBadPasswordTime.QuadPart = 0;
8989 FixedUserData.UserId = ulRid;
8990 FixedUserData.PrimaryGroupId = DOMAIN_GROUP_RID_USERS;
8993 AccountType;
8994 FixedUserData.CountryCode = 0;
8995 FixedUserData.CodePage = 0;
8996 FixedUserData.BadPasswordCount = 0;
8997 FixedUserData.LogonCount = 0;
8998 FixedUserData.AdminCount = 0;
8999 FixedUserData.OperatorCount = 0;
9000
9001 /* Set fixed user data attribute */
9002 Status = SampSetObjectAttribute(UserObject,
9003 L"F",
9004 REG_BINARY,
9005 (LPVOID)&FixedUserData,
9006 sizeof(SAM_USER_FIXED_DATA));
9007 if (!NT_SUCCESS(Status))
9008 {
9009 TRACE("failed with status 0x%08lx\n", Status);
9010 goto done;
9011 }
9012
9013 /* Set the Name attribute */
9015 L"Name",
9016 Name);
9017 if (!NT_SUCCESS(Status))
9018 {
9019 TRACE("failed with status 0x%08lx\n", Status);
9020 goto done;
9021 }
9022
9023 /* Set the FullName attribute */
9025 L"FullName",
9026 NULL);
9027 if (!NT_SUCCESS(Status))
9028 {
9029 TRACE("failed with status 0x%08lx\n", Status);
9030 goto done;
9031 }
9032
9033 /* Set the HomeDirectory attribute */
9035 L"HomeDirectory",
9036 NULL);
9037 if (!NT_SUCCESS(Status))
9038 {
9039 TRACE("failed with status 0x%08lx\n", Status);
9040 goto done;
9041 }
9042
9043 /* Set the HomeDirectoryDrive attribute */
9045 L"HomeDirectoryDrive",
9046 NULL);
9047 if (!NT_SUCCESS(Status))
9048 {
9049 TRACE("failed with status 0x%08lx\n", Status);
9050 goto done;
9051 }
9052
9053 /* Set the ScriptPath attribute */
9055 L"ScriptPath",
9056 NULL);
9057 if (!NT_SUCCESS(Status))
9058 {
9059 TRACE("failed with status 0x%08lx\n", Status);
9060 goto done;
9061 }
9062
9063 /* Set the ProfilePath attribute */
9065 L"ProfilePath",
9066 NULL);
9067 if (!NT_SUCCESS(Status))
9068 {
9069 TRACE("failed with status 0x%08lx\n", Status);
9070 goto done;
9071 }
9072
9073 /* Set the AdminComment attribute */
9075 L"AdminComment",
9076 NULL);
9077 if (!NT_SUCCESS(Status))
9078 {
9079 TRACE("failed with status 0x%08lx\n", Status);
9080 goto done;
9081 }
9082
9083 /* Set the UserComment attribute */
9085 L"UserComment",
9086 NULL);
9087 if (!NT_SUCCESS(Status))
9088 {
9089 TRACE("failed with status 0x%08lx\n", Status);
9090 goto done;
9091 }
9092
9093 /* Set the WorkStations attribute */
9095 L"WorkStations",
9096 NULL);
9097 if (!NT_SUCCESS(Status))
9098 {
9099 TRACE("failed with status 0x%08lx\n", Status);
9100 goto done;
9101 }
9102
9103 /* Set the Parameters attribute */
9105 L"Parameters",
9106 NULL);
9107 if (!NT_SUCCESS(Status))
9108 {
9109 TRACE("failed with status 0x%08lx\n", Status);
9110 goto done;
9111 }
9112
9113 /* Set LogonHours attribute*/
9114 *((PUSHORT)LogonHours) = 168;
9115 memset(&(LogonHours[2]), 0xff, 21);
9116
9117 Status = SampSetObjectAttribute(UserObject,
9118 L"LogonHours",
9119 REG_BINARY,
9120 &LogonHours,
9121 sizeof(LogonHours));
9122 if (!NT_SUCCESS(Status))
9123 {
9124 TRACE("failed with status 0x%08lx\n", Status);
9125 goto done;
9126 }
9127
9128 /* Set Groups attribute*/
9129 GroupMembership.RelativeId = DOMAIN_GROUP_RID_USERS;
9130 GroupMembership.Attributes = SE_GROUP_MANDATORY |
9133
9134 Status = SampSetObjectAttribute(UserObject,
9135 L"Groups",
9136 REG_BINARY,
9137 &GroupMembership,
9138 sizeof(GROUP_MEMBERSHIP));
9139 if (!NT_SUCCESS(Status))
9140 {
9141 TRACE("failed with status 0x%08lx\n", Status);
9142 goto done;
9143 }
9144
9145 /* Set LMPwd attribute*/
9146 Status = SampSetObjectAttribute(UserObject,
9147 L"LMPwd",
9148 REG_BINARY,
9149 NULL,
9150 0);
9151 if (!NT_SUCCESS(Status))
9152 {
9153 TRACE("failed with status 0x%08lx\n", Status);
9154 goto done;
9155 }
9156
9157 /* Set NTPwd attribute*/
9158 Status = SampSetObjectAttribute(UserObject,
9159 L"NTPwd",
9160 REG_BINARY,
9161 NULL,
9162 0);
9163 if (!NT_SUCCESS(Status))
9164 {
9165 TRACE("failed with status 0x%08lx\n", Status);
9166 goto done;
9167 }
9168
9169 /* Set LMPwdHistory attribute*/
9170 Status = SampSetObjectAttribute(UserObject,
9171 L"LMPwdHistory",
9172 REG_BINARY,
9173 NULL,
9174 0);
9175 if (!NT_SUCCESS(Status))
9176 {
9177 TRACE("failed with status 0x%08lx\n", Status);
9178 goto done;
9179 }
9180
9181 /* Set NTPwdHistory attribute*/
9182 Status = SampSetObjectAttribute(UserObject,
9183 L"NTPwdHistory",
9184 REG_BINARY,
9185 NULL,
9186 0);
9187 if (!NT_SUCCESS(Status))
9188 {
9189 TRACE("failed with status 0x%08lx\n", Status);
9190 goto done;
9191 }
9192
9193 /* Set the PrivateData attribute */
9195 L"PrivateData",
9196 NULL);
9197 if (!NT_SUCCESS(Status))
9198 {
9199 TRACE("failed with status 0x%08lx\n", Status);
9200 goto done;
9201 }
9202
9203 /* Set the SecDesc attribute*/
9204 Status = SampSetObjectAttribute(UserObject,
9205 L"SecDesc",
9206 REG_BINARY,
9207 Sd,
9208 SdSize);
9209 if (!NT_SUCCESS(Status))
9210 {
9211 TRACE("failed with status 0x%08lx\n", Status);
9212 goto done;
9213 }
9214
9215 if (NT_SUCCESS(Status))
9216 {
9217 *UserHandle = (SAMPR_HANDLE)UserObject;
9218 *RelativeId = ulRid;
9219 *GrantedAccess = UserObject->Access;
9220 }
9221
9222done:
9223 if (Sd != NULL)
9224 RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
9225
9226 if (UserSid != NULL)
9227 RtlFreeHeap(RtlGetProcessHeap(), 0, UserSid);
9228
9230
9231 TRACE("returns with status 0x%08lx\n", Status);
9232
9233 return Status;
9234}
NTSTATUS SampCreateAccountSid(IN PSAM_DB_OBJECT DomainObject, IN ULONG ulRelativeId, IN OUT PSID *AccountSid)
Definition: domain.c:303
NTSTATUS SampCreateUserSD(IN PSID UserSid, OUT PSECURITY_DESCRIPTOR *UserSd, OUT PULONG Size)
Definition: security.c:1433
#define SE_GROUP_MANDATORY
Definition: setypes.h:90
#define SE_GROUP_ENABLED_BY_DEFAULT
Definition: setypes.h:91
#define SE_GROUP_ENABLED
Definition: setypes.h:92
#define USER_NORMAL_ACCOUNT
Definition: ntsam.h:171
#define USER_PASSWORD_NOT_REQUIRED
Definition: ntsam.h:169
#define USER_WORKSTATION_TRUST_ACCOUNT
Definition: ntsam.h:174
#define USER_TEMP_DUPLICATE_ACCOUNT
Definition: ntsam.h:170
#define DOMAIN_CREATE_USER
Definition: ntsam.h:37
#define USER_SERVER_TRUST_ACCOUNT
Definition: ntsam.h:175
#define USER_INTERDOMAIN_TRUST_ACCOUNT
Definition: ntsam.h:173
#define USER_ACCOUNT_DISABLED
Definition: ntsam.h:167
static GENERIC_MAPPING UserMapping
Definition: samrpc.c:48
ULONG RelativeId
Definition: ntsam.h:496
ULONG Attributes
Definition: ntsam.h:497
USHORT OperatorCount
Definition: samsrv.h:115
#define MAXULONG
Definition: typedefs.h:251
uint16_t * PUSHORT
Definition: typedefs.h:56
#define MAXLONG
Definition: umtypes.h:116
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK GrantedAccess
Definition: sefuncs.h:20
#define DOMAIN_GROUP_RID_USERS
Definition: setypes.h:640
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by SamCreateUser2InDomain().

◆ SamrCreateUserInDomain()

NTSTATUS NTAPI SamrCreateUserInDomain ( IN SAMPR_HANDLE  DomainHandle,
IN PRPC_UNICODE_STRING  Name,
IN ACCESS_MASK  DesiredAccess,
OUT SAMPR_HANDLE UserHandle,
OUT unsigned long RelativeId 
)

Definition at line 2296 of file samrpc.c.

2301{
2302 SAM_DOMAIN_FIXED_DATA FixedDomainData;
2303 SAM_USER_FIXED_DATA FixedUserData;
2304 PSAM_DB_OBJECT DomainObject;
2305 PSAM_DB_OBJECT UserObject;
2306 GROUP_MEMBERSHIP GroupMembership;
2307 UCHAR LogonHours[23];
2308 ULONG ulSize;
2309 ULONG ulRid;
2310 WCHAR szRid[9];
2312 ULONG SdSize = 0;
2313 PSID UserSid = NULL;
2315
2316 TRACE("SamrCreateUserInDomain(%p %p %lx %p %p)\n",
2317 DomainHandle, Name, DesiredAccess, UserHandle, RelativeId);
2318
2319 if (Name == NULL ||
2320 Name->Length == 0 ||
2321 Name->Buffer == NULL ||
2322 UserHandle == NULL ||
2323 RelativeId == NULL)
2325
2326 /* Map generic access rights */
2328 &UserMapping);
2329
2331 TRUE);
2332
2333 /* Validate the domain handle */
2334 Status = SampValidateDbObject(DomainHandle,
2337 &DomainObject);
2338 if (!NT_SUCCESS(Status))
2339 {
2340 TRACE("failed with status 0x%08lx\n", Status);
2341 goto done;
2342 }
2343
2344 /* Check the user account name */
2346 if (!NT_SUCCESS(Status))
2347 {
2348 TRACE("SampCheckAccountName failed (Status 0x%08lx)\n", Status);
2349 goto done;
2350 }
2351
2352 /* Check if the user name already exists in the domain */
2353 Status = SampCheckAccountNameInDomain(DomainObject,
2354 Name->Buffer);
2355 if (!NT_SUCCESS(Status))
2356 {
2357 TRACE("User name \'%S\' already exists in domain (Status 0x%08lx)\n",
2358 Name->Buffer, Status);
2359 goto done;
2360 }
2361
2362 /* Get the fixed domain attributes */
2363 ulSize = sizeof(SAM_DOMAIN_FIXED_DATA);
2364 Status = SampGetObjectAttribute(DomainObject,
2365 L"F",
2366 NULL,
2367 (PVOID)&FixedDomainData,
2368 &ulSize);
2369 if (!NT_SUCCESS(Status))
2370 {
2371 TRACE("failed with status 0x%08lx\n", Status);
2372 goto done;
2373 }
2374
2375 /* Increment the NextRid attribute */
2376 ulRid = FixedDomainData.NextRid;
2377 FixedDomainData.NextRid++;
2378
2379 TRACE("RID: %lx\n", ulRid);
2380
2381 /* Create the user SID */
2382 Status = SampCreateAccountSid(DomainObject,
2383 ulRid,
2384 &UserSid);
2385 if (!NT_SUCCESS(Status))
2386 {
2387 TRACE("SampCreateAccountSid failed (Status 0x%08lx)\n", Status);
2388 goto done;
2389 }
2390
2391 /* Create the security descriptor */
2392 Status = SampCreateUserSD(UserSid,
2393 &Sd,
2394 &SdSize);
2395 if (!NT_SUCCESS(Status))
2396 {
2397 TRACE("SampCreateUserSD failed (Status 0x%08lx)\n", Status);
2398 goto done;
2399 }
2400
2401 /* Store the fixed domain attributes */
2402 Status = SampSetObjectAttribute(DomainObject,
2403 L"F",
2404 REG_BINARY,
2405 &FixedDomainData,
2406 ulSize);
2407 if (!NT_SUCCESS(Status))
2408 {
2409 TRACE("failed with status 0x%08lx\n", Status);
2410 goto done;
2411 }
2412
2413 /* Convert the RID into a string (hex) */
2414 swprintf(szRid, L"%08lX", ulRid);
2415
2416 /* Create the user object */
2417 Status = SampCreateDbObject(DomainObject,
2418 L"Users",
2419 szRid,
2420 ulRid,
2423 &UserObject);
2424 if (!NT_SUCCESS(Status))
2425 {
2426 TRACE("failed with status 0x%08lx\n", Status);
2427 goto done;
2428 }
2429
2430 /* Add the account name for the user object */
2431 Status = SampSetAccountNameInDomain(DomainObject,
2432 L"Users",
2433 Name->Buffer,
2434 ulRid);
2435 if (!NT_SUCCESS(Status))
2436 {
2437 TRACE("failed with status 0x%08lx\n", Status);
2438 goto done;
2439 }
2440
2441 /* Initialize fixed user data */
2442 memset(&FixedUserData, 0, sizeof(SAM_USER_FIXED_DATA));
2443 FixedUserData.Version = 1;
2444 FixedUserData.Reserved = 0;
2445 FixedUserData.LastLogon.QuadPart = 0;
2446 FixedUserData.LastLogoff.QuadPart = 0;
2447 FixedUserData.PasswordLastSet.QuadPart = 0;
2448 FixedUserData.AccountExpires.QuadPart = MAXLONGLONG;
2449 FixedUserData.LastBadPasswordTime.QuadPart = 0;
2450 FixedUserData.UserId = ulRid;
2451 FixedUserData.PrimaryGroupId = DOMAIN_GROUP_RID_USERS;
2455 FixedUserData.CountryCode = 0;
2456 FixedUserData.CodePage = 0;
2457 FixedUserData.BadPasswordCount = 0;
2458 FixedUserData.LogonCount = 0;
2459 FixedUserData.AdminCount = 0;
2460 FixedUserData.OperatorCount = 0;
2461
2462 /* Set fixed user data attribute */
2463 Status = SampSetObjectAttribute(UserObject,
2464 L"F",
2465 REG_BINARY,
2466 (LPVOID)&FixedUserData,
2467 sizeof(SAM_USER_FIXED_DATA));
2468 if (!NT_SUCCESS(Status))
2469 {
2470 TRACE("failed with status 0x%08lx\n", Status);
2471 goto done;
2472 }
2473
2474 /* Set the Name attribute */
2476 L"Name",
2477 Name);
2478 if (!NT_SUCCESS(Status))
2479 {
2480 TRACE("failed with status 0x%08lx\n", Status);
2481 goto done;
2482 }
2483
2484 /* Set the FullName attribute */
2486 L"FullName",
2487 NULL);
2488 if (!NT_SUCCESS(Status))
2489 {
2490 TRACE("failed with status 0x%08lx\n", Status);
2491 goto done;
2492 }
2493
2494 /* Set the HomeDirectory attribute */
2496 L"HomeDirectory",
2497 NULL);
2498 if (!NT_SUCCESS(Status))
2499 {
2500 TRACE("failed with status 0x%08lx\n", Status);
2501 goto done;
2502 }
2503
2504 /* Set the HomeDirectoryDrive attribute */
2506 L"HomeDirectoryDrive",
2507 NULL);
2508 if (!NT_SUCCESS(Status))
2509 {
2510 TRACE("failed with status 0x%08lx\n", Status);
2511 goto done;
2512 }
2513
2514 /* Set the ScriptPath attribute */
2516 L"ScriptPath",
2517 NULL);
2518 if (!NT_SUCCESS(Status))
2519 {
2520 TRACE("failed with status 0x%08lx\n", Status);
2521 goto done;
2522 }
2523
2524 /* Set the ProfilePath attribute */
2526 L"ProfilePath",
2527 NULL);
2528 if (!NT_SUCCESS(Status))
2529 {
2530 TRACE("failed with status 0x%08lx\n", Status);
2531 goto done;
2532 }
2533
2534 /* Set the AdminComment attribute */
2536 L"AdminComment",
2537 NULL);
2538 if (!NT_SUCCESS(Status))
2539 {
2540 TRACE("failed with status 0x%08lx\n", Status);
2541 goto done;
2542 }
2543
2544 /* Set the UserComment attribute */
2546 L"UserComment",
2547 NULL);
2548 if (!NT_SUCCESS(Status))
2549 {
2550 TRACE("failed with status 0x%08lx\n", Status);
2551 goto done;
2552 }
2553
2554 /* Set the WorkStations attribute */
2556 L"WorkStations",
2557 NULL);
2558 if (!NT_SUCCESS(Status))
2559 {
2560 TRACE("failed with status 0x%08lx\n", Status);
2561 goto done;
2562 }
2563
2564 /* Set the Parameters attribute */
2566 L"Parameters",
2567 NULL);
2568 if (!NT_SUCCESS(Status))
2569 {
2570 TRACE("failed with status 0x%08lx\n", Status);
2571 goto done;
2572 }
2573
2574 /* Set LogonHours attribute*/
2575 *((PUSHORT)LogonHours) = 168;
2576 memset(&(LogonHours[2]), 0xff, 21);
2577
2578 Status = SampSetObjectAttribute(UserObject,
2579 L"LogonHours",
2580 REG_BINARY,
2581 &LogonHours,
2582 sizeof(LogonHours));
2583 if (!NT_SUCCESS(Status))
2584 {
2585 TRACE("failed with status 0x%08lx\n", Status);
2586 goto done;
2587 }
2588
2589 /* Set Groups attribute*/
2590 GroupMembership.RelativeId = DOMAIN_GROUP_RID_USERS;
2591 GroupMembership.Attributes = SE_GROUP_MANDATORY |
2594
2595 Status = SampSetObjectAttribute(UserObject,
2596 L"Groups",
2597 REG_BINARY,
2598 &GroupMembership,
2599 sizeof(GROUP_MEMBERSHIP));
2600 if (!NT_SUCCESS(Status))
2601 {
2602 TRACE("failed with status 0x%08lx\n", Status);
2603 goto done;
2604 }
2605
2606 /* Set LMPwd attribute*/
2607 Status = SampSetObjectAttribute(UserObject,
2608 L"LMPwd",
2609 REG_BINARY,
2610 &EmptyLmHash,
2612 if (!NT_SUCCESS(Status))
2613 {
2614 TRACE("failed with status 0x%08lx\n", Status);
2615 goto done;
2616 }
2617
2618 /* Set NTPwd attribute*/
2619 Status = SampSetObjectAttribute(UserObject,
2620 L"NTPwd",
2621 REG_BINARY,
2622 &EmptyNtHash,
2624 if (!NT_SUCCESS(Status))
2625 {
2626 TRACE("failed with status 0x%08lx\n", Status);
2627 goto done;
2628 }
2629
2630 /* Set LMPwdHistory attribute*/
2631 Status = SampSetObjectAttribute(UserObject,
2632 L"LMPwdHistory",
2633 REG_BINARY,
2634 NULL,
2635 0);
2636 if (!NT_SUCCESS(Status))
2637 {
2638 TRACE("failed with status 0x%08lx\n", Status);
2639 goto done;
2640 }
2641
2642 /* Set NTPwdHistory attribute*/
2643 Status = SampSetObjectAttribute(UserObject,
2644 L"NTPwdHistory",
2645 REG_BINARY,
2646 NULL,
2647 0);
2648 if (!NT_SUCCESS(Status))
2649 {
2650 TRACE("failed with status 0x%08lx\n", Status);
2651 goto done;
2652 }
2653
2654 /* Set the PrivateData attribute */
2656 L"PrivateData",
2657 NULL);
2658 if (!NT_SUCCESS(Status))
2659 {
2660 TRACE("failed with status 0x%08lx\n", Status);
2661 goto done;
2662 }
2663
2664 /* Set the SecDesc attribute*/
2665 Status = SampSetObjectAttribute(UserObject,
2666 L"SecDesc",
2667 REG_BINARY,
2668 Sd,
2669 SdSize);
2670 if (!NT_SUCCESS(Status))
2671 {
2672 TRACE("failed with status 0x%08lx\n", Status);
2673 goto done;
2674 }
2675
2676 if (NT_SUCCESS(Status))
2677 {
2678 *UserHandle = (SAMPR_HANDLE)UserObject;
2679 *RelativeId = ulRid;
2680 }
2681
2682done:
2683 if (Sd != NULL)
2684 RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
2685
2686 if (UserSid != NULL)
2687 RtlFreeHeap(RtlGetProcessHeap(), 0, UserSid);
2688
2690
2691 TRACE("returns with status 0x%08lx\n", Status);
2692
2693 return Status;
2694}
#define MAXLONGLONG

Referenced by SamCreateUserInDomain().

◆ SamrDeleteAlias()

NTSTATUS NTAPI SamrDeleteAlias ( IN OUT SAMPR_HANDLE AliasHandle)

Definition at line 5222 of file samrpc.c.

5223{
5224 PSAM_DB_OBJECT AliasObject;
5226
5227 TRACE("SamrDeleteAlias(%p)\n", AliasHandle);
5228
5230 TRUE);
5231
5232 /* Validate the alias handle */
5233 Status = SampValidateDbObject(*AliasHandle,
5235 DELETE,
5236 &AliasObject);
5237 if (!NT_SUCCESS(Status))
5238 {
5239 TRACE("SampValidateDbObject failed (Status 0x%08lx)\n", Status);
5240 goto done;
5241 }
5242
5243 /* Fail, if the alias is built-in */
5244 if (AliasObject->RelativeId < 1000)
5245 {
5246 TRACE("You can not delete a special account!\n");
5248 goto done;
5249 }
5250
5251 /* Remove all members from the alias */
5253 if (!NT_SUCCESS(Status))
5254 {
5255 TRACE("SampRemoveAllMembersFromAlias() failed (Status 0x%08lx)\n", Status);
5256 goto done;
5257 }
5258
5259 /* Delete the alias from the database */
5260 Status = SampDeleteAccountDbObject(AliasObject);
5261 if (!NT_SUCCESS(Status))
5262 {
5263 TRACE("SampDeleteAccountDbObject() failed (Status 0x%08lx)\n", Status);
5264 goto done;
5265 }
5266
5267 /* Invalidate the handle */
5268 *AliasHandle = NULL;
5269
5270done:
5272
5273 return Status;
5274}
NTSTATUS SampRemoveAllMembersFromAlias(IN PSAM_DB_OBJECT AliasObject)
Definition: alias.c:314
NTSTATUS SampDeleteAccountDbObject(PSAM_DB_OBJECT DbObject)
Definition: database.c:368
#define DELETE
Definition: nt_native.h:57
#define STATUS_SPECIAL_ACCOUNT
Definition: ntstatus.h:528

Referenced by SamDeleteAlias().

◆ SamrDeleteGroup()

NTSTATUS NTAPI SamrDeleteGroup ( IN OUT SAMPR_HANDLE GroupHandle)

Definition at line 4534 of file samrpc.c.

4535{
4536 PSAM_DB_OBJECT GroupObject;
4537 ULONG Length = 0;
4539
4540 TRACE("SamrDeleteGroup(%p)\n", GroupHandle);
4541
4543 TRUE);
4544
4545 /* Validate the group handle */
4546 Status = SampValidateDbObject(*GroupHandle,
4548 DELETE,
4549 &GroupObject);
4550 if (!NT_SUCCESS(Status))
4551 {
4552 TRACE("SampValidateDbObject() failed (Status 0x%08lx)\n", Status);
4553 goto done;
4554 }
4555
4556 /* Fail, if the group is built-in */
4557 if (GroupObject->RelativeId < 1000)
4558 {
4559 TRACE("You can not delete a special account!\n");
4561 goto done;
4562 }
4563
4564 /* Get the length of the Members attribute */
4565 SampGetObjectAttribute(GroupObject,
4566 L"Members",
4567 NULL,
4568 NULL,
4569 &Length);
4570
4571 /* Fail, if the group has members */
4572 if (Length != 0)
4573 {
4574 TRACE("There are still members in the group!\n");
4576 goto done;
4577 }
4578
4579 /* FIXME: Remove the group from all aliases */
4580
4581 /* Delete the group from the database */
4582 Status = SampDeleteAccountDbObject(GroupObject);
4583 if (!NT_SUCCESS(Status))
4584 {
4585 TRACE("SampDeleteAccountDbObject() failed (Status 0x%08lx)\n", Status);
4586 goto done;
4587 }
4588
4589 /* Invalidate the handle */
4590 *GroupHandle = NULL;
4591
4592done:
4594
4595 return Status;
4596}
#define STATUS_MEMBER_IN_GROUP
Definition: ntstatus.h:339

Referenced by SamDeleteGroup().

◆ SamrDeleteUser()

NTSTATUS NTAPI SamrDeleteUser ( IN OUT SAMPR_HANDLE UserHandle)

Definition at line 5482 of file samrpc.c.

5483{
5484 PSAM_DB_OBJECT UserObject;
5486
5487 TRACE("SamrDeleteUser(%p)\n", UserHandle);
5488
5490 TRUE);
5491
5492 /* Validate the user handle */
5493 Status = SampValidateDbObject(*UserHandle,
5495 DELETE,
5496 &UserObject);
5497 if (!NT_SUCCESS(Status))
5498 {
5499 TRACE("SampValidateDbObject() failed (Status 0x%08lx)\n", Status);
5500 goto done;
5501 }
5502
5503 /* Fail, if the user is built-in */
5504 if (UserObject->RelativeId < 1000)
5505 {
5506 TRACE("You can not delete a special account!\n");
5508 goto done;
5509 }
5510
5511 /* Remove the user from all groups */
5512 Status = SampRemoveUserFromAllGroups(UserObject);
5513 if (!NT_SUCCESS(Status))
5514 {
5515 TRACE("SampRemoveUserFromAllGroups() failed (Status 0x%08lx)\n", Status);
5516 goto done;
5517 }
5518
5519 /* Remove the user from all aliases */
5521 if (!NT_SUCCESS(Status))
5522 {
5523 TRACE("SampRemoveUserFromAllAliases() failed (Status 0x%08lx)\n", Status);
5524 goto done;
5525 }
5526
5527 /* Delete the user from the database */
5528 Status = SampDeleteAccountDbObject(UserObject);
5529 if (!NT_SUCCESS(Status))
5530 {
5531 TRACE("SampDeleteAccountDbObject() failed (Status 0x%08lx)\n", Status);
5532 goto done;
5533 }
5534
5535 /* Invalidate the handle */
5536 *UserHandle = NULL;
5537
5538done:
5540
5541 return Status;
5542}
NTSTATUS SampRemoveUserFromAllGroups(IN PSAM_DB_OBJECT UserObject)
Definition: user.c:319
NTSTATUS SampRemoveUserFromAllAliases(IN PSAM_DB_OBJECT UserObject)
Definition: user.c:391

Referenced by SamDeleteUser().

◆ SamrEnumerateAliasesInDomain()

NTSTATUS NTAPI SamrEnumerateAliasesInDomain ( IN SAMPR_HANDLE  DomainHandle,
IN OUT unsigned long EnumerationContext,
OUT PSAMPR_ENUMERATION_BUFFER Buffer,
IN unsigned long  PreferedMaximumLength,
OUT unsigned long CountReturned 
)

Definition at line 3085 of file samrpc.c.

3090{
3091 PSAMPR_ENUMERATION_BUFFER EnumBuffer = NULL;
3092 PSAM_DB_OBJECT DomainObject;
3093 HANDLE AliasesKeyHandle = NULL;
3094 HANDLE NamesKeyHandle = NULL;
3095 WCHAR AliasName[64];
3096 ULONG EnumIndex;
3097 ULONG EnumCount = 0;
3099 ULONG NameLength;
3101 ULONG Rid;
3102 ULONG i;
3103 BOOLEAN MoreEntries = FALSE;
3105
3106 TRACE("SamrEnumerateAliasesInDomain(%p %p %p %lu %p)\n",
3107 DomainHandle, EnumerationContext, Buffer,
3108 PreferedMaximumLength, CountReturned);
3109
3111 TRUE);
3112
3113 /* Validate the domain handle */
3114 Status = SampValidateDbObject(DomainHandle,
3117 &DomainObject);
3118 if (!NT_SUCCESS(Status))
3119 goto done;
3120
3121 Status = SampRegOpenKey(DomainObject->KeyHandle,
3122 L"Aliases",
3123 KEY_READ,
3124 &AliasesKeyHandle);
3125 if (!NT_SUCCESS(Status))
3126 goto done;
3127
3128 Status = SampRegOpenKey(AliasesKeyHandle,
3129 L"Names",
3130 KEY_READ,
3131 &NamesKeyHandle);
3132 if (!NT_SUCCESS(Status))
3133 goto done;
3134
3135 TRACE("Part 1\n");
3136
3137 EnumIndex = *EnumerationContext;
3138
3139 while (TRUE)
3140 {
3141 NameLength = 64 * sizeof(WCHAR);
3142 Status = SampRegEnumerateValue(NamesKeyHandle,
3143 EnumIndex,
3144 AliasName,
3145 &NameLength,
3146 NULL,
3147 NULL,
3148 NULL);
3149 if (!NT_SUCCESS(Status))
3150 {
3153 break;
3154 }
3155
3156 TRACE("EnumIndex: %lu\n", EnumIndex);
3157 TRACE("Alias name: %S\n", AliasName);
3158 TRACE("Name length: %lu\n", NameLength);
3159
3160 if ((RequiredLength + NameLength + sizeof(UNICODE_NULL) + sizeof(SAMPR_RID_ENUMERATION)) > PreferedMaximumLength)
3161 {
3162 MoreEntries = TRUE;
3163 break;
3164 }
3165
3166 RequiredLength += (NameLength + sizeof(UNICODE_NULL) + sizeof(SAMPR_RID_ENUMERATION));
3167 EnumCount++;
3168
3169 EnumIndex++;
3170 }
3171
3172 TRACE("EnumCount: %lu\n", EnumCount);
3173 TRACE("RequiredLength: %lu\n", RequiredLength);
3174
3175 if (!NT_SUCCESS(Status))
3176 goto done;
3177
3178 EnumBuffer = midl_user_allocate(sizeof(SAMPR_ENUMERATION_BUFFER));
3179 if (EnumBuffer == NULL)
3180 {
3182 goto done;
3183 }
3184
3185 EnumBuffer->EntriesRead = EnumCount;
3186 if (EnumCount == 0)
3187 {
3189 goto done;
3190 }
3191
3192 EnumBuffer->Buffer = midl_user_allocate(EnumCount * sizeof(SAMPR_RID_ENUMERATION));
3193 if (EnumBuffer->Buffer == NULL)
3194 {
3196 goto done;
3197 }
3198
3199 TRACE("Part 2\n");
3200
3201 EnumIndex = *EnumerationContext;
3202 for (i = 0; i < EnumCount; i++, EnumIndex++)
3203 {
3204 NameLength = 64 * sizeof(WCHAR);
3205 DataLength = sizeof(ULONG);
3206 Status = SampRegEnumerateValue(NamesKeyHandle,
3207 EnumIndex,
3208 AliasName,
3209 &NameLength,
3210 NULL,
3211 &Rid,
3212 &DataLength);
3213 if (!NT_SUCCESS(Status))
3214 {
3217 break;
3218 }
3219
3220 TRACE("EnumIndex: %lu\n", EnumIndex);
3221 TRACE("Alias name: %S\n", AliasName);
3222 TRACE("Name length: %lu\n", NameLength);
3223 TRACE("RID: %lu\n", Rid);
3224
3225 EnumBuffer->Buffer[i].RelativeId = Rid;
3226
3227 EnumBuffer->Buffer[i].Name.Length = (USHORT)NameLength;
3228 EnumBuffer->Buffer[i].Name.MaximumLength = (USHORT)(NameLength + sizeof(UNICODE_NULL));
3229
3230/* FIXME: Disabled because of bugs in widl and rpcrt4 */
3231#if 0
3232 EnumBuffer->Buffer[i].Name.Buffer = midl_user_allocate(EnumBuffer->Buffer[i].Name.MaximumLength);
3233 if (EnumBuffer->Buffer[i].Name.Buffer == NULL)
3234 {
3236 goto done;
3237 }
3238
3239 memcpy(EnumBuffer->Buffer[i].Name.Buffer,
3240 AliasName,
3241 EnumBuffer->Buffer[i].Name.Length);
3242#endif
3243 }
3244
3245done:
3246 if (NT_SUCCESS(Status))
3247 {
3248 *EnumerationContext += EnumCount;
3249 *Buffer = EnumBuffer;
3250 *CountReturned = EnumCount;
3251 }
3252 else
3253 {
3254 *EnumerationContext = 0;
3255 *Buffer = NULL;
3256 *CountReturned = 0;
3257
3258 if (EnumBuffer != NULL)
3259 {
3260 if (EnumBuffer->Buffer != NULL)
3261 {
3262 if (EnumBuffer->EntriesRead != 0)
3263 {
3264 for (i = 0; i < EnumBuffer->EntriesRead; i++)
3265 {
3266 if (EnumBuffer->Buffer[i].Name.Buffer != NULL)
3267 midl_user_free(EnumBuffer->Buffer[i].Name.Buffer);
3268 }
3269 }
3270
3271 midl_user_free(EnumBuffer->Buffer);
3272 }
3273
3274 midl_user_free(EnumBuffer);
3275 }
3276 }
3277
3278 SampRegCloseKey(&NamesKeyHandle);
3279 SampRegCloseKey(&AliasesKeyHandle);
3280
3281 if ((Status == STATUS_SUCCESS) && (MoreEntries != FALSE))
3283
3285
3286 return Status;
3287}
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
NTSTATUS SampRegEnumerateValue(IN HANDLE KeyHandle, IN ULONG Index, OUT LPWSTR Name, IN OUT PULONG NameLength, OUT PULONG Type OPTIONAL, OUT PVOID Data OPTIONAL, IN OUT PULONG DataLength OPTIONAL)
Definition: registry.c:226
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define UNICODE_NULL
#define DOMAIN_LIST_ACCOUNTS
Definition: ntsam.h:41
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:205
unsigned short USHORT
Definition: pedump.c:61
unsigned short Length
Definition: msv1_0.h:22
unsigned short MaximumLength
Definition: msv1_0.h:23
PSAMPR_RID_ENUMERATION Buffer
Definition: sam.idl:96
unsigned long EntriesRead
Definition: sam.idl:95
unsigned long RelativeId
Definition: sam.idl:89
RPC_UNICODE_STRING Name
Definition: sam.idl:90
#define STATUS_MORE_ENTRIES
Definition: udferr_usr.h:124
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:30

Referenced by SamEnumerateAliasesInDomain().

◆ SamrEnumerateDomainsInSamServer()

NTSTATUS NTAPI SamrEnumerateDomainsInSamServer ( IN SAMPR_HANDLE  ServerHandle,
IN OUT unsigned long EnumerationContext,
OUT PSAMPR_ENUMERATION_BUFFER Buffer,
IN ULONG  PreferedMaximumLength,
OUT PULONG  CountReturned 
)

Definition at line 621 of file samrpc.c.

626{
627 PSAM_DB_OBJECT ServerObject;
628 WCHAR DomainKeyName[64];
629 HANDLE DomainsKeyHandle = NULL;
630 HANDLE DomainKeyHandle = NULL;
631 ULONG EnumIndex;
632 ULONG EnumCount;
635 ULONG i;
636 PSAMPR_ENUMERATION_BUFFER EnumBuffer = NULL;
638
639 TRACE("SamrEnumerateDomainsInSamServer(%p %p %p %lu %p)\n",
640 ServerHandle, EnumerationContext, Buffer, PreferedMaximumLength,
641 CountReturned);
642
644 TRUE);
645
646 /* Validate the server handle */
647 Status = SampValidateDbObject(ServerHandle,
650 &ServerObject);
651 if (!NT_SUCCESS(Status))
652 goto done;
653
654 Status = SampRegOpenKey(ServerObject->KeyHandle,
655 L"Domains",
656 KEY_READ,
657 &DomainsKeyHandle);
658 if (!NT_SUCCESS(Status))
659 goto done;
660
661 EnumIndex = *EnumerationContext;
662 EnumCount = 0;
663 RequiredLength = 0;
664
665 while (TRUE)
666 {
667 Status = SampRegEnumerateSubKey(DomainsKeyHandle,
668 EnumIndex,
669 64 * sizeof(WCHAR),
670 DomainKeyName);
671 if (!NT_SUCCESS(Status))
672 break;
673
674 TRACE("EnumIndex: %lu\n", EnumIndex);
675 TRACE("Domain key name: %S\n", DomainKeyName);
676
677 Status = SampRegOpenKey(DomainsKeyHandle,
678 DomainKeyName,
679 KEY_READ,
680 &DomainKeyHandle);
681 TRACE("SampRegOpenKey returned %08lX\n", Status);
682 if (NT_SUCCESS(Status))
683 {
684 DataLength = 0;
685 Status = SampRegQueryValue(DomainKeyHandle,
686 L"Name",
687 NULL,
688 NULL,
689 &DataLength);
690 TRACE("SampRegQueryValue returned %08lX\n", Status);
691 if (NT_SUCCESS(Status))
692 {
693 TRACE("Data length: %lu\n", DataLength);
694
695 if ((RequiredLength + DataLength + sizeof(UNICODE_STRING)) > PreferedMaximumLength)
696 break;
697
699 EnumCount++;
700 }
701
702 SampRegCloseKey(&DomainKeyHandle);
703 }
704
705 EnumIndex++;
706 }
707
708 TRACE("EnumCount: %lu\n", EnumCount);
709 TRACE("RequiredLength: %lu\n", RequiredLength);
710
711 EnumBuffer = midl_user_allocate(sizeof(SAMPR_ENUMERATION_BUFFER));
712 if (EnumBuffer == NULL)
713 {
715 goto done;
716 }
717
718 EnumBuffer->EntriesRead = EnumCount;
719 EnumBuffer->Buffer = midl_user_allocate(EnumCount * sizeof(SAMPR_RID_ENUMERATION));
720 if (EnumBuffer->Buffer == NULL)
721 {
723 goto done;
724 }
725
726 EnumIndex = *EnumerationContext;
727 for (i = 0; i < EnumCount; i++, EnumIndex++)
728 {
729 Status = SampRegEnumerateSubKey(DomainsKeyHandle,
730 EnumIndex,
731 64 * sizeof(WCHAR),
732 DomainKeyName);
733 if (!NT_SUCCESS(Status))
734 break;
735
736 TRACE("EnumIndex: %lu\n", EnumIndex);
737 TRACE("Domain key name: %S\n", DomainKeyName);
738
739 Status = SampRegOpenKey(DomainsKeyHandle,
740 DomainKeyName,
741 KEY_READ,
742 &DomainKeyHandle);
743 TRACE("SampRegOpenKey returned %08lX\n", Status);
744 if (NT_SUCCESS(Status))
745 {
746 DataLength = 0;
747 Status = SampRegQueryValue(DomainKeyHandle,
748 L"Name",
749 NULL,
750 NULL,
751 &DataLength);
752 TRACE("SampRegQueryValue returned %08lX\n", Status);
753 if (NT_SUCCESS(Status))
754 {
755 EnumBuffer->Buffer[i].RelativeId = 0;
756 EnumBuffer->Buffer[i].Name.Length = (USHORT)DataLength - sizeof(WCHAR);
757 EnumBuffer->Buffer[i].Name.MaximumLength = (USHORT)DataLength;
759 if (EnumBuffer->Buffer[i].Name.Buffer == NULL)
760 {
761 SampRegCloseKey(&DomainKeyHandle);
763 goto done;
764 }
765
766 Status = SampRegQueryValue(DomainKeyHandle,
767 L"Name",
768 NULL,
769 EnumBuffer->Buffer[i].Name.Buffer,
770 &DataLength);
771 TRACE("SampRegQueryValue returned %08lX\n", Status);
772 if (NT_SUCCESS(Status))
773 {
774 TRACE("Domain name: %S\n", EnumBuffer->Buffer[i].Name.Buffer);
775 }
776 }
777
778 SampRegCloseKey(&DomainKeyHandle);
779
780 if (!NT_SUCCESS(Status))
781 goto done;
782 }
783 }
784
785 if (NT_SUCCESS(Status))
786 {
787 *EnumerationContext += EnumCount;
788 *Buffer = EnumBuffer;
789 *CountReturned = EnumCount;
790 }
791
792done:
793 SampRegCloseKey(&DomainKeyHandle);
794 SampRegCloseKey(&DomainsKeyHandle);
795
796 if (!NT_SUCCESS(Status))
797 {
798 *EnumerationContext = 0;
799 *Buffer = NULL;
800 *CountReturned = 0;
801
802 if (EnumBuffer != NULL)
803 {
804 if (EnumBuffer->Buffer != NULL)
805 {
806 if (EnumBuffer->EntriesRead != 0)
807 {
808 for (i = 0; i < EnumBuffer->EntriesRead; i++)
809 {
810 if (EnumBuffer->Buffer[i].Name.Buffer != NULL)
811 midl_user_free(EnumBuffer->Buffer[i].Name.Buffer);
812 }
813 }
814
815 midl_user_free(EnumBuffer->Buffer);
816 }
817
818 midl_user_free(EnumBuffer);
819 }
820 }
821
823
824 return Status;
825}
NTSTATUS SampRegQueryValue(IN HANDLE KeyHandle, IN LPCWSTR ValueName, OUT PULONG Type OPTIONAL, OUT PVOID Data OPTIONAL, IN OUT PULONG DataLength OPTIONAL)
Definition: registry.c:332
NTSTATUS SampRegEnumerateSubKey(IN HANDLE KeyHandle, IN ULONG Index, IN ULONG Length, OUT LPWSTR Buffer)
Definition: registry.c:101
struct _UNICODE_STRING UNICODE_STRING
#define SAM_SERVER_ENUMERATE_DOMAINS
Definition: ntsam.h:103

Referenced by SamEnumerateDomainsInSamServer().

◆ SamrEnumerateGroupsInDomain()

NTSTATUS NTAPI SamrEnumerateGroupsInDomain ( IN SAMPR_HANDLE  DomainHandle,
IN OUT unsigned long EnumerationContext,
OUT PSAMPR_ENUMERATION_BUFFER Buffer,
IN unsigned long  PreferedMaximumLength,
OUT unsigned long CountReturned 
)

Definition at line 2088 of file samrpc.c.

2093{
2094 PSAMPR_ENUMERATION_BUFFER EnumBuffer = NULL;
2095 PSAM_DB_OBJECT DomainObject;
2096 HANDLE GroupsKeyHandle = NULL;
2097 HANDLE NamesKeyHandle = NULL;
2098 WCHAR GroupName[64];
2099 ULONG EnumIndex;
2100 ULONG EnumCount = 0;
2102 ULONG NameLength;
2104 ULONG Rid;
2105 ULONG i;
2106 BOOLEAN MoreEntries = FALSE;
2108
2109 TRACE("SamrEnumerateUsersInDomain(%p %p %p %lu %p)\n",
2110 DomainHandle, EnumerationContext, Buffer,
2111 PreferedMaximumLength, CountReturned);
2112
2114 TRUE);
2115
2116 /* Validate the domain handle */
2117 Status = SampValidateDbObject(DomainHandle,
2120 &DomainObject);
2121 if (!NT_SUCCESS(Status))
2122 goto done;
2123
2124 Status = SampRegOpenKey(DomainObject->KeyHandle,
2125 L"Groups",
2126 KEY_READ,
2127 &GroupsKeyHandle);
2128 if (!NT_SUCCESS(Status))
2129 goto done;
2130
2131 Status = SampRegOpenKey(GroupsKeyHandle,
2132 L"Names",
2133 KEY_READ,
2134 &NamesKeyHandle);
2135 if (!NT_SUCCESS(Status))
2136 goto done;
2137
2138 TRACE("Part 1\n");
2139
2140 EnumIndex = *EnumerationContext;
2141
2142 while (TRUE)
2143 {
2144 NameLength = 64 * sizeof(WCHAR);
2145 Status = SampRegEnumerateValue(NamesKeyHandle,
2146 EnumIndex,
2147 GroupName,
2148 &NameLength,
2149 NULL,
2150 NULL,
2151 NULL);
2152 if (!NT_SUCCESS(Status))
2153 {
2156 break;
2157 }
2158
2159 TRACE("EnumIndex: %lu\n", EnumIndex);
2160 TRACE("Group name: %S\n", GroupName);
2161 TRACE("Name length: %lu\n", NameLength);
2162
2163 if ((RequiredLength + NameLength + sizeof(UNICODE_NULL) + sizeof(SAMPR_RID_ENUMERATION)) > PreferedMaximumLength)
2164 {
2165 MoreEntries = TRUE;
2166 break;
2167 }
2168
2169 RequiredLength += (NameLength + sizeof(UNICODE_NULL) + sizeof(SAMPR_RID_ENUMERATION));
2170 EnumCount++;
2171
2172 EnumIndex++;
2173 }
2174
2175 TRACE("EnumCount: %lu\n", EnumCount);
2176 TRACE("RequiredLength: %lu\n", RequiredLength);
2177
2178 if (!NT_SUCCESS(Status))
2179 goto done;
2180
2181 EnumBuffer = midl_user_allocate(sizeof(SAMPR_ENUMERATION_BUFFER));
2182 if (EnumBuffer == NULL)
2183 {
2185 goto done;
2186 }
2187
2188 EnumBuffer->EntriesRead = EnumCount;
2189 if (EnumCount == 0)
2190 {
2192 goto done;
2193 }
2194
2195 EnumBuffer->Buffer = midl_user_allocate(EnumCount * sizeof(SAMPR_RID_ENUMERATION));
2196 if (EnumBuffer->Buffer == NULL)
2197 {
2199 goto done;
2200 }
2201
2202 TRACE("Part 2\n");
2203
2204 EnumIndex = *EnumerationContext;
2205 for (i = 0; i < EnumCount; i++, EnumIndex++)
2206 {
2207 NameLength = 64 * sizeof(WCHAR);
2208 DataLength = sizeof(ULONG);
2209 Status = SampRegEnumerateValue(NamesKeyHandle,
2210 EnumIndex,
2211 GroupName,
2212 &NameLength,
2213 NULL,
2214 &Rid,
2215 &DataLength);
2216 if (!NT_SUCCESS(Status))
2217 {
2220 break;
2221 }
2222
2223 TRACE("EnumIndex: %lu\n", EnumIndex);
2224 TRACE("Group name: %S\n", GroupName);
2225 TRACE("Name length: %lu\n", NameLength);
2226 TRACE("RID: %lu\n", Rid);
2227
2228 EnumBuffer->Buffer[i].RelativeId = Rid;
2229
2230 EnumBuffer->Buffer[i].Name.Length = (USHORT)NameLength;
2231 EnumBuffer->Buffer[i].Name.MaximumLength = (USHORT)(NameLength + sizeof(UNICODE_NULL));
2232
2233/* FIXME: Disabled because of bugs in widl and rpcrt4 */
2234#if 0
2235 EnumBuffer->Buffer[i].Name.Buffer = midl_user_allocate(EnumBuffer->Buffer[i].Name.MaximumLength);
2236 if (EnumBuffer->Buffer[i].Name.Buffer == NULL)
2237 {
2239 goto done;
2240 }
2241
2242 memcpy(EnumBuffer->Buffer[i].Name.Buffer,
2243 GroupName,
2244 EnumBuffer->Buffer[i].Name.Length);
2245#endif
2246 }
2247
2248done:
2249 if (NT_SUCCESS(Status))
2250 {
2251 *EnumerationContext += EnumCount;
2252 *Buffer = EnumBuffer;
2253 *CountReturned = EnumCount;
2254 }
2255 else
2256 {
2257 *EnumerationContext = 0;
2258 *Buffer = NULL;
2259 *CountReturned = 0;
2260
2261 if (EnumBuffer != NULL)
2262 {
2263 if (EnumBuffer->Buffer != NULL)
2264 {
2265 if (EnumBuffer->EntriesRead != 0)
2266 {
2267 for (i = 0; i < EnumBuffer->EntriesRead; i++)
2268 {
2269 if (EnumBuffer->Buffer[i].Name.Buffer != NULL)
2270 midl_user_free(EnumBuffer->Buffer[i].Name.Buffer);
2271 }
2272 }
2273
2274 midl_user_free(EnumBuffer->Buffer);
2275 }
2276
2277 midl_user_free(EnumBuffer);
2278 }
2279 }
2280
2281 SampRegCloseKey(&NamesKeyHandle);
2282 SampRegCloseKey(&GroupsKeyHandle);
2283
2284 if ((Status == STATUS_SUCCESS) && (MoreEntries != FALSE))
2286
2288
2289 return Status;
2290}

Referenced by SamEnumerateGroupsInDomain().

◆ SamrEnumerateUsersInDomain()

NTSTATUS NTAPI SamrEnumerateUsersInDomain ( IN SAMPR_HANDLE  DomainHandle,
IN OUT unsigned long EnumerationContext,
IN unsigned long  UserAccountControl,
OUT PSAMPR_ENUMERATION_BUFFER Buffer,
IN unsigned long  PreferedMaximumLength,
OUT unsigned long CountReturned 
)

Definition at line 2700 of file samrpc.c.

2706{
2707 PSAMPR_ENUMERATION_BUFFER EnumBuffer = NULL;
2708 PSAM_DB_OBJECT DomainObject;
2709 HANDLE UsersKeyHandle = NULL;
2710 HANDLE NamesKeyHandle = NULL;
2711 WCHAR UserName[64];
2712 ULONG EnumIndex;
2713 ULONG EnumCount = 0;
2715 ULONG NameLength;
2717 ULONG Rid;
2718 ULONG i;
2719 BOOLEAN MoreEntries = FALSE;
2721
2722 TRACE("SamrEnumerateUsersInDomain(%p %p %lx %p %lu %p)\n",
2723 DomainHandle, EnumerationContext, UserAccountControl, Buffer,
2724 PreferedMaximumLength, CountReturned);
2725
2727 TRUE);
2728
2729 /* Validate the domain handle */
2730 Status = SampValidateDbObject(DomainHandle,
2733 &DomainObject);
2734 if (!NT_SUCCESS(Status))
2735 goto done;
2736
2737 Status = SampRegOpenKey(DomainObject->KeyHandle,
2738 L"Users",
2739 KEY_READ,
2740 &UsersKeyHandle);
2741 if (!NT_SUCCESS(Status))
2742 goto done;
2743
2744 Status = SampRegOpenKey(UsersKeyHandle,
2745 L"Names",
2746 KEY_READ,
2747 &NamesKeyHandle);
2748 if (!NT_SUCCESS(Status))
2749 goto done;
2750
2751 TRACE("Part 1\n");
2752
2753 EnumIndex = *EnumerationContext;
2754
2755 while (TRUE)
2756 {
2757 NameLength = 64 * sizeof(WCHAR);
2758 Status = SampRegEnumerateValue(NamesKeyHandle,
2759 EnumIndex,
2760 UserName,
2761 &NameLength,
2762 NULL,
2763 NULL,
2764 NULL);
2765 if (!NT_SUCCESS(Status))
2766 {
2769 break;
2770 }
2771
2772 TRACE("EnumIndex: %lu\n", EnumIndex);
2773 TRACE("User name: %S\n", UserName);
2774 TRACE("Name length: %lu\n", NameLength);
2775
2776 if ((RequiredLength + NameLength + sizeof(UNICODE_NULL) + sizeof(SAMPR_RID_ENUMERATION)) > PreferedMaximumLength)
2777 {
2778 MoreEntries = TRUE;
2779 break;
2780 }
2781
2782 RequiredLength += (NameLength + sizeof(UNICODE_NULL) + sizeof(SAMPR_RID_ENUMERATION));
2783 EnumCount++;
2784
2785 EnumIndex++;
2786 }
2787
2788 TRACE("EnumCount: %lu\n", EnumCount);
2789 TRACE("RequiredLength: %lu\n", RequiredLength);
2790
2791 if (!NT_SUCCESS(Status))
2792 goto done;
2793
2794 EnumBuffer = midl_user_allocate(sizeof(SAMPR_ENUMERATION_BUFFER));
2795 if (EnumBuffer == NULL)
2796 {
2798 goto done;
2799 }
2800
2801 EnumBuffer->EntriesRead = EnumCount;
2802 if (EnumCount == 0)
2803 {
2805 goto done;
2806 }
2807
2808 EnumBuffer->Buffer = midl_user_allocate(EnumCount * sizeof(SAMPR_RID_ENUMERATION));
2809 if (EnumBuffer->Buffer == NULL)
2810 {
2812 goto done;
2813 }
2814
2815 TRACE("Part 2\n");
2816
2817 EnumIndex = *EnumerationContext;
2818 for (i = 0; i < EnumCount; i++, EnumIndex++)
2819 {
2820 NameLength = 64 * sizeof(WCHAR);
2821 DataLength = sizeof(ULONG);
2822 Status = SampRegEnumerateValue(NamesKeyHandle,
2823 EnumIndex,
2824 UserName,
2825 &NameLength,
2826 NULL,
2827 &Rid,
2828 &DataLength);
2829 if (!NT_SUCCESS(Status))
2830 {
2833 break;
2834 }
2835
2836 TRACE("EnumIndex: %lu\n", EnumIndex);
2837 TRACE("User name: %S\n", UserName);
2838 TRACE("Name length: %lu\n", NameLength);
2839 TRACE("RID: %lu\n", Rid);
2840
2841 EnumBuffer->Buffer[i].RelativeId = Rid;
2842
2843 EnumBuffer->Buffer[i].Name.Length = (USHORT)NameLength;
2844 EnumBuffer->Buffer[i].Name.MaximumLength = (USHORT)(NameLength + sizeof(UNICODE_NULL));
2845
2846/* FIXME: Disabled because of bugs in widl and rpcrt4 */
2847#if 0
2848 EnumBuffer->Buffer[i].Name.Buffer = midl_user_allocate(EnumBuffer->Buffer[i].Name.MaximumLength);
2849 if (EnumBuffer->Buffer[i].Name.Buffer == NULL)
2850 {
2852 goto done;
2853 }
2854
2855 memcpy(EnumBuffer->Buffer[i].Name.Buffer,
2856 UserName,
2857 EnumBuffer->Buffer[i].Name.Length);
2858#endif
2859 }
2860
2861done:
2862 if (NT_SUCCESS(Status))
2863 {
2864 *EnumerationContext += EnumCount;
2865 *Buffer = EnumBuffer;
2866 *CountReturned = EnumCount;
2867 }
2868 else
2869 {
2870 *EnumerationContext = 0;
2871 *Buffer = NULL;
2872 *CountReturned = 0;
2873
2874 if (EnumBuffer != NULL)
2875 {
2876 if (EnumBuffer->Buffer != NULL)
2877 {
2878 if (EnumBuffer->EntriesRead != 0)
2879 {
2880 for (i = 0; i < EnumBuffer->EntriesRead; i++)
2881 {
2882 if (EnumBuffer->Buffer[i].Name.Buffer != NULL)
2883 midl_user_free(EnumBuffer->Buffer[i].Name.Buffer);
2884 }
2885 }
2886
2887 midl_user_free(EnumBuffer->Buffer);
2888 }
2889
2890 midl_user_free(EnumBuffer);
2891 }
2892 }
2893
2894 SampRegCloseKey(&NamesKeyHandle);
2895 SampRegCloseKey(&UsersKeyHandle);
2896
2897 if ((Status == STATUS_SUCCESS) && (MoreEntries != FALSE))
2899
2901
2902 return Status;
2903}

Referenced by SamEnumerateUsersInDomain().

◆ SamrGetAliasMembership()

NTSTATUS NTAPI SamrGetAliasMembership ( IN SAMPR_HANDLE  DomainHandle,
IN PSAMPR_PSID_ARRAY  SidArray,
OUT PSAMPR_ULONG_ARRAY  Membership 
)

Definition at line 3293 of file samrpc.c.

3296{
3297 PSAM_DB_OBJECT DomainObject;
3298 HANDLE AliasesKeyHandle = NULL;
3299 HANDLE MembersKeyHandle = NULL;
3300 HANDLE MemberKeyHandle = NULL;
3301 LPWSTR MemberSidString = NULL;
3302 PULONG RidArray = NULL;
3303 ULONG MaxSidCount = 0;
3304 ULONG ValueCount;
3306 ULONG i, j;
3307 ULONG RidIndex;
3309 WCHAR NameBuffer[9];
3310
3311 TRACE("SamrGetAliasMembership(%p %p %p)\n",
3312 DomainHandle, SidArray, Membership);
3313
3315 TRUE);
3316
3317 /* Validate the domain handle */
3318 Status = SampValidateDbObject(DomainHandle,
3321 &DomainObject);
3322 if (!NT_SUCCESS(Status))
3323 goto done;
3324
3325 Status = SampRegOpenKey(DomainObject->KeyHandle,
3326 L"Aliases",
3327 KEY_READ,
3328 &AliasesKeyHandle);
3329 TRACE("SampRegOpenKey returned %08lX\n", Status);
3330 if (!NT_SUCCESS(Status))
3331 goto done;
3332
3333 Status = SampRegOpenKey(AliasesKeyHandle,
3334 L"Members",
3335 KEY_READ,
3336 &MembersKeyHandle);
3337 TRACE("SampRegOpenKey returned %08lX\n", Status);
3338
3340 {
3342 goto done;
3343 }
3344
3345 if (!NT_SUCCESS(Status))
3346 goto done;
3347
3348 for (i = 0; i < SidArray->Count; i++)
3349 {
3350 ConvertSidToStringSid(SidArray->Sids[i].SidPointer, &MemberSidString);
3351TRACE("Open %S\n", MemberSidString);
3352
3353 Status = SampRegOpenKey(MembersKeyHandle,
3354 MemberSidString,
3355 KEY_READ,
3356 &MemberKeyHandle);
3357 TRACE("SampRegOpenKey returned %08lX\n", Status);
3358 if (NT_SUCCESS(Status))
3359 {
3360 Status = SampRegQueryKeyInfo(MemberKeyHandle,
3361 NULL,
3362 &ValueCount);
3363 if (NT_SUCCESS(Status))
3364 {
3365 TRACE("Found %lu values\n", ValueCount);
3366 MaxSidCount += ValueCount;
3367 }
3368
3369 SampRegCloseKey(&MemberKeyHandle);
3370 }
3371
3374
3375 LocalFree(MemberSidString);
3376 }
3377
3378 if (MaxSidCount == 0)
3379 {
3381 goto done;
3382 }
3383
3384 TRACE("Maximum sid count: %lu\n", MaxSidCount);
3385 RidArray = midl_user_allocate(MaxSidCount * sizeof(ULONG));
3386 if (RidArray == NULL)
3387 {
3389 goto done;
3390 }
3391
3392 RidIndex = 0;
3393 for (i = 0; i < SidArray->Count; i++)
3394 {
3395 ConvertSidToStringSid(SidArray->Sids[i].SidPointer, &MemberSidString);
3396TRACE("Open %S\n", MemberSidString);
3397
3398 Status = SampRegOpenKey(MembersKeyHandle,
3399 MemberSidString,
3400 KEY_READ,
3401 &MemberKeyHandle);
3402 TRACE("SampRegOpenKey returned %08lX\n", Status);
3403 if (NT_SUCCESS(Status))
3404 {
3405 Status = SampRegQueryKeyInfo(MemberKeyHandle,
3406 NULL,
3407 &ValueCount);
3408 if (NT_SUCCESS(Status))
3409 {
3410 TRACE("Found %lu values\n", ValueCount);
3411
3412 for (j = 0; j < ValueCount; j++)
3413 {
3414 DataLength = 9 * sizeof(WCHAR);
3415 Status = SampRegEnumerateValue(MemberKeyHandle,
3416 j,
3417 NameBuffer,
3418 &DataLength,
3419 NULL,
3420 NULL,
3421 NULL);
3422 if (NT_SUCCESS(Status))
3423 {
3424 /* FIXME: Do not return each RID more than once. */
3425 RidArray[RidIndex] = wcstoul(NameBuffer, NULL, 16);
3426 RidIndex++;
3427 }
3428 }
3429 }
3430
3431 SampRegCloseKey(&MemberKeyHandle);
3432 }
3433
3436
3437 LocalFree(MemberSidString);
3438 }
3439
3440done:
3441 SampRegCloseKey(&MembersKeyHandle);
3442 SampRegCloseKey(&AliasesKeyHandle);
3443
3444 if (NT_SUCCESS(Status))
3445 {
3446 Membership->Count = MaxSidCount;
3447 Membership->Element = RidArray;
3448 }
3449 else
3450 {
3451 if (RidArray != NULL)
3452 midl_user_free(RidArray);
3453 }
3454
3456
3457 return Status;
3458}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define DOMAIN_GET_ALIAS_MEMBERSHIP
Definition: ntsam.h:40
#define ConvertSidToStringSid
Definition: sddl.h:160
uint32_t * PULONG
Definition: typedefs.h:59
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ SamrGetBootKeyInformation()

NTSTATUS NTAPI SamrGetBootKeyInformation ( IN handle_t  BindingHandle)

Definition at line 9682 of file samrpc.c.

9683{
9686}

◆ SamrGetDisplayEnumerationIndex()

NTSTATUS NTAPI SamrGetDisplayEnumerationIndex ( IN SAMPR_HANDLE  DomainHandle,
IN DOMAIN_DISPLAY_INFORMATION  DisplayInformationClass,
IN PRPC_UNICODE_STRING  Prefix,
OUT unsigned long Index 
)

Definition at line 8276 of file samrpc.c.

8280{
8281 TRACE("SamrGetDisplayEnumerationIndex(%p %lu %p %p)\n",
8282 DomainHandle, DisplayInformationClass, Prefix, Index);
8283
8284 return SamrGetDisplayEnumerationIndex2(DomainHandle,
8285 DisplayInformationClass,
8286 Prefix,
8287 Index);
8288}
NTSTATUS NTAPI SamrGetDisplayEnumerationIndex2(IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN PRPC_UNICODE_STRING Prefix, OUT unsigned long *Index)
Definition: samrpc.c:8809
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1630

◆ SamrGetDisplayEnumerationIndex2()

NTSTATUS NTAPI SamrGetDisplayEnumerationIndex2 ( IN SAMPR_HANDLE  DomainHandle,
IN DOMAIN_DISPLAY_INFORMATION  DisplayInformationClass,
IN PRPC_UNICODE_STRING  Prefix,
OUT unsigned long Index 
)

Definition at line 8809 of file samrpc.c.

8813{
8814 TRACE("SamrGetDisplayEnumerationIndex2(%p %lu %p %p)\n",
8815 DomainHandle, DisplayInformationClass, Prefix, Index);
8816
8819}

Referenced by SamGetDisplayEnumerationIndex(), and SamrGetDisplayEnumerationIndex().

◆ SamrGetDomainPasswordInformation()

NTSTATUS NTAPI SamrGetDomainPasswordInformation ( IN handle_t  BindingHandle,
IN PRPC_UNICODE_STRING  Unused,
OUT PUSER_DOMAIN_PASSWORD_INFORMATION  PasswordInformation 
)

Definition at line 9378 of file samrpc.c.

9381{
9382 SAMPR_HANDLE ServerHandle = NULL;
9383 PSAM_DB_OBJECT DomainObject = NULL;
9384 SAM_DOMAIN_FIXED_DATA FixedData;
9385 ULONG Length;
9387
9388 TRACE("SamrGetDomainPasswordInformation(%p %p %p)\n",
9389 BindingHandle, Unused, PasswordInformation);
9390
9392 &ServerHandle,
9394 if (!NT_SUCCESS(Status))
9395 {
9396 TRACE("SamrConnect() failed (Status 0x%08lx)\n", Status);
9397 goto done;
9398 }
9399
9400 Status = SampOpenDbObject((PSAM_DB_OBJECT)ServerHandle,
9401 L"Domains",
9402 L"Account",
9403 0,
9406 &DomainObject);
9407 if (!NT_SUCCESS(Status))
9408 {
9409 TRACE("SampOpenDbObject() failed (Status 0x%08lx)\n", Status);
9410 goto done;
9411 }
9412
9413 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
9414 Status = SampGetObjectAttribute(DomainObject,
9415 L"F",
9416 NULL,
9417 &FixedData,
9418 &Length);
9419 if (!NT_SUCCESS(Status))
9420 {
9421 TRACE("SampGetObjectAttribute() failed (Status 0x%08lx)\n", Status);
9422 goto done;
9423 }
9424
9425 PasswordInformation->MinPasswordLength = FixedData.MinPasswordLength;
9426 PasswordInformation->PasswordProperties = FixedData.PasswordProperties;
9427
9428done:
9429 if (DomainObject != NULL)
9430 SampCloseDbObject(DomainObject);
9431
9432 if (ServerHandle != NULL)
9433 SamrCloseHandle(&ServerHandle);
9434
9435 return Status;
9436}
#define Unused(x)
Definition: atlwin.h:28
#define SAM_SERVER_LOOKUP_DOMAIN
Definition: ntsam.h:104
#define DOMAIN_READ_PASSWORD_PARAMETERS
Definition: ntsam.h:33
NTSTATUS NTAPI SamrCloseHandle(IN OUT SAMPR_HANDLE *SamHandle)
Definition: samrpc.c:161
NTSTATUS NTAPI SamrConnect(IN PSAMPR_SERVER_NAME ServerName, OUT SAMPR_HANDLE *ServerHandle, IN ACCESS_MASK DesiredAccess)
Definition: samrpc.c:135
_In_ ULONG _Out_ HANDLE * BindingHandle
Definition: tdikrnl.h:1147

◆ SamrGetGroupsForUser()

NTSTATUS NTAPI SamrGetGroupsForUser ( IN SAMPR_HANDLE  UserHandle,
OUT PSAMPR_GET_GROUPS_BUFFER Groups 
)

Definition at line 8145 of file samrpc.c.

8147{
8148 PSAMPR_GET_GROUPS_BUFFER GroupsBuffer = NULL;
8149 PSAM_DB_OBJECT UserObject;
8150 ULONG Length = 0;
8152
8153 TRACE("SamrGetGroupsForUser(%p %p)\n",
8154 UserHandle, Groups);
8155
8157 TRUE);
8158
8159 /* Validate the user handle */
8160 Status = SampValidateDbObject(UserHandle,
8163 &UserObject);
8164 if (!NT_SUCCESS(Status))
8165 {
8166 TRACE("SampValidateDbObject failed with status 0x%08lx\n", Status);
8167 goto done;
8168 }
8169
8170 /* Allocate the groups buffer */
8171 GroupsBuffer = midl_user_allocate(sizeof(SAMPR_GET_GROUPS_BUFFER));
8172 if (GroupsBuffer == NULL)
8173 {
8175 goto done;
8176 }
8177
8178 /*
8179 * Get the size of the Groups attribute.
8180 * Do not check the status code because in case of an error
8181 * Length will be 0. And that is all we need.
8182 */
8183 SampGetObjectAttribute(UserObject,
8184 L"Groups",
8185 NULL,
8186 NULL,
8187 &Length);
8188
8189 /* If there is no Groups attribute, return a groups buffer without an array */
8190 if (Length == 0)
8191 {
8192 GroupsBuffer->MembershipCount = 0;
8193 GroupsBuffer->Groups = NULL;
8194
8195 *Groups = GroupsBuffer;
8196
8198 goto done;
8199 }
8200
8201 /* Allocate a buffer for the Groups attribute */
8202 GroupsBuffer->Groups = midl_user_allocate(Length);
8203 if (GroupsBuffer->Groups == NULL)
8204 {
8206 goto done;
8207 }
8208
8209 /* Retrieve the Grous attribute */
8210 Status = SampGetObjectAttribute(UserObject,
8211 L"Groups",
8212 NULL,
8213 GroupsBuffer->Groups,
8214 &Length);
8215 if (!NT_SUCCESS(Status))
8216 {
8217 TRACE("SampGetObjectAttribute failed with status 0x%08lx\n", Status);
8218 goto done;
8219 }
8220
8221 /* Calculate the membership count */
8222 GroupsBuffer->MembershipCount = Length / sizeof(GROUP_MEMBERSHIP);
8223
8224 /* Return the groups buffer to the caller */
8225 *Groups = GroupsBuffer;
8226
8227done:
8228 if (!NT_SUCCESS(Status))
8229 {
8230 if (GroupsBuffer != NULL)
8231 {
8232 if (GroupsBuffer->Groups != NULL)
8233 midl_user_free(GroupsBuffer->Groups);
8234
8235 midl_user_free(GroupsBuffer);
8236 }
8237 }
8238
8240
8241 return Status;
8242}
#define USER_LIST_GROUPS
Definition: ntsam.h:134
struct _GROUP_MEMBERSHIP GROUP_MEMBERSHIP
unsigned long MembershipCount
Definition: sam.idl:115
PGROUP_MEMBERSHIP Groups
Definition: sam.idl:116

Referenced by SamGetGroupsForUser().

◆ SamrGetMembersInAlias()

NTSTATUS NTAPI SamrGetMembersInAlias ( IN SAMPR_HANDLE  AliasHandle,
OUT PSAMPR_PSID_ARRAY_OUT  Members 
)

Definition at line 5360 of file samrpc.c.

5362{
5363 PSAM_DB_OBJECT AliasObject;
5364 PSAMPR_SID_INFORMATION MemberArray = NULL;
5365 ULONG MemberCount = 0;
5366 ULONG Index;
5368
5369 TRACE("SamrGetMembersInAlias(%p %p %p)\n",
5370 AliasHandle, Members);
5371
5373 TRUE);
5374
5375 /* Validate the alias handle */
5376 Status = SampValidateDbObject(AliasHandle,
5379 &AliasObject);
5380 if (!NT_SUCCESS(Status))
5381 {
5382 ERR("failed with status 0x%08lx\n", Status);
5383 goto done;
5384 }
5385
5386 Status = SampGetMembersInAlias(AliasObject,
5387 &MemberCount,
5388 &MemberArray);
5389
5390 /* Return the number of members and the member array */
5391 if (NT_SUCCESS(Status))
5392 {
5393 Members->Count = MemberCount;
5394 Members->Sids = MemberArray;
5395 }
5396
5397done:
5398 /* Clean up the members array and the SID buffers if something failed */
5399 if (!NT_SUCCESS(Status))
5400 {
5401 if (MemberArray != NULL)
5402 {
5403 for (Index = 0; Index < MemberCount; Index++)
5404 {
5405 if (MemberArray[Index].SidPointer != NULL)
5406 midl_user_free(MemberArray[Index].SidPointer);
5407 }
5408
5409 midl_user_free(MemberArray);
5410 }
5411 }
5412
5414
5415 return Status;
5416}
#define ERR(fmt,...)
Definition: debug.h:110
NTSTATUS SampGetMembersInAlias(IN PSAM_DB_OBJECT AliasObject, OUT PULONG MemberCount, OUT PSAMPR_SID_INFORMATION *MemberArray)
Definition: alias.c:218
#define ALIAS_LIST_MEMBERS
Definition: ntsam.h:11

Referenced by SamGetMembersInAlias().

◆ SamrGetMembersInGroup()

NTSTATUS NTAPI SamrGetMembersInGroup ( IN SAMPR_HANDLE  GroupHandle,
OUT PSAMPR_GET_MEMBERS_BUFFER Members 
)

Definition at line 4664 of file samrpc.c.

4666{
4667 PSAMPR_GET_MEMBERS_BUFFER MembersBuffer = NULL;
4668 PSAM_DB_OBJECT GroupObject;
4669 ULONG Length = 0;
4670 ULONG i;
4672
4673 TRACE("SamrGetMembersInGroup(%p %p)\n",
4674 GroupHandle, Members);
4675
4677 TRUE);
4678
4679 /* Validate the group handle */
4680 Status = SampValidateDbObject(GroupHandle,
4683 &GroupObject);
4684 if (!NT_SUCCESS(Status))
4685 goto done;
4686
4687 MembersBuffer = midl_user_allocate(sizeof(SAMPR_GET_MEMBERS_BUFFER));
4688 if (MembersBuffer == NULL)
4689 {
4691 goto done;
4692 }
4693
4694 SampGetObjectAttribute(GroupObject,
4695 L"Members",
4696 NULL,
4697 NULL,
4698 &Length);
4699
4700 if (Length == 0)
4701 {
4702 MembersBuffer->MemberCount = 0;
4703 MembersBuffer->Members = NULL;
4704 MembersBuffer->Attributes = NULL;
4705
4706 *Members = MembersBuffer;
4707
4709 goto done;
4710 }
4711
4712 MembersBuffer->Members = midl_user_allocate(Length);
4713 if (MembersBuffer->Members == NULL)
4714 {
4716 goto done;
4717 }
4718
4719 MembersBuffer->Attributes = midl_user_allocate(Length);
4720 if (MembersBuffer->Attributes == NULL)
4721 {
4723 goto done;
4724 }
4725
4726 Status = SampGetObjectAttribute(GroupObject,
4727 L"Members",
4728 NULL,
4729 MembersBuffer->Members,
4730 &Length);
4731 if (!NT_SUCCESS(Status))
4732 {
4733 TRACE("SampGetObjectAttributes() failed (Status 0x%08lx)\n", Status);
4734 goto done;
4735 }
4736
4737 MembersBuffer->MemberCount = Length / sizeof(ULONG);
4738
4739 for (i = 0; i < MembersBuffer->MemberCount; i++)
4740 {
4742 MembersBuffer->Members[i],
4743 GroupObject->RelativeId,
4744 &(MembersBuffer->Attributes[i]));
4745 if (!NT_SUCCESS(Status))
4746 {
4747 TRACE("SampGetUserGroupAttributes() failed (Status 0x%08lx)\n", Status);
4748 goto done;
4749 }
4750 }
4751
4752 *Members = MembersBuffer;
4753
4754done:
4755 if (!NT_SUCCESS(Status))
4756 {
4757 if (MembersBuffer != NULL)
4758 {
4759 if (MembersBuffer->Members != NULL)
4760 midl_user_free(MembersBuffer->Members);
4761
4762 if (MembersBuffer->Attributes != NULL)
4763 midl_user_free(MembersBuffer->Attributes);
4764
4765 midl_user_free(MembersBuffer);
4766 }
4767 }
4768
4770
4771 return Status;
4772}
NTSTATUS SampGetUserGroupAttributes(IN PSAM_DB_OBJECT DomainObject, IN ULONG UserId, IN ULONG GroupId, OUT PULONG GroupAttributes)
Definition: user.c:183
#define GROUP_LIST_MEMBERS
Definition: ntsam.h:79
unsigned long * Members
Definition: sam.idl:122
unsigned long MemberCount
Definition: sam.idl:121
unsigned long * Attributes
Definition: sam.idl:123

Referenced by SamGetMembersInGroup().

◆ SamrGetUserDomainPasswordInformation()

NTSTATUS NTAPI SamrGetUserDomainPasswordInformation ( IN SAMPR_HANDLE  UserHandle,
OUT PUSER_DOMAIN_PASSWORD_INFORMATION  PasswordInformation 
)

Definition at line 8314 of file samrpc.c.

8316{
8317 SAM_DOMAIN_FIXED_DATA DomainFixedData;
8318 SAM_USER_FIXED_DATA UserFixedData;
8319 PSAM_DB_OBJECT DomainObject;
8320 PSAM_DB_OBJECT UserObject;
8321 ULONG Length = 0;
8323
8324 TRACE("SamrGetUserDomainPasswordInformation(%p %p)\n",
8325 UserHandle, PasswordInformation);
8326
8328 TRUE);
8329
8330 /* Validate the user handle */
8331 Status = SampValidateDbObject(UserHandle,
8333 0,
8334 &UserObject);
8335 if (!NT_SUCCESS(Status))
8336 {
8337 TRACE("SampValidateDbObject failed with status 0x%08lx\n", Status);
8338 goto done;
8339 }
8340
8341 /* Validate the domain object */
8345 &DomainObject);
8346 if (!NT_SUCCESS(Status))
8347 {
8348 TRACE("SampValidateDbObject failed with status 0x%08lx\n", Status);
8349 goto done;
8350 }
8351
8352 /* Get fixed user data */
8353 Length = sizeof(SAM_USER_FIXED_DATA);
8354 Status = SampGetObjectAttribute(UserObject,
8355 L"F",
8356 NULL,
8357 (PVOID)&UserFixedData,
8358 &Length);
8359 if (!NT_SUCCESS(Status))
8360 {
8361 TRACE("SampGetObjectAttribute failed with status 0x%08lx\n", Status);
8362 goto done;
8363 }
8364
8365 if ((UserObject->RelativeId == DOMAIN_USER_RID_KRBTGT) ||
8369 {
8370 PasswordInformation->MinPasswordLength = 0;
8371 PasswordInformation->PasswordProperties = 0;
8372 }
8373 else
8374 {
8375 /* Get fixed domain data */
8376 Length = sizeof(SAM_DOMAIN_FIXED_DATA);
8377 Status = SampGetObjectAttribute(DomainObject,
8378 L"F",
8379 NULL,
8380 (PVOID)&DomainFixedData,
8381 &Length);
8382 if (!NT_SUCCESS(Status))
8383 {
8384 TRACE("SampGetObjectAttribute failed with status 0x%08lx\n", Status);
8385 goto done;
8386 }
8387
8388 PasswordInformation->MinPasswordLength = DomainFixedData.MinPasswordLength;
8389 PasswordInformation->PasswordProperties = DomainFixedData.PasswordProperties;
8390 }
8391
8392done:
8394
8395 return STATUS_SUCCESS;
8396}
#define DOMAIN_USER_RID_KRBTGT
Definition: setypes.h:633

Referenced by SampCheckPassword().

◆ SamrLookupDomainInSamServer()

NTSTATUS NTAPI SamrLookupDomainInSamServer ( IN SAMPR_HANDLE  ServerHandle,
IN PRPC_UNICODE_STRING  Name,
OUT PRPC_SID DomainId 
)

Definition at line 504 of file samrpc.c.

507{
508 PSAM_DB_OBJECT ServerObject;
509 HANDLE DomainsKeyHandle = NULL;
510 HANDLE DomainKeyHandle = NULL;
511 WCHAR DomainKeyName[64];
512 ULONG Index;
513 WCHAR DomainNameString[MAX_COMPUTERNAME_LENGTH + 1];
514 UNICODE_STRING DomainName;
516 BOOL Found = FALSE;
518
519 TRACE("SamrLookupDomainInSamServer(%p %p %p)\n",
520 ServerHandle, Name, DomainId);
521
523 TRUE);
524
525 /* Validate the server handle */
526 Status = SampValidateDbObject(ServerHandle,
529 &ServerObject);
530 if (!NT_SUCCESS(Status))
531 goto done;
532
533 *DomainId = NULL;
534
535 Status = SampRegOpenKey(ServerObject->KeyHandle,
536 L"Domains",
537 KEY_READ,
538 &DomainsKeyHandle);
539 if (!NT_SUCCESS(Status))
540 goto done;
541
542 Index = 0;
543 while (Found == FALSE)
544 {
545 Status = SampRegEnumerateSubKey(DomainsKeyHandle,
546 Index,
547 64,
548 DomainKeyName);
549 if (!NT_SUCCESS(Status))
550 {
553 break;
554 }
555
556 TRACE("Domain key name: %S\n", DomainKeyName);
557
558 Status = SampRegOpenKey(DomainsKeyHandle,
559 DomainKeyName,
560 KEY_READ,
561 &DomainKeyHandle);
562 if (NT_SUCCESS(Status))
563 {
564 Length = (MAX_COMPUTERNAME_LENGTH + 1) * sizeof(WCHAR);
565 Status = SampRegQueryValue(DomainKeyHandle,
566 L"Name",
567 NULL,
568 (PVOID)&DomainNameString,
569 &Length);
570 if (NT_SUCCESS(Status))
571 {
572 TRACE("Domain name: %S\n", DomainNameString);
573
574 RtlInitUnicodeString(&DomainName,
575 DomainNameString);
577 {
578 TRACE("Found it!\n");
579 Found = TRUE;
580
581 Status = SampRegQueryValue(DomainKeyHandle,
582 L"SID",
583 NULL,
584 NULL,
585 &Length);
586 if (NT_SUCCESS(Status))
587 {
588 *DomainId = midl_user_allocate(Length);
589
590 SampRegQueryValue(DomainKeyHandle,
591 L"SID",
592 NULL,
593 (PVOID)*DomainId,
594 &Length);
595
597 break;
598 }
599 }
600 }
601
602 SampRegCloseKey(&DomainKeyHandle);
603 }
604
605 Index++;
606 }
607
608done:
609 SampRegCloseKey(&DomainKeyHandle);
610 SampRegCloseKey(&DomainsKeyHandle);
611
613
614 return Status;
615}
return Found
Definition: dirsup.c:1270
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_NO_SUCH_DOMAIN
Definition: ntstatus.h:459
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:243

Referenced by MsvpChangePassword(), and SamLookupDomainInSamServer().

◆ SamrLookupIdsInDomain()

NTSTATUS NTAPI SamrLookupIdsInDomain ( IN SAMPR_HANDLE  DomainHandle,
IN ULONG  Count,
IN ULONG RelativeIds,
OUT PSAMPR_RETURNED_USTRING_ARRAY  Names,
OUT PSAMPR_ULONG_ARRAY  Use 
)

Definition at line 3693 of file samrpc.c.

3698{
3699 PSAM_DB_OBJECT DomainObject;
3700 WCHAR RidString[9];
3701 HANDLE AccountsKeyHandle = NULL;
3702 HANDLE AccountKeyHandle = NULL;
3703 ULONG MappedCount = 0;
3705 ULONG i;
3707
3708 TRACE("SamrLookupIdsInDomain(%p %lu %p %p %p)\n",
3709 DomainHandle, Count, RelativeIds, Names, Use);
3710
3712 TRUE);
3713
3714 /* Validate the domain handle */
3715 Status = SampValidateDbObject(DomainHandle,
3718 &DomainObject);
3719 if (!NT_SUCCESS(Status))
3720 {
3721 TRACE("failed with status 0x%08lx\n", Status);
3722 goto done;
3723 }
3724
3725 Names->Count = 0;
3726 Use->Count = 0;
3727
3728 if (Count == 0)
3729 {
3731 goto done;
3732 }
3733
3734 /* Allocate the names array */
3735 Names->Element = midl_user_allocate(Count * sizeof(*Names->Element));
3736 if (Names->Element == NULL)
3737 {
3739 goto done;
3740 }
3741
3742 /* Allocate the use array */
3743 Use->Element = midl_user_allocate(Count * sizeof(*Use->Element));
3744 if (Use->Element == NULL)
3745 {
3747 goto done;
3748 }
3749
3750 Names->Count = Count;
3751 Use->Count = Count;
3752
3753 for (i = 0; i < Count; i++)
3754 {
3755 TRACE("RID: %lu\n", RelativeIds[i]);
3756
3757 swprintf(RidString, L"%08lx", RelativeIds[i]);
3758
3759 /* Lookup aliases */
3760 Status = SampRegOpenKey(DomainObject->KeyHandle,
3761 L"Aliases",
3762 KEY_READ,
3763 &AccountsKeyHandle);
3764 if (NT_SUCCESS(Status))
3765 {
3766 Status = SampRegOpenKey(AccountsKeyHandle,
3767 RidString,
3768 KEY_READ,
3769 &AccountKeyHandle);
3770 if (NT_SUCCESS(Status))
3771 {
3772 DataLength = 0;
3773 Status = SampRegQueryValue(AccountKeyHandle,
3774 L"Name",
3775 NULL,
3776 NULL,
3777 &DataLength);
3778 if (NT_SUCCESS(Status))
3779 {
3780 Names->Element[i].Buffer = midl_user_allocate(DataLength);
3781 if (Names->Element[i].Buffer == NULL)
3783
3784 if (NT_SUCCESS(Status))
3785 {
3786 Names->Element[i].MaximumLength = (USHORT)DataLength;
3787 Names->Element[i].Length = (USHORT)(DataLength - sizeof(WCHAR));
3788
3789 Status = SampRegQueryValue(AccountKeyHandle,
3790 L"Name",
3791 NULL,
3792 Names->Element[i].Buffer,
3793 &DataLength);
3794 }
3795 }
3796
3797 SampRegCloseKey(&AccountKeyHandle);
3798 }
3799
3800 SampRegCloseKey(&AccountsKeyHandle);
3801 }
3802
3804 break;
3805
3806 /* Return alias account */
3807 if (NT_SUCCESS(Status) && Names->Element[i].Buffer != NULL)
3808 {
3809 TRACE("Name: %S\n", Names->Element[i].Buffer);
3810 Use->Element[i] = SidTypeAlias;
3811 MappedCount++;
3812 continue;
3813 }
3814
3815 /* Lookup groups */
3816 Status = SampRegOpenKey(DomainObject->KeyHandle,
3817 L"Groups",
3818 KEY_READ,
3819 &AccountsKeyHandle);
3820 if (NT_SUCCESS(Status))
3821 {
3822 Status = SampRegOpenKey(AccountsKeyHandle,
3823 RidString,
3824 KEY_READ,
3825 &AccountKeyHandle);
3826 if (NT_SUCCESS(Status))
3827 {
3828 DataLength = 0;
3829 Status = SampRegQueryValue(AccountKeyHandle,
3830 L"Name",
3831 NULL,
3832 NULL,
3833 &DataLength);
3834 if (NT_SUCCESS(Status))
3835 {
3836 Names->Element[i].Buffer = midl_user_allocate(DataLength);
3837 if (Names->Element[i].Buffer == NULL)
3839
3840 if (NT_SUCCESS(Status))
3841 {
3842 Names->Element[i].MaximumLength = (USHORT)DataLength;
3843 Names->Element[i].Length = (USHORT)(DataLength - sizeof(WCHAR));
3844
3845 Status = SampRegQueryValue(AccountKeyHandle,
3846 L"Name",
3847 NULL,
3848 Names->Element[i].Buffer,
3849 &DataLength);
3850 }
3851 }
3852
3853 SampRegCloseKey(&AccountKeyHandle);
3854 }
3855
3856 SampRegCloseKey(&AccountsKeyHandle);
3857 }
3858
3860 break;
3861
3862 /* Return group account */
3863 if (NT_SUCCESS(Status) && Names->Element[i].Buffer != NULL)
3864 {
3865 TRACE("Name: %S\n", Names->Element[i].Buffer);
3866 Use->Element[i] = SidTypeGroup;
3867 MappedCount++;
3868 continue;
3869 }
3870
3871 /* Lookup users */
3872 Status = SampRegOpenKey(DomainObject->KeyHandle,
3873 L"Users",
3874 KEY_READ,
3875 &AccountsKeyHandle);
3876 if (NT_SUCCESS(Status))
3877 {
3878 Status = SampRegOpenKey(AccountsKeyHandle,
3879 RidString,
3880 KEY_READ,
3881 &AccountKeyHandle);
3882 if (NT_SUCCESS(Status))
3883 {
3884 DataLength = 0;
3885 Status = SampRegQueryValue(AccountKeyHandle,
3886 L"Name",
3887 NULL,
3888 NULL,
3889 &DataLength);
3890 if (NT_SUCCESS(Status))
3891 {
3892 TRACE("DataLength: %lu\n", DataLength);
3893
3894 Names->Element[i].Buffer = midl_user_allocate(DataLength);
3895 if (Names->Element[i].Buffer == NULL)
3897
3898 if (NT_SUCCESS(Status))
3899 {
3900 Names->Element[i].MaximumLength = (USHORT)DataLength;
3901 Names->Element[i].Length = (USHORT)(DataLength - sizeof(WCHAR));
3902
3903 Status = SampRegQueryValue(AccountKeyHandle,
3904 L"Name",
3905 NULL,
3906 Names->Element[i].Buffer,
3907 &DataLength);
3908 }
3909 }
3910
3911 SampRegCloseKey(&AccountKeyHandle);
3912 }
3913
3914 SampRegCloseKey(&AccountsKeyHandle);
3915 }
3916
3918 break;
3919
3920 /* Return user account */
3921 if (NT_SUCCESS(Status) && Names->Element[i].Buffer != NULL)
3922 {
3923 TRACE("Name: %S\n", Names->Element[i].Buffer);
3924 Use->Element[i] = SidTypeUser;
3925 MappedCount++;
3926 continue;
3927 }
3928
3929 /* Return unknown account */
3930 Use->Element[i] = SidTypeUnknown;
3931 }
3932
3933done:
3936
3937 if (NT_SUCCESS(Status))
3938 {
3939 if (MappedCount == 0)
3941 else if (MappedCount < Count)
3943 }
3944 else
3945 {
3946 if (Names->Element != NULL)
3947 {
3948 for (i = 0; i < Count; i++)
3949 {
3950 if (Names->Element[i].Buffer != NULL)
3951 midl_user_free(Names->Element[i].Buffer);
3952 }
3953
3954 midl_user_free(Names->Element);
3955 Names->Element = NULL;
3956 }
3957
3958 Names->Count = 0;
3959
3960 if (Use->Element != NULL)
3961 {
3962 midl_user_free(Use->Element);
3963 Use->Element = NULL;
3964 }
3965
3966 Use->Count = 0;
3967 }
3968
3970
3971 return Status;
3972}
PWSTR Names[]
@ SidTypeUnknown
Definition: lsa.idl:125
@ SidTypeAlias
Definition: lsa.idl:121
@ SidTypeGroup
Definition: lsa.idl:119
@ SidTypeUser
Definition: lsa.idl:118
#define DOMAIN_LOOKUP
Definition: ntsam.h:42
#define STATUS_NONE_MAPPED
Definition: ntstatus.h:351
#define STATUS_SOME_NOT_MAPPED
Definition: ntstatus.h:86

Referenced by LsapLookupAccountDomainSids(), LsapLookupBuiltinDomainSids(), and SamLookupIdsInDomain().

◆ SamrLookupNamesInDomain()

NTSTATUS NTAPI SamrLookupNamesInDomain ( IN SAMPR_HANDLE  DomainHandle,
IN ULONG  Count,
IN RPC_UNICODE_STRING  Names[],
OUT PSAMPR_ULONG_ARRAY  RelativeIds,
OUT PSAMPR_ULONG_ARRAY  Use 
)

Definition at line 3464 of file samrpc.c.

3469{
3470 PSAM_DB_OBJECT DomainObject;
3471 HANDLE AccountsKeyHandle = NULL;
3472 HANDLE NamesKeyHandle = NULL;
3473 ULONG MappedCount = 0;
3475 ULONG i;
3476 ULONG RelativeId;
3478
3479 TRACE("SamrLookupNamesInDomain(%p %lu %p %p %p)\n",
3480 DomainHandle, Count, Names, RelativeIds, Use);
3481
3483 TRUE);
3484
3485 /* Validate the domain handle */
3486 Status = SampValidateDbObject(DomainHandle,
3489 &DomainObject);
3490 if (!NT_SUCCESS(Status))
3491 {
3492 TRACE("failed with status 0x%08lx\n", Status);
3493 goto done;
3494 }
3495
3496 RelativeIds->Count = 0;
3497 Use->Count = 0;
3498
3499 if (Count == 0)
3500 {
3502 goto done;
3503 }
3504
3505 /* Allocate the relative IDs array */
3506 RelativeIds->Element = midl_user_allocate(Count * sizeof(ULONG));
3507 if (RelativeIds->Element == NULL)
3508 {
3510 goto done;
3511 }
3512
3513 /* Allocate the use array */
3514 Use->Element = midl_user_allocate(Count * sizeof(ULONG));
3515 if (Use->Element == NULL)
3516 {
3518 goto done;
3519 }
3520
3521 RelativeIds->Count = Count;
3522 Use->Count = Count;
3523
3524 for (i = 0; i < Count; i++)
3525 {
3526 TRACE("Name: %S\n", Names[i].Buffer);
3527
3528 RelativeId = 0;
3529
3530 /* Lookup aliases */
3531 Status = SampRegOpenKey(DomainObject->KeyHandle,
3532 L"Aliases",
3533 KEY_READ,
3534 &AccountsKeyHandle);
3535 if (NT_SUCCESS(Status))
3536 {
3537 Status = SampRegOpenKey(AccountsKeyHandle,
3538 L"Names",
3539 KEY_READ,
3540 &NamesKeyHandle);
3541 if (NT_SUCCESS(Status))
3542 {
3543 DataLength = sizeof(ULONG);
3544 Status = SampRegQueryValue(NamesKeyHandle,
3545 Names[i].Buffer,
3546 NULL,
3547 &RelativeId,
3548 &DataLength);
3549
3550 SampRegCloseKey(&NamesKeyHandle);
3551 }
3552
3553 SampRegCloseKey(&AccountsKeyHandle);
3554 }
3555
3557 break;
3558
3559 /* Return alias account */
3560 if (NT_SUCCESS(Status) && RelativeId != 0)
3561 {
3562 TRACE("Rid: %lu\n", RelativeId);
3563 RelativeIds->Element[i] = RelativeId;
3564 Use->Element[i] = SidTypeAlias;
3565 MappedCount++;
3566 continue;
3567 }
3568
3569 /* Lookup groups */
3570 Status = SampRegOpenKey(DomainObject->KeyHandle,
3571 L"Groups",
3572 KEY_READ,
3573 &AccountsKeyHandle);
3574 if (NT_SUCCESS(Status))
3575 {
3576 Status = SampRegOpenKey(AccountsKeyHandle,
3577 L"Names",
3578 KEY_READ,
3579 &NamesKeyHandle);
3580 if (NT_SUCCESS(Status))
3581 {
3582 DataLength = sizeof(ULONG);
3583 Status = SampRegQueryValue(NamesKeyHandle,
3584 Names[i].Buffer,
3585 NULL,
3586 &RelativeId,
3587 &DataLength);
3588
3589 SampRegCloseKey(&NamesKeyHandle);
3590 }
3591
3592 SampRegCloseKey(&AccountsKeyHandle);
3593 }
3594
3596 break;
3597
3598 /* Return group account */
3599 if (NT_SUCCESS(Status) && RelativeId != 0)
3600 {
3601 TRACE("Rid: %lu\n", RelativeId);
3602 RelativeIds->Element[i] = RelativeId;
3603 Use->Element[i] = SidTypeGroup;
3604 MappedCount++;
3605 continue;
3606 }
3607
3608 /* Lookup users */
3609 Status = SampRegOpenKey(DomainObject->KeyHandle,
3610 L"Users",
3611 KEY_READ,
3612 &AccountsKeyHandle);
3613 if (NT_SUCCESS(Status))
3614 {
3615 Status = SampRegOpenKey(AccountsKeyHandle,
3616 L"Names",
3617 KEY_READ,
3618 &NamesKeyHandle);
3619 if (NT_SUCCESS(Status))
3620 {
3621 DataLength = sizeof(ULONG);
3622 Status = SampRegQueryValue(NamesKeyHandle,
3623 Names[i].Buffer,
3624 NULL,
3625 &RelativeId,
3626 &DataLength);
3627
3628 SampRegCloseKey(&NamesKeyHandle);
3629 }
3630
3631 SampRegCloseKey(&AccountsKeyHandle);
3632 }
3633
3635 break;
3636
3637 /* Return user account */
3638 if (NT_SUCCESS(Status) && RelativeId != 0)
3639 {
3640 TRACE("Rid: %lu\n", RelativeId);
3641 RelativeIds->Element[i] = RelativeId;
3642 Use->Element[i] = SidTypeUser;
3643 MappedCount++;
3644 continue;
3645 }
3646
3647 /* Return unknown account */
3648 RelativeIds->Element[i] = 0;
3649 Use->Element[i] = SidTypeUnknown;
3650 }
3651
3652done:
3655
3656 if (NT_SUCCESS(Status))
3657 {
3658 if (MappedCount == 0)
3660 else if (MappedCount < Count)
3662 }
3663 else
3664 {
3665 if (RelativeIds->Element != NULL)
3666 {
3667 midl_user_free(RelativeIds->Element);
3668 RelativeIds->Element = NULL;
3669 }
3670
3671 RelativeIds->Count = 0;
3672
3673 if (Use->Element != NULL)
3674 {
3675 midl_user_free(Use->Element);
3676 Use->Element = NULL;
3677 }
3678
3679 Use->Count = 0;
3680 }
3681
3683
3684 TRACE("Returned Status %lx\n", Status);
3685
3686 return Status;
3687}

Referenced by LsapLookupAccountNames(), LsapLookupBuiltinNames(), LsapLookupIsolatedAccountNames(), LsapLookupIsolatedBuiltinNames(), MsvpChangePassword(), SamLookupNamesInDomain(), and SamValidateNormalUser().

◆ SamrOemChangePasswordUser2()

NTSTATUS NTAPI SamrOemChangePasswordUser2 ( IN handle_t  BindingHandle,
IN PRPC_STRING  ServerName,
IN PRPC_STRING  UserName,
IN PSAMPR_ENCRYPTED_USER_PASSWORD  NewPasswordEncryptedWithOldLm,
IN PENCRYPTED_LM_OWF_PASSWORD  OldLmOwfPasswordEncryptedWithNewLm 
)

Definition at line 9348 of file samrpc.c.

9353{
9356}

◆ SamrOpenAlias()

NTSTATUS NTAPI SamrOpenAlias ( IN SAMPR_HANDLE  DomainHandle,
IN ACCESS_MASK  DesiredAccess,
IN ULONG  AliasId,
OUT SAMPR_HANDLE AliasHandle 
)

Definition at line 4821 of file samrpc.c.

4825{
4826 PSAM_DB_OBJECT DomainObject;
4827 PSAM_DB_OBJECT AliasObject;
4828 WCHAR szRid[9];
4830
4831 TRACE("SamrOpenAlias(%p %lx %lx %p)\n",
4832 DomainHandle, DesiredAccess, AliasId, AliasHandle);
4833
4834 /* Map generic access rights */
4836 &AliasMapping);
4837
4839 TRUE);
4840
4841 /* Validate the domain handle */
4842 Status = SampValidateDbObject(DomainHandle,
4845 &DomainObject);
4846 if (!NT_SUCCESS(Status))
4847 {
4848 TRACE("failed with status 0x%08lx\n", Status);
4849 goto done;
4850 }
4851
4852 /* Convert the RID into a string (hex) */
4853 swprintf(szRid, L"%08lX", AliasId);
4854
4855 /* Create the alias object */
4856 Status = SampOpenDbObject(DomainObject,
4857 L"Aliases",
4858 szRid,
4859 AliasId,
4862 &AliasObject);
4863 if (!NT_SUCCESS(Status))
4864 {
4865 TRACE("failed with status 0x%08lx\n", Status);
4866 goto done;
4867 }
4868
4869 *AliasHandle = (SAMPR_HANDLE)AliasObject;
4870
4871done:
4873
4874 return Status;
4875}

Referenced by SamOpenAlias().

◆ SamrOpenDomain()

NTSTATUS NTAPI SamrOpenDomain ( IN SAMPR_HANDLE  ServerHandle,
IN ACCESS_MASK  DesiredAccess,
IN PRPC_SID  DomainId,
OUT SAMPR_HANDLE DomainHandle 
)

Definition at line 831 of file samrpc.c.

835{
836 PSAM_DB_OBJECT ServerObject;
837 PSAM_DB_OBJECT DomainObject;
839
840 TRACE("SamrOpenDomain(%p %lx %p %p)\n",
841 ServerHandle, DesiredAccess, DomainId, DomainHandle);
842
843 /* Map generic access rights */
846
848 TRUE);
849
850 /* Validate the server handle */
851 Status = SampValidateDbObject(ServerHandle,
854 &ServerObject);
855 if (!NT_SUCCESS(Status))
856 return Status;
857
858 /* Validate the Domain SID */
859 if ((DomainId->Revision != SID_REVISION) ||
860 (DomainId->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES) ||
861 (memcmp(&DomainId->IdentifierAuthority, &NtSidAuthority, sizeof(SID_IDENTIFIER_AUTHORITY)) != 0))
863
864 /* Open the domain object */
865 if ((DomainId->SubAuthorityCount == 1) &&
866 (DomainId->SubAuthority[0] == SECURITY_BUILTIN_DOMAIN_RID))
867 {
868 /* Builtin domain object */
869 TRACE("Opening the builtin domain object.\n");
870
871 Status = SampOpenDbObject(ServerObject,
872 L"Domains",
873 L"Builtin",
874 0,
877 &DomainObject);
878 }
879 else if ((DomainId->SubAuthorityCount == 4) &&
880 (DomainId->SubAuthority[0] == SECURITY_NT_NON_UNIQUE))
881 {
882 /* Account domain object */
883 TRACE("Opening the account domain object.\n");
884
885 /* FIXME: Check the account domain sub authorities!!! */
886
887 Status = SampOpenDbObject(ServerObject,
888 L"Domains",
889 L"Account",
890 0,
893 &DomainObject);
894 }
895 else
896 {
897 /* No valid domain SID */
899 }
900
901 if (NT_SUCCESS(Status))
902 *DomainHandle = (SAMPR_HANDLE)DomainObject;
903
905
906 TRACE("SamrOpenDomain done (Status 0x%08lx)\n", Status);
907
908 return Status;
909}
static SID_IDENTIFIER_AUTHORITY NtSidAuthority
Definition: samrpc.c:14
static GENERIC_MAPPING DomainMapping
Definition: samrpc.c:24
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:581
#define SID_MAX_SUB_AUTHORITIES
Definition: setypes.h:482
#define SID_REVISION
Definition: setypes.h:481
#define SECURITY_NT_NON_UNIQUE
Definition: setypes.h:577

Referenced by LsapLookupAccountDomainSids(), LsapLookupAccountNames(), LsapLookupBuiltinDomainSids(), LsapLookupBuiltinNames(), LsapLookupIsolatedAccountNames(), and LsapLookupIsolatedBuiltinNames().

◆ SamrOpenGroup()

NTSTATUS NTAPI SamrOpenGroup ( IN SAMPR_HANDLE  DomainHandle,
IN ACCESS_MASK  DesiredAccess,
IN unsigned long  GroupId,
OUT SAMPR_HANDLE GroupHandle 
)

Definition at line 3978 of file samrpc.c.

3982{
3983 PSAM_DB_OBJECT DomainObject;
3984 PSAM_DB_OBJECT GroupObject;
3985 WCHAR szRid[9];
3987
3988 TRACE("SamrOpenGroup(%p %lx %lx %p)\n",
3989 DomainHandle, DesiredAccess, GroupId, GroupHandle);
3990
3991 /* Map generic access rights */
3993 &GroupMapping);
3994
3996 TRUE);
3997
3998 /* Validate the domain handle */
3999 Status = SampValidateDbObject(DomainHandle,
4002 &DomainObject);
4003 if (!NT_SUCCESS(Status))
4004 {
4005 TRACE("failed with status 0x%08lx\n", Status);
4006 goto done;
4007 }
4008
4009 /* Convert the RID into a string (hex) */
4010 swprintf(szRid, L"%08lX", GroupId);
4011
4012 /* Create the group object */
4013 Status = SampOpenDbObject(DomainObject,
4014 L"Groups",
4015 szRid,
4016 GroupId,
4019 &GroupObject);
4020 if (!NT_SUCCESS(Status))
4021 {
4022 TRACE("failed with status 0x%08lx\n", Status);
4023 goto done;
4024 }
4025
4026 *GroupHandle = (SAMPR_HANDLE)GroupObject;
4027
4028done:
4030
4031 return Status;
4032}

Referenced by SamOpenGroup().

◆ SamrOpenUser()

NTSTATUS NTAPI SamrOpenUser ( IN SAMPR_HANDLE  DomainHandle,
IN ACCESS_MASK  DesiredAccess,
IN unsigned long  UserId,
OUT SAMPR_HANDLE UserHandle 
)

Definition at line 5422 of file samrpc.c.

5426{
5427 PSAM_DB_OBJECT DomainObject;
5428 PSAM_DB_OBJECT UserObject;
5429 WCHAR szRid[9];
5431
5432 TRACE("SamrOpenUser(%p %lx %lx %p)\n",
5433 DomainHandle, DesiredAccess, UserId, UserHandle);
5434
5435 /* Map generic access rights */
5437 &UserMapping);
5438
5440 TRUE);
5441
5442 /* Validate the domain handle */
5443 Status = SampValidateDbObject(DomainHandle,
5446 &DomainObject);
5447 if (!NT_SUCCESS(Status))
5448 {
5449 TRACE("failed with status 0x%08lx\n", Status);
5450 goto done;
5451 }
5452
5453 /* Convert the RID into a string (hex) */
5454 swprintf(szRid, L"%08lX", UserId);
5455
5456 /* Create the user object */
5457 Status = SampOpenDbObject(DomainObject,
5458 L"Users",
5459 szRid,
5460 UserId,
5463 &UserObject);
5464 if (!NT_SUCCESS(Status))
5465 {
5466 TRACE("failed with status 0x%08lx\n", Status);
5467 goto done;
5468 }
5469
5470 *UserHandle = (SAMPR_HANDLE)UserObject;
5471
5472done:
5474
5475 return Status;
5476}

◆ SamrQueryDisplayInformation()

NTSTATUS NTAPI SamrQueryDisplayInformation ( IN SAMPR_HANDLE  DomainHandle,
IN DOMAIN_DISPLAY_INFORMATION  DisplayInformationClass,
IN unsigned long  Index,
IN unsigned long  EntryCount,
IN unsigned long  PreferredMaximumLength,
OUT unsigned long TotalAvailable,
OUT unsigned long TotalReturned,
OUT PSAMPR_DISPLAY_INFO_BUFFER  Buffer 
)

Definition at line 8248 of file samrpc.c.

8256{
8257 TRACE("SamrQueryDisplayInformation(%p %lu %lu %lu %lu %p %p %p)\n",
8258 DomainHandle, DisplayInformationClass, Index,
8259 EntryCount, PreferredMaximumLength, TotalAvailable,
8260 TotalReturned, Buffer);
8261
8262 return SamrQueryDisplayInformation3(DomainHandle,
8263 DisplayInformationClass,
8264 Index,
8265 EntryCount,
8266 PreferredMaximumLength,
8267 TotalAvailable,
8268 TotalReturned,
8269 Buffer);
8270}
NTSTATUS NTAPI SamrQueryDisplayInformation3(IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN unsigned long Index, IN unsigned long EntryCount, IN unsigned long PreferredMaximumLength, OUT unsigned long *TotalAvailable, OUT unsigned long *TotalReturned, OUT PSAMPR_DISPLAY_INFO_BUFFER Buffer)
Definition: samrpc.c:9240

◆ SamrQueryDisplayInformation2()

NTSTATUS NTAPI SamrQueryDisplayInformation2 ( IN SAMPR_HANDLE  DomainHandle,
IN DOMAIN_DISPLAY_INFORMATION  DisplayInformationClass,
IN unsigned long  Index,
IN unsigned long  EntryCount,
IN unsigned long  PreferredMaximumLength,
OUT unsigned long TotalAvailable,
OUT unsigned long TotalReturned,
OUT PSAMPR_DISPLAY_INFO_BUFFER  Buffer 
)

Definition at line 8781 of file samrpc.c.

8789{
8790 TRACE("SamrQueryDisplayInformation2(%p %lu %lu %lu %lu %p %p %p)\n",
8791 DomainHandle, DisplayInformationClass, Index,
8792 EntryCount, PreferredMaximumLength, TotalAvailable,
8793 TotalReturned, Buffer);
8794
8795 return SamrQueryDisplayInformation3(DomainHandle,
8796 DisplayInformationClass,
8797 Index,
8798 EntryCount,
8799 PreferredMaximumLength,
8800 TotalAvailable,
8801 TotalReturned,
8802 Buffer);
8803}

◆ SamrQueryDisplayInformation3()

NTSTATUS NTAPI SamrQueryDisplayInformation3 ( IN SAMPR_HANDLE  DomainHandle,
IN DOMAIN_DISPLAY_INFORMATION  DisplayInformationClass,
IN unsigned long  Index,
IN unsigned long  EntryCount,
IN unsigned long  PreferredMaximumLength,
OUT unsigned long TotalAvailable,
OUT unsigned long TotalReturned,
OUT PSAMPR_DISPLAY_INFO_BUFFER  Buffer 
)

Definition at line 9240 of file samrpc.c.

9248{
9249 PSAM_DB_OBJECT DomainObject;
9251
9252 FIXME("SamrQueryDisplayInformation3(%p %lu %lu %lu %lu %p %p %p)\n",
9253 DomainHandle, DisplayInformationClass, Index,
9254 EntryCount, PreferredMaximumLength, TotalAvailable,
9255 TotalReturned, Buffer);
9256
9258 TRUE);
9259
9260 /* Validate the domain handle */
9261 Status = SampValidateDbObject(DomainHandle,
9264 &DomainObject);
9265 if (!NT_SUCCESS(Status))
9266 {
9267 ERR("SampValidateDbObject() failed (Status 0x%08lx)\n", Status);
9268 goto done;
9269 }
9270
9271 Status = SampFillDisplayCache(DomainObject,
9272 DisplayInformationClass);
9273 if (!NT_SUCCESS(Status))
9274 {
9275 ERR("SampFillDisplayCache() failed (Status 0x%08lx)\n", Status);
9276 goto done;
9277 }
9278
9279done:
9280 TRACE("returns with status 0x%08lx\n", Status);
9281
9283
9284// return Status;
9286}
NTSTATUS SampFillDisplayCache(_In_ PSAM_DB_OBJECT DomainObject, _In_ DOMAIN_DISPLAY_INFORMATION DisplayInformationClass)
Definition: display.c:172

Referenced by SamQueryDisplayInformation(), SamrQueryDisplayInformation(), and SamrQueryDisplayInformation2().

◆ SamrQueryInformationAlias()

NTSTATUS NTAPI SamrQueryInformationAlias ( IN SAMPR_HANDLE  AliasHandle,
IN ALIAS_INFORMATION_CLASS  AliasInformationClass,
OUT PSAMPR_ALIAS_INFO_BUFFER Buffer 
)

Definition at line 5044 of file samrpc.c.

5047{
5048 PSAM_DB_OBJECT AliasObject;
5050
5051 TRACE("SamrQueryInformationAlias(%p %lu %p)\n",
5052 AliasHandle, AliasInformationClass, Buffer);
5053
5055 TRUE);
5056
5057 /* Validate the alias handle */
5058 Status = SampValidateDbObject(AliasHandle,
5061 &AliasObject);
5062 if (!NT_SUCCESS(Status))
5063 goto done;
5064
5065 switch (AliasInformationClass)
5066 {
5068 Status = SampQueryAliasGeneral(AliasObject,
5069 Buffer);
5070 break;
5071
5073 Status = SampQueryAliasName(AliasObject,
5074 Buffer);
5075 break;
5076
5078 Status = SampQueryAliasAdminComment(AliasObject,
5079 Buffer);
5080 break;
5081
5082 default:
5084 break;
5085 }
5086
5087done:
5089
5090 return Status;
5091}
@ AliasGeneralInformation
Definition: ntsam.h:279
@ AliasAdminCommentInformation
Definition: ntsam.h:281
@ AliasNameInformation
Definition: ntsam.h:280
#define ALIAS_READ_INFORMATION
Definition: ntsam.h:12
static NTSTATUS SampQueryAliasGeneral(PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER *Buffer)
Definition: samrpc.c:4879
static NTSTATUS SampQueryAliasName(PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER *Buffer)
Definition: samrpc.c:4962
static NTSTATUS SampQueryAliasAdminComment(PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER *Buffer)
Definition: samrpc.c:5002

Referenced by SamQueryInformationAlias().

◆ SamrQueryInformationDomain()

NTSTATUS NTAPI SamrQueryInformationDomain ( IN SAMPR_HANDLE  DomainHandle,
IN DOMAIN_INFORMATION_CLASS  DomainInformationClass,
OUT PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)

Definition at line 1615 of file samrpc.c.

1618{
1619 TRACE("SamrQueryInformationDomain(%p %lu %p)\n",
1620 DomainHandle, DomainInformationClass, Buffer);
1621
1622 return SamrQueryInformationDomain2(DomainHandle,
1623 DomainInformationClass,
1624 Buffer);
1625}
NTSTATUS NTAPI SamrQueryInformationDomain2(IN SAMPR_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:8461

Referenced by SamQueryInformationDomain().

◆ SamrQueryInformationDomain2()

NTSTATUS NTAPI SamrQueryInformationDomain2 ( IN SAMPR_HANDLE  DomainHandle,
IN DOMAIN_INFORMATION_CLASS  DomainInformationClass,
OUT PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)

Definition at line 8461 of file samrpc.c.

8464{
8465 PSAM_DB_OBJECT DomainObject;
8468
8469 TRACE("SamrQueryInformationDomain2(%p %lu %p)\n",
8470 DomainHandle, DomainInformationClass, Buffer);
8471
8472 switch (DomainInformationClass)
8473 {
8477 break;
8478
8489 break;
8490
8494 break;
8495
8496 default:
8498 }
8499
8501 TRUE);
8502
8503 /* Validate the server handle */
8504 Status = SampValidateDbObject(DomainHandle,
8507 &DomainObject);
8508 if (!NT_SUCCESS(Status))
8509 goto done;
8510
8511 switch (DomainInformationClass)
8512 {
8514 Status = SampQueryDomainPassword(DomainObject,
8515 Buffer);
8516 break;
8517
8519 Status = SampQueryDomainGeneral(DomainObject,
8520 Buffer);
8521 break;
8522
8524 Status = SampQueryDomainLogoff(DomainObject,
8525 Buffer);
8526 break;
8527
8529 Status = SampQueryDomainOem(DomainObject,
8530 Buffer);
8531 break;
8532
8534 Status = SampQueryDomainName(DomainObject,
8535 Buffer);
8536 break;
8537
8539 Status = SampQueryDomainReplication(DomainObject,
8540 Buffer);
8541 break;
8542
8544 Status = SampQueryDomainServerRole(DomainObject,
8545 Buffer);
8546 break;
8547
8549 Status = SampQueryDomainModified(DomainObject,
8550 Buffer);
8551 break;
8552
8554 Status = SampQueryDomainState(DomainObject,
8555 Buffer);
8556 break;
8557
8559 Status = SampQueryDomainGeneral2(DomainObject,
8560 Buffer);
8561 break;
8562
8564 Status = SampQueryDomainLockout(DomainObject,
8565 Buffer);
8566 break;
8567
8569 Status = SampQueryDomainModified2(DomainObject,
8570 Buffer);
8571 break;
8572
8573 default:
8575 }
8576
8577done:
8579
8580 return Status;
8581}
ULONG ACCESS_MASK
Definition: nt_native.h:40
@ DomainLogoffInformation
Definition: ntsam.h:343
@ DomainReplicationInformation
Definition: ntsam.h:346
@ DomainOemInformation
Definition: ntsam.h:344
@ DomainNameInformation
Definition: ntsam.h:345
@ DomainServerRoleInformation
Definition: ntsam.h:347
@ DomainPasswordInformation
Definition: ntsam.h:341
@ DomainLockoutInformation
Definition: ntsam.h:352
@ DomainModifiedInformation2
Definition: ntsam.h:353
@ DomainGeneralInformation
Definition: ntsam.h:342
@ DomainGeneralInformation2
Definition: ntsam.h:351
@ DomainStateInformation
Definition: ntsam.h:349
@ DomainModifiedInformation
Definition: ntsam.h:348
#define DOMAIN_READ_OTHER_PARAMETERS
Definition: ntsam.h:35
static NTSTATUS SampQueryDomainReplication(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:1237
static NTSTATUS SampQueryDomainLockout(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:1524
static NTSTATUS SampQueryDomainModified(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:1319
static NTSTATUS SampQueryDomainOem(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:1155
static NTSTATUS SampQueryDomainName(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:1196
static NTSTATUS SampQueryDomainLogoff(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:1113
static NTSTATUS SampQueryDomainPassword(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:913
static NTSTATUS SampQueryDomainModified2(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:1567
static NTSTATUS SampQueryDomainState(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:1363
static NTSTATUS SampQueryDomainServerRole(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:1278
static NTSTATUS SampQueryDomainGeneral(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:997
static NTSTATUS SampQueryDomainGeneral2(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:1404

Referenced by SamrQueryInformationDomain().

◆ SamrQueryInformationGroup()

NTSTATUS NTAPI SamrQueryInformationGroup ( IN SAMPR_HANDLE  GroupHandle,
IN GROUP_INFORMATION_CLASS  GroupInformationClass,
OUT PSAMPR_GROUP_INFO_BUFFER Buffer 
)

Definition at line 4252 of file samrpc.c.

4255{
4256 PSAM_DB_OBJECT GroupObject;
4258
4259 TRACE("SamrQueryInformationGroup(%p %lu %p)\n",
4260 GroupHandle, GroupInformationClass, Buffer);
4261
4263 TRUE);
4264
4265 /* Validate the group handle */
4266 Status = SampValidateDbObject(GroupHandle,
4269 &GroupObject);
4270 if (!NT_SUCCESS(Status))
4271 goto done;
4272
4273 switch (GroupInformationClass)
4274 {
4276 Status = SampQueryGroupGeneral(GroupObject,
4277 Buffer);
4278 break;
4279
4281 Status = SampQueryGroupName(GroupObject,
4282 Buffer);
4283 break;
4284
4286 Status = SampQueryGroupAttribute(GroupObject,
4287 Buffer);
4288 break;
4289
4291 Status = SampQueryGroupAdminComment(GroupObject,
4292 Buffer);
4293 break;
4294
4295 default:
4297 break;
4298 }
4299
4300done:
4302
4303 return Status;
4304}
#define GROUP_READ_INFORMATION
Definition: ntsam.h:75
@ GroupAttributeInformation
Definition: ntsam.h:466
@ GroupGeneralInformation
Definition: ntsam.h:464
@ GroupNameInformation
Definition: ntsam.h:465
@ GroupAdminCommentInformation
Definition: ntsam.h:467
static NTSTATUS SampQueryGroupGeneral(PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
Definition: samrpc.c:4036
static NTSTATUS SampQueryGroupName(PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
Definition: samrpc.c:4126
static NTSTATUS SampQueryGroupAttribute(PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
Definition: samrpc.c:4166
static NTSTATUS SampQueryGroupAdminComment(PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
Definition: samrpc.c:4210

Referenced by SamQueryInformationGroup().

◆ SamrQueryInformationUser()

NTSTATUS NTAPI SamrQueryInformationUser ( IN SAMPR_HANDLE  UserHandle,
IN USER_INFORMATION_CLASS  UserInformationClass,
OUT PSAMPR_USER_INFO_BUFFER Buffer 
)

Definition at line 7234 of file samrpc.c.

7237{
7238 TRACE("SamrQueryInformationUser(%p %lu %p)\n",
7239 UserHandle, UserInformationClass, Buffer);
7240
7241 return SamrQueryInformationUser2(UserHandle,
7242 UserInformationClass,
7243 Buffer);
7244}
NTSTATUS NTAPI SamrQueryInformationUser2(IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, OUT PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:8587

Referenced by SamQueryInformationUser(), and SamValidateNormalUser().

◆ SamrQueryInformationUser2()

NTSTATUS NTAPI SamrQueryInformationUser2 ( IN SAMPR_HANDLE  UserHandle,
IN USER_INFORMATION_CLASS  UserInformationClass,
OUT PSAMPR_USER_INFO_BUFFER Buffer 
)

Definition at line 8587 of file samrpc.c.

8590{
8591 PSAM_DB_OBJECT UserObject;
8594
8595 TRACE("SamrQueryInformationUser2(%p %lu %p)\n",
8596 UserHandle, UserInformationClass, Buffer);
8597
8598 switch (UserInformationClass)
8599 {
8607 break;
8608
8615 break;
8616
8621 break;
8622
8626 break;
8627
8634 break;
8635
8638 case UserAllInformation:
8639 DesiredAccess = 0;
8640 break;
8641
8642 default:
8644 }
8645
8647 TRUE);
8648
8649 /* Validate the domain handle */
8650 Status = SampValidateDbObject(UserHandle,
8653 &UserObject);
8654 if (!NT_SUCCESS(Status))
8655 {
8656 TRACE("failed with status 0x%08lx\n", Status);
8657 goto done;
8658 }
8659
8660 switch (UserInformationClass)
8661 {
8663 Status = SampQueryUserGeneral(UserObject,
8664 Buffer);
8665 break;
8666
8668 Status = SampQueryUserPreferences(UserObject,
8669 Buffer);
8670 break;
8671
8673 Status = SampQueryUserLogon(UserObject,
8674 Buffer);
8675 break;
8676
8678 Status = SampQueryUserLogonHours(UserObject,
8679 Buffer);
8680 break;
8681
8683 Status = SampQueryUserAccount(UserObject,
8684 Buffer);
8685 break;
8686
8688 Status = SampQueryUserName(UserObject,
8689 Buffer);
8690 break;
8691
8693 Status = SampQueryUserAccountName(UserObject,
8694 Buffer);
8695 break;
8696
8698 Status = SampQueryUserFullName(UserObject,
8699 Buffer);
8700 break;
8701
8703 Status = SampQueryUserPrimaryGroup(UserObject,
8704 Buffer);
8705 break;
8706
8708 Status = SampQueryUserHome(UserObject,
8709 Buffer);
8710 break;
8711
8713 Status = SampQueryUserScript(UserObject,
8714 Buffer);
8715 break;
8716
8718 Status = SampQueryUserProfile(UserObject,
8719 Buffer);
8720 break;
8721
8723 Status = SampQueryUserAdminComment(UserObject,
8724 Buffer);
8725 break;
8726
8728 Status = SampQueryUserWorkStations(UserObject,
8729 Buffer);
8730 break;
8731
8733 Status = SampQueryUserControl(UserObject,
8734 Buffer);
8735 break;
8736
8738 Status = SampQueryUserExpires(UserObject,
8739 Buffer);
8740 break;
8741
8743 Status = SampQueryUserInternal1(UserObject,
8744 Buffer);
8745 break;
8746
8748 Status = SampQueryUserInternal2(UserObject,
8749 Buffer);
8750 break;
8751
8753 Status = SampQueryUserParameters(UserObject,
8754 Buffer);
8755 break;
8756
8757 case UserAllInformation:
8758 Status = SampQueryUserAll(UserObject,
8759 Buffer);
8760 break;
8761
8762// case UserInternal4Information:
8763// case UserInternal5Information:
8764// case UserInternal4InformationNew:
8765// case UserInternal5InformationNew:
8766
8767 default:
8769 }
8770
8771done:
8773
8774 return Status;
8775}
@ UserScriptInformation
Definition: ntsam.h:524
@ UserAccountNameInformation
Definition: ntsam.h:520
@ UserPrimaryGroupInformation
Definition: ntsam.h:522
@ UserAccountInformation
Definition: ntsam.h:518
@ UserInternal1Information
Definition: ntsam.h:531
@ UserParametersInformation
Definition: ntsam.h:533
@ UserWorkStationsInformation
Definition: ntsam.h:527
@ UserNameInformation
Definition: ntsam.h:519
@ UserLogonHoursInformation
Definition: ntsam.h:517
@ UserLogonInformation
Definition: ntsam.h:516
@ UserGeneralInformation
Definition: ntsam.h:514
@ UserFullNameInformation
Definition: ntsam.h:521
@ UserInternal2Information
Definition: ntsam.h:532
@ UserControlInformation
Definition: ntsam.h:529
@ UserAdminCommentInformation
Definition: ntsam.h:526
@ UserProfileInformation
Definition: ntsam.h:525
@ UserAllInformation
Definition: ntsam.h:534
@ UserExpiresInformation
Definition: ntsam.h:530
@ UserPreferencesInformation
Definition: ntsam.h:515
@ UserHomeInformation
Definition: ntsam.h:523
static NTSTATUS SampQueryUserLogon(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:5697
static NTSTATUS SampQueryUserAdminComment(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6405
static NTSTATUS SampQueryUserWorkStations(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6446
static NTSTATUS SampQueryUserInternal2(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6661
static NTSTATUS SampQueryUserAll(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6749
static NTSTATUS SampQueryUserExpires(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6530
static NTSTATUS SampQueryUserGeneral(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:5547
static NTSTATUS SampQueryUserPreferences(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:5641
static NTSTATUS SampQueryUserLogonHours(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6046
static NTSTATUS SampQueryUserControl(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6488
static NTSTATUS SampQueryUserHome(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6269
static NTSTATUS SampQueryUserInternal1(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6573
static NTSTATUS SampQueryUserParameters(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6708
static NTSTATUS SampQueryUserFullName(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6186
static NTSTATUS SampQueryUserPrimaryGroup(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6228
static NTSTATUS SampQueryUserName(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6091
static NTSTATUS SampQueryUserAccount(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:5876
static NTSTATUS SampQueryUserProfile(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6364
static NTSTATUS SampQueryUserScript(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6323
static NTSTATUS SampQueryUserAccountName(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:6145

Referenced by SamrQueryInformationUser().

◆ SamrQuerySecurityObject()

NTSTATUS NTAPI SamrQuerySecurityObject ( IN SAMPR_HANDLE  ObjectHandle,
IN SECURITY_INFORMATION  SecurityInformation,
OUT PSAMPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor 
)

Definition at line 329 of file samrpc.c.

332{
333 PSAM_DB_OBJECT SamObject;
336 PSECURITY_DESCRIPTOR ResultSd = NULL;
338 ULONG RelativeSdSize = 0;
339 ULONG ResultSdSize = 0;
341
342 TRACE("SamrQuerySecurityObject(%p %lx %p)\n",
344
346
348 TRUE);
349
354
357
358 /* Validate the server handle */
359 Status = SampValidateDbObject(ObjectHandle,
362 &SamObject);
363 if (!NT_SUCCESS(Status))
364 goto done;
365
366 /* Get the size of the SD */
367 Status = SampGetObjectAttribute(SamObject,
368 L"SecDesc",
369 NULL,
370 NULL,
371 &RelativeSdSize);
373 {
374 TRACE("Status 0x%08lx\n", Status);
375 goto done;
376 }
377
378 /* Allocate a buffer for the SD */
379 RelativeSd = midl_user_allocate(RelativeSdSize);
380 if (RelativeSd == NULL)
381 {
383 goto done;
384 }
385
386 /* Get the SD */
387 Status = SampGetObjectAttribute(SamObject,
388 L"SecDesc",
389 NULL,
390 RelativeSd,
391 &RelativeSdSize);
392 if (!NT_SUCCESS(Status))
393 {
394 TRACE("Status 0x%08lx\n", Status);
395 goto done;
396 }
397
398 /* Invalidate the SD information that was not requested */
400 RelativeSd->Owner = 0;
401
403 RelativeSd->Group = 0;
404
406 RelativeSd->Control &= ~SE_DACL_PRESENT;
407
409 RelativeSd->Control &= ~SE_SACL_PRESENT;
410
411 /* Calculate the required SD size */
412 Status = RtlMakeSelfRelativeSD(RelativeSd,
413 NULL,
414 &ResultSdSize);
416 goto done;
417
418 /* Allocate a buffer for the new SD */
419 ResultSd = MIDL_user_allocate(ResultSdSize);
420 if (ResultSd == NULL)
421 {
423 goto done;
424 }
425
426 /* Build the new SD */
427 Status = RtlMakeSelfRelativeSD(RelativeSd,
428 ResultSd,
429 &ResultSdSize);
430 if (!NT_SUCCESS(Status))
431 goto done;
432
433 /* Allocate the SD data buffer */
435 if (SdData == NULL)
436 {
438 goto done;
439 }
440
441 /* Fill the SD data buffer and return it to the caller */
442 SdData->Length = ResultSdSize;
443 SdData->SecurityDescriptor = (PBYTE)ResultSd;
444
445 *SecurityDescriptor = SdData;
446
447done:
449
450 if (!NT_SUCCESS(Status))
451 {
452 if (ResultSd != NULL)
453 MIDL_user_free(ResultSd);
454 }
455
456 if (RelativeSd != NULL)
457 MIDL_user_free(RelativeSd);
458
459 return Status;
460}
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION SecurityInformation
Definition: fltkernel.h:1340
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: irotp.c:371
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
NTSYSAPI NTSTATUS NTAPI RtlMakeSelfRelativeSD(_In_ PSECURITY_DESCRIPTOR AbsoluteSD, _Out_ PSECURITY_DESCRIPTOR SelfRelativeSD, _Inout_ PULONG BufferLength)
#define ACCESS_SYSTEM_SECURITY
Definition: nt_native.h:77
#define READ_CONTROL
Definition: nt_native.h:58
BYTE * PBYTE
Definition: pedump.c:66
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
SECURITY_DESCRIPTOR_CONTROL Control
Definition: setypes.h:839
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:191
#define DACL_SECURITY_INFORMATION
Definition: setypes.h:125
#define OWNER_SECURITY_INFORMATION
Definition: setypes.h:123
#define GROUP_SECURITY_INFORMATION
Definition: setypes.h:124
#define SACL_SECURITY_INFORMATION
Definition: setypes.h:126

Referenced by SamQuerySecurityObject().

◆ SamrRemoveMemberFromAlias()

NTSTATUS NTAPI SamrRemoveMemberFromAlias ( IN SAMPR_HANDLE  AliasHandle,
IN PRPC_SID  MemberId 
)

Definition at line 5320 of file samrpc.c.

5322{
5323 PSAM_DB_OBJECT AliasObject;
5325
5326 TRACE("SamrRemoveMemberFromAlias(%p %p)\n",
5327 AliasHandle, MemberId);
5328
5330 TRUE);
5331
5332 /* Validate the alias handle */
5333 Status = SampValidateDbObject(AliasHandle,
5336 &AliasObject);
5337 if (!NT_SUCCESS(Status))
5338 {
5339 TRACE("failed with status 0x%08lx\n", Status);
5340 goto done;
5341 }
5342
5343 Status = SampRemoveMemberFromAlias(AliasObject,
5344 MemberId);
5345 if (!NT_SUCCESS(Status))
5346 {
5347 TRACE("failed with status 0x%08lx\n", Status);
5348 }
5349
5350done:
5352
5353 return Status;
5354}
NTSTATUS NTAPI SampRemoveMemberFromAlias(IN PSAM_DB_OBJECT AliasObject, IN PRPC_SID MemberId)
Definition: alias.c:111
#define ALIAS_REMOVE_MEMBER
Definition: ntsam.h:10

Referenced by SamRemoveMemberFromAlias(), and SamrRemoveMultipleMembersFromAlias().

◆ SamrRemoveMemberFromForeignDomain()

NTSTATUS NTAPI SamrRemoveMemberFromForeignDomain ( IN SAMPR_HANDLE  DomainHandle,
IN PRPC_SID  MemberSid 
)

Definition at line 8402 of file samrpc.c.

8404{
8405 PSAM_DB_OBJECT DomainObject;
8406 ULONG Rid = 0;
8408
8409 TRACE("SamrRemoveMemberFromForeignDomain(%p %p)\n",
8410 DomainHandle, MemberSid);
8411
8413 TRUE);
8414
8415 /* Validate the domain object */
8416 Status = SampValidateDbObject(DomainHandle,
8419 &DomainObject);
8420 if (!NT_SUCCESS(Status))
8421 {
8422 TRACE("SampValidateDbObject failed with status 0x%08lx\n", Status);
8423 goto done;
8424 }
8425
8426 /* Retrieve the RID from the MemberSID */
8427 Status = SampGetRidFromSid((PSID)MemberSid,
8428 &Rid);
8429 if (!NT_SUCCESS(Status))
8430 {
8431 TRACE("SampGetRidFromSid failed with status 0x%08lx\n", Status);
8432 goto done;
8433 }
8434
8435 /* Fail, if the RID represents a special account */
8436 if (Rid < 1000)
8437 {
8438 TRACE("Cannot remove a special account (RID: %lu)\n", Rid);
8440 goto done;
8441 }
8442
8443 /* Remove the member from all aliases in the domain */
8445 MemberSid);
8446 if (!NT_SUCCESS(Status))
8447 {
8448 TRACE("SampRemoveMemberFromAllAliases failed with status 0x%08lx\n", Status);
8449 }
8450
8451done:
8453
8454 return Status;
8455}
NTSTATUS SampRemoveMemberFromAllAliases(IN PSAM_DB_OBJECT DomainObject, IN PRPC_SID MemberSid)
Definition: domain.c:214
NTSTATUS SampGetRidFromSid(IN PSID Sid, OUT PULONG Rid)
Definition: utils.c:138

Referenced by SamRemoveMemberFromForeignDomain().

◆ SamrRemoveMemberFromGroup()

NTSTATUS NTAPI SamrRemoveMemberFromGroup ( IN SAMPR_HANDLE  GroupHandle,
IN unsigned long  MemberId 
)

Definition at line 4602 of file samrpc.c.

4604{
4605 PSAM_DB_OBJECT GroupObject;
4606 PSAM_DB_OBJECT UserObject = NULL;
4608
4609 TRACE("SamrRemoveMemberFromGroup(%p %lu)\n",
4610 GroupHandle, MemberId);
4611
4613 TRUE);
4614
4615 /* Validate the group handle */
4616 Status = SampValidateDbObject(GroupHandle,
4619 &GroupObject);
4620 if (!NT_SUCCESS(Status))
4621 goto done;
4622
4623 /* Open the user object in the same domain */
4624 Status = SampOpenUserObject(GroupObject->ParentObject,
4625 MemberId,
4626 0,
4627 &UserObject);
4628 if (!NT_SUCCESS(Status))
4629 {
4630 ERR("SampOpenUserObject() failed (Status 0x%08lx)\n", Status);
4631 goto done;
4632 }
4633
4634 /* Remove group membership from the user object */
4636 GroupObject->RelativeId);
4637 if (!NT_SUCCESS(Status))
4638 {
4639 ERR("SampAddGroupMembershipToUser() failed (Status 0x%08lx)\n", Status);
4640 goto done;
4641 }
4642
4643 /* Remove the member from the group object */
4644 Status = SampRemoveMemberFromGroup(GroupObject,
4645 MemberId);
4646 if (!NT_SUCCESS(Status))
4647 {
4648 ERR("SampRemoveMemberFromGroup() failed (Status 0x%08lx)\n", Status);
4649 }
4650
4651done:
4652 if (UserObject)
4653 SampCloseDbObject(UserObject);
4654
4656
4657 return Status;
4658}
NTSTATUS SampRemoveMemberFromGroup(IN PSAM_DB_OBJECT GroupObject, IN ULONG MemberId)
Definition: group.c:103
NTSTATUS SampRemoveGroupMembershipFromUser(IN PSAM_DB_OBJECT UserObject, IN ULONG GroupId)
Definition: user.c:108
#define GROUP_REMOVE_MEMBER
Definition: ntsam.h:78

Referenced by SamRemoveMemberFromGroup().

◆ SamrRemoveMultipleMembersFromAlias()

NTSTATUS NTAPI SamrRemoveMultipleMembersFromAlias ( IN SAMPR_HANDLE  AliasHandle,
IN PSAMPR_PSID_ARRAY  MembersBuffer 
)

Definition at line 9320 of file samrpc.c.

9322{
9323 ULONG i;
9325
9326 TRACE("SamrRemoveMultipleMembersFromAlias(%p %p)\n",
9327 AliasHandle, MembersBuffer);
9328
9329 for (i = 0; i < MembersBuffer->Count; i++)
9330 {
9331 Status = SamrRemoveMemberFromAlias(AliasHandle,
9332 ((PSID *)MembersBuffer->Sids)[i]);
9333
9336
9337 if (!NT_SUCCESS(Status))
9338 break;
9339 }
9340
9341 return Status;
9342}
NTSTATUS NTAPI SamrRemoveMemberFromAlias(IN SAMPR_HANDLE AliasHandle, IN PRPC_SID MemberId)
Definition: samrpc.c:5320

Referenced by SamRemoveMultipleMembersFromAlias().

◆ SamrRidToSid()

NTSTATUS NTAPI SamrRidToSid ( IN SAMPR_HANDLE  ObjectHandle,
IN unsigned long  Rid,
OUT PRPC_SID Sid 
)

Definition at line 9792 of file samrpc.c.

9795{
9798}

◆ SamrSetBootKeyInformation()

NTSTATUS NTAPI SamrSetBootKeyInformation ( IN handle_t  BindingHandle)

Definition at line 9673 of file samrpc.c.

9674{
9677}

◆ SamrSetDSRMPassword()

NTSTATUS NTAPI SamrSetDSRMPassword ( IN handle_t  BindingHandle,
IN PRPC_UNICODE_STRING  Unused,
IN unsigned long  UserId,
IN PENCRYPTED_NT_OWF_PASSWORD  EncryptedNtOwfPassword 
)

Definition at line 9803 of file samrpc.c.

9807{
9810}

◆ SamrSetInformationAlias()

NTSTATUS NTAPI SamrSetInformationAlias ( IN SAMPR_HANDLE  AliasHandle,
IN ALIAS_INFORMATION_CLASS  AliasInformationClass,
IN PSAMPR_ALIAS_INFO_BUFFER  Buffer 
)

Definition at line 5173 of file samrpc.c.

5176{
5177 PSAM_DB_OBJECT AliasObject;
5179
5180 TRACE("SamrSetInformationAlias(%p %lu %p)\n",
5181 AliasHandle, AliasInformationClass, Buffer);
5182
5184 TRUE);
5185
5186 /* Validate the alias handle */
5187 Status = SampValidateDbObject(AliasHandle,
5190 &AliasObject);
5191 if (!NT_SUCCESS(Status))
5192 goto done;
5193
5194 switch (AliasInformationClass)
5195 {
5197 Status = SampSetAliasName(AliasObject,
5198 Buffer);
5199 break;
5200
5203 L"Description",
5204 &Buffer->AdminComment.AdminComment);
5205 break;
5206
5207 default:
5209 break;
5210 }
5211
5212done:
5214
5215 return Status;
5216}
#define ALIAS_WRITE_ACCOUNT
Definition: ntsam.h:13
static NTSTATUS SampSetAliasName(PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER Buffer)
Definition: samrpc.c:5095

Referenced by SamSetInformationAlias().

◆ SamrSetInformationDomain()

NTSTATUS NTAPI SamrSetInformationDomain ( IN SAMPR_HANDLE  DomainHandle,
IN DOMAIN_INFORMATION_CLASS  DomainInformationClass,
IN PSAMPR_DOMAIN_INFO_BUFFER  DomainInformation 
)

Definition at line 1790 of file samrpc.c.

1793{
1794 PSAM_DB_OBJECT DomainObject;
1797
1798 TRACE("SamrSetInformationDomain(%p %lu %p)\n",
1799 DomainHandle, DomainInformationClass, DomainInformation);
1800
1801 switch (DomainInformationClass)
1802 {
1806 break;
1807
1812 break;
1813
1818 break;
1819
1820 default:
1822 }
1823
1825 TRUE);
1826
1827 /* Validate the server handle */
1828 Status = SampValidateDbObject(DomainHandle,
1831 &DomainObject);
1832 if (!NT_SUCCESS(Status))
1833 goto done;
1834
1835 switch (DomainInformationClass)
1836 {
1838 Status = SampSetDomainPassword(DomainObject,
1839 DomainInformation);
1840 break;
1841
1843 Status = SampSetDomainLogoff(DomainObject,
1844 DomainInformation);
1845 break;
1846
1848 Status = SampSetObjectAttributeString(DomainObject,
1849 L"OemInformation",
1850 &DomainInformation->Oem.OemInformation);
1851 break;
1852
1854 Status = SampSetObjectAttributeString(DomainObject,
1855 L"Name",
1856 &DomainInformation->Name.DomainName);
1857 break;
1858
1860 Status = SampSetObjectAttributeString(DomainObject,
1861 L"ReplicaSourceNodeName",
1862 &DomainInformation->Replication.ReplicaSourceNodeName);
1863 break;
1864
1866 Status = SampSetDomainServerRole(DomainObject,
1867 DomainInformation);
1868 break;
1869
1871 Status = SampSetDomainState(DomainObject,
1872 DomainInformation);
1873 break;
1874
1876 Status = SampSetDomainLockout(DomainObject,
1877 DomainInformation);
1878 break;
1879
1880 default:
1882 }
1883
1884done:
1886
1887 return Status;
1888}
#define DOMAIN_WRITE_OTHER_PARAMETERS
Definition: ntsam.h:36
#define DOMAIN_WRITE_PASSWORD_PARAMS
Definition: ntsam.h:34
#define DOMAIN_ADMINISTER_SERVER
Definition: ntsam.h:43
static NTSTATUS SampSetDomainState(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
Definition: samrpc.c:1726
static NTSTATUS SampSetDomainServerRole(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
Definition: samrpc.c:1696
static NTSTATUS SampSetDomainLogoff(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
Definition: samrpc.c:1665
static NTSTATUS SampSetDomainPassword(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
Definition: samrpc.c:1629
static NTSTATUS SampSetDomainLockout(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
Definition: samrpc.c:1756

Referenced by SamSetInformationDomain().

◆ SamrSetInformationGroup()

NTSTATUS NTAPI SamrSetInformationGroup ( IN SAMPR_HANDLE  GroupHandle,
IN GROUP_INFORMATION_CLASS  GroupInformationClass,
IN PSAMPR_GROUP_INFO_BUFFER  Buffer 
)

Definition at line 4416 of file samrpc.c.

4419{
4420 PSAM_DB_OBJECT GroupObject;
4422
4423 TRACE("SamrSetInformationGroup(%p %lu %p)\n",
4424 GroupHandle, GroupInformationClass, Buffer);
4425
4427 TRUE);
4428
4429 /* Validate the group handle */
4430 Status = SampValidateDbObject(GroupHandle,
4433 &GroupObject);
4434 if (!NT_SUCCESS(Status))
4435 goto done;
4436
4437 switch (GroupInformationClass)
4438 {
4440 Status = SampSetGroupName(GroupObject,
4441 Buffer);
4442 break;
4443
4445 Status = SampSetGroupAttribute(GroupObject,
4446 Buffer);
4447 break;
4448
4451 L"AdminComment",
4452 &Buffer->AdminComment.AdminComment);
4453 break;
4454
4455 default:
4457 break;
4458 }
4459
4460done:
4462
4463 return Status;
4464}
#define GROUP_WRITE_ACCOUNT
Definition: ntsam.h:76
static NTSTATUS SampSetGroupAttribute(PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER Buffer)
Definition: samrpc.c:4384
static NTSTATUS SampSetGroupName(PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER Buffer)
Definition: samrpc.c:4308

Referenced by SamSetInformationGroup().

◆ SamrSetInformationUser()

NTSTATUS NTAPI SamrSetInformationUser ( IN SAMPR_HANDLE  UserHandle,
IN USER_INFORMATION_CLASS  UserInformationClass,
IN PSAMPR_USER_INFO_BUFFER  Buffer 
)

Definition at line 7848 of file samrpc.c.

7851{
7852 TRACE("SamrSetInformationUser(%p %lu %p)\n",
7853 UserHandle, UserInformationClass, Buffer);
7854
7855 return SamrSetInformationUser2(UserHandle,
7856 UserInformationClass,
7857 Buffer);
7858}
NTSTATUS NTAPI SamrSetInformationUser2(IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, IN PSAMPR_USER_INFO_BUFFER Buffer)
Definition: samrpc.c:9468

Referenced by LsaApLogonUserEx2(), and SamSetInformationUser().

◆ SamrSetInformationUser2()

NTSTATUS NTAPI SamrSetInformationUser2 ( IN SAMPR_HANDLE  UserHandle,
IN USER_INFORMATION_CLASS  UserInformationClass,
IN PSAMPR_USER_INFO_BUFFER  Buffer 
)

Definition at line 9468 of file samrpc.c.

9471{
9472 PSAM_DB_OBJECT UserObject;
9475
9476 TRACE("SamrSetInformationUser2(%p %lu %p)\n",
9477 UserHandle, UserInformationClass, Buffer);
9478
9479 switch (UserInformationClass)
9480 {
9495 break;
9496
9500 break;
9501
9504 break;
9505
9509 break;
9510
9511 case UserAllInformation:
9513 DesiredAccess = 0; /* FIXME */
9514 break;
9515
9516 default:
9518 }
9519
9521 TRUE);
9522
9523 /* Validate the domain handle */
9524 Status = SampValidateDbObject(UserHandle,
9527 &UserObject);
9528 if (!NT_SUCCESS(Status))
9529 {
9530 TRACE("failed with status 0x%08lx\n", Status);
9531 goto done;
9532 }
9533
9534 switch (UserInformationClass)
9535 {
9537 Status = SampSetUserGeneral(UserObject,
9538 Buffer);
9539 break;
9540
9542 Status = SampSetUserPreferences(UserObject,
9543 Buffer);
9544 break;
9545
9548 &Buffer->LogonHours.LogonHours);
9549 break;
9550
9552 Status = SampSetUserName(UserObject,
9553 &Buffer->Name.UserName);
9554 if (!NT_SUCCESS(Status))
9555 break;
9556
9558 L"FullName",
9559 &Buffer->Name.FullName);
9560 break;
9561
9563 Status = SampSetUserName(UserObject,
9564 &Buffer->AccountName.UserName);
9565 break;
9566
9569 L"FullName",
9570 &Buffer->FullName.FullName);
9571 break;
9572
9574 Status = SampSetUserPrimaryGroup(UserObject,
9575 Buffer);
9576 break;
9577
9580 L"HomeDirectory",
9581 &Buffer->Home.HomeDirectory);
9582 if (!NT_SUCCESS(Status))
9583 break;
9584
9586 L"HomeDirectoryDrive",
9587 &Buffer->Home.HomeDirectoryDrive);
9588 break;
9589
9592 L"ScriptPath",
9593 &Buffer->Script.ScriptPath);
9594 break;
9595
9598 L"ProfilePath",
9599 &Buffer->Profile.ProfilePath);
9600 break;
9601
9604 L"AdminComment",
9605 &Buffer->AdminComment.AdminComment);
9606 break;
9607
9610 L"WorkStations",
9611 &Buffer->WorkStations.WorkStations);
9612 break;
9613
9615 TRACE("Password: %S\n", Buffer->SetPassword.Password.Buffer);
9616 TRACE("PasswordExpired: %d\n", Buffer->SetPassword.PasswordExpired);
9617
9619 L"Password",
9620 &Buffer->SetPassword.Password);
9621 break;
9622
9624 Status = SampSetUserControl(UserObject,
9625 Buffer);
9626 break;
9627
9629 Status = SampSetUserExpires(UserObject,
9630 Buffer);
9631 break;
9632
9634 Status = SampSetUserInternal1(UserObject,
9635 Buffer);
9636 break;
9637
9639 Status = SampSetUserInternal2(UserObject,
9640 Buffer);
9641 break;
9642
9645 L"Parameters",
9646 &Buffer->Parameters.Parameters);
9647 break;
9648
9649 case UserAllInformation:
9650 Status = SampSetUserAll(UserObject,
9651 Buffer);
9652 break;
9653
9654// case UserInternal4Information:
9655// case UserInternal5Information:
9656// case UserInternal4InformationNew:
9657// case UserInternal5InformationNew:
9658
9659 default:
9661 }
9662
9663done:
9665
9666 return Status;
9667}
#define USER_FORCE_PASSWORD_CHANGE
Definition: ntsam.h:133
#define USER_WRITE_ACCOUNT
Definition: ntsam.h:131
@ UserSetPasswordInformation
Definition: ntsam.h:528
#define USER_WRITE_PREFERENCES
Definition: ntsam.h:128
static NTSTATUS SampSetUserPreferences(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
Definition: samrpc.c:7372
static NTSTATUS SampSetUserAll(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
Definition: samrpc.c:7608
static NTSTATUS SampSetUserInternal2(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
Definition: samrpc.c:7555
static NTSTATUS SampSetUserExpires(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
Definition: samrpc.c:7469
static NTSTATUS SampSetUserGeneral(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
Definition: samrpc.c:7319
static NTSTATUS SampSetUserInternal1(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
Definition: samrpc.c:7500
static NTSTATUS SampSetUserPrimaryGroup(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
Definition: samrpc.c:7409
static NTSTATUS SampSetUserControl(PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
Definition: samrpc.c:7439

Referenced by SamrSetInformationUser().

◆ SamrSetMemberAttributesOfGroup()

NTSTATUS NTAPI SamrSetMemberAttributesOfGroup ( IN SAMPR_HANDLE  GroupHandle,
IN unsigned long  MemberId,
IN unsigned long  Attributes 
)

Definition at line 4778 of file samrpc.c.

4781{
4782 PSAM_DB_OBJECT GroupObject;
4784
4785 TRACE("SamrSetMemberAttributesOfGroup(%p %lu %lx)\n",
4786 GroupHandle, MemberId, Attributes);
4787
4789 TRUE);
4790
4791 /* Validate the group handle */
4792 Status = SampValidateDbObject(GroupHandle,
4795 &GroupObject);
4796 if (!NT_SUCCESS(Status))
4797 {
4798 TRACE("SampValidateDbObject failed with status 0x%08lx\n", Status);
4799 goto done;
4800 }
4801
4803 MemberId,
4804 GroupObject->RelativeId,
4805 Attributes);
4806 if (!NT_SUCCESS(Status))
4807 {
4808 TRACE("SampSetUserGroupAttributes failed with status 0x%08lx\n", Status);
4809 }
4810
4811done:
4813
4814 return Status;
4815}
NTSTATUS SampSetUserGroupAttributes(IN PSAM_DB_OBJECT DomainObject, IN ULONG UserId, IN ULONG GroupId, IN ULONG GroupAttributes)
Definition: user.c:248

Referenced by SamSetMemberAttributesOfGroup().

◆ SamrSetSecurityObject()

NTSTATUS NTAPI SamrSetSecurityObject ( IN SAMPR_HANDLE  ObjectHandle,
IN SECURITY_INFORMATION  SecurityInformation,
IN PSAMPR_SR_SECURITY_DESCRIPTOR  SecurityDescriptor 
)

Definition at line 192 of file samrpc.c.

195{
196 PSAM_DB_OBJECT DbObject = NULL;
198 PSECURITY_DESCRIPTOR RelativeSd = NULL;
199 ULONG RelativeSdSize = 0;
203
204 TRACE("SamrSetSecurityObject(%p %lx %p)\n",
206
207 if ((SecurityDescriptor == NULL) ||
208 (SecurityDescriptor->SecurityDescriptor == NULL) ||
211
212 if (SecurityInformation == 0 ||
216
219
222
225
229
233
234 /* Validate the server handle */
235 Status = SampValidateDbObject(ObjectHandle,
238 &DbObject);
239 if (!NT_SUCCESS(Status))
240 goto done;
241
242 /* Get the mapping for the object type */
243 switch (DbObject->ObjectType)
244 {
247 break;
248
251 break;
252
253 case SamDbAliasObject:
255 break;
256
257 case SamDbGroupObject:
259 break;
260
261 case SamDbUserObject:
263 break;
264
265 default:
267 }
268
269 /* Get the size of the SD */
271 L"SecDesc",
272 NULL,
273 NULL,
274 &RelativeSdSize);
275 if (!NT_SUCCESS(Status))
276 return Status;
277
278 /* Allocate a buffer for the SD */
279 RelativeSd = RtlAllocateHeap(RtlGetProcessHeap(), 0, RelativeSdSize);
280 if (RelativeSd == NULL)
282
283 /* Get the SD */
285 L"SecDesc",
286 NULL,
287 RelativeSd,
288 &RelativeSdSize);
289 if (!NT_SUCCESS(Status))
290 goto done;
291
292 /* Build the new security descriptor */
294 (PSECURITY_DESCRIPTOR)SecurityDescriptor->SecurityDescriptor,
295 &RelativeSd,
296 Mapping,
298 if (!NT_SUCCESS(Status))
299 {
300 ERR("RtlSetSecurityObject failed (Status 0x%08lx)\n", Status);
301 goto done;
302 }
303
304 /* Set the modified SD */
306 L"SecDesc",
308 RelativeSd,
309 RtlLengthSecurityDescriptor(RelativeSd));
310 if (!NT_SUCCESS(Status))
311 {
312 ERR("SampSetObjectAttribute failed (Status 0x%08lx)\n", Status);
313 }
314
315done:
316 if (TokenHandle != NULL)
318
319 if (RelativeSd != NULL)
320 RtlFreeHeap(RtlGetProcessHeap(), 0, RelativeSd);
321
322 return Status;
323}
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static PVOID Mapping[EMS_PHYSICAL_PAGES]
Definition: emsdrv.c:41
NTSYSAPI ULONG WINAPI RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR)
_In_ ACCESS_MASK _In_ ULONG _Out_ PHANDLE TokenHandle
Definition: psfuncs.h:726
NTSYSAPI NTSTATUS NTAPI RtlSetSecurityObject(_In_ SECURITY_INFORMATION SecurityInformation, _In_ PSECURITY_DESCRIPTOR ModificationDescriptor, _Out_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor, _In_ PGENERIC_MAPPING GenericMapping, _In_ HANDLE Token)
_In_opt_ PSID Group
Definition: rtlfuncs.h:1646
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ SaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ OwnerSize PSID Owner
Definition: rtlfuncs.h:1597
NTSYSAPI BOOLEAN NTAPI RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor)
Definition: sd.c:1054
#define WRITE_DAC
Definition: nt_native.h:59
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define WRITE_OWNER
Definition: nt_native.h:60
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
SAM_DB_OBJECT_TYPE ObjectType
Definition: samsrv.h:48

Referenced by SamSetSecurityObject().

◆ SamrShutdownSamServer()

NTSTATUS NTAPI SamrShutdownSamServer ( IN SAMPR_HANDLE  ServerHandle)

Definition at line 466 of file samrpc.c.

467{
468 PSAM_DB_OBJECT ServerObject;
470
471 TRACE("SamrShutdownSamServer(%p)\n",
472 ServerHandle);
473
475 TRUE);
476
477 /* Validate the server handle */
478 Status = SampValidateDbObject(ServerHandle,
481 &ServerObject);
482
484
485 if (!NT_SUCCESS(Status))
486 return Status;
487
488 /* Shut the server down */
490
492 if (!NT_SUCCESS(Status))
493 {
494 ERR("SampShutdownDisplayCache() failed (Status 0x%08lx)\n", Status);
495 }
496
497 return STATUS_SUCCESS;
498}
NTSTATUS SampShutdownDisplayCache(VOID)
Definition: display.c:164
#define SAM_SERVER_SHUTDOWN
Definition: ntsam.h:100
RPC_STATUS WINAPI RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1596

Referenced by SamShutdownSamServer().

◆ SamrTestPrivateFunctionsDomain()

NTSTATUS NTAPI SamrTestPrivateFunctionsDomain ( IN SAMPR_HANDLE  DomainHandle)

Definition at line 8294 of file samrpc.c.

8295{
8298}

◆ SamrTestPrivateFunctionsUser()

NTSTATUS NTAPI SamrTestPrivateFunctionsUser ( IN SAMPR_HANDLE  UserHandle)

Definition at line 8304 of file samrpc.c.

8305{
8308}

◆ SamrUnicodeChangePasswordUser2()

NTSTATUS NTAPI SamrUnicodeChangePasswordUser2 ( IN handle_t  BindingHandle,
IN PRPC_UNICODE_STRING  ServerName,
IN PRPC_UNICODE_STRING  UserName,
IN PSAMPR_ENCRYPTED_USER_PASSWORD  NewPasswordEncryptedWithOldNt,
IN PENCRYPTED_NT_OWF_PASSWORD  OldNtOwfPasswordEncryptedWithNewNt,
IN unsigned char  LmPresent,
IN PSAMPR_ENCRYPTED_USER_PASSWORD  NewPasswordEncryptedWithOldLm,
IN PENCRYPTED_LM_OWF_PASSWORD  OldLmOwfPasswordEncryptedWithNewNt 
)

Definition at line 9361 of file samrpc.c.

9369{
9372}

◆ SamrUnicodeChangePasswordUser3()

NTSTATUS NTAPI SamrUnicodeChangePasswordUser3 ( IN handle_t  BindingHandle)

Definition at line 9728 of file samrpc.c.

9729{
9732}

◆ SamrValidatePassword()

NTSTATUS NTAPI SamrValidatePassword ( IN handle_t  Handle,
IN PASSWORD_POLICY_VALIDATION_TYPE  ValidationType,
IN PSAM_VALIDATE_INPUT_ARG  InputArg,
OUT PSAM_VALIDATE_OUTPUT_ARG OutputArg 
)

Definition at line 9815 of file samrpc.c.

9819{
9822}

Variable Documentation

◆ AliasMapping

GENERIC_MAPPING AliasMapping
static
Initial value:
=
{
}
#define ALIAS_EXECUTE
Definition: ntsam.h:23
#define ALIAS_READ
Definition: ntsam.h:15
#define ALIAS_WRITE
Definition: ntsam.h:18
#define ALIAS_ALL_ACCESS
Definition: ntsam.h:26

Definition at line 32 of file samrpc.c.

Referenced by SamrCreateAliasInDomain(), SamrOpenAlias(), and SamrSetSecurityObject().

◆ DomainMapping

GENERIC_MAPPING DomainMapping
static
Initial value:
=
{
}
#define DOMAIN_ALL_ACCESS
Definition: ntsam.h:62
#define DOMAIN_EXECUTE
Definition: ntsam.h:57
#define DOMAIN_WRITE
Definition: ntsam.h:49
#define DOMAIN_READ
Definition: ntsam.h:45

Definition at line 24 of file samrpc.c.

Referenced by SamrOpenDomain(), and SamrSetSecurityObject().

◆ GroupMapping

GENERIC_MAPPING GroupMapping
static
Initial value:
=
{
}
#define GROUP_ALL_ACCESS
Definition: ntsam.h:92
#define GROUP_EXECUTE
Definition: ntsam.h:89
#define GROUP_WRITE
Definition: ntsam.h:84
#define GROUP_READ
Definition: ntsam.h:81

Definition at line 40 of file samrpc.c.

Referenced by SamrCreateGroupInDomain(), SamrOpenGroup(), and SamrSetSecurityObject().

◆ NtSidAuthority

◆ pServerMapping

PGENERIC_MAPPING pServerMapping = &ServerMapping

Definition at line 56 of file samrpc.c.

Referenced by SamIConnect().

◆ ServerMapping

GENERIC_MAPPING ServerMapping
static
Initial value:
=
{
}
#define SAM_SERVER_READ
Definition: ntsam.h:106
#define SAM_SERVER_EXECUTE
Definition: ntsam.h:114
#define SAM_SERVER_ALL_ACCESS
Definition: ntsam.h:118
#define SAM_SERVER_WRITE
Definition: ntsam.h:109

Definition at line 16 of file samrpc.c.

Referenced by SamrConnect5(), and SamrSetSecurityObject().

◆ UserMapping

GENERIC_MAPPING UserMapping
static
Initial value:
=
{
}
#define USER_READ
Definition: ntsam.h:138
#define USER_WRITE
Definition: ntsam.h:145
#define USER_EXECUTE
Definition: ntsam.h:149
#define USER_ALL_ACCESS
Definition: ntsam.h:153

Definition at line 48 of file samrpc.c.

Referenced by InitProcessCallback(), MapGlobalUserHeap(), SamrCreateUser2InDomain(), SamrCreateUserInDomain(), SamrOpenUser(), and SamrSetSecurityObject().