BSD 4_3_Tahoe release
[unix-history] / usr / src / new / nntp / common / README
This directory contains lotsa good stuff common to both
the news server, support, and client programs. The short of it is:
conf.h Configuration information for NNTP server,
support, and client programs. Described in detail below.
response_codes.h These are the #define's of the numeric response
codes in NNTP. This shouldn't change.
rfc977.h Things that weren't response codes, but belong somewhere.
These should remain constant.
clientlib.c This file is a collection of routines which clients
can use to talk to the NNTP server. The code is
well documented, but briefly, the functions are
getserverbyfile Opens a named file and
returns the contents,
presumed to be a host name
server_init Open connection to server
getsocket Get a stream socket
get_server Get line from server
put_server Send line to server
close_server Close connection
It is worth noting that these routines use
buffered I/O, and leave the external variables
"ser_rd_fp" and "ser_wr_fp" (server read/write
file pointers, respectively) floating around
for use by programs which need them.
In any event, you shouldn't need to screw with
these routines.
conf.h
======
You will need to screw with this to get the server, support, and
client programs running. Unfortunately, "rrn" has its own ideas of
where to look for config information, so there is some duplication of
effort here. With luck, it won't be too great.
This is sort of a walk through conf.h so you can get some idea of
what parameters need to be changed. The #defines's default value is
listed in parenthesis after it's name. Manual entries mentioned here
are in the "doc" directory of the NNTP distribution.
First are some compile-time type options, for compiling in
certain code. The options should be "#undef"ed if you don't want
them, and "#defined" if you do.
ALONE (undefined)
Defines whether we're a stand alone version of the server, or
whether we're running under inetd. I suggest you run under inetd.
FASTFORK (undefined)
If we're ALONE, then this option tells us not to read the
active file when we fork, but rather for the parent daemon to re-read
it every READINTVL (below) seconds. This should make forking off children
a little bit faster.
BSD_42 (undefined)
If you have a 4.2 BSD system (as opposed to a 4.3 BSD system),
this needs to be defined. Really it does only two things: changes
the log level to be compatible with 4.2, and automatically defines
DBM (below). If, somehow, you already have ndbm, then you should
kill the lines which auto-define it.
DBM (undefined)
If you don't have the ndbm routines in your standard library (i.e.,
if you're not running 4.3 BSD), you'll have to define this; all it
does is replace the ndbm calls with the earlier, unwieldy dbm calls.
vfork (undefined)
If you don't have the vfork system call, define vfork to be fork,
i.e.,
#define vfork fork
If you do have it, use it: it will increase performance on transfer
dominated machines by a factor or two or so in nntpd.
SYSLOG (LOG_NEWS)
Some systems, such as the Masscomp, do not have a syslog facility.
If SYSLOG is undefined, no syslog/openlog calls will be made.
Naturally, if SYSLOG isn't defined, LOG (below) cannot be defined.
Otherwise, define it to be the name of the facility under which we
log stuff.
LOG (undefined)
When LOG is defined, we log copious amounts of information via
syslog to a special file. One a busy system like ucbvax, this produces
about 100K of log information per day. Look in ../src/SYSLOG to
get an idea of what will be logged. You can use the scripts
provided in ../support to produce statistics on your NNTP server if
you run with LOG.
IHAVE_DEBUG (undefined)
Enables logging of each message-id as it is offered via the IHAVE
command. This produces huge log files, but is useful if you suspect
a site is repeatedly offering the same article to your site after you
have rejected it.
XHDR (defined)
Enables the XHDR command, which is an extention of the NNTP spec.
XHDR allows client programs to see header lines (e.g., subject) from
an article or range of articles. This allows the '=' command in rn
to be much faster, IF AND ONLY IF your server machine is fast. Since
this command foists off work on the server, it may be better to leave this
undefined if your server machine is heavily loaded.
SUBNET (undefined)
If you are running 4.3 BSD or have support for subnets on
your local net, this will include subnet support for the access
file. Basically, a routine goes out and looks at all your ethernet
interfaces, and figures out subnet masks from them. It then
uses these to resolve subnets from IP addresses.
DAMAGED_NETMASK (undefined)
4.3 supports subnet masks of any bit-width, but user programs
are *very* hard pressed to deal with masks which are not a multiple
of 8 bits wide. If you have a weird netmask, define DAMAGED_NETMASK.
The code which uses it is in server/inet_snetof.c. This code
is a real hack, and you may have to diddle with it to make it work.
GHNAME (defined)
Defined if you want to use the 4BSD gethostname() call to
determine the name of your system. This #define is only used
by the mini-inews when posting news. Some reasons you might not
want to use this are: if your UUCP/news name is different than
your internet name; if your gethostname() currently doesn't
return fully-qualified names (e.g., 4.2) but you may "upgrade"
to 4.3 (and return fq'd names) shortly, and you'd rather not
have to recompile news... See UUNAME below.
UUNAME (undefined)
If this is defined, mini-inews will get the hostname out
of /etc/uucpname or /local/uucpname.
>>> If GHNAME and UUNAME are undefined, mini-inews will <<<
>>> get the host name from /usr/include/whoami.h <<<
TIMEOUT (2 hours)
If a server is idle in command mode for TIMEOUT amount of time,
it will close the connection with an error message. This prevents
old servers from clogging the system. Timeout should be at least two
hours so people can go eat lunch and leave an rn on their terminal.
XFER_TIMEOUT (30 minutes)
This is like TIMEOUT, above, but takes effect when the server is
receiving news via IHAVE or POST. If at least one line is not received
in XFER_TIMEOUT amount of time, the server aborts with an error.
DOMAIN ("uucp")
If domain is defined, it specifies that whatever it is defined
as will be appended to host names; this is for posting news when
your hostname() doesn't return your fully-qualified domain name.
If your hostname system call does return a fully-qualified name,
simply undef DOMAIN.
SERVER_FILE ("/usr/local/lib/rn/server")
This file contains the name of the machine which runs the
news server. Mini-inews, rrn, and getactive all use the contents
of this file. The idea behind this is that you don't have to have the server
compiled into anything, and can have the same binaries across
machines which have different news servers.
You must edit this file, and add a single line which contains
the name of the news server for each machine which runs rrn.
If you have multiple news servers on your network, users can
select which one they want to use via the NNTPSERVER environment
variable, which will override the contents of SERVER_FILE. Simply
set NNTPSERVER to be the name of the machine whose news server you
want to use.
If you are afraid of people abusing a particular news server
via NNTPSERVER, you should edit the access file for that news server
accordingly. Security begins at home.
>>> rrn, mini-inews, and getactive NO LONGER have compiled in server names <<<
>>> Be sure to create the SERVER_FILE as mentioned above, or you'll lose! <<<
POSTER ("news")
If your nntpd is run as root, nntpd will attempt to setuid()
and setgid() to the uid and gid of whoever POSTER is defined as.
If your nntpd isn't running as root (i.e., it might run as "usenet"),
either undefine this, or define it to be a user which exists but
is not used -- the setuid will fail in any event.
Next, we have some common files:
ACTIVE_FILE ("/usr/lib/news/active")
Specifies the location of the "active" file.
ACCESS_FILE ("/usr/lib/news/nntp_access")
Specifies the location of the remote access file.
See the manual entry, nntpd.8c, for a better explanation.
A sample access file is in ../support/access_file.
HISTORY_FILE ("/usr/lib/news/history")
Specifies the location of the "history" file.
This is used with NEWNEWS and ARTICLE/HEAD/BODY/STAT when
given an message-id argument.
INEWS ("/usr/lib/news/inews")
Specifies the location of inews, for posting. Note that this
is NOT the same as the mini-inews in the inews directory
supplied with the NNTP distribution, which should only
be installed on client machines. INEWS should be the pathname
of real, live, honest-to-God inews. Your inews may be
in a different place, such as /usr/bin/inews.
SPOOLDIR ("/usr/spool/news/")
This is the directory where news is stored. Note that
the trailing / is important.
RNEWS ("/usr/bin/rnews")
Specifies the location of the rnews program which is used
for dealing with news received from other systems via the
IHAVE command; it is often a link to inews.
STAT_FILE ("/usr/lib/news/mgdstats")
When the support program "mkgrdates" is run, it keep stats
in a file to tell whether or not to rebuild its database
the next time it is run; this is the file the stats are kept
in. Needless to say, it must be writable by whatever user-id
runs "mkgrdates". See the manual entry "mkgrdates.8c" for
more info.
NGDATE_FILE ("/usr/lib/news/groupdates")
Specifies the location of the newsgroup creation date file.
See the manual entry for both nntpd.8c and mkgrdates.8c for
more info.
READINTVL (600 seconds)
If the server is compiled with FASTFORK and ALONE, then this number
tells how often to check if the active file has changed (and to
read it in if it has changed since the last time). See README
in the "server" directory of the NNTP distribution. If you are
not compiled with FASTFORK and ALONE (hint: you're not going to),
don't worry about this.