- /* create a message to send */
- if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
- ld->ld_errno = LDAP_NO_MEMORY;
- return( ld->ld_errno );
- }
-
- LDAP_NEXT_MSGID( ld, id );
- rc = ber_printf( ber, "{its", /* '}' */
- id, LDAP_REQ_DELETE, dn );
- if ( rc == -1 )
- {
- ld->ld_errno = LDAP_ENCODING_ERROR;
- ber_free( ber, 1 );
- return( ld->ld_errno );
- }
-
- /* Put Server Controls */
- if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
- ber_free( ber, 1 );
+ ber = ldap_build_delete_req( ld, dn, sctrls, cctrls, &id );
+ if( !ber )