mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-03 12:30:29 -05:00
ITS#10374 pcache: fix config emit of noattr attrset
Support for configuring an empty attrset was added in add25c2f45
for ITS#5074 but code to emit the config wasn't updated accordingly.
This commit is contained in:
parent
216562d19d
commit
0ff74659c0
1 changed files with 30 additions and 21 deletions
|
|
@ -3880,32 +3880,41 @@ pc_cf_gen( ConfigArgs *c )
|
|||
break;
|
||||
case PC_ATTR:
|
||||
for (i=0; i<cm->numattrsets; i++) {
|
||||
if ( !qm->attr_sets[i].count ) continue;
|
||||
if ( !(qm->attr_sets[i].flags & PC_CONFIGURED) ) continue;
|
||||
|
||||
bv.bv_len = snprintf( c->cr_msg, sizeof( c->cr_msg ), "%d", i );
|
||||
|
||||
/* count the attr length */
|
||||
for ( attr_name = qm->attr_sets[i].attrs;
|
||||
attr_name->an_name.bv_val; attr_name++ )
|
||||
{
|
||||
bv.bv_len += attr_name->an_name.bv_len + 1;
|
||||
if ( attr_name->an_desc &&
|
||||
( attr_name->an_desc->ad_flags & SLAP_DESC_TEMPORARY ) ) {
|
||||
bv.bv_len += STRLENOF("undef:");
|
||||
}
|
||||
}
|
||||
|
||||
bv.bv_val = ch_malloc( bv.bv_len+1 );
|
||||
ptr = lutil_strcopy( bv.bv_val, c->cr_msg );
|
||||
for ( attr_name = qm->attr_sets[i].attrs;
|
||||
attr_name->an_name.bv_val; attr_name++ ) {
|
||||
if ( !qm->attr_sets[i].count ) {
|
||||
bv.bv_len += sizeof( LDAP_NO_ATTRS );
|
||||
bv.bv_val = ch_malloc( bv.bv_len+1 );
|
||||
ptr = lutil_strcopy( bv.bv_val, c->cr_msg );
|
||||
*ptr++ = ' ';
|
||||
if ( attr_name->an_desc &&
|
||||
( attr_name->an_desc->ad_flags & SLAP_DESC_TEMPORARY ) ) {
|
||||
ptr = lutil_strcopy( ptr, "undef:" );
|
||||
lutil_strcopy( ptr, LDAP_NO_ATTRS );
|
||||
} else {
|
||||
|
||||
/* count the attr length */
|
||||
for ( attr_name = qm->attr_sets[i].attrs;
|
||||
attr_name->an_name.bv_val; attr_name++ )
|
||||
{
|
||||
bv.bv_len += attr_name->an_name.bv_len + 1;
|
||||
if ( attr_name->an_desc &&
|
||||
( attr_name->an_desc->ad_flags & SLAP_DESC_TEMPORARY ) ) {
|
||||
bv.bv_len += STRLENOF("undef:");
|
||||
}
|
||||
}
|
||||
|
||||
bv.bv_val = ch_malloc( bv.bv_len+1 );
|
||||
ptr = lutil_strcopy( bv.bv_val, c->cr_msg );
|
||||
for ( attr_name = qm->attr_sets[i].attrs;
|
||||
attr_name->an_name.bv_val; attr_name++ ) {
|
||||
*ptr++ = ' ';
|
||||
if ( attr_name->an_desc &&
|
||||
( attr_name->an_desc->ad_flags & SLAP_DESC_TEMPORARY ) ) {
|
||||
ptr = lutil_strcopy( ptr, "undef:" );
|
||||
}
|
||||
ptr = lutil_strcopy( ptr, attr_name->an_name.bv_val );
|
||||
}
|
||||
ptr = lutil_strcopy( ptr, attr_name->an_name.bv_val );
|
||||
}
|
||||
|
||||
ber_bvarray_add( &c->rvalue_vals, &bv );
|
||||
}
|
||||
if ( !c->rvalue_vals )
|
||||
|
|
|
|||
Loading…
Reference in a new issue