From: Ralph Boehme Date: Tue, 15 Jun 2021 09:17:57 +0000 (+0200) Subject: smbd: pass tevent context to create_conn_struct_as_root() X-Git-Tag: tevent-0.11.0~344 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=16c39b81d6f2c7d75cfe72bbbe2f6a5bde42c7b0;p=thirdparty%2Fsamba.git smbd: pass tevent context to create_conn_struct_as_root() The next commit will add another caller of create_conn_struct_as_root() that is going to pass a long-lived tevent context. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 6f7707dbc9b..864cd102403 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -242,6 +242,7 @@ static NTSTATUS parse_dfs_path(connection_struct *conn, *********************************************************/ static NTSTATUS create_conn_struct_as_root(TALLOC_CTX *ctx, + struct tevent_context *ev, struct messaging_context *msg, connection_struct **pconn, int snum, @@ -260,12 +261,7 @@ static NTSTATUS create_conn_struct_as_root(TALLOC_CTX *ctx, return NT_STATUS_NO_MEMORY; } - sconn->ev_ctx = samba_tevent_context_init(sconn); - if (sconn->ev_ctx == NULL) { - TALLOC_FREE(sconn); - return NT_STATUS_NO_MEMORY; - } - + sconn->ev_ctx = ev; sconn->msg_ctx = msg; conn = conn_new(sconn); @@ -401,6 +397,7 @@ NTSTATUS create_conn_struct_tos(struct messaging_context *msg, struct conn_struct_tos **_c) { struct conn_struct_tos *c = NULL; + struct tevent_context *ev = NULL; NTSTATUS status; *_c = NULL; @@ -410,8 +407,15 @@ NTSTATUS create_conn_struct_tos(struct messaging_context *msg, return NT_STATUS_NO_MEMORY; } + ev = samba_tevent_context_init(c); + if (ev == NULL) { + TALLOC_FREE(c); + return NT_STATUS_NO_MEMORY; + } + become_root(); status = create_conn_struct_as_root(c, + ev, msg, &c->conn, snum,