summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-02 02:01:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:13 -0500
commit452ddd94ba22bebe0fda5ee6a7ddceae2057fe40 (patch)
treef68b6554822c0d9aa1ceda711d2c28afa6aa9f4a /source4
parent26c6b4c70bd85d8030a96651f2a255a4d48fcda1 (diff)
downloadsamba-452ddd94ba22bebe0fda5ee6a7ddceae2057fe40.tar.gz
r3450: portability fixes
- fix rep_inet_ntoa() for IRIX - lib/signal.c needs system/wait.h - some systems define a macro "accept", which breaks the lib/socket/ structures. use fn_ as a prefix for the structure elements to avoid the problem (This used to be commit ced1a0fcdc8d8e47755ce4391c19f8b12862eb60)
Diffstat (limited to 'source4')
-rw-r--r--source4/include/includes.h4
-rw-r--r--source4/include/system/network.h4
-rw-r--r--source4/lib/signal.c1
-rw-r--r--source4/lib/socket/socket.c58
-rw-r--r--source4/lib/socket/socket.h28
-rw-r--r--source4/lib/socket/socket_ipv4.c40
-rw-r--r--source4/lib/socket/socket_ipv6.c40
-rw-r--r--source4/lib/socket/socket_unix.c40
8 files changed, 108 insertions, 107 deletions
diff --git a/source4/include/includes.h b/source4/include/includes.h
index a6a2354f670..c38c0acc8b7 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -379,10 +379,6 @@ typedef int (*comparison_fn_t)(const void *, const void *);
#define PASSWORD_LENGTH 8
#endif
-#ifdef REPLACE_INET_NTOA
-#define inet_ntoa rep_inet_ntoa
-#endif
-
#ifndef HAVE_PIPE
#define SYNC_DNS 1
#endif
diff --git a/source4/include/system/network.h b/source4/include/system/network.h
index fcee0f7c246..8b9fe0bcc54 100644
--- a/source4/include/system/network.h
+++ b/source4/include/system/network.h
@@ -58,3 +58,7 @@
#endif
+#ifdef REPLACE_INET_NTOA
+#define inet_ntoa rep_inet_ntoa
+#endif
+
diff --git a/source4/lib/signal.c b/source4/lib/signal.c
index bff4b91c1a0..66d3e1f76ed 100644
--- a/source4/lib/signal.c
+++ b/source4/lib/signal.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "system/wait.h"
/****************************************************************************
Catch child exits and reap the child zombie status.
diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c
index 892695f6eb9..c2865cd9f09 100644
--- a/source4/lib/socket/socket.c
+++ b/source4/lib/socket/socket.c
@@ -26,8 +26,8 @@
static int socket_destructor(void *ptr)
{
struct socket_context *sock = ptr;
- if (sock->ops->close) {
- sock->ops->close(sock);
+ if (sock->ops->fn_close) {
+ sock->ops->fn_close(sock);
}
return 0;
}
@@ -54,7 +54,7 @@ NTSTATUS socket_create(const char *name, enum socket_type type, struct socket_co
return NT_STATUS_INVALID_PARAMETER;
}
- status = (*new_sock)->ops->init((*new_sock));
+ status = (*new_sock)->ops->fn_init((*new_sock));
if (!NT_STATUS_IS_OK(status)) {
talloc_free(*new_sock);
return status;
@@ -92,11 +92,11 @@ NTSTATUS socket_connect(struct socket_context *sock,
return NT_STATUS_INVALID_PARAMETER;
}
- if (!sock->ops->connect) {
+ if (!sock->ops->fn_connect) {
return NT_STATUS_NOT_IMPLEMENTED;
}
- return sock->ops->connect(sock, my_address, my_port, server_address, server_port, flags);
+ return sock->ops->fn_connect(sock, my_address, my_port, server_address, server_port, flags);
}
NTSTATUS socket_listen(struct socket_context *sock, const char *my_address, int port, int queue_size, uint32_t flags)
@@ -109,11 +109,11 @@ NTSTATUS socket_listen(struct socket_context *sock, const char *my_address, int
return NT_STATUS_INVALID_PARAMETER;
}
- if (!sock->ops->listen) {
+ if (!sock->ops->fn_listen) {
return NT_STATUS_NOT_IMPLEMENTED;
}
- return sock->ops->listen(sock, my_address, port, queue_size, flags);
+ return sock->ops->fn_listen(sock, my_address, port, queue_size, flags);
}
NTSTATUS socket_accept(struct socket_context *sock, struct socket_context **new_sock)
@@ -128,11 +128,11 @@ NTSTATUS socket_accept(struct socket_context *sock, struct socket_context **new_
return NT_STATUS_INVALID_PARAMETER;
}
- if (!sock->ops->accept) {
+ if (!sock->ops->fn_accept) {
return NT_STATUS_NOT_IMPLEMENTED;
}
- status = sock->ops->accept(sock, new_sock);
+ status = sock->ops->fn_accept(sock, new_sock);
if (NT_STATUS_IS_OK(status)) {
talloc_set_destructor(*new_sock, socket_destructor);
@@ -153,7 +153,7 @@ NTSTATUS socket_recv(struct socket_context *sock, void *buf,
return NT_STATUS_INVALID_PARAMETER;
}
- if (!sock->ops->recv) {
+ if (!sock->ops->fn_recv) {
return NT_STATUS_NOT_IMPLEMENTED;
}
@@ -162,10 +162,10 @@ NTSTATUS socket_recv(struct socket_context *sock, void *buf,
*nread = 0;
return STATUS_MORE_ENTRIES;
}
- return sock->ops->recv(sock, buf, 1+(random() % wantlen), nread, flags);
+ return sock->ops->fn_recv(sock, buf, 1+(random() % wantlen), nread, flags);
}
- return sock->ops->recv(sock, buf, wantlen, nread, flags);
+ return sock->ops->fn_recv(sock, buf, wantlen, nread, flags);
}
NTSTATUS socket_send(struct socket_context *sock,
@@ -180,7 +180,7 @@ NTSTATUS socket_send(struct socket_context *sock,
return NT_STATUS_INVALID_PARAMETER;
}
- if (!sock->ops->send) {
+ if (!sock->ops->fn_send) {
return NT_STATUS_NOT_IMPLEMENTED;
}
@@ -191,73 +191,73 @@ NTSTATUS socket_send(struct socket_context *sock,
return STATUS_MORE_ENTRIES;
}
blob2.length = 1+(random() % blob2.length);
- return sock->ops->send(sock, &blob2, sendlen, flags);
+ return sock->ops->fn_send(sock, &blob2, sendlen, flags);
}
- return sock->ops->send(sock, blob, sendlen, flags);
+ return sock->ops->fn_send(sock, blob, sendlen, flags);
}
NTSTATUS socket_set_option(struct socket_context *sock, const char *option, const char *val)
{
- if (!sock->ops->set_option) {
+ if (!sock->ops->fn_set_option) {
return NT_STATUS_NOT_IMPLEMENTED;
}
- return sock->ops->set_option(sock, option, val);
+ return sock->ops->fn_set_option(sock, option, val);
}
char *socket_get_peer_name(struct socket_context *sock, TALLOC_CTX *mem_ctx)
{
- if (!sock->ops->get_peer_name) {
+ if (!sock->ops->fn_get_peer_name) {
return NULL;
}
- return sock->ops->get_peer_name(sock, mem_ctx);
+ return sock->ops->fn_get_peer_name(sock, mem_ctx);
}
char *socket_get_peer_addr(struct socket_context *sock, TALLOC_CTX *mem_ctx)
{
- if (!sock->ops->get_peer_addr) {
+ if (!sock->ops->fn_get_peer_addr) {
return NULL;
}
- return sock->ops->get_peer_addr(sock, mem_ctx);
+ return sock->ops->fn_get_peer_addr(sock, mem_ctx);
}
int socket_get_peer_port(struct socket_context *sock)
{
- if (!sock->ops->get_peer_port) {
+ if (!sock->ops->fn_get_peer_port) {
return -1;
}
- return sock->ops->get_peer_port(sock);
+ return sock->ops->fn_get_peer_port(sock);
}
char *socket_get_my_addr(struct socket_context *sock, TALLOC_CTX *mem_ctx)
{
- if (!sock->ops->get_my_addr) {
+ if (!sock->ops->fn_get_my_addr) {
return NULL;
}
- return sock->ops->get_my_addr(sock, mem_ctx);
+ return sock->ops->fn_get_my_addr(sock, mem_ctx);
}
int socket_get_my_port(struct socket_context *sock)
{
- if (!sock->ops->get_my_port) {
+ if (!sock->ops->fn_get_my_port) {
return -1;
}
- return sock->ops->get_my_port(sock);
+ return sock->ops->fn_get_my_port(sock);
}
int socket_get_fd(struct socket_context *sock)
{
- if (!sock->ops->get_fd) {
+ if (!sock->ops->fn_get_fd) {
return -1;
}
- return sock->ops->get_fd(sock);
+ return sock->ops->fn_get_fd(sock);
}
/*
diff --git a/source4/lib/socket/socket.h b/source4/lib/socket/socket.h
index 6e54a37b806..7a8d3359627 100644
--- a/source4/lib/socket/socket.h
+++ b/source4/lib/socket/socket.h
@@ -31,36 +31,36 @@ struct socket_ops {
const char *name;
enum socket_type type;
- NTSTATUS (*init)(struct socket_context *sock);
+ NTSTATUS (*fn_init)(struct socket_context *sock);
/* client ops */
- NTSTATUS (*connect)(struct socket_context *sock,
+ NTSTATUS (*fn_connect)(struct socket_context *sock,
const char *my_address, int my_port,
const char *server_address, int server_port,
uint32_t flags);
/* server ops */
- NTSTATUS (*listen)(struct socket_context *sock,
+ NTSTATUS (*fn_listen)(struct socket_context *sock,
const char *my_address, int port, int queue_size, uint32_t flags);
- NTSTATUS (*accept)(struct socket_context *sock, struct socket_context **new_sock);
+ NTSTATUS (*fn_accept)(struct socket_context *sock, struct socket_context **new_sock);
/* general ops */
- NTSTATUS (*recv)(struct socket_context *sock, void *buf,
+ NTSTATUS (*fn_recv)(struct socket_context *sock, void *buf,
size_t wantlen, size_t *nread, uint32_t flags);
- NTSTATUS (*send)(struct socket_context *sock,
+ NTSTATUS (*fn_send)(struct socket_context *sock,
const DATA_BLOB *blob, size_t *sendlen, uint32_t flags);
- void (*close)(struct socket_context *sock);
+ void (*fn_close)(struct socket_context *sock);
- NTSTATUS (*set_option)(struct socket_context *sock, const char *option, const char *val);
+ NTSTATUS (*fn_set_option)(struct socket_context *sock, const char *option, const char *val);
- char *(*get_peer_name)(struct socket_context *sock, TALLOC_CTX *mem_ctx);
- char *(*get_peer_addr)(struct socket_context *sock, TALLOC_CTX *mem_ctx);
- int (*get_peer_port)(struct socket_context *sock);
- char *(*get_my_addr)(struct socket_context *sock, TALLOC_CTX *mem_ctx);
- int (*get_my_port)(struct socket_context *sock);
+ char *(*fn_get_peer_name)(struct socket_context *sock, TALLOC_CTX *mem_ctx);
+ char *(*fn_get_peer_addr)(struct socket_context *sock, TALLOC_CTX *mem_ctx);
+ int (*fn_get_peer_port)(struct socket_context *sock);
+ char *(*fn_get_my_addr)(struct socket_context *sock, TALLOC_CTX *mem_ctx);
+ int (*fn_get_my_port)(struct socket_context *sock);
- int (*get_fd)(struct socket_context *sock);
+ int (*fn_get_fd)(struct socket_context *sock);
};
enum socket_state {
diff --git a/source4/lib/socket/socket_ipv4.c b/source4/lib/socket/socket_ipv4.c
index 9777705419a..263f5aa2550 100644
--- a/source4/lib/socket/socket_ipv4.c
+++ b/source4/lib/socket/socket_ipv4.c
@@ -310,26 +310,26 @@ static int ipv4_tcp_get_fd(struct socket_context *sock)
}
static const struct socket_ops ipv4_tcp_ops = {
- .name = "ipv4",
- .type = SOCKET_TYPE_STREAM,
-
- .init = ipv4_tcp_init,
- .connect = ipv4_tcp_connect,
- .listen = ipv4_tcp_listen,
- .accept = ipv4_tcp_accept,
- .recv = ipv4_tcp_recv,
- .send = ipv4_tcp_send,
- .close = ipv4_tcp_close,
-
- .set_option = ipv4_tcp_set_option,
-
- .get_peer_name = ipv4_tcp_get_peer_name,
- .get_peer_addr = ipv4_tcp_get_peer_addr,
- .get_peer_port = ipv4_tcp_get_peer_port,
- .get_my_addr = ipv4_tcp_get_my_addr,
- .get_my_port = ipv4_tcp_get_my_port,
-
- .get_fd = ipv4_tcp_get_fd
+ .name = "ipv4",
+ .type = SOCKET_TYPE_STREAM,
+
+ .fn_init = ipv4_tcp_init,
+ .fn_connect = ipv4_tcp_connect,
+ .fn_listen = ipv4_tcp_listen,
+ .fn_accept = ipv4_tcp_accept,
+ .fn_recv = ipv4_tcp_recv,
+ .fn_send = ipv4_tcp_send,
+ .fn_close = ipv4_tcp_close,
+
+ .fn_set_option = ipv4_tcp_set_option,
+
+ .fn_get_peer_name = ipv4_tcp_get_peer_name,
+ .fn_get_peer_addr = ipv4_tcp_get_peer_addr,
+ .fn_get_peer_port = ipv4_tcp_get_peer_port,
+ .fn_get_my_addr = ipv4_tcp_get_my_addr,
+ .fn_get_my_port = ipv4_tcp_get_my_port,
+
+ .fn_get_fd = ipv4_tcp_get_fd
};
const struct socket_ops *socket_ipv4_ops(void)
diff --git a/source4/lib/socket/socket_ipv6.c b/source4/lib/socket/socket_ipv6.c
index 75e6fcab5c6..c8683446ec0 100644
--- a/source4/lib/socket/socket_ipv6.c
+++ b/source4/lib/socket/socket_ipv6.c
@@ -328,26 +328,26 @@ static int ipv6_tcp_get_fd(struct socket_context *sock)
}
static const struct socket_ops ipv6_tcp_ops = {
- .name = "ipv6",
- .type = SOCKET_TYPE_STREAM,
-
- .init = ipv6_tcp_init,
- .connect = ipv6_tcp_connect,
- .listen = ipv6_tcp_listen,
- .accept = ipv6_tcp_accept,
- .recv = ipv6_tcp_recv,
- .send = ipv6_tcp_send,
- .close = ipv6_tcp_close,
-
- .set_option = ipv6_tcp_set_option,
-
- .get_peer_name = ipv6_tcp_get_peer_name,
- .get_peer_addr = ipv6_tcp_get_peer_addr,
- .get_peer_port = ipv6_tcp_get_peer_port,
- .get_my_addr = ipv6_tcp_get_my_addr,
- .get_my_port = ipv6_tcp_get_my_port,
-
- .get_fd = ipv6_tcp_get_fd
+ .name = "ipv6",
+ .type = SOCKET_TYPE_STREAM,
+
+ .fn_init = ipv6_tcp_init,
+ .fn_connect = ipv6_tcp_connect,
+ .fn_listen = ipv6_tcp_listen,
+ .fn_accept = ipv6_tcp_accept,
+ .fn_recv = ipv6_tcp_recv,
+ .fn_send = ipv6_tcp_send,
+ .fn_close = ipv6_tcp_close,
+
+ .fn_set_option = ipv6_tcp_set_option,
+
+ .fn_get_peer_name = ipv6_tcp_get_peer_name,
+ .fn_get_peer_addr = ipv6_tcp_get_peer_addr,
+ .fn_get_peer_port = ipv6_tcp_get_peer_port,
+ .fn_get_my_addr = ipv6_tcp_get_my_addr,
+ .fn_get_my_port = ipv6_tcp_get_my_port,
+
+ .fn_get_fd = ipv6_tcp_get_fd
};
const struct socket_ops *socket_ipv6_ops(void)
diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c
index d160d897ee2..f09573802a0 100644
--- a/source4/lib/socket/socket_unix.c
+++ b/source4/lib/socket/socket_unix.c
@@ -246,26 +246,26 @@ static int unixdom_get_fd(struct socket_context *sock)
}
static const struct socket_ops unixdom_ops = {
- .name = "unix",
- .type = SOCKET_TYPE_STREAM,
-
- .init = unixdom_init,
- .connect = unixdom_connect,
- .listen = unixdom_listen,
- .accept = unixdom_accept,
- .recv = unixdom_recv,
- .send = unixdom_send,
- .close = unixdom_close,
-
- .set_option = unixdom_set_option,
-
- .get_peer_name = unixdom_get_peer_name,
- .get_peer_addr = unixdom_get_peer_addr,
- .get_peer_port = unixdom_get_peer_port,
- .get_my_addr = unixdom_get_my_addr,
- .get_my_port = unixdom_get_my_port,
-
- .get_fd = unixdom_get_fd
+ .name = "unix",
+ .type = SOCKET_TYPE_STREAM,
+
+ .fn_init = unixdom_init,
+ .fn_connect = unixdom_connect,
+ .fn_listen = unixdom_listen,
+ .fn_accept = unixdom_accept,
+ .fn_recv = unixdom_recv,
+ .fn_send = unixdom_send,
+ .fn_close = unixdom_close,
+
+ .fn_set_option = unixdom_set_option,
+
+ .fn_get_peer_name = unixdom_get_peer_name,
+ .fn_get_peer_addr = unixdom_get_peer_addr,
+ .fn_get_peer_port = unixdom_get_peer_port,
+ .fn_get_my_addr = unixdom_get_my_addr,
+ .fn_get_my_port = unixdom_get_my_port,
+
+ .fn_get_fd = unixdom_get_fd
};
const struct socket_ops *socket_unixdom_ops(void)