s4: auth: Add TALLOC_CTX * to auth_register()
authorJeremy Allison <jra@samba.org>
Tue, 9 May 2017 19:39:14 +0000 (12:39 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 11 May 2017 18:30:12 +0000 (20:30 +0200)
Use the talloc context passed into all modules.
Remove one more talloc_autofree_context().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/auth/auth.h
source4/auth/ntlm/auth.c
source4/auth/ntlm/auth_anonymous.c
source4/auth/ntlm/auth_developer.c
source4/auth/ntlm/auth_sam.c
source4/auth/ntlm/auth_unix.c
source4/auth/ntlm/auth_winbind.c

index 066703d59da061ec40f65276a0fa02201ea0fc9d..de3a8bd5b2272dad79bd5c9ed811a265c28e72de 100644 (file)
@@ -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,
index 2f2cdc1a4ff72208818bb5f31c2e23ef0c667801..c8c3e11e5b35ce5798e5eef366c8bac29bf3db50 100644 (file)
@@ -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);
 
index 9bdcf0cbcb4075b5a855259c11fd81b16c50b53f..6d3d0ace82c8ea938c6868c6eff10f52ca32830f 100644 (file)
@@ -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;
index 93a073b125d69d3da0dfcec5876801cca100f26e..e7e4be96ae8cde22d45cae1cc8ff614ac0d7761b 100644 (file)
@@ -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;
index 305fdc5d2813893aedd523d38d7eb5a5475d5959..f7da04e657375afbe98b15ce4bd09ddc4d5970e1 100644 (file)
@@ -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;
index 5fb8b4f5dde61b42069312d4d7d2bfc97d0878aa..ad780bafc826b6ac6efa28c49d5a94cb905d3097 100644 (file)
@@ -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;
index d5bf5ad268521aed0cde821299913f89d575344c..f5bd22acef6c07846fef33abe181120b5a8d912c 100644 (file)
@@ -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;