Skip to content

Commit 084e4a4

Browse files
committed
added size_limit to simcontrol
if size_limit in simcontrol is exceeded the attachment won't be passed to spamassassin
1 parent 63ee199 commit 084e4a4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

simscan.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ char *replace(char *string, char *oldpiece, char *newpiece);
104104
int DebugFlag = 0;
105105
int DebugFiles = 0;
106106

107+
int size_limit = 250000;
108+
107109
/* --stdout is required for reading virus names */
108110
char *viri_args[] = { "clamdscan", "--stdout", message_name, NULL };
109111

@@ -255,7 +257,6 @@ int main(int argc, char **argv)
255257
int i = 0;
256258
int gotrcpt = 0;
257259
int gotfrom = 0;
258-
int size_limit=250000;
259260

260261
/* print out version information if requested */
261262
if ( argc > 1 && strcmp(argv[1],"-v" )==0 ) {
@@ -554,6 +555,7 @@ int main(int argc, char **argv)
554555
#endif
555556

556557
#ifdef ENABLE_SPAM
558+
/* attachments-size-limit patch */
557559
if ( DebugFlag > 0 ) fprintf(stderr, "simscan: size limit is %d bytes\n", size_limit);
558560
if (msgsize >= size_limit) {
559561
// if ( DebugFlag > 0 ) { // now logging also when debug is off
@@ -1912,6 +1914,12 @@ void per_domain_lookup( char *key )
19121914
}
19131915
if ( DebugFlag > 1 ) fprintf(stderr, "simscan:[%d]: spampassthru = %s/%d\n", getppid(), val, PerDomainSpamPassthru);
19141916
#endif
1917+
/* size limit - if exceeded the attachment won't be passed to spamassassin */
1918+
} else if ( strcasecmp(parm,"size_limit") == 0) {
1919+
if ( DebugFlag > 1 ) fprintf(stderr, "simscan:[%d]: default size limit is = %d\n", getppid(), size_limit);
1920+
size_limit = atoi(val);
1921+
if ( DebugFlag > 1 ) fprintf(stderr, "simscan:[%d]: assigned size limit is = %d\n", getppid(), size_limit);
1922+
/* end size limit */
19151923
} else {
19161924
if ( DebugFlag > 1 ) fprintf(stderr, "simscan:[%d]: unimplemented flag %s = %s\n", getppid(), parm, val);
19171925
}

0 commit comments

Comments
 (0)