/* * call from within bdb_initialize() */ static int bdb_monitor_initialize( void ) { int i, code; ConfigArgs c; char *argv[ 3 ]; static int bdb_monitor_initialized = 0; if ( backend_info( "monitor" ) == NULL ) { return -1; } if ( bdb_monitor_initialized++ ) { return 0; } /* register schema here */ argv[ 0 ] = "back-bdb/back-hdb monitor"; c.argv = argv; c.argc = 3; c.fname = argv[0]; for ( i = 0; s_oid[ i ].name; i++ ) { c.lineno = i; argv[ 1 ] = s_oid[ i ].name; argv[ 2 ] = s_oid[ i ].oid; if ( parse_oidm( &c, 0, NULL ) != 0 ) { Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_monitor_initialize) ": unable to add " "objectIdentifier \"%s=%s\"\n", s_oid[ i ].name, s_oid[ i ].oid, 0 ); return 1; } } for ( i = 0; s_at[ i ].desc != NULL; i++ ) { code = register_at( s_at[ i ].desc, s_at[ i ].ad, 1 ); if ( code != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_monitor_initialize) ": register_at failed\n", 0, 0, 0 ); } (*s_at[ i ].ad)->ad_type->sat_flags |= SLAP_AT_HIDE; } for ( i = 0; s_oc[ i ].desc != NULL; i++ ) { code = register_oc( s_oc[ i ].desc, s_oc[ i ].oc, 1 ); if ( code != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_monitor_initialize) ": register_oc failed\n", 0, 0, 0 ); } (*s_oc[ i ].oc)->soc_flags |= SLAP_OC_HIDE; } return 0; }
/* * call from within ldap_back_initialize() */ static int ldap_back_monitor_initialize( void ) { int i, code; ConfigArgs c; char *argv[ 3 ]; static int ldap_back_monitor_initialized = 0; /* register schema here; if compiled as dynamic object, * must be loaded __after__ back_monitor.la */ if ( ldap_back_monitor_initialized++ ) { return 0; } if ( backend_info( "monitor" ) == NULL ) { return -1; } argv[ 0 ] = "back-ldap monitor"; c.argv = argv; c.argc = 3; c.fname = argv[0]; for ( i = 0; s_oid[ i ].name; i++ ) { argv[ 1 ] = s_oid[ i ].name; argv[ 2 ] = s_oid[ i ].oid; if ( parse_oidm( &c, 0, NULL ) != 0 ) { Debug( LDAP_DEBUG_ANY, "ldap_back_monitor_initialize: unable to add " "objectIdentifier \"%s=%s\"\n", s_oid[ i ].name, s_oid[ i ].oid, 0 ); return 1; } } for ( i = 0; s_at[ i ].desc != NULL; i++ ) { code = register_at( s_at[ i ].desc, s_at[ i ].ad, 1 ); if ( code != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_ANY, "ldap_back_monitor_initialize: register_at failed\n", 0, 0, 0 ); } } for ( i = 0; s_oc[ i ].desc != NULL; i++ ) { code = register_oc( s_oc[ i ].desc, s_oc[ i ].oc, 1 ); if ( code != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_ANY, "ldap_back_monitor_initialize: register_oc failed\n", 0, 0, 0 ); } } return 0; }
/* * call from within bdb_initialize() */ static int bdb_monitor_initialize( void ) { int i, code; ConfigArgs c; char *argv[ 3 ]; static int bdb_monitor_initialized = 0; /* set to 0 when successfully initialized; otherwise, remember failure */ static int bdb_monitor_initialized_failure = 1; if ( bdb_monitor_initialized++ ) { return bdb_monitor_initialized_failure; } if ( backend_info( "monitor" ) == NULL ) { return -1; } /* register schema here */ argv[ 0 ] = "back-bdb/back-hdb monitor"; c.argv = argv; c.argc = 3; c.fname = argv[0]; for ( i = 0; s_oid[ i ].name; i++ ) { c.lineno = i; argv[ 1 ] = s_oid[ i ].name; argv[ 2 ] = s_oid[ i ].oid; if ( parse_oidm( &c, 0, NULL ) != 0 ) { Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_monitor_initialize) ": unable to add " "objectIdentifier \"%s=%s\"\n", s_oid[ i ].name, s_oid[ i ].oid, 0 ); return 2; } } for ( i = 0; s_at[ i ].desc != NULL; i++ ) { code = register_at( s_at[ i ].desc, s_at[ i ].ad, 1 ); if ( code != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_monitor_initialize) ": register_at failed for attributeType (%s)\n", s_at[ i ].desc, 0, 0 ); return 3; } else { (*s_at[ i ].ad)->ad_type->sat_flags |= SLAP_AT_HIDE; } } for ( i = 0; s_oc[ i ].desc != NULL; i++ ) { code = register_oc( s_oc[ i ].desc, s_oc[ i ].oc, 1 ); if ( code != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_monitor_initialize) ": register_oc failed for objectClass (%s)\n", s_oc[ i ].desc, 0, 0 ); return 4; } else { (*s_oc[ i ].oc)->soc_flags |= SLAP_OC_HIDE; } } return ( bdb_monitor_initialized_failure = LDAP_SUCCESS ); }