s3:smbd: update sconn->remote_hostname after the netbios session request
authorStefan Metzmacher <metze@samba.org>
Wed, 17 Oct 2012 12:59:30 +0000 (14:59 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 19 Oct 2012 10:14:57 +0000 (12:14 +0200)
Also update the info in the new smbXsrv structure.
This way we can log the remote name in status outputs.

metze

Signed-off-by: Michael Adam <obnox@samba.org>
source3/smbd/reply.c

index 1b4a1620d6c6bc6240eb8e7e01fe60389cc5acda..4423e8e19091f15217e00b84cee5a3c19cde1de4 100644 (file)
@@ -590,6 +590,19 @@ void reply_special(struct smbd_server_connection *sconn, char *inbuf, size_t inb
                set_local_machine_name(name1, True);
                set_remote_machine_name(name2, True);
 
+               if (is_ipaddress(sconn->remote_hostname)) {
+                       char *p = discard_const_p(char, sconn->remote_hostname);
+
+                       talloc_free(p);
+
+                       sconn->remote_hostname = talloc_strdup(sconn,
+                                               get_remote_machine_name());
+                       if (sconn->remote_hostname == NULL) {
+                               exit_server_cleanly("could not copy remote name");
+                       }
+                       sconn->conn->remote_hostname = sconn->remote_hostname;
+               }
+
                DEBUG(2,("netbios connect: local=%s remote=%s, name type = %x\n",
                         get_local_machine_name(), get_remote_machine_name(),
                         name_type2));