summaryrefslogtreecommitdiff
path: root/source4/smb_server/sesssetup.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-07-15 02:11:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:57:36 -0500
commita02809e28e0becb201350b7edc72418f49ea2a4e (patch)
treefe15c7547ccfca6d62e3ae91b430f82d03c77aa2 /source4/smb_server/sesssetup.c
parent5779a7da9aecb7329eb47e93000dc8b9de96d9ae (diff)
downloadsamba-a02809e28e0becb201350b7edc72418f49ea2a4e.tar.gz
samba-a02809e28e0becb201350b7edc72418f49ea2a4e.tar.bz2
samba-a02809e28e0becb201350b7edc72418f49ea2a4e.zip
r1507: fixed the handling of SMB chaining with the new server structure. You
must think carefully about packet chaining when dealing with any authentication or SMB parsing issues. The particular problem here was that a chained tconX didn't get the req->session setup after an initial sesstion setup call, so the tconx used a bogus VUID. (This used to be commit 6f2a335cd623211071b01d982d4e7c69b49a5602)
Diffstat (limited to 'source4/smb_server/sesssetup.c')
-rw-r--r--source4/smb_server/sesssetup.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source4/smb_server/sesssetup.c b/source4/smb_server/sesssetup.c
index 44a8840d00..3e332cfbb9 100644
--- a/source4/smb_server/sesssetup.c
+++ b/source4/smb_server/sesssetup.c
@@ -82,6 +82,8 @@ static NTSTATUS sesssetup_old(struct smbsrv_request *req, union smb_sesssetup *s
&sess->old.out.lanman,
&sess->old.out.domain);
+ req->session = smbsrv_session_find(req->smb_conn, sess->old.out.vuid);
+
return NT_STATUS_OK;
}
@@ -133,6 +135,7 @@ static NTSTATUS sesssetup_nt1(struct smbsrv_request *req, union smb_sesssetup *s
&sess->nt1.out.lanman,
&sess->nt1.out.domain);
+ req->session = smbsrv_session_find(req->smb_conn, sess->nt1.out.vuid);
srv_setup_signing(req->smb_conn, &session_info->session_key, &sess->nt1.in.password2);
return NT_STATUS_OK;
}
@@ -153,18 +156,25 @@ static NTSTATUS sesssetup_spnego(struct smbsrv_request *req, union smb_sesssetup
NTSTATUS sesssetup_backend(struct smbsrv_request *req,
union smb_sesssetup *sess)
{
+ NTSTATUS status = NT_STATUS_INVALID_LEVEL;
+
switch (sess->generic.level) {
case RAW_SESSSETUP_OLD:
- return sesssetup_old(req, sess);
+ status = sesssetup_old(req, sess);
+ break;
case RAW_SESSSETUP_NT1:
- return sesssetup_nt1(req, sess);
+ status = sesssetup_nt1(req, sess);
+ break;
case RAW_SESSSETUP_SPNEGO:
- return sesssetup_spnego(req, sess);
+ status = sesssetup_spnego(req, sess);
+ break;
}
- req->smb_conn->negotiate.done_sesssetup = True;
+ if (NT_STATUS_IS_OK(status)) {
+ req->smb_conn->negotiate.done_sesssetup = True;
+ }
- return NT_STATUS_INVALID_LEVEL;
+ return status;
}