diff options
Diffstat (limited to 'source4/smb_server')
-rw-r--r-- | source4/smb_server/password.c | 11 | ||||
-rw-r--r-- | source4/smb_server/sesssetup.c | 12 |
2 files changed, 14 insertions, 9 deletions
diff --git a/source4/smb_server/password.c b/source4/smb_server/password.c index c302f65980..d553d8612d 100644 --- a/source4/smb_server/password.c +++ b/source4/smb_server/password.c @@ -58,8 +58,6 @@ void smbsrv_invalidate_vuid(struct smbsrv_connection *smb_conn, uint16_t vuid) session_yield(sess); - free_session_info(&sess->session_info); - DLIST_REMOVE(smb_conn->sessions.session_list, sess); /* clear the vuid from the 'cache' on each connection, and @@ -135,8 +133,13 @@ uint16_t smbsrv_register_session(struct smbsrv_connection *smb_conn, smb_conn->sessions.num_validated_vuids++; /* use this to keep tabs on all our info from the authentication */ - sess->session_info = session_info; - sess->gensec_ctx = gensec_ctx; + if (session_info) { + sess->session_info = talloc_reference(sess, session_info); + } + + if (gensec_ctx) { + sess->gensec_ctx = talloc_reference(sess, gensec_ctx); + } sess->smb_conn = smb_conn; DLIST_ADD(smb_conn->sessions.session_list, sess); diff --git a/source4/smb_server/sesssetup.c b/source4/smb_server/sesssetup.c index 7b4c217b8f..03a750e070 100644 --- a/source4/smb_server/sesssetup.c +++ b/source4/smb_server/sesssetup.c @@ -74,7 +74,8 @@ static NTSTATUS sesssetup_old(struct smbsrv_request *req, union smb_sesssetup *s return nt_status_squash(status); } - status = make_session_info(server_info, &session_info); + /* This references server_info into session_info */ + status = make_session_info(req, server_info, &session_info); if (!NT_STATUS_IS_OK(status)) { return nt_status_squash(status); } @@ -157,12 +158,12 @@ static NTSTATUS sesssetup_nt1(struct smbsrv_request *req, union smb_sesssetup *s return nt_status_squash(status); } - status = make_session_info(server_info, &session_info); + /* This references server_info into session_info */ + status = make_session_info(req, server_info, &session_info); if (!NT_STATUS_IS_OK(status)) { return nt_status_squash(status); } - - talloc_steal(session_info, server_info); + talloc_free(server_info); sess->nt1.out.action = 0; sess->nt1.out.vuid = smbsrv_register_session(req->smb_conn, session_info, NULL); @@ -238,7 +239,8 @@ 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); + vuid = smbsrv_register_session(req->smb_conn, + session_info, gensec_ctx); if (vuid == UID_FIELD_INVALID) { return NT_STATUS_ACCESS_DENIED; } |