From: Ian Jackson Date: Wed, 2 Jun 2021 17:00:04 +0000 (+0100) Subject: sshkeys: Tests a restricted command, refactor X-Git-Tag: otter-0.7.0~97 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=df3c1142ecf898240180ace8bc344cdf46c80e1c;p=otter.git sshkeys: Tests a restricted command, refactor Signed-off-by: Ian Jackson --- diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index 009266c1..45171e1b 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -246,16 +246,20 @@ impl Ctx { .lines().nth(2).unwrap().unwrap(), STATIC_TEST.strip_suffix("\n").unwrap() ); - let mut command = ds.gss( - "--account ssh:test: \ - --ssh nowhere \ - list-accounts" - )?; - command.insert(0, ds.subst( - "--ssh-command=@src@/apitest/mock-ssh-restricted \ - @authkeys@ '@dummy_key_data@'" - )?); - self.otter(&command)?; + let mk_restricted = |account|{ + let mut command = ds.also(&[("account",account)]).gss( + "--account @account@ \ + --ssh nowhere \ + list-accounts" + )?; + command.insert(0, ds.subst( + "--ssh-command=@src@/apitest/mock-ssh-restricted \ + @authkeys@ '@dummy_key_data@'" + )?); + Ok::<_,Explode>(command) + }; + + self.otter(&mk_restricted("ssh:test:")?)?; } }