diff options
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/tls/tls.c | 21 | ||||
-rw-r--r-- | source4/lib/tls/tls.h | 5 |
2 files changed, 25 insertions, 1 deletions
diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c index 8f443c67d7..53b689f135 100644 --- a/source4/lib/tls/tls.c +++ b/source4/lib/tls/tls.c @@ -159,6 +159,20 @@ static NTSTATUS tls_handshake(struct tls_context *tls) return NT_STATUS_OK; } +/* + see how many bytes are pending on the connection +*/ +NTSTATUS tls_socket_pending(struct tls_context *tls, size_t *npending) +{ + if (!tls->tls_enabled || tls->tls_detect) { + return socket_pending(tls->socket, npending); + } + *npending = gnutls_record_check_pending(tls->session); + if (*npending == 0) { + return socket_pending(tls->socket, npending); + } + return NT_STATUS_OK; +} /* receive data either by tls or normal socket_recv @@ -222,7 +236,7 @@ NTSTATUS tls_socket_send(struct tls_context *tls, const DATA_BLOB *blob, size_t return STATUS_MORE_ENTRIES; } if (ret < 0) { - DEBUG(0,("gnutls_record_send failed - %s\n", gnutls_strerror(ret))); + DEBUG(0,("gnutls_record_send of %d failed - %s\n", blob->length, gnutls_strerror(ret))); return NT_STATUS_UNEXPECTED_NETWORK_ERROR; } *sendlen = ret; @@ -426,4 +440,9 @@ BOOL tls_support(struct tls_params *params) return False; } +NTSTATUS tls_socket_pending(struct tls_context *tls, size_t *npending) +{ + return socket_pending((struct socket_context *)tls, npending); +} + #endif diff --git a/source4/lib/tls/tls.h b/source4/lib/tls/tls.h index f87d49d9eb..fe993a3804 100644 --- a/source4/lib/tls/tls.h +++ b/source4/lib/tls/tls.h @@ -59,3 +59,8 @@ BOOL tls_enabled(struct tls_context *tls); BOOL tls_support(struct tls_params *parms); +/* + ask for the number of bytes in a pending incoming packet +*/ +NTSTATUS tls_socket_pending(struct tls_context *tls, size_t *npending); + |