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

Search responses with incorrect msgId

Hi all,

My application is an ldap client based on openLdap suite. I'm having problems when receiving search responses with incorrect msgId. The problem is: always returns error -1 being impossible to discriminate other situations like remote server close. The application always detach the connection fd when -1 is received (99% is broken connection). But we don't want to do close this when "receive a search response with out-of-context msgId" (usually "out-of-time search result entries" after sending AbandonRequest from client).

I can't use ldap_msgid, because 'LDAPMessage*' is NULL and causes abort()
(anyway, no special result code is specified for this situation at ldap_msgid API description).

My code:
  LDAP* handle = (LDAP*) a_ldap;
  LDAPMessage* hmessage (NULL);
resultCode = ldap_result (handle, LDAP_RES_ANY, LDAP_MSG_ONE, NULL, &hmessage);

// I test the following, hoping result is not -1 with LDAP_RES_UNSOLICITED, but it returned -1 again...
  if (resultCode.getValue () == -1)
resultCode = ldap_result (handle, LDAP_RES_UNSOLICITED, LDAP_MSG_ONE, NULL, &hmessage);

¿do you know any other way to identify responses with incorrect msgid?