Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LDap problem ( Windows Related)
#1
hi ,
i had a big problem after ldap connexion ,

after good login and password i can t connect

Warning: ldap_search() [function.ldap-search]: Search: Operations error in C:\xampp\htdocs\mydms\op\op.Login.php on line 94


op\op.login.php

if (!is_bool($ds)) {
// Ensure that the LDAP connection is set to use version 3 protocol.
// Required for most authentication methods, including SASL.
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

// try an anonymous bind first. If it succeeds, get the DN for the user.
$bind = @ldap_bind($ds);
$dn = false;

if ($bind) {
$search = ldap_search($ds, $settings->_ldapBaseDN, "uid=".$login);
if (!is_bool($search)) {
$info = ldap_get_entries($ds, $search);
if (!is_bool($info) && $info["count"]>0) {
$dn = $info[0]['dn'];
}
}
}



inc.settings.php

var $_ldapHost = "xx.x.x.x";
var $_ldapPort = xxx;
var $_ldapBaseDN = "OU=xxxx,DC=xxxxx,DC=xxx";
Reply
#2
what version of php do you have? and did you import the datebase in mysql ?

LetoDMS
Reply
#3
my version php : [PHP: 5.3.1]
In mysql database letodms work but , when i would like to work in ldap database he say :
Warning: ldap_search() [function.ldap-search]: Search: Operations error in C:\xampp\htdocs\mydms\op\op.Login.php on line 94
Reply
#4
now my ldap connection work .

new code for op\op.login.php


if (!is_bool($ds)) {
// Ensure that the LDAP connection is set to use version 3 protocol.
// Required for most authentication methods, including SASL.
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

// try an anonymous bind first. If it succeeds, get the DN for the user.
$bind = @ldap_bind($ds, $login."@xxxxx.com", $pwd);
if ($bind) {
// Successfully authenticated. Now check to see if the user exists within
// the database. If not, add them in, but do not add their password.
$user = getUserByLogin($login);
if (is_bool($user) && !$settings->_restricted) {
// Retrieve the user's LDAP information.
$filter='(&(Sn=*)(givenname=*))';
$search = ldap_search($ds, $settings->_ldapBaseDN, $filter);
if (!is_bool($search)) {
$info = ldap_get_entries($ds, $search);
if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) {
$user = addUser($login, null, $info[0]['cn'][0], $info[0]['mail'][0], $settings->_language, $settings->_theme, "");
}*/
$tab=array();
for ($i=0; $i < $info["count"]; $i++){
if(strtoupper($info[$i]["samaccountname"][0])==strtoupper($login)){
$tab['cn']=$info[$i]["cn"][0];
$tab['mail']=$info[$i]["mail"][0];
$user = addUser($login, md5($pwd), $tab['cn'], $tab['mail'], $settings->_language, $settings->_theme, "");
}

}

}
}
if (!is_bool($user)) {
$userid = $user->getID();
}
}
ldap_close($ds);
}
}
Reply
#5
hey i checked that our code is working fine on linux , i think we would say that would be a customize code for windows.

thanks very much

LetoDMS
Reply
#6
the code no foun in my ubuntu.

result log:

PHP Fatal error: Call to undefined function ldap_connect() in /usr/local/letodms/op/op.Login.php on line 74


inc/inc.Settings.php


var $_ldapHost = "10.xxx.xx.xxx";
var $_ldapPort = "389"; // Optional.
var $_ldapBaseDN = "DC=domain,DC=es";


what is the problem?
someone can upload the file op.Login.php
Reply
#7
(05-26-2010, 07:28 PM)diegovgd Wrote: the code no foun in my ubuntu.

result log:

PHP Fatal error: Call to undefined function ldap_connect() in /usr/local/letodms/op/op.Login.php on line 74


inc/inc.Settings.php


var $_ldapHost = "10.xxx.xx.xxx";
var $_ldapPort = "389"; // Optional.
var $_ldapBaseDN = "DC=domain,DC=es";


what is the problem?
someone can upload the file op.Login.php

Solved, ldap_connect not installed or is installed but you have to recompile php
Reply


Forum Jump:


Users browsing this thread: