diff options
author | Jakob Borg <jakob@kastelo.net> | 2022-07-26 08:24:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-26 08:24:58 +0200 |
commit | adce6fa473557e921cb01d7c892181a8f9c11b0b (patch) | |
tree | 997cb8473ff8851511e944bf2fa8bfbf7100e535 /proto | |
parent | 34a5f087c8676a10eeb787d9de02c9fa33c4302c (diff) | |
download | syncthing-adce6fa473557e921cb01d7c892181a8f9c11b0b.tar.gz syncthing-adce6fa473557e921cb01d7c892181a8f9c11b0b.zip |
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.
Diffstat (limited to 'proto')
-rw-r--r-- | proto/lib/config/folderconfiguration.proto | 1 | ||||
-rw-r--r-- | proto/lib/db/structs.proto | 1 | ||||
-rw-r--r-- | proto/lib/protocol/bep.proto | 24 |
3 files changed, 26 insertions, 0 deletions
diff --git a/proto/lib/config/folderconfiguration.proto b/proto/lib/config/folderconfiguration.proto index a0a838186..1f76bde6a 100644 --- a/proto/lib/config/folderconfiguration.proto +++ b/proto/lib/config/folderconfiguration.proto @@ -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"]; diff --git a/proto/lib/db/structs.proto b/proto/lib/db/structs.proto index f27acda32..9bb8300aa 100644 --- a/proto/lib/db/structs.proto +++ b/proto/lib/db/structs.proto @@ -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; diff --git a/proto/lib/protocol/bep.proto b/proto/lib/protocol/bep.proto index b12c94914..167cd22cf 100644 --- a/proto/lib/protocol/bep.proto +++ b/proto/lib/protocol/bep.proto @@ -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 { |