diff --git a/services/univention-s4-connector/modules/univention/s4connector/s4/password.py b/services/univention-s4-connector/modules/univention/s4connector/s4/password.py index beb31751a8..ef7ee01d87 100644 --- a/services/univention-s4-connector/modules/univention/s4connector/s4/password.py +++ b/services/univention-s4-connector/modules/univention/s4connector/s4/password.py @@ -605,7 +605,7 @@ def password_sync_ucs_to_s4(s4connector, key, object): if pwdHistoryLength: userobject = s4connector.get_ucs_object(key, ucs_object['dn']) pwhistoryPolicy = userobject.loadPolicyObject('policies/pwhistory') - pwhistory_length = int(pwhistoryPolicy['length']) + pwhistory_length = int(pwhistoryPolicy.get('length', 0)) if pwhistory_length != pwdHistoryLength: ud.debug(ud.LDAP, ud.WARN, "password_sync_ucs_to_s4: Mismatch between UCS pwhistoryPolicy (%s) and S4 pwhistoryPolicy (%s). Using the larger one." % (pwhistory_length, pwdHistoryLength)) des_len = max(pwdHistoryLength, pwhistory_length) * 16