The branch, v4-7-test has been updated
       via  54ab11d s4: com: Replace erroneous inclusion of internal talloc.h 
header with external.
       via  dbc050b lib: auth: Store the netlogon_creds_cli_global_db pointer 
on the NULL context.
       via  eb2d10d s3: clients: Use netlogon_creds_cli_close_global_db() in 
all normal exit paths.
       via  301044e lib: auth: Add a shutdown function for 
netlogon_creds_cli_global_db.
       via  df7ccb9 s3: rpcclient: Use rpcclient_msg_ctx as the long-lived 
talloc context for rpcclient_netlogon_creds.
       via  fc3c124 s3: rpcclient: Use event context as the talloc parent of 
the rpcclient_msg_ctx.
       via  4880438 s3: rpcclient: Split out initialization and free of event 
context.
       via  65a90719 s3: rpc_client: Allocate struct db_context * off the local 
frame, as all other variables in this function.
       via  a4a0478 lib: cli: fname is a local variable already freed in the 
function scope, doesn't need to be on talloc_autofree_context()
       via  68f8c33 s4: schema: Allocate global_schema off the NULL context, 
not the talloc_autofree_context().
       via  07ee9d4 lib: ldb: Python. Take care of freeing the passed in module 
description if ldb_register_module() fails.
       via  d09bb56 lib: ldb: Use NULL to allocate modules not 
talloc_autofree_context().
       via  f5f63d6 s4: COM: Remove talloc_autofree_context() from (unused) COM 
code.
       via  490464a lib: rpc: The registered interfaces are a lists of 
singletons that are never removed.
       via  26cf4ec s4: modules. Fix missing TALLOC_CTX in module init function.
       via  a727c56 smb.conf: Explain that "ntlm auth" is a per-passdb setting
      from  67612bb selftest: Add test for password change when NTLM is disabled

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-7-test


- Log -----------------------------------------------------------------
commit 54ab11d16f21d4bb3ae3a62a86597ebaade0ae09
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Aug 14 13:02:30 2017 -0700

    s4: com: Replace erroneous inclusion of internal talloc.h header with 
external.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Stefan Metzmacher <me...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Tue Aug 15 08:06:40 CEST 2017 on sn-devel-144
    
    (cherry picked from commit f816de5636bb17ab09dd4b9c3e5b0249dc9b186f)
    
    Autobuild-User(v4-7-test): Karolin Seeger <ksee...@samba.org>
    Autobuild-Date(v4-7-test): Thu Aug 17 14:58:08 CEST 2017 on sn-devel-144

commit dbc050b7e888373dd43b56d1c42756d73047b98c
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 16:14:00 2017 -0700

    lib: auth: Store the netlogon_creds_cli_global_db pointer on the NULL 
context.
    
    Now we shutdown correctly it doesn't need the talloc_autofree_context().
    
    Last use of talloc_autofree_context() ourside the talloc test code !
    
    Please don't add it ever again :-).
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Thu Jul 27 01:34:12 CEST 2017 on sn-devel-144
    
    (cherry picked from commit e74081ce5d0f81024f7384816c589e5bc28baf80)

commit eb2d10df8ad7ed80de8c83e03618ae6624cb03cf
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 16:12:45 2017 -0700

    s3: clients: Use netlogon_creds_cli_close_global_db() in all normal exit 
paths.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit dbd32932463935cd47c55a9e1afdaccd7f6daf4d)

commit 301044e10640aa6ce4867c28fc61aed889fbb611
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 14:49:47 2017 -0700

    lib: auth: Add a shutdown function for netlogon_creds_cli_global_db.
    
    Will allow us to move off the talloc_autofree_context().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 4cc104d015bdfeb631c7c8f5252fc31727a128ca)

commit df7ccb91466fee717dd8d49c6ba54b770591c1b2
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 13:14:08 2017 -0700

    s3: rpcclient: Use rpcclient_msg_ctx as the long-lived talloc context for 
rpcclient_netlogon_creds.
    
    Guaranteed to stay around until the command exits.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 74b589799e794cc8872a7d3845ced9f5087a8366)

commit fc3c124662c92cbb3d58ac110c22b16b56403491
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 13:12:20 2017 -0700

    s3: rpcclient: Use event context as the talloc parent of the 
