1
Fork 0

add remaining offsets

main
Motiejus Jakštys 2022-02-12 23:01:16 +02:00 committed by Motiejus Jakštys
parent 7c63c7ab3b
commit bece7e9464
1 changed files with 23 additions and 13 deletions

View File

@ -78,24 +78,28 @@ relative to the beginning of the file.
``` ```
const File = struct { const File = struct {
magic: [4]u8, magic: [4]u8,
version: u3, version: u4,
shells_oob: u1,
padding: u4, padding: u4,
num_shells: u8,
num_users: u32, num_users: u32,
num_groups: u32, num_groups: u32,
<... TBD ...> offset_cmph_gid2group: u26,
offset_cmph_uid2user: u26,
offset_cmph_groupname2group: u26,
offset_cmph_username2user: u26,
offset_sorted_groups: u26,
offset_sorted_users: u26,
offset_groupmembers: u26,
offset_additional_gids: u26,
} }
``` ```
`magic` must be 0xf09fa4b7, and `version` must be `0`. The remaining fields are `magic` is 0xf09fa4b7, and `version` must be `0`. Offsets are indices to
indices to further sections of the file with their sizes in bytes. All numbers further sections of the file, with zero being the first block (the magic
are little-endian. number). As all blobs are 64-byte aligned, the offsets are pointing to the
beginning of the 64-byte "block" (thus u26). All numbers are little-endian.
What's remaining, variable-length: As of writing the file header is 40 bytes.
1. A lookup list of shells (if `shells_oob` is True).
2. 4 indices mentioned above.
3. <...>
Primitive types: Primitive types:
@ -116,8 +120,9 @@ const User = struct {
gid: u32, gid: u32,
// pointer to a separate structure that contains a list of gids // pointer to a separate structure that contains a list of gids
additional_gids_offset: u29, additional_gids_offset: u29,
padding: u1, // shell is a different story, documented elsewhere.
shell_len: u6, shell_here: u1,
shell_len_or_place: u6,
home_len: u6, home_len: u6,
username_len: u6, username_len: u6,
gecos_len: u8, gecos_len: u8,
@ -127,5 +132,10 @@ const User = struct {
} }
``` ```
TODO explain:
- shells
- `additional_gids`
- `members`
[git-subtrac]: https://github.com/apenwarr/git-subtrac/ [git-subtrac]: https://github.com/apenwarr/git-subtrac/
[cmph]: http://cmph.sourceforge.net/ [cmph]: http://cmph.sourceforge.net/