use domain objects for Samba 3
This commit is contained in:
parent
0c68a66676
commit
6ca1c8a16c
|
@ -25,6 +25,7 @@ $Id$
|
||||||
|
|
||||||
include_once("config.inc");
|
include_once("config.inc");
|
||||||
include_once("account.inc");
|
include_once("account.inc");
|
||||||
|
include_once("ldap.inc");
|
||||||
|
|
||||||
|
|
||||||
// returns an array of String with all available user profiles (without .pru)
|
// returns an array of String with all available user profiles (without .pru)
|
||||||
|
@ -172,7 +173,28 @@ function loadUserProfile($profile) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (substr($line, 0, 12) == "smb_domain: ") {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +234,28 @@ function loadHostProfile($profile) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (substr($line, 0, 12) == "smb_domain: ") {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,7 @@ if ($_GET['type'] == "user") {
|
||||||
echo ("<br><br><a href=\"javascript:history.back()\">" . _("Back to Profile Editor") . "</a>");
|
echo ("<br><br><a href=\"javascript:history.back()\">" . _("Back to Profile Editor") . "</a>");
|
||||||
exit;
|
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'];
|
$acct->smb_domain = $_POST['smb_domain'];
|
||||||
}
|
}
|
||||||
elseif ($_POST['smb_domain']) {
|
elseif ($_POST['smb_domain']) {
|
||||||
|
@ -252,7 +252,7 @@ elseif ($_GET['type'] == "host") {
|
||||||
echo ("<br><br><a href=\"javascript:history.back()\">" . _("Back to Profile Editor") . "</a>");
|
echo ("<br><br><a href=\"javascript:history.back()\">" . _("Back to Profile Editor") . "</a>");
|
||||||
exit;
|
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'];
|
$acct->smb_domain = $_POST['smb_domain'];
|
||||||
}
|
}
|
||||||
elseif ($_POST['smb_domain']) {
|
elseif ($_POST['smb_domain']) {
|
||||||
|
|
|
@ -84,11 +84,11 @@ if ($_SESSION['config']->get_samba3() == "yes") {
|
||||||
echo "<td><select name=\"smb_domain\">\n";
|
echo "<td><select name=\"smb_domain\">\n";
|
||||||
$doms = $_SESSION['ldap']->search_domains($_SESSION['config']->get_DomainSuffix());
|
$doms = $_SESSION['ldap']->search_domains($_SESSION['config']->get_DomainSuffix());
|
||||||
for ($i = 0; $i < sizeof($doms); $i++) {
|
for ($i = 0; $i < sizeof($doms); $i++) {
|
||||||
if (strtolower($acct->smb_domain) == strtolower($doms[$i]->name)) {
|
if (strtolower($acct->smb_domain->name) == strtolower($doms[$i]->name)) {
|
||||||
echo ("<option selected>" . $acct->smb_domain . "</option>\n");
|
echo ("<option selected value=\"" . $act->smb_domain->dn . "\">" . $acct->smb_domain->name . "</option>\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo ("<option>" . $doms[$i]->name . "</option>\n");
|
echo ("<option value=\"" . $doms[$i]->dn . "\">" . $doms[$i]->name . "</option>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "</select></td>\n";
|
echo "</select></td>\n";
|
||||||
|
|
|
@ -331,11 +331,11 @@ if ($_SESSION['config']->get_samba3() == "yes") {
|
||||||
echo "<td><select name=\"smb_domain\">\n";
|
echo "<td><select name=\"smb_domain\">\n";
|
||||||
$doms = $_SESSION['ldap']->search_domains($_SESSION['config']->get_DomainSuffix());
|
$doms = $_SESSION['ldap']->search_domains($_SESSION['config']->get_DomainSuffix());
|
||||||
for ($i = 0; $i < sizeof($doms); $i++) {
|
for ($i = 0; $i < sizeof($doms); $i++) {
|
||||||
if (strtolower($acct->smb_domain) == strtolower($doms[$i]->name)) {
|
if (strtolower($acct->smb_domain->name) == strtolower($doms[$i]->name)) {
|
||||||
echo ("<option selected>" . $acct->smb_domain . "</option>\n");
|
echo ("<option selected value=\"" . $act->smb_domain->dn . "\">" . $acct->smb_domain->name . "</option>\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo ("<option>" . $doms[$i]->name . "</option>\n");
|
echo ("<option value=\"" . $doms[$i]->dn . "\">" . $doms[$i]->name . "</option>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "</select></td>\n";
|
echo "</select></td>\n";
|
||||||
|
|
Loading…
Reference in New Issue