Skip to content

Commit

Permalink
fusefrontend: Set owner after symlink creation in PlaintextNames mode
Browse files Browse the repository at this point in the history
This is already done in regular mode, but was missing when PlaintextNames mode
is enabled. As a result, symlinks created by non-root users were still owned
by root afterwards.

Fixes rfjakob#176
  • Loading branch information
slackner committed Nov 28, 2017
1 parent 84fb791 commit cf081fa
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions internal/fusefrontend/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,16 +427,15 @@ func (fs *FS) Symlink(target string, linkName string, context *fuse.Context) (co
if err != nil {
return fuse.ToStatus(err)
}
if fs.args.PlaintextNames {
err = os.Symlink(target, cPath)
return fuse.ToStatus(err)
var cTarget string = target
if !fs.args.PlaintextNames {
// Symlinks are encrypted like file contents (GCM) and base64-encoded
cBinTarget := fs.contentEnc.EncryptBlock([]byte(target), 0, nil)
cTarget = fs.nameTransform.B64.EncodeToString(cBinTarget)
}
// Symlinks are encrypted like file contents (GCM) and base64-encoded
cBinTarget := fs.contentEnc.EncryptBlock([]byte(target), 0, nil)
cTarget := fs.nameTransform.B64.EncodeToString(cBinTarget)
// Handle long file name
cName := filepath.Base(cPath)
if nametransform.IsLongContent(cName) {
if !fs.args.PlaintextNames && nametransform.IsLongContent(cName) {
var dirfd *os.File
dirfd, err = os.Open(filepath.Dir(cPath))
if err != nil {
Expand Down

0 comments on commit cf081fa

Please sign in to comment.