summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/util/iov_buf.c21
-rw-r--r--lib/util/iov_buf.h6
-rw-r--r--lib/util/wscript_build1
-rw-r--r--libcli/smb/smbXcli_base.c26
4 files changed, 27 insertions, 27 deletions
diff --git a/lib/util/iov_buf.c b/lib/util/iov_buf.c
index d260b2fea86..592bc5d0498 100644
--- a/lib/util/iov_buf.c
+++ b/lib/util/iov_buf.c
@@ -20,6 +20,7 @@
#include "replace.h"
#include "system/filesys.h"
#include "iov_buf.h"
+#include <talloc.h>
ssize_t iov_buflen(const struct iovec *iov, int iovcnt)
{
@@ -90,3 +91,23 @@ bool iov_advance(struct iovec **iov, int *iovcnt, size_t n)
*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;
+}
diff --git a/lib/util/iov_buf.h b/lib/util/iov_buf.h
index 8f0ca266da9..79b81b84779 100644
--- a/lib/util/iov_buf.h
+++ b/lib/util/iov_buf.h
@@ -20,13 +20,13 @@
#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
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 91505eb1b44..d09394736ac 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -78,6 +78,7 @@ bld.SAMBA_SUBSYSTEM('samba-util-core',
bld.SAMBA_LIBRARY('iov_buf',
source='iov_buf.c',
+ deps='talloc',
local_include=False,
private_library=True)
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 1fcf11e6c93..1ec11a9dec4 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -1343,28 +1343,6 @@ static size_t smbXcli_iov_len(const struct iovec *iov, int count)
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,
@@ -1647,7 +1625,7 @@ static NTSTATUS smb1cli_conn_signv(struct smbXcli_conn *conn,
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;
}
@@ -1739,7 +1717,7 @@ static NTSTATUS smb1cli_req_writev_submit(struct tevent_req *req,
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;
}