Commit 65def943 authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Ondřej Kuzník
Browse files

More logging improvements

parent 1740f36b
......@@ -52,6 +52,8 @@ request_bind( Operation *op )
tag = ber_get_int( copy, &version );
if ( tag == LBER_ERROR ) {
Debug( LDAP_DEBUG_PACKETS, "request_bind: "
"failed to parse version field\n" );
goto fail;
} else if ( version != LDAP_VERSION3 ) {
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
......@@ -63,6 +65,8 @@ request_bind( Operation *op )
tag = ber_get_stringbv( copy, &binddn, LBER_BV_NOTERM );
if ( tag == LBER_ERROR ) {
Debug( LDAP_DEBUG_PACKETS, "request_bind: "
"failed to parse bind name field\n" );
goto fail;
}
......
......@@ -66,12 +66,17 @@ client_read_cb( evutil_socket_t s, short what, void *arg )
int err = sock_errno();
if ( err != EWOULDBLOCK && err != EAGAIN ) {
if ( err ) {
if ( err || tag == LBER_ERROR ) {
char ebuf[128];
Debug( LDAP_DEBUG_ANY, "client_read_cb: "
"ber_get_next on fd %d failed errno=%d (%s)\n",
Debug( LDAP_DEBUG_STATS, "client_read_cb: "
"ber_get_next on fd=%d failed errno=%d (%s)\n",
c->c_fd, err,
sock_errstr( err, ebuf, sizeof(ebuf) ) );
} else {
Debug( LDAP_DEBUG_STATS, "client_read_cb: "
"ber_get_next on fd=%d connid=%lu received "
"a strange PDU tag=%lx\n",
c->c_fd, c->c_connid, tag );
}
c->c_currentber = NULL;
......@@ -153,12 +158,17 @@ handle_requests( void *ctx, void *arg )
int err = sock_errno();
if ( err != EWOULDBLOCK && err != EAGAIN ) {
if ( err ) {
if ( err || tag == LBER_ERROR ) {
char ebuf[128];
Debug( LDAP_DEBUG_ANY, "handle_requests: "
"ber_get_next on fd %d failed errno=%d (%s)\n",
"ber_get_next on fd=%d failed errno=%d (%s)\n",
c->c_fd, err,
sock_errstr( err, ebuf, sizeof(ebuf) ) );
} else {
Debug( LDAP_DEBUG_STATS, "handle_requests: "
"ber_get_next on fd=%d connid=%lu received "
"a strange PDU tag=%lx\n",
c->c_fd, c->c_connid, tag );
}
c->c_currentber = NULL;
......@@ -260,7 +270,7 @@ client_write_cb( evutil_socket_t s, short what, void *arg )
char ebuf[128];
ldap_pvt_thread_mutex_unlock( &c->c_io_mutex );
Debug( LDAP_DEBUG_ANY, "client_write_cb: "
"ber_flush on fd %d failed errno=%d (%s)\n",
"ber_flush on fd=%d failed errno=%d (%s)\n",
c->c_fd, err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
CLIENT_LOCK_DESTROY(c);
return;
......
......@@ -138,7 +138,7 @@ static void
slapd_close( ber_socket_t s )
{
Debug( LDAP_DEBUG_CONNS, "slapd_close: "
"closing %ld\n",
"closing fd=%ld\n",
(long)s );
tcp_close( s );
}
......
......@@ -493,11 +493,18 @@ handle_responses( void *ctx, void *arg )
int err = sock_errno();
if ( err != EWOULDBLOCK && err != EAGAIN ) {
char ebuf[128];
Debug( LDAP_DEBUG_ANY, "handle_responses: "
"ber_get_next on fd %d failed errno=%d (%s)\n",
c->c_fd, err,
sock_errstr( err, ebuf, sizeof(ebuf) ) );
if ( err || tag == LBER_ERROR ) {
char ebuf[128];
Debug( LDAP_DEBUG_ANY, "handle_responses: "
"ber_get_next on fd=%d failed errno=%d (%s)\n",
c->c_fd, err,
sock_errstr( err, ebuf, sizeof(ebuf) ) );
} else {
Debug( LDAP_DEBUG_STATS, "handle_responses: "
"ber_get_next on fd=%d connid=%lu received "
"a strange PDU tag=%lx\n",
c->c_fd, c->c_connid, tag );
}
c->c_currentber = NULL;
ber_free( ber, 1 );
......@@ -558,12 +565,17 @@ upstream_read_cb( evutil_socket_t s, short what, void *arg )
int err = sock_errno();
if ( err != EWOULDBLOCK && err != EAGAIN ) {
if ( err ) {
if ( err || tag == LBER_ERROR ) {
char ebuf[128];
Debug( LDAP_DEBUG_ANY, "upstream_read_cb: "
"ber_get_next on fd %d failed errno=%d (%s)\n",
"ber_get_next on fd=%d failed errno=%d (%s)\n",
c->c_fd, err,
sock_errstr( err, ebuf, sizeof(ebuf) ) );
} else {
Debug( LDAP_DEBUG_STATS, "upstream_read_cb: "
"ber_get_next on fd=%d connid=%lu received "
"a strange PDU tag=%lx\n",
c->c_fd, c->c_connid, tag );
}
c->c_currentber = NULL;
......@@ -666,10 +678,18 @@ upstream_bind_cb( evutil_socket_t s, short what, void *arg )
int err = sock_errno();
if ( err != EWOULDBLOCK && err != EAGAIN ) {
char ebuf[128];
Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
"ber_get_next on fd %d failed errno=%d (%s)\n",
c->c_fd, err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
if ( err || tag == LBER_ERROR ) {
char ebuf[128];
Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
"ber_get_next on fd=%d failed errno=%d (%s)\n",
c->c_fd, err,
sock_errstr( err, ebuf, sizeof(ebuf) ) );
} else {
Debug( LDAP_DEBUG_STATS, "upstream_bind_cb: "
"ber_get_next on fd=%d connid=%lu received "
"a strange PDU tag=%lx\n",
c->c_fd, c->c_connid, tag );
}
c->c_currentber = NULL;
goto fail;
......@@ -757,7 +777,7 @@ upstream_write_cb( evutil_socket_t s, short what, void *arg )
if ( err != EWOULDBLOCK && err != EAGAIN ) {
char ebuf[128];
Debug( LDAP_DEBUG_ANY, "upstream_write_cb: "
"ber_flush on fd %d failed errno=%d (%s)\n",
"ber_flush on fd=%d failed errno=%d (%s)\n",
c->c_fd, err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
ldap_pvt_thread_mutex_unlock( &c->c_io_mutex );
UPSTREAM_LOCK_DESTROY(c);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment