mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 09:00:27 +00:00
[SAMSRV]
- Implement all cases of SamrQueryInformationDomain. - Store all fixed size domain attributes in the registry value "F". - Initialize all domain attribute in SampCreateDomain. svn path=/trunk/; revision=56818
This commit is contained in:
parent
d4ee387801
commit
a7086d73a7
5 changed files with 1002 additions and 60 deletions
File diff suppressed because it is too large
Load diff
|
@ -12,6 +12,7 @@
|
|||
#include <windows.h>
|
||||
#define NTOS_MODE_USER
|
||||
#include <ndk/cmfuncs.h>
|
||||
#include <ndk/kefuncs.h>
|
||||
#include <ndk/obfuncs.h>
|
||||
#include <ndk/rtlfuncs.h>
|
||||
#include <ndk/umtypes.h>
|
||||
|
@ -50,6 +51,28 @@ typedef struct _SAM_DB_OBJECT
|
|||
|
||||
#define SAMP_DB_SIGNATURE 0x87654321
|
||||
|
||||
typedef struct _SAM_DOMAIN_FIXED_DATA
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG Reserved;
|
||||
LARGE_INTEGER CreationTime;
|
||||
LARGE_INTEGER DomainModifiedCount;
|
||||
LARGE_INTEGER MaxPasswordAge;
|
||||
LARGE_INTEGER MinPasswordAge;
|
||||
LARGE_INTEGER ForceLogoff;
|
||||
LARGE_INTEGER LockoutDuration;
|
||||
LARGE_INTEGER LockoutObservationWindow;
|
||||
LARGE_INTEGER ModifiedCountAtLastPromotion;
|
||||
ULONG NextRid;
|
||||
ULONG PasswordProperties;
|
||||
USHORT MinPasswordLength;
|
||||
USHORT PasswordHistoryLength;
|
||||
USHORT LockoutThreshold;
|
||||
DOMAIN_SERVER_ENABLE_STATE DomainServerState;
|
||||
DOMAIN_SERVER_ROLE DomainServerRole;
|
||||
BOOLEAN UasCompatibilityRequired;
|
||||
} SAM_DOMAIN_FIXED_DATA, *PSAM_DOMAIN_FIXED_DATA;
|
||||
|
||||
/* database.c */
|
||||
|
||||
NTSTATUS
|
||||
|
|
|
@ -277,6 +277,8 @@ SampCreateDomain(IN HKEY hDomainsKey,
|
|||
IN PSID lpDomainSid,
|
||||
OUT PHKEY lpDomainKey)
|
||||
{
|
||||
SAM_DOMAIN_FIXED_DATA FixedData;
|
||||
LPWSTR lpEmptyString = L"";
|
||||
DWORD dwDisposition;
|
||||
HKEY hDomainKey = NULL;
|
||||
HKEY hAliasesKey = NULL;
|
||||
|
@ -287,6 +289,26 @@ SampCreateDomain(IN HKEY hDomainsKey,
|
|||
if (lpDomainKey != NULL)
|
||||
*lpDomainKey = NULL;
|
||||
|
||||
/* Initialize the fixed domain data */
|
||||
memset(&FixedData, 0, sizeof(SAM_DOMAIN_FIXED_DATA));
|
||||
FixedData.Version = 1;
|
||||
NtQuerySystemTime(&FixedData.CreationTime);
|
||||
FixedData.DomainModifiedCount.QuadPart = 0;
|
||||
// FixedData.MaxPasswordAge // 6 Weeks
|
||||
FixedData.MinPasswordAge.QuadPart = 0; // Now
|
||||
// FixedData.ForceLogoff
|
||||
// FixedData.LockoutDuration // 30 minutes
|
||||
// FixedData.LockoutObservationWindow // 30 minutes
|
||||
FixedData.ModifiedCountAtLastPromotion.QuadPart = 0;
|
||||
FixedData.NextRid = 1000;
|
||||
FixedData.PasswordProperties = 0;
|
||||
FixedData.MinPasswordLength = 0;
|
||||
FixedData.PasswordHistoryLength = 0;
|
||||
FixedData.LockoutThreshold = 0;
|
||||
FixedData.DomainServerState = DomainServerEnabled;
|
||||
FixedData.DomainServerRole = DomainServerRolePrimary;
|
||||
FixedData.UasCompatibilityRequired = TRUE;
|
||||
|
||||
if (RegCreateKeyExW(hDomainsKey,
|
||||
lpKeyName,
|
||||
0,
|
||||
|
@ -298,6 +320,15 @@ SampCreateDomain(IN HKEY hDomainsKey,
|
|||
&dwDisposition))
|
||||
return FALSE;
|
||||
|
||||
/* Set the fixed data value */
|
||||
if (RegSetValueEx(hDomainKey,
|
||||
L"F",
|
||||
0,
|
||||
REG_BINARY,
|
||||
(LPVOID)&FixedData,
|
||||
sizeof(SAM_DOMAIN_FIXED_DATA)))
|
||||
return FALSE;
|
||||
|
||||
if (lpDomainSid != NULL)
|
||||
{
|
||||
RegSetValueEx(hDomainKey,
|
||||
|
@ -315,6 +346,20 @@ SampCreateDomain(IN HKEY hDomainsKey,
|
|||
RtlLengthSid(lpDomainSid));
|
||||
}
|
||||
|
||||
RegSetValueEx(hDomainKey,
|
||||
L"OemInformation",
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPVOID)lpEmptyString,
|
||||
sizeof(WCHAR));
|
||||
|
||||
RegSetValueEx(hDomainKey,
|
||||
L"ReplicaSourceNodeName",
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPVOID)lpEmptyString,
|
||||
sizeof(WCHAR));
|
||||
|
||||
/* Create the Alias container */
|
||||
if (!RegCreateKeyExW(hDomainKey,
|
||||
L"Aliases",
|
||||
|
@ -507,22 +552,22 @@ SampInitializeSAM(VOID)
|
|||
{
|
||||
SampCreateAliasAccount(hDomainKey,
|
||||
L"Administrators",
|
||||
L"",
|
||||
L"Testabc1234567890",
|
||||
DOMAIN_ALIAS_RID_ADMINS);
|
||||
|
||||
SampCreateAliasAccount(hDomainKey,
|
||||
L"Users",
|
||||
L"",
|
||||
L"Users Group",
|
||||
DOMAIN_ALIAS_RID_USERS);
|
||||
|
||||
SampCreateAliasAccount(hDomainKey,
|
||||
L"Guests",
|
||||
L"",
|
||||
L"Guests Group",
|
||||
DOMAIN_ALIAS_RID_GUESTS);
|
||||
|
||||
SampCreateAliasAccount(hDomainKey,
|
||||
L"Power Users",
|
||||
L"",
|
||||
L"Power Users Group",
|
||||
DOMAIN_ALIAS_RID_POWER_USERS);
|
||||
|
||||
|
||||
|
|
|
@ -220,6 +220,18 @@ typedef enum _DOMAIN_INFORMATION_CLASS
|
|||
DomainModifiedInformation2
|
||||
} DOMAIN_INFORMATION_CLASS;
|
||||
|
||||
typedef enum _DOMAIN_SERVER_ENABLE_STATE
|
||||
{
|
||||
DomainServerEnabled = 1,
|
||||
DomainServerDisabled
|
||||
} DOMAIN_SERVER_ENABLE_STATE, *PDOMAIN_SERVER_ENABLE_STATE;
|
||||
|
||||
typedef enum _DOMAIN_SERVER_ROLE
|
||||
{
|
||||
DomainServerRoleBackup = 2,
|
||||
DomainServerRolePrimary
|
||||
} DOMAIN_SERVER_ROLE, *PDOMAIN_SERVER_ROLE;
|
||||
|
||||
typedef struct _DOMAIN_NAME_INFORMATION
|
||||
{
|
||||
UNICODE_STRING DomainName;
|
||||
|
@ -384,6 +396,11 @@ SamQueryInformationUser(IN SAM_HANDLE UserHandle,
|
|||
IN USER_INFORMATION_CLASS UserInformationClass,
|
||||
OUT PVOID *Buffer);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
SamRemoveMemberFromAlias(IN SAM_HANDLE AliasHandle,
|
||||
IN PSID MemberId);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
SamSetInformationAlias(IN SAM_HANDLE AliasHandle,
|
||||
|
|
|
@ -135,22 +135,26 @@ typedef struct _USER_DOMAIN_PASSWORD_INFORMATION
|
|||
unsigned long PasswordProperties;
|
||||
} USER_DOMAIN_PASSWORD_INFORMATION, *PUSER_DOMAIN_PASSWORD_INFORMATION;
|
||||
|
||||
cpp_quote("#ifndef _NTSAM_")
|
||||
typedef enum _DOMAIN_SERVER_ENABLE_STATE
|
||||
{
|
||||
DomainServerEnabled = 1,
|
||||
DomainServerDisabled
|
||||
} DOMAIN_SERVER_ENABLE_STATE, *PDOMAIN_SERVER_ENABLE_STATE;
|
||||
cpp_quote("#endif")
|
||||
|
||||
typedef struct _DOMAIN_STATE_INFORMATION
|
||||
{
|
||||
DOMAIN_SERVER_ENABLE_STATE DomainServerState;
|
||||
} DOMAIN_STATE_INFORMATION, *PDOMAIN_STATE_INFORMATION;
|
||||
|
||||
cpp_quote("#ifndef _NTSAM_")
|
||||
typedef enum _DOMAIN_SERVER_ROLE
|
||||
{
|
||||
DomainServerRoleBackup = 2,
|
||||
DomainServerRolePrimary = 3
|
||||
} DOMAIN_SERVER_ROLE, *PDOMAIN_SERVER_ROLE;
|
||||
cpp_quote("#endif")
|
||||
|
||||
cpp_quote("#ifndef _NTSECAPI_H")
|
||||
typedef struct _DOMAIN_PASSWORD_INFORMATION
|
||||
|
|
Loading…
Reference in a new issue