summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-08-14 14:31:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:42 -0500
commit2da44a2dee1ad425a25f9a188896ce031356630c (patch)
treed3f34d293628aac29f3f7f7b78f38914b884781d /source3/smbd
parentc638a84cb1215f9d67531c72959baf10deea2700 (diff)
downloadsamba-2da44a2dee1ad425a25f9a188896ce031356630c.tar.gz
samba-2da44a2dee1ad425a25f9a188896ce031356630c.tar.bz2
samba-2da44a2dee1ad425a25f9a188896ce031356630c.zip
r24412: Convert reply_open to the new API
(This used to be commit 394987f5224086cb379ea8d0364924679b8a0214)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/process.c2
-rw-r--r--source3/smbd/reply.c87
2 files changed, 51 insertions, 38 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 0f4d53b77a..f0d1c56e90 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -692,7 +692,7 @@ static const struct smb_message_struct {
/* 0x00 */ { "SMBmkdir",NULL,reply_mkdir,AS_USER | NEED_WRITE},
/* 0x01 */ { "SMBrmdir",NULL,reply_rmdir,AS_USER | NEED_WRITE},
-/* 0x02 */ { "SMBopen",reply_open,NULL,AS_USER },
+/* 0x02 */ { "SMBopen",NULL,reply_open,AS_USER },
/* 0x03 */ { "SMBcreate",NULL,reply_mknew,AS_USER},
/* 0x04 */ { "SMBclose",NULL,reply_close,AS_USER | CAN_IPC },
/* 0x05 */ { "SMBflush",NULL,reply_flush,AS_USER},
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 6acee164c6..40b9630ecf 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1392,10 +1392,9 @@ int reply_fclose(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
Reply to an open.
****************************************************************************/
-int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
+void reply_open(connection_struct *conn, struct smb_request *req)
{
pstring fname;
- int outsize = 0;
uint32 fattr=0;
SMB_OFF_T size = 0;
time_t mtime=0;
@@ -1410,55 +1409,64 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
uint32 create_disposition;
uint32 create_options = 0;
NTSTATUS status;
- struct smb_request req;
START_PROFILE(SMBopen);
- init_smb_request(&req, (uint8 *)inbuf);
-
- if (req.wct < 2) {
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ if (req->wct < 2) {
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ END_PROFILE(SMBopen);
+ return;
}
- oplock_request = CORE_OPLOCK_REQUEST(inbuf);
- deny_mode = SVAL(inbuf,smb_vwv0);
- dos_attr = SVAL(inbuf,smb_vwv1);
+ oplock_request = CORE_OPLOCK_REQUEST(req->inbuf);
+ deny_mode = SVAL(req->inbuf,smb_vwv0);
+ dos_attr = SVAL(req->inbuf,smb_vwv1);
- srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, smb_buf(inbuf)+1,
- sizeof(fname), 0, STR_TERMINATE, &status);
+ srvstr_get_path((char *)req->inbuf, req->flags2, fname,
+ smb_buf(req->inbuf)+1, sizeof(fname), 0,
+ STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
END_PROFILE(SMBopen);
- return ERROR_NT(status);
+ return;
}
- status = resolve_dfspath(conn, SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES, fname);
+ status = resolve_dfspath(conn, req->flags2 & FLAGS2_DFS_PATHNAMES,
+ fname);
if (!NT_STATUS_IS_OK(status)) {
- END_PROFILE(SMBopen);
if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
- return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, ERRSRV, ERRbadpath);
+ reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
+ ERRSRV, ERRbadpath);
+ END_PROFILE(SMBopen);
+ return;
}
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ END_PROFILE(SMBopen);
+ return;
}
status = unix_convert(conn, fname, False, NULL, &sbuf);
if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
END_PROFILE(SMBopen);
- return ERROR_NT(status);
+ return;
}
status = check_name(conn, fname);
if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
END_PROFILE(SMBopen);
- return ERROR_NT(status);
+ return;
}
if (!map_open_params_to_ntcreate(fname, deny_mode, OPENX_FILE_EXISTS_OPEN,
&access_mask, &share_mode, &create_disposition, &create_options)) {
+ reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
END_PROFILE(SMBopen);
- return ERROR_NT(NT_STATUS_DOS(ERRDOS, ERRbadaccess));
+ return;
}
- status = open_file_ntcreate(conn, &req, fname, &sbuf,
+ status = open_file_ntcreate(conn, req, fname, &sbuf,
access_mask,
share_mode,
create_disposition,
@@ -1468,12 +1476,14 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
&info, &fsp);
if (!NT_STATUS_IS_OK(status)) {
- END_PROFILE(SMBopen);
- if (open_was_deferred(SVAL(inbuf,smb_mid))) {
+ if (open_was_deferred(req->mid)) {
/* We have re-scheduled this call. */
- return -1;
+ END_PROFILE(SMBopen);
+ return;
}
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ END_PROFILE(SMBopen);
+ return;
}
size = sbuf.st_size;
@@ -1483,30 +1493,33 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
if (fattr & aDIR) {
DEBUG(3,("attempt to open a directory %s\n",fname));
close_file(fsp,ERROR_CLOSE);
+ reply_doserror(req, ERRDOS,ERRnoaccess);
END_PROFILE(SMBopen);
- return ERROR_DOS(ERRDOS,ERRnoaccess);
+ return;
}
-
- outsize = set_message(inbuf,outbuf,7,0,True);
- SSVAL(outbuf,smb_vwv0,fsp->fnum);
- SSVAL(outbuf,smb_vwv1,fattr);
+
+ reply_outbuf(req, 7, 0);
+ SSVAL(req->outbuf,smb_vwv0,fsp->fnum);
+ SSVAL(req->outbuf,smb_vwv1,fattr);
if(lp_dos_filetime_resolution(SNUM(conn)) ) {
- srv_put_dos_date3(outbuf,smb_vwv2,mtime & ~1);
+ srv_put_dos_date3((char *)req->outbuf,smb_vwv2,mtime & ~1);
} else {
- srv_put_dos_date3(outbuf,smb_vwv2,mtime);
+ srv_put_dos_date3((char *)req->outbuf,smb_vwv2,mtime);
}
- SIVAL(outbuf,smb_vwv4,(uint32)size);
- SSVAL(outbuf,smb_vwv6,deny_mode);
+ SIVAL(req->outbuf,smb_vwv4,(uint32)size);
+ SSVAL(req->outbuf,smb_vwv6,deny_mode);
if (oplock_request && lp_fake_oplocks(SNUM(conn))) {
- SCVAL(outbuf,smb_flg,CVAL(outbuf,smb_flg)|CORE_OPLOCK_GRANTED);
+ SCVAL(req->outbuf,smb_flg,
+ CVAL(req->outbuf,smb_flg)|CORE_OPLOCK_GRANTED);
}
if(EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
- SCVAL(outbuf,smb_flg,CVAL(outbuf,smb_flg)|CORE_OPLOCK_GRANTED);
+ SCVAL(req->outbuf,smb_flg,
+ CVAL(req->outbuf,smb_flg)|CORE_OPLOCK_GRANTED);
}
END_PROFILE(SMBopen);
- return(outsize);
+ return;
}
/****************************************************************************