diff --git a/lam/help/help.inc b/lam/help/help.inc index 4e7192ce..e5938ae9 100644 --- a/lam/help/help.inc +++ b/lam/help/help.inc @@ -174,18 +174,18 @@ $helpArray = array ( // account.php "400" => array ("ext" => "FALSE", "Headline" => _("Username"), "Text" => _("Username of the user which should be created. Valid characters are: a-z,0-9, .-_. Lam doesn't allow a number as first - character because it's impossible to create a homedirectory starting with a number. Lam doesn't allow capital letters A-Z because it + character because useradd also doesn't allow it. Lam doesn't allow capital letters A-Z because it can cause several problems. If username is allready used username will expanded with a number. The next free number will be used.")), "401" => array ("ext" => "FALSE", "Headline" => _("UID Number"), "Text" => _("If empty UID Number will be generated automaticly. Valid values are between").' '.$_SESSION['config']->get_minUID()._(" and ").$_SESSION['config']->get_maxUID()."."), - "402" => array ("ext" => "FALSE", "Headline" => _("Additional Groupmembership"), + "402" => array ("ext" => "FALSE", "Headline" => _("Additional Groups"), "Text" => _("Can be left empty. Hold the CTRL-key to (de)select multiple groups.")), "403" => array ("ext" => "FALSE", "Headline" => _("Home Directory"), "Text" => _("$user and $group are replaced with username or primary groupname.")), "404" => array ("ext" => "FALSE", "Headline" => _("Gecos"), "Text" => _("User descriptopn. If left empty sur- and givename will be used.")), "405" => array ("ext" => "FALSE", "Headline" => _("Login shell"), - "Text" => _("To disable login use /bin/false.")), + "Text" => _("To disable login use /bin/false. List of shells is read from lam/config/shells")), "406" => array ("ext" => "FALSE", "Headline" => _("Primary group"), "Text" => _("The Primary Group the user should be member of.")), "407" => array ("ext" => "FALSE", "Headline" => _("Groupname"), @@ -203,77 +203,71 @@ $helpArray = array ( "411" => array ("ext" => "FALSE", "Headline" => _("UID number"), "Text" => _("If empty UID Number will be generated automaticly. Valid values are between").' '.$_SESSION['config']->get_minMachine()._(" and ").$_SESSION['config']->get_maxMachine()."."), "412" => array ("ext" => "FALSE", "Headline" => _("Primary group"), - "Text" => _("The Prmary Group the host should be member of.")), + "Text" => _("The Primary Group the host should be member of.")), "413" => array ("ext" => "FALSE", "Headline" => _("Gecos"), "Text" => _("Host description. If left empty host name will be used.")), "414" => array ("ext" => "FALSE", "Headline" => _("Password warn"), - "Text" => _("Days before password is to expire that user is warned of pending password expiration. Value must be 0<.")), + "Text" => _("Days before password is to expire that user is warned of pending password expiration. If set value must be 0<. Can be left empty.")), "415" => array ("ext" => "FALSE", "Headline" => _("Password expire"), - "Text" => _("Number of days a user can login even his password has expired. -1=always")), + "Text" => _("Number of days a user can login even his password has expired. -1=always. Can be left empty.")), "416" => array ("ext" => "FALSE", "Headline" => _("Maximum passwordage"), - "Text" => _("Number of days after a user has to change his password again Value must be 0<.")), + "Text" => _("Number of days after a user has to change his password again. If set value must be 0<. Can be left empty.")), "417" => array ("ext" => "FALSE", "Headline" => _("Minimum passwordage"), - "Text" => _("Number of days a user has to wait until he\'s allowed to change his password again. Value must be 0<.")), + "Text" => _("Number of days a user has to wait until he\'s allowed to change his password again. If set value must be 0<. Can be left empty.")), "418" => array ("ext" => "FALSE", "Headline" => _("Expire date"), - "Text" => _("Account expire date.")), - "419" => array ("ext" => "FALSE", "Headline" => _("Password warn"), - "Text" => _("Days before password is to expire that host is warned of pending password expiration. Value must be 0<.")), - "420" => array ("ext" => "FALSE", "Headline" => _("Password expire"), - "Text" => _("Number of days a host can login even his password has expired. -1=always")), - "421" => array ("ext" => "FALSE", "Headline" => _("Maximum passwordage"), - "Text" => _("Number of days after a host has to change his password again Value must be 0< and should be higher as the value on client-side.")), - "422" => array ("ext" => "FALSE", "Headline" => _("Minimum passwordage"), - "Text" => _("Number of days a host has to wait until he\'s allowed to change his password again. Value must be 0<.")), - "423" => array ("ext" => "FALSE", "Headline" => _("Expire date"), - "Text" => _("Account expire date.")), + "Text" => _("Account expire date. If an account is expired login is only possible if password expire is set. Format: DD-MM-YYYY")), "424" => array ("ext" => "FALSE", "Headline" => _("Surname"), - "Text" => _("Surname")), + "Text" => _("Surname of user. Only letters, - and spaces are allowed. Have you ever seen anybody with a number in his name?")), "425" => array ("ext" => "FALSE", "Headline" => _("Given name"), - "Text" => _("Given name")), + "Text" => _("Given name of user. Only letters - and spaces are allowed. Have you ever seen anybody with a number in his name?")), "426" => array ("ext" => "FALSE", "Headline" => _("Use no password"), - "Text" => _("Use no password")), + "Text" => _("If checked no password will be used.")), "427" => array ("ext" => "FALSE", "Headline" => _("Account deactivated"), - "Text" => _("Account deactivated")), - "428" => array ("ext" => "FALSE", "Headline" => _("Use no password"), - "Text" => _("Use no password.")), - "429" => array ("ext" => "FALSE", "Headline" => _("Password does not expire"), - "Text" => _("Password doesn't expire.")), - "430" => array ("ext" => "FALSE", "Headline" => _("User can change password"), - "Text" => _("User can change password.")), - "431" => array ("ext" => "FALSE", "Headline" => _("User must change password"), - "Text" => _("User must change password.")), + "Text" => _("If checked account will be deactivated by putting a ! before the encrypted password.")), + "429" => array ("ext" => "FALSE", "Headline" => _("Password doesn't expire"), + "Text" => _("If checked password won't expire. (Setting X-Flag)")), + "430" => array ("ext" => "FALSE", "Headline" => _("User can change Password"), + "Text" => _("Date after the user is able to change his password. Format: DD-MM-YYYY")), + "431" => array ("ext" => "FALSE", "Headline" => _("User must change Password"), + "Text" => _("Date after the user must change his password. Format: DD-MM-YYYY")), "432" => array ("ext" => "FALSE", "Headline" => _("Account is deactivated"), - "Text" => _("Account is deactivated.")), + "Text" => _("If checked account will be deactivated. (Setting D-Flag)")), "433" => array ("ext" => "FALSE", "Headline" => _("Home drive"), "Text" => _("Driveletter assigned on windows-workstations as homedirectory.")), "434" => array ("ext" => "FALSE", "Headline" => _("Script path"), - "Text" => _("Filename and -path relative to netlogon-share which should be executed on logon. $user and $group are replaced with user- and groupname. Can be left empty.")), + "Text" => _("Filename and -path relative to netlogon-share which should be executed on logon. \$user and \$group are replaced with user- and groupname. Can be left empty.")), "435" => array ("ext" => "FALSE", "Headline" => _("Profile path"), - "Text" => _("Path of the userprofile. Can be a local absolute path or a UNC-path (\\\\server\\share). $user and $group are replaced with user- and groupname. Can be left empty.")), + "Text" => _("Path of the userprofile. Can be a local absolute path or a UNC-path (\\\\server\\share). \$user and \$group are replaced with user- and groupname. Can be left empty.")), "436" => array ("ext" => "FALSE", "Headline" => _("Samba workstations"), "Text" => _("Komma-separated list of samba workstations the user is allowed to login. Empty means every workstation. Can be left empty.")), "437" => array ("ext" => "FALSE", "Headline" => _("smb home"), - "Text" => _("UNC-path (\\\\server\\share) of homedirectory. $user and $group are replaced with user- and groupname. Can be left empty.")), + "Text" => _("UNC-path (\\\\server\\share) of homedirectory. \$user and \$group are replaced with user- and groupname. Can be left empty.")), "438" => array ("ext" => "FALSE", "Headline" => _("Domain"), "Text" => _("Windows-Domain of user. Can be left empty.")), "439" => array ("ext" => "FALSE", "Headline" => _("Mountpoint"), - "Text" => _("Mountpoint")), + "Text" => _("Mointpoint of device with enabled quotas.")), "440" => array ("ext" => "FALSE", "Headline" => _("Used blocks"), - "Text" => _("Used blocks.")), - "441" => array ("ext" => "FALSE", "Headline" => _("soft block limit"), - "Text" => _("soft block limit")), - "442" => array ("ext" => "FALSE", "Headline" => _("hard block limit"), - "Text" => _("hard block limit")), - "443" => array ("ext" => "FALSE", "Headline" => _("grace block period"), - "Text" => _("grace block period")), - "444" => array ("ext" => "FALSE", "Headline" => _("used inodes"), - "Text" => _("used inodes")), - "445" => array ("ext" => "FALSE", "Headline" => _("soft inode limit"), - "Text" => _("soft inode limit")), - "446" => array ("ext" => "FALSE", "Headline" => _("hard inode limit"), - "Text" => _("hard inode limit")), - "447" => array ("ext" => "FALSE", "Headline" => _("grace inode period"), - "Text" => _("grace inode period")), + "Text" => _("Blocks used by user. 1000 blocks are usually 1MB")), + "441" => array ("ext" => "FALSE", "Headline" => _("Soft block limit"), + "Text" => _("Soft block limit.
See also:").' '. + 'Quota How-To'), + "442" => array ("ext" => "FALSE", "Headline" => _("Hard block limit"), + "Text" => _("Hard block limit.
See also:").'
'. + 'Quota How-To'), + "443" => array ("ext" => "FALSE", "Headline" => _("Grace block period"), + "Text" => _("Grace block period. Most filesystems use a fixed maximum value of 7 days.
See also:").'
'. + 'Quota How-To'), + "444" => array ("ext" => "FALSE", "Headline" => _("Used inodes"), + "Text" => _("Used inodes (files) by user.")), + "445" => array ("ext" => "FALSE", "Headline" => _("Soft inode limit"), + "Text" => _("Soft inode (files) limit.
See also:").'
'. + 'Quota How-To'), + "446" => array ("ext" => "FALSE", "Headline" => _("Hard inode limit"), + "Text" => _("Hard inode (files) limit.
See also:").'
'. + 'Quota How-To'), + "447" => array ("ext" => "FALSE", "Headline" => _("Grace inode period"), + "Text" => _("Grace inode (files) period. Most filesystems use a fixed maximum value of 7 days.
See also:").'
'. + 'Quota How-To'), "448" => array ("ext" => "FALSE", "Headline" => _("Title"), "Text" => _("Title")), "449" => array ("ext" => "FALSE", "Headline" => _("Employee type"), @@ -303,7 +297,7 @@ $helpArray = array ( "461" => array ("ext" => "FALSE", "Headline" => _("Suffix"), "Text" => _("Suffix")), "462" => array ("ext" => "FALSE", "Headline" => _("Suffix"), - "Text" => _("Suffix")), + "Text" => _("The position in ldap-tree where the user should be created.")), "463" => array ("ext" => "FALSE", "Headline" => _("Suffix"), "Text" => _("Suffix")), "464" => array ("ext" => "FALSE", "Headline" => _("Windows groupname"), diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 3313a6a8..cba78ecb 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -88,19 +88,14 @@ function initvars($type=false,$DN=false) { // This function registers all needes @session_start(); setlanguage(); if ($type) { - if (session_is_registered("type2")) session_unregister("type2"); - session_register("type2"); // $type2 stores the kind of account (User|Group|Host) + if (isset($_SESSION['type2'])) unset($_SESSION['type2']); $_SESSION['type2'] = $type; - if (session_is_registered("shelllist")) session_unregister("shelllist"); - session_register("shelllist"); // $shelllist contains all shells defined in /etc/shells + if (isset($_SESSION['shelllist'])) unset($_SESSION['shelllist']); $_SESSION['shelllist'] = getshells(); // Write List of all valid shells in variable - if (session_is_registered("account")) session_unregister("account"); - session_register("account"); // The new Accout properties are stored here - if (session_is_registered("errors")) session_unregister("errors"); - session_register("errors"); // $type2 stores the kind of account (User|Group|Host) + if (isset($_SESSION['account'])) unset($_SESSION['account']); + if (isset($_SESSION['errors'])) unset($_SESSION['errors']); if ($DN) { - if (session_is_registered("account_old")) session_unregister("account_old"); - else session_register("account_old"); // Only valid if an account should be modified. It'll contains the existing account properties + if (isset($_SESSION['account_old'])) unset($_SESSION['account_old']); $DN = str_replace("\'", '',$DN); switch ($type) { case 'user': @@ -114,8 +109,7 @@ function initvars($type=false,$DN=false) { // This function registers all needes $_SESSION['account'] = loadgroup($DN); $_SESSION['account_old'] = $_SESSION['account']; $_SESSION['account']->general_dn = substr($_SESSION['account']->general_dn, strpos($_SESSION['account']->general_dn, ',')+1); - if (!session_is_registered('final_changegids')) session_register('final_changegids'); - else $_SESSION['final_changegids'] = ''; + $_SESSION['final_changegids'] = ''; break; case 'host': $_SESSION['account'] = loadhost($DN); @@ -163,6 +157,15 @@ function getshells() { // Return a list of all shells listed in ../config/shells return $shells; } +function replace_umlaut($text) { // This function will replace umlates with ascci-chars + $aTranslate = array("ä"=>"ae", "Ä"=>"Ae", + "ö"=>"oe", "Ö"=>"Oe", + "ü"=>"ue", "Ü"=>"Ue", + "ß"=>"ss" + ); + return strtr($text, $aTranslate); + } + function checkglobal($values, $type, $values_old=false) { // This functions checks all global account parameters $values is class account(), $type=user|host|group // If all values are OK an array of class account is returned. Else an error-string is returned $return = new account(); @@ -176,11 +179,11 @@ function checkglobal($values, $type, $values_old=false) { // This functions chec if ( !ereg('^[/]([a-z]|[A-Z])([a-z]|[A-Z]|[0-9]|[.]|[-]|[_])*([/]([a-z]|[A-Z])([a-z]|[A-Z]|[0-9]|[.]|[-]|[_])*)*$', $return->general_homedir )) $errors[] = array('ERROR', _('Home Directory'), _('Homedirectory contents invalid characters.')); // Check if givenname is valid - if ( !ereg('^([a-z]|[A-Z])+$', $values->general_givenname)) $errors[] = array('ERROR', _('Given name'), _('Givenname contents invalid characters')); + if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $values->general_givenname)) $errors[] = array('ERROR', _('Given name'), _('Givenname contents invalid characters')); // Check if surname is valid - if ( !ereg('^([a-z]|[A-Z])+$', $values->general_surname)) $errors[] = array('ERROR', _('Surname'), _('Surname contents invalid characters')); + if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $values->general_surname)) $errors[] = array('ERROR', _('Surname'), _('Surname contents invalid characters')); if ( ($values->general_gecos=='') || ($values->general_gecos==' ')) { - $return->general_gecos = $values->general_givenname . " " . $values->general_surname ; + $return->general_gecos = replace_umlaut($values->general_givenname) . " " . replace_umlaut($values->general_surname) ; $errors[] = array('INFO', _('Gecos'), _('Inserted sur- and givenname in gecos-field.')); } if ($values->general_group=='') $errors[] = array('ERROR', _('Primary group'), _('No primary group defined!')); @@ -345,19 +348,20 @@ function checksamba($values, $type) { // This function checks all samba account if ($values->smb_profilePath != $return->smb_profilePath) $errors[] = array('INFO', _('Profile path'), _('Inserted username in profilepath.')); $return->smb_profilePath = str_replace('$group', $return->general_group, $return->smb_profilePath); if ($values->smb_profilePath != $return->smb_profilePath) $errors[] = array('INFO', _('Profile path'), _('Inserted groupname in profilepath.')); - $return->smb_smbHome = str_replace('$user', $values->general_username, $values->smb_smbHome); - if ($values->smb_smbHome != $return->smb_smbHome) $errors[] = array('INFO', _('smb home'), _('Inserted username in smbhome.')); - $return->smb_smbHome = str_replace('$group', $return->general_group, $return->smb_smbHome); - if ($values->smb_smbHome != $return->smb_smbHome) $errors[] = array('INFO', _('smb home'), _('Inserted groupname in smbhome.')); + $return->smb_smbhome = str_replace('$user', $values->general_username, $values->smb_smbhome); + if ($values->smb_smbhome != $return->smb_smbhome) $errors[] = array('INFO', _('smb home'), _('Inserted username in Home Path.')); + $return->smb_smbhome = str_replace('$group', $return->general_group, $return->smb_smbhome); + if ($values->smb_smbhome != $return->smb_smbhome) $errors[] = array('INFO', _('smb home'), _('Inserted groupname in HomePath.')); + if ( (!ereg('^[\][\]([a-z]|[A-Z]|[0-9]|[.]|[-]|[%])+([\]([a-z]|[A-Z]|[0-9]|[.]|[-]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+)+$', $return->smb_smbhome))) + $errors[] = array('ERROR', _('Home path'), _('Home path is invalid.')); if ( !ereg('^([a-z]|[A-Z]|[0-9]|[\|]|[\#]|[\*]|[\,]|[\.]|[\;]|[\:]|[\_]|[\-]|[\+]|[\!]|[\%]|[\&]|[\/]|[\?]|[\{]|[\[]|[\(]|[\)]|[\]]|[\}])*$', $values->smb_password)) $errors[] = array('ERROR', _('Password'), _('Password contents invalid characters. Valid characters are: a-z, A-Z, 0-9 and #*,.;:_-+!$%&/|?{[()]}= !')); - if ( (!$return->smb_scriptPath=='') && (!ereg('^([/])*[a-z]([a-z]|[0-9]|[.]|[-]|[_]|[%])*([/][a-z]([a-z]|[0-9]|[.]|[-]|[_]|[%])*)*$', $return->smb_scriptPath))) + if ( (!$return->smb_scriptPath=='') && (!ereg('^([/])*([a-z]|[0-9]|[.]|[-]|[_]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+([a-z]|[0-9]|[.]|[-]|[_]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])*'. + '([/]([a-z]|[0-9]|[.]|[-]|[_]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+([a-z]|[0-9]|[.]|[-]|[_]|[%]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])*)*$', $return->smb_scriptPath))) $errors[] = array('ERROR', _('Scriptpath'), _('Script path is invalid.')); if ( (!$return->smb_profilePath=='') && (!ereg('^[/][a-z]([a-z]|[0-9]|[.]|[-]|[_]|[%])*([/][a-z]([a-z]|[0-9]|[.]|[-]|[_]|[%])*)*$', $return->smb_profilePath)) && (!ereg('^[\][\]([a-z]|[A-Z]|[0-9]|[.]|[-]|[%])+([\]([a-z]|[A-Z]|[0-9]|[.]|[-]|[%])+)+$', $return->smb_profilePath))) $errors[] = array('ERROR', _('Profile path'), _('Profile path is invalid.')); - if ( (!$return->smb_smbHome=='') && !ereg('^[\][\]([a-z]|[A-Z]|[0-9]|[.]|[-])+([\]([a-z]|[A-Z]|[0-9]|[.]|[-])+)+$', $return->smb_smbhome)) - $errors[] = array('ERROR', _('smb home'), _('smb home is invalid.')); if ((!$values->smb_smbuserworkstations=='') && !ereg('^([a-z]|[A-Z]|[0-9]|[.]|[-])+(([,])+([a-z]|[A-Z]|[0-9]|[.]|[-])+)*$', $values->smb_smbuserworkstations)) $errors[] = array('ERROR', _('Samba workstations'), _('Samba workstations is invalid.')); $return->smb_flagsW = 0; @@ -723,6 +727,14 @@ function loaduser($dn) { // Will load all needed values from an existing account $i++; } if ($_SESSION['config']->samba3 == 'yes') { + if (in_array('sambaSamAccount', $attr['objectClass'])) $load=3; + else $load=2; + } + else { + if (in_array('sambaSamAccount', $attr['objectClass'])) $load=3; + else $load=2; + } + if ($load==3) { if (isset($attr['sambaAcctFlags'][0])) { if (strrpos($attr['sambaAcctFlags'][0], 'W')) $return->smb_flagsW=true; if (strrpos($attr['sambaAcctFlags'][0], 'D')) $return->smb_flagsD=true; @@ -730,32 +742,32 @@ function loaduser($dn) { // Will load all needed values from an existing account } if (isset($attr['sambaPwdCanChange'][0])) $return->smb_pwdcanchange = $attr['sambaPwdCanChange'][0]; if (isset($attr['sambaPwdMustChange'][0])) $return->smb_pwdmustchange = $attr['sambaPwdMustChange'][0]; - if (isset($attr['sambaHomePath'][0])) $return->smb_smbhome = $attr['sambaHomePath'][0]; + if (isset($attr['sambaHomePath'][0])) $return->smb_smbhome = utf8_decode($attr['sambaHomePath'][0]); if (isset($attr['sambaHomeDrive'][0])) $return->smb_homedrive = $attr['sambaHomeDrive'][0]; - if (isset($attr['sambaLogonScript'][0])) $return->smb_scriptPath = $attr['sambaLogonScript'][0]; + if (isset($attr['sambaLogonScript'][0])) $return->smb_scriptPath = utf8_decode($attr['sambaLogonScript'][0]); if (isset($attr['sambaProfilePath'][0])) $return->smb_profilePath = $attr['sambaProfilePath'][0]; if (isset($attr['sambaUserWorkstations'][0])) $return->smb_smbuserworkstations = $attr['sambaUserWorkstations'][0]; if (isset($attr['sambaDomainName'][0])) $return->smb_domain = $attr['sambaDomainName'][0]; if (isset($attr['sambaNTPassword'][0])) $return->smb_password = $attr['sambaNTPassword'][0]; } - else { - if (isset($attr['acctFlags'][0])) { - if (strrpos($attr['acctFlags'][0], 'W')) $return->smb_flagsW=true; - if (strrpos($attr['acctFlags'][0], 'D')) $return->smb_flagsD=true; - if (strrpos($attr['acctFlags'][0], 'X')) $return->smb_flagsX=true; - } - if (isset($attr['ntPassword'][0])) $return->smb_password = $attr['ntPassword'][0]; - if (isset($attr['smbHome'][0])) $return->smb_smbhome = $attr['smbHome'][0]; - if (isset($attr['pwdCanChange'][0])) $return->smb_pwdcanchange = $attr['pwdCanChange'][0]; - if (isset($attr['pwdMustChange'][0])) $return->smb_pwdmustchange = $attr['pwdMustChange'][0]; - if (isset($attr['homeDrive'][0])) $return->smb_homedrive = $attr['homeDrive'][0]; - if (isset($attr['scriptPath'][0])) $return->smb_scriptPath = $attr['scriptPath'][0]; - if (isset($attr['profilePath'][0])) $return->smb_profilePath = $attr['profilePath'][0]; - if (isset($attr['userWorkstations'][0])) $return->smb_smbuserworkstations = $attr['userWorkstations'][0]; - if (isset($attr['domain'][0])) $return->smb_domain = $attr['domain'][0]; + else { + if (isset($attr['acctFlags'][0])) { + if (strrpos($attr['acctFlags'][0], 'W')) $return->smb_flagsW=true; + if (strrpos($attr['acctFlags'][0], 'D')) $return->smb_flagsD=true; + if (strrpos($attr['acctFlags'][0], 'X')) $return->smb_flagsX=true; } - if (isset($attr['givenName'][0])) $return->general_givenname = $attr['givenName'][0]; - if (isset($attr['sn'][0])) $return->general_surname = $attr['sn'][0]; + if (isset($attr['ntPassword'][0])) $return->smb_password = $attr['ntPassword'][0]; + if (isset($attr['smbHome'][0])) $return->smb_smbhome = utf8_decode($attr['smbHome'][0]); + if (isset($attr['pwdCanChange'][0])) $return->smb_pwdcanchange = $attr['pwdCanChange'][0]; + if (isset($attr['pwdMustChange'][0])) $return->smb_pwdmustchange = $attr['pwdMustChange'][0]; + if (isset($attr['homeDrive'][0])) $return->smb_homedrive = $attr['homeDrive'][0]; + if (isset($attr['scriptPath'][0])) $return->smb_scriptPath = utf8_decode($attr['scriptPath'][0]); + if (isset($attr['profilePath'][0])) $return->smb_profilePath = $attr['profilePath'][0]; + if (isset($attr['userWorkstations'][0])) $return->smb_smbuserworkstations = $attr['userWorkstations'][0]; + if (isset($attr['domain'][0])) $return->smb_domain = $attr['domain'][0]; + } + if (isset($attr['givenName'][0])) $return->general_givenname = utf8_decode($attr['givenName'][0]); + if (isset($attr['sn'][0])) $return->general_surname = utf8_decode($attr['sn'][0]); if (isset($attr['title'][0])) $return->personal_title = $attr['title'][0]; if (isset($attr['mail'][0])) $return->personal_mail = $attr['mail'][0]; if (isset($attr['telephoneNumber'][0])) $return->personal_telephoneNumber = $attr['telephoneNumber'][0]; @@ -792,7 +804,7 @@ function loadhost($dn) { // Will load all needed values from an existing account if (isset($attr['uid'][0])) $return->general_username = $attr['uid'][0]; if (isset($attr['uidNumber'][0])) $return->general_uidNumber = $attr['uidNumber'][0]; if (isset($attr['shadowLastChange'][0])) $return->unix_shadowLastChange = $attr['shadowLastChange'][0]; - if (isset($attr['gecos'][0])) $return->general_gecos = $attr['gecos'][0]; + if (isset($attr['gecos'][0])) $return->general_gecos = utf8_decode($attr['gecos'][0]); if (isset($attr['description'][0])) $return->general_gecos = $attr['description'][0]; if (isset($attr['gidNumber'][0])) { $result = ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_GroupSuffix(), "objectclass=PosixGroup", array('gidNumber', 'cn')); @@ -816,7 +828,16 @@ function loadhost($dn) { // Will load all needed values from an existing account if (isset($attr['shadowWarning'][0])) $return->unix_pwdwarn = $attr['shadowWarning'][0]; if (isset($attr['shadowInactive'][0])) $return->unix_pwdallowlogin = $attr['shadowInactive'][0]; if (isset($attr['shadowExpire'][0])) $return->unix_pwdexpire = $attr['shadowExpire'][0]*86400; + if ($_SESSION['config']->samba3 == 'yes') { + if (in_array('sambaSamAccount', $attr['objectClass'])) $load=3; + else $load=2; + } + else { + if (in_array('sambaSamAccount', $attr['objectClass'])) $load=3; + else $load=2; + } + if ($load==3) { if (isset($attr['sambaAcctFlags'][0])) { if (strrpos($attr['sambaAcctFlags'][0], 'W')) $return->smb_flagsW=true; if (strrpos($attr['sambaAcctFlags'][0], 'D')) $return->smb_flagsD=true; @@ -836,8 +857,6 @@ function loadhost($dn) { // Will load all needed values from an existing account if (isset($attr['pwdCanChange'][0])) $return->smb_pwdcanchange = $attr['pwdCanChange'][0]; if (isset($attr['pwdMustChange'][0])) $return->smb_pwdmustchange = $attr['pwdMustChange'][0]; } - if (isset($attr['givenName'][0])) $return->general_givenname = $attr['givenName'][0]; - if (isset($attr['sn'][0])) $return->general_surname = $attr['sn'][0]; if (substr(str_replace('{CRYPT}', '',$attr['userPassword'][0]),0,1) == '!' ) $return->unix_deactivated=true; return $return; } @@ -923,9 +942,9 @@ function createuser($values) { // Will create the LDAP-Account $attr['sambaPwdMustChange'] = $values->smb_pwdmustchange; // sambaAccount_may $attr['sambaAcctFlags'] = smbflag(values); // sambaAccount_may $attr['displayName'] = $values->general_gecos; // sambaAccount_may - if ($values->smb_smbhome!='') $attr['sambaHomePath'] = $values->smb_smbhome; // sambaAccount_may + if ($values->smb_smbhome!='') $attr['sambaHomePath'] = utf8_encode($values->smb_smbhome); // sambaAccount_may if ($values->smb_homedrive!='') $attr['sambaHomeDrive'] = $values->smb_homedrive; // sambaAccount_may - if ($values->smb_scriptPath!='') $attr['sambaLogonScript'] = $values->smb_scriptPath; // sambaAccount_may + if ($values->smb_scriptPath!='') $attr['sambaLogonScript'] = utf8_encode($values->smb_scriptPath); // sambaAccount_may if ($values->smb_profilePath!='') $attr['sambaProfilePath'] = $values->smb_profilePath; // sambaAccount_may if ($values->smb_smbuserworkstations!='') $attr['sambaUserWorkstations'] = $values->smb_smbuserworkstations; // sambaAccount_may if ($values->smb_domain!='') $attr['sambaDomainName'] = $values->smb_domain->name; // sambaAccount_may @@ -946,9 +965,9 @@ function createuser($values) { // Will create the LDAP-Account $attr['pwdMustChange'] = $values->smb_pwdmustchange; // sambaAccount_may $attr['acctFlags'] = smbflag(values); // sambaAccount_may $attr['displayName'] = $values->general_gecos; // sambaAccount_may - if ($values->smb_smbhome!='') $attr['smbHome'] = $values->smb_smbhome; // sambaAccount_may + if ($values->smb_smbhome!='') $attr['smbHome'] = utf8_encode($values->smb_smbhome); // sambaAccount_may if ($values->smb_homedrive!='') $attr['homeDrive'] = $values->smb_homedrive; // sambaAccount_may - if ($values->smb_scriptPath!='') $attr['scriptPath'] = $values->smb_scriptPath; // sambaAccount_may + if ($values->smb_scriptPath!='') $attr['scriptPath'] = utf8_encode($values->smb_scriptPath); // sambaAccount_may if ($values->smb_profilePath!='') $attr['profilePath'] = $values->smb_profilePath; // sambaAccount_may if ($values->smb_smbuserworkstations!='') $attr['userWorkstations'] = $values->smb_smbuserworkstations; // sambaAccount_may if ($values->smb_domain!='') $attr['domain'] = $values->smb_domain; // sambaAccount_may @@ -991,8 +1010,8 @@ function createuser($values) { // Will create the LDAP-Account if ($values->unix_pwdallowlogin!='') $attr['shadowInactive'] = $values->unix_pwdallowlogin; // shadowAccount_may if ($date) $attr['shadowExpire'] = $date ; // shadowAccount_may - if ($values->general_givenname!='') $attr['givenName'] = $values->general_givenname; - if ($values->general_surname!='') $attr['sn'] = $values->general_surname; + if ($values->general_givenname!='') $attr['givenName'] = utf8_encode($values->general_givenname); + if ($values->general_surname!='') $attr['sn'] = utf8_encode($values->general_surname); $success = ldap_add($_SESSION['ldap']->server(),$values->general_dn, $attr); if (!$success) return 4; @@ -1092,19 +1111,19 @@ function modifyuser($values,$values_old) { // Will modify the LDAP-Account if ($values->smb_pwdcanchange != $values_old->smb_pwdcanchange) $attr['sambaPwdCanChange'] = $values->smb_pwdcanchange; // sambaAccount_may if ($values->smb_pwdmustchange != $values_old->smb_pwdmustchange) $attr['sambaPwdMustChange'] = $values->smb_pwdmustchange; // sambaAccount_may $attr['sambaAcctFlags'] = smbflag($values); // sambaAccount_may - if (($values->smb_smbhome!='') && ($values->smb_smbhome!=$values_old->smb_smbhome)) $attr['sambaHomePath'] = $values->smb_smbhome; // sambaAccount_may - if (($values->smb_smbhome=='') && ($values->smb_smbhome!=$values_old->smb_smbhome)) $attr_rem['sambaHomePath'] = $values_old->smb_smbhome; // sambaAccount_may + if (($values->smb_smbhome!='') && ($values->smb_smbhome!=$values_old->smb_smbhome)) $attr['sambaHomePath'] = utf8_encode($values->smb_smbhome); // sambaAccount_may + if (($values->smb_smbhome=='') && ($values->smb_smbhome!=$values_old->smb_smbhome)) $attr_rem['sambaHomePath'] = utf8_encode($values_old->smb_smbhome); // sambaAccount_may if (($values->smb_homedrive!='') && ($values->smb_homedrive!=$values_old->smb_homedrive)) $attr['sambaHomeDrive'] = $values->smb_homedrive; // sambaAccount_may if (($values->smb_homedrive=='') && ($values->smb_homedrive!=$values_old->smb_homedrive)) $attr_rem['sambaHomeDrive'] = $values_old->smb_homedrive; // sambaAccount_may - if (($values->smb_scriptPath!='') && ($values->smb_scriptPath!=$values_old->smb_scriptPath)) $attr['sambaLogonScript'] = $values->smb_scriptPath; // sambaAccount_may - if (($values->smb_scriptPath=='') && ($values->smb_scriptPath!=$values_old->smb_scriptPath)) $attr_rem['sambaLogonScript'] = $values_old->smb_scriptPath; // sambaAccount_may + if (($values->smb_scriptPath!='') && ($values->smb_scriptPath!=$values_old->smb_scriptPath)) $attr['sambaLogonScript'] = utf8_encode($values->smb_scriptPath); // sambaAccount_may + if (($values->smb_scriptPath=='') && ($values->smb_scriptPath!=$values_old->smb_scriptPath)) $attr_rem['sambaLogonScript'] = utf8_encode($values_old->smb_scriptPath); // sambaAccount_may if (($values->smb_profilePath!='') && ($values->smb_profilePath!=$values_old->smb_profilePath)) $attr['sambaProfilePath'] = $values->smb_profilePath; // sambaAccount_may if (($values->smb_profilePath=='') && ($values->smb_profilePath!=$values_old->smb_profilePath)) $attr_rem['sambaProfilePath'] = $values_old->smb_profilePath; // sambaAccount_may if (($values->smb_smbuserworkstations!='') && ($values->smb_smbuserworkstations!=$values_old->smb_smbuserworkstations))$attr['sambaUserWorkstations'] = $values->smb_smbuserworkstations; // sambaAccount_may if (($values->smb_smbuserworkstations=='') && ($values->smb_smbuserworkstations!=$values_old->smb_smbuserworkstations))$attr_rem['sambaUserWorkstations'] = $values_old->smb_smbuserworkstations; // sambaAccount_may if (($values->smb_domain->name!='') && ($values->smb_domain->name!=$values_old->smb_domain->name)) $attr['sambaDomainName'] = $values->smb_domain->name; // sambaAccount_may if (($values->smb_domain->name=='') && ($values->smb_domain->name!=$values_old->smb_domain->name)) $attr_rem['sambaDomainName'] = $values_old->smb_domain->name; // sambaAccount_may - if ($values->general_gecos != $values_old->general_gecos) $attr['displayName'] = $values->general_gecos; // sambaAccount_may + if ($values->general_gecos != $values_old->general_gecos) $attr['displayName'] = utf8_encode($values->general_gecos); // sambaAccount_may } else { if ($values->smb_password_no) { @@ -1121,25 +1140,26 @@ function modifyuser($values,$values_old) { // Will modify the LDAP-Account if ($values->smb_pwdcanchange != $values_old->smb_pwdcanchange) $attr['pwdCanChange'] = $values->smb_pwdcanchange; // sambaAccount_may if ($values->smb_pwdmustchange != $values_old->smb_pwdmustchange) $attr['pwdMustChange'] = $values->smb_pwdmustchange; // sambaAccount_may $attr['acctFlags'] = smbflag($values); // sambaAccount_may - if (($values->smb_smbhome!='') && ($values->smb_smbhome!=$values_old->smb_smbhome)) $attr['smbHome'] = $values->smb_smbhome; // sambaAccount_may - if (($values->smb_smbhome=='') && ($values->smb_smbhome!=$values_old->smb_smbhome)) $attr_rem['smbHome'] = $values_old->smb_smbhome; // sambaAccount_may + if (($values->smb_smbhome!='') && ($values->smb_smbhome!=$values_old->smb_smbhome)) $attr['smbHome'] = utf8_encode($values->smb_smbhome); // sambaAccount_may + if (($values->smb_smbhome=='') && ($values->smb_smbhome!=$values_old->smb_smbhome)) $attr_rem['smbHome'] = utf8_encode($values_old->smb_smbhome); // sambaAccount_may if (($values->smb_homedrive!='') && ($values->smb_homedrive!=$values_old->smb_homedrive)) $attr['homeDrive'] = $values->smb_homedrive; // sambaAccount_may if (($values->smb_homedrive=='') && ($values->smb_homedrive!=$values_old->smb_homedrive)) $attr_rem['homeDrive'] = $values_old->smb_homedrive; // sambaAccount_may - if (($values->smb_scriptPath!='') && ($values->smb_scriptPath!=$values_old->smb_scriptPath)) $attr['scriptPath'] = $values->smb_scriptPath; // sambaAccount_may - if (($values->smb_scriptPath=='') && ($values->smb_scriptPath!=$values_old->smb_scriptPath)) $attr_rem['scriptPath'] = $values_old->smb_scriptPath; // sambaAccount_may + if (($values->smb_scriptPath!='') && ($values->smb_scriptPath!=$values_old->smb_scriptPath)) $attr['scriptPath'] = utf8_encode($values->smb_scriptPath); // sambaAccount_may + if (($values->smb_scriptPath=='') && ($values->smb_scriptPath!=$values_old->smb_scriptPath)) $attr_rem['scriptPath'] = utf8_encode($values_old->smb_scriptPath); // sambaAccount_may if (($values->smb_profilePath!='') && ($values->smb_profilePath!=$values_old->smb_profilePath)) $attr['profilePath'] = $values->smb_profilePath; // sambaAccount_may if (($values->smb_profilePath=='') && ($values->smb_profilePath!=$values_old->smb_profilePath)) $attr_rem['profilePath'] = $values_old->smb_profilePath; // sambaAccount_may if (($values->smb_smbuserworkstations!='') && ($values->smb_smbuserworkstations!=$values_old->smb_smbuserworkstations))$attr['userWorkstations'] = $values->smb_smbuserworkstations; // sambaAccount_may if (($values->smb_smbuserworkstations=='') && ($values->smb_smbuserworkstations!=$values_old->smb_smbuserworkstations))$attr_rem['userWorkstations'] = $values_old->smb_smbuserworkstations; // sambaAccount_may if (($values->smb_domain!='') && ($values->smb_domain!=$values_old->smb_domain)) $attr['domain'] = $values->smb_domain; // sambaAccount_may if (($values->smb_domain=='') && ($values->smb_domain!=$values_old->smb_domain)) $attr_rem['domain'] = $values_old->smb_domain; // sambaAccount_may - if ($values->general_gecos != $values_old->general_gecos) $attr['displayName'] = $values->general_gecos; // sambaAccount_may + if ($values->general_gecos != $values_old->general_gecos) $attr['displayName'] = utf8_encode($values->general_gecos); // sambaAccount_may } if ($values->general_shell != $values_old->general_shell) $attr['loginShell'] = $values->general_shell; // posixAccount_may if ($values->general_gecos != $values_old->general_gecos) { - $attr['gecos'] = $values->general_gecos; // posixAccount_may - $attr['description'] = $values->general_gecos; // posixAccount_may sambaAccount_may + $attr['gecos'] = ($values->general_gecos); // posixAccount_may + $attr['description'] = utf8_encode($values->general_gecos); // posixAccount_may sambaAccount_may + print ($attr['gecos']); } if (($values->unix_host != $values_old->unix_host)) { @@ -1230,8 +1250,8 @@ function modifyuser($values,$values_old) { // Will modify the LDAP-Account ($values->unix_pwdexpire_mon = $date['mon'] != $values_old->unix_pwdexpire_mon = $date['mon']) || ($values->unix_pwdexpire_yea = $date['year'] != $values->unix_pwdexpire_yea = $date['year'])) $attr['shadowExpire'] = $date ; // shadowAccount_may - if ($values->general_givenname!=$values_old->general_givenname) $attr['givenName'] = $values->general_givenname; - if ($values->general_surname!=$values_old->general_surname) $attr['sn'] = $values->general_surname; + if ($values->general_givenname!=$values_old->general_givenname) $attr['givenName'] = utf8_encode($values->general_givenname); + if ($values->general_surname!=$values_old->general_surname) $attr['sn'] = utf8_encode($values->general_surname); if ( (!in_array('posixAccount', $_SESSION['account_old']->general_objectClass)) || (!in_array('shadowAccount', $_SESSION['account_old']->general_objectClass)) || diff --git a/lam/templates/account.php b/lam/templates/account.php index 1cd37d92..2a7cda33 100644 --- a/lam/templates/account.php +++ b/lam/templates/account.php @@ -342,16 +342,16 @@ switch ($select_local) { switch ( $_SESSION['type2'] ) { case 'user' : if (session_is_registered("type2")) session_unregister("type2"); - echo "\n"; + echo "\n"; break; case 'group' : if (session_is_registered("type2")) session_unregister("type2"); - echo "\n"; + echo "\n"; break; case 'host' : if (session_is_registered("type2")) session_unregister("type2"); - echo "\n"; + echo "\n"; break; } break; @@ -458,7 +458,7 @@ switch ($select_local) { // Select which part of page will be loaded echo ''. ''._('Help').''. ''."\n".''; - echo _('Additional Groupmembership'); + echo _('Additional Groups'); echo ''."\n".'smb_password_no) echo ' checked '; echo '>'."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Password doesn\'t expire.'); echo ''."\n".'\n"; } if ( $_SESSION['account']->smb_mapgroup == $_SESSION['account']->smb_domain->SID . "-" . '514' ) { - echo '\n"; } else { - echo '\n"; } if ( $_SESSION['account']->smb_mapgroup == $_SESSION['account']->smb_domain->SID . "-" . '513' ) { - echo '\n"; } else { - echo '\n"; } if ( $_SESSION['account']->smb_mapgroup == $_SESSION['account']->smb_domain->SID . "-" . '512' ) { - echo '\n"; } else { - echo '\n"; } @@ -1039,29 +1039,29 @@ switch ($select_local) { // Select which part of page will be loaded if (isset($_SESSION['account_old']->general_objectClass)) { if (!in_array('posixAccount', $_SESSION['account_old']->general_objectClass)) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass posixAccount not found.'), _('Have to recreate entry.')); echo "\n"; } if (!in_array('shadowAccount', $_SESSION['account_old']->general_objectClass)) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass shadowAccount.'), _('Have to recreate entry.')); echo "\n"; } if (!in_array('inetOrgPerson', $_SESSION['account_old']->general_objectClass)) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass inetOrgPerson not found.'), _('Have to recreate entry.')); echo "\n"; } if ($_SESSION['config']->samba3 == 'yes') { if (!in_array('sambaSamAccount', $_SESSION['account_old']->general_objectClass)) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass sambaSamAccount not found.'), _('Have to recreate entry.')); echo "\n"; }} else if (!in_array('sambaAccount', $_SESSION['account_old']->general_objectClass)) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass sambaAccount not found.'), _('Have to recreate entry.')); echo "\n"; } } @@ -1082,12 +1082,12 @@ switch ($select_local) { // Select which part of page will be loaded if (isset($_SESSION['account_old']->general_objectClass)) { if (($_SESSION['config']->samba3 == 'yes') && (!in_array('sambaGroupMapping', $_SESSION['account_old']->general_objectClass))) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass sambaGroupMapping not found.'), _('Have to recreate entry.')); echo "\n"; } if (!in_array('posixGroup', $_SESSION['account_old']->general_objectClass)) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass posixGroup not found.'), _('Have to recreate entry.')); echo "\n"; } } @@ -1102,29 +1102,29 @@ switch ($select_local) { // Select which part of page will be loaded if (isset($_SESSION['account_old']->general_objectClass)) { if (!in_array('posixAccount', $_SESSION['account_old']->general_objectClass)) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass posixAccount not found.'), _('Have to recreate entry.')); echo "\n"; } if (!in_array('shadowAccount', $_SESSION['account_old']->general_objectClass)) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass shadowAccount not found.'), _('Have to recreate entry.')); echo "\n"; } if (!in_array('account', $_SESSION['account_old']->general_objectClass)) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass account not found.'), _('Have to recreate entry.')); echo "\n"; } if ($_SESSION['config']->samba3 == 'yes') { if (!in_array('sambaSamAccount', $_SESSION['account_old']->general_objectClass)) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass sambaSamAccount not found.'), _('Have to recreate entry.')); echo "\n"; }} else if (!in_array('sambaAccount', $_SESSION['account_old']->general_objectClass)) { echo ''; - StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); + StatusMessage('WARN', _('ObjectClass sambaAccount not found.'), _('Have to recreate entry.')); echo "\n"; } } diff --git a/lam/templates/masscreate.php b/lam/templates/masscreate.php index 9029c0de..341270e9 100644 --- a/lam/templates/masscreate.php +++ b/lam/templates/masscreate.php @@ -61,10 +61,10 @@ if ($select!='pdf') { switch ($select) { case 'cancel': - if ( session_is_registered("accounts")) session_unregister("accounts"); - if ( session_is_registered("pointer")) session_unregister("pointer"); - if ( session_is_registered("errors")) session_unregister("errors"); - echo ''; + if ( isset($_SESSION['accounts'])) unset($_SESSION['accounts']); + if ( isset($_SESSION['pointer'])) unset($_SESSION['pointer']); + if ( isset($_SESSION['errors'])) unset($_SESSION['errors']); + echo ''; break; case 'create': if ($_SESSION['pointer'] < sizeof($_SESSION['accounts'])) {