From 6677d8f1d50a2e51947dac137d126d37614a6255 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 28 Aug 2022 12:03:34 +0200 Subject: [PATCH] Replace remaining golang.org/x/crypto/ssh/terminal ref with golang.org/x/term Fixes https://github.com/rfjakob/gocryptfs/issues/681 Fixes 2a25c3a8fda1f0918fd76687561b1a9c615298b9 --- go.mod | 2 +- go.sum | 6 ++---- internal/readpassword/read.go | 10 +++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 4b1aff3..754a667 100644 --- a/go.mod +++ b/go.mod @@ -16,5 +16,5 @@ require ( golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2 - golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b + golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 ) diff --git a/go.sum b/go.sum index a186360..4167388 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/hanwen/go-fuse/v2 v2.1.1-0.20210825171523-3ab5d95a30ae h1:4CB6T4YTUVvnro5ba8ju1QCbOuyGAeF3vvKlo50EJ4k= -github.com/hanwen/go-fuse/v2 v2.1.1-0.20210825171523-3ab5d95a30ae/go.mod h1:B1nGE/6RBFyBRC1RRnf23UpwCdyJ31eukw34oAKukAc= github.com/hanwen/go-fuse/v2 v2.1.1-0.20211219085202-934a183ed914 h1:hGXMxS1wTE4y+f7iBqFArrJ6X8QozHnEdnVzGZI9Ywc= github.com/hanwen/go-fuse/v2 v2.1.1-0.20211219085202-934a183ed914/go.mod h1:B1nGE/6RBFyBRC1RRnf23UpwCdyJ31eukw34oAKukAc= github.com/jacobsa/crypto v0.0.0-20190317225127-9f44e2d11115 h1:YuDUUFNM21CAbyPOpOP8BicaTD/0klJEKt5p8yuw+uY= @@ -43,8 +41,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2 h1:c8PlLMqBbOHoqtjteWm5/kbe6rNY2pbRfbIMVnepueo= golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b h1:9zKuko04nR4gjZ4+DNjHqRlAJqbJETHwiNKDqTfOjfE= -golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc= +golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/internal/readpassword/read.go b/internal/readpassword/read.go index 498d09b..3ad3bb4 100644 --- a/internal/readpassword/read.go +++ b/internal/readpassword/read.go @@ -9,7 +9,7 @@ import ( "os/exec" "strings" - "golang.org/x/crypto/ssh/terminal" + "golang.org/x/term" "github.com/rfjakob/gocryptfs/v2/internal/tlog" ) @@ -31,7 +31,7 @@ func Once(extpass []string, passfile []string, prompt string) ([]byte, error) { if prompt == "" { prompt = "Password" } - if !terminal.IsTerminal(int(os.Stdin.Fd())) { + if !term.IsTerminal(int(os.Stdin.Fd())) { return readPasswordStdin(prompt) } return readPasswordTerminal(prompt + ": ") @@ -46,7 +46,7 @@ func Twice(extpass []string, passfile []string) ([]byte, error) { if len(extpass) != 0 { return readPasswordExtpass(extpass) } - if !terminal.IsTerminal(int(os.Stdin.Fd())) { + if !term.IsTerminal(int(os.Stdin.Fd())) { return readPasswordStdin("Password") } p1, err := readPasswordTerminal("Password: ") @@ -72,8 +72,8 @@ func Twice(extpass []string, passfile []string) ([]byte, error) { func readPasswordTerminal(prompt string) ([]byte, error) { fd := int(os.Stdin.Fd()) fmt.Fprintf(os.Stderr, prompt) - // terminal.ReadPassword removes the trailing newline - p, err := terminal.ReadPassword(fd) + // term.ReadPassword removes the trailing newline + p, err := term.ReadPassword(fd) if err != nil { return nil, fmt.Errorf("Could not read password from terminal: %v\n", err) }