[NTOSKRNL] Use the security descriptor for all the symlinks

This commit is contained in:
Pierre Schweitzer 2019-05-21 19:27:32 +02:00
parent 95d303bf13
commit fe6c7f05e2
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B

View file

@ -169,14 +169,13 @@ ObpCreateDosDevicesDirectory(VOID)
Status = NtCreateDirectoryObject(&Handle, Status = NtCreateDirectoryObject(&Handle,
DIRECTORY_ALL_ACCESS, DIRECTORY_ALL_ACCESS,
&ObjectAttributes); &ObjectAttributes);
RtlGetDaclSecurityDescriptor(&DosDevicesSD, &DaclPresent, &Dacl, &DaclDefaulted); if (!NT_SUCCESS(Status))
ExFreePoolWithTag(Dacl, 'lcaD'); goto done;
if (!NT_SUCCESS(Status)) return Status;
/* Create the system device map */ /* Create the system device map */
Status = ObpCreateDeviceMap(Handle); Status = ObpCreateDeviceMap(Handle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return Status; goto done;
/*********************************************\ /*********************************************\
|*** HACK until we support device mappings ***| |*** HACK until we support device mappings ***|
@ -187,7 +186,7 @@ ObpCreateDosDevicesDirectory(VOID)
&LinkName, &LinkName,
OBJ_PERMANENT, OBJ_PERMANENT,
NULL, NULL,
NULL); &DosDevicesSD);
Status = NtCreateSymbolicLinkObject(&SymHandle, Status = NtCreateSymbolicLinkObject(&SymHandle,
SYMBOLIC_LINK_ALL_ACCESS, SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
@ -208,7 +207,7 @@ ObpCreateDosDevicesDirectory(VOID)
&LinkName, &LinkName,
OBJ_PERMANENT, OBJ_PERMANENT,
Handle, Handle,
NULL); &DosDevicesSD);
Status = NtCreateSymbolicLinkObject(&SymHandle, Status = NtCreateSymbolicLinkObject(&SymHandle,
SYMBOLIC_LINK_ALL_ACCESS, SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
@ -226,7 +225,7 @@ ObpCreateDosDevicesDirectory(VOID)
&LinkName, &LinkName,
OBJ_PERMANENT, OBJ_PERMANENT,
Handle, Handle,
NULL); &DosDevicesSD);
Status = NtCreateSymbolicLinkObject(&SymHandle, Status = NtCreateSymbolicLinkObject(&SymHandle,
SYMBOLIC_LINK_ALL_ACCESS, SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
@ -235,7 +234,8 @@ ObpCreateDosDevicesDirectory(VOID)
/* Close the directory handle */ /* Close the directory handle */
NtClose(Handle); NtClose(Handle);
if (!NT_SUCCESS(Status)) return Status; if (!NT_SUCCESS(Status))
goto done;
/* /*
* Initialize the \DosDevices symbolic link pointing to the global * Initialize the \DosDevices symbolic link pointing to the global
@ -248,13 +248,17 @@ ObpCreateDosDevicesDirectory(VOID)
&LinkName, &LinkName,
OBJ_PERMANENT, OBJ_PERMANENT,
NULL, NULL,
NULL); &DosDevicesSD);
Status = NtCreateSymbolicLinkObject(&SymHandle, Status = NtCreateSymbolicLinkObject(&SymHandle,
SYMBOLIC_LINK_ALL_ACCESS, SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
&RootName); &RootName);
if (NT_SUCCESS(Status)) NtClose(SymHandle); if (NT_SUCCESS(Status)) NtClose(SymHandle);
done:
RtlGetDaclSecurityDescriptor(&DosDevicesSD, &DaclPresent, &Dacl, &DaclDefaulted);
ExFreePoolWithTag(Dacl, 'lcaD');
/* Return status */ /* Return status */
return Status; return Status;
} }