ber_int_t origid,
ber_int_t msgid,
LDAPControl **sctrls,
- LDAPControl **cctrls)
+ LDAPControl **cctrls )
{
BerElement *ber;
int i, err, sendabandon;
- ber_int_t *old_abandon;
+ ber_int_t *old_abandon;
Sockbuf *sb;
LDAPRequest *lr;
i = ++(ld)->ld_msgid;
#ifdef LDAP_CONNECTIONLESS
if ( LDAP_IS_UDP(ld) ) {
- err = ber_write( ber, ld->ld_options.ldo_peer,
- sizeof(struct sockaddr), 0);
+ err = ber_write( ber, ld->ld_options.ldo_peer,
+ sizeof(struct sockaddr), 0);
}
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, "{isti", /* '}' */
- i, dn,
- LDAP_REQ_ABANDON, msgid );
+ LDAP_VERSION2 )
+ {
+ char *dn = ld->ld_options.ldo_cldapdn;
+ if (!dn) dn = "";
+ err = ber_printf( ber, "{isti", /* '}' */
+ i, dn,
+ LDAP_REQ_ABANDON, msgid );
} else
#endif
{
- /* create a message to send */
- err = ber_printf( ber, "{iti", /* '}' */
- i,
- LDAP_REQ_ABANDON, msgid );
+ /* create a message to send */
+ err = ber_printf( ber, "{iti", /* '}' */
+ i,
+ LDAP_REQ_ABANDON, msgid );
}
if( err == -1 ) {
{
BerElement *ber;
- if (( ber = ber_alloc_t( ld->ld_lberoptions )) == NULL ) {
+ ber = ber_alloc_t( ld->ld_lberoptions );
+ if ( ber == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
}
}
if ( rc ) return rc;
- lr = (LDAPRequest *)LDAP_CALLOC( 1, sizeof( LDAPRequest ));
+ lr = (LDAPRequest *)LDAP_CALLOC( 1, sizeof( LDAPRequest ) );
if ( lr == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
ldap_free_connection( ld, lc, 0, 0 );
if ( lsu_port == lcu_port
&& strcmp( lcu->lud_scheme, lsu->lud_scheme ) == 0
&& lcu->lud_host != NULL && *lcu->lud_host != '\0'
- && lsu->lud_host != NULL && *lsu->lud_host != '\0'
+ && lsu->lud_host != NULL && *lsu->lud_host != '\0'
&& strcasecmp( lsu->lud_host, lcu->lud_host ) == 0 )
{
found = 1;
for ( lc = lconns; lc != NULL; lc = lc->lconn_next ) {
if ( lc->lconn_server != NULL ) {
fprintf( stderr, "* host: %s port: %d%s\n",
- ( lc->lconn_server->lud_host == NULL ) ? "(null)"
- : lc->lconn_server->lud_host,
- lc->lconn_server->lud_port, ( lc->lconn_sb ==
- ld->ld_sb ) ? " (default)" : "" );
+ ( lc->lconn_server->lud_host == NULL ) ? "(null)"
+ : lc->lconn_server->lud_host,
+ lc->lconn_server->lud_port, ( lc->lconn_sb ==
+ ld->ld_sb ) ? " (default)" : "" );
}
fprintf( stderr, " refcnt: %d status: %s\n", lc->lconn_refcnt,
- ( lc->lconn_status == LDAP_CONNST_NEEDSOCKET ) ?
- "NeedSocket" : ( lc->lconn_status ==
- LDAP_CONNST_CONNECTING ) ? "Connecting" : "Connected" );
+ ( lc->lconn_status == LDAP_CONNST_NEEDSOCKET ) ?
+ "NeedSocket" : ( lc->lconn_status ==
+ LDAP_CONNST_CONNECTING ) ? "Connecting" : "Connected" );
fprintf( stderr, " last used: %s",
- ldap_pvt_ctime( &lc->lconn_lastused, timebuf ));
+ ldap_pvt_ctime( &lc->lconn_lastused, timebuf ));
if( lc->lconn_rebind_inprogress ) {
fprintf( stderr, " rebind in progress\n");
if( lc->lconn_rebind_queue != NULL) {
fprintf( stderr, " Empty\n" );
}
for ( ; lr != NULL; lr = lr->lr_next ) {
- fprintf( stderr, " * msgid %d, origid %d, status %s\n",
- lr->lr_msgid, lr->lr_origid,
- ( lr->lr_status == LDAP_REQST_INPROGRESS ) ? "InProgress" :
- ( lr->lr_status == LDAP_REQST_CHASINGREFS ) ? "ChasingRefs" :
- ( lr->lr_status == LDAP_REQST_NOTCONNECTED ) ? "NotConnected" :
- ( lr->lr_status == LDAP_REQST_WRITING ) ? "Writing" :
- ( lr->lr_status == LDAP_REQST_COMPLETED ) ? "RequestCompleted"
- : "InvalidStatus");
- fprintf( stderr, " outstanding referrals %d, parent count %d\n",
- lr->lr_outrefcnt, lr->lr_parentcnt );
+ fprintf( stderr, " * msgid %d, origid %d, status %s\n",
+ lr->lr_msgid, lr->lr_origid,
+ ( lr->lr_status == LDAP_REQST_INPROGRESS ) ? "InProgress" :
+ ( lr->lr_status == LDAP_REQST_CHASINGREFS ) ? "ChasingRefs" :
+ ( lr->lr_status == LDAP_REQST_NOTCONNECTED ) ? "NotConnected" :
+ ( lr->lr_status == LDAP_REQST_WRITING ) ? "Writing" :
+ ( lr->lr_status == LDAP_REQST_COMPLETED ) ? "RequestCompleted"
+ : "InvalidStatus");
+ fprintf( stderr, " outstanding referrals %d, parent count %d\n",
+ lr->lr_outrefcnt, lr->lr_parentcnt );
}
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
#endif
fprintf( stderr, "** ld %p Response Queue:\n", (void *)ld );
- if (( lm = ld->ld_responses ) == NULL ) {
+ if ( ( lm = ld->ld_responses ) == NULL ) {
fprintf( stderr, " Empty\n" );
}
for ( ; lm != NULL; lm = lm->lm_next ) {
fprintf( stderr, " * msgid %d, type %lu\n",
lm->lm_msgid, (unsigned long) lm->lm_msgtype );
- if (( l = lm->lm_chain ) != NULL ) {
+ if ( ( l = lm->lm_chain ) != NULL ) {
fprintf( stderr, " chained responses:\n" );
for ( ; l != NULL; l = l->lm_chain ) {
fprintf( stderr,
- " * msgid %d, type %lu\n",
- l->lm_msgid,
- (unsigned long) l->lm_msgtype );
+ " * msgid %d, type %lu\n",
+ l->lm_msgid,
+ (unsigned long) l->lm_msgtype );
}
}
}
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
#endif
for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) {
- if( lr->lr_status == LDAP_REQST_COMPLETED ) {
+ if ( lr->lr_status == LDAP_REQST_COMPLETED ) {
continue; /* Skip completed requests */
}
if ( msgid == lr->lr_msgid ) {
}
#endif /* LDAP_DEBUG */
- if ( (*result = chkResponseList(ld, msgid, all)) != NULL ) {
+ if ( ( *result = chkResponseList( ld, msgid, all ) ) != NULL ) {
rc = (*result)->lm_msgtype;
} else {
for ( lc = ld->ld_conns; lc != NULL; lc = nextlc ) {
nextlc = lc->lconn_next;
if ( ber_sockbuf_ctrl( lc->lconn_sb,
- LBER_SB_OPT_DATA_READY, NULL ) ) {
+ LBER_SB_OPT_DATA_READY, NULL ) )
+ {
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
#endif
if ( rc == 0 || ( rc == -1 && (
!LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_RESTART)
- || errno != EINTR )))
+ || errno != EINTR ) ) )
{
ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
LDAP_TIMEOUT);
{
nextlc = lc->lconn_next;
if ( lc->lconn_status == LDAP_CONNST_CONNECTED &&
- ldap_is_read_ready( ld, lc->lconn_sb ))
+ ldap_is_read_ready( ld, lc->lconn_sb ) )
{
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
retry:
if ( lc->lconn_ber == NULL ) {
- lc->lconn_ber = ldap_alloc_ber_with_options(ld);
+ lc->lconn_ber = ldap_alloc_ber_with_options( ld );
if( lc->lconn_ber == NULL ) {
return -1;
if ( LDAP_IS_UDP(ld) ) {
struct sockaddr from;
ber_int_sb_read( lc->lconn_sb, &from, sizeof(struct sockaddr) );
- if (ld->ld_options.ldo_version == LDAP_VERSION2) isv2=1;
+ if (ld->ld_options.ldo_version == LDAP_VERSION2) isv2 = 1;
}
nextresp3:
#endif
if ( lr == NULL ) {
Debug( LDAP_DEBUG_ANY,
"no request for response on ld %p msgid %ld (tossing)\n",
- (void *)ld, (long) id, 0 );
+ (void *)ld, (long)id, 0 );
goto retry_ber;
}
#ifdef LDAP_CONNECTIONLESS
if ( refer_cnt > 0 ) {
/* sucessfully chased reference */
/* If haven't got end search, set chasing referrals */
- if( lr->lr_status != LDAP_REQST_COMPLETED) {
+ if ( lr->lr_status != LDAP_REQST_COMPLETED ) {
lr->lr_status = LDAP_REQST_CHASINGREFS;
Debug( LDAP_DEBUG_TRACE,
"read1msg: search ref chased, "
* Note: refs arrary is freed by ldap_chase_v3referrals
*/
refer_cnt = ldap_chase_v3referrals( ld, lr, refs,
- 0, &lr->lr_res_error, &hadref );
+ 0, &lr->lr_res_error, &hadref );
lr->lr_status = LDAP_REQST_COMPLETED;
Debug( LDAP_DEBUG_TRACE,
"read1msg: referral chased, mark request completed, ld %p msgid %d\n",
!= LBER_ERROR )
{
if ( lr_res_error != NULL ) {
- {
- if ( lr->lr_res_error != NULL ) {
- (void)ldap_append_referral( ld, &lr->lr_res_error, lr_res_error );
- LDAP_FREE( (char *)lr_res_error );
- } else {
- lr->lr_res_error = lr_res_error;
- }
+ if ( lr->lr_res_error != NULL ) {
+ (void)ldap_append_referral( ld, &lr->lr_res_error, lr_res_error );
+ LDAP_FREE( (char *)lr_res_error );
+ } else {
+ lr->lr_res_error = lr_res_error;
}
lr_res_error = NULL;
}
/* Check if all requests are finished, lr is now parent */
tmplr = lr;
- if (tmplr->lr_status == LDAP_REQST_COMPLETED) {
+ if ( tmplr->lr_status == LDAP_REQST_COMPLETED ) {
for ( tmplr=lr->lr_child;
tmplr != NULL;
tmplr=tmplr->lr_refnext)
{
- if( tmplr->lr_status != LDAP_REQST_COMPLETED) break;
+ if ( tmplr->lr_status != LDAP_REQST_COMPLETED ) break;
}
}