1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

r24225: Convert reply_flush to the new API

(This used to be commit f843c02f07)
This commit is contained in:
Volker Lendecke 2007-08-04 20:44:33 +00:00 committed by Gerald (Jerry) Carter
parent bf160bb621
commit 5d2031915e
2 changed files with 22 additions and 10 deletions

View File

@ -693,7 +693,7 @@ static const struct smb_message_struct {
/* 0x02 */ { "SMBopen",reply_open,NULL,AS_USER }, /* 0x02 */ { "SMBopen",reply_open,NULL,AS_USER },
/* 0x03 */ { "SMBcreate",reply_mknew,NULL,AS_USER}, /* 0x03 */ { "SMBcreate",reply_mknew,NULL,AS_USER},
/* 0x04 */ { "SMBclose",NULL,reply_close,AS_USER | CAN_IPC }, /* 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 }, /* 0x06 */ { "SMBunlink",NULL,reply_unlink,AS_USER | NEED_WRITE },
/* 0x07 */ { "SMBmv",reply_mv,NULL,AS_USER | NEED_WRITE }, /* 0x07 */ { "SMBmv",reply_mv,NULL,AS_USER | NEED_WRITE },
/* 0x08 */ { "SMBgetatr",reply_getatr,NULL,AS_USER}, /* 0x08 */ { "SMBgetatr",reply_getatr,NULL,AS_USER},

View File

@ -3463,31 +3463,43 @@ int reply_lseek(connection_struct *conn, char *inbuf,char *outbuf, int size, int
Reply to a flush. 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;
uint16 fnum = SVAL(inbuf,smb_vwv0); files_struct *fsp;
files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
START_PROFILE(SMBflush); START_PROFILE(SMBflush);
if (fnum != 0xFFFF) if (req->wct < 1) {
CHECK_FSP(fsp,conn); 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) { if (!fsp) {
file_sync_all(conn); file_sync_all(conn);
} else { } else {
NTSTATUS status = sync_file(conn, fsp, True); NTSTATUS status = sync_file(conn, fsp, True);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBflush);
DEBUG(5,("reply_flush: sync_file for %s returned %s\n", DEBUG(5,("reply_flush: sync_file for %s returned %s\n",
fsp->fsp_name, nt_errstr(status) )); 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")); DEBUG(3,("flush\n"));
END_PROFILE(SMBflush); END_PROFILE(SMBflush);
return(outsize); return;
} }
/**************************************************************************** /****************************************************************************