Resolves:
https://issues.redhat.com/browse/FC-1046
We require that <user> be explicitly specified in 'ssh
<user>@<hostname>'. When
forgetting to specify, such as 'ssh 192.168.10.2', a useful error log should be
printed instead of exiting directly.
Signed-off-by: Lichen Liu <lichliu(a)redhat.com>
---
kdumpctl | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 3da5fff..45277a7 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -748,7 +748,12 @@ check_ssh_config()
[[ "${OPT[_fstype]}" == ssh ]] || return 0
target=$(ssh -G "${OPT[_target]}" | sed -n -e
"s/^hostname[[:space:]]\+\([^[:space:]]*\).*$/\1/p")
- [[ ${OPT[_target]} =~ .*@.* ]] || return 1
+
+ if [[ ${OPT[_target]} != *@* ]]; then
+ derror "Please verify that $KDUMP_CONFIG_FILE contains 'ssh
<user>@<host>' and that it is properly formatted."
+ return 1
+ fi
+
if [[ ${OPT[_target]#*@} != "$target" ]]; then
derror "Invalid ssh destination ${OPT[_target]} provided."
return 1
--
2.43.0