Trim password if from executable output

This commit is contained in:
Blallo 2021-01-31 19:10:21 +01:00
parent 87c86a8090
commit 54fb7b3be3
No known key found for this signature in database
GPG key ID: 0CBE577C9B72DC3F

View file

@ -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)