rpcclient_msg_ctx.
    
    Give control over shutdown.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit b1450af1c3c7ddc0573510706d605eedecaff61c)

commit 48804386b983e21f4aab3c90a1d0178f41db33d6
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 13:10:30 2017 -0700

    s3: rpcclient: Split out initialization and free of event context.
    
    Allows us to control shutdown.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 1d6b98cdab4f0a400673cf967225214e858ab1ee)

commit 65a90719213dd5f886a4c62586d64c77394906a0
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 12:58:29 2017 -0700

    s3: rpc_client: Allocate struct db_context * off the local frame, as all 
other variables in this function.
    
    On success, netlogon_creds_cli_set_global_db() reparents it to a long-lived 
context.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 1fb46b76dbcf28d8c71ff1096c402953a90bcf5f)

commit a4a0478b00b48ae4900c8a711fa1596fed79b7ba
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 12:56:15 2017 -0700

    lib: cli: fname is a local variable already freed in the function scope, 
doesn't need to be on talloc_autofree_context()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 5c8a98c2dae92c71873798eb37f506093700a14c)

commit 68f8c33ac734118d366607b25e21870057bb2438
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 12:50:50 2017 -0700

    s4: schema: Allocate global_schema off the NULL context, not the 
talloc_autofree_context().
    
    The ldb context keeps a talloc_reference to this also, so the long-live 
allocation
    context can be NULL.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit c27a6438cb3dd98fc300311a951b91be91610a90)

commit 07ee9d4e01ffb141ce7062a8df1e9795145cf683
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 12:12:17 2017 -0700

    lib: ldb: Python. Take care of freeing the passed in module description if 
ldb_register_module() fails.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 99e4bea89e82327e6de3adf7e8411eb9a89f54db)

commit d09bb56b3dce6dedf3599b0f3cc357daaf694e64
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 12:11:03 2017 -0700

    lib: ldb: Use NULL to allocate modules not talloc_autofree_context().
    
    ldb modules are not (yet) unloaded and are only loaded once (there is a 
check
    that makes sure of this). Allocate off the NULL context. We never want this
    to be freed until process shutdown. If eventually we add the ability to
    unload ldb modules we can add a deregister function that walks and frees 
the list.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 41b1f8a20c7db6b79706a4aebcc7074149a6ab62)

commit f5f63d6d64b0a2b5899829e1f152150ea3987c6c
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 12:00:21 2017 -0700

    s4: COM: Remove talloc_autofree_context() from (unused) COM code.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit fe2ac3e304201d18ca15d388b622a4f15f72ad0a)

commit 490464a63c71dfe3be6f4843088ffb99eeb63c55
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 11:43:47 2017 -0700

    lib: rpc: The registered interfaces are a lists of singletons that are 
never removed.
    
    Allocate them off the NULL context not the talloc_autofree_context().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 1c1fce74142f1ba982fee045cdb72938faabe5d5)

commit 26cf4ec9807afa80c3dba50ea58d4dba958e6f2d
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jul 24 10:02:08 2017 -0700

    s4: modules. Fix missing TALLOC_CTX in module init function.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 34ca1b3af46d0e647f1094a75844128a30f61330)

commit a727c56ccc13dd538b5ca502b6ee8432fc2a3944
Author: Andrew Bartlett <abart...@samba.org>
Date:   Mon Jul 24 14:09:19 2017 +1200

    smb.conf: Explain that "ntlm auth" is a per-passdb setting
    
    This parameter has always applied to this passdb only, not to domain
    authentication.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12929
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 9d4a9bd3cc6d5031b4cb6120be8d261350a8bdfc)

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/smbdotconf/security/ntlmauth.xml | 18 ++++++++++++++----
 lib/ldb/common/ldb_modules.c              | 12 +++++++++++-
 lib/ldb/pyldb.c                           |  5 ++++-
 libcli/auth/netlogon_creds_cli.c          | 11 ++++++++---
 libcli/auth/netlogon_creds_cli.h          |  1 +
 librpc/ndr/ndr_table.c                    | 12 +++++++++++-
 pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm   |  6 +++---
 source3/include/includes.h                |  1 +
 source3/lib/netapi/netapi.c               |  2 ++
 source3/rpc_client/cli_netlogon.c         |  2 +-
 source3/rpcclient/rpcclient.c             | 19 +++++++++++++++----
 source3/smbd/server_exit.c                |  2 ++
 source3/winbindd/winbindd.c               |  3 +++
 source4/dsdb/schema/schema_set.c          |  4 ++--
 source4/lib/com/classes/simple.c          |  4 ++--
 source4/lib/com/com.h                     |  3 ++-
 source4/lib/com/dcom/tables.c             | 10 ++++++----
 source4/lib/com/tables.c                  |  6 ++++--
 source4/lib/wmi/wbemdata.c                |  4 ++--
 source4/rpc_server/remote/dcesrv_remote.c |  4 ++--
 20 files changed, 96 insertions(+), 33 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/security/ntlmauth.xml 
b/docs-xml/smbdotconf/security/ntlmauth.xml
index f0969bf..dceae44 100644
--- a/docs-xml/smbdotconf/security/ntlmauth.xml
+++ b/docs-xml/smbdotconf/security/ntlmauth.xml
@@ -6,8 +6,18 @@
 <description>
     <para>This parameter determines whether or not 
<citerefentry><refentrytitle>smbd</refentrytitle>
     <manvolnum>8</manvolnum></citerefentry> will attempt to
-    authenticate users using the NTLM encrypted password response.
-    If disabled, NTLM and LanMan authencication is disabled server-wide.</para>
+    authenticate users using the NTLM encrypted password response for
+    this local passdb (SAM or account database). </para>
+
+    <para>If disabled, both NTLM and LanMan authencication against the
+    local passdb is disabled.</para>
+
+    <para>Note that these settings apply only to local users,
+    authentication will still be forwarded to and NTLM authentication
+    accepted against any domain we are joined to, and any trusted
+    domain, even if disabled or if NTLMv2-only is enforced here.  To
+    control NTLM authentiation for domain users, this must option must
+    be configured on each DC.</para>
 
     <para>By default with <command moreinfo="none">lanman
     auth</command> set to <constant>no</constant> and
@@ -41,8 +51,8 @@
         </listitem>
 
         <listitem>
-          <para><constant>disabled</constant> - Do not allow NTLM (or
-          LanMan) authentication of any level as a server, nor permit
+          <para><constant>disabled</constant> - Do not accept NTLM (or
+          LanMan) authentication of any level, nor permit
           NTLM password changes.</para>
         </listitem>
 
diff --git a/lib/ldb/common/ldb_modules.c b/lib/ldb/common/ldb_modules.c
index 3dd0438..25551e1 100644
--- a/lib/ldb/common/ldb_modules.c
+++ b/lib/ldb/common/ldb_modules.c
@@ -280,7 +280,17 @@ int ldb_register_module(const struct ldb_module_ops *ops)
        if (ldb_find_module_ops(ops->name) != NULL)
                return LDB_ERR_ENTRY_ALREADY_EXISTS;
 
-       entry = talloc(talloc_autofree_context(), struct ops_list_entry);
+       /*
+        * ldb modules are not (yet) unloaded and
+        * are only loaded once (the above check
+        * makes sure of this). Allocate off the NULL
+        * context. We never want this to be freed
+        * until process shutdown. If eventually we
+        * want to unload ldb modules we can add a
+        * deregister function that walks and
+        * frees the list.
+        */
+       entry = talloc(NULL, struct ops_list_entry);
        if (entry == NULL) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index b65e255..515a69e 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -3949,7 +3949,7 @@ static PyObject *py_register_module(PyObject *module, 
PyObject *args)
        if (!PyArg_ParseTuple(args, "O", &input))
                return NULL;
 
-       ops = talloc_zero(talloc_autofree_context(), struct ldb_module_ops);
+       ops = talloc_zero(NULL, struct ldb_module_ops);
        if (ops == NULL) {
                PyErr_NoMemory();
                return NULL;
@@ -3972,6 +3972,9 @@ static PyObject *py_register_module(PyObject *module, 
PyObject *args)
        ops->del_transaction = py_module_del_transaction;
 
        ret = ldb_register_module(ops);
+       if (ret != LDB_SUCCESS) {
+               TALLOC_FREE(ops);
+       }
 
        PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, NULL);
 
