diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index 62a9622d..9ededb2d 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -76,7 +76,7 @@ class posixAccount extends baseModule { $this->messages['uid'][1] = array('WARN', _('User name'), _('You are using a capital letters. This can cause problems because windows isn\'t case-sensitive.')); $this->messages['uid'][2] = array('ERROR', _('User name'), _('User name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !')); $this->messages['uid'][3] = array('WARN', _('Host name'), _('You are using a capital letters. This can cause problems because windows isn\'t case-sensitive.')); - $this->messages['uid'][4] = array('ERROR', _('Host name'), _('Host name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ ! Host name must end with $ !')); + $this->messages['uid'][4] = array('ERROR', _('Host name'), _('Host name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !')); $this->messages['uid'][5] = array('WARN', _('User name'), _('User name in use. Selected next free user name.')); $this->messages['uid'][6] = array('WARN', _('Host name'), _('Host name in use. Selected next free host name.')); $this->messages['uid'][7] = array('ERROR', _('Account %s:') . ' posixAccount_userName', _('User name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !')); @@ -337,7 +337,7 @@ class posixAccount extends baseModule { ), 'minMaxHost' => array( 'Headline' => _('UID number'), - 'Text' => _('These are the minimum and maximum numbers to use for machine IDs when creating new accounts for Samba hosts. The range should be different from that of users. New host accounts will always get the highest number in use plus one.') + 'Text' => _('These are the minimum and maximum numbers to use for machine IDs when creating new accounts for hosts. The range should be different from that of users. New host accounts will always get the highest number in use plus one.') ), 'pwdHash' => array( "Headline" => _("Password hash type"), @@ -790,11 +790,6 @@ class posixAccount extends baseModule { $errors[] = $this->messages['uid'][2]; } if ($this->get_scope()=='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 if ( !get_preg($this->attributes['uid'][0], 'hostname')) $errors[] = $this->messages['uid'][4]; diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index 15847ca0..eb9e46bb 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -126,10 +126,6 @@ class sambaSamAccount extends baseModule { $return['icon'] = 'samba.png'; // manages user and host accounts $return["account_types"] = array("user", "host"); - if ($this->get_scope() == "host") { - // LDAP filter - $return["ldap_filter"] = array('and' => '(uid=*$)', 'or' => "(objectClass=posixAccount)"); - } // alias name $return["alias"] = _('Samba 3'); // RDN attribute @@ -560,6 +556,27 @@ class sambaSamAccount extends baseModule { if ($attrs['uid'][0]=='') return false; return true; } + + /** + * This function is used to check if all settings for this module have been made. + * + * @see baseModule::module_complete + * + * @return boolean true, if settings are complete + */ + public function module_complete() { + if (!in_array('sambaSamAccount', $this->attributes['objectClass'])) { + return true; + } + if ($this->get_scope() == "host") { + $attrs = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes(); + if (substr($attrs['uid'][0], -1, 1) != '$') { + return false; + } + } + return true; + } + /** * This function loads the LDAP attributes for this module. @@ -947,6 +964,12 @@ class sambaSamAccount extends baseModule { } $return = array(); if (in_array('sambaSamAccount', $this->attributes['objectClass'])) { + if ($this->get_scope() == "host") { + $attrs = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes(); + if (substr($attrs['uid'][0], -1, 1) != '$') { + StatusMessage("ERROR", _('Host name must end with $!'), _('Please check your settings on the Unix page!')); + } + } // Get Domain SID from user SID $sambaDomains = search_domains(); if (sizeof($sambaDomains) == 0) {