mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-01 12:39:35 -05:00
missing or empty attrs list in a syncrepl specification
is changed to mean attrs="*"
This commit is contained in:
parent
9459a7f535
commit
a0331a0487
1 changed files with 37 additions and 21 deletions
|
|
@ -405,29 +405,23 @@ do_syncrepl(
|
|||
|
||||
psub = be->be_nsuffix[0];
|
||||
|
||||
/* Delete Attributes */
|
||||
descs = sync_descs;
|
||||
for ( n = 0; si->attrs[ n ] != NULL; n++ ) ;
|
||||
|
||||
for ( i = 0; descs[i] != NULL; i++ ) {
|
||||
for ( j = 0; si->attrs[j] != NULL; j++ ) {
|
||||
if ( !strcmp( si->attrs[j], descs[i]->ad_cname.bv_val )) {
|
||||
ch_free( si->attrs[j] );
|
||||
for ( k = j; si->attrs[k] != NULL; k++ ) {
|
||||
si->attrs[k] = si->attrs[k+1];
|
||||
if ( n != 0 ) {
|
||||
/* Delete Attributes */
|
||||
descs = sync_descs;
|
||||
for ( i = 0; descs[i] != NULL; i++ ) {
|
||||
for ( j = 0; si->attrs[j] != NULL; j++ ) {
|
||||
if ( !strcmp( si->attrs[j], descs[i]->ad_cname.bv_val )) {
|
||||
ch_free( si->attrs[j] );
|
||||
for ( k = j; si->attrs[k] != NULL; k++ ) {
|
||||
si->attrs[k] = si->attrs[k+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Add Attributes */
|
||||
|
||||
for ( n = 0; si->attrs[ n ] != NULL; n++ ) ;
|
||||
|
||||
descs = sync_descs;
|
||||
|
||||
for ( i = 0; descs[i] != NULL; i++ ) {
|
||||
tmp = ( char ** ) ch_realloc( si->attrs,
|
||||
( n + 3 ) * sizeof( char * ));
|
||||
for ( n = 0; si->attrs[ n ] != NULL; n++ );
|
||||
tmp = ( char ** ) ch_realloc( si->attrs, ( n + 4 ) * sizeof( char * ));
|
||||
if ( tmp == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ERR, "out of memory\n", 0,0,0 );
|
||||
|
|
@ -435,7 +429,24 @@ do_syncrepl(
|
|||
Debug( LDAP_DEBUG_ANY, "out of memory\n", 0,0,0 );
|
||||
#endif
|
||||
}
|
||||
si->attrs = tmp;
|
||||
} else {
|
||||
tmp = ( char ** ) ch_realloc( si->attrs, 5 * sizeof( char * ));
|
||||
if ( tmp == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ERR, "out of memory\n", 0,0,0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY, "out of memory\n", 0,0,0 );
|
||||
#endif
|
||||
}
|
||||
tmp[ n++ ] = ch_strdup( "*" );
|
||||
}
|
||||
|
||||
descs = sync_descs;
|
||||
si->attrs = tmp;
|
||||
|
||||
/* Add Attributes */
|
||||
|
||||
for ( i = 0; descs[ i ] != NULL; i++ ) {
|
||||
si->attrs[ n++ ] = ch_strdup ( descs[i]->ad_cname.bv_val );
|
||||
si->attrs[ n ] = NULL;
|
||||
}
|
||||
|
|
@ -1618,10 +1629,15 @@ str2clist( char ***out, char *in, const char *brkstr )
|
|||
|
||||
/* find last element in list */
|
||||
for (i = 0; *out && *out[i]; i++);
|
||||
|
||||
|
||||
/* protect the input string from strtok */
|
||||
str = ch_strdup( in );
|
||||
|
||||
if ( *str == '\0' ) {
|
||||
free( str );
|
||||
return( *out );
|
||||
}
|
||||
|
||||
/* Count words in string */
|
||||
j=1;
|
||||
for ( s = str; *s; s++ ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue