-static void
-print_sid(const void *p, const tchar *type)
-{
- const SID *sid = p;
- tprintf(T(" [%"TS" SID]\n"), type);
- tprintf(T(" Revision = %u\n"), sid->revision);
- tprintf(T(" Subauthority count = %u\n"), sid->sub_authority_count);
- tprintf(T(" Identifier authority = "));
- print_byte_field(sid->identifier_authority,
- sizeof(sid->identifier_authority), stdout);
- tputchar(T('\n'));
- for (u8 i = 0; i < sid->sub_authority_count; i++) {
- tprintf(T(" Subauthority %u = %u\n"),
- i, le32_to_cpu(sid->sub_authority[i]));
- }
- tputchar(T('\n'));
-}
-
-static void
-print_security_descriptor(const void *p, u64 size)
-{
- const SecurityDescriptor *sd = p;
-
- u8 revision = sd->revision;
- u16 control = le16_to_cpu(sd->security_descriptor_control);
- u32 owner_offset = le32_to_cpu(sd->owner_offset);
- u32 group_offset = le32_to_cpu(sd->group_offset);
- u32 sacl_offset = le32_to_cpu(sd->sacl_offset);
- u32 dacl_offset = le32_to_cpu(sd->dacl_offset);
- tprintf(T("Revision = %u\n"), revision);
- tprintf(T("Security Descriptor Control = %#x\n"), control);
- tprintf(T("Owner offset = %u\n"), owner_offset);
- tprintf(T("Group offset = %u\n"), group_offset);
- tprintf(T("System ACL offset = %u\n"), sacl_offset);
- tprintf(T("Discretionary ACL offset = %u\n"), dacl_offset);
-
- if (sd->owner_offset != 0)
- print_sid(p + owner_offset, T("Owner"));
- if (sd->group_offset != 0)
- print_sid(p + group_offset, T("Group"));
- if (sd->sacl_offset != 0)
- print_acl(p + sacl_offset, T("System"));
- if (sd->dacl_offset != 0)
- print_acl(p + dacl_offset, T("Discretionary"));
-}
-
-/*
- * Prints the security data for a WIM file.
- */
-void
-print_security_data(const struct wim_security_data *sd)
-{
- wimlib_assert(sd != NULL);
-
- tputs(T("[SECURITY DATA]"));
- tprintf(T("Length = %"PRIu32" bytes\n"), sd->total_length);
- tprintf(T("Number of Entries = %"PRIu32"\n"), sd->num_entries);
-
- for (u32 i = 0; i < sd->num_entries; i++) {
- tprintf(T("[SecurityDescriptor %"PRIu32", length = %"PRIu64"]\n"),
- i, sd->sizes[i]);
- print_security_descriptor(sd->descriptors[i], sd->sizes[i]);
- tputchar(T('\n'));
- }
- tputchar(T('\n'));