Skip to content
Commit cb598593 authored by Guilhem Moulin's avatar Guilhem Moulin
Browse files

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.
parent da2055f1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment