Common subdirectories: ../simscan-1.2.orig/cdb/CVS and cdb/CVS Common subdirectories: ../simscan-1.2.orig/contrib/CVS and contrib/CVS --- ../simscan-1.2.orig/simscan.c 2005-10-05 17:12:42.000000000 -0400 +++ simscan.c 2007-05-03 14:48:49.272254000 -0400 @@ -42,6 +42,7 @@ #define EXIT_0 0 /* Success */ #define EXIT_11 11 /* address too long */ #define EXIT_400 71 /* temporary refusal to accept */ +#define EXIT_454 54 /* unable to read envelope or message */ #define EXIT_500 31 /* permenent refusal to accept message SMTP: 5XX code */ #define EXIT_MSG 82 /* exit with custom error message */ @@ -68,6 +69,9 @@ 91 Envelope format error. */ +#if HAVE_STRSEP!=1 +char *strsep (char **pp, char *delim); +#endif #ifdef QUARANTINEDIR void quarantine_msg(char *message_name); @@ -194,6 +198,10 @@ #ifdef ENABLE_RECEIVED char runned_scanners[MAX_EMAIL]=""; void add_run_scanner(char *key); +struct tm *tm; +static char monthname[12][4] = { + "Jan","Feb","Mar","Apr","May","Jun" +,"Jul","Aug","Sep","Oct","Nov","Dec"}; #endif #ifdef ENABLE_REGEX @@ -346,6 +354,14 @@ write(fd_per,addr_buff, tmpread); } + if(virgin == 1){ + if( DebugFlag > 0){ + /* fprintf(stderr, "simscan[%ld]: no envelope information, deferred exit\n", getppid()); */ + } + exit_clean(EXIT_454); + } + + /* close the addr file */ if ( close(fd_per) == -1 ) { @@ -602,24 +618,27 @@ close(pim[1]); dup2(pim[0],0); execl(qmail_queue, qmail_queue, 0); - _exit(-1); + _exit(111); } close(pim[0]); - #ifdef ENABLE_RECEIVED +#ifdef ENABLE_RECEIVED gettimeofday(&stop,(struct timezone *) 0); utime=SECS(stop)-SECS(start); - snprintf(buffer,sizeof(buffer), -"Received: by simscan %s ppid: %d, pid: %d, t: %3.4fs\n scanners:%s\n", - VERSION,getppid(),getpid(),utime, - strlen(runned_scanners) > 0 ? runned_scanners : "none"); + + tm = gmtime(&start.tv_sec); + snprintf(buffer,sizeof(buffer), "Received: (simscan %s ppid %ld pid %d t %.4fs)\n" + " (scanners: %s); %02d %s %04d %02d:%02d:%02d -0000\n", + VERSION, getppid(), getpid(), utime, runned_scanners[0] ? runned_scanners : "none", + tm->tm_mday,monthname[tm->tm_mon],tm->tm_year,tm->tm_hour,tm->tm_min,tm->tm_sec); + if ( write(pim[1], buffer,strlen(buffer)) == -1 ) { if ( DebugFlag > 0 ) { fprintf(stderr, "simscan: error writing received line\n"); } exit_clean(EXIT_400); } - #endif +#endif /* write the message to qmail-queue */ while( (ret = read(fd, buffer, sizeof(buffer))) > 0 ) { @@ -994,7 +1013,9 @@ #endif #ifdef SPAM_HITS + ReqHits = SPAM_HITS; if ( PerDomainHits==1 && ( SpamHits >= PDHits ) ) { + ReqHits = PDHits; #ifdef ENABLE_DROPMSG log_message("SPAM DROPPED", Subject, 1); #else @@ -1620,15 +1641,6 @@ } SpamHits = atof(hits); - if ( (tmpstr = strstr(spambuf, "required=")) != NULL ) { - tmpstr+=9; - memset(hits,0,sizeof(hits)); - for(l=0;l<9 && *tmpstr!=' '; ++l, ++tmpstr) { - hits[l] = *tmpstr; - } - ReqHits = atof(hits); - } - } return(0); } --- ../simscan-1.2.orig/simscanmk.c 2005-09-27 14:14:58.000000000 -0400 +++ simscanmk.c 2007-05-03 14:50:51.142658000 -0400 @@ -72,10 +72,12 @@ get_options(argc,argv); #ifdef ENABLE_RECEIVED if (buildversions){ - make_version_cdb(); + int xcode = make_version_cdb(); + if (xcode != 0) exit(xcode); } else { #endif - make_cdb(); + int xcode = make_cdb(); + if (xcode != 0) exit(xcode); #ifdef ENABLE_RECEIVED } #endif @@ -369,6 +371,7 @@ static char input[MAX_LINE]; uint32 h; + sleep(0); /* some NFS timing crazyness on solaris jkister 20061108 */ if ( (fs = fopen(ClearFile,"r")) == NULL) { printf("Not building simcontrol.cdb file. No %s/simcontrol text file\n",