1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-04 08:22:08 +03:00

r17222: Change the function prototypes for the GENSEc and TLS socket creation

routines to return an NTSTATUS.  This should help track down errors.

Use a bit of talloc_steal and talloc_unlink to get the real socket to
be a child of the GENSEC or TLS socket.

Always return a new socket, even for the 'pass-though' case.

Andrew Bartlett
(This used to be commit 003e2ab93c)
This commit is contained in:
Andrew Bartlett
2006-07-25 00:57:27 +00:00
committed by Gerald (Jerry) Carter
parent c047a88f41
commit 9d6f276717
8 changed files with 147 additions and 77 deletions

View File

@ -370,15 +370,18 @@ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, struct cli_credentials *cr
talloc_free(tmp_ctx);
if (NT_STATUS_IS_OK(status)) {
struct socket_context *socket = gensec_socket_init(conn->gensec,
conn->sock,
conn->event.event_ctx,
ldap_read_io_handler,
conn);
if (socket) {
conn->sock = socket;
talloc_steal(conn->sock, socket);
packet_set_socket(conn->packet, socket);
struct socket_context *sasl_socket;
status = gensec_socket_init(conn->gensec,
conn->sock,
conn->event.event_ctx,
ldap_read_io_handler,
conn,
&sasl_socket);
if (NT_STATUS_IS_OK(status)) {
talloc_steal(conn->sock, sasl_socket);
talloc_unlink(conn, conn->sock);
conn->sock = sasl_socket;
packet_set_socket(conn->packet, conn->sock);
} else {
status = NT_STATUS_NO_MEMORY;
goto failed;