]> git.sur5r.net Git - openldap/commitdiff
ITS#6950 Fix '1.1', '+' and '*' in pcacheAttrSets
authorRalf Haferkamp <ralf@openldap.org>
Tue, 24 May 2011 12:28:07 +0000 (14:28 +0200)
committerRalf Haferkamp <ralf@openldap.org>
Tue, 24 May 2011 12:35:03 +0000 (14:35 +0200)
servers/slapd/overlays/pcache.c

index cb03e3ed80710a22bc1f36a99e6608bee6bf70f1..cec3eca05ca8aa845da1b25ed8bf2c52fb7f34f4 100644 (file)
@@ -3767,7 +3767,8 @@ pc_cf_gen( ConfigArgs *c )
                                        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 ) {
+                                       if ( attr_name->an_desc &&
+                                                       ( attr_name->an_desc->ad_flags & SLAP_DESC_TEMPORARY ) ) {
                                                bv.bv_len += STRLENOF("undef:");
                                        }
                                }
@@ -3777,7 +3778,8 @@ pc_cf_gen( ConfigArgs *c )
                                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 ) {
+                                       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 );
@@ -4810,8 +4812,14 @@ pcache_db_close(
 
        for ( i = 0; i < cm->numattrsets; i++ ) {
                int j;
+
+               /* Account of LDAP_NO_ATTRS */
+               if ( !qm->attr_sets[i].count ) continue;
+
                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 ) {
+                       if ( qm->attr_sets[i].attrs[j].an_desc &&
+                                       ( 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 );
                        }
                }