File indexing completed on 2025-01-05 04:35:35
0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0002 // SPDX-FileCopyrightText: 2020-2022 Harald Sitter <sitter@kde.org> 0003 0004 #pragma once 0005 0006 #include <cstdint> 0007 0008 #include <QString> 0009 0010 // https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-ace_header 0011 struct ACE { // roughly _ACE_HEADER 0012 ACE(const QString &sid_, uint8_t type_, uint8_t flags_, uint32_t mask_) 0013 : sid(sid_) 0014 , type(type_) 0015 , flags(flags_) 0016 , mask(mask_) 0017 , originalXattr(toSMBXattr()) 0018 { 0019 } 0020 0021 const QString sid; 0022 uint8_t type; // BYTE 0023 uint8_t flags; // BYTE 0024 uint32_t mask; // DWORD 0025 const QString originalXattr; // toSMBXattr at construction time 0026 0027 QString toSMBXattr() const 0028 { 0029 // NB: the mask should be 0xHEX to be the same as the input format. 0030 // libsmbc doesn't correctly parse 0xHEX masks though and ends up 0031 // setting 0x0. Specifically it calls sscanf with %u even when it 0032 // explicitly verified the input is 0x and would require %x to 0033 // correctly parse it. 0034 return QStringLiteral("%1/%2/%3").arg(type).arg(flags).arg(mask); 0035 } 0036 };