diff --git a/source/auth/auth_winbind.c b/source/auth/auth_winbind.c index 2a35047e21e..05183d65d06 100644 --- a/source/auth/auth_winbind.c +++ b/source/auth/auth_winbind.c @@ -162,7 +162,10 @@ static NTSTATUS winbind_check_password(struct auth_method_context *ctx, const struct auth_usersupplied_info *user_info_new; struct netr_IdentityInfo *identity_info; - winbind_servers = irpc_servers_byname(ctx->auth_ctx->msg_ctx, "winbind_server"); + s = talloc(mem_ctx, struct winbind_check_password_state); + NT_STATUS_HAVE_NO_MEMORY(s); + + winbind_servers = irpc_servers_byname(ctx->auth_ctx->msg_ctx, s, "winbind_server"); if ((winbind_servers == NULL) || (winbind_servers[0].id == 0)) { DEBUG(0, ("Winbind authentication for [%s]\\[%s] failed, " "no winbind_server running!\n", @@ -170,9 +173,6 @@ static NTSTATUS winbind_check_password(struct auth_method_context *ctx, return NT_STATUS_NO_LOGON_SERVERS; } - s = talloc(mem_ctx, struct winbind_check_password_state); - NT_STATUS_HAVE_NO_MEMORY(s); - if (user_info->flags & USER_INFO_INTERACTIVE_LOGON) { struct netr_PasswordInfo *password_info; diff --git a/source/lib/messaging/irpc.h b/source/lib/messaging/irpc.h index 6873f014a6a..0ea1d5d69fb 100644 --- a/source/lib/messaging/irpc.h +++ b/source/lib/messaging/irpc.h @@ -117,7 +117,7 @@ NTSTATUS irpc_call(struct messaging_context *msg_ctx, int callnum, void *r, TALLOC_CTX *ctx); NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name); -struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, const char *name); +struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, TALLOC_CTX *mem_ctx, const char *name); void irpc_remove_name(struct messaging_context *msg_ctx, const char *name); NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status); diff --git a/source/lib/messaging/messaging.c b/source/lib/messaging/messaging.c index 705fdcc4655..9b4f4b49c43 100644 --- a/source/lib/messaging/messaging.c +++ b/source/lib/messaging/messaging.c @@ -961,7 +961,8 @@ NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name) /* return a list of server ids for a server name */ -struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, +struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, + TALLOC_CTX *mem_ctx, const char *name) { struct tdb_wrap *t; @@ -985,7 +986,7 @@ struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, return NULL; } count = rec.dsize / sizeof(struct server_id); - ret = talloc_array(msg_ctx, struct server_id, count+1); + ret = talloc_array(mem_ctx, struct server_id, count+1); if (ret == NULL) { tdb_unlock_bystring(t->tdb, name); talloc_free(t); diff --git a/source/libcli/finddcs.c b/source/libcli/finddcs.c index d8acf44ba0a..09967c72b16 100644 --- a/source/libcli/finddcs.c +++ b/source/libcli/finddcs.c @@ -133,7 +133,7 @@ static void finddcs_name_resolved(struct composite_context *ctx) return; } - nbt_servers = irpc_servers_byname(state->msg_ctx, "nbt_server"); + nbt_servers = irpc_servers_byname(state->msg_ctx, state, "nbt_server"); if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { fallback_node_status(state); return; diff --git a/source/scripting/ejs/smbcalls_rpc.c b/source/scripting/ejs/smbcalls_rpc.c index 4d4e12e855e..73b6661cd32 100644 --- a/source/scripting/ejs/smbcalls_rpc.c +++ b/source/scripting/ejs/smbcalls_rpc.c @@ -88,7 +88,7 @@ static int ejs_irpc_connect(MprVarHandle eid, int argc, char **argv) return -1; } - p->dest_ids = irpc_servers_byname(p->msg_ctx, p->server_name); + p->dest_ids = irpc_servers_byname(p->msg_ctx, p, p->server_name); if (p->dest_ids == NULL || p->dest_ids[0].id == 0) { talloc_free(p); status = NT_STATUS_OBJECT_NAME_NOT_FOUND; diff --git a/source/winbind/wb_dom_info.c b/source/winbind/wb_dom_info.c index 28f35c20952..39a734aace4 100644 --- a/source/winbind/wb_dom_info.c +++ b/source/winbind/wb_dom_info.c @@ -96,7 +96,7 @@ static void get_dom_info_recv_addrs(struct composite_context *ctx) if (!composite_is_ok(state->ctx)) return; nbt_servers = irpc_servers_byname(state->service->task->msg_ctx, - "nbt_server"); + state, "nbt_server"); if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { composite_error(state->ctx, NT_STATUS_NO_LOGON_SERVERS); return; diff --git a/source/wrepl_server/wrepl_apply_records.c b/source/wrepl_server/wrepl_apply_records.c index f805d21dfe8..033657987ef 100644 --- a/source/wrepl_server/wrepl_apply_records.c +++ b/source/wrepl_server/wrepl_apply_records.c @@ -911,7 +911,7 @@ static NTSTATUS r_do_late_release_demand(struct r_do_challenge_state *state) DEBUG(4,("late release demand record %s\n", nbt_name_string(state, &state->replica.name))); - nbt_servers = irpc_servers_byname(state->msg_ctx, "nbt_server"); + nbt_servers = irpc_servers_byname(state->msg_ctx, state, "nbt_server"); if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { return NT_STATUS_INTERNAL_ERROR; } @@ -1051,7 +1051,7 @@ static NTSTATUS r_do_challenge(struct wreplsrv_partner *partner, talloc_steal(state, replica->owner); talloc_steal(state, replica->addresses); - nbt_servers = irpc_servers_byname(state->msg_ctx, "nbt_server"); + nbt_servers = irpc_servers_byname(state->msg_ctx, state, "nbt_server"); if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { return NT_STATUS_INTERNAL_ERROR; } @@ -1113,7 +1113,7 @@ static NTSTATUS r_do_release_demand(struct wreplsrv_partner *partner, DEBUG(4,("release demand record %s\n", nbt_name_string(mem_ctx, &replica->name))); - nbt_servers = irpc_servers_byname(partner->service->task->msg_ctx, "nbt_server"); + nbt_servers = irpc_servers_byname(partner->service->task->msg_ctx, mem_ctx, "nbt_server"); if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { return NT_STATUS_INTERNAL_ERROR; } diff --git a/source/wrepl_server/wrepl_scavenging.c b/source/wrepl_server/wrepl_scavenging.c index e134e64c065..b75fa72abfc 100644 --- a/source/wrepl_server/wrepl_scavenging.c +++ b/source/wrepl_server/wrepl_scavenging.c @@ -390,7 +390,7 @@ static NTSTATUS wreplsrv_scavenging_replica_active_records(struct wreplsrv_servi struct verify_state *s; struct server_id *nbt_servers; - nbt_servers = irpc_servers_byname(service->task->msg_ctx, "nbt_server"); + nbt_servers = irpc_servers_byname(service->task->msg_ctx, tmp_mem, "nbt_server"); if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { return NT_STATUS_INTERNAL_ERROR; }