fixed small bug with smbHome

Allowed Umlaute as Username, Sharename, ...
Improved help
This commit is contained in:
katagia 2003-08-14 12:49:11 +00:00
parent 41171e07fe
commit 98286f64da
4 changed files with 157 additions and 143 deletions

View File

@ -174,18 +174,18 @@ $helpArray = array (
// account.php // account.php
"400" => array ("ext" => "FALSE", "Headline" => _("Username"), "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 "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.")), 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"), "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()."."), "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.")), "Text" => _("Can be left empty. Hold the CTRL-key to (de)select multiple groups.")),
"403" => array ("ext" => "FALSE", "Headline" => _("Home Directory"), "403" => array ("ext" => "FALSE", "Headline" => _("Home Directory"),
"Text" => _("$user and $group are replaced with username or primary groupname.")), "Text" => _("$user and $group are replaced with username or primary groupname.")),
"404" => array ("ext" => "FALSE", "Headline" => _("Gecos"), "404" => array ("ext" => "FALSE", "Headline" => _("Gecos"),
"Text" => _("User descriptopn. If left empty sur- and givename will be used.")), "Text" => _("User descriptopn. If left empty sur- and givename will be used.")),
"405" => array ("ext" => "FALSE", "Headline" => _("Login shell"), "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"), "406" => array ("ext" => "FALSE", "Headline" => _("Primary group"),
"Text" => _("The Primary Group the user should be member of.")), "Text" => _("The Primary Group the user should be member of.")),
"407" => array ("ext" => "FALSE", "Headline" => _("Groupname"), "407" => array ("ext" => "FALSE", "Headline" => _("Groupname"),
@ -203,77 +203,71 @@ $helpArray = array (
"411" => array ("ext" => "FALSE", "Headline" => _("UID number"), "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()."."), "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"), "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"), "413" => array ("ext" => "FALSE", "Headline" => _("Gecos"),
"Text" => _("Host description. If left empty host name will be used.")), "Text" => _("Host description. If left empty host name will be used.")),
"414" => array ("ext" => "FALSE", "Headline" => _("Password warn"), "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"), "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"), "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"), "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"), "418" => 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")),
"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.")),
"424" => array ("ext" => "FALSE", "Headline" => _("Surname"), "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"), "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"), "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"), "427" => array ("ext" => "FALSE", "Headline" => _("Account deactivated"),
"Text" => _("Account deactivated")), "Text" => _("If checked account will be deactivated by putting a ! before the encrypted password.")),
"428" => array ("ext" => "FALSE", "Headline" => _("Use no password"), "429" => array ("ext" => "FALSE", "Headline" => _("Password doesn't expire"),
"Text" => _("Use no password.")), "Text" => _("If checked password won't expire. (Setting X-Flag)")),
"429" => array ("ext" => "FALSE", "Headline" => _("Password does not expire"), "430" => array ("ext" => "FALSE", "Headline" => _("User can change Password"),
"Text" => _("Password doesn't expire.")), "Text" => _("Date after the user is able to change his password. Format: DD-MM-YYYY")),
"430" => array ("ext" => "FALSE", "Headline" => _("User can change password"), "431" => array ("ext" => "FALSE", "Headline" => _("User must change Password"),
"Text" => _("User can change password.")), "Text" => _("Date after the user must change his password. Format: DD-MM-YYYY")),
"431" => array ("ext" => "FALSE", "Headline" => _("User must change password"),
"Text" => _("User must change password.")),
"432" => array ("ext" => "FALSE", "Headline" => _("Account is deactivated"), "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"), "433" => array ("ext" => "FALSE", "Headline" => _("Home drive"),
"Text" => _("Driveletter assigned on windows-workstations as homedirectory.")), "Text" => _("Driveletter assigned on windows-workstations as homedirectory.")),
"434" => array ("ext" => "FALSE", "Headline" => _("Script path"), "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"), "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"), "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.")), "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"), "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"), "438" => array ("ext" => "FALSE", "Headline" => _("Domain"),
"Text" => _("Windows-Domain of user. Can be left empty.")), "Text" => _("Windows-Domain of user. Can be left empty.")),
"439" => array ("ext" => "FALSE", "Headline" => _("Mountpoint"), "439" => array ("ext" => "FALSE", "Headline" => _("Mountpoint"),
"Text" => _("Mountpoint")), "Text" => _("Mointpoint of device with enabled quotas.")),
"440" => array ("ext" => "FALSE", "Headline" => _("Used blocks"), "440" => array ("ext" => "FALSE", "Headline" => _("Used blocks"),
"Text" => _("Used blocks.")), "Text" => _("Blocks used by user. 1000 blocks are usually 1MB")),
"441" => array ("ext" => "FALSE", "Headline" => _("soft block limit"), "441" => array ("ext" => "FALSE", "Headline" => _("Soft block limit"),
"Text" => _("soft block limit")), "Text" => _("Soft block limit.<br> See also:").' <a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.4"</a>'.
"442" => array ("ext" => "FALSE", "Headline" => _("hard block limit"), 'Quota How-To'),
"Text" => _("hard block limit")), "442" => array ("ext" => "FALSE", "Headline" => _("Hard block limit"),
"443" => array ("ext" => "FALSE", "Headline" => _("grace block period"), "Text" => _("Hard block limit.<br> See also:").' <a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.5"</a>'.
"Text" => _("grace block period")), 'Quota How-To'),
"444" => array ("ext" => "FALSE", "Headline" => _("used inodes"), "443" => array ("ext" => "FALSE", "Headline" => _("Grace block period"),
"Text" => _("used inodes")), "Text" => _("Grace block period. Most filesystems use a fixed maximum value of 7 days.<br> See also:").' <a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.6"</a>'.
"445" => array ("ext" => "FALSE", "Headline" => _("soft inode limit"), 'Quota How-To'),
"Text" => _("soft inode limit")), "444" => array ("ext" => "FALSE", "Headline" => _("Used inodes"),
"446" => array ("ext" => "FALSE", "Headline" => _("hard inode limit"), "Text" => _("Used inodes (files) by user.")),
"Text" => _("hard inode limit")), "445" => array ("ext" => "FALSE", "Headline" => _("Soft inode limit"),
"447" => array ("ext" => "FALSE", "Headline" => _("grace inode period"), "Text" => _("Soft inode (files) limit.<br> See also:").' <a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.4"</a>'.
"Text" => _("grace inode period")), 'Quota How-To'),
"446" => array ("ext" => "FALSE", "Headline" => _("Hard inode limit"),
"Text" => _("Hard inode (files) limit.<br> See also:").' <a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.5"</a>'.
'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.<br> See also:").' <a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.6"</a>'.
'Quota How-To'),
"448" => array ("ext" => "FALSE", "Headline" => _("Title"), "448" => array ("ext" => "FALSE", "Headline" => _("Title"),
"Text" => _("Title")), "Text" => _("Title")),
"449" => array ("ext" => "FALSE", "Headline" => _("Employee type"), "449" => array ("ext" => "FALSE", "Headline" => _("Employee type"),
@ -303,7 +297,7 @@ $helpArray = array (
"461" => array ("ext" => "FALSE", "Headline" => _("Suffix"), "461" => array ("ext" => "FALSE", "Headline" => _("Suffix"),
"Text" => _("Suffix")), "Text" => _("Suffix")),
"462" => array ("ext" => "FALSE", "Headline" => _("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"), "463" => array ("ext" => "FALSE", "Headline" => _("Suffix"),
"Text" => _("Suffix")), "Text" => _("Suffix")),
"464" => array ("ext" => "FALSE", "Headline" => _("Windows groupname"), "464" => array ("ext" => "FALSE", "Headline" => _("Windows groupname"),

View File

@ -88,19 +88,14 @@ function initvars($type=false,$DN=false) { // This function registers all needes
@session_start(); @session_start();
setlanguage(); setlanguage();
if ($type) { if ($type) {
if (session_is_registered("type2")) session_unregister("type2"); if (isset($_SESSION['type2'])) unset($_SESSION['type2']);
session_register("type2"); // $type2 stores the kind of account (User|Group|Host)
$_SESSION['type2'] = $type; $_SESSION['type2'] = $type;
if (session_is_registered("shelllist")) session_unregister("shelllist"); if (isset($_SESSION['shelllist'])) unset($_SESSION['shelllist']);
session_register("shelllist"); // $shelllist contains all shells defined in /etc/shells
$_SESSION['shelllist'] = getshells(); // Write List of all valid shells in variable $_SESSION['shelllist'] = getshells(); // Write List of all valid shells in variable
if (session_is_registered("account")) session_unregister("account"); if (isset($_SESSION['account'])) unset($_SESSION['account']);
session_register("account"); // The new Accout properties are stored here if (isset($_SESSION['errors'])) unset($_SESSION['errors']);
if (session_is_registered("errors")) session_unregister("errors");
session_register("errors"); // $type2 stores the kind of account (User|Group|Host)
if ($DN) { if ($DN) {
if (session_is_registered("account_old")) session_unregister("account_old"); if (isset($_SESSION['account_old'])) unset($_SESSION['account_old']);
else session_register("account_old"); // Only valid if an account should be modified. It'll contains the existing account properties
$DN = str_replace("\'", '',$DN); $DN = str_replace("\'", '',$DN);
switch ($type) { switch ($type) {
case 'user': case 'user':
@ -114,8 +109,7 @@ function initvars($type=false,$DN=false) { // This function registers all needes
$_SESSION['account'] = loadgroup($DN); $_SESSION['account'] = loadgroup($DN);
$_SESSION['account_old'] = $_SESSION['account']; $_SESSION['account_old'] = $_SESSION['account'];
$_SESSION['account']->general_dn = substr($_SESSION['account']->general_dn, strpos($_SESSION['account']->general_dn, ',')+1); $_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'); $_SESSION['final_changegids'] = '';
else $_SESSION['final_changegids'] = '';
break; break;
case 'host': case 'host':
$_SESSION['account'] = loadhost($DN); $_SESSION['account'] = loadhost($DN);
@ -163,6 +157,15 @@ function getshells() { // Return a list of all shells listed in ../config/shells
return $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 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 // If all values are OK an array of class account is returned. Else an error-string is returned
$return = new account(); $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 )) 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.')); $errors[] = array('ERROR', _('Home Directory'), _('Homedirectory contents invalid characters.'));
// Check if givenname is valid // 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 // 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==' ')) { 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.')); $errors[] = array('INFO', _('Gecos'), _('Inserted sur- and givenname in gecos-field.'));
} }
if ($values->general_group=='') $errors[] = array('ERROR', _('Primary group'), _('No primary group defined!')); 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.')); 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); $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.')); 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); $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.')); 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); $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.')); 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]|[\|]|[\#]|[\*]|[\,]|[\.]|[\;]|[\:]|[\_]|[\-]|[\+]|[\!]|[\%]|[\&]|[\/]|[\?]|[\{]|[\[]|[\(]|[\)]|[\]]|[\}])*$', 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 #*,.;:_-+!$%&/|?{[()]}= !')); $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.')); $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)) 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))) && (!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.')); $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)) 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.')); $errors[] = array('ERROR', _('Samba workstations'), _('Samba workstations is invalid.'));
$return->smb_flagsW = 0; $return->smb_flagsW = 0;
@ -723,6 +727,14 @@ function loaduser($dn) { // Will load all needed values from an existing account
$i++; $i++;
} }
if ($_SESSION['config']->samba3 == 'yes') { 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 (isset($attr['sambaAcctFlags'][0])) {
if (strrpos($attr['sambaAcctFlags'][0], 'W')) $return->smb_flagsW=true; if (strrpos($attr['sambaAcctFlags'][0], 'W')) $return->smb_flagsW=true;
if (strrpos($attr['sambaAcctFlags'][0], 'D')) $return->smb_flagsD=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['sambaPwdCanChange'][0])) $return->smb_pwdcanchange = $attr['sambaPwdCanChange'][0];
if (isset($attr['sambaPwdMustChange'][0])) $return->smb_pwdmustchange = $attr['sambaPwdMustChange'][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['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['sambaProfilePath'][0])) $return->smb_profilePath = $attr['sambaProfilePath'][0];
if (isset($attr['sambaUserWorkstations'][0])) $return->smb_smbuserworkstations = $attr['sambaUserWorkstations'][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['sambaDomainName'][0])) $return->smb_domain = $attr['sambaDomainName'][0];
if (isset($attr['sambaNTPassword'][0])) $return->smb_password = $attr['sambaNTPassword'][0]; if (isset($attr['sambaNTPassword'][0])) $return->smb_password = $attr['sambaNTPassword'][0];
} }
else { else {
if (isset($attr['acctFlags'][0])) { if (isset($attr['acctFlags'][0])) {
if (strrpos($attr['acctFlags'][0], 'W')) $return->smb_flagsW=true; 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], 'D')) $return->smb_flagsD=true;
if (strrpos($attr['acctFlags'][0], 'X')) $return->smb_flagsX=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];
} }
if (isset($attr['givenName'][0])) $return->general_givenname = $attr['givenName'][0]; if (isset($attr['ntPassword'][0])) $return->smb_password = $attr['ntPassword'][0];
if (isset($attr['sn'][0])) $return->general_surname = $attr['sn'][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['title'][0])) $return->personal_title = $attr['title'][0];
if (isset($attr['mail'][0])) $return->personal_mail = $attr['mail'][0]; if (isset($attr['mail'][0])) $return->personal_mail = $attr['mail'][0];
if (isset($attr['telephoneNumber'][0])) $return->personal_telephoneNumber = $attr['telephoneNumber'][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['uid'][0])) $return->general_username = $attr['uid'][0];
if (isset($attr['uidNumber'][0])) $return->general_uidNumber = $attr['uidNumber'][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['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['description'][0])) $return->general_gecos = $attr['description'][0];
if (isset($attr['gidNumber'][0])) { if (isset($attr['gidNumber'][0])) {
$result = ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_GroupSuffix(), "objectclass=PosixGroup", array('gidNumber', 'cn')); $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['shadowWarning'][0])) $return->unix_pwdwarn = $attr['shadowWarning'][0];
if (isset($attr['shadowInactive'][0])) $return->unix_pwdallowlogin = $attr['shadowInactive'][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 (isset($attr['shadowExpire'][0])) $return->unix_pwdexpire = $attr['shadowExpire'][0]*86400;
if ($_SESSION['config']->samba3 == 'yes') { 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 (isset($attr['sambaAcctFlags'][0])) {
if (strrpos($attr['sambaAcctFlags'][0], 'W')) $return->smb_flagsW=true; if (strrpos($attr['sambaAcctFlags'][0], 'W')) $return->smb_flagsW=true;
if (strrpos($attr['sambaAcctFlags'][0], 'D')) $return->smb_flagsD=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['pwdCanChange'][0])) $return->smb_pwdcanchange = $attr['pwdCanChange'][0];
if (isset($attr['pwdMustChange'][0])) $return->smb_pwdmustchange = $attr['pwdMustChange'][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; if (substr(str_replace('{CRYPT}', '',$attr['userPassword'][0]),0,1) == '!' ) $return->unix_deactivated=true;
return $return; return $return;
} }
@ -923,9 +942,9 @@ function createuser($values) { // Will create the LDAP-Account
$attr['sambaPwdMustChange'] = $values->smb_pwdmustchange; // sambaAccount_may $attr['sambaPwdMustChange'] = $values->smb_pwdmustchange; // sambaAccount_may
$attr['sambaAcctFlags'] = smbflag(values); // sambaAccount_may $attr['sambaAcctFlags'] = smbflag(values); // sambaAccount_may
$attr['displayName'] = $values->general_gecos; // 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_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_profilePath!='') $attr['sambaProfilePath'] = $values->smb_profilePath; // sambaAccount_may
if ($values->smb_smbuserworkstations!='') $attr['sambaUserWorkstations'] = $values->smb_smbuserworkstations; // 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 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['pwdMustChange'] = $values->smb_pwdmustchange; // sambaAccount_may
$attr['acctFlags'] = smbflag(values); // sambaAccount_may $attr['acctFlags'] = smbflag(values); // sambaAccount_may
$attr['displayName'] = $values->general_gecos; // 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_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_profilePath!='') $attr['profilePath'] = $values->smb_profilePath; // sambaAccount_may
if ($values->smb_smbuserworkstations!='') $attr['userWorkstations'] = $values->smb_smbuserworkstations; // sambaAccount_may if ($values->smb_smbuserworkstations!='') $attr['userWorkstations'] = $values->smb_smbuserworkstations; // sambaAccount_may
if ($values->smb_domain!='') $attr['domain'] = $values->smb_domain; // 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 ($values->unix_pwdallowlogin!='') $attr['shadowInactive'] = $values->unix_pwdallowlogin; // shadowAccount_may
if ($date) $attr['shadowExpire'] = $date ; // shadowAccount_may if ($date) $attr['shadowExpire'] = $date ; // shadowAccount_may
if ($values->general_givenname!='') $attr['givenName'] = $values->general_givenname; if ($values->general_givenname!='') $attr['givenName'] = utf8_encode($values->general_givenname);
if ($values->general_surname!='') $attr['sn'] = $values->general_surname; if ($values->general_surname!='') $attr['sn'] = utf8_encode($values->general_surname);
$success = ldap_add($_SESSION['ldap']->server(),$values->general_dn, $attr); $success = ldap_add($_SESSION['ldap']->server(),$values->general_dn, $attr);
if (!$success) return 4; 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_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 if ($values->smb_pwdmustchange != $values_old->smb_pwdmustchange) $attr['sambaPwdMustChange'] = $values->smb_pwdmustchange; // sambaAccount_may
$attr['sambaAcctFlags'] = smbflag($values); // 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['sambaHomePath'] = utf8_encode($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_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['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_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['sambaLogonScript'] = utf8_encode($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_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['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_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['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_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['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->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 { else {
if ($values->smb_password_no) { 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_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 if ($values->smb_pwdmustchange != $values_old->smb_pwdmustchange) $attr['pwdMustChange'] = $values->smb_pwdmustchange; // sambaAccount_may
$attr['acctFlags'] = smbflag($values); // 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['smbHome'] = utf8_encode($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_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['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_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['scriptPath'] = utf8_encode($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_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['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_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['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_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['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->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) if ($values->general_shell != $values_old->general_shell)
$attr['loginShell'] = $values->general_shell; // posixAccount_may $attr['loginShell'] = $values->general_shell; // posixAccount_may
if ($values->general_gecos != $values_old->general_gecos) { if ($values->general_gecos != $values_old->general_gecos) {
$attr['gecos'] = $values->general_gecos; // posixAccount_may $attr['gecos'] = ($values->general_gecos); // posixAccount_may
$attr['description'] = $values->general_gecos; // posixAccount_may sambaAccount_may $attr['description'] = utf8_encode($values->general_gecos); // posixAccount_may sambaAccount_may
print ($attr['gecos']);
} }
if (($values->unix_host != $values_old->unix_host)) { 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_mon = $date['mon'] != $values_old->unix_pwdexpire_mon = $date['mon']) ||
($values->unix_pwdexpire_yea = $date['year'] != $values->unix_pwdexpire_yea = $date['year'])) ($values->unix_pwdexpire_yea = $date['year'] != $values->unix_pwdexpire_yea = $date['year']))
$attr['shadowExpire'] = $date ; // shadowAccount_may $attr['shadowExpire'] = $date ; // shadowAccount_may
if ($values->general_givenname!=$values_old->general_givenname) $attr['givenName'] = $values->general_givenname; 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'] = $values->general_surname; if ($values->general_surname!=$values_old->general_surname) $attr['sn'] = utf8_encode($values->general_surname);
if ( (!in_array('posixAccount', $_SESSION['account_old']->general_objectClass)) || if ( (!in_array('posixAccount', $_SESSION['account_old']->general_objectClass)) ||
(!in_array('shadowAccount', $_SESSION['account_old']->general_objectClass)) || (!in_array('shadowAccount', $_SESSION['account_old']->general_objectClass)) ||

View File

@ -342,16 +342,16 @@ switch ($select_local) {
switch ( $_SESSION['type2'] ) { switch ( $_SESSION['type2'] ) {
case 'user' : case 'user' :
if (session_is_registered("type2")) session_unregister("type2"); if (session_is_registered("type2")) session_unregister("type2");
echo "<meta http-equiv=\"refresh\" content=\"0; URL=lists/listusers.php\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2; URL=lists/listusers.php\">\n";
break; break;
case 'group' : case 'group' :
if (session_is_registered("type2")) session_unregister("type2"); if (session_is_registered("type2")) session_unregister("type2");
echo "<meta http-equiv=\"refresh\" content=\"0; URL=lists/listgroups.php\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2; URL=lists/listgroups.php\">\n";
break; break;
case 'host' : case 'host' :
if (session_is_registered("type2")) session_unregister("type2"); if (session_is_registered("type2")) session_unregister("type2");
echo "<meta http-equiv=\"refresh\" content=\"0; URL=lists/listhosts.php\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2; URL=lists/listhosts.php\">\n";
break; break;
} }
break; break;
@ -458,7 +458,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo '</select></td><td>'. echo '</select></td><td>'.
'<a href="help.php?HelpNumber=406" target="lamhelp">'._('Help').'</a>'. '<a href="help.php?HelpNumber=406" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>'; '</td></tr>'."\n".'<tr><td>';
echo _('Additional Groupmembership'); echo _('Additional Groups');
echo '</td>'."\n".'<td><select name="f_general_groupadd[]" size="3" multiple>'; echo '</td>'."\n".'<td><select name="f_general_groupadd[]" size="3" multiple>';
// loop though existing groups for additional groups // loop though existing groups for additional groups
foreach ($groups as $group) { foreach ($groups as $group) {
@ -727,7 +727,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo '</td>'."\n".'<td><input name="f_smb_password_no" type="checkbox"'; echo '</td>'."\n".'<td><input name="f_smb_password_no" type="checkbox"';
if ($_SESSION['account']->smb_password_no) echo ' checked '; if ($_SESSION['account']->smb_password_no) echo ' checked ';
echo '></td>'."\n".'<td>'. echo '></td>'."\n".'<td>'.
'<a href="help.php?HelpNumber=428" target="lamhelp">'._('Help').'</a>'. '<a href="help.php?HelpNumber=426" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>'; '</td></tr>'."\n".'<tr><td>';
echo _('Password doesn\'t expire.'); echo _('Password doesn\'t expire.');
echo '</td>'."\n".'<td><input name="f_smb_flagsX" type="checkbox"'; echo '</td>'."\n".'<td><input name="f_smb_flagsX" type="checkbox"';
@ -837,29 +837,29 @@ switch ($select_local) { // Select which part of page will be loaded
echo "</option>\n"; echo "</option>\n";
} }
if ( $_SESSION['account']->smb_mapgroup == $_SESSION['account']->smb_domain->SID . "-" . '514' ) { if ( $_SESSION['account']->smb_mapgroup == $_SESSION['account']->smb_domain->SID . "-" . '514' ) {
echo '<option selected> '; echo '<option selected> *';
echo _('Domain Guests'); echo _('Domain Guests');
echo "</option>\n"; } echo "</option>\n"; }
else { else {
echo '<option> '; echo '<option> *';
echo _('Domain Guests'); echo _('Domain Guests');
echo "</option>\n"; echo "</option>\n";
} }
if ( $_SESSION['account']->smb_mapgroup == $_SESSION['account']->smb_domain->SID . "-" . '513' ) { if ( $_SESSION['account']->smb_mapgroup == $_SESSION['account']->smb_domain->SID . "-" . '513' ) {
echo '<option selected> '; echo '<option selected> *';
echo _('Domain Users'); echo _('Domain Users');
echo "</option>\n"; } echo "</option>\n"; }
else { else {
echo '<option> '; echo '<option> *';
echo _('Domain Users'); echo _('Domain Users');
echo "</option>\n"; echo "</option>\n";
} }
if ( $_SESSION['account']->smb_mapgroup == $_SESSION['account']->smb_domain->SID . "-" . '512' ) { if ( $_SESSION['account']->smb_mapgroup == $_SESSION['account']->smb_domain->SID . "-" . '512' ) {
echo '<option selected> '; echo '<option selected> *';
echo _('Domain Admins'); echo _('Domain Admins');
echo "</option>\n"; } echo "</option>\n"; }
else { else {
echo '<option> '; echo '<option> *';
echo _('Domain Admins'); echo _('Domain Admins');
echo "</option>\n"; echo "</option>\n";
} }
@ -1039,29 +1039,29 @@ switch ($select_local) { // Select which part of page will be loaded
if (isset($_SESSION['account_old']->general_objectClass)) { if (isset($_SESSION['account_old']->general_objectClass)) {
if (!in_array('posixAccount', $_SESSION['account_old']->general_objectClass)) { if (!in_array('posixAccount', $_SESSION['account_old']->general_objectClass)) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass posixAccount not found.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
} }
if (!in_array('shadowAccount', $_SESSION['account_old']->general_objectClass)) { if (!in_array('shadowAccount', $_SESSION['account_old']->general_objectClass)) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass shadowAccount.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
} }
if (!in_array('inetOrgPerson', $_SESSION['account_old']->general_objectClass)) { if (!in_array('inetOrgPerson', $_SESSION['account_old']->general_objectClass)) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass inetOrgPerson not found.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
} }
if ($_SESSION['config']->samba3 == 'yes') { if ($_SESSION['config']->samba3 == 'yes') {
if (!in_array('sambaSamAccount', $_SESSION['account_old']->general_objectClass)) { if (!in_array('sambaSamAccount', $_SESSION['account_old']->general_objectClass)) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass sambaSamAccount not found.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
}} }}
else else
if (!in_array('sambaAccount', $_SESSION['account_old']->general_objectClass)) { if (!in_array('sambaAccount', $_SESSION['account_old']->general_objectClass)) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass sambaAccount not found.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
} }
} }
@ -1082,12 +1082,12 @@ switch ($select_local) { // Select which part of page will be loaded
if (isset($_SESSION['account_old']->general_objectClass)) { if (isset($_SESSION['account_old']->general_objectClass)) {
if (($_SESSION['config']->samba3 == 'yes') && (!in_array('sambaGroupMapping', $_SESSION['account_old']->general_objectClass))) { if (($_SESSION['config']->samba3 == 'yes') && (!in_array('sambaGroupMapping', $_SESSION['account_old']->general_objectClass))) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass sambaGroupMapping not found.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
} }
if (!in_array('posixGroup', $_SESSION['account_old']->general_objectClass)) { if (!in_array('posixGroup', $_SESSION['account_old']->general_objectClass)) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass posixGroup not found.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
} }
} }
@ -1102,29 +1102,29 @@ switch ($select_local) { // Select which part of page will be loaded
if (isset($_SESSION['account_old']->general_objectClass)) { if (isset($_SESSION['account_old']->general_objectClass)) {
if (!in_array('posixAccount', $_SESSION['account_old']->general_objectClass)) { if (!in_array('posixAccount', $_SESSION['account_old']->general_objectClass)) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass posixAccount not found.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
} }
if (!in_array('shadowAccount', $_SESSION['account_old']->general_objectClass)) { if (!in_array('shadowAccount', $_SESSION['account_old']->general_objectClass)) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass shadowAccount not found.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
} }
if (!in_array('account', $_SESSION['account_old']->general_objectClass)) { if (!in_array('account', $_SESSION['account_old']->general_objectClass)) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass account not found.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
} }
if ($_SESSION['config']->samba3 == 'yes') { if ($_SESSION['config']->samba3 == 'yes') {
if (!in_array('sambaSamAccount', $_SESSION['account_old']->general_objectClass)) { if (!in_array('sambaSamAccount', $_SESSION['account_old']->general_objectClass)) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass sambaSamAccount not found.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
}} }}
else else
if (!in_array('sambaAccount', $_SESSION['account_old']->general_objectClass)) { if (!in_array('sambaAccount', $_SESSION['account_old']->general_objectClass)) {
echo '<tr>'; echo '<tr>';
StatusMessage('WARN', _('ObjectClass doesn\'t fit.'), _('Have to recreate entry.')); StatusMessage('WARN', _('ObjectClass sambaAccount not found.'), _('Have to recreate entry.'));
echo "</tr>\n"; echo "</tr>\n";
} }
} }

View File

@ -61,10 +61,10 @@ if ($select!='pdf') {
switch ($select) { switch ($select) {
case 'cancel': case 'cancel':
if ( session_is_registered("accounts")) session_unregister("accounts"); if ( isset($_SESSION['accounts'])) unset($_SESSION['accounts']);
if ( session_is_registered("pointer")) session_unregister("pointer"); if ( isset($_SESSION['pointer'])) unset($_SESSION['pointer']);
if ( session_is_registered("errors")) session_unregister("errors"); if ( isset($_SESSION['errors'])) unset($_SESSION['errors']);
echo '<meta http-equiv="refresh" content="0; URL=lists/listusers.php">'; echo '<meta http-equiv="refresh" content="1; URL=lists/listusers.php">';
break; break;
case 'create': case 'create':
if ($_SESSION['pointer'] < sizeof($_SESSION['accounts'])) { if ($_SESSION['pointer'] < sizeof($_SESSION['accounts'])) {