fusefrontend: Set owner after symlink creation in PlaintextNames mode
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 https://github.com/rfjakob/gocryptfs/issues/176
This commit is contained in:
parent
3f68b0c09a
commit
295c4c2b85
@ -427,16 +427,15 @@ func (fs *FS) Symlink(target string, linkName string, context *fuse.Context) (co
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fuse.ToStatus(err)
|
return fuse.ToStatus(err)
|
||||||
}
|
}
|
||||||
if fs.args.PlaintextNames {
|
var cTarget string = target
|
||||||
err = os.Symlink(target, cPath)
|
if !fs.args.PlaintextNames {
|
||||||
return fuse.ToStatus(err)
|
// 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
|
// Handle long file name
|
||||||
cName := filepath.Base(cPath)
|
cName := filepath.Base(cPath)
|
||||||
if nametransform.IsLongContent(cName) {
|
if !fs.args.PlaintextNames && nametransform.IsLongContent(cName) {
|
||||||
var dirfd *os.File
|
var dirfd *os.File
|
||||||
dirfd, err = os.Open(filepath.Dir(cPath))
|
dirfd, err = os.Open(filepath.Dir(cPath))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user