Oddity in port 445 behavior...

Christopher R.Hertel crh at ubiqx.mn.org
Fri Jun 21 11:47:01 GMT 2002

I am playing with port 445.

The only differences between an NBT session and a non-NBT (naked) session

- The NBT session is generally (but not exclusively) carried on port 139,
  while the naked session is generally (but not exclusively) carred on
  port 445.

- After the initial TCP connection, NBT sends a SESSION REQUEST message
  and the server is supposed to respond with a POSITIVE or NEGATIVE
  SESSION RESPONSE.  Using naked transport that exchange is skipped.

My thoughts on this:

- The sensible thing to do is to write the server so that it will respond
  to an NBT SESSION REQUEST if it gets one, and not care if it doesn't.  I
  *think* that's what we do in Samba but I'm not sure (haven't tested).

  From my testing it appears, unfortunately, that W2K just ignores the
  NBT SESSION request if the request arrives on port 445.  That's a shame,
  I think.  It means that the client must assume that port 445 is always
  naked transport, and 139 is always NBT transport.  A reasonable set of
  assumptions... but what happens if someone is redirecting services to
  other ports?  Many people do this, I've learned (tunnelling via SSH,
  etc.).  Which set of semantics do you use if the port number is not 139
  or 445?

  The problem here is that W2K simply ignores the packet, so the client
  must decide whether to time-out waiting for a reply or to start sending
  SMBs before it knows if it got an error message back from the server.
  I am not sure what happens if it times out, but we have seen Windows
  behave strangely if it senses a delay.  Perhaps the best way to handle
  this is to make the connection, try the NBT SESSION SETUP, if you get a
  response then go with it, if not then close the connection and try again
  without the NBT SESSION SETUP.

Just curious what people think.

Chris -)-----

Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org

More information about the samba-technical mailing list