diff --git management/univention-management-console-module-adtakeover/umc/python/adtakeover/takeover.py management/univention-management-console-module-adtakeover/umc/python/adtakeover/takeover.py index 59d2ef9ebe..5baf3926af 100644 --- management/univention-management-console-module-adtakeover/umc/python/adtakeover/takeover.py +++ management/univention-management-console-module-adtakeover/umc/python/adtakeover/takeover.py @@ -1334,14 +1334,11 @@ class AD_Takeover(object): for attr in ("mail", "proxyAddresses"): if attr in msg: for address in msg[attr]: - address = address.decode('UTF-8').find("@") - char_idx = address.find("@") - if char_idx != -1: - domainpart = address[char_idx + 1:].lower() - # if not domainpart.endswith(".local"): ## We need to create all the domains. Alternatively set: - # ucr:directory/manager/web/modules/users/user/properties/mailAlternativeAddress/syntax=emailAddress - if domainpart not in maildomains: - maildomains.append(domainpart) + address, _, domainpart = address.decode('UTF-8').lower().rpartition('@') + # if not domainpart.endswith(".local"): ## We need to create all the domains. Alternatively set: + # ucr:directory/manager/web/modules/users/user/properties/mailAlternativeAddress/syntax=emailAddress + if domainpart and domainpart not in maildomains: + maildomains.append(domainpart) for maildomain in maildomains: returncode = run_and_output_to_log(["univention-directory-manager", "mail/domain", "create", "--ignore_exists", "--position", "cn=domain,cn=mail,%s" % self.ucr["ldap/base"], "--set", "name=%s" % maildomain], log.debug) if returncode != 0: