prefix undef attrs with undef: (ITS#6823)

This commit is contained in:
Pierangelo Masarati 2011-02-02 21:45:34 +00:00
parent e72c093a55
commit 4e3eac93f7
2 changed files with 22 additions and 2 deletions

View file

@ -79,6 +79,7 @@ special attributes "*" (all user attributes), "+" (all operational attributes)
or both; in the latter case, any other attribute is redundant and should
be avoided for clarity. A set of attributes can contain "1.1" as the only
attribute; in this case, only the presence of the entries is cached.
Attributes prefixed by "undef:" need not be present in the schema.
.TP
.B pcacheMaxQueries <queries>

View file

@ -3763,13 +3763,21 @@ pc_cf_gen( ConfigArgs *c )
/* 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->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->ad_flags & SLAP_DESC_TEMPORARY ) {
ptr = lutil_strcopy( ptr, "undef:" );
}
ptr = lutil_strcopy( ptr, attr_name->an_name.bv_val );
}
ber_bvarray_add( &c->rvalue_vals, &bv );
@ -4025,7 +4033,12 @@ pc_cf_gen( ConfigArgs *c )
all_op = 1;
BER_BVSTR( &attr_name->an_name, LDAP_ALL_OPERATIONAL_ATTRIBUTES );
} else {
if ( slap_str2ad( c->argv[i], &attr_name->an_desc, &text ) ) {
if ( strncasecmp( c->argv[i], "undef:", STRLENOF("undef:") ) == 0 ) {
struct berval bv;
ber_str2bv( c->argv[i] + STRLENOF("undef:"), 0, 0, &bv );
attr_name->an_desc = slap_bv2tmp_ad( &bv, NULL );
} else if ( slap_str2ad( c->argv[i], &attr_name->an_desc, &text ) ) {
strcpy( c->cr_msg, text );
Debug( LDAP_DEBUG_CONFIG, "%s: %s.\n", c->log, c->cr_msg, 0 );
ch_free( qm->attr_sets[num].attrs );
@ -4793,7 +4806,13 @@ pcache_db_close(
free( tm );
}
for ( i=0; i<cm->numattrsets; i++ ) {
for ( i = 0; i < cm->numattrsets; i++ ) {
int j;
for ( j = 0; !BER_BVISNULL( &qm->attr_sets[i].attrs[j].an_name ); j++ ) {
if ( qm->attr_sets[i].attrs[j].an_desc->ad_flags & SLAP_DESC_TEMPORARY ) {
slap_sl_mfuncs.bmf_free( qm->attr_sets[i].attrs[j].an_desc, NULL );
}
}
free( qm->attr_sets[i].attrs );
}
free( qm->attr_sets );