summaryrefslogtreecommitdiff
path: root/mount.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-03-22 00:02:10 +0100
committerJakob Unterwurzacher2018-03-22 00:02:10 +0100
commit9bc039a4bac6b51d9ebe116de5c311e90343a088 (patch)
treef4ebd37e2cbe4088435421fb7c9550c186161b09 /mount.go
parent9c86daf499dca8a69b058ec56803d06fbba4fdab (diff)
Add `-masterkey=stdin` functionality
https://github.com/rfjakob/gocryptfs/issues/218
Diffstat (limited to 'mount.go')
-rw-r--r--mount.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/mount.go b/mount.go
index 21a70af..96ff7f6 100644
--- a/mount.go
+++ b/mount.go
@@ -98,9 +98,14 @@ func doMount(args *argContainer) {
{
// Get master key (may prompt for the password)
var masterkey []byte
+ masterkeyFromStdin := false
+ if args.masterkey == "stdin" {
+ args.masterkey = string(readpassword.Once("", "Masterkey"))
+ masterkeyFromStdin = true
+ }
if args.masterkey != "" {
// "-masterkey"
- masterkey = parseMasterKey(args.masterkey)
+ masterkey = parseMasterKey(args.masterkey, masterkeyFromStdin)
} else if args.zerokey {
// "-zerokey"
tlog.Info.Printf("Using all-zero dummy master key.")
@@ -354,7 +359,7 @@ func initFuseFrontend(masterkey []byte, args *argContainer, confFile *configfile
}
srv, err := fuse.NewServer(conn.RawFS(), args.mountpoint, &mOpts)
if err != nil {
- tlog.Fatal.Printf("fuse.NewServer failed: %v", err)
+ tlog.Fatal.Printf("fuse.NewServer failed: %q", err)
if runtime.GOOS == "darwin" {
tlog.Info.Printf("Maybe you should run: /Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse")
}