metasingleconn_t *msc = &mc->mc_conns[ candidate ];
int rc;
struct berval cred = BER_BVC( "" );
- int msgid;
+ int msgid,
+ rebinding = 0,
+ save_nretries = nretries;
/*
* Otherwise an anonymous bind is performed
}
rc = LDAP_BUSY;
- break;
+ if ( rebinding ) {
+ break;
+ }
+
+ /* FIXME: some times the request times out
+ * while the other party is not willing to
+ * send a response any more. Give it a second
+ * chance with a freshly bound connection */
+ rebinding = 1;
+ nretries = save_nretries;
+ /* fallthru */
case -1:
ldap_get_option( msc->msc_ld,
p = r + 1, i++ )
;
- res = ch_calloc( sizeof( char ), strlen( s ) + 4 + 4*i + 1 );
+ res = ch_calloc( sizeof( char ),
+ strlen( s )
+ + STRLENOF( "(.+,)?" )
+ + STRLENOF( "[ ]?" ) * i + 1 );
- ptr = lutil_strcopy( res, "(.*)" );
+ ptr = lutil_strcopy( res, "(.+,)?" );
for ( i = 0, p = s;
( r = strchr( p, ',' ) ) != NULL;
p = r + 1 , i++ ) {
len = strlen( s );
- res = ch_calloc( sizeof( char ), len + sizeof( "%1" ) );
+ res = ch_calloc( sizeof( char ), len + STRLENOF( "%1" ) + 1 );
if ( res == NULL ) {
return NULL;
}
strcpy( res, "%1" );
- strcpy( res + sizeof( "%1" ) - 1, s );
+ strcpy( &res[ STRLENOF( "%1" ) ], s );
return res;
}