From 980191d189ee1f5a25e74a6bdf141d4c7e4455d5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 17 Oct 2012 14:59:30 +0200 Subject: [PATCH] s3:smbd: update sconn->remote_hostname after the netbios session request 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 --- source3/smbd/reply.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 1b4a1620d6c..4423e8e1909 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -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));