summaryrefslogtreecommitdiff
path: root/source3/smbd/nttrans.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/nttrans.c')
-rw-r--r--source3/smbd/nttrans.c110
1 files changed, 52 insertions, 58 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 30841686fb..1a13d962f0 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -120,6 +120,11 @@ void send_nt_replies(connection_struct *conn,
+ data_alignment_offset);
/*
+ * We might have had SMBnttranss in req->inbuf, fix that.
+ */
+ SCVAL(req->outbuf, smb_com, SMBnttrans);
+
+ /*
* Set total params and data to be sent.
*/
@@ -304,11 +309,10 @@ static void do_ntcreate_pipe_open(connection_struct *conn,
char *fname = NULL;
int pnum = -1;
char *p = NULL;
- uint32 flags = IVAL(req->inbuf,smb_ntcreate_Flags);
+ uint32 flags = IVAL(req->vwv+3, 1);
TALLOC_CTX *ctx = talloc_tos();
- srvstr_pull_buf_talloc(ctx, (char *)req->inbuf, req->flags2, &fname,
- smb_buf(req->inbuf), STR_TERMINATE);
+ srvstr_pull_req_talloc(ctx, req, &fname, req->buf, STR_TERMINATE);
if (!fname) {
reply_botherror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND,
@@ -408,24 +412,21 @@ void reply_ntcreate_and_X(struct smb_request *req)
return;
}
- flags = IVAL(req->inbuf,smb_ntcreate_Flags);
- access_mask = IVAL(req->inbuf,smb_ntcreate_DesiredAccess);
- file_attributes = IVAL(req->inbuf,smb_ntcreate_FileAttributes);
- share_access = IVAL(req->inbuf,smb_ntcreate_ShareAccess);
- create_disposition = IVAL(req->inbuf,smb_ntcreate_CreateDisposition);
- create_options = IVAL(req->inbuf,smb_ntcreate_CreateOptions);
- root_dir_fid = (uint16)IVAL(req->inbuf,smb_ntcreate_RootDirectoryFid);
+ flags = IVAL(req->vwv+3, 1);
+ access_mask = IVAL(req->vwv+7, 1);
+ file_attributes = IVAL(req->vwv+13, 1);
+ share_access = IVAL(req->vwv+15, 1);
+ create_disposition = IVAL(req->vwv+17, 1);
+ create_options = IVAL(req->vwv+19, 1);
+ root_dir_fid = (uint16)IVAL(req->vwv+5, 1);
- allocation_size = (uint64_t)IVAL(req->inbuf,
- smb_ntcreate_AllocationSize);
+ allocation_size = (uint64_t)IVAL(req->vwv+9, 1);
#ifdef LARGE_SMB_OFF_T
- allocation_size |= (((uint64_t)IVAL(
- req->inbuf,
- smb_ntcreate_AllocationSize + 4)) << 32);
+ allocation_size |= (((uint64_t)IVAL(req->vwv+11, 1)) << 32);
#endif
- srvstr_get_path(ctx, (char *)req->inbuf, req->flags2, &fname,
- smb_buf(req->inbuf), 0, STR_TERMINATE, &status);
+ srvstr_get_path_req(ctx, req, &fname, (const char *)req->buf,
+ STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
@@ -729,6 +730,9 @@ static NTSTATUS set_sd(files_struct *fsp, uint8 *data, uint32 sd_len,
if (psd->sacl==0) {
security_info_sent &= ~SACL_SECURITY_INFORMATION;
}
+ if (security_info_sent & DACL_SECURITY_INFORMATION) {
+ psd->type |= SEC_DESC_DACL_PRESENT;
+ }
if (psd->dacl==0) {
security_info_sent &= ~DACL_SECURITY_INFORMATION;
}
@@ -1228,7 +1232,7 @@ void reply_ntrename(struct smb_request *req)
connection_struct *conn = req->conn;
char *oldname = NULL;
char *newname = NULL;
- char *p;
+ const char *p;
NTSTATUS status;
bool src_has_wcard = False;
bool dest_has_wcard = False;
@@ -1244,13 +1248,12 @@ void reply_ntrename(struct smb_request *req)
return;
}
- attrs = SVAL(req->inbuf,smb_vwv0);
- rename_type = SVAL(req->inbuf,smb_vwv1);
+ attrs = SVAL(req->vwv+0, 0);
+ rename_type = SVAL(req->vwv+1, 0);
- p = smb_buf(req->inbuf) + 1;
- p += srvstr_get_path_wcard(ctx, (char *)req->inbuf, req->flags2, &oldname, p,
- 0, STR_TERMINATE, &status,
- &src_has_wcard);
+ p = (const char *)req->buf + 1;
+ p += srvstr_get_path_req_wcard(ctx, req, &oldname, p, STR_TERMINATE,
+ &status, &src_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
END_PROFILE(SMBntrename);
@@ -1271,9 +1274,8 @@ void reply_ntrename(struct smb_request *req)
}
p++;
- p += srvstr_get_path_wcard(ctx, (char *)req->inbuf, req->flags2, &newname, p,
- 0, STR_TERMINATE, &status,
- &dest_has_wcard);
+ p += srvstr_get_path_req_wcard(ctx, req, &newname, p, STR_TERMINATE,
+ &status, &dest_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
END_PROFILE(SMBntrename);
@@ -1446,7 +1448,8 @@ static void call_nt_transact_notify_change(connection_struct *conn,
* here.
*/
- change_notify_reply(fsp->conn, req->inbuf, max_param_count, fsp->notify);
+ change_notify_reply(fsp->conn, req, max_param_count,
+ fsp->notify);
/*
* change_notify_reply() above has independently sent its
@@ -2538,11 +2541,11 @@ void reply_nttrans(struct smb_request *req)
size = smb_len(req->inbuf) + 4;
av_size = smb_len(req->inbuf);
- pscnt = IVAL(req->inbuf,smb_nt_ParameterCount);
- psoff = IVAL(req->inbuf,smb_nt_ParameterOffset);
- dscnt = IVAL(req->inbuf,smb_nt_DataCount);
- dsoff = IVAL(req->inbuf,smb_nt_DataOffset);
- function_code = SVAL(req->inbuf, smb_nt_Function);
+ pscnt = IVAL(req->vwv+9, 1);
+ psoff = IVAL(req->vwv+11, 1);
+ dscnt = IVAL(req->vwv+13, 1);
+ dsoff = IVAL(req->vwv+15, 1);
+ function_code = SVAL(req->vwv+18, 0);
if (IS_IPC(conn) && (function_code != NT_TRANSACT_CREATE)) {
reply_doserror(req, ERRSRV, ERRaccess);
@@ -2568,15 +2571,15 @@ void reply_nttrans(struct smb_request *req)
state->mid = req->mid;
state->vuid = req->vuid;
- state->total_data = IVAL(req->inbuf, smb_nt_TotalDataCount);
+ state->total_data = IVAL(req->vwv+3, 1);
state->data = NULL;
- state->total_param = IVAL(req->inbuf, smb_nt_TotalParameterCount);
+ state->total_param = IVAL(req->vwv+1, 1);
state->param = NULL;
- state->max_data_return = IVAL(req->inbuf,smb_nt_MaxDataCount);
- state->max_param_return = IVAL(req->inbuf,smb_nt_MaxParameterCount);
+ state->max_data_return = IVAL(req->vwv+7, 1);
+ state->max_param_return = IVAL(req->vwv+5, 1);
/* setup count is in *words* */
- state->setup_count = 2*CVAL(req->inbuf,smb_nt_SetupCount);
+ state->setup_count = 2*CVAL(req->vwv+17, 1);
state->setup = NULL;
state->call = function_code;
@@ -2691,8 +2694,7 @@ void reply_nttrans(struct smb_request *req)
goto bad_param;
}
- memcpy( state->setup, &req->inbuf[smb_nt_SetupStart],
- state->setup_count);
+ memcpy(state->setup, req->vwv+19, state->setup_count);
dump_data(10, (uint8 *)state->setup, state->setup_count);
}
@@ -2763,25 +2765,23 @@ void reply_nttranss(struct smb_request *req)
/* Revise state->total_param and state->total_data in case they have
changed downwards */
- if (IVAL(req->inbuf, smb_nts_TotalParameterCount)
- < state->total_param) {
- state->total_param = IVAL(req->inbuf,
- smb_nts_TotalParameterCount);
+ if (IVAL(req->vwv+1, 1) < state->total_param) {
+ state->total_param = IVAL(req->vwv+1, 1);
}
- if (IVAL(req->inbuf, smb_nts_TotalDataCount) < state->total_data) {
- state->total_data = IVAL(req->inbuf, smb_nts_TotalDataCount);
+ if (IVAL(req->vwv+3, 1) < state->total_data) {
+ state->total_data = IVAL(req->vwv+3, 1);
}
size = smb_len(req->inbuf) + 4;
av_size = smb_len(req->inbuf);
- pcnt = IVAL(req->inbuf,smb_nts_ParameterCount);
- poff = IVAL(req->inbuf, smb_nts_ParameterOffset);
- pdisp = IVAL(req->inbuf, smb_nts_ParameterDisplacement);
+ pcnt = IVAL(req->vwv+5, 1);
+ poff = IVAL(req->vwv+7, 1);
+ pdisp = IVAL(req->vwv+9, 1);
- dcnt = IVAL(req->inbuf, smb_nts_DataCount);
- ddisp = IVAL(req->inbuf, smb_nts_DataDisplacement);
- doff = IVAL(req->inbuf, smb_nts_DataOffset);
+ dcnt = IVAL(req->vwv+11, 1);
+ doff = IVAL(req->vwv+13, 1);
+ ddisp = IVAL(req->vwv+15, 1);
state->received_param += pcnt;
state->received_data += dcnt;
@@ -2834,12 +2834,6 @@ void reply_nttranss(struct smb_request *req)
return;
}
- /*
- * construct_reply_common will copy smb_com from inbuf to
- * outbuf. SMBnttranss is wrong here.
- */
- SCVAL(req->inbuf,smb_com,SMBnttrans);
-
handle_nttrans(conn, state, req);
DLIST_REMOVE(conn->pending_trans, state);