diff options
author | Daniel Mueller <deso@posteo.net> | 2019-01-09 13:41:53 -0800 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-01-09 13:41:53 -0800 |
commit | 4842ac86c0a805c5c4a679644594252ca5ea388b (patch) | |
tree | d49fcace411df5361f7c9fd6880629e7bec0a1d3 /nitrocli/src/args.rs | |
parent | 749a5c78c2075c5d37b01ec4fd23704aa5cfdf09 (diff) | |
download | nitrocli-4842ac86c0a805c5c4a679644594252ca5ea388b.tar.gz nitrocli-4842ac86c0a805c5c4a679644594252ca5ea388b.tar.bz2 |
Introduce Admin and User PIN fields to execution context
In order to run tests fully non-interactively we need to avoid the need
for using the GPG agent's PIN entry and caching mechanism. To accomplish
that, we first need an alternate way to supply the PINs to use to the
program.
This change offers such a way by extending the execution context with
two fields representing the PINs that are populated by corresponding
environment variables, NITROCLI_ADMIN_PIN & NITROCLI_USER_PIN, if set.
While only two PINs are required right now, because the program allows
for the changing of each of the PINs, we also add two fields
representing new PINs. These latter two fields are populated by the
NITROCLI_NEW_ADMIN_PIN and NITROCLI_NEW_USER_PIN environment variables.
Diffstat (limited to 'nitrocli/src/args.rs')
-rw-r--r-- | nitrocli/src/args.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs index 6e55cb1..6f02832 100644 --- a/nitrocli/src/args.rs +++ b/nitrocli/src/args.rs @@ -17,6 +17,7 @@ // * along with this program. If not, see <http://www.gnu.org/licenses/>. * // ************************************************************************* +use std::ffi; use std::io; use std::result; use std::str; @@ -44,6 +45,10 @@ pub struct ExecCtx<'io> { pub model: Option<DeviceModel>, pub stdout: &'io mut dyn io::Write, pub stderr: &'io mut dyn io::Write, + pub admin_pin: Option<ffi::OsString>, + pub user_pin: Option<ffi::OsString>, + pub new_admin_pin: Option<ffi::OsString>, + pub new_user_pin: Option<ffi::OsString>, pub verbosity: u64, } @@ -817,6 +822,10 @@ fn parse_arguments<'io, 'ctx: 'io>( model, stdout: ctx.stdout, stderr: ctx.stderr, + admin_pin: ctx.admin_pin.take(), + user_pin: ctx.user_pin.take(), + new_admin_pin: ctx.new_admin_pin.take(), + new_user_pin: ctx.new_user_pin.take(), verbosity, }; Ok((command, ctx, subargs)) |