prepare Samba 3 support
This commit is contained in:
parent
6d1d4700b0
commit
ad520a8995
|
@ -113,8 +113,14 @@ class Ldap{
|
||||||
// searches LDAP for a specific user name
|
// searches LDAP for a specific user name
|
||||||
// and returns its DN entry
|
// and returns its DN entry
|
||||||
function search_username($name) {
|
function search_username($name) {
|
||||||
|
if ($this->conf->get_samba3() == "yes") {
|
||||||
|
// users have the attribute "posixAccount" or "sambaSamAccount" and uid $name
|
||||||
|
$filter = "(&(|(objectClass=posixAccount) (objectClass=sambaSamAccount)) (uid=$name))";
|
||||||
|
}
|
||||||
|
else {
|
||||||
// users have the attribute "posixAccount" or "sambaAccount" and uid $name
|
// users have the attribute "posixAccount" or "sambaAccount" and uid $name
|
||||||
$filter = "(&(|(objectClass=posixAccount) (objectClass=sambaAccount)) (uid=$name))";
|
$filter = "(&(|(objectClass=posixAccount) (objectClass=sambaAccount)) (uid=$name))";
|
||||||
|
}
|
||||||
$attrs = array();
|
$attrs = array();
|
||||||
$sr = @ldap_search($this->server, $this->conf->get_UserSuffix(), $filter, $attrs);
|
$sr = @ldap_search($this->server, $this->conf->get_UserSuffix(), $filter, $attrs);
|
||||||
if ($sr) {
|
if ($sr) {
|
||||||
|
|
|
@ -103,8 +103,14 @@ for ($k = 0; $k < sizeof($desc_array); $k++) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// configure search filter
|
// configure search filter
|
||||||
|
if ($_SESSION['config']->get_samba3() == "yes") {
|
||||||
|
// Samba hosts have the attribute "sambaSamAccount" and end with "$"
|
||||||
|
$filter = "(&(objectClass=sambaSamAccount) (uid=*$)";
|
||||||
|
}
|
||||||
|
else {
|
||||||
// Samba hosts have the attribute "sambaAccount" and end with "$"
|
// Samba hosts have the attribute "sambaAccount" and end with "$"
|
||||||
$filter = "(&(objectClass=sambaAccount) (uid=*$)";
|
$filter = "(&(objectClass=sambaAccount) (uid=*$)";
|
||||||
|
}
|
||||||
for ($k = 0; $k < sizeof($desc_array); $k++) {
|
for ($k = 0; $k < sizeof($desc_array); $k++) {
|
||||||
if ($_POST["filter" . strtolower($attr_array[$k])])
|
if ($_POST["filter" . strtolower($attr_array[$k])])
|
||||||
$filter = $filter . "(" . strtolower($attr_array[$k]) . "=" .
|
$filter = $filter . "(" . strtolower($attr_array[$k]) . "=" .
|
||||||
|
|
Loading…
Reference in New Issue