Bifrost#T36198: Create non-conflicting ServerId for objects with non-unique or long UID
ClosedPublic

Authored by machniak on Jul 19 2017, 1:36 PM.

Details

Summary

This fixes two cases:

  • Activesync client creating an object with very long UID (more than 64 chars)
  • Storage containing more than one copy of the same event.

Diff Detail

Repository
rS syncroton
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
machniak created this revision.Jul 19 2017, 1:36 PM
vanmeeuwen requested changes to this revision.Jul 19 2017, 3:33 PM
vanmeeuwen added a subscriber: vanmeeuwen.

Please see the inline commentary / questions.

lib/kolab_sync_data.php
977

Would there be a reason to not let $folder->get_object($uid) fail before doing the more expensive preg_match()?

Could we clause with a strstr($uid, 'CRC') == 0 to clause the expensive preg_match() only happening against the sub-set of UIDs?

1913

this substr($uid, 0, 53) will actually constitute up to 54 characters, right? We only have 53 left.

This revision now requires changes to proceed.Jul 19 2017, 3:33 PM
machniak requested review of this revision.Jul 19 2017, 3:39 PM
machniak added inline comments.
lib/kolab_sync_data.php
977

As it is prefix match I don't think it would give as much more performance. Besides, after this change all UIDs are supposed to be CRC-prefixed. So, it is more a sanity check + string exploding.

1913

3rd argument of substr() is requested length.

vanmeeuwen accepted this revision.Jul 19 2017, 3:41 PM
vanmeeuwen added inline comments.
lib/kolab_sync_data.php
977

OK, agreed.

1913

Ah, I thought it was the end position, starting from 0 ;-)

This revision is now accepted and ready to land.Jul 19 2017, 3:41 PM
This revision was automatically updated to reflect the committed changes.