From e3880fa759cfa03222262327854fe7bbe585fe01 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 26 Sep 2004 11:30:20 +0000 Subject: r2660: - converted the libcli/raw/ library to use talloc_increase_ref_count() rather than manual reference counts - properly support SMBexit in the cifs and posix backends - added a logoff method to all backends With these changes the RAW-CONTEXT test now passes against the posix backend (This used to be commit c315d6ac1cc40546fde1474702a6d66d07ee13c8) --- source4/smb_server/reply.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'source4/smb_server') diff --git a/source4/smb_server/reply.c b/source4/smb_server/reply.c index 72c7c20a11..94317bfc39 100644 --- a/source4/smb_server/reply.c +++ b/source4/smb_server/reply.c @@ -1149,23 +1149,26 @@ void reply_flush(struct smbsrv_request *req) /**************************************************************************** - Reply to a exit. + Reply to a exit. This closes all files open by a smbpid ****************************************************************************/ void reply_exit(struct smbsrv_request *req) { + NTSTATUS status; + struct smbsrv_tcon *tcon; REQ_CHECK_WCT(req, 0); - req->async.send_fn = reply_simple_send; - - if (!req->tcon) { - req_reply_error(req, NT_STATUS_INVALID_HANDLE); - return; + for (tcon=req->smb_conn->tree.tcons;tcon;tcon=tcon->next) { + req->tcon = tcon; + status = tcon->ntvfs_ops->exit(req); + req->tcon = NULL; + if (!NT_STATUS_IS_OK(status)) { + req_reply_error(req, status); + return; + } } - /* call backend */ - req->async.status = req->tcon->ntvfs_ops->exit(req); - - REQ_ASYNC_TAIL; + req_setup_reply(req, 0, 0); + req_send_reply(req); } @@ -2097,20 +2100,29 @@ void reply_sesssetup(struct smbsrv_request *req) req_reply_error(req, NT_STATUS_FOOBAR); } - /**************************************************************************** Reply to a SMBulogoffX. ****************************************************************************/ void reply_ulogoffX(struct smbsrv_request *req) { + struct smbsrv_tcon *tcon; uint16_t vuid; + NTSTATUS status; vuid = SVAL(req->in.hdr, HDR_UID); - + /* in user level security we are supposed to close any files - open by this user */ + open by this user on all open tree connects */ if ((vuid != 0) && (lp_security() != SEC_SHARE)) { - DEBUG(0,("REWRITE: not closing user files\n")); + for (tcon=req->smb_conn->tree.tcons;tcon;tcon=tcon->next) { + req->tcon = tcon; + status = tcon->ntvfs_ops->logoff(req); + req->tcon = NULL; + if (!NT_STATUS_IS_OK(status)) { + req_reply_error(req, status); + return; + } + } } smbsrv_invalidate_vuid(req->smb_conn, vuid); -- cgit