[jcifs] jCIFS error code handling.

Christopher R. Hertel crh at ubiqx.mn.org
Sat Jul 13 05:35:14 EST 2002


So here's some more skatterings of info...

The DOS codes are one byte of Error Class, plus two bytes of Error Code.
The DOS version of "File not Found" would be:

Error.Class = ERRDOS (0x01)
Error.Code  = ERRbadfile (0x0002)

The equivalent error using NTSTATUS codes would (likely) be:

Status = STATUS_NO_SUCH_FILE  (0xC000000F)

The other Andrew, Andrew Bartlett, did the following trick to figure out
mappings between DOS and NT codes...

- He modified Samba so that if he logs in with username 0xXXXXXXXX (where
  the XXX's are NT Status codes, like C000000F) Samba will return a login
  failure with the given code as the Status.  (This hack is in the code,
  and can be enabled if compiled using the --enable-developer configure
  option.)

- The setup is to use the Samba box as the PDC, and then set up a 
  Windows2000 system as a member server, offering a share.  The client, in 
  this case, is yet another Samba box running the SMBTorture tools.  

- SMBTorture can be configured in a variety of ways.  I haven't used it 
  much myself yet so I don't have specifics, but what ABartlett did was to
  make SMBTorture attempt logins against the W2K Server, starting with
  username 0xC0000000 and incrementing.  The server would forward the
  login credentials to the Samba PDC which would return a login failure
  with the login name as the error code.  With SMBTorture configured to
  request DOS error codes, the W2K server (the pickle in the middle)  
  needed to translate the NTSTATUS codes it was getting from the PDC into 
  DOS error codes it could hand back to the client.

That gave a clear mapping from NTSTATUS to DOS codes, based on W2K's idea
of what that mapping should be.

The reverse mapping is not symmetric, of course, and I don't know off hand 
if the tests can be easily reversed.  Another interesting note is that the 
test needs to be re-run from time to time, because the mappings change.

Ouch.

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 jcifs mailing list