mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 00:29:35 -05:00
In ordered_value_sort, allow zero-length ordered values.
In check_vals, log msg when ordered_value_sort fails.
This commit is contained in:
parent
f8a97897ad
commit
ba881c5e6f
2 changed files with 13 additions and 4 deletions
|
|
@ -2909,8 +2909,11 @@ check_vals( ConfigTable *ct, ConfigArgs *ca, void *ptr, int isAttr )
|
|||
if ( a && ( ad->ad_type->sat_flags & SLAP_AT_ORDERED_VAL )) {
|
||||
sort = 1;
|
||||
rc = ordered_value_sort( a, 1 );
|
||||
if ( rc )
|
||||
if ( rc ) {
|
||||
sprintf(ca->msg, "ordered_value_sort failed on attr %s\n",
|
||||
ad->ad_cname.bv_val );
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
for ( i=0; vals[i].bv_val; i++ ) {
|
||||
ca->line = vals[i].bv_val;
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ ordered_value_sort( Attribute *a, int do_renumber )
|
|||
char *ptr;
|
||||
index = 1;
|
||||
ptr = strchr( a->a_vals[i].bv_val, '}' );
|
||||
if ( !ptr || !ptr[1] )
|
||||
if ( !ptr )
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
if ( noindex )
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
|
|
@ -361,8 +361,14 @@ ordered_value_sort( Attribute *a, int do_renumber )
|
|||
#endif
|
||||
|
||||
indexes = ch_malloc( vals * sizeof(int) );
|
||||
for ( i=0; i<vals; i++)
|
||||
indexes[i] = strtol(a->a_vals[i].bv_val+1, NULL, 0);
|
||||
for ( i=0; i<vals; i++) {
|
||||
char *ptr;
|
||||
indexes[i] = strtol(a->a_vals[i].bv_val+1, &ptr, 0);
|
||||
if ( *ptr != '}' ) {
|
||||
ch_free( indexes );
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
}
|
||||
|
||||
/* Insertion sort */
|
||||
for ( i=1; i<vals; i++ ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue