Add a raiseonerr option to ldappasswd_user_change

This is so on tests for bad password one can catch the error
message.

https://pagure.io/freeipa/issue/6964
https://pagure.io/freeipa/issue/5948
https://pagure.io/freeipa/issue/2445
https://pagure.io/freeipa/issue/298

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Rob Crittenden 2020-09-26 19:40:02 -04:00
parent 6da070e655
commit be2efc12d3

View File

@ -1751,7 +1751,8 @@ def get_host_ip_with_hostmask(host):
return None
def ldappasswd_user_change(user, oldpw, newpw, master, use_dirman=False):
def ldappasswd_user_change(user, oldpw, newpw, master, use_dirman=False,
raiseonerr=True):
container_user = dict(DEFAULT_CONFIG)['container_user']
basedn = master.domain.basedn
@ -1766,7 +1767,7 @@ def ldappasswd_user_change(user, oldpw, newpw, master, use_dirman=False):
else:
args = [paths.LDAPPASSWD, '-D', userdn, '-w', oldpw, '-a', oldpw,
'-s', newpw, '-x', '-ZZ', '-H', master_ldap_uri]
master.run_command(args)
return master.run_command(args, raiseonerr=raiseonerr)
def ldappasswd_sysaccount_change(user, oldpw, newpw, master, use_dirman=False):