From 6f8fb3bf39676d7c41ae19d5130ed8cc5bb09e2d Mon Sep 17 00:00:00 2001 From: Ondrej Kuznik Date: Thu, 12 Apr 2012 10:29:33 +0200 Subject: [PATCH] ITS#7182 Simplify connection entry creation using entry_stub. --- servers/slapd/back-ldap/monitor.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/servers/slapd/back-ldap/monitor.c b/servers/slapd/back-ldap/monitor.c index 68e9f46182..1086c14473 100644 --- a/servers/slapd/back-ldap/monitor.c +++ b/servers/slapd/back-ldap/monitor.c @@ -481,30 +481,18 @@ ldap_back_monitor_conn_entry( { Entry *e; monitor_entry_t *mp; - monitor_extra_t *mbe; + monitor_extra_t *mbe = arg->op->o_bd->bd_info->bi_extra; char buf[SLAP_TEXT_BUFLEN]; char *ptr; - struct berval bv, dn, ndn; + struct berval bv; int i; - e = entry_alloc(); - bv.bv_val = buf; bv.bv_len = snprintf( bv.bv_val, SLAP_TEXT_BUFLEN, "cn=Connection %lu", lc->lc_connid ); - build_new_dn( &dn, &arg->ms->mss_dn, &bv, NULL ); - build_new_dn( &ndn, &arg->ms->mss_ndn, &bv, NULL ); - - e->e_name = dn; - e->e_nname = ndn; - - bv.bv_val += 3; - bv.bv_len -= 3; - attr_merge_normalize_one( e, slap_schema.si_ad_cn, &bv, NULL ); - - BER_BVSTR( &bv, "monitorContainer" ); - attr_merge_normalize_one( e, slap_schema.si_ad_objectClass, &bv, NULL ); + e = mbe->entry_stub( &arg->ms->mss_dn, &arg->ms->mss_ndn, &bv, + oc_monitorContainer, NULL, NULL ); attr_merge_normalize_one( e, ad_olmDbBoundDN, &lc->lc_bound_ndn, NULL ); @@ -526,7 +514,6 @@ ldap_back_monitor_conn_entry( attr_merge_normalize_one( e, ad_olmDbPeerAddress, &bv, NULL ); ch_free( bv.bv_val ); - mbe = (monitor_extra_t *) arg->op->o_bd->bd_info->bi_extra; mp = mbe->entrypriv_create(); e->e_private = mp; mp->mp_info = arg->ms; -- 2.39.5