return nullptr;
}
- DCE2_MOVE(frag_ptr, frag_len, sizeof(DceRpcCoContElem));
+ dce2_move(frag_ptr, frag_len, sizeof(DceRpcCoContElem));
/* Don't really care about the transfer syntaxes */
for (j = 0; j < num_tsyns; j++)
return nullptr;
}
- DCE2_MOVE(frag_ptr, frag_len, sizeof(DceRpcCoSynId));
+ dce2_move(frag_ptr, frag_len, sizeof(DceRpcCoSynId));
}
if (sd->trans == DCE2_TRANS_TYPE__TCP)
{
return;
}
- DCE2_MOVE(frag_ptr, frag_len, sizeof(DceRpcCoBindAck));
+ dce2_move(frag_ptr, frag_len, sizeof(DceRpcCoBindAck));
/* Set what should be the maximum amount of data a client can send in a fragment */
max_recv_frag = DceRpcCoBindAckMaxRecvFrag(co_hdr, bind_ack);
return;
}
- DCE2_MOVE(ctx_data, ctx_len, sec_addr_len);
+ dce2_move(ctx_data, ctx_len, sec_addr_len);
/* padded to 4 octet */
if ((sizeof(DceRpcCoBindAck) + sec_addr_len) & 3)
return;
}
- DCE2_MOVE(ctx_data, ctx_len, pad);
+ dce2_move(ctx_data, ctx_len, pad);
/* Now we're at the start of the context item results */
if (ctx_len < sizeof(DceRpcCoContResultList))
ctx_list = (const DceRpcCoContResultList*)ctx_data;
num_ctx_results = DceRpcCoContNumResults(ctx_list);
- DCE2_MOVE(ctx_data, ctx_len, sizeof(DceRpcCoContResultList));
+ dce2_move(ctx_data, ctx_len, sizeof(DceRpcCoContResultList));
for (i = 0; i < num_ctx_results; i++)
{
ctx_result = (const DceRpcCoContResult*)ctx_data;
result = DceRpcCoContRes(co_hdr, ctx_result);
- DCE2_MOVE(ctx_data, ctx_len, sizeof(DceRpcCoContResult));
+ dce2_move(ctx_data, ctx_len, sizeof(DceRpcCoContResult));
if (DCE2_QueueIsEmpty(cot->pending_ctx_ids))
return;
return;
}
- DCE2_MOVE(frag_ptr, frag_len, sizeof(DceRpcCoBind));
+ dce2_move(frag_ptr, frag_len, sizeof(DceRpcCoBind));
switch (policy)
{
return;
}
- DCE2_MOVE(frag_ptr, frag_len, sizeof(DceRpcCoAltCtx));
+ dce2_move(frag_ptr, frag_len, sizeof(DceRpcCoAltCtx));
switch (policy)
{
}
else
{
- DCE2_MOVE(seg_data, seg_len, hdr_size);
+ dce2_move(seg_data, seg_len, hdr_size);
}
}
}
/* Move past header */
- DCE2_MOVE(frag_ptr, frag_len, req_size);
+ dce2_move(frag_ptr, frag_len, req_size);
/* If for some reason we had some fragments queued */
if (DceRpcCoFirstFrag(co_hdr) && !DceRpcCoLastFrag(co_hdr)
}
/* Move past header */
- DCE2_MOVE(frag_ptr, frag_len, sizeof(DceRpcCoResponse));
+ dce2_move(frag_ptr, frag_len, sizeof(DceRpcCoResponse));
/* If for some reason we had some fragments queued */
if (DceRpcCoFirstFrag(co_hdr) && !DCE2_BufferIsEmpty(cot->frag_tracker.srv_stub_buf))
/* We've got the main header. Move past it to the
* start of the pdu */
- DCE2_MOVE(frag_ptr, frag_len, sizeof(DceRpcCoHdr));
+ dce2_move(frag_ptr, frag_len, sizeof(DceRpcCoHdr));
/* Client specific pdu types - some overlap with server */
if ( DetectionEngine::get_current_packet()->is_from_client() )
return DCE2_RET__ERROR;
const DceRpcCoHdr* co_hdr = (const DceRpcCoHdr*)seg_ptr;
- DCE2_MOVE(seg_ptr, seg_len, sizeof(DceRpcCoHdr));
+ dce2_move(seg_ptr, seg_len, sizeof(DceRpcCoHdr));
if (DceRpcCoPduType(co_hdr) != DCERPC_PDU_TYPE__REQUEST)
return DCE2_RET__ERROR;
goto dce2_coprocess_exit;
}
- DCE2_MOVE(data_ptr, data_len, frag_len);
+ dce2_move(data_ptr, data_len, frag_len);
/* Got a full DCE/RPC pdu */
DCE2_CoDecode(sd, cot, frag_ptr, frag_len);
break;
/* Move the length of the amount of data we used to get header */
- DCE2_MOVE(data_ptr, data_len, data_used);
+ dce2_move(data_ptr, data_len, data_used);
if (DCE2_CoHdrChecks(sd, cot, (DceRpcCoHdr*)DCE2_BufferData(seg->buf)) !=
DCE2_RET__SUCCESS)
DCE2_BufferEmpty(seg->buf);
/* Move back to original packet header */
data_back = -data_used;
- DCE2_MOVE(data_ptr, data_len, data_back);
+ dce2_move(data_ptr, data_len, data_back);
/*Check the original packet*/
if (DCE2_CoHdrChecks(sd, cot, (const DceRpcCoHdr*)data_ptr) !=
DCE2_RET__SUCCESS)
if (status != DCE2_RET__SUCCESS)
break;
- DCE2_MOVE(data_ptr, data_len, data_used);
+ dce2_move(data_ptr, data_len, data_used);
}
/* Do this before calling DCE2_CoSegDecode since it will empty
uint32_t dcnt = SmbWriteAndXReqDataCnt((const SmbWriteAndXReq*)nb_ptr);
uint16_t remaining = SmbWriteAndXReqRemaining((const SmbWriteAndXReq*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
if (DCE2_SmbCheckData(ssd, (const uint8_t*)smb_hdr, nb_ptr, nb_len,
byte_count, dcnt, doff) != DCE2_RET__SUCCESS)
return DCE2_RET__ERROR;
// This may move backwards
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
// If a "raw" write is requested there will be two bytes after the
// header/pad and before the data which is supposed to represent a
// From data size check above, nb_len >= dsize
dcnt -= 2;
- DCE2_MOVE(nb_ptr, nb_len, 2);
+ dce2_move(nb_ptr, nb_len, 2);
}
if (dcnt > nb_len)
{
// Have at least 2 bytes of data based on byte count check done earlier
- DCE2_MOVE(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
+ dce2_move(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
if (!SmbFmtAscii(*nb_ptr))
{
return DCE2_RET__ERROR;
}
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
ssd->cur_rtracker->file_name =
DCE2_SmbGetFileName(nb_ptr, nb_len, SmbUnicode(smb_hdr),
// Have at least 2 bytes of data based on byte count check done earlier
- DCE2_MOVE(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
-
+ dce2_move(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
+ assert(nb_ptr != nullptr);
if (!SmbFmtAscii(*nb_ptr))
{
dce_alert(GID_DCE2, DCE2_SMB_BAD_FORM, (dce2CommonStats*)&dce2_smb_stats,
return DCE2_RET__ERROR;
}
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
ssd->cur_rtracker->file_name =
DCE2_SmbGetFileName(nb_ptr, nb_len, SmbUnicode(smb_hdr),
uint32_t i;
- DCE2_MOVE(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
+ dce2_move(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
if (!SmbFmtAscii(*nb_ptr))
{
return DCE2_RET__ERROR;
}
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
if (SmbUnicode(smb_hdr))
{
}
// i <= nb_len
- DCE2_MOVE(nb_ptr, nb_len, i);
+ dce2_move(nb_ptr, nb_len, i);
if ((nb_len > 0) && !SmbFmtAscii(*nb_ptr))
{
uint8_t fmt = *(nb_ptr + com_size);
uint16_t fmt_dcnt = snort::alignedNtohs((const uint16_t*)(nb_ptr + com_size + 1));
- DCE2_MOVE(nb_ptr, nb_len, (com_size + 3));
+ dce2_move(nb_ptr, nb_len, (com_size + 3));
DCE2_SmbCheckFmtData(ssd, nb_len, byte_count, fmt, com_dcnt, fmt_dcnt);
uint16_t fid = SmbWriteReqFid((const SmbWriteReq*)nb_ptr);
uint32_t offset = SmbWriteReqOffset((const SmbWriteReq*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, (com_size + 3));
+ dce2_move(nb_ptr, nb_len, (com_size + 3));
DCE2_SmbCheckFmtData(ssd, nb_len, byte_count, fmt, com_dcnt, fmt_dcnt);
// Have at least 2 bytes of data based on byte count check done earlier
- DCE2_MOVE(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
-
+ dce2_move(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
+ assert(nb_ptr != nullptr);
if (!SmbFmtAscii(*nb_ptr))
{
dce_alert(GID_DCE2, DCE2_SMB_BAD_FORM, (dce2CommonStats*)&dce2_smb_stats,
return DCE2_RET__ERROR;
}
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
ssd->cur_rtracker->file_name =
DCE2_SmbGetFileName(nb_ptr, nb_len, SmbUnicode(smb_hdr),
return DCE2_RET__ERROR;
if (!ftracker->is_ipc)
- ssd->cur_rtracker->file_offset = SmbLockAndReadReqOffset((const SmbLockAndReadReq*)nb_ptr);
+ ssd->cur_rtracker->file_offset = SmbLockAndReadReqOffset((const
+ SmbLockAndReadReq*)nb_ptr);
// Set this for response
ssd->cur_rtracker->ftracker = ftracker;
uint16_t com_dcnt = SmbLockAndReadRespCount((const SmbLockAndReadResp*)nb_ptr);
uint16_t fmt_dcnt = snort::alignedNtohs((const uint16_t*)(nb_ptr + com_size + 1));
- DCE2_MOVE(nb_ptr, nb_len, (com_size + 3));
+ dce2_move(nb_ptr, nb_len, (com_size + 3));
DCE2_SmbCheckFmtData(ssd, nb_len, byte_count, fmt, com_dcnt, fmt_dcnt);
uint16_t fid = SmbWriteAndUnlockReqFid((const SmbWriteAndUnlockReq*)nb_ptr);
uint32_t offset = SmbWriteAndUnlockReqOffset((const SmbWriteAndUnlockReq*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, (com_size + 3));
+ dce2_move(nb_ptr, nb_len, (com_size + 3));
DCE2_SmbCheckFmtData(ssd, nb_len, byte_count, fmt, com_dcnt, fmt_dcnt);
ssd->cur_rtracker->file_size = SmbOpenAndXReqAllocSize((const SmbOpenAndXReq*)nb_ptr);
}
- DCE2_MOVE(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
+ dce2_move(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
if (unicode)
pad = (nb_ptr - (const uint8_t*)smb_hdr) & 1;
if (nb_len < (pad + null_bytes))
return DCE2_RET__ERROR;
- DCE2_MOVE(nb_ptr, nb_len, pad);
+ dce2_move(nb_ptr, nb_len, pad);
// Samba allows chaining OpenAndX/NtCreateAndX so might have
// already been set.
uint16_t doff = SmbReadAndXRespDataOff((const SmbReadAndXResp*)nb_ptr);
uint32_t dcnt = SmbReadAndXRespDataCnt((const SmbReadAndXResp*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
if (DCE2_SmbCheckData(ssd, (const uint8_t*)smb_hdr, nb_ptr, nb_len,
byte_count, dcnt, doff) != DCE2_RET__SUCCESS)
return DCE2_RET__ERROR;
// This may move backwards
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
if (dcnt > nb_len)
dcnt = nb_len;
uint32_t dcnt = SmbWriteAndXReqDataCnt((const SmbWriteAndXReq*)nb_ptr);
uint64_t offset = SmbWriteAndXReqOffset((const SmbWriteAndXExtReq*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
if (DCE2_SmbCheckData(ssd, (const uint8_t*)smb_hdr, nb_ptr, nb_len,
byte_count, dcnt, doff) != DCE2_RET__SUCCESS)
return DCE2_RET__ERROR;
// This may move backwards
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
if (dcnt > nb_len)
{
uint16_t uni_pass_len =
SmbNt10SessionSetupAndXReqUnicodePassLen((const SmbNt10_SessionSetupAndXReq*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
if (((uint32_t)oem_pass_len + uni_pass_len) > nb_len)
{
return DCE2_RET__ERROR;
}
- DCE2_MOVE(nb_ptr, nb_len, (oem_pass_len + uni_pass_len));
+ dce2_move(nb_ptr, nb_len, (oem_pass_len + uni_pass_len));
// If unicode there should be a padding byte if the password
// lengths are even since the command length is odd
if ((increment == 2) && (nb_len != 0) && !((oem_pass_len + uni_pass_len) & 1))
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
}
else // Extended security blob version, word count of 12
{
uint16_t blob_len =
SmbSessionSetupAndXReqBlobLen((const SmbNt10_SessionSetupAndXExtReq*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
if (blob_len > nb_len)
{
return DCE2_RET__ERROR;
}
- DCE2_MOVE(nb_ptr, nb_len, blob_len);
+ dce2_move(nb_ptr, nb_len, blob_len);
// If unicode there should be a padding byte if the blob
// length is even since the command length is odd
if ((increment == 2) && (nb_len != 0) && !(blob_len & 1))
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
}
// Attempting to fingerprint Client Windows/Samba version.
for (j = 0; j < 2; j++)
{
+ assert(nb_ptr != nullptr);
while ((nb_len >= increment) && (*nb_ptr != '\0'))
- DCE2_MOVE(nb_ptr, nb_len, increment);
+ dce2_move(nb_ptr, nb_len, increment);
// Just return success if we run out of data
if (nb_len < increment)
}
// Move past NULL string terminator
- DCE2_MOVE(nb_ptr, nb_len, increment);
+ dce2_move(nb_ptr, nb_len, increment);
}
}
// sending data to it.
// Windows Vista and above don't put anything here
+ assert(nb_ptr != nullptr);
if (*nb_ptr == '\0')
{
DCE2_SsnSetPolicy(&ssd->sd, DCE2_POLICY__WINVISTA);
if (dce2_smb_os_fsm[state].input == (char)*nb_ptr)
{
state = dce2_smb_os_fsm[state].next_state;
- DCE2_MOVE(nb_ptr, rlen, increment);
+ dce2_move(nb_ptr, rlen, increment);
}
else
{
}
// Move to LanMan string
- DCE2_MOVE(nb_ptr, nb_len, i + increment);
+ dce2_move(nb_ptr, nb_len, i + increment);
// Samba
if (*nb_ptr == 'S')
if (DCE2_ComInfoWordCount(com_info) == 3)
{
- DCE2_MOVE(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
+ dce2_move(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
// Word count 3 and Unicode has a one byte pad
if ((increment == 2) && (nb_len != 0))
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
}
else // Only valid word counts are 3 and 4
{
uint16_t blob_len = SmbSessionSetupAndXRespBlobLen(
(const SmbNt10_SessionSetupAndXExtResp*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
+ dce2_move(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
if (blob_len > nb_len)
{
return DCE2_RET__ERROR;
}
- DCE2_MOVE(nb_ptr, nb_len, blob_len);
+ dce2_move(nb_ptr, nb_len, blob_len);
if ((increment == 2) && (nb_len != 0) && !(blob_len & 1))
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
}
// Attempting to fingerprint Server Windows/Samba version.
// Note the below is quick and dirty. We're assuming the server
// is kosher. It's policy will be used when the client is
// sending data to it.
+ assert(nb_ptr != nullptr);
if ((nb_len < increment) || (*nb_ptr == '\0'))
{
return DCE2_RET__SUCCESS;
if (dce2_smb_os_fsm[state].input == (char)*nb_ptr)
{
state = dce2_smb_os_fsm[state].next_state;
- DCE2_MOVE(nb_ptr, rlen, increment);
+ dce2_move(nb_ptr, rlen, increment);
}
else
{
}
// Move to LanMan string
- DCE2_MOVE(nb_ptr, nb_len, i + increment);
+ dce2_move(nb_ptr, nb_len, i + increment);
// Samba
if (*nb_ptr == 'S')
int ntlm_index = 0;
uint16_t com_size = DCE2_ComInfoCommandSize(com_info);
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
while ((term_ptr = (uint8_t*)memchr(nb_ptr, '\0', nb_len)) != nullptr)
{
}
// Move past format
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
if (nb_len == 0)
break;
break;
// Move past string and NULL byte
- DCE2_MOVE(nb_ptr, nb_len, (term_ptr - nb_ptr) + 1);
+ dce2_move(nb_ptr, nb_len, (term_ptr - nb_ptr) + 1);
ntlm_index++;
}
if (DCE2_ScSmbInvalidShares((dce2SmbProtoConf*)ssd->sd.config) != nullptr)
{
uint16_t pass_len = SmbTreeConnectAndXReqPassLen((const SmbTreeConnectAndXReq*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
if (pass_len >= nb_len)
return DCE2_RET__ERROR;
// Move past password length
- DCE2_MOVE(nb_ptr, nb_len, pass_len);
+ dce2_move(nb_ptr, nb_len, pass_len);
const uint8_t* bs = nullptr;
// Move past path components
+ assert(nb_ptr != nullptr);
while ((bs = (const uint8_t*)memchr(nb_ptr, '\\', nb_len)) != nullptr)
- DCE2_MOVE(nb_ptr, nb_len, (bs - nb_ptr) + 1);
+ dce2_move(nb_ptr, nb_len, (bs - nb_ptr) + 1);
// Move past NULL byte if unicode
if (SmbUnicode(smb_hdr) && (nb_len != 0))
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
if (nb_len != 0)
DCE2_SmbInvalidShareCheck(ssd, smb_hdr, nb_ptr, nb_len);
}
else
{
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
int state = SERVICE_0;
while ((nb_len > 0) && (state < SERVICE_FS))
if (dce2_smb_service_fsm[state].input == (char)*nb_ptr)
{
state = dce2_smb_service_fsm[state].next_state;
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
}
else
{
// Have at least 4 bytes of data based on byte count check done earlier
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
// If unicode flag is set, strings, except possibly the service string
// are going to be unicode. The NT spec specifies that unicode strings
return DCE2_RET__ERROR;
}
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
// IPC$ does not need to be case sensitive. And the case sensitivity flag in
// the SMB header doesn't seem to have any effect on this.
const uint8_t* bs = nullptr;
while ((bs = (const uint8_t*)memchr(nb_ptr, '\\', nb_len)) != nullptr)
- DCE2_MOVE(nb_ptr, nb_len, (bs - nb_ptr) + 1);
+ dce2_move(nb_ptr, nb_len, (bs - nb_ptr) + 1);
bool unicode = SmbUnicode(smb_hdr);
if (unicode && (nb_len > 0))
- DCE2_MOVE(nb_ptr, nb_len, 1);
+ dce2_move(nb_ptr, nb_len, 1);
// Check for invalid shares first
if ((DCE2_ScSmbInvalidShares((dce2SmbProtoConf*)ssd->sd.config) != nullptr) && (nb_len >
if (unicode && (nb_ptr[1] != 0))
break;
state = dce2_ipc_share_fsm[state].next_state;
- DCE2_MOVE(nb_ptr, nb_len, increment);
+ dce2_move(nb_ptr, nb_len, increment);
}
else
{
(const SmbNtCreateAndXReq*)nb_ptr);
}
- DCE2_MOVE(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
+ dce2_move(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
if (file_name_length > DCE2_SMB_MAX_PATH_LEN)
return DCE2_RET__ERROR;
if (nb_len < (pad + file_name_length))
return DCE2_RET__ERROR;
- DCE2_MOVE(nb_ptr, nb_len, pad);
+ dce2_move(nb_ptr, nb_len, pad);
// Samba allows chaining OpenAndX/NtCreateAndX so might have
// already been set.
uint16_t dcnt = SmbWriteRawReqDataCnt((const SmbWriteRawReq*)nb_ptr);
uint64_t offset = SmbWriteRawReqOffset((const SmbWriteRawExtReq*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
if (DCE2_SmbCheckTotalCount(ssd, tdcnt, dcnt, 0) != DCE2_RET__SUCCESS)
return DCE2_RET__ERROR;
return DCE2_RET__ERROR;
// This may move backwards
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
if (dcnt > nb_len)
{
uint16_t fid = SmbWriteAndCloseReqFid((const SmbWriteAndCloseReq*)nb_ptr);
uint32_t offset = SmbWriteAndCloseReqOffset((const SmbWriteAndCloseReq*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, (com_size + 1));
+ dce2_move(nb_ptr, nb_len, (com_size + 1));
if (DCE2_SmbCheckData(ssd, (const uint8_t*)smb_hdr, nb_ptr, nb_len,
byte_count, dcnt,
if (file_name_length > DCE2_SMB_MAX_PATH_LEN)
return DCE2_RET__ERROR;
- DCE2_MOVE(param_ptr, param_len, sizeof(SmbNtTransactCreateReqParams));
+ dce2_move(param_ptr, param_len, sizeof(SmbNtTransactCreateReqParams));
if (unicode)
pad = (param_ptr - param_start) & 1;
if (param_len < (pad + file_name_length))
return DCE2_RET__ERROR;
- DCE2_MOVE(param_ptr, param_len, pad);
+ dce2_move(param_ptr, param_len, pad);
ssd->cur_rtracker->file_name =
DCE2_SmbGetFileName(param_ptr, file_name_length, unicode, &ssd->cur_rtracker->file_name_size);
tpcnt = (uint16_t)ttracker->tpcnt;
}
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
if (DCE2_SmbValidateTransactionFields(ssd, (const uint8_t*)smb_hdr, nb_ptr, nb_len,
byte_count, tdcnt, tpcnt, dcnt, doff, ddisp, pcnt, poff, pdisp) != DCE2_RET__SUCCESS)
if (data_params & DCE2_SMB_TRANS__DATA)
{
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
if ((dcnt != 0)
&& (DCE2_SmbBufferTransactionData(ttracker, nb_ptr, dcnt, ddisp)
if (data_params & DCE2_SMB_TRANS__PARAMS)
{
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
if ((pcnt != 0)
&& (DCE2_SmbBufferTransactionParameters(ttracker, nb_ptr, pcnt, pdisp)
return DCE2_RET__ERROR;
}
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
// Samba validates the Name which should be \PIPE\ and errors
// if not. Windows doesn't care.
return DCE2_RET__ERROR;
}
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
break;
return DCE2_RET__IGNORE;
}
- DCE2_MOVE(nb_ptr, nb_len, com_size);
+ dce2_move(nb_ptr, nb_len, com_size);
break;
dce_alert(GID_DCE2, DCE2_SMB_DCNT_ZERO, (dce2CommonStats*)&dce2_smb_stats,
ssd->sd);
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
// If all of the data and parameters weren't sent, buffer what was sent
if (((dcnt != tdcnt) || (pcnt != tpcnt)) && (dcnt != 0)
dce_alert(GID_DCE2, DCE2_SMB_DCNT_ZERO, (dce2CommonStats*)&dce2_smb_stats,
ssd->sd);
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
// If all of the data and parameters weren't sent, buffer what was sent
if (((pcnt != tpcnt) || (dcnt != tdcnt)) && (pcnt != 0)
return DCE2_RET__ERROR;
}
- DCE2_MOVE(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
+ dce2_move(nb_ptr, nb_len, DCE2_ComInfoCommandSize(com_info));
// From client request
if (ttracker->smb_type == SMB_TYPE__REQUEST)
if (data_params & DCE2_SMB_TRANS__DATA)
{
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
if ((ttracker->dsent < ttracker->tdcnt)
|| (ttracker->psent < ttracker->tpcnt)
if (data_params & DCE2_SMB_TRANS__PARAMS)
{
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
if ((ttracker->dsent < ttracker->tdcnt)
|| (ttracker->psent < ttracker->tpcnt)
SmbTrans2Open2ReqAllocSize((const SmbTrans2Open2ReqParams*)param_ptr);
}
- DCE2_MOVE(param_ptr, param_len, sizeof(SmbTrans2Open2ReqParams));
+ dce2_move(param_ptr, param_len, sizeof(SmbTrans2Open2ReqParams));
ssd->cur_rtracker->file_name =
DCE2_SmbGetFileName(param_ptr, param_len, unicode, &ssd->cur_rtracker->file_name_size);
uint16_t pcnt = SmbTransactionReqParamCnt((const SmbTransactionReq*)nb_ptr);
uint16_t poff = SmbTransactionReqParamOff((const SmbTransactionReq*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
const uint8_t* data_ptr = nb_ptr;
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
const uint8_t* param_ptr = nb_ptr;
status = DCE2_SmbTransactionReq(ssd, ttracker, data_ptr, dcnt, param_ptr, pcnt);
uint16_t dcnt = SmbTransactionRespDataCnt((const SmbTransactionResp*)nb_ptr);
uint16_t doff = SmbTransactionRespDataOff((const SmbTransactionResp*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
if (DCE2_SmbProcessResponseData(ssd, nb_ptr, dcnt) != DCE2_RET__SUCCESS)
return DCE2_RET__ERROR;
if (status != DCE2_RET__FULL)
return status;
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
switch (ttracker->subcom)
{
case TRANS2_SET_FILE_INFORMATION:
data_ptr = nb_ptr;
- DCE2_MOVE(data_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - data_ptr);
+ dce2_move(data_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - data_ptr);
status = DCE2_SmbTrans2SetFileInfoReq(ssd, nb_ptr, pcnt, data_ptr, dcnt);
if (status != DCE2_RET__SUCCESS)
uint16_t poff = SmbTransaction2RespParamOff((const SmbTransaction2Resp*)nb_ptr);
uint16_t pcnt = SmbTransaction2RespParamCnt((const SmbTransaction2Resp*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
ptr = nb_ptr;
len = pcnt;
uint16_t doff = SmbTransaction2RespDataOff((const SmbTransaction2Resp*)nb_ptr);
uint16_t dcnt = SmbTransaction2RespDataCnt((const SmbTransaction2Resp*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + doff) - nb_ptr);
ptr = nb_ptr;
len = dcnt;
uint16_t poff = SmbTransaction2RespParamOff((const SmbTransaction2Resp*)nb_ptr);
uint16_t pcnt = SmbTransaction2RespParamCnt((const SmbTransaction2Resp*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
ptr = nb_ptr;
len = pcnt;
if (status != DCE2_RET__FULL)
return status;
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
switch (ttracker->subcom)
{
uint32_t poff = SmbNtTransactRespParamOff((const SmbNtTransactResp*)nb_ptr);
uint32_t pcnt = SmbNtTransactRespParamCnt((const SmbNtTransactResp*)nb_ptr);
- DCE2_MOVE(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
+ dce2_move(nb_ptr, nb_len, ((const uint8_t*)smb_hdr + poff) - nb_ptr);
ptr = nb_ptr;
len = pcnt;