s4: messaging: Remove bool auto_remove parameter from imessaging_init().
authorJeremy Allison <jra@samba.org>
Fri, 22 Jul 2016 18:17:24 +0000 (11:17 -0700)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 23 Jul 2016 04:04:11 +0000 (06:04 +0200)
With modern messaging this doesn't do anything (it's an
empty destructor). Clean up so we can add a proper destructor
in future.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/auth/auth_samba4.c
source3/winbindd/winbindd.c
source4/lib/messaging/messaging.c
source4/lib/messaging/messaging.h
source4/lib/messaging/pymessaging.c
source4/lib/messaging/tests/irpc.c
source4/lib/messaging/tests/messaging.c
source4/smbd/server.c
source4/smbd/service_stream.c
source4/smbd/service_task.c

index 8ea05c6bcd4b677c4cb6f15b51d2b4f1e5a5cdf1..a0d6afd32d4f9f9aa324fb350f6e81d706dd2e4e 100644 (file)
@@ -231,7 +231,7 @@ static NTSTATUS prepare_gensec(const struct auth_context *auth_context,
        msg_ctx = imessaging_init(frame,
                                  lp_ctx,
                                  *server_id,
-                                 event_ctx, true);
+                                 event_ctx);
        if (msg_ctx == NULL) {
                DEBUG(1, ("imessaging_init failed\n"));
                TALLOC_FREE(frame);
@@ -322,7 +322,7 @@ static NTSTATUS make_auth4_context_s4(const struct auth_context *auth_context,
        msg_ctx = imessaging_init(frame,
                                  lp_ctx,
                                  *server_id,
-                                 event_ctx, true);
+                                 event_ctx);
        if (msg_ctx == NULL) {
                DEBUG(1, ("imessaging_init failed\n"));
                TALLOC_FREE(frame);
index 002ba3f5e8c616ee02a0adae190bcac610b4a0b9..f79dc478a77c0e8bc2d29e2070883c4a5c705650 100644 (file)
@@ -122,8 +122,7 @@ struct imessaging_context *winbind_imessaging_context(void)
         * Note we MUST use the NULL context here, not the autofree context,
         * to avoid side effects in forked children exiting.
         */
-       msg = imessaging_init(NULL, lp_ctx, myself, winbind_event_context(),
-                             false);
+       msg = imessaging_init(NULL, lp_ctx, myself, winbind_event_context());
        talloc_unlink(NULL, lp_ctx);
 
        if (msg == NULL) {
index 0fc180be2a454257a990d8024d2d7667f74a9cea..486d602dbb62245015cbe3e273e67ae8a70a8a54 100644 (file)
@@ -280,7 +280,6 @@ NTSTATUS imessaging_send_ptr(struct imessaging_context *msg, struct server_id se
 
 
 /*
-  remove our messaging socket and database entry
 */
 int imessaging_cleanup(struct imessaging_context *msg)
 {
@@ -296,17 +295,11 @@ static void imessaging_dgm_recv(const uint8_t *buf, size_t buf_len,
 
 /*
   create the listening socket and setup the dispatcher
-
-  use auto_remove=true when you want a destructor to remove the
-  associated messaging socket and database entry on talloc free. Don't
-  use this in processes that may fork and a child may talloc free this
-  memory
 */
 struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
                                           struct loadparm_context *lp_ctx,
                                           struct server_id server_id,
-                                          struct tevent_context *ev,
-                                          bool auto_remove)
+                                          struct tevent_context *ev)
 {
        struct imessaging_context *msg;
        bool ok;
@@ -376,10 +369,6 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
                goto fail;
        }
 
-       if (auto_remove) {
-               talloc_set_destructor(msg, imessaging_cleanup);
-       }
-
        imessaging_register(msg, NULL, MSG_PING, ping_message);
        imessaging_register(msg, NULL, MSG_REQ_POOL_USAGE, pool_message);
        imessaging_register(msg, NULL, MSG_IRPC, irpc_handler);
@@ -452,7 +441,7 @@ struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx,
        /* This is because we are not in the s3 serverid database */
        id.unique_id = SERVERID_UNIQUE_ID_NOT_TO_VERIFY;
 
-       return imessaging_init(mem_ctx, lp_ctx, id, ev, true);
+       return imessaging_init(mem_ctx, lp_ctx, id, ev);
 }
 /*
   a list of registered irpc server functions
index c3477f2d3422141a589cb2f4826f9626d001dd69..2efab94ae5547974c56ea8fd3acbc819591c9fe9 100644 (file)
@@ -43,8 +43,7 @@ NTSTATUS imessaging_register_tmp(struct imessaging_context *msg, void *private_d
 struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
                                           struct loadparm_context *lp_ctx,
                                           struct server_id server_id,
-                                          struct tevent_context *ev,
-                                          bool auto_remove);
+                                          struct tevent_context *ev);
 int imessaging_cleanup(struct imessaging_context *msg);
 struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx,
                                           struct loadparm_context *lp_ctx,
index cef0703dc33e749a860c7db567543ac40b507eb9..f62354b8a02b9c3e5a8d513b55cd82c6c6d39b38 100644 (file)
@@ -115,7 +115,7 @@ static PyObject *py_imessaging_connect(PyTypeObject *self, PyObject *args, PyObj
                ret->msg_ctx = imessaging_init(ret->mem_ctx,
                                               lp_ctx,
                                               server_id,
-                                              ev, true);
+                                              ev);
        } else {
                ret->msg_ctx = imessaging_client_init(ret->mem_ctx,
                                                      lp_ctx,
index 486420b50dd3660c1c37a585d3861f43bc735998..466b47fdb34d2dd9bd2be102e46ddb68a427ec11 100644 (file)
@@ -261,14 +261,14 @@ static bool irpc_setup(struct torture_context *tctx, void **_data)
                       imessaging_init(tctx,
                                      tctx->lp_ctx,
                                      cluster_id(0, MSG_ID1),
-                                     data->ev, true),
+                                     data->ev),
                       "Failed to init first messaging context");
 
        torture_assert(tctx, data->msg_ctx2 = 
                       imessaging_init(tctx,
                                      tctx->lp_ctx,
                                      cluster_id(0, MSG_ID2), 
-                                     data->ev, true),
+                                     data->ev),
                       "Failed to init second messaging context");
 
        /* register the server side function */
index 2759703af2de4bdd5d87040979c8811ca34c006e..51195a18113294114d52918d3c2d5323f0e3acde 100644 (file)
@@ -73,7 +73,7 @@ static bool test_ping_speed(struct torture_context *tctx)
 
        msg_server_ctx = imessaging_init(tctx,
                                         tctx->lp_ctx, cluster_id(0, 1),
-                                        ev, true);
+                                        ev);
        
        torture_assert(tctx, msg_server_ctx != NULL, "Failed to init ping messaging context");
                
@@ -83,7 +83,7 @@ static bool test_ping_speed(struct torture_context *tctx)
        msg_client_ctx = imessaging_init(tctx,
                                         tctx->lp_ctx,
                                         cluster_id(0, 2),
-                                        ev, true);
+                                        ev);
 
        torture_assert(tctx, msg_client_ctx != NULL, 
                       "msg_client_ctx imessaging_init() failed");
index 7dc7635414b82ee7de2b7c031b2bed73c268d6ce..2399f4f84544ed921a5ff638bd158d560f455c52 100644 (file)
@@ -223,7 +223,7 @@ static NTSTATUS setup_parent_messaging(struct tevent_context *event_ctx,
 
        msg = imessaging_init(talloc_autofree_context(),
                              lp_ctx,
-                             cluster_id(0, SAMBA_PARENT_TASKID), event_ctx, false);
+                             cluster_id(0, SAMBA_PARENT_TASKID), event_ctx);
        NT_STATUS_HAVE_NO_MEMORY(msg);
 
        status = irpc_add_name(msg, "samba");
index 9aca501007d3e34842078dbe77e87b389671ea36..f0a379acf6a68be6f9296b0af51ecb1507dbfb5f 100644 (file)
@@ -194,7 +194,7 @@ static void stream_new_connection(struct tevent_context *ev,
        /* setup to receive internal messages on this connection */
        srv_conn->msg_ctx = imessaging_init(srv_conn,
                                            lp_ctx,
-                                           srv_conn->server_id, ev, false);
+                                           srv_conn->server_id, ev);
        if (!srv_conn->msg_ctx) {
                stream_terminate_connection(srv_conn, "imessaging_init() failed");
                return;
index 7422f2c3e9be2bb21af402ebf80dd32c5cb662e8..34f73d9f4b28feb85478ed45c97cd205175a5abd 100644 (file)
@@ -85,7 +85,7 @@ static void task_server_callback(struct tevent_context *event_ctx,
        task->msg_ctx = imessaging_init(task,
                                        task->lp_ctx,
                                        task->server_id,
-                                       task->event_ctx, false);
+                                       task->event_ctx);
        if (!task->msg_ctx) {
                task_server_terminate(task, "imessaging_init() failed", true);
                return;