diff --git a/trunk/gosa-plugins/systems/admin/systems/class_servGeneric.inc b/trunk/gosa-plugins/systems/admin/systems/class_servGeneric.inc
index 1c889b7b9f7705ea49a114cb9f40e63b6418f6b0..4eaeb02180685135d657ad9d800495ab730cad32 100644 (file)
if ($this->orig_dn != $this->dn){
$ldap= $this->config->get_ldap_link();
- $ldap->cd ($this->base);
- $ldap->search ("(cn=".$this->cn.")", array("cn"));
+ # Do not allow objects with the same name in other departments, either
+ $ldap->cd ($this->config->current['BASE']);
+ $ldap->search ("(cn=".$this->cn.")", array("cn", "gosaUnitTag"));
if ($ldap->count() != 0){
while ($attrs= $ldap->fetch()){
if ($attrs['dn'] != $this->orig_dn){
if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,".get_ou('systemIncomingRDN')."/",$attrs['dn']) && preg_match("/,".get_ou('serverRDN')."/",$attrs['dn'])){
- $message[]= msgPool::duplicated(_("Server name"));
- break;
+ if (isset($this->config->current['HONOURUNITTAGS']) &&
+ preg_match('/true/i', $this->config->current['HONOURUNITTAGS']) &&
+ $attrs['gosaUnitTag'][0] != $this->get_gosaUnitTag()) {
+ # the new/moved object is in a different administrative unit, this is not a duplicate
+ continue;
+ } else {
+ $message[]= msgPool::duplicated(_("Server Name"));
+ break;
+ }
}
}
}