https://bugzilla.mindrot.org/show_bug.cgi?id=1918

Damien Miller <d...@mindrot.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2061|0                           |1
        is obsolete|                            |

--- Comment #32 from Damien Miller <d...@mindrot.org> ---
Created attachment 3039
  --> https://bugzilla.mindrot.org/attachment.cgi?id=3039&action=edit
improved negated match heuristic

Revisiting this, I think I've come up with a heuristic that doesn't
yield horrible surprises:

If a pattern-list contains a mixture of negated and non-negated
patterns,
then it will only return success if the comparison string matches one
of
the non-negated patterns. E.g.

match("foo.example.com", "!bar.example.com,*.example.com") => success
match("bar.example.com", "!bar.example.com,*.example.com") => failure
match("notexample.com", "!bar.example.com,*.example.com") => failure

If the pattern-list contains only negated matches. the it will return
success if none of them match. E.g.

match("a", "!a,!b") => failure
match("a", "!b,!c") => success

These examples use test strings, but the same logic applies for address
matching too.

This patch implements this heuristic and adds unit tests for it.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
_______________________________________________
openssh-bugs mailing list
openssh-bugs@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-bugs

Reply via email to