Also hide master key reminder with "-q"

Also fix missing newline after password prompt
This commit is contained in:
Jakob Unterwurzacher 2015-11-09 23:26:56 +01:00
parent 51fcf61630
commit e43733ca0d
3 changed files with 4 additions and 4 deletions

View File

@ -180,7 +180,7 @@ func main() {
fmt.Printf("Password: ") fmt.Printf("Password: ")
} }
currentPassword = readPassword() currentPassword = readPassword()
cryptfs.Info.Printf("\nDecrypting master key... ") cryptfs.Info.Printf("Decrypting master key... ")
cryptfs.Warn.Disable() // Silence DecryptBlock() error messages on incorrect password cryptfs.Warn.Disable() // Silence DecryptBlock() error messages on incorrect password
key, cf, err = cryptfs.LoadConfFile(cfname, currentPassword) key, cf, err = cryptfs.LoadConfFile(cfname, currentPassword)
cryptfs.Warn.Enable() cryptfs.Warn.Enable()

View File

@ -25,7 +25,7 @@ func printMasterKey(key []byte) {
} }
} }
fmt.Printf(` cryptfs.Info.Printf(`
ATTENTION: ATTENTION:
Your master key is: %s Your master key is: %s

View File

@ -9,9 +9,8 @@ import (
func readPasswordTwice() string { func readPasswordTwice() string {
fmt.Printf("Password: ") fmt.Printf("Password: ")
p1 := readPassword() p1 := readPassword()
fmt.Printf("\nRepeat: ") fmt.Printf("Repeat: ")
p2 := readPassword() p2 := readPassword()
fmt.Printf("\n")
if p1 != p2 { if p1 != p2 {
fmt.Printf("Passwords do not match\n") fmt.Printf("Passwords do not match\n")
os.Exit(ERREXIT_PASSWORD) os.Exit(ERREXIT_PASSWORD)
@ -23,6 +22,7 @@ func readPasswordTwice() string {
func readPassword() string { func readPassword() string {
fd := int(os.Stdin.Fd()) fd := int(os.Stdin.Fd())
p, err := terminal.ReadPassword(fd) p, err := terminal.ReadPassword(fd)
fmt.Printf("\n")
if err != nil { if err != nil {
fmt.Printf("Error: Could not read password: %v\n", err) fmt.Printf("Error: Could not read password: %v\n", err)
os.Exit(ERREXIT_PASSWORD) os.Exit(ERREXIT_PASSWORD)