Xref: utzoo news.software.b:8399 news.sysadmin:3882 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!bbn.com!papaya.bbn.com!rsalz From: rsalz@bbn.com (Rich Salz) Newsgroups: news.software.b,news.sysadmin Subject: Verifying headers (Was Re: LET'S NAME THE GUILTY POSTING SOFTWARE!!!) Message-ID: <3638@litchi.bbn.com> Date: 23 Jun 91 02:23:17 GMT References: <1991Jun19.154645.11885@zoo.toronto.edu> <1991Jun19.172544.32267@mp.cs.niu.edu> <6098@gazette.bcm.tmc.edu> <1991Jun20.114358.4871@mp.cs.niu.edu> Followup-To: news.software.b Organization: BBN Systems and Technology, Inc. Lines: 34 In scs@iti.org (Steve Simmons) writes: >Good point. What we really need is a "standard library" that will do >syntax checking on article headers. This is amazingly trivial to do. The inews that comes with InterNetNews copies all headers into a table: typedef enum _HEADERTYPE { HTobs, /* obsolete header */ HTreq, /* required header */ HTstd /* standard header */ } HEADERTYPE; typedef struct _HEADER { char *Name; BOOL CanSet; HEADERTYPE Type; char *Value; } HEADER; The table has entries like this: { "Path", FALSE, HTstd } { "Subject", TRUE, HTreq } Scan the article, fill in the table. Run through it once to make sure the user didn't try to specify any headers where HEADER.CanSet == FALSE. Make sure that Header.Value != NULL for all entries where HEADER.Type == HTreq. If the put a From, add a Sender. Verify the newsgroups, and send the article as mail if any are moderated and there is no approved line. Add a Date, MessageID (if needed), a Path, Lines, and you're all set. The whole thing can be done in roughly 118 lines, not counting the table-building. Code will be freely redistributable in early August. /r$ -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net. Use a domain-based address or give alternate paths, or you may lose out.