b6be68c Ticket #48265 - Complex filter in a search request doen't work as expected. (regression)

Authored and Committed by nhosoi 8 years ago
    Ticket #48265 - Complex filter in a search request doen't work as expected. (regression)
    
    Description: commit c2658c14802783d0a8919783aa7123be9e749c18 to fix
    Ticket 47521 - Complex filter in a search request doen't work as expected.
    regressed this case:
      "(&(&(|(l=A)(l=B)(l=C))(|(C=D)(c=E)))(|(uid=*test*)(cn=*test*))(o=X))"
    in which a simple filter follows a complex filter which choice is
    different from the outer choice.  I.e., '|' for (uid=...)(cn=...)
    is different from the first '&'.
    
    The fix for 47521 solves this case:
      "(&(&(uid=A)(cn=B))(&(givenname=C))(mail=D)(&(description=E)))"
    in this case, (mail=D) used to be dropped from the filter in the
    function index_subsys_flatten_filter.
    
    The 47521 fix saved the simple filter "(mail=D)" in the 2nd example,
    but it forced to skip the complex filter with the different choice
    and converted the 1st example to:
      "(&(&(|(l=A)(l=B)(l=C))(|(C=D)(c=E)))(o=X))"
    This patch saves such a complex filter, as well.
    
    https://fedorahosted.org/389/ticket/48265
    
    Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
    
    (cherry picked from commit 8c3d3e4648fbb5229e329e2154d46f1ae808ba02)
    (cherry picked from commit 3d9dbf2d441e551495a1f3169dc2020324c484b4)