5abe3d9 ipaserver.install.adtrust: fix CID 323644

2 files Authored by abbra 5 years ago, Committed by cheimes 5 years ago,
    ipaserver.install.adtrust: fix CID 323644
    
    Fix Coverity finding CID 323644: logically dead code path
    
    The code to determine whether NetBIOS name was already set or need to be
    set after deriving it from a domain or asking a user for an interactive
    input, was refactored at some point to avoid retrieving the whole LDAP
    entry. Instead, it was provided with the actual NetBIOS name retrieved.
    
    As result, a part of the code got neglected and was never executed.
    
    Fix this code and provide a test that tries to test predefined,
    interactively provided and automatically derived NetBIOS name depending
    on how the installer is being run.
    
    We mock up the actual execution so that no access to LDAP or Samba is
    needed.
    
    Backport to ipa-4-7 takes into account Python 2.7 differences:
     - uses mock instead of unittest.mock if the latter is not available
     - derives ApiMockup from object
    
    Fixes: https://pagure.io/freeipa/issue/7753
    Reviewed-By: Christian Heimes <cheimes@redhat.com>
    (cherry picked from commit 82af034023b03ae64f005c8160b9e961e7b9fd55)
    
    Reviewed-By: Christian Heimes <cheimes@redhat.com>
    
        
file modified
+1 -2