diff options
-rw-r--r-- | source4/auth/auth_util.c | 26 | ||||
-rw-r--r-- | source4/auth/gensec/schannel.c | 22 |
2 files changed, 27 insertions, 21 deletions
diff --git a/source4/auth/auth_util.c b/source4/auth/auth_util.c index a56a32d934..19fd63ed2e 100644 --- a/source4/auth/auth_util.c +++ b/source4/auth/auth_util.c @@ -456,6 +456,32 @@ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } +NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, + struct auth_session_info **_session_info) +{ + NTSTATUS nt_status; + struct auth_serversupplied_info *server_info = NULL; + struct auth_session_info *session_info = NULL; + TALLOC_CTX *mem_ctx = talloc_new(parent_ctx); + + nt_status = auth_anonymous_server_info(mem_ctx, + &server_info); + if (!NT_STATUS_IS_OK(nt_status)) { + talloc_free(mem_ctx); + return nt_status; + } + + /* references the server_info into the session_info */ + nt_status = auth_generate_session_info(parent_ctx, server_info, &session_info); + talloc_free(mem_ctx); + + NT_STATUS_NOT_OK_RETURN(nt_status); + + *_session_info = session_info; + + return NT_STATUS_OK; +} + /**************************************************************************** prints a struct auth_session_info security token to debug output. ****************************************************************************/ diff --git a/source4/auth/gensec/schannel.c b/source4/auth/gensec/schannel.c index 8d5c7554f5..dd0bc1eddd 100644 --- a/source4/auth/gensec/schannel.c +++ b/source4/auth/gensec/schannel.c @@ -167,28 +167,8 @@ NTSTATUS dcerpc_schannel_creds(struct gensec_security *gensec_security, static NTSTATUS schannel_session_info(struct gensec_security *gensec_security, struct auth_session_info **_session_info) { - NTSTATUS nt_status; struct schannel_state *state = gensec_security->private_data; - struct auth_serversupplied_info *server_info = NULL; - struct auth_session_info *session_info = NULL; - TALLOC_CTX *mem_ctx = talloc_new(state); - - nt_status = auth_anonymous_server_info(mem_ctx, - &server_info); - if (!NT_STATUS_IS_OK(nt_status)) { - talloc_free(mem_ctx); - return nt_status; - } - - /* references the server_info into the session_info */ - nt_status = auth_generate_session_info(state, server_info, &session_info); - talloc_free(mem_ctx); - - NT_STATUS_NOT_OK_RETURN(nt_status); - - *_session_info = session_info; - - return NT_STATUS_OK; + return auth_anonymous_session_info(state, _session_info); } static NTSTATUS schannel_start(struct gensec_security *gensec_security) |