Browse Source

lib/config: Allow sharing already encrypted folder with untrusted devices (fixes #8965) (#9012)

Safety check added in v1.23.6 introduced bug. Bug unshares folders with untrusted devices if folder does not have an encryption password set, regardless of whether the folder is shared with the untrusted device as encrypted or not. Prevents sharing with untrusted devices in some cases where sharing would be encrypted.

Patch preserves safety check but permits sharing folders with untrusted devices if they are shared as encrypted.

Signed-off-by: kewiha <[email protected]>
Keith Harrison 2 years ago
parent
commit
eed12f3ec5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lib/config/config.go

+ 2 - 2
lib/config/config.go

@@ -556,8 +556,8 @@ loop:
 func ensureNoUntrustedTrustingSharing(f *FolderConfiguration, devices []FolderDeviceConfiguration, existingDevices map[protocol.DeviceID]*DeviceConfiguration) []FolderDeviceConfiguration {
 func ensureNoUntrustedTrustingSharing(f *FolderConfiguration, devices []FolderDeviceConfiguration, existingDevices map[protocol.DeviceID]*DeviceConfiguration) []FolderDeviceConfiguration {
 	for i := 0; i < len(devices); i++ {
 	for i := 0; i < len(devices); i++ {
 		dev := devices[i]
 		dev := devices[i]
-		if dev.EncryptionPassword != "" {
-			// There's a password set, no check required
+		if dev.EncryptionPassword != "" || f.Type == FolderTypeReceiveEncrypted {
+			// There's a password set or the folder is received encrypted, no check required
 			continue
 			continue
 		}
 		}
 		if devCfg := existingDevices[dev.DeviceID]; devCfg.Untrusted {
 		if devCfg := existingDevices[dev.DeviceID]; devCfg.Untrusted {