body_dynamic_size = 0;
}
- req = talloc(transport, struct smb2_request);
+ req = talloc_zero(transport, struct smb2_request);
if (req == NULL) return NULL;
req->state = SMB2_REQUEST_INIT;
req->transport = transport;
- req->session = NULL;
- req->tree = NULL;
- req->recv_iov = NULL;
- req->status = NT_STATUS_OK;
- req->async.fn = NULL;
-
- ZERO_STRUCT(req->cancel);
- ZERO_STRUCT(req->in);
- ZERO_STRUCT(req->out);
-
- if (req->out.size > 0) {
- hdr_offset = req->out.size;
- } else {
- hdr_offset = NBT_HDR_SIZE;
- }
+
+ hdr_offset = NBT_HDR_SIZE;
req->out.size = hdr_offset + SMB2_HDR_BODY + body_fixed_size;
req->out.allocated = req->out.size + body_dynamic_size;
body_dynamic_size);
if (req == NULL) return NULL;
- SIVAL(req->out.hdr, SMB2_HDR_PID, tree->session->pid);
- SIVAL(req->out.hdr, SMB2_HDR_TID, tree->tid);
req->session = tree->session;
req->tree = tree;
DATA_BLOB blob;
NTSTATUS status;
bool ret;
+ void *ptr = NULL;
if (str == NULL) {
return smb2_push_o16s16_blob(buf, ofs, data_blob(NULL, 0));
}
ret = convert_string_talloc(buf->buffer, CH_UNIX, CH_UTF16,
- str, strlen(str), (void **)&blob.data, &blob.length);
+ str, strlen(str), &ptr, &blob.length);
if (!ret) {
return NT_STATUS_ILLEGAL_CHARACTER;
}
+ blob.data = (uint8_t *)ptr;
status = smb2_push_o16s16_blob(buf, ofs, blob);
data_blob_free(&blob);