From 28a02d5cf7b3ebba4e1d118bf7906e459d5597bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Fri, 22 Mar 2024 10:02:36 +0000 Subject: [PATCH] fix: avoid a warn() when an non-resolvable host is specified with scp or sftp --- bin/shell/osh.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/shell/osh.pl b/bin/shell/osh.pl index 85cf71691..7d7da2b1f 100755 --- a/bin/shell/osh.pl +++ b/bin/shell/osh.pl @@ -1808,6 +1808,11 @@ sub do_plugin_jit_mfa { main_exit(OVH::Bastion::EXIT_NO_HOST, 'no_host', "A host is required for this plugin but none was specified"); } + # if $ip is undef it's because $host didn't resolve, exit + if (!$ip) { + main_exit OVH::Bastion::EXIT_HOST_NOT_FOUND, 'host_not_found', "Unable to resolve host '$host'"; + } + # if no user yet, fix it to remote user # we need it to be able to get the proper answer for is_access_granted, and we need to # call is_access_granted so that we know whether we need to trigger JIT MFA for this