int code;
char *cname;
char *oid;
+ char *oidm = NULL;
if ( !OID_LEADCHAR( at->at_oid[0] )) {
/* Expand OID macros */
return SLAP_SCHERR_OIDM;
}
if ( oid != at->at_oid ) {
- ldap_memfree( at->at_oid );
+ oidm = at->at_oid;
at->at_oid = oid;
}
}
sat->sat_cname.bv_val = cname;
sat->sat_cname.bv_len = strlen( cname );
+ sat->sat_oidmacro = oidm;
ldap_pvt_thread_mutex_init(&sat->sat_ad_mutex);
if ( at->at_sup_oid ) {
}
i = 0;
for ( at=start; at; at=LDAP_STAILQ_NEXT(at, sat_next)) {
+ LDAPAttributeType lat, *latp;
if ( sys && !(at->sat_flags & SLAP_AT_HARDCODE)) continue;
- if ( ldap_attributetype2bv( &at->sat_atype, &bv ) == NULL ) {
+ if ( at->sat_oidmacro ) {
+ lat = at->sat_atype;
+ lat.at_oid = at->sat_oidmacro;
+ latp = ⪫
+ } else {
+ latp = &at->sat_atype;
+ }
+ if ( ldap_attributetype2bv( latp, &bv ) == NULL ) {
ber_bvarray_free( bva );
}
if ( !sys ) {
- idx.bv_len = sprintf(idx.bv_val, "{%02d}", i);
+ idx.bv_len = sprintf(idx.bv_val, "{%d}", i);
}
bva[i].bv_len = idx.bv_len + bv.bv_len;
bva[i].bv_val = ch_malloc( bva[i].bv_len + 1 );
ContentRule *scr;
int code;
int op = 0;
+ char *oidm = NULL;
if ( cr->cr_names != NULL ) {
int i;
return SLAP_SCHERR_OIDM;
}
if ( oid != cr->cr_oid ) {
- ldap_memfree( cr->cr_oid );
+ oidm = cr->cr_oid;
cr->cr_oid = oid;
}
}
scr = (ContentRule *) ch_calloc( 1, sizeof(ContentRule) );
AC_MEMCPY( &scr->scr_crule, cr, sizeof(LDAPContentRule) );
+ scr->scr_oidmacro = oidm;
scr->scr_sclass = oc_find(cr->cr_oid);
if ( !scr->scr_sclass ) {
*err = cr->cr_oid;
}
i = 0;
for ( cr=start; cr; cr=LDAP_STAILQ_NEXT(cr, scr_next)) {
+ LDAPContentRule lcr, *lcrp;
if ( sys && !(cr->scr_flags & SLAP_CR_HARDCODE)) continue;
- if ( ldap_contentrule2bv( &cr->scr_crule, &bv ) == NULL ) {
+ if ( cr->scr_oidmacro ) {
+ lcr = cr->scr_crule;
+ lcr.cr_oid = cr->scr_oidmacro;
+ lcrp = &lcr;
+ } else {
+ lcrp = &cr->scr_crule;
+ }
+ if ( ldap_contentrule2bv( lcrp, &bv ) == NULL ) {
ber_bvarray_free( bva );
}
if ( !sys ) {
- idx.bv_len = sprintf(idx.bv_val, "{%02d}", i);
+ idx.bv_len = sprintf(idx.bv_val, "{%d}", i);
}
bva[i].bv_len = idx.bv_len + bv.bv_len;
bva[i].bv_val = ch_malloc( bva[i].bv_len + 1 );
ObjectClass *soc;
int code;
int op = 0;
+ char *oidm = NULL;
if ( oc->oc_names != NULL ) {
int i;
return SLAP_SCHERR_OIDM;
}
if ( oid != oc->oc_oid ) {
- ldap_memfree( oc->oc_oid );
+ oidm = oc->oc_oid;
oc->oc_oid = oid;
}
}
soc = (ObjectClass *) ch_calloc( 1, sizeof(ObjectClass) );
AC_MEMCPY( &soc->soc_oclass, oc, sizeof(LDAPObjectClass) );
+ soc->soc_oidmacro = oidm;
if( oc->oc_names != NULL ) {
soc->soc_cname.bv_val = soc->soc_names[0];
} else {
}
i = 0;
for ( oc=start; oc; oc=LDAP_STAILQ_NEXT(oc, soc_next)) {
+ LDAPObjectClass loc, *locp;
if ( sys && !(oc->soc_flags & SLAP_OC_HARDCODE)) continue;
- if ( ldap_objectclass2bv( &oc->soc_oclass, &bv ) == NULL ) {
+ if ( oc->soc_oidmacro ) {
+ loc = oc->soc_oclass;
+ loc.oc_oid = oc->soc_oidmacro;
+ locp = &loc;
+ } else {
+ locp = &oc->soc_oclass;
+ }
+ if ( ldap_objectclass2bv( locp, &bv ) == NULL ) {
ber_bvarray_free( bva );
}
if ( !sys ) {
- idx.bv_len = sprintf(idx.bv_val, "{%02d}", i);
+ idx.bv_len = sprintf(idx.bv_val, "{%d}", i);
}
bva[i].bv_len = idx.bv_len + bv.bv_len;
bva[i].bv_val = ch_malloc( bva[i].bv_len + 1 );
if ( sys && !(om->som_flags & SLAP_OM_HARDCODE)) continue;
for ( j=0; !BER_BVISNULL(&om->som_names[j]); i++,j++ ) {
if ( !sys ) {
- idx.bv_len = sprintf(idx.bv_val, "{%02d}", i );
+ idx.bv_len = sprintf(idx.bv_val, "{%d}", i );
}
bva[i].bv_len = idx.bv_len + om->som_names[j].bv_len +
om->som_subs[j].bv_len + 1;
Syntax *sat_syntax;
AttributeTypeSchemaCheckFN *sat_check;
+ char *sat_oidmacro;
#define SLAP_AT_NONE 0x0000U
#define SLAP_AT_ABSTRACT 0x0100U /* cannot be instantiated */
AttributeType **soc_required;
AttributeType **soc_allowed;
ObjectClassSchemaCheckFN *soc_check;
+ char *soc_oidmacro;
slap_mask_t soc_flags;
#define soc_oid soc_oclass.oc_oid
#define soc_names soc_oclass.oc_names
#define scr_at_oids_may scr_crule.cr_at_oids_may
#define scr_at_oids_not scr_crule.cr_at_oids_not
+ char *scr_oidmacro;
#define SLAP_CR_HARDCODE 0x10000U
int scr_flags;