1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r22748: fix memleaks by passing an mem_ctx to

irpc_servers_byname()

metze
(This used to be commit b54584dfab)
This commit is contained in:
Stefan Metzmacher 2007-05-07 15:19:53 +00:00 committed by Gerald (Jerry) Carter
parent 56ab0cd77c
commit 68b531e817
8 changed files with 15 additions and 14 deletions

View File

@ -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;

View File

@ -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);

View File

@ -962,6 +962,7 @@ 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,
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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}