smbd: call samba_tevent_context_init() within create_conn_struct_as_root()
authorStefan Metzmacher <metze@samba.org>
Fri, 25 May 2018 06:49:29 +0000 (08:49 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 14 Jun 2018 18:52:23 +0000 (20:52 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/msdfs.c

index ff836138cd777fba16d229b10864f10e920eca05..1a6454b5c2be020844d1e2b9cf25034f738ac9c2 100644 (file)
@@ -240,7 +240,6 @@ 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,
@@ -258,7 +257,12 @@ static NTSTATUS create_conn_struct_as_root(TALLOC_CTX *ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       sconn->ev_ctx = ev;
+       sconn->ev_ctx = samba_tevent_context_init(sconn);
+       if (sconn->ev_ctx == NULL) {
+               TALLOC_FREE(sconn);
+               return NT_STATUS_NO_MEMORY;
+       }
+
        sconn->msg_ctx = msg;
 
        conn = conn_new(sconn);
@@ -387,7 +391,6 @@ 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;
@@ -397,15 +400,8 @@ 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,