From: Alain Spineux Date: Mon, 20 Apr 2020 14:40:37 +0000 (+0200) Subject: BEE Backport bacula/src/findlib/create_file.c X-Git-Tag: Release-11.3.2~1834 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a48d90f4da8892303213ca9fc70d084f6bf29ce;p=thirdparty%2Fbacula.git BEE Backport bacula/src/findlib/create_file.c This commit is the result of the squash of the following main commits: Author: Alain Spineux Date: Mon Nov 12 11:07:04 2018 +0100 win32: Fix #4286 about the restore of a volume root directory with the hidden & system attributes - Detect root directories like C:\ or C:\mount_point and setup st_rdev=WIN32_ROOT_POINT to tell restore to not restore the hidden and system attributes - Be aware that there is 2 different "directories" (1) the parent directory like c:\mount_point and (2) the root directory of the volume that your are attaching to the parent. The attributes that you see is the attribute of (1) but for drive letters, their is no (1) then you see always (2) (that are hidden and system). When VSS snapshot is used --- diff --git a/bacula/src/findlib/create_file.c b/bacula/src/findlib/create_file.c index 8a7102a7b2..088834d105 100644 --- a/bacula/src/findlib/create_file.c +++ b/bacula/src/findlib/create_file.c @@ -365,6 +365,13 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace) case FT_DIRBEGIN: case FT_DIREND: Dmsg2(200, "Make dir mode=%o dir=%s\n", new_mode, attr->ofname); + if (is_win32_stream(attr->data_stream) && attr->statp.st_rdev == WIN32_ROOT_POINT) { + /* this is a root directory like C:\ or C:\anymountpoint, + * don't restore HIDDEN and SYSTEM attributes + */ + new_mode &= ~S_ISVTX; // remove FILE_ATTRIBUTE_HIDDEN + new_mode |= S_IRWXO; // remove FILE_ATTRIBUTE_SYSTEM + } if (!makepath(attr, attr->ofname, new_mode, parent_mode, uid, gid, 0)) { return CF_ERROR; }