Author: Philipp Hahn Date: Mon Dec 5 13:38:00 2016 +0100 Bug #42124 join: Search for IP and MAC too When creating a new computer object, search for the IP and MAC address too. This solves the case where the computer object is pre-created, but uses a different name than the computer currently uses. diff --git a/management/univention-join/univention-server-join b/management/univention-join/univention-server-join index 2186418..34afca9 100755 --- a/management/univention-join/univention-server-join +++ b/management/univention-join/univention-server-join @@ -211,7 +211,10 @@ create_entry () { local group="$5" log 0 "Join $desc" - old_dn="$(univention-directory-manager "$module" list --filter name="$NEWHOSTNAME" "${ADMINOPTIONS[@]}" | DN1)" + query="(name=$NEWNAME)" + [ -n "${MAC:-}" ] && query+="(mac=$MAC)" + [ -n "${IP:-}" ] && query+="(ip=$IP)" + old_dn="$(univention-directory-manager computers/computer list --filter "(|${query})" "${ADMINOPTIONS[@]}" | DN1)" if [ $? -gt 0 ]; then log 1 "E: failed search $desc [$old_dn]" exit 1