#include "replace.h"
#include "system/filesys.h"
#include "iov_buf.h"
+#include <talloc.h>
ssize_t iov_buflen(const struct iovec *iov, int iovcnt)
{
*iovcnt = cnt;
return true;
}
+
+uint8_t *iov_concat(TALLOC_CTX *mem_ctx, const struct iovec *iov, int count)
+{
+ ssize_t buflen;
+ uint8_t *buf;
+
+ buflen = iov_buflen(iov, count);
+ if (buflen == -1) {
+ return NULL;
+ }
+
+ buf = talloc_array(mem_ctx, uint8_t, buflen);
+ if (buf == NULL) {
+ return NULL;
+ }
+
+ iov_buf(iov, count, buf, buflen);
+
+ return buf;
+}
#ifndef __LIB_IOV_BUF_H__
#define __LIB_IOV_BUF_H__
-#include <unistd.h>
-#include <stdint.h>
-#include <stdbool.h>
+#include "replace.h"
+#include <talloc.h>
ssize_t iov_buflen(const struct iovec *iov, int iovlen);
ssize_t iov_buf(const struct iovec *iov, int iovcnt,
uint8_t *buf, size_t buflen);
bool iov_advance(struct iovec **iov, int *iovcnt, size_t n);
+uint8_t *iov_concat(TALLOC_CTX *mem_ctx, const struct iovec *iov, int count);
#endif
return ret;
}
-static uint8_t *smbXcli_iov_concat(TALLOC_CTX *mem_ctx,
- const struct iovec *iov,
- int count)
-{
- ssize_t buflen;
- uint8_t *buf;
-
- buflen = iov_buflen(iov, count);
- if (buflen == -1) {
- return NULL;
- }
-
- buf = talloc_array(mem_ctx, uint8_t, buflen);
- if (buf == NULL) {
- return NULL;
- }
-
- iov_buf(iov, count, buf, buflen);
-
- return buf;
-}
-
static void smb1cli_req_flags(enum protocol_types protocol,
uint32_t smb1_capabilities,
uint8_t smb_command,
frame = talloc_stackframe();
- buf = smbXcli_iov_concat(frame, &iov[1], iov_count - 1);
+ buf = iov_concat(frame, &iov[1], iov_count - 1);
if (buf == NULL) {
return NT_STATUS_NO_MEMORY;
}
if (common_encryption_on(state->conn->smb1.trans_enc)) {
char *buf, *enc_buf;
- buf = (char *)smbXcli_iov_concat(talloc_tos(), iov, iov_count);
+ buf = (char *)iov_concat(talloc_tos(), iov, iov_count);
if (buf == NULL) {
return NT_STATUS_NO_MEMORY;
}