From f55ea8bb3dca868e21663cd90eaea7a35cd7886c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 9 Jan 2006 22:12:53 +0000 Subject: r12804: This patch reworks the Samba4 sockets layer to use a socket_address structure that is more generic than just 'IP/port'. It now passes make test, and has been reviewed and updated by metze. (Thankyou *very* much). This passes 'make test' as well as kerberos use (not currently in the testsuite). The original purpose of this patch was to have Samba able to pass a socket address stucture from the BSD layer into the kerberos routines and back again. It also removes nbt_peer_addr, which was being used for a similar purpose. It is a large change, but worthwhile I feel. Andrew Bartlett (This used to be commit 88198c4881d8620a37086f80e4da5a5b71c5bbb2) --- source4/wrepl_server/wrepl_in_call.c | 3 ++- source4/wrepl_server/wrepl_in_connection.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'source4/wrepl_server') diff --git a/source4/wrepl_server/wrepl_in_call.c b/source4/wrepl_server/wrepl_in_call.c index 8dabc2ee86..46ee25b7ad 100644 --- a/source4/wrepl_server/wrepl_in_call.c +++ b/source4/wrepl_server/wrepl_in_call.c @@ -401,8 +401,9 @@ static NTSTATUS wreplsrv_in_replication(struct wreplsrv_in_call *call) } if (!call->wreplconn->partner) { + struct socket_address *partner_ip = socket_get_peer_addr(call->wreplconn->conn->socket, call); DEBUG(1,("Failing WINS replication from non-partner %s\n", - socket_get_peer_addr(call->wreplconn->conn->socket, call))); + partner_ip ? partner_ip->addr : NULL)); return wreplsrv_in_stop_assoc_ctx(call); } diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c index 4e93ebf7a3..80e443ace7 100644 --- a/source4/wrepl_server/wrepl_in_connection.c +++ b/source4/wrepl_server/wrepl_in_connection.c @@ -143,7 +143,7 @@ static void wreplsrv_accept(struct stream_connection *conn) { struct wreplsrv_service *service = talloc_get_type(conn->private, struct wreplsrv_service); struct wreplsrv_in_connection *wreplconn; - const char *peer_ip; + struct socket_address *peer_ip; wreplconn = talloc_zero(conn, struct wreplsrv_in_connection); if (!wreplconn) { @@ -170,11 +170,11 @@ static void wreplsrv_accept(struct stream_connection *conn) peer_ip = socket_get_peer_addr(conn->socket, wreplconn); if (!peer_ip) { - wreplsrv_terminate_in_connection(wreplconn, "wreplsrv_accept: out of memory"); + wreplsrv_terminate_in_connection(wreplconn, "wreplsrv_accept: could not obtain peer IP from kernel"); return; } - wreplconn->partner = wreplsrv_find_partner(service, peer_ip); + wreplconn->partner = wreplsrv_find_partner(service, peer_ip->addr); conn->private = wreplconn; -- cgit