Skip to content

Commit

Permalink
findlib: parent dirs should have consistent mode
Browse files Browse the repository at this point in the history
Previously when creating parent directories Bareos handled the deepest
parent directory special and set permissions on it.
This surfaced when selecting only files, but not directories to restore.
In that case the directory that contains the files got a mode that was
derived from the file mode of the file being restored when the parent
directory was created.
While this in itself is already inconsistent, the effective mode was
also calculated by adding S_IWUSR and S_IXUSR which did not take group
or other in account.

This patch now makes sure that no permission on parent directories is
set explicitly, so you just get what the effective uid, gid and umask
will produce.

(cherry picked from commit 7058607)
  • Loading branch information
arogge committed Dec 18, 2019
1 parent fe22caa commit 68c99eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/findlib/mkpath.cc
Expand Up @@ -266,7 +266,7 @@ bool makepath(Attributes *attr, const char *apath, mode_t mode, mode_t parent_mo
/*
* Set for final component
*/
if (i < ndir && new_dir[i++]) {
if (i < ndir && new_dir[i++] && !keep_dir_modes) {
SetOwnMod(attr, path, owner, group, mode);
}

Expand Down

0 comments on commit 68c99eb

Please sign in to comment.