From 54fb7b3be3fc42cb86f68e1b07d7d763fd089081 Mon Sep 17 00:00:00 2001 From: Blallo Date: Sun, 31 Jan 2021 19:10:21 +0100 Subject: [PATCH] Trim password if from executable output --- config/config.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 9136bf6..a16f133 100644 --- a/config/config.go +++ b/config/config.go @@ -7,6 +7,7 @@ import ( "log" "os" "path" + "strings" "git.lattuga.net/blallo/papero/worker" "github.com/mitchellh/go-homedir" @@ -178,7 +179,11 @@ func validatePort(port int) (int, error) { func getPassword(connection *connectionInfo) (string, error) { if connection.PasswordExec.Present() { - return connection.PasswordExec.Run() + pass, err := connection.PasswordExec.Run() + if err != nil { + return "", err + } + return strings.TrimRight(pass, "\n"), nil } if connection.PasswordFile != "" { file, err := os.Open(connection.PasswordFile)