Hello,
I am trying to get the LDAP integration working with W2K3 server. My setup is a PHP 5.0.4, MySQL 4.1.11 and IIS6 running on a Windows 2k3 server.

I have had a few troubles with the LDAP module which I have worked through myself, but this error is something I cannot figure out:

warning: ldap_search() [function.ldap-search]: Search: Operations error in ...\modules\ldap_integration\ldap_integration\LDAPInterface.php on line 74. 
warning: ldap_search(): supplied argument is not a valid ldap link resource in ...\modules\ldap_integration\ldap_integration\LDAPInterface.php on line 109. 

I debugged the code and determined that:-
$this->connection = NULL;
$base_dn = value entered in Drupal settings as required;
$dn = value entered in Drupal settings as required;

I also changed $dn from the recommended sAMAccountName to cn as cn seemed to be the logical choice.

I think the fact that $this->connection is NULL is the error. I manually changed it to ldap://myservername and the error changed indicating a malformed resource url.

If there is any other advice or solutions you can give me, that would be great. Also, the wiki documentation is not very clear for this version, so if there is a more basic step-by-step howto, that would be great too.

Thanks.

CommentFileSizeAuthor
#9 ldaptest.php__1.txt1.51 KBnetkeeper

Comments

pablobm’s picture

Hi, the problem is, I don't have an AD setup I can test my code against, so I'm blindfolded when it comes to code for that environment.

$this->connection is a PHP resource, not a string, that's why your change doesn't work.

pablobm’s picture

Title: LDAP-SEARCH function errors » ldap_search() function errors on AD
Assigned: Unassigned » pablobm

There was a big codebase change. This issue might be solved now.

ashtonium’s picture

I don't believe this is fixed yet. I'm running the latest 4.7 release (30/07/2006 - 01:15) of ldap_integration, but I'm still getting:

ldap_search() [function.ldap-search]: Search: Operations error in /var/www/test-drupal-4.7.2/modules/contrib/ldap_integration/ldap_integration/LDAPInterface.php on line 124.

While running your old code base with this patch applied I was not encountering this error, so I'm assuming that there's a fix in there somewhere... I'll dig through and see if I can find it.

qwerty1234’s picture

The filter needs to be surrounded by parenthesis.

I modified the search() function when it calls ldap_search from:

  $x = ldap_search($this->connection, $base_dn, $filter, $attributes);

to:

  $x = ldap_search($this->connection, $base_dn, "(".$filter.")", $attributes);

.. worked for me. hope it helps.

pablobm’s picture

As I cannot work on this now (until f###ing Acer repairs my laptop), please feel free to commit any appropriate fixes to the code, such as this. Just try to follow the conventions I use in the code, if possible.

By the way, I'd rather use the form "($filter)". It would read then as:

$x = ldap_search($this->connection, $base_dn, "($filter)", $attributes);

Thanks for your patience.

steckels00’s picture

Following up on this, tried to institute patches listed previously without any luck. I'm successfully using the same server for LDAP authentication with GLPI, so can rule out that problem on my end at least. Some of our OU's have spaces so I used one that does not for testing. I'm not much of a PHP'er but willing to help with testing environment if you need it. Hope your laptops back up to snuff!

I'm using->
Drupal 4.7.3
PHP 5.5.1
IIS 6.0

smithmb’s picture

Hi there,

I'm using Drupal 4.7.3, Windows 2003 AD, and PHP 5, and none of the 'fixes' posted so far seem to help with the error (the same error as others above):

ldap_search() [function.ldap-search]: Search: Operations error in /..../modules/ldap_integration/ldap_integration/LDAPInterface.php on line 127.

Adding quotations around the filter doesn't seem to help, but I'll be playing with this to see if there's another way around...

martins@bebr.ufl.edu

kreaper’s picture

Version: master » 4.7.x-1.0
Status: Active » Closed (won't fix)

This is an LDAP issue. If using AD, make sure to check TLS option and also make sure your bind dn and bindpw are correct.

netkeeper’s picture

Status: Closed (won't fix) » Fixed
StatusFileSize
new1.51 KB

http://bugs.php.net/bug.php?id=30670&edit=2

The error actually lies within 2003 AD by adding the following code between the connect and bind fucntions it works correctly, but as I have found it has a limitation of 1000 search results.

ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION,3);
ldap_set_option($ds, LDAP_OPT_REFERRALS,0);

Updated ldaptest.php attached

Anonymous’s picture

Status: Fixed » Closed (fixed)