Skip to content

lib/model: Fix passwords on receive-enc needing token (ref #7518) - #7739

Merged
imsodin merged 1 commit into
syncthing:mainfrom
imsodin:model/fix-enc-send-cc-pw
Jun 3, 2021
Merged

imsodin merged 1 commit into
syncthing:mainfrom
imsodin:model/fix-enc-send-cc-pw

Conversation

@imsodin

@imsodin imsodin commented Jun 2, 2021

Copy link
Copy Markdown
Member

I was testing some encryption related UI changes (not this PR) when suddenly all hell broke loose: The trusted side treated received encrypted file indexes like normal files. Reason is that the change in #7198 is just plain broken, luckily it only matters if you have encrypted folders both ways (folder1: A untrusted <-> B, folder2: A <-> B untrusted). That is uncommon enough that no-one seems to have run into it yet - yeii for not cleaning up old test folders on test setups.

The completely broken part is returning early from generateClusterConfig with passwords == nil, and then ignoring that error in AddConnection, thus going ahead and calling Connection.SetPasswords with a nil map.

I basically reverted #7518 and to keep #7198 fixed, I added a new check to CommitConfiguration: If a receive-encrypted folder changes, and it doesn't have the token yet, don't just resend a cluster config, but drop the connection (to get the token).

Comment thread lib/model/model.go
for _, id := range closeDevices {
delete(clusterConfigDevices, id)
if conn, ok := m.conn[id]; ok {
go conn.Close(errDevicePaused)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be sending multiple closes here for the same connection; I'm going to assume that's OK.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's a noop then (there's a sync.Once in protocol.Connection).

@imsodin
imsodin merged commit 41baccb into syncthing:main Jun 3, 2021
@imsodin
imsodin deleted the model/fix-enc-send-cc-pw branch June 3, 2021 13:39
@calmh calmh added this to the v1.18.0 milestone Jun 8, 2021
@calmh calmh added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Aug 11, 2022
@syncthing syncthing locked and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants