[jcifs] Bug: Error in SmbTree.java??

Johannes Bredner johannes.bredner at googlemail.com
Sat Feb 21 10:18:46 GMT 2009


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/
>>
>
>
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the jcifs mailing list