diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-08-13 07:18:35 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-08-14 13:13:52 +0200 |
commit | 26853e4607573ec849aa663eb2dd7bcea9acca24 (patch) | |
tree | 47e357705b35c21dae2c39f8c88211e6d08e5c0f /source4 | |
parent | affba1f75cc1136c4ffe38f41ceb1f5626df2d07 (diff) | |
download | samba-26853e4607573ec849aa663eb2dd7bcea9acca24.tar.gz samba-26853e4607573ec849aa663eb2dd7bcea9acca24.tar.bz2 samba-26853e4607573ec849aa663eb2dd7bcea9acca24.zip |
gensec_gssapi: only cache the session key in STAGE_DONE
The key may change because we switch from initiator to acceptor
subkey.
metze
(This used to be commit 66244092a457b2cde6339cb31dcfa73b122ba9b5)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/auth/gensec/gensec_gssapi.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source4/auth/gensec/gensec_gssapi.c b/source4/auth/gensec/gensec_gssapi.c index 0df40dc82f..20d08078be 100644 --- a/source4/auth/gensec/gensec_gssapi.c +++ b/source4/auth/gensec/gensec_gssapi.c @@ -1236,12 +1236,16 @@ static NTSTATUS gensec_gssapi_session_key(struct gensec_security *gensec_securit return NT_STATUS_NO_USER_SESSION_KEY; } - DEBUG(10, ("Got KRB5 session key of length %d\n", - (int)KRB5_KEY_LENGTH(subkey))); - gensec_gssapi_state->session_key = data_blob_talloc(gensec_gssapi_state, - KRB5_KEY_DATA(subkey), KRB5_KEY_LENGTH(subkey)); + DEBUG(10, ("Got KRB5 session key of length %d%s\n", + (int)KRB5_KEY_LENGTH(subkey), + (gensec_gssapi_state->sasl_state == STAGE_DONE)?" (done)":"")); + *session_key = data_blob_talloc(gensec_gssapi_state, + KRB5_KEY_DATA(subkey), KRB5_KEY_LENGTH(subkey)); krb5_free_keyblock(gensec_gssapi_state->smb_krb5_context->krb5_context, subkey); - *session_key = gensec_gssapi_state->session_key; + if (gensec_gssapi_state->sasl_state == STAGE_DONE) { + /* only cache in the done stage */ + gensec_gssapi_state->session_key = *session_key; + } dump_data_pw("KRB5 Session Key:\n", session_key->data, session_key->length); return NT_STATUS_OK; |