X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fat.c;h=27facafff50b885212e29f62ec22abf0c11f39a5;hb=014ba5ac80497d02b83514f30dabe3824e9facdc;hp=7e28fb6663fa0332a27e2cb82871d231153e0e76;hpb=8a5b200c447a758d91805827593db72c54bea6e2;p=openldap diff --git a/servers/slapd/at.c b/servers/slapd/at.c index 7e28fb6663..27facafff5 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -338,7 +338,6 @@ at_add( ldap_memfree( at->at_syntax_oid ); at->at_syntax_oid = oid; } - } if ( at->at_names && at->at_names[0] ) { @@ -406,6 +405,11 @@ at_add( return SLAP_SCHERR_ATTR_BAD_USAGE; } + if ( supsat->sat_obsolete && !sat->sat_obsolete ) { + /* subtypes must be obsolete if super is */ + return SLAP_SCHERR_ATTR_BAD_SUP; + } + if ( sat->sat_flags & SLAP_AT_FINAL ) { /* cannot subtype a "final" attribute type */ return SLAP_SCHERR_ATTR_BAD_SUP; @@ -526,15 +530,23 @@ at_add( return SLAP_SCHERR_ATTR_BAD_MR; } -#if 0 - if( sat->sat_syntax != mr->smr_syntax ) { - if( mr->smr_compat_syntaxes == NULL ) { + /* due to funky LDAP builtin substring rules, we + * we check against the equality rule assertion + * syntax and compat syntaxes instead of those + * associated with the substrings rule. + */ + if( sat->sat_equality && + sat->sat_syntax != sat->sat_equality->smr_syntax ) + { + if( sat->sat_equality->smr_compat_syntaxes == NULL ) { *err = sat->sat_substr_oid; return SLAP_SCHERR_ATTR_BAD_MR; } - for(i=0; mr->smr_compat_syntaxes[i]; i++) { - if( sat->sat_syntax == mr->smr_compat_syntaxes[i] ) { + for(i=0; sat->sat_equality->smr_compat_syntaxes[i]; i++) { + if( sat->sat_syntax == + sat->sat_equality->smr_compat_syntaxes[i] ) + { i = -1; break; } @@ -545,7 +557,6 @@ at_add( return SLAP_SCHERR_ATTR_BAD_MR; } } -#endif sat->sat_substr = mr; } @@ -574,7 +585,6 @@ at_index_print( void ) } #endif -#if defined( SLAPD_SCHEMA_DN ) int at_schema_info( Entry *e ) { @@ -586,19 +596,15 @@ at_schema_info( Entry *e ) vals[1].bv_val = NULL; for ( at = attr_list; at; at = at->sat_next ) { + if( at->sat_flags & SLAP_AT_HIDE ) continue; + if ( ldap_attributetype2bv( &at->sat_atype, vals ) == NULL ) { return -1; } - if( at->sat_flags & SLAP_AT_HIDE ) continue; - -#if 0 - Debug( LDAP_DEBUG_TRACE, "Merging at [%ld] %s\n", - (long) vals[0].bv_len, vals[0].bv_val, 0 ); -#endif - attr_merge( e, ad_attributeTypes, vals ); + if( attr_merge( e, ad_attributeTypes, vals ) ) + return -1; ldap_memfree( vals[0].bv_val ); } return 0; } -#endif