[Date Prev][Date Next] [Chronological] [Thread] [Top]

Regarding ldap client library with php ldap exop patch



This is regarding the php ldap exop patch published by Pierangelo Masarati at :

http://www.sys-net.it/~ando/Download/#PHP%3E

I BADLY require paged results for my ldap based application. The patch applies fine to
PHP 5_2 HEAD. However, two things need to be changed.


1. the zstr struct does not exist, which needs to be defined. This is not a problem.
Solved with some help from PHP developers on what zstr is.


2. In the function php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) in
ldap.c, timelimit is set to -1 as follows:


int ldap_attrsonly = 0;
int ldap_sizelimit = -1;
int ldap_timelimit = -1;


The ldap_search operation keeps on returning a LDAP ERROR : Timeout in this case.
Modifying timelimit to :


int ldap_timelimit = 300;

for example fixes the issue and pagination works. I'm guessing the following is what
causes problems:


#ifdef HAVE_LDAP_SEARCH_EXT_S
/* Run the actual search */
{
int rc;
struct timeval tv;
tv.tv_sec = ldap_timelimit;
tv.tv_usec = 0;
rc = ldap_search_ext(ld->link, ldap_base_dn, scope,
ldap_filter, ldap_attrs, ldap_attrsonly,
NULL, NULL, &tv, ldap_sizelimit, &rcs[i] );
/* TODO: check rc == LDAP_SUCCESS */
}



the tv.tv_usec=0 when tv.tv_sec = -1

Just a hunch. How does ldap_search_ext handle timelimit? Thank you. I currently have it
set to 300, which is bad, and it seems to be working fine.


Please remember the problem (with the patch applied) happens not only to paged requests
but any ldap_search request (keeps timing out instantaneously)



-- Faraz R Khan Chief Architect Emergen Consulting Pvt Ltd www.emergen.biz