do not check UID/GID for existing accounts

This commit is contained in:
Roland Gruber 2008-07-17 19:25:30 +00:00
parent 8eff004b83
commit 1f6e60114d
2 changed files with 31 additions and 27 deletions

View File

@ -758,10 +758,11 @@ class posixAccount extends baseModule {
// old account -> return id-number which has been used
}
else {
// Check manual ID
// id-number is out of valid range
// check manual ID
if ($this->getAccountContainer()->isNewAccount || !isset($this->orig['uidNumber'][0]) || ($this->orig['uidNumber'][0] != $this->attributes['uidNumber'][0])) {
// check range
if (!is_numeric($this->attributes['uidNumber'][0]) || ($this->attributes['uidNumber'][0] < $minID) || ($this->attributes['uidNumber'][0] > $maxID)) $errors[] = array('ERROR', _('ID-Number'), sprintf(_('Please enter a value between %s and %s!'), $minID, $maxID));
// $uids is allways an array but not if no entries were found
// $uids is always an array but not if no entries were found
if (is_array($uids)) {
// id-number is in use and account is a new account
if ((in_array($this->attributes['uidNumber'][0], $uids)) && $this->orig['uidNumber'][0]=='') $errors[] = array('ERROR', _('ID-Number'), _('ID is already in use'));
@ -772,6 +773,7 @@ class posixAccount extends baseModule {
}
}
}
}
if ($this->get_scope()=='user') {
if (($this->attributes['uid'][0] != $_POST['uid']) && !get_preg($_POST['uid'], '!upper'))
$errors[] = $this->messages['uid'][1];

View File

@ -568,7 +568,8 @@ class posixGroup extends baseModule {
}
else {
// Check manual ID
// id-number is out of valid range
if ($this->getAccountContainer()->isNewAccount || !isset($this->orig['gidNumber'][0]) || ($this->orig['gidNumber'][0] != $this->attributes['gidNumber'][0])) {
// check range
if (($this->attributes['gidNumber'][0] < $minID) || ($this->attributes['gidNumber'][0] > $maxID) || !is_numeric($this->attributes['gidNumber'][0])) {
$errors[] = array('ERROR', _('ID-Number'), sprintf(_('Please enter a value between %s and %s!'), $minID, $maxID));
if (isset($this->orig['gidNumber'][0])) $this->attributes['gidNumber'][0] = $this->orig['gidNumber'][0];
@ -589,6 +590,7 @@ class posixGroup extends baseModule {
}
}
}
}
if ($this->attributes['cn'][0]!=$_POST['cn']) {
$this->attributes['cn'][0] = $_POST['cn'];
if (($this->attributes['cn'][0] != $_POST['cn']) && ereg('[A-Z]$', $_POST['cn']))