]> git.sur5r.net Git - openldap/commitdiff
ITS#7902 fix str2entry / sorted vals
authorHoward Chu <hyc@openldap.org>
Wed, 23 Jul 2014 03:21:35 +0000 (20:21 -0700)
committerHoward Chu <hyc@openldap.org>
Wed, 23 Jul 2014 03:21:35 +0000 (20:21 -0700)
servers/slapd/entry.c

index f0da7a411d2d052eddf1d1430f7bb5ae308b148a..0d6291bbbd4224d086a7b41088dd1608db449493 100644 (file)
@@ -278,18 +278,6 @@ str2entry2( char *s, int checkvals )
        
                        if (( ad_prev && ad != ad_prev ) || ( i == lines )) {
                                int j, k;
-                               /* FIXME: we only need this when migrating from an unsorted DB */
-                               if ( atail != &ahead && atail->a_desc->ad_type->sat_flags & SLAP_AT_SORTED_VAL ) {
-                                       rc = slap_sort_vals( (Modifications *)atail, &text, &j, NULL );
-                                       if ( rc == LDAP_SUCCESS ) {
-                                               atail->a_flags |= SLAP_ATTR_SORTED_VALS;
-                                       } else if ( rc == LDAP_TYPE_OR_VALUE_EXISTS ) {
-                                               Debug( LDAP_DEBUG_ANY,
-                                                       "str2entry: attributeType %s value #%d provided more than once\n",
-                                                       atail->a_desc->ad_cname.bv_val, j, 0 );
-                                               goto fail;
-                                       }
-                               }
                                atail->a_next = attr_alloc( NULL );
                                atail = atail->a_next;
                                atail->a_flags = 0;
@@ -321,6 +309,18 @@ str2entry2( char *s, int checkvals )
                                        atail->a_nvals = atail->a_vals;
                                }
                                attr_cnt = 0;
+                               /* FIXME: we only need this when migrating from an unsorted DB */
+                               if ( atail->a_desc->ad_type->sat_flags & SLAP_AT_SORTED_VAL ) {
+                                       rc = slap_sort_vals( (Modifications *)atail, &text, &j, NULL );
+                                       if ( rc == LDAP_SUCCESS ) {
+                                               atail->a_flags |= SLAP_ATTR_SORTED_VALS;
+                                       } else if ( rc == LDAP_TYPE_OR_VALUE_EXISTS ) {
+                                               Debug( LDAP_DEBUG_ANY,
+                                                       "str2entry: attributeType %s value #%d provided more than once\n",
+                                                       atail->a_desc->ad_cname.bv_val, j, 0 );
+                                               goto fail;
+                                       }
+                               }
                                if ( i == lines ) break;
                        }