From: Howard Chu Date: Sun, 9 Apr 2017 21:45:36 +0000 (+0100) Subject: Fix autoca schema init X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cff264c6e1b91632b1722506c022e519a216e422;p=openldap Fix autoca schema init Wait for core.schema to get loaded --- diff --git a/servers/slapd/overlays/autoca.c b/servers/slapd/overlays/autoca.c index 2762a4f26e..dab10cb681 100644 --- a/servers/slapd/overlays/autoca.c +++ b/servers/slapd/overlays/autoca.c @@ -964,6 +964,24 @@ autoca_db_open( if (slapMode & SLAP_TOOL_MODE) return 0; + if ( ! *aca_attr2[0].ad ) { + int i, code; + const char *text; + + for ( i=0; aca_attr2[i].at; i++ ) { + code = slap_str2ad( aca_attr2[i].at, aca_attr2[i].ad, &text ); + if ( code ) return code; + } + + /* Schema may not be loaded, ignore if missing */ + slap_str2ad( "ipHostNumber", &ad_ipaddr, &text ); + + for ( i=0; aca_ocs[i].ot; i++ ) { + code = register_oc( aca_ocs[i].ot, aca_ocs[i].oc, 0 ); + if ( code ) return code; + } + } + thrctx = ldap_pvt_thread_pool_context(); connection_fake_init2( &conn, &opbuf, thrctx, 0 ); op = &opbuf.ob_op; @@ -1069,19 +1087,6 @@ int autoca_initialize() { if ( code ) return code; } - for ( i=0; aca_attr2[i].at; i++ ) { - code = slap_str2ad( aca_attr2[i].at, aca_attr2[i].ad, &text ); - if ( code ) return code; - } - - /* Schema may not be loaded, ignore if missing */ - slap_str2ad( "ipHostNumber", &ad_ipaddr, &text ); - - for ( i=0; aca_ocs[i].ot; i++ ) { - code = register_oc( aca_ocs[i].ot, aca_ocs[i].oc, 0 ); - if ( code ) return code; - } - return overlay_register( &autoca ); }