From 34f616fc6f48a4182f7e5125a080de205925c7e4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 9 May 2017 12:39:14 -0700 Subject: [PATCH] s4: auth: Add TALLOC_CTX * to auth_register() Use the talloc context passed into all modules. Remove one more talloc_autofree_context(). Signed-off-by: Jeremy Allison Reviewed-by: Andreas Schneider --- source4/auth/auth.h | 2 +- source4/auth/ntlm/auth.c | 5 +++-- source4/auth/ntlm/auth_anonymous.c | 2 +- source4/auth/ntlm/auth_developer.c | 2 +- source4/auth/ntlm/auth_sam.c | 6 +++--- source4/auth/ntlm/auth_unix.c | 2 +- source4/auth/ntlm/auth_winbind.c | 6 +++--- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/source4/auth/auth.h b/source4/auth/auth.h index 066703d59da..de3a8bd5b22 100644 --- a/source4/auth/auth.h +++ b/source4/auth/auth.h @@ -156,7 +156,7 @@ NTSTATUS auth_check_password(struct auth4_context *auth_ctx, struct auth_user_info_dc **user_info_dc, uint8_t *pauthoritative); NTSTATUS auth4_init(void); -NTSTATUS auth_register(const struct auth_operations *ops); +NTSTATUS auth_register(TALLOC_CTX *mem_ctx, const struct auth_operations *ops); NTSTATUS server_service_auth_init(TALLOC_CTX *ctx); NTSTATUS authenticate_ldap_simple_bind(TALLOC_CTX *mem_ctx, struct tevent_context *ev, diff --git a/source4/auth/ntlm/auth.c b/source4/auth/ntlm/auth.c index 2f2cdc1a4ff..c8c3e11e5b3 100644 --- a/source4/auth/ntlm/auth.c +++ b/source4/auth/ntlm/auth.c @@ -764,7 +764,8 @@ static int num_backends; The 'name' can be later used by other backends to find the operations structure for this backend. */ -_PUBLIC_ NTSTATUS auth_register(const struct auth_operations *ops) +_PUBLIC_ NTSTATUS auth_register(TALLOC_CTX *mem_ctx, + const struct auth_operations *ops) { struct auth_operations *new_ops; @@ -775,7 +776,7 @@ _PUBLIC_ NTSTATUS auth_register(const struct auth_operations *ops) return NT_STATUS_OBJECT_NAME_COLLISION; } - backends = talloc_realloc(talloc_autofree_context(), backends, + backends = talloc_realloc(mem_ctx, backends, struct auth_backend, num_backends+1); NT_STATUS_HAVE_NO_MEMORY(backends); diff --git a/source4/auth/ntlm/auth_anonymous.c b/source4/auth/ntlm/auth_anonymous.c index 9bdcf0cbcb4..6d3d0ace82c 100644 --- a/source4/auth/ntlm/auth_anonymous.c +++ b/source4/auth/ntlm/auth_anonymous.c @@ -99,7 +99,7 @@ _PUBLIC_ NTSTATUS auth4_anonymous_init(TALLOC_CTX *ctx) { NTSTATUS ret; - ret = auth_register(&anonymous_auth_ops); + ret = auth_register(ctx, &anonymous_auth_ops); if (!NT_STATUS_IS_OK(ret)) { DEBUG(0,("Failed to register 'anonymous' auth backend!\n")); return ret; diff --git a/source4/auth/ntlm/auth_developer.c b/source4/auth/ntlm/auth_developer.c index 93a073b125d..e7e4be96ae8 100644 --- a/source4/auth/ntlm/auth_developer.c +++ b/source4/auth/ntlm/auth_developer.c @@ -141,7 +141,7 @@ _PUBLIC_ NTSTATUS auth4_developer_init(TALLOC_CTX *ctx) { NTSTATUS ret; - ret = auth_register(&name_to_ntstatus_auth_ops); + ret = auth_register(ctx, &name_to_ntstatus_auth_ops); if (!NT_STATUS_IS_OK(ret)) { DEBUG(0,("Failed to register 'name_to_ntstatus' auth backend!\n")); return ret; diff --git a/source4/auth/ntlm/auth_sam.c b/source4/auth/ntlm/auth_sam.c index 305fdc5d281..f7da04e6573 100644 --- a/source4/auth/ntlm/auth_sam.c +++ b/source4/auth/ntlm/auth_sam.c @@ -928,19 +928,19 @@ _PUBLIC_ NTSTATUS auth4_sam_init(TALLOC_CTX *ctx) { NTSTATUS ret; - ret = auth_register(&sam_ops); + ret = auth_register(ctx, &sam_ops); if (!NT_STATUS_IS_OK(ret)) { DEBUG(0,("Failed to register 'sam' auth backend!\n")); return ret; } - ret = auth_register(&sam_ignoredomain_ops); + ret = auth_register(ctx, &sam_ignoredomain_ops); if (!NT_STATUS_IS_OK(ret)) { DEBUG(0,("Failed to register 'sam_ignoredomain' auth backend!\n")); return ret; } - ret = auth_register(&sam_failtrusts_ops); + ret = auth_register(ctx, &sam_failtrusts_ops); if (!NT_STATUS_IS_OK(ret)) { DEBUG(0,("Failed to register 'sam_failtrusts' auth backend!\n")); return ret; diff --git a/source4/auth/ntlm/auth_unix.c b/source4/auth/ntlm/auth_unix.c index 5fb8b4f5dde..ad780bafc82 100644 --- a/source4/auth/ntlm/auth_unix.c +++ b/source4/auth/ntlm/auth_unix.c @@ -755,7 +755,7 @@ _PUBLIC_ NTSTATUS auth4_unix_init(TALLOC_CTX *ctx) { NTSTATUS ret; - ret = auth_register(&unix_ops); + ret = auth_register(ctx, &unix_ops); if (!NT_STATUS_IS_OK(ret)) { DEBUG(0,("Failed to register unix auth backend!\n")); return ret; diff --git a/source4/auth/ntlm/auth_winbind.c b/source4/auth/ntlm/auth_winbind.c index d5bf5ad2685..f5bd22acef6 100644 --- a/source4/auth/ntlm/auth_winbind.c +++ b/source4/auth/ntlm/auth_winbind.c @@ -317,19 +317,19 @@ _PUBLIC_ NTSTATUS auth4_winbind_init(TALLOC_CTX *ctx) { NTSTATUS ret; - ret = auth_register(&winbind_ops); + ret = auth_register(ctx, &winbind_ops); if (!NT_STATUS_IS_OK(ret)) { DEBUG(0,("Failed to register 'winbind' auth backend!\n")); return ret; } - ret = auth_register(&winbind_rodc_ops); + ret = auth_register(ctx, &winbind_rodc_ops); if (!NT_STATUS_IS_OK(ret)) { DEBUG(0,("Failed to register 'winbind_rodc' auth backend!\n")); return ret; } - ret = auth_register(&winbind_wbclient_ops); + ret = auth_register(ctx, &winbind_wbclient_ops); if (!NT_STATUS_IS_OK(ret)) { DEBUG(0,("Failed to register 'winbind_wbclient' auth backend!\n")); return ret; -- 2.34.1