summaryrefslogtreecommitdiff
path: root/internal/readpassword/read.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/readpassword/read.go')
-rw-r--r--internal/readpassword/read.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/readpassword/read.go b/internal/readpassword/read.go
index 6945f0a..f00b425 100644
--- a/internal/readpassword/read.go
+++ b/internal/readpassword/read.go
@@ -83,7 +83,16 @@ func readPasswordStdin() string {
// Exits on read error or empty result.
func readPasswordExtpass(extpass string) string {
tlog.Info.Println("Reading password from extpass program")
- parts := strings.Split(extpass, " ")
+ var parts []string
+ // The option "-passfile=FILE" gets transformed to
+ // "-extpass="/bin/cat -- FILE". We don't want to split FILE on spaces,
+ // so let's handle it manually.
+ passfileCat := "/bin/cat -- "
+ if strings.HasPrefix(extpass, passfileCat) {
+ parts = []string{"/bin/cat", "--", extpass[len(passfileCat):]}
+ } else {
+ parts = strings.Split(extpass, " ")
+ }
cmd := exec.Command(parts[0], parts[1:]...)
cmd.Stderr = os.Stderr
pipe, err := cmd.StdoutPipe()