The branch, v4-2-test has been updated
       via  b688f57 s4:rpc_server/netlogon: fix bugs in 
dcesrv_netr_DsRGetDCNameEx2()
      from  75e2768 ctdb-daemon: Correctly process the exit code from failed 
eventscripts

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-2-test


- Log -----------------------------------------------------------------
commit b688f57ba0f1cbaf65dbe81075848ed7aeba702f
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Jan 22 11:22:25 2015 +0000

    s4:rpc_server/netlogon: fix bugs in dcesrv_netr_DsRGetDCNameEx2()
    
    We should return the our ip address the client is connected too.
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Günther Deschner <g...@samba.org>
    (cherry picked from commit 459d1d3fb9a5282d19121eaacba9d611896b37ff)
    
    Autobuild-User(v4-2-test): Stefan Metzmacher <me...@samba.org>
    Autobuild-Date(v4-2-test): Tue Aug 18 19:15:43 CEST 2015 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source4/rpc_server/netlogon/dcerpc_netlogon.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c 
b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 3ea26e2..b2f0073 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -1828,15 +1828,16 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct 
dcesrv_call_state *dce_call,
        struct ldb_context *sam_ctx;
        struct netr_DsRGetDCNameInfo *info;
        struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx;
+       const struct tsocket_address *local_address;
+       char *local_addr = NULL;
        const struct tsocket_address *remote_address;
-       char *addr = NULL;
+       char *remote_addr = NULL;
        const char *server_site_name;
        char *guid_str;
        struct netlogon_samlogon_response response;
        NTSTATUS status;
        const char *dc_name = NULL;
        const char *domain_name = NULL;
-       struct interface *ifaces;
        const char *pdc_ip;
 
        ZERO_STRUCTP(r->out.info);
@@ -1847,10 +1848,16 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct 
dcesrv_call_state *dce_call,
                return WERR_DS_UNAVAILABLE;
        }
 
+       local_address = dcesrv_connection_get_local_address(dce_call->conn);
+       if (tsocket_address_is_inet(local_address, "ip")) {
+               local_addr = tsocket_address_inet_addr_string(local_address, 
mem_ctx);
+               W_ERROR_HAVE_NO_MEMORY(local_addr);
+       }
+
        remote_address = dcesrv_connection_get_remote_address(dce_call->conn);
        if (tsocket_address_is_inet(remote_address, "ip")) {
-               addr = tsocket_address_inet_addr_string(remote_address, 
mem_ctx);
-               W_ERROR_HAVE_NO_MEMORY(addr);
+               remote_addr = tsocket_address_inet_addr_string(remote_address, 
mem_ctx);
+               W_ERROR_HAVE_NO_MEMORY(remote_addr);
        }
 
        /* "server_unc" is ignored by w2k3 */
@@ -1908,7 +1915,7 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct 
dcesrv_call_state *dce_call,
                                                 r->in.domain_name,
                                                 NULL, guid_str,
                                                 r->in.client_account,
-                                                r->in.mask, addr,
+                                                r->in.mask, remote_addr,
                                                 
NETLOGON_NT_VERSION_5EX_WITH_IP,
                                                 lp_ctx, &response, true);
        if (!NT_STATUS_IS_OK(status)) {
@@ -1956,12 +1963,11 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct 
dcesrv_call_state *dce_call,
        info = talloc(mem_ctx, struct netr_DsRGetDCNameInfo);
        W_ERROR_HAVE_NO_MEMORY(info);
        info->dc_unc = talloc_asprintf(mem_ctx, "%s%s",
-                       dc_name[0] == '\\'? "\\\\":"",
+                       dc_name[0] != '\\'? "\\\\":"",
                        talloc_strdup(mem_ctx, dc_name));
        W_ERROR_HAVE_NO_MEMORY(info->dc_unc);
 
-       load_interface_list(mem_ctx, lp_ctx, &ifaces);
-       pdc_ip = iface_list_best_ip(ifaces, addr);
+       pdc_ip = local_addr;
        if (pdc_ip == NULL) {
                pdc_ip = "127.0.0.1";
        }


-- 
Samba Shared Repository

Reply via email to