summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-08-13 20:29:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:38 -0500
commit5cc0a6b43c32f2a118c0b7995a74c99ccca6ca64 (patch)
tree79ef91964b3bc919d36678cf5734dd43b57c0187 /source3
parent6624bf7fd28d20fab0becb7140627b88c24456ce (diff)
downloadsamba-5cc0a6b43c32f2a118c0b7995a74c99ccca6ca64.tar.gz
samba-5cc0a6b43c32f2a118c0b7995a74c99ccca6ca64.tar.bz2
samba-5cc0a6b43c32f2a118c0b7995a74c99ccca6ca64.zip
r24386: Piss off Volker (not deliberately) by checking in a reply_mknew -> conversion.
Sorry vl, remove one of your 15 patches :-). Jeremy. (This used to be commit a7648ed9d40d6f61362e1488dc30216363870694)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/process.c4
-rw-r--r--source3/smbd/reply.c84
2 files changed, 54 insertions, 34 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 93c6be8c2f..96945e0748 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -693,7 +693,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 },
-/* 0x03 */ { "SMBcreate",reply_mknew,NULL,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},
/* 0x06 */ { "SMBunlink",NULL,reply_unlink,AS_USER | NEED_WRITE },
@@ -705,7 +705,7 @@ static const struct smb_message_struct {
/* 0x0c */ { "SMBlock",reply_lock,NULL,AS_USER},
/* 0x0d */ { "SMBunlock",reply_unlock,NULL,AS_USER},
/* 0x0e */ { "SMBctemp",reply_ctemp,NULL,AS_USER },
-/* 0x0f */ { "SMBmknew",reply_mknew,NULL,AS_USER},
+/* 0x0f */ { "SMBmknew",NULL,reply_mknew,AS_USER},
/* 0x10 */ { "SMBcheckpath",NULL,reply_checkpath,AS_USER},
/* 0x11 */ { "SMBexit",NULL,reply_exit,DO_CHDIR},
/* 0x12 */ { "SMBlseek",reply_lseek,NULL,AS_USER},
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index ea86cd03d8..48b100764a 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1750,61 +1750,76 @@ void reply_ulogoffX(connection_struct *conn, struct smb_request *req)
Reply to a mknew or a create.
****************************************************************************/
-int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
+void reply_mknew(connection_struct *conn, struct smb_request *req)
{
pstring fname;
int com;
- int outsize = 0;
- uint32 fattr = SVAL(inbuf,smb_vwv0);
+ uint32 fattr = 0;
struct timespec ts[2];
files_struct *fsp;
- int oplock_request = CORE_OPLOCK_REQUEST(inbuf);
+ int oplock_request = 0;
SMB_STRUCT_STAT sbuf;
NTSTATUS status;
uint32 access_mask = FILE_GENERIC_READ | FILE_GENERIC_WRITE;
uint32 share_mode = FILE_SHARE_READ|FILE_SHARE_WRITE;
uint32 create_disposition;
uint32 create_options = 0;
- struct smb_request req;
START_PROFILE(SMBcreate);
- init_smb_request(&req, (uint8 *)inbuf);
-
- com = SVAL(inbuf,smb_com);
+ if (req->wct < 3) {
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ END_PROFILE(SMBcreate);
+ return;
+ }
- ts[1] = convert_time_t_to_timespec(srv_make_unix_date3(inbuf + smb_vwv1)); /* mtime. */
+ fattr = SVAL(req->inbuf,smb_vwv0);
+ oplock_request = CORE_OPLOCK_REQUEST(req->inbuf);
+ com = SVAL(req->inbuf,smb_com);
- srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, smb_buf(inbuf) + 1,
- sizeof(fname), 0, STR_TERMINATE, &status);
+ ts[1] =convert_time_t_to_timespec(
+ srv_make_unix_date3(req->inbuf + smb_vwv1));
+ /* mtime. */
+
+ 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(SMBcreate);
- 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(SMBcreate);
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);
+ return;
}
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ return;
}
status = unix_convert(conn, fname, False, NULL, &sbuf);
if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
END_PROFILE(SMBcreate);
- return ERROR_NT(status);
+ return;
}
status = check_name(conn, fname);
if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
END_PROFILE(SMBcreate);
- return ERROR_NT(status);
+ return;
}
if (fattr & aVOLID) {
- DEBUG(0,("Attempt to create file (%s) with volid set - please report this\n",fname));
+ DEBUG(0,("Attempt to create file (%s) with volid set - "
+ "please report this\n", fname));
}
if(com == SMBmknew) {
@@ -1816,7 +1831,7 @@ int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
}
/* Open file using ntcreate. */
- status = open_file_ntcreate(conn, &req, fname, &sbuf,
+ status = open_file_ntcreate(conn, req, fname, &sbuf,
access_mask,
share_mode,
create_disposition,
@@ -1824,35 +1839,40 @@ int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
fattr,
oplock_request,
NULL, &fsp);
-
+
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBcreate);
- if (open_was_deferred(SVAL(inbuf,smb_mid))) {
+ if (open_was_deferred(req->mid)) {
/* We have re-scheduled this call. */
- return -1;
+ return;
}
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ return;
}
-
+
ts[0] = get_atimespec(&sbuf); /* atime. */
file_ntimes(conn, fname, ts);
- outsize = set_message(inbuf,outbuf,1,0,True);
- SSVAL(outbuf,smb_vwv0,fsp->fnum);
+ reply_outbuf(req, 1, 0);
+
+ SSVAL(req->outbuf,smb_vwv0,fsp->fnum);
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);
}
-
+
DEBUG( 2, ( "reply_mknew: file %s\n", fname ) );
- DEBUG( 3, ( "reply_mknew %s fd=%d dmode=0x%x\n", fname, fsp->fh->fd, (unsigned int)fattr ) );
+ DEBUG( 3, ( "reply_mknew %s fd=%d dmode=0x%x\n",
+ fname, fsp->fh->fd, (unsigned int)fattr ) );
END_PROFILE(SMBcreate);
- return(outsize);
+ return;
}
/****************************************************************************