]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/entry.c
Add trickle-sync for quick mode
[openldap] / servers / slapd / entry.c
index 220d7a22f57bb0777d586fbeb457e23404bd246c..7f1461d24f2ac544c84475ac536269ca4014d5ac 100644 (file)
@@ -166,6 +166,11 @@ str2entry2( char *s, int checkvals )
                        break;
                }
                i++;
+               if (i >= lines) {
+                       Debug( LDAP_DEBUG_TRACE,
+                               "<= str2entry ran past end of entry\n", 0, 0, 0 );
+                       goto fail;
+               }
 
                rc = ldif_parse_line2( s, type+i, vals+i, &freev );
                freeval[i] = freev;
@@ -207,6 +212,8 @@ str2entry2( char *s, int checkvals )
                goto fail;
        }
 
+#define bvcasematch(bv1, bv2)  ( ((bv1)->bv_len == (bv2)->bv_len) && (strncasecmp((bv1)->bv_val, (bv2)->bv_val, (bv1)->bv_len) == 0) )
+
        /* Make sure all attributes with multiple values are contiguous */
        if ( checkvals ) {
                int j, k;
@@ -215,7 +222,7 @@ str2entry2( char *s, int checkvals )
 
                for (i=0; i<lines; i++) {
                        for ( j=i+1; j<lines; j++ ) {
-                               if ( bvmatch( type+i, type+j )) {
+                               if ( bvcasematch( type+i, type+j )) {
                                        /* out of order, move intervening attributes down */
                                        if ( j != i+1 ) {
                                                bv = vals[j];
@@ -238,7 +245,7 @@ str2entry2( char *s, int checkvals )
 
        for ( i=0; i<=lines; i++ ) {
                ad_prev = ad;
-               if ( !ad || ( i<lines && !bvmatch( type+i, &ad->ad_cname ))) {
+               if ( !ad || ( i<lines && !bvcasematch( type+i, &ad->ad_cname ))) {
                        ad = NULL;
                        rc = slap_bv2ad( type+i, &ad, &text );
 
@@ -500,10 +507,12 @@ entry_prealloc( int num )
 
        if (!num) return 0;
 
+#if STRIDE_FACTOR > 1
        /* Round up to our stride factor */
        num += STRIDE_FACTOR-1;
        num /= STRIDE_FACTOR;
        num *= STRIDE_FACTOR;
+#endif
 
        s = ch_calloc( 1, sizeof(slap_list) + num * sizeof(Entry));
        s->next = entry_chunks;