LDAP Abandon might work:
if (ldap_abandon(ld, 0, sctrls, cctrls) != LDAP_SUCCESS)
{
/* handle ldap error */
};
There was a discussion about this on the OpenLDAP mailing list:
http://www.openldap.org/lists/openldap-devel/200905/msg00008.html
In Brief:
The abandon request sends a message to the server, however the server does not send a response back to the client for abandon requests. Zero is not a valid MSGID for LDAP requests. Since the zero is an invalid MSGID and the server does not respond to abandon requests, in theory the server will ignore an abandon request for msgid zero. This would provide activity upon the TCP socket, preventing the firewall from dropping the connection.
See:
- RFC 4511, Section 4.11: Abandon Operation
- RFC 4511, Section 4.1.1.1: MessageID
https://www.rfc-editor.org/rfc/rfc4511