automatically add "$" to uid for hosts

This commit is contained in:
Roland Gruber 2005-10-26 09:24:20 +00:00
parent 1135c5d709
commit 835583383b
1 changed files with 8 additions and 5 deletions

View File

@ -687,7 +687,7 @@ class posixAccount extends baseModule {
if ( !get_preg($this->attributes['homeDirectory'][0], 'homeDirectory' )) if ( !get_preg($this->attributes['homeDirectory'][0], 'homeDirectory' ))
$triggered_messages['homeDirecotry'][] = $this->messages['homeDirectory'][0]; $triggered_messages['homeDirecotry'][] = $this->messages['homeDirectory'][0];
} }
if (($post['userPassword_lock'] && $post['userPassword_invalid']) || ($post['userPassword_nopassword'] && $post['userPassword_invalid'])) { if (($post['userPassword_lock'] && $post['userPassword_invalid']) || ($post['userPassword_nopassword'] && $post['userPassword_invalid'])) {
// found invalid password parameter combination // found invalid password parameter combination
$triggered_messages['userPassword'][] = $this->messages['userPassword'][3]; $triggered_messages['userPassword'][] = $this->messages['userPassword'][3];
} }
@ -732,6 +732,11 @@ class posixAccount extends baseModule {
$triggered_messages['uid'][] = $this->messages['uid'][2]; $triggered_messages['uid'][] = $this->messages['uid'][2];
} }
if ($_SESSION[$this->base]->type=='host') { if ($_SESSION[$this->base]->type=='host') {
// add "$" to uid if needed
if (substr($this->attributes['uid'][0], -1, 1) != '$') {
$this->attributes['uid'][0] .= '$';
$post['uid'] .= '$';
}
// Check if Hostname contains only valid characters // Check if Hostname contains only valid characters
if ( !get_preg($this->attributes['uid'][0], 'hostname')) if ( !get_preg($this->attributes['uid'][0], 'hostname'))
$triggered_messages['uid'][] = $this->messages['uid'][4]; $triggered_messages['uid'][] = $this->messages['uid'][4];
@ -783,10 +788,8 @@ class posixAccount extends baseModule {
} }
// Show warning if lam has changed username // Show warning if lam has changed username
if ($this->attributes['uid'][0] != $post['uid']) { if ($this->attributes['uid'][0] != $post['uid']) {
if ($_SESSION[$this->base]->type=='user') if ($_SESSION[$this->base]->type=='user') $triggered_messages['uid'][] = $this->messages['uid'][5];
$triggered_messages['uid'][] = $this->messages['uid'][5]; if ($_SESSION[$this->base]->type=='host') $triggered_messages['uid'][] = $this->messages['uid'][6];
if ($_SESSION[$this->base]->type=='host')
$triggered_messages['uid'][] = $this->messages['uid'][6];
} }
if ($_SESSION[$this->base]->isNewAccount && !get_preg($this->attributes['userPassword'][0], 'password')) if ($_SESSION[$this->base]->isNewAccount && !get_preg($this->attributes['userPassword'][0], 'password'))
$triggered_messages['userPassword'][] = $this->messages['userPassword'][1]; $triggered_messages['userPassword'][] = $this->messages['userPassword'][1];