LDAPControl **ctrls
)
{
- BerElement *ber;
+ char berbuf[256];
+ BerElement *ber = (BerElement *)berbuf;
int rc;
long bytes;
assert( ctrls == NULL ); /* ctrls not implemented */
- ber = ber_alloc_t( LBER_USE_DER );
+ ber_init_w_nullc( ber, LBER_USE_DER );
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
}
- if ( ber == NULL ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_ldap_response: conn %d ber_alloc failed\n",
- conn ? conn->c_connid : 0 ));
-#else
- Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
-#endif
-
- return;
- }
-
#ifdef LDAP_CONNECTIONLESS
if (conn->c_is_udp) {
rc = ber_write(ber, (char *)&op->o_peeraddr, sizeof(struct sockaddr), 0);
#else
Debug( LDAP_DEBUG_ANY, "ber_write failed\n", 0, 0, 0 );
#endif
- ber_free(ber, 1);
+ ber_free_buf( ber );
return;
}
}
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
- ber_free( ber, 1 );
+ ber_free_buf( ber );
return;
}
/* send BER */
bytes = send_ldap_ber( conn, ber );
- ber_free( ber, 1 );
+ ber_free_buf( ber );
if ( bytes < 0 ) {
#ifdef NEW_LOGGING
LDAPControl **ctrls
)
{
- BerElement *ber;
+ char berbuf[256];
+ BerElement *ber = (BerElement *)berbuf;;
Attribute *a, *aa;
int i, rc=-1, bytes;
char *edn;
edn = e->e_ndn;
- ber = ber_alloc_t( LBER_USE_DER );
-
- if ( ber == NULL ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_entry: conn %d ber_alloc failed\n",
- op->o_connid ));
-#else
- Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
-#endif
-
- send_ldap_result( conn, op, LDAP_OTHER,
- NULL, "BER allocation error", NULL, NULL );
- goto error_return;
- }
+ ber_init_w_nullc( ber, LBER_USE_DER );
#ifdef LDAP_CONNECTIONLESS
if (conn->c_is_udp) {
#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
- ber_free(ber, 1);
+ ber_free_buf( ber );
return;
}
}
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
- ber_free( ber, 1 );
+ ber_free_buf( ber );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding DN error", NULL, NULL );
goto error_return;
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
- ber_free( ber, 1 );
+ ber_free_buf( ber );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding description error", NULL, NULL );
goto error_return;
"ber_printf failed\n", 0, 0, 0 );
#endif
- ber_free( ber, 1 );
+ ber_free_buf( ber );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding values error", NULL, NULL );
goto error_return;
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
- ber_free( ber, 1 );
+ ber_free_buf( ber );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encode end error", NULL, NULL );
goto error_return;
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
- ber_free( ber, 1 );
+ ber_free_buf( ber );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding description error", NULL, NULL );
attrs_free( aa );
"ber_printf failed\n", 0, 0, 0 );
#endif
- ber_free( ber, 1 );
+ ber_free_buf( ber );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding values error", NULL, NULL );
attrs_free( aa );
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
- ber_free( ber, 1 );
+ ber_free_buf( ber );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encode end error", NULL, NULL );
attrs_free( aa );
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
- ber_free( ber, 1 );
+ ber_free_buf( ber );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encode entry end error", NULL, NULL );
return( 1 );
}
bytes = send_ldap_ber( conn, ber );
- ber_free( ber, 1 );
+ ber_free_buf( ber );
if ( bytes < 0 ) {
#ifdef NEW_LOGGING
struct berval ***v2refs
)
{
- BerElement *ber;
+ char berbuf[256];
+ BerElement *ber = (BerElement *)berbuf;
int rc;
int bytes;
return 0;
}
- ber = ber_alloc_t( LBER_USE_DER );
-
- if ( ber == NULL ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_reference: conn %d ber_alloc failed\n",
- op->o_connid ));
-#else
- Debug( LDAP_DEBUG_ANY,
- "send_search_reference: ber_alloc failed\n", 0, 0, 0 );
-#endif
-
- send_ldap_result( conn, op, LDAP_OTHER,
- NULL, "alloc BER error", NULL, NULL );
- return -1;
- }
+ ber_init_w_nullc( ber, LBER_USE_DER );
rc = ber_printf( ber, "{it{V}N}", op->o_msgid,
LDAP_RES_SEARCH_REFERENCE, refs );
"send_search_reference: ber_printf failed\n", 0, 0, 0 );
#endif
- ber_free( ber, 1 );
+ ber_free_buf( ber );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encode DN error", NULL, NULL );
return -1;
}
bytes = send_ldap_ber( conn, ber );
- ber_free( ber, 1 );
+ ber_free_buf( ber );
ldap_pvt_thread_mutex_lock( &num_sent_mutex );
num_bytes_sent += bytes;