Adaugă codul complet al proiectului underchat-ircd

This commit is contained in:
mihaiitdata 2026-02-13 00:04:12 +02:00
parent caba5224bf
commit 5fdc1cc27c
462 changed files with 164488 additions and 0 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
**/.git
**/.sw?

119
.github/workflows/docker-publish.yml vendored Normal file
View File

@ -0,0 +1,119 @@
name: Build and Publish Docker Image
on:
# Trigger on releases
release:
types: [published]
# Trigger on commits to master and develop branches
push:
branches:
- master
- develop
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# Tag as 'latest' for releases
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
# Tag with version for releases (e.g., v1.0.0, 1.0.0, 1.0, 1)
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Tag as 'edge' for master branch commits
type=raw,value=edge,enable=${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
# Tag with commit SHA for master branch commits
type=sha,prefix={{branch}}-,enable=${{ github.ref == 'refs/heads/master' }}
# Tag as 'dev' for develop branch commits
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/develop' && github.event_name == 'push' }}
# Tag with commit SHA for develop branch commits
type=sha,prefix={{branch}}-,enable=${{ github.ref == 'refs/heads/develop' }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-and-push-linesync:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-linesync
tags: |
# Tag as 'latest' for releases
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
# Tag with version for releases
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Tag as 'edge' for master branch commits
type=raw,value=edge,enable=${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
# Tag with commit SHA for master branch commits
type=sha,prefix={{branch}}-,enable=${{ github.ref == 'refs/heads/master' }}
# Tag as 'dev' for develop branch commits
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/develop' && github.event_name == 'push' }}
# Tag with commit SHA for develop branch commits
type=sha,prefix={{branch}}-,enable=${{ github.ref == 'refs/heads/develop' }}
- name: Build and push Linesync Docker image
uses: docker/build-push-action@v5
with:
context: ./tools/linesync
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

23
.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
makefile
Makefile
config.log
config.h
stamp-h
config.status
config.cache
.deps/
.project
ircu.tags
autom4te.cache
stamp-h1
include/patchlist.h
.orig
tools/sidconvert/sid2num
tools/sidconvert/num2sid
!tools/sidconvert/Makefile
.*.sw?
# iauthd-ts build artifacts
tools/iauthd-ts/dist/
tools/iauthd-ts/node_modules/
.claude/settings.local.json

10
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Ask2AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.14" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/underchat-ircd.iml" filepath="$PROJECT_DIR$/.idea/underchat-ircd.iml" />
</modules>
</component>
</project>

8
.idea/underchat-ircd.iml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.14" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

3
.mailmap Normal file
View File

@ -0,0 +1,3 @@
Matthew Beeching <jobe@mdbnet.co.uk> jobe1986 <devnull@localhost>
Matthew Beeching <jobe@mdbnet.co.uk> jobe198 <devnull@localhost>

120
CLAUDE.md Normal file
View File

@ -0,0 +1,120 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
**Nefarious IRCd** is an IRC server daemon based on ircu (the Undernet IRC daemon). This is a C codebase using GNU Autotools for building. It implements the P10 protocol and includes features like:
- Asynchronous event engines (epoll on Linux, kqueue on BSD, /dev/poll on Solaris)
- Account persistence during netsplits
- Dynamic configuration via F: (feature) lines
- SSL/TLS support for server-to-server and client connections
## Build Commands
```bash
# Configure the build
./configure --enable-debug --with-maxcon=4096
# Compile
make
# Install (by default to $HOME/bin, $HOME/lib)
make install
# Clean build artifacts
make clean
```
Configuration options can be viewed with `./configure --help`. Common options:
- `--enable-debug` - Enable debugging support
- `--with-maxcon=N` - Set maximum connections (default varies by platform)
- `--prefix=PATH` - Installation prefix (default: $HOME)
- `--libdir=PATH`, `--bindir=PATH`, `--mandir=PATH` - Specific install directories
## Docker Build
Docker support is in `tools/docker/`:
```bash
# Build Docker image
docker build -t nefarious .
# The Dockerfile:
# - Uses Debian 12 base
# - Installs build dependencies and Perl modules for iauthd
# - Runs as non-root user (UID/GID 1234)
# - Configures with --enable-debug --with-maxcon=4096
# - Removes build tools after compilation to reduce image size
```
## Configuration System
Nefarious uses a hierarchical configuration file (`ircd.conf`) with block-based syntax. The configuration format is documented in `doc/example.conf`.
### Docker Configuration
For Docker deployments, the configuration uses environment variable templating:
1. Template file: `tools/docker/base.conf-dist` contains `%VARIABLE_NAME%` placeholders
2. Entry point script: `tools/docker/dockerentrypoint.sh` substitutes environment variables via sed
3. Final config is written at container startup to `base.conf`
Required environment variables (with defaults in dockerentrypoint.sh):
- `IRCD_GENERAL_NAME` - Server name (default: localhost.localdomain)
- `IRCD_GENERAL_DESCRIPTION` - Server description
- `IRCD_GENERAL_NUMERIC` - Server numeric (0-4095, must be unique on network)
- `IRCD_ADMIN_LOCATION` - Admin location info
- `IRCD_ADMIN_CONTACT` - Admin contact info
The Docker setup uses multiple config files included by main `ircd.conf`:
- `base.conf` - Generated from base.conf-dist with variable substitution
- `local.conf` - Local server-specific settings
- `linesync.conf` - Line sync configuration
## Code Architecture
### Event Engine
Nefarious uses platform-specific event engines for efficient I/O multiplexing:
- **Linux**: `engine_epoll.c` (epoll family - most efficient)
- **FreeBSD**: `engine_kqueue.c` (kqueue)
- **Solaris**: `engine_devpoll.c` (/dev/poll)
- **Fallback**: `engine_poll.c`, `engine_select.c`
The engine is selected automatically at configure time based on platform.
### Command Handlers
IRC commands are implemented in `ircd/m_*.c` files (e.g., `m_join.c`, `m_privmsg.c`, `m_mode.c`). Each file handles one or more related IRC commands using a message table registration system.
### Core Subsystems
- **Client management**: `client.c`, `IPcheck.c` - Track connected clients and IP limits
- **Channel management**: `channel.c` - Channel state, modes, membership
- **Network I/O**: `listener.c` - Accept incoming connections; engine_*.c - Event handling
- **Protocol**: `ircd_relay.c`, `m_*.c` - P10 protocol implementation
- **Features**: `ircd_features.c` - Dynamic runtime configuration (F: lines)
- **DNS resolution**: `ircd_res.c`, `ircd_reslib.c` - Asynchronous DNS
- **Authentication**: Tools include `iauthd.pl` for external authentication
### Helper Tools
Located in `tools/`:
- `iauthd.pl` - IAuth daemon for external authentication (Perl)
- `linesync/` - Git-based configuration synchronization
- `docker/` - Docker configuration and entry point
- `convert-conf` - Convert old ircd.conf format to current format (built during make)
## Documentation
All documentation is in `doc/`:
- `example.conf` - Complete configuration file example with inline documentation
- `readme.features` - Detailed feature documentation (F: lines)
- `readme.iauth` - IAuth protocol documentation
- `p10.txt`, `p10.html` - P10 protocol specification
- `modes.txt` - Channel and user modes
- Platform-specific: `freebsd.txt`, `linux-poll.patch`
- Feature-specific: `readme.gline`, `readme.zline`, `readme.shun`, `readme.who`
## Important Notes
- Server numeric must be unique on the network and cannot be changed without restart
- Time synchronization via NTP is critical - clock skew causes serious issues
- The codebase is designed for high-performance with thousands of simultaneous connections
- SSL certificates are auto-generated by dockerentrypoint.sh if not present (ircd.pem)

11881
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

4169
ChangeLog.11 Normal file

File diff suppressed because it is too large Load Diff

3802
ChangeLog.nefarious Normal file

File diff suppressed because it is too large Load Diff

79
Dockerfile Normal file
View File

@ -0,0 +1,79 @@
FROM debian:12
ENV GID 1234
ENV UID 1234
RUN DEBIAN_FRONTEND=noninteractive RUNLEVEL=1 apt-get update
RUN DEBIAN_FRONTEND=noninteractive RUNLEVEL=1 apt-get -y install build-essential libssl-dev autoconf automake flex libpcre3-dev byacc gawk git vim procps net-tools iputils-ping bind9-host
#libgeoip-dev libmaxminddb-dev
# Perl dependencies for iauthd.pl (commented out - using TypeScript version)
#RUN DEBIAN_FRONTEND=noninteractive apt-get -y install libpoe-perl libpoe-component-client-dns-perl libterm-readkey-perl libfile-slurp-perl libtime-duration-perl
# Node.js for iauthd-ts
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install nodejs npm
RUN mkdir -p /home/nefarious/nefarious2
RUN mkdir -p /home/nefarious/ircd
COPY . /home/nefarious/nefarious2
RUN groupadd -g ${GID} nefarious
RUN useradd -u ${UID} -g ${GID} nefarious
RUN chown -R nefarious:nefarious /home/nefarious
USER nefarious
WORKDIR /home/nefarious/nefarious2
#Build and install nefarious
# maxcon bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578038 - docker build limit seems different than docker run limit
#RUN ./configure --libdir=/home/nefarious/ircd --mandir=/home/nefarious/ircd --bindir=/home/nefarious/ircd \
# I cant get the maxminddb library to compile in at all in debian 12, give up on geoip for now
# --with-geoip=/usr --with-mmdb=/usr \
RUN ./configure --libdir=/home/nefarious/ircd --enable-debug --with-maxcon=4096
RUN make
RUN touch /home/nefarious/ircd/ircd.pem && make install && rm /home/nefarious/ircd/ircd.pem
# Build iauthd-ts
WORKDIR /home/nefarious/nefarious2/tools/iauthd-ts
RUN npm install && npm run build
# Copy iauthd-ts to ircd directory
RUN cp -r /home/nefarious/nefarious2/tools/iauthd-ts/dist /home/nefarious/ircd/iauthd-ts
RUN cp /home/nefarious/nefarious2/tools/iauthd-ts/package.json /home/nefarious/ircd/iauthd-ts/
WORKDIR /home/nefarious/ircd/iauthd-ts
RUN npm install --omit=dev
WORKDIR /home/nefarious/ircd
# Symlink ircd.log to stdout so docker logs captures it
RUN ln -sf /dev/stdout /home/nefarious/ircd/ircd.log
USER root
#Clean up build
RUN rm -rf /home/nefarious/nefarious2
RUN apt-get remove -y build-essential && apt-get autoremove -y
RUN apt-get clean
USER nefarious
COPY ./tools/docker/dockerentrypoint.sh /home/nefarious/dockerentrypoint.sh
COPY ./tools/linesync/gitsync.sh /home/nefarious/ircd/gitsync.sh
# Create wrapper script for iauthd.pl that runs the Node.js version
RUN printf '#!/bin/sh\nexec node /home/nefarious/ircd/iauthd-ts/index.js "$@"\n' > /home/nefarious/ircd/iauthd.pl && \
chmod +x /home/nefarious/ircd/iauthd.pl
#ircd-docker.conf includes the other config files
COPY tools/docker/ircd-docker.conf /home/nefarious/ircd/ircd-docker.conf
COPY tools/docker/base.conf-dist /home/nefarious/ircd/base.conf-dist
COPY tools/docker/ircd.conf /home/nefarious/ircd/ircd.conf
COPY tools/docker/linesync.conf /home/nefarious/ircd/linesync.conf
ENTRYPOINT ["/home/nefarious/dockerentrypoint.sh"]
CMD ["/home/nefarious/bin/ircd", "-n", "-x", "5", "-f", "ircd-docker.conf"]

1078
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

61
INSTALL Normal file
View File

@ -0,0 +1,61 @@
ircu - INSTALL
Original by Run <carlo@runaway.xs4all.nl>,
Isomer <isomer@coders.net>, and Kev <klmitch@mit.edu>
Rewritten by Sengaia <sengaia@undernet.org>
Updated by Entrope <entrope@undernet.org>
Compiling and installing ircu should be a fairly straightforward process,
if you have obtained this software as a (.tar.gz) package, please consider
using CVS (described below). Using CVS will make updating your installation
much easier.
After obtaining the latest version of the ircu source code, change into the
source directory (ircu2.10.xx.yy), and run "./configure". To see the various
ways in which you can customize your installation, run "./configure --help".
The configure process will check your environment and prepare itself for
compiling the source code. If one or more of the prerequisites cannot be
found, configure will terminate with an error. You will need to resolve
this and run configure again.
If configure runs without error(s), you are ready to compile. To compile ircu,
run "make". Please use GNU make and gcc. If the source code does not compile,
make sure your environment is setup correctly. If you are convinced the source
of the failure is ircu, gather all relevant information about your system such
as the Architecture, OS version, the configure statement you used, etc. and
contact coder-com@undernet.org.
Once ircu is compiled, install it by running "make install".
Next, you will have to configure your IRC server by setting up your ircd.conf
file. Use the included doc/example.conf as a starting point; it is installed
in $HOME/lib/example.conf by default.
Setting up ircd.conf can be a bit tricky, so if this is your first time doing
it, begin with a bare-bones configuration and extend it as you go.
If you are upgrading from ircu2.10.11, use the ircd/convert-conf
program to convert your existing configuration file(s). It is
compiled during "make" and installed to $PREFIX/bin/convert-conf.
Good Luck!
RETRIEVING IRCU VIA CVS
The recommended way to get the ircu package now is to use CVS. CVS makes
upgrades a lot less painful and lets you get the latest package.
The first thing you need to do is login to the cvs server:
# cvs -d :pserver:anonymous@cvs.undernet.org:/cvsroot/undernet-ircu login
(we recommend that you cut and paste the above line to use it :)
When it prompts you for a password hit enter since there isn't one.
To check out the the last development version of ircu, use:
# cvs -d :pserver:anonymous@cvs.undernet.org:/cvsroot/undernet-ircu co -P ircu2.10
The latest stable version has a tag name that depends on the version
number; see doc/readme.cvs for details.
To update your source tree to the latest version, run "cvs update -dP" from within the
ircu2.10 directory. For more information, see http://coder-com.undernet.org.

169
INSTALL_FR Normal file
View File

@ -0,0 +1,169 @@
Fichier d'installation en français par delete <delete@cyberabuse.org>
Mis à jour par delete <delete@cyberabuse.org>
L'UnderNet IRC daemon.
L'installation de l'IRC daemon (ircd) existes dans les ordres que
voici:
1) Déballer le module.
2) cd dans le répertoire.
3) `./configure'
4) `make config'
5) `make install'
1) Déballer le module.
====================
La voie recommendée pour avoir le module de l'ircu est d'utilisé CVS.
CVS obtiend les marques améliore beaucoup moins douloureux et vous
laisse obtenir le dernier module.
1.1) La première chose que vous avez besoin de faire est de vous
identifiez envers le serveur.
Avec la commande que voici:
cvs -d :pserver:anonymous@cvs.undernet.org:/cvsroot/undernet-ircu login
(Nous recommandons que vous coupez et collez la ligne ci-dessus pour
l'utiliser :). Quand il insiste pour un mot de passe écriver
'anoncvs'.
1.2) Alors vous allez décider lesquels des versions vous voulez
utiliser:
stable - Ceci est la version recommandé. En cas de doute utiliser le!
Pour avoir cette version, additioner "-r u2_10_11" à la ligne de
commande du CVS.
beta - Cette version subit le test avant d'être favorisée à
ircu2.10. Il peut être buggé. L'utilisation sur le réseau de
production d'undernet est interdite, excepté certains serveurs
autorisés. La flag "-r" que vous avez besoin de regardez est documenté
sur le site web du Coder Committee's, http://coder-com.undernet.org.
alpha - C'est la version de développement. On ne le garantit pas de
compiler, et devrait être considéré FORTEMENT instable. On ne le
destine pas pour l'usage de production. Pour contrôler ce
branchement, n'employez aucun flag "-r".
Pour vérifier la version, tapez:
cvs -d :pserver:anonymous@cvs.undernet.org:/cvsroot/undernet-ircu co -P ircu2.10
Les deux lignes ci-dessus ne devraient pas avoir une entrée entre
eux. Si vous voulez utiliser un autre version, placez le flag "-r"
approprié après le "co". Ceci créera un répertoire ircu2.10, et
mettra tous les fichiers dedans.
Pour avoir la dernière version, tapez "cvs update -dP".
Pour plus d'information, regardez sur le site de coder-com à:
http://coder-com.undernet.org/
La vieille (essayé et rectifiez) méthode qui fonctionne même lorsque
le website n'est pas DoS'd (soupir) est inclue ci-dessous. En
utilisant la méthode au-dessous vous n'avez qu'à taper "cvs update -
dP" pour obtenir la dernière version.
Le nom du module est quelque chose comme `ircu2.x.y.z.tgz ', où
"x.y.z" est la version en cours (au moment de l'écriture nous avons
ircu2.10.10.pl15.(development).tgz). Vous avez besoin de `gzip', du
GNU, ouvrez la commande et uncompresser ce module. Vous pouvez
télécharger ceci de chaque site ftp GNU pour presque n'importe quel
système d'exploitation.
Si vous avez un tar GNU, taper:
tar -xzf ircu2.x.y.z.tgz
où "ircu2.x.y.z.tgz" est le nom du package.
Si sa ne marche pas, essayez:
gzip -d ircu2.x.y.z.tgz | tar -xvf ircu2.x.y.z.tar
Les deux méthodes ont comme conséquence un répertoire "ircu2.x.y.z"
dans votre répertoire actuel.
2) cd dans la directory de base.
================================
Faites à ce répertoire votre répertoire actuel en tapant:
cd ircu2.x.y.z
ou ircu2.10 si vous utilisé cvs.
Là où "ircu2.x.y.z" est le nom du répertoire dézippé.
3) "./configure"
=================
Ceci produira le 'config/setup.h', votre configuration dépend du
système d'exploitation.
Si ceci produit un message une erreur tel que "Permission Denied",
alors essai avec "chmod a+x ./configure" pour avoir la permission
d'excuter le fichier.
Pour plus d'information sur la commande configure, tapez "./configure
--help".
4) "make"
=========
Tapez:
make
dans le répertoire de base. Il devrait compiler sans erreurs ou
avertissements. Veuillez expédier n'importe quel problème aux
dévelopeurs, mais seulement après que vous vous êtes assurés ce n'est
pas une erreur de vous-même. Si vous voulez que votre système
d'exploitation soit supporté dans de futures versions, faite une
connexion qui fixe réellement le problème.
5) "make install"
=================
Type:
make install
Ceci devrait installer l'ircd et la dir man. Veuillez revérifier les
permissions du binaire.
Naturellement, vous avez besoin d'un ircd.conf syntactiquement correct
dans DPATH. Voyez les Docs pour certaine information sur ceci. Créez
également un ircd.motd avec le texte de votre MOTD. Et créez
finalement un remote.motd avec trois lignes de texte comme MOTD à
distance. Encore, tous ces fichiers devraient être lisibles par
l'ircd, et les fichiers journaux devraient être écrivable.
En cas de problème.
======================
Si vous avez des problèmes à configurer le serveur vous pourriez
considérer d'installer GNU dans votre VOIE D'ACCÈS. Dans certains cas
un cerveau-mort /bin/sh pose le problème, dans ce cas je suggère
d'installer le "bash" et de l'utiliser comme (as sh - > bash). En
conclusion, tout autre problèmes de compilent devrait être résolu
quand vous installez le GCC. Si vous avez des problemes avec le
startage du ircd, executer "./configure" encore et mettez la commande
"--enable-debug". Recompiler l'ircd, et executer-le avec:
ircd -t -x9
Cela va écrire un debug output a votre écrant, probablement avec la
cause du pourquoi il ne veut pas starter.
N'UTILISEZ PAS UN SERVEUR AVEC LA MISE AU POINT PERMISE SUR UN RÉSEAU
DE PRODUCTION. Faire ainsi est un risque d'intimité grave.
Si quelque chose ne marche pas, envoyer un e-mail à
coder-com@undernet.org

249
LICENSE Normal file
View File

@ -0,0 +1,249 @@
GNU GENERAL PUBLIC LICENSE
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:
a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
That's all there is to it!

156
Makefile.in Normal file
View File

@ -0,0 +1,156 @@
# Makefile for the Undernet IRC Daemon.
# Copyright (C) 1997, Carlo Wood <carlo@runaway.xs4all.nl>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#### Start of system configuration section. ####
prefix = @prefix@
srcdir = @srcdir@
VPATH = @srcdir@
SHELL = @SHPROG@
RM = @RMPROG@
AWK = @AWK@
@SET_MAKE@
#### End of system configuration section. ####
SUBDIRS = ircd ircd/test
IRCD_MAKEFILES = Makefile ircd/Makefile ircd/test/Makefile
all: build
.PHONY: server build depend install config update diff patch export update
# Some versions of make give a warning when this is empty:
.SUFFIXES: .dummy
build: ${IRCD_MAKEFILES}
@for i in ${SUBDIRS}; do \
echo "Building $$i..."; \
cd $$i; ${MAKE} build; cd ..; \
done
config:
@echo "*************************************************************"
@echo "* The \"make config\" step is now DEPRECATED. Most *"
@echo "* server options are now configurable via the configuration *"
@echo "* file using F-lines; the rest are specified on the command *"
@echo "* line to \"./configure\". To aid the transition, a shell *"
@echo "* script has been provided to generate the necessary *"
@echo "* configuration lines for you. You may run this script by *"
@echo "* typing \"tools/transition\"; please pay attention to its *"
@echo "* output. This message will be removed for the next major *"
@echo "* release of ircu. *"
@echo "*************************************************************"
root-clean:
@for i in '*.orig' '.*.orig' '*.rej' '.*.rej' '\#*' '*~' '.*~' '*.bak' '.*.bak' core; do\
echo "Removing $$i"; \
REMOVE_FILES="`find . -name "$$i" -print`"; \
test -n "$$REMOVE_FILES" && ${RM} -f $$REMOVE_FILES; \
done || true
sub-clean: ${IRCD_MAKEFILES}
@for i in ${SUBDIRS}; do \
echo "Cleaning $$i..."; \
cd $$i; ${MAKE} clean; cd ..;\
done
clean: root-clean sub-clean
root-distclean: root-clean
@for i in '*.rej'; do \
echo "Removing $$i"; \
REMOVE_FILES="`find . -name "$$i" -print`"; \
test -n "$$REMOVE_FILES" && ${RM} -f $$REMOVE_FILES; \
done || true
sub-distclean: ${IRCD_MAKEFILES}
@for i in ${SUBDIRS}; do \
echo "Dist-cleaning $$i..."; \
cd $$i; ${MAKE} distclean; cd ..;\
done
distclean: root-distclean sub-distclean
${RM} -f Makefile config.h config.log config.cache config.status \
stamp-h include/patchlist.h
${RM} -rf patches/marks
maintainer-clean: root-distclean ${IRCD_MAKEFILES}
@for i in ${SUBDIRS}; do \
echo "maintainer-cleaning $$i..."; \
cd $$i; ${MAKE} maintainer-clean; cd ..;\
done
depend: ${IRCD_MAKEFILES}
@for i in ${SUBDIRS}; do \
echo "Making dependencies in $$i..."; \
cd $$i; ${MAKE} depend; cd ..; \
done
install: ${IRCD_MAKEFILES}
test -d ${prefix} || mkdir ${prefix}
@for i in ${SUBDIRS}; do \
echo "Installing $$i..."; \
cd $$i; ${MAKE} install; cd ..; \
done
uninstall: ${IRCD_MAKEFILES}
@for i in ${SUBDIRS}; do \
echo "Uninstalling $$i..."; \
cd $$i; ${MAKE} uninstall; cd ..; \
done
${srcdir}/aclocal.m4: acinclude.m4
cd ${srcdir} && aclocal
${srcdir}/configure: configure.in aclocal.m4
cd ${srcdir} && autoconf
# autoheader might not change config.h.in, so touch a stamp file.
${srcdir}/config.h.in: stamp-h.in
${srcdir}/stamp-h.in: configure.in aclocal.m4 acconfig.h
cd ${srcdir} && autoheader
echo timestamp > ${srcdir}/stamp-h.in
config.h: stamp-h
stamp-h: config.h.in config.status
./config.status
Makefile: Makefile.in config.status
./config.status
ircd/Makefile: ircd/Makefile.in config.status
./config.status
ircd/test/Makefile: ircd/test/Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
# Some versions of 'make' do not support the .PHONY target :
FORCE:
# Indent all headers and source files:
indent:
@test "`indent --version`" = "GNU indent 2.1.0" || \
(echo "You need GNU indent 2.1.0; See doc/readme.indent" && exit -1);
VERSION_CONTROL=none indent include/*.h ircd/*.c
# do a cvs update
update:
cvs -z9 update

179
README Normal file
View File

@ -0,0 +1,179 @@
Welcome to Nefarious 2, the Evilnet IRC daemon
Current features include:
- A completely rewritten network event engine, which make full use
of the asynchronous event engines available in FreeBSD (kqueue)
and Solaris (/dev/poll), resulting in dramaticaly improved
performance.
- New F: (feature) lines in ircd.conf, and the GET/SET commands allow
many settings to be changed dynamically, rather than by with compile-
time configuration.
- The new "account" feature added to the P10 protocol, allows people to
remain logged in to service bots (i.e., gnuworld) during a netsplit.
This means people will not have to login again once the network rejoins.
INSTALLATION
Please see the INSTALL file for installation instructions, for hints on how to
best configure your OS for running Nefarious 2 under high load, see the various
README.<platform> files.
COMPATIBILITY
This version of Nefarious 2 will only work with servers that use the P10
protocol, some of the new features will only work between Nefarious 2 servers.
Nefarious 2 versions after March 22nd/commit b6ac7f6 are by default not
backward compatable with SSL server2server links. You must add feature
SSL_NOSSLv3 = "FALSE" until all servers are updated.
GENERAL PERFORMANCE HINTS
For platform-specific notes and hints, see the platform-specific
sections below. These notes apply to servers that will serve large
numbers (thousands) of clients simultaneously. If your server serves
a small amount of users, the defaults should work well enough.
- Run an OS that supports an asynchronous network event engine; currently
these are FreeBSD (kqueue), and Solaris (/dev/poll); possibly other BSDs
will also support kqueue. This will have a dramatic effect on performance.
- Make things as lean as possible: Make your server dedicated to Nefarious 2,
disable anything that is not neccesary, and build a custom kernel (where
possible).
- Tune kernel parameters as described in the platform-specific
sections below.
- With many clients connecting each second, Nefarious 2 will be doing lots of
DNS lookups. Make sure that the DNS server(s) in your /etc/resolv.conf are
as close as possible, or run a local caching DNS server on your IRC server.
TIME SYNCHRONIZATION
Many things can and will go horribly wrong when the clocks on the servers
on your network become (too far) out of sync. It is therefore highly
recommended that all servers run a version of ntpd that will keep their
clocks from going astray.
INFORMATION HIDING
As per undernet-admins CFV-165, this server contains code that will,
by default, hide certain information from ordinary users. If you do
not want this, override the default "HIS" feature settings in your
ircd.conf.
MORE INFORMATION
For more information on this software, see the included documentation
in the doc/ directory.
For general information on Evilnet, visit http://evilnet.github.io/
Happy IRCing!
DOCKER
Nefarious is available as a Docker image from GitHub Container Registry:
docker pull ghcr.io/evilnet/nefarious2:latest # Latest release
docker pull ghcr.io/evilnet/nefarious2:edge # Latest master branch
docker pull ghcr.io/evilnet/nefarious2:dev # Latest develop branch
Environment Variables:
IRCD_GENERAL_NAME Server name (default: localhost.localdomain)
IRCD_GENERAL_DESCRIPTION Server description (default: localhost.localdomain)
IRCD_GENERAL_NUMERIC Server numeric, must be unique on network (default: 1)
IRCD_ADMIN_LOCATION Admin location info (default: Somewhere)
IRCD_ADMIN_CONTACT Admin contact info (default: root@localhost)
Example:
docker run -d \
-p 6667:6667 \
-p 6697:6697 \
-e IRCD_GENERAL_NAME=irc.example.com \
-e IRCD_GENERAL_DESCRIPTION="My IRC Server" \
-e IRCD_GENERAL_NUMERIC=1 \
-e IRCD_ADMIN_LOCATION="New York, USA" \
-e IRCD_ADMIN_CONTACT="admin@example.com" \
ghcr.io/evilnet/nefarious2:latest
Exposed Ports:
6667 IRC (plaintext)
6697 IRC (SSL)
7000 IRC (plaintext)
4497 Server link (SSL)
9998 Services link (SSL)
16667 IRC (plaintext)
SSL certificates are auto-generated on first run if not provided.
RUNNING THIS SERVER ON LINUX
If you run Linux 2.6 or above (or 2.4 with appropriate patches), Nefarious 2
can use the epoll family of system calls for much more efficient checks of
which connections are active. Most pre-epoll systems will use 100% CPU with
2000 clients; with epoll, a server may use only a few percent of CPU with the
same load.
To handle that many connections, the ircd must be started with a high
enough file descriptor resource. Check your distribution's docs on
how to set the global and per-user limits according to your expected
load.
RUNNING THIS SERVER ON FREEBSD
When running on FreeBSD, Nefarious 2 can make use of the kqueue() event engine,
which results in much improved performance over the old poll()-based method.
kqueue is included in the more recent 4.x releases of FreeBSD.
In order for Nefarious 2 to be able to serve many clients simultaneously, you
need to increase the maximum allowable number of open files in the system. To
do this, add commands such as the following during your system's boot sequence:
sysctl -w kern.maxfiles=16384
sysctl -w kern.maxfilesperproc=16384
Unless you will be serving thousands of clients simultaneously, you will not
need to do the following, unless of course you just can't stand having a
system that is not optimized to its limits :)
Build a custom kernel: Make your kernel as lean as possible by removing all
drivers and options you will not need. The following parameters will affect
performance, they are listed with suggested values only. For more information
on what they do exactly, see FreeBSD's documentation.
maxusers 2048
options NMBCLUSTERS=65535
options ICMP_BANDLIM
Also, you may wish to run the following at system startup (from /etc/rc.local,
or whichever other method you prefer):
sysctl -w net.inet.tcp.rfc1323=1
sysctl -w net.inet.tcp.delayed_ack=0
sysctl -w net.inet.tcp.restrict_rst=1
sysctl -w kern.ipc.maxsockbuf=2097152
sysctl -w kern.ipc.somaxconn=2048
Created by Sengaia <sengaia@undernet.org>, July 20 2002.
RUNNING THIS SERVER ON SOLARIS
When running on Solaris, Nefarious 2 can make use of the /dev/poll event
engine, which results in much improved performance over the old poll()-based
method. Solaris versions 8 and 9 include /dev/poll out of the box, for Solaris
7 you will have to grab and install Patch-ID 106541-21.
In order to increase the number of clients Nefarious 2 can handle, add lines
such as the following to /etc/system:
* set hard limit on file descriptors
set rlim_fd_max = 16384
* set soft limit on file descriptors
set rlim_fd_cur = 8192
For more useful hints see http://www.sean.de/Solaris/soltune.html
Created by Sengaia <sengaia@undernet.org> on July 20, 2002.

222
RELEASE.NOTES Normal file
View File

@ -0,0 +1,222 @@
Release notes for ircu2.10.12
Last updated: 1 Sep 2005
Written by Michael Poole <mdpoole@troilus.org>
Based on earlier documents by Kev <klmitch@mit.edu> and
Braden <dbtem@yahoo.com>.
This document briefly describes changes in ircu2.10.12 relative to
ircu2.10.11. ircu2.10.12 is only compatible with servers that
implement the P10 protocol. It has been tested to link against
ircu2.10.11, but some features (notably IPv6 support and oplevels) are
not supported by ircu2.10.11.
Semantic Changes (TAKE NOTE):
Channel keys and passwords (see the "oplevels" enhancement below)
listed in a JOIN are now only checked against the corresponding
channel. In ircu2.10.11, "JOIN #a,#b key" would attempt to use "key"
as the key for both #a and #b. ircu2.10.12 will only attempt to use
it as the key for #a. ircu2.10.12's behavior matches that documented
in RFC 1459.
Enhancements:
The configuration file format has changed to one that is easier to
read. It is based on the configuration parser found in ircd-hybrid.
As usual, an example configuration file can be found in the doc
subdirectory.
ircu now supports IPv6 clients. If your operating system provides
IPv6 socket support, ircu can accept connections on IPv6 addresses.
Even if your operating system does not support IPv6 sockets, you can
link (using IPv4) to a server that has IPv6 clients, and ircu will
treat the IPv6 clients correctly.
The DNS resolver has been replaced with a streamlined version (also
from ircd-hybrid) that avoids some of the complications from using
the full libresolv or adns libraries.
The server can query an IAUTH external authorization server. The
protocol is described in doc/readme.iauth. This allows an external
program to accept or reject any client that connects to the server
and allows that external program to assign an account stamp to the
incoming user.
A new feature called "oplevels" has been added. It uses new channel
keys (+A for the administrator, +U for users) to grant chanop status
when you join using those keys. Part of this channel protection is
that you cannot be deopped in channel by someone who you opped.
A new channel mode, +D, has been added for auditorium-style channels.
These are channels where most users listen but do not speak or receive
ops or voice. The effect of +D is that the server waits to send the
JOIN message for new users until the user gets ops or voice or sends a
message to the channel. A list of join-delayed users in a channel may
be retrieved by using /NAMES -d #channel. The response to /NAMES -d
uses the same format as numeric 353, but uses numeric 355 instead. If
an op removes +D while there are still join-delayed users, the server
automatically sets mode +d, and removes +d when the last user's join
is shown. It is not possible to set channel mode +d manually; its
purpose is to warn channel users that there are "hidden" users in the
channel.
More than one hashing mechanism is now supported for oper passwords,
and a new tool (ircd/umkpasswd) is provided to generate them.
Commands that send messages to specified services may be defined in
the configuration file by using Pseudo blocks. This lets users use
commands like /X or /CHANSERV from their client, without tying the
admin to a particular arrangement or naming of services.
The /stats command accepts string identifiers in addition to
single-character identifiers. For example, "/stats access" shows the
same data as "/stats i". Supported names are shown by /stats. New
/stats options are: /stats a (nameservers), to list DNS nameservers in
use; /stats L (modules), to list loaded modules; and /stats R
(mappings), to list privmsg helper commands defined by Pseudo blocks.
By default, all of these are hidden from normal users.
Client blocks (previously I: lines), Operator blocks (previously O:
and o: lines), channel bans and silences may use CIDR notation instead
of simple wildcards. You may also have silence exceptions by putting
'~' before the mask; for example, if you wish to silence everyone
except X, you could use SILENCE *!*@*,~X!cservice@undernet.org.
The server will no longer kick "net riders" in keyed (+k) channels if
both sides of the net join have the same key.
IP masks (as used in bans, G-lines, etc) are now parsed in a more
forgiving manner. 127.0.0.0/8, 127.* and 127/8 are all accepted and
mean the same thing. Ambiguous expressions like 127/8 are interpreted
as IPv4 masks; to interpret it as an IPv6 mask, use 127:/8.
Configuration Changes:
As mentioned above, the configuration file format has changed
radically. Please consult doc/example.conf for details on the
new format. Some prominent changes follow.
The old contents of H: lines have been merged into the Connect block
that describes the peer server(s) that should be allowed to hub.
Two default virtual host addresses may be specified, one for IPv4
sockets and one for IPv6 sockets.
Nickname jupes have their own blocks, and do not share structure with
UWorld server declarations.
Operator connection classes and individual operator blocks may be
assigned privileges, rather than having them controlled globally.
Because of this, the feature settings that controlled the privileges
globally have been removed.
The maximum number of clients allowed per IP may be set in a Client
block (the equivalent of C: lines).
New feature settings (see doc/readme.features for explanations):
ANNOUNCE_INVITES, HIS_STATS_L, HIS_STATS_a, HIS_STATS_R,
LOCAL_CHANNELS, TOPIC_BURST.
Deleted features, since they had no effect even in 2.10.11: AUTOHIDE,
HIS_DESYNCS, TIMESEC.
Deleted features since they are now controlled by other configuration
entries: VIRTUAL_HOST, oper and locop privilege features.
Deleted feature since it no longer applies: HIS_STATS_h.
Compile Time Options:
A listing of supported compile-time options may be seen by running
"./configure --help". The defaults should be sane. In particular,
you should NOT compile with --enable-debug or with --disable-symbols
on a production network.
Otherwise Undocumented Features:
Despite our preferences to keep these undocumented, they are
occasionally useful, and are described here for users who may
need them.
To enable these, you need to add them to CFLAGS prior to running
./configure, usually as in: CFLAGS="-O2 -D<option>" ./configure
-DNICKLEN=20
This allows you change the maximum nick length from 15 to 20 (or
whatever number you use at the end). It MUST be the same on all
servers on your network, or bad things will happen. You should also
use the NICKLEN feature in ircd.conf.
-DNOTHROTTLE
This disables the throttling code. This is used for debugging
*only*. It lets you connect up to 255 clients from one host with no
time considerations. If this is enabled on a production server Kev will
personally drive your server into the ground. You have been warned.
Operating System and Kernel Requirements:
If you plan allowing more than 1000 clients on your server, you may
need to adjust your kernel resource limits for networking and
I/O. There are two things you will need to pay particular attention
to, the number of file descriptors available and the number of buffers
the kernel has available to read and write data to the file
descriptors.
To calculate kernel buffer requirements a good place to start is to
multiply the expected number connections expected on the machine by
the amount of data we buffer for each connection. Doubling the result
of the above calculation and dividing it by the size of the buffers
the kernel uses for I/O should give you a starting place.
The server uses 2K kernel buffers for clients, and 64K kernel buffers
for servers (actual use may be somewhat higher).
c_count - number of clients expected
c_q - number of bytes buffered for each client
s_count - number of servers expected
s_q - number of bytes buffered for each server
buffer count = (2 * (c_count * c_q + s_count * s_q)) / kernel buffer size
If the client count is 2000 and the server count is 1 (normal leaf)
and your server uses 2K as an I/O buffer size:
You need (2 * (2000 * 2048 + 1 * 65536)) / 2048 or a minimum of 4064
buffers available, if the kernel uses 512 byte buffers you will need a
minimum of 16256 kernel buffers.
These settings may be a bit light for net-breaks under full client
load you will need to experiment a bit to find the right settings for
your server.
FreeBSD --WildThang
You may want to increase your kernel resources if you want to put a
lot of clients on your machine here are a few values to start with:
CHILD_MAX=4096
OPEN_MAX=4096
FD_SETSIZE=4096
NMBCLUSTERS=8096
If you have trouble connecting *out* from your machine try:
sysctl -w net.inet.ip.portrange.last=10000
Solaris 2.6 --Tar
Increase the default hard limit for file descriptors in /etc/system:
set rlim_fd_max = 4096
The server will raise the soft limit to the hard limit.
Linux 2.2 -- [Tri]/Isomer
The kernel has a kernel destination cache size of 4096. If the kernel
sees more than 4096 IP's in 60s it warns 'dst cache overflow'. This
limit can be changed by modifying /proc/sys/net/ipv4/route/max_size.
A patch to select is also recommended if you have regular poll/select
errors.

202
acinclude.m4 Normal file
View File

@ -0,0 +1,202 @@
dnl
dnl Macro: unet_NONBLOCKING
dnl
dnl Check whether we have posix, bsd or sysv non-blocking sockets and
dnl define respectively NBLOCK_POSIX, NBLOCK_BSD or NBLOCK_SYSV.
dnl
AC_DEFUN([unet_NONBLOCKING],
[dnl Do we have posix, bsd or sysv non-blocking stuff ?
AC_CACHE_CHECK([for posix non-blocking], unet_cv_sys_nonblocking_posix,
[AC_TRY_RUN([#include <sys/types.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <signal.h>
$ac_cv_type_signal alarmed() { exit(1); }
int main(void)
{
char b[12];
struct sockaddr x;
size_t l = sizeof(x);
int f = socket(AF_INET, SOCK_DGRAM, 0);
if (f >= 0 && !(fcntl(f, F_SETFL, O_NONBLOCK)))
{
signal(SIGALRM, alarmed);
alarm(2);
recvfrom(f, b, 12, 0, &x, &l);
alarm(0);
exit(0);
}
exit(1);
}], unet_cv_sys_nonblocking_posix=yes, unet_cv_sys_nonblocking_posix=no)])
if test $unet_cv_sys_nonblocking_posix = yes; then
AC_DEFINE([NBLOCK_POSIX],,[Define if you have POSIX non-blocking sockets.])
else
AC_CACHE_CHECK([for bsd non-blocking], unet_cv_sys_nonblocking_bsd,
[AC_TRY_RUN([#include <sys/types.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <signal.h>
$ac_cv_type_signal alarmed() { exit(1); }
int main(void)
{
char b[12];
struct sockaddr x;
size_t l = sizeof(x);
int f = socket(AF_INET, SOCK_DGRAM, 0);
if (f >= 0 && !(fcntl(f, F_SETFL, O_NDELAY)))
{
signal(SIGALRM, alarmed);
alarm(2);
recvfrom(f, b, 12, 0, &x, &l);
alarm(0);
exit(0);
}
exit(1);
}], unet_cv_sys_nonblocking_bsd=yes, unet_cv_sys_nonblocking_bsd=no)])
if test $unet_cv_sys_nonblocking_bsd = yes; then
AC_DEFINE([NBLOCK_BSD],,[Define if you have BSD non-blocking sockets.])
else
AC_DEFINE([NBLOCK_SYSV],,[Define if you have SysV non-blocking sockets.])
fi
fi])
dnl
dnl Macro: unet_SIGNALS
dnl
dnl Check if we have posix signals, reliable bsd signals or
dnl unreliable sysv signals and define respectively POSIX_SIGNALS,
dnl BSD_RELIABLE_SIGNALS or SYSV_UNRELIABLE_SIGNALS.
dnl
AC_DEFUN([unet_SIGNALS],
[dnl Do we have posix signals, reliable bsd signals or unreliable sysv signals ?
AC_CACHE_CHECK([for posix signals], unet_cv_sys_signal_posix,
[AC_TRY_COMPILE([#include <signal.h>],
[sigaction(SIGTERM, (struct sigaction *)0L, (struct sigaction *)0L)],
unet_cv_sys_signal_posix=yes, unet_cv_sys_signal_posix=no)])
if test $unet_cv_sys_signal_posix = yes; then
AC_DEFINE([POSIX_SIGNALS],,[Define if you have POSIX signals.])
else
AC_CACHE_CHECK([for bsd reliable signals], unet_cv_sys_signal_bsd,
[AC_TRY_RUN([#include <signal.h>
int calls = 0;
$ac_cv_type_signal handler()
{
if (calls) return;
calls++;
kill(getpid(), SIGTERM);
sleep(1);
}
int main(void)
{
signal(SIGTERM, handler);
kill(getpid(), SIGTERM);
exit (0);
}], unet_cv_sys_signal_bsd=yes, unet_cv_sys_signal_bsd=no)])
if test $unet_cv_sys_signal_bsd = yes; then
AC_DEFINE([BSD_RELIABLE_SIGNALS],,[Define if you have (reliable) BSD signals.])
else
AC_DEFINE([SYSV_UNRELIABLE_SIGNALS],,[Define if you have (unreliable) SysV signals.])
fi
fi])
dnl
dnl Macro: unet_CHECK_TYPE_SIZES
dnl
dnl Check the size of several types and define a valid int16_t and int32_t.
dnl
AC_DEFUN([unet_CHECK_TYPE_SIZES],
[dnl Check type sizes
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(int64_t)
AC_CHECK_SIZEOF(long long)
if test "$ac_cv_sizeof_int" = 2 ; then
AC_CHECK_TYPE(int16_t, int)
AC_CHECK_TYPE(uint16_t, unsigned int)
elif test "$ac_cv_sizeof_short" = 2 ; then
AC_CHECK_TYPE(int16_t, short)
AC_CHECK_TYPE(uint16_t, unsigned short)
else
AC_MSG_ERROR([Cannot find a type with size of 16 bits])
fi
if test "$ac_cv_sizeof_int" = 4 ; then
AC_CHECK_TYPE(int32_t, int)
AC_CHECK_TYPE(uint32_t, unsigned int)
elif test "$ac_cv_sizeof_short" = 4 ; then
AC_CHECK_TYPE(int32_t, short)
AC_CHECK_TYPE(uint32_t, unsigned short)
elif test "$ac_cv_sizeof_long" = 4 ; then
AC_CHECK_TYPE(int32_t, long)
AC_CHECK_TYPE(uint32_t, unsigned long)
else
AC_MSG_ERROR([Cannot find a type with size of 32 bits])
fi
if test "$ac_cv_sizeof_int64_t" = 8 ; then
AC_CHECK_TYPE(int64_t)
AC_CHECK_TYPE(uint64_t)
elif test "$ac_cv_sizeof_long_long" = 8 ; then
AC_CHECK_TYPE(int64_t, long long)
AC_CHECK_TYPE(uint64_t, unsigned long long)
else
AC_MSG_ERROR([Cannot find a type with size of 64 bits])
fi])
dnl Written by John Hawkinson <jhawk@mit.edu>. This code is in the Public
dnl Domain.
dnl
dnl This test is for network applications that need socket() and
dnl gethostbyname() -ish functions. Under Solaris, those applications need to
dnl link with "-lsocket -lnsl". Under IRIX, they should *not* link with
dnl "-lsocket" because libsocket.a breaks a number of things (for instance:
dnl gethostbyname() under IRIX 5.2, and snoop sockets under most versions of
dnl IRIX).
dnl
dnl Unfortunately, many application developers are not aware of this, and
dnl mistakenly write tests that cause -lsocket to be used under IRIX. It is
dnl also easy to write tests that cause -lnsl to be used under operating
dnl systems where neither are necessary (or useful), such as SunOS 4.1.4, which
dnl uses -lnsl for TLI.
dnl
dnl This test exists so that every application developer does not test this in
dnl a different, and subtly broken fashion.
dnl
dnl It has been argued that this test should be broken up into two seperate
dnl tests, one for the resolver libraries, and one for the libraries necessary
dnl for using Sockets API. Unfortunately, the two are carefully intertwined and
dnl allowing the autoconf user to use them independantly potentially results in
dnl unfortunate ordering dependancies -- as such, such component macros would
dnl have to carefully use indirection and be aware if the other components were
dnl executed. Since other autoconf macros do not go to this trouble, and almost
dnl no applications use sockets without the resolver, this complexity has not
dnl been implemented.
dnl
dnl The check for libresolv is in case you are attempting to link statically
dnl and happen to have a libresolv.a lying around (and no libnsl.a).
dnl
AC_DEFUN([AC_LIBRARY_NET], [
# Most operating systems have gethostbyname() in the default searched
# libraries (i.e. libc):
AC_CHECK_FUNC(gethostbyname, ,
# Some OSes (eg. Solaris) place it in libnsl:
AC_CHECK_LIB(nsl, gethostbyname, ,
# Some strange OSes (SINIX) have it in libsocket:
AC_CHECK_LIB(socket, gethostbyname, ,
# Unfortunately libsocket sometimes depends on libnsl.
# AC_CHECK_LIB's API is essentially broken so the following
# ugliness is necessary:
AC_CHECK_LIB(socket, gethostbyname,
LIBS="-lsocket -lnsl $LIBS",
AC_CHECK_LIB(resolv, gethostbyname),
-lnsl)
)
)
)
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)))
])

37
aclocal.m4 vendored Normal file
View File

@ -0,0 +1,37 @@
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# This was merged into AC_PROG_CC in Autoconf.
AU_DEFUN([AM_PROG_CC_STDC],
[AC_PROG_CC
AC_DIAGNOSE([obsolete], [$0:
your code should no longer depend upon `am_cv_prog_cc_stdc', but upon
`ac_cv_prog_cc_stdc'. Remove this warning and the assignment when
you adjust the code. You can also remove the above call to
AC_PROG_CC if you already called it elsewhere.])
am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
])
AU_DEFUN([fp_PROG_CC_STDC])
m4_include([acinclude.m4])

1476
config.guess vendored Normal file

File diff suppressed because it is too large Load Diff

279
config.h.in Normal file
View File

@ -0,0 +1,279 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define if you have (reliable) BSD signals. */
#undef BSD_RELIABLE_SIGNALS
/* Configuration file name */
#undef CPATH
/* Enable debugging code */
#undef DEBUGMODE
/* Domain name to be used for some statistics gathering */
#undef DOMAINNAME
/* Path to data directory */
#undef DPATH
/* Define to implement epoll system calls */
#undef EPOLL_NEED_BODY
/* Force inlining for a few critical functions */
#undef FORCEINLINE
/* Path name used as a base for the GeoIP include files. */
#undef GEOIP_INCLUDES_PATH
/* Path name used as a base for the GeoIP lib files. */
#undef GEOIP_LIBS_PATH
/* Define to 1 if you have the <crypt.h> header file. */
#undef HAVE_CRYPT_H
/* Define to 1 if you have the `getrusage' function. */
#undef HAVE_GETRUSAGE
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `kqueue' function. */
#undef HAVE_KQUEUE
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define to 1 if you have the `resolv' library (-lresolv). */
#undef HAVE_LIBRESOLV
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H
/* Define to 1 if system calls automatically restart after interruption by a
signal. */
#undef HAVE_RESTARTABLE_SYSCALLS
/* Define to 1 if you have the `setrlimit' function. */
#undef HAVE_SETRLIMIT
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/devpoll.h> header file. */
#undef HAVE_SYS_DEVPOLL_H
/* Define to 1 if you have the <sys/epoll.h> header file. */
#undef HAVE_SYS_EPOLL_H
/* Define to 1 if you have the <sys/event.h> header file. */
#undef HAVE_SYS_EVENT_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the `times' function. */
#undef HAVE_TIMES
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if we have va_copy */
#undef HAVE_VA_COPY
/* Define if we have __va_copy */
#undef HAVE___VA_COPY
/* Enable IPv6 support */
#undef IPV6
/* Define if building on Solaris */
#undef IRCU_SOLARIS
/* Path to debugging log file */
#undef LPATH
/* Maximum number of network connections */
#undef MAXCONNECTIONS
/* Path name used as a base for the MaxMindDB include files. */
#undef MMDB_INCLUDES_PATH
/* Path name used as a base for the MaxMindDB lib files. */
#undef MMDB_LIBS_PATH
/* Define if you have BSD non-blocking sockets. */
#undef NBLOCK_BSD
/* Define if you have POSIX non-blocking sockets. */
#undef NBLOCK_POSIX
/* Define if you have SysV non-blocking sockets. */
#undef NBLOCK_SYSV
/* Disable assertions */
#undef NDEBUG
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Path to /dev/null */
#undef PATH_DEVNULL
/* Define if you have POSIX signals. */
#undef POSIX_SIGNALS
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of `int64_t', as computed by sizeof. */
#undef SIZEOF_INT64_T
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
/* Path to executable for restarts */
#undef SPATH
/* Path name used as a base for the ssl include files. */
#undef SSL_INCLUDES_PATH
/* Path name used as a base for the ssl lib files. */
#undef SSL_LIBS_PATH
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you have (unreliable) SysV signals. */
#undef SYSV_UNRELIABLE_SIGNALS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
/* Define to enable the /dev/poll engine */
#undef USE_DEVPOLL
/* Define to enable the epoll engine */
#undef USE_EPOLL
/* Define if you are using GeoIP */
#undef USE_GEOIP
/* Define if you are using GeoIP with *_gl() functions */
#undef USE_GEOIP_GL
/* Define to enable the kqueue engine */
#undef USE_KQUEUE
/* Define if you are using MaxMindDB */
#undef USE_MMDB
/* Specify whether or not to use poll() */
#undef USE_POLL
/* Define if you are using OpenSSL */
#undef USE_SSL
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#undef YYTEXT_POINTER
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define to `short' if <sys/types.h> does not define. */
#undef int16_t
/* Define to `long' if <sys/types.h> does not define. */
#undef int32_t
/* Define to `long long' if <sys/types.h> does not define. */
#undef int64_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* type to use in place of socklen_t if not defined */
#undef socklen_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define to `unsigned short' if <sys/types.h> does not define. */
#undef uint16_t
/* Define to `unsigned long' if <sys/types.h> does not define. */
#undef uint32_t
/* Define to `unsigned long long' if <sys/types.h> does not define. */
#undef uint64_t

1605
config.sub vendored Normal file

File diff suppressed because it is too large Load Diff

9257
configure vendored Normal file

File diff suppressed because it is too large Load Diff

949
configure.in Normal file
View File

@ -0,0 +1,949 @@
dnl Prefered emacs editing mode: -*- shell-script -*-
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright (c) 1997, by Carlo Wood <carlo@runaway.xs4all.nl>
dnl Copyright (C) 2001 Kevin L. Mitchell <klmitch@mit.edu>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 1, or (at your option)
dnl any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl $Id$
dnl Make sure we are in the correct directory (someone could have run
dnl 'configure' with a wrong '--srcdir').
AC_INIT(ircd/ircd.c)
dnl Set the default prefix
AC_PREFIX_DEFAULT([$HOME])
AC_MSG_CHECKING([for installation prefix])
AC_CACHE_VAL(unet_cv_prefix, [unet_cv_prefix=$HOME])
if test x"$prefix" != xNONE; then
unet_cv_prefix=$prefix
fi
AC_MSG_RESULT([$unet_cv_prefix])
dnl HACK WARNING: We are referencing an autoconf internal variable. This is
dnl the only way to force the prefix to be retrieved from the config.cache
dnl file!
ac_default_prefix=$unet_cv_prefix
dnl Define the input and output configuration header file.
AC_CONFIG_HEADER([config.h])
dnl Demand at least version 2.59 of autoconf (for AS_HELP_STRING)
AC_PREREQ(2.59)
dnl Find out what type of system we are
AC_CANONICAL_HOST
dnl This should be done early.
AC_PROG_CC
dnl ANSIfy the C compiler whenever possible.
AM_PROG_CC_STDC
AC_PROG_CC_C99
dnl Checks for libraries.
dnl Locate the library containing crypt
AC_SEARCH_LIBS(crypt, descrypt crypt, ,
[AC_MSG_ERROR([Unable to find library containing crypt()])])
dnl Do all the checks necessary to figure out -lnsl / -lsocket stuff
AC_LIBRARY_NET
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(crypt.h poll.h inttypes.h stdint.h sys/devpoll.h sys/epoll.h sys/event.h sys/param.h sys/resource.h sys/socket.h)
dnl Checks for typedefs, structures, and compiler characteristics
dnl AC_C_CONST
AC_C_BIGENDIAN
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_UID_T
unet_CHECK_TYPE_SIZES
AC_CHECK_TYPE(struct sockaddr_in6, [unet_have_sockaddr_in6="yes"], [unet_have_sockaddr_in6="no"], [#include <sys/types.h>
#include <netinet/in.h>])
dnl Check for socklen_t. In traditional BSD this is an int, but some
dnl OSes use a different type. Test until we find something that will
dnl work properly. Test borrowed from a patch submitted for Python.
AC_CHECK_TYPE([socklen_t], ,[
AC_MSG_CHECKING([for socklen_t equivalent])
AC_CACHE_VAL([curl_cv_socklen_t_equiv],
[
dnl Systems have either "struct sockaddr*" or "void*" as second
dnl arg to getpeername.
curl_cv_socklen_t_equiv=
for arg2 in "struct sockaddr" void ; do
for t in int size_t unsigned long "unsigned long" ; do
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>
int getpeername (int $arg2 *, $t *);],[$t len;
getpeername(0, 0, &len);], [curl_cv_socklen_t_equiv="$t"
break])
done
done
])
AC_MSG_RESULT($curl_cv_socklen_t_equiv)
AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
[type to use in place of socklen_t if not defined])],
[#include <sys/types.h>
#include<sys/socket.h>])
dnl Checks for library functions.
AC_CHECK_FUNCS([kqueue setrlimit getrusage times])
dnl Do we have restarting syscalls ?
AC_SYS_RESTARTABLE_SYSCALLS
dnl Check for required features for admins?
AC_MSG_CHECKING([for donuts])
AC_MSG_RESULT([yes])
dnl Test for programs
AC_PROG_AWK
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PATH_PROGS(RMPROG, rm, /bin/rm)
AC_PATH_PROGS(SHPROG, sh, /bin/sh)
dnl (F)LEX - needed for the new conf file parser
AC_PROG_LEX
dnl The autoconf docs say $LEX defaults to 'lex'. They lie.
if test "$LEX" = ":" ; then
AC_MSG_ERROR([Cannot find flex.])
elif echo "" | $LEX -V -v --version > /dev/null 2>&1 ; then
:
else
AC_MSG_ERROR([Cannot use $LEX as flex.])
fi
dnl YACC - ditto
AC_PROG_YACC
dnl The autoconf docs say $YACC defaults to 'yacc'. This seems to be true,
dnl but judging from AC_PROG_LEX, it may not stay true.
if test "$YACC" = ":" ; then
AC_MSG_ERROR([Cannot find yacc.])
elif echo "" | $YACC -V -v --version > /dev/null 2>&1 ; then
:
else
dnl byacc does not seem to have any way to test for workingness, so only warn.
AC_MSG_WARN([$YACC may not work as yacc.])
fi
unet_NONBLOCKING
unet_SIGNALS
dnl Check OS for os_dep files.
AC_MSG_CHECKING(for OS-dependent information)
case "$host" in
*-linux*)
AC_MSG_RESULT([Linux ($host) found.])
unet_poll_syscall=yes
;;
*-solaris*)
AC_MSG_RESULT([Solaris ($host) found.])
if test x"$ac_cv_header_poll_h" = xyes; then
unet_poll_syscall=yes
else
unet_poll_syscall=no
fi
AC_DEFINE([IRCU_SOLARIS], 1, [Define if building on Solaris])
;;
*-sunos*)
AC_MSG_RESULT([Solaris ($host) found.])
unet_poll_syscall=no
;;
*-openbsd*)
AC_MSG_RESULT([OpenBSD ($host) found.])
if test x"$ac_cv_header_poll_h" = xyes; then
unet_poll_syscall=yes
else
unet_poll_syscall=no
fi
;;
*-*bsd*)
AC_MSG_RESULT([Generic BSD ($host) found.])
if test x"$ac_cv_header_poll_h" = xyes; then
unet_poll_syscall=yes
else
unet_poll_syscall=no
fi
;;
*-darwin*)
AC_MSG_RESULT([Darwin (Mac OS X) ($host) found.])
unet_poll_syscall=no
;;
*)
AC_MSG_RESULT([Unknown system type $host found.])
AC_MSG_WARN([Unknown OS type; using generic routines.])
unet_poll_syscall=no
;;
esac
dnl Check user configuration options
dnl Start with --enable-poll
AC_MSG_CHECKING([whether to enable use of poll()])
AC_ARG_ENABLE([poll],
[ --enable-poll Force poll to be used regardless of whether or not
it is a system call],
[unet_cv_enable_poll=$enable_poll],
[AC_CACHE_VAL(unet_cv_enable_poll,
[unet_cv_enable_poll=$unet_poll_syscall])])
# Force poll to be disabled if there is no poll.h
if test x"$ac_cv_header_poll_h" != xyes; then
unet_cv_enable_poll=no
fi
AC_MSG_RESULT([$unet_cv_enable_poll])
if test x"$unet_cv_enable_poll" = xyes; then
AC_DEFINE([USE_POLL], 1, [Specify whether or not to use poll()])
ENGINE_C=engine_poll.c
else
ENGINE_C=engine_select.c
fi
AC_SUBST(ENGINE_C)
dnl Now look for --enable-debug
AC_MSG_CHECKING([whether to enable debug mode])
AC_ARG_ENABLE([debug],
[ --enable-debug Turn on debugging mode],
[unet_cv_enable_debug=$enable_debug],
[AC_CACHE_VAL(unet_cv_enable_debug,
[unet_cv_enable_debug=no])])
AC_MSG_RESULT([$unet_cv_enable_debug])
if test x"$unet_cv_enable_debug" = xyes; then
AC_DEFINE([DEBUGMODE], 1, [Enable debugging code])
fi
dnl Now look for --enable-leak-detect
AC_MSG_CHECKING([whether to enable leak detection])
AC_ARG_WITH([leak-detect],
[ --with-leak-detect Turn on the leak detector(requires patched boehm)],
[unet_cv_with_leak_detect=$with_leak_detect],
[AC_CACHE_VAL(unet_cv_with_leak_detect,
[unet_cv_with_leak_detect=no])])
AC_MSG_RESULT([$unet_cv_enable_leak_detect])
if test x"$unet_cv_with_leak_detect" != xno; then
LIBS="-lgc $LIBS"
CFLAGS="-DMDEBUG $CFLAGS"
if test x"$unet_cv_with_leak_detect" != xyes; then
LIBS="-L$unet_cv_with_leak_detect $LIBS"
fi
fi
AC_ARG_WITH([ipv6],
AS_HELP_STRING([--without-ipv6], [disable IPv6 support (default is autodetect)]),
[ac_cv_use_ipv6=$withval],
[ac_cv_use_ipv6=$unet_have_sockaddr_in6])
AC_CACHE_CHECK([whether to use IPv6], [ac_cv_use_ipv6], [ac_cv_use_ipv6=no])
if test x"$ac_cv_use_ipv6" != "xno" ; then
AC_DEFINE([IPV6], 1, [Enable IPv6 support])
fi
dnl And now for --disable-asserts
AC_MSG_CHECKING([whether to enable asserts])
AC_ARG_ENABLE([asserts],
[ --disable-asserts Disable assertion checking],
[unet_cv_enable_asserts=$enable_asserts],
[AC_CACHE_VAL(unet_cv_enable_asserts,
[unet_cv_enable_asserts=yes])])
AC_MSG_RESULT([$unet_cv_enable_asserts])
if test x"$unet_cv_enable_asserts" = xno; then
AC_DEFINE([NDEBUG], 1, [Disable assertions])
fi
dnl Now check for --enable-profile
AC_MSG_CHECKING([whether to enable profiling support (gprof)])
AC_ARG_ENABLE([profile],
[ --enable-profile Enable profiling support (add -pg to CFLAGS and LDFLAGS)],
[unet_cv_enable_profile=$enable_profile],
[AC_CACHE_VAL(unet_cv_enable_profile,
[unet_cv_enable_profile=no])])
AC_MSG_RESULT([$unet_cv_enable_profile])
if test x"$unet_cv_enable_profile" = xyes; then
CFLAGS="-pg $CFLAGS"
LDFLAGS="-pg $LDFLAGS"
fi
dnl Now check for --enable-pedantic
AC_MSG_CHECKING([whether to enable pedantic compiler warnings])
AC_ARG_ENABLE([pedantic],
[ --enable-pedantic Enable pedantic warnings (add -pedantic to CFLAGS)],
[unet_cv_enable_pedantic=$enable_pedantic],
[AC_CACHE_VAL(unet_cv_enable_pedantic,
[unet_cv_enable_pedantic=no])])
AC_MSG_RESULT([$unet_cv_enable_pedantic])
if test x"$unet_cv_enable_pedantic" = xyes; then
CFLAGS="-pedantic $CFLAGS"
fi
dnl Now check for --enable-warnings
AC_MSG_CHECKING([whether to enable compiler warnings])
AC_ARG_ENABLE([warnings],
[ --enable-warnings Enable warnings (add -Wall to CFLAGS)],
[unet_cv_enable_warnings=$enable_warnings],
[AC_CACHE_VAL(unet_cv_enable_warnings,
[unet_cv_enable_warnings=no])])
AC_MSG_RESULT([$unet_cv_enable_warnings])
if test x"$unet_cv_enable_warnings" = xyes; then
CFLAGS="-Wall $CFLAGS"
fi
dnl --disable-inlines check...
AC_MSG_CHECKING([whether to enable inlining for a few critical functions])
AC_ARG_ENABLE([inlines],
[ --disable-inlines Disable inlining for a few critical functions],
[unet_cv_enable_inlines=$enable_inlines],
[AC_CACHE_VAL(unet_cv_enable_inlines,
[unet_cv_enable_inlines=yes])])
AC_MSG_RESULT([$unet_cv_enable_inlines])
if test x"$unet_cv_enable_inlines" = xyes; then
AC_DEFINE([FORCEINLINE], 1, [Force inlining for a few critical functions])
fi
dnl --disable-devpoll check...
AC_MSG_CHECKING([whether to enable the /dev/poll event engine])
AC_ARG_ENABLE([devpoll],
[ --disable-devpoll Disable the /dev/poll-based engine],
[unet_cv_enable_devpoll=$enable_devpoll],
[AC_CACHE_VAL(unet_cv_enable_devpoll,
[unet_cv_enable_devpoll=yes])])
if test x"$ac_cv_header_sys_devpoll_h" = xno; then
unet_cv_enable_devpoll=no
fi
AC_MSG_RESULT([$unet_cv_enable_devpoll])
if test x"$unet_cv_enable_devpoll" != xno; then
AC_DEFINE([USE_DEVPOLL], 1, [Define to enable the /dev/poll engine])
ENGINE_C="engine_devpoll.c $ENGINE_C"
fi
dnl --disable-kqueue check...
AC_MSG_CHECKING([whether to enable the kqueue event engine])
AC_ARG_ENABLE([kqueue],
[ --disable-kqueue Disable the kqueue-based engine],
[unet_cv_enable_kqueue=$enable_kqueue],
[AC_CACHE_VAL(unet_cv_enable_kqueue,
[unet_cv_enable_kqueue=yes])])
if test x"$ac_cv_header_sys_event_h" = xno -o x"$ac_cv_func_kqueue" = xno; then
unet_cv_enable_kqueue=no
fi
AC_MSG_RESULT([$unet_cv_enable_kqueue])
if test x"$unet_cv_enable_kqueue" != xno; then
AC_DEFINE([USE_KQUEUE], 1, [Define to enable the kqueue engine])
ENGINE_C="engine_kqueue.c $ENGINE_C"
fi
dnl --disable-epoll check
AC_MSG_CHECKING([whether to enable the epoll event engine])
AC_ARG_ENABLE([epoll],
[ --disable-epoll Disable the epoll-based engine],
[unet_cv_enable_epoll=$enable_epoll],
[AC_CACHE_VAL(unet_cv_enable_epoll,
[unet_cv_enable_epoll=yes])])
if test x"$ac_cv_header_sys_epoll_h" = xno -o x"$ac_cv_func_epoll" = xno; then
unet_cv_enable_epoll=no
fi
AC_MSG_RESULT([$unet_cv_enable_epoll])
dnl If we have the header and user has not refused epoll, we still need
dnl to check whether the functions are properly defined.
if test x"$unet_cv_enable_epoll" != xno; then
AC_MSG_CHECKING([whether epoll functions are properly defined])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>], [epoll_create(10);])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_DEFINE([EPOLL_NEED_BODY], 1, [Define to implement epoll system calls])])
AC_DEFINE([USE_EPOLL], 1, [Define to enable the epoll engine])
ENGINE_C="engine_epoll.c $ENGINE_C"
fi
dnl How to copy one va_list to another?
AC_CACHE_CHECK([for va_copy], unet_cv_c_va_copy, [AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);])],
[unet_cv_c_va_copy="yes"],
[unet_cv_c_va_copy="no"]
)])
if test "$unet_cv_c_va_copy" = "yes" ; then
AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
fi
AC_CACHE_CHECK([for __va_copy], unet_cv_c___va_copy, [AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);])],
[unet_cv_c___va_copy="yes"],
[unet_cv_c___va_copy="no"]
)])
if test "$unet_cv_c___va_copy" = "yes" ; then
AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
fi
dnl --with-symlink lets us set the name of the symlink; defaults to "ircd"
AC_MSG_CHECKING([what name to give the symlink])
AC_ARG_WITH([symlink],
[ --with-symlink=name Name to give the symlink; if name is "no," no
symlink will be created.],
[unet_cv_with_symlink=$with_symlink],
[AC_CACHE_VAL(unet_cv_with_symlink,
[unet_cv_with_symlink="ircd"])])
if test x"$unet_cv_with_symlink" = xyes; then
unet_cv_with_symlink="ircd"
fi
AC_MSG_RESULT([$unet_cv_with_symlink])
if test x"$unet_cv_with_symlink" = xno; then
INSTALL_RULE=install-no-symlink
SYMLINK=
else
INSTALL_RULE=install-with-symlink
SYMLINK=$unet_cv_with_symlink
fi
AC_SUBST(INSTALL_RULE)
AC_SUBST(SYMLINK)
dnl --with-mode lets us set the permissions on the binary
AC_MSG_CHECKING([what permissions to set on the installed binary])
AC_ARG_WITH([mode],
[ --with-mode=mode Permissions (in octal) to give the binary],
[unet_cv_with_mode=$with_mode],
[AC_CACHE_VAL(unet_cv_with_mode,
[unet_cv_with_mode=711])])
if test x"$unet_cv_with_mode" = xyes -o x"$unet_cv_with_mode" = xno; then
unet_cv_with_mode=711
fi
AC_MSG_RESULT([$unet_cv_with_mode])
IRCDMODE=$unet_cv_with_mode
AC_SUBST(IRCDMODE)
dnl --with-owner lets us set the owner of the binary
changequote(,)dnl
unet_uid=`id | sed -e 's/.*uid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
changequote([,])dnl
AC_MSG_CHECKING([which user should own the installed binary])
AC_ARG_WITH([owner],
[ --with-owner=owner Specify owner of the installed binary],
[unet_cv_with_owner=$with_owner],
[AC_CACHE_VAL(unet_cv_with_owner,
[unet_cv_with_owner=$unet_uid])])
if test x"$unet_cv_with_owner" = xyes -o x"$unet_cv_with_owner" = xno; then
unet_cv_with_owner=$unet_uid
fi
AC_MSG_RESULT([$unet_cv_with_owner])
IRCDOWN=$unet_cv_with_owner
AC_SUBST(IRCDOWN)
dnl --with-group lets us set the group owner of the binary
changequote(,)dnl
unet_gid=`id | sed -e 's/.*gid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
changequote([,])dnl
AC_MSG_CHECKING([which group should own the installed binary])
AC_ARG_WITH([group],
[ --with-group=group Specify group owner of the installed binary],
[unet_cv_with_group=$with_group],
[AC_CACHE_VAL(unet_cv_with_group,
[unet_cv_with_group=$unet_gid])])
if test x"$unet_cv_with_group" = xyes -o x"$unet_cv_with_group" = xno; then
unet_cv_with_group=$unet_gid
fi
AC_MSG_RESULT([$unet_cv_with_group])
IRCDGRP=$unet_cv_with_group
AC_SUBST(IRCDGRP)
dnl --with-domain lets us set the domain name for some statistics-gathering
unet_domain=
if test -f /etc/resolv.conf; then
unet_domain=`awk '/^domain/ { print $2; exit }' /etc/resolv.conf`
if test x"$unet_domain" = x; then
unet_domain=`awk '/^search/ { print $2; exit }' /etc/resolv.conf`
fi
fi
AC_MSG_CHECKING([for site domain name])
AC_ARG_WITH([domain],
[ --with-domain=domain Domain name to use in local statistics gathering],
[unet_cv_with_domain=$with_domain],
[AC_CACHE_VAL(unet_cv_with_domain,
[unet_cv_with_domain=$unet_domain])])
if test x"$unet_cv_with_domain" = xyes -o x"$unet_cv_with_domain" = xno; then
unet_cv_with_domain=$unet_domain
fi
if test x"$unet_cv_with_domain" = xno; then
AC_MSG_ERROR([Unable to determine server DNS domain; use --with-domain to set it])
fi
AC_MSG_RESULT([$unet_cv_with_domain])
AC_DEFINE_UNQUOTED(DOMAINNAME, "*$unet_cv_with_domain",
[Domain name to be used for some statistics gathering])
dnl --with-chroot lets us define a directory that we are going to be using
dnl as the root of our filesystem
AC_MSG_CHECKING([if chroot operation is desired])
AC_ARG_WITH([chroot],
[ --with-chroot=dir Specify that the server will be operated under
a different root directory given by dir. See
doc/readme.chroot for more information.],
[unet_cv_with_chroot=$with_chroot],
[AC_CACHE_VAL(unet_cv_with_chroot,
[unet_cv_with_chroot=no])])
if test x"$unet_cv_with_chroot" = xyes; then
AC_MSG_ERROR([--with-chroot given with no directory. See doc/readme.chroot.])
fi
# Ensure there are no trailing /'s to mess us up
unet_cv_with_chroot=`echo "$unet_cv_with_chroot" | sed 's%/*$%%'`
AC_MSG_RESULT([$unet_cv_with_chroot])
dnl Determine some default directory names
dnl
dnl HACK WARNING: We are referencing an autoconf internal variable. This is
dnl the only way to figure out what value $prefix will have when we go to do
dnl the install--and the only way we can stick that value in our definitions
dnl of SPATH, etc.
# Deal with the annoying value "NONE" here
unet_save_prefix=$prefix
if test x"$prefix" = xNONE; then
prefix=$ac_default_prefix
else
prefix=$prefix
fi
unet_save_exec_prefix=$exec_prefix
if test x"$exec_prefix" = xNONE; then
exec_prefix=$prefix
else
exec_prefix=$exec_prefix
fi
# Obtain the actual interesting directories
unet_bindir=`eval echo "$bindir"`
unet_libdir=`eval echo "$libdir"`
# Restore the original settings of $prefix and $exec_prefix
prefix=$unet_save_prefix
exec_prefix=$unet_save_exec_prefix
dnl Now compute the name of the binary and verify that it will work under
dnl chroot operation
AC_MSG_CHECKING([where the binary will be for /restart])
if test x"$unet_cv_with_symlink" = xno; then
unet_spath="$unet_bindir/ircd"
else
unet_spath="$unet_bindir/$unet_cv_with_symlink"
fi
AC_MSG_RESULT([$unet_spath])
if test x"$unet_cv_with_chroot" != xno; then
if echo "$unet_spath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
unet_spath=`echo "$unet_spath" | sed "s%^$unet_cv_with_chroot%%"`
else
AC_MSG_WARN([Binary $unet_spath not relative to root directory $unet_cv_with_chroot; restarts will probably fail])
fi
fi
AC_DEFINE_UNQUOTED(SPATH, "$unet_spath", [Path to executable for restarts])
dnl --with-dpath sets the all-important DPATH
AC_MSG_CHECKING([what the data directory should be])
AC_ARG_WITH([dpath],
[ --with-dpath=dir Directory for all server data files],
[unet_cv_with_dpath=$with_dpath],
[AC_CACHE_VAL(unet_cv_with_dpath,
[unet_cv_with_dpath=$unet_libdir])])
if test x"$unet_cv_with_dpath" = xyes -o x"$unet_cv_with_dpath" = xno; then
unet_cv_with_dpath=$unet_libdir
fi
# Ensure there are no trailing /'s to mess us up
unet_cv_with_dpath=`echo "$unet_cv_with_dpath" | sed 's%/*$%%'`
AC_MSG_RESULT([$unet_cv_with_dpath])
if test x"$unet_cv_with_chroot" != xno; then
if echo "$unet_cv_with_dpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
unet_dpath=`echo "$unet_cv_with_dpath" | sed "s%^$unet_cv_with_chroot%%"`
else
AC_MSG_ERROR([Data directory $unet_cv_with_dpath not relative to root directory $unet_cv_with_chroot])
fi
else
unet_dpath=$unet_cv_with_dpath
fi
AC_DEFINE_UNQUOTED(DPATH, "$unet_dpath", [Path to data directory])
DPATH=$unet_cv_with_dpath
AC_SUBST(DPATH)
dnl --with-cpath allows us to specify the configuration file
AC_MSG_CHECKING([where the default configuration file resides])
AC_ARG_WITH([cpath],
[ --with-cpath=file Set server configuration file],
[unet_cv_with_cpath=$with_cpath],
[AC_CACHE_VAL(unet_cv_with_cpath,
[unet_cv_with_cpath="ircd.conf"])])
if test x"$unet_cv_with_cpath" = xyes -o x"$unet_cv_with_cpath" = xno; then
unet_cv_with_cpath="ircd.conf"
fi
AC_MSG_RESULT([$unet_cv_with_cpath])
if echo "$unet_cv_with_cpath" | grep '^/' > /dev/null 2>&1; then
# Absolute path; check against chroot stuff
if test x"$unet_cv_with_chroot" != xno; then
if echo "$unet_cv_with_cpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
unet_cpath=`echo "$unet_cv_with_cpath" | sed "s%^$unet_cv_with_chroot%%"`
else
AC_MSG_ERROR([Configuration file $unet_cv_with_cpath not relative to root directory $unet_cv_with_chroot])
fi
else
unet_cpath=$unet_cv_with_cpath
fi
else
unet_cpath=$unet_cv_with_cpath
fi
AC_DEFINE_UNQUOTED(CPATH, "$unet_cpath", [Configuration file name])
dnl --with-lpath allows us to specify the default debugging log file
AC_MSG_CHECKING([where to put the debugging log if debugging enabled])
AC_ARG_WITH([lpath],
[ --with-lpath=file Set the debugging log file],
[unet_cv_with_lpath=$with_lpath],
[AC_CACHE_VAL(unet_cv_with_lpath,
[unet_cv_with_lpath="ircd.log"])])
if test x"$unet_cv_with_lpath" = xyes -o x"$unet_cv_with_lpath" = xno; then
unet_cv_with_lpath="ircd.log"
fi
AC_MSG_RESULT([$unet_cv_with_lpath])
if echo "$unet_cv_with_lpath" | grep '^/' > /dev/null 2>&1; then
# Absolute path; check against chroot stuff
if test x"$unet_cv_with_chroot" != xno; then
if echo "$unet_cv_with_lpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
unet_lpath=`echo "$unet_cv_with_lpath" | sed "s%^$unet_cv_with_chroot%%"`
else
AC_MSG_WARN([Log file $unet_cv_with_lpath not relative to root directory $unet_cv_with_chroot; using default ircd.log instead])
unet_cv_with_lpath="ircd.log"
unet_lpath="ircd.log"
fi
else
unet_lpath=$unet_cv_with_lpath
fi
else
unet_lpath=$unet_cv_with_lpath
fi
AC_DEFINE_UNQUOTED(LPATH, "$unet_lpath", [Path to debugging log file])
dnl check for /dev/null so we can use it to hold evil fd's
AC_MSG_CHECKING([for /dev/null])
if test -c /dev/null ; then
AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null])
AC_MSG_RESULT(yes)
else
AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
AC_MSG_RESULT(no - using devnull.log)
fi
dnl **
dnl ** SSL Library checks (OpenSSL)
dnl **
AC_MSG_CHECKING([whether to enable OpenSSL support])
AC_ARG_ENABLE([ssl],
[ --disable-ssl Disable Secure Sockets Layer support],
[unet_cv_enable_ssl=$enable_ssl],
[AC_CACHE_VAL(unet_cv_enable_ssl,
[unet_cv_enable_ssl=yes])])
AC_MSG_RESULT([$unet_cv_enable_ssl])
if test x"$unet_cv_enable_ssl" = xyes; then
AC_MSG_CHECKING([for OpenSSL includes])
AC_ARG_WITH([openssl-includes],
AS_HELP_STRING([--with-openssl-includes=dir], [Specify location of OpenSSL header files (default: /usr/include)]),
[base_ssl_inc=$withval],
[base_ssl_inc=/usr/include])
[unet_cv_with_openssl_inc_prefix=$base_ssl_inc]
AC_MSG_RESULT([$unet_cv_with_openssl_inc_prefix])
AC_DEFINE_UNQUOTED(SSL_INCLUDES_PATH, "$base_ssl_inc", [Path name used as a base for the ssl include files.])
AC_MSG_CHECKING([for OpenSSL libraries])
AC_ARG_WITH([openssl-libs],
AS_HELP_STRING([--with-openssl-libs=dir], [Specify location of OpenSSL libs (default: /usr/lib)]),
[unet_cv_with_openssl_prefix=$withval],
[unet_cv_with_openssl_prefix=/usr/lib])
AC_MSG_RESULT([$unet_cv_with_openssl_prefix])
AC_DEFINE_UNQUOTED(SSL_LIBS_PATH, "$unet_cv_with_openssl_prefix", [Path name used as a base for the ssl lib files.])
save_CFLAGS=$CFLAGS
save_LIBS=$LIBS
CFLAGS="-I$unet_cv_with_openssl_inc_prefix -lcrypto"
LIBS="-Wl,-rpath=$unet_cv_with_openssl_prefix -L$unet_cv_with_openssl_prefix -lssl -lcrypto"
AC_CHECK_LIB(ssl, SSL_read, [
AC_CHECK_LIB(crypto, X509_new, [
AC_CHECK_LIB(crypto, EVP_sha256, [
AC_CHECK_HEADERS($base_ssl_inc/openssl/ssl.h $base_ssl_inc/openssl/err.h, [
enable_ssl="yes";
OPENSSL_LDFLAGS="-lssl -lcrypto"
])
])
])
])
LIBS=$save_LIBS
CFLAGS=$save_CFLAGS
if test "x$enable_ssl" = xyes; then
AC_DEFINE([USE_SSL], , [Define if you are using OpenSSL])
LIBS="$LIBS -Wl,-rpath=$unet_cv_with_openssl_prefix -L$unet_cv_with_openssl_prefix $OPENSSL_LDFLAGS"
CFLAGS="$CFLAGS -I$unet_cv_with_openssl_inc_prefix"
else
AC_MSG_ERROR([Unable to find OpenSSL, Maybe you need to install the openssl and libssl-dev package, or use --with-openssl-includes and --with-openssl-libs if you have openssl installed in an odd location])
fi
fi
dnl **
dnl ** GeoIP checks (GeoIP)
dnl **
AC_MSG_CHECKING([whether to enable GeoIP support])
AC_ARG_ENABLE([geoip],
[ --disable-geoip Disable GeoIP support],
[unet_cv_enable_geoip=$enable_geoip],
[AC_CACHE_VAL(unet_cv_enable_geoip,
[unet_cv_enable_geoip=yes])])
AC_MSG_RESULT([$unet_cv_enable_geoip])
if test x"$unet_cv_enable_geoip" = xyes; then
AC_ARG_WITH([geoip],
AS_HELP_STRING([--with-geoip=dir], [Specify the installation prefix of GeoIP (default: /usr/local)]),
[base_geoip_prefix=$withval],
[base_geoip_prefix=/usr/local])
AC_MSG_CHECKING([for GeoIP includes])
AC_ARG_WITH([geoip-includes],
AS_HELP_STRING([--with-geoip-includes=dir], [Specify location of GeoIP header files (default: /usr/local/include)]),
[base_geoip_inc=$withval],
[base_geoip_inc=$base_geoip_prefix/include])
[unet_cv_with_geoip_inc_prefix=$base_geoip_inc]
AC_MSG_RESULT([$unet_cv_with_geoip_inc_prefix])
AC_DEFINE_UNQUOTED(GEOIP_INCLUDES_PATH, "$base_geoip_inc", [Path name used as a base for the GeoIP include files.])
AC_MSG_CHECKING([for GeoIP libraries])
AC_ARG_WITH([geoip-libs],
AS_HELP_STRING([--with-geoip-libs=dir], [Specify location of GeoIP libs (default: /usr/local/lib)]),
[base_geoip_lib=$withval],
[base_geoip_lib=$base_geoip_prefix/lib])
[unet_cv_with_geoip_prefix=$base_geoip_lib]
AC_MSG_RESULT([$unet_cv_with_geoip_prefix])
AC_DEFINE_UNQUOTED(GEOIP_LIBS_PATH, "$unet_cv_with_geoip_prefix", [Path name used as a base for the GeoIP lib files.])
save_CFLAGS=$CFLAGS
save_LIBS=$LIBS
CFLAGS="-I$unet_cv_with_geoip_inc_prefix"
LIBS="-L$unet_cv_with_geoip_prefix"
AC_CHECK_HEADERS($unet_cv_with_geoip_inc_prefix/GeoIP.h, [
AC_CHECK_LIB(GeoIP, GeoIP_id_by_addr_gl, [
AC_CHECK_LIB(GeoIP, GeoIP_id_by_addr_v6_gl, [
enable_geoip="yes";
enable_geoip_gl="yes";
GEOIP_LDFLAGS="-lGeoIP"
])
], [
AC_CHECK_LIB(GeoIP, GeoIP_id_by_addr, [
AC_CHECK_LIB(GeoIP, GeoIP_id_by_addr_v6, [
enable_geoip="yes";
GEOIP_LDFLAGS="-lGeoIP"
])
])
])
])
LIBS=$save_LIBS
CFLAGS=$save_CFLAGS
if test "x$enable_geoip" = xyes; then
AC_DEFINE([USE_GEOIP], , [Define if you are using GeoIP])
if test "x$enable_geoip_gl" = xyes; then
AC_DEFINE([USE_GEOIP_GL], , [Define if you are using GeoIP with *_gl() functions])
fi
LIBS="$LIBS -L$unet_cv_with_geoip_prefix $GEOIP_LDFLAGS"
CFLAGS="$CFLAGS -I$unet_cv_with_geoip_inc_prefix"
else
AC_MSG_WARN([Unable to find GeoIP, GeoIP features will not work without libGeoIP. Disabling GeoIP support.])
fi
fi
dnl **
dnl ** MaxMindDB checks (GeoIP)
dnl **
AC_MSG_CHECKING([whether to enable MaxMindDB support])
AC_ARG_ENABLE([mmdb],
[ --disable-mmdb Disable MaxMindDB support],
[unet_cv_enable_mmdb=$enable_mmdb],
[AC_CACHE_VAL(unet_cv_enable_mmdb,
[unet_cv_enable_mmdb=yes])])
AC_MSG_RESULT([$unet_cv_enable_mmdb])
if test x"$unet_cv_enable_mmdb" = xyes; then
AC_ARG_WITH([mmdb],
AS_HELP_STRING([--with-mmdb=dir], [Specify the installation prefix of MaxMindDB (default: /usr/local)]),
[base_mmdb_prefix=$withval],
[base_mmdb_prefix=/usr/local])
AC_MSG_CHECKING([for MaxMindDB includes])
AC_ARG_WITH([mmdb-includes],
AS_HELP_STRING([--with-mmdb-includes=dir], [Specify location of MaxMindDB header files (default: /usr/local/include)]),
[base_mmdb_inc=$withval],
[base_mmdb_inc=$base_mmdb_prefix/include])
[unet_cv_with_mmdb_inc_prefix=$base_mmdb_inc]
AC_MSG_RESULT([$unet_cv_with_mmdb_inc_prefix])
AC_DEFINE_UNQUOTED(MMDB_INCLUDES_PATH, "$base_mmdb_inc", [Path name used as a base for the MaxMindDB include files.])
AC_MSG_CHECKING([for MaxMindDB libraries])
AC_ARG_WITH([mmdb-libs],
AS_HELP_STRING([--with-mmdb-libs=dir], [Specify location of MaxMindDB libs (default: /usr/local/lib)]),
[base_mmdb_lib=$withval],
[base_mmdb_lib=$base_mmdb_prefix/lib])
[unet_cv_with_mmdb_prefix=$base_mmdb_lib]
AC_MSG_RESULT([$unet_cv_with_mmdb_prefix])
AC_DEFINE_UNQUOTED(MMDB_LIBS_PATH, "$unet_cv_with_mmdb_prefix", [Path name used as a base for the MaxMindDB lib files.])
save_CFLAGS=$CFLAGS
save_LIBS=$LIBS
CFLAGS="-I$unet_cv_with_mmdb_inc_prefix"
LIBS="-L$unet_cv_with_mmdb_prefix"
AC_CHECK_HEADERS($unet_cv_with_mmdb_inc_prefix/maxminddb.h, [
AC_CHECK_LIB(maxminddb, MMDB_lookup_string, [
AC_CHECK_LIB(maxminddb, MMDB_get_value, [
enable_mmdb="yes";
MMDB_LDFLAGS="-lmaxminddb"
])
])
])
LIBS=$save_LIBS
CFLAGS=$save_CFLAGS
if test "x$enable_mmdb" = xyes; then
AC_DEFINE([USE_MMDB], , [Define if you are using MaxMindDB])
LIBS="$LIBS -L$unet_cv_with_mmdb_prefix $MMDB_LDFLAGS"
CFLAGS="$CFLAGS -I$unet_cv_with_mmdb_inc_prefix"
else
AC_MSG_WARN([Unable to find MaxMindDB, MaxMindDB features will not work without libmaxminddb. Disabling MaxMindDB support.])
fi
fi
dnl --with-maxcon allows us to set the maximum connections
unet_maxcon=`ulimit -Sn`
if test x"$unet_maxcon" = xunlimited; then
unet_maxcon=1024
fi
unet_maxcon=`expr $unet_maxcon - 4`
AC_MSG_CHECKING([max connections])
AC_ARG_WITH([maxcon],
[ --with-maxcon=maxcon Maximum number of connections server will accept],
[unet_cv_with_maxcon=$with_maxcon],
[AC_CACHE_VAL(unet_cv_with_maxcon,
[unet_cv_with_maxcon=$unet_maxcon])])
if test x"$unet_cv_with_maxcon" = xyes -o x"$unet_cv_with_maxcon" = xno; then
if test "$unet_maxcon" -lt 32; then
AC_MSG_ERROR([Maximum connections (number of open files minus 4) must be at least 32.])
fi
unet_cv_with_maxcon=$unet_maxcon
elif test "$unet_cv_with_maxcon" -lt 32; then
AC_MSG_ERROR([Maximum connections (--with-maxcon) must be at least 32.])
fi
AC_MSG_RESULT([$unet_cv_with_maxcon])
AC_DEFINE_UNQUOTED(MAXCONNECTIONS, $unet_cv_with_maxcon,
[Maximum number of network connections])
dnl Finally really generate all output files:
AC_OUTPUT(Makefile ircd/Makefile ircd/test/Makefile, [echo timestamp > stamp-h])
dnl Report configuration
AC_OUTPUT_COMMANDS([echo "
ircu is now hopefully configured for your system.
Host system: $host_os
Prefix: $prefix
Asserts: $unet_cv_enable_asserts
Warnings: $unet_cv_enable_warnings
Debug: $unet_cv_enable_debug
Profile: $unet_cv_enable_profile
Owner/mode: $unet_cv_with_owner.$unet_cv_with_group ($unet_cv_with_mode)
Chroot: $unet_cv_with_chroot
Domain: $unet_cv_with_domain
DPath: $unet_cv_with_dpath
CPath: $unet_cv_with_cpath
LPath: $unet_cv_with_lpath
Maximum connections: $unet_cv_with_maxcon
poll() engine: $unet_cv_enable_poll
kqueue() engine: $unet_cv_enable_kqueue
/dev/poll engine: $unet_cv_enable_devpoll
epoll() engine: $unet_cv_enable_epoll
"])

3
doc/.cvsignore Normal file
View File

@ -0,0 +1,3 @@
Makefile
stamp-m
doxygen

242
doc/Authors Normal file
View File

@ -0,0 +1,242 @@
/************************************************************************
* IRC - Internet Relay Chat, doc/AUTHORS
* Copyright (C) 1990
*
* AUTHORS FILE:
* This file attempts to remember all contributors to the IRC
* developement. Names can be only added this file, no name
* should never be removed. This file must be included into all
* distributions of IRC and derived works.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
IRC was conceived of and written by Jarkko Oikarinen <jto@tolsun.oulu.fi>.
IRC was originally written in University of Oulu, Computing Center.
Jan 1991 - IRC 2.6 jto@tolsun.oulu.fi
- Multiple Channels and protocol changes
Contributions were made by a cast of dozens, including the following:
Markku Jarvinen <mta@tut.fi>: Emacs-like editing facility for the client
Kimmo Suominen <kim@kannel.lut.fi>: HP-UX port
Jeff Trim <jtrim@orion.cair.du.edu>: enhancements and advice
Vijay Subramaniam <vijay@lll-winken.llnl.gov>: advice and ruthless publicity
Karl Kleinpaste <karl@cis.ohio-state.edu>: user's manual
Greg Lindahl <gl8f@virginia.edu>: AUTOMATON code, the Wumpus GM automaton,
myriad bug fixes
Bill Wisner <wisner@hayes.fai.alaska.edu>: numerous bug fixes and code
enhancements
Tom Davis <conslt16@zeus.unl.edu> and Tim Russell <russell@zeus.unl.edu>:
VMS modifications
Markku Savela <msa@tel4.tel.vtt.fi>: advice, support, and being the
incentive to do some of our *own* coding. :)
Tom Hopkins <hoppie@buengf.bu.edu>: bug fixes, quarantine lines,
consolidation of various patches.
Christopher Davis <ckd@cs.bu.edu>: EFnet/Anet gateway coding,
many automata ;), documentation fixing.
Helen Rose <hrose@cs.bu.edu>: documentation updating, and fixing.
Tom Hinds <rocker@bucsf.bu.edu>: emacs client updating.
Tim Miller <cerebus@bu-pub.bu.edu>: various server and client-breaking
features.
Darren Reed <avalon@coombs.anu.edu.au>: various bug fixes and enhancements.
Introduced nickname and channelname hash tables into the server.
The version 2.2 release was coordinated by Mike Bolotski
<mikeb@salmon.ee.ubc.ca>.
The version 2.4 release was coordinated by Markku Savela and
Chelsea Ashley Dyerman
The version 2.5.2 release was coordinated by Christopher Davis, Helen Rose,
and Tom Hopkins.
The versions 2.6.2, 2.7 and 2.8 releases were coordinated by Darren Reed.
Contributions for the 2.8 release from the following people:
Matthew Green <phone@coombs.anu.edu.au>
Chuck Kane <ckane@ece.uiuc.edu>
Matt Lyle <matt@oc.com>
Vesa Ruokonen <ruokonen@lut.fi>
Markku Savela <Markku.Savela@vtt.fi> / April 1990
Fixed various bugs in 2.2PL1 release server (2.2msa.4) and changed
sockets to use non-blocking mode (2.2msa.9). [I have absolutely
nothing to do with clients :-]
Chelsea Ashley Dyerman <chelsea@earth.cchem.berkeley.edu> / April 1990
Rewrote the Makefiles, restructuring of source tree. Added libIrcd.a to
the Makefile macros, numerous reformatting of server text messages, and
added mkversion.sh to keep track of compilation statistics. Numerous
bug fixes and enhancements, and co-coordinator of the 2.4 release.
Jarle Lyngaas (nmijl@alf.uib.no) added Note functions to ircd.
Armin Gruner <gruner@informatik.tu-muenchen.de> / May, June 1990:
* Patched KILL-line feature for ircd.conf, works now.
Enhancement: Time intervals can be specified in passwd-field.
Result: KILL-Line is only active during these intervals
* Patched PRIVMSG handling, now OPER can specify masks for sending
private messages, advantage: msg to all at a specified server or host.
* Little tests on irc 2.5 alpha, fixed some little typos in client code.
Change: common/debug.c has been moved to ircd/s_debug.c, and a
irc/c_debug.c has been created, for the benefit that wrong server msg
are displayed if client does not recognize them. (strange, if a server
sends an 'unknown command', isn't it?)
Tom Hopkins <hoppie@buengf.bu.edu> / September, October 1990:
* Patched msa's K lines for servers (Q lines).
* Consolidated several patches, including Stealth's logging patch.
* Fixed several minor bugs.
* Has done lots of other stuff that I can't seem to remember, but he
always works on code, so he has to have done alot more than three
lines worth. :)
Thanks go to those persons not mentioned here who have added their advice,
opinions, and code to IRC.
Various modifications, bugreports, cleanups and testing by:
Hugo Calendar <hugo@ucscb.ucsc.edu>
Bo Adler <adler@csvax.cs.caltech.edu>
Michael Sandrof <ms5n+@andrew.cmu.edu>
Jon Solomon <jsol@cs.bu.edu>
Jan Peterson <jlp@hamblin.math.byu.edu>
Nathan Glasser <nathan@brokaw.lcs.mit.edu>
Helen Rose <hrose@eff.org>
Mike Pelletier <stealth@caen.engin.umich.edu>
Basalat Ali Raja <gwydion@tavi.rice.edu>
Eric P. Scott <eps@toaster.sfsu.edu>
Dan Goodwin <fornax@wpi.wpi.edu>
Noah Friedman <friedman@ai.mit.edu>
UNDERNET (1991 - 1999)
--------
The Undernet versions (TSpre8, u2.9 and u2.10) are based on ircd-2.8.10 and
contain thousands of hours of work by Carlo Wood <carlo@alinoe.com>
(Run on IRC). The number of protocol enhancements, changes and additions
that have been added are too many to summarize. All patches are kept in the
cvs repository at http://coder-com.undernet.org/. Discussions on this
server code are currently on the mailing list coder-com@undernet.org, or in
#coder-com on undernet.
The current maintainer is Bleep.
Various additions and bugfixes have been contributed by:
Aaron <agifford@sci.dixie.edu>
Bleep <tomh@inxpress.net>
CaptJay <captjay@superlink.net>
CapVideo <majdi@puck.nether.net>
Chaos <simon@troll.elec.uow.edu.au>
Cym <cym@acrux.net>
Derrick <dirk@servtech.com>
Ensor <dholmes@rahul.net>
flux <cmlambertus@ucdavis.edu>
Ghostwolf <foxxe@trms.com>
Gte- <gte@atomicrevs.demon.co.uk>
Isomer <isomer@coders.net>
Jamey <woodjr@durrance.Colorado.EDU>
Jarle <jarlel@II.UIB.NO>
Kev <klmitch@mit.edu>
Nemesi <cocito@tin.it>
Niels <niels@holding.pi.net>
Run <carlo@alinoe.com>
record <jegelhof@cloud9.net>
smg <smg@lm.com>
SeKs <intru@step.polymtl.ca>
Simon- <sim@peace.netnation.com>
Starfox <starfox@quicklink.com>
Trio <trio@b62897.STUDENT.CWRU.Edu>
WildThang <dvmitche@antietam.nssl.uoknor.edu>
Xorath <vorac@wheel.dcn.davis.ca.us>
UNDERNET (2000 - 2004)
--------
The Undernet versions (P9, P10, u2.10.11 and u2.10.12) are based on
ircu2.10.07 and contain many hours of work by Coder Commitee.
The number of protocol enhancements, changes and additions
that have been added are too many to summarize. All patches are kept in the
cvs repository at http://coder-com.undernet.org/. Discussions on this
server code are currently on the mailing list coder-com@undernet.org, or in
#coder-com on undernet.
The current maintainer is Isomer.
Various additions, testings and bugfixes have been contributed by:
A1kmm <ircu_stuff@mware.virtualave.net>
Bleep <tomh@inxpress.net>
Gte- <gte@atomicrevs.demon.co.uk>
Isomer <isomer@coders.net>
Kev <klmitch@mit.edu>
Delete <delete@cyberabuse.org>
Ghostwolf <foxxe@wtfs.net>
Braden <dbtem@yahoo.com>
net <net@astrolink.org>
Steven <steven@doyle.net>
OmniDynmc <omni@dynmc.net>
Dianora <db@db.net>
Sengaia <sengaia@undernet.org>
Cyberdude <Cyberdude@undernet.org>
Maniac- <maniac@cetlink.net>
Vampire- <vampire@p16.pub.ro>
mbuna <mbuna@bugged.org>
beware <steendijk@tomaatnet.nl>
n3tguy <netguy@spidernet.net>
reed <reed@reedloden.com>
Math <math@rootservices.net>
hikari <shadow@undernet.org>
Bleep <tom.helvey@cox.net>
froo <froo@quakenet.org>
splidge <splidge@quakenet.org>
Zarjazz <zarjazz@quakenet.org>
Spike <ekips@pandora.be>
Jeekay <jeekay@netgamers.org>
Entrope <entrope@gamesurge.net>
Nefarious 2.0
--------
The AfterNET version is based on ircu2.10.12. The number of protocol
enhancements, changes and additions that have been added are too many
to summarize. All patches are kept in the git repository.
The current maintainer is Jobe
Various additions, testings, bugfixes and documentation tweaks have
been contributed by:
Jobe <jobe@mdbnet.co.uk>
Rubin <rubin@afternet.org>
Andromeda <andromeda@cerberuslabs.ca>
Obnoxious <obnoxious@binhex.org>

41
doc/Authors.nefarious Normal file
View File

@ -0,0 +1,41 @@
/************************************************************************
* IRC - Internet Relay Chat, doc/AUTHORS
* Copyright (C) 1990
*
* AUTHORS FILE:
* This file attempts to remember all contributors to the IRC
* developement. Names can be only added this file, no name
* should never be removed. This file must be included into all
* distributions of IRC and derived works.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
IRC was conceived of and written by Jarkko Oikarinen <jto@tolsun.oulu.fi>.
IRC was originally written in University of Oulu, Computing Center.
Jan 1991 - IRC 2.6 jto@tolsun.oulu.fi
- Multiple Channels and protocol changes
For a full list of the ircu contributors and authors pelase see doc/Authors
Contributions were made by a cast of dozens, including the following:
Matthew Beeching <jobe@mdbnet.co.uk>: Majority of the Nefarious 2 features
ported from Nefarious 1.
Trystan Scott <trystan@burkee.org>: Supplied a patch for a few compiler
warnings.
Alex Schumann <rubin@afternet.org>: iAuthd development and misc bug fixes.

105
doc/api/api.txt Normal file
View File

@ -0,0 +1,105 @@
This directory is intended for documents describing programming
interfaces within ircu, including such things as modebuf's and the
features interface. Please write these documents as plain text; if we
want HTML, we can write a script to convert the text versions into
HTML versions. Toward that end, I respectfully suggest everyone
conform to a common format, which I will describe here:
Every .txt file should begin with a couple of paragraphs giving an
overview of the API, its purpose, and how to use it. Paragraphs
should be separated by blank lines, as shown here. Paragraphs that do
not end in some form of punctuation, such as a period, will be treated
as section headings. The introduction ends when the first API element
appears. API element documentation is introduced with "<" followed by
the element type--"struct", "typedef", "function", "macro", or (heaven
forbid) "global", followed by ">", all on a line by itself. The next
line should contain a declaration of the element as it would appear in
a header file; this may spread across multiple lines and contain
comments and blank lines. The declaration ends for most elements when
a ";" is encountered; for macros, the declaration ends on the last
line not ending in "\".
The documentation for the API element should immediately follow the
declaration of that element, and should be separated from it by a
single blank line. This documentation should explain the purpose of
the element and describe what each of its fields mean. The
documentation ends when the corresponding "</" tag is reached, just as
in HTML or XML. (I don't intend for the files to be either HTML or
XML, I just want them to be easy to parse so they could be turned into
either, as occasion warrants.) An example follows:
<struct>
struct FooBar; /* a sample structure with no definition */
The comment, since it's on the same line as the ";", is associated
with the declaration for struct FooBar.
</struct>
<struct>
struct FooBar {
long fb_magic; /* a magic number */
char *fb_string; /* a string of some sort */
};
The sequence "};" ends the struct declaration.
</struct>
<typedef>
typedef FooBar_t; /* a simple typedef */
This element shows how to hide the inner workings of typedefs.
</typedef>
<typedef>
typedef struct FooBar FooBar_t; /* a more complex typedef */
Here we show the full typedef declaration.
</typedef>
<global>
extern int fooBarFreeList; /* global variables should be avoided */
You should avoid global variables, but if you must have one for alloc
counts or whatever, here's how to specify documentation for them.
</global>
<macro>
#define HAVE_FOOBAR /* We have FOOBAR, whatever it may be */
This could be used for boolean macros (macros used in #ifdef's, for
instance) or for simple value macros where you're hiding the values.
Since there are so many variations on macros, I'll only show one other
variation below:
</macro>
<macro>
#define FooBarVerify(foobar) ((foobar) && \
(foobar)->fb_magic == FOOBAR_STRUCT_MAGIC)
This macro takes arguments. Again, we could leave out the actual
definition, or even treat the macro as a function rather than a
macro. This also shows how to do multi-line macros.
</macro>
<function>
void *foobar(struct FooBar *blah, int flag);
Since function definitions never appear in header files anyway, we
don't have to worry about hiding information. You should leave off
"extern" in the function declaration, and please include names for the
variables, so you can refer to them in the function documentation.
</function>
The API document may then end in some summary information, if you
wish, or a ChangeLog of some form, such as follows.
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2000-12-18 Kev] Initial definition of how API documents should look.
Further entries in the changelog should *precede* this one and should
be separated from it by a blank line. Also specify your name, as
listed in the "<authors>" section, so we know who to blame ;)
</changelog>

816
doc/api/events.txt Normal file
View File

@ -0,0 +1,816 @@
The IRC server is built around an event loop. Until the u2.10.11
release, this event loop has been rather ad-hoc; timed events are
hard-coded in, signals are handled inside the signal handler, etc.
All of this has changed with u2.10.11. A new subsystem, the events
subsystem, has been introduced; the new subsystem contains a
generalization of the concept of an event. An event is a signal, the
expiration of a timer, or some form of activity on a network socket.
This new subsystem has the potential to vastly simplify the code that
is arguably the core of any network program, and makes it much simpler
to support more exotic forms of network activity monitoring than the
conventional select() and poll() calls.
The primary concepts that the events subsystem works with are the
"event," represented by a struct Event, and the "generator." There
are three types of generators: sockets, represented by struct Socket;
signals, represented by struct Signal; and timers, represented by
struct Timer. Each of these generators will be described in turn.
Signals
The signal is perhaps the simplest generator in the entire events
subsystem. Basically, instead of setting a signal handler, the
function signal_add() is called, specifying a function to be called
when a given signal is detected. Most importantly, that call-back
function is called _outside_ the context of a signal handler,
permitting the call-back to use more exotic functions that are
anathema within a signal handler, such as MyMalloc(). Once a
call-back for a signal has been established, it cannot be deleted;
this design decision was driven by the fact that ircd never changes
its signal handlers.
Whenever a signal is received, an event of type ET_SIGNAL is
generated, and that event is passed to the event call-back function
specified in the signal_add() call.
Timers
Execution of the call-back functions for a timer occur when that timer
_expires_; when a timer expires depends on the type of timer and the
expiration time that was used for that timer. A TT_ABSOLUTE timer,
for instance, expires at exactly the time given as the expiration
time. This time is a standard UNIX time_t value, measuring seconds
since the UNIX epoch. The TT_ABSOLUTE timer type is complemented by
the TT_RELATIVE timer; the time passed as its expiration time is
relative to the current time. If a TT_RELATIVE timer is given an
expiration time of 5, for instance, it will expire 5 seconds after the
present time. Internally, TT_RELATIVE timers are converted into
TT_ABSOLUTE timers, with the expiration time adjusted by addition of
the current time.
Those two types of timers, TT_ABSOLUTE and TT_RELATIVE, are
single-shot timers. Once they expire, they are removed from the timer
list unless re-added by the event call-back or through some other
mechanism. There is another type of timer, however, the TT_PERIODIC
timer, that is not removed from the timer list. TT_PERIODIC timers
are similar to TT_RELATIVE timers, in that one passes in the expire
time as a relative number of seconds, but when they expire, they are
re-added to the timer list with the same relative expire time. This
means that a TT_PERIODIC timer with an expire time of 5 seconds that
is set at 11:50:00 will have its call-back called at 11:50:05,
11:50:10, 11:50:15, and so on.
Timers have to be run by the event engines explicitly by calling
timer_run() on the generator list passed to the engine event loop.
In addition, engines may determine the next (absolute) time that a
timer needs to be run by calling the timer_next() macro; this may be
used to set a timeout on the engine's network activity monitoring
function. Engines are described in detail below.
When a timer expires, an event of ET_EXPIRE is generated, and the
call-back function is called. When a timer is destroyed, either as
the result of an expiration or as a result of an explicit timer_del()
call, an event of ET_DESTROY is generated, notifying the call-back
that the struct Timer can be deallocated.
Sockets
Perhaps the most complicated event generator in all of the event
system is the socket, as described by struct Socket. This single
classification covers datagram sockets and stream sockets. To
differentiate the different kinds of sockets, there is a socket state
associated with each socket. The available states are SS_CONNECTING,
which indicates that a particular socket is in the process of
completing a non-blocking connect(); SS_LISTENING, which indicates
that a particular socket is a listening socket; SS_CONNECTED, which is
the state of every other stream socket; SS_DATAGRAM, which is an
ordinary datagram socket, and SS_CONNECTDG, which describes a
connected datagram socket. (The SS_NOTSOCK state is for the internal
use of the events system and will not be described here.)
In addition to the socket states, there's also an event mask for each
socket; this set of flags is used to tell the events subsystem what
events the application is interested in for the socket. For
SS_CONNECTING and SS_LISTENING sockets, this events mask has no
meaning, but on the other socket states, the event mask is used to
determine if the application is interested in readable
(SOCK_EVENT_READABLE) or writable (SOCK_EVENT_WRITABLE) indications.
Most of the defined event types have to do with socket generators.
When a socket turns up readable, for instance, an event of type
ET_READ is generated. Similarly, ET_WRITE is generated when a socket
can be written to. The ET_ACCEPT event is generated when a listening
socket indicates that there is a connection to be accepted; ET_CONNECT
is generated when a non-blocking connect is completed. Finally, if an
end-of-file indication is detected, ET_EOF is generated, whereas if an
error has occurred on the socket, ET_ERROR is generated. Of course,
when a socket has been deleted by the socket_del() function, an event
of ET_DESTROY is generated when it is safe for the memory used by the
struct Socket to be reclaimed.
Events
An event, represented by a struct Event, describes in detail all of
the particulars of an event. Each event has a type, and an optional
integer piece of data may be passed with some events--in particular,
ET_SIGNAL events pass the signal number, and ET_ERROR events pass the
errno value. The struct Event also contains a pointer to the
structure describing the generated event--although it should be noted
that the only way to disambiguate which type of generator is contained
within the struct Event is by which call-back function has been
called.
All generators have a void pointer which can be used to pass important
information to the call-back, such as a pointer to a struct Client.
Additionally, generators have a reference count, and a union of a void
pointer and an integer that should only be utilized by the event
engine. Finally, there is also a field for flags, although the only
flag of concern to the application (or the engine) is the active flag,
which may be tested using the test macros described below.
Whatever the generator, the call-back function is a function returning
nothing (void) and taking as its sole argument a pointer to struct
Event. This call-back function may be implemented as a single switch
statement that calls out to appropriate external functions as needed.
Engines
Engines implement the actual socket event loop, and may also have some
means of receiving signal events. Each engine has a name, which
should describe what its core function is; for instance, the engine
based on the standard select() function is named, simply, "select()."
Each engine must implement several call-backs which are used to
initialize the engine, notify the engine of sockets the application is
interested in, etc. All of this data is described by a single struct
Engine, which should be the only non-static variable or function in
the engine's source file.
The engine's event loop, pointed to by the eng_loop field of the
struct Engine, must consist of a single while loop predicated on the
global variable _running_. Additionally, this loop's final statement
must be a call to timer_run(), to execute all timers that have become
due. Ideally, this construction should be pulled out of each engine's
eng_loop and put in the event_loop() function of the events
subsystem.
Reference Counts
As mentioned previously, all generators keep a reference count.
Should timer_del() or socket_del() be called on a generator with a
non-zero reference count, for whatever reason, the actual destruction
of the generator will be delayed until the reference count again
reaches zero. This is used by the event loop to keep sockets that it
is currently referencing from being deallocated before it is done
checking all pending events on them. To increment the reference count
by one, call gen_ref_inc() on the generator; the corresponding macro
gen_ref_dec() decrements the reference counts, and will automatically
destroy the generator if the appropriate conditions are met.
Debugging Functions
It can be difficult to debug an engines if, say, a socket state can
only be expressed as a meaningless number. Therefore, when DEBUGMODE
is #define'd, five number-to-name functions are also defined to make
the debugging data more meaningful. These functions must only be
called when DEBUGMODE is #define'd. Calling them from within Debug()
macro calls is safe; calling them from log_write() calls is not.
<typedef>
typedef void (*EventCallBack)(struct Event*);
The _EventCallBack_ type is used to simplify declaration of event
call-back functions. It is used in timer_add(), signal_add(), and
socket_add(). The event call-back should process the event, taking
whatever actions are necessary. The function should be declared as
returning void.
</typedef>
<typedef>
typedef int (*EngineInit)(int);
The _EngineInit_ function takes an integer specifying the maximum
number of sockets the event system is expecting to handle. This
number may be used by the engine initialization function for memory
allocation computations. If initialization succeeds, this function
must return 1. If initialization fails, the function should clean up
after itself and return 0. The events subsystem has the ability to
fall back upon another engine, should an engine initialization fail.
Needless to say, the engines based upon poll() and select() should
never fail in this way.
</typedef>
<typedef>
typedef void (*EngineSignal)(struct Signal*);
If an engine has the capability to directly detect signals, it should
set the eng_signal field of struct Engine non-zero. When the
application indicates interest in a particular signal, the
_EngineSignal_ function will be called with the filled-in struct
Signal, in order to register interest in that signal with the engine.
</typedef>
<typedef>
typedef int (*EngineAdd)(struct Socket*);
All engines must define an _EngineAdd_ function, which is used to
inform the engine of the application's interest in the socket. If the
new socket cannot be accommodated by the engine for whatever reason,
this function must return 0. Otherwise, the function must return 1,
informing the events subsystem that the interest has been noted.
</typedef>
<typedef>
typedef void (*EngineState)(struct Socket*, enum SocketState new_state);
Sockets can change state. SS_CONNECTING sockets, for instance, can
become SS_CONNECTED. Whenever a socket state changes, the engine is
informed, since some states require different notification procedures
than others. This is accomplished by calling the _EngineState_
function with the new state. The struct Socket passed to the engine
will still have the old state, if the engine must reference that.
</typedef>
<typedef>
typedef void (*EngineEvents)(struct Socket*, unsigned int new_events);
Applications may only be interested in given events on a socket for a
limited time. When the application's interest shifts, a new events
mask is set for the socket. The engine is informed of this change by
a call to its _EngineEvents_ function.
</typedef>
<typedef>
typedef void (*EngineDelete)(struct Socket*);
Eventually, an application will close all the sockets it has opened.
When a socket is closed, and the corresponding struct Socket deleted
with a call to socket_del(), the _EngineDelete_ function will be
called to notify the engine of the change.
</typedef>
<typedef>
typedef void (*EngineLoop)(struct Generators*);
The workhorse of the entire events subsystem is the event loop,
implemented by each engine as the _EngineLoop_ function. This
function is called with a single argument that may be passed to
timer_next() to calculate the next time a timer will expire.
</typedef>
<enum>
enum SocketState {
SS_CONNECTING, /* Connection in progress on socket */
SS_LISTENING, /* Socket is a listening socket */
SS_CONNECTED, /* Socket is a connected socket */
SS_DATAGRAM, /* Socket is a datagram socket */
SS_CONNECTDG, /* Socket is a connected datagram socket */
SS_NOTSOCK /* Socket isn't a socket at all */
};
This enumeration contains a list of all possible states a socket can
be in. Applications should not use SS_NOTSOCK; engines should treat
it as a special socket state for non-sockets. The only event that
should be watched for on a struct Socket in the SS_NOTSOCK state is
readability. This socket state is used to implement the fall-back
signal event generation.
</enum>
<enum>
enum TimerType {
TT_ABSOLUTE, /* timer that runs at a specific time */
TT_RELATIVE, /* timer that runs so many seconds in the future */
TT_PERIODIC /* timer that runs periodically */
};
The three possible timer types are defined by the TimerType
enumeration. More details can be found in the "Timers" sub-section.
</enum>
<enum>
enum EventType {
ET_READ, /* Readable event detected */
ET_WRITE, /* Writable event detected */
ET_ACCEPT, /* Connection can be accepted */
ET_CONNECT, /* Connection completed */
ET_EOF, /* End-of-file on connection */
ET_ERROR, /* Error condition detected */
ET_SIGNAL, /* A signal was received */
ET_EXPIRE, /* A timer expired */
ET_DESTROY /* The generator is being destroyed */
};
This enumeration contains all the types of events that can be
generated by the events subsystem. The first 6 are generated by
socket generators, the next by signal generators, and the next by
timer generators. ET_DESTROY is generated by both socket and timer
generators when the events subsystem is finished with the memory
allocated by both.
</enum>
<struct>
struct Socket;
This structure describes everything the events subsystem knows about a
given socket. All of its fields may be accessed through the s_*
macros described below.
</struct>
<struct>
struct Timer;
The struct Timer structure describes everything the events subsystem
knows about a given timer. Again, all of its fields may be accessed
through the t_* macros described below.
</struct>
<struct>
struct Signal;
Signal generators are described by a struct Signal. All of the fields
of a struct Signal may be accessed by the sig_* macros described
below.
</struct>
<struct>
struct Event;
Each event is described by a struct Event. Its fields may be examined
using the ev_* macros described below.
</struct>
<struct>
struct Generators;
Each engine is passed a list of all generators when the engine's
_EngineLoop_ function is called. The only valid way to access this
structure is via the timer_next() function described below.
</struct>
<struct>
struct Engine {
const char* eng_name; /* a name for the engine */
EngineInit eng_init; /* initialize engine */
EngineSignal eng_signal; /* express interest in a signal */
EngineAdd eng_add; /* express interest in a socket */
EngineState eng_state; /* mention a change in state to engine */
EngineEvents eng_events; /* express interest in socket events */
EngineDelete eng_closing; /* socket is being closed */
EngineLoop eng_loop; /* actual event loop */
};
Each engine is described by the struct Engine structure. Each engine
must define all of the functions described above except for the
_EngineSignal_ function, which is optional.
</struct>
<macro>
#define SOCK_EVENT_READABLE 0x0001 /* interested in readable */
The SOCK_EVENT_READABLE flag indicates to the engine that the
application is interested in readability on this particular socket.
</macro>
<macro>
#define SOCK_EVENT_WRITABLE 0x0002 /* interested in writable */
The SOCK_EVENT_WRITABLE flag indicates to the engine that the
application is interested in this socket being writable.
</macro>
<macro>
#define SOCK_EVENT_MASK (SOCK_EVENT_READABLE | SOCK_EVENT_WRITABLE)
SOCK_EVENT_MASK may be used to extract only the event interest flags
from an event interest set.
</macro>
<macro>
#define SOCK_ACTION_SET 0x0000 /* set interest set as follows */
When socket_events() is called with a set of event interest flags and
SOCK_ACTION_SET, the socket's event interest flags are set to those
passed into socket_events().
</macro>
<macro>
#define SOCK_ACTION_ADD 0x1000 /* add to interest set */
When SOCK_ACTION_ADD is used in a call to socket_events(), the event
interest flags passed in are added to the existing event interest
flags for the socket.
</macro>
<macro>
#define SOCK_ACTION_DEL 0x2000 /* remove from interest set */
When SOCK_ACTION_DEL is used in a call to socket_events(), the event
interest flags passed in are removed from the existing event interest
flags for the socket.
</macro>
<macro>
#define SOCK_ACTION_MASK 0x3000 /* mask out the actions */
SOCK_ACTION_MASK is used to isolate the socket action desired.
</macro>
<function>
enum SocketState s_state(struct Socket* sock);
This macro returns the state of the given socket.
</function>
<function>
unsigned int s_events(struct Socket* sock);
This macro returns the current event interest mask for a given
socket. Note that if the socket is in the SS_CONNECTING or
SS_LISTENING states, this mask has no meaning.
</function>
<function>
int s_fd(struct Socket* sock);
This macro simply returns the file descriptor for the given socket.
</function>
<function>
void* s_data(struct Socket* sock);
When a struct Socket is initialized, data that the call-back function
may find useful, such as a pointer to a struct Connection, is stored
in the struct Socket. This macro returns that pointer.
</function>
<function>
int s_ed_int(struct Socket* sock);
Engines may find it convenient to associate an integer with a struct
Socket. This macro may be used to retrieve that integer or, when used
as an lvalue, to assign a value to it. Engine data must be either an
int or a void*; use of both is prohibited.
</function>
<function>
void* s_ed_ptr(struct Socket* sock);
Engines may find it convenient to associate a void* pointer with a
struct Socket. This macro may be used to retrieve that pointer or,
when used as an lvalue, to assign a value to it. Engine data must be
either an int or a void*; use of both is prohibited.
</function>
<function>
int s_active(struct Socket* sock);
A socket's active flag is set when initialized by socket_add(), and is
cleared immediately prior to generating an event of type ET_DESTROY.
This may be used by the application to determine whether or not the
socket is still in use by the events subsystem. If it is, s_active()
returns a non-zero value; otherwise, its value is 0.
</function>
<function>
int socket_add(struct Socket* sock, EventCallBack call, void* data,
enum SocketState state, unsigned int events, int fd);
This function is called to add a socket to the list of sockets to be
monitored. The _sock_ parameter is a pointer to a struct Socket that
is allocated by the application. The _call_ parameter is a pointer to
a function to process any events on the socket. The _data_ parameter
is for use of the socket call-back and may be zero. The _state_
parameter must be one of the valid socket states. The _events_
parameter must be a valid events interest mask--0, or the binary OR of
SOCK_EVENT_READABLE or SOCK_EVENT_WRITABLE. Finally, the _fd_
parameter specifies the socket's file descriptor. This function
returns 1 if successful or 0 otherwise.
</function>
<function>
void socket_del(struct Socket* sock);
When the application is no longer interested in a particular socket,
it should call the socket_del() function. This function must be
called no later than when the socket has been closed, to avoid
attempting to call select() or similar functions on closed sockets.
</function>
<function>
void socket_state(struct Socket* sock, enum SocketState state);
Occasionally, a socket's state will change. This function is used to
inform the events subsystem of that change. Only certain state
transitions are valid--a socket in the SS_LISTENING or SS_CONNECTED
states cannot change states, nor can an SS_CONNECTING socket change to
some state other than SS_CONNECTED. Of course, SS_DATAGRAM sockets
may change state only to SS_CONNECTDG, and SS_CONNECTDG sockets may
only change states to SS_DATAGRAM.
</function>
<function>
void socket_events(struct Socket* sock, unsigned int events);
When the application changes the events it is interested in, it uses
socket_events() to notify the events subsystem of that change. The
_events_ parameter is the binary OR of one of SOCK_ACTION_SET,
SOCK_ACTION_ADD, or SOCK_ACTION_DEL with an events mask. See the
documentation for the SOCK_* macros for more information.
</function>
<function>
const char* state_to_name(enum SocketState state);
This function is defined only when DEBUGMODE is #define'd. It takes
the given _state_ and returns a string giving that state's name. This
function may safely be called from Debug() macros.
</function>
<function>
const char* sock_flags(unsigned int flags);
This function is defined only when DEBUGMODE is #define'd. It takes
the given event interest flags and returns a string naming each of
those flags. This function may safely be called from Debug() macros,
but may only be called once, since it uses function static storage to
store the flag strings.
</function>
<function>
int sig_signal(struct Signal* sig);
This macro returns the signal number for the given struct Signal.
</function>
<function>
void* sig_data(struct Signal* sig);
When a struct Signal is initialized, data that the call-back function
may find useful is stored in the struct Signal. This macro returns
that pointer.
</function>
<function>
int sig_ed_int(struct Signal* sig);
Engines may find it convenient to associate an integer with a struct
Signal. This macro may be used to retrieve that integer or, when used
as an lvalue, to assign a value to it. Engine data must be either an
int or a void*; use of both is prohibited.
</function>
<function>
void* sig_ed_ptr(struct Signal* sig);
Engines may find it convenient to associate a void* pointer with a
struct Signal. This macro may be used to retrieve that pointer or,
when used as an lvalue, to assign a value to it. Engine data must be
either an int or a void*; use of both is prohibited.
</function>
<function>
int sig_active(struct Signal* sig);
A signal's active flag is set when initialized by signal_add(). This
may be used by the application to determine whether or not the signal
has been initialized yet. If it is, sig_active() returns a non-zero
value; otherwise, its value is 0.
</function>
<function>
void signal_add(struct Signal* signal, EventCallBack call, void* data,
int sig);
This function is called to add a signal to the list of signals to be
monitored. The _signal_ parameter is a pointer is a pointer to a
struct Signal that is allocated by the application. The _call_
parameter is a pointer to a function to process any signal events.
The _data_ parameter is for use of the signal call-back and may be
zero. The _sig_ parameter is the integer value of the signal to be
monitored.
</function>
<function>
enum TimerType t_type(struct Timer* tim);
This macro returns the type of the given timer.
</function>
<function>
time_t t_value(struct Timer* tim);
This macro returns the value that was used when the given timer was
initialized by the events subsystem. It will contain an absolute time
if the timer type is TT_ABSOLUTE, and a relative time otherwise.
</function>
<function>
time_t t_expire(struct Timer* tim);
This macro returns the absolute time at which the timer will next
expire.
</function>
<function>
void* t_data(struct Timer* tim);
When a struct Timer is initialized, data that the call-back function
may find useful is stored in the struct Socket. This macro returns
that pointer.
</function>
<function>
int t_ed_int(struct Timer *tim);
Engines may find it convenient to associate an integer with a struct
Timer. This macro may be used to retrieve that integer or, when used
as an lvalue, to assign a value to it. Engine data must be either an
int or a void*; use of both is prohibited.
</function>
<function>
void* t_ed_ptr(struct Timer *tim);
Engines may find it convenient to associate a void* pointer with a
struct Timer. This macro may be used to retrieve that pointer or,
when used as an lvalue, to assign a value to it. Engine data must be
either an int or a void*; use of both is prohibited.
</function>
<function>
int t_active(struct Timer *tim);
A timer's active flag is set when initialized by timer_add(), and is
cleared immediately prior to generating an event of type ET_DESTROY.
This may be used by the application to determine whether or not the
timer is still in use by the events subsystem. If it is, s_active()
returns a non-zero value; otherwise, its value is 0.
</function>
<function>
void timer_add(struct Timer* timer, EventCallBack call, void* data,
enum TimerType type, time_t value);
This function is called to initialize and queue a timer. The _timer_
parameter is a pointer to a struct Timer that is allocated by the
application. The _call_ parameter is a pointer to a function to
process the timer's expiration. The _data_ parameter is for use of
the timer call-back and may be zero. The _type_ parameter must be one
of the valid timer types--TT_ABSOLUTE, TT_RELATIVE, or TT_PERIODIC.
Finally, _value_ is the value for the timer's expiration.
</function>
<function>
void timer_del(struct Timer* timer);
When the application no longer needs a TT_PERIODIC timer, or when it
wishes to stop a TT_ABSOLUTE or TT_RELATIVE timer before its
expiration, it should call the timer_del() function.
</function>
<function>
void timer_chg(struct Timer* timer, enum TimerType type, time_t value);
Occasionally, an application may wish to delay an existing TT_ABSOLUTE
or TT_RELATIVE timer; this may be done with the timer_chg() function.
The _type_ parameter must be one of TT_ABSOLUTE or
TT_RELATIVE--changing the values of TT_PERIODIC timers is not
supported. The _value_ parameter is the same as would be given to
timer_add() for that particular type of timer.
</function>
<function>
void timer_run(void);
When an engine has finished processing the results of its socket and
signal checks--just before it loops around to test for more events--it
should call the timer_run() function to expire any waiting timers.
</function>
<function>
time_t timer_next(struct Generators* gen);
Most engines will use a blocking call with a timeout to check for
socket activity. To determine when the next timer needs to be run,
and thus to calculate how long the call should block, the engine
should call timer_next() with the _gen_ parameter passed to the
_EngineLoop_ function. The timer_next() function returns an absolute
time, which may have to be massaged into a relative time before the
engine may use it.
</function>
<function>
const char* timer_to_name(enum TimerType type);
This function is defined only when DEBUGMODE is #define'd. It takes
the given _type_ and returns a string giving that type's name. This
function may safely be called from Debug() macros.
</function>
<function>
enum EventType ev_type(struct Event* ev);
This macro simply returns the type of the event _ev_.
</function>
<function>
int ev_data(struct Event* ev);
When an event is generated, a single integer can be passed along as a
piece of extra information. This can be used, for instance, to carry
an errno value when an ET_ERROR is generated. This macro simply
returns that integer.
</function>
<function>
struct Socket* ev_socket(struct Event* ev);
If the event was generated by a socket, this macro returns a pointer
to the struct Socket that generated the event. The results are
undefined if the event was not generated by a socket.
</function>
<function>
struct Signal* ev_signal(struct Event* ev);
If the event was generated by a signal, this macro returns a pointer
to the struct Signal that generated the event. The results are
undefined if the event was not generated by a signal.
</function>
<function>
struct Timer* ev_timer(struct Event* ev);
If the event was generated by a timer, this macro returns a pointer to
the struct Timer that generated the event. The results are undefined
if the event was not generated by a timer.
</function>
<function>
void event_init(int max_sockets);
Before any of the functions or macros described here can be called,
the events subsystem must be initialized by calling event_init(). The
_max_sockets_ parameter specifies to the events subsystem how many
sockets it must be able to support; this figure may be used for memory
allocation by the engines.
</function>
<function>
void event_loop(void);
Once the initial sockets are open, signals added, and timers queued,
the application must call the event_loop() function in order to
actually begin monitoring those sockets, signals, and timers.
</function>
<function>
void event_generate(enum EventType type, void* arg, int data);
This is the function called by the events subsystem to generate
particular events. The _type_ parameter specifies the type of event
to generate, and the _arg_ parameter must be a pointer to the event's
generator. The _data_ parameter may be used for passing such things
as signal numbers or errno values.
</function>
<function>
const char* event_to_name(enum EventType type);
This function is defined only when DEBUGMODE is #define'd. It takes
the given _type_ and returns a string giving that event type's name.
This function may safely be called from Debug() macros.
</function>
<function>
const char* engine_name(void);
This function is used to retrieve the name of the engine presently
being used by the events subsystem.
</function>
<function>
void gen_ref_inc(void* gen);
This macro increments the reference count of the generator _gen_,
preventing it from simply disappearing without warning.
</function>
<function>
void gen_ref_dec(void* gen);
This macro decrements the reference count of the generator _gen_, and
releases the memory associated with it by generating at ET_DESTROY
event if the reference count falls to zero and the generator is marked
for destruction. No references should be made to the generator after
calling this macro.
</function>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-6-14 Kev] Finished initial description of the events subsystem.
[2001-6-13 Kev] Initial description of the events subsystem.
</changelog>

230
doc/api/features.txt Normal file
View File

@ -0,0 +1,230 @@
As of u2.10.11, most of the compile-time configuration options present
in previous versions of ircu have been provided via the configuration
file as "features." This document is intended not only to give an
explanation of how to use the features subsystem in new code, but also
how to define new features.
In the ircd_features.h header file is an enum Feature that lists all
the features known to the features subsystem. The order of entries in
this list must match precisely the order of features as listed in the
features[] table in ircd_features.c. There are four kinds of
features, seven different flags that can be set for features, and
seven different call-backs for more complex features.
Types of Features
There are at present four different types of features: NONE, INT,
BOOL, and STR. Features of type "NONE" are complex features, such as
the logging subsystem, that have complicated behavior that's managed
through the use of call-backs. The call-backs available are set,
which is called to set the value of the feature; reset, which is
called to reset the value of the feature back to its default; get,
which is called to send the user a RPL_FEATURE to describe the feature
setting; unmark, which is called prior to reading the configuration
file; mark, which is called after reading the configuration file; and
report, which is used to send a user a list of RPL_STATSFLINE
replies.
In comparison to type "NONE," the other types are very simple. Type
"INT" is used for features that take an integer value; "BOOL" is for
those features that are boolean types; and "STR" is for those features
that take simple string values. The values for these feature types
are handled directly by the features subsystem, and can be examined
from code with the feature_int(), feature_bool(), and feature_str()
functions, described below. These features have a notify callback,
which is used to warn subsystems that use the values of particular
features that the value has changed.
Feature Flags
There are seven feature flags, one of which is used internally by the
feature subsystem. Three of these flags, FEAT_OPER, FEAT_MYOPER, and
FEAT_NODISP, are used to select who can see the settings of those
features; FEAT_OPER permits any operator anywhere on the network to
examine the settings of a particular feature, whereas FEAT_MYOPER only
permits operators local to a server to examine feature values, and
FEAT_NODISP prohibits display of the feature value altogether. If
none of these three flags are specified, then any user may examine
that feature's value.
Two other flags only have any meaning for string values; they are
FEAT_NULL, which is used to specify that a feature of type "STR" may
have a NULL value, and FEAT_CASE, which specifies that the feature is
case sensitive--this may be used on file names, for example. Note
that if you give "0" as the default value for a feature, you must also
set the FEAT_NULL flag.
The remaining non-internal flag is FEAT_READ, which simply sets the
feature to be read-only; a feature so marked may only be changed
through the configuration file.
Marking Features
When the configuration file is read, there must be some way to
determine if a particular Feature entry has been removed since the
last time the configuration file was read. The way this is done in
the features subsystem is to have a "mark" for each feature. Prior to
reading the configuration file, all marks are cleared for all features
(and all "unmark" call-backs are called). As each Feature entry is
encountered and processed, that feature's mark is set. Finally, when
the configuration file has been fully read, all remaining unmarked
features are reset to their default values (and all "mark" call-backs
are called).
Adding New Features
To add a new feature, first determine the feature's name (which must
begin with the string "FEAT_") and its type ("NONE," "INT," "BOOL," or
"STR"). Then add the feature to the enum Feature in an appropriate
place (i.e., it's good to group all features affecting operators
separate from those features affecting networking code), and a
corresponding entry in the features[] table in ircd_features.c. It
will be best to use one of the F_?() macros, which are documented
below. Then, whenever you need to refer to the value of a specific
feature, call the appropriate feature_<type>() function, as documented
below.
<enum>
enum Feature;
The "Feature" enum lists all of the features known to the feature
subsystem. Each feature name *must* begin with "FEAT_"; the portion
of the name following "FEAT_" will be what you use to set the feature
from the configuration file or with the "set" or "reset" commands.
</enum>
<function>
int feature_set(struct Client* from, const char* const* fields, int count);
The feature_set() function takes an array of strings and a count of
the number of strings in the array. The first string is a feature
name, and, for most features, the second string will be that feature's
value. The _from_ parameter is the struct Client describing the user
that issued the "set" command. This parameter may be NULL if
feature_set() is being called from the configuration file subsystem.
</function>
<function>
int feature_reset(struct Client* from, const char* const* fields, int count);
The feature_reset() function is very similar in arguments to the
feature_set() function, except that it may not be called from the
configuration file subsystem. It resets the named feature to its
default value.
</function>
<function>
int feature_get(struct Client* from, const char* const* fields, int count);
Again, feature_get() is very similar in arguments to the feature_set()
function, except that again it may not be called from the
configuration file subsystem. It reports the value of the named
feature to the user that issued the "get" command.
</function>
<function>
void feature_unmark(void);
This function is used to unmark all feature values, as described in
the subsection "Marking Features." It takes no arguments and returns
nothing.
</function>
<function>
void feature_mark(void);
The complement to feature_unmark(), feature_mark() resets all
unchanged feature settings to their defaults. See the subsection on
"Marking Features."
</function>
<function>
void feature_init(void);
This function initializes the feature interface by setting the default
values for all features correctly.
</function>
<function>
void feature_report(struct Client* to);
Reports all Feature entries to a user using RPL_STATSFLINE, except
those which the user is not permitted to see due to flag settings.
</function>
<function>
int feature_int(enum Feature feat);
To retrieve the values of integer features, call this function.
Calling this function on a different type of feature, such as a "BOOL"
feature, will result in an assertion failure.
</function>
<function>
int feature_bool(enum Feature feat);
This function is the complement of feature_int() for features of type
"BOOL."
</function>
<function>
const char *feature_str(enum Feature feat);
Use this function to retrieve strings values for features of type
"STR"; you may not modify nor free the string value.
</function>
<macro>
#define F_N(type, flags, set, reset, get, notify, unmark, mark, report)
This macro is used in the features[] table to simplify defining a
feature of type "NONE." The _type_ parameter is the name of the
feature excluding the "FEAT_" prefix, and MUST NOT be in
double-quotes. The _flags_ parameter may be 0, FEAT_OPER, or
FEAT_MYOPER--the bitwise OR of these two flags is permissible but
would not make sense. The rest of the arguments are pointers to
functions implementing the named call-back.
</macro>
<macro>
#define F_I(type, flags, v_int, notify)
To define integer features, use the F_I() macro. The _type_ and
_flags_ parameters are as for F_N(), and the _v_int_ parameter
specifies the default value of the feature. The _notify_ parameter,
if non-zero, will be called whenever the value of the feature changes.
</macro>
<macro>
#define F_B(type, flags, v_int, notify)
This macro is used for defining features of type "BOOL"; it is very
similar to F_I(), but _v_int_ should either 0 (for a "FALSE" value) or
1 (for a "TRUE" value). The _notify_ parameter, if non-zero, will be
called whenever the value of the feature changes.
</macro>
<macro>
#define F_S(type, flags, v_str, notify)
Also similar to F_I(), F_S() defines features of type "STR." The
_flags_ argument may be the bitwise OR of one of FEAT_OPER or
FEAT_MYOPER with the special string flags FEAT_NULL and FEAT_CASE,
which are described above in the section "Feature Flags." The
_notify_ parameter, if non-zero, will be called whenever the value of
the feature changes. Note that FEAT_NULL *must* be set if the default
string _v_str_ is set to NULL.
</macro>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-06-13 Kev] Mention notify with the other callbacks
[2001-01-02 Kev] Add documentation for new flags and for the notify
mechanism
[2000-12-18 Kev] Document the features API
</changelog>

283
doc/api/gline.txt Normal file
View File

@ -0,0 +1,283 @@
Some users can be very annoying, as any IRC operator can attest. Some
can in fact be downright abusive. Sometimes the best way of dealing
with these users is to ban them from the entire network. The G-line
system permits this.
G-lines are fairly complicated. A G-line can be active or inactive,
either locally or globally. It can be a purely local G-line, or
global. It could be based on IP address or on host name. In short,
there are many variations on the basic G-line. Worse, there is also
the concept of a "bad channel," or BADCHAN, that has been tacked onto
the G-line subsystem, when it should have been a separate command in
the first place.
Different types of G-lines are differentiated from each other through
the use of various flags. Some of these flags are maintained solely
by the G-line subsystem, where as others are passed to various
functions in the API.
<macro>
#define GLINE_MAX_EXPIRE 604800 /* max expire: 7 days */
This macro lists the maximum expire time a G-line is permitted to
have. This value is limited to 7 days to prevent abuse of the system.
</macro>
<macro>
#define GLINE_ACTIVE 0x0001
This flag is used to indicate that a given G-line is globally active.
</macro>
<macro>
#define GLINE_IPMASK 0x0002
This flag is used to indicate that a given G-line is an IP mask. This
flag is maintained internally by the G-line subsystem.
</macro>
<macro>
#define GLINE_BADCHAN 0x0004
This flag is used to indicate that a given G-line specifies a BADCHAN,
a channel that users are not permitted to join. This flag is
maintained internally, but is also used in gline_find() to search for
a BADCHAN for a particular channel.
</macro>
<macro>
#define GLINE_LOCAL 0x0008
This flag is used to indicate that a given G-line is a local G-line.
Local G-lines do not affect users on other servers.
</macro>
<macro>
#define GLINE_ANY 0x0010
This flag is passed to gline_find() to signal that function to return
any G-line or BADCHAN that matches the passed mask string. It is
never set on a real G-line.
</macro>
<macro>
#define GLINE_FORCE 0x0020
This flag is passed to gline_add() to force the server to accept an
expire time that might be out of bounds. It is never set on a real
G-line.
</macro>
<macro>
#define GLINE_EXACT 0x0040
This flag is passed to gline_find() to signal that function to return
only G-lines that exactly match the passed mask string. That is, the
ircd_strcmp() function is called to compare the G-line to the mask,
rather than the match() function. This flag is never set on a real
G-line.
</macro>
<macro>
#define GLINE_LDEACT 0x0080 /* locally deactivated */
This flag is set on global G-lines that have been locally
deactivated. This flag is maintained internally by the G-line
subsystem.
</macro>
<macro>
#define GLINE_GLOBAL 0x0100 /* find only global glines */
This flag is passed to gline_find() or gline_lookup() to specify that
the caller is only interested in global G-lines. This flag is never
set on a real G-line.
</macro>
<macro>
#define GLINE_LASTMOD 0x0200 /* find only glines with non-zero lastmod */
This flag is passed to gline_find() or gline_lookup() to specify that
the caller is only interested in G-lines with a non-zero lastmod time,
that is, G-lines that were not set by a U-lined service. This flag is
never set on a real G-line.
</macro>
<struct>
struct Gline;
The struct Gline describes everything about a given G-line. None of
its fields may be directly accessed by the application; use the
functions and macros described below instead.
</struct>
<function>
int GlineIsActive(struct Gline* g);
This macro returns a non-zero value if the G-line is active, or 0
otherwise. If a G-line is locally deactivated, this macro will always
return 0.
</function>
<function>
int GlineIsRemActive(struct Gline* g);
This macro returns a non-zero value if the G-line is active, ignoring
whether or not it is locally deactivated.
</function>
<function>
int GlineIsIpMask(struct Gline* g);
This macro returns a non-zero value if the G-line is an IP mask.
</function>
<function>
int GlineIsBadChan(struct Gline* g);
This macro returns a non-zero value if a G-line actually represents a
BADCHAN.
</function>
<function>
int GlineIsLocal(struct Gline* g);
This macro returns a non-zero value if a G-line is local only.
</function>
<function>
char* GlineUser(struct Gline* g);
This macro returns the user name associated with the G-line. If the
G-line represents a BADCHAN, this will contain the channel name.
</function>
<function>
char* GlineHost(struct Gline* g);
This macro returns the host name associated with the G-line. If the
G-line represents a BADCHAN, this will be a NULL pointer.
</function>
<function>
char* GlineReason(struct Gline* g);
This macro returns the reason that was given when the G-line was set.
</function>
<function>
time_t GlineLastMod(struct Gline* g);
G-lines that were not set by a U-lined service have a modification
time that must be monotonically increasing. This macro simply returns
that modification time.
</function>
<function>
int gline_propagate(struct Client *cptr, struct Client *sptr,
struct Gline *gline);
When a global G-line is set or modified, all other servers must be
notified of the new G-line. This function takes care of propagating
the G-line specified by _gline_, originated by the client _sptr_, to
all servers except _cptr_ (which may be a NULL pointer).
</function>
<function>
int gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
char *reason, time_t expire, time_t lastmod, unsigned int flags);
This function simply adds a G-line, set by _sptr_ and with a
_userhost_, _reason_, _expire_, and _lastmod_ as specified. The
_flags_ parameter is a bit mask consisting of the binary OR of
GLINE_FORCE, GLINE_LOCAL, or GLINE_ACTIVE, as appropriate. The
gline_add() function also calls gline_propagate() to propagate the
G-line, and kills off any local users matching the G-line if it is
active.
</function>
<function>
int gline_activate(struct Client *cptr, struct Client *sptr,
struct Gline *gline, time_t lastmod, unsigned int flags);
This function activates the G-line specified by _gline_, setting its
_lastmod_ time as specified. If _flags_ is GLINE_LOCAL and if the
G-line is locally deactivated, this function will turn off the local
deactivation flag, but will not modify _lastmod_. If the G-line is
globally deactivated, passing this function the GLINE_LOCAL flag will
have no effect.
</function>
<function>
int gline_deactivate(struct Client *cptr, struct Client *sptr,
struct Gline *gline, time_t lastmod, unsigned int flags);
This function is similar to gline_activate() except that it
deactivates the G-line. If the given G-line is local, or if it was
set by a U-lined service (and GLINE_LOCAL was not passed via _flags_),
then the G-line is deleted from memory. In all other cases, the
G-line is simply deactivated, either locally (if GLINE_LOCAL was
passed via _flags_) or globally. Global deactivation will update the
_lastmod_ time.
</function>
<function>
struct Gline *gline_find(char *userhost, unsigned int flags);
This function looks up a G-line matching the given _userhost_ value,
under control of the _flags_ parameter. Valid _flags_ that may be
passed are: GLINE_BADCHAN, GLINE_ANY, GLINE_GLOBAL, GLINE_LASTMOD, or
GLINE_EXACT, each described above.
</function>
<function>
struct Gline *gline_lookup(struct Client *cptr, unsigned int flags);
This function looks up a G-line matching the given client, specified
by _cptr_, under the control of the _flags_. Valid values for _flags_
are GLINE_GLOBAL and GLINE_LASTMOD, as described above.
</function>
<function>
void gline_free(struct Gline *gline);
This function releases all storage associated with a given G-line.
</function>
<function>
void gline_burst(struct Client *cptr);
This function generates a burst of all existing global G-lines and
BADCHANs and sends them to the server specified by _cptr_.
</function>
<function>
int gline_resend(struct Client *cptr, struct Gline *gline);
This function resends the _gline_ to a server specified by _cptr_.
This may be used if, for instance, it is discovered that a server is
not synchronized with respect to a particular G-line.
</function>
<function>
int gline_list(struct Client *sptr, char *userhost);
This function sends the information about a G-line matching _userhost_
to the client specified by _sptr_. If _userhost_ is a NULL pointer, a
list of all G-lines is sent.
</function>
<function>
void gline_stats(struct Client *sptr);
This function generates a list of all G-lines, sending them to the
user _sptr_ by a /STATS G response.
</function>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-6-15 Kev] Initial documentation for the G-line API.
</changelog>

268
doc/api/ircd_snprintf.txt Normal file
View File

@ -0,0 +1,268 @@
These functions are intended to be a complete replacement for sprintf
and sprintf_irc. They are a (nearly) complete reimplementation, and
of course they're snprintf clones, making it more difficult for
accidental buffer overflows to crop up.
First off, what's missing? These functions support all ANSI C
conversion specifiers and selected ones from ISO 9x, with the
exception of all floating-point conversions. The floating-point
conversions are tricky, and will likely be dependent on the
representation of a floating-point number on a particular
architecture. While that representation is likely to conform to some
standard, it is not currently used in ircu, so seemed like a good
thing to omit, given the difficulty of implementing it.
There are two more things missing from this implementation that would
be required by ANSI; the first is support for multibyte character
strings, and the second is support for locales, neither of which have
any relevance for ircu, so again omission seemed to be a good policy.
Additionally, %#x always causes '0x' (or '0X') to be printed, even if
the number is zero.
These functions also have some extensions not seen in a
standards-compliant implementation; technically, the ISO 9x extensions
fall into this category, for instance. The ISO 9x extensions
supported are type extensions--%ju, %tu, and %zu, for instance; %qu
and %hhu are also supported. The extensions added for use in ircu are
%Tu, which takes a time_t, and the new %C conversion, which inserts
either a numeric or a nick, dependent on the <dest> parameter. The
GNU %m extension, which inserts the strerror() string corresponding to
the current value of errno, is also supported, as is a special %v
extension, which essentially does a recursive call to ircd_snprintf.
The following description is descended from the Linux man page for the
printf family of functions.
The format string is composed of zero or more directives: ordinary
characters (not %), which are copied unchanged to the output stream;
and conversion specifications, each of which results in fetching zero
or more subsequent arguments. Each conversion specification is
introduced by the character %. The arguments must correspond properly
(after type promotion) with the conversion specifier. After the %,
the following appear in sequence:
* Zero or more of the following flags:
# specifying that the value should be converted to an "alternate
form." For c, d, i, n, p, s, and u conversions, this option
has no effect. For o conversions, the precision of the number
is increased to force the first character of the output string
to a zero (except if a zero value is printed with an explicit
precision of zero). For x and X conversions, the string '0x'
(or '0X' for X conversions) is prepended to it. For e, E, f,
g, and G conversions, the result will always contain a decimal
point, even if no digits follow it (normally, a decimal point
appears in the results of those conversions only if a digit
follows). For g and G conversions, trailing zeros are not
removed from the result as they would otherwise be. For C
conversions, if the destination is local and the origin is a
user, the nick!user@host form is used.
0 specifying zero padding. For all conversions except n, the
converted value is padded on the left with zeros rather than
blanks. If a precision is given with a numeric conversion (d,
i, o, u, i, x, and X), the 0 flag is ignored.
- (a negative field width flag) indicates the converted value is
to be left adjusted on the field boundary. Except for n
conversions, the converted value is padded on the right with
blanks, rather than on the left with blanks or zeros. A -
overrides a 0 if both are given.
' ' (a space) specifying that a blank should be left before a
positive number produced by a signed conversion (d, e, E, f,
g, G, or i).
+ specifying that a sign always be placed before a number
produced by a signed conversion. A + overrides a space if
both are used.
: specifying that a struct Client name should be preceded by a
':' character if the destination is a user
* An optional decimal digit string specifying a minimum field width.
If the converted value has fewer characters than the field width, it
will be padded with spaces on the left (or right, if the
left-adjustment flag has been given) to fill out the field width.
* An optional precision, in the form of a period (`.') followed by an
optional digit string. If the digit string is omitted, the
precision is taken as zero. This gives the minimum number of digits
to appear for d, i, o, u, x, and X conversions, the number of digits
to appear after the decimal-point for e, E, and f conversions, the
maximum number of significant digits for g and G conversions, or the
maximum number of characters to be printed from a string for s
conversions.
* The optional character h, specifying that a following d, i, o, u, x,
or X conversion corresponds to a short int or unsigned short int
argument, or that a following n conversion corresponds to a pointer
to a short int argument. If the h character is given again, char is
used instead of short int.
* The optional character l (ell) specifying that a following d, i, o,
u, x, or X conversion applies to a pointer to a long int or unsigned
long int argument, or that a following n conversion corresponds to a
pointer to a long int argument.
* The character L specifying that a following e, E, f, g, or G
conversion corresponds to a long double argument, or a following d,
i, o, u, x, or X conversion corresponds to a long long argument.
Note that long long is not specified in ANSI C and therefore not
portable to all architectures.
* The optional character q. This is equivalent to L.
* A j character specifying that the following integer (d, i, o, u, x,
or X) conversion corresponds to an intmax_t argument.
* A t character specifying that the following integer (d, i, o, u, x,
or X) conversion corresponds to a ptrdiff_t argument.
* A z character specifying that the following integer (d, i, o, u, x,
or X) conversion corresponds to a size_t argument.
* A T character specifying that the following integer (d, i, o, u, x,
or X) conversion corresponds to a time_t argument.
* A character that specifies the type of conversion to be applied.
A field width or precision, or both, may be indicated by an asterisk
`*' instead of a digit string. In this case, an int argument supplies
the field width or precision. A negative field width is treated as a
left adjustment flag followed by a positive field width; a negative
precision is treated as though it were missing.
The conversion specifiers and their meanings are:
diouxX The int (or appropriate variant) argument is converted
to signed decimal (d and i), unsigned octal (o),
unsigned decimal (u), or unsigned hexadecimal (x and
X) notation. The letters abcdef are used for x
conversions; the letters ABCDEF are used for X
conversions. The precision, if any, gives the minimum
number of digits that must appear; if the converted
value requires fewer digits, it is padded on the left
with zeros.
eE [NOT IMPLEMENTED] The double argument is rounded and
converted in the style [-]d.dddedd where there is one
digit before the decimal-point character and the
number of digits after it is equal to the precision;
if the precision is missing, it is taken as 6; if the
precision is zero, no decimal-point character
appears. An E conversion uses the letter E (rather
than e) to introduce the exponent. The exponent
always contains at least two digits; if the value is
zero, the exponent is 00.
f [NOT IMPLEMENTED] The double argument is rounded and
converted to decimal notation in the style
[-]ddd.ddd, where the number of digits after the
decimal-point character is equal to the precision
specification. If the precision is missing, it is
taken as 6; if the precision is explicitly zero, no
decimal-point character appears. If a decimal point
appears, at least one digit appears before it.
g [NOT IMPLEMENTED] The double argument is converted in
style f or e (or E for G conversions). The precision
specifies the number of significant digits. If the
precision is missing, 6 digits are given; if the
precision is zero, it is treated as 1. Style e is
used if the exponent from its conversion is less than
-4 or greater than or equal to the precision.
Trailing zeros are removed from the fractional part of
the result; a decimal point appears only if it is
followed by at least one digit.
c The int argument is converted to an unsigned char, and
the resulting character is written.
s The "char *" argument is expected to be a pointer to
an array of character type (pointer to a string).
Characters from the array are written up to (but not
including) a terminating NUL character; if a precision
is specified, no more than the number specified are
written. If a precision is given, no null character
need be present; if the precision is not specified, or
is greater than the size of the array, the array must
contain a terminating NUL character.
p The "void *" pointer argument is printed in
hexadecimal (as if by %#x or %#lx).
n The number of characters written so far is stored into
the integer indicated by the ``int *'' (or variant)
pointer argument. No argument is converted.
m The error message associated with the current value of
errno is printed as if by %s.
C The client argument identifier is printed under the
control of the <dest> argument; if <dest> is NULL or
is a user, the client's name (nickname or server name)
is printed; otherwise, the client's network numeric is
printed.
H The channel argument identifier (channel name) is
printed.
v The argument given must be a pointer to a struct
VarData with vd_format and vd_args must be initialized
appropriately. On return, vd_chars will contain the
number of characters added to the buffer, and
vd_overflow will contain the number of characters that
could not be added due to buffer overflow or due to a
precision.
% A `%' is written. No argument is converted. The
complete conversion specification is `%%'.
In no case does a non-existent or small field width cause truncation
of a field; if the result of a conversion is wider than the field
width, the field is expanded to contain the conversion result.
<struct>
struct VarData {
size_t vd_chars; /* number of characters inserted */
size_t vd_overflow; /* number of characters that couldn't be */
const char *vd_format; /* format string */
va_list vd_args; /* arguments for %v */
};
This structure is used by the %v conversion specification. The
_vd_format_ element must contain a format string, and the _vd_args_
element must be a variable argument list. Upon return from
ircd_snprintf() or ircd_vsnprintf(), the _vd_chars_ element will
contain the number of characters that were able to be inserted, and
the _vd_overflow_ element will contain the number of characters that
could not be inserted.
</struct>
<function>
int ircd_snprintf(struct Client *dest, char *buf, size_t buf_len,
const char *format, ...);
This formats the argument list, under control of the _format_, into
the buffer specified by _buf_, the size of which is specified by
_buf_len_. The _dest_ parameter is used to determine whether to use a
numeric or a nickname for %C conversions.
</function>
<function>
int ircd_vsnprintf(struct Client *dest, char *buf, size_t buf_len,
const char *format, va_list args);
This function is identical to the ircd_snprintf() function except for
the variable argument list given by _args_.
</function>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-6-15 Kev] Initial documentation of the ircd_snprintf family of
functions.
</changelog>

92
doc/api/joinbuf.txt Normal file
View File

@ -0,0 +1,92 @@
IRC wouldn't be of much interest without the ability for users to join
channels. Of course, they must also be able to leave those channels
when they get bored of the conversation there. Users can join or
leave multiple channels at once. Sometimes these JOIN and PART
messages can be ganged together into a single message. This is
facilitated by the JoinBuf system.
<struct>
struct JoinBuf;
This structure is used to accumulate and describe several channel
joins or parts. None of its fields are directly or indirectly
accessible to the application; a struct JoinBuf is only suitable for
passing to the joinbuf_*() suite of functions. JoinBuf structures
must be allocated by the caller.
</struct>
<macro>
#define JOINBUF_TYPE_JOIN 0 /* send JOINs */
This macro tells joinbuf_init() that the JoinBuf is being used to
generate several channel joins.
</macro>
<macro>
#define JOINBUF_TYPE_CREATE 1 /* send CREATEs */
This macro tells joinbuf_init() that the JoinBuf is being used to
generate several channel creations.
</macro>
<macro>
#define JOINBUF_TYPE_PART 2 /* send PARTs */
This macro tells joinbuf_init() that the JoinBuf is being used to
generate several channel parts.
</macro>
<macro>
#define JOINBUF_TYPE_PARTALL 3 /* send local PARTs, but not remote */
This macro tells joinbuf_init() that the JoinBuf is being used to
record PARTs for all the user's channels. That fact is communicated
to servers through a more efficient means than sending several PARTs,
but local clients can only be made aware of it with standard PART
messages.
</macro>
<function>
void joinbuf_init(struct JoinBuf *jbuf, struct Client *source,
struct Client *connect, unsigned int type, char *comment,
time_t create);
This function is used to initialize a caller allocated JoinBuf,
specified by _jbuf_. The originating user is specified by _source_;
the connection on which the message was received is specified by
_connect_; the type (one of the JOINBUF_TYPE_* macros described above)
is specified by _type_. PART messages may have an optional comment,
which is passed through the _comment_ parameter. JOIN and CREATE
messages require a timestamp, passed through the _create_ parameter.
</function>
<function>
void joinbuf_join(struct JoinBuf *jbuf, struct Channel *chan,
unsigned int flags);
This function adds a channel to the JoinBuf. The _chan_ parameter
specifies the channel, and may only be NULL if the JoinBuf type is
JOINBUF_TYPE_JOIN--this will cause a "JOIN 0" message to be sent to
all servers. The _flags_ parameter is used to specify the user's
current channel flags. For JOINBUF_TYPE_PART and JOINBUF_TYPE_PARTALL
JoinBufs, passing CHFL_ZOMBIE will inhibit sending the PART to all
channel users, and CHFL_BANNED will inhibit sending the user's
specified PART comment. For JOINBUF_TYPE_JOIN or JOINBUF_TYPE_CREATE
JoinBufs, the _flags_ parameter is used to set the initial channel
modes for the user.
</function>
<function>
int joinbuf_flush(struct JoinBuf *jbuf);
This function simply flushes the contents of the struct JoinBuf to the
appropriate destinations.
</function>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-6-15 Kev] Initial documentation of the JoinBuf subsystem.
</changelog>

161
doc/api/jupe.txt Normal file
View File

@ -0,0 +1,161 @@
Occasionally, a server will become incorrectly configured or will
start behaving incorrectly. Even more rarely, a server will be
compromised, and a modified version of the server put in place to
cause problems. These cases are the reason for the _jupe_, a
temporary server ban. This is similar to the G-line, which is a
temporary user ban, and indeed, the jupe API is very similar to the
G-line API.
<macro>
#define JUPE_MAX_EXPIRE 604800 /* max expire: 7 days */
This macro lists the maximum expire time a jupe is permitted to have.
This value is limited to 7 days to prevent abuse of the system.
</macro>
<macro>
#define JUPE_ACTIVE 0x0001
This flag is used to indicate that a given jupe is globally active.
</macro>
<macro>
#define JUPE_LOCAL 0x0002
This flag is used to indicate that a given jupe is a local one. Local
jupes do not affect users on other servers.
</macro>
<macro>
#define JUPE_LDEACT 0x0004 /* locally deactivated */
This flag is set on global jupes that have been locally deactivated.
This flag is maintained internally by the jupe subsystem.
</macro>
<struct>
struct Jupe;
The struct Jupe describes everything about a given jupe. None of its
fields may be directly accessed by the application; use the functions
and macros described below instead.
</struct>
<function>
int JupeIsActive(struct Jupe* j);
This macro returns a non-zero value if the jupe is active, or 0
otherwise. If a jupe is locally deactivated, this macro will always
return 0.
</function>
<function>
int JupeIsRemActive(struct Jupe* j);
This macro returns a non-zero value if the jupe is active, ignoring
whether or not it is locally deactivated.
</function>
<function>
int JupeIsLocal(struct Jupe* j);
This macro returns a non-zero value if the jupe is local only.
</function>
<function>
char* JupeServer(struct Jupe* j);
This macro returns the server name associated with the jupe.
</function>
<function>
char* JupeReason(struct Jupe* j);
This macro returns the reason that was given when the jupe was set.
</function>
<function>
time_t JupeLastMod(struct Jupe* j);
Jupes have a modification time that must be monotonically increasing.
This macro simply returns that modification time.
</function>
<function>
int jupe_add(struct Client *cptr, struct Client *sptr, char *server,
char *reason, time_t expire, time_t lastmod, unsigned int flags);
This function simply adds a jupe, set by _sptr_ and with a _server_,
_reason_, _expire_, and _lastmod_ as specified. The _flags_ parameter
is a bit mask consisting of the binary OR of JUPE_LOCAL and
JUPE_ACTIVE, as appropriate. The jupe_add() function will propagate
the jupe to all servers (assuming JUPE_LOCAL was not passed), and will
break its link to the server specified by _server_ (assuming that the
JUPE_ACTIVE flag _was_ passed).
</function>
<function>
int jupe_activate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
time_t lastmod, unsigned int flags);
This function activates the jupe specified by _jupe_, setting its
_lastmod_ time as specified. If _flags_ is JUPE_LOCAL and if the jupe
is locally deactivated, this function will turn off the local
deactivation flag, but will not modify _lastmod_. If the jupe is
globally deactivated, passing this function the JUPE_LOCAL flag will
have no effect.
</function>
<function>
int jupe_deactivate(struct Client *cptr, struct Client *sptr,
struct Jupe *jupe, time_t lastmod, unsigned int flags);
This function is similar to jupe_activate() except that it deactivates
the jupe. If the given jupe is local, then the jupe is deleted from
memory. In all other cases, the jupe is simply deactivated, either
locally (if JUPE_LOCAL was passed via _flags_) or globally. Global
deactivation will update the _lastmod_ time.
</function>
<function>
struct Jupe* jupe_find(char *server);
This function searches for a jupe matching the given _server_.
</function>
<function>
void jupe_free(struct Jupe *jupe);
This function releases all storage associated with a given jupe.
</function>
<function>
void jupe_burst(struct Client *cptr);
This function generates a burst of all existing global jupes and sends
them to the server specified by _cptr_.
</function>
<function>
int jupe_resend(struct Client *cptr, struct Jupe *jupe);
This function resends the _jupe_ to a server specified by _cptr_.
This may be used if, for instance, it is discovered that a server is
not synchronized with respect to a particular jupe.
</function>
<function>
int jupe_list(struct Client *sptr, char *server);
This function sends the information about a jupe matching _server_ to
the client specified by _sptr_. If _server_ is a NULL pointer, a list
of all jupes is sent.
</function>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-6-15 Kev] Initial documentation of the jupe API.
</changelog>

240
doc/api/log.txt Normal file
View File

@ -0,0 +1,240 @@
Old versions of ircu did not have very good means of dealing with
logging. In u2.10.11, an entirely new logging subsystem was written,
allowing a server administrator much more power in determining what
actions are to be logged where. The new logging subsystem permits log
messages to go to syslog, to a file, and to server operators via
server notices, simultaneously (though having output to multiple log
files is not presently supported).
All log messages have two values that are passed in with them: the
logging level, which must be one of the values in enum LogLevel, and a
logging subsystem, which must be one of the values in enum LogSys;
these values are used as indexes into arrays within ircd_log.c, so be
careful should you change them.
In addition to the LogLevel and LogSys, there is also a set of three
flags that may be passed to the log_write() logging function; these
flags may be used to suppress certain types of logging that may be
undesirable. For instance, when a server links, a log may be written
containing the server's IP address; to prevent this IP address from
ever showing up in a server notice, that invocation of log_write() is
passed the LOG_NOSNOTICE flag.
<enum>
enum LogLevel {
L_CRIT,
L_ERROR,
L_WARNING,
L_NOTICE,
L_TRACE,
L_INFO,
L_DEBUG,
L_LAST_LEVEL
};
This enum describes the severity levels of a log message. The
severity decreases as you proceed downwards in the list, so L_DEBUG is
less severe than L_INFO, and L_CRIT in the most severe of all. The
special value L_LAST_LEVEL should never be used; it merely marks the
end of the list.
</enum>
<enum>
enum LogSys {
LS_SYSTEM, LS_CONFIG, LS_OPERMODE, LS_GLINE, LS_JUPE, LS_WHO, LS_NETWORK,
LS_OPERKILL, LS_SERVKILL, LS_USER, LS_OPER, LS_RESOLVER, LS_SOCKET,
LS_DEBUG, LS_OLDLOG,
LS_LAST_SYSTEM
};
These are the various logging subsystems recognized by the logging
subsystem. Again, order is important, and again, LS_LAST_SYSTEM
should never be used.
</enum>
<function>
void log_debug_init(int usetty);
This initializes the special-purpose debug logging code in the
server. If the _usetty_ parameter is non-zero, then all debugging
output will go to the terminal regardless of file settings for the
LS_DEBUG subsystem. This function is not defined unless the server is
compiled with -DDEBUGMODE.
</function>
<function>
void log_init(const char *process_name);
This initializes the entire logging subsystem, including special
things such as storing the process name and opening syslog with the
open_log() function. It may only be called once.
</function>
<function>
void log_reopen(void);
All log files are persistently open, in order to avoid the overhead of
re-opening the log file each time. This function is used to close all
the log files and to close and reopen syslog. (Log files are opened
again only when there is something to write to them.)
</function>
<function>
void log_close(void);
This closes all log files and the syslog prior to the server
terminating. Should logs need to be reopened after calling this
function, call log_reopen() instead of log_init().
</function>
<function>
void log_write(enum LogSys subsys, enum LogLevel severity,
unsigned int flags, const char *fmt, ...);
This is the actual logging function. The _flags_ parameter is 0 or
the bitwise OR of LOG_NOSYSLOG (suppresses syslogging), LOG_NOFILELOG
(suppresses logging to a file) and LOG_NOSNOTICE (suppresses logging
via server notices). The _fmt_ parameter is a format string
acceptable to ircd_snprintf(), which is the function called to
actually format the log message.
</function>
<function>
void log_vwrite(enum LogSys subsys, enum LogLevel severity,
unsigned int flags, const char *fmt, va_list vl);
This is similar to log_write() except that it takes a va_list
parameter.
</function>
<function>
char *log_cannon(const char *subsys);
This returns the canonical name for logging subsystem. This probably
should not be exposed here, but it is needed in ircd_features.c at
present.
</function>
<function>
int log_set_file(const char *subsys, const char *filename);
This sets the file name for the specified logging subsystem to
_filename_; returns 2 if the subsystem was undefined, 1 if the value
of _filename_ was not understood, or 0 if there was no error.
</function>
<function>
char *log_get_file(const char *subsys);
This returns the current log file name for the given subsystem.
</function>
<function>
int log_set_facility(const char *subsys, const char *facility);
This sets the syslog facility for the specified logging subsystem to
_facility_; returns 2 if the subsystem was undefined, 1 if the value
of _facility_ was not understood, or 0 if there was no error. Two
special facility names may be given; "NONE" specifies that no
syslogging should be performed, and "DEFAULT" specifies that ircd's
default syslog facility should be used.
</function>
<function>
char *log_get_facility(const char *subsys);
This returns the current syslog facility for the given subsystem. See
the documentation for log_set_facility() for a description of the
special facility names "NONE" and "DEFAULT."
</function>
<function>
int log_set_snomask(const char *subsys, const char *snomask);
This sets the server notice type for the specified logging subsystem
to _snomask_; returns 2 if the subsystem was undefined, 1 if the value
of _snomask_ was not understood, or 0 if there was no error. The
special server notice type "NONE" indicates that no server notices
should be generated. The other valid values for _snomask_ are:
"OLDSNO," "SERVKILL," "OPERKILL," "HACK2," "HACK3," "UNAUTH,"
"TCPCOMMON," "TOOMANY," "HACK4," "GLINE," "NETWORK," "IPMISMATCH,"
"THROTTLE," "OLDREALOP," "CONNEXIT," and "DEBUG."
</function>
<function>
char *log_get_snomask(const char *subsys);
This returns the current server notice type for the given subsystem.
See the documentation for log_set_snomask() for a description of the
return values.
</function>
<function>
int log_set_level(const char *subsys, const char *level);
This function is used to set the minimum log level for a particular
subsystem; returns 2 if the subsystem was undefined, 1 if the value of
_level_ was not understood, or 0 if there was no error. Any log
notices generated with lower severity than that set with this function
will not be logged. Valid values are "CRIT," "ERROR," "WARNING,"
"NOTICE," "TRACE," "INFO," and "DEBUG."
</function>
<function>
char *log_get_level(const char *subsys);
This returns the current minimum log level for the given subsystem.
See the documentation for log_set_level() for a description of the
return values.
</function>
<function>
int log_set_default(const char *facility);
This function sets the default syslog facility for all of ircd. Valid
values for _facility_ are as described for log_set_facility() with the
exclusion of the "NONE" and "DEFAULT" facilities; returns 1 if the
facility name was unrecognized (or proscribed) or 0 if there was no
error.
</function>
<function>
char *log_get_default(void);
This simply returns ircd's default syslog facility.
</function>
<function>
void log_feature_unmark(void);
This function is called by the ircd_features.c subsystem and should
not be called by any other part of ircd. See the features API
documentation for notes on what this function does.
</function>
<function>
void log_feature_mark(int flag);
This function is called by the ircd_features.c subsystem and should
not be called by any other part of ircd. See the features API
documentation for notes on what this function does.
</function>
<function>
void log_feature_report(struct Client *to, int flag);
This function is called by the ircd_features.c subsystem and should
not be called by any other part of ircd. See the features API
documentation for notes on what this function does.
</function>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-06-13 Kev] Fix a minor typo.
[2000-12-18 Kev] Wrote some documentation on how to use the logging
subsystem.
</changelog>

282
doc/api/modebuf.txt Normal file
View File

@ -0,0 +1,282 @@
Generating and parsing channel mode strings is often a very
complicated process. The ModeBuf interface, along with the associated
mode parsing functions, attempt to make this much more programmatic.
The interface to the functions in this suite is itself very
complicated, unfortunately, though most of the complication is in the
effects of various flags on the operation of the functions.
<struct>
struct ModeBuf;
This structure is used to accumulate and describe several mode
changes. None of its fields are directly or indirectly accessible to
the application; a struct ModeBuf is only suitable for passing to the
modebuf_*() suite of functions. ModeBuf structures must be allocated
by the caller.
</struct>
<function>
void modebuf_init(struct ModeBuf *mbuf, struct Client *source,
struct Client *connect, struct Channel *chan,
unsigned int dest);
This function initializes a caller-allocated ModeBuf, _mbuf_, with the
given parameters. If the mode should not be sent to a particular
server, perhaps because it was received from that server, that server
should be specified by the _connect_ parameter. The channel the mode
change will take place on is given by the _chan_ parameter, and the
disposition of the mode is given by the _dest_ parameter, which is the
binary OR of the MODEBUF_DEST_* flags described below.
</function>
<macro>
#define MODEBUF_DEST_CHANNEL 0x0001 /* Mode is flushed to channel */
This flag, when set in a call to modebuf_init(), causes the accumulated
mode change to be sent to the channel (in client<->server protocol, of
course).
</macro>
<macro>
#define MODEBUF_DEST_SERVER 0x0002 /* Mode is flushed to server */
If other servers should be made aware of the mode change, this flag
should be passed to modebuf_init(). One time when the mode change may
not be passed is when processing the mode in a BURST message.
</macro>
<macro>
#define MODEBUF_DEST_OPMODE 0x0100 /* Send server mode as OPMODE */
This flag is used to tell the modebuf_*() suite to send an OPMODE
message to other servers, rather than an ordinary MODE message.
</macro>
<macro>
#define MODEBUF_DEST_DEOP 0x0200 /* Deop the offender */
When bouncing a mode change, giving this flag to modebuf_init() causes
the originating user to be deopped on the channel as part of the mode
bounce.
</macro>
<macro>
#define MODEBUF_DEST_BOUNCE 0x0400 /* Bounce the modes */
When a mode change is illegitimate, that is, when it originates from a
user that is not (as far as this server knows) a channel operator, the
mode change should be bounced. This involves reversing the sense of
the mode and sending it back to the originating server. This flag is
used to tell the modebuf_*() suite to do just that.
</macro>
<macro>
#define MODEBUF_DEST_LOG 0x0800 /* Log the mode changes to OPATH */
The OPMODE command is reserved for IRC operators. When it is used,
the server should log the command for accountability purposes. This
flag, given to modebuf_init(), will cause the ModeBuf system to log
the exact mode change to a log file.
</macro>
<macro>
#define MODEBUF_DEST_HACK2 0x2000 /* Send a HACK(2) notice, reverse */
When a remote user that this server does not think is a channel
operator proceeds to change a channel mode, that mode must be
bounced. In addition, in order to provide some debugging capability,
a server notice may be sent, called a "HACK(2)" notice. Passing
modebuf_init() this flag causes that notice to be sent.
</macro>
<macro>
#define MODEBUF_DEST_HACK3 0x4000 /* Send a HACK(3) notice, TS == 0 */
When the origin of a mode change is a server, we should always accept
the mode change. To provide accountability, however, a server notice
should be sent. This flag will cause the server to generate a
"HACK(3)" notice.
</macro>
<macro>
#define MODEBUF_DEST_HACK4 0x8000 /* Send a HACK(4) notice, TS == 0 */
Some servers are special. When a server that has a Uworld entry
issues a mode change, we send a "HACK(4)" message to differentiate it
from an ordinary server changing a channel mode. This is the flag
that must be passed to modebuf_init() to cause that behavior.
</macro>
<function>
void modebuf_mode(struct ModeBuf *mbuf, unsigned int mode);
Certain channel modes take no arguments. Those mode changes can be
fed to the ModeBuf system using modebuf_mode(). The _mode_ parameter
is a bit mask of the mode changes, and must have one of MODE_ADD or
MODE_DEL set.
</function>
<function>
void modebuf_mode_uint(struct ModeBuf *mbuf, unsigned int mode,
unsigned int uint);
One channel mode, the "limit" mode ("+l"), takes a single integer
argument. This limit can be fed to the ModeBuf system with the
modebuf_mode_uint() function. The _mode_ parameter must be the binary
OR of one of MODE_ADD or MODE_DEL with the MODE_LIMIT flag. The
_uint_ parameter specifies the limit.
</function>
<function>
void modebuf_mode_string(struct ModeBuf *mbuf, unsigned int mode,
char *string, int free);
Some channel modes take a string parameter. These can be fed to
ModeBuf with modebuf_mode_string(). The _mode_ parameter should be
the binary OR of one of MODE_ADD or MODE_DEL with the flag for the
mode. The _string_ parameter specifies the string, and the _free_
parameter indicates whether the ModeBuf system should call MyFree() on
the string once it is done with it.
</function>
<function>
void modebuf_mode_client(struct ModeBuf *mbuf, unsigned int mode,
struct Client *client);
The remaining channel modes take a parameter specifying a client.
These can be fed to ModeBuf with modebuf_mode_client(). The _mode_
parameter should be the binary OR of one of MODE_ADD or MODE_DEL with
the flag for the mode. The _client_ parameter should be a pointer to
a struct Client specifying which client the mode is supposed to act
upon.
</function>
<function>
int modebuf_flush(struct ModeBuf *mbuf);
This function simply flushes the contents of the struct ModeBuf
specified by _mbuf_ to the appropriate destinations, as was specified
by the _dest_ parameter in the call to modebuf_init(). This function
returns 0 for the convenience of callers that must return an integer.
</function>
<function>
void modebuf_extract(struct ModeBuf *mbuf, char *buf);
One use of the ModeBuf within ircd requires the ability to pull a
simple mode string out of the struct ModeBuf for use elsewhere. This
can be accomplished with this function. The _buf_ parameter should be
large enough to accommodate the simple mode string.
</function>
<function>
void mode_ban_invalidate(struct Channel *chan);
Looking up bans affecting a particular user can be a fairly expensive
operation, so the server caches the result of the lookup. Should the
ban list for a channel change, all the cached results must be
invalidated to force rechecking. This may be done with the
mode_ban_invalidate() function, which acts upon the channel given by
_chan_.
</function>
<function>
void mode_invite_clear(struct Channel *chan);
When a channel that was invite-only has the "+i" channel mode removed,
the invite list that the server keeps is no longer necessary. The
mode_invite_clear() function flushes that invite list for the channel
given by _chan_, reclaiming the memory used by the invite list.
</function>
<function>
int mode_parse(struct ModeBuf *mbuf, struct Client *cptr, struct Client *sptr,
struct Channel *chptr, int parc, char *parv[],
unsigned int flags);
This function parses a mode change command, given by the contents of
_parv[]_, and under the control of _flags_. The channel being modified
is given by _chptr_, the source of the change is given by _sptr_, and
the connection the change was received from is given by _cptr_. The
_parc_ parameter gives the count of the number of elements in the
_parv[]_ array. The ModeBuf must have already been initialized by a
call to modebuf_init(), described above. For more information on
_flags_, see the MODE_PARSE_* macros described below. This function
returns an integer indicating the number of elements of _parv[]_ it
used. The modebuf_flush() function must be called upon return from
mode_parse() to flush the mode changes to the channel.
</function>
<macro>
#define MODE_PARSE_SET 0x01 /* actually set channel modes */
When this flag is passed to mode_parse(), the channel mode being
parsed will actually be effected on the channel.
</macro>
<macro>
#define MODE_PARSE_STRICT 0x02 /* +m +n +t style not supported */
Users are permitted to send complicated mode commands like "MODE #foo
+m +n +t +k foo +i"; servers are not. Passing this flag to
mode_parse() causes it to strictly enforce this restriction.
</macro>
<macro>
#define MODE_PARSE_FORCE 0x04 /* force the mode to be applied */
Some mode changes are not permitted under normal circumstances. When
this flag is passed to mode_parse(), these mode changes will be
accepted.
</macro>
<macro>
#define MODE_PARSE_BOUNCE 0x08 /* we will be bouncing the modes */
This flag warns mode_parse() that the mode is to be bounced. This
will cause it to systematically feed each mode into ModeBuf in order
for that interface to generate the proper bounce messages.
</macro>
<macro>
#define MODE_PARSE_NOTOPER 0x10 /* send "not chanop" to user */
This flag is used to warn mode_parse() that the user generating the
mode change is not a channel operator. If the user attempts to change
a mode, an appropriate error message will be sent to the user (once).
</macro>
<macro>
#define MODE_PARSE_NOTMEMBER 0x20 /* send "not member" to user */
This flag is used to warn mode_parse() that the user generating the
mode change is not even on the channel. If the user attempts to
change a mode, an appropriate error message will be sent to the user
(once).
</macro>
<macro>
#define MODE_PARSE_WIPEOUT 0x40 /* wipe out +k and +l during burst */
When this flag is passed to mode_parse(), the channel key and limit
will be reversed if the mode string doesn't update them. This is used
for processing BURST messages.
</macro>
<macro>
#define MODE_PARSE_BURST 0x80 /* be even more strict w/extra args */
The BURST message is even more strict than a standard MODE message.
Processing *must* stop after reading the mode string itself, or
mode_parse() could gobble up arguments not intended for it. This flag
tells mode_parse() about this restriction.
</macro>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-6-15 Kev] Initial documentation of the ModeBuf and mode parsing
subsystems.
</changelog>

76
doc/api/motd.txt Normal file
View File

@ -0,0 +1,76 @@
The server has a Message of the Day (MOTD) which is often used for
describing the Acceptable Usage Policy, where to get help if you have
problems, and so on. Older versions of ircd had a lot of duplicated
code, as well as some inefficiencies, all related to sending the
MOTD. As of u2.10.11, there is an API specifically for MOTDs. This
API caches the MOTDs in memory for efficiency. Sending a MOTD to a
client is as simple as calling a single function.
<function>
void motd_init(void);
This function initializes the MOTD subsystem. It will also read in
the default MOTD (usually ircd.motd) and the remote MOTD (usually
remote.motd) files.
</function>
<function>
int motd_send(struct Client* cptr);
This function sends an appropriate MOTD to the client specified by
_cptr_. If _cptr_ is not a local client, the remote MOTD will be
sent; otherwise, an attempt will be made to find a Motd entry in the
configuration file that matches the client. If no Motd entry can be
found, the default MOTD will be sent to the client. This function
returns 0 for the convenience of other functions that must have an
integer return value. </function>
<function>
void motd_signon(struct Client* cptr);
This function is similar to motd_send(), described above, except that
it will only send a message to the client indicating when the MOTD was
last modified if the FEAT_NODEFAULTMOTD feature is set to TRUE.
</function>
<function>
void motd_recache(void);
The MOTD system will not automatically detect when MOTD files have
been modified. This function causes the MOTD system to clear the MOTD
cache and re-read the files.
</function>
<function>
void motd_add(const char *hostmask, const char *path, isgeoip);
This function is used to add a MOTD to be sent to clients possessing a
given _hostmask_. If _hostmask_ is a numerical string, it is
interpreted as a connection class. If _isgeoip_ is 0 then _hostmask_
is treated as described above. If _isgeoip_ is 1 then _hostmask_ is
treated as a 2 letter country code and if _isgeoip_ is 2 then
_hostmask_ is treated as a 2 letter continent code.
</function>
<function>
void motd_clear(void);
This function clears the list of special MOTDs. Only the default MOTD
and remote MOTD are not affected by this function.
</function>
<function>
void motd_report(struct Client *to);
The motd_report() function sends a list of the Motd entries stored in
memory to the client specified by _to_. Access control should be
handled by the caller.
</function>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-6-15 Kev] Initial documentation of the MOTD interface.
</changelog>

195
doc/api/msgq.txt Normal file
View File

@ -0,0 +1,195 @@
Many messages generated by an IRC server are sent to multiple
recipients. Previous versions of ircd used DBuf to store these
messages until they could actually be sent. The problem with using a
DBuf for this, though, is that there are multiple copies of the same
message hanging around. Another problem is that there is at least one
strcpy() or equivalent call for each destination the message is sent
to. A simple solution to this problem is to use messages queues.
This file documents the MsgQ interface for ircd.
The MsgQ interface is loosely based on the API for DBuf. Although the
structures are vastly different, most calls, including several of the
macros, are similar to certain pieces of the DBuf API. This made
retrofitting ircd with MsgQ support much simpler.
<struct>
struct MsgCounts {
int alloc;
int used;
};
The MsgCounts structure may be used for determining how much memory is
in use by the MsgQ system. The _alloc_ element is a count of the
total number of structures (of whatever type) that have been
allocated; the _used_ element is a count of how many are actually in
use. MsgQ never releases any of its allocated memory; instead, it
places unused structures onto a free list.
</struct>
<struct>
struct MsgBuf;
The MsgBuf structure contains the actual message, along with a
reference count and the message's length. None of its fields are
directly accessible by the application.
</struct>
<struct>
struct MsgQ;
The MsgQ structure is a structure allocated by the application that is
used by the MsgQ system to describe an entire message queue, including
both normal and priority queues. None of its fields are directly
accessible by the application.
</struct>
<global>
struct MsgCounts msgBufCounts; /* resource count for struct MsgBuf */
This global variable counts the number of MsgBuf structures that have
been allocated. This may be used to determine how much memory is in
use by the MsgQ system.
</global>
<global>
struct MsgCounts msgCounts; /* resource count for struct Msg */
This global variable counts the number of Msg structures that have
been allocated. The Msg structure describes the link between a queue
and a message. It is not accessible to the application, and so not
further documented here.
</global>
<function>
unsigned int MsgQLength(struct MsgQ* mq);
This macro returns the number of bytes in a particular user's message
queue.
</function>
<function>
unsigned int MsgQCount(struct MsgQ* mq);
This macro returns the number of messages in a particular user's
message queue.
</function>
<function>
void MsgQClear(struct MsgQ* mq);
This macro simply clears the content of a particular message queue.
NOTE: This macro evaluates its argument twice.
</function>
<function>
void msgq_init(struct MsgQ *mq);
This function initializes a caller-allocated message queue to be
empty. Calling this function on a message queue with messages in it
WILL RESULT IN A MEMORY LEAK.
</function>
<function>
void msgq_delete(struct MsgQ *mq, unsigned int length);
This function removes the given number of bytes from the message
queue. If entire messages have been sent, they will be unlinked from
the queue. The _length_ parameter does not need to correspond to a
given message's length; the MsgQ system is able to deal with messages
that have only partially been sent.
</function>
<function>
int msgq_mapiov(const struct MsgQ *mq, struct iovec *iov, int count,
unsigned int *len);
The msgq_mapiov() function takes a struct MsgQ (specified by the _mq_
parameter) and a caller allocated struct iovec array (specified by the
_iov_ parameter) and maps the contents of the message into the struct
iovec array. The _count_ parameter must indicate the total number of
elements available for msgq_mapiov() to use. The _len_ parameter must
be a pointer to an unsigned int, and upon return from the function
will contain the total number of bytes that have been mapped into the
struct iovec array. This function returns the number of struct iovec
elements that have been filled. For more information about the
purpose of struct iovec, see your system's man page for the writev()
function.
</function>
<function>
struct MsgBuf *msgq_make(struct Client *dest, const char *format, ...);
This function allocates a struct MsgBuf and calls ircd_vsnprintf()
with the _dest_ and _format_ parameters to fill it in. Most callers
should use the send_buffer() function (declared in send.h) to attach
the struct MsgBuf to a client's message queue.
</function>
<function>
struct MsgBuf *msgq_vmake(struct Client *dest, const char *format, va_list vl);
This function is identical to msgq_make() except that it takes a
va_list (given by the _vl_ parameter) and calls ircd_vsnprintf() to
format the message.
</function>
<function>
void msgq_append(struct Client *dest, struct MsgBuf *mb, const char *format,
...);
Occasionally a caller is not able to completely compute a message
before calling msgq_make(). When this happens, the msgq_append()
function may be called to append more text onto the struct MsgBuf
specified by the _mb_ parameter. As with msgq_make(), the _dest_ and
_format_ parameters are passed to ircd_vsnprintf(), along with the
additional arguments.
</function>
<function>
void msgq_clean(struct MsgBuf *mb);
As mentioned above, struct MsgBuf includes a reference count. When
that reference count reaches zero, the structure is released. The
reference count is set to 1 by msgq_make() and msgq_vmake(). Once a
given message has been attached to all the queues it needs to be, the
caller should call the msgq_clean() function to decrement this
reference count. This function will place the struct MsgBuf back onto
the free list if it did not get attached to any message queues. The
msgq_delete() function calls msgq_clean() internally, so the
application need not call msgq_clean() explicitly afterwards.
</function>
<function>
void msgq_add(struct MsgQ *mq, struct MsgBuf *mb, int prio);
This function is used to attach a given struct MsgBuf, as specified by
the _mb_ parameter, to a given message queue. The _prio_ parameter,
if non-zero, specifies that the message should be placed on the
priority queue. This function is called by send_buffer(), defined in
send.h; most applications should call that function, rather than this
one.
</function>
<function>
void msgq_count_memory(size_t *msg_alloc, size_t *msg_used,
size_t *msgbuf_alloc, size_t *msgbuf_used);
This function simply takes the counts kept in msgBufCounts and
msgCounts and multiplies them by the appropriate structure sizes,
storing the resulting sizes into its parameters.
</function>
<function>
unsigned int msgq_bufleft(struct MsgBuf *mb);
This function is for use in conjunction with msgq_append(). It
returns the total number of bytes of free storage in the given _mb_.
</function>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-6-15 Kev] Initial documentation for the MsgQ functions.
</changelog>

91
doc/api/privileges.txt Normal file
View File

@ -0,0 +1,91 @@
Access control becomes more of a problem as you have more and more
users that need to access certain features. As it stands, ircu has
only 3 access levels: ordinary user, local operator, and global
operator. This is hardly enough control, especially over some of the
more advanced and powerful features, such as G-lines.
Since u2.10.11, ircu includes the concept of privileges. Privileges
are basically an arbitrarily long bit string. Access to particular
features is governed by the value of a particular bit of that bit
string--in other words, privileges are a form of Access Control List.
This document covers the basic structures and macros used by the
privileges system.
<struct>
struct Privs;
The Privs structure stores a privileges bit string and represents a
user's entire privilege set. This is implemented as a structure,
rather than as an array of integers, in order to leverage C's
structure copy.
</struct>
<function>
void PrivSet(struct Privs pset, int priv);
This macro sets the privilege specified by _priv_ in the privileges
structure. This macro evaluates the _priv_ argument twice.
</function>
<function>
void PrivClr(struct Privs pset, int priv);
This macro clears the privilege specified by _priv_ in the privileges
structure. This macro evaluates the _priv_ argument twice.
</function>
<function>
int PrivHas(struct Privs pset, int priv);
This macro tests whether the privilege specified by _priv_ is set in
the privileges structure, returning non-zero if it is. This macro
evaluates the _priv_ argument twice.
</function>
<function>
void GrantPriv(struct Client* cli, int priv);
This macro grants a particular client, specified by _cli_, the
privilege specified by _priv_. This macro evaluates the _priv_
argument twice.
</function>
<function>
void RevokePriv(struct Client* cli, int priv);
This macro revokes the privilege specified by _priv_ from the client.
This macro evaluates the _priv_ argument twice.
</function>
<function>
int HasPriv(struct Client* cli, int priv);
This macro tests whether the client specified by _cli_ has the
privilege specified by _priv_, returning non-zero if so. This macro
evaluates the _priv_ argument twice.
</function>
<function>
void client_set_privs(struct Client* client);
The ircu configuration file does not yet support privileges. This
function thus sets the appropriate privileges for an operator, based
upon various feature settings. It should be called whenever there is
a change in a user's IRC operator status.
</function>
<function>
int client_report_privs(struct Client *to, struct Client *client);
This function sends the client specified by _to_ a list of the
privileges that another client has. It returns a value of 0 for the
convenience of other functions that must return an integer value.
</function>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-6-15 Kev] Initial documentation of the privileges system.
</changelog>

231
doc/api/send.txt Normal file
View File

@ -0,0 +1,231 @@
The send functions are perhaps the most important API in all of ircd;
without them, communications would not be possible. Most of these
functions are pretty much stand-alone, although one or two are
intended for use in conjunction with the MsgQ interface. The send
functions use the MsgQ interface internally, but for the most part,
this fact is hidden from the caller.
Command tokenization provides the greatest complication. The
functions do use ircd_snprintf() internally, so the use of numerics
doesn't increase that complication. The tokenization issue is dealt
with by making each function accept two char* pointers, _cmd_ and
_tok_, in that order, and then defining a CMD_* macro in msg.h that
contains the message string and the token string in that order. When
one of these functions is called, it determines whether the
destination will be a server or a user, then selects the correct one,
either _cmd_ or _tok_, for that message.
The MsgQ interface provides the concept of a priority queue; messages
which must be sent as soon as possible, regardless of what other
messages may already be in the queue. The sendcmdto_prio_one() and
sendcmdto_flag_butone() functions make use of this priority queue.
The function send_buffer() also takes a _prio_ argument that should be
non-zero if the message passed to it should be placed in the priority
queue.
<macro>
#define SKIP_DEAF 0x01 /* skip users that are +d */
This flag may be passed to sendcmdto_channel_butone() to cause a
message passed by that function to skip users that are +d. See the
documentation for sendcmdto_channel_butone() for more information.
</macro>
<macro>
#define SKIP_BURST 0x02 /* skip users that are bursting */
This is another flag that may be passed to
sendcmdto_channel_butone(). Its purpose is to cause the server to not
send the message across a link that is still in the "burst" stage of
network junction. See the documentation for
sendcmdto_channel_butone() for more information.
</macro>
<macro>
#define SKIP_NONOPS 0x04 /* skip users that aren't chanops */
Some messages may need to be passed only to channel operators. This
flag is passed to sendcmdto_channel_butone() when that is the case.
See the documentation for sendcmdto_channel_butone() for more
information.
</macro>
<function>
void send_buffer(struct Client* to, struct MsgBuf* buf, int prio);
Some applications may need to build a message piece by piece, directly
utilizing the MsgQ interface. The function send_buffer() is used when
that message has been completed to place the message on a client's
queue. See the documentation for the MsgQ interface for more
information about struct MsgBuf and the _buf_ parameter.
</function>
<function>
void flush_connections(struct Client* cptr);
This function attempts to send all queued data to a client specified
by _cptr_. If _cptr_ is 0, all clients with non-empty send queues
will have their queues flushed.
</function>
<function>
void send_queued(struct Client *to);
This function attempts to send all queued data to a client specified
by _to_. The _to_ parameter is not permitted to be 0. This is the
function called by flush_connections().
</function>
<function>
void sendrawto_one(struct Client *to, const char *pattern, ...);
Most of the actual send functions in this API send their data with a
prefix--the numeric of the origin. This function is used when a
message should be sent _without_ that prefix. The caller must specify
the complete message, including the exact command, with the _pattern_
argument and the variable argument list following it.
</function>
<function>
void sendcmdto_one(struct Client *from, const char *cmd, const char *tok,
struct Client *to, const char *pattern, ...);
This function is used for sending messages to specific clients. The
origin of the message is specified using the _from_ parameter; this
will be used to formulate the origin. As mentioned above, _cmd_ and
_tok_ are used to determine the command and token to be used. The
_to_ parameter specifies which client the message should be sent to.
The origin and command will be formatted and followed by a space; the
given _pattern_ and the following arguments are passed to
ircd_snprintf() for formatting.
</function>
<function>
void sendcmdto_prio_one(struct Client *from, const char *cmd, const char *tok,
struct Client *to, const char *pattern, ...);
This function is identical to sendcmdto_one() except that messages
formatted using it will be placed onto the priority queue.
</function>
<function>
void sendcmdto_serv_butone(struct Client *from, const char *cmd,
const char *tok, struct Client *one,
const char *pattern, ...);
This function treats its arguments similar to sendcmdto_one() does.
Messages passed created with this function are sent to all directly
linked servers except for the _one_ passed. If _one_ is 0, the
message is sent to all linked servers.
</function>
<function>
void sendcmdto_common_channels(struct Client *from, const char *cmd,
const char *tok, const char *pattern, ...);
When a user quits IRC, all of the other users on the channels that the
user is on must receive a single QUIT message. This function formats
the message, under control of _from_ (for the origin prefix), _cmd_
and _tok_, and _pattern_ and the variable argument list, and sends
that message to all local users on the same channels as the user
specified by _from_. This function does not send any messages across
server<->server links.
</function>
<function>
void sendcmdto_channel_butserv(struct Client *from, const char *cmd,
const char *tok, struct Channel *to,
const char *pattern, ...);
This function is used to send a command to every local user on a
particular channel, specified by _to_. No messages are sent across
the server<->server links.
</function>
<function>
void sendcmdto_channel_butone(struct Client *from, const char *cmd,
const char *tok, struct Channel *to,
struct Client *one, unsigned int skip,
const char *pattern, ...);
This function is used mostly for sending PRIVMSG commands to
particular channels. The users that receive the message are under the
control of the _skip_ parameter, which is a binary OR of the
SKIP_DEAF, SKIP_BURST, and SKIP_NONOPS flags, depending on what
channel users should see the message. This function sends messages
across both client<->server and server<->server links, as needed. The
client specified by _one_ will not receive a copy of the message.
</function>
<function>
void sendcmdto_flag_butone(struct Client *from, const char *cmd,
const char *tok, struct Client *one,
unsigned int flag, const char *pattern, ...);
This function is used for sending messages to clients with specific
user modes set (specified by the _flag_ parameter). Three flags make
sense for this function: FLAGS_WALLOP (user mode +w), FLAGS_DEBUG
(user mode +g), and FLAGS_OPER. FLAGS_OPER has a special meaning that
further restricts distribution of the message only to IRC operators.
For the purposes of this function, no distinction is made between
global operators and local operators.
</function>
<function>
void sendcmdto_match_butone(struct Client *from, const char *cmd,
const char *tok, const char *to,
struct Client *one, unsigned int who,
const char *pattern, ...);
Certain kinds of global messages may be sent by IRC operators. This
function implements those global messages. The _to_ parameter is used
to specify a pattern by which to filter users, while _who_ specifies
whether that pattern is to be applied to the user's server name or to
the user's host name. The _who_ parameter may be one of MATCH_SERVER
or MATCH_HOST; these two macros are defined in s_user.h. The _one_
parameter will not receive a copy of the message.
</function>
<function>
void sendto_opmask_butone(struct Client *one, unsigned int mask,
const char *pattern, ...);
The sendto_opmask_butone() function sends a server notice to all
subscribing users except for _one_. The _mask_ parameter is one of
the SNO_* values defined in client.h and is used for selection of
subscribing users.
</function>
<function>
void vsendto_opmask_butone(struct Client *one, unsigned int mask,
const char *pattern, va_list vl);
The vsendto_opmask_butone() function is identical to the
sendto_opmask_butone() function except that instead of a variable
argument list, it takes a va_list, specified by _vl_.
</function>
<macro>
#define SND_EXPLICIT 0x40000000 /* first arg is a pattern to use */
When this flag, defined in ircd_reply.h, is combined with the _reply_
argument to the send_reply() function, the format string send_reply()
uses is obtained from the first argument in the variable argument list
passed to that function, rather than from the table of replies.
</macro>
<function>
int send_reply(struct Client* to, int reply, ...);
The send_reply() function, declared in ircd_reply.h, is used to send
clients numeric replies. Unless SND_EXPLICIT is used, the pattern
will be extracted from a table of replies.
</function>
<authors>
Kev <klmitch@mit.edu>
</authors>
<changelog>
[2001-6-15 Kev] Initial documentation for the send functions.
</changelog>

View File

@ -0,0 +1,54 @@
diff -rbud gc6.5/include/gc.h gc6.5.patched/include/gc.h
--- gc6.5/include/gc.h Sat May 21 05:50:58 2005
+++ gc6.5.patched/include/gc.h Sat Jun 25 00:11:18 2005
@@ -779,6 +779,11 @@
GC_API GC_PTR GC_call_with_alloc_lock
GC_PROTO((GC_fn_type fn, GC_PTR client_data));
+GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
+
+/* Sets the leak handler to be called when an object is leaked. */
+GC_API void GC_set_leak_handler(void (*lh)(void*, int));
+
/* The following routines are primarily intended for use with a */
/* preprocessor which inserts calls to check C pointer arithmetic. */
/* They indicate failure by invoking the corresponding _print_proc. */
diff -rbud gc6.5/reclaim.c gc6.5.patched/reclaim.c
--- gc6.5/reclaim.c Tue Nov 23 06:58:18 2004
+++ gc6.5.patched/reclaim.c Sat Jun 25 00:52:18 2005
@@ -36,6 +36,14 @@
GC_bool GC_have_errors = FALSE;
+static void (*leak_handler)(void*, int);
+
+void
+GC_set_leak_handler(void (*lh)(void*, int))
+{
+ leak_handler = lh;
+}
+
void GC_add_leaked(leaked)
ptr_t leaked;
{
@@ -64,6 +72,12 @@
if (GC_debugging_started) GC_print_all_smashed();
for (i = 0; i < GC_n_leaked; ++i) {
ptr_t p = GC_leaked[i];
+ if (leak_handler)
+ {
+ leak_handler(GC_base(p), GC_size(GC_base(p)));
+ }
+ else
+ {
if (HDR(p) -> hb_obj_kind == PTRFREE) {
GC_err_printf0("Leaked atomic object at ");
} else {
@@ -71,6 +85,7 @@
}
GC_print_heap_obj(p);
GC_err_printf0("\n");
+ }
GC_free(p);
GC_leaked[i] = 0;
}

1397
doc/example.conf Normal file

File diff suppressed because it is too large Load Diff

53
doc/extendedbans.txt Normal file
View File

@ -0,0 +1,53 @@
------------------------------------------------------------------------------
Extended Bans Overview
------------------------------------------------------------------------------
This is a quick attempt to document the Nefarious2 extended ban system.
Extended bans allow a more far reaching and extendable mechanism to match more than the traditional nick, user, and hostname of a ban bask. Extended bans can offer additional fields (ie account, marks, real name, other channels they are in, etc)
The extended ban system is handled through the same channel mode +b as normal bans. However, they use the ~ symbol (tilde) to differenciate themselves. So an extended ban to match an account named 'jobe' would look like: /MODE #somechannel +b ~a:jobe
------------------------------------------------------------------------------
Extended Action bans:
------------------------------------------------------------------------------
q - Matching users cannot send to channel
n - Matching users cannot change their nick
------------------------------------------------------------------------------
Extended Matches:
------------------------------------------------------------------------------
a - Matches an account name
c - Matches against channels the user is in
r - Matches 'Real name' field
m - Matches any marks the user has set on them (ie TOR)
M - Matches any marks on the user, but only if they are not authenticated/registered
j - Links the banlist to the banlist from another channel
------------------------------------------------------------------------------
Special Nesting Case:
------------------------------------------------------------------------------
Note that q and n accept only 1 parameter, but it can be another extended ban:
/MODE #channel +b ~q:~a:jobe <--- this would stop account jobe from speaking
------------------------------------------------------------------------------
Examples:
------------------------------------------------------------------------------
Other than q and n, the rest of the extended bans accept a single parameter after the ':'.
/MODE #channel +b ~r:*bot* <--- this would ban users with 'bot' in their username/gecos field
/MODE #channel +b ~a:jobe <--- Ban users authenticated as account 'jobe'
/MODE #channel +b ~c:#evilnet <--- Bans users who are also in channel #evilnet
/MODE #channel +b ~j:#afternet <--- Bans any users who are also banned in channel #afternet
------------------------------------------------------------------------------
Bugs/Limitations
------------------------------------------------------------------------------
You cannot currently construct a ban which combines the special fields such as account ('a') with other fields. So it is not currently possible to ban, for example, only users whose realname contains 'bot' and whose host contains 'aol.com'.
Each extended ban type can be enabled/disabled using feature lines in ircd.conf.

151
doc/fda.txt Normal file
View File

@ -0,0 +1,151 @@
fdaman.txt - brief usage information for FDA (Free Debug Allocator)
Copyright (C) 1998 Thomas Helvey <tomh@inxpress.net>
1. Base Functionality
Basic use of the fda tools is as simple as including the header
and source file with your source defining DEBUG and using capitalized
versions of malloc(), calloc(), realloc(), and free().
The fda allocation functions verify all your arguments and will call
assert() if something is wrong. FDA trashes all allocated memory
in a predictable manner and applies prefix and postfix bounds checking
signatures to every allocation. When a pointer is freed it's validated,
and checked for overflows and underflows. The fda Realloc function
does not allow malloc or free through realloc and forces reallocation
if the required memory is larger than the current allocation.
In both the DEBUG and non-debug versions of fda, if a memory allocation
fails once, a low memory callback function is called to allow you to
release some memory and allow malloc to succeed, the default version
prints a warning message to stderr. If the low memory callback returns
the allocation is attempted again, if the second allocation fails a
no memory callback function is called to allow you to clean up before
terminating the application, if you allow the no memory callback to
return the results are undefined. (a NULL ptr will be returned from the
allocation call) The default no memory handler prints an error message
to stderr and calls abort(). The DEBUG version will assert if you allow
the no memory function to return.
Both the low memory and no memory callbacks have the signature of:
void handler(void)
The debug version of fda will not allow you to do the following:
Allocate a zero length chunk of memory.
Free a non-allocated pointer.
Free a pointer twice.
Free a pointer at the wrong offset.
Use realloc to free memory. (realloc(p, 0))
Use realloc to malloc memory. (realloc(0, s))
Overwrite the bounds of the memory you allocated. (checked on free)
The base functions for fda are:
void* malloc(size_t)
void* realloc(void*, size_t)
void* calloc(size_t, size_t)
void free(void*)
char* strdup(const char*)
void set_lowmem_handler(void (*fn)(void))
void set_nomem_handler(void (*fn)(void))
FDA uses a hash table to lookup pointers. The size of the hash table can
be changed at compile time by using -DFDA_HASH_TABLE_SIZE <prime>
where prime is a prime number somewhere around the number of allocations
expected. The default hash table size is 16339 which should be large enough
to hold most medium sized applications. FDA allocates memory for it's
debugging records so if your application uses a lot of memory you
may want to make sure you have enough memory available to use the debug
version. FDA allocates 20 bytes to store each allocation and 20 bytes
to store location information (file and line info). This overhead only
applies if you have DEBUG or _DEBUG defined.
2. Extended functionality
FDA provides a few handy functions for validating pointers and
checking for overruns before they occur when debugging.
The first function fda_sizeof(ptr) returns the size of the buffer
pointed to by ptr, this allows you to verify that your pointer
is what it says it is. fda_sizeof() will call assert() if the
pointer you pass it is not at the start of an allocation.
The second function valid_ptr(ptr, size) verifies that ptr lies within
allocated memory and there are at least size bytes available in the buffer.
You can pass valid_ptr() a pointer to any location in allocated memory.
valid_ptr() calls assert if the pointer points outside of allocated memory
or the remaining size is less than the size specified.
valid_ptr() is more efficient if the pointer argument is the value
returned from malloc because it's a simple hash table lookup, a more
exhaustive algorithm is used if it's not found in the hash table.
FDA extended functions:
size_t fda_sizeof(const void*)
int valid_ptr(const void*, size_t)
Typical usage for the fda extended functions:
Note: the assert macro compiles to nothing if NDEBUG is defined.
Verify a foo_ptr:
assert(sizeof(struct foo) == fda_sizeof(foo_ptr));
assert(valid_ptr(foo_ptr, sizeof(struct foo)));
Check for room to write:
assert(valid_ptr(buf, len));
3. Leak checking and block validation
FDA has several functions for leak checking, and reference marking.
fda_clear_refs() iterates through all of the allocated blocks of
memory and clears the referenced flag.
fda_set_ref() marks a single allocation(block) as being referenced or
in use by somebody.
fda_assert_refs() iterates through all the allocated blocks of
memory and calls assert() if it finds one that's not referenced.
Typical usage of the block validation functions:
fda_clear_refs(); /* clear all block references */
for each allocation do
fda_set_ref(allocation); /* mark allocation in use */
done
fda_assert_refs(); /* this will assert if a leak is found */
4. Reporting functions:
FDA has 4 functions for reporting various aspects of allocation
status.
fda_get_byte_count() tells you the current total number of bytes
your application has allocated. (this does not include debugging records)
This will give you an idea of how much memory your application is
using at any given time.
fda_get_block_count() returns the total count of current allocations.
fda_enum_locations() calls a user supplied enumeration function with
file, line, count information, this allows you to see your file by
file allocation density. ;) fda_enum_locations() returns the total
number of locations that have memory allocated.
fda_enum_leaks() calls a user supplied enumeration function with
file, line, size, and ptr for every block not marked as referenced.
One use for fda_enum_leaks() is checking for leaks when your program
exits:
void enum_fn(const char* file, int line, size_t size, void* ptr)
{
printf("Memory leak: %s: %d - %d bytes at (%p)\n", file, line, size, ptr);
}
int main(void)
{
...
#if defined(DEBUG)
/* check for memory leaks before exiting */
fda_clear_refs();
fda_enum_leaks(enum_fn);
#endif
return 0; /* return from main */
}
The test file fdatest.c gives examples of usage for most of the functions
available with FDA.
Please let me know if you encounter any problems with FDA.
So far FDA has been built and tested on linux and Windows NT.
If you find that it works with or without change on other platforms
please let me know so I can make the appropriate changes to the
code and add it to the list of tested platforms.

208
doc/features.txt Normal file
View File

@ -0,0 +1,208 @@
Undernet server features.
-------------------------
This document is supposed to list the features that undernet supports and
provides to clients, and which version of ircu this was added. Additional
numeric replies should be added here too.
Extended Who information: (WHOX)
Version: unknown, but at least 2.10.07+
This is described in the file 'readme.who'
USERIP:
Version: unknown, but at least 2.10.07+
This works the same as userhost, but returns the IP instead, useful for
setting a ban on someones IP address instead of their nick.
usage:
USERIP nick[,nick...]
returns:
RPL_USERIP (307)
:server.name 307 target nick[*]=[+|-]user@host...
RPL_ISUPPORT:
version: 2.10.08+
This sends a numeric during client signon that lists various features that
ircu supports. This allows client and script writers to know what features
they can use, and various parameters about the irc server. The numeric
used is '005' to try and maintain some semblance of compatibility with
dalnet which has a similar feature. The 005 numeric may be split across
multiple lines if the length exceeds 512 characters.
The format is:
:servername 005 target feature1 feature2... :are supported by this server.
:servername 005 target feature200... :are supported by this server.
features are either a word describing the feature eg: 'SILENCE', or a word
describing the feature and an equals and a list of parameters.
eg: SILENCE=15 (says that we support silence, and we support up to 15 of
them per user), or FOO=12,3 (says we support FOO with parameters 12 and 3)
for example 2.10.08 lists:
:test.undernet.org 005 test SILENCE=15 WHOX WALLCHOPS USERIP CPRIVMSG
CNOTICE MODES=6 MAXCHANNELS=10 MAXBANS=30 NICKLEN=9 TOPICLEN=160
KICKLEN=160
NOTE: Versions prior to 2.10.08+ use numeric 005 as part of 'MAP', so
005 should be /not/ be used after the server registration has occured.
(ie: after END_OF_MOTD has arrived).
MAP:
Version: unknown, but since 2.9.30 at least, updated in 2.10.08
/map shows the servers as the server percieves them, who's connected
to who in a pretty display. In version 2.10.08 it also lists the
amount time time it takes a message to get /from/ a server to the local
server - this measures the one way lag only, in 2.10.08 it also lists
the number of clients that are currently on that server.
The lag estimation is very approximate and depends on people changing nick
and joining channels, so the less clients on a server the less reliable the
lag estimation is.
Map prior to 2.10.08 uses:
RPL_MAP 005
RPL_MAPMORE 006
RPL_MAPEND 007
Map changed in 2.10.08 to allow for ISUPPORT on numeric 005, the new
numerics are:
RPL_MAP 015
RPL_MAPMORE 016
RPL_MAPEND 017
WALLCHOPS:
Version: unknown, but since 2.10.07
WALLCHOPS sends a message to all channel operators (@)'s on a channel.
It does /not/ require you to be op'd (@'d) to do so. This is a feature.
syntax:
WALLCHOPS #channel :message
or:
NOTICE @#channel :message
this sends:
:user NOTICE @#channel :message
to clients that are @'d on the channel.
CPRIVMSG/CNOTICE:
Version: unknown, but since 2.10.07
CPRIVMSG/CNOTICE are a way around target limiting in recent undernet
servers. Undernet servers prevent you from sending messages to too many
people at once in an attempt to help cut down the amount of spam that
occurs on the network. Because there are several situations where you want
to send messages to lots of people that are on the same channel as you
(autogreet's and gamebots for example) an 'escape' was made in the form
of CPRIVMSG/CNOTICE. These allow you to send a privmsg/notice to a person
on a common channel if you are op'd (@'d) without incuring a target
penalty. If you see 'Target changed too fast' messages, you should
probably be using these commands.
Syntax:
CPRIVMSG #channel nick :Message
CNOTICE #channel nick :Message
Results are the same as for 'PRIVMSG' and 'NOTICE' respectively.
SILENCE:
Version: unknown, 2.9.32 at least.
Silence is a server side ignore. You can /silence +hostmask or
/silence +nick, to add someone to your silence list, or use /silence
-hostmask to remove it. /silence will list your 'silence list'.
you can /silence nick, to see someone elses silence list (useful for
helping someone). Silence is preferably used as a last resort as it
tends to use server CPU time. Undernet typically only allows 15 silences
per user. in 2.10.08+ this information is available in the RPL_ISUPPORT
line.
Syntax:
SILENCE +hostmask
SILENCE +nick
SILENCE -hostmask
SILENCE -nick
SILENCE nick
reply:
RPL_SILELIST 217
RPL_ENDOFSILELIST 218
User modes:
Version: various
Undernet supports these additional user modes:
+d: Deaf & Dumb. This user will not get any channel traffic. Used for
bots.
+k: This user cannot be kicked, deop'd or /kill'd. This usermode may only
be set by a server, it may not be set by a user. This is used by
undernet service bots (X/W/UWorld etc)
+g: List channel HACK:'s
+s: Server messages - takes a parameter of which masks to send, see
'snomask.html' for more details. (2.10.0+)
LIST:
Version: Unknown
List now takes various parameters to allow you to quickly and efficiently
find interesting channels. These are:
>n or <n show channels with less than or greater than 'n' users
respectively
C>n or C<n show channels that have existed for less than or greater than
'n' minutes.
T>n or C<n show channels that have had their topic changed in less than or
greater than 'n' minutes.
Additional Numerics:
RPL_LISTHELP 334
Additional Topic Numerics:
Version: Since the dawn of time.
Topic also lists who set it and when they set it.
Additional Numerics:
RPL_TOPICWHOTIME 333
Straight after the topic:
:server.name 333 #channel Isomer 923423442
where the number is seconds past 00:00 1970-01-01 that the topic was set.
INVITE list:
Version: 2.10.08+
/invite without any parameters lists which channels you have an outstanding
invite to (ie: an invite to a channel which you haven't joined)
Additional Numerics:
RPL_INVITELIST 336
RPL_ENDOFINVITELIST 337
NICK change:
Version: Since the dawn of time.
Undernet prevents you from changing nick on a channel while your banned.
Undernet prevents you changing nicks more than once per 30 seconds, you
get one 'free' nick change if you haven't changed nick recently.
Additional Numerics:
RPL_BANNICKCHANGE 347
RPL_NICKTOOFAST 349
Target limiting:
Version: Recent 2.10.07ish at least.
Undernet prevents you from changing 20 targets per 2 minutes. A target
is a 'Nick' or 'channel'. This is to prevent spam. If you message more
than 20 people or join more than 20 channels in two minutes then you'll
start getting 'Target change too fast' and will have to wait before you
can start talking. See CPRIVMSG/CNOTICE above for information on how to
avoid this.
Additional Numerics:
ERR_TARGETTOOFAST 349

28
doc/freebsd.txt Normal file
View File

@ -0,0 +1,28 @@
This document pertains to kernel panics with FreeBSD involving mbufs.
This is a well documented problem with programs such as ircu, and inn that
involve a lot of clients, the solution is generally to set the option 'NMBCLUSTERS'
to a reasonably higher number the default is 1024, you should first try increasing
this *10 (10240) and continue checking mbuf usage with netstat -m.
It has been recommended that this be increased as far as *50 (51200) (although more
won't hurt, it uses more memory, so don't go too far overboard) it's been stated
over and over that the default is very low, but then, you're supposed to know how
to configure your OS for what you're doing right? =)
There is a note in the configuration for this:
# Note that you will probably want to bump up NMBCLUSTERS a lot to use
options NMBCLUSTERS=1024
Merely change the 1024 to the number that best suites your system.
-poptix poptix@poptix.net
April 17, 2000 Matthew S. Hallacy

478
doc/history/2.4.notes Normal file
View File

@ -0,0 +1,478 @@
/************************************************************************
* IRC - Internet Relay Chat, 2.4.notes
* Copyright (C) 1990 Markku Savela
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
IRC 2.4 release notes 6 May 1990/msa (Markku.Savela@vtt.fi)
============================================================
This document explains the changes I have done up to this
point. Some additional changes and packaging has been made by
Chelsea (chelsea@earth.cchem.berkeley.edu). This is personal
view of the changes.
CHANGES TO LAST THE OFFICIAL RELEASE (2.2PL1)
This release of irc2.4 is based to 2.2PL1 release (see the
HISTORY chapter later in this document). Aside from fixing the
bugs, this version is in many ways different from the 2.2PL1.
The purpose of the most changes is to make it easier to run an
IRC server. Normal users benefit from these changes indirectly
by getting a better maintained server.
1. Changes visible to normal users
Even while mainly fixing bugs, some user visible changes have
crept in too.
1.1 General note on wildcards
Many commands accept now wildcard matching where applicable. All
compares are case insensitive (e.g. "a" == "A"). The wild cards are
? matches any single character
* matches any number of characters, also empty
string. [PL1 had a bug, which caused "*du*"
not match "....edu"].
1.2 Server supported wildcards for "/who mask" command.
Protocol message is "WHO mask", where mask can be
empty
0 List all users [No change from PL1]
* List all users on the same channel where the user is
(or all, if user is on 0) [No change from PL1].
number List all users on the specified channel [No change
from PL1]. Note, if the "mask" begings with a digit,
this form is assumed, and the remainder of mask is
ignored, e.g. "/who 12*.fi" gives all people from
channel 12 and ignores the "*.fi" part.
mask If the mask is any string, it will be compared
*separately* to each information field of the user
and if a match is found in any field, that user
is included into the list. The fields searched
are
nickname
loginname (account name)
real name (text shown in parenthesis)
hostname (users machine)
servername (server he/she is using)
Note: servername is not usually shown on WHO output,
but is included in anyway. Example: finding all users
somehow connected with Finnish sites, can be achieved
with mask "*.fi".
1.3 Changes to /whois command
As WHO, also /whois accepts wild cards as a parameters. WHOIS
returns information for all users whose nickname matches the specified
mask.
WHOIS automaticly calls WHOWAS [see below], if the attempted nickname
is not found.
1.4 Short term "WHOWAS" history
The server has a short in memory cache of the recent nickname changes
(the current default is set to 200 last changes). The design goal of
this is that it remembers changes in last few minutes, there is no
intention of this to be a long term history. That must be a separate
project, although it could use the hooks provided by this service.
"WHOWAS nickname" queries this cache and returns about the same
information that WHOIS would do, if the nickname is found. Wildcards
are not accepted here, this is a specifically designed feature. If
the name is not found, WHOWAS doesn't reply anything. This is because
the most useful use of WHOWAS is implicitly through "WHOIS".
This history is also implicitly utilized by KILL command.
1.5 New SERVER-SERVER/SERVER-CLIENT protocol message WALLOPS
The message ":source WALLOPS :Message" sends the message text
to all operators that are currently online. Any user can use this
command, it's not restricted. How this function is activated, depends
on the client, but if nothing else works, "/quote wallops text" should.
NOTE:This function will not be fully operational until *ALL*
servers have upgraded to version 2.4. Also, operators
must be using a client that recognizes this command.
This is really a hasty addition. But, done this way it follows
the general IRC message philosophy, where messages are sent only
to links where they are needed (e.g. WALLOPS goes only to servers
that have opers online--it's not broadcast to every server).
1.6 General use of wildcarding in server queries
All commands that previously took a servername as a parameter,
now accept also a wildcarded mask. The mask is replaced with
the first matching servername. The following user level commands
are affected
/admin server -- administrative info
/time server -- local time
/version server -- the server version
/motd server -- "the message of the day"
/info server -- info (usually same on same server version)
/stat f server -- statistics information
/users server -- users logged on server machine
Note: Remote capability is a new feature for "info" and "stat"
commands. Until all servers have upgraded, these commands may not
reach the intended target and may return the information from some
intermediate server.
1.7 Marking user AWAY
v2.2PL1 version and earlier showed the AWAY-state (G) only for
the local users of the same server. AWAY status could be queried
only by sending a message to a user. This release (or since msa.4)
broadcasts the away status to every server and the commands /WHO and
/WHOIS give this information reliably.
A side effect of this change is: when a user marks himself/herself
as AWAY, all pre-msa.4 servers that are reached will send back an
acknowlegde message. Until all servers are upgraged, use of AWAY
is somewhat inconvenient. If you get extra messages from AWAY,
they also contain the server information. Use /admin command and
send a *friendly* request for the admin to upgrage his/her server
to a working version, namely 2.4 :)
1.8 Servers don't restrict characters within messages
The parameter fields of the messages can now contain any characters
in range 1-255, except '\r', '\n' and '\0'. The client programs should
by default filter away the "dangerous" control characters, but intelligent
clients can utilize this change and allow exchanges with foreign
8-bit (or wider) charactersets. (The actual command parts must still be
represented with the ordinary 7-bit characters.)
2. Changes visible to the server administrator
2.1 Identifying servers
Servers/clients have now always two names (it was this way in
PL1, but I think this version makes the idea more clear):
Announced Name:
The official name of the server (the name you use in
/time, /quote connect, etc) or users nickname. Servers
name is usually the hostname, but can actually be almost
any string of characters resembling hostname. This one
is given in M-line of ircd.conf.
Socket hostname:
Socket hostname of the server or client. This is the hostname
of the connecting server/client and this is resolved from the
connection. If resolve cannot be done, ircd defaults to using
numeric IP-address. *ALL* access checks are based on this
name, especially noteworthy fact, if your resolver cannot find
hostnames by IP-address, you must allow the access by IP-numbers
in your ircd.conf.
In many places, where servers name is shown, actually both are
shown. The general format of the displayed name is
AnnouncedName[SocketHostName]
When a connection is yet unkown, there is no AnnouncedName, and if the
AnnouncedName is the same as SocketHostName, the "[..]"-part is omitted.
2.2 Many notices to local operators
If an oper is signed on the server, he/she will receive many
notices about exceptional conditions and servers actions. When
something goes wrong, it should be much easier to fix the problems.
Few often occurring, inportant error messages are
"Write error to SERVERNAME, closing link"
write() to socket returned with an error. Server is
closing the link. This means usually network problems
which you can do nothing about.
"Max buffering limit exceeded for SERVERNAME"
This is the situation where old server would have been
"frozen". The socket buffers in your OS have been filled and
even servers own predefined internal buffering MAX for a link
has been exceeded. Exceeding this limit most likely means
that the link is really dead, so the server closes the link
and scratches all queued output for it. If the limit is
set high ( > 20000 bytes), you won't usually see this, but
just "No responce from SERVERNAME, closing link" as the
server does not reply to PING as it should.
"Link SERVERNAME cancelled, server SERVERNAME already exits"
Two different servers from your net fragment attempted
to connect same other net fragment about the same time
and this collision is detected at your server. IRC routing
does not allow loops, the link causing the loop is closed.
(Which of the two links gets closed is mostly determined
by pure chance and timing--you may lose a better link this
way. Collisions should be rare in normal operation, if
the timers in "config.h" are not messed up too much...)
Of course, you get this too, if you try to connect to a
server that is already connected by some other route. In
that case your attempted connection is just safely cancelled.
The notices attempt to be self explaining.
2.3 Links statistics collecting
IRCD now counts the bytes and messages transmitted to each open
link. This information can be output with a command "/stats l"
("/stats" or "/stat m" will give the old message count statistics).
Sample output
Link SendQ SendM SendBytes RcveM RcveBytes Open since
oddjob.uchicago 0 203 8067 772 34321 Sun May 6 02:15:45 1990
cs.hut.fi[sauna 0 1916 79798 94 3082 Sun May 6 01:51:25 1990
otax.tky.hut.fi 0 3722 151511 426 22690 Sun May 6 00:25:54 1990
nada.kth.se 0 8775 355811 5333 223853 Sat May 5 14:11:49 1990
vehka.cs.uta.fi 0 23816 882000 901 41156 Fri May 4 22:50:23 1990
lut.fi 0 25145 943765 1068 35020 Fri May 4 22:34:16 1990
kreeta.helsinki 0 24286 899191 957 47085 Fri May 4 22:33:28 1990
naakka.tut.fi 0 27754 1067302 8288 362960 Fri May 4 22:33:14 1990
joyx.joensuu.fi 0 30003 1172949 2300 80053 Fri May 4 22:33:05 1990
tel4.tel.vtt.fi 04083771 167473890 863475 35022755 Mon Apr 23 00:15:17 1990
| | | | | |
| | | | | Link established
| | | | The number of bytes received
| | | The number protocol messages received
| | The number of bytes transmitted
| The number of protocol messages transmitted
The amount of queued data in bytes (if socket is hung)
The last row (with the local servername) contains the total
cumulative counts for all connections since the server was started.
One can query the statistics of a remote server by adding the servers
name to the command "/stat l servername". Of course, this only works,
if all intermediate servers have upgraged. The first "old" server
will stop the propagation and return the message counts by default.
2.4 Connecting servers
An oper can manually activate a connection phase to any server
defined in ircd.conf C-lines (to successfully complete the connection,
the N-line must be present too). The message achieving this is
CONNECT servername portnumber
where servername may be a mask string containing wildcards. This
name is matched against entries in ircd.conf (notice: the testing
is made in reverse order, e.g. the last C-line in ircd.conf is tested
first). If portnumber is omitted, the ircd uses the one given in the
found C-line. If the C-line does not have the portnumber, the compiled
default will be used (PORTNUM from config.h).
This release allows also for remote connecting. An oper can send
a connect request to remote server with
CONNECT servername portnumber remoteserver
This command is passed to the 'remoteserver' and it then tries to
execute it like it was given locally. (If there are opers online on
that server, they will get a notice about this happening.) Note, that
one can remotely connect only what is defined in ircd.conf. Usually
one needs and should use this only for immediate your neighbours. Nobody
should randomly go and give connect requests to distant servers, unless
one knows it's absolutely necessary and is very familiar about the
linking setup there.
2.4 Terminating connections
The SQUIT command in PL1 was not intended to be used manually and
was very dangerous to use (it also created so called "ghost servers").
Since msa.4, the SQUIT has been safer to use manually.
"SQUIT z" s a
\ /
\ /
------- x ------- y --| |-- z ------- b
/ ^ \
/ | \
p c
"SQUIT z" will break the link between "y" and "z" if injected
into system from "s". After that the net will be in two fragmets,
broken between "y" and "z". Server "z" never sees the actual
SQUIT, all it observers is that the link to "y" suddenly closes
(opers on z would see it as "Server y closed the connection"
notice. Opers on y would see it as "Received remote SQUIT from
x", note that the actual source "s" is not identified in the
current version--for reasons too complicated to be explained
here).
*WARNING* *WARNING* If the server "y" is still running pre-msa.4
(like PL1), don't *EVER* issue a SQUIT for its links (unless the
link is to a leaf node or verifiably a "ghost server").
Note, that when the link between "y" and "z" breaks, y will spit
out SQUIT's for "z", "a", "b" and "c" to "x". At same time "z"
is sending SQUIT's for "x", "s", "p", etc to "a", "b" and "c".
SQUIT is normally generated by servers automaticly, it's just
a later modification (msa.4) that allows an OPER to use this
same message to "simulate" a link break at certain point.
*IMPORTANT* If server "z" has configuration "C:y::y:6667", it
automaticly attempts to reconnect after a short delay (currently
10 seconds), but only *if* the connection has been up long enough
reliably (currently set to 10 minutes). If the thus formed link is
squit another time, it will not attempt to come back immeatedly.
This gives an oper time to reconfigure the links if that first
short delay is not enough.
As in all commands, also SQUIT accepts wildcards, but be careful to
give sufficient identification. SQUIT of wrong server is not nice...
2.5 KILL message
KILL will implicitly use the history database. If a KILL is
issued for a nick that has been changed to another, the server
will automaticly re-issue the kill with the new nickname, if
the change has happened recently (current value should be 90
seconds). If a "terrorist" is clearly distrupting channel by
bombarding it with garbage from negative channels and changing
nick all time, there is no need to consult the "WHOWAS" data
base, just use the nickname that was used to send the garbage
and ircd hunts the culprit down. When this change of target
happens, the oper issuing the kill is notified.
NOTE: With automatic, kill-proof-reconnecting clients, the
value of KILL is becoming insignificant...
2.6 Changing the server defaults from the command line
The servers activation command is now
ircd[ -f configfile][ -h servername][ -p portnumber][ -x debuglevel]
where parameters can be given in any order. If the "configfile"
is defined, it will override the default specified in the file
"config.h". If "servername" is defined, it will override the
one defined in the M-line on the configuration line. "portnumber"
will override the compiled default (from "config.h") or the
one from the M-line of the configuration file. The "debuglevel"
will determine the amout of logging the server does into a
log file that has been define in "config.h". The "debuglevel"
should never be defined for a server running normally, it can
quickly generate megabytes of trace. Usually needed only when
the server is incapable of starting properly at all, then one
run with "-x9" usually is enough to reveal the problem.
3. General cleaning up and commenting the code
This issue is controversial. My way of fixing bugs is not just
fix them, I also want to program defensively, make it difficult to
make new errors. Thus I have heavily reformatted and reorganized
those files that I have had to touch. Some functions have been
renamed intentionally to catch all uses of those functions [because
the functions semantics or calling sequences have been changed].
This release (2.4) will be the last IRC version I'm contributing
to. If you have any wishes or complains about the code or functioining
of IRC, use the source or ask whomever it happens to be the current
developer.
HISTORY
There have been many different versions of IRC and many of those
versions are still in use. The following attempt to bring some
clarification to the versions. This starts from 2.01.6, hopefully
no servers are running older versions...
...
...
2.01.6 A version from WiZ in summer 1989
...
2.01t6 A series of releases, which contained minor
2.01T6 adjustements and bug fixes to the base version.
2.01u6 Some of those fixes caused extra errors, of
2.01U6 this series versions 2.01U6 and 2.01v6 are at
2.01v6 least known to be rather stable.
2.1.0 Mike Bolotski created these versions from the sources
2.1.1 of 2.01U6, but unfortunale some devious bug crept in
and caused a lots of linking problems (the nasty "ghost
server problem" splintered the net constantly). These
versions must be deleted on sight :) [Autumn 1989]
2.2 This version is the 2.01v6 sources repackaged into
multiple directories by Mike again. Probably nobody
is running this base version, because is was promptly
followed by two patch releases [Autumn 1989]
2.2PL0 These two are the last major "official" releases
2.2PL1 and most of the servers upgraged to either of
these.
2.2msa Unfortunately 2.2PL1 version had a tendency to die
mysteriously very often. So, I started to look into the
code from March 1990 and that resulted a series of
patches to the 2.2PL1 server code, but finally
decided to release full server code releases of which
few have got wider distribution
2.2msa.4
Has most of the known PL1 bugs fixed and seems
to be very reliable. But once servers started
staying up, a new problem appeared: socket
buffers started getting full and servers tended
to freeze very often for long intervals.
2.3alpha
2.3 Is an attempt to make an official release from 2.2msa.4
code, but hassles with changed copyrights make this
version unacceptable. Besides, 2.3alpha or 2.2msa.4 are
now obsolete, old versions :)
2.2msa.x
To solve the freezing problems, the server code is changed
to use non-blocking sockets.
2.2msa.7
2.2msa.9
Are intermediate test versions, of which .9 seems
to have most of the problems solved.
2.2msa.10
Never released. This is slightly improved version
of msa.9, some new features.
2.4 Is a release which combines 2.2msa.10 and Chelsea's
modifications to the server. Also, this release has
once again reorganized the directories and makefiles.
-- msa (Markku.Savela@vtt.fi)

128
doc/history/2.7-New Normal file
View File

@ -0,0 +1,128 @@
* WHOREPLY and NAMREPLY become numberics instead of strings.
* msa's patches to kick/mode to attempt to follow nick name changes
* spike's patches to get SUMMON to find last idle tty
* melazy's various DNS improvements.
* pjg's saber C check
* prefix changed for all server->client messages in which the origin
of the sender is a client to appear as follows:
nick!user@host
* TRACE output changed.
* # channel topics broadcast
* +-numeric channels removed from server
* numerics for TRACE output 201-209
* new switches for STATS: i,k,q,y
* numerics for stats output 211-219
* MODE changed to also operate on users
* deoper added as both mode and direct command. deoper sends out
":user OPER -" to other servers. (from Kaizzu)
* XTRA/VOICE/GRAPH removed.
* MODE +a scrapped.
* added custom ANSI-compatible ctype macros to ensure speed
* user modes i,w,s,o implemented as follows:
i - invisible. over rides any channel mode for those external
to your channel. you are invisible.
w - receive wallops
s - receive local service notices (errors, etc)
o - operator flag. (can not be set currently except using the
OPER command).
* MODE +b added to ban a user from a channel using "nick!user@host" as
the mask to match to the user. If the user matches the ban mask they
are not allowed in. MODE +b with no parameters returns the list of
ban masks currently in place. MODE +b <mask> and MODE -b <mask>
add/delete a ban mask respectively.
Thanks to HulkHogan (andy@lingua.cltr.uq.oz.au) for defining what
we needed here and the 'BlackBall' approach.
* Operator passwords may now be stored in the ircd.conf file as the
encrypted plaintext. Crypt(3) is used to generate the matching
plaintext from the OPER command. Thanks to the following people
for help with this:
Sean Batt (sean@coombs.anu.edu.au),
Andy. M. Jones (andy@lingua.cltr.uq.oz.au),
Nelson Minar (minar@reed.edu).
* Server now creates "ircd.pid" file when booted. Holds the current
pid of the server.
* Each O and I line in the ircd.conf file may be linked only a number
of times equal to or the max. links value for the class they belong
to.
* Server stores results of any successful DNS lookups for servers so
that future lookups are not needed. A rehash will wipe all previous
lookup results and cause the server to start over. The server will
attempt to lookup each hostname in a C/N line on booting. This may
cause a delay during starting the server.
* All functions should be of the form "function_name", macros of the
form "MacroName" and constants as CONSTANT.
* Services are now treated with some respect. A service is associated
with an S-line in the ircd.conf. A service must send a NICK/SERVICE
pair on connecting to achieve service status.
* JOIN/PART now accept a list of channels in the first parameter with
each separated by a ",". eg "JOIN #foo,#bar,#foobar"
* A hopcount for the distance to nicknames and servers has been
introduced (for better or worse). It is passed as the second
parameter to both NICK and SERVER.
WHO and LINKS both report the hopcount in the info field.
* Default for WALL and WALLOPS set "off"
* rearranged config.h
* ISON now returns nicknames with the actual case, i.e.
ISON wiz will answer WiZ
New into 2.7.1
* STATS u, r, z
u - uptime
r - CPU useage stats
z - counts and shows current memory useage
r & z are only available if DEBUGMODE is defined in config.h
* GETHOST which forces all reverse lookups of ip#'s to also match
when doing a forward lookup of the hostname returned.
* SENDQ_ALWAYS buffering policy for sending data over links.
(Server tries to buffer as much data as possible before attempting
a write).
New into 2.7.2
* NOTE (once again appears and in much better state)
* WHOWAS gives a list of known users of the nick in question
rather than just the most recent.
* Server can accept both server and client connections via a unix
domain socket. This provides greater security and reliability for
connections between the host and itself. (#define UNIXPORT)
* STATS C reports L-lines: New Numeric 241
* #define for showing all users the invisible count from LUSERS

32
doc/history/ChangeLog.07 Normal file
View File

@ -0,0 +1,32 @@
#
# ChangeLog for Undernet ircu Servers
#
# $Id: ChangeLog.07,v 1.2 2003-01-08 03:17:18 klmitch Exp $
#
# Please insert new entries on the top of the list, a one or two line comment
# is sufficient. Please include your name on the entries we know who to blame.
# Please keep lines < 80 chars.
#-------------------------------------------------------------------------------
* Added hostname hiding compatible with ircu2.10.10 to allow host hiding
for transitioning services, back out pline8 for now. --Bleep
* Fixed default behavior for BADCHAN. supposed to DEFAULT yes, however
should not change each time a make config is done. -- WT
* doc/readme.www: add Runs link update patch for linux info. --Bleep
* channel.c, channel.h: add David M's fixup for local channel oper overrides.
--Bleep
* s_misc.c (date): add Runs Y2K patch --Bleep
* hash.c (hChangeClient): bug fix. If the client pointer matched the first
pointer in the bucket, the change was ignored (returned 0), leaving stale
values in the hash table, eventually causing the server to die for mysterious
reasons. Bug discovered by Quant and Isomer --Bleep
* config-sh.in, channel.h, numeric.h, channel.c, s_debug.c, s_err.c:
add lchanmode patch by CaptJay, add symbols to incredibly long
feature string. Bump patchlevel to .03 --Bleep
* list.h list.c s_conf.h s_conf.c opercmds.c:
badchan patch 2 seperate settings, allow global, and allow local.
currently allow_local is 'unapproved' for use on undernet. --WildThang
* ircd.h, s_serv.h, s_debug.h, ircd.c, s_user.c, s_bsd.c:
removed STAT_MASTER/BOOT_OPER code, original patch by Isomer --Bleep
* s_user.c (m_nick): removed redundant check for acptr --Bleep
* ChangeLog (file): added ChangeLog, and BUGS files, import to ircu2.10 --Bleep

696
doc/history/ChangeLog.10 Normal file
View File

@ -0,0 +1,696 @@
#
# ChangeLog for ircu2.10.10
#
# $Id: ChangeLog.10,v 1.2 2003-01-08 03:17:18 klmitch Exp $
#
# Insert new changes at beginning of the change list.
#
-------------------------- Released 2.10.10.pl15
* Fiddle with /KILL and various exits to make the user experience uniform,
no matter who's doing the killing or where. Previously, differences in
QUITs and in the messages sent to the killed client could help make a
partial map of the network; now that these messages are all uniform, there
is no way to tell. -Kev
* Split ISUPPORT numeric into two numerics, so as not to exceed the 15
parameter limit imposed by the RFC -Kev
* Turn on HEAD_IN_SAND_REMOTE...oops -Kev
* Send prefixed error messages to other servers, so ERROR doesn't get
interpreted as a prefix -Kev
* Reverse sense of HEAD_IN_SAND_WHO_HOPCOUNT to do what was intended; use a
hopcount of 0 if user is using /who on him/herself -Kev
* Allow a user to see his/her own idle time without having to do
/whois <nick> <nick>; correct spelling of HEAD_IN_SAND_IDLETIME to
HEAD_IN_SAND_WHOIS_IDLETIME -Kev
* Fix a missing ')' in the idle time stuff -Kev
* Include ircd_policy.h in whocmds.c -Kev
* Fixed bug in idle time, thanks hektik -- Isomer
* Update 005 to be compliant with other networks -- Isomer
* Hide hop count -- Isomer
* Hide idletime unless you explicitly ask for it -- Isomer
* /wallops and /wallusers would dump core because of the previous change--my
bad. Now only include user@host when sptr is a client. -Kev
* /wallops and /wallusers would leave out the user@host--noticed because
pl14 broke my script. Fixed. -Kev
* Fix several compile warnings, including the one in table_gen.c -Kev
* Fix a bug in m_silence.c that rendered it uncompilable -Kev
* Hopefully make mode clears during bursts appear to originate from local
server -Kev
* Fix several things to send server<->server protocol messages with numeric
origins -Kev
* Rework directed notices and mass-messages to use numerics and tokens
as appropriate; the latter required the modifications to
sendto_match_butone() -Kev
* Redefined how sendto_match_butone() works, since it's only used with
PRIVMSG or NOTICE -Kev
* Bumped patchlevel to pl15(development) -Kev
* Corrected reverse-sense of HEAD_IN_SAND_REMOTE test in m_whois() -Kev
* Clean up logic in m_whowas(), corrected numeric reply -Kev
* Finally fixed /whois to tell you what your own server is -Kev
* Clean up logic in add_banid() with some well-placed DupString()'s -Kev
* Hide which server performed a nick collision kill -- Isomer
* To allow for remote whois not giving away the remote server, all remote
numerics to clients are remapped to come from the local server :/ -- Isomer
* All remote queries are disabled for users, except /whois -- Isomer
(/whois now uses the second parameter for which server to use, ie:
/whois <ignored> <nick> will query <nick>'s server.)
* Fixed /who showing server name -- Isomer
* Fixed burst showing linking server -- Isomer
* Fixed burst bans showing linked server -- Isomer
* Fixed /whowas showing server name -- Isomer
-------------------------- Released 2.10.10.pl14 (You got any issues with that punk?)
* Changed (then fixed) /LINKS to output an empty links list -- Isomer
* Make netsplit server notice say the right thing
* Final fix for HEAD_IN_SAND_WHOIS_SERVERNAME
* Fix a bug with implementation of HEAD_IN_SAND_NETSPLIT
* Permit users to find out what server they're on, since they already
know -- Kev
* Added HEAD_IN_SAND_WHO_SERVERNAME to cover final source of server
names -- Kev
* Fixed wallops, wallusers now sends wallops to local clients,
wallusers to servers.
* Added host to /kill messages -- Isomer
* Fixed whois (opers can see server names) -- Isomer
* Implement walluser -- Bleep
* stats fixed -- Isomer
* trace disabled from non opers -- Isomer
* server name removed from whois (but not /who, shrug!) -- Isomer
* netsplits are now represented with "*.net *.split" -- Isomer
* Done /links -- Isomer
* Modifications to map as suggested by nighty -- Isomer
* Wallops is the only code that uses sendto_ops_butone now, this
isolates wallops entirely. No server notices sent by wallops.
* HEAD_IN_SAND_SNOTICES done -- Bleep
* HEAD_IN_SAND_WALLOPS done -- Bleep
* HEAD_IN_SAND_DESYNC done -- Bleep
* HEAD_IN_SAND_MAP done -- Isomer
* According to CFV-165, buring our head in the sand to try and
* hide from DoS - First pass -- Isomer
* As requested by hop: hidden keys are shown as "*" not "" -- Isomer
* As requested by Buff: allow admins to *disable* below behavour -- Isomer
* As requested by Adriel, compile time option to disable mo_wallops
-- Isomer
-------------------------- Released 2.10.10.pl13
* Don't allow two copies of the server to start -- Isomer/Kev
-------------------------- Released 2.10.10.pl12
* Release 2.10.10.pl12 before Mr_RIP threatens physical violence -- Isomer
* Don't 'hubhide' nick's in /trace (oops!) -- Isomer
* Allow K:line by realname, updated client connection logging -- Gte-
* ircd/m_join.c: use ERR_BANNEDFROMCHAN instead of ERR_BADCHANNAME -- Kev
--------------------------- Released 2.10.10.pl11.(release)
* Fixed G-lined (reason), thanks to dfx -- Isomer
* Added reason to the "G-lined (reason)" quit messages. -- Isomer
* Removed 'for nick[1.2.3.4]' from quit messages, they're redundant
and make hub hiding more reliable --Isomer
* ircd/s_user.c (hunt_server): add 'No such server' message back
--Isomer
* ircd/s_bsd.c: remove ALWAYSFLUSH - the problem wasn't ircu's fault
-- Isomer
* ircd/m_names.c (m_names): don't add a space if the user's a
zombie; fixes an overrun where we generate a huge number of spaces
in the names reply without length-checking them properly -- Kev
* added 'ALWAYSFLUSH', if you thought the furgeson flusher was bad...
--Isomer
* Fixed /USERHOST again. Horribly embarrased. Thanks again Liandrin
--Isomer
* Added extra field to /stats Y showing how many people are in that class.
Information was previously available via /trace, however tended to flood
you off if you weren't on a good connection. Requested by Mr_RIP
-- Isomer
* Fixed 'BADCHAN' resetting itself to 'Y', reported by Gator --Isomer
--------------------------- Released 2.10.10.pl10
* Released 2.10.10.pl10
* Backported /names optimisation from 2.10.11.
'/names 0' now returns verbose listing, '/names' simply returns
ENDOFNAMES. Disallow harmfull /names usage. --Gte
* Fixed ERR_NOSUCHNICK bug in userhost, thanks to Liandrin --Isomer
* Conceal more bugs in IPcheck --Isomer
* Add 'POST' as a unregistered command to disconnect people abusing web
proxies --Isomer.
* Conceal bugs in IPcheck --Isomer
* Fix for changing the wrong define --Isomer
* Fix for the easter buggy. --Isomer
* Fix for rpong --Run
* Fix for other IPcheck bug, thanks BLMet. --Bleep
* Fix for IPcheck bug, rewrite IPcheck from scratch (mostly),
add changes for new code to s_user.c, ircd.c --Bleep
* Shorten connection timeout for auth queries to 60 seconds
If connection is from localhost use the server alias for the
client host. --Bleep
* Fix for ident bug --Isomer
* Fix for rping/rpong --Gte
* Add m_pong to parser handler --Bleep
* Fix for EXTENDED_NUMERICS bug doh!!! --Bleep
* Fix for Max Undernet Server bug --Bleep
* Fix for PRIVMSG<->NOTICE translation from hubs --Bleep
* Fix for Bogus protocol strings for P9 servers --Bleep
* Hookup UPING code again, cleanups --Bleep
* Convert numerics back to mask and shift extended numerics
follow same mechanism --Bleep
* Fixed bogus errno return on Solaris --Bleep
* Fixed core on RPING bug, tokenized RPING --Bleep
* Remove add_local_domain entirely, unused --Bleep
* Merge u2_10_10_beta06 create branch u2_10_10_beta07 --Bleep
* Remove size_t from socket calls, audit usage of size_t
values. --Bleep
* Fix for OSF1, RES_NOALIASES not defined there. --Bleep
* Don't bother doing hostname lookup or setting me.sockhost
since we never want to display it there is really no reason
to have the info. --Bleep
* Bugfix broken N:line check in chkconf --Maniac
* Bugfix, fix clients occasionally getting stuck in IPcheck
code. Add note to members in client struct that aren't used
for any remote client code, didn't want to actually move them
this close to release (paranoia) --Bleep
* A few little cleanups in check_pings, removed yet another
address display. --Bleep
* Bugfix, autoconnects displaying server IP address to opers.
--Bleep
* Remove names from /stats p, since its always the server
name from the M:line anyhow, (redundant information)
--Bleep
* Unborked throttling. --Bleep
* Fix two stupid bugs, related to IP mismatch kills. --Bleep
* Clean up configuration, make it a bit easier for admins to
turn off asserts and heap checking code. Moved host name dns
query for listener virtual host ports to dead code and use
me.name for the listener name (no sense in looking up the name
if we don't want to display it). Change direct bump of unknowns
in s_bsd.c to Count_newunknowns(UserStats) for consistency.
--Bleep
* Added option to kill any connecting client with a forward and
reverse DNS mismatch. Fixed bug in s_auth that that caused
incorrect counts for unknown clients. Replaced missing server
notice for SNO_IPMISMATCH. --Bleep
* Added a few more little name tweaks, no sense in looking up
the hostname in the conf if no one knows it. --Bleep
* Moved to beta archive, bumped patchlevel, fixed message for
lost C:line in s_conf.c (I don't think I've ever seen this happen)
--Bleep
* Finished host hiding changes, it should not be possible for any
online user to discover the real hostname or IP address of any
connected or unconnected server listed in the configuration. This
applies to opers and regular users. The name in the M:line is the
name used for connecting and all informational messages. --Bleep
* Removed code in dbuf.c that flushes the dbufs if the server runs out
it looks like a fully loaded server may not be able to handle a net
break without shedding a few clients. --Bleep
* Finish IP address cleanup, alpha should be clean for not displaying
server hosts or IP addresses to users now. This needs to be verified.
Changed version to u2.10.10 per Isomers suggestion. --Bleep
* Remove server IP address from info line for connecting servers.
This almost completes the IP address hiding changes for alpha, there
are still a few stats commands available to users that will show the
server addresses, but they can be easily disabled or only show '*'s
to non-opers. --Bleep
* Fix possible (but not likely) memory leak in debug allocator, couldn't
find the "meg a minute" problem, using the debug allocator on the
production network with more than 1000 clients on a server may cause
problems if you don't have a lot of memory. (This does not seem to
be a problem with non-debug builds) --Bleep
* Captialisation fixes, just to keep certain ppl quiet. --Isomer
* Removed +s channels from /list. They were shown sometimes, but not
others, and the information that was shown about them was inconsistant.
list is not an effective way to gain information anyway. Reformatted
and touched up readme.who as well. --Isomer
* Added MAP to ISUPPORT, added doc/features.txt --Isomer
* Added suggestions made by scripters. more info for ISUPPORT, and
added stuff to 'TODO' --Isomer
* More TODO items 'done'. P:'s now ignore '*'s. ping shouldn't do funky
stuff with mirc anymore, needs discussion --Isomer
* Typo fixed. Now I'm annoyed. --Isomer
* Right, Makefile's gonna work now or I'm going to get REALLY annoyed at it.
--Isomer
* TODO, m_ping, ircd/Makefile.in: Added note to TODO, added info to
m_ping, and fixed Makefile bug using bsdmake. --Isomer
* s_bsd.c, listener.c, s_user.c, s_serv.c, s_bsd.h:
Set receive and send buffers in correct order to enable flow
control for clients and support fat pipes better for servers.
Finally got it right :)
See Stevens "Unix Network Programming" v1 p 191-193
--Bleep
* ircd.c (main): added idiot checking to make sure MAXCONNECTIONS
is sane. --Bleep
* send.c: Don't let negative fd's break stuff, audit sentalong
usage for sillyness. --Bleep
* send.c (sendto_common_channels): bug fix, code assumed client
local, file descriptor is only in local client struct
--Bleep
* table_gen.c, channel.c: make FIXME changes, removed
FIXME code from table_gen, readd FIXME code to channel.c,
I hope I got this right. --Bleep
* Makefile.in: Add purify def, fix so CFLAGS don't error
off when using Solaris compiler --Bleep
* fda.c (fda_free): fix compile error on Solaris --Bleep
* configure.in: add SunOS case to detect Solaris --Bleep
* os_solaris.c (os_send_nonb): fix solaris compile error --Bleep
* exaconf.2: add file from conf design to docs directory to
have it available for new conf parser development --Bleep
* fda.c (fda_free): fix memory leak, doh!!! --Bleep
* hash.c (addNickJupes): fix buffer overrun --Bleep
* s_bsd.c (read_message(poll)): fix uninitialized memory read
bogosity in poll macros. --Bleep
* channel.c (send_user_modes): change to send XXX:ov instead
of XXX:o:v doesn't send XXX: if no modes set. --Bleep
* s_bsd.c (connect_server): bugfix for connect/rehash/connect
multiple outstanding dns query core. --Bleep
* channel.c (send_user_modes): bugfix for burst not sending modes
when burst line is created. --Gte
* m_gline.c: change NumServ(cptr) to NumServ(sptr) found by Gte
--Bleep
* config-sh.in: add WildThangs BADCHAN config fix --Bleep
* config-sh.in: add Runs restart bugfix --Bleep
* Makefile.in: make sure version.c gets regenerated when checksums
change --Bleep
* Makefile.in: remove hash.c/crypt/sums idiocy, all of the ridiculous
anti-hack stuff is already done in version.c anyhow.
"Shhh..., don't tell the admins ( .)( .) you're being watched"
--Bleep
* hash.c (m_hash): fix count bugs --Bleep
* m_squit.c (mo_squit): fix off by one, /quote SQUIT bug --Bleep
* ircd_relay.c: oops, changed the wrong one. Fixed previous fix. --Isomer
* Makefile.in, ircd_relay.c: Fixed 'make depend', added dependancies, fixed
bug where server would core on sending a server notice --Isomer
* m_kick.c (ms_kick): fix core on kick message coming from
server --Bleep
* config.in: remove CRYPT_LINK_PASSWORD option --Bleep
* doc/readme.www: Applied Runs' doc patch --Bleep
* client.h: Add member to client struct to try to aggravate the
bug found by Jesus --Bleep
* client.h: Remove IsListening macros and flags, add FLAGS_UPUNG
and IsUPing/GetUPing/SetUPing macros --Bleep
* m_silence.c, m_create.c: check for IsServer(sptr) don't
allow X SILENCE X +*@*.com or X C #blah 947477407 core the
server. --Bleep
* os_*.c, res.c: clean interface for os_recvfrom_nonb --Bleep
* uping.c, uping.h: new files for UDP pings, these aren't hooked up yet, or
finished or tested.
--Bleep
* channel.c: find_member_link(): Fail fast for Servers, prevents core when
servers set a channel mode. --Isomer
* channel.c, channel.h, various.c: Changed find_member_link() to take
a chptr instead of the first member, and special case'd +k users
(see comment in code for more details) --Isomer
* ircd/Makefile.in: Changed gnu specific $^ for $< in table_gen
rules --Bleep
* INSTALL: Explained about CVS --Isomer
* example.conf: Point to coder-com@ for help configuring the server. --Isomer
* INSTALL: Make things a bit more plain. --Isomer
* s_bsd.c (read_message (poll)): removed local_cptr array using
this temp made possible a bug where if a client lower in the list
managed to exit a client higher in the list, a dangling reference
to the already exited client would be left in the local_cptr array.
Found by Quantum by loading 100's of clones with the same nick.
--Bleep
* INSTALL: Added instructions for -lcrypt FAQ --Isomer
* INSTALL: Added instructions for -lresolv FAQ --Isomer
* INSTALL: Added instructions for making ./configure executable --Isomer
* numeric.h: Merged in some more numerics that other ircds user --Isomer
* IPcheck.c: Fix gramatical error to keep pedants happy. --Isomer
* IPcheck.c: Allow -DNOTHROTTLE for debugging purposes. --Isomer
* m_stats.c: make stats c available to opers only, TEMP_HACK --Bleep
* IPcheck.c: Fixed outdated comment. Thanks Quantum --Isomer
* ircd_reply.c: Fix the fix, silly typo. thanks Bleep --Isomer
* ircd_reply.c: added check for people without nicks. --Isomer
* doc/Authors, ircd/version.c.SH: updated /info and maintainer
lists. --Isomer
* channel.h, channel.c, m_join.c, m_mode.c: add David M's
lchanmode patch update --Bleep
* s_auth.c: fix ident bug, comment code for rule. --Bleep
* m_invite.c (m_invite): Fix syntax error, missing ')'. -- Isomer.
* m_invite.c (m_invite): tokenize invites, change from accidental
broadcast to directed message (bug fix). --Bleep
* m_time.c (m_time): send tokenized time messages --Bleep
* s_user.c (set_user_mode): Send wallops to everyone by default
allow compile option WALLOPS_OPER_ONLY for networks that want
to disable wallops for users. --Bleep
* s_misc.c (exit_one_client): tokenize client quit message to other servers.
--Gte
* m_kick.c: you would have thought I'd fix all of them the first time, but
no... -- Isomer
* m_kick.c: Fixed missing space after TOK_KICK -- Isomer
* m_burst.c: Fixed netrider kick bugs -- Isomer
* s_user.c: Bug fix --Bleep
* s_user.c: only send wallops to opers --Bleep
* s_user.c: enforced undernet policy. -- Isomer
* s_user.c: replace user_modes with struct UserMode array
change code to use new struct. --Bleep
* s_user.c (set_user_mode): clean up switch statement --Bleep
* channel.c (set_mode): fixed -k foo bug, extra == 0 typo in
conditional. --Bleep
* dbuf.c (dbuf_alloc): fixed count bug, we _have_ to count it in
the branches. --Bleep
* dbuf.c, send.c, s_bsd.c, send.h: bahh finally did it right,
if a dbuf allocation fails, attempt to flush all send buffers except
for the one we are trying to build (we're twiddling with the list etc..)
if the allocation fails a second time, _then_ bail. --Bleep
* s_bsd.c, send.c: if dbuf_put fails for send or receive buffers,
call flush connections to free up some buffers (safe here). --Bleep
* dbuf.c (dbuf_put): back out previous change, afaict it would fail
spectacularly --Bleep
* dbuf.c (dbuf_put): call flush_connections(0) if we can't allocate
a dbuf the first time, this may prevent the server from dropping
connections during netbursts. --Bleep
* m_privmsg.c: fix IDLE_ON_MSG fix -- Isomer
* m_privmsg.c, parse.c: fix IDLE_ON_MSG bug --Bleep
* m_ison.c (m_ison): Temp hack to fix missing null terminator. --Bleep
* m_nick.c (m_nick): fix null nick reply bug --Bleep
* ircd_string.c, match.c: fix a couple possible issues with
the character attribute changes --Bleep
* s_auth.c, ircd.c: turn off connection status messages for
connections to server ports. --Bleep
* ircd.c, s_conf.c, m_server.c, ircd.h, s_conf.h:
removed portnum and server_port global variables, server port
in M:lines is ignored, server ports now need to be defined in
the P:lines. Add SERVER_PORT config option to allow:
'/connect server.net.dom' without specifying the port. --Bleep
* config-sh.in: change PORTNUM to SERVER_PORT now used for
default server port for outgoing connections in m_connect.
--Bleep
* example.conf: document changes to M:line for server port --Bleep
* ircd_chattr.h, ircd_string.h, ircd_string.c, table_gen.c:
put Nemesi's table generation code and macros back in, the
tables are now automagically generated whenever the table_gen.c
file is modified, use a slightly different mechanism to get the
tables in the executable. Add reference data file to test dir
for character attributes. --Bleep
* s_auth.c (check_ident_reply): add function that implements
auth reply undernet rules checking. --Bleep
* s_misc.c (date): added Runs Y2K patch --Bleep
* m_privmsg.c: work on server handlers, hookup new code to parser,
test, fixed a couple bugs, fixed username bug in server NICK
processing --Bleep
* ircd_chattr.c, m_privmsg.c: Work on privmsg code a bit more,
commit for review, still a bit more to do --Bleep
* os_bsd.c, configure.in: add os dependency file for bsd
--Bleep
* m_privmsg.c, ircd_string.c: little cleanups for privmsg
work on prototype handler for new parser. --Bleep
* m_connect.c, s_conf.c: clean up /connect handling code
--Bleep
* m_away.c, m_admin.c, m_close.c, m_connect.c:
start cleaning up handlers --Bleep
* whocmds.c, whowas.c, *.c: split out handlers from whocmds.c
and whowas.c --Bleep
* s_serv.c, m_*.c: split out handlers from s_serv.c
--Bleep
* querycmds.c, m_*.c: split out handlers from querycmds.c
--Bleep
* opercmds.c, m_stats.c, m_connect.c, parse.c, handlers.h, *.c
add new command handlers --Bleep
* channel.c, m_names.c: new file for names handler --Bleep
* channel.c, m_list.c: new file for list handler --Bleep
* channel.c, m_topic.c: new file for topic handler --Bleep
* channel.c, m_burst.c: new file for burst handler --Bleep
* channel.c, m_create.c: new file for create handler --Bleep
* channel.c, m_destroy.c: new file for destroy handler --Bleep
* channel.c, send.c, m_join.c: new file for join handler,
const fixups for send.c --Bleep
* channel.c, m_mode.c: new file for mode command handler,
clean up file scope buffer mess. --Bleep
* m_silence.c: split out SILENCE handler to a new file,
cleanup --Bleep
* m_ison.c: split out ISON handler to a new file, cleanup --Bleep
* m_userip.c: split out to new file, change userhost and userip
to use same algorithm with different formatting functions --Bleep
* m_userhost.c: split out to new file --Bleep
* send.c: add new function send_buffer, cleanup godemode ick a bit
--Bleep
* m_wallchops.c: split out wallchops handler --Bleep
* m_cprivmsg.c: split out m_cprivmsg and m_cnotice.
* m_pass.c, s_user.c: split out m_pass, pass message handler
--Bleep
* m_oper.c: split out m_oper.c from s_user.c, setup to use
new parser. --Bleep
* m_pong.c, m_ping.c, parse.c, s_user.c, channel.c:
Add new file for pong messages, convert ping and pong to use
numerics. Test pings and pongs on testnet. Fix numeric
nick bug in channel.c. --Bleep
* m_ping.c, s_serv.c, parse.c: new file for pings, fixed a
minor bug in ping handling. --Bleep
* m_nick.c, m_kill.c: clean up nick code for servers, still needs work
fix string formatting bug in m_kill --Bleep
* m_nick.c, s_user.c, ircd_chattr.c: add new file for NICK command,
clean up local client registration for nicks. --Bleep
* m_away.c, s_user.c, parse.c: split out m_away handlers for client,
add user_set_away function. --Bleep
* m_kill.c, ircd_reply: Rework handling of kill from server, add new error
message formatter. --Bleep
* m_kill.c (mo_kill): Rework handling for kill from operator on server
kill originated from --Bleep
* m_kill.c: new message handler file for kill --Bleep
* configure.in, ircd/Makefile.in: added automatic os checking to autoconf
checked --Gte
* m_quit.c: new message handler file for quit --Bleep
* m_privmsg.c: new message handler file for privmsg --Bleep
* ircd_string.c, support.c, support.h, *.c: moved strtoken to ircd_string
and renamed ircd_strtok --Bleep
* channel.c, s_user.c, s_debug.c, send.c, channel.h: finish membership code
--Bleep
* channel.c, more cleanups of membership code and macros --Bleep
* channel.c, s_misc.c: more cleanup in channel link code, most likely
still a bit broken yet, more to come. --Bleep
* querycmds.h (Count_remoteclientquits): fix minor bug --Bleep
* ircd.h, querycmds.h, struct.h, channel.c, list.c, map.c, opercmds.c,
s_err.c, s_serv.c, s_user.c, s_misc.c: Add Isomers passivelag0-1.patch
fixed minor bug in macros --Bleep
* channel.h, channel.c, s_user.c, s_debug.c, s_user.c:
added Membership struct for channel associations, change user/channel
lookups to use new struct. --Bleep
* channel.c, channel.h, s_user.c: cleanup channel and user code
a bit, new function find_no_nickchange_channel --Bleep
* parse.c, m_defaults.c: added default handlers and hooked up new
message handlers --Bleep
* *.c, struct.h: added Isomer's passivelag patch and, the second
p10 patch --Bleep
* ircd_reply.[ch]: new files for commonly used replies --Bleep
* m_proto.[ch]: new file for protocol command support, needed for zip
links --Bleep
* client.h, parse.c, msg.h: add code to support multiple message handlers
depending on client status. --Bleep
* s_bsd.c, packet.c: code cleanup prep for zip links --Bleep
* channel.c, opercmds.c, ircd.c, s_serv.c, s_user.c, querycmds.c,
whocmds.c, whowas.c: Add Isomers p10ify patch, tokenize server to
server commands --Bleep
* s_user.c (m_nick): killed goto --Bleep
* client.h, *.c: moved client stuff to client.h --Bleep
* version.c.SH, patchlevel.h, .patches: change version string
generation, patch level is now set in patchlevel.h by simply
bumping the number in the PATCHLEVEL string. --Bleep
* ircd_alloc.c, channel.c: fixup warnings in release build (NDEBUG)
--Bleep
* fda.h, ircd_alloc.h, fda.c, ircd_alloc.c, fda_t.c: new files,
runmalloc was core dumping on squits and unable to handle or
detect double frees, the memory debug code can be disabled by
compiling with NDEBUG defined --Bleep
* channel.c (remove_user_from_channel): refactor function --Bleep
* channel.c (m_kick): refactor function a bit, put all checks at top
move code out to new function (make_zombie) --Bleep
* s_bsd.c (completed_connection): fixed stupid
"Write error to blah: Socket not connected" bug --Bleep
* struct.h, send.h, send.c, s_bsd.c, IPcheck.c, s_user.c, *:
More socket code cleanup, move file descriptor to local part of
client struct, use cptr->error to handle the errno of any socket
error, fix bug in IPcheck that ends up only disallowing every
256th clone, Add more ipcheck forgiveness to s_user.c (needs work).
Changed IPcheck_local_connect and IPcheck_connect_fail interfaces to
use struct in_addrs instead of client structs to allow delaying the
allocation of the client struct till after the check was done.
Added can_send function to send.c (should be called before work is done
but right now it's called just before trying to send (needs work))
* channel.c: Added Isomers netride2.patch, still needs a config option
to turn it on (NO_INVITE_NETRIDE) --Bleep
* parse.c, msg.h: Added silent ignores for notices so connect progress
messages do not cause connecting server to spew ERR_REGISTER_FIRST
messages at the server it's connecting to. --Bleep
* s_serv.c, s_user.c, channel.c, send.c: Tokenised BURST, NICK,
END_OF_BURST, EOB_ACK, PRIVMSG and NOTICE Server to Server.
About 8-10% Bandwidth saving on BURSTS. --Gte
* channel.c (m_join): servjoin patch --Isomer
* ircd_osdep.h, os_*.c, s_bsd.c, send.c: more cleanups in socket code,
use enumeration for IO results. --Bleep
* s_bsd.c: clean up select and poll code a bit more, fixed message pacing bug
in poll. --Bleep
* supported.h, numeric.h, s_user.c, s_err.c: Added Isomers features
patch. Use numeric 005 RPL_ISSUPPORT to convey server features to
clients. --Bleep
* s_user.c (m_nick): IP differ patch, use IP address instead of host
name to determine different user@host for nick collides. --Isomer
* hash.c (hChangeClient): Bug fix. Fixed bug that caused stale entries
to be left in client hash table after a name change. Discovered by
Quant and Isomer. --Bleep
* hash.c (hSeekClient): fixed bug I introduced when reversing my hash
table code changes, thanks Quant and Isomer --Bleep
* opercmds.c (m_lusers): send limited luser info to remote
clients --Isomer
* numeric.h, channel.c, s_err.c: Changed invite list numerics
from 283/284 to 346/347 to match IRCnet numerics --Bleep
* config-sh.in, gline.h, numeric.h, gline.c, opercmds.c, s_debug.c, s_err.c:
Add badchan patch by WildThang --Bleep
* config-sh.in, channel.h, numeric.h, channel.c, s_debug.c, s_err.c:
Add lchanmode patch by David M --Bleep
* channel.c (cancel_mode): removed incorrect assert --Bleep
* *.c: removed P9 support, not everything is completely gone but most
of it is, the server builds and connects to other servers, but thats
as far as it's been tested so far. --Bleep
* ircd.h, ircd.c, s_bsd.c:
removed BOOT_INETD/BOOT_CONSOLE code, unused non-functional --Bleep
* struct.h, ircd.h, ircd.c, s_user.c, s_bsd.c:
removed BOOT_OPER/STAT_MASTER code, original patch by Isomer --Bleep
* s_user.c (m_nick): removed redundant check for acptr
* hash.c (hSeekClient, hSeekChannel): roll back some of hash.c changes
* hash.c (hSeekClient, hSeekChannel): removed unused variable from previous
changes.
* hash.c (hSeekClient, hSeekChannel): fix compile error from status changes,
fix logic bug that caused the first client that matched the mask to be
returned regardless of whether or not it's name matched, this can result
in wierd problems where the wrong server/client could be returned from the
hash table lookup. Removed code that moved client to head of hash table
chain for it's bucket when it's looked up, if the hash table is working
reasonably well this just wastes cpu.
* hash.c, list.c: added code to zero out cptr->hnext when client removed
from hash table, added assert for hnext == 0 in list.c to make sure that
client was actually removed from the hash table before freeing it's memory.
* various: misc cleanups
* support.c: removed dead code
* configure.in: remove unneeded checks for minix, aix, ansi/posix headers
these things are handled by porting layer code.
* res.c: remove calls to add_local_domain, these were causing incorrect
behavior
* opercmds.c: cleanups in gline code
* s_bsd.c: increase socket buffers to 65535 for server connections
* crypt/mkpasswd.c: mutter correct runes to get file to compile without warnings
* gline.c, gline.h: add new files to attempt to encapsulate glines a bit,
some code from opercmds.c needs to be moved here still
* opercmds.c (m_gline): fix local gline bug
* s_conf.c (initconf): add password change on rehash fix
* s_conf.c (rehash): fix rehash freeing and reloading the motd/rmotd files for
every client connected.
* ircd_log.c: use 2K fixed buffer instead of vsnprintf, nothing we write to
the log should ever exceed 512 bytes, but it doesn't hurt to be paranoid.
* res.c: change resolver timeouts to 5 seconds, per RFC1123
* channel.c: more little cleanups, no code changes
* channel.c: a) stops iterating over /invite list
b) adds /invite to list the channels you're currently invited to.
c) adds lotsa new numerics --Isomer
* ircd_signal.c, ircd.c: fix bug in signals
* channel.c (can_send) add Isomer's changes
* channel.c: add send_ban_list, cleanup a few names, reformat some parts to make
more readable, fix bug introduced by name changes
* ircd_chattr.[ch]: add new macro for checking K:line time chars vs comments
* listener.c (show_ports): add code to show client/server and hidden status
* s_conf.c: bug fixes, cleanups, add code to set server port and hidden
status for listeners (P:lines)
* s_conf.c (initconf): add interface selection code to P:lines so ports can
be set on a single interface or multiple interfaces (multi-homed hosts)
* s_conf.c: rewrote C/N line code, removed N:lines entirely, clean up server
conf line code.
* s_conf.c (check_server): move ip checks out of resolved or not so they can
be checked for worse case situations on server connects
* res.c (resolver_read): add Isomer's debug info for failed resolver queries
* opercmds.c (m_stats): remove call to time(0) for each local client in
stats l command, use CurrentTime instead
* s_conf.c (initconf): only do lookups on C:lines instead of both C/N lines
* res.c: fix resolver hang bugs
* s_conf.c (rehash): remove extra semicolin that was causing c/n lines to
accumulate
* s_conf.c (rehash): add portnum back to the listener list so we don't loose
the server port on a rehash
* s_auth.c, listener.c: remove warnings for normal errors
* s_auth.c, listener.c: use osdep non-blocking calls instead of locals
* s_auth.c, listener.c: add code for non-blocking recovery for listeners and
auth queries
* s_auth.c (auth_error): call IPcheck_connect_fail if the client socket dies
during the auth check so the reference count doesn't get borked in the
IPcheck code.
* numnicks.c: yet another extended numerics bug fix... sheesh
* s_bsd.c, s_conf.c: move conf line code from s_bsd.c to s_conf.c, cleanup
cleanup check_server, check_client (still not completely tested, may be
a bit buggy yet).
* parse.h, parse.c, s_debug.c: remove privmsg logging code
* numnicks.c (FindXNServer): fix off by one bug
* common.h, common.c: removed unused files
* s_bsd.c (net_connect_completed): new function, called after connection
establishment for servers and clients, release reference count for
the dns reply and set the socket buffer size to IRCD_READBUF_SIZE
for servers and 2K for clients.
* channel.c, crule.c: cleanup bogus casts
* listener.h (add_listener): fix bug that caused server a server port listener
to think it was a client port listener.
* s_user.c, s_serv.c: release reference to dns_reply when connection is
established.
* s_bsd.c (completed_connection): removed call to start_auth for connects
the auth module expects connections not to be linked anywhere and owns
the client struct until it's done.
* listener.c (release_listener): fix inverted assert client exit bug
* ircd_chattr.c: fix signed/unsigned warnings with Sun Workshop (+w)
* ircd_chattr.c, ircd_chattr.h: new files for character attributes and case
translation, hopefully they will be a bit easier to maintain.
* s_conf.c (rehash): fixed logic bug that caused and infinite loop,
fix port update bug (needed to call mark_listeners_closing before initconf)
* *.c, runmalloc.[ch]: change the way the server deals with out of memory
conditions. On server startup a no-memory handler is installed which
calls server_restart if an allocation fails. Allocations are now checked
in the memory allocation functions. Added asserts after every allocation
to verify for debug.
* *.c *.h: move authentication and dns to authentication module rename a few
globals, const correctness fixes, add ircd_string code, rework network
code, use dns callbacks, removed a lot of redundant code
* s_bsd.c: finish this stage of net code work
* *.c, *.h: rewrite select and poll code, add listener.[ch] net.code overhaul
in progress, prepare for adding auth module
* s_bsd.h, struct.h: moved client struct macros back into struct.h for now,
the last place they belonged was in the network code... feh
* ircd.c (open_debugfile): removed client for debug file
* ircd_string.h, ircd_string.c: new files for string processing, add
ircd_strncpy function
* *.c, *.h: rename ircstp to ServerStats
* *.c, *.h: rename now to CurrentTime
* listener.h, listener.c: new files for listener ports
* include/ircd_defs.h: new file for global definitions (HOSTLEN, USERLEN)
* struct.h: add local_flag to client struct, to make local/remote detection simpler
* s_bsd.c (read_message): split out separate versions for select and poll
* s_bsd.h, various source files: remove the rest of the unix domain socket
support this removes a number of comparisons that were unneeded in
code that should run reasonably fast.
* os_*.c, res.c, ircd_osdep.h: add os_recvfrom_nonb for resolver
* os_*.c, s_bsd.c, s_auth.c, ircd_osdep.h: add os_get_sockname, os_get_peername
* bsd.h, bsd.c: merge into s_bsd
* ircd_osdep.h, os_generic.c, os_linux.c, ircd_osdep.h: move os variable stuff
to separate compilation units, os generic contains the original code
(start here).
* s_bsd.c, send.c, struct.h: remove pyr (pyramid) finally
* res.h, res.c, s_misc.c: cleanup headers/dependencies in res.h
* match.h: include sys/types.h before netinet/in.h, broken BSD system headers
* ircd/Makefile.in: remove CFLAGS from link line, use LDFLAGS instead
* ircd.c: add missing include for sys/socket.h
* common.h (strChattr, strCasediff): remove pointless non-portable inline
decls. The functions are complex enough that inlining just bloats the code
* ircd_xopen.h, ircd_xopen.c, s_user.c, s_serv.c: porting layer for crypt and
other xopen library calls, moved crypt to ircd_xopen.
* s_uping.c, s_uping.h, s_bsd.c, s_misc.c, s_bsd.h, ircd.c, s_debug.c:
Removed s_ping. There are much better tools available that actually work
correctly. The s_ping code was a waste of resources, and has historically
given incorrect results (it never worked correctly).
* ircd/s_bsd.c, res.c, s_user.c, s_serv.c: little fixups to allow code to
build on Solaris, still have some warnings there.
TODO: wrap crypt and things that depend on _XOPEN_SOURCE in their own
file so it doesn't bother the network code.
* ircd/s_bsd.c: cast option arg to const char* for setsockopt (solaris)
* ircd/Makefile.in: removed hard coded dependencies for hash.o chkconfig.o,
let the automatic stuff take care of it, it does it better than humans.
* *.c *.h: remove register keywords, attribute macro junk, cleanup
dependencies, rename MIN and MAX to IRCD_MIN IRCD_MAX all headers in
C files are sorted, removed as many duplicate includes as I could find
(dozens) general cleanups. Mutter the correct runes to get the protoype
for crypt included where it was needed.
* *.c *.h: dependency cleanups up to querycmds.c
* ircd.c, bsd.c, s_bsd.c: move signal handling code to ircd_signal.c
* ircd_signal.c, ircd_signal.h: new files, use only POSIX signals remove
support for unreliable signals.
* *.h *.c: include guards, dependency cleanups
* Configure.in, setup-sh.in: include guards, config.h includes setup.h
add config dir to include path
* sys.h: include guards, remove hard coded path to config.h
* s_user.c (hunt_server): fix logic bug
* numnicks.c (SetServerYXX): fix off by one error
* multiple files (n2k patch): add code to handle extended numerics

316
doc/history/Manual Normal file
View File

@ -0,0 +1,316 @@
/************************************************************************
* IRC - Internet Relay Chat, doc/MANUAL
* Copyright (C) 1990, Karl Kleinpaste
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
Date: 04 Apr 1989
Author: Karl Kleinpaste
karl@cis.ohio-state.edu
Last modification: 15 May 1992
by Mauri Haikola
mjh@stekt.oulu.fi
Modified for undernet: 7 Feb 1995
by Carlo Wood
carlo@runaway.xs4all.nl
INTERNET RELAY CHAT (IRC)
a real-time conversational system
* 1: IRC - replacement for talk(1)
IRC is a functional replacement for and improvement to talk(1). Talk
is an old, primitive, atrocious, minimalist sort of keyboard/screen
conversation tool, using a grotesque, machine-dependent protocol.
IRC does everything talk does, but with a better protocol, allowing
more than 2 users to talk at once, with access across the aggregate
Internet, and providing a whole raft of other useful features.
Note (added Apr 7, 1998): The above statement has been left there for
historical reasons. It should be noted however that IRC is not any
longer a replacement for talk(1). At the time IRC was first developed,
people connected to internet all were using accounts on UNIX Operating
Systems, which almost all did run a non-restricted fingerd and a talkd.
This allowed to see if someone was logged in (with finger) and then
summon him to talk by connecting to his talk daemon. For IRC however it
is necessary to already be connected to an IRC server and one needs
to pay attention to the window of the IRC client in order to see if someone
wants to talk to you. Therefore IRC has become more of a 'chat box':
a Real Time Chat environment for chatting, making friends and exchanging
information. It has little resemblance anyore with talk(1).
* 2: Entering Internet Relay Chat
To enter Internet Relay Chat you need to run a client, which will start
connecting to its default server. More info on clients can be achieved
from ftp://ftp.undernet.org/pub/irc/docs/faq/underfaq.1. A lot of clients
for all kinds of Operating Systems and (programming) languages can be
found in ftp://ftp.undernet.org/pub/irc/clients/index.html.
* 3: How much can be seen from here
The universe - seriously.
This is most formally called Internet Relay Chat. Server hosts are
connected via a tree structure. The various servers relay control and
message data among themselves to advertise the existence of other
servers, users, and the channels and other resources being occupied by
those users.
* 4: Structure
There is quite a lot of structure to the operation of IRC, as compared
to crufty old talk(1). Since so little could be done with talk(1), it
needed little structure. But to keep track of people spread literally
around the world, the structure is useful so that one can speak to exactly
those people with whom one wishes to speak. The structure is outlined in
more detail in the paragraphs below.
** 4.1: Nicknames
All users of IRC are known to the system by a `nickname.' A nickname
can be chosen at the moment the client connects, but can be changed at
any time. Nickname clashes are not allowed; this is enforced by the servers.
If one's intended nickname clashes with someone else as one enters chat, one
will not be able to complete entry to IRC until one changes one's nickname
to something else.
** 4.2: Presence on a channel
Fundamental to the operation of IRC is the concept of a channel. All
users are `on a channel' while inside IRC. One enters the `null
channel' first. One cannot send any messages while not in any
chatting channel unless one has set up a private conversation in some
way. The number of channels is virtually unlimited - whatever will
fit in a string of 200 characters and starts with a #, & or + sign.
A channel which is prefixed with a '#' (pound sign) is a global channel;
available to everyone on the network. A channel prefixed with a
'&' (ampersand) is a local channel; only available to users on the server
you are connected to. While a channel prefixed with a + (addition sign)
are global and modeless; those channels do accept mode changes.
** 4.3: Main modes of #channels
Public
This is the default mode for a channel. When one is on a public
channel, one can be seen by all other users (if one's own user mode
permits this). Anyone can notice users on a public channel and join
such a channel's conversation.
Private
This means that, although anyone can see that one is using chat, no
one can tell what channel one is using unless one is already on that
channel with oneself. Since the number of potential channels is in
the billions, this is quite some security - all one gives away is the
acknowledgement that one is using chat.
Secret
While one is on a secret channel, no one who is not on one's channel
with oneself can even see that one is there. One's name does not show
up in a wildcard search of active users. Of course, making a channel
like '#test' secret gives a huge change to be discovered anyway.
Changing the mode
The mode of a channel (private, secret, invite-only, moderated,
topic-limited, person-number-limited, no-messages-to-channel, ban
someone from channel, etc.) is set by a channel operator, who is the
first person to join a channel, or someone who has had channel
operatorship bestowed on them by another channel operator.
Local channels
Channels which are prefixed with the ampersand (&) sign are local
channels which mean they can only be accessed to users who are on
the same server. For example, &help may exist on every server on
the network, however each of them are different channels whereas
global (#) channels are just one channel for the entire network.
Modeless channels
Channels that have a name that start with a plus sign (+) instead,
are modeless. This means that nobody is channel operator and hence
no mode changes can be done. The default mode of a +channel is "+nt".
The intention of modeless channels is to avoid channel wars by making
all users on that channel a-priori equal. The only possible abuse,
channel flooding, should be solved with /ignore.
*** 4.4: Conversations not using channels
It is possible to conduct conversations with others without using the
formalized channel structure. Doing so requires that two people set
themselves up for private conversation using special commands; see
User Commands below.
** 5: Getting help
Type "/help." Follow the instructions. Since this is a client feature
it might not work for you, in which case you'd have to consult your
local IRC guru or someone on the net.
** 5.1: User commands
In most clients, commands must start with a '/' (for example: /join #test).
The most important commands supported by IRC are:
help quit who whois
list topic join part
links msg invite silence
names stats nick away
info clear query ignore
mode
Also read the file ADD-TO-IRCRC for a description of Undernet specific
commands and an example script for the ircII client.
*** 5.1.1: /quit [comment]
/quit exits chat. Optional comment may be included; see above.
*** 5.1.2: /who [channelname_mask | user@host.mask]
/who returns information on who is using chat. Users of public channels
show up with one of their channels identified, if any. Users of private
channels appear, but they are specified as being on a private, unspecified
channel. Users of secret channels and users whose user mode is +i (invisible)
do not appear at all.
Giving a channel name as an argument to /who returns only those users of the
specified channel. This still doesn't show users of secret channel or
invisible users one is actually on the same channel with them. Users
of private channels are shown, if an exact channel name is given.
For a detailed explanation of the many options of /who, see doc/readme.who !
*** 5.1.3: /whois <nickname>
This returns information about individual users. Type "/whois nickname"
to get information on the login name and host from which the nicknamed
user comes. You can specify multiple nicknames to query by seperating
each with a comma.
*** 5.1.4: /topic <some topic string>
Channels can be given off-the-cuff "topics." Saying "/topic some
string of text" will associate that topic with the current channel.
*** 5.1.5: /list [options] [channel.mask]
/list will give lists of active channels, the number of users of each,
and the topics therewith associated. Again, secret channels do not
appear and private channels only appear as Prv.
[options] is a comma seperated list of one or more of the following options:
>nnn
<nnn
C<ccc
C>ccc
T<ttt
and T>ttt
This comma seperated list may not contain spaces.
Here `nnn' is the minimum or maximum number of users on a channel,
`ccc' is the minimum or maximum age or creation time of a channel, in
respectively seconds or UTC. And `ttt' is the minimum or maximum age
or creation time of the topic of the channel, in respectively seconds
or UTC.
On most servers, if no options are given, the server will use a
default option (like "T<10") in order to strongly reduce the of number
of listed channels.
*** 5.1.6: /join <channel> [key]
/join <channel_name> is the means to enter a channel. Give the channel
name as an argument. If this is a secret or hidden channel, /who
commands will show oneself and any other users of one's channel.
One's arrival on a channel is announced to the rest of the users
already on that channel. Silent, anonymous "lurking" is not
supported.
If the channel is locked with a key, you need to add the [key]
parameter which acts as a password (cannot contain spaces).
*** 5.1.7: /msg <nick> <some text string>
A single message can be sent privately to a certain user with /msg.
Type /msg nickname and the text to be sent. It will be sent privately
to the indicated nickname.
*** 5.1.8: /invite <nick> <#channel>
If there is a user online to whom one wishes to speak, one may invite
that user to join oneself on a certain channel. One types "/invite
nickname" with an optional channel name. The receiving user gets a
one-line message indicating the sender and the invitation. The
receiving user is free to ignore the invitation, of course. You
cannot invite users to a modeless channel.
*** 5.1.9: /ignore <nick!user@host.mask>
If one wants to ignore messages sent by some other user or users, it
may be done with /ignore command. One can ignore someone by their
nickname, or by their user@host data. Wildcards may be used. /ignore
is only intended to ignore annoying public messages (messages sent to
a channel), to stop flooding (a huge number of messages per second)
you have to use banning for channel messages, and /silence for private
messages. /mode <your nick> +d stops all messages from ALL channels.
*** 5.1.12: /silence [nick!user@host.mask]
This command effectively stops private message flooding at the server
of the flooder. You can use "/silence nick" to get a list of the
silence masks of 'nick'. This command is undernet specific and therefor
not supported by all clients unless you add specifically a line to your
clients configuration file.
*** 5.1.11: /nick <new_nick>
One can change nicknames by issuing "/nick new-nickname." All users
on one's channel will be informed about the change. NOTE: If one enters
chat with a nickname clash (e.g., one's login name is the same as
someone else's, and the other user got there first), the system will
not let one enter until one issues a /nick command with a unique
nickname. Nicknames are limited to nine characters in length on the
Undernet.
*** 5.1.12: /mode #channel [lots of parameters]
This command can be used for altering the various modes of a channel
(see the explanation of channel modes above). /mode command can only
be issued by channel operators. Please use /help, or the manual of
your client to find out about this command.
If you would like a list of the current modes in the channel, type
/mode <channel> (you do not need to be a channel operator to do this).
For a list of channel bans, type /mode <channel> +b.
* 6: Questions, problems, troubles?
If you have problems, please get and read the FAQs from
ftp.undernet.org:/pub/irc/docs/underfaq.1 and underfaq.2.
You can also ask for help on some of the operator channels on IRC,
for example #help. They will be able to assist you in whatever
problems you are having with IRC.

71
doc/history/README-2.6 Normal file
View File

@ -0,0 +1,71 @@
/************************************************************************
* IRC - Internet Relay Chat, README
* Copyright (C) 1990
*
* For the list of authors and their e-mail addresses, see
* file doc/AUTHORS
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
To install the new server, there is just a few changes to be made.
* General Comments
Tue Nov 13 12:43:46 1990 Armin Gruner <gruner@informatik.tu-muenchen.de>
(APOLLO: Be sure to have NEED_INET_NETOF, NEED_INET_ADDR and
NEED_INET_NTOA undefined.)
Mon Nov 26 20:10:37 1990 Armin Gruner <gruner@informatik.tu-muenchen.de>
Comment: I just found that compiling on our SUN SPARC with GCC produces
code that dumps core.. (that might not happen on your machine, try it,
we may have out-of-date libraries). See netnews gnu.gcc.bug for a dis-
cussion about the matter. It seems that gcc passes struct's in a
different manner.
* Server configuration
Edit the include/config.h to your hearts content, avoiding going
beyond the warning line, unless you are *absolute* sure you know
what you are doing.
If you happen to not take to this warning, you may end up with
a server that will not function properly and annoy not only you,
but users all around the world.
Old irc client can be found in this package and if you want to use it,
check Makefile in directory irc before compiling. There are other,
better irc clients in distribution and the client distributed with
this version is simply something to begin with if you don't happen
to have other clients available.
This version was brought to you by jto@tolsun.oulu.fi and send any
bug fixes and suggestions to me.
NOTE: This server does *NOT* have MAIL system installed by default.
The reason is that it doesn't work with many systems.
This version introduces you string channels, starting with
a plus (+) sign. The first person joining a string channel
claims it's ownership and after that is entitiled to use /mode
command. Ownerships can be given and taken away with
/mode <channel> +o <nickname> and /mode <channel> -o <nickname>
Other flags are: s - secret, p - private, l - limited, i - inviteonly.
m - moderated, n - no private messages to channel,
t - topic settable by operator only
New command /KICK <channel> <user> kicks a user off channel.
--Jarkko (jto@oulu.fi)

1901
doc/history/README.patches Normal file

File diff suppressed because it is too large Load Diff

51
doc/history/history.pre24 Normal file
View File

@ -0,0 +1,51 @@
/************************************************************************
* IRC - Internet Relay Chat, doc/HISTORY
* Copyright (C) 1990
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
HISTORY of Recent IRC Versions.
Previous version numbering schemes have caused some confusion, which this
document attempts to resolve.
The original test versions released by WiZ were numbered 2.01?6 where
the ? refers to a letter. The last known stable version was U6.
Version 2.1.0/1 was rewritten by Mike Bolotski from the U6 sources but
several bugs were introduced during the rewrite. After several weeks,
almost all servers backed up to U6. Version v6 contained comparatively
minor modifications from U6.
Version 2.2 consists of the v6 source repackaged into multiple directories,
and with modified documentation. From now on, the version number will
stay relatively constant. As minor changes and bug fixes are added, they
will be distributed in the form of context diffs, to be applied with the
'patch' command. Each bugfix will bump the patchlevel (PL) of the release
by 1. The PL is documented in the version.c file in the lib/misc directory.
Version 2.3 was unfortunate mistake containing copyright violations
so it was soon taken off distribution.
Version 2.4 contains *very* many bug fixes, enhancements, and "hooks" for
use in future releases. The source tree has been restructured, and the
Makefiles rewritten to be recursive and follow the new source tree layout.
Version 2.5 contains string channels and channel modes (as well as
channel operators). Also Wizible's MAIL system was included as an option.
Hopefully, whoever provides a fix will also update the respective
ChangeLogs to summarize the changes, as well as adding a description of
the bug to the BugList file.

206
doc/history/overview.u2.9 Normal file
View File

@ -0,0 +1,206 @@
Hi fellow undernetters,
I forgot if it was requested on routing-com or here, but you won't see me
cross posting, so I did choose 'wastelanders'.
The request was to mail an overview of the changes 2.8 ==> u2.9,
especially for the new Opers, but also as a reminder for others.
The patch file from irc2.8.21.mu3.1 to ircu2.9.17.mu is 446652 bytes.
So you will understand I can't cover every little change.
New commands
------------
/UPING <server.to> [<port>] [<server.from>] [<number of packets>]
Sends <number of packets> (default 5, max 20) size 1024 bytes, from (remote)
server <server.from> (default local server) to <server.to>. The default
port is 7007 and the same on all servers. If a server is down, you can
still use port 7 (echo). Also 2.8 echo's, on port PORTNUM (config.h).
UPING uses udp, you need CN lines (masks as server names are allowed) but
the connection doesn't have to exist already.
/RPING <server.to> [<server.from>] [<Optional remark>]
Sends one 'RPING' message using the irc protocol over an existing link.
It allows to measure the lag of remote links, respons is in ms accuracy.
The <Optional remark> can be used to measure to total pingtime to your
client (like the CTCP PING) or to add a serial number for automation.
/MAP [server.mask]
Shows a map in the layout as Router.
/SETTIME
Only for debugging, isn't needed. (Oper only).
Changed commands
----------------
/CONNECT
No doubt the biggest impact of 2.9 is on connecting:
When the link is physically possible, your /connect ALWAYS succeeds
except when an H: or L: line somewhere on the net forbids it, or when
*after* your connect another connect is done that cause a loop. The only
restriction is that you are not allowed to make deliberately a loop:
you must first squit. Loops only happen when to connects are done
simultaneously and the SERVER messages had not yet time to propagate
over the whole net.
When a connect (manual or automatically) is done for a link that used
to get "server exists", with 2.9 the Ghost is squitted off the net,
making it possible to recover faster from breaks caused by bad links.
If on the other hand a loop occurs because two parts connect at two
points, the servers that detect the server nick collision will squit
the most logical link to break the loop, and only one link. This results
thus in a connected net one way or the other (for this all 2.8 servers need
to be off the net! Till that time the net will connect and then break
at two places, giving more messages then right now with only 2.8).
2.9 servers also notify the Opers (or users with +s) about net.junctions
and net.breaks. It does this even better then Router: A lot faster, always
correct (REAL junctions), and independent of Router: You will also see
them when Router is 'on the other side'.
/TIME
Has changed. Now also shows the system clock / TimeStamp clock offset.
/MODE +b
You only have to be joined, not be chan op anymore.
/MODE <nick> +d
Makes the user 'Deaf'. Needed for the channel registration service.
Channel messages are not routed to a Deaf person decreasing bandwidth use.
/LINKS
Output also shows used protocol for that link.
New numerics
------------
RPL_MAP, RPL_MAPMORE, RPL_MAPEND and RPL_TRACEPING.
Bug fixes
---------
- A handshaking link doesn't pingtime out; That can interfere with
slow nameserver lookups.
- U: lines (and K: lines) now active directly after a /rehash
- Don't bind() a socket before connect(), thats useless on machines
with just one ip number (like we all have), and can confuse
some OS's I found out.
Significant Patches
-------------------
The following patches have been the objective. To realize them I needed to
rewrite and change huge other parts of the code also, because lot of the code
in 2.8 is under great tension of re-re-re-patches.
- Rewrote m_server. Objective:
= Allow ghosted servers to reconnect (solution "server exists").
To allow for this:
- Added a timestamp to SQUIT, this timestamp functions as a label
which matches the corresponding SERVER (connect).
- Added a prefix for every message, absolutely necessary to keep track
of the correct order (direction actually).
- The oci has been added (oper sees invisibles on own server).
- A new NOTE is added, many bugs removed and extremely speeded up due to
a better interface with the rest of the code.
- The TimeStamp clocks are now automatically synchronized, so a wrong
system clock isn't a problem anymore.
- Added a Protocol-version and detection. This allows protocol changes
with a *MUCH* higher backwards compatibility.
- Server now keeps track of the server map. This allowed for /MAP and
a lot of speed ups (don't have to scan through all clients to find a
server) but much more important: The disconnect burst could be brought
back to ONE message (instead of a QUIT for ever single client).
Apart from decreasing bandwidth use, this was necessary for other
important protocol changes, and even more to allow important future
changes that will reduce the connect.burst as well. The most important
current impact is that it allows SQUIT to travel down stream AND up stream.
Because directionless messages can loose the order, the timestamp on
SQUIT was needed to check the validity.
- In the client structure a pointer to the server structure is used
rather then the full servername, using less memory AND speeding up
several places because you don't need to lookup the servername
anymore.
- USER removed from the connect burst (now all in NICK).
Other patches
-------------
- exit_client() is rewritten.
Added are exit_client_msg() and exit_new_server().
This has especially impact on the possibilities within the protocol.
The old exit_client() was clumsy and therefor already used in an incorrect
way at several places. The kludges around this part of the code made it
impossible to make any changes without breaking something else. Only after
the rewrite it was possible to make changes described else where.
This also allowed to improve the error message handling to the point that
Opers see *always* the error messages involved with routing (also those
from remote /connects, delayed errors and squit reasons 'from the other
side').
- send.c is more or less rewritten. varargs are fixed now and send.c is
highly optimized for speed (possible because of new internal server map).
- All useable dog3 code speed ups have been added.
These include:
- Added a head pointer in the dyn buffer.
- several code optimisations
- continious kill line checking removed (I added the check at
the place where it belongs: after a /rehash).
- Useable patches from dl:
- Stop as much as possible flooding from unregistered connections.
- VERSION and ADMIN available for unregistered users.
- syslog (if defined) KILLs of local clients.
- Many compile warnings have been removed. Also a special fix for DYNIX to
make UPING/RPING also work there (needed gettimeofday()).
Package changes
---------------
- The irc client is removed from the package as are several old files with
incorrect old useless info (Like 'WHATSNEW', ChangeLog that stopped at 1992).
- A Makefile.dist is added.
- Slighty changed doc/Manual
- New doc/NOTE manual
- NO_DEFAULT_INVISIBLE removed; users are always visible by default.
- Last but not least: patchlevel.h is rewritten so any additional patch
can do the version update itself, without interfering: No need to edit
this by hand anymore.
Summary
=======
- Less memory usage
- Speeded up code
- Less bandwidth use, especially disconnect burst
- "Server exists" solved
- Error messages concerning (remote) /connects now always visible.
- New tools to do (remote) link testing
- Intelligent and improved SQUIT handling, should stop unwanted breaks.
- squits comments visible everywhere.
- net.junction and net.break notices
- Overall protocol streamlining allowing for future improvements
of the protocol.
Run

1
doc/ircd.opermotd Normal file
View File

@ -0,0 +1 @@
This is your opermotd, only opers will be able to see this

1
doc/ircd.rules Normal file
View File

@ -0,0 +1 @@
insert your network/server rules here

535
doc/iso-time.html Normal file
View File

@ -0,0 +1,535 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!-- $Id: iso-time.html,v 1.1 2000-04-02 23:46:03 bleep Exp $ -->
<HTML>
<HEAD>
<TITLE>International Standard Date and Time Notation</TITLE>
<BASE HREF="http://www.cl.cam.ac.uk/~mgk25/iso-time.html">
<META NAME="keywords" CONTENT="ISO 8601, date format, time format,
standard notation, calendar, clock, time zones, daylight saving time,
summer time, international standard, file format, protocol,
data representation">
<META NAME="description" CONTENT="International Standard ISO 8601
specifies numeric representations of date and time. It helps to avoid
confusion caused by the many different national notations.">
</HEAD>
<BODY BGCOLOR="#EFEFEF" TEXT="#000000">
<H1>A Summary of the International Standard Date and Time Notation</H1>
<P>by Markus Kuhn
<P><A HREF="http://www.iso.ch/markete/8601.pdf">International Standard
ISO 8601</A> specifies numeric representations of date and time. This
standard notation helps to avoid confusion in international
communication caused by the many different national notations and
increases the portability of computer user interfaces. In addition,
these formats have several important advantages for computer usage
compared to other traditional date and time notations. The time
notation described here is already the de-facto standard in almost all
countries and the date notation is becoming increasingly popular.
<P><STRONG>Especially authors of Web pages and software engineers who
design user interfaces, file formats, and communication protocols
should be familiar with ISO 8601.</STRONG>
<P>Contents: <A HREF="#date">Date</A>, <A HREF="#time">Time of Day</A>,
<A HREF="#zone">Time Zone</A>.
<H2><A NAME="date">Date</A></H2>
<P>The international standard date notation is
<BLOCKQUOTE><P><STRONG>YYYY-MM-DD</STRONG></BLOCKQUOTE>
<P>where YYYY is the year in the usual Gregorian calendar, MM is the
month of the year between 01 (January) and 12 (December), and DD is
the day of the month between 01 and 31.
<P>For example, the fourth day of February in the year 1995 is written
in the standard notation as
<BLOCKQUOTE><P><STRONG>1995-02-04</STRONG></BLOCKQUOTE>
<P>Other commonly used notations are e.g. 2/4/95, 4/2/95, 95/2/4,
4.2.1995, 04-FEB-1995, 4-February-1995, and many more. Especially the
first two examples are dangerous, because as both are used quite often
in the U.S. and in Great Britain and both can not be distinguished, it
is unclear whether 2/4/95 means 1995-04-02 or 1995-02-04. The date
notation 2/4/5 has at least six reasonable interpretations (assuming
that only the twentieth and twenty-first century are reasonable
candidates in our life time).
<P>Advantages of the ISO 8601 standard date notation compared to other
commonly used variants:
<UL>
<LI>easily readable and writeable by software (no 'JAN', 'FEB', ...
table necessary)
<LI>easily comparable and sortable with a trivial string comparison
<LI>language independent
<LI>can not be confused with other popular date notations
<LI>consistency with the common 24h time notation system, where
the larger units (hours) are also written in front of the smaller
ones (minutes and seconds)
<LI>strings containing a date followed by a time are also
easily comparable and sortable (e.g. write "1995-02-04 22:45:00")
<LI>the notation is short and has constant length, which makes both
keyboard data entry and table layout easier
<LI>identical to the Chinese date notation, so the largest cultural
group (>25%) on this planet is already familiar with it :-)
<LI>date notations with the order "year, month, day" are in addition
already widely used e.g. in Japan, Korea, Hungary, Sweden, Finland,
Denmark, and a few other countries and people in the U.S. are already
used to at least the "month, day" order
<LI>a 4-digit year representation avoids
<A HREF="http://www.year2000.com/cgi-bin/clock.cgi">overflow
problems after 1999-12-31</A>
</UL>
<P>As dates will look a little bit strange anyway starting with
2000-01-01 (e.g. like 1/1/0), it has been suggested that the year 2000
is an excellent opportunity to change to the standard date notation.
<P>ISO 8601 is only specifying numeric notations and does not cover
dates and times where words are used in the representation. It is not
intended as a replacement for language-dependent worded date notations
such as "24. Dezember 2001" (German) or "February 4, 1995" (US
English). ISO 8601 should however be used to replace notations such as
"2/4/95" and "9.30 p.m.".
<P>Apart from the recommended primary standard notation
<STRONG>YYYY-MM-DD</STRONG>, ISO 8601 also specifies a number of
alternative formats for use in applications with special requirements.
All of these alternatives can easily and automatically be
distinguished from each other:
<P>The hyphens can be omitted if compactness of the representation is
more important than human readability, for example as in
<BLOCKQUOTE><P><STRONG>19950204</STRONG></BLOCKQUOTE>
<P>For situations where information about the century is really not
required, a 2-digit year representation is available:
<BLOCKQUOTE><P><STRONG>95-02-04</STRONG> or
<STRONG>950204</STRONG></BLOCKQUOTE>
<P>If only the month or even only the year is of interest:
<BLOCKQUOTE><P><STRONG>1995-02</STRONG> or
<STRONG>1995</STRONG></BLOCKQUOTE>
<P>In commercial and industrial applications (delivery times,
production plans, etc.), especially in Europe, it is often required to
refer to a week of a year. Week 01 of a year is per definition the
first week that has the Thursday in this year, which is equivalent to
the week that contains the fourth day of January. In other words, the
first week of a new year is the week that has the majority of its
days in the new year. Week 01 might also contain days from the
previous year and the week before week 01 of a year is the last week
(52 or 53) of the previous year even if it contains days from the new
year. A week starts with Monday (day 1) and ends with Sunday (day 7).
For example, the first week of the year 1997 lasts from 1996-12-30 to
1997-01-05 and can be written in standard notation as
<BLOCKQUOTE><P><STRONG>1997-W01</STRONG> or
<STRONG>1997W01</STRONG></BLOCKQUOTE>
<P>The week notation can also be extended by a number indicating the
day of the week. For example, the day 1996-12-31, which is the Tuesday
(day 2) of the first week of 1997, can also be written as
<BLOCKQUOTE><P><STRONG>1997-W01-2</STRONG> or
<STRONG>1997W012</STRONG></BLOCKQUOTE>
<P>for applications like industrial planning where many things like
shift rotations are organized per week and knowing the week number and
the day of the week is more handy than knowing the day of the month.
<P>An abbreviated version of the year and week number like
<BLOCKQUOTE><P><STRONG>95W05</STRONG></BLOCKQUOTE>
<P>is sometimes useful as a compact code printed on a product that
indicates when it has been manufactured.
<P>The ISO standard avoids explicitly stating the possible range of
week numbers, but this can easily be deduced from the definition:
<BLOCKQUOTE>
<P><STRONG>Theorem:</STRONG> Possible ISO week numbers are in the
range 01 to 53. A year always has a week 52. (There is one historic
exception: the year in which the Gregorian calendar was introduced had
less than 365 days and less than 52 weeks.)
<P><STRONG>Proof:</STRONG> Per definition, the first week of a year is
W01 and consequently days before week W01 belong to the previous year
and so there is no week with lower numbers. Considering the highest
possible week number, the worst case is a leap year like 1976 that
starts with a Thursday, because this keeps the highest possible number
of days of W01 in the previous year, i.e. 3 days. In this case, the
Sunday of W52 of the worst case year is day number 4+51*7=361 and
361-366=5 days of W53 belong still to this year, which guarantees that
in the worst case year day 4 (Thursday) of W53 is not yet in the next
year, so a week number 53 is possible. For example, the 53 weeks of
the worst case year 1976 started with 1975-12-29 = 1976-W01-1 and
ended with 1977-01-02 = 1976-W53-7. On the other hand, considering the
lowest number of the last week of a year, the worst case is a non-leap
year like 1999 that starts with a Friday, which ensures that the first
three days of the year belong to the last week of the previous year.
In this case, the Sunday of week 52 would be day number 3+52*7=367,
i.e. only the last 367-365=2 days of the W52 reach into the next year
and consequently, even a worst case year like 1999 has a week W52
including the days 1999-12-27 to 2000-01-02. q.e.d.
</BLOCKQUOTE>
<P>[Unfortunately, the current version of the C programming language
standard provides in the <CODE>strftime()</CODE> function no means to
generate the ISO 8601 week notation. A required extension would be
four new formatting codes: for the year of the week to which the
specified day belongs (both 2-digit and 4-digit), for the number of
the week between 01 and 53, and for the day of the week between 1
(Monday) and 7 (Sunday). Another trivial mistake in the description of
<CODE>strftime()</CODE> in the C standard is that the range of seconds
goes from 00 to 61, because at one time only one single leap second 60
can be inserted into UTC and consequently there will never be a leap
second 61. Contribution <A
HREF="http://www.gold.net/users/cdwf/c/wg14n764.txt">N764</A> to the
<A HREF="ftp://dkuug.dk/JTC1/SC22/wg14/index.html">ISO C committee</A>
suggests to fix some of this in the next revision of the ISO C
standard. The author of this text has also developed a proposal for a
<A HREF="c-time/">modernised clock and calendar API</A> for C, which
provides full proper treatment of leap seconds and timezones and fixes
numerous other problems in the current C timing library functions. It
also serves as an excellent model for those who want to design clock
library functions for other programming languages.]
<P>Both day and year are useful units of structuring time, because the
position of the sun on the sky, which influences our lives, is
described by them. However the 12 months of a year are of some obscure
mystic origin and have no real purpose today except that people are
used to having them (they do not even describe the current position of
the moon). In some applications, a date notation is preferred that
uses only the year and the day of the year between 001 and 365 (366 in
leap years). The standard notation for this variant representing
the day 1995-02-04 (that is day 035 of the year 1995) is
<BLOCKQUOTE><P><STRONG>1995-035</STRONG> or
<STRONG>1995035</STRONG></BLOCKQUOTE>
<P>Leap years are years with an additional day YYYY-02-29, where the
year number is a multiple of four with the following exception: If a
year is a multiple of 100, then it is only a leap year if it is also a
multiple of 400. For example, 1900 was not a leap year, but 2000 is one.
<H2><A NAME="time">Time of Day</A></H2>
<P>The international standard notation for the time of day is
<BLOCKQUOTE><P><STRONG>hh:mm:ss</STRONG></BLOCKQUOTE>
<P>where hh is the number of complete hours that have passed since
midnight (00-24), mm is the number of complete minutes that have
passed since the start of the hour (00-59), and ss is the number of
complete seconds since the start of the minute (00-59). If the hour
value is 24, then the minute and second values must be zero. [Although
ISO 8601 does not mention this, the value 60 for ss might sometimes be
needed during an inserted <A
HREF="http://tycho.usno.navy.mil/leap.html">leap second</A> in an
atomic time scale like Coordinated Universal Time (UTC). A single leap
second 23:59:60 is inserted into the UTC time scale every few years as
announced by the <A HREF="http://hpiers.obspm.fr/">International Earth
Rotation Service</A> in Paris to keep UTC from wandering away more
than 0.9&nbsp;s from the less constant astronomical time scale UT1
that is defined by the actual rotation of the earth.]
<P>An example time is
<BLOCKQUOTE><P><STRONG>23:59:59</STRONG></BLOCKQUOTE>
<P>which represents the time one second before midnight.
<P>As with the date notation, the separating colons can also be
omitted as in
<BLOCKQUOTE><P><STRONG>235959</STRONG></BLOCKQUOTE>
<P>and the precision can be reduced by omitting the seconds or both
the seconds and minutes as in
<BLOCKQUOTE><P><STRONG>23:59</STRONG>, <STRONG>2359</STRONG>, or
<STRONG>23</STRONG></BLOCKQUOTE>
<P>It is also possible to add fractions of a second after a decimal
dot or comma, for instance the time 5.8&nbsp;ms before midnight can be
written as
<BLOCKQUOTE><P><STRONG>23:59:59.9942</STRONG> or
<STRONG>235959.9942</STRONG> </BLOCKQUOTE>
<P>As every day both starts and ends with midnight, the two notations
<STRONG>00:00</STRONG> and <STRONG>24:00</STRONG> are available to
distinguish the two midnights that can be associated with one date.
This means that the following two notations refer to exactly the same
point in time:
<BLOCKQUOTE><P><STRONG>1995-02-04 24:00</STRONG> =
<STRONG>1995-02-05 00:00</STRONG></BLOCKQUOTE>
<P>In case an unambiguous representation of time is required, 00:00 is
usually the preferred notation for midnight and not 24:00. Digital
clocks display 00:00 and not 24:00.
<P>ISO 8601 does not specify, whether its notations specify a point in
time or a time period. This means for example that ISO 8601 does not
define whether 09:00 refers to the exact end of the ninth hour of the
day or the period from 09:00 to 09:01 or anything else. The users of
the standard must somehow agree on the exact interpretation of the
time notation if this should be of any concern.
<P>If a date and a time are displayed on the same line, then always
write the date in front of the time. If a date and a time value are
stored together in a single data field, then ISO 8601 suggests that
they should be separated by a latin capital letter T, as in
<STRONG>19951231T235959</STRONG>.
<P>A remark for readers from the U.S.:
<BLOCKQUOTE><P>The 24h time notation specified here has already been
the de-facto standard all over the world in written language for
decades. The only exception are some English speaking countries, where
still notations with hours between 1 and 12 and additions like "a.m."
and "p.m." are in wide use. The common 24h international standard
notation starts to get widely used now even in England. Most other
languages don't even have abbreviations like "a.m." and "p.m." and the
12h notation is certainly hardly ever used on Continental Europe to
write or display a time. Even in the U.S., the military and computer
programmers have been using the 24h notation for a long time.
<P>The old English 12h notation has many disadvantages like:
<UL>
<LI> It is longer than the normal 24h notation.
<LI> It takes somewhat more time for humans to compare two times
in 12h notation.
<LI> It is not clear, how 00:00, 12:00 and 24:00 are represented.
Even encyclopedias and style manuals contain contradicting
descriptions and a common quick fix seems to be to avoid
"12:00 a.m./p.m." altogether and write "noon", "midnight", or
"12:01 a.m./p.m." instead, although the word "midnight" still
does not distinguish between 00:00 and 24:00.
<LI> It makes people often believe that the next day starts at the
overflow from "12:59 a.m." to "1:00 a.m.", which is a common
problem not only when people try to program the timer of VCRs
shortly after midnight.
<LI> It is not easily comparable with a string compare operation.
<LI> It is not immediately clear for the unaware, whether the
time between "12:00 a.m./p.m." and "1:00 a.m./p.m." starts
at 00:00 or at 12:00, i.e. the English 12h notation is more
difficult to understand.
</UL>
<P>Please consider the 12h time to be a relic from the dark ages when
Roman numerals were used, the number zero had not yet been invented
and analog clocks were the only known form of displaying a
time. Please avoid using it today, especially in technical
applications! Even in the U.S., the widely respected <CITE>Chicago
Manual of Style</CITE> now recommends using the international
standard time notation in publications.
</BLOCKQUOTE>
<P>A remark for readers from German speaking countries:
<BLOCKQUOTE><P>In May 1996, the German standard DIN 5008, which
specifies typographical rules for German texts written on typewriters,
has been updated. The old German numeric date notations DD.MM.YYYY and
DD.MM.YY have been replaced by the ISO date notations YYYY-MM-DD and
YY-MM-DD. Similarly, the old German time notations hh.mm and hh.mm.ss
have been replaced by the ISO notations hh:mm and hh:mm:ss. Those new
notations are now also mentioned in the latest edition of the
<CITE>Duden</CITE>. The German alphanumeric date notation continues to
be for example "3. August 1994" or "3. Aug. 1994". The corresponding
Austrian standard has already used the ISO 8601 date and time
notations before.
<P>ISO 8601 has been adopted as European Standard EN 28601 and is
therefore now a valid standard in all EU countries and all conflicting
national standards have been changed accordingly.
</BLOCKQUOTE>
<H2><A NAME="zone">Time Zone</A></H2>
<P>Without any further additions, a date and time as written above is
assumed to be in some local time zone. In order to indicate that a
time is measured in <A HREF="http://aa.usno.navy.mil/AA/faq/docs/UT.html"
>Universal Time (UTC)</A>, you can append a capital
letter <STRONG>Z</STRONG> to a time as in
<BLOCKQUOTE><P><STRONG>23:59:59Z</STRONG> or <STRONG>2359Z</STRONG>
</BLOCKQUOTE>
<P>[The Z stands for the "zero meridian", which goes through Greenwich
in London, and it is also commonly used in radio communication where
it is pronounced "Zulu" (the word for Z in the international radio
alphabet). <A HREF=
"http://www.apparent-wind.com/gmt-explained.html">Universal
Time</A> (sometimes also called "Zulu Time") was called Greenwich Mean
Time (GMT) before 1972, however this term should no longer be
used. Since the introduction of an international atomic time scale,
almost all existing civil time zones are now related to UTC, which is
slightly different from the old and now unused GMT.]
<P>The strings
<BLOCKQUOTE><P><STRONG>+hh:mm</STRONG>, <STRONG>+hhmm</STRONG>, or
<STRONG>+hh</STRONG></BLOCKQUOTE>
<P>can be added to the time to indicate that the used local time zone
is hh hours and mm minutes ahead of UTC. For time zones west of the
zero meridian, which are behind UTC, the notation
<BLOCKQUOTE><P><STRONG>-hh:mm</STRONG>, <STRONG>-hhmm</STRONG>, or
<STRONG>-hh</STRONG></BLOCKQUOTE>
<P>is used instead. For example, Central European Time (CET) is +0100
and U.S./Canadian Eastern Standard Time (EST) is -0500. The following
strings all indicate the same point of time:
<BLOCKQUOTE><P><STRONG>12:00Z</STRONG> = <STRONG>13:00+01:00</STRONG>
= <STRONG>0700-0500</STRONG></BLOCKQUOTE>
<P>There exists no international standard that specifies
abbreviations for civil time zones like CET, EST, etc. and sometimes
the same abbreviation is even used for two very different time zones.
In addition, politicians enjoy modifying the rules for civil time
zones, especially for daylight saving times, every few years, so the
only really reliable way of describing a local time zone is to specify
numerically the difference of local time to UTC. Better use directly
UTC as your only time zone where this is possible and then you do not
have to worry about time zones and daylight saving time changes at
all.
<H2><A NAME="tz">More Information about Time Zones</A></H2>
<P><A HREF="mailto:ado@elsie.nci.nih.gov">Arthur David Olson</A> and
others maintain a <A HREF=
"http://www.twinsun.com/tz/tz-link.htm">database of all current and
many historic time zone changes and daylight saving time
algorithms</A>. It is available via ftp from <A
HREF="ftp://elsie.nci.nih.gov/pub/">elsie.nci.nih.gov</A> in the
<SAMP>tzcode*</SAMP> and <SAMP>tzdata*</SAMP> files. Most Unix time
zone handling implementations are based on this package. If you want
to join the <SAMP>tz</SAMP> mailing list, which is dedicated to
discussions about time zones and this software, please send a request
for subscription to <A HREF="mailto:tz-request@elsie.nci.nih.gov"
>tz-request@elsie.nci.nih.gov</A>. You can read previous discussion
there in the <A HREF="ftp://elsie.nci.nih.gov/pub/tzarchive.gz">tz
archive</A>.
<H2><A NAME="other">Other Links about Date, Time, and Calendars</A></H2>
<P>Some other interesting sources of information about date and time
on the Internet are for example the <A
HREF="http://www.boulder.nist.gov/timefreq/glossary.htm">Glossary of
Frequency and Timing Terms</A> and the <A
HREF="http://www.boulder.nist.gov/timefreq/faq/faq.htm">FAQ</A>
provided by <A HREF="http://www.boulder.nist.gov/timefreq/">NIST</A>,
the <A HREF=
"http://www.yahoo.com/Science/Measurements_and_Units/Time/" >Yahoo
Science:Measurements and Units:Time</A> link collection, the <A
HREF="http://tycho.usno.navy.mil/">U.S. Naval Observatory Server</A>,
the <A HREF="http://hpiers.obspm.fr/"> International Earth Rotation
Service (IERS)</A> (for time gurus only!), the <A
HREF="http://www.eecis.udel.edu/~ntp/">University of Delaware NTP Time
Server</A>, the time and calendar section of the <A
HREF="http://sciastro.astronomy.net/sci.astro.3.FAQ">USENET sci.astro
FAQ</A>, and the <A HREF=
"http://www.tondering.dk/claus/calendar.html">Calendar FAQ</A>.
<P><HR>
<P>This was a brief overview of the ISO 8601 standard, which covers
only the most useful notations and includes some additional related
information. The full standard defines in addition a number of more
exotic notations including some for periods of time. The <A HREF=
"http://www.iso.ch/cate/d15903.html">ISO 8601:1988 document</A> is
fortunately now also <A
HREF="http://www.iso.ch/markete/8601.pdf">available online</A>, or you
can order a paper copy from
<BLOCKQUOTE><P>
<A HREF="http://www.iso.ch/">International Organization
for Standardization</A><BR>
Case postale 56<BR>
1, rue de Varemb&eacute;<BR>
CH-1211 Gen&egrave;ve 20<BR>
Switzerland<BR>
<BR>
phone: +41 22 749 01 11<BR>
fax: +41 22 733 34 30<BR>
email: <A HREF="mailto:sales@isocs.iso.ch">sales@isocs.iso.ch</A>
</BLOCKQUOTE>
<P>A more detailed online summary of ISO 8601 than this one is the
text <CITE>ISO 8601:1988 Date/Time Representations</CITE> available
from <A HREF=
"ftp://ftp.informatik.uni-erlangen.de/pub/doc/ISO/ISO8601.ps.Z">
ftp.informatik.uni-erlangen.de/pub/doc/ISO/ISO8601.ps.Z</A>
(PostScript, 16 kb, 5 pages) written by <A HREF=
"mailto:Gary.Houston@actrix.gen.nz">Gary Houston</A>, now also
available in <A HREF=
"http://www.mcs.vuw.ac.nz/comp/Technical/SGML/doc/iso8601/ISO8601.html"
>HTML</A>. Ian Galpin (G1SMD) proposes to use ISO 8601 as a <A
HREF="http://www.kirsta.demon.co.uk/radio/iso_8601.htm">Common Date-Time
Standard for Amateur Radio</A>. <A
HREF="http://www.saqqara.demon.co.uk/">Steve Adams</A> has written <A
HREF= "http://www.saqqara.demon.co.uk/datefmt.htm">another web
page</A> about the ISO date format that is partially based on this
text.
<P>ISO TC 154 decided in 1996 to revise ISO 8601. <A
HREF="mailto:Louis.Visser@nni.nl">Louis Visser</A> is coordinating
this project. If you want to contribute to this work, you should
contact your <A HREF=
"http://www.iso.ch/addresse/address.html">national ISO member
organization</A>. <!-- Have a look at the <A HREF="8601v04.pdf">1998-01
draft of the forthcoming ISO 8601:1999</A>.-->
<P><HR>
<P>I wish to thank <A HREF="http://emr.cs.uiuc.edu/~reingold">Edward
M. Reingold</A> for developing the fine GNU Emacs calendar functions,
as well as <A HREF="http://yank.kitchener.on.ca/~richw">Rich Wales</A>,
<A HREF="mailto:msb@sq.com">Mark Brader</A>, <A
HREF="mailto:eggert%yata.UUCP@twinsun.com">Paul Eggert</A>, and others
in the <A HREF="news:comp.std.internat">comp.std.internat</A>, <A
HREF="news:comp.protocols.time.ntp">comp.protocols.time.ntp</A>, and
<A HREF="news:sci.astro">sci.astro</A> USENET discussion groups for
valuable comments about this text. Further comments and hyperlinks to
this page are very welcome.
<P>Some journalists recently got interested in the international date
and time format and reported about it. Examples include:
<UL>
<LI>An article by <A HREF="mailto:Jon.Auerbach@news.wsj.com">Jon G.
Auerbach</A> in the 1999-06-01 issue of the Wall Street Journal, page
A1.
</UL>
<P>If you are a journalist and need information on this or related
topics, please feel free to contact me.
<P>You might also be interested in the <A
HREF="http://www.cl.cam.ac.uk/~mgk25/iso-paper.html">International
Standard Paper Sizes</A> Web page.
<P><A HREF="http://www.cl.cam.ac.uk/~mgk25/">
Markus Kuhn</A> <A HREF="mailto:Markus.Kuhn@cl.cam.ac.uk"
>&lt;Markus.Kuhn@cl.cam.ac.uk></A>
<BR><SMALL>created 1995 -- last modified 2000-01-24 --
http://www.cl.cam.ac.uk/~mgk25/iso-time.html</SMALL>
</BODY>
</HTML>

52
doc/linux-poll.patch Normal file
View File

@ -0,0 +1,52 @@
*** ./select.c.bak Sun Apr 30 13:00:38 2000
--- /usr/src/linux/fs/select.c Mon May 1 18:00:15 2000
***************
*** 11,16 ****
--- 11,17 ----
*/
#include <linux/malloc.h>
+ #include <linux/vmalloc.h>
#include <linux/smp_lock.h>
#include <linux/poll.h>
#include <linux/file.h>
***************
*** 416,422 ****
}
size = nfds * sizeof(struct pollfd);
! fds = (struct pollfd *) kmalloc(size, GFP_KERNEL);
if (!fds)
goto out;
--- 417,426 ----
}
size = nfds * sizeof(struct pollfd);
! if (size > PAGE_SIZE)
! fds = (struct pollfd *) vmalloc(size);
! else
! fds = (struct pollfd *) kmalloc(size, GFP_KERNEL);
if (!fds)
goto out;
***************
*** 437,443 ****
err = -EINTR;
out_fds:
! kfree(fds);
out:
if (wait)
free_wait(wait_table);
--- 441,450 ----
err = -EINTR;
out_fds:
! if (size > PAGE_SIZE)
! vfree(fds);
! else
! kfree(fds);
out:
if (wait)
free_wait(wait_table);

183
doc/modes.txt Normal file
View File

@ -0,0 +1,183 @@
Nefarious 2 Modes Documentation
Last updated 3 Nov 2015 by Andromeda
USER MODES
~~~~~~~~~~~~~~~~~
a - Admin
Marks the user as an IRC Administrator
B - Bot
Marks the user as a bot
C - Cloakhost
Hashed mask of the user's host to display if hidden host and/or fakehost do not meet requirements
c - Cloak IP
Hashed mask of the user's IP address to display if hidden host and/or fakehost do not meet requirements
D - Deaf to Priv
Sets the user to deaf to private messages and notices
d - Deaf
Makes the user deaf to incoming messages non-prefix configured channels
f - Fakehost
Sets the fakehost on the user assuming hidden host is enabled and active
g - Debug
Allows the user to view debug information
H - Hide Oper
Hides all indications that the user is an Operator
h - Sethost
Sets the fakehost on the user assuming hidden host is enabled and active
I - No Idle
Hides the idle time of the user for /whois requests
i - Invisible
Hides the user from /who and /names when triggered by a user not on the same channel
k - Service
Sets the target as a network service. This should NOT be used for operators or users as it WILL cause major issues
with channel registration and other such services abilities
L - No Link
Allows the user to walk through channel redirections without being forced into the destination channel
p - No Channel
Hides channel list from non-opers in /whois
o - IRC Operator
Grants IRC Operator privileges to the user
O - Local Operator
Grants IRC Operator privileges to the user on the local server only and does not allow for network wide commands
q - Common Channels Only
Can only be private messaged from users in common channels
R - Registered Only
Only allow private messages from registered users
r - Registered
Marks the user as registered
s - Snomask/Service Notice
Sets the specified snomask on the user. See doc/snomask.txt for more information
W - Whois Notice
Tell the user who someone performs a /whois request on him/her
w - Wallops
Allows the user to recieve wallop notices
X - Xtra Op
Sets the user into God mode. This is an emergency override flag and should NOT be used
constantly! This flag is also potentially dangerous and you should be very careful with
it.
x - Hidden Host (Virtual Host)
Sets a hidden host on the user based on the hidden host type configured in the features block
z - SSL
Marks the user as connected via SSL
CHANNEL MODES
~~~~~~~~~~~~~~~~~
A - APASS
Used with OPLEVEL
a - Admin Only
Marks a channel as admin restricted, allowing only IRC Administrators to join
b - Ban
Sets a ban on the channel of the specified nick!user@host mask (wildcards permitted)
C - No CTCP
Block all CTCP's sent to the channel
c - No Colour
Forbid the use of colours on the channel
D - Delayed joins
Hide all join events on the channel until the user speaks or has a mode set
d - Was Delayed Joins
Replaces +D when disabled if there are hidden users yet to join the channel
e - Except
Sets a ban exception on the channel of the specified nick!user@host mask (wildcards permitted)
h - Channel HalfOp
Sets +h on the user granting them channel half operator abilities (if enabled)
i - Invite Only
Marks the channel as by invite only
k - Key
Sets a passphraze on the channel required for users to join
L - Redirect
Marks the channel as being redirected to the specified destination
l - Limit
Set the limit of users permitted to join the channel
M - Registered Moderated
Only allows registered users and voiced/halfop'd/op'd to send messages in the channel
m - Moderated
Marks a channel as moderated (muted) and only allows users with voice, halfop, and op to speak
N - No Channel Notices
Denies sending notices to the channel
n - No External Messages
Forbids users from outside the channel from sending messages to it
O - Oper Only
Marks a channel as oper restricted, allowing only IRC Operators to join
o - Channel Operator
Sets +o on the user granting them channel operator abilities
p - Private
Marks a channel as private
Q - No Quit/Part Messages
Hide all quit and part messages
R - Registered
Marks the channel as registered
r - Registered Users Only
Only allow registered users to join the channel
S - Strip
Remove all colours and effects on all messages within the channel
s - Secret
Marks a channel as secret and excludes it from /list
T - No Multi Target Messages
Block all multi channel messages (such as /amsg in mIRC)
t - Topic
Only ops can set the topic
U - UPASS
Used with OPLEVEL
v - Channel Voice
Sets +v on the user granting channel voice abilities
z - Persistant
Resyncs channels upon bursting
Z - SSL Users Only
Only allow users using SSL to join the channel

1184
doc/p10.html Normal file

File diff suppressed because it is too large Load Diff

1103
doc/p10.txt Normal file

File diff suppressed because it is too large Load Diff

25
doc/readme.asll Normal file
View File

@ -0,0 +1,25 @@
AsLL preliminary documentation, last updated 13 Jun 2002
Server-to-server ping format:
<prefix> G !<local-ts> <target> <local-ts>
prefix = origin server numeric
local-ts = local timestamp, as "seconds.miliseconds"
target = target server numeric
The local-ts is also sent instead of the origin field,
so RTT information can be collected from non-AsLL servers,
while preserving backward compatibility.
Server-to-server pong format:
<prefix> Z <origin> <target> <remote-ts> <diff> <local-ts>
prefix = origin server numeric
origin = origin server numeric
target = target server numeric
remote-ts = remote timestamp as received from an AsLL PING
diff = difference between local-ts and remote-ts in miliseconds (integer)
local-ts = local timestamp, as "seconds.miliseconds"

91
doc/readme.chroot Normal file
View File

@ -0,0 +1,91 @@
Using Chroot With IRCD
Introduction
Many system administrators like to run certain daemons within a
"jail," a secure area of the file system that the daemon supposedly
cannot break out of. That way, if the daemon is compromised somehow,
the attacker cannot get out and affect the rest of the system in any
way. There are problems with this--the standard UNIX way of doing
this is with the chroot() call, which has been deprecated by the
UNIX98 standard. Moreover, if an attacker has root within the jail,
it is trivial to get *out* of the jail in most circumstances.
Nevertheless, it is still often a good idea, and some systems can use
more secure jails than other systems.
Older versions of ircd supported chroot() operation within the server
itself, but these were fraught with problems--chroot() can only be
called by a process running as root, so ircd had to be started as
root, typically by making it setuid, and would then have to drop those
privileges after calling chroot(). Moreover, the design of the server
would require that the server binary be in DPATH, or the /RESTART
command would not work. In fact, /RESTART still wouldn't work,
because the server would then attempt to change directories to a DPATH
relative to the current root directory--and of course, the root
directory often would not contain the shared libraries necessary for
the ircd to even start.
Configuring the Server For Use With Chroot
In the versions of ircd starting with u2.10.11, all the setuid and
chroot() code has been removed from the server. It is still possible
to cause the daemon to run in a chroot() jail, however, through the
use of a wrapper script. This requires making all paths compiled in
to the server be relative to the new root directory; fortunately, this
can be done by giving the configure script the --with-chroot=<dir>
option. The <dir> argument specifies to configure where the root
directory will be, and the server restart path, data path,
configuration file, and debug log files will all be modified to be
relative to this root directory. If the data path or configuration
files cannot be made relative to the specified root directory,
configure will issue an error message and exit; if the server restart
path is not relative to the specified root directory, configure will
issue a warning.
The various paths are made relative to the root directory through the
use of simple edits to their string representation. As an example,
assume that we will be using the root directory "/home/ircd"; if the
data path is "/home/ircd/lib," the data path that will be compiled
into the server will be simply "/lib"; if, on the other hand, the
specified data path were "/usr/local/lib/ircd," configure would issue
an error, since there is no way to make the data path relative to the
specified root directory.
Preparing the Root Directory
Most modern operating systems use shared libraries. When using
chroot(), these libraries are searched for relative to the new root
directory, and they must be present in order for a program to
execute. The root directory must be prepared, therefore, by coping
these libraries into the correct place. A script for this purpose has
been provided in tools/mkchroot. This script relies on the command
"ldd," which is used to report which shared libraries are used by a
particular program; it also relies on ldd printing out the full path
to those libraries. If either of these conditions is not met, it will
be necessary to track down the libraries by hand and place them into
the appropriate locations. The tools/mkchroot script takes as its
first argument the path to the directory to be prepared as a root
directory; following this argument should be a list of programs that
will be running with that directory as the root directory.
Using the Wrapper
Also provided in the tools subdirectory are the sources for a simple
wrapper program that can be used to start ircd. The program can be
compiled by executing "cc -o wrapper tools/wrapper.c"; it must be run
as root, but do not install it as root, since that would be a major
security risk. This tool can be used to set the hard limit on file
descriptors, as well as a root directory, and so may be useful to the
administrator even if chroot() operation is not desired. A summary of
the command line options for the wrapper tool can be obtained with the
"-h" option. To set the file descriptor limit, use the "-l" option
followed by the desired number of file descriptors; to select an
alternative root directory, use "-c" followed by the desired root
directory. You must use the "-u" option to specify a user name (or
user ID) that the command should be run as; otherwise, the command
will be run as root, which is not what you want (and why you should
never install this program setuid root). Follow the command line
arguments with "--" and the full path to the command that you wish to
run, along with arguments to that command. The "--" tells the wrapper
program to stop interpreting options, and is very important if you
must give the command any options.

126
doc/readme.crules Normal file
View File

@ -0,0 +1,126 @@
SmartRoute
Rule based connects
Draft 4 - Aug 19, 1994
by Tony Vencill
Rule based connects allow an admin to specify under what conditions
a connect should not be allowed. If no rules are specified for a
given C and/or N line it will be allowed under any condition.
A rule may consist of any legal combination of the following functions
and operators.
Functions
---------
connected(targetmask) - true if a server other than that processing
the rule is connected that matches the
target mask
directcon(targetmask) - true if a server other than that processing
the rule is directly connected that matches
the target mask
via(viamask, targetmask) - true if a server other than that processing
the rule matches the target mask and is
connected via a directly connected server
that matches the via mask
directop() - true if an oper is directly connected
Unary operators
---------------
! eg: !argument - true if the argument is false
Binary operartors
-----------------
&& eg: arg1&&arg2 - true if arg1 and arg2 are both true
|| eg: arg1||arg2 - true if arg1, arg2, or both are true
Parenthesis () are allowed for grouping arguments, but if no parenthesis
are included, && will take precedence over ||, ! will take precedence
over both && and ||, and the function will be evaluated from left to
right. White space in a rule is ignored. Invalid characters in a rule
will lead to the rule being ignored.
Examples
--------
A simple example of a connect rule might be:
connected(*eu.under*)
This might be used in a US undernet server for a Europe CN pair to
insure that a second Europe link is not allowed if one US-EU link
already exists. Note that on the undernet, US server names are
city.state.us.undernet.org and Europe server names are
city.country.eu.undernet.org.
A more interesting example might be:
connected(*eu.under*) &&
( !direct(*eu.under*) || via(manhat*, *eu.under*) )
Imagine the Boston undernet server uses this rule on its Europe CN
pairs. This says that if a Europe server is already connected, a
Boston-Europe connect will not be allowed. It also says that if a
Europe server does already exist and Boston is not directly connected
to one or more Europe servers or Manhattan is, the Boston-Europe
connect will not be allowed. This has the effect of allowing multiple
US-EU links but attempting to limit these links to one server (ie:
Boston will not initiate its first Europe link if another server is
already linking Europe). This rule will also prefer to let Manhattan
handle the US-EU link by disallowing Boston-Europe links if a Europe
server is already linked to Manhattan.
A example of the remaining function, directop(), is:
connected(*eu.under*) || directop()
If this line is used on Boston for the Paderborn CN pair, it will allow
connects to Paderborn only if another Europe server is not already
connected and there is not an oper on Boston. If this rule is
overrideable (ie: is applied only to autoconnects as described below),
then it will disallow Boston autoconnects to Paderborn while a Boston
oper is online, but allow oper-initiated connects to Paderborn under any
circumstance. This directop() function could be used to invoke less
prefered routes only when an oper is not present to handle routing, or
conversly to allow use of less preferable routes only when an oper is
present to monitor their performance.
ircd.conf entries
-----------------
A rule is listed in the ircd.conf file using a D or d line (which can
be thought of as a "disallow" line). D lines will apply to all oper
and server originated connects, while d lines will apply only to
autoconnects (ie: they are overrideable by opers). The formats are:
D:targetmask::rule
d:targetmask::rule
Remember that newlines are not allowed in conf lines. Two examples
(from above) are:
D:*eu.under*::connected(*eu.under*)
d:*eu.under*::connected(*eu.under*) || directop()
Connects originating from other servers will be checked against and
matching D lines, while matching d lines will be ignored as it will not
be clear whether or not the connection attempt is oper initiated.
Checking and viewing rules
--------------------------
The chkconf program that comes with the servers has been modified to
also check your connect rules. If running in debug mode, parsing errors
will show up at debug level 8. To view rules online, "/stats d" can be
used to see all rules and "/stats D" can be used to view those rules
which affect oper initiated connects and accepts.
Processing and storage
----------------------
The rules are parsed when the conf file is read and transformed into a
more efficiently computed form, then all applicable rules are
evaluated each time a connect command is given or an autoconnect is
due. If more than one applicable rule is given, only one need
evaluate to true for the connect to be allowed (ie: the rules are ored
together). Note that conditions that exist when the connect is
initiated might differ from conditions when the link is established.

42
doc/readme.cvs Normal file
View File

@ -0,0 +1,42 @@
Notes on checking out from the Undernet CVS archive.
The main trunk of the tree (HEAD) will be used for development only.
When the maintainers believe the code is stable enough to prepare for
a release, they will make a branch for that release series.
Each branch will have a base name, which is the name of the release
series where dots are replaced with underscores. The branch name will
be the base name with the suffix "_branch". Once an official release
is made, each release branch will have one or more fixed tags and one
moving tag. The fixed tags will indicate specific patchlevels, and
have the base name with a suffix giving the zero-based patchlevel.
The moving tag's name will be the base name, and will always point to
the same state as some fixed tag on the branch.
This allows developers to easily track the most recent version of any
branch (by checking out using the branch's name), and allows server
admins to easily track the most recent release on the branch (by
checking out using the branch's base name).
For example, for the ircu2.10.12 release series, the branch's base
name is u2_10_12. The branch's name is u2_10_12_branch. The first
release (ircu2.10.12) would be permanently tagged as u2_10_12_0, and
until an update is released, it would also have the tag u2_10_12.
When the first update is released, it would be permanently tagged as
u2_10_12_01, and the tag u2_10_12 would be changed to point to it.
If the current stable series is 2.10.12, server admins should check
out the code using the command:
cvs -d :pserver:anonymous@cvs.undernet.org:/cvsroot/undernet-ircu co -r u2_10_12 -P ircu2.10
Admins may only run unreleased code on Undernet with coder-com
approval. The command above will retrieve the most recent release.
Developers should check out the release branch using the command:
cvs -d :pserver:anonymous@cvs.undernet.org:/cvsroot/undernet-ircu co -r u2_10_12_branch -P ircu2.10
http://sourceforge.net/cvs/?group_id=63470 gives more information on
using CVS to access the ircu code; http://www.nongnu.org/cvs/ gives
more information on using CVS in general.
NOTE: Release before ircu2.10.12 used a different branching scheme.
Older revisions of this readme.cvs explain that system.

1806
doc/readme.features Normal file

File diff suppressed because it is too large Load Diff

124
doc/readme.gline Normal file
View File

@ -0,0 +1,124 @@
GLINE documentation, last updated on 17 Mar 2007
For an ordinary user, the syntax is:
GLINE [<mask>]
If <mask> is given, and if a G-line for that server exists, all the
information about that G-line is displayed. If <mask> is not given,
an error is returned.
For an operator, the syntax is:
GLINE [[!][+|-|>|<]<mask> [<target>] [<expiration> [:<reason>]]]
There are a total of 10 basic forms of the GLINE command. If no
arguments are given, all existing G-lines will be listed; if only
<mask> is given, the behavior is the same as for an ordinary user.
The remaining forms allow G-lines to be set, manipulated, or possibly
destroyed.
* Local G-lines.
Opers may set or remove G-lines that only apply to a specific server.
When the <target> parameter is not given, the specific server will be
the local server; otherwise, it will be taken to be a remote server,
and the G-line operations will take place there, if the oper has the
GLINE privilege. When <mask> is preceded with the '+' character, the
G-line will be added, and <expiration> and <reason> are required; when
<mask> is preceded with the '-' character, the G-line will be removed,
and <expiration> and <reason> are not required. The '<' and '>'
character prefixes are not valid for local G-lines.
* Local modifications to global G-lines.
Opers may locally activate or deactivate global G-lines. In this
mode, <mask> is interpreted as referencing an existing G-line, and
will be preceded by either '<' (to locally deactivate the G-line) or
'>' (to locally activate the G-line). This local state overrides the
global state of the G-line, and persists until there is a global state
change to the G-line, or until the G-line expires. The <expiration>
and <reason> arguments are not required, but <target> may be given if
the oper desires to make the appropriate change on a remote
server--note that the oper will need the GLINE privilege for this.
* Global G-lines.
Opers may, if they have the GLINE privilege, set and manipulate global
G-lines on the network. To create a new G-line, the oper must prefix
the <mask> with either '+' (for globally activated G-lines) or '-'
(for globally deactivated G-lines). Additionally, <target> must be
given as "*", and the <expiration> and <reason> parameters are
required. If the G-line already exists, it will be modified to match
the new global status, <expiration>, and <reason>.
When the G-line already exists, an oper may activate or deactivate it
simply by setting <target> to "*" and prefixing the <mask> with either
"+" (to activate the G-line) or "-" (to deactivate it). If it is
desired to simply modify the expiration time or reason, without
changing the activation status, specify <mask> without any prefix, set
<target> to "*", and provide the updated <expire> and optionally an
updated <reason>.
* Privilege notes.
Note that, for all locally-restricted G-line changes, such as locally
activating a G-line or creating a local G-line, the oper must have the
LOCAL_GLINE privilege. For any other G-line change, including
locally-restricted changes on remote servers, the server's
CONFIG_OPERCMDS privilege must be enabled and the oper must have the
GLINE privilege. There are also restrictions to prevent an oper from
setting a G-line that is too wide; in some cases, those restrictions
may be overridden by prefixing the <mask> parameter with the "!"
character, IF the operator has the WIDE_GLINE privilege.
For a server, the syntax is:
<prefix> GL <target> [!][+|-|>|<]<mask> [<expiration>] [<lastmod>]
[<lifetime>] [:<reason>]
There are a total of 8 basic forms of the GL command. The primary
innovation is the addition of the <lifetime> parameter, which
specifies a lifetime for the G-line record which may be longer than
the expiration time. <lifetime> will be monotonically increasing,
enabling <expiration> to be modified in any way desirable.
* Local G-lines.
Remote servers, or opers on them, may remotely set local G-lines on
the local server. To create a local G-line, <target> will be set to
the numeric of the local server, and <mask> must be preceded by '+'
(optionally preceded by '!' if the origin desires to override some
safety settings). The <expiration> and <reason> parameters are
required. The <lastmod> and <lifetime> parameters will be ignored if
present, allowing backwards compatibility with ircu2.10.12.10 and
prior versions. Removing local G-lines is similar--<mask> must be
preceded by '-', and all other parameters are ignored to allow
backwards compatibility.
* Local modifications to global G-lines.
Remote servers, or opers on them, may also locally activate or
deactivate a global G-line on the local server. The <target> must be
set to the numeric of the local server, and <mask> must be preceded by
either '<' (to locally deactivate the G-line) or '>' (to locally
activate the G-line). This local state overrides the global state of
the G-line, and persists until there is a global state change to the
G-line, or until the G-line expires. No other parameters are
necessary in this mode, and will be ignored if present.
* Global G-lines.
For creation and manipulation of global G-lines, the <target>
parameter must be set to "*". If the G-line does not exist, and if
<expiration> is given, the G-line will be created with the specified
expiration and <reason> (the latter defaulting to "No reason" if not
present). Otherwise, the G-line will be updated according to the
available parameters. The rules are similar to those for oper-issued
global G-lines, with the addition of a <lastmod> parameter, which is a
monotonically increasing serial number for the G-line, and an optional
<lifetime> parameter that specifies a monotonically increasing
lifetime for the G-line record. Note that, for existing G-lines where
only state changes (global activation or deactivation) are necessary,
only <lastmod> is required; <expiration> must be specified for all
other forms of the GL command.

577
doc/readme.iauth Normal file
View File

@ -0,0 +1,577 @@
OVERVIEW
========
The iauth protocol used here is based on the one in irc2.11.1, with
minor changes to support challenge-response protocols and
login-on-connect. Reference to that version's iauth-internals.txt and
source code may be useful. For clarity, this document uses "server"
to refer to any IRC server implementing this protocol, "ircu" to refer
to Undernet ircd, and "ircd" to refer to IRCnet ircd.
Certain messages are relayed to interested operators. ircu implements
this by using the 131072 (SNO_AUTH) server notice mask. ircd
implements this by using the &AUTH local channel.
STARTING IAUTH
==============
The path to the iauth program is specified in the server configuration
file. The server spawns that program when reading the configuration
file or when the previous iauth instance terminates. To protect
against a series of crashes, the server will refuse to restart an
iauth instance that it spawned in the last five seconds. A rehash
operation will clear this behavior. The server and iauth instance
communicate over the iauth instance's stdin and stdout.
Every message from the server to the iauth instance is a single line.
The line starts with an integer client identifier. This may be -1 to
indicate no particular client or a non-negative number to indicate a
client connected to the server.
When the server starts the iauth instance, it sends a line formatted
like "-1 M irc.example.org 20000" to indicate its name and an
exclusive upper bound on valid client identifiers. In that example,
possible client identifiers would be from 0 through 19999 inclusive.
This upper bound is called MAXCONNECTIONS in the server code.
When the iauth instance starts, it sends a V message to indicate its
version.
The server should provide /stats subcommands that report the iauth
instance's version, configuration and statistics.
Line formats in both direction are IRC-like in format: space
characters separate arguments and a colon at the start of an argument
indicates that the remainder of the line is one argument. To avoid
problems, IPv6 address arguments with a leading colon may have to be
prefixed with a 0 -- for example, ::1 sent as 0::1.
When the iauth instance sends messages that relate to a particular
client, that client is identified by three parameters from the
server's Client Introduction message (<id>, <remoteip> and
<remoteport>). If any of these disagree with the server's current
user tables, it is an error.
CLIENT STATES
=============
Each client is conceptually in one of four states: GONE, REGISTER,
HURRY or NORMAL. Each client starts in the GONE state. Certain
messages from the server signal a client's transition from one state
to another, and certain messages from the iauth instance cause a state
transition.
To be pedantic, the REGISTER state is a collection of sub-states since
certain commands must occur at most and/or at least one time during
the REGISTER state. The distinctions between these sub-states are
distracting and not important, so they are described as one state and
the repetition limitations are described for each command.
The rationale for the HURRY state is to give explicit input to the
iauth instance as to when the server believes it has sent the complete
set of data for the client. Rather than defining the complete set of
information in this protocol document, that is left to the server.
ircd does not indicate this state.
POLICIES AND USE CASES
======================
The historical application of iauth has been to block users that
appear to be drones early, before they have a chance to disrupt the
network, and without affecting other users on the same host (which
K-lines do). This protocol extends that application by adding the n
server message and by allowing challenge-response exchanges with the
client.
Eventually it would be nice to move the DNS and ident lookups into
iauth, and remove that code from the IRC server. ircd already does
this; since ircu does not, it adds the u server message.
For trusted proxies, this protocol gives the capability for clients
connecting through those proxies to be displayed with their actual
username, IP address and hostname. The same functions allow other
clients to use iauth-assigned spoofs, for example to hide the IP
addresses used by operators.
This protocol allows login-on-connect, for example by clients that
send their account name and password in PASS, through the R iauth
message.
This protocol allows iauth to assign a client to a particular class by
specifying a class name in the D or R iauth message.
SERVER MESSAGES
===============
X - Example Message Description
Syntax: <id> X <several> <arguments>
Example: 5 X arguments vary
States: REGISTER(1), HURRY, NORMAL
Next State: -
Comments: This is an example message description. Each message is a
single character. The States field indicates which states the
message may occur in and any restrictions on how many times the
message may be sent during those states (restrictions only make
sense when Next State is -). The Next State field indicates which
new state is implied by the message; a hyphen indicates no state
change is implied. This is an example, not a description of the
actual X message.
Compatibility: If we believe ircu behavior is different than ircd's,
this describes ircd's behavior or expectations.
C - Client Introduction
Syntax: <id> C <remoteip> <remoteport> <localip> <localport>
Example: 5 C 192.168.1.10 23367 192.168.0.1 6667
States: GONE
Next State: REGISTER
Comments: Indicates that <localport> on <localip> accepted a client
connection from <remoteport> on <remoteip>.
D - Client Disconnect
Syntax: <id> D
Example: 5 D
States: REGISTER, HURRY, NORMAL
Next State: GONE
Comments: Indicates that a client is disconnecting from the server.
F - Client Has An SSL Certificate
Syntax: <id> F <fingerprint>
Example 5 F 61d0720b27d8aed9c0a7cb788091b0d8d9a94e119d5118e574b70eecd41b3c26
States: REGISTER
Next State: -
Comments: Indicates that a client has connected using an SSL client
certificate and what that certificates fingerprint is. This message
is enabled by requesting the 'F' policy.
Compatibility: This is a Nefarious extension, ircd and Undernet ircu do
not send it.
R - Client Has Authenticated Using SASL or LOC
Syntax: <id> R <account>
Example 5 R dave
States: REGISTER
Next State: -
Comments: Indicates that a client has authenticated using SASL or LOC and has
had an account name applied. This message is enabled by requesting the 'r'
policy.
Compatibility: This is a Nefarious extension, ircd and Undernet ircu do
not send it.
N - Hostname Received
Syntax: <id> N <hostname>
Example: 5 N host-1-10.example.org
States: REGISTER(1)
Next State: -
Comments: Indicates that the server received hostname information for
a client. Only one of 'N' and 'd' is sent.
d - Hostname Timeout
Syntax: <id> d
Example: 5 d
States: REGISTER(1)
Next State: -
Comments: Indicates that the server did not receive hostname
information for a client in a timely fashion. Only one of 'N' and
'd' is sent.
P - Client Password
Syntax: <id> P :<password ...>
Example: 5 P :buddha n1rvan4
States: REGISTER
Next State: -
Comments: Indicates the client's password information. This may be a
traditional client password, an account and pass phrase pair, or the
response to a challenge (see the iauth C message). This message is
enabled by requesting the A policy.
U - Client Username
Syntax: <id> U <username> <hostname> <servername> :<userinfo ...>
Example: 5 U buddha bodhisattva.example.com irc.undernet.org :Gautama Siddhartha
States: REGISTER(1+)
Next State: -
Comments: Indicates the client's claimed username and "GECOS"
information, along with client hostname and server name. This
information is not reliable. This message is enabled by requesting
the A policy.
Compatibility: ircd only sends the <username> parameter.
u - Client Username
Syntax: <id> u <username>
Syntax: <id> u
Example: 5 u notbuddha
States: REGISTER(1)
Next State: -
Comments: Indicates a more reliable username for the client.
Compatibility: This is an Undernet extension and ircd does not send
it. It is enabled by the iauth instance requesting the U policy.
If the identd lookup fails for a user, no username is passed.
n - Client Nickname
Syntax: <id> n <nickname>
Example: 5 n Buddha
States: REGISTER(1+), HURRY
Next State: -
Comments: Indicates the client's requested nickname.
Compatibility: This is an Undernet extension and ircd does not send
it. It is enabled by the iauth instance requesting the U policy.
H - Hurry Up
Syntax: <id> H <class>
Example: 5 H Others
States: REGISTER
Next State: HURRY
Comments: Indicates that the server is ready to register the client
except for needing a response from the iauth server. <class> is
a tentative connection class for the user, which will be used unless
iauth overrides it in a D or R message.
Compatibility: This is an Undernet extension and ircd does not send
it. It is enabled by the iauth instance requesting the U policy.
T - Client Registered
Syntax: <id> T
Example: 5 T
States: HURRY
Next State: NORMAL
Comments: Indicates the server got tired of waiting for iauth to
finish and the client is being accepted. This message should
never be sent when the R policy is in effect.
Compatibility: ircd allows this message for clients in the REGISTER
state.
E - Error
Syntax: <id> E <type> :<additional text>
Example: 5 E Gone
States: N/A
Next State: -
Comments: Indicates that a message received from the iauth instance
could not be rationally interpreted. This may be because the client
could not be found, the client was in an inappropriate state for the
message, or for other reasons. The <type> argument specifies the
general type of error and <additional text> provides details. <id>
may be -1.
M - Server Name and Capacity
Syntax: <id> M <servername> <capacity>
Example: -1 M irc.example.org 20000
States: GONE(1)
Next State: -
Comments: Indicates the server's name and upper bound on client
identifiers.
Compatibility: ircd does not include the <capacity> information.
The <id> should be ignored: ircd sends 0 and ircu sends -1.
e - Server Event
Syntax <id> e <event>[ :<params>]
Example: -1 e rehash
States: N/A
Next State: -
Comments: Notifies iauthd of an event identified by <event> with
further information regarding the event being supplied in <params>.
This messages is enabled by requesting the 'e' policy.
Currently implimented events: rehash
Compatibility: This is a Nefarious extension, ircd and Undernet ircu do
not send it.
X - Extension Query Reply
Syntax: <id> X <servername> <routing> :<reply>
Example: -1 X channels.undernet.org 5/127.0.0.1/6667 :OK kev Logged in
States: N/A
Next State: -
Comments: Used to deliver the reply to an extension query to the iauth
instance. The <servername> parameter indicates the origin of the
reply. The <routing> parameter is the same as was used in the X
message from the iauth instance, and can be used to pair the reply
with the original request. The <reply> parameter contains the text
of the reply.
Compatibility: This is an Undernet extension and ircd does not send
it.
x - Extension Query Server Not Linked
Syntax: <id> x <servername> <routing> :Server not online
Example: -1 x channels.undernet.org 5/127.0.0.1/6667 :Server not online
States: N/A
Next State: -
Comments: Used to indicate to the iauth instance that the server
specified in the X message is not presently linked to the network.
This will not detect the extension query being lost due to a network
break, so iauth instances should further implement a timeout
mechanism for extension queries.
Compatibility: This is an Undernet extension and ircd does not send
it.
W - WEBIRC Message Received From Client
Syntax: <id> W <password> <username> <hostname> <ip>[ :<options>]
Example: 5 W password cgiirc localhost 127.0.0.1
States: REGISTER
Next State: -
Comments: Used to forward a WEBIRC request from the client to iauthd
for validation and application. This message is enabled by requesting
the 'w' policy. The options argument is always forwarded in this
context if supplied by the client as there is no WebIRC confguration
available to decide whether or not to allow options at this stage.
Compatibility: This is a Nefarious extension, ircd and Undernet ircu do
not send it.
w - WEBIRC Message Received and Trusted From Client
Syntax: <id> w <password> <username> <hostname> <ip>[ :<options>]
Example: 5 w password cgiirc localhost 127.0.0.1
States: REGISTER
Next State: -
Comments: Used to forward a WEBIRC request from the client to iauthd
having already been validated and applied by Nefarious. This message
is enabled by requesting the 'w' policy. In this case the options
argument is only supplied if the client provided one and the WebIRC
configuration that accepted this WEBIRC request enables options.
Compatibility: This is a Nefarious extension, ircd and Undernet ircu do
not send it.
IAUTH MESSAGES
==============
X - Example Message Description
Syntax: X <arguments>
Example: X something
Notify: yes
States: N/A
Next State: N/A
Comments: This is an example message description. Each message is a
single character. If the Notify field is present and says yes,
interested operators (with SNO_AUTH set) should be notified of the
message. The States field, where present, indicate which states
accept this message. Clients in other states should ignore the
message or treat it as an error. The Next State field, where
present, indicates what the next state should be for the client.
This is an example, not a description of the actual X message.
Compatibility: If we believe ircu behavior is different than ircd's,
this describes ircd's behavior or expectations.
> - Operator Notification
Syntax: > :<message text>
Example: > :Hello Operators!
Notify: yes
Comments: Contains a message that the iauth instance wants to send to
interested operators.
G - Set Debug Level
Syntax: G <level>
Example: G 1
Notify: yes
Comments: Sets a debug level for the server's end of the iauth
conversation. When enabled, debug messages should be sent to the
same channel (group, mask, etc) as other iauth notifications.
Debug level 0 suppresses iauth-related debug output, and positive
integers enable iauth debugging messages.
O - Set Policy Options
Syntax: O <options>
Example: O RTAWU
Notify: yes
Comments: Sets policy options for the iauth conversation. Old policy
options should be forgotten. Valid policy options are:
A - Send username and password information.
This causes the server to send the U and P messages.
R - Require clients to be approved before registering them.
When this policy is in effect, it affects the behavior
of a registration timeout; for details, see the documentation
for the T server message.
T - When the R policy is in effect and the iauth service does not
respond for a client, this causes the server to count the number
of clients refused, to send a warning message to interested
operators periodically, and to send the count of rejected users
to interested operators when the iauth instance responds again.
U - Send nickname, confirmed username and hurry information.
This causes the server to send the n, u and H messages.
W - Allow extra time for iauth to respond based on hostname.
When this policy is in effect and a DNS message (N or d) is
sent for a client, that client's registration timeout is
extended or reset.
w - Send WEBIRC requests whether or not they have been validated by
Nefarious.
F - Send SSL client certificate fingerprints where available.
r - Send account name when a client authenticates using SASL.
e - Send IRCd event notifications.
Compatibility: The U policy is an Undernet extension and is not
recognized by ircd. The w, F, r and e policies are a Nefarious extension
that is not recognized by Undernet ircu or ircd.
V - iauth Program Version
Syntax: V :<version string>
Example: V :Undernet-iauthu v1.0
Notify: yes
Comments: Indicates the iauth program version. This should only be
used in diagnostic messages, and must not change protocol behavior.
a - Start of new configuration
Syntax: a
Example: a
Notify: yes
Comments: Indicates that a new configuration is being loaded by the
iauth instance. Any cached configuration records should be cleared.
A - Configuration Information
Syntax: A <hosts?> <module> :<options>
Example: A * rfc931
Notify: yes
Comments: Indicates new configuration information.
s - Start of new statistics
Syntax: s
Example: s
Notify: yes
Comments: Indicates a new set of statistics will be sent. Any cached
statistics records should be cleared.
S - Statistics Information
Syntax: S <module> :<module information>
Example: S rfc931 connected 0 unix 0 other 0 bad 0 out of 0
Notify: yes
Comments: Indicates new or additional statistics information.
o - Forced Username
Syntax: o <id> <remoteip> <remoteport> <username>
Example: o 5 192.168.1.10 23367 bubba
States: REGISTER, HURRY
Next State: -
Comments: Indicates that the username should be used for the specified
client even if the normal sanity-checking would prohibit the
username.
U - Trusted Username
Syntax: U <id> <remoteip> <remoteport> <username>
Example: U 5 192.168.1.10 23367 buddha
States: REGISTER, HURRY
Next State: -
Comments: Indicates that the iauth instance believes <username> is
accurate for the specified client.
u - Untrusted Username
Syntax: u <id> <remoteip> <remoteport> <username>
Example: u 5 192.168.1.10 23367 enlightened_one
States: REGISTER, HURRY
Next State: -
Comments: Indicates that the iauth instance does not strongly trust
<username> to be accurate, but has no more trusted username.
N - Client Hostname
Syntax: N <id> <remoteip> <remoteport> <hostname>
Example: N 5 192.168.1.10 23367 buddha.example.org
States: REGISTER, HURRY
Next State: -
Comments: Indicates that the iauth instance believes the specified
client should use the hostname given.
Compatibility: This is an Undernet extension and ircd does not support
this message.
I - Client IP Address
Syntax: I <id> <currentip> <remoteport> <newip>
Example: I 5 192.168.1.10 23367 127.128.129.130
States: REGISTER, HURRY
Next State: -
Comments: Indicates that the iauth instance wants the server to
present and treat the client as using <newip>. This means that
future iauth messages relating to the client must use <newip>
as the <remoteip> parameter.
Compatibility: This is an Undernet extension and ircd does not support
this message.
M - Adjust User Mode
Syntax: M <id> <remoteip> <remoteport> +<mode changes>
Example: M 5 192.168.1.10 23367 +iwg
States: REGISTER, HURRY
Next State: -
Comments: Indicates a set of user mode changes to be applied to the
client.
Compatibility: This is an Undernet extension and ircd does not support
this message.
m - Mark a user
Syntax: m <id> <remoteip> <remoteport> <marktype> <markdata>
Example: m 5 192.168.1.10 23367 WEBIRC :Some WEBIRC
States: REGISTER, HURRY, NORMAL
Next State: -
Comments: Sets the specified markdata for the specified marktype on
the specified client. Currently available mark types are WEBIRC,
GEOIP, CVERSION, SSLCLIFP, KILL and MARK. GEOIP requires both a 2
letter country code and a 2 letter continent code both without
the : prefix and an optional country name prefixed by a :. MARK
is a simple single word tag that is added to a list so you can
add several MARK marks on a user.
Compatibility: This is a Nefarious extension, ircd and Undernet ircu do
not support this message.
C - Challenge User
Syntax: C <id> <remoteip> <remoteport> :<challenge string>
Example: C 5 192.168.1.10 23367 :In which year did Columbus sail the ocean blue?
States: REGISTER, HURRY
Next State: -
Comments: Indicates that the challenge string should be sent to the
specified user, for example via NOTICE * :*** <challenge string>.
The client responds by sending PASS :<response>, which should be
relayed via the P server message. This requires that the A policy
be in effect.
Compatibility: This is an Undernet extension and ircd does not support
this message.
k - Quietly Kill Client
Syntax: k <id> <remoteip> <remoteport> :<reason>
Example: k 5 192.168.1.10 23367 :Open proxy found.
States: REGISTER, HURRY, NORMAL
Next State: GONE
Comments: Indicates that the specified client should be disconnected
for the reason given without notifying operators.
Compatibility: ircu does not use the same notification mechanism as
ircd, so operators are notified using SNO_CONNEXIT anyway.
K - Kill Client
Syntax: K <id> <remoteip> <remoteport> :<reason>
Example: K 5 192.168.1.10 23367 :We don't like you.
States: REGISTER, HURRY, NORMAL
Next State: GONE
Comments: Indicates that the specified client should be disconnected
for the reason given. Operators should be notified.
d - "Soft" Done Checking
Syntax: d <id> <remoteip> <remoteport>
Example: d 5 192.168.1.10 23367
States: REGISTER, HURRY
Next State: -
Comments: Indicates that the iauth instance has no objection to letting
the specified client onto the network, but that some further work is
in process. In particular, an account stamp and/or connection class
might be available later.
Compatibility: This is an Undernet extension and ircd does not support
this message.
D - Done Checking
Syntax: D <id> <remoteip> <remoteport> [class]
Example: D 5 192.168.1.10 23367
States: REGISTER, HURRY
Next State: NORMAL
Comments: Indicates that the iauth instance believes the specified
client should be allowed onto the network. If a class parameter is
given, the client should be assigned to that class.
Compatibility: Specifying the class is an Undernet extension and ircd
does not support that parameter.
R - Registered User
Syntax: R <id> <remoteip> <remoteport> <account> [class]
Example: R 5 192.168.1.10 23367 Buddha
States: REGISTER, HURRY
Next State: NORMAL
Comments: Indicates that the iauth instance believes the specified
client should be allowed onto the network, pre-authenticated to
the account listed. If a class parameter is given, the client
should be assigned to that class.
Compatibility: This is an Undernet extension and ircd does not support
this message.
X - Extension Query
Syntax: X <servername> <routing> :<query>
Example: X channels.undernet.org 5/127.0.0.1/6667 :login kev pass
Comments: Used by the iauth instance to send an extension query to
the server specified by <servername>. The <routing> parameter is
not interpreted by the servers; it will be returned unchanged in
the extension query reply message (the X server message) and may be
used to pair the query with its reply. The <query> parameter is
sent to <servername>.
Compatibility: This is an Undernet extension and ircd does not support
this message.

9
doc/readme.indent Normal file
View File

@ -0,0 +1,9 @@
If you want to indent this source file, in order to convert
the source tree to the used programming style, you should use
`make indent' in the base directory.
For this to work you need to have `indent' version 2.1.0 or higher
in your PATH. GNU indent 2.1.0 is available from all GNU sites,
its main ftp site is ftp://ftp.gnu.org/indent/. Or you can download
it directly from the webpage of its maintainer at
http://www.xs4all.nl/~carlo17/indent/

57
doc/readme.jupe Normal file
View File

@ -0,0 +1,57 @@
JUPE documentation, last updated on 18 Mar 2000
For an ordinary user, the syntax is:
JUPE [<server>]
If <server> is given, and if a jupe for that server exists, all the
information about that jupe is displayed. If <server> is not given,
all un-expired jupes are displayed.
For an operator, the syntax is:
JUPE [[+|-]<server> [[<target>] <expiration> :<reason>]]
If <server> is not given, or if it is not prefixed by "+" or "-", the
operation is exactly the same as if it were issued by an ordinary
user. If the "+" or "-" prefixes are used, the arguments <target>,
<expiration>, and <reason> must be given, even if the jupe already
exists. If <target> is "*" and the currently existing jupe is a local
jupe, the local jupe will be erased and recreated with the parameters
given, as described below. Otherwise, if the jupe currently exists, a
prefix of "+" will cause an inactive jupe to be activated, whereas a
prefix of "-" will cause an active jupe to be deactivated.
If the jupe does not already exist, it is created. The <target>
parameter is used to select whether the jupe is only to apply to a
single server (which need not be the local server) or to the whole
network; if <target> is not given, it is assumed to be the local
server. This could be useful if a single particular link is having
problems, for instance. The <expiration> parameter is a number of
seconds, not to exceed 7 days, for the jupe to exist. The <reason>
argument is mandatory and should describe why this particular jupe was
placed.
For a server, the syntax is:
<prefix> JU <target> (+|-)<server> <expiration> <lastmod> :<reason>
The <target> may be a server numeric or the character "*", for a
globally scoped jupe. The <server> argument is a server name, and
must be prefixed by one of "+" (to indicate an active jupe) or "-" (to
indicate an inactive jupe). The parameter <expiration> is a total
number of seconds the jupe is to live for, and <lastmod> is used for
versioning. Since JUPEs are propagated during netbursts, there must
be some way of resolving conflicting states, which is the reason for
this argument, and is also the reason jupes cannot be deleted, only
deactivated. The <reason> parameter indicates the reason the jupe was
placed.
If a JUPE is received with a <target> of "*", any jupes with local
scope are deleted, in preference for the globally scoped version. If
the jupe already exists, the values of <lastmod> are compared; if the
received <lastmod> is less than the stored <lastmod>, the existing
jupe is resent to the server from which the JUPE message was received;
otherwise, the jupe is activated or deactivated, depending on the
<server> prefix. If the jupe does not currently exist, it is created
with the parameters given.

194
doc/readme.log Normal file
View File

@ -0,0 +1,194 @@
Older versions of ircd had no consistent way of logging various
actions. Some things, such as G-lines, were written out to log files
with names compiled into the server. Others could only be logged
through syslog. Some required that their log files exist beforehand.
Starting with u2.10.11, this situation has changed dramatically.
All logging in the server is now unified through a single logging
subsystem. Unfortunately, the server still does not generate all the
logs that it could, and some more tuning is in store for the next
major release of ircd. Nevertheless, the logs that are generated are
far more consistent, and those log messages may be sent to a given
file, to syslog, or even to online operators--or any combination of
these three methods. This file is intended to describe configuration
of the logging subsystem.
All logs are classified by a "subsystem" and a "level." The subsystem
is a major classification; each subsystem may be configured
individually. The level classification is used to indicate how
important the message is; subsystems may be configured to omit log
messages with less than a certain importance--not unlike syslog.
Levels
Levels are used to classify the importance of various log messages.
The most important level is the "CRIT" level; the least important is
the "DEBUG" level. Each of the levels is also mapped to a
corresponding syslog level, and some may even force generation of
certain types of server notices. Each importance level is described
below.
* CRIT - Used for very critical notifications, such as server
termination. This is mapped to the corresponding "CRIT" syslog
priority. This will also generate server notices to the "OLDSNO"
server notice mask.
* ERROR - Used to report important error conditions. This is mapped
to the corresponding "ERR" syslog priority.
* WARNING - Used to warn about certain conditions. This is mapped to
the corresponding "WARNING" syslog priority.
* NOTICE - Used for reporting important information. This is mapped
to the corresponding "NOTICE" syslog priority.
* TRACE - Used to tracing operation of the server. This is mapped to
the corresponding "INFO" syslog priority.
* INFO - Used for reporting unimportant but potentially useful
information. This is mapped to the corresponding "INFO" syslog
priority.
* DEBUG - Used for reporting debugging information. This is mapped
to the corresponding "DEBUG" syslog priority. This will also
generate server notices to the "DEBUG" server notice mask.
Subsystems
All of the subsystems are described below, along with their default
logging configuration. There are no default log files to log to, and
the default logging level is INFO (unless the server is compiled with
debugging enabled)--this means that only notices of importance INFO or
higher will be logged.
* SYSTEM - Used to report information that affects the server as a
whole. By default, log messages to this subsystem go nowhere.
* CONFIG - Used to report information concerning the configuration
file. By default, log messages to this subsystem go to the default
syslog facility, which defaults to "USER," and to the "OLDSNO"
server notice mask.
* OPERMODE - Used to report usage of /OPMODE and /CLEARMODE. By
default, log messages to this subsystem go to the "HACK4" server
notice mask.
* GLINE - Used to report usage of /GLINE, particularly BADCHANs. By
default, log messages to this subsystem go to the "GLINE" server
notice mask.
* JUPE - Used to report usage of /JUPE. By default, log messages to
this subsystem go to the "NETWORK" server notice mask.
* WHO - Used to report usage of the extended features of /WHO
(/WHOX). By default, log messages to this subsystem go nowhere.
* NETWORK - Used to report net junctions and net breaks. By default,
log messages to this subsystem go to the "NETWORK" server notice
mask.
* OPERKILL - Used to report usage of /KILL by IRC operators. By
default, log messages to this subsystem go nowhere.
* SERVKILL - Used to report usage of /KILL by other servers. By
default, log messages to this subsystem go nowhere.
* USER - Used to report user sign-ons and sign-offs. By default, log
messages to this subsystem go nowhere.
* OPER - Used to report usage of /OPER, either successfully or
unsuccessfully. By default, log messages to this subsystem go to
the "OLDREALOP" server notice mask.
* RESOLVER - Used to report error messages or other conditions from
the resolver and authentication system. By default, log messages
to this subsystem go nowhere.
* SOCKET - Used to report problems with sockets. By default, log
messages to this subsystem go nowhere.
* IAUTH - Used to report connects, disconnects and errors for the
IAuth authorization mechanism. By default, log messages to this
subsystem go to the "NETWORK" server notice mask.
* DEBUG - Used only when debugging is enabled. All log messages to
this subsystem go either to the console or to the debug log file
compiled into the server, as well as to the "DEBUG" server notice
mask. This is the only subsystem with a default log file.
Configuration
The true power of the logging subsystem comes from its extremely
flexible configuration. The default server facility can be
configured, as can the facility for each individual subsystem
described above. Moreover, administrators can configure the server to
log to specific files, send selected log messages to operators
subscribed to any server notice mask, and even change the default log
level for each subsystem.
The logging subsystem has a set of tables mapping names to the
numerical values used internally. Subsystems, levels, syslog
facilities, and server notice masks are all configured using strings.
These tables even include special strings, such as "DEFAULT" and
"NONE." Each possible configuration piece is described below.
Default Syslog Facility
The IRC server has a default facility that it uses when sending log
messages to syslog. The default facility may be overridden for each
individual subsystem, but the default itself can be changed with an
appropriate Feature entry in the configuration file. The facility
normally defaults to "USER," but may be configured to be any of AUTH,
CRON, DAEMON, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6,
LOCAL7, LPR, MAIL, NEWS, USER, or UUCP. Some systems also have the
AUTHPRIV facility. To configure this default, add a Feature line to
the configuration file that looks like "LOG" = "<facility>";
<facility> should be replaced with the string for the desired default
syslog facility.
Log Files
Each subsystem may be configured to send its log messages to any
single log file with a Feature entry like "LOG" = "<subsys>" "FILE"
"<file>"; <subsys> should be replaced with one of the subsystem names
described above, and <file> should be a file name for the log file.
The file name may be relative to the server's data directory
("DPATH"), or it may be an absolute path name. Note that if you're
using chroot, these absolute path names will be relative to the
server's root directory.
Logging to Syslog
By default, except for the CONFIG subsystem, no logs are sent to
syslog. This can be overridden using an Feature entry like "LOG" =
"<subsys>" "FACILITY" "<facility>"; <subsys>, as above, should be
replaced with one of the subsystem names described above, and
<facility> must be one of the facility strings mentioned under
"Default Syslog Facility." The facility string may also be "NONE," to
turn off syslog for that subsystem, and "DEFAULT," to use the server's
default facility. Please don't confuse a DEFAULT facility with the
default for a particular subsystem; only the CONFIG subsystem defaults
to DEFAULT, whereas all the rest default to NONE.
Logging via Server Notices
Log messages can be sent to online IRC operators. Many subsystems
actually default to this behavior, in fact. For security, log
messages containing IP addresses or other extremely sensitive data
will never be sent via server notices, but all others can be sent to a
specific server notice mask. (For more information about server
notice masks, please see doc/snomask.html.) The available mask names
are OLDSNO, SERVKILL, OPERKILL, HACK2, HACK3, UNAUTH, TCPCOMMON,
TOOMANY, HACK4, GLINE, NETWORK, IPMISMATCH, THROTTLE, OLDREALOP,
CONNEXIT, and DEBUG. The special mask name "NONE" inhibits sending of
server notices for a particular subsystem. The Feature entry for this
configuration looks like "LOG" = "<subsys>" "SNOMASK" "<mask>"; again,
<subsys> is one of the subsystems described above, and <mask> is one
of the mask names.
Setting Minimum Logging Level
The minimum log level for a particular subsystem may be set with an
Feature entry like "LOG" = "<subsys>" "LEVEL" "<level>"; here,
<subsys> is yet again one of the subsystems described above, and
<level> is one of the level names, also described above.

View File

@ -0,0 +1,90 @@
Login-on-Connect Documentation
Last updated 29 Jun 2014 by Andromeda
1. LOC is a feature intended to allow a client to log into services before
they are fully connected to the network. For networks that do not set +x
by default, this is a nice little security bonus as you are cloaked before
you even finish connecting. Malicious users, /ISON, /USERIP, and low latency
can reveal it's real host/IP before the user has a chance to connect and set
+x on themself.
2. Client<->Server:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The PASS command works as follows...
Syntax:
PASS [optional I:Line password] [/Service Nick]/Account/Password
Example:
PASS /Andromeda/ThisIsMyPassword
mIRC Syntax:
/server irc.afternet.org:6667 /AuthServ/Andromeda/ThisIsMyPassword
The way LOC works, it sends the account name and password to the default
service specified in the configuration file or if specified, the service
nick included within the syntax.
If the client sends such a password message, after sending NICK,
USER and PONG, it's username/passphrase are sent to the specified bot
for validation, while holding the client in the 'registration' state.
If the authentication succeeds, the client's account and umode +x are set,
after which he is introduced to the network, continuing the regular connect
phase. If authentication fails (or the bot is not on the network), the user
is given a chance to retry (they can do this by sending another PASS command),
or to disconnect from the server. If the user wishes to connect without a
hidden hostmask, he can send a PASS command with no parameters.
3. iAuthd<->LOC:
~~~~~~~~~~~~~~~~~~~~~~~
When a network is using iAuthd with Nefarious 2 for scanning incoming connections
for potential malicious users and other threats, Using LOC can bypass the iAuthd
scan process entirely. This is useful if a user's host is listed in any DNSBL in
use within the network.
4. Server<->Server:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ACCOUNT message now has the following syntax:
Auth check:
<client's server numeric> AC <bot's numeric> C <request-id> <username> :<passphrase>
Host check:
<client's server numeric> AC <bot's numeric> H <request-id> <ident>@<host>:<ip> <username> :<passphrase>
If the host contains :'s it should be surrounded by []. Useful for determining
IPv6 vs IPv4 or unresolved rDNS's. Generally keeping things nice and tidy or
easier to work with.
Fingerprint check:
<client's server numeric> AC <bot's numeric> S <request-id> <ident>@<host>:<ip> <sslfingerprint> <username> :<passphrase>
Servers send this message to request a service bot to authenticate the client.
<request-id> is not processed neither by the servers along the way nor the
service bot. Currently this is:
'.' <fd> '.' <cookie>
The inital '.' makes sure that the ID is not a valid integer, which is part of
the hack required to support old-style ACCOUNT messages. The cookie is used to
validate replies, since the user might disconnect and the fd be reused before
the reply comes back from the service. Hubs propagate this message as-is
towards the service bot, not unlike PRIVMSG.
Auth reply:
<bot's server numeric> AC <client's server numeric> A|D <request-id>
Service bots send this in reply to an 'auth check' message from a server.
"A" stands for "accepted", "D" for "denied". Again, hubs will have
to proagate this message back to the client's server.
Remote auth:
<bot's server numeric> AC <client numeric> R <account> [<timestamp>]
This is the current message used by service bots to announce the network
that a user has logged in. The old format is still supported:
<bot's server numeric> AC <client numeric> <account> [<timestamp>]
5. IRCu Configuration:
~~~~~~~~~~~~~~~~~~~~~~~~~
FEAT_LOGIN_ON_CONNECT (default FALSE) will specify whether
ircu will honour the login scheme as specified above for the PASS command.
ircu will route ACCOUNT messages anyway, regardless of this feature's value.

124
doc/readme.shun Normal file
View File

@ -0,0 +1,124 @@
SHUN documentation, last updated on 22 Jun 2013
For an ordinary user, the syntax is:
SHUN [<mask>]
If <mask> is given, and if a Shun for that server exists, all the
information about that Shun is displayed. If <mask> is not given,
an error is returned.
For an operator, the syntax is:
SHUN [[!][+|-|>|<]<mask> [<target>] [<expiration> [:<reason>]]]
There are a total of 10 basic forms of the SHUN command. If no
arguments are given, all existing Shuns will be listed; if only
<mask> is given, the behavior is the same as for an ordinary user.
The remaining forms allow Shuns to be set, manipulated, or possibly
destroyed.
* Local Shuns.
Opers may set or remove Shuns that only apply to a specific server.
When the <target> parameter is not given, the specific server will be
the local server; otherwise, it will be taken to be a remote server,
and the Shun operations will take place there, if the oper has the
SHUN privilege. When <mask> is preceded with the '+' character, the
Shun will be added, and <expiration> and <reason> are required; when
<mask> is preceded with the '-' character, the Shun will be removed,
and <expiration> and <reason> are not required. The '<' and '>'
character prefixes are not valid for local Shuns.
* Local modifications to global Shuns.
Opers may locally activate or deactivate global Shuns. In this
mode, <mask> is interpreted as referencing an existing Shun, and
will be preceded by either '<' (to locally deactivate the Shun) or
'>' (to locally activate the Shun). This local state overrides the
global state of the Shun, and persists until there is a global state
change to the Shun, or until the Shun expires. The <expiration>
and <reason> arguments are not required, but <target> may be given if
the oper desires to make the appropriate change on a remote
server--note that the oper will need the SHUN privilege for this.
* Global Shuns.
Opers may, if they have the SHUN privilege, set and manipulate global
Shuns on the network. To create a new Shun, the oper must prefix
the <mask> with either '+' (for globally activated Shuns) or '-'
(for globally deactivated Shuns). Additionally, <target> must be
given as "*", and the <expiration> and <reason> parameters are
required. If the Shun already exists, it will be modified to match
the new global status, <expiration>, and <reason>.
When the Shun already exists, an oper may activate or deactivate it
simply by setting <target> to "*" and prefixing the <mask> with either
"+" (to activate the Shun) or "-" (to deactivate it). If it is
desired to simply modify the expiration time or reason, without
changing the activation status, specify <mask> without any prefix, set
<target> to "*", and provide the updated <expire> and optionally an
updated <reason>.
* Privilege notes.
Note that, for all locally-restricted Shun changes, such as locally
activating a Shun or creating a local Shun, the oper must have the
LOCAL_SHUN privilege. For any other Shun change, including
locally-restricted changes on remote servers, the server's
CONFIG_OPERCMDS privilege must be enabled and the oper must have the
SHUN privilege. There are also restrictions to prevent an oper from
setting a Shun that is too wide; in some cases, those restrictions
may be overridden by prefixing the <mask> parameter with the "!"
character, IF the operator has the WIDE_SHUN privilege.
For a server, the syntax is:
<prefix> SU <target> [!][+|-|>|<]<mask> [<expiration>] [<lastmod>]
[<lifetime>] [:<reason>]
There are a total of 8 basic forms of the SU command. The primary
innovation is the addition of the <lifetime> parameter, which
specifies a lifetime for the Shun record which may be longer than
the expiration time. <lifetime> will be monotonically increasing,
enabling <expiration> to be modified in any way desirable.
* Local Shuns.
Remote servers, or opers on them, may remotely set local Shuns on
the local server. To create a local Shun, <target> will be set to
the numeric of the local server, and <mask> must be preceded by '+'
(optionally preceded by '!' if the origin desires to override some
safety settings). The <expiration> and <reason> parameters are
required. The <lastmod> and <lifetime> parameters will be ignored if
present, allowing backwards compatibility with ircu2.10.12.10 and
prior versions. Removing local Shuns is similar--<mask> must be
preceded by '-', and all other parameters are ignored to allow
backwards compatibility.
* Local modifications to global Shuns.
Remote servers, or opers on them, may also locally activate or
deactivate a global Shun on the local server. The <target> must be
set to the numeric of the local server, and <mask> must be preceded by
either '<' (to locally deactivate the Shun) or '>' (to locally
activate the Shun). This local state overrides the global state of
the Shun, and persists until there is a global state change to the
Shun, or until the Shun expires. No other parameters are
necessary in this mode, and will be ignored if present.
* Global Shuns.
For creation and manipulation of global Shuns, the <target>
parameter must be set to "*". If the Shun does not exist, and if
<expiration> is given, the Shun will be created with the specified
expiration and <reason> (the latter defaulting to "No reason" if not
present). Otherwise, the Shun will be updated according to the
available parameters. The rules are similar to those for oper-issued
global Shuns, with the addition of a <lastmod> parameter, which is a
monotonically increasing serial number for the Shun, and an optional
<lifetime> parameter that specifies a monotonically increasing
lifetime for the Shun record. Note that, for existing Shuns where
only state changes (global activation or deactivation) are necessary,
only <lastmod> is required; <expiration> must be specified for all
other forms of the SU command.

290
doc/readme.who Normal file
View File

@ -0,0 +1,290 @@
WHO documentation, updated on 02 Jan 1999.
Since ircu2.10.02 the WHO command had been changed from what described in
RFC1459, while still keeping backward compatibility, actually it has been
changed again in u2.10.05 so that since this release the format of the who
query is now:
[:source] WHO <mask1> [<options> [<mask2>]]
<mask2> is optional, if mask2 is present it's used for matching and mask1 is
ignored, otherwise mask1 is used for matching, since mask2 is the last
parameter it *can* contain a space and this can help when trying to match a
"realname".
When matching IP numbers the <mask> can be in 3 forms:
- The old and well known IRC masks using * and ? as wanted
- The IPmask form a.b.c.d/e.f.g.h as used in most firewalls and
system configurations, where what is before the / are the bits we expect
in the IP number and what is after the / is the "filter mask" telling wich
bits whould be considered and wich should be ignored.
- The IPmask form a.b.c.d/bitcount where bitcount is an integer between 0
and 31 (inclusive), the matching will be for the IPs whose first
"bitcount" bits are equal to those in a.b.c.d
Note that:
. The bitcount must be between 0 and 31, 32 is NOT good (and
makes no sense to use it... just match against the static IP a.b.c.d)
. The missing pieces of both the bitmask and the ipnumber in the forms
ipnumber/bitmask and ipnumber/bitcount default to zero from right to left,
this is NOT what inet_aton and most tools do but makes more sense here
IMO, in example /who 194.243/16 is taken as /who 194.243.0.0/255.255.0.0
(inet_aton whould take 194.243 as 194.0.0.243).
. For the above reason and specified validity limits 1.2.3.4/31 becomes
1.2.3.4/255.255.255.254 while 1.2.3.4/32 becomes 1.2.3.4/32.0.0.0 :)
For all the other fields th match happens as has always been, i.e. it's only
considered the IRC mask with * and ? (that is: don't expect to catch an user
with "realname" = "1.2.3.4" when doing "/who 1.2/16 h" :)
For both the masks and the options (and thus for all flags) case is NOT
significative (so "/who <any> o" is exactly the same as "/who <ANY> O".
The "options" part can be as follows:
[<flags>][%[<fields>[,<querytype>]]]
in which:
<flags>: can be a sequence of field matching flags, use mode matching flags
and special purpose flags
Field matching flags, when one of these is specified the field in
question is matched against the mask, otherwise it's not matched.
n Nick (in nick!user@host)
u Username (in nick!user@host)
h Hostname (in nick!user@host)
i Numeric IP (the unresolved host)
s Servername (the canonic name of the server the guy is on)
r Info text (formerly "Realname")
a Account name
m Marks (Nefarious only option)
If no field-matching flags are specified they default to what old servers
used to do: nuhsr (= everything except the numeric IP)
User mode matching flags (specifying one of these means that only clients
with that umode are considered, what is not specified is always matched):
d Join-delayed channel members
o Irc operator
[In the future more flags will be supported, basically all
usermodes plus the +/- specificators to revert the filtering]
Special purpose flags:
x If this is specified the extended visibility of information for opers
is applied, what this means depends on the fact that you are local or
global operator and on how the admin configured the server (global
and eventually local irc opers might be allowed with this flag to see
+i local users, to see all +i users, to see users into +p and/or +s
channels, and so on). Using the 'x' flag while not being an irc
operator is meaningless (it will be ignored), using it while oper'd
means that the query is almost certainly logged and the admin might
(rightfully) ask you an explanation on why you did.
The rest, what follows the %, that is [%[fields[,<querytype>]]], is as it
has always been since the first who.patch, the <fields> part specifies
wich fields to include in the output as:
c : Include (first) channel name
d : Include "distance" in hops (hopcount)
f : Include flags (all of them)
h : Include hostname
i : Include IP
l : Include idle time (0 for remote users) [2.10.11+]
n : Include nick
r : Include real name
s : Include server name
t : Include the querytype in the reply
u : Include userID with eventual ~
a : Include account name
o : Include oplevel (shows 999 to users without ops in the channel)
m : Include marks seperated by , up to a limit of 128 characters
And the ,<querytype> final option can be used to specify what you want the
server to say in the querytype field of the output, useful to filter the
output in scripts that do a kind of "on 354 ..."
If no %fields are specified the reply is _exactly_ the same as has always
been, numeric 352, same fields, same order.
If one or more %fields are specified the reply uses a new numeric, since an
out-of-standard 352 crashes EPIC and confuses several other clients. I used
354.
:"source" 354 "target" ["querytype"] ["channel"] ["user"]
["IP"] ["host"] ["server"] ["nick"]
["flags"] ["hops"] ["idle"] ["account"]
["oplevel"] ["marks"] [:"realname"]
Where only the fields specified in the %fields options are present.
"querytype" is the same value passed in the /who command, it is provided to
simplify scripting, in example one could pass a certain value in the query
and have that value "signal" back what is to be done with those replies.
The number of lines in the reply is still limited to avoid self-flooding and
sooner or later another limitation will be added: you will be forced to do
no more than one /who query every 'n' seconds where 'n' depends on the
number of fields you actually match (the field-match flags specified before
% in the option, defaulting to 6 if you don't specify an option at all),
infact matching against many fields as the default query does severely
affects the CPU usage of the server and is *much* better to specify with the
field-matching flags what you are looking for, in example when you are
looking for all french users a "/who *.fr h" is A LOT better than just "/who
*.fr" (and actually you want users that have the
_hostname_ matching *.fr, you wouldn't want to match a japanese user
that has the realname "ku fung-kay aj.fr" in example...)
Note that:
- An user doing a "/who whatever" or a "/who whatever o"
will not see any change (except for the anti-flood limit and sooner or
later the CPU usage limit)
- An user doing a "/who #wasteland %n" will get just a list of nicks (lame,
very lame way of doing it :-)
- An user doing a "/who 0 o%nuhs" will get a list of the opers with Nick,
userID, server and hostname like:
:Amst* 354 Nemesi #wasteland nbakker pc73.a.sn.no Oslo*.org Niels
- An user doing a "/who 0 o%tnuhs,166" will get a list of the opers
with Nick, userID, server and hostname like the above but with a
request type field of 166 like:
:Amst* 354 Nemesi 166 #wasteland nbakker pc73.a.sn.no
Oslo-R.NO.EU.Undernet.org Niels
So that he can have in example a script that does
on ^354 "% 166" display "There is an oper ..."
- The client will have to sort/format the fields by itself,
the _order_ in which flags are passed is not significant, the fields in the
reply will always have the same order.
- The maximum number of _lines_ reported as reply for a query
is 2048/(n+4) where 'n' is the number of flags "enabled" that is the
number of fields included in each reply.
Actually: 1 field returned = maximum 409 replies
2 fields returned = maximum 341 replies
3 fields returned = maximum 292 replies
4 fields returned = maximum 256 replies
5 fields returned = maximum 227 replies
6 fields returned = maximum 204 replies
7 fields returned = maximum 186 replies (default query)
8 fields returned = maximum 170 replies
9 fields returned = maximum 157 replies
10 fields returned = maximum 146 replies
If the limit is reached before completing the query the reply is truncated
and a new numeric error is issued after the "End of WHO", anyway the "end
of" numeric is _always_ sent (otherwise some scripts and clients go
crazy).
The actual "mask" to match can have one of the two following forms:
- A comma-separated list of elements: in this case each element
is treated as a flat channel or nick name and is not matched to the other
elements. Nicks do count in the limit of output lines (they should not be
that many anyway), channels count if who asks the query is not on the
channel. (That is: a /who #channel gives unlimited output if you are in
there).
- A _single_ mask: in this case (no commas, only one element) the mask is
first checked to be a full channel or nickname, then it is matched against
all relevant fiels as already known. These happens in different steps
with replicates-removal so that if one has (?) something like "#wasteland"
as "real name" or is on a channel named "#***MyChan***" it all works
nicely.
Miscellaneous bug fixes / "undocumented feature" changes:
- /who NickName did not show the user with nick = NickName when it was
invisible, even if the nick was given completely (without wildchars) now
it does, since one could always see him as /whois NickName. It does not
report him twice if he also has in example the userID == NickName and is
-i.
- ":source WHO :The Black Hacker" did not report an user having "The Black
Hacker" as real name, now it does. Since this can only be done without the
flags/format specificator because that would become the "last parameter"
an escape has been provided: if you pass to m_who _3_ parameters the first
one will be ignored and the last one used for matching, like in example
":source WHO foo %nuh :*Black Hacker*" where "foo" will not be used and
the match will happen on "*Black Hacker*". (It was passed through
clean_channelname() that prevented the mask from containing spaces and
such...)
- When one user was umode -i he was shown or not depending on the
fact he was on a +p or +s channel... since we are doing a lookup on the
_user_ this makes no sense to me, example:
Neme1 : umode -i, on no channels, was SEEN with a /who 0
Neme2 : umode -i, on channel #p with chmode +p, was NOT SEEN by /who 0
Neme3 : umode -i, on channel #s with chmode +s, was NOT SEEN by /who 0
Now all users "-i" are matched with a "/who mask", the +i users instead
must be on a _common_ channel to be seen.
Basically being on "one" +s|p channel "forced" a +i status while one might
want to be on #secret (mode +s) and have nobody know that he is in there
but on the other side stay -i so others can find him. Of course a +s|p
channel is never shown in the reply unless who asks the query is in there,
if no "visible" channels are available for a -i user he is shown on
"channel *".
- When one user is +i is shown _only_ if there is a common channel,
the first common channel found is shown in the reply.
- As requested by many persons an escape has been provided for opers,
when #defined SHOW_ALL_CHANNELS opers can /who #channel from outside
and see users in there even if the channel is +s|+p
Each admin decides locally if this feature is enabled to his opers.
- As requested by many admins an escape from the query-size limit
has been provided for opers, by #defining UNLIMIT_OPER_QUERY opers
can do unlimited sized /who-s (until they get disconnected by max
SendQ exceeded ;)
Again admins will decide if enable or not this feature.
- A /who a,c,b,d,e,f used to return as many ** END OF WHO as there
were elements in the list, since now the command is supposed to be
_efficient_ for /who nick1,nick2,nick3 .. I return a _single_ end
of query message.
- /who did not work for a channel named in example #**StarWars**
now it does handle it properly (the mask was passed through
collapse() and then.. did not find that channel, fixed).
- "/who #John" did not report an user having '#John' as "Real name",
now it does (and does NOT report him twice if he is ALSO on a
channel named #John, strange but true: this can happen).
- "/who a,b,c,d" where a b c and d are channelnames/nicks now uses an hash
lookup and therefore is extremely efficient, if _only_ one field is
specified it is looked in all the fields; who really wants _only_ users on
a specific channel or a single nick (without looking for a match in the
other fields) can force the server to consider the parameter as a list
adding a comma somewhere, like:
"/who #Italia," or "/who ,Nemesi"
Or even better to avoid misbehaviour with other servers:
"/who #Italia %... #Italia," or "/who Nemesi %... Nemesi,"
This will make old servers act properly and new ones and should be the
recomended way for GUI based clients to get a channel's userlist and all
the infos they want about users on the channel.
- If you use the new numeric, flags will contain all the information about
a user on a channel. @ for op'd, + for voiced, and ! for zombie. eg:
Isomer #coder-com H@+, where the old behavor of just displaying one of
them has been preserved for the old numeric. [2.10.11+]
Regards, Andrea aka Nemesi

23
doc/readme.www Normal file
View File

@ -0,0 +1,23 @@
More, and up to date, information can be retrieved from the following
world wide web pages:
* Undernet Documents Project:
http://www.user-com.undernet.org/documents/
* Release Notes & Patch Repository:
http://coder-com.undernet.org/
* ircII scripts to support the undernet extentions:
http://coder-com.undernet.org/ircii/
* Undernet Use Policy:
http://www.user-com.undernet.org/documents/aup.html
* Operator Etiquette:
http://www.user-com.undernet.org/documents/operman.html
* New server links & Routing info:
http://routing-com.undernet.org/
* Information about large number of file descriptors per process:
linux: http://www.linux.org.za/oskar/patches/kernel/filehandle/

96
doc/readme.xquery Normal file
View File

@ -0,0 +1,96 @@
OVERVIEW
========
The extension query mechanism provides a means by which servers may
send queries to other servers and receive replies. Obviously,
ordinary ircu servers have no need of this mechanism, but it allows
pseudo-server services to communicate with each other. Additionally,
extensions have been made to the iauth protocol (see readme.iauth) to
allow iauth instances to send and receive extension queries. This
could be used, for instance, to submit client information for
immediate proxy scanning by a centralized service, or to query a
centralized database for log-in parameters.
DETAILED DESCRIPTION
====================
The extension query mechanism consists of a pair of commands, the
XQUERY command (token XQ) and the XREPLY command (token XR). Servers
and IRC operators may send an XQUERY, naming a target service, an
opaque "routing" token, and the query; the target service is expected
to reply with an XREPLY, which will include the routing token from the
query and the service's reply to the query.
The query syntax is:
<prefix> XQ <target> <routing> :<query>
where <target> is the target service's numeric nick, <routing> is the
opaque "routing" token, and <query> is the query for the service to
act upon. IRC operators may also issue queries, using the XQUERY
command with the same parameters, with <target> permitted to be a
server name mask; this is largely intended for debugging purposes.
Ordinary users cannot issue XQUERY commands, in order to encourage use
of the regular PRIVMSG and NOTICE commands.
The reply syntax is:
<prefix> XR <target> <routing> :<reply>
where <target> is the origin of the original query, <routing> is the
opaque "routing" token from the query, and <reply> is the service's
reply to the query. This command can only be issued by servers.
USE WITH IAUTH
==============
Three message extensions have been made to the iauth protocol. An
iauth instance can issue an XQUERY through the use of the "X" client
message with the following syntax:
X <servername> <routing> :<query>
If <servername> is not presently linked to the network, ircu will
respond with an "x" server message, having the following syntax:
<id> x <servername> <routing> :Server not online
If, on the other hand, <servername> names a valid, on-line server,
ircu will prepend "iauth:" to the "routing" token and forward the
query to that server. If an XREPLY is received from the service, ircu
will strip off the "iauth:" prefix on the "routing" token and send the
reply to the iauth instance with the "X" server message:
<id> X <servername> <routing> :<reply>
Having the "iauth:" prefix on the "routing" token enables future ircu
extensions which wish to use the extension query mechanism to be
differentiated from extension queries originated from iauth.
RATIONALE
=========
The extension query mechanism was originated as part of an effort to
establish a reliable login-on-connect system for Undernet. Previous
attempts at such a system required out-of-band parallel connections,
and could possibly result in a compromise of hidden IPs (such as the
IP of X's database server). Further, without extensive extensions to
GNUWorld, certain login restrictions--such as the maximum logged-in
client count--could not be reliably enforced. By providing an in-band
signalling mechanism that iauth can make direct use of, these problems
are eliminated; the only remaining problem is what to do if iauth is
unable to communicate with the login service, which can be solved
through policy decisions and timeouts implemented within the iauth
instance.
The rationale for the opaque "routing" token is to provide pairing
between replies and queries. The lack of such pairing is one of the
shortcomings of the IRC protocol, as specified in RFC 1459; only one
Undernet extension has attempted to provide such a pairing--a
little-used extension to the /WHO command. In an iauth context, such
pairing is critical; otherwise, iauth could potentially apply a reply
to the wrong client. Although the pairing could be part of the query,
it makes sense to make it part of the base protocol message, making it
explicit. This also allows ircu to add routing data to the token,
making it possible for more extensions than just iauth to make use of
extension queries.

124
doc/readme.zline Normal file
View File

@ -0,0 +1,124 @@
ZLINE documentation, last updated on 22 Jun 2013
For an ordinary user, the syntax is:
ZLINE [<mask>]
If <mask> is given, and if a Z-line for that server exists, all the
information about that Z-line is displayed. If <mask> is not given,
an error is returned.
For an operator, the syntax is:
ZLINE [[!][+|-|>|<]<mask> [<target>] [<expiration> [:<reason>]]]
There are a total of 10 basic forms of the ZLINE command. If no
arguments are given, all existing Z-lines will be listed; if only
<mask> is given, the behavior is the same as for an ordinary user.
The remaining forms allow Z-lines to be set, manipulated, or possibly
destroyed.
* Local Z-lines.
Opers may set or remove Z-lines that only apply to a specific server.
When the <target> parameter is not given, the specific server will be
the local server; otherwise, it will be taken to be a remote server,
and the Z-line operations will take place there, if the oper has the
ZLINE privilege. When <mask> is preceded with the '+' character, the
Z-line will be added, and <expiration> and <reason> are required; when
<mask> is preceded with the '-' character, the Z-line will be removed,
and <expiration> and <reason> are not required. The '<' and '>'
character prefixes are not valid for local Z-lines.
* Local modifications to global Z-lines.
Opers may locally activate or deactivate global Z-lines. In this
mode, <mask> is interpreted as referencing an existing Z-line, and
will be preceded by either '<' (to locally deactivate the Z-line) or
'>' (to locally activate the Z-line). This local state overrides the
global state of the Z-line, and persists until there is a global state
change to the Z-line, or until the Z-line expires. The <expiration>
and <reason> arguments are not required, but <target> may be given if
the oper desires to make the appropriate change on a remote
server--note that the oper will need the ZLINE privilege for this.
* Global Z-lines.
Opers may, if they have the ZLINE privilege, set and manipulate global
Z-lines on the network. To create a new Z-line, the oper must prefix
the <mask> with either '+' (for globally activated Z-lines) or '-'
(for globally deactivated Z-lines). Additionally, <target> must be
given as "*", and the <expiration> and <reason> parameters are
required. If the Z-line already exists, it will be modified to match
the new global status, <expiration>, and <reason>.
When the Z-line already exists, an oper may activate or deactivate it
simply by setting <target> to "*" and prefixing the <mask> with either
"+" (to activate the Z-line) or "-" (to deactivate it). If it is
desired to simply modify the expiration time or reason, without
changing the activation status, specify <mask> without any prefix, set
<target> to "*", and provide the updated <expire> and optionally an
updated <reason>.
* Privilege notes.
Note that, for all locally-restricted Z-line changes, such as locally
activating a Z-line or creating a local Z-line, the oper must have the
LOCAL_ZLINE privilege. For any other Z-line change, including
locally-restricted changes on remote servers, the server's
CONFIG_OPERCMDS privilege must be enabled and the oper must have the
ZLINE privilege. There are also restrictions to prevent an oper from
setting a Z-line that is too wide; in some cases, those restrictions
may be overridden by prefixing the <mask> parameter with the "!"
character, IF the operator has the WIDE_ZLINE privilege.
For a server, the syntax is:
<prefix> ZL <target> [!][+|-|>|<]<mask> [<expiration>] [<lastmod>]
[<lifetime>] [:<reason>]
There are a total of 8 basic forms of the ZL command. The primary
innovation is the addition of the <lifetime> parameter, which
specifies a lifetime for the Z-line record which may be longer than
the expiration time. <lifetime> will be monotonically increasing,
enabling <expiration> to be modified in any way desirable.
* Local Z-lines.
Remote servers, or opers on them, may remotely set local Z-lines on
the local server. To create a local Z-line, <target> will be set to
the numeric of the local server, and <mask> must be preceded by '+'
(optionally preceded by '!' if the origin desires to override some
safety settings). The <expiration> and <reason> parameters are
required. The <lastmod> and <lifetime> parameters will be ignored if
present, allowing backwards compatibility with ircu2.10.12.10 and
prior versions. Removing local Z-lines is similar--<mask> must be
preceded by '-', and all other parameters are ignored to allow
backwards compatibility.
* Local modifications to global Z-lines.
Remote servers, or opers on them, may also locally activate or
deactivate a global Z-line on the local server. The <target> must be
set to the numeric of the local server, and <mask> must be preceded by
either '<' (to locally deactivate the Z-line) or '>' (to locally
activate the Z-line). This local state overrides the global state of
the Z-line, and persists until there is a global state change to the
Z-line, or until the Z-line expires. No other parameters are
necessary in this mode, and will be ignored if present.
* Global Z-lines.
For creation and manipulation of global Z-lines, the <target>
parameter must be set to "*". If the Z-line does not exist, and if
<expiration> is given, the Z-line will be created with the specified
expiration and <reason> (the latter defaulting to "No reason" if not
present). Otherwise, the Z-line will be updated according to the
available parameters. The rules are similar to those for oper-issued
global Z-lines, with the addition of a <lastmod> parameter, which is a
monotonically increasing serial number for the Z-line, and an optional
<lifetime> parameter that specifies a monotonically increasing
lifetime for the Z-line record. Note that, for existing Z-lines where
only state changes (global activation or deactivation) are necessary,
only <lastmod> is required; <expiration> must be specified for all
other forms of the ZL command.

451
doc/rfc1413.txt Normal file
View File

@ -0,0 +1,451 @@
Network Working Group M. St. Johns
Request for Comments: 1413 US Department of Defense
Obsoletes: 931 February 1993
Identification Protocol
Status of this Memo
This RFC specifies an IAB standards track protocol for the Internet
community, and requests discussion and suggestions for improvements.
Please refer to the current edition of the "IAB Official Protocol
Standards" for the standardization state and status of this protocol.
Distribution of this memo is unlimited.
1. INTRODUCTION
The Identification Protocol (a.k.a., "ident", a.k.a., "the Ident
Protocol") provides a means to determine the identity of a user of a
particular TCP connection. Given a TCP port number pair, it returns
a character string which identifies the owner of that connection on
the server's system.
The Identification Protocol was formerly called the Authentication
Server Protocol. It has been renamed to better reflect its function.
This document is a product of the TCP Client Identity Protocol
Working Group of the Internet Engineering Task Force (IETF).
2. OVERVIEW
This is a connection based application on TCP. A server listens for
TCP connections on TCP port 113 (decimal). Once a connection is
established, the server reads a line of data which specifies the
connection of interest. If it exists, the system dependent user
identifier of the connection of interest is sent as the reply. The
server may then either shut the connection down or it may continue to
read/respond to multiple queries.
The server should close the connection down after a configurable
amount of time with no queries - a 60-180 second idle timeout is
recommended. The client may close the connection down at any time;
however to allow for network delays the client should wait at least
30 seconds (or longer) after a query before abandoning the query and
closing the connection.
St. Johns [Page 1]
RFC 1413 Identification Protocol February 1993
3. RESTRICTIONS
Queries are permitted only for fully specified connections. The
query contains the local/foreign port pair -- the local/foreign
address pair used to fully specify the connection is taken from the
local and foreign address of query connection. This means a user on
address A may only query the server on address B about connections
between A and B.
4. QUERY/RESPONSE FORMAT
The server accepts simple text query requests of the form:
<port-on-server> , <port-on-client>
where <port-on-server> is the TCP port (decimal) on the target (where
the "ident" server is running) system, and <port-on-client> is the
TCP port (decimal) on the source (client) system.
N.B - If a client on host A wants to ask a server on host B about a
connection specified locally (on the client's machine) as 23, 6191
(an inbound TELNET connection), the client must actually ask about
6191, 23 - which is how the connection would be specified on host B.
For example:
6191, 23
The response is of the form
<port-on-server> , <port-on-client> : <resp-type> : <add-info>
where <port-on-server>,<port-on-client> are the same pair as the
query, <resp-type> is a keyword identifying the type of response, and
<add-info> is context dependent.
The information returned is that associated with the fully specified
TCP connection identified by <server-address>, <client-address>,
<port-on-server>, <port-on-client>, where <server-address> and
<client-address> are the local and foreign IP addresses of the
querying connection -- i.e., the TCP connection to the Identification
Protocol Server. (<port-on-server> and <port-on-client> are taken
from the query.)
For example:
6193, 23 : USERID : UNIX : stjohns
6195, 23 : ERROR : NO-USER
St. Johns [Page 2]
RFC 1413 Identification Protocol February 1993
5. RESPONSE TYPES
A response can be one of two types:
USERID
In this case, <add-info> is a string consisting of an
operating system name (with an optional character set
identifier), followed by ":", followed by an
identification string.
The character set (if present) is separated from the
operating system name by ",". The character set
identifier is used to indicate the character set of the
identification string. The character set identifier,
if omitted, defaults to "US-ASCII" (see below).
Permitted operating system names and character set
names are specified in RFC 1340, "Assigned Numbers" or
its successors.
In addition to those operating system and character set
names specified in "Assigned Numbers" there is one
special case operating system identifier - "OTHER".
Unless "OTHER" is specified as the operating system
type, the server is expected to return the "normal"
user identification of the owner of this connection.
"Normal" in this context may be taken to mean a string
of characters which uniquely identifies the connection
owner such as a user identifier assigned by the system
administrator and used by such user as a mail
identifier, or as the "user" part of a user/password
pair used to gain access to system resources. When an
operating system is specified (e.g., anything but
"OTHER"), the user identifier is expected to be in a
more or less immediately useful form - e.g., something
that could be used as an argument to "finger" or as a
mail address.
"OTHER" indicates the identifier is an unformatted
character string consisting of printable characters in
the specified character set. "OTHER" should be
specified if the user identifier does not meet the
constraints of the previous paragraph. Sending an
encrypted audit token, or returning other non-userid
information about a user (such as the real name and
phone number of a user from a UNIX passwd file) are
St. Johns [Page 3]
RFC 1413 Identification Protocol February 1993
both examples of when "OTHER" should be used.
Returned user identifiers are expected to be printable
in the character set indicated.
The identifier is an unformatted octet string - - all
octets are permissible EXCEPT octal 000 (NUL), 012 (LF)
and 015 (CR). N.B. - space characters (040) following the
colon separator ARE part of the identifier string and
may not be ignored. A response string is still
terminated normally by a CR/LF. N.B. A string may be
printable, but is not *necessarily* printable.
ERROR
For some reason the port owner could not be determined, <add-info>
tells why. The following are the permitted values of <add-info> and
their meanings:
INVALID-PORT
Either the local or foreign port was improperly
specified. This should be returned if either or
both of the port ids were out of range (TCP port
numbers are from 1-65535), negative integers, reals or
in any fashion not recognized as a non-negative
integer.
NO-USER
The connection specified by the port pair is not
currently in use or currently not owned by an
identifiable entity.
HIDDEN-USER
The server was able to identify the user of this
port, but the information was not returned at the
request of the user.
UNKNOWN-ERROR
Can't determine connection owner; reason unknown.
Any error not covered above should return this
error code value. Optionally, this code MAY be
returned in lieu of any other specific error code
if, for example, the server desires to hide
information implied by the return of that error
St. Johns [Page 4]
RFC 1413 Identification Protocol February 1993
code, or for any other reason. If a server
implements such a feature, it MUST be configurable
and it MUST default to returning the proper error
message.
Other values may eventually be specified and defined in future
revisions to this document. If an implementer has a need to specify
a non-standard error code, that code must begin with "X".
In addition, the server is allowed to drop the query connection
without responding. Any premature close (i.e., one where the client
does not receive the EOL, whether graceful or an abort should be
considered to have the same meaning as "ERROR : UNKNOWN-ERROR".
FORMAL SYNTAX
<request> ::= <port-pair> <EOL>
<port-pair> ::= <integer> "," <integer>
<reply> ::= <reply-text> <EOL>
<EOL> ::= "015 012" ; CR-LF End of Line Indicator
<reply-text> ::= <error-reply> | <ident-reply>
<error-reply> ::= <port-pair> ":" "ERROR" ":" <error-type>
<ident-reply> ::= <port-pair> ":" "USERID" ":" <opsys-field>
":" <user-id>
<error-type> ::= "INVALID-PORT" | "NO-USER" | "UNKNOWN-ERROR"
| "HIDDEN-USER" | <error-token>
<opsys-field> ::= <opsys> [ "," <charset>]
<opsys> ::= "OTHER" | "UNIX" | <token> ...etc.
; (See "Assigned Numbers")
<charset> ::= "US-ASCII" | ...etc.
; (See "Assigned Numbers")
<user-id> ::= <octet-string>
<token> ::= 1*64<token-characters> ; 1-64 characters
<error-token> ::= "X"1*63<token-characters>
; 2-64 chars beginning w/X
St. Johns [Page 5]
RFC 1413 Identification Protocol February 1993
<integer> ::= 1*5<digit> ; 1-5 digits.
<digit> ::= "0" | "1" ... "8" | "9" ; 0-9
<token-characters> ::=
<Any of these ASCII characters: a-z, A-Z,
- (dash), .!@#$%^&*()_=+.,<>/?"'~`{}[]; >
; upper and lowercase a-z plus
; printables minus the colon ":"
; character.
<octet-string> ::= 1*512<octet-characters>
<octet-characters> ::=
<any octet from 00 to 377 (octal) except for
ASCII NUL (000), CR (015) and LF (012)>
Notes on Syntax:
1) To promote interoperability among variant
implementations, with respect to white space the above
syntax is understood to embody the "be conservative in
what you send and be liberal in what you accept"
philosophy. Clients and servers should not generate
unnecessary white space (space and tab characters) but
should accept white space anywhere except within a
token. In parsing responses, white space may occur
anywhere, except within a token. Specifically, any
amount of white space is permitted at the beginning or
end of a line both for queries and responses. This
does not apply for responses that contain a user ID
because everything after the colon after the operating
system type until the terminating CR/LF is taken as
part of the user ID. The terminating CR/LF is NOT
considered part of the user ID.
2) The above notwithstanding, servers should restrict the
amount of inter-token white space they send to the
smallest amount reasonable or useful. Clients should
feel free to abort a connection if they receive 1000
characters without receiving an <EOL>.
3) The 512 character limit on user IDs and the 64
character limit on tokens should be understood to mean
as follows: a) No new token (i.e., OPSYS or ERROR-TYPE)
token will be defined that has a length greater than 64
and b) a server SHOULD NOT send more than 512 octets of
user ID and a client MUST accept at least 512 octets of
St. Johns [Page 6]
RFC 1413 Identification Protocol February 1993
user ID. Because of this limitation, a server MUST
return the most significant portion of the user ID in
the first 512 octets.
4) The character sets and character set identifiers should
map directly to those defined in or referenced by RFC 1340,
"Assigned Numbers" or its successors. Character set
identifiers only apply to the user identification field
- all other fields will be defined in and must be sent
as US-ASCII.
5) Although <user-id> is defined as an <octet-string>
above, it must follow the format and character set
constraints implied by the <opsys-field>; see the
discussion above.
6) The character set provides context for the client to
print or store the returned user identification string.
If the client does not recognize or implement the
returned character set, it should handle the returned
identification string as OCTET, but should in addition
store or report the character set. An OCTET string
should be printed, stored or handled in hex notation
(0-9a-f) in addition to any other representation the
client implements - this provides a standard
representation among differing implementations.
6. Security Considerations
The information returned by this protocol is at most as trustworthy
as the host providing it OR the organization operating the host. For
example, a PC in an open lab has few if any controls on it to prevent
a user from having this protocol return any identifier the user
wants. Likewise, if the host has been compromised the information
returned may be completely erroneous and misleading.
The Identification Protocol is not intended as an authorization or
access control protocol. At best, it provides some additional
auditing information with respect to TCP connections. At worst, it
can provide misleading, incorrect, or maliciously incorrect
information.
The use of the information returned by this protocol for other than
auditing is strongly discouraged. Specifically, using Identification
Protocol information to make access control decisions - either as the
primary method (i.e., no other checks) or as an adjunct to other
methods may result in a weakening of normal host security.
St. Johns [Page 7]
RFC 1413 Identification Protocol February 1993
An Identification server may reveal information about users,
entities, objects or processes which might normally be considered
private. An Identification server provides service which is a rough
analog of the CallerID services provided by some phone companies and
many of the same privacy considerations and arguments that apply to
the CallerID service apply to Identification. If you wouldn't run a
"finger" server due to privacy considerations you may not want to run
this protocol.
7. ACKNOWLEDGEMENTS
Acknowledgement is given to Dan Bernstein who is primarily
responsible for renewing interest in this protocol and for pointing
out some annoying errors in RFC 931.
References
[1] St. Johns, M., "Authentication Server", RFC 931, TPSC, January
1985.
[2] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, RFC 1340,
USC/Information Sciences Institute, July 1992.
Author's Address
Michael C. St. Johns
DARPA/CSTO
3701 N. Fairfax Dr
Arlington, VA 22203
Phone: (703) 696-2271
EMail: stjohns@DARPA.MIL
St. Johns [Page 8]

3657
doc/rfc1459.unet Normal file

File diff suppressed because it is too large Load Diff

233
doc/snomask.html Normal file
View File

@ -0,0 +1,233 @@
<html>
<head>
<title>SNOMASK - Server Notice Masks</title>
</head>
<body bgcolor=#FFFFFF text=#000000 link=#700000 vlink=#404040>
<center>
<font face="arial">
<h2>SNOMASK - Server Notice Masks</h2></font>
<font face="arial" size="2">
Written by <a href="mailto:foxxe@trms.com">Ghostwolf</a> 18th June 1997<br>
Modified with permission by <a href="mailto:loki@undernet.org">loki</a> 12th November 1997
</center>
<p><hr width="80%" noshade>
<blockquote>
This document (hopefully) gives a brief explanation of the use of server
notice masks new to ircu2.10.00. This mask allows clients to specify which
types of server notices they will receive when usermode +s. The mask may
optionally be omitted, and reasonable defaults will be used by the server.
<p>
Note: the descriptions here will be best understood by those with knowledge
of C syntax. We do not attempt to explain either this or hexadecimal values
in this document, and familiarity with these is assumed of the reader.
<p>
Usage:
</font><kbd><strong>
/mode &lt;nick&gt; +s [+/-][mask]</kbd></strong>
<font face="arial" size="2">
<p>
<center>
<table border=0 cellspacing=5 cellpadding=0 width=85%>
<tr align=center valign=middle>
<th align=left><font face="arial" size="2">Mask</th>
<th align=left>&nbsp;</th>
<th align=left><font face="arial" size="2">Hex value</th>
<th align=left><font face="arial" size="2">Description</th>
</tr>
<tr>
<td><font face="arial" size="2">1</td>
<td><font face="arial" size="2">SNO_OLDSNO</td>
<td><font face="arial" size="2">0x1</td>
<td><font face="arial" size="2">/* unsorted old messages */</td>
</tr>
<tr>
<td><font face="arial" size="2">2</td>
<td><font face="arial" size="2">SNO_SERVKILL</td>
<td><font face="arial" size="2">0x2</td>
<td><font face="arial" size="2">/* server kills (nick collisions) */</td>
</tr>
<tr>
<td><font face="arial" size="2">4</td>
<td><font face="arial" size="2">SNO_OPERKILL</td>
<td><font face="arial" size="2">0x4</td>
<td><font face="arial" size="2">/* oper kills */</td>
</tr>
<tr>
<td><font face="arial" size="2">8</td>
<td><font face="arial" size="2">SNO_HACK2</td>
<td><font face="arial" size="2">0x8</td>
<td><font face="arial" size="2">/* desyncs */</td>
</tr>
<tr>
<td><font face="arial" size="2">16</td>
<td><font face="arial" size="2">SNO_HACK3
<td><font face="arial" size="2">0x10</td>
<td><font face="arial" size="2">/* temporary desyncs */</td>
</tr>
<tr>
<td><font face="arial" size="2">32</td>
<td><font face="arial" size="2">SNO_UNAUTH</td>
<td><font face="arial" size="2">0x20</td>
<td><font face="arial" size="2">/* unauthorized connections */</td>
</tr>
<tr>
<td><font face="arial" size="2">64</td>
<td><font face="arial" size="2">SNO_TCPCOMMON</td>
<td><font face="arial" size="2">0x40</td>
<td><font face="arial" size="2">/* common TCP or socket errors */</td>
</tr>
<tr>
<td><font face="arial" size="2">128</td>
<td><font face="arial" size="2">SNO_TOOMANY</td>
<td><font face="arial" size="2">0x80</td>
<td><font face="arial" size="2">/* too many connections */</td>
</tr>
<tr>
<td><font face="arial" size="2">256</td>
<td><font face="arial" size="2">SNO_HACK4</td>
<td><font face="arial" size="2">0x100</td>
<td><font face="arial" size="2">/* Uworld actions on channels */</td>
</tr>
<tr>
<td><font face="arial" size="2">512</td>
<td><font face="arial" size="2">SNO_GLINE</td>
<td><font face="arial" size="2">0x200</td>
<td><font face="arial" size="2">/* glines */</td>
</tr>
<tr>
<td><font face="arial" size="2">1024</td>
<td><font face="arial" size="2">SNO_NETWORK</td>
<td><font face="arial" size="2">0x400</td>
<td><font face="arial" size="2">/* net join/break, etc */</td>
</tr>
<tr>
<td><font face="arial" size="2">2048</td>
<td><font face="arial" size="2">SNO_IPMISMATCH</td>
<td><font face="arial" size="2">0x800</td>
<td><font face="arial" size="2">/* IP mismatches */</td>
</tr>
<tr>
<td><font face="arial" size="2">4096</td>
<td><font face="arial" size="2">SNO_THROTTLE</td>
<td><font face="arial" size="2">0x1000</td>
<td><font face="arial" size="2">/* host throttle add/remove notices */</td>
</tr>
<tr>
<td><font face="arial" size="2">8192</td>
<td><font face="arial" size="2">SNO_OLDREALOP</td>
<td><font face="arial" size="2">0x2000</td>
<td><font face="arial" size="2">/* old oper-only messages */</td>
</tr>
<tr>
<td><font face="arial" size="2">16384</td>
<td><font face="arial" size="2">SNO_CONNEXIT</td>
<td><font face="arial" size="2">0x4000</td>
<td><font face="arial" size="2">/* client connect/exit (ugh) */</td>
</tr>
<tr>
<td><font face="arial" size="2">32768</td>
<td><font face="arial" size="2">SNO_AUTO</td>
<td><font face="arial" size="2">0x8000</td>
<td><font face="arial" size="2">/* AUTO G-Lines */</td>
</tr>
<tr>
<td><font face="arial" size="2">65536</td>
<td><font face="arial" size="2">SNO_DEBUG</td>
<td><font face="arial" size="2">0x10000</td>
<td><font face="arial" size="2">/* debugging messages (DEBUGMODE only) */</td>
</tr>
<tr>
<td><font face="arial" size="2">131072</td>
<td><font face="arial" size="2">SNO_NICKCHG</td>
<td><font face="arial" size="2">0x20000</td>
<td><font face="arial" size="2">/* nick change messages */</td>
</tr>
<tr>
<td><font face="arial" size="2">262144</td>
<td><font face="arial" size="2">SNO_AUTH</td>
<td><font face="arial" size="2">0x40000</td>
<td><font face="arial" size="2">/* iauth status messages */</td>
</tr>
<tr>
<td><font face="arial" size="2">524288</td>
<td><font face="arial" size="2">SNO_WEBIRC</td>
<td><font face="arial" size="2">0x80000</td>
<td><font face="arial" size="2">/* WebIRC messages */</td>
</tr>
</table>
</center>
<p>
<table border=0 cellpadding=0 cellspacing=5 width=90%>
<tr>
<td><font face="arial" size="2">standard +s</td>
<td><font face="arial" size="2">SNO_DEFAULT (SNO_NETWORK | SNO_OPERKILL | SNO_GLINE)</td>
</tr>
<tr>
<td><font face="arial" size="2">standard +s when +o/O</td>
<td><font face="arial" size="2">SNO_DEFAULT | SNO_HACK2 | SNO_THROTTLE | SNO_OLDSNO)</td>
</tr>
<tr>
<td><font face="arial" size="2">only opers may set</td>
<td><font face="arial" size="2">SNO_OPER (SNO_CONNEXIT | SNO_OLDREALOP | SNO_AUTH)</td>
</tr>
</table>
<p><hr width="80%" noshade>
<h3 align=center>Examples of Usage</h3>
To receive only operkills, use /mode <nick> +s 4<br>
To receive operkills and glines, add the values:
</font>
<blockquote><kbd><strong>
/mode &lt;nick&gt; +s 516</kbd></strong><p>
<font face="arial" size="2">
(512+4=516)
</blockquote>
<p>
If you are already receiving some notices and you wish to add notices of
netjoins/breaks use:
</font>
<blockquote><kbd><strong>
/mode Ghostwolf +s +1024</kbd></strong><p>
</blockquote>
<font face="arial" size="2">
<p>
If you wish to stop receiving netjoin/break notices, but continue to receive
other notices, use:
</font>
<blockquote><kbd><strong>
/mode Ghostwolf +s -1024<br>
OR<br>
/mode Ghostwolf -s +1024</kbd></strong>
</blockquote>
<font face="arial" size="2">
<p>
A user typing <strong>/mode Ghostwolf +s </strong>will receive netsplits/joins, operkills, and g-lines.<p>
Opers who are +s will additionally receive HACK notices and anything that
was originally in sendto_ops() and wasn't changed. Only opers can choose to
receive connect/exit notices and anything that originally was in
sendtoreal_ops() and hasn't been changed (connect/exit notices also require
a #define in config.h).
<p>
</font><center>
<hr width=80% noshade><font size=-1><strong>
If you have further questions about server notices (implementation, etc.),<br>
please consult the ircu source code and/or e-mail <a
href="mailto:coder-com@undernet.org">coder-com@undernet.org</a>.
</strong></font></center>
<hr width="80%" noshade><p>
<p align="right">
<em>
<font face="times new roman" font size="-1">
Return to <a href="http://www.user-com.undernet.org/documents/" target="nfo">main Documents Project page</a><br>
</em>
</font>
</body>
</html>

85
doc/snomask.txt Normal file
View File

@ -0,0 +1,85 @@
SNOMASK - Server Notice Masks
=============================
Written by Ghostwolf 18th June 1997
Modified with permission by loki 12th November 1997
Converted to TXT by Jobe 30th May 2013
-----------------------------
This document (hopefully) gives a brief explanation of the use of server notice
masks new to ircu2.10.00. This mask allows clients to specify which types of
server notices they will receive when usermode +s. The mask may optionally be
omitted, and reasonable defaults will be used by the server.
Note: the descriptions here will be best understood by those with knowledge of
C syntax. We do not attempt to explain either this or hexadecimal values in
this document, and familiarity with these is assumed of the reader.
-----------------------------
Usage: /mode <nick> +s [+/-][mask]
Mask Hex Value Description
1 SNO_OLDSNO 0x1 /* unsorted old messages */
2 SNO_SERVKILL 0x2 /* server kills (nick collisions) */
4 SNO_OPERKILL 0x4 /* oper kills */
8 SNO_HACK2 0x8 /* desyncs */
16 SNO_HACK3 0x10 /* temporary desyncs */
32 SNO_UNAUTH 0x20 /* unauthorized connections */
64 SNO_TCPCOMMON 0x40 /* common TCP or socket errors */
128 SNO_TOOMANY 0x80 /* too many connections */
256 SNO_HACK4 0x100 /* Uworld actions on channels */
512 SNO_GLINE 0x200 /* glines */
1024 SNO_NETWORK 0x400 /* net join/break, etc */
2048 SNO_IPMISMATCH 0x800 /* IP mismatches */
4096 SNO_THROTTLE 0x1000 /* host throttle add/remove notices */
8192 SNO_OLDREALOP 0x2000 /* old oper-only messages */
16384 SNO_CONNEXIT 0x4000 /* client connect/exit (ugh) */
32768 SNO_AUTO 0x8000 /* AUTO G-Lines */
65536 SNO_DEBUG 0x10000 /* debugging messages (DEBUGMODE only) */
131072 SNO_NICKCHG 0x20000 /* nick change messages */
262144 SNO_AUTH 0x40000 /* iauth status messages */
524288 SNO_WEBIRC 0x80000 /* WebIRC messages */
standard +s SNO_DEFAULT (SNO_NETWORK | SNO_OPERKILL | SNO_GLINE)
standard +s when +o/O SNO_OPERDEFAULT (SNO_DEFAULT|SNO_HACK2|SNO_THROTTLE|SNO_OLDSNO)
only opers may set SNO_OPER (SNO_CONNEXIT | SNO_OLDREALOP | SNO_AUTH)
-----------------------------
Examples of Usage:
=============================
To receive only operkills, use /mode +s 4
To receive operkills and glines, add the values:
/mode <nick> +s 516
(512+4=516)
If you are already receiving some notices and you wish to add notices of
netjoins/breaks use:
/mode Ghostwolf +s +1024
If you wish to stop receiving netjoin/break notices, but continue to receive
other notices, use:
/mode Ghostwolf +s -1024
OR
/mode Ghostwolf -s +1024
A user typing /mode Ghostwolf +s will receive netsplits/joins, operkills, and
g-lines.
Opers who are +s will additionally receive HACK notices and anything that was
originally in sendto_ops() and wasn't changed. Only opers can choose to receive
connect/exit notices and anything that originally was in sendtoreal_ops() and
hasn't been changed (connect/exit notices also require a #define in config.h).
-----------------------------
If you have further questions about server notices (implementation, etc.),
please consult the ircu source code and/or e-mail coder-com@undernet.org.
Please do not contact coder-com@undernet.org regarding Nefarious extensions.
-----------------------------

33
doc/strings.txt Normal file
View File

@ -0,0 +1,33 @@
Strings Information for ircu
Client:
name: (nickname for clients, server name for servers)
set in s_conf.c when checking C/N lines for a server
set in s_user.c during client registration
username: (user name string)
set in s_auth.c if the client RFC 931 authentication query successful.
set in s_user.c if auth query unsuccessful.
info: (string)
set in s_serv.c during server registration
set in s_user.c during client registration
passwd: (password string)
set in xxx.c when
used in xxx.c
cleared in xxx.c when
sock_ip: (ip address)
set in s_bsd.c when connection is established
used in s_conf.c when looking for conf entries
not cleared
sockhost: (resolved host name or ip address)
set in s_bsd.c when connection is established (copied from sock_ip)
set in s_auth.c if dns query is successful
set in s_conf.c if a C line is found that matches something in dns_reply.hp
used in opercmds.c

View File

@ -0,0 +1,56 @@
services:
nefarious:
image: ghcr.io/evilnet/nefarious2:latest
container_name: nefarious
restart: unless-stopped
ports:
- "6667:6667" # IRC (plaintext)
- "6697:6697" # IRC (SSL)
- "7000:7000" # IRC (plaintext)
- "4497:4497" # Server link (SSL)
- "9998:9998" # Services link (SSL)
environment:
IRCD_GENERAL_NAME: irc.example.com
IRCD_GENERAL_DESCRIPTION: "My IRC Server"
IRCD_GENERAL_NUMERIC: 1
IRCD_ADMIN_LOCATION: "New York, USA"
IRCD_ADMIN_CONTACT: "admin@example.com"
volumes:
# Persist SSL certificate
- ./ircd.pem:/home/nefarious/ircd/ircd.pem
# Custom configuration (optional)
- ./local.conf:/home/nefarious/ircd/local.conf
# Linesync Sidecar - Git-based configuration sync
# Uncomment to enable automatic config updates from a git repository
#
# Setup steps:
# 1. docker compose run --rm linesync keygen
# 2. Add the public key to your git repo's deploy keys
# 3. docker compose run --rm -e GIT_REPOSITORY=git@github.com:yourorg/linesync-data.git linesync setup
# 4. docker compose up -d
#
# linesync:
# image: ghcr.io/evilnet/nefarious2-linesync:latest
# # Or build locally:
# # build: ./tools/linesync
# container_name: linesync
# restart: unless-stopped
# depends_on:
# - nefarious
# volumes:
# # SSH keys directory
# - ./linesync-ssh:/home/linesync/.ssh
# # Config file - same bind mount as nefarious
# - ./local.conf:/home/linesync/ircd/local.conf
# # Linesync git repo directory (created by setup)
# - ./linesync:/home/linesync/ircd/linesync
# # Docker socket for sending SIGHUP to nefarious
# - /var/run/docker.sock:/var/run/docker.sock
# environment:
# NEFARIOUS_CONTAINER: nefarious
# SYNC_INTERVAL: 300
# IRCD_CONF: /home/linesync/ircd/local.conf
# # Optional: sync SSL certs from git tag
# # CERT_TAG: myserver-cert

1
include/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
patchlist.h

27
include/IPcheck.h Normal file
View File

@ -0,0 +1,27 @@
/** @file IPcheck.h
* @brief Interface to count users connected from particular IP addresses.
* @version $Id: IPcheck.h 1329 2005-03-19 23:22:09Z entrope $
*/
#ifndef INCLUDED_ipcheck_h
#define INCLUDED_ipcheck_h
#ifndef INCLUDED_sys_types_h
#include <sys/types.h> /* time_t, size_t */
#define INCLUDED_sys_types_h
#endif
struct Client;
struct irc_in_addr;
/*
* Prototypes
*/
extern void IPcheck_init(void);
extern int IPcheck_local_connect(const struct irc_in_addr *ip, time_t *next_target_out);
extern void IPcheck_connect_fail(const struct Client *cptr, int disconnect);
extern void IPcheck_connect_succeeded(struct Client *cptr);
extern int IPcheck_remote_connect(struct Client *cptr, int is_burst);
extern void IPcheck_disconnect(struct Client *cptr);
extern unsigned short IPcheck_nr(struct Client* cptr);
#endif /* INCLUDED_ipcheck_h */

64
include/capab.h Normal file
View File

@ -0,0 +1,64 @@
#ifndef INCLUDED_capab_h
#define INCLUDED_capab_h
/*
* IRC - Internet Relay Chat, include/capab.h
* Copyright (C) 2004 Kevin L. Mitchell <klmitch@mit.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file
* @brief Interface and public definitions for capabilities extension
* @version $Id: capab.h 1349 2005-04-05 01:46:05Z entrope $
*/
#ifndef INCLUDED_client_h
#include "client.h"
#endif
#define CAPFL_HIDDEN 0x0001 /**< Do not advertize this capability */
#define CAPFL_PROHIBIT 0x0002 /**< Client may not set this capability */
#define CAPFL_PROTO 0x0004 /**< Cap must be acknowledged by client */
#define CAPFL_STICKY 0x0008 /**< Cap may not be cleared once set */
#define CAPLIST \
_CAP(USERPFX, 0, "undernet.org/userpfx")
/** Client capabilities */
enum Capab {
#define _CAP(cap, flags, name, feat) CAP_ ## cap
_CAP(NONE, CAPFL_HIDDEN|CAPFL_PROHIBIT, "none", 0),
_CAP(NAMESX, 0, "multi-prefix", 0),
_CAP(UHNAMES, 0, "userhost-in-names", 0),
_CAP(EXTJOIN, 0, "extended-join", 0),
_CAP(AWAYNOTIFY, 0, "away-notify", 0),
_CAP(ACCNOTIFY, 0, "account-notify", 0),
_CAP(SASL, 0, "sasl", 0),
#ifdef USE_SSL
_CAP(TLS, 0, "tls", 0),
#endif
/* CAPLIST, */
#undef _CAP
_CAP_LAST_CAP
};
DECLARE_FLAGSET(CapSet, _CAP_LAST_CAP);
#define CapHas(cs, cap) FlagHas(cs, cap)
#define CapSet(cs, cap) FlagSet(cs, cap)
#define CapClr(cs, cap) FlagClr(cs, cap)
extern void client_check_caps(struct Client *client, struct Client *replyto);
#endif /* INCLUDED_capab_h */

572
include/channel.h Normal file
View File

@ -0,0 +1,572 @@
/*
* IRC - Internet Relay Chat, ircd/channel.h
* Copyright (C) 1990 Jarkko Oikarinen
* Copyright (C) 1996 - 1997 Carlo Wood
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file
* @brief Channel management and maintenance.
* @version $Id: channel.h 1913 2009-07-04 22:46:00Z entrope $
*/
#ifndef INCLUDED_channel_h
#define INCLUDED_channel_h
#ifndef INCLUDED_ircd_defs_h
#include "ircd_defs.h" /* NICKLEN */
#endif
#ifndef INCLUDED_sys_types_h
#include <sys/types.h>
#define INCLUDED_sys_types_h
#endif
#ifndef INCLUDED_res_h
#include "res.h"
#endif
struct SLink;
struct Client;
/*
* General defines
*/
#define MAXMODEPARAMS 6 /**< Maximum number of mode parameters */
#define MODEBUFLEN 200 /**< Maximum length of a mode */
#define KEYLEN 23 /**< Maximum length of a key */
#define CHANNELLEN 200 /**< Maximum length of a channel */
#define MAXJOINARGS 15 /**< number of slots for join buffer */
#define STARTJOINLEN 10 /**< fuzzy numbers */
#define STARTCREATELEN 20
/*
* Macro's
*/
#define ChannelExists(n) (0 != FindChannel(n))
#define CHFL_CHANOP 0x0001 /**< Channel operator */
#define CHFL_VOICE 0x0002 /**< the power to speak */
#define CHFL_DEOPPED 0x0004 /**< Is de-opped by a server */
#define CHFL_SERVOPOK 0x0008 /**< Server op allowed */
#define CHFL_ZOMBIE 0x0010 /**< Kicked from channel */
#define CHFL_BURST_JOINED 0x0100 /**< Just joined by net.junction */
#define CHFL_BANNED 0x1000 /**< Channel member is banned */
#define CHFL_SILENCE_IPMASK 0x2000 /**< silence mask is a CIDR */
#define CHFL_BURST_ALREADY_OPPED 0x04000
/**< In oob BURST, but was already
* joined and opped
*/
#define CHFL_BURST_ALREADY_VOICED 0x08000
/**, In oob BURST, but was already
* joined and voiced
*/
#define CHFL_CHANNEL_MANAGER 0x10000 /**< Set when creating channel or using
* Apass
*/
#define CHFL_USER_PARTING 0x20000 /**< User is already parting that
* channel
*/
#define CHFL_DELAYED 0x40000 /**< User's join message is delayed */
#define CHFL_BURST_ALREADY_HALFOPPED 0x400000
/**< In oob BURST, but was already
* joined and halfopped
*/
#define CHFL_HALFOP 0x800000 /**< Channel half operator */
#define CHFL_OVERLAP (CHFL_CHANOP | CHFL_HALFOP | CHFL_VOICE)
#define CHFL_VOICED_OR_OPPED (CHFL_CHANOP | CHFL_HALFOP | CHFL_VOICE)
#define MBFL_BANVALID 0x0001 /**< MBFL_BANNED bit is valid */
#define MBFL_BANNED 0x0002 /**< Channel member is banned */
#define MBFL_BANVALID_QUIET 0x0004 /**< MBFL_BANNED_QUIET bit is valid */
#define MBFL_BANNED_QUIET 0x0008 /**< Channel member is banned from speaking */
#define MBFL_BANVALID_NICK 0x0010 /**< MBFL_BANNED_NICK bit is valid */
#define MBFL_BANNED_NICK 0x0020 /**< Channel member is banned from changing nick */
#define MBFL_EXCEPTVALID 0x0040 /**< MBFL_EXCEPTED is valid */
#define MBFL_EXCEPTED 0x0080 /**< Channel member is ban excepted */
#define MBFL_EXCEPTVALID_QUIET 0x0100 /**< MBFL_EXCEPTED_QUIET is valid */
#define MBFL_EXCEPTED_QUIET 0x0200 /**< Channel member is ban excepted */
#define MBFL_EXCEPTVALID_NICK 0x0400 /**< MBFL_EXCEPTED_NICK is valid */
#define MBFL_EXCEPTED_NICK 0x0800 /**< Channel member is ban excepted */
/* Channel Visibility macros */
#define MODE_CHANOP CHFL_CHANOP /**< +o Chanop */
#define MODE_VOICE CHFL_VOICE /**< +v Voice */
#define MODE_PRIVATE 0x0004 /**< +p Private */
#define MODE_SECRET 0x0008 /**< +s Secret */
#define MODE_MODERATED 0x0010 /**< +m Moderated */
#define MODE_TOPICLIMIT 0x0020 /**< +t Topic Limited */
#define MODE_INVITEONLY 0x0040 /**< +i Invite only */
#define MODE_NOPRIVMSGS 0x0080 /**< +n No Private Messages */
#define MODE_KEY 0x0100 /**< +k Keyed */
#define MODE_BAN 0x0200 /**< +b Ban */
#define MODE_LIMIT 0x0400 /**< +l Limit */
#define MODE_REGONLY 0x0800 /**< Only +r users may join */
#define MODE_DELJOINS 0x1000 /**< New join messages are delayed */
#define MODE_REGISTERED 0x2000 /**< Channel marked as registered
* (for future semantic expansion) */
#define MODE_SAVE 0x20000 /**< save this mode-with-arg 'til
* later */
#define MODE_FREE 0x40000 /**< string needs to be passed to
* MyFree() */
#define MODE_BURSTADDED 0x80000 /**< channel was created by a BURST */
#define MODE_UPASS 0x100000
#define MODE_APASS 0x200000
#define MODE_WASDELJOINS 0x400000 /**< Not DELJOINS, but some joins
* pending */
#define MODE_HALFOP CHFL_HALFOP /**< +h Halfop */
#define MODE_EXCEPT 0x1000000 /**< +e Ban exception */
#define MODE_REDIRECT 0x2000000 /**< +L Channel redirect */
#define EXMODE_ADMINONLY 0x00000001 /**< +a User mode +a only may join */
#define EXMODE_OPERONLY 0x00000002 /**< +O User mode +o only may join */
#define EXMODE_REGMODERATED 0x00000004 /**< +M Like +m but allows registered users too */
#define EXMODE_NONOTICES 0x00000008 /**< +N No notices allowed to the channel */
#define EXMODE_PERSIST 0x00000010 /**< +z Channel remains even if empty */
#define EXMODE_SSLONLY 0x00000020 /**< +Z Only SSL users (user mode +z) may join */
#define EXMODE_NOQUITPARTS 0x00000040 /**< +Q Strip QUIT/PART messages */
#define EXMODE_NOCTCPS 0x00000080 /**< +C Block CTCP messages */
#define EXMODE_NOMULTITARG 0x00000100 /**< +T Block messages with a list of targets */
#define EXMODE_NOCOLOR 0x00000200 /**< +c Block messages containing color */
#define EXMODE_STRIPCOLOR 0x00000400 /**< +S Strip color from messages */
/** mode flags which take another parameter (With PARAmeterS)
*/
#define MODE_WPARAS (MODE_CHANOP|MODE_HALFOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT|MODE_APASS|MODE_UPASS)
/** Available Channel modes */
#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AabCcDdhikLlMmNnOopQRrSsTtUvZz" : "abCcDdhikLlMmNnOopQRrSsTtvZz"
/** Available Channel modes that take parameters */
#define infochanmodeswithparams feature_bool(FEAT_OPLEVELS) ? \
(feature_bool(FEAT_HALFOPS) ? "AbhkLloUv" : "AbkLloUv") : \
(feature_bool(FEAT_HALFOPS) ? "bhkLlov" : "bkLlov")
#define HoldChannel(x) (!(x))
/** name invisible */
#define SecretChannel(x) ((x) && ((x)->mode.mode & MODE_SECRET))
/** channel not shown but names are */
#define HiddenChannel(x) ((x) && ((x)->mode.mode & MODE_PRIVATE))
/** channel visible */
#define ShowChannel(v,c) (PubChannel(c) || find_channel_member((v),(c)))
#define PubChannel(x) ((!x) || ((x)->mode.mode & \
(MODE_PRIVATE | MODE_SECRET)) == 0)
#define IsGlobalChannel(name) (*(name) == '#')
#define IsLocalChannel(name) (*(name) == '&')
#define IsChannelName(name) (IsGlobalChannel(name) || IsLocalChannel(name))
typedef enum ChannelGetType {
CGT_NO_CREATE,
CGT_CREATE
} ChannelGetType;
/* used in SetMode() in channel.c and m_umode() in s_msg.c */
#define MODE_NULL 0
#define MODE_ADD 0x40000000
#define MODE_DEL 0x20000000
/* used in ListingArgs.flags */
#define LISTARG_TOPICLIMITS 0x0001
#define LISTARG_SHOWSECRET 0x0002
#define LISTARG_NEGATEWILDCARD 0x0004
#define LISTARG_SHOWMODES 0x0008
/**
* Maximum acceptable lag time in seconds: A channel younger than
* this is not protected against hacking admins.
* Mainly here to check if the TS clocks really sync (otherwise this
* will start causing HACK notices.
* This value must be the same on all servers.
*
* This value has been increased to 1 day in order to distinguish this
* "normal" type of HACK wallops / desyncs, from possiblity still
* existing bugs.
*/
#define TS_LAG_TIME 86400
extern const char* const PartFmt1;
extern const char* const PartFmt2;
extern const char* const PartFmt1serv;
extern const char* const PartFmt2serv;
/*
* Structures
*/
/** Information about a client on one channel
*
* This structure forms a sparse matrix with users down the side, and
* channels across the top. This matrix holds all the information about
* which users are on what channels, and what modes that user has on that
* channel (if they are op'd, voice'd and cached information if they are
* banned or not)
*/
struct Membership {
struct Client* user; /**< The user */
struct Channel* channel; /**< The channel */
struct Membership* next_member; /**< The next user on this channel */
struct Membership* prev_member; /**< The previous user on this channel*/
struct Membership* next_channel; /**< Next channel this user is on */
struct Membership* prev_channel; /**< Previous channel this user is on*/
unsigned int status; /**< Flags for op'd, voice'd, etc */
unsigned int banflags; /**< Ban cache flags */
unsigned short oplevel; /**< Op level */
};
#define MAXOPLEVELDIGITS 3
#define MAXOPLEVEL 999
#define IsZombie(x) ((x)->status & CHFL_ZOMBIE) /**< see \ref zombie */
#define IsDeopped(x) ((x)->status & CHFL_DEOPPED)
#define IsBanned(x) ((x)->banflags & MBFL_BANNED)
#define IsBanValid(x) ((x)->banflags & MBFL_BANVALID)
#define IsBannedQuiet(x) ((x)->banflags & MBFL_BANNED_QUIET)
#define IsBanValidQuiet(x) ((x)->banflags & MBFL_BANVALID_QUIET)
#define IsBannedNick(x) ((x)->banflags & MBFL_BANNED_NICK)
#define IsBanValidNick(x) ((x)->banflags & MBFL_BANVALID_NICK)
#define IsChanOp(x) ((x)->status & CHFL_CHANOP)
#define IsHalfOp(x) ((x)->status & CHFL_HALFOP)
#define ExtBanTypes(x) ((x)->extbantype)
#define OpLevel(x) ((x)->oplevel)
#define HasVoice(x) ((x)->status & CHFL_VOICE)
#define IsServOpOk(x) ((x)->status & CHFL_SERVOPOK)
#define IsBurstJoined(x) ((x)->status & CHFL_BURST_JOINED)
#define IsVoicedOrOpped(x) ((x)->status & CHFL_VOICED_OR_OPPED)
#define IsChannelManager(x) ((x)->status & CHFL_CHANNEL_MANAGER)
#define IsUserParting(x) ((x)->status & CHFL_USER_PARTING)
#define IsDelayedJoin(x) ((x)->status & CHFL_DELAYED)
#define IsExcepted(x) ((x)->banflags & MBFL_EXCEPTED)
#define IsExceptValid(x) ((x)->banflags & MBFL_EXCEPTVALID)
#define IsExceptedQuiet(x) ((x)->banflags & MBFL_EXCEPTED_QUIET)
#define IsExceptValidQuiet(x) ((x)->banflags & MBFL_EXCEPTVALID_QUIET)
#define IsExceptedNick(x) ((x)->banflags & MBFL_EXCEPTED_NICK)
#define IsExceptValidNick(x) ((x)->banflags & MBFL_EXCEPTVALID_NICK)
#define SetBanned(x) ((x)->banflags |= MBFL_BANNED)
#define SetBanValid(x) ((x)->banflags |= MBFL_BANVALID)
#define SetBannedQuiet(x) ((x)->banflags |= MBFL_BANNED_QUIET)
#define SetBanValidQuiet(x) ((x)->banflags |= MBFL_BANVALID_QUIET)
#define SetBannedNick(x) ((x)->banflags |= MBFL_BANNED_NICK)
#define SetBanValidNick(x) ((x)->banflags |= MBFL_BANVALID_NICK)
#define SetDeopped(x) ((x)->status |= CHFL_DEOPPED)
#define SetServOpOk(x) ((x)->status |= CHFL_SERVOPOK)
#define SetBurstJoined(x) ((x)->status |= CHFL_BURST_JOINED)
#define SetZombie(x) ((x)->status |= CHFL_ZOMBIE)
#define SetChannelManager(x) ((x)->status |= CHFL_CHANNEL_MANAGER)
#define SetOpLevel(x, v) (void)((x)->oplevel = (v))
#define SetUserParting(x) ((x)->status |= CHFL_USER_PARTING)
#define SetDelayedJoin(x) ((x)->status |= CHFL_DELAYED)
#define SetExcepted(x) ((x)->banflags |= MBFL_EXCEPTED)
#define SetExceptValid(x) ((x)->banflags |= MBFL_EXCEPTVALID)
#define SetExceptedQuiet(x) ((x)->banflags |= MBFL_EXCEPTED_QUIET)
#define SetExceptValidQuiet(x) ((x)->banflags |= MBFL_EXCEPTVALID_QUIET)
#define SetExceptedNick(x) ((x)->banflags |= MBFL_EXCEPTED_NICK)
#define SetExceptValidNick(x) ((x)->banflags |= MBFL_EXCEPTVALID_NICK)
#define ClearBanned(x) ((x)->banflags &= ~MBFL_BANNED)
#define ClearBanValid(x) ((x)->banflags &= ~MBFL_BANVALID)
#define ClearBannedQuiet(x) ((x)->banflags &= ~MBFL_BANNED_QUIET)
#define ClearBanValidQuiet(x) ((x)->banflags &= ~MBFL_BANVALID_QUIET)
#define ClearBannedNick(x) ((x)->banflags &= ~MBFL_BANNED_NICK)
#define ClearBanValidNick(x)((x)->banflags &= ~MBFL_BANVALID_NICK)
#define ClearDeopped(x) ((x)->status &= ~CHFL_DEOPPED)
#define ClearServOpOk(x) ((x)->status &= ~CHFL_SERVOPOK)
#define ClearBurstJoined(x) ((x)->status &= ~CHFL_BURST_JOINED)
#define ClearDelayedJoin(x) ((x)->status &= ~CHFL_DELAYED)
#define ClearExcepted(x) ((x)->banflags &= ~MBFL_EXCEPTED)
#define ClearExceptValid(x) ((x)->banflags &= ~MBFL_EXCEPTVALID)
#define ClearExceptedQuiet(x) ((x)->banflags &= ~MBFL_EXCEPTED_QUIET)
#define ClearExceptValidQuiet(x) ((x)->banflags &= ~MBFL_EXCEPTVALID_QUIET)
#define ClearExceptedNick(x) ((x)->banflags &= ~MBFL_EXCEPTED_NICK)
#define ClearExceptValidNick(x) ((x)->banflags &= ~MBFL_EXCEPTVALID_NICK)
/** Mode information for a channel */
struct Mode {
unsigned int mode;
unsigned int exmode;
unsigned int limit;
char key[KEYLEN + 1];
char upass[KEYLEN + 1];
char apass[KEYLEN + 1];
char redir[CHANNELLEN + 1];
};
#define EBAN_NONE 0x00000000 /* Passed to find_ban() when no extended ban type is specified. */
#define EBAN_EXCEPTLIST 0x10000000 /* Only ever passed to find_ban() so wont conflic with EBAN_NOCHILD. */
#define EBAN_NOCHILD 0x10000000 /* Extended Ban cannot have a nested extended ban. */
#define EBAN_NEGATEMASK 0x20000000 /* Mask is negated (extended ban applies to users who do not match). */
#define EBAN_QUIET 0x00000001 /* Extended Ban quiets matching users. */
#define EBAN_NICK 0x00000002 /* Extended Ban stops matching users changing nick. */
#define EBAN_JOIN 0x00000010 /* Extended Ban checks the specified channels ban list. */
#define EBAN_ACCOUNT 0x00000020 /* Extended Ban matches against a users account names. */
#define EBAN_CHANNEL 0x00000040 /* Extended Ban matches against channels the user is a member of. */
#define EBAN_REALNAME 0x00000080 /* Extended Ban matches against a users real name. */
#define EBAN_MARK 0x00000100 /* Extended Ban matches marks on all users. */
#define EBAN_MARKUA 0x00000200 /* Extended Ban matches marks on unauthenticated users. */
#define EBAN_TYPES 0x000003FF /* Mask of all extended ban types. */
#define EBAN_CRITERIA 0xF0000000 /* Mask of all extended ban criteria. */
#define EBAN_MASKTYPE 0x000003F0 /* Mask of all mask types. */
#define EBAN_ACTIVITY 0x0000000F /* Mask of all extended bans that block a specific activity. */
struct ExtBanInfo {
char banchar;
int flags;
int feat;
};
struct ExtBan {
int flags; /**< Flags describing this extended ban. */
unsigned int prefixlen; /**< Length of the extended ban prefix. */
unsigned int nu_len; /**< length of nick!user part of mask. */
char delimiter; /**< Character used as the delimiter. */
char mask[NICKLEN+USERLEN+HOSTLEN+3]; /**< Mask to match the client against. */
};
#define BAN_IPMASK 0x0001 /**< ban mask is an IP-number mask */
#define BAN_OVERLAPPED 0x0002 /**< ban overlapped, need bounce */
#define BAN_BURSTED 0x0004 /**< Ban part of last BURST */
#define BAN_BURST_WIPEOUT 0x0008 /**< Ban will be wiped at EOB */
#define BAN_EXCEPTION 0x0010 /**< Ban is an exception */
#define BAN_EXTENDED 0x0020 /**< Ban is an Extended Ban */
#define BAN_DEL 0x4000 /**< Ban is being removed */
#define BAN_ADD 0x8000 /**< Ban is being added */
/** A single ban for a channel. */
struct Ban {
struct Ban* next; /**< next ban in the channel */
struct irc_in_addr address; /**< address for BAN_IPMASK bans */
struct ExtBan extban; /**< extended ban info */
time_t when; /**< timestamp when ban was added */
unsigned short flags; /**< modifier flags for the ban */
unsigned char nu_len; /**< length of nick!user part of banstr */
unsigned char addrbits; /**< netmask length for BAN_IPMASK bans */
char who[NICKLEN+1]; /**< name of client that set the ban */
char banstr[NICKLEN+USERLEN+HOSTLEN+3]; /**< hostmask that the ban matches */
};
/** Information about a channel */
struct Channel {
struct Channel* next; /**< next channel in the global channel list */
struct Channel* prev; /**< previous channel */
struct Channel* hnext; /**< Next channel in the hash table */
struct DestructEvent* destruct_event;
time_t creationtime; /**< Creation time of this channel */
time_t topic_time; /**< Modification time of the topic */
unsigned int users; /**< Number of clients on this channel */
unsigned int nonsslusers; /**< Number of clients without user mode +z */
struct Membership* members; /**< Pointer to the clients on this channel*/
struct SLink* invites; /**< List of invites on this channel */
struct Ban* banlist; /**< List of bans on this channel */
struct Ban* exceptlist; /**< List of excepts on this channel */
struct Mode mode; /**< This channels mode */
char topic[TOPICLEN + 1]; /**< Channels topic */
char topic_nick[NICKLEN + USERLEN + HOSTLEN + 3]; /**< Nick of the person who set
* The topic
*/
char chname[1]; /**< Dynamically allocated string of the
* channel name
*/
};
/** Information about a /list in progress */
struct ListingArgs {
time_t max_time;
time_t min_time;
unsigned int max_users;
unsigned int min_users;
unsigned int flags;
time_t max_topic_time;
time_t min_topic_time;
unsigned int bucket;
char wildcard[CHANNELLEN + 1];
};
struct ModeBuf {
unsigned int mb_add; /**< Modes to add */
unsigned int mb_exadd; /**< Extended modes to add */
unsigned int mb_rem; /**< Modes to remove */
unsigned int mb_exrem; /**< Extended modes to remove */
struct Client *mb_source; /**< Source of MODE changes */
struct Client *mb_connect; /**< Connection of MODE changes */
struct Channel *mb_channel; /**< Channel they affect */
unsigned int mb_dest; /**< Destination of MODE changes */
unsigned int mb_count; /**< Number of modes w/args */
struct {
unsigned int mbm_type; /**< Type of argument */
union {
unsigned int mbma_uint; /**< A limit */
char *mbma_string; /**< A string */
struct Client *mbma_client; /**< A client */
} mbm_arg; /**< The mode argument */
unsigned short mbm_oplevel; /**< Oplevel for a bounce */
} mb_modeargs[MAXMODEPARAMS];
/**< A mode w/args */
};
#define MODEBUF_DEST_CHANNEL 0x00001 /**< Mode is flushed to channel */
#define MODEBUF_DEST_SERVER 0x00002 /**< Mode is flushed to server */
#define MODEBUF_DEST_OPMODE 0x00100 /**< Send server mode as OPMODE */
#define MODEBUF_DEST_DEOP 0x00200 /**< Deop the offender */
#define MODEBUF_DEST_BOUNCE 0x00400 /**< Bounce the modes */
#define MODEBUF_DEST_LOG 0x00800 /**< Log the mode changes to OPATH */
#define MODEBUF_DEST_HACK2 0x02000 /**< Send a HACK(2) notice, reverse */
#define MODEBUF_DEST_HACK3 0x04000 /**< Send a HACK(3) notice, TS == 0 */
#define MODEBUF_DEST_HACK4 0x08000 /**< Send a HACK(4) notice, TS == 0 */
#define MODEBUF_DEST_NOKEY 0x10000 /**< Don't send the real key */
#define MB_TYPE(mb, i) ((mb)->mb_modeargs[(i)].mbm_type)
#define MB_UINT(mb, i) ((mb)->mb_modeargs[(i)].mbm_arg.mbma_uint)
#define MB_STRING(mb, i) ((mb)->mb_modeargs[(i)].mbm_arg.mbma_string)
#define MB_CLIENT(mb, i) ((mb)->mb_modeargs[(i)].mbm_arg.mbma_client)
#define MB_OPLEVEL(mb, i) ((mb)->mb_modeargs[(i)].mbm_oplevel)
/** A buffer represeting a list of joins to send */
struct JoinBuf {
struct Client *jb_source; /**< Source of joins (ie, joiner) */
struct Client *jb_connect; /**< Connection of joiner */
unsigned int jb_type; /**< Type of join (JOIN or CREATE) */
char *jb_comment; /**< part comment */
time_t jb_create; /**< Creation timestamp */
unsigned int jb_count; /**< Number of channels */
unsigned int jb_strlen; /**< length so far */
struct Channel *jb_channels[MAXJOINARGS];
/**< channels joined or whatever */
};
#define JOINBUF_TYPE_JOIN 0 /**< send JOINs */
#define JOINBUF_TYPE_CREATE 1 /**< send CREATEs */
#define JOINBUF_TYPE_PART 2 /**< send PARTs */
#define JOINBUF_TYPE_PARTALL 3 /**< send local PARTs, but not remote */
extern struct Channel* GlobalChannelList;
extern int LocalChanOperMode;
/*
* Proto types
*/
extern void channel_modes(struct Client *cptr, char *mbuf, char *pbuf,
int buflen, struct Channel *chptr,
struct Membership *member);
extern int set_mode(struct Client* cptr, struct Client* sptr,
struct Channel* chptr, int parc, char* parv[],
char* mbuf, char* pbuf, char* npbuf, int* badop);
extern void send_hack_notice(struct Client *cptr, struct Client *sptr,
int parc, char *parv[], int badop, int mtype);
extern struct Channel *get_channel(struct Client *cptr,
char *chname, ChannelGetType flag);
extern struct Membership* find_member_link(struct Channel * chptr,
const struct Client* cptr);
extern int sub1_from_channel(struct Channel* chptr);
extern int destruct_channel(struct Channel* chptr);
extern void add_user_to_channel(struct Channel* chptr, struct Client* who,
unsigned int flags, int oplevel);
extern void make_zombie(struct Membership* member, struct Client* who,
struct Client* cptr, struct Client* sptr,
struct Channel* chptr);
extern struct Client* find_chasing(struct Client* sptr, const char* user, int* chasing);
void add_invite(struct Client *cptr, struct Channel *chptr);
int number_of_zombies(struct Channel *chptr);
extern const char* find_no_nickchange_channel(struct Client* cptr);
extern struct Membership* find_channel_member(struct Client* cptr, struct Channel* chptr);
extern int member_can_send_to_channel(struct Membership* member, int reveal);
extern int client_can_send_to_channel(struct Client *cptr, struct Channel *chptr, int reveal);
extern void remove_user_from_channel(struct Client *sptr, struct Channel *chptr);
extern void remove_user_from_all_channels(struct Client* cptr);
extern int is_chan_op(struct Client *cptr, struct Channel *chptr);
extern int is_zombie(struct Client *cptr, struct Channel *chptr);
extern int is_half_op(struct Client *cptr, struct Channel *chptr);
extern int has_voice(struct Client *cptr, struct Channel *chptr);
/*
NOTE: pointer is compared, and not dereferenced, called by
add_target with a void*, since targets could be anything,
this function can't make any assumptions that it has a channel
*/
extern int IsInvited(struct Client* cptr, const void* chptr);
extern void send_channel_modes(struct Client *cptr, struct Channel *chptr);
extern char *pretty_mask(char *mask);
extern char *pretty_extmask(char *mask);
extern void del_invite(struct Client *cptr, struct Channel *chptr);
extern void list_set_default(void); /* this belongs elsewhere! */
extern void RevealDelayedJoinIfNeeded(struct Client *sptr, struct Channel *chptr);
extern void RevealDelayedJoin(struct Membership *member);
extern void CheckDelayedJoins(struct Channel *chan);
extern void modebuf_init(struct ModeBuf *mbuf, struct Client *source,
struct Client *connect, struct Channel *chan,
unsigned int dest);
extern void modebuf_mode(struct ModeBuf *mbuf, unsigned int mode);
extern void modebuf_mode_uint(struct ModeBuf *mbuf, unsigned int mode,
unsigned int uint);
extern void modebuf_mode_string(struct ModeBuf *mbuf, unsigned int mode,
char *string, int free);
extern void modebuf_mode_client(struct ModeBuf *mbuf, unsigned int mode,
struct Client *client, int oplevel);
extern int modebuf_flush(struct ModeBuf *mbuf);
extern void modebuf_extract(struct ModeBuf *mbuf, char *buf, int oplevels);
extern void mode_ban_invalidate(struct Channel *chan);
extern void mode_except_invalidate(struct Channel *chan);
extern void mode_invite_clear(struct Channel *chan);
extern int mode_parse(struct ModeBuf *mbuf, struct Client *cptr,
struct Client *sptr, struct Channel *chptr,
int parc, char *parv[], unsigned int flags,
struct Membership* member);
#define MODE_PARSE_SET 0x01 /**< actually set channel modes */
#define MODE_PARSE_STRICT 0x02 /**< +m +n +t style not supported */
#define MODE_PARSE_FORCE 0x04 /**< force the mode to be applied */
#define MODE_PARSE_BOUNCE 0x08 /**< we will be bouncing the modes */
#define MODE_PARSE_NOTOPER 0x10 /**< send "not chanop" to user */
#define MODE_PARSE_NOTMEMBER 0x20 /**< send "not member" to user */
#define MODE_PARSE_WIPEOUT 0x40 /**< wipe out +k and +l during burst */
#define MODE_PARSE_BURST 0x80 /**< be even more strict w/extra args */
#define MODE_PARSE_ISHALFOP 0x100 /**< op and halfop differentiation */
extern void joinbuf_init(struct JoinBuf *jbuf, struct Client *source,
struct Client *connect, unsigned int type,
char *comment, time_t create);
extern void joinbuf_join(struct JoinBuf *jbuf, struct Channel *chan,
unsigned int flags);
extern int joinbuf_flush(struct JoinBuf *jbuf);
extern struct Ban *make_ban(const char *banstr);
extern struct Ban *find_ban(struct Client *cptr, struct Ban *banlist, int extbantype, int level);
extern int apply_ban(struct Ban **banlist, struct Ban *newban, int free);
extern int apply_except(struct Ban **banlist, struct Ban *newban, int do_free);
extern void free_ban(struct Ban *ban);
extern int SetAutoChanModes(struct Channel *chptr);
extern int common_chan_count(struct Client *a, struct Client *b, int max);
#endif /* INCLUDED_channel_h */

156
include/class.h Normal file
View File

@ -0,0 +1,156 @@
/*
* IRC - Internet Relay Chat, include/class.h
* Copyright (C) 1990 Darren Reed
* Copyright (C) 1996 - 1997 Carlo Wood
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file
* @brief Declarations and interfaces for handling connection classes.
* @version $Id: class.h 1511 2005-10-05 01:53:30Z entrope $
*/
#ifndef INCLUDED_class_h
#define INCLUDED_class_h
#ifndef INCLUDED_sys_types_h
#include <sys/types.h>
#define INCLUDED_sys_types_h
#endif
#include "client.h"
struct ConfItem;
struct StatDesc;
/* Class restriction FlagSet */
enum ClassRestrictFlag {
CRFLAG_JOIN, /**< User cannot join channerls. */
CRFLAG_PRIVMSG, /**< User cannot send PRIVMSG/NOTICE to users not on common channels. */
CRFLAG_UMODE, /**< User cannot change his/her own user modes. */
CRFLAG_LAST_FLAG
};
/** Declare flagset type for Class restriction flags. */
DECLARE_FLAGSET(ClassRestrictFlags, CRFLAG_LAST_FLAG);
/*
* Structures
*/
/** Represents a connection class. */
struct ConnectionClass {
struct ConnectionClass* next; /**< Link to next connection class. */
char *cc_name; /**< Name of connection class. */
char *default_umode; /**< Default usermode for users
in this class. */
char *autojoinchan; /**< Auto join channel list. */
char *autojoinnotice; /**< Auto join notice. */
unsigned int snomask; /**< Default server notice mask. */
struct Privs privs; /**< Privilege bits that are set on
or off. */
struct Privs privs_dirty; /**< Indication of which bits in
ConnectionClass::privs are valid. */
struct ClassRestrictFlags restrictflags; /**< Class restrictions applied to users. */
unsigned int max_sendq; /**< Maximum client SendQ in bytes. */
unsigned int max_recvq; /**< Maximum client RecvQ in bytes. */
unsigned int max_links; /**< Maximum connections allowed. */
unsigned int max_chans; /**< Maximum channels allowed to join. */
unsigned int ref_count; /**< Number of references to class. */
signed int lag_min; /**< Minimum number of seconds for fake lag. */
signed int lag_factor; /**< Factor by which the message length is divided to add to fake lag. */
unsigned short ping_freq; /**< Ping frequency for clients. */
unsigned short conn_freq; /**< Auto-connect frequency. */
unsigned char valid; /**< Valid flag (cleared after this
class is removed from the config).*/
};
/*
* Macro's
*/
/** Get class name for \a x. */
#define ConClass(x) ((x)->cc_name)
/** Get ping frequency for \a x. */
#define PingFreq(x) ((x)->ping_freq)
/** Get connection frequency for \a x. */
#define ConFreq(x) ((x)->conn_freq)
/** Get maximum links allowed for \a x. */
#define MaxLinks(x) ((x)->max_links)
/** Get maximum SendQ size for \a x. */
#define MaxSendq(x) ((x)->max_sendq)
/** Get maximum RecvQ size for \a x. */
#define MaxRecvq(x) ((x)->max_recvq)
/** Get maximum channel limit for \a x. */
#define MaxChans(x) ((x)->max_chans)
/** Get number of references to \a x. */
#define Links(x) ((x)->ref_count)
/** Get fake lag minimum for \a x. */
#define LagMin(x) ((x)->lag_min)
/** Get fake lag factor for \a x. */
#define LagFactor(x) ((x)->lag_factor)
/** Get class name for ConfItem \a x. */
#define ConfClass(x) ((x)->conn_class->cc_name)
/** Get ping frequency for ConfItem \a x. */
#define ConfPingFreq(x) ((x)->conn_class->ping_freq)
/** Get connection frequency for ConfItem \a x. */
#define ConfConFreq(x) ((x)->conn_class->conn_freq)
/** Get maximum links allowed for ConfItem \a x. */
#define ConfMaxLinks(x) ((x)->conn_class->max_links)
/** Get maximum SendQ size for ConfItem \a x. */
#define ConfSendq(x) ((x)->conn_class->max_sendq)
/** Get maximum RecvQ size for ConfItem \a x. */
#define ConfRecvq(x) ((x)->conn_class->max_recvq)
/** Get number of references to class in ConfItem \a x. */
#define ConfLinks(x) ((x)->conn_class->ref_count)
/** Get default usermode for ConfItem \a x. */
#define ConfUmode(x) ((x)->conn_class->default_umode)
/** Get default snomask for ConfItem \a x. */
#define ConfSnoMask(x) ((x)->conn_class->snomask)
/** Get autojoin channel list for ConfItem \a x. */
#define ConfAjoinChan(x) ((x)->conn_class->autojoinchan)
/** Get autojoin channel notice for ConfItem \a x. */
#define ConfAjoinNotice(x) ((x)->conn_class->autojoinnotice)
/** Find a valid configuration class by name. */
#define find_class(name) do_find_class((name), 0)
/*
* Proto types
*/
extern void init_class(void);
extern const struct ConnectionClass* get_class_list(void);
extern void class_mark_delete(void);
extern void class_delete_marked(void);
extern struct ConnectionClass *do_find_class(const char *name, int extras);
extern struct ConnectionClass *make_class(void);
extern void free_class(struct ConnectionClass * tmp);
extern char *get_conf_class(const struct ConfItem *aconf);
extern int get_conf_ping(const struct ConfItem *aconf);
extern char *get_client_class(struct Client *acptr);
extern struct ConnectionClass *get_client_class_conf(struct Client *acptr);
extern void add_class(char *name, unsigned int ping,
unsigned int confreq, unsigned int maxli,
unsigned int sendq, unsigned int recvq);
extern void report_classes(struct Client *sptr, const struct StatDesc *sd,
char *param);
extern unsigned int get_sendq(struct Client* cptr);
extern unsigned int get_recvq(struct Client *cptr);
extern int get_lag_min(struct Client *cptr);
extern int get_lag_factor(struct Client *cptr);
extern unsigned int get_client_maxchans(struct Client *acptr);
extern void class_send_meminfo(struct Client* cptr);
#endif /* INCLUDED_class_h */

1128
include/client.h Normal file

File diff suppressed because it is too large Load Diff

21
include/crule.h Normal file
View File

@ -0,0 +1,21 @@
/** @file crule.h
* @brief Interfaces and declarations for connection rule checking.
* @version $Id: crule.h 1231 2004-10-05 04:21:37Z entrope $
*/
#ifndef INCLUDED_crule_h
#define INCLUDED_crule_h
/*
* Proto types
*/
/*
* opaque node pointer
*/
struct CRuleNode;
extern void crule_free(struct CRuleNode** elem);
extern int crule_eval(struct CRuleNode* rule);
extern struct CRuleNode* crule_parse(const char* rule);
#endif /* INCLUDED_crule_h */

62
include/dbuf.h Normal file
View File

@ -0,0 +1,62 @@
/*
* IRC - Internet Relay Chat, include/dbuf.h
* Copyright (C) 1990 Markku Savela
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file
* @brief Interfaces and declarations for dealing with data buffers.
* @version $Id: dbuf.h 1216 2004-10-05 00:51:56Z entrope $
*/
#ifndef INCLUDED_dbuf_h
#define INCLUDED_dbuf_h
#ifndef INCLUDED_sys_types_h
#include <sys/types.h> /* size_t */
#define INCLUDED_sys_types_h
#endif
/*
* These two globals should be considered read only
*/
extern int DBufAllocCount;
extern int DBufUsedCount;
struct DBufBuffer;
/** Queue of data chunks. */
struct DBuf {
unsigned int length; /**< Current number of bytes stored */
struct DBufBuffer *head; /**< First data buffer, if length > 0 */
struct DBufBuffer *tail; /**< Last data buffer, if length > 0 */
};
/** Return number of bytes in a DBuf. */
#define DBufLength(dyn) ((dyn)->length)
/** Release the entire content of a DBuf. */
#define DBufClear(dyn) dbuf_delete((dyn), DBufLength(dyn))
/*
* Prototypes
*/
extern void dbuf_delete(struct DBuf *dyn, unsigned int length);
extern int dbuf_put(struct DBuf *dyn, const char *buf, unsigned int length);
extern const char *dbuf_map(const struct DBuf *dyn, unsigned int *length);
extern unsigned int dbuf_get(struct DBuf *dyn, char *buf, unsigned int length);
extern unsigned int dbuf_getmsg(struct DBuf *dyn, char *buf, unsigned int length);
extern void dbuf_count_memory(size_t *allocated, size_t *used);
#endif /* INCLUDED_dbuf_h */

49
include/destruct_event.h Normal file
View File

@ -0,0 +1,49 @@
#ifndef INCLUDED_destruct_event_h
#define INCLUDED_destruct_event_h
/*
* IRC - Internet Relay Chat, include/destruct_event.h
* Copyright (C) 2002 Carlo Wood <carlo@alinoe.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file
* @brief Functions for handling timed channel destruction events.
* @version $Id: destruct_event.h 1231 2004-10-05 04:21:37Z entrope $
*/
#ifndef INCLUDED_config_h
#include "config.h"
#endif
#ifndef INCLUDED_channel_h
#include "channel.h"
#endif
#ifndef INCLUDED_ircd_events_h
#include "ircd_events.h"
#endif
/** Structure describing a destruction event. */
struct DestructEvent {
struct DestructEvent* next_event; /**< Next event in the queue. */
struct DestructEvent* prev_event; /**< Previous event in the queue. */
time_t expires; /**< When the destruction should happen. */
struct Channel* chptr; /**< Channel to destroy. */
};
extern void schedule_destruct_event_1m(struct Channel* chptr);
extern void schedule_destruct_event_48h(struct Channel* chptr);
extern void remove_destruct_event(struct Channel* chptr);
extern void exec_expired_destruct_events(struct Event* ev);
#endif /* INCLUDED_destruct_event_h */

56
include/fileio.h Normal file
View File

@ -0,0 +1,56 @@
/** @file fileio.h
* @brief ANSI FILE* clone API declarations.
* @version $Id: fileio.h 1219 2004-10-05 01:45:24Z entrope $
*/
#ifndef INCLUDED_fileio_h
#define INCLUDED_fileio_h
#ifndef INCLUDED_sys_types_h
#include <sys/types.h> /* size_t */
#define INCLUDED_sys_types_h
#endif
struct stat;
/** A mirror of the ANSI FILE struct, but it works for any
* file descriptor. FileBufs are allocated when a file is opened with
* fbopen, and they are freed when the file is closed using fbclose.
* (Some OSes limit the range of file descriptors in a FILE*, for
* example to fit in "char".)
*/
typedef struct FileBuf FBFILE;
/*
* open a file and return a FBFILE*, see fopen(3)
*/
extern FBFILE *fbopen(const char *filename, const char *mode);
/*
* associate a file descriptor with a FBFILE*
* if a FBFILE* is associated here it MUST be closed using fbclose
* see fdopen(3)
*/
extern FBFILE *fdbopen(int fd, const char *mode);
/*
* close a file opened with fbopen, see fclose(3)
*/
extern void fbclose(FBFILE * fb);
/*
* return the next character from the file, EOF on end of file
* see fgetc(3)
*/
extern int fbgetc(FBFILE * fb);
/*
* return next string in a file up to and including the newline character
* see fgets(3)
*/
extern char *fbgets(char *buf, size_t len, FBFILE * fb);
/*
* write a null terminated string to a file, see fputs(3)
*/
extern int fbputs(const char *str, FBFILE * fb);
/*
* return the status of the file associated with fb, see fstat(3)
*/
extern int fbstat(struct stat *sb, FBFILE * fb);
#endif /* INCLUDED_fileio_h */

Some files were not shown because too many files have changed in this diff Show More