Commit bbef731d authored by Dmitry Bogatov's avatar Dmitry Bogatov

Import Upstream version 0.51

parents
--- Setting up /etc/aliases
Create /etc/aliases if it does not already exist. You should include
forwarding instructions for mailer-daemon, postmaster, and root:
root: alias
postmaster: alias
mailer-daemon: alias
Note that qmail never delivers mail to root. The instructions shown here
will deliver messages to the mailbox of the ``alias'' user.
For further details on the format of /etc/aliases, and a list of
sendmail compatibility warnings, see the newaliases man page.
--- Compiling /etc/aliases
Once /etc/aliases is ready, run newaliases to compile /etc/aliases into
/etc/aliases.cdb:
# newaliases
Review /etc/aliases.cdb to make sure it has the instructions you want:
% printforward < /etc/aliases.cdb | more
For the format of printforward's output, see the setforward man page.
If you change /etc/aliases you will have to run newaliases again. You
may want to add a comment at the top of /etc/aliases as a reminder.
--- Compiling :include: files
If you have an :include: file, say /etc/staff-list, compile it into
/etc/staff-list.bin:
# newinclude /etc/staff-list
See the newinclude man page for a list of sendmail compatibility
warnings. Review /etc/staff-list.bin:
% printmaillist < /etc/staff-list.bin | more
For the format of printmaillist's output, see the setmaillist man page.
If you change /etc/staff-list you will have to run newinclude again. You
may want to add a comment at the top of /etc/staff-list as a reminder.
--- Configuring qmail to use /etc/aliases
To activate /etc/aliases, put this line into ~alias/.qmail-default:
| fastforward -d /etc/aliases.cdb
If qmail is already running, make sure to chmod +t ~alias before you
edit .qmail files in ~alias, and chmod -t ~alias after.
--- Testing aliases
To check the expansion of postmaster@your.host without sending any mail:
% env DEFAULT=postmaster HOST=your.host fastforward -nd /etc/aliases.cdb
Replace your.host with your fully qualified domain name. Make sure to
include the -nd.
Next, try sending a message to postmaster@your.host. Watch the qmail log
and the final mailbox to make sure the alias works the way you want.
You can check other aliases the same way.
--- Using /etc/aliases for virtual domains
To put all addresses at virt.dom under control of /etc/aliases, add
virt.dom:alias
to /var/qmail/control/virtualdomains, and give qmail-send a HUP signal.
Also add
virt.dom
to /var/qmail/control/rcpthosts so that qmail accepts mail for virt.dom
from remote hosts. Now you can handle virt.dom in /etc/aliases:
billing@virt.dom: joe, fred
(this line catches all other addresses)@virt.dom: joe
Note that postmaster@virt.dom will go to joe; the @virt.dom instruction
overrides the postmaster instruction. Note, however, that other .qmail
files in ~alias override ~alias/.qmail-default, so you can set up
~alias/.qmail-postmaster to handle postmaster@everything.
Beware that sendmail does not support domain-specific instructions in
/etc/aliases; they are a fastforward feature.
fastforward handles qmail forwarding according to a cdb database. It can
create forwarding databases from a sendmail-style /etc/aliases or from
user-oriented virtual-domain tables.
fastforward supports external mailing lists, stored in a binary format
for fast access. It has a tool to convert sendmail-style include files
into binary lists.
fastforward is more reliable than sendmail. sendmail can't deal with
long aliases, or deeply nested aliases, or deeply nested include files;
fastforward has no limits other than memory. sendmail can produce
corrupted alias files if the system crashes; fastforward is crashproof.
fastforward's database-building tools are much faster than sendmail's
newaliases. Even better, fastforward deliveries don't pause while the
database is being rebuilt.
fastforward does not support insecure sendmail-style program deliveries
from include files; you can use qmail's secure built-in mechanisms
instead. fastforward does support program deliveries from /etc/aliases.
19980519 version: fastforward 0.51, alpha.
19980519 code: added preline variant in fastforward; updated setforward,
printforward, newaliases accordingly.
19980519 doc: added virtual-domains section to ALIASES.
19980519 doc: used -d in ALIASES.
19980519 code: added fastforward -d.
19980519 doc: put version and home page into fastforward.1.
19980519 doc: simplified INSTALL.
19980519 doc: added ALIASES.
19980519 doc: expanded explanation in conf-qmail.
19980519 code: switched to new install.
19980420 portability problem: IRIX doesn't have vfork(). impact:
couldn't compile under IRIX. fix: include fork.h in
fastforward.c. tnx JB.
19980420 fastforward 0.50, alpha.
BLURB
README
TODO
THANKS
CHANGES
FILES
TARGETS
VERSION
SYSDEPS
Makefile
ALIASES
INSTALL
hier.c
fastforward.1
fastforward.c
printforward.1
printforward.c
setforward.1
setforward.c
printmaillist.1
printmaillist.c
setmaillist.1
setmaillist.c
newaliases.1
newaliases.c
newinclude.1
newinclude.c
auto-str.c
install.c
instcheck.c
conf-cc
conf-ld
find-systype.sh
make-compile.sh
make-load.sh
make-makelib.sh
trycpp.c
warn-auto.sh
alloc.h
alloc.c
alloc_re.c
case.h
case_lowerb.c
cdb.h
cdb_hash.c
cdb_seek.c
cdb_unpack.c
cdbmake.h
cdbmake_add.c
cdbmake_hash.c
cdbmake_pack.c
cdbmss.h
cdbmss.c
control.h
control.c
env.h
envread.c
error.h
error.c
error_str.c
fd.h
fd_copy.c
fd_move.c
fork.h1
fork.h2
tryvfork.c
fmt.h
fmt_ulong.c
scan.h
scan_ulong.c
getln.h
getln.c
getln2.c
sgetopt.h
sgetopt.c
subgetopt.h
subgetopt.c
open.h
open_read.c
open_trunc.c
conf-qmail
auto_qmail.h
qmail.h
qmail.c
seek.h
seek_set.c
sig.h
sig_catch.c
sig_pipe.c
trysgact.c
byte.h
byte_chr.c
byte_copy.c
byte_cr.c
byte_diff.c
str.h
str_chr.c
str_cpy.c
str_diff.c
str_diffn.c
str_len.c
str_rchr.c
gen_alloc.h
gen_allocdefs.h
stralloc.h
stralloc_eady.c
stralloc_pend.c
stralloc_copy.c
stralloc_opyb.c
stralloc_opys.c
stralloc_cat.c
stralloc_catb.c
stralloc_cats.c
stralloc_arts.c
strset.h
strset.c
substdio.h
substdio.c
substdi.c
substdo.c
substdio_copy.c
subfd.h
subfderr.c
subfdouts.c
subfdins.c
readwrite.h
exit.h
token822.h
token822.c
uint32.h1
uint32.h2
tryulong32.c
wait.h
wait_pid.c
trywaitp.c
strerr.h
strerr_sys.c
strerr_die.c
slurpclose.h
slurpclose.c
coe.h
coe.c
Like any other piece of software (and information generally),
fastforward comes with NO WARRANTY.
Things you have to decide before starting:
* Where qmail is installed, normally /var/qmail. (To change this
directory, edit conf-qmail now.)
How to install:
1. Create and install the programs and man pages:
# make setup check
2. To configure qmail to use /etc/aliases, see ALIASES.
That's it! To report success:
% ( echo 'First M. Last'; cat `cat SYSDEPS` ) | mail djb-qst@cr.yp.to
Replace First M. Last with your name.
This diff is collapsed.
fastforward 0.51, alpha.
19980519
Copyright 1998
D. J. Bernstein, djb@pobox.com
fastforward handles qmail forwarding according to a cdb database. It can
create forwarding databases from a sendmail-style /etc/aliases or from
user-oriented virtual-domain tables. See BLURB for a more detailed
advertisement.
INSTALL says how to set up fastforward.
You may distribute unmodified copies of the fastforward package.
The rest of this file is a list of systypes where various versions of
fastforward have been reported to work.
0.50: bsd.os-2.0.1-:i386-:-:pentium-:-
0.50: irix-5.3-11091811-:-:-:ip19-:- (tnx JB)
0.50: linux-2.0.7-:i386-:-:i486-:- (tnx TLM)
0.50: linux-2.0.33-:i386-:-:i486-:- (tnx TB)
0.50: osf1-v4.0-878-:-:-:alpha-:- (tnx BJM)
0.50: sunos-5.6-generic-:sparc-:sun4-:sun4m-:sun4m- (tnx TWH)
VERSION
systype
hassgact.h
haswaitp.h
fork.h
uint32.h
auto-ccld.sh
make-load
find-systype
systype
load
make-compile
compile
uint32.h
fork.h
fastforward.o
slurpclose.o
coe.o
strset.o
qmail.o
auto-str.o
make-makelib
makelib
substdio.o
substdi.o
substdo.o
subfderr.o
subfdouts.o
subfdins.o
substdio_copy.o
substdio.a
error.o
error_str.o
error.a
str_len.o
str_diff.o
str_diffn.o
str_cpy.o
str_chr.o
str_rchr.o
byte_chr.o
byte_diff.o
byte_copy.o
byte_cr.o
str.a
auto-str
auto_qmail.c
auto_qmail.o
subgetopt.o
sgetopt.o
getopt.a
cdb_hash.o
cdb_unpack.o
cdb_seek.o
cdb.a
envread.o
env.a
strerr_sys.o
strerr_die.o
strerr.a
stralloc_eady.o
stralloc_pend.o
stralloc_copy.o
stralloc_opys.o
stralloc_opyb.o
stralloc_cat.o
stralloc_cats.o
stralloc_catb.o
stralloc_arts.o
stralloc.a
alloc.o
alloc_re.o
alloc.a
case_lowerb.o
case.a
fmt_ulong.o
scan_ulong.o
fs.a
hassgact.h
sig_catch.o
sig_pipe.o
sig.a
haswaitp.h
wait_pid.o
wait.a
seek_set.o
seek.a
open_read.o
open_trunc.o
open.a
fd_copy.o
fd_move.o
fd.a
fastforward
printforward.o
printforward
setforward.o
cdbmss.o
cdbmake_pack.o
cdbmake_hash.o
cdbmake_add.o
cdbmake.a
setforward
newaliases.o
token822.o
control.o
getln.o
getln2.o
getln.a
newaliases
printmaillist.o
printmaillist
setmaillist.o
setmaillist
newinclude.o
newinclude
prog
fastforward.0
printforward.0
setforward.0
newaliases.0
printmaillist.0
setmaillist.0
newinclude.0
man
it
install.o
hier.o
install
setup
instcheck.o
instcheck
check
BJM = Barry J. Miller
JB = Jos Backus
LW = Lionel Widdifield
MS = Mikael Suokas
PJG = Paul Graham
SAC = Shawn A. Clifford
TB = Thomas Bullinger
TLM = Timothy L. Mayo
TWH = Thomas W. Holt
consider other table formats
test
fastforward 0.51
#include "alloc.h"
#include "error.h"
extern char *malloc();
extern void free();
#define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */
#define SPACE 4096 /* must be multiple of ALIGNMENT */
typedef union { char irrelevant[ALIGNMENT]; double d; } aligned;
static aligned realspace[SPACE / ALIGNMENT];
#define space ((char *) realspace)
static unsigned int avail = SPACE; /* multiple of ALIGNMENT; 0<=avail<=SPACE */
/*@null@*//*@out@*/char *alloc(n)
unsigned int n;
{
char *x;
n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */
if (n <= avail) { avail -= n; return space + avail; }
x = malloc(n);
if (!x) errno = error_nomem;
return x;
}
void alloc_free(x)
char *x;
{
if (x >= space)
if (x < space + SPACE)
return; /* XXX: assuming that pointers are flat */
free(x);
}
#ifndef ALLOC_H
#define ALLOC_H
extern /*@null@*//*@out@*/char *alloc();
extern void alloc_free();
extern int alloc_re();
#endif
#include "alloc.h"
#include "byte.h"
int alloc_re(x,m,n)
char **x;
unsigned int m;
unsigned int n;
{
char *y;
y = alloc(n);
if (!y) return 0;
byte_copy(y,m,*x);
alloc_free(*x);
*x = y;
return 1;
}
#include "substdio.h"
#include "readwrite.h"
#include "exit.h"
char buf1[256];
substdio ss1 = SUBSTDIO_FDBUF(write,1,buf1,sizeof(buf1));
void puts(s)
char *s;
{
if (substdio_puts(&ss1,s) == -1) _exit(111);
}
void main(argc,argv)
int argc;
char **argv;
{
char *name;
char *value;
unsigned char ch;
char octal[4];
name = argv[1];
if (!name) _exit(100);
value = argv[2];
if (!value) _exit(100);
puts("char ");
puts(name);
puts("[] = \"\\\n");
while (ch = *value++) {
puts("\\");
octal[3] = 0;
octal[2] = '0' + (ch & 7); ch >>= 3;
octal[1] = '0' + (ch & 7); ch >>= 3;
octal[0] = '0' + (ch & 7);
puts(octal);
}
puts("\\\n\";\n");
if (substdio_flush(&ss1) == -1) _exit(111);
_exit(0);
}
#ifndef AUTO_QMAIL_H
#define AUTO_QMAIL_H
extern char auto_qmail[];
#endif
#ifndef BYTE_H
#define BYTE_H
extern unsigned int byte_chr();
extern unsigned int byte_rchr();
extern void byte_copy();
extern void byte_copyr();
extern int byte_diff();
extern void byte_zero();
#define byte_equal(s,n,t) (!byte_diff((s),(n),(t)))
#endif
#include "byte.h"
unsigned int byte_chr(s,n,c)
char *s;
register unsigned int n;
int c;
{
register char ch;
register char *t;
ch = c;
t = s;
for (;;) {
if (!n) break; if (*t == ch) break; ++t; --n;
if (!n) break; if (*t == ch) break; ++t; --n;
if (!n) break; if (*t == ch) break; ++t; --n;
if (!n) break; if (*t == ch) break; ++t; --n;
}
return t - s;
}
#include "byte.h"
void byte_copy(to,n,from)
register char *to;
register unsigned int n;
register char *from;
{
for (;;) {
if (!n) return; *to++ = *from++; --n;
if (!n) return; *to++ = *from++; --n;
if (!n) return; *to++ = *from++; --n;
if (!n) return; *to++ = *from++; --n;
}
}
#include "byte.h"
void byte_copyr(to,n,from)
register char *to;
register unsigned int n;
register char *from;
{
to += n;
from += n;
for (;;) {
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
}
}
#include "byte.h"
int byte_diff(s,n,t)
register char *s;
register unsigned int n;
register char *t;
{
for (;;) {
if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
}
return ((int)(unsigned int)(unsigned char) *s)
- ((int)(unsigned int)(unsigned char) *t);
}
#ifndef CASE_H
#define CASE_H
extern void case_lowers();
extern void case_lowerb();
extern int case_diffs();
extern int case_diffb();
extern int case_starts();
extern int case_startb();
#define case_equals(s,t) (!case_diffs((s),(t)))
#endif
#include "case.h"
void case_lowerb(s,len)
char *s;
unsigned int len;
{
unsigned char x;
while (len > 0) {
--len;
x = *s - 'A';
if (x <= 'Z' - 'A') *s = x + 'a';
++s;
}
}
#ifndef CDB_H
#define CDB_H
#include "uint32.h"
extern uint32 cdb_hash();
extern uint32 cdb_unpack();
extern int cdb_bread();
extern int cdb_seek();
#endif
#include "cdb.h"
uint32 cdb_hash(buf,len)
unsigned char *buf;
unsigned int len;
{
uint32 h;