summaryrefslogtreecommitdiff
path: root/source4/smb_server/sesssetup.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-08-12 03:23:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:57:53 -0500
commit62c67d65056604e2a2969d9901978c0b5326978b (patch)
tree9f02ef5ec962db9787a181e521ffc247c63ebc98 /source4/smb_server/sesssetup.c
parent912e79ade515451152be6b45cc3cc83a9d286827 (diff)
downloadsamba-62c67d65056604e2a2969d9901978c0b5326978b.tar.gz
samba-62c67d65056604e2a2969d9901978c0b5326978b.tar.bz2
samba-62c67d65056604e2a2969d9901978c0b5326978b.zip
r1747: don't segfault when the spnego mech only use one call from the client to finish
metze (This used to be commit ddac5e46d42d3b2daae10107b1bcb3b138de7474)
Diffstat (limited to 'source4/smb_server/sesssetup.c')
-rw-r--r--source4/smb_server/sesssetup.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/source4/smb_server/sesssetup.c b/source4/smb_server/sesssetup.c
index 39aadf8778..14cb1be067 100644
--- a/source4/smb_server/sesssetup.c
+++ b/source4/smb_server/sesssetup.c
@@ -212,25 +212,35 @@ static NTSTATUS sesssetup_spnego(struct smbsrv_request *req, union smb_sesssetup
}
+ if (!smb_sess) {
+ vuid = smbsrv_register_session(req->smb_conn, session_info, gensec_ctx);
+ if (vuid == UID_FIELD_INVALID) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+ smb_sess = smbsrv_session_find(req->smb_conn, vuid);
+ if (!smb_sess) {
+ return NT_STATUS_FOOBAR;
+ }
+ }
+
if (NT_STATUS_IS_OK(status)) {
DATA_BLOB session_key;
DATA_BLOB null_data_blob = data_blob(NULL, 0);
+
status = gensec_session_info(smb_sess->gensec_ctx, &smb_sess->session_info);
- if (NT_STATUS_IS_OK(gensec_session_key(smb_sess->gensec_ctx,
- &session_key))) {
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ status = gensec_session_key(smb_sess->gensec_ctx,
+ &session_key);
+ if (NT_STATUS_IS_OK(status)) {
srv_setup_signing(req->smb_conn, &session_key, &null_data_blob);
req->seq_num = 0;
req->smb_conn->signing.next_seq_num = 2;
}
}
- if (!smb_sess) {
- vuid = smbsrv_register_session(req->smb_conn, session_info, gensec_ctx);
- if (vuid == UID_FIELD_INVALID) {
- return NT_STATUS_ACCESS_DENIED;
- }
- }
-
sess->spnego.out.action = 0;
sess->spnego.out.vuid = vuid;
sesssetup_common_strings(req,