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

r11423: Add some TALLOC_CTX

(This used to be commit a043ef33dc)
This commit is contained in:
Volker Lendecke 2005-10-31 20:28:08 +00:00 committed by Gerald (Jerry) Carter
parent 5ca7979b2c
commit 4bb85c2939
4 changed files with 16 additions and 13 deletions

View File

@ -35,13 +35,14 @@ struct cmd_lookupname_state {
static struct composite_context *lookupname_send_req(struct wbsrv_domain *domain, void *p); static struct composite_context *lookupname_send_req(struct wbsrv_domain *domain, void *p);
static NTSTATUS lookupname_recv_req(struct composite_context *ctx, void *p); static NTSTATUS lookupname_recv_req(struct composite_context *ctx, void *p);
struct composite_context *wb_cmd_lookupname_send(struct wbsrv_service *service, struct composite_context *wb_cmd_lookupname_send(TALLOC_CTX *mem_ctx,
struct wbsrv_service *service,
const char *dom_name, const char *dom_name,
const char *name) const char *name)
{ {
struct cmd_lookupname_state *state; struct cmd_lookupname_state *state;
state = talloc(NULL, struct cmd_lookupname_state); state = talloc(mem_ctx, struct cmd_lookupname_state);
state->name = talloc_asprintf(state, "%s\\%s", dom_name, name); state->name = talloc_asprintf(state, "%s\\%s", dom_name, name);
if (state->name == NULL) goto failed; if (state->name == NULL) goto failed;
state->ctx = wb_domain_request_send(state, service, state->ctx = wb_domain_request_send(state, service,
@ -97,12 +98,13 @@ NTSTATUS wb_cmd_lookupname_recv(struct composite_context *c,
return status; return status;
} }
NTSTATUS wb_cmd_lookupname(struct wbsrv_service *service, NTSTATUS wb_cmd_lookupname(TALLOC_CTX *mem_ctx,
struct wbsrv_service *service,
const char *dom_name, const char *dom_name,
const char *name, const char *name,
TALLOC_CTX *mem_ctx, struct wb_sid_object **sid) struct wb_sid_object **sid)
{ {
struct composite_context *c = struct composite_context *c =
wb_cmd_lookupname_send(service, dom_name, name); wb_cmd_lookupname_send(mem_ctx, service, dom_name, name);
return wb_cmd_lookupname_recv(c, mem_ctx, sid); return wb_cmd_lookupname_recv(c, mem_ctx, sid);
} }

View File

@ -35,12 +35,13 @@ struct cmd_lookupsid_state {
static struct composite_context *lookupsid_send_req(struct wbsrv_domain *domain, void *p); static struct composite_context *lookupsid_send_req(struct wbsrv_domain *domain, void *p);
static NTSTATUS lookupsid_recv_req(struct composite_context *ctx, void *p); static NTSTATUS lookupsid_recv_req(struct composite_context *ctx, void *p);
struct composite_context *wb_cmd_lookupsid_send(struct wbsrv_service *service, struct composite_context *wb_cmd_lookupsid_send(TALLOC_CTX *mem_ctx,
struct wbsrv_service *service,
const struct dom_sid *sid) const struct dom_sid *sid)
{ {
struct cmd_lookupsid_state *state; struct cmd_lookupsid_state *state;
state = talloc(NULL, struct cmd_lookupsid_state); state = talloc(mem_ctx, struct cmd_lookupsid_state);
state->sid = dom_sid_dup(state, sid); state->sid = dom_sid_dup(state, sid);
if (state->sid == NULL) goto failed; if (state->sid == NULL) goto failed;
state->ctx = wb_domain_request_send(state, service, state->ctx = wb_domain_request_send(state, service,
@ -95,11 +96,11 @@ NTSTATUS wb_cmd_lookupsid_recv(struct composite_context *c,
return status; return status;
} }
NTSTATUS wb_cmd_lookupsid(struct wbsrv_service *service, NTSTATUS wb_cmd_lookupsid(TALLOC_CTX *mem_ctx, struct wbsrv_service *service,
const struct dom_sid *sid, const struct dom_sid *sid,
TALLOC_CTX *mem_ctx, struct wb_sid_object **name) struct wb_sid_object **name)
{ {
struct composite_context *c = struct composite_context *c =
wb_cmd_lookupsid_send(service, sid); wb_cmd_lookupsid_send(mem_ctx, service, sid);
return wb_cmd_lookupsid_recv(c, mem_ctx, name); return wb_cmd_lookupsid_recv(c, mem_ctx, name);
} }

View File

@ -371,7 +371,7 @@ NTSTATUS wbsrv_samba3_lookupname(struct wbsrv_samba3_call *s3call)
DEBUG(5, ("wbsrv_samba3_lookupname called\n")); DEBUG(5, ("wbsrv_samba3_lookupname called\n"));
ctx = wb_cmd_lookupname_send(service, ctx = wb_cmd_lookupname_send(s3call, service,
s3call->request.data.name.dom_name, s3call->request.data.name.dom_name,
s3call->request.data.name.name); s3call->request.data.name.name);
NT_STATUS_HAVE_NO_MEMORY(ctx); NT_STATUS_HAVE_NO_MEMORY(ctx);
@ -425,7 +425,7 @@ NTSTATUS wbsrv_samba3_lookupsid(struct wbsrv_samba3_call *s3call)
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }
ctx = wb_cmd_lookupsid_send(service, sid); ctx = wb_cmd_lookupsid_send(s3call, service, sid);
NT_STATUS_HAVE_NO_MEMORY(ctx); NT_STATUS_HAVE_NO_MEMORY(ctx);
/* setup the callbacks */ /* setup the callbacks */

View File

@ -127,7 +127,7 @@ struct composite_context *wb_sid2domain_send(struct wbsrv_service *service,
return result; return result;
} }
ctx = wb_cmd_lookupsid_send(service, state->my_domain, state->sid); ctx = wb_cmd_lookupsid_send(state, service, state->sid);
if (ctx == NULL) goto failed; if (ctx == NULL) goto failed;
ctx->async.fn = sid2domain_recv_name; ctx->async.fn = sid2domain_recv_name;
ctx->async.private_data = state; ctx->async.private_data = state;