prepare Samba 3 support

This commit is contained in:
Roland Gruber 2003-06-08 18:58:01 +00:00
parent 6d1d4700b0
commit ad520a8995
2 changed files with 16 additions and 4 deletions

View File

@ -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) {

View File

@ -103,8 +103,14 @@ for ($k = 0; $k < sizeof($desc_array); $k++) {
} }
// configure search filter // configure search filter
// Samba hosts have the attribute "sambaAccount" and end with "$" if ($_SESSION['config']->get_samba3() == "yes") {
$filter = "(&(objectClass=sambaAccount) (uid=*$)"; // Samba hosts have the attribute "sambaSamAccount" and end with "$"
$filter = "(&(objectClass=sambaSamAccount) (uid=*$)";
}
else {
// Samba hosts have the attribute "sambaAccount" and end with "$"
$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]) . "=" .