summaryrefslogtreecommitdiff
path: root/source4/libcli/raw
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli/raw')
-rw-r--r--source4/libcli/raw/clisocket.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index cbbd6490bd..9249f453e8 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -49,8 +49,10 @@ static int smbcli_sock_destructor(void *ptr)
/*
create a smbcli_socket context
+ The event_ctx is optional - if not supplied one will be created
*/
-struct smbcli_socket *smbcli_sock_init(TALLOC_CTX *mem_ctx)
+struct smbcli_socket *smbcli_sock_init(TALLOC_CTX *mem_ctx,
+ struct event_context *event_ctx)
{
struct smbcli_socket *sock;
@@ -59,7 +61,11 @@ struct smbcli_socket *smbcli_sock_init(TALLOC_CTX *mem_ctx)
return NULL;
}
- sock->event.ctx = event_context_init(sock);
+ if (event_ctx) {
+ sock->event.ctx = talloc_reference(sock, event_ctx);
+ } else {
+ sock->event.ctx = event_context_init(sock);
+ }
if (sock->event.ctx == NULL) {
talloc_free(sock);
return NULL;