mirror of
https://github.com/rclone/rclone.git
synced 2024-11-21 16:03:29 +01:00
windows: make rclone work with SeBackupPrivilege and/or SeRestorePrivilege
On Windows, this change includes the `FILE_FLAG_BACKUP_SEMANTICS` in all calls to `CreateFile`. Adding this flag allows is useful when rclone is running within a security context that has `SeBackupPrivilege` and/or `SeRestorePrivilege` token privileges enabled. Without this flag, rclone cannot properly leverage special security groups such as Backup Operators who possess the these privileges. See: https://forum.rclone.org/t/rclone-sebackupprivilege-file-flag-backup-semantics/45339 See: https://github.com/rclone/rclone/pull/7877.
This commit is contained in:
parent
dac7f76b14
commit
b778ec0142
@ -61,7 +61,7 @@ func OpenFile(path string, mode int, perm os.FileMode) (*os.File, error) {
|
||||
default:
|
||||
createmode = syscall.OPEN_EXISTING
|
||||
}
|
||||
h, e := syscall.CreateFile(pathp, access, sharemode, nil, createmode, syscall.FILE_ATTRIBUTE_NORMAL, 0)
|
||||
h, e := syscall.CreateFile(pathp, access, sharemode, nil, createmode, syscall.FILE_ATTRIBUTE_NORMAL|syscall.FILE_FLAG_BACKUP_SEMANTICS, 0)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user