summaryrefslogtreecommitdiff
path: root/source4/lib/socket
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/socket')
-rw-r--r--source4/lib/socket/socket.c20
-rw-r--r--source4/lib/socket/socket.h16
-rw-r--r--source4/lib/socket/socket_ipv4.c38
-rw-r--r--source4/lib/socket/socket_ipv6.c19
-rw-r--r--source4/lib/socket/socket_unix.c26
5 files changed, 38 insertions, 81 deletions
diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c
index 9d18377db1..4f7f4ef4b9 100644
--- a/source4/lib/socket/socket.c
+++ b/source4/lib/socket/socket.c
@@ -171,7 +171,7 @@ _PUBLIC_ NTSTATUS socket_accept(struct socket_context *sock, struct socket_conte
}
_PUBLIC_ NTSTATUS socket_recv(struct socket_context *sock, void *buf,
- size_t wantlen, size_t *nread, uint32_t flags)
+ size_t wantlen, size_t *nread)
{
if (sock == NULL) {
return NT_STATUS_CONNECTION_DISCONNECTED;
@@ -191,14 +191,14 @@ _PUBLIC_ NTSTATUS socket_recv(struct socket_context *sock, void *buf,
*nread = 0;
return STATUS_MORE_ENTRIES;
}
- return sock->ops->fn_recv(sock, buf, 1+(random() % wantlen), nread, flags);
+ return sock->ops->fn_recv(sock, buf, 1+(random() % wantlen), nread);
}
- return sock->ops->fn_recv(sock, buf, wantlen, nread, flags);
+ return sock->ops->fn_recv(sock, buf, wantlen, nread);
}
_PUBLIC_ NTSTATUS socket_recvfrom(struct socket_context *sock, void *buf,
- size_t wantlen, size_t *nread, uint32_t flags,
+ size_t wantlen, size_t *nread,
TALLOC_CTX *mem_ctx, struct socket_address **src_addr)
{
if (sock == NULL) {
@@ -212,12 +212,12 @@ _PUBLIC_ NTSTATUS socket_recvfrom(struct socket_context *sock, void *buf,
return NT_STATUS_NOT_IMPLEMENTED;
}
- return sock->ops->fn_recvfrom(sock, buf, wantlen, nread, flags,
+ return sock->ops->fn_recvfrom(sock, buf, wantlen, nread,
mem_ctx, src_addr);
}
_PUBLIC_ NTSTATUS socket_send(struct socket_context *sock,
- const DATA_BLOB *blob, size_t *sendlen, uint32_t flags)
+ const DATA_BLOB *blob, size_t *sendlen)
{
if (sock == NULL) {
return NT_STATUS_CONNECTION_DISCONNECTED;
@@ -238,15 +238,15 @@ _PUBLIC_ NTSTATUS socket_send(struct socket_context *sock,
return STATUS_MORE_ENTRIES;
}
blob2.length = 1+(random() % blob2.length);
- return sock->ops->fn_send(sock, &blob2, sendlen, flags);
+ return sock->ops->fn_send(sock, &blob2, sendlen);
}
- return sock->ops->fn_send(sock, blob, sendlen, flags);
+ return sock->ops->fn_send(sock, blob, sendlen);
}
_PUBLIC_ NTSTATUS socket_sendto(struct socket_context *sock,
- const DATA_BLOB *blob, size_t *sendlen, uint32_t flags,
+ const DATA_BLOB *blob, size_t *sendlen,
const struct socket_address *dest_addr)
{
if (sock == NULL) {
@@ -265,7 +265,7 @@ _PUBLIC_ NTSTATUS socket_sendto(struct socket_context *sock,
return NT_STATUS_NOT_IMPLEMENTED;
}
- return sock->ops->fn_sendto(sock, blob, sendlen, flags, dest_addr);
+ return sock->ops->fn_sendto(sock, blob, sendlen, dest_addr);
}
diff --git a/source4/lib/socket/socket.h b/source4/lib/socket/socket.h
index 31dadb2f89..04ae53e464 100644
--- a/source4/lib/socket/socket.h
+++ b/source4/lib/socket/socket.h
@@ -62,15 +62,15 @@ struct socket_ops {
/* general ops */
NTSTATUS (*fn_recv)(struct socket_context *sock, void *buf,
- size_t wantlen, size_t *nread, uint32_t flags);
+ size_t wantlen, size_t *nread);
NTSTATUS (*fn_send)(struct socket_context *sock,
- const DATA_BLOB *blob, size_t *sendlen, uint32_t flags);
+ const DATA_BLOB *blob, size_t *sendlen);
NTSTATUS (*fn_sendto)(struct socket_context *sock,
- const DATA_BLOB *blob, size_t *sendlen, uint32_t flags,
+ const DATA_BLOB *blob, size_t *sendlen,
const struct socket_address *dest_addr);
NTSTATUS (*fn_recvfrom)(struct socket_context *sock,
- void *buf, size_t wantlen, size_t *nread, uint32_t flags,
+ void *buf, size_t wantlen, size_t *nread,
TALLOC_CTX *addr_ctx, struct socket_address **src_addr);
NTSTATUS (*fn_pending)(struct socket_context *sock, size_t *npending);
@@ -129,14 +129,14 @@ NTSTATUS socket_listen(struct socket_context *sock,
int queue_size, uint32_t flags);
NTSTATUS socket_accept(struct socket_context *sock, struct socket_context **new_sock);
NTSTATUS socket_recv(struct socket_context *sock, void *buf,
- size_t wantlen, size_t *nread, uint32_t flags);
+ size_t wantlen, size_t *nread);
NTSTATUS socket_recvfrom(struct socket_context *sock, void *buf,
- size_t wantlen, size_t *nread, uint32_t flags,
+ size_t wantlen, size_t *nread,
TALLOC_CTX *addr_ctx, struct socket_address **src_addr);
NTSTATUS socket_send(struct socket_context *sock,
- const DATA_BLOB *blob, size_t *sendlen, uint32_t flags);
+ const DATA_BLOB *blob, size_t *sendlen);
NTSTATUS socket_sendto(struct socket_context *sock,
- const DATA_BLOB *blob, size_t *sendlen, uint32_t flags,
+ const DATA_BLOB *blob, size_t *sendlen,
const struct socket_address *dest_addr);
NTSTATUS socket_pending(struct socket_context *sock, size_t *npending);
NTSTATUS socket_set_option(struct socket_context *sock, const char *option, const char *val);
diff --git a/source4/lib/socket/socket_ipv4.c b/source4/lib/socket/socket_ipv4.c
index 9e1f60d40a..38c9f98fdb 100644
--- a/source4/lib/socket/socket_ipv4.c
+++ b/source4/lib/socket/socket_ipv4.c
@@ -251,23 +251,13 @@ static NTSTATUS ipv4_accept(struct socket_context *sock, struct socket_context *
}
static NTSTATUS ipv4_recv(struct socket_context *sock, void *buf,
- size_t wantlen, size_t *nread, uint32_t flags)
+ size_t wantlen, size_t *nread)
{
ssize_t gotlen;
- int flgs = 0;
-
- /* TODO: we need to map all flags here */
- if (flags & SOCKET_FLAG_PEEK) {
- flgs |= MSG_PEEK;
- }
-
- if (flags & SOCKET_FLAG_BLOCK) {
- flgs |= MSG_WAITALL;
- }
*nread = 0;
- gotlen = recv(sock->fd, buf, wantlen, flgs);
+ gotlen = recv(sock->fd, buf, wantlen, 0);
if (gotlen == 0) {
return NT_STATUS_END_OF_FILE;
} else if (gotlen == -1) {
@@ -281,11 +271,10 @@ static NTSTATUS ipv4_recv(struct socket_context *sock, void *buf,
static NTSTATUS ipv4_recvfrom(struct socket_context *sock, void *buf,
- size_t wantlen, size_t *nread, uint32_t flags,
+ size_t wantlen, size_t *nread,
TALLOC_CTX *addr_ctx, struct socket_address **_src)
{
ssize_t gotlen;
- int flgs = 0;
struct sockaddr_in *from_addr;
socklen_t from_len = sizeof(*from_addr);
struct socket_address *src;
@@ -305,17 +294,10 @@ static NTSTATUS ipv4_recvfrom(struct socket_context *sock, void *buf,
}
src->sockaddr = (struct sockaddr *)from_addr;
- if (flags & SOCKET_FLAG_PEEK) {
- flgs |= MSG_PEEK;
- }
-
- if (flags & SOCKET_FLAG_BLOCK) {
- flgs |= MSG_WAITALL;
- }
*nread = 0;
- gotlen = recvfrom(sock->fd, buf, wantlen, flgs,
+ gotlen = recvfrom(sock->fd, buf, wantlen, 0,
src->sockaddr, &from_len);
if (gotlen == 0) {
talloc_free(src);
@@ -345,14 +327,13 @@ static NTSTATUS ipv4_recvfrom(struct socket_context *sock, void *buf,
}
static NTSTATUS ipv4_send(struct socket_context *sock,
- const DATA_BLOB *blob, size_t *sendlen, uint32_t flags)
+ const DATA_BLOB *blob, size_t *sendlen)
{
ssize_t len;
- int flgs = 0;
*sendlen = 0;
- len = send(sock->fd, blob->data, blob->length, flgs);
+ len = send(sock->fd, blob->data, blob->length, 0);
if (len == -1) {
return map_nt_error_from_unix(errno);
}
@@ -363,14 +344,13 @@ static NTSTATUS ipv4_send(struct socket_context *sock,
}
static NTSTATUS ipv4_sendto(struct socket_context *sock,
- const DATA_BLOB *blob, size_t *sendlen, uint32_t flags,
+ const DATA_BLOB *blob, size_t *sendlen,
const struct socket_address *dest_addr)
{
ssize_t len;
- int flgs = 0;
if (dest_addr->sockaddr) {
- len = sendto(sock->fd, blob->data, blob->length, flgs,
+ len = sendto(sock->fd, blob->data, blob->length, 0,
dest_addr->sockaddr, dest_addr->sockaddrlen);
} else {
struct sockaddr_in srv_addr;
@@ -387,7 +367,7 @@ static NTSTATUS ipv4_sendto(struct socket_context *sock,
*sendlen = 0;
- len = sendto(sock->fd, blob->data, blob->length, flgs,
+ len = sendto(sock->fd, blob->data, blob->length, 0,
(struct sockaddr *)&srv_addr, sizeof(srv_addr));
}
if (len == -1) {
diff --git a/source4/lib/socket/socket_ipv6.c b/source4/lib/socket/socket_ipv6.c
index 9b6dcbf985..3e987b4306 100644
--- a/source4/lib/socket/socket_ipv6.c
+++ b/source4/lib/socket/socket_ipv6.c
@@ -224,23 +224,13 @@ static NTSTATUS ipv6_tcp_accept(struct socket_context *sock, struct socket_conte
}
static NTSTATUS ipv6_tcp_recv(struct socket_context *sock, void *buf,
- size_t wantlen, size_t *nread, uint32_t flags)
+ size_t wantlen, size_t *nread)
{
ssize_t gotlen;
- int flgs = 0;
-
- /* TODO: we need to map all flags here */
- if (flags & SOCKET_FLAG_PEEK) {
- flgs |= MSG_PEEK;
- }
-
- if (flags & SOCKET_FLAG_BLOCK) {
- flgs |= MSG_WAITALL;
- }
*nread = 0;
- gotlen = recv(sock->fd, buf, wantlen, flgs);
+ gotlen = recv(sock->fd, buf, wantlen, 0);
if (gotlen == 0) {
return NT_STATUS_END_OF_FILE;
} else if (gotlen == -1) {
@@ -253,14 +243,13 @@ static NTSTATUS ipv6_tcp_recv(struct socket_context *sock, void *buf,
}
static NTSTATUS ipv6_tcp_send(struct socket_context *sock,
- const DATA_BLOB *blob, size_t *sendlen, uint32_t flags)
+ const DATA_BLOB *blob, size_t *sendlen)
{
ssize_t len;
- int flgs = 0;
*sendlen = 0;
- len = send(sock->fd, blob->data, blob->length, flgs);
+ len = send(sock->fd, blob->data, blob->length, 0);
if (len == -1) {
return map_nt_error_from_unix(errno);
}
diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c
index 3feb1bf234..d59ef02ba9 100644
--- a/source4/lib/socket/socket_unix.c
+++ b/source4/lib/socket/socket_unix.c
@@ -219,23 +219,13 @@ static NTSTATUS unixdom_accept(struct socket_context *sock,
}
static NTSTATUS unixdom_recv(struct socket_context *sock, void *buf,
- size_t wantlen, size_t *nread, uint32_t flags)
+ size_t wantlen, size_t *nread)
{
ssize_t gotlen;
- int flgs = 0;
-
- /* TODO: we need to map all flags here */
- if (flags & SOCKET_FLAG_PEEK) {
- flgs |= MSG_PEEK;
- }
-
- if (flags & SOCKET_FLAG_BLOCK) {
- flgs |= MSG_WAITALL;
- }
*nread = 0;
- gotlen = recv(sock->fd, buf, wantlen, flgs);
+ gotlen = recv(sock->fd, buf, wantlen, 0);
if (gotlen == 0) {
return NT_STATUS_END_OF_FILE;
} else if (gotlen == -1) {
@@ -248,14 +238,13 @@ static NTSTATUS unixdom_recv(struct socket_context *sock, void *buf,
}
static NTSTATUS unixdom_send(struct socket_context *sock,
- const DATA_BLOB *blob, size_t *sendlen, uint32_t flags)
+ const DATA_BLOB *blob, size_t *sendlen)
{
ssize_t len;
- int flgs = 0;
*sendlen = 0;
- len = send(sock->fd, blob->data, blob->length, flgs);
+ len = send(sock->fd, blob->data, blob->length, 0);
if (len == -1) {
return unixdom_error(errno);
}
@@ -267,15 +256,14 @@ static NTSTATUS unixdom_send(struct socket_context *sock,
static NTSTATUS unixdom_sendto(struct socket_context *sock,
- const DATA_BLOB *blob, size_t *sendlen, uint32_t flags,
+ const DATA_BLOB *blob, size_t *sendlen,
const struct socket_address *dest)
{
ssize_t len;
- int flgs = 0;
*sendlen = 0;
if (dest->sockaddr) {
- len = sendto(sock->fd, blob->data, blob->length, flgs,
+ len = sendto(sock->fd, blob->data, blob->length, 0,
dest->sockaddr, dest->sockaddrlen);
} else {
struct sockaddr_un srv_addr;
@@ -288,7 +276,7 @@ static NTSTATUS unixdom_sendto(struct socket_context *sock,
srv_addr.sun_family = AF_UNIX;
strncpy(srv_addr.sun_path, dest->addr, sizeof(srv_addr.sun_path));
- len = sendto(sock->fd, blob->data, blob->length, flgs,
+ len = sendto(sock->fd, blob->data, blob->length, 0,
(struct sockaddr *)&srv_addr, sizeof(srv_addr));
}
if (len == -1) {