[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, normalized_name);
|
||||||
DECODE_OR_IGNORE(&response, exists);
|
DECODE_OR_IGNORE(&response, exists);
|
||||||
|
|
||||||
fmt::println("{}|{}", exists, ret);
|
|
||||||
|
|
||||||
if (exists == 0U) {
|
if (exists == 0U) {
|
||||||
*file_desc = reinterpret_cast<PVOID>(handle);
|
*file_desc = reinterpret_cast<PVOID>(handle);
|
||||||
set_open_info(to_handle(*file_desc),
|
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(
|
auto file_path = utils::string::from_utf8(utils::path::combine(
|
||||||
mount_location_, {utils::string::to_utf8(file_name)}));
|
mount_location_, {utils::string::to_utf8(file_name)}));
|
||||||
|
|
||||||
auto ret = STATUS_BUFFER_OVERFLOW;
|
auto ret{STATUS_BUFFER_OVERFLOW};
|
||||||
if ((descriptor_size == nullptr) ||
|
if ((descriptor_size == nullptr) ||
|
||||||
(*descriptor_size <= std::numeric_limits<SIZE_T>::max())) {
|
(*descriptor_size <= std::numeric_limits<SIZE_T>::max())) {
|
||||||
auto *descriptor = descriptor_size == nullptr
|
auto *descriptor = descriptor_size == nullptr
|
||||||
|
@ -168,24 +168,32 @@ auto remote_winfsp_drive::GetSecurityByName(PWSTR file_name, PUINT32 attributes,
|
|||||||
PSECURITY_DESCRIPTOR descriptor,
|
PSECURITY_DESCRIPTOR descriptor,
|
||||||
SIZE_T *descriptor_size)
|
SIZE_T *descriptor_size)
|
||||||
-> NTSTATUS {
|
-> NTSTATUS {
|
||||||
|
std::uint64_t sds{
|
||||||
|
(descriptor_size == nullptr) ? 0U : *descriptor_size,
|
||||||
|
};
|
||||||
|
|
||||||
std::wstring string_descriptor;
|
std::wstring string_descriptor;
|
||||||
std::uint64_t sds = (descriptor_size == nullptr) ? 0 : *descriptor_size;
|
auto ret{
|
||||||
auto ret = remote_instance_->winfsp_get_security_by_name(
|
remote_instance_->winfsp_get_security_by_name(
|
||||||
file_name, attributes, descriptor_size ? &sds : nullptr,
|
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);
|
*descriptor_size = static_cast<SIZE_T>(sds);
|
||||||
if ((ret == STATUS_SUCCESS) && *descriptor_size) {
|
|
||||||
PSECURITY_DESCRIPTOR sd{nullptr};
|
PSECURITY_DESCRIPTOR desc{nullptr};
|
||||||
ULONG sz2{0U};
|
ULONG size{0U};
|
||||||
if (::ConvertStringSecurityDescriptorToSecurityDescriptorW(
|
if (::ConvertStringSecurityDescriptorToSecurityDescriptorW(
|
||||||
string_descriptor.data(), SDDL_REVISION_1, &sd, &sz2)) {
|
string_descriptor.data(), SDDL_REVISION_1, &desc, &size)) {
|
||||||
if (sz2 > *descriptor_size) {
|
if (size > *descriptor_size) {
|
||||||
ret = STATUS_BUFFER_TOO_SMALL;
|
ret = STATUS_BUFFER_TOO_SMALL;
|
||||||
} else {
|
} else {
|
||||||
::CopyMemory(descriptor, sd, sz2);
|
::CopyMemory(descriptor, desc, size);
|
||||||
}
|
}
|
||||||
*descriptor_size = sz2;
|
|
||||||
::LocalFree(sd);
|
*descriptor_size = size;
|
||||||
|
::LocalFree(desc);
|
||||||
} else {
|
} else {
|
||||||
ret = FspNtStatusFromWin32(::GetLastError());
|
ret = FspNtStatusFromWin32(::GetLastError());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user