summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-08-04 20:44:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:18 -0500
commit5d2031915e9fa56cb1ccdc55a489bd62225ce739 (patch)
treedfb7e8fd35c8d692a616836293840b3291038ddb /source3/smbd
parentbf160bb6211fa1ca68c17f54290ce4cbb5dbb263 (diff)
downloadsamba-5d2031915e9fa56cb1ccdc55a489bd62225ce739.tar.gz
samba-5d2031915e9fa56cb1ccdc55a489bd62225ce739.tar.bz2
samba-5d2031915e9fa56cb1ccdc55a489bd62225ce739.zip
r24225: Convert reply_flush to the new API
(This used to be commit f843c02f0794964eba02ab983f9c0701801f415c)
Diffstat (limited to 'source3/smbd')
-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;
}
/****************************************************************************