#!/usr/share/ucs-test/runner bash
# shellcheck shell=bash
## desc: Checking for the ktutil replication problem
## bugs: [10047]
## roles: [domaincontroller_master, domaincontroller_backup]
## tags: [basic]
## packages: [ldap-utils]
## exposure: dangerous
eval "$(univention-config-registry shell)"

# shellcheck source=../../lib/base.sh
. "$TESTLIBPATH/base.sh" || exit 137
# shellcheck source=../../lib/random.sh
. "$TESTLIBPATH/random.sh" || exit 137

tmpfile=$(mktemp)
trap "rm -f '$tmpfile'" EXIT
cat >$tmpfile <<__HERE__
dn: $ldap_hostdn
changetype: modify
replace: description
description: ktutil check $(random_chars)
__HERE__

echo -e "\n\n***Change the description of the local host"
ldapmodify -x -D "cn=admin,$ldap_base" -y /etc/ldap.secret -H "ldap://$ldap_master:$ldap_master_port" -f "$tmpfile"

if ! wait_for_replication; then
	echo "Error: The notifier_id is wrong. Please check Bug #10047."
	exit 111
else
	exit 101
fi

# vim: set ft=sh :
