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

Michael B Allen ioplex at gmail.com
Thu Feb 19 19:26:44 GMT 2009


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/


More information about the jcifs mailing list