5c62fbd kdb: fix memory handling in ipadb_find_principal

1 file Authored by abbra 3 years ago, Committed by cheimes 3 years ago,
    kdb: fix memory handling in ipadb_find_principal
    
    BER structure representing a string might not have termination '\0'
    character, thus we should use length-bound functions to operate on it.
    
    Memory handling of LDAP values was leaving previous vals over iteration.
    Also, when freeing vals, we need to explicitly set it to NULL.
    
    Fixes: https://pagure.io/freeipa/issue/8291
    
    Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
    Reviewed-by: Simo Sorce <ssorce@redhat.com>
    Reviewed-By: Christian Heimes <cheimes@redhat.com>