From: Pierangelo Masarati Date: Tue, 26 Apr 2005 10:02:19 +0000 (+0000) Subject: work around the last issue: some times the result times out while the other party... X-Git-Tag: OPENLDAP_AC_BP~792 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6b035aac3e74f8a39a38c5f5197523c0f126cd5d;p=openldap work around the last issue: some times the result times out while the other party is not willing to send any response; give it a second chance --- diff --git a/servers/slapd/back-meta/bind.c b/servers/slapd/back-meta/bind.c index ef8484172a..f0e0c50024 100644 --- a/servers/slapd/back-meta/bind.c +++ b/servers/slapd/back-meta/bind.c @@ -314,7 +314,9 @@ meta_back_single_dobind( 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 @@ -362,7 +364,17 @@ retry:; } 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, diff --git a/servers/slapd/back-meta/config.c b/servers/slapd/back-meta/config.c index a5ec9a63a8..6281f37c7b 100644 --- a/servers/slapd/back-meta/config.c +++ b/servers/slapd/back-meta/config.c @@ -837,9 +837,12 @@ suffix_massage_regexize( const char *s ) 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++ ) { @@ -863,13 +866,13 @@ suffix_massage_patternize( const char *s ) 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; }