Refactor crypttab(5) parsing logic.
Going through each of the crypttab(5) file, ignoring empty lines and
comments, decoding octal escape sequences, etc. introduced a lot of
duplicate boilerplate code. We now use
crypttab_find_entry([--quiet], $target)
Search the crypttab(5) for the given $target and set
CRYPTTAB_NAME, CRYPTTAB_SOURCE, CRYPTTAB_KEY, and
CRYPTTAB_OPTIONS accordingly. Return 0 if a match is found, and
1 otherwise.
and
crypttab_foreach_entry($callback)
Iterate through the crypttab(5) and run the given $callback for
each entry found. $callback refers to each entry using
variables CRYPTTAB_NAME, CRYPTTAB_SOURCE, CRYPTTAB_KEY and
CRYPTTAB_OPTIONS.
Loading
Please register or sign in to comment