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

Support new -S option to not check Subject CRCs

the Subject CRC calculation was changed in May of 2022 (trailing whitespace is
removed prior to calculation), so messages imported before this date/revision
of sbbs might be detected as having an invalid/mismatch Subject CRC. This -S
option can be used to suppress such errors (for Keyop).

Don't support /option syntax any longer in non-*nix builds (just -options).
Options are now case-sensitive (i.e. -S and -s are different options).
Bump version to 3.20.
parent c382e714
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4313 passed
...@@ -132,6 +132,7 @@ char *usage="\nusage: chksmb [-opts] <filespec.SHD>\n" ...@@ -132,6 +132,7 @@ char *usage="\nusage: chksmb [-opts] <filespec.SHD>\n"
" a - don't check allocation files\n" " a - don't check allocation files\n"
" t - don't check translation strings\n" " t - don't check translation strings\n"
" i - don't check message IDs\n" " i - don't check message IDs\n"
" S - don't check subject CRCs\n"
" e - display extended info on corrupted msgs\n"; " e - display extended info on corrupted msgs\n";
int main(int argc, char **argv) int main(int argc, char **argv)
...@@ -144,6 +145,7 @@ int main(int argc, char **argv) ...@@ -144,6 +145,7 @@ int main(int argc, char **argv)
BOOL stop_on_error=FALSE,pause_on_error=FALSE,chkxlat=TRUE,chkalloc=TRUE,chkhash=TRUE BOOL stop_on_error=FALSE,pause_on_error=FALSE,chkxlat=TRUE,chkalloc=TRUE,chkhash=TRUE
,lzhmsg,extinfo=FALSE,msgerr; ,lzhmsg,extinfo=FALSE,msgerr;
BOOL chk_msgids = TRUE; BOOL chk_msgids = TRUE;
BOOL chk_subjcrc = TRUE;
uint16_t xlat; uint16_t xlat;
uint32_t m; uint32_t m;
ulong l,n,size,total=0,orphan,deleted,headers ulong l,n,size,total=0,orphan,deleted,headers
...@@ -176,7 +178,7 @@ int main(int argc, char **argv) ...@@ -176,7 +178,7 @@ int main(int argc, char **argv)
hash_t** hashes; hash_t** hashes;
time_t now=time(NULL); time_t now=time(NULL);
fprintf(stderr,"\nCHKSMB v3.19-%s %s/%s SMBLIB %s - Check Synchronet Message Base\n" fprintf(stderr,"\nCHKSMB v3.20-%s %s/%s SMBLIB %s - Check Synchronet Message Base\n"
,PLATFORM_DESC, GIT_BRANCH, GIT_HASH, smb_lib_ver()); ,PLATFORM_DESC, GIT_BRANCH, GIT_HASH, smb_lib_ver());
if(argc<2) { if(argc<2) {
...@@ -196,37 +198,37 @@ int main(int argc, char **argv) ...@@ -196,37 +198,37 @@ int main(int argc, char **argv)
} }
errlast=errors; errlast=errors;
if(argv[x][0]=='-' if(argv[x][0]=='-'
#if !defined(__unix__) /* just for backwards compatibility */
|| argv[x][0]=='/'
#endif
) { ) {
for(y=1;argv[x][y];y++) for(y=1;argv[x][y];y++)
switch(toupper(argv[x][y])) { switch(argv[x][y]) {
case 'Q': case 'q':
beep=""; beep="";
break; break;
case 'B': case 'b':
beep="\a"; beep="\a";
break; break;
case 'P': case 'p':
pause_on_error=TRUE; pause_on_error=TRUE;
break; break;
case 'S': case 's':
stop_on_error=TRUE; stop_on_error=TRUE;
break; break;
case 'T': case 'S':
chk_subjcrc = FALSE;
break;
case 't':
chkxlat=FALSE; chkxlat=FALSE;
break; break;
case 'A': case 'a':
chkalloc=FALSE; chkalloc=FALSE;
break; break;
case 'H': case 'h':
chkhash=FALSE; chkhash=FALSE;
break; break;
case 'I': case 'i':
chk_msgids = FALSE; chk_msgids = FALSE;
break; break;
case 'E': case 'e':
extinfo=TRUE; extinfo=TRUE;
break; break;
default: default:
...@@ -578,7 +580,7 @@ int main(int argc, char **argv) ...@@ -578,7 +580,7 @@ int main(int argc, char **argv)
"index import date/time\n"); "index import date/time\n");
timeerr++; timeerr++;
} }
if((msg.hdr.type == SMB_MSG_TYPE_NORMAL || msg.hdr.type == SMB_MSG_TYPE_POLL) if(chk_subjcrc && (msg.hdr.type == SMB_MSG_TYPE_NORMAL || msg.hdr.type == SMB_MSG_TYPE_POLL)
&& msg.idx.subj!=smb_subject_crc(msg.subj)) { && msg.idx.subj!=smb_subject_crc(msg.subj)) {
fprintf(stderr,"%sSubject CRC mismatch\n",beep); fprintf(stderr,"%sSubject CRC mismatch\n",beep);
msgerr=TRUE; msgerr=TRUE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment