summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-11-23 00:16:54 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-11-23 00:16:54 +0000
commit62685054962f4be7d8791b87dff85e89347269e8 (patch)
tree357e0e7438c44d266603b694a77f3a6a69c9d603
parent6b81cc2e0bca79f4aa472cd2b1b90d0c51818612 (diff)
downloadsamba-62685054962f4be7d8791b87dff85e89347269e8.tar.gz
samba-62685054962f4be7d8791b87dff85e89347269e8.tar.bz2
samba-62685054962f4be7d8791b87dff85e89347269e8.zip
Patch by emil@disksites.com <Emil Rasamat> to ensure we always always
free() each auth method. (We had relied on the use of talloc() only, despite providing the free() callback) Andrew Bartlett (This used to be commit 5872c0e26e3407c7c1dcf2074a36896a3ca1325a)
-rw-r--r--source3/auth/auth.c15
-rw-r--r--source3/auth/auth_server.c2
2 files changed, 15 insertions, 2 deletions
diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index 20dccc6592..1b49699fbc 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -321,9 +321,20 @@ static NTSTATUS check_ntlm_password(const struct auth_context *auth_context,
static void free_auth_context(struct auth_context **auth_context)
{
- if (*auth_context != NULL)
+ auth_methods *auth_method;
+
+ if (*auth_context) {
+ /* Free private data of context's authentication methods */
+ for (auth_method = (*auth_context)->auth_method_list; auth_method; auth_method = auth_method->next) {
+ if (auth_method->free_private_data) {
+ auth_method->free_private_data (&auth_method->private_data);
+ auth_method->private_data = NULL;
+ }
+ }
+
talloc_destroy((*auth_context)->mem_ctx);
- *auth_context = NULL;
+ *auth_context = NULL;
+ }
}
/***************************************************************************
diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c
index b57293943c..41adc21784 100644
--- a/source3/auth/auth_server.c
+++ b/source3/auth/auth_server.c
@@ -143,8 +143,10 @@ static void free_server_private_data(void **private_data_pointer)
{
struct cli_state **cli = (struct cli_state **)private_data_pointer;
if (*cli && (*cli)->initialised) {
+ DEBUG(10, ("Shutting down smbserver connection\n"));
cli_shutdown(*cli);
}
+ *private_data_pointer = NULL;
}
/****************************************************************************