summaryrefslogtreecommitdiff
path: root/source3/auth/auth_ntlmssp.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2010-07-16 19:44:22 -0400
committerAndrew Bartlett <abartlet@samba.org>2010-07-19 14:20:04 +1000
commitc09dcb903cdc1a68f71e892501a450df31367a54 (patch)
tree7c7938d79d20e66f8274030aabf79a30c9d39320 /source3/auth/auth_ntlmssp.c
parent673fcfa3775ac6bdc467dde0bcf6670966cab50c (diff)
downloadsamba-c09dcb903cdc1a68f71e892501a450df31367a54.tar.gz
samba-c09dcb903cdc1a68f71e892501a450df31367a54.tar.bz2
samba-c09dcb903cdc1a68f71e892501a450df31367a54.zip
s3-auth: Use talloc hierarchies to properly free auth_ntlmssp_state contexts
Turn auth_ntlmssp_end into a destructor and attach it to auth_ntlmssp_state. Remote auth_ntlmssp_end and use TALLOC_FREE in the callers. Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/auth/auth_ntlmssp.c')
-rw-r--r--source3/auth/auth_ntlmssp.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c
index d389ee7c1f..bebb86ee17 100644
--- a/source3/auth/auth_ntlmssp.c
+++ b/source3/auth/auth_ntlmssp.c
@@ -254,6 +254,8 @@ static NTSTATUS auth_ntlmssp_check_password(struct ntlmssp_state *ntlmssp_state,
return nt_status;
}
+static int auth_ntlmssp_state_destructor(void *ptr);
+
NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state)
{
NTSTATUS nt_status;
@@ -311,17 +313,21 @@ NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state)
ans->ntlmssp_state->set_challenge = auth_ntlmssp_set_challenge;
ans->ntlmssp_state->check_password = auth_ntlmssp_check_password;
+ talloc_set_destructor((TALLOC_CTX *)ans, auth_ntlmssp_state_destructor);
+
*auth_ntlmssp_state = ans;
return NT_STATUS_OK;
}
-void auth_ntlmssp_end(struct auth_ntlmssp_state **auth_ntlmssp_state)
+static int auth_ntlmssp_state_destructor(void *ptr)
{
- if (*auth_ntlmssp_state == NULL) {
- return;
- }
- TALLOC_FREE((*auth_ntlmssp_state)->server_info);
- TALLOC_FREE(*auth_ntlmssp_state);
+ struct auth_ntlmssp_state *ans;
+
+ ans = talloc_get_type(ptr, struct auth_ntlmssp_state);
+
+ TALLOC_FREE(ans->server_info);
+ TALLOC_FREE(ans->ntlmssp_state);
+ return 0;
}
NTSTATUS auth_ntlmssp_update(struct auth_ntlmssp_state *auth_ntlmssp_state,