diff --git a/libcli/auth/netlogon_creds_cli.c b/libcli/auth/netlogon_creds_cli.c
index 367bf6c..526ee39 100644
--- a/libcli/auth/netlogon_creds_cli.c
+++ b/libcli/auth/netlogon_creds_cli.c
@@ -208,7 +208,7 @@ NTSTATUS netlogon_creds_cli_set_global_db(struct db_context 
**db)
                return NT_STATUS_INVALID_PARAMETER_MIX;
        }
 
-       netlogon_creds_cli_global_db = talloc_move(talloc_autofree_context(), 
db);
+       netlogon_creds_cli_global_db = talloc_move(NULL, db);
        return NT_STATUS_OK;
 }
 
@@ -221,12 +221,12 @@ NTSTATUS netlogon_creds_cli_open_global_db(struct 
loadparm_context *lp_ctx)
                return NT_STATUS_OK;
        }
 
-       fname = lpcfg_private_db_path(talloc_autofree_context(), lp_ctx, 
"netlogon_creds_cli");
+       fname = lpcfg_private_db_path(NULL, lp_ctx, "netlogon_creds_cli");
        if (fname == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
 
-       global_db = dbwrap_local_open(talloc_autofree_context(), lp_ctx,
+       global_db = dbwrap_local_open(NULL, lp_ctx,
                                      fname, 0,
                                      TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
                                      O_RDWR|O_CREAT,
@@ -244,6 +244,11 @@ NTSTATUS netlogon_creds_cli_open_global_db(struct 
loadparm_context *lp_ctx)
        return NT_STATUS_OK;
 }
 
+void netlogon_creds_cli_close_global_db(void)
+{
+       TALLOC_FREE(netlogon_creds_cli_global_db);
+}
+
 NTSTATUS netlogon_creds_cli_context_global(struct loadparm_context *lp_ctx,
                                struct messaging_context *msg_ctx,
                                const char *client_account,
diff --git a/libcli/auth/netlogon_creds_cli.h b/libcli/auth/netlogon_creds_cli.h
index cecb0e6..32902f1 100644
--- a/libcli/auth/netlogon_creds_cli.h
+++ b/libcli/auth/netlogon_creds_cli.h
@@ -32,6 +32,7 @@ struct db_context;
 
 NTSTATUS netlogon_creds_cli_set_global_db(struct db_context **db);
 NTSTATUS netlogon_creds_cli_open_global_db(struct loadparm_context *lp_ctx);
+void netlogon_creds_cli_close_global_db(void);
 
 NTSTATUS netlogon_creds_cli_context_global(struct loadparm_context *lp_ctx,
                                struct messaging_context *msg_ctx,
diff --git a/librpc/ndr/ndr_table.c b/librpc/ndr/ndr_table.c
index 3dc158f..f64e5ac 100644
--- a/librpc/ndr/ndr_table.c
+++ b/librpc/ndr/ndr_table.c
@@ -44,7 +44,17 @@ NTSTATUS ndr_table_register(const struct ndr_interface_table 
*table)
                }
        }
 
-       l = talloc(talloc_autofree_context(), struct ndr_interface_list);
+       /*
+        * This is a singleton instance guarenteed
+        * by the above check to be only added once
+        * into the list so we can allocate off the NULL
+        * context. We never want this to be freed
+        * until process shutdown. If needed we could
+        * add a deregister function that walks and
+        * frees the list.
+        */
+
+       l = talloc(NULL, struct ndr_interface_list);
        l->table = table;
 
        DLIST_ADD(ndr_interfaces, l);
diff --git a/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm 
b/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
index 27e1e5d..35e6e3f 100644
--- a/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
@@ -44,9 +44,9 @@ sub ParseRegFunc($)
 {
        my $interface = shift;
 
-       $res .= "static NTSTATUS dcom_proxy_$interface->{NAME}_init(void)
+       $res .= "static NTSTATUS dcom_proxy_$interface->{NAME}_init(TALLOC_CTX 
*ctx)
 {
-       struct $interface->{NAME}_vtable *proxy_vtable = 
talloc(talloc_autofree_context(), struct $interface->{NAME}_vtable);
+       struct $interface->{NAME}_vtable *proxy_vtable = talloc(ctx, struct 
$interface->{NAME}_vtable);
 ";
 
        if (defined($interface->{BASE})) {
@@ -75,7 +75,7 @@ sub ParseRegFunc($)
        $res.= "
        proxy_vtable->iid = ndr_table_$interface->{NAME}.syntax_id.uuid;
 
-       return dcom_register_proxy((struct IUnknown_vtable *)proxy_vtable);
+       return dcom_register_proxy(ctx, (struct IUnknown_vtable *)proxy_vtable);
 }\n\n";
 }
 
diff --git a/source3/include/includes.h b/source3/include/includes.h
index e82bfad..58bfaa7 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -317,6 +317,7 @@ typedef char fstring[FSTRING_LEN];
 
 #include "../libcli/util/ntstatus.h"
 #include "../libcli/util/error.h"
+#include "../libcli/auth/netlogon_creds_cli.h"
 #include "../lib/util/charset/charset.h"
 #include "dynconfig/dynconfig.h"
 #include "locking.h"
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index 3ed7295..093348b 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -184,6 +184,8 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
 
        secrets_shutdown();
 
+       netlogon_creds_cli_close_global_db();
+
        if (ctx == stat_ctx) {
                stat_ctx = NULL;
        }
diff --git a/source3/rpc_client/cli_netlogon.c 
b/source3/rpc_client/cli_netlogon.c
index d17c6c0..719b985 100644
--- a/source3/rpc_client/cli_netlogon.c
+++ b/source3/rpc_client/cli_netlogon.c
@@ -67,7 +67,7 @@ NTSTATUS rpccli_pre_open_netlogon_creds(void)
                return NT_STATUS_NO_MEMORY;
        }
 
-       global_db = db_open(talloc_autofree_context(), fname,
+       global_db = db_open(frame, fname,
                            0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
                            O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_2,
                            DBWRAP_FLAG_OPTIMIZE_READONLY_ACCESS);
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index be77696..3203df2 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -766,7 +766,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
                                default_transport,
                                rpcclient_netlogon_domain,
                                &cmd_entry->rpc_pipe,
-                               talloc_autofree_context(),
+                               rpcclient_msg_ctx,
                                &rpcclient_netlogon_creds);
                        break;
                default:
@@ -805,7 +805,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
                        ntresult = 
rpccli_create_netlogon_creds_with_creds(creds,
                                                        dc_name,
                                                        rpcclient_msg_ctx,
-                                                       
talloc_autofree_context(),
+                                                       rpcclient_msg_ctx,
                                                        
&rpcclient_netlogon_creds);
                        if (!NT_STATUS_IS_OK(ntresult)) {
                                DEBUG(0, ("Could not initialise credentials for 
%s.\n",
@@ -948,6 +948,7 @@ out_free:
        const char *binding_string = NULL;
        const char *host;
        int signing_state = SMB_SIGNING_IPC_DEFAULT;
+       struct tevent_context *ev_ctx = NULL;
 
        /* make sure the vars that get altered (4th field) are in
           a fixed location or certain compilers complain */
@@ -1013,8 +1014,15 @@ out_free:
        poptFreeContext(pc);
        popt_burn_cmdline_password(argc, argv);
 
-       nt_status = messaging_init_client(talloc_autofree_context(),
-                                         
samba_tevent_context_init(talloc_autofree_context()),
+       ev_ctx = samba_tevent_context_init(frame);
+       if (ev_ctx == NULL) {
+               fprintf(stderr, "Could not init event context\n");
+               result = 1;
+               goto done;
+       }
+
+       nt_status = messaging_init_client(ev_ctx,
+                                         ev_ctx,
                                          &rpcclient_msg_ctx);
        if (geteuid() != 0 &&
                        NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED)) {
@@ -1246,6 +1254,9 @@ done:
                cli_shutdown(cli);
        }
        popt_free_cmdline_auth_info();
+       netlogon_creds_cli_close_global_db();
+       TALLOC_FREE(rpcclient_msg_ctx);
+       TALLOC_FREE(ev_ctx);
        TALLOC_FREE(frame);
        return result;
 }
diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c
index bf50394..74ddd70 100644
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -46,6 +46,7 @@
 #include "messages.h"
 #include "../lib/util/pidfile.h"
 #include "smbprofile.h"
+#include "libcli/auth/netlogon_creds_cli.h"
 
 static struct files_struct *log_writeable_file_fn(
        struct files_struct *fsp, void *private_data)
@@ -226,6 +227,7 @@ static void exit_server_common(enum server_exit_reason how,
        sconn = NULL;
        xconn = NULL;
        client = NULL;
+       netlogon_creds_cli_close_global_db();
        TALLOC_FREE(global_smbXsrv_client);
        smbprofile_dump();
        server_messaging_context_free();
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 58e4d89..f244516 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -44,6 +44,7 @@
 #include "lib/param/param.h"
 #include "lib/async_req/async_sock.h"
 #include "libsmb/samlogon_cache.h"
+#include "libcli/auth/netlogon_creds_cli.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
@@ -245,6 +246,8 @@ static void terminate(bool is_parent)
 
        gencache_stabilize();
 
+       netlogon_creds_cli_close_global_db();
+
 #if 0
        if (interactive) {
                TALLOC_CTX *mem_ctx = talloc_init("end_description");
diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c
index 12a3cab..cfd320b 100644
--- a/source4/dsdb/schema/schema_set.c
+++ b/source4/dsdb/schema/schema_set.c
@@ -734,11 +734,11 @@ void dsdb_make_schema_global(struct ldb_context *ldb, 
struct dsdb_schema *schema
        }
 
        if (global_schema) {
-               talloc_unlink(talloc_autofree_context(), global_schema);
+               talloc_unlink(NULL, global_schema);
        }
 
        /* we want the schema to be around permanently */
-       talloc_reparent(ldb, talloc_autofree_context(), schema);
+       talloc_reparent(ldb, NULL, schema);
        global_schema = schema;
 
        /* This calls the talloc_reference() of the global schema back onto the 
ldb */
diff --git a/source4/lib/com/classes/simple.c b/source4/lib/com/classes/simple.c
index 28f5d84..7d05733 100644
--- a/source4/lib/com/classes/simple.c
+++ b/source4/lib/com/classes/simple.c
@@ -110,7 +110,7 @@ static struct IStream_vtable simple_IStream_vtable = {
 NTSTATUS com_simple_init(TALLOC_CTX *ctx)
 {
        struct GUID clsid;
-       struct IUnknown *class_object = talloc(talloc_autofree_context(), 
struct IUnknown);
+       struct IUnknown *class_object = talloc(ctx, struct IUnknown);
 
        class_object->ctx = NULL;
        class_object->object_data = NULL;
@@ -120,5 +120,5 @@ NTSTATUS com_simple_init(TALLOC_CTX *ctx)
        GUID_from_string(COM_ICLASSFACTORY_UUID, 
&simple_classobject_vtable.iid);
        GUID_from_string(COM_ISTREAM_UUID, &simple_IStream_vtable.iid);
 
-       return com_register_running_class(&clsid, PROGID_SIMPLE, class_object);
+       return com_register_running_class(ctx, &clsid, PROGID_SIMPLE, 
class_object);
 }
diff --git a/source4/lib/com/com.h b/source4/lib/com/com.h
index 82d10da..56cd210 100644
--- a/source4/lib/com/com.h
+++ b/source4/lib/com/com.h
@@ -20,6 +20,7 @@
 #ifndef __SAMBA_COM_H__
 #define __SAMBA_COM_H__
 
+#include <talloc.h>
 #include "librpc/gen_ndr/misc.h"
 
 struct com_context;
@@ -38,7 +39,7 @@ struct com_context
 };
 
 struct IUnknown *com_class_by_clsid(struct com_context *ctx, const struct GUID 
*clsid);
-NTSTATUS com_register_running_class(struct GUID *clsid, const char *progid, 
struct IUnknown *p);
+NTSTATUS com_register_running_class(TALLOC_CTX *ctx, struct GUID *clsid, const 
char *progid, struct IUnknown *p);
 
 struct dcom_interface_p *dcom_get_local_iface_p(struct GUID *ipid);
 
diff --git a/source4/lib/com/dcom/tables.c b/source4/lib/com/dcom/tables.c
index f94aa87..7f745c1 100644
--- a/source4/lib/com/dcom/tables.c
+++ b/source4/lib/com/dcom/tables.c
@@ -29,9 +29,10 @@ static struct dcom_proxy {
        struct dcom_proxy *prev, *next;
 }  *proxies = NULL;
 
-NTSTATUS dcom_register_proxy(struct IUnknown_vtable *proxy_vtable)
+NTSTATUS dcom_register_proxy(TALLOC_CTX *ctx,
+               struct IUnknown_vtable *proxy_vtable)
 {
-       struct dcom_proxy *proxy = talloc(talloc_autofree_context(), struct 
dcom_proxy);
+       struct dcom_proxy *proxy = talloc(ctx, struct dcom_proxy);
 
        proxy->vtable = proxy_vtable;
        DLIST_ADD(proxies, proxy);
@@ -57,9 +58,10 @@ static struct dcom_marshal {
        struct dcom_marshal *prev, *next;
 }  *marshals = NULL;
 
-NTSTATUS dcom_register_marshal(struct GUID *clsid, marshal_fn marshal, 
unmarshal_fn unmarshal)
+NTSTATUS dcom_register_marshal(TALLOC_CTX *ctx,
+               struct GUID *clsid, marshal_fn marshal, unmarshal_fn unmarshal)
 {
-       struct dcom_marshal *p = talloc(talloc_autofree_context(), struct 
dcom_marshal);
+       struct dcom_marshal *p = talloc(ctx, struct dcom_marshal);
 
        p->clsid = *clsid;
        p->marshal = marshal;
diff --git a/source4/lib/com/tables.c b/source4/lib/com/tables.c
index 842067e..e1f93bc 100644
--- a/source4/lib/com/tables.c
+++ b/source4/lib/com/tables.c
@@ -96,9 +96,11 @@ struct IUnknown *com_class_by_clsid(struct com_context *ctx, 
const struct GUID *
        return NULL;
 }
 
-NTSTATUS com_register_running_class(struct GUID *clsid, const char *progid, 
struct IUnknown *p)
+NTSTATUS com_register_running_class(TALLOC_CTX *ctx,
+               struct GUID *clsid, const char *progid, struct IUnknown *p)
 {
-       struct com_class *l = 
talloc_zero(running_classes?running_classes:talloc_autofree_context(), struct 
com_class);
+       struct com_class *l = talloc_zero(running_classes?
+                               running_classes : ctx, struct com_class);
 
        l->clsid = *clsid;
        l->progid = talloc_strdup(l, progid);
diff --git a/source4/lib/wmi/wbemdata.c b/source4/lib/wmi/wbemdata.c
index 2aeda01..df98da4 100644
--- a/source4/lib/wmi/wbemdata.c
+++ b/source4/lib/wmi/wbemdata.c
@@ -432,11 +432,11 @@ struct composite_context 
*dcom_proxy_IEnumWbemClassObject_Release_send(struct IU
        return c;
 }
 
-NTSTATUS dcom_proxy_IWbemClassObject_init(void)
+NTSTATUS dcom_proxy_IWbemClassObject_init(TALLOC_CTX *ctx)
 {
        struct GUID clsid;
        GUID_from_string("4590f812-1d3a-11d0-891f-00aa004b2e24", &clsid);
-       dcom_register_marshal(&clsid, marshal, unmarshal);
+       dcom_register_marshal(ctx, &clsid, marshal, unmarshal);
 
 #if 0
        struct IEnumWbemClassObject_vtable *proxy_vtable;
diff --git a/source4/rpc_server/remote/dcesrv_remote.c 
b/source4/rpc_server/remote/dcesrv_remote.c
index 69ce08c..b32fe9b 100644
--- a/source4/rpc_server/remote/dcesrv_remote.c
+++ b/source4/rpc_server/remote/dcesrv_remote.c
@@ -28,7 +28,7 @@
 #include "librpc/ndr/ndr_table.h"
 #include "param/param.h"
 
-NTSTATUS dcerpc_server_remote_init(void);
+NTSTATUS dcerpc_server_remote_init(TALLOC_CTX *ctx);
 
 struct dcesrv_remote_private {
        struct dcerpc_pipe *c_pipe;
@@ -403,7 +403,7 @@ static bool remote_op_interface_by_name(struct 
dcesrv_interface *iface, const ch
        return false;   
 }
 
-NTSTATUS dcerpc_server_remote_init(void)
+NTSTATUS dcerpc_server_remote_init(TALLOC_CTX *ctx)
 {
        NTSTATUS ret;
        static const struct dcesrv_endpoint_server ep_server = {


-- 
Samba Shared Repository

Reply via email to