/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2001-2005 The OpenLDAP Foundation.
+ * Copyright 2001-2006 The OpenLDAP Foundation.
* Portions Copyright 2001-2003 Pierangelo Masarati.
* All rights reserved.
*
done:;
if ( rc ) {
- if ( *atp ) {
+ if ( atp && *atp ) {
attrs_free( *atp );
*atp = NULL;
}
}
if ( at->at_oid == NULL ) {
+ ldap_attributetype_free(at);
Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
"null OID for attributeType \"%s\"\n",
mat[ i ].name, 0, 0 );
code = at_add(at, 0, NULL, &err);
if ( code ) {
+ ldap_attributetype_free(at);
Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: "
"%s in attributeType \"%s\"\n",
scherr2str(code), mat[ i ].name, 0 );
}
if ( oc->oc_oid == NULL ) {
+ ldap_objectclass_free(oc);
Debug( LDAP_DEBUG_ANY,
"objectclass \"%s\" has no OID\n" ,
moc[ i ].name, 0, 0 );
code = oc_add(oc, 0, NULL, &err);
if ( code ) {
+ ldap_objectclass_free(oc);
Debug( LDAP_DEBUG_ANY,
"objectclass \"%s\": %s \"%s\"\n" ,
moc[ i ].name, scherr2str(code), err );
return -1;
}
-
ldap_memfree(oc);
Oc = oc_find( moc[ i ].name );
{
monitor_info_t *mi = (monitor_info_t *)be->be_private;
struct monitor_subsys_t **ms;
- Entry *e, **ep;
+ Entry *e, **ep, *root;
monitor_entry_t *mp;
int i;
- char buf[ BACKMONITOR_BUFSIZE ];
- struct berval bv;
+ struct berval bv, rdn = BER_BVC(SLAPD_MONITOR_DN);
struct tm *tms;
#ifdef HAVE_GMTIME_R
struct tm tm_buf;
#endif
static char tmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
+ struct berval desc[] = {
+ BER_BVC("This subtree contains monitoring/managing objects."),
+ BER_BVC("This object contains information about this server."),
+ BER_BVC("Most of the information is held in operational"
+ " attributes, which must be explicitly requested."),
+ BER_BVNULL };
assert( be_monitor != NULL );
if ( be != be_monitor ) {
if ( BER_BVISEMPTY( &be->be_rootdn ) ) {
BER_BVSTR( &mi->mi_creatorsName, SLAPD_ANONYMOUS );
+ BER_BVSTR( &mi->mi_ncreatorsName, SLAPD_ANONYMOUS );
} else {
mi->mi_creatorsName = be->be_rootdn;
+ mi->mi_ncreatorsName = be->be_rootndn;
}
/*
* creates the "cn=Monitor" entry
*/
- snprintf( buf, sizeof( buf ),
- "dn: %s\n"
- "objectClass: %s\n"
- "structuralObjectClass: %s\n"
- "cn: Monitor\n"
- "description: This subtree contains monitoring/managing objects.\n"
- "description: This object contains information about this server.\n"
- "description: Most of the information is held in operational"
- " attributeTypes, which must be explicitly requested.\n"
- "creatorsName: %s\n"
- "modifiersName: %s\n"
- "createTimestamp: %s\n"
- "modifyTimestamp: %s\n",
- SLAPD_MONITOR_DN,
- mi->mi_oc_monitorServer->soc_cname.bv_val,
- mi->mi_oc_monitorServer->soc_cname.bv_val,
- mi->mi_creatorsName.bv_val,
- mi->mi_creatorsName.bv_val,
- mi->mi_startTime.bv_val,
- mi->mi_startTime.bv_val );
-
- e = str2entry( buf );
+ e = monitor_entry_stub( NULL, NULL, &rdn, mi->mi_oc_monitorServer, mi,
+ NULL, NULL );
+
if ( e == NULL) {
Debug( LDAP_DEBUG_ANY,
"unable to create \"%s\" entry\n",
return( -1 );
}
+ attr_merge_normalize( e, slap_schema.si_ad_description, desc, NULL );
+
bv.bv_val = strchr( (char *) Versionstr, '$' );
if ( bv.bv_val != NULL ) {
char *end;
SLAPD_MONITOR_DN, 0, 0 );
return -1;
}
+ root = e;
/*
* Create all the subsystem specific entries
return( -1 );
}
- dn.bv_len += sizeof( SLAPD_MONITOR_DN ); /* 1 for the , */
- dn.bv_val = ch_malloc( dn.bv_len + 1 );
- strcpy( dn.bv_val , monitor_subsys[ i ]->mss_rdn.bv_val );
- strcat( dn.bv_val, "," SLAPD_MONITOR_DN );
- rc = dnPrettyNormal( NULL, &dn, &monitor_subsys[ i ]->mss_dn,
- &monitor_subsys[ i ]->mss_ndn, NULL );
- free( dn.bv_val );
- if ( rc != LDAP_SUCCESS ) {
- Debug( LDAP_DEBUG_ANY,
- "monitor DN \"%s\" is invalid\n",
- dn.bv_val, 0, 0 );
- return( -1 );
- }
+ e = monitor_entry_stub( &root->e_name, &root->e_nname,
+ &monitor_subsys[ i ]->mss_rdn, mi->mi_oc_monitorContainer, mi,
+ NULL, NULL );
- snprintf( buf, sizeof( buf ),
- "dn: %s\n"
- "objectClass: %s\n"
- "structuralObjectClass: %s\n"
- "cn: %s\n"
- "creatorsName: %s\n"
- "modifiersName: %s\n"
- "createTimestamp: %s\n"
- "modifyTimestamp: %s\n",
- monitor_subsys[ i ]->mss_dn.bv_val,
- mi->mi_oc_monitorContainer->soc_cname.bv_val,
- mi->mi_oc_monitorContainer->soc_cname.bv_val,
- monitor_subsys[ i ]->mss_name,
- mi->mi_creatorsName.bv_val,
- mi->mi_creatorsName.bv_val,
- mi->mi_startTime.bv_val,
- mi->mi_startTime.bv_val );
-
- e = str2entry( buf );
-
if ( e == NULL) {
Debug( LDAP_DEBUG_ANY,
"unable to create \"%s\" entry\n",
monitor_subsys[ i ]->mss_dn.bv_val, 0, 0 );
return( -1 );
}
+ monitor_subsys[i]->mss_dn = e->e_name;
+ monitor_subsys[i]->mss_ndn = e->e_nname;
if ( !BER_BVISNULL( &monitor_subsys[ i ]->mss_desc[ 0 ] ) ) {
attr_merge_normalize( e, slap_schema.si_ad_description,
if ( !BER_BVISNULL( &monitor_subsys[ i ]->mss_rdn ) ) {
ch_free( monitor_subsys[ i ]->mss_rdn.bv_val );
}
-
- if ( !BER_BVISNULL( &monitor_subsys[ i ]->mss_dn ) ) {
- ch_free( monitor_subsys[ i ]->mss_dn.bv_val );
- }
-
- if ( !BER_BVISNULL( &monitor_subsys[ i ]->mss_ndn ) ) {
- ch_free( monitor_subsys[ i ]->mss_ndn.bv_val );
- }
}
ch_free( monitor_subsys );