summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/process.c2
-rw-r--r--source3/smbd/reply.c30
2 files changed, 22 insertions, 10 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 02ad205bd5..f455b39a52 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -693,7 +693,7 @@ static const struct smb_message_struct {
/* 0x02 */ { "SMBopen",reply_open,NULL,AS_USER },
/* 0x03 */ { "SMBcreate",reply_mknew,NULL,AS_USER},
/* 0x04 */ { "SMBclose",NULL,reply_close,AS_USER | CAN_IPC },
-/* 0x05 */ { "SMBflush",reply_flush,NULL,AS_USER},
+/* 0x05 */ { "SMBflush",NULL,reply_flush,AS_USER},
/* 0x06 */ { "SMBunlink",NULL,reply_unlink,AS_USER | NEED_WRITE },
/* 0x07 */ { "SMBmv",reply_mv,NULL,AS_USER | NEED_WRITE },
/* 0x08 */ { "SMBgetatr",reply_getatr,NULL,AS_USER},
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 94f18641bf..2b54c636a5 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -3463,31 +3463,43 @@ int reply_lseek(connection_struct *conn, char *inbuf,char *outbuf, int size, int
Reply to a flush.
****************************************************************************/
-int reply_flush(connection_struct *conn, char *inbuf,char *outbuf, int size, int dum_buffsize)
+void reply_flush(connection_struct *conn, struct smb_request *req)
{
- int outsize = set_message(inbuf,outbuf,0,0,False);
- uint16 fnum = SVAL(inbuf,smb_vwv0);
- files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
+ uint16 fnum;
+ files_struct *fsp;
+
START_PROFILE(SMBflush);
- if (fnum != 0xFFFF)
- CHECK_FSP(fsp,conn);
+ if (req->wct < 1) {
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return;
+ }
+
+ fnum = SVAL(req->inbuf,smb_vwv0);
+ fsp = file_fsp(fnum);
+
+ if ((fnum != 0xFFFF) && !check_fsp(conn, req, fsp, &current_user)) {
+ return;
+ }
if (!fsp) {
file_sync_all(conn);
} else {
NTSTATUS status = sync_file(conn, fsp, True);
if (!NT_STATUS_IS_OK(status)) {
- END_PROFILE(SMBflush);
DEBUG(5,("reply_flush: sync_file for %s returned %s\n",
fsp->fsp_name, nt_errstr(status) ));
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ END_PROFILE(SMBflush);
+ return;
}
}
+ reply_outbuf(req, 0, 0);
+
DEBUG(3,("flush\n"));
END_PROFILE(SMBflush);
- return(outsize);
+ return;
}
/****************************************************************************