summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/socket/socket_unix.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c
index 3f265f7214..04ba89578f 100644
--- a/source4/lib/socket/socket_unix.c
+++ b/source4/lib/socket/socket_unix.c
@@ -249,6 +249,37 @@ static NTSTATUS unixdom_send(struct socket_context *sock,
return NT_STATUS_OK;
}
+
+static NTSTATUS unixdom_sendto(struct socket_context *sock,
+ const DATA_BLOB *blob, size_t *sendlen, uint32_t flags,
+ const char *dest_addr, int dest_port)
+{
+ ssize_t len;
+ int flgs = 0;
+ struct sockaddr_un srv_addr;
+
+ if (strlen(dest_addr)+1 > sizeof(srv_addr.sun_path)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ ZERO_STRUCT(srv_addr);
+ srv_addr.sun_family = AF_UNIX;
+ strncpy(srv_addr.sun_path, dest_addr, sizeof(srv_addr.sun_path));
+
+ *sendlen = 0;
+
+ len = sendto(sock->fd, blob->data, blob->length, flgs,
+ (struct sockaddr *)&srv_addr, sizeof(srv_addr));
+ if (len == -1) {
+ return map_nt_error_from_unix(errno);
+ }
+
+ *sendlen = len;
+
+ return NT_STATUS_OK;
+}
+
+
static NTSTATUS unixdom_set_option(struct socket_context *sock,
const char *option, const char *val)
{
@@ -294,6 +325,7 @@ static const struct socket_ops unixdom_ops = {
.fn_accept = unixdom_accept,
.fn_recv = unixdom_recv,
.fn_send = unixdom_send,
+ .fn_sendto = unixdom_sendto,
.fn_close = unixdom_close,
.fn_set_option = unixdom_set_option,