s4:smb_server: use tsocket_address_string() for debugging the client address
authorStefan Metzmacher <metze@samba.org>
Tue, 27 Apr 2010 14:05:08 +0000 (16:05 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 27 Apr 2010 15:05:30 +0000 (17:05 +0200)
metze

source4/smb_server/management.c

index b8e42aec400cf19e668e7bd36bca4748e543f6eb..05373595c02cc29cc24efb2fbe056bb6b65a133b 100644 (file)
@@ -79,9 +79,15 @@ static NTSTATUS smbsrv_tcon_information(struct irpc_message *msg,
 {
        struct smbsrv_connection *smb_conn = talloc_get_type(msg->private_data,
                                             struct smbsrv_connection);
+       struct tsocket_address *client_addr = smb_conn->connection->remote_address;
+       char *client_addr_string;
        int i=0, count=0;
        struct smbsrv_tcon *tcon;
 
+       /* This is for debugging only! */
+       client_addr_string = tsocket_address_string(client_addr, r);
+       NT_STATUS_HAVE_NO_MEMORY(client_addr_string);
+
        /* count the number of tcons */
        for (tcon=smb_conn->smb_tcons.list; tcon; tcon=tcon->next) {
                count++;
@@ -93,14 +99,8 @@ static NTSTATUS smbsrv_tcon_information(struct irpc_message *msg,
 
        for (tcon=smb_conn->smb_tcons.list; tcon; tcon=tcon->next) {
                struct smbsrv_tcon_info *info = &r->out.info.tcons.tcons[i];
-               struct socket_address *client_addr;
-               client_addr = socket_get_peer_addr(smb_conn->connection->socket, r);
-               
-               if (client_addr) {
-                       info->client_ip = client_addr->addr;
-               } else {
-                       info->client_ip = NULL;
-               }
+
+               info->client_ip    = client_addr_string;
 
                info->tid          = tcon->tid;
                info->share_name   = tcon->share_name;