[bug] Windows-to-Linux remote mount ignores CREATE_NEW #44
This commit is contained in:
parent
a613ec77ff
commit
ff746a7bec
@ -188,8 +188,6 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
|
||||
DECODE_OR_IGNORE(&response, normalized_name);
|
||||
DECODE_OR_IGNORE(&response, exists);
|
||||
|
||||
fmt::println("{}|{}", exists, ret);
|
||||
|
||||
if (exists == 0U) {
|
||||
*file_desc = reinterpret_cast<PVOID>(handle);
|
||||
set_open_info(to_handle(*file_desc),
|
||||
|
@ -1061,7 +1061,7 @@ auto remote_server::winfsp_get_security_by_name(PWSTR file_name,
|
||||
auto file_path = utils::string::from_utf8(utils::path::combine(
|
||||
mount_location_, {utils::string::to_utf8(file_name)}));
|
||||
|
||||
auto ret = STATUS_BUFFER_OVERFLOW;
|
||||
auto ret{STATUS_BUFFER_OVERFLOW};
|
||||
if ((descriptor_size == nullptr) ||
|
||||
(*descriptor_size <= std::numeric_limits<SIZE_T>::max())) {
|
||||
auto *descriptor = descriptor_size == nullptr
|
||||
|
@ -168,24 +168,32 @@ auto remote_winfsp_drive::GetSecurityByName(PWSTR file_name, PUINT32 attributes,
|
||||
PSECURITY_DESCRIPTOR descriptor,
|
||||
SIZE_T *descriptor_size)
|
||||
-> NTSTATUS {
|
||||
std::uint64_t sds{
|
||||
(descriptor_size == nullptr) ? 0U : *descriptor_size,
|
||||
};
|
||||
|
||||
std::wstring string_descriptor;
|
||||
std::uint64_t sds = (descriptor_size == nullptr) ? 0 : *descriptor_size;
|
||||
auto ret = remote_instance_->winfsp_get_security_by_name(
|
||||
auto ret{
|
||||
remote_instance_->winfsp_get_security_by_name(
|
||||
file_name, attributes, descriptor_size ? &sds : nullptr,
|
||||
string_descriptor);
|
||||
string_descriptor),
|
||||
};
|
||||
|
||||
if ((ret == STATUS_SUCCESS) && (descriptor_size != nullptr)) {
|
||||
*descriptor_size = static_cast<SIZE_T>(sds);
|
||||
if ((ret == STATUS_SUCCESS) && *descriptor_size) {
|
||||
PSECURITY_DESCRIPTOR sd{nullptr};
|
||||
ULONG sz2{0U};
|
||||
|
||||
PSECURITY_DESCRIPTOR desc{nullptr};
|
||||
ULONG size{0U};
|
||||
if (::ConvertStringSecurityDescriptorToSecurityDescriptorW(
|
||||
string_descriptor.data(), SDDL_REVISION_1, &sd, &sz2)) {
|
||||
if (sz2 > *descriptor_size) {
|
||||
string_descriptor.data(), SDDL_REVISION_1, &desc, &size)) {
|
||||
if (size > *descriptor_size) {
|
||||
ret = STATUS_BUFFER_TOO_SMALL;
|
||||
} else {
|
||||
::CopyMemory(descriptor, sd, sz2);
|
||||
::CopyMemory(descriptor, desc, size);
|
||||
}
|
||||
*descriptor_size = sz2;
|
||||
::LocalFree(sd);
|
||||
|
||||
*descriptor_size = size;
|
||||
::LocalFree(desc);
|
||||
} else {
|
||||
ret = FspNtStatusFromWin32(::GetLastError());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user