uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str)
{
- size_t buflen = talloc_get_size(buf);
+ size_t buflen;
char *converted;
size_t converted_size;
+ if (buf == NULL) {
+ return NULL;
+ }
+
+ buflen = talloc_get_size(buf);
/*
* We're pushing into an SMB buffer, align odd
*/
buf = TALLOC_REALLOC_ARRAY(NULL, buf, uint8_t,
buflen + converted_size);
if (buf == NULL) {
+ TALLOC_FREE(converted);
return NULL;
}
}
result = cli_request_send(mem_ctx, ev, cli, SMBopenX, additional_flags,
- 15, vwv, talloc_get_size(bytes), bytes);
+ 15, vwv, 0, talloc_get_size(bytes), bytes);
TALLOC_FREE(bytes);
return result;
}
uint8_t *bytes;
NTSTATUS status;
- SMB_ASSERT(req->state >= ASYNC_REQ_DONE);
- if (req->state == ASYNC_REQ_ERROR) {
- return req->status;
+ if (async_req_is_error(req, &status)) {
+ return status;
}
status = cli_pull_reply(req, &wct, &vwv, &num_bytes, &bytes);
SSVAL(vwv+0, 0, fnum);
SIVALS(vwv+1, 0, -1);
- return cli_request_send(mem_ctx, ev, cli, SMBclose, 0, 3, vwv,
+ return cli_request_send(mem_ctx, ev, cli, SMBclose, 0, 3, vwv, 0,
0, NULL);
}
uint16_t *vwv;
uint16_t num_bytes;
uint8_t *bytes;
+ NTSTATUS status;
- SMB_ASSERT(req->state >= ASYNC_REQ_DONE);
- if (req->state == ASYNC_REQ_ERROR) {
- return req->status;
+ if (async_req_is_error(req, &status)) {
+ return status;
}
return cli_pull_reply(req, &wct, &vwv, &num_bytes, &bytes);