Bug 15718 - smbstatus's machine name uses hostname instead of ip address
Summary: smbstatus's machine name uses hostname instead of ip address
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other (show other bugs)
Version: 4.20.5
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-19 10:25 UTC by Jones Syue
Modified: 2024-09-20 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jones Syue 2024-09-19 10:25:55 UTC
After session is established, 'smbstatus' utility could list client's 
information to help us understand which clients are connected, for example,
'Machine' column includes a machine name, an ip address, and a port. The 
client's 'machine name' seems always an ip address format, which is the
same as ip address information in the brackets, this looks like repeated 
and is not able to give more information about clients which are connected,
like their netbios name, computer name, or hostname.

This patch uses is_ipaddress() for 'remote_name' checking, if 'remote_name'
is ip address format, replace its content with get_remote_machine_name(),
in order to make 'smbstatus' utility to show more clues to help us collect
client's hostname information. Not sure if this patch do it in the correct
way, any insights are appreciated.

Before apply this patch:

jones@u22044-2:~$ sudo /usr/local/samba/bin/smbstatus

Samba version 4.20.5
PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing
----------------------------------------------------------------------------------------------------------------------------------------
3148638 jones        jones        192.168.7.67 (ipv4:192.168.7.67:58620)        SMB3_11           -                    partial(AES-128-GMAC)

Service      pid     Machine       Connected at                     Encryption   Signing
---------------------------------------------------------------------------------------------
samba        3148638 192.168.7.67    Thu Sep 19 05:54:31 PM 2024 CST  -            -


After apply this patch:

jones@u22044-2:~$ sudo /usr/local/samba/bin/smbstatus

Samba version 4.20.5
PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing
----------------------------------------------------------------------------------------------------------------------------------------
3147285 jones        jones        jones-ws22-67 (ipv4:192.168.7.67:58616)     SMB3_11           -                    partial(AES-128-GMAC)

Service      pid     Machine       Connected at                     Encryption   Signing
---------------------------------------------------------------------------------------------
samba        3147285 jones-ws22-67 Thu Sep 19 05:52:22 PM 2024 CST  -            -

patch will follow.