The branch, master has been updated
       via  d94c94f... s4:ntvfs: remove socket_address based functions
       via  bb04e90... s4:ntvfs/ipc: pass the already given tsocket_address 
structures to the named_pipe_auth code
       via  8fb3292... s4:smb_server: pass tsocket_addresses to the ntvfs layer
       via  c04d809... s4:ntvfs: add tsocket based addresses to ntvfs_context
       via  7bbaab8... s4:rpc_server: remove 'socket_address' based functions
       via  32bcc73... s4:rpc_server/srvsvc: pass tsocket_address to the ntvfs 
layer
       via  772cf15... s4:rpc_server/spoolss: use tsocket_address in 
dcesrv_spoolss_check_server_name()
       via  606025f... s4:rpc_server/netlogon: use tsocket_address in 
dcesrv_netr_DsRGetDCNameEx2()
       via  c42bb8e... s4:rpc_server: remember the local and remote address
       via  ba703cb... s4:service_named_pipe: use the passed client and server 
addresses
       via  cf3c595... s4:cldap_server: allow src_address = NULL in 
fill_netlogon_samlogon_response()
       via  4d191b6... s4:dsdb/common: if we don't have the ip of the client 
return the server site as client site
       via  2436ec2... lib/tsocket: add tsocket_address_is_unix() function
       via  e1596bb... lib/tsocket: add tsocket_address_is_inet() function
      from  3dd50b2... s4-test: make spnupdate work without make install

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d94c94fcb94ae0dfd221b5c807ec310f9c0fd8ed
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Apr 26 13:38:00 2010 +0200

    s4:ntvfs: remove socket_address based functions
    
    metze

commit bb04e90259315fd49fe1222b7c8f7fce23f1a2b6
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Apr 26 13:37:12 2010 +0200

    s4:ntvfs/ipc: pass the already given tsocket_address structures to the 
named_pipe_auth code
    
    metze

commit 8fb3292c993302b74247d6fa4795b279b131abcf
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Apr 26 13:34:44 2010 +0200

    s4:smb_server: pass tsocket_addresses to the ntvfs layer
    
    metze

commit c04d809ba001ebca17b68eae3a9f7d37454a290c
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Apr 26 13:40:15 2010 +0200

    s4:ntvfs: add tsocket based addresses to ntvfs_context
    
    metze

commit 7bbaab8dffcfe55b5da099840ec200be4d098b69
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Apr 26 13:39:36 2010 +0200

    s4:rpc_server: remove 'socket_address' based functions
    
    metze

commit 32bcc73cf8b59e2254967d55ebeb2715d4287840
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Apr 26 13:27:51 2010 +0200

    s4:rpc_server/srvsvc: pass tsocket_address to the ntvfs layer
    
    metze

commit 772cf15eb969591d65598a03fee24a4e559158ea
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Apr 26 13:22:01 2010 +0200

    s4:rpc_server/spoolss: use tsocket_address in 
dcesrv_spoolss_check_server_name()
    
    metze

commit 606025f11de9e1b9fa7c6d69a6fc346ca984dd93
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Apr 26 13:18:41 2010 +0200

    s4:rpc_server/netlogon: use tsocket_address in dcesrv_netr_DsRGetDCNameEx2()
    
    metze

commit c42bb8e49c77517729f9b57a81fd07815b5b493a
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Apr 26 13:06:07 2010 +0200

    s4:rpc_server: remember the local and remote address
    
    metze

commit ba703cb8e90070447dda46a3356f6a49b2fee537
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Apr 26 13:56:06 2010 +0200

    s4:service_named_pipe: use the passed client and server addresses
    
    This gives the rpc server code the correct client and server
    ip addresses for ncacn_np.
    
    metze

commit cf3c595b9c6778ee4dea28176936013bc1f1e876
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue Apr 27 10:22:25 2010 +0200

    s4:cldap_server: allow src_address = NULL in 
fill_netlogon_samlogon_response()
    
    If we don't have the client address, we assume it's a local call,
    maybe ncalrpc.
    
    metze

commit 4d191b6fa7b96ed56912bf68e6771ffb8e3cfe12
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue Apr 27 10:21:28 2010 +0200

    s4:dsdb/common: if we don't have the ip of the client return the server 
site as client site
    
    metze

commit 2436ec2928d1aac0e6fd885ca1b9cdecef8bf89a
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue Apr 27 10:41:46 2010 +0200

    lib/tsocket: add tsocket_address_is_unix() function
    
    metze

commit e1596bbf27ee636d8ab47e39eda21c64ef49b671
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue Apr 27 10:34:15 2010 +0200

    lib/tsocket: add tsocket_address_is_inet() function
    
    metze

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

Summary of changes:
 lib/tsocket/tsocket.h                         |   29 +++++++++++++
 lib/tsocket/tsocket_bsd.c                     |   54 +++++++++++++++++++++++++
 source4/cldap_server/netlogon.c               |   12 +++++-
 source4/dsdb/common/util.c                    |    8 ++++
 source4/ntvfs/ipc/vfs_ipc.c                   |   31 +-------------
 source4/ntvfs/ntvfs.h                         |    5 +-
 source4/ntvfs/ntvfs_interface.c               |   54 +++++++++++-------------
 source4/rpc_server/dcerpc_server.c            |   29 +++++---------
 source4/rpc_server/dcerpc_server.h            |    7 ++-
 source4/rpc_server/netlogon/dcerpc_netlogon.c |   14 ++++--
 source4/rpc_server/service_rpc.c              |    5 +-
 source4/rpc_server/spoolss/dcesrv_spoolss.c   |   11 +++--
 source4/rpc_server/srvsvc/srvsvc_ntvfs.c      |   18 ++------
 source4/smb_server/smb/service.c              |    6 ++-
 source4/smb_server/smb2/tcon.c                |    6 ++-
 source4/smbd/service_named_pipe.c             |   39 +++++++++++++++++-
 16 files changed, 215 insertions(+), 113 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tsocket/tsocket.h b/lib/tsocket/tsocket.h
index d983325..d4f9e87 100644
--- a/lib/tsocket/tsocket.h
+++ b/lib/tsocket/tsocket.h
@@ -101,6 +101,7 @@ struct iovec;
  *
  * @return              The address as a string representation, NULL on error.
  *
+ * @see tsocket_address_is_inet()
  * @see tsocket_address_inet_addr_string()
  * @see tsocket_address_inet_port()
  */
@@ -486,6 +487,20 @@ int tstream_disconnect_recv(struct tevent_req *req,
  * @{
  */
 
+/**
+ * @brief Find out if the tsocket_address represents an ipv4 or ipv6 endpoint.
+ *
+ * @param[in]  addr     The tsocket_address pointer
+ *
+ * @param[in]  fam      The family can be can be "ipv4", "ipv6" or "ip". With
+ *                      "ip" is autodetects "ipv4" or "ipv6" based on the
+ *                      addr.
+ *
+ * @return              true if addr represents an address of the given family,
+ *                      otherwise false.
+ */
+bool tsocket_address_is_inet(const struct tsocket_address *addr, const char 
*fam);
+
 #if DOXYGEN
 /**
  * @brief Create a tsocket_address for ipv4 and ipv6 endpoint addresses.
@@ -533,6 +548,8 @@ int _tsocket_address_inet_from_strings(TALLOC_CTX *mem_ctx,
  *
  * @return              A newly allocated string of the address, NULL on error
  *                      with errno set.
+ *
+ * @see tsocket_address_is_inet()
  */
 char *tsocket_address_inet_addr_string(const struct tsocket_address *addr,
                                       TALLOC_CTX *mem_ctx);
@@ -558,6 +575,16 @@ uint16_t tsocket_address_inet_port(const struct 
tsocket_address *addr);
 int tsocket_address_inet_set_port(struct tsocket_address *addr,
                                  uint16_t port);
 
+/**
+ * @brief Find out if the tsocket_address represents an unix domain endpoint.
+ *
+ * @param[in]  addr     The tsocket_address pointer
+ *
+ * @return              true if addr represents an unix domain endpoint,
+ *                      otherwise false.
+ */
+bool tsocket_address_is_unix(const struct tsocket_address *addr);
+
 #ifdef DOXYGEN
 /**
  * @brief Create a tsocket_address for a unix domain endpoint addresses.
@@ -569,6 +596,8 @@ int tsocket_address_inet_set_port(struct tsocket_address 
*addr,
  * @param[in]  _addr    The tsocket_address pointer to store the information.
  *
  * @return              0 on success, -1 on error with errno set.
+ *
+ * @see tsocket_address_is_unix()
  */
 int tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx,
                                   const char *path,
diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c
index 43defb3..4a8a63e 100644
--- a/lib/tsocket/tsocket_bsd.c
+++ b/lib/tsocket/tsocket_bsd.c
@@ -294,6 +294,43 @@ ssize_t tsocket_address_bsd_sockaddr(const struct 
tsocket_address *addr,
        return sa_socklen;
 }
 
+bool tsocket_address_is_inet(const struct tsocket_address *addr, const char 
*fam)
+{
+       struct tsocket_address_bsd *bsda = talloc_get_type(addr->private_data,
+                                          struct tsocket_address_bsd);
+
+       if (!bsda) {
+               return false;
+       }
+
+       switch (bsda->u.sa.sa_family) {
+       case AF_INET:
+               if (strcasecmp(fam, "ip") == 0) {
+                       return true;
+               }
+
+               if (strcasecmp(fam, "ipv4") == 0) {
+                       return true;
+               }
+
+               return false;
+#ifdef HAVE_IPV6
+       case AF_INET6:
+               if (strcasecmp(fam, "ip") == 0) {
+                       return true;
+               }
+
+               if (strcasecmp(fam, "ipv6") == 0) {
+                       return true;
+               }
+
+               return false;
+#endif
+       }
+
+       return false;
+}
+
 int _tsocket_address_inet_from_strings(TALLOC_CTX *mem_ctx,
                                       const char *fam,
                                       const char *addr,
@@ -466,6 +503,23 @@ int tsocket_address_inet_set_port(struct tsocket_address 
*addr,
        return 0;
 }
 
+bool tsocket_address_is_unix(const struct tsocket_address *addr)
+{
+       struct tsocket_address_bsd *bsda = talloc_get_type(addr->private_data,
+                                          struct tsocket_address_bsd);
+
+       if (!bsda) {
+               return false;
+       }
+
+       switch (bsda->u.sa.sa_family) {
+       case AF_UNIX:
+               return true;
+       }
+
+       return false;
+}
+
 int _tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx,
                                    const char *path,
                                    struct tsocket_address **_addr,
diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c
index 1993c1f..e24f1b3 100644
--- a/source4/cldap_server/netlogon.c
+++ b/source4/cldap_server/netlogon.c
@@ -270,8 +270,16 @@ NTSTATUS fill_netlogon_samlogon_response(struct 
ldb_context *sam_ctx,
                                                  src_address, NULL);
        NT_STATUS_HAVE_NO_MEMORY(client_site);
        load_interfaces(mem_ctx, lp_interfaces(lp_ctx), &ifaces);
-       pdc_ip           = iface_best_ip(ifaces, src_address);
-
+       /*
+        * TODO: the caller should pass the address which the client
+        * used to trigger this call, as the client is able to reach
+        * this ip.
+        */
+       if (src_address) {
+               pdc_ip = iface_best_ip(ifaces, src_address);
+       } else {
+               pdc_ip = iface_n_ip(ifaces, 0);
+       }
        ZERO_STRUCTP(netlogon);
 
        /* check if either of these bits is present */
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 7dd68b8..60bcbe4 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -1609,6 +1609,14 @@ const char *samdb_client_site_name(struct ldb_context 
*ldb, TALLOC_CTX *mem_ctx,
        unsigned int i;
        int cnt, ret;
 
+       /*
+        * if we don't have a client ip e.g. ncalrpc
+        * the server site is the client site
+        */
+       if (ip_address == NULL) {
+               return samdb_server_site_name(ldb, mem_ctx);
+       }
+
        sites_container_dn = samdb_sites_dn(ldb, mem_ctx);
        if (sites_container_dn == NULL) {
                return NULL;
diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c
index 1a76b97..2d40d1f 100644
--- a/source4/ntvfs/ipc/vfs_ipc.c
+++ b/source4/ntvfs/ipc/vfs_ipc.c
@@ -251,9 +251,7 @@ static NTSTATUS ipc_open(struct ntvfs_module_context *ntvfs,
        struct tevent_req *subreq;
        const char *fname;
        const char *directory;
-       struct socket_address *client_sa;
        struct tsocket_address *client_addr;
-       struct socket_address *server_sa;
        struct tsocket_address *server_addr;
        int ret;
        DATA_BLOB delegated_creds = data_blob_null;
@@ -316,33 +314,8 @@ static NTSTATUS ipc_open(struct ntvfs_module_context 
*ntvfs,
                                                   &state->info3);
        NT_STATUS_NOT_OK_RETURN(status);
 
-       client_sa = ntvfs_get_peer_addr(ntvfs, state);
-       if (!client_sa) {
-               return NT_STATUS_INTERNAL_ERROR;
-       }
-
-       server_sa = ntvfs_get_my_addr(ntvfs, state);
-       if (!server_sa) {
-               return NT_STATUS_INTERNAL_ERROR;
-       }
-
-       ret = tsocket_address_inet_from_strings(state, "ip",
-                                               client_sa->addr,
-                                               client_sa->port,
-                                               &client_addr);
-       if (ret == -1) {
-               status = map_nt_error_from_unix(errno);
-               return status;
-       }
-
-       ret = tsocket_address_inet_from_strings(state, "ip",
-                                               server_sa->addr,
-                                               server_sa->port,
-                                               &server_addr);
-       if (ret == -1) {
-               status = map_nt_error_from_unix(errno);
-               return status;
-       }
+       client_addr = ntvfs_get_local_address(ipriv->ntvfs);
+       server_addr = ntvfs_get_remote_address(ipriv->ntvfs);
 
        if (req->session_info->credentials) {
                struct gssapi_creds_container *gcc;
diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h
index 5e9c657..02281e7 100644
--- a/source4/ntvfs/ntvfs.h
+++ b/source4/ntvfs/ntvfs.h
@@ -209,9 +209,8 @@ struct ntvfs_context {
        } oplock;
 
        struct {
-               void *private_data;
-               struct socket_address *(*get_my_addr)(void *private_data, 
TALLOC_CTX *mem_ctx);
-               struct socket_address *(*get_peer_addr)(void *private_data, 
TALLOC_CTX *mem_ctx);
+               const struct tsocket_address *local_address;
+               const struct tsocket_address *remote_address;
        } client;
 
        struct {
diff --git a/source4/ntvfs/ntvfs_interface.c b/source4/ntvfs/ntvfs_interface.c
index 808bd97..608db13 100644
--- a/source4/ntvfs/ntvfs_interface.c
+++ b/source4/ntvfs/ntvfs_interface.c
@@ -20,6 +20,7 @@
 
 #include "includes.h"
 #include "ntvfs/ntvfs.h"
+#include "lib/tsocket/tsocket.h"
 
 /* connect/disconnect */
 NTSTATUS ntvfs_connect(struct ntvfs_request *req, union smb_tcon *tcon)
@@ -666,6 +667,30 @@ NTSTATUS ntvfs_next_exit(struct ntvfs_module_context 
*ntvfs,
        return ntvfs->next->ops->exit(ntvfs->next, req);
 }
 
+/* client connection callback */
+NTSTATUS ntvfs_set_addresses(struct ntvfs_context *ntvfs,
+                            const struct tsocket_address *local_address,
+                            const struct tsocket_address *remote_address)
+{
+       ntvfs->client.local_address = tsocket_address_copy(local_address, 
ntvfs);
+       NT_STATUS_HAVE_NO_MEMORY(ntvfs->client.local_address);
+
+       ntvfs->client.remote_address = tsocket_address_copy(remote_address, 
ntvfs);
+       NT_STATUS_HAVE_NO_MEMORY(ntvfs->client.remote_address);
+
+       return NT_STATUS_OK;
+}
+
+const struct tsocket_address *ntvfs_get_local_address(struct 
ntvfs_module_context *ntvfs)
+{
+       return ntvfs->ctx->client.local_address;
+}
+
+const struct tsocket_address *ntvfs_get_remote_address(struct 
ntvfs_module_context *ntvfs)
+{
+       return ntvfs->ctx->client.remote_address;
+}
+
 /* oplock helpers */
 NTSTATUS ntvfs_set_oplock_handler(struct ntvfs_context *ntvfs,
                                           NTSTATUS (*handler)(void 
*private_data, struct ntvfs_handle *handle, uint8_t level),
@@ -686,32 +711,3 @@ NTSTATUS ntvfs_send_oplock_break(struct 
ntvfs_module_context *ntvfs,
        return ntvfs->ctx->oplock.handler(ntvfs->ctx->oplock.private_data, 
handle, level);
 }
 
-/* client connection callback */
-NTSTATUS ntvfs_set_addr_callbacks(struct ntvfs_context *ntvfs,
-                                          struct socket_address 
*(*my_addr)(void *private_data, TALLOC_CTX *mem_ctx),
-                                          struct socket_address 
*(*peer_addr)(void *private_data, TALLOC_CTX *mem_ctx),
-                                          void *private_data)
-{
-       ntvfs->client.get_peer_addr     = my_addr;
-       ntvfs->client.get_my_addr       = peer_addr;
-       ntvfs->client.private_data      = private_data;
-       return NT_STATUS_OK;
-}
-
-struct socket_address *ntvfs_get_my_addr(struct ntvfs_module_context *ntvfs, 
TALLOC_CTX *mem_ctx)
-{
-       if (!ntvfs->ctx->client.get_my_addr) {
-               return NULL;
-       }
-
-       return ntvfs->ctx->client.get_my_addr(ntvfs->ctx->client.private_data, 
mem_ctx);
-}
-
-struct socket_address *ntvfs_get_peer_addr(struct ntvfs_module_context *ntvfs, 
TALLOC_CTX *mem_ctx)
-{
-       if (!ntvfs->ctx->client.get_peer_addr) {
-               return NULL;
-       }
-
-       return 
ntvfs->ctx->client.get_peer_addr(ntvfs->ctx->client.private_data, mem_ctx);
-}
diff --git a/source4/rpc_server/dcerpc_server.c 
b/source4/rpc_server/dcerpc_server.c
index bc06c06..0b0e3f2 100644
--- a/source4/rpc_server/dcerpc_server.c
+++ b/source4/rpc_server/dcerpc_server.c
@@ -1111,25 +1111,6 @@ _PUBLIC_ NTSTATUS dcesrv_reply(struct dcesrv_call_state 
*call)
        return NT_STATUS_OK;
 }
 
-_PUBLIC_ struct socket_address *dcesrv_connection_get_my_addr(struct 
dcesrv_connection *conn, TALLOC_CTX *mem_ctx)
-{
-       if (!conn->transport.get_my_addr) {
-               return NULL;
-       }
-
-       return conn->transport.get_my_addr(conn, mem_ctx);
-}
-
-_PUBLIC_ struct socket_address *dcesrv_connection_get_peer_addr(struct 
dcesrv_connection *conn, TALLOC_CTX *mem_ctx)
-{
-       if (!conn->transport.get_peer_addr) {
-               return NULL;
-       }
-
-       return conn->transport.get_peer_addr(conn, mem_ctx);
-}
-
-
 /*
   remove the call from the right list when freed
  */
@@ -1139,6 +1120,16 @@ static int dcesrv_call_dequeue(struct dcesrv_call_state 
*call)
        return 0;
 }
 
+_PUBLIC_ const struct tsocket_address 
*dcesrv_connection_get_local_address(struct dcesrv_connection *conn)
+{
+       return conn->local_address;
+}
+
+_PUBLIC_ const struct tsocket_address 
*dcesrv_connection_get_remote_address(struct dcesrv_connection *conn)
+{
+       return conn->remote_address;
+}
+
 /*
   process some input to a dcerpc endpoint server.
 */
diff --git a/source4/rpc_server/dcerpc_server.h 
b/source4/rpc_server/dcerpc_server.h
index 0628730..bf93380 100644
--- a/source4/rpc_server/dcerpc_server.h
+++ b/source4/rpc_server/dcerpc_server.h
@@ -218,12 +218,13 @@ struct dcesrv_connection {
        struct {
                void *private_data;
                void (*report_output_data)(struct dcesrv_connection *);
-               struct socket_address *(*get_my_addr)(struct dcesrv_connection 
*, TALLOC_CTX *mem_ctx);
-               struct socket_address *(*get_peer_addr)(struct 
dcesrv_connection *, TALLOC_CTX *mem_ctx);
        } transport;
 
        struct tstream_context *stream;
        struct tevent_queue *send_queue;
+
+       const struct tsocket_address *local_address;
+       const struct tsocket_address *remote_address;
 };
 
 
@@ -334,6 +335,8 @@ struct dcesrv_handle *dcesrv_handle_fetch(
 struct socket_address *dcesrv_connection_get_my_addr(struct dcesrv_connection 
*conn, TALLOC_CTX *mem_ctx);
 
 struct socket_address *dcesrv_connection_get_peer_addr(struct 
dcesrv_connection *conn, TALLOC_CTX *mem_ctx);
+const struct tsocket_address *dcesrv_connection_get_local_address(struct 
dcesrv_connection *conn);
+const struct tsocket_address *dcesrv_connection_get_remote_address(struct 
dcesrv_connection *conn);
 
 NTSTATUS dcesrv_fetch_session_key(struct dcesrv_connection *p, DATA_BLOB 
*session_key);
 
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c 
b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index a62a2ac..2650dc7 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -33,7 +33,7 @@
 #include "lib/messaging/irpc.h"
 #include "librpc/gen_ndr/ndr_irpc.h"
 #include "cldap_server/cldap_server.h"
-#include "lib/socket/socket.h"
+#include "lib/tsocket/tsocket.h"
 
 struct netlogon_server_pipe_state {
        struct netr_Credential client_challenge;
@@ -1525,7 +1525,8 @@ 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;
-       struct socket_address *addr;
+       const struct tsocket_address *remote_address;
+       char *addr = NULL;
        const char *server_site_name;
        char *guid_str;
        struct netlogon_samlogon_response response;
@@ -1539,8 +1540,11 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct 
dcesrv_call_state *dce_call,
                return WERR_DS_UNAVAILABLE;
        }
 
-       addr = dce_call->conn->transport.get_peer_addr(dce_call->conn, mem_ctx);
-       W_ERROR_HAVE_NO_MEMORY(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);
+       }
 
        /* "server_unc" is ignored by w2k3 */
 
@@ -1562,7 +1566,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->addr,
+                                                r->in.mask, addr,
                                                 
NETLOGON_NT_VERSION_5EX_WITH_IP,
                                                 lp_ctx, &response);
        if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c
index 6485d9e..906b02d 100644
--- a/source4/rpc_server/service_rpc.c
+++ b/source4/rpc_server/service_rpc.c
@@ -370,8 +370,6 @@ static void dcesrv_sock_accept(struct stream_connection 
*srv_conn)
 
        dcesrv_conn->transport.private_data             = srv_conn;
        dcesrv_conn->transport.report_output_data       = 
dcesrv_sock_report_output_data;
-       dcesrv_conn->transport.get_my_addr              = 
dcesrv_sock_get_my_addr;
-       dcesrv_conn->transport.get_peer_addr            = 
dcesrv_sock_get_peer_addr;
 
        TALLOC_FREE(srv_conn->event.fde);
 
@@ -403,6 +401,9 @@ static void dcesrv_sock_accept(struct stream_connection 
*srv_conn)
                return;
        }
 
+       dcesrv_conn->local_address = srv_conn->local_address;
+       dcesrv_conn->remote_address = srv_conn->remote_address;
+
        srv_conn->private_data = dcesrv_conn;
 
        irpc_add_name(srv_conn->msg_ctx, "rpc_server");
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c 
b/source4/rpc_server/spoolss/dcesrv_spoolss.c
index 53e251f..0fe8e0e 100644
--- a/source4/rpc_server/spoolss/dcesrv_spoolss.c
+++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c
@@ -24,7 +24,7 @@
 #include "rpc_server/dcerpc_server.h"
 #include "librpc/gen_ndr/ndr_spoolss.h"
 #include "ntptr/ntptr.h"
-#include "lib/socket/socket.h"
+#include "lib/tsocket/tsocket.h"
 #include "librpc/gen_ndr/ndr_spoolss_c.h"
 #include "auth/credentials/credentials.h"
 #include "param/param.h"
@@ -148,7 +148,8 @@ static WERROR dcesrv_spoolss_check_server_name(struct 
dcesrv_call_state *dce_cal
                                        const char *server_name)
 {
        bool ret;
-       struct socket_address *myaddr;
+       const struct tsocket_address *local_address;
+       char *myaddr;
        const char **aliases;
        const char *dnsdomain;
        unsigned int i;
@@ -201,10 +202,12 @@ static WERROR dcesrv_spoolss_check_server_name(struct 
dcesrv_call_state *dce_cal
                if (ret) return WERR_OK;
        }
 
-       myaddr = dcesrv_connection_get_my_addr(dce_call->conn, mem_ctx);
+       local_address = dcesrv_connection_get_local_address(dce_call->conn);
+
+       myaddr = tsocket_address_inet_addr_string(local_address, mem_ctx);


-- 
Samba Shared Repository

Reply via email to