TALLOC_FREE(msg);
}
-/*******************************************************************
- Setup only the byte count for a smb message.
-********************************************************************/
-
-int set_message_bcc(char *buf,int num_bytes)
-{
- int num_words = CVAL(buf,smb_wct);
- SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes);
- _smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4);
- return (smb_size + num_words*2 + num_bytes);
-}
-
-/*******************************************************************
- Add a data blob to the end of a smb_buf, adjusting bcc and smb_len.
- Return the bytes added
-********************************************************************/
-
-ssize_t message_push_blob(uint8_t **outbuf, DATA_BLOB blob)
-{
- size_t newlen;
- uint8_t *tmp;
-
- newlen = smb_len(*outbuf) + 4;
- if (newlen < 4) {
- return -1;
- }
-
- newlen += blob.length;
- if (newlen < blob.length) {
- return -1;
- }
-
- tmp = talloc_realloc(NULL, *outbuf, uint8_t, newlen);
- if (tmp == NULL) {
- DBG_ERR("talloc failed\n");
- return -1;
- }
- *outbuf = tmp;
-
- memcpy(tmp + smb_len(tmp) + 4, blob.data, blob.length);
- set_message_bcc((char *)tmp, smb_buflen(tmp) + blob.length);
- return blob.length;
-}
-
/*******************************************************************
Reduce a file name, removing .. elements.
********************************************************************/
fsp->fsp_name->st.cached_dos_attributes = FILE_ATTRIBUTE_INVALID;
return fsp;
}
+
+/*******************************************************************
+ Setup only the byte count for a smb message.
+********************************************************************/
+
+int set_message_bcc(char *buf, int num_bytes)
+{
+ int num_words = CVAL(buf, smb_wct);
+ SSVAL(buf, smb_vwv + num_words * SIZEOFWORD, num_bytes);
+ _smb_setlen(buf, smb_size + num_words * 2 + num_bytes - 4);
+ return (smb_size + num_words * 2 + num_bytes);
+}
+
+/*******************************************************************
+ Add a data blob to the end of a smb_buf, adjusting bcc and smb_len.
+ Return the bytes added
+********************************************************************/
+
+ssize_t message_push_blob(uint8_t **outbuf, DATA_BLOB blob)
+{
+ size_t newlen;
+ uint8_t *tmp;
+
+ newlen = smb_len(*outbuf) + 4;
+ if (newlen < 4) {
+ return -1;
+ }
+
+ newlen += blob.length;
+ if (newlen < blob.length) {
+ return -1;
+ }
+
+ tmp = talloc_realloc(NULL, *outbuf, uint8_t, newlen);
+ if (tmp == NULL) {
+ DBG_ERR("talloc failed\n");
+ return -1;
+ }
+ *outbuf = tmp;
+
+ memcpy(tmp + smb_len(tmp) + 4, blob.data, blob.length);
+ set_message_bcc((char *)tmp, smb_buflen(tmp) + blob.length);
+ return blob.length;
+}
struct smb_filename **_smb_fname_out,
char **_mask_out);
struct files_struct *file_fsp(struct smb_request *req, uint16_t fid);
+int set_message_bcc(char *buf, int num_bytes);
+ssize_t message_push_blob(uint8_t **outbuf, DATA_BLOB blob);
#endif