7cac506 IPA: Remove MPG groups if getgrgid was called before getpw()

Authored and Committed by jhrozek 5 years ago
    IPA: Remove MPG groups if getgrgid was called before getpw()
    
    https://fedorahosted.org/sssd/ticket/2724
    
    This bug only affects IPA clients that are connected to IPA servers with
    AD trust and ID mapping in effect.
    
    If an IPA client calls getgrgid() for an ID that matches a user, the
    user's private group would be returned and stored as a group entry.
    
    Subsequent queries for that user would fail, because MPG domains impose
    uniqueness restriction for both the ID and name space across groups and
    users.
    
    To work around that, we remove the UPG groups in MPG domains during a
    group lookup.
    
    Reviewed-by: Sumit Bose <sbose@redhat.com>
    (cherry picked from commit 6fe057efb981ee4b45dcadf131c03f8501fce28d)