[BUG SOLVED] Re: [jcifs] NamedPipe error in jcifs_0.6.1: IOException 2: Invalid operation for IPC service

Michael B Allen mballen at erols.com
Wed Mar 20 21:27:26 EST 2002


On Wed, 20 Mar 2002 09:21:11 +0100
Kammerloher Josef <Josef.Kammerloher at softlab.de> wrote:

> 
> Mar 20 08:28:32.585 - smb andx data
> SmbComTreeConnectAndXResponse[command=SMB_COM_TREE_CONNECT_ANDX,received=tru
> e,errorCode=0x00000000,flags=0x0098,flags2=0x8001,tid=2048,pid=16132,uid=204
> 8,mid=2,wordCount=3,byteCount=7,andxCommand=0xFF,andxOffset=142,supportSearc
> hBits=true,shareIsInDfs=false,service=IPC,nativeFileSystem=]
> 
> Mar 20 08:28:32.587 - smb received
> 00000: FF 53 4D 42 73 00 00 00 00 98 01 80 00 00 00 00  |ÿSMBs...........|
> 00010: 00 00 00 00 00 00 00 00 00 08 04 3F 00 08 02 00  |...........?....|
> 00020: 03 75 00 7E 00 00 00 55 00 00 57 00 69 00 6E 00  |.u.~...U..W.i.n.|
> 00030: 64 00 6F 00 77 00 73 00 20 00 4E 00 54 00 20 00  |d.o.w.s. .N.T. .|
> 00040: 34 00 2E 00 30 00 00 00 4E 00 54 00 20 00 4C 00  |4...0...N.T. .L.|
> 00050: 41 00 4E 00 20 00 4D 00 61 00 6E 00 61 00 67 00  |A.N. .M.a.n.a.g.|
> 00060: 65 00 72 00 20 00 34 00 2E 00 30 00 00 00 53 00  |e.r. .4...0...S.|
> 00070: 4F 00 46 00 54 00 4C 00 41 00 42 00 00 00 03 FF  |O.F.T.L.A.B....ÿ|
> 00080: 00 8E 00 01 00 07 00 49 50 43 00 00 00 00        |.......IPC....  |
> 
> HERE  " IOException 2: Invalid operation for IPC service"  is thrown
> 

This is because in jcifs/smb/SmbTree.java I put the below to prevent
the client from trying to do inappropriate things on IPC$ but I forgot
SMB_COM_NT_CREATE_ANDX.

     67     void send( ServerMessageBlock request,
     68                             ServerMessageBlock response ) throws SmbException {
     69         if( response != null ) {
     70             response.received = false;
     71         }
     72         treeConnect( request, response );
     73         if( request == null || (response != null && response.received )) {
     74             return;
     75         }
     76         if( service.equals( "A:" ) == false ) {
     77             switch( request.command ) {
     78                 case ServerMessageBlock.SMB_COM_OPEN_ANDX:

     you need this -->  case ServerMessageBlock.SMB_COM_NT_CREATE_ANDX:

     79                 case ServerMessageBlock.SMB_COM_READ_ANDX:
     80                 case ServerMessageBlock.SMB_COM_WRITE_ANDX:
     81                 case ServerMessageBlock.SMB_COM_CLOSE:
     82                 case ServerMessageBlock.SMB_COM_TREE_DISCONNECT:
     83                     break;
     84                 default:
     85                     throw new SmbException( SmbException.ERRCLI, SmbException.ERRioe,
     86                                 "Invalid operation for " + service + " service");
     87             }
     88         }
     89         request.tid = tid;
     90         session.send( request, response );
     91     }

But you could probably get around this by simply setting:

  useNTSmbs = false

I will have to release a 0.6.2 to patch it. Thanks for the catch. I
really need unit testing.

Mike

-- 
May The Source be with you.





More information about the jcifs mailing list