mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
s4: messaging: Remove bool auto_remove parameter from imessaging_init().
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>
This commit is contained in:
parent
32b1c74c27
commit
da47e13323
source3
source4
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user