diff --git a/lam/lib/profiles.inc b/lam/lib/profiles.inc index f05d63ba..fe83da83 100644 --- a/lam/lib/profiles.inc +++ b/lam/lib/profiles.inc @@ -25,6 +25,7 @@ $Id$ include_once("config.inc"); include_once("account.inc"); +include_once("ldap.inc"); // returns an array of String with all available user profiles (without .pru) @@ -172,7 +173,28 @@ function loadUserProfile($profile) { continue; } if (substr($line, 0, 12) == "smb_domain: ") { - $acc->smb_domain = chop(substr($line, 12, strlen($line)-12)); + if ($_SESSION['config']->get_samba3() == "yes") { + $dn = chop(substr($line, 12, strlen($line)-12)); + // load domain object + $dom = new samba3domain(); + $sr = @ldap_search($_SESSION['ldap']->server, $dn, "objectClass=sambaDomain"); + if ($sr) { + $info = @ldap_get_entries($_SESSION['ldap']->server, $sr); + if ($info) { + // get domain attributes + @array_shift($info); + $dom->dn = $dn; + $dom->name = $info[0]['sambadomainname'][0]; + $dom->SID = $info[0]['sambaSID'][0]; + $dom->nextRID = $info[0]['sambanextrid'][0]; + $dom->nextUserRID = $info[0]['sambanextuserrid'][0]; + $dom->nextGroupRID = $info[0]['sambanextgrouprid'][0]; + if (isset($dom->RIDbase)) $dom->RIDbase = $info[0]['sambaalgorithmicridbase'][0]; + } + } + $acc->smb_domain = $dom; + } + else $acc->smb_domain = chop(substr($line, 12, strlen($line)-12)); continue; } } @@ -212,7 +234,28 @@ function loadHostProfile($profile) { continue; } if (substr($line, 0, 12) == "smb_domain: ") { - $acc->smb_domain = chop(substr($line, 12, strlen($line)-12)); + if ($_SESSION['config']->get_samba3() == "yes") { + $dn = chop(substr($line, 12, strlen($line)-12)); + // load domain object + $dom = new samba3domain(); + $sr = @ldap_search($_SESSION['ldap']->server, $dn, "objectClass=sambaDomain"); + if ($sr) { + $info = @ldap_get_entries($_SESSION['ldap']->server, $sr); + if ($info) { + // get domain attributes + @array_shift($info); + $dom->dn = $dn; + $dom->name = $info[0]['sambadomainname'][0]; + $dom->SID = $info[0]['sambaSID'][0]; + $dom->nextRID = $info[0]['sambanextrid'][0]; + $dom->nextUserRID = $info[0]['sambanextuserrid'][0]; + $dom->nextGroupRID = $info[0]['sambanextgrouprid'][0]; + if (isset($dom->RIDbase)) $dom->RIDbase = $info[0]['sambaalgorithmicridbase'][0]; + } + } + $acc->smb_domain = $dom; + } + else $acc->smb_domain = chop(substr($line, 12, strlen($line)-12)); continue; } } diff --git a/lam/templates/profedit/profilecreate.php b/lam/templates/profedit/profilecreate.php index 6e1ea00d..04a0a860 100644 --- a/lam/templates/profedit/profilecreate.php +++ b/lam/templates/profedit/profilecreate.php @@ -217,7 +217,7 @@ if ($_GET['type'] == "user") { echo ("

" . _("Back to Profile Editor") . ""); exit; } - if ($_POST['smb_domain'] && eregi("^[a-z0-9_\\-]+$", $_POST['smb_domain'])) { + if ($_POST['smb_domain'] && is_string($_POST['smb_domain'])) { $acct->smb_domain = $_POST['smb_domain']; } elseif ($_POST['smb_domain']) { @@ -252,7 +252,7 @@ elseif ($_GET['type'] == "host") { echo ("

" . _("Back to Profile Editor") . ""); exit; } - if ($_POST['smb_domain'] && eregi("^[a-z0-9_\\-]+$", $_POST['smb_domain'])) { + if ($_POST['smb_domain'] && is_string($_POST['smb_domain'])) { $acct->smb_domain = $_POST['smb_domain']; } elseif ($_POST['smb_domain']) { diff --git a/lam/templates/profedit/profilehost.php b/lam/templates/profedit/profilehost.php index eb9cdcae..4e626179 100644 --- a/lam/templates/profedit/profilehost.php +++ b/lam/templates/profedit/profilehost.php @@ -84,11 +84,11 @@ if ($_SESSION['config']->get_samba3() == "yes") { echo "\n"; diff --git a/lam/templates/profedit/profileuser.php b/lam/templates/profedit/profileuser.php index f111c2a8..9bab6e46 100644 --- a/lam/templates/profedit/profileuser.php +++ b/lam/templates/profedit/profileuser.php @@ -331,11 +331,11 @@ if ($_SESSION['config']->get_samba3() == "yes") { echo "\n";