Sys.Linux.Subid (Hyper v0.1.0)

Copy Markdown View Source

Subuid and Subgid utilities

Summary

Functions

Parse one /etc/subuid//etc/subgid line (name:start:count) into a Spec, where min_id is start and max_id is start + count. A line that is not exactly three colon-separated fields, or whose start/count are not integers, yields {:error, :invalid_format}.

Parse the subid file at path. Any malformed line refuses the whole file with {:error, :invalid_format} — these files gate privilege delegation, so a partial read must never masquerade as the complete ruleset.

Return the list of all subgid ranges

Return the list of all subuid ranges

Functions

parse(line)

@spec parse(String.t()) :: {:ok, Sys.Linux.Subid.Spec.t()} | {:error, :invalid_format}

Parse one /etc/subuid//etc/subgid line (name:start:count) into a Spec, where min_id is start and max_id is start + count. A line that is not exactly three colon-separated fields, or whose start/count are not integers, yields {:error, :invalid_format}.

ranges(path)

@spec ranges(Path.t()) ::
  {:ok, [Sys.Linux.Subid.Spec.t()]}
  | {:error,
     File.posix() | :badarg | :terminated | :system_limit | :invalid_format}

Parse the subid file at path. Any malformed line refuses the whole file with {:error, :invalid_format} — these files gate privilege delegation, so a partial read must never masquerade as the complete ruleset.

subgid_ranges()

@spec subgid_ranges() ::
  {:ok, [Sys.Linux.Subid.Spec.t()]}
  | {:error,
     File.posix() | :badarg | :terminated | :system_limit | :invalid_format}

Return the list of all subgid ranges

subuid_ranges()

@spec subuid_ranges() ::
  {:ok, [Sys.Linux.Subid.Spec.t()]}
  | {:error,
     File.posix() | :badarg | :terminated | :system_limit | :invalid_format}

Return the list of all subuid ranges