diff options
author | Simo Sorce <idra@samba.org> | 2010-07-16 18:33:38 -0400 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-07-20 15:52:24 +1000 |
commit | a04bbd281c5b94166e23026ea06e98939250028c (patch) | |
tree | bdf0598bb9c72a1e16d00e3ff1bf072d33f561ea /source3/auth | |
parent | 0bb8d133c9a39873828dbe977513edd31e1a7045 (diff) | |
download | samba-a04bbd281c5b94166e23026ea06e98939250028c.tar.gz samba-a04bbd281c5b94166e23026ea06e98939250028c.tar.bz2 samba-a04bbd281c5b94166e23026ea06e98939250028c.zip |
s3-auth: Refactor and rename auth_ntlmssp_server_info()
Rename it to auth_ntlmssp_steal_server_info() to make it clear that
the server_info struct is stolen from the auth_ntlmssp_state structure.
Use talloc_move instead of manual steal&clear
Add comments to explain what is going on.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/auth')
-rw-r--r-- | source3/auth/auth_ntlmssp.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c index a71c02b14f..efeca5c403 100644 --- a/source3/auth/auth_ntlmssp.c +++ b/source3/auth/auth_ntlmssp.c @@ -83,23 +83,25 @@ void auth_ntlmssp_want_seal(struct auth_ntlmssp_state *auth_ntlmssp_state) } -NTSTATUS auth_ntlmssp_server_info(TALLOC_CTX *mem_ctx, - struct auth_ntlmssp_state *auth_ntlmssp_state, - struct auth_serversupplied_info **_server_info) +NTSTATUS auth_ntlmssp_steal_server_info(TALLOC_CTX *mem_ctx, + struct auth_ntlmssp_state *auth_ntlmssp_state, + struct auth_serversupplied_info **server_info) { - struct auth_serversupplied_info *server_info = auth_ntlmssp_state->server_info; - data_blob_free(&server_info->user_session_key); - server_info->user_session_key = + /* Free the current server_info user_session_key and reset it from the + * current ntlmssp_state session_key */ + data_blob_free(&auth_ntlmssp_state->server_info->user_session_key); + auth_ntlmssp_state->server_info->user_session_key = data_blob_talloc( - server_info, + auth_ntlmssp_state->server_info, auth_ntlmssp_state->ntlmssp_state->session_key.data, auth_ntlmssp_state->ntlmssp_state->session_key.length); - if (auth_ntlmssp_state->ntlmssp_state->session_key.length && !server_info->user_session_key.data) { - *_server_info = NULL; + if (auth_ntlmssp_state->ntlmssp_state->session_key.length && + !auth_ntlmssp_state->server_info->user_session_key.data) { + *server_info = NULL; return NT_STATUS_NO_MEMORY; } - auth_ntlmssp_state->server_info = NULL; - *_server_info = talloc_steal(mem_ctx, server_info); + /* Steal server_info away from auth_ntlmssp_state */ + *server_info = talloc_move(mem_ctx, &auth_ntlmssp_state->server_info); return NT_STATUS_OK; } |