r12796: use the correct address as initiator
authorStefan Metzmacher <metze@samba.org>
Mon, 9 Jan 2006 17:03:17 +0000 (17:03 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:49:56 +0000 (13:49 -0500)
metze

source/wrepl_server/wrepl_in_call.c
source/wrepl_server/wrepl_in_connection.c
source/wrepl_server/wrepl_out_helpers.c
source/wrepl_server/wrepl_server.h

index 27428106d4ed757cd7a92c0ecc2f5b5a845d2415..8dabc2ee8604175f5a664bc6045b977d3b50a30e 100644 (file)
@@ -109,12 +109,11 @@ static NTSTATUS wreplsrv_in_table_query(struct wreplsrv_in_call *call)
        struct wreplsrv_service *service = call->wreplconn->service;
        struct wrepl_replication *repl_out = &call->rep_packet.message.replication;
        struct wrepl_table *table_out = &call->rep_packet.message.replication.info.table;
-       const char *our_ip = call->wreplconn->our_ip;
 
        repl_out->command = WREPL_REPL_TABLE_REPLY;
 
        return wreplsrv_fill_wrepl_table(service, call, table_out,
-                                        our_ip, True);
+                                        service->wins_db->local_owner, True);
 }
 
 static int wreplsrv_in_sort_wins_name(struct wrepl_wins_name *n1,
@@ -126,7 +125,6 @@ static int wreplsrv_in_sort_wins_name(struct wrepl_wins_name *n1,
 }
 
 static NTSTATUS wreplsrv_record2wins_name(TALLOC_CTX *mem_ctx,
-                                         const char *our_address,
                                          struct wrepl_wins_name *name,
                                          struct winsdb_record *rec)
 {
@@ -264,7 +262,7 @@ static NTSTATUS wreplsrv_in_send_request(struct wreplsrv_in_call *call)
                status = winsdb_record(service->wins_db, res->msgs[i], call, &rec);
                NT_STATUS_NOT_OK_RETURN(status);
 
-               status = wreplsrv_record2wins_name(names, call->wreplconn->our_ip, &names[i], rec);
+               status = wreplsrv_record2wins_name(names, &names[i], rec);
                NT_STATUS_NOT_OK_RETURN(status);
                talloc_free(rec);
                talloc_free(res->msgs[i]);
index f3bb5544e343180d72b6025bb48c1b20eacb5392..4e93ebf7a37c241a56c87ff747ce937712a4cc71 100644 (file)
@@ -167,11 +167,6 @@ static void wreplsrv_accept(struct stream_connection *conn)
 
        wreplconn->conn         = conn;
        wreplconn->service      = service;
-       wreplconn->our_ip       = socket_get_my_addr(conn->socket, wreplconn);
-       if (!wreplconn->our_ip) {
-               wreplsrv_terminate_in_connection(wreplconn, "wreplsrv_accept: out of memory");
-               return;
-       }
 
        peer_ip = socket_get_peer_addr(conn->socket, wreplconn);
        if (!peer_ip) {
@@ -221,8 +216,6 @@ NTSTATUS wreplsrv_in_connection_merge(struct wreplsrv_partner *partner,
 
        wrepl_in->service       = service;
        wrepl_in->partner       = partner;
-       wrepl_in->our_ip        = socket_get_my_addr(sock, wrepl_in);
-       NT_STATUS_HAVE_NO_MEMORY(wrepl_in->our_ip);
 
        status = stream_new_connection_merge(service->task->event_ctx, model_ops,
                                             sock, &wreplsrv_stream_ops, service->task->msg_ctx,
index b0cf039281945faea515b5a6337ad1f55be5fa9f..dbcddf859ca821c63ba479847b008b93e1e26930 100644 (file)
@@ -27,6 +27,7 @@
 #include "smbd/service_stream.h"
 #include "librpc/gen_ndr/ndr_winsrepl.h"
 #include "wrepl_server/wrepl_server.h"
+#include "nbt_server/wins/winsdb.h"
 #include "libcli/composite/composite.h"
 #include "libcli/wrepl/winsrepl.h"
 
@@ -825,7 +826,6 @@ static NTSTATUS wreplsrv_push_notify_update(struct wreplsrv_push_notify_state *s
        struct socket_context *sock;
        struct packet_context *packet;
        uint16_t fde_flags;
-       const char *our_ip;
 
        /* prepare the outgoing request */
        req->opcode     = WREPL_OPCODE_BITS;
@@ -834,11 +834,8 @@ static NTSTATUS wreplsrv_push_notify_update(struct wreplsrv_push_notify_state *s
 
        repl_out->command = state->command;
 
-       our_ip = socket_get_my_addr(state->wreplconn->sock->sock, state);
-       NT_STATUS_HAVE_NO_MEMORY(our_ip);
-
        status = wreplsrv_fill_wrepl_table(service, state, table_out,
-                                          our_ip, state->full_table);
+                                          service->wins_db->local_owner, state->full_table);
        NT_STATUS_NOT_OK_RETURN(status);
 
        /* queue the request */
@@ -911,7 +908,6 @@ static NTSTATUS wreplsrv_push_notify_inform(struct wreplsrv_push_notify_state *s
        struct wrepl_replication *repl_out = &state->req_packet.message.replication;
        struct wrepl_table *table_out = &state->req_packet.message.replication.info.table;
        NTSTATUS status;
-       const char *our_ip;
 
        req->opcode     = WREPL_OPCODE_BITS;
        req->assoc_ctx  = state->wreplconn->assoc_ctx.peer_ctx;
@@ -919,11 +915,8 @@ static NTSTATUS wreplsrv_push_notify_inform(struct wreplsrv_push_notify_state *s
 
        repl_out->command = state->command;
 
-       our_ip = socket_get_my_addr(state->wreplconn->sock->sock, state);
-       NT_STATUS_HAVE_NO_MEMORY(our_ip);
-
        status = wreplsrv_fill_wrepl_table(service, state, table_out,
-                                          our_ip, state->full_table);
+                                          service->wins_db->local_owner, state->full_table);
        NT_STATUS_NOT_OK_RETURN(status);
 
        /* we won't get a reply to a inform message */
index 5219f1fb1b480d4ceb94664b6a2de0f8e866ce07..bcf6f8ac48d382492844dd5fba6396a139de3212 100644 (file)
@@ -56,13 +56,6 @@ struct wreplsrv_in_connection {
         */
        struct wreplsrv_partner *partner;
 
-       /*
-        * we need to take care of our own ip address,
-        * as this is the WINS-Owner ID the peer expect
-        * from us.
-        */
-       const char *our_ip;
-
        /* keep track of the assoc_ctx's */
        struct {
                BOOL stopped;