*** sendmail/collect.c.orig Fri Mar 15 12:32:47 2002 --- sendmail/collect.c Thu May 23 18:28:38 2002 *************** *** 664,669 **** --- 664,707 ---- } readerr: + + #ifdef REGEX_BODY + /* readerr is the target of all 'DATA' command good and bad */ + /* at this point we have a file handle of the data stored in the que + * if df is valid */ + /* -tim */ + + if(df) { + STAB *regex_map; + char *regex_map_name="bodyregex"; + char *av[2]; + int regex_filtered=0; /* true if to be filtered */ + char buf[MAXLINE]; /* might make use of buflen counts */ + int rcode; + char *match; + char err[MAXLINE]="554 5.3.1 body error1"; + + regex_map = stab(regex_map_name, ST_MAP, ST_FIND); + if (regex_map != NULL) { + av[1] = NULL; + sm_io_rewind(df, SM_TIME_DEFAULT); + av[0] = buf; + while(sm_io_fgets(df, SM_TIME_DEFAULT, buf, sizeof buf)) { + if(match=(*regex_map->s_map.map_class->map_lookup) + (®ex_map->s_map, buf, av, &rcode)) { + regex_filtered=1; + strncpy(err,match,MAXLINE-1); + } + } + + if (regex_filtered) + syserr(err); + /*syserr("554 5.3.0 body error");*/ + } + } + + #endif /* REGEX_BODY */ + if ((sm_io_eof(fp) && smtpmode) || sm_io_error(fp)) { const char *errmsg;