From 75ebb28a625bc16d145f5acd9e0cc1d305716afe Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 10 Nov 2016 00:27:08 +0100 Subject: ctlsock: add initial limited implementation At the moment, in forward mode you can only encrypt paths and in reverse mode you can only decrypt paths. --- mount.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'mount.go') diff --git a/mount.go b/mount.go index 1a00bb7..3bafd8c 100644 --- a/mount.go +++ b/mount.go @@ -18,6 +18,7 @@ import ( "github.com/rfjakob/gocryptfs/internal/configfile" "github.com/rfjakob/gocryptfs/internal/cryptocore" + "github.com/rfjakob/gocryptfs/internal/ctlsock" "github.com/rfjakob/gocryptfs/internal/fusefrontend" "github.com/rfjakob/gocryptfs/internal/fusefrontend_reverse" "github.com/rfjakob/gocryptfs/internal/tlog" @@ -165,10 +166,18 @@ func initFuseFrontend(key []byte, args *argContainer, confFile *configfile.ConfF jsonBytes, _ := json.MarshalIndent(frontendArgs, "", "\t") tlog.Debug.Printf("frontendArgs: %s", string(jsonBytes)) var finalFs pathfs.FileSystem + var ctlSockBackend ctlsock.Interface if args.reverse { - finalFs = fusefrontend_reverse.NewFS(frontendArgs) + fs := fusefrontend_reverse.NewFS(frontendArgs) + finalFs = fs + ctlSockBackend = fs } else { - finalFs = fusefrontend.NewFS(frontendArgs) + fs := fusefrontend.NewFS(frontendArgs) + finalFs = fs + ctlSockBackend = fs + } + if args.ctlsock != "" { + ctlsock.CreateAndServe(args.ctlsock, ctlSockBackend) } pathFsOpts := &pathfs.PathNodeFsOptions{ClientInodes: true} pathFs := pathfs.NewPathNodeFs(finalFs, pathFsOpts) @@ -200,9 +209,8 @@ func initFuseFrontend(key []byte, args *argContainer, confFile *configfile.ConfF if args.reverse { mOpts.Name += "-reverse" } - // The kernel enforces read-only operation, we just have to pass "ro". - // Reverse mounts are always read-only + // Reverse mounts are always read-only. if args.ro || args.reverse { mOpts.Options = append(mOpts.Options, "ro") } -- cgit v1.2.3