summaryrefslogtreecommitdiff
path: root/ucs-3.0/tests/17-set-john-mailserver.sh
blob: 5249278cf9eb4e5c767497605e89ad1cd454d6c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

eval "$(ucr shell)"

if [ "${server_role}" != "domaincontroller_master" ]; then
    echo "SKIPPED - This system is not a master domain controller."
    exit 0
fi

imap_server=$(ldapsearch -x -H ldap://${ldap_server_name}:${ldap_server_port} -D "${ldap_hostdn}" -y /etc/machine.secret -LLL "(univentionService=IMAP)" cn | grep ^cn | awk '{print $2}' | head -n 1)

if [ -z "${imap_server}" ]; then
    echo "FAILED - No IMAP server found"
    exit 1
fi

univention-directory-manager users/user modify \
    --dn="uid=doe,cn=users,${ldap_base}" \
    --set "mailHomeServer=${imap_server}.${domainname}"

ldapsearch -x -H ldap://${ldap_server_name}:${ldap_server_port} -b "${ldap_base}" -LLL -D "${ldap_hostdn}" -y /etc/machine.secret "(uid=doe)" entrydn univentionMailHomeServer