[Bug 1918] match_pattern_list fails for negated failure

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Fri Aug 25 18:57:33 AEST 2017


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

Damien Miller <djm at mindrot.org> changed:

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

--- Comment #32 from Damien Miller <djm at 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.


More information about the openssh-bugs mailing list