summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-04-27 16:17:28 +0200
committerStefan Metzmacher <metze@samba.org>2010-04-27 17:05:30 +0200
commitb7782514b91b365ec07426d4adfc8f59c53c372e (patch)
tree184a97bf278ac6cd44679cde85e312dc5eddc1fb
parent0a70788e190ca00cab27c67000abf77617141b5e (diff)
downloadsamba-b7782514b91b365ec07426d4adfc8f59c53c372e.tar.gz
samba-b7782514b91b365ec07426d4adfc8f59c53c372e.tar.bz2
samba-b7782514b91b365ec07426d4adfc8f59c53c372e.zip
s4:wrepl_server: use tsocket_address functions to get the peer ip
metze
-rw-r--r--source4/wrepl_server/wrepl_in_call.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source4/wrepl_server/wrepl_in_call.c b/source4/wrepl_server/wrepl_in_call.c
index dfe255567e..91a39400de 100644
--- a/source4/wrepl_server/wrepl_in_call.c
+++ b/source4/wrepl_server/wrepl_in_call.c
@@ -21,7 +21,7 @@
#include "includes.h"
#include "lib/events/events.h"
-#include "lib/socket/socket.h"
+#include "lib/tsocket/tsocket.h"
#include "smbd/service_task.h"
#include "smbd/service_stream.h"
#include "libcli/wrepl/winsrepl.h"
@@ -429,12 +429,23 @@ 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);
+ struct tsocket_address *peer_addr = call->wreplconn->conn->remote_address;
+ char *peer_ip;
- call->wreplconn->partner = wreplsrv_find_partner(call->wreplconn->service, partner_ip->addr);
+ if (!tsocket_address_is_inet(peer_addr, "ipv4")) {
+ DEBUG(0,("wreplsrv_in_replication: non ipv4 peer addr '%s'\n",
+ tsocket_address_string(peer_addr, call)));
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ peer_ip = tsocket_address_inet_addr_string(peer_addr, call);
+ if (peer_ip == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ call->wreplconn->partner = wreplsrv_find_partner(call->wreplconn->service, peer_ip);
if (!call->wreplconn->partner) {
- DEBUG(1,("Failing WINS replication from non-partner %s\n",
- partner_ip ? partner_ip->addr : NULL));
+ DEBUG(1,("Failing WINS replication from non-partner %s\n", peer_ip));
return wreplsrv_in_stop_assoc_ctx(call);
}
}