Man page updates. [rsc] --rw-rw-r-- M 602626 glenda sys 2123 Dec 20 07:19 sys/src/cmd/primes.c /n/sourcesdump/2005/1220/plan9/sys/src/cmd/primes.c:40,46 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/primes.c:40,46 double k, temp, v, limit, nn; if(argc <= 1) { - fprint(2, "usage: primes starting [ending]\n"); + fprint(2, "usage: primes start [finish]\n"); exits("usage"); } nn = atof(argp[1]); [rsc] --rw-rw-r-- M 602626 glenda sys 2504 Dec 20 07:13 sys/src/cmd/rc/here.c /n/sourcesdump/2005/1220/plan9/sys/src/cmd/rc/here.c:62,68 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/rc/here.c:62,68 while((c = rchr(runq->cmdfd))!=EOF){ if(c=='\n' || s==&line[NLINE]){ *s='\0'; - if(strcmp(line, tag)==0) break; + if(tag && strcmp(line, tag)==0) break; if(subst) psubst(f, line); else pstr(f, line); [rsc] --rw-rw-r-- M 602626 glenda sys 1015 Dec 20 08:07 sys/man/1/factor /n/sourcesdump/2005/1220/plan9/sys/man/1/factor:9,19 - /n/sourcesdump/2005/1221/plan9/sys/man/1/factor:9,17 ] .PP .B primes - [ .I start [ .I finish - ] ] .SH DESCRIPTION .I Factor [rsc] --rw-rw-r-- M 602626 presotto sys 6142 Dec 20 08:05 sys/man/1/filter /n/sourcesdump/2005/1220/plan9/sys/man/1/filter:9,22 - /n/sourcesdump/2005/1221/plan9/sys/man/1/filter:9,25 ] .I rcvr .I mailbox - .I "regexp file [ .I "regexp file - ]* + ] ... .PP - .B upas/list add|check - .I patterns - .I addrfile ... + .B upas/list + [ + .B -d + ] + .B add|check + .I patternfile + .I addressfile ... .PP .B upas/deliver .I recipient /n/sourcesdump/2005/1220/plan9/sys/man/1/filter:30,35 - /n/sourcesdump/2005/1221/plan9/sys/man/1/filter:33,45 ] .PP .B upas/vf + [ + .B -r + ] + [ + .B -s + .I savefile + ] .SH DESCRIPTION .PP A user may filter all incoming mail by creating /n/sourcesdump/2005/1220/plan9/sys/man/1/filter:51,66 - /n/sourcesdump/2005/1221/plan9/sys/man/1/filter:61,81 be append only. A message that matches none of the expressions is delivered into the user's standard mail box. - The flags are: - .TP - .B h - the regular expression is matched against the message header - rather than the address. - .TP - .B b - the regular expression is matched against both the header and the body - of the message. .PP + By default, + .I filter + matches each regular expression against the message's sender. + The + .B -h + flag causes + .I filter + to match against the entire header, + and the + .B -b + flag causes + .I filter + to match against the entire message (header and body). + .PP For example, to delete any messages of precedence bulk, place in your .B pipeto /n/sourcesdump/2005/1220/plan9/sys/man/1/filter:133,139 - /n/sourcesdump/2005/1221/plan9/sys/man/1/filter:148,154 to add a pattern to .I patternfile for each address in the - .IR addrssfile 's + .I addressfiles that doesh't already match a pattern. .PP .IR Token , /n/sourcesdump/2005/1220/plan9/sys/man/1/filter:168,189 - /n/sourcesdump/2005/1221/plan9/sys/man/1/filter:183,292 .BR /bin . .PP .I Vf - takes a mail message as standard input, searches for executable - MIME attachments, wraps them in a warning message, and appends - .B .suspect - to any related filenames. + (virus filter) + takes a mail message as standard input + and searches for executable MIME attachments, + either rewriting them to be non-executable or + rejecting the message. + The behavior depends on the attachment's file name + extension and MIME content type. .B /sys/lib/mimetype - contains the list of known MIME content types and file extensions. + contains the list of known extensions and MIME content types. + The fifth field of each line specifies the + safety of a particular file type: + .B y + (yes), + .B m + (maybe; treated same as yes), + .B n + (no), + .B p + (previous), + or + .B r + (reject). .I Vf - considers all those for which the fifth field of - .B mimetype - is - .BR n . - If the script + allows attachments with safety + .B y + or + .B m + to pass through unaltered. + Attachments with safety + .B n + both are wrapped in extra MIME headers + and have + .B .suspect + appended to their file names, to avoid + automatic execution by mail readers. + Attachments with safety + .B r + (currently, + .BR .bat , + .BR .com , + .BR .exe , + and + .BR .scr , + all Microsoft executable extensions) + are taken as + cause for the entire message to be rejected. + A safety of + .B p + (used for the + .B x-gunzip + mime type) + causes the previous extension to be tested, + so that + .B x.tar.gz + is treated the same as + .BR x.tar . + .PP + If .B /mail/lib/validateattachment - exists and is executable, each attachment - is passed, as a mail message, to the script - for further examination. + exists and is executable, + .B vf + runs it on all attachments with safety + .B n + (attachments it would normally sanitize). + If + .IR validateattachment 's + exit status contains the string + .L discard , + .I vf + rejects the entire message. + If the status contains the string + .L accept , + .I vf + does not sanitize the attachment. + Otherwise, + .I vf + sanitizes the attachment as before. + The standard + .I validateattachment + uses + .IR file (1) + to determine the file type. + It accepts text and image files + and discards messages containing + executables or + .I zip + (see + .IR gzip(1)) + archives of executables. + .PP + The + .B -r + option causes + .I vf + not to sanitize MIME attachments, only to + reject messages it determines to be viruses. + The + .B -s + option causes + .I vf + to log all attachments of safety + .B r + in the mail box + .IR savefile . .SH FILES .TF /mail/box/*/dead.letter .TP /n/sourcesdump/2005/1220/plan9/sys/man/1/filter:191,197 - /n/sourcesdump/2005/1221/plan9/sys/man/1/filter:294,300 mail filter .TP .B /sys/lib/mimetype - mime content types + MIME content types .TP .B /mail/lib/validateattachment attachment checker [rsc] --rw-rw-r-- M 602626 glenda sys 1070 Dec 20 08:05 sys/src/cmd/upas/filterkit/deliver.c /n/sourcesdump/2005/1220/plan9/sys/src/cmd/upas/filterkit/deliver.c:4,10 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/upas/filterkit/deliver.c:4,10 void usage(void) { - fprint(2, "usage: %s recipient fromaddr-file mbox\n", argv0); + fprint(2, "usage: %s recipient fromfile mbox\n", argv0); exits("usage"); } [rsc] --rw-rw-r-- M 602626 glenda sys 4754 Dec 20 08:05 sys/src/cmd/upas/filterkit/list.c /n/sourcesdump/2005/1220/plan9/sys/src/cmd/upas/filterkit/list.c:30,36 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/upas/filterkit/list.c:30,36 static void usage(void) { - fprint(2, "usage: %s 'check|add' patternfile addr [addr*]\n", argv0); + fprint(2, "usage: %s add|check patternfile [addressfile ...]\n", argv0); exits("usage"); } [rsc] --rw-rw-r-- M 602626 glenda sys 2365 Dec 20 08:05 sys/src/cmd/upas/send/filter.c /n/sourcesdump/2005/1220/plan9/sys/src/cmd/upas/send/filter.c:8,13 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/upas/send/filter.c:8,20 char *findbody(char*); void + usage(void) + { + fprint(2, "usage: upas/filter [-bh] rcvr mailbox [regexp file] ...\n"); + exits("usage"); + } + + void main(int argc, char *argv[]) { message *mp; /n/sourcesdump/2005/1220/plan9/sys/src/cmd/upas/send/filter.c:31,43 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/upas/send/filter.c:38,50 header = 1; body = 1; break; + default: + usage(); } ARGEND Binit(&bin, 0, OREAD); - if(argc < 2){ - fprint(2, "usage: filter rcvr mailfile [regexp mailfile ...]\n"); - exits("usage"); - } + if(argc < 2) + usage(); mp = m_read(&bin, 1, 0); /* get rid of local system name */ [rsc] --rw-rw-r-- M 602626 glenda sys 20043 Dec 20 08:05 sys/src/cmd/upas/vf/vf.c /n/sourcesdump/2005/1220/plan9/sys/src/cmd/upas/vf/vf.c:117,122 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/upas/vf/vf.c:117,129 char *savefile; void + usage(void) + { + fprint(2, "usage: upas/vf [-r] [-s savefile]\n"); + exits("usage"); + } + + void main(int argc, char **argv) { ARGBEGIN{ /n/sourcesdump/2005/1220/plan9/sys/src/cmd/upas/vf/vf.c:124,135 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/upas/vf/vf.c:131,145 justreject = 1; break; case 's': - savefile = ARGF(); - if(savefile == nil) - exits("usage"); + savefile = EARGF(usage()); break; - }ARGEND; + default: + usage(); + }ARGEND + if(argc) + usage(); + Binit(&in, 0, OREAD); Binit(&out, 1, OWRITE); /n/sourcesdump/2005/1220/plan9/sys/src/cmd/upas/vf/vf.c:415,422 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/upas/vf/vf.c:425,431 } /* - * XXX save the decoded file, run 9 unzip -tf on it, and then - * look at the file list. + * Run the external checker to do content-based checks. */ static int runchecker(Part *p) /n/sourcesdump/2005/1220/plan9/sys/src/cmd/upas/vf/vf.c:483,488 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/upas/vf/vf.c:492,500 if(runchecker(p) > 0) return p; + if(justreject) + return p; + fprint(2, "x\n"); syslog(0, "mail", "vf wrapped %s %s", p->type?s_to_c(p->type):"?", p->filename?s_to_c(p->filename):"?"); /n/sourcesdump/2005/1220/plan9/sys/src/cmd/upas/vf/vf.c:871,878 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/upas/vf/vf.c:883,888 return 2; } } - if(justreject) - return 0; return 1; } /n/sourcesdump/2005/1220/plan9/sys/src/cmd/upas/vf/vf.c:886,894 - /n/sourcesdump/2005/1221/plan9/sys/src/cmd/upas/vf/vf.c:896,901 Mtype *m; char *s, *fix; int rv = 1; - - if(justreject) - return 0; fix = s = strchr(type, '/'); if(s != nil)