Skip to main content

build_password_pipe

Function build_password_pipe 

Source
pub fn build_password_pipe(
    tool: PrivilegeTool,
    password: &str,
    command: &str,
) -> Option<String>
Expand description

What: Build a command that pipes a password to the privilege tool via stdin.

Inputs:

  • tool: Resolved privilege tool.
  • password: Cleartext password.
  • command: The unprivileged command to wrap.

Output:

  • Some(cmd) for tools that support stdin password (sudo).
  • None for tools that do not (doas).

Details:

  • Uses shell_single_quote for safe password escaping.
  • Only sudo supports -S (read password from stdin).