[jcifs] Possible bug in jcifs.smb.SmbComOpenAndX

Andy Thomson a10008051 at gmail.com
Thu Aug 27 07:58:09 MDT 2009


Mike,

It looks like that the declared "int flags" in SmbComOpenAndX is not used, and
it may be stepping on the declared "byte flags" from ServerMessageBlock.  This
appears to be the case in the writeParameterWordsWireFormat() method.  

I did not find any "upstream" usages of it [int flags], and the lower ones
reference the correct ServerMessageBlock one [byte flags].  This one [int flags]
is not set, which implies that the writeParameterWordsWireFormat() is always
seeing a default setting, and never the intended one, at least not that I can
tell.  ServeMessageBlock does call the writeParameterWordsWireFormat() method
via the encode() method, not sure the result is always what was intended.

The class SmbComOpenAndX extends AndXServerMessageBlock, and
AndXServerMessageBlock extends ServerMessageBlock.  ServerMessageBlock has a
variable "byte flags" defined in it.

class SmbComOpenAndX extends AndXServerMessageBlock {
  ...

  int flags,               <<< should be removed ???
  desiredAccess,
  searchAttributes,
  fileAttributes,
  creationTime,
  openFunction,
  allocationSize;
   
  ...

  int writeParameterWordsWireFormat( byte[] dst, int dstIndex ) {
    int start = dstIndex;

    writeInt2( flags, dst, dstIndex );   <<< which flag? use empty 
                                             local one? or one from 
                                             ServerMessageBlock?
    ...
  }
}

---

Andy





More information about the jCIFS mailing list