diff --git a/lam/config/profiles/users/default.pru b/lam/config/profiles/users/default.pru index 898ee817..4938dae5 100644 --- a/lam/config/profiles/users/default.pru +++ b/lam/config/profiles/users/default.pru @@ -1,3 +1,4 @@ +general_group: admin general_homedir: /home/$user general_shell: /bin/bash unix_password_no: 0 @@ -11,3 +12,6 @@ smb_password_no: 0 smb_useunixpwd: 1 smb_flagsD: 1 smb_homedrive: U: +smb_smbhome: \\server\$user +smb_domain: sambaDomainName=test,dc=my-domain,dc=com +quota: /home,0,0,0,0;/,0,0,0,0 diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 49c2fcde..26db2fa3 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -969,19 +969,19 @@ function modifyuser($values,$values_old) { // Will modify the LDAP-Account // old password code $password_old = str_replace('{CRYPT}', '',$values_old->unix_password); if (substr($password_old,0,1) == '!' ) $password_old = substr($password_old,1,strlen($password_old)); - if ($values->unix_password=='') { - if ($values->unix_password_no) { - $password_old = ''; - $attr['shadowLastChange'] = getdays(); // shadowAccount_may - } - if ($values->unix_deactivated) $attr['userPassword'] = '{CRYPT}!' . $password_old; - else $attr['userPassword'] = '{CRYPT}' . $password_old; - } - else { - if ($values->unix_deactivated) $attr['userPassword'] = '{CRYPT}!' . crypt($values->unix_password); - else $attr['userPassword'] = '{CRYPT}' . crypt($values->unix_password); - $attr['shadowLastChange'] = getdays(); // shadowAccount_may - } + if ($values->unix_password=='') { + if ($values->unix_password_no) { + $password_old = ''; + $attr['shadowLastChange'] = getdays(); // shadowAccount_may + } + if ($values->unix_deactivated && !$values_old->unix_deactivated) $attr['userPassword'] = '{CRYPT}!' . $password_old; + if (!$values->unix_deactivated && $values_old->unix_deactivated) $attr['userPassword'] = '{CRYPT}' . $password_old; + } + else { + if ($values->unix_deactivated) $attr['userPassword'] = '{CRYPT}!' . crypt($values->unix_password); + else $attr['userPassword'] = '{CRYPT}' . crypt($values->unix_password); + $attr['shadowLastChange'] = getdays(); // shadowAccount_may + } if ($_SESSION['config']->is_samba3()) { if ($values->smb_password_no) { diff --git a/lam/templates/account/groupedit.php b/lam/templates/account/groupedit.php index 8e84cdf0..e9298904 100644 --- a/lam/templates/account/groupedit.php +++ b/lam/templates/account/groupedit.php @@ -370,6 +370,10 @@ switch ($select_local) { // Select which part of page will be loaded // finish = page shown after account has been created/modified case 'groupmembers': ldapreload('user'); + $temp2 = $_SESSION['userDN']; + unset($temp2[0]); + foreach ($temp2 as $temp) $users[] = $temp['cn']; + sort($users, SORT_STRING); echo "\n"; echo "\n
"; echo "\n\n
"; @@ -411,12 +415,10 @@ switch ($select_local) { // Select which part of page will be loaded echo "
"; echo _('Available users'); echo "\n"; - if (count($_SESSION['userDN'])!=0) { + if (count($users)!=0) { echo "\n"; } echo "
\n
\n\n\n"; diff --git a/lam/templates/account/useredit.php b/lam/templates/account/useredit.php index b160e809..a9b7af0b 100644 --- a/lam/templates/account/useredit.php +++ b/lam/templates/account/useredit.php @@ -335,18 +335,18 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch $_SESSION['account']->smb_profilePath = str_replace('$user', $_SESSION['account']->general_username, $_SESSION['account']->smb_profilePath); $_SESSION['account']->smb_profilePath = str_replace('$group', $_SESSION['account']->general_group, $_SESSION['account']->smb_profilePath); - if ($_SESSION['account']->smb_profilePath != $_POST['f_smb_profilePath']) $errors[] = array('INFO', _('Profile path'), _('Inserted user- or groupname in profilepath.')); + if ($_SESSION['account']->smb_profilePath != stripslashes($_POST['f_smb_profilePath'])) $errors[] = array('INFO', _('Profile path'), _('Inserted user- or groupname in profilepath.')); $_SESSION['account']->smb_smbhome = str_replace('$user', $_SESSION['account']->general_username, $_SESSION['account']->smb_smbhome); $_SESSION['account']->smb_smbhome = str_replace('$group', $_SESSION['account']->general_group, $_SESSION['account']->smb_smbhome); - if ($_SESSION['account']->smb_smbhome != $_POST['f_smb_smbhome']) $errors[] = array('INFO', _('Home path'), _('Inserted user- or groupname in HomePath.')); + if ($_SESSION['account']->smb_smbhome != stripslashes($_POST['f_smb_smbhome'])) $errors[] = array('INFO', _('Home path'), _('Inserted user- or groupname in HomePath.')); if ( (!$_SESSION['account']->smb_smbhome=='') && (!ereg('^[\][\]([a-z]|[A-Z]|[0-9]|[.]|[-]|[%])+([\]([a-z]|[A-Z]|[0-9]|[.]|[-]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+)+$', $_SESSION['account']->smb_smbhome))) $errors[] = array('ERROR', _('Home path'), _('Home path is invalid.')); if ( !ereg('^([a-z]|[A-Z]|[0-9]|[\|]|[\#]|[\*]|[\,]|[\.]|[\;]|[\:]|[\_]|[\-]|[\+]|[\!]|[\%]|[\&]|[\/]|[\?]|[\{]|[\[]|[\(]|[\)]|[\]]|[\}])*$', $smb_password)) $errors[] = array('ERROR', _('Password'), _('Password contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and #*,.;:_-+!$%&/|?{[()]}= !')); if ( (!$_SESSION['account']->smb_scriptPath=='') && (!ereg('^([/])*([a-z]|[0-9]|[.]|[-]|[_]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+([a-z]|[0-9]|[.]|[-]|[_]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])*'. - '([/]([a-z]|[0-9]|[.]|[-]|[_]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+([a-z]|[0-9]|[.]|[-]|[_]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])*)*$', $_SESSION['account']->smb_scriptPath))) + '([/]([a-z]|[0-9]|[.]|[-]|[_]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+([a-z]|[0-9]|[.]|[-]|[_]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])*)*(([.][b][a][t])|([.][c][m][d]))$', $_SESSION['account']->smb_scriptPath))) $errors[] = array('ERROR', _('Script path'), _('Script path is invalid!')); if ( (!$_SESSION['account']->smb_profilePath=='') && (!ereg('^[/][a-z]([a-z]|[0-9]|[.]|[-]|[_]|[%])*([/][a-z]([a-z]|[0-9]|[.]|[-]|[_]|[%])*)*$', $_SESSION['account']->smb_profilePath)) && (!ereg('^[\][\]([a-z]|[A-Z]|[0-9]|[.]|[-]|[%])+([\]([a-z]|[A-Z]|[0-9]|[.]|[-]|[%])+)+$', $_SESSION['account']->smb_profilePath))) @@ -606,6 +606,10 @@ switch ($select_local) { // Select which part of page will be loaded case 'workstations': ldapreload('host'); + $temp2 = $_SESSION['hostDN']; + unset($temp2[0]); + foreach ($temp2 as $temp) $hosts[] = $temp['cn']; + sort($hosts, SORT_STRING); // get workstation array $temp = str_replace(' ', '', $_SESSION['account']->smb_smbuserworkstations); $workstations = explode (',', $temp); @@ -652,12 +656,11 @@ switch ($select_local) { // Select which part of page will be loaded echo "
"; echo _('Available workstations'); echo "\n"; - if (count($_SESSION['hostDN'])!=0) { + if (count($hosts)!=0) { echo "\n"; }