This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
}
if (!(flags & SOCKET_FLAG_BLOCK)) {
- ret = set_blocking(sock->fd, False);
+ ret = set_blocking(sock->fd, false);
if (ret == -1) {
return map_nt_error_from_unix(errno);
}
unlink(my_address->addr);
}
- if (my_address && my_address->sockaddr) {
+ if (my_address->sockaddr) {
ret = bind(sock->fd, (struct sockaddr *)&my_addr, sizeof(my_addr));
+ } else if (my_address->addr == NULL) {
+ return NT_STATUS_INVALID_PARAMETER;
} else {
-
if (strlen(my_address->addr)+1 > sizeof(my_addr.sun_path)) {
return NT_STATUS_OBJECT_PATH_INVALID;
}
}
if (!(flags & SOCKET_FLAG_BLOCK)) {
- ret = set_blocking(sock->fd, False);
+ ret = set_blocking(sock->fd, false);
if (ret == -1) {
return unixdom_error(errno);
}
}
if (!(sock->flags & SOCKET_FLAG_BLOCK)) {
- int ret = set_blocking(new_fd, False);
+ int ret = set_blocking(new_fd, false);
if (ret == -1) {
close(new_fd);
return map_nt_error_from_unix(errno);
}
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) {
}
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);
}
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;
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) {
.fn_get_fd = unixdom_get_fd
};
-const struct socket_ops *socket_unixdom_ops(enum socket_type type)
+_PUBLIC_ const struct socket_ops *socket_unixdom_ops(enum socket_type type)
{
return &unixdom_ops;
}