diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-01-31 01:50:54 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:51:37 -0500 |
commit | 7c7125be5dfdbacd702891e16529eb1412966f83 (patch) | |
tree | a5740baeadabc46793b30897c009892f8b5c53ad /source4/auth/gensec/gensec_gssapi.c | |
parent | bc72dfa91ac409d3879b1959b607fa9f30cec160 (diff) | |
download | samba-7c7125be5dfdbacd702891e16529eb1412966f83.tar.gz samba-7c7125be5dfdbacd702891e16529eb1412966f83.tar.bz2 samba-7c7125be5dfdbacd702891e16529eb1412966f83.zip |
r13247: Try to make better use of talloc in the auth/ and auth/gensec code.
We don't want temporary memory hanging around on the long-term
contexts.
Andrew Bartlett
(This used to be commit 85b3f6ebddfb655fdd08d1799752e562a6ff9cb1)
Diffstat (limited to 'source4/auth/gensec/gensec_gssapi.c')
-rw-r--r-- | source4/auth/gensec/gensec_gssapi.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source4/auth/gensec/gensec_gssapi.c b/source4/auth/gensec/gensec_gssapi.c index f9650ee6cc..c90faacf02 100644 --- a/source4/auth/gensec/gensec_gssapi.c +++ b/source4/auth/gensec/gensec_gssapi.c @@ -759,7 +759,7 @@ static NTSTATUS gensec_gssapi_session_key(struct gensec_security *gensec_securit } static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_security, - struct auth_session_info **_session_info) + struct auth_session_info **_session_info) { NTSTATUS nt_status; TALLOC_CTX *mem_ctx; @@ -873,13 +873,17 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi } /* references the server_info into the session_info */ - nt_status = auth_generate_session_info(gensec_gssapi_state, server_info, &session_info); - talloc_free(mem_ctx); - talloc_free(server_info); - NT_STATUS_NOT_OK_RETURN(nt_status); + nt_status = auth_generate_session_info(mem_ctx, server_info, &session_info); + if (!NT_STATUS_IS_OK(nt_status)) { + talloc_free(mem_ctx); + return nt_status; + } nt_status = gensec_gssapi_session_key(gensec_security, &session_info->session_key); - NT_STATUS_NOT_OK_RETURN(nt_status); + if (!NT_STATUS_IS_OK(nt_status)) { + talloc_free(mem_ctx); + return nt_status; + } if (!(gensec_gssapi_state->got_flags & GSS_C_DELEG_FLAG)) { DEBUG(10, ("gensec_gssapi: NO delegated credentials supplied by client\n")); @@ -888,6 +892,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi DEBUG(10, ("gensec_gssapi: delegated credentials supplied by client\n")); session_info->credentials = cli_credentials_init(session_info); if (!session_info->credentials) { + talloc_free(mem_ctx); return NT_STATUS_NO_MEMORY; } @@ -897,11 +902,13 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi gensec_gssapi_state->delegated_cred_handle, CRED_SPECIFIED); if (ret) { + talloc_free(mem_ctx); return NT_STATUS_NO_MEMORY; } /* It has been taken from this place... */ gensec_gssapi_state->delegated_cred_handle = GSS_C_NO_CREDENTIAL; } + talloc_steal(gensec_gssapi_state, session_info); *_session_info = session_info; return NT_STATUS_OK; |