load correct domain even if Samba version differs
This commit is contained in:
parent
8675e6a9cb
commit
76888028de
|
@ -48,7 +48,6 @@ function getUserProfiles() {
|
||||||
|
|
||||||
// returns an array of String with all available group profiles (without .prg)
|
// returns an array of String with all available group profiles (without .prg)
|
||||||
function getGroupProfiles() {
|
function getGroupProfiles() {
|
||||||
// group profiles are not supported at this time
|
|
||||||
$dir = @dir(substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/groups");
|
$dir = @dir(substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/groups");
|
||||||
$ret = array();
|
$ret = array();
|
||||||
$pos = 0;
|
$pos = 0;
|
||||||
|
@ -180,26 +179,51 @@ function loadUserProfile($profile) {
|
||||||
if (substr($line, 0, 12) == "smb_domain: ") {
|
if (substr($line, 0, 12) == "smb_domain: ") {
|
||||||
if ($_SESSION['config']->is_samba3()) {
|
if ($_SESSION['config']->is_samba3()) {
|
||||||
$dn = chop(substr($line, 12, strlen($line)-12));
|
$dn = chop(substr($line, 12, strlen($line)-12));
|
||||||
// load domain object
|
if (! stristr($dn, "sambaDomainName=")) { // Samba 3 and Samba 2 profile
|
||||||
$dom = new samba3domain();
|
// get domain list
|
||||||
$sr = @ldap_search($_SESSION['ldap']->server, $dn, "objectClass=sambaDomain");
|
$doms = $_SESSION['ldap']->search_domains($_SESSION['config']->get_domainSuffix());
|
||||||
if ($sr) {
|
// search domain name
|
||||||
$info = @ldap_get_entries($_SESSION['ldap']->server, $sr);
|
for ($d = 0; $d < sizeof($doms); $d++) {
|
||||||
if ($info) {
|
if (strtolower($doms[$d]->name) == strtolower($dn)) {
|
||||||
// get domain attributes
|
$acc->smb_domain = $doms[$d];
|
||||||
@array_shift($info);
|
break;
|
||||||
$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 { // Samba 3 and Samba 3 profile
|
||||||
|
// 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 {
|
||||||
|
$dom_name = chop(substr($line, 12, strlen($line)-12));
|
||||||
|
if (substr($dom_name, 0, 16) == "sambaDomainName=") { // Samba 2 and Samba 3 profile
|
||||||
|
// extract domain name from DN
|
||||||
|
$dom_name = substr($dom_name, 16, strlen($dom_name) - 16);
|
||||||
|
$pos = strpos($dom_name, ",");
|
||||||
|
$dom_name = substr($dom_name, 0, $pos);
|
||||||
|
$acc->smb_domain = $dom_name;
|
||||||
|
}
|
||||||
|
else { // Samba 2 and Samba 2 profile
|
||||||
|
$acc->smb_domain = $dom_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else $acc->smb_domain = chop(substr($line, 12, strlen($line)-12));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (substr($line, 0, 7) == "quota: ") {
|
if (substr($line, 0, 7) == "quota: ") {
|
||||||
|
|
Loading…
Reference in New Issue