[linux-cifs-client] are SMB TID's specific to the SMB UID used in the tree connect call?

Christopher R. Hertel crh at ubiqx.mn.org
Wed Aug 26 14:29:25 MDT 2009


Jeff Layton wrote:
> I've been looking at what it will take to implement multisession mounts
> in CIFS. Apologies if I'm not using the right terminology here...
> 
> I've run up against the following question however. CIFS currently
> keeps a list of Tree Connect ID's (TID's) per SMB session. When I
> cleaned up this code a while back, my assumption was that TID's should
> only be used with the SMB UID that was used to perform the tree connect.

Both TIDs and UIDs should be unique within the scope of a single virtual
circuit.  (For the CIFS VFS, that means within the scope of a single TCP
connection.)  Once a TID has been established over the VC, any UID
established over the same VC should be usable when accessing resources
available within that TID.  From the LANMAN1.0 spec (SMB-LM1X):

  smb_uid is the user identifier. It is used by the LANMAN 1.0 extended
  protocol when the server is executing in "user level security mode"
  to validate access on protocols which reference symbolicly named
  resources (such as file open). Thus differing users accessing the
  same TID may be granted differing access to the resources defined
  by the TID based on smb_uid. The UID requested is validated by the
  server via the Session Set Up protocol.
  Note that -2 is reserved as an invalid UID.

So...  a single TID over a single transport connection can be used by as
many different users (UIDs) as have been generated via SessionSetupAndx
calls over the same transport connection.

> The existing MultiuserMount code in CIFS however violates this rule. It
> makes CIFS replace the SMB UID in a call with another one, but the TID
> stays the same.
> 
> It seems to work fine however. This leads me to believe that it's OK to
> use a TID with a different UID. Is that the case?

Yep.

> If so, then will the TID continue to be valid even after the smb
> session is torn down?

If the UID is invalidated using an SMB_COM_LOGOFF_ANDX or such, then the TID
is still valid.  The TID is valid until a Tree Disconnect is performed or
the VC is closed.

...at least, that's what's supposed to happen.  :)

Chris -)-----

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
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