all: Support syncing ownership (fixes #1329) (#8434)

This adds support for syncing ownership on Unixes and on Windows. The
scanner always picks up ownership information, but it is not applied
unless the new folder option "Sync Ownership" is set.

Ownership data is stored in a new FileInfo field called "platform data". This
is intended to hold further platform-specific data in the future
(specifically, extended attributes), which is why the whole design is a
bit overkill for just ownership.
This commit is contained in:
Jakob Borg
2022-07-26 08:24:58 +02:00
committed by GitHub
parent 34a5f087c8
commit adce6fa473
35 changed files with 1896 additions and 500 deletions
@@ -54,6 +54,7 @@ message FolderConfiguration {
fs.CopyRangeMethod copy_range_method = 32 [(ext.default) = "standard"];
bool case_sensitive_fs = 33 [(ext.goname) = "CaseSensitiveFS", (ext.xml) = "caseSensitiveFS", (ext.json) = "caseSensitiveFS"];
bool follow_junctions = 34 [(ext.goname) = "JunctionsAsDirs", (ext.xml) = "junctionsAsDirs", (ext.json) = "junctionsAsDirs"];
bool sync_ownership = 35;
// Legacy deprecated
bool read_only = 9000 [deprecated=true, (ext.xml) = "ro,attr,omitempty"];
+1
View File
@@ -36,6 +36,7 @@ message FileInfoTruncated {
uint32 permissions = 4;
int32 modified_ns = 11;
int32 block_size = 13 [(ext.goname) = "RawBlockSize"];
protocol.PlatformData platform = 14;
// see bep.proto
uint32 local_flags = 1000;
+24
View File
@@ -107,6 +107,7 @@ message FileInfo {
uint32 permissions = 4;
int32 modified_ns = 11;
int32 block_size = 13 [(ext.goname) = "RawBlockSize"];
PlatformData platform = 14;
// The local_flags fields stores flags that are relevant to the local
// host only. It is not part of the protocol, doesn't get sent or
@@ -147,6 +148,29 @@ message Counter {
uint64 value = 2;
}
message PlatformData {
UnixData unix = 1 [(gogoproto.nullable) = true];
WindowsData windows = 2 [(gogoproto.nullable) = true];
}
message UnixData {
// The owner name and group name are set when known (i.e., could be
// resolved on the source device), while the UID and GID are always set
// as they come directly from the stat() call.
string owner_name = 1;
string group_name = 2;
int32 uid = 3 [(ext.goname) = "UID"];
int32 gid = 4 [(ext.goname) = "GID"];
}
message WindowsData {
// Windows file objects have a single owner, which may be a user or a
// group. We keep the name of that account, and a flag to indicate what
// type it is.
string owner_name = 1;
bool owner_is_group = 2;
}
// Request
message Request {