Skip to content
Snippets Groups Projects
Commit 17b7aee1 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Use smb_msg_type() to double-check the header type against attribute flags.

The inferred message type should match the stored message type. Confirm that.
parent c018dfb8
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -158,7 +158,7 @@ int main(int argc, char **argv) ...@@ -158,7 +158,7 @@ int main(int argc, char **argv)
,hasherr,badhash ,hasherr,badhash
,acthdrblocks,actdatblocks ,acthdrblocks,actdatblocks
,dfieldlength,dfieldoffset ,dfieldlength,dfieldoffset
,dupenum,dupenumhdr,dupeoff,attr,actalloc ,dupenum,dupenumhdr,dupeoff,attr,actalloc,types
,datactalloc,misnumbered,timeerr,idxofferr,idxerr ,datactalloc,misnumbered,timeerr,idxofferr,idxerr
,subjcrc,fromcrc,tocrc ,subjcrc,fromcrc,tocrc
,intransit,unvalidated ,intransit,unvalidated
...@@ -349,6 +349,7 @@ int main(int argc, char **argv) ...@@ -349,6 +349,7 @@ int main(int argc, char **argv)
} }
headers=deleted=orphan=dupenumhdr=attr=zeronum=timeerr=lockerr=hdrerr=0; headers=deleted=orphan=dupenumhdr=attr=zeronum=timeerr=lockerr=hdrerr=0;
types = 0;
subjcrc=fromcrc=tocrc=0; subjcrc=fromcrc=tocrc=0;
hdrnumerr=hdrlenerr=0; hdrnumerr=hdrlenerr=0;
actalloc=datactalloc=deldatblocks=delhdrblocks=xlaterr=0; actalloc=datactalloc=deldatblocks=delhdrblocks=xlaterr=0;
...@@ -471,6 +472,13 @@ int main(int argc, char **argv) ...@@ -471,6 +472,13 @@ int main(int argc, char **argv)
} }
} }
if(msg.hdr.type != smb_msg_type(msg.hdr.attr)) {
fprintf(stderr,"%sMessage type mismatch (%d, expected %d)\n"
,beep, msg.hdr.type, smb_msg_type(msg.hdr.attr));
msgerr=TRUE;
types++;
}
if(!(smb.status.attr&SMB_EMAIL) && chkhash) { if(!(smb.status.attr&SMB_EMAIL) && chkhash) {
/* Look-up the message hashes */ /* Look-up the message hashes */
hashes=smb_msghashes(&msg,(uchar*)body,SMB_HASH_SOURCE_DUPE); hashes=smb_msghashes(&msg,(uchar*)body,SMB_HASH_SOURCE_DUPE);
...@@ -1015,6 +1023,10 @@ int main(int argc, char **argv) ...@@ -1015,6 +1023,10 @@ int main(int argc, char **argv)
printf("%-35.35s (!): %lu\n" printf("%-35.35s (!): %lu\n"
,"Mismatched Header Lengths" ,"Mismatched Header Lengths"
,hdrlenerr); ,hdrlenerr);
if(types)
printf("%-35.35s (!): %lu\n"
,"Mismatched Attribute/MsgTypes"
,types);
#define INDXERR "Index/Header Mismatch: " #define INDXERR "Index/Header Mismatch: "
if(attr) if(attr)
printf("%-35.35s (!): %lu\n" printf("%-35.35s (!): %lu\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment