hardcoded port 445

Linda Walsh samba at tlinx.org
Mon Oct 31 13:00:19 MDT 2011

Oskar Liljeblad wrote:
> Hello
> I am writing a small application doing MSRPC using Samba4. It relies on
> forwarded ports, it will for instance connect to which is
> forwarded to 445 on some remote machine.  So I looked at the Samba code and
> noticed two places where 445 is hardcoded:
> My application will not be connecting to 445 so will this cause
> incompatibility?  If so I see only one solution: Always keep track of what
> type of port is specified, NetBIOS or CIFS.  That would be needed in many
> places, libcli (struct smbcli_socket), lib/socket/connect_multi.c etc,
> and many functions would need to be modified.
> Any suggestions how to go about here?
    Why are you connecting to port 445 if you are not going to be using it?

Ports below 1024 are considered "reserved" ports -- they have well 
defined meanings
across computer systems and are *reserved* or the general use and 
function of the

You can't use one of those ports in an arbitrary application and expect 
it NOT to cause
problems.  Choose a port >1024 for your demo.  If you talk to port 445, 
then you need to
send it only valid MS-RPC/SMB/CIFS commands.

(at least thats my take on it...someone else is more than welcome to 
'educate' me about my
narrow or outdated views on the matter... ;-) )


More information about the samba-technical mailing list