]> git.sur5r.net Git - openldap/commitdiff
prefix undef attrs with undef: (ITS#6823)
authorPierangelo Masarati <ando@openldap.org>
Wed, 2 Feb 2011 21:45:34 +0000 (21:45 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 8 Jun 2011 19:25:23 +0000 (12:25 -0700)
doc/man/man5/slapo-pcache.5
servers/slapd/overlays/pcache.c

index daff804e55f7ccd9e5903037fb05f4536817023a..ef8fb212ad210f3ad8dfe734e9b60b67953c9a98 100644 (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>
index 74d30cde614cf345657d673c7a7ac8187d4df951..cb03e3ed80710a22bc1f36a99e6608bee6bf70f1 100644 (file)
@@ -3765,13 +3765,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 );
@@ -4027,7 +4035,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 );
@@ -4795,7 +4808,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 );