ber_int_t origid,
ber_int_t msgid,
LDAPControl **sctrls,
- LDAPControl **cctrls,
- int lock));
+ LDAPControl **cctrls));
/*
* ldap_abandon_ext - perform an ldap extended abandon operation.
#endif
/* check client controls */
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
+#endif
rc = ldap_int_client_controls( ld, cctrls );
- if( rc != LDAP_SUCCESS ) return rc;
+ if( rc == LDAP_SUCCESS )
+ rc = do_abandon( ld, msgid, msgid, sctrls, cctrls );
- return do_abandon( ld, msgid, msgid, sctrls, cctrls, 1 );
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+#endif
+ return rc;
}
ber_int_t origid,
ber_int_t msgid,
LDAPControl **sctrls,
- LDAPControl **cctrls,
- int lock)
+ LDAPControl **cctrls)
{
BerElement *ber;
int i, err, sendabandon;
sendabandon = 1;
-#ifdef LDAP_R_COMPILE
- if ( lock ) ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
/* find the request that we are abandoning */
for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) {
if ( lr->lr_msgid == msgid ) { /* this message */
}
if ( lr->lr_origid == msgid ) {/* child: abandon it */
(void) do_abandon( ld,
- msgid, lr->lr_msgid, sctrls, cctrls, 0 );
+ msgid, lr->lr_msgid, sctrls, cctrls );
}
}
-#ifdef LDAP_R_COMPILE
- if ( lock ) ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
if ( lr != NULL ) {
if ( origid == msgid && lr->lr_parent != NULL ) {
}
}
- if ( ldap_msgdelete( ld, msgid ) == 0 ) {
+/* ldap_msgdelete locks the res_mutex. Give up the req_mutex
+ * while we're in there.
+ */
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+#endif
+ err = ldap_msgdelete( ld, msgid );
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
+#endif
+ if ( err == 0 ) {
ld->ld_errno = LDAP_SUCCESS;
return LDAP_SUCCESS;
}
ld->ld_errno = LDAP_NO_MEMORY;
} else {
+ LDAP_NEXT_MSGID(ld, i);
#ifdef LDAP_CONNECTIONLESS
if ( LDAP_IS_UDP(ld) ) {
err = ber_write( ber, ld->ld_options.ldo_peer,
char *dn = ld->ld_options.ldo_cldapdn;
if (!dn) dn = "";
err = ber_printf( ber, "{isti", /* '}' */
- ++ld->ld_msgid, dn,
+ i, dn,
LDAP_REQ_ABANDON, msgid );
} else
#endif
{
/* create a message to send */
err = ber_printf( ber, "{iti", /* '}' */
- ++ld->ld_msgid,
+ i,
LDAP_REQ_ABANDON, msgid );
}
sb = ld->ld_sb;
}
-#ifdef LDAP_R_COMPILE
- if ( lock ) ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
if ( ber_flush( sb, ber, 1 ) != 0 ) {
ld->ld_errno = LDAP_SERVER_DOWN;
err = -1;
} else {
err = 0;
}
-#ifdef LDAP_R_COMPILE
- if ( lock ) ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
}
}
}
{
BerElement *ber;
int i, rc;
+ ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_add_ext\n", 0, 0, 0 );
return ld->ld_errno;
}
+ LDAP_NEXT_MSGID(ld, id);
rc = ber_printf( ber, "{it{s{", /* '}}}' */
- ++ld->ld_msgid, LDAP_REQ_ADD, dn );
+ id, LDAP_REQ_ADD, dn );
if ( rc == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
}
/* send the message */
- *msgidp = ldap_send_initial_request( ld, LDAP_REQ_ADD, dn, ber );
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_ADD, dn, ber, id );
if(*msgidp < 0)
return ld->ld_errno;
{
int rc;
BerElement *ber;
+ ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_compare\n", 0, 0, 0 );
return( LDAP_NO_MEMORY );
}
- if ( ber_printf( ber, "{it{s{sON}N}", /* '}' */
- ++ld->ld_msgid,
- LDAP_REQ_COMPARE, dn, attr, bvalue ) == -1 )
+ LDAP_NEXT_MSGID(ld, id);
+ rc = ber_printf( ber, "{it{s{sON}N}", /* '}' */
+ id,
+ LDAP_REQ_COMPARE, dn, attr, bvalue );
+ if ( rc == -1 )
{
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
/* send the message */
- *msgidp = ldap_send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber );
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber, id );
return ( *msgidp < 0 ? ld->ld_errno : LDAP_SUCCESS );
}
{
int rc;
BerElement *ber;
+ ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_delete_ext\n", 0,0,0 );
return( ld->ld_errno );
}
- if ( ber_printf( ber, "{its", /* '}' */
- ++ld->ld_msgid, LDAP_REQ_DELETE, dn ) == -1 )
+ LDAP_NEXT_MSGID( ld, id );
+ rc = ber_printf( ber, "{its", /* '}' */
+ id, LDAP_REQ_DELETE, dn );
+ if ( rc == -1 )
{
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
}
/* send the message */
- *msgidp = ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber );
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber, id );
if(*msgidp < 0)
return ld->ld_errno;
if(referralsp != NULL) *referralsp = NULL;
if(serverctrls != NULL) *serverctrls = NULL;
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
+#endif
/* Find the next result... */
for ( lm = r; lm != NULL; lm = lm->lm_chain ) {
/* skip over entries and references */
if( lm == NULL ) {
ld->ld_errno = LDAP_NO_RESULTS_RETURNED;
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
+#endif
return ld->ld_errno;
}
if ( freeit ) {
ldap_msgfree( r );
}
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
+#endif
return( errcode );
}
{
BerElement *ber;
int rc;
+ ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_extended_operation\n", 0,0,0 );
return( ld->ld_errno );
}
+ LDAP_NEXT_MSGID( ld, id );
if ( reqdata != NULL ) {
rc = ber_printf( ber, "{it{tstON}", /* '}' */
- ++ld->ld_msgid, LDAP_REQ_EXTENDED,
+ id, LDAP_REQ_EXTENDED,
LDAP_TAG_EXOP_REQ_OID, reqoid,
LDAP_TAG_EXOP_REQ_VALUE, reqdata );
} else {
rc = ber_printf( ber, "{it{tsN}", /* '}' */
- ++ld->ld_msgid, LDAP_REQ_EXTENDED,
+ id, LDAP_REQ_EXTENDED,
LDAP_TAG_EXOP_REQ_OID, reqoid );
}
}
/* send the message */
- *msgidp = ldap_send_initial_request( ld, LDAP_REQ_EXTENDED, NULL, ber );
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_EXTENDED, NULL, ber, id );
return( *msgidp < 0 ? ld->ld_errno : LDAP_SUCCESS );
}
char *cred;
int rc;
ber_len_t credlen;
+ ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_kerberos_bind1\n", 0, 0, 0 );
return( -1 );
}
+ LDAP_NEXT_MSGID( ld, id );
/* fill it in */
- rc = ber_printf( ber, "{it{istoN}N}", ++ld->ld_msgid, LDAP_REQ_BIND,
+ rc = ber_printf( ber, "{it{istoN}N}", id, LDAP_REQ_BIND,
ld->ld_version, dn, LDAP_AUTH_KRBV41, cred, credlen );
if ( rc == -1 ) {
/* send the message */
- return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber, id ));
}
int
char *cred;
int rc;
ber_len_t credlen;
+ ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_kerberos_bind2\n", 0, 0, 0 );
return( -1 );
}
+ LDAP_NEXT_MSGID( ld, id );
/* fill it in */
- rc = ber_printf( ber, "{it{istoN}N}", ++ld->ld_msgid, LDAP_REQ_BIND,
+ rc = ber_printf( ber, "{it{istoN}N}", id, LDAP_REQ_BIND,
ld->ld_version, dn, LDAP_AUTH_KRBV42, cred, credlen );
-
LDAP_FREE( cred );
if ( rc == -1 ) {
}
/* send the message */
- return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber, id ));
}
/* synchronous bind to DSA using kerberos */
#endif
#endif
+#ifdef LDAP_R_COMPILE
+#define LDAP_NEXT_MSGID(ld, id) \
+ ldap_pvt_thread_mutex_lock( &(ld)->ld_req_mutex ); \
+ id = ++(ld)->ld_msgid; \
+ ldap_pvt_thread_mutex_unlock( &(ld)->ld_req_mutex )
+#else
+#define LDAP_NEXT_MSGID(ld, id) id = ++(ld)->ld_msgid
+#endif
+
/*
* in init.c
*/
* in request.c
*/
LDAP_F (ber_int_t) ldap_send_initial_request( LDAP *ld, ber_tag_t msgtype,
- const char *dn, BerElement *ber );
+ const char *dn, BerElement *ber, ber_int_t msgid );
LDAP_F (BerElement *) ldap_alloc_ber_with_options( LDAP *ld );
LDAP_F (void) ldap_set_ber_options( LDAP *ld, BerElement *ber );
LDAPControl **sctrls,
LDAPControl **cctrls,
ber_int_t timelimit,
- ber_int_t sizelimit ));
+ ber_int_t sizelimit,
+ ber_int_t *msgidp));
/*
{
BerElement *ber;
int i, rc;
+ ber_int_t id;
/*
* A modify request looks like this:
return( LDAP_NO_MEMORY );
}
- if ( ber_printf( ber, "{it{s{" /*}}}*/, ++ld->ld_msgid, LDAP_REQ_MODIFY, dn )
- == -1 ) {
+ LDAP_NEXT_MSGID( ld, id );
+ rc = ber_printf( ber, "{it{s{" /*}}}*/, id, LDAP_REQ_MODIFY, dn );
+ if ( rc == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
return( ld->ld_errno );
}
/* send the message */
- *msgidp = ldap_send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber );
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber, id );
return( *msgidp < 0 ? ld->ld_errno : LDAP_SUCCESS );
}
{
BerElement *ber;
int rc;
+ ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_rename\n", 0, 0, 0 );
return( LDAP_NO_MEMORY );
}
+ LDAP_NEXT_MSGID( ld, id );
if( newSuperior != NULL ) {
/* must be version 3 (or greater) */
if ( ld->ld_version < LDAP_VERSION3 ) {
ber_free( ber, 1 );
return( ld->ld_errno );
}
-
rc = ber_printf( ber, "{it{ssbtsN}", /* '}' */
- ++ld->ld_msgid, LDAP_REQ_MODDN,
+ id, LDAP_REQ_MODDN,
dn, newrdn, (ber_int_t) deleteoldrdn,
LDAP_TAG_NEWSUPERIOR, newSuperior );
} else {
rc = ber_printf( ber, "{it{ssbN}", /* '}' */
- ++ld->ld_msgid, LDAP_REQ_MODDN,
+ id, LDAP_REQ_MODDN,
dn, newrdn, (ber_int_t) deleteoldrdn );
}
}
/* send the message */
- *msgidp = ldap_send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber );
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber, id );
if( *msgidp < 0 ) {
return( ld->ld_errno );
LDAP *ld,
ber_tag_t msgtype,
const char *dn,
- BerElement *ber )
+ BerElement *ber,
+ ber_int_t msgid)
{
LDAPURLDesc *servers;
int rc;
return LDAP_PARAM_ERROR;
}
#endif
- rc = ldap_send_server_request( ld, ber, ld->ld_msgid, NULL,
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
+#endif
+ rc = ldap_send_server_request( ld, ber, msgid, NULL,
servers, NULL, NULL );
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+#endif
if (servers)
ldap_free_urllist(servers);
return(rc);
* request to be in WRITING state.
*/
rc = 0;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
if ( ld->ld_requests &&
ld->ld_requests->lr_status == LDAP_REQST_WRITING &&
ldap_int_flush_request( ld, ld->ld_requests ) < 0 ) {
rc = -1;
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
if ( rc ) return rc;
if (( lr = (LDAPRequest *)LDAP_CALLOC( 1, sizeof( LDAPRequest ))) ==
lr->lr_origid = lr->lr_msgid;
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
if (( lr->lr_next = ld->ld_requests ) != NULL ) {
lr->lr_next->lr_prev = lr;
}
if ( ldap_int_flush_request( ld, lr ) == -1 ) {
msgid = -1;
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
return( msgid );
}
}
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
#endif
fprintf( stderr, "** Response Queue:\n" );
if (( lm = ld->ld_responses ) == NULL ) {
}
}
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
}
#endif /* LDAP_DEBUG */
srv->lud_dn = LDAP_STRDUP( "" );
}
- ber = re_encode_request( ld, origreq->lr_ber, ++ld->ld_msgid,
+ LDAP_NEXT_MSGID( ld, rc );
+ ber = re_encode_request( ld, origreq->lr_ber, rc,
sref, srv, &rinfo.ri_request );
if( ber == NULL ) {
/* Send the new request to the server - may require a bind */
rinfo.ri_msgid = origreq->lr_origid;
rinfo.ri_url = refarray[i];
- if ( (rc = ldap_send_server_request( ld, ber, ld->ld_msgid,
- origreq, srv, NULL, &rinfo )) < 0 ) {
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
+#endif
+ rc = ldap_send_server_request( ld, ber, ld->ld_msgid,
+ origreq, srv, NULL, &rinfo );
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+#endif
+ if ( rc < 0 ) {
/* Failure, try next referral in the list */
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ERR,
*hadrefp = 1;
+ LDAP_NEXT_MSGID( ld, rc );
ber = re_encode_request( ld, origreq->lr_ber,
- ++ld->ld_msgid, sref, srv, &rinfo.ri_request );
+ rc, sref, srv, &rinfo.ri_request );
if( ber == NULL ) {
return -1 ;
rinfo.ri_msgid = origreq->lr_origid;
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
+#endif
rc = ldap_send_server_request( ld, ber, ld->ld_msgid,
lr, srv, NULL, &rinfo );
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+#endif
LDAP_FREE( rinfo.ri_url );
LDAPMessage **result )
{
LDAPMessage *lm;
+ int rc;
assert( ld != NULL );
assert( result != NULL );
Debug( LDAP_DEBUG_TRACE, "ldap_result msgid %d\n", msgid, 0, 0 );
#endif
- lm = chkResponseList(ld, msgid, all);
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
+#endif
+ lm = chkResponseList(ld, msgid, all);
if ( lm == NULL ) {
- return( wait4msg( ld, msgid, all, timeout, result ) );
+ rc = wait4msg( ld, msgid, all, timeout, result );
+ } else {
+ *result = lm;
+ ld->ld_errno = LDAP_SUCCESS;
+ rc = lm->lm_msgtype;
}
-
- *result = lm;
- ld->ld_errno = LDAP_SUCCESS;
- return( lm->lm_msgtype );
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
+#endif
+ return( rc );
}
static LDAPMessage *
msgid, all, 0 );
#endif
lastlm = NULL;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
-#endif
for ( lm = ld->ld_responses; lm != NULL; lm = nextlm ) {
nextlm = lm->lm_next;
}
lm->lm_next = NULL;
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
#ifdef LDAP_DEBUG
if( lm == NULL) {
}
if ( lc == NULL ) {
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
-#endif
rc = ldap_int_select( ld, tvp );
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
+ ldap_pvt_thread_yield();
+ ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
#endif
-
-
#ifdef LDAP_DEBUG
if ( rc == -1 ) {
#ifdef NEW_LOGGING
#endif
retry:
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
-#endif
if ( lc->lconn_ber == NULL ) {
lc->lconn_ber = ldap_alloc_ber_with_options(ld);
if( lc->lconn_ber == NULL ) {
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
return -1;
}
}
*/
lc->lconn_ber = NULL;
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
if ( tag != LDAP_TAG_MESSAGE ) {
if ( tag == LBER_DEFAULT) {
#ifdef LDAP_DEBUG
* search response.
*/
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
-#endif
prev = NULL;
for ( l = ld->ld_responses; l != NULL; l = l->lm_next ) {
if ( l->lm_msgid == new->lm_msgid )
}
leave:
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
if ( foundit ) {
ld->ld_errno = LDAP_SUCCESS;
return( tag );
{
BerElement *ber;
int rc;
+ ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( TRANSPORT, ENTRY, "ldap_sasl_bind\n", 0, 0, 0 );
assert( LBER_VALID( ber ) );
+ LDAP_NEXT_MSGID( ld, id );
if( mechanism == LDAP_SASL_SIMPLE ) {
/* simple bind */
rc = ber_printf( ber, "{it{istON}" /*}*/,
- ++ld->ld_msgid, LDAP_REQ_BIND,
+ id, LDAP_REQ_BIND,
ld->ld_version, dn, LDAP_AUTH_SIMPLE,
cred );
} else if ( cred == NULL || cred->bv_val == NULL ) {
/* SASL bind w/o creditials */
rc = ber_printf( ber, "{it{ist{sN}N}" /*}*/,
- ++ld->ld_msgid, LDAP_REQ_BIND,
+ id, LDAP_REQ_BIND,
ld->ld_version, dn, LDAP_AUTH_SASL,
mechanism );
} else {
/* SASL bind w/ creditials */
rc = ber_printf( ber, "{it{ist{sON}N}" /*}*/,
- ++ld->ld_msgid, LDAP_REQ_BIND,
+ id, LDAP_REQ_BIND,
ld->ld_version, dn, LDAP_AUTH_SASL,
mechanism, cred );
}
/* send the message */
- *msgidp = ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber );
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber, id );
if(*msgidp < 0)
return ld->ld_errno;
int rc;
BerElement *ber;
int timelimit;
+ ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_search_ext\n", 0, 0, 0 );
}
ber = ldap_build_search_req( ld, base, scope, filter, attrs,
- attrsonly, sctrls, cctrls, timelimit, sizelimit );
+ attrsonly, sctrls, cctrls, timelimit, sizelimit, &id );
if ( ber == NULL ) {
return ld->ld_errno;
/* send the message */
- *msgidp = ldap_send_initial_request( ld, LDAP_REQ_SEARCH, base, ber );
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_SEARCH, base, ber, id );
if( *msgidp < 0 )
return ld->ld_errno;
char **attrs, int attrsonly )
{
BerElement *ber;
+ ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_search\n", 0, 0, 0 );
assert( LDAP_VALID( ld ) );
ber = ldap_build_search_req( ld, base, scope, filter, attrs,
- attrsonly, NULL, NULL, -1, -1 );
+ attrsonly, NULL, NULL, -1, -1, &id );
if ( ber == NULL ) {
return( -1 );
/* send the message */
- return ( ldap_send_initial_request( ld, LDAP_REQ_SEARCH, base, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_SEARCH, base, ber, id ));
}
LDAPControl **sctrls,
LDAPControl **cctrls,
ber_int_t timelimit,
- ber_int_t sizelimit )
+ ber_int_t sizelimit,
+ ber_int_t *idp)
{
BerElement *ber;
- int err;
+ int err, id;
/*
* Create the search request. It looks like this:
}
}
+ LDAP_NEXT_MSGID( ld, *idp );
#ifdef LDAP_CONNECTIONLESS
if ( LDAP_IS_UDP(ld) ) {
err = ber_write( ber, ld->ld_options.ldo_peer,
if ( LDAP_IS_UDP(ld) && ld->ld_options.ldo_version == LDAP_VERSION2) {
char *dn = ld->ld_options.ldo_cldapdn;
if (!dn) dn = "";
- err = ber_printf( ber, "{ist{seeiib", ++ld->ld_msgid, dn,
+ err = ber_printf( ber, "{ist{seeiib", *idp, dn,
LDAP_REQ_SEARCH, base, (ber_int_t) scope, ld->ld_deref,
(sizelimit < 0) ? ld->ld_sizelimit : sizelimit,
(timelimit < 0) ? ld->ld_timelimit : timelimit,
} else
#endif
{
- err = ber_printf( ber, "{it{seeiib", ++ld->ld_msgid,
+ err = ber_printf( ber, "{it{seeiib", *idp,
LDAP_REQ_SEARCH, base, (ber_int_t) scope, ld->ld_deref,
(sizelimit < 0) ? ld->ld_sizelimit : sizelimit,
(timelimit < 0) ? ld->ld_timelimit : timelimit,
LDAPControl **cctrls )
{
BerElement *ber;
+ ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_send_unbind\n", 0, 0, 0 );
return( ld->ld_errno );
}
+ LDAP_NEXT_MSGID( ld, id );
/* fill it in */
- if ( ber_printf( ber, "{itn" /*}*/, ++ld->ld_msgid,
+ if ( ber_printf( ber, "{itn" /*}*/, id,
LDAP_REQ_UNBIND ) == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );