/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2000-2005 The OpenLDAP Foundation.
+ * Copyright 2000-2012 The OpenLDAP Foundation.
* Portions Copyright 2000-2003 Kurt D. Zeilenga.
* All rights reserved.
*
rs->sr_ref = NULL;
if ( BER_BVISEMPTY( &op->o_req_ndn ) ) {
-#ifdef LDAP_DEVEL
-#if 0
/* FIXME: need some means to determine whether the database
* is a glue instance; if we got here with empty DN, then
* we passed this same test in dnssrv_back_referrals() */
if ( !SLAP_GLUE_INSTANCE( op->o_bd ) ) {
rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
- rs->sr_err = "DNS SRV operation upon null (empty) DN disallowed";
- } else
-#endif
- {
+ rs->sr_text = "DNS SRV operation upon null (empty) DN disallowed";
+
+ } else {
rs->sr_err = LDAP_SUCCESS;
}
goto done;
-#endif /* LDAP_DEVEL */
}
manageDSAit = get_manageDSAit( op );
for( i=0; hosts[i] != NULL; i++) {
struct berval url;
- url.bv_len = sizeof("ldap://")-1 + strlen(hosts[i]);
+ url.bv_len = STRLENOF( "ldap://" ) + strlen(hosts[i]);
url.bv_val = ch_malloc( url.bv_len + 1 );
strcpy( url.bv_val, "ldap://" );
- strcpy( &url.bv_val[sizeof("ldap://")-1], hosts[i] );
+ strcpy( &url.bv_val[STRLENOF( "ldap://" )], hosts[i] );
if( ber_bvarray_add( &urls, &url ) < 0 ) {
free( url.bv_val );
send_ldap_error( op, rs, LDAP_SUCCESS, NULL );
} else {
- Entry *e = ch_calloc( 1, sizeof(Entry) );
+ Entry e = { 0 };
AttributeDescription *ad_objectClass
= slap_schema.si_ad_objectClass;
AttributeDescription *ad_ref = slap_schema.si_ad_ref;
- e->e_name.bv_val = strdup( op->o_req_dn.bv_val );
- e->e_name.bv_len = op->o_req_dn.bv_len;
- e->e_nname.bv_val = strdup( op->o_req_ndn.bv_val );
- e->e_nname.bv_len = op->o_req_ndn.bv_len;
+ e.e_name.bv_val = ch_strdup( op->o_req_dn.bv_val );
+ e.e_name.bv_len = op->o_req_dn.bv_len;
+ e.e_nname.bv_val = ch_strdup( op->o_req_ndn.bv_val );
+ e.e_nname.bv_len = op->o_req_ndn.bv_len;
- e->e_attrs = NULL;
- e->e_private = NULL;
+ e.e_attrs = NULL;
+ e.e_private = NULL;
- attr_mergeit_one( e, ad_objectClass, &slap_schema.si_oc_top->soc_cname );
- attr_mergeit_one( e, ad_objectClass, &slap_schema.si_oc_referral->soc_cname );
- attr_mergeit_one( e, ad_objectClass, &slap_schema.si_oc_extensibleObject->soc_cname );
+ attr_merge_one( &e, ad_objectClass, &slap_schema.si_oc_referral->soc_cname, NULL );
+ attr_merge_one( &e, ad_objectClass, &slap_schema.si_oc_extensibleObject->soc_cname, NULL );
if ( ad_dc ) {
char *p;
} else if ( p != NULL ) {
bv.bv_len = p - bv.bv_val;
+
+ } else {
+ bv.bv_len = strlen( bv.bv_val );
}
- attr_mergeit_one( e, ad_dc, &bv );
+ attr_merge_normalize_one( &e, ad_dc, &bv, NULL );
}
if ( ad_associatedDomain ) {
struct berval bv;
ber_str2bv( domain, 0, 0, &bv );
- attr_mergeit_one( e, ad_associatedDomain, &bv );
+ attr_merge_normalize_one( &e, ad_associatedDomain, &bv, NULL );
}
- attr_mergeit( e, ad_ref, urls );
+ attr_merge_normalize_one( &e, ad_ref, urls, NULL );
- rc = test_filter( op, e, op->oq_search.rs_filter );
+ rc = test_filter( op, &e, op->oq_search.rs_filter );
if( rc == LDAP_COMPARE_TRUE ) {
- rs->sr_entry = e;
+ rs->sr_entry = &e;
rs->sr_attrs = op->oq_search.rs_attrs;
rs->sr_flags = REP_ENTRY_MODIFIABLE;
send_search_entry( op, rs );
rs->sr_entry = NULL;
rs->sr_attrs = NULL;
+ rs->sr_flags = 0;
}
- entry_free( e );
+ entry_clean( &e );
rs->sr_err = LDAP_SUCCESS;
send_ldap_result( op, rs );
if( urls != NULL ) ber_bvarray_free( urls );
return 0;
}
-