summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src
diff options
context:
space:
mode:
authorMarkus Pettersson <markus.pettersson@mullvad.net>2023-10-26 10:56:51 +0200
committerMarkus Pettersson <markus.pettersson@mullvad.net>2023-10-27 08:54:31 +0200
commit2c007aa39106cfbeddaa9e3640f0b61f403e5f8a (patch)
tree661345bfeda4c9fdef798a2472e6a49d38725b79 /mullvad-cli/src
parent1de3f4efb1c6fd5d506353811f6a74b09c5bc172 (diff)
downloadmullvadvpn-2c007aa39106cfbeddaa9e3640f0b61f403e5f8a.tar.xz
mullvadvpn-2c007aa39106cfbeddaa9e3640f0b61f403e5f8a.zip
Make username+password authentication optional in SOCKS5 remote configuration
SOCKS5 optionally supports username+password authentication, which has been implemented previously. This commit addresses a bug in the argument parsing, which made username+password required arguments when adding a remote SOCKS5 api access method using `mullvad api-access add socks5 remote`. Apparently, this is a known pitfall with `clap`: https://github.com/clap-rs/clap/issues/5092
Diffstat (limited to 'mullvad-cli/src')
-rw-r--r--mullvad-cli/src/cmds/api_access.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/mullvad-cli/src/cmds/api_access.rs b/mullvad-cli/src/cmds/api_access.rs
index 441c549c71..dc736c71c6 100644
--- a/mullvad-cli/src/cmds/api_access.rs
+++ b/mullvad-cli/src/cmds/api_access.rs
@@ -321,12 +321,13 @@ pub enum AddSocks5Commands {
}
#[derive(Args, Debug, Clone)]
+#[group(requires_all = ["username", "password"])] // https://github.com/clap-rs/clap/issues/5092
pub struct SocksAuthentication {
/// Username for authentication against a remote SOCKS5 proxy
- #[arg(short, long)]
+ #[arg(short, long, required = false)]
username: String,
/// Password for authentication against a remote SOCKS5 proxy
- #[arg(short, long)]
+ #[arg(short, long, required = false)]
password: String,
}