[jcifs] Andx bug w/ IBM cluster server (was Bug: Error in SmbTree.java??)

Michael B Allen ioplex at gmail.com
Sat Feb 21 19:00:07 GMT 2009


Johannes,

Does this fix it?

  http://www.ioplex.com/~miallen/jcifs-1.3.4a.jar
  http://www.ioplex.com/~miallen/jcifs-1.3.4a.tgz
  http://www.ioplex.com/~miallen/jcifs-1.3.4a.zip

The SMB_COM_TREE_CONNECT_ANDX response in your screenshot shows
additional "parameter words" (7 instead of the usual 3) that JCIFS was
not decoding correctly. I've never seen that before (must be an IBM
cluster thing) but I have fixed JCIFS so that it should properly
advance the buffer by the number parameter words as opposed to the
content of the parameter words and as a result move on to decoding the
"parameter bytes" correctly. The service string is in the parameter
bytes so it was not being decoded properly and thus the trans2 issue
was just an artifact of the message not being decoded properly.

For future reference, your initial message should probably have
mentioned that you were using an IBM cluster server. Obviously if no
one else reported this issue there is a good chance it's
environmental.

Mike

On Sat, Feb 21, 2009 at 5:18 AM, Johannes Bredner
<johannes.bredner at googlemail.com> wrote:
> Hi,
>
> i now figured out where the problem occurs. See working-call.jpg and
> not-working-call.jpg. Working-call is a request to the ibm hosted server and
> the other from a request of the other provider. The error occurs when the
> response is received. Out of this the variable service is taken. This
> response does not contain an "A:" for the service that is set by receiving
> the response. I don`t know wich packet to inspect to look for the content of
> the response for service because the information is not readable for me.
> Could this happen caused by clustering the servers?
>
> Does this help you? Do you need more information?
>
> Best regards,
>
> Johannes
>
>
> 2009/2/19 Johannes Bredner <johannes.bredner at googlemail.com>
>>
>> The programm is more than simple.
>>
>> Set wins, user, password, domain in jcifs conffig, new SMBFile and call a
>> SmbFile.listFiles();
>>
>> This Programm worked fine for our IBM hosted servers, but we have another
>> provier that has clustered win 2k3 servers where the problem occurs. I think
>> in case of the ibm servers two non "A:" are called with
>>   command = 50
>>   subCommand = 16
>> and
>>   command = 50
>>   subCommand = 32
>>
>> Im not at work now, but will debug the code tomorrow and hope to find out
>> why the calls are different.
>>
>> Johannes
>>
>>
>>
>> 2009/2/19 Michael B Allen <ioplex at gmail.com>
>>>
>>> I have not looked at this very carefully but I think the service for
>>> TRANS2_FIND_FIRST2 should be "A:" so your code change should be
>>> unnecessary.
>>>
>>> What are the conditions under which you get this error?
>>>
>>> Can you provide a small test program that replicates the error?
>>>
>>> Mike
>>>
>>> On Thu, Feb 19, 2009 at 8:29 AM, Johannes Bredner
>>> <johannes.bredner at googlemail.com> wrote:
>>> > Hi all there,
>>> >
>>> > i think i`ve found a bug in SmbTree.java. Here the Problem:
>>> >
>>> > In the constructor of Trans2FindFirst2.java
>>> >
>>> > Trans2FindFirst2(String filename, String wildcard, int
>>> > searchAttributes){
>>> > ........
>>> > command = SMB_COM_TRANSACTION2;
>>> > subCommand = TRANS2_FIND_FIRST2;
>>> > .....
>>> > }
>>> >
>>> > This subcommand results in an exception in SmbTree.java
>>> >
>>> >
>>> >
>>> >
>>> > ------------------------------------------------------------------------------------------------------------------------
>>> > void send( ServerMessageBlock request,
>>> >                            ServerMessageBlock response ) throws
>>> > SmbException {
>>> >        if( response != null ) {
>>> >            response.received = false;
>>> >        }
>>> >        treeConnect( request, response );
>>> >        if( request == null || (response != null && response.received ))
>>> > {
>>> >            return;
>>> >        }
>>> >        if( service.equals( "A:" ) == false ) {
>>> >            switch( request.command ) {
>>> >                case ServerMessageBlock.SMB_COM_OPEN_ANDX:
>>> >                case ServerMessageBlock.SMB_COM_NT_CREATE_ANDX:
>>> >                case ServerMessageBlock.SMB_COM_READ_ANDX:
>>> >                case ServerMessageBlock.SMB_COM_WRITE_ANDX:
>>> >                case ServerMessageBlock.SMB_COM_CLOSE:
>>> >                case ServerMessageBlock.SMB_COM_TREE_DISCONNECT:
>>> >                    break;
>>> >                case ServerMessageBlock.SMB_COM_TRANSACTION:
>>> >                case ServerMessageBlock.SMB_COM_TRANSACTION2:
>>> >                    switch( ((SmbComTransaction)request).subCommand &
>>> > 0xFF
>>> > ) {
>>> >                        case SmbComTransaction.NET_SHARE_ENUM:
>>> >                        case SmbComTransaction.NET_SERVER_ENUM2:
>>> >                        case SmbComTransaction.NET_SERVER_ENUM3:
>>> >                        case SmbComTransaction.TRANS_PEEK_NAMED_PIPE:
>>> >                        case SmbComTransaction.TRANS_WAIT_NAMED_PIPE:
>>> >                        case SmbComTransaction.TRANS_CALL_NAMED_PIPE:
>>> >                        case
>>> > SmbComTransaction.TRANS_TRANSACT_NAMED_PIPE:
>>> >                        case SmbComTransaction.TRANS2_GET_DFS_REFERRAL:
>>> >                            break;
>>> >                        default:
>>> >                              throw new SmbException( "Invalid operation
>>> > for " + service + " service" );
>>> >                    }
>>> >                    break;
>>> >                default:
>>> >                    throw new SmbException( "Invalid operation for " +
>>> > service + " service" + request );
>>> >            }
>>> >        }
>>> >        request.tid = tid;
>>> >
>>> > ------------------------------------------------------------------------------------------------------------------------
>>> >
>>> > throws the Exception "Invalid operation for service". Here my idea:
>>> >
>>> >
>>> >
>>> > ------------------------------------------------------------------------------------------------------------------------
>>> > void send( ServerMessageBlock request,
>>> >                            ServerMessageBlock response ) throws
>>> > SmbException {
>>> >        if( response != null ) {
>>> >            response.received = false;
>>> >        }
>>> >        treeConnect( request, response );
>>> >        if( request == null || (response != null && response.received ))
>>> > {
>>> >            return;
>>> >        }
>>> >        if( service.equals( "A:" ) == false ) {
>>> >            switch( request.command ) {
>>> >                case ServerMessageBlock.SMB_COM_OPEN_ANDX:
>>> >                case ServerMessageBlock.SMB_COM_NT_CREATE_ANDX:
>>> >                case ServerMessageBlock.SMB_COM_READ_ANDX:
>>> >                case ServerMessageBlock.SMB_COM_WRITE_ANDX:
>>> >                case ServerMessageBlock.SMB_COM_CLOSE:
>>> >                case ServerMessageBlock.SMB_COM_TREE_DISCONNECT:
>>> >                    break;
>>> >                case ServerMessageBlock.SMB_COM_TRANSACTION:
>>> >                case ServerMessageBlock.SMB_COM_TRANSACTION2:
>>> >                    switch( ((SmbComTransaction)request).subCommand &
>>> > 0xFF
>>> > ) {
>>> >                        case SmbComTransaction.NET_SHARE_ENUM:
>>> >                        case SmbComTransaction.NET_SERVER_ENUM2:
>>> >                        case SmbComTransaction.NET_SERVER_ENUM3:
>>> >                        case SmbComTransaction.TRANS_PEEK_NAMED_PIPE:
>>> >                        case SmbComTransaction.TRANS_WAIT_NAMED_PIPE:
>>> >                        case SmbComTransaction.TRANS_CALL_NAMED_PIPE:
>>> >                        case
>>> > SmbComTransaction.TRANS_TRANSACT_NAMED_PIPE:
>>> >                        case SmbComTransaction.TRANS2_GET_DFS_REFERRAL:
>>> >                        case SmbComTransaction.TRANS2_FIND_FIRST2:
>>> >                            break;
>>> >                        default:
>>> >                              throw new SmbException( "Invalid operation
>>> > for " + service + " service" );
>>> >                    }
>>> >                    break;
>>> >                default:
>>> >                    throw new SmbException( "Invalid operation for " +
>>> > service + " service" + request );
>>> >            }
>>> >        }
>>> >        request.tid = tid;
>>> >
>>> >
>>> > ------------------------------------------------------------------------------------------------------------------------
>>> >
>>> > If i add the subcommand line for TRANS2_FIND_FIRST2 everything works
>>> > fine,
>>> > but i don`t really know if this is the right way to fix the problem.
>>> > Just
>>> > seems, that this command is missing in the list.
>>> >
>>> > Do you agree with my fix? Is this the right way to report bugs?
>>> >
>>> > Please answer to this email, because i`m not on the list at the moment.
>>> >
>>> > Best regards,
>>> >
>>> > Johannes
>>> >
>>>
>>>
>>>
>>> --
>>> Michael B Allen
>>> Java Active Directory Integration
>>> http://www.ioplex.com/
>>
>
>



-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/


More information about the jcifs mailing list