@@ -586,7 +586,7 @@ static void clear_network(s32 s,u8 *ptr)
586586 */
587587static s32 SMBCheck (u8 command ,SMBHANDLE * handle )
588588{
589- s32 ret ;
589+ s32 ret = SMB_ERROR ;
590590 u8 * ptr = handle -> message .smb ;
591591 NBTSMB * nbt = & handle -> message ;
592592 u32 readlen ;
@@ -600,8 +600,7 @@ static s32 SMBCheck(u8 command,SMBHANDLE *handle)
600600
601601 /*keep going till we get a NBT session message*/
602602 do {
603- ret = smb_recv (handle -> sck_server , (u8 * )nbt , 4 );
604- if (ret != 4 ) goto failed ;
603+ if (smb_recv (handle -> sck_server , (u8 * )nbt , 4 ) != 4 ) goto failed ;
605604
606605 if (nbt -> msg != NBT_SESSISON_MSG )
607606 {
@@ -621,23 +620,19 @@ static s32 SMBCheck(u8 command,SMBHANDLE *handle)
621620 readlen = (u32 )((nbt -> length_high <<16 )|nbt -> length );
622621
623622 // Get server message block
624- ret = smb_recv (handle -> sck_server , ptr , readlen );
625- if (readlen != ret ) goto failed ;
623+ if ( readlen != smb_recv (handle -> sck_server , ptr , readlen ) ) goto failed ;
626624
627625 /*** Do basic SMB Header checks ***/
628- ret = getUInt (ptr ,SMB_OFFSET_PROTO );
629- if (ret != SMB_PROTO ) goto failed ;
630-
631- ret = getUChar (ptr , SMB_OFFSET_CMD );
632- if (ret != command ) goto failed ;
626+ if (getUInt (ptr ,SMB_OFFSET_PROTO ) != SMB_PROTO ){ret = SMB_BAD_PROTOCOL ; goto failed ;}
633627
634- ret = getUInt (ptr ,SMB_OFFSET_NTSTATUS );
635- if (ret ) goto failed ;
628+ if (getUChar (ptr , SMB_OFFSET_CMD ) != command ){ret = SMB_BAD_COMMAND ; goto failed ;}
636629
630+ if (getUInt (ptr ,SMB_OFFSET_NTSTATUS )) goto failed ;
631+
637632 return SMB_SUCCESS ;
638633failed :
639634 clear_network (handle -> sck_server ,ptr );
640- return SMB_ERROR ;
635+ return ret ;
641636}
642637
643638/**
0 commit comments