receivedmsgiddb(1)
NAME
- receivedMSGIDdb - validate the "Message-ID: " records in
- the headers of e-mail files against domain names in a database
- file
SYNOPSIS
receivedMSGIDdb [-c] [-f from_address] [-r m|n] [-v] dbfilename [filename(s)]
DESCRIPTION
- ReceivedMSGIDdb is for validating the "Message-ID: "
- records in the headers of e-mail files against domain names in a
- database file.
- The program requires a Posix compatible regex(3) library
- to parse the e-mail addresses, and mmap(2) to map the database
- file of e-mail addresses into the Unix VM system. The e-mail ad
- dresses from the e-mail header are validated against the database
- file using a binary search. The database file name is a required
- command line argument.
- The database is a standard Unix text file, one e-mail ad
- dress per line, in lexical order, constructed with "sort -u in
- file > outfile", or equivalent.
- The database mechanism is conservative with machine re
- sources, requiring about 12.5 micro-seconds of machine time to
- lookup a word in the Unix system dictionary, (2.5 MB, quarter of
- a million words, single 466 MHz., Pentium, lightly loaded, Linux
- 2.2, time(1) command to lookup every word in the dictionary, di
- vided by the number of words.) Conceptually, the database mecha
- nism is implemented similar to the the technique used in the
- look(1) command, but requires exact matches, as opposed to par
- tial key matches.
- The input e-mail file name(s) may be supplied as addition
- al optional command line arguments, or redirected to the program
- via stdin for compatibility with procmail(1), and other e-mail
- scripting agents.
- A suitable procmail(1) recipe example might be:
:0 wfh
* ? receivedMSGIDdb address.db
| formail -A "X-Notice: Message in address.db- database"
- The -f from_address option can be used to validate that
- the "Message-ID: " and the "From: " e-mail address, (or any other
- e-mail address,) are from the same machine/domain. The -f option
- can be used multiple times to validate any number e-mail address
- es.
- The program contains less than 300 lines of declarations
- and statements, all of which are documented with in line com
- ments.
- The program has been compiled and tested on SunOS, So
- laris, and Linux, and may work on other brands of Unix.
- The program returns 0 if no error and a match was found in
- the database file for the domain name in any "Message-ID: " head
- er records, 1 if no error and no match found; else returns a
- unique error code greater than 1 representing the error encoun
- tered-which will, also, print an error diagnostic to stderr.
- However, if one or more e-mail addresses are specified on
- the command line with the -f option, then if all e-mail addresses
- have the same domain name as found in the database file from the
- "Message-ID: " header record, then the program returns 1. If any
- e-mail address does not have the same domain name as found in the
- database file from the "Message-ID: " record, then the program
- returns 0. If the domain name in the "Message-ID: " record is not
- found in the database, the program returns 1, as before. The re
- turn values for the -f option are for compatibility with procmail
- scripts.
- The -r option is useful for controlling the return value
- under error conditions-for example, the program return can be
- preempted if the database file can not be opened, (or read,) with
- a return value of match, or no match, depending on environmental
- requirements.
OPTIONS
- dbfilename
- Database file name.
- filename(s)
- E-mail file name(s), (defaults to stdin).
- -c Print all matching e-mail addresses, not just the
- first.
- -f from_address
- Validate the e-mail address, from_address.
- -r m|n On file error, exit return = match for m, no match
- for n.
- -v Print the program's version information.
WARNINGS
- Under buffer overflow conditions, the program makes no at
- tempts at handling the situation-it just detects it, prints an
- error message, and exits.
SEE ALSO
- receivedIP(1), receivedIPdb(1), receivedIPdbdedup(1), re
- ceivedIPdbrm(1), receivedIPdbusort(1), bsearchtext(1), re
- ceivedAddress(1), receivedTodb(1), receivedMSGIDdb(1), receive
- dUnknowndb(1), tolower(1), toupper(1), bsorttext(1) receivedIP
- forgedb(1), hsearchtext(1), bsearchbody(1)
DIAGNOSTICS
- Error messages for incompatible arguments, failure to al
- locate memory, inaccessible files, opening and closing files, in
- put record buffer overflow, compiling regular expressions, and e
- mail header format or structure errors.
AUTHORS
---------------------------------------------------------------------
- A license is hereby granted to reproduce this software
- source code and
to create executable versions from this source code for - personal,
non-commercial use. The copyright notice included with - the software
must be maintained in all copies produced. - THIS PROGRAM IS PROVIDED "AS IS". THE AUTHOR PROVIDES NO
- WARRANTIES
WHATSOEVER, EXPRESSED OR IMPLIED, INCLUDING WARRANTIES OF
MERCHANTABILITY, TITLE, OR FITNESS FOR ANY PARTICULAR PUR - POSE. THE
AUTHOR DOES NOT WARRANT THAT USE OF THIS PROGRAM DOES NOT - INFRINGE THE
INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY IN ANY - COUNTRY.
- Copyright (c) 2001-2007, John Conover, All Rights Re
- served.
- Comments and/or bug reports should be addressed to:
john@email.johncon.com (John Conover)- ---------------------------------------------------------------------
January 16, 2007 RE