summaryrefslogtreecommitdiffstats
path: root/source4/smb_server/smb/sesssetup.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-20 09:44:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:52:40 -0500
commitd3e28ccd4824adce2feed9fe53cf2d4d393d607a (patch)
treea9f30272024ab4fac088d3620239478c8aa83a37 /source4/smb_server/smb/sesssetup.c
parentb691b4ad3d5b2ac813355d81d4c90f84977689a3 (diff)
downloadsamba-d3e28ccd4824adce2feed9fe53cf2d4d393d607a.tar.gz
samba-d3e28ccd4824adce2feed9fe53cf2d4d393d607a.tar.xz
samba-d3e28ccd4824adce2feed9fe53cf2d4d393d607a.zip
r23020: a better fix for the memory leak - this one doesn't stuff up spnego :)
(This used to be commit 9a8da730a725fc9fc1a3e407273e688f44eadfe1)
Diffstat (limited to 'source4/smb_server/smb/sesssetup.c')
-rw-r--r--source4/smb_server/smb/sesssetup.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source4/smb_server/smb/sesssetup.c b/source4/smb_server/smb/sesssetup.c
index b6bddaa5b1d..2e9403b10ae 100644
--- a/source4/smb_server/smb/sesssetup.c
+++ b/source4/smb_server/smb/sesssetup.c
@@ -49,6 +49,8 @@ static void smbsrv_sesssetup_backend_send(struct smbsrv_request *req,
{
if (NT_STATUS_IS_OK(status)) {
req->smb_conn->negotiate.done_sesssetup = True;
+ /* we need to keep the session long term */
+ req->session = talloc_steal(req->smb_conn, req->session);
}
smbsrv_reply_sesssetup_send(req, sess, status);
}
@@ -71,7 +73,7 @@ static void sesssetup_old_send(struct auth_check_password_request *areq,
if (!NT_STATUS_IS_OK(status)) goto failed;
/* allocate a new session */
- smb_sess = smbsrv_session_new(req->smb_conn, NULL);
+ smb_sess = smbsrv_session_new(req->smb_conn, req, NULL);
if (!smb_sess) {
status = NT_STATUS_INSUFFICIENT_RESOURCES;
goto failed;
@@ -166,7 +168,7 @@ static void sesssetup_nt1_send(struct auth_check_password_request *areq,
if (!NT_STATUS_IS_OK(status)) goto failed;
/* allocate a new session */
- smb_sess = smbsrv_session_new(req->smb_conn, NULL);
+ smb_sess = smbsrv_session_new(req->smb_conn, req, NULL);
if (!smb_sess) {
status = NT_STATUS_INSUFFICIENT_RESOURCES;
goto failed;
@@ -339,6 +341,10 @@ done:
failed:
status = auth_nt_status_squash(status);
smbsrv_sesssetup_backend_send(req, sess, status);
+ if (!NT_STATUS_IS_OK(status) &&
+ !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+ talloc_free(smb_sess);
+ }
}
/*
@@ -394,7 +400,7 @@ static void sesssetup_spnego(struct smbsrv_request *req, union smb_sesssetup *se
}
/* allocate a new session */
- smb_sess = smbsrv_session_new(req->smb_conn, gensec_ctx);
+ smb_sess = smbsrv_session_new(req->smb_conn, req->smb_conn, gensec_ctx);
if (!smb_sess) {
status = NT_STATUS_INSUFFICIENT_RESOURCES;
goto failed;