diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-06-19 09:31:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:18:30 -0500 |
commit | c7496c6cdb7bdcdd483868c21457350f567ec054 (patch) | |
tree | 5584e0aaf51f9504bc5754d79a147b39af766de2 /source4/lib | |
parent | 68853a1c7be11ffaaef4ad2e3f78a97f0b401b68 (diff) | |
download | samba-c7496c6cdb7bdcdd483868c21457350f567ec054.tar.gz samba-c7496c6cdb7bdcdd483868c21457350f567ec054.tar.bz2 samba-c7496c6cdb7bdcdd483868c21457350f567ec054.zip |
r7747: - simplified the ldap server buffer handling
- got rid of the special cases for sasl buffers
- added a tls_socket_pending() call to determine how much data is waiting on a tls connection
- removed the attempt at async handling of ldap calls. The buffers/sockets are all async, but the calls themselves
are sync.
(This used to be commit 73cb4aad229d08e17e22d5792580bd43a61b142a)
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); + |