ejabberd icon indicating copy to clipboard operation
ejabberd copied to clipboard

mod_privacy: honor the 'order' attribute

Open crosser opened this issue 7 years ago • 7 comments

When checking a packet against the active privacy list, make sure that the items in the list are sorted according to the 'order' attribute.

Bug-url: https://github.com/processone/ejabberd/issues/2529 Signed-off-by: Eugene Crosser [email protected]

crosser avatar Jul 15 '18 15:07 crosser

No, this is not efficient. The list should be sorted during iq-set.

zinid avatar Jul 15 '18 19:07 zinid

Then you would need to guarantee that the backend preserves the order. Is there such guarantee, including possible future backends?

In any case, my concern is the bug #2529 . If it is fixed in some other way, I'll be perfectly happy.

crosser avatar Jul 15 '18 19:07 crosser

@zinid , I think that I can make ordering O(N) and still used at application-time. Will that be acceptable? If so, I'll resubmit this PR.

(I think pre-sorting is not a good design. Imagine that you keep it in an SQL and someone decides to modify the data directly in the backend. Then sorting will be lost. I actually did that before, because user-side privacy list editor(s?) suck.)

crosser avatar Jul 16 '18 07:07 crosser

@zinid , I pushed a new version of the patch that does not use lists:sort(). (But the code is more difficult to read, unfortunately :( ). Please see if this is more acceptable. Thanks.

crosser avatar Jul 16 '18 14:07 crosser

Hi @crosser, many thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes.

p1bot avatar Jan 21 '19 11:01 p1bot

You did it @crosser!

Thank you for signing the ProcessOne Contribution License Agreement.

We will have a look at your contribution!

p1bot avatar Jan 21 '19 11:01 p1bot

@prefiks: What do you think about this PR and Issue?

Neustradamus avatar Apr 20 '23 10:04 Neustradamus