]> git.sur5r.net Git - openldap/commitdiff
work around the last issue: some times the result times out while the other party...
authorPierangelo Masarati <ando@openldap.org>
Tue, 26 Apr 2005 10:02:19 +0000 (10:02 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 26 Apr 2005 10:02:19 +0000 (10:02 +0000)
servers/slapd/back-meta/bind.c
servers/slapd/back-meta/config.c

index ef8484172ae346c2464ce3c181b9b209831d4920..f0e0c5002453b7055023d95b517fdd73b0e66073 100644 (file)
@@ -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,
index a5ec9a63a8a4e8a753d7d560e6e5341a23f4d8d6..6281f37c7beb9e4f117c2a60100088bf30b10cda 100644 (file)
@@ -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;
 }