1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-12-16 19:08:07 +00:00

Compare commits

..

35 Commits

Author SHA1 Message Date
Alexander Barton
4726e36efc Changed version string back to "0.6.x-CVS". 2003-03-09 22:33:19 +00:00
Alexander Barton
3105bd9fff Updated documentation. 2003-03-09 20:16:57 +00:00
Alexander Barton
cb8ed9d5da ngIRCd now handles recursive calls to Conn_Close() correctly (from HEAD). 2003-03-09 20:16:46 +00:00
Alexander Barton
a156641afd Updated version number to 0.6.1 :-) 2003-01-21 21:23:34 +00:00
Alexander Barton
78752bbff8 Updated documentation. 2003-01-21 21:20:19 +00:00
Alexander Barton
90e6ec3f89 The server didn't validate weather the target user of a channel user mode
change is a valid channel member or not (from HEAD).
2003-01-21 21:05:19 +00:00
Alexander Barton
9810da343c - Non-memers of a channel could crash the server when trying to change its modes. (HEAD) 2003-01-17 19:08:57 +00:00
Alexander Barton
e8b99f4d3a - Updated documentation. 2003-01-17 19:07:15 +00:00
Alexander Barton
84efd5e969 - Removed strl[cat|cpy]() function calls ... 2003-01-08 23:13:45 +00:00
Alexander Barton
33927ee854 - Fixed up previous CHANINFO patch ... 2003-01-08 23:09:34 +00:00
Alexander Barton
3d46fc6036 - Changed semantics of Client_SetAway() [from HEAD]. 2003-01-08 23:09:04 +00:00
Alexander Barton
ac587adc69 - MODE returns the key and user limit for channel members correctly now. [Head] 2003-01-08 23:08:12 +00:00
Alexander Barton
2688829ddd - Updated documentation. 2003-01-08 23:07:57 +00:00
Alexander Barton
4294dd8043 - Updated documentation. 2003-01-08 20:36:57 +00:00
Alexander Barton
6b9ce1cb72 - Fixed up broken patch (once again -- *ARGL*) ... 2003-01-08 20:32:17 +00:00
Alexander Barton
72a4c0489f - CHANINFO: Fixed up broken fix ... 2003-01-08 20:22:57 +00:00
Alexander Barton
60a4085c38 - fixed up propagation of modes with arguments between servers. 2003-01-08 17:47:48 +00:00
Alexander Barton
5206ab302d - Updated documentation. 2003-01-08 17:47:43 +00:00
Alexander Barton
635afd660d - Updated documentation. 2003-01-05 23:04:12 +00:00
Alexander Barton
5b3d89312e - CVS date is in ISO format now (YYYY-MM-DD) [from HEAD]. 2003-01-04 10:58:15 +00:00
Alexander Barton
f7c1242979 - the server sets a correct default AWAY message when receiving a "MODE +a". 2003-01-02 18:03:05 +00:00
Alexander Barton
822d3d12c8 - Adjusted copyright banner to include 2003 :-) 2003-01-01 13:47:42 +00:00
Alexander Barton
7de53b1903 - Fixed up command forwarding: only to servers! (from CVS-HEAD) 2003-01-01 13:46:37 +00:00
Alexander Barton
9e3def72e0 - Updated documentation. 2003-01-01 13:46:06 +00:00
Alexander Barton
3da58202e6 - Fixed up bad test if we are still connected in KILL. 2002-12-31 15:48:33 +00:00
Alexander Barton
ec016a89e2 - Fixed up KILL once more: it can't kill other clients than valid users now. 2002-12-27 13:37:43 +00:00
Alexander Barton
1bcc64721f - Fixed KILL: you can't crash the server by killing yourself any more;
and ngIRCd no longer sends a QUIT to other servers after the KILL. (HEAD)
2002-12-26 19:01:29 +00:00
Alexander Barton
939ec25f72 - Changed version string to "0.6.x-CVS". 2002-12-26 18:48:44 +00:00
Alexander Barton
1f7024cb36 - Version 0.6.0 2002-12-24 13:54:09 +00:00
Alexander Barton
c2fcc98a55 - Updated Documentation for version 0.6.0 2002-12-24 13:53:54 +00:00
Alexander Barton
fe06c3200e - Dokumentation aktualisiert. 2002-12-22 23:50:59 +00:00
Alexander Barton
dd7ff82b8f - Version 0.6.0-pre2 2002-12-22 23:43:16 +00:00
Alexander Barton
f84cd22fe1 - Backports from CVS-HEAD (005-numeric, extended LUSERS reply). 2002-12-22 23:42:28 +00:00
Alexander Barton
3544d1bc40 - Version 0.6.0-pre1 2002-12-18 16:50:29 +00:00
Alexander Barton
6c88184b58 - Updated documentation. 2002-12-18 16:27:14 +00:00
67 changed files with 2372 additions and 3871 deletions

23
AUTHORS
View File

@@ -1,26 +1,13 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- AUTHORS and CONTRIBUTORS -- -- AUTHORS / Autoren --
Main Authors Alexander Barton, alex@arthur.ath.cx
~~~~~~~~~~~~
Alexander Barton, <alex@barton.de>, "alex"
Contributors
~~~~~~~~~~~~
Goetz Hoffart, <goetz@hoffart.de>
Ilja Osthoff, <i.osthoff@gmx.net>
Sean Reifschneider, <jafo-rpms@tummy.com>
--
$Id: AUTHORS,v 1.5 2003/04/21 21:33:18 alex Exp $

View File

@@ -7,57 +7,14 @@
ngIRCd is free software and published under the ngIRCd is free software and published under the
terms of the GNU General Public License. terms of the GNU General Public License.
-- ChangeLog -- -- ChangeLog / Aenderungen --
ngIRCd CVS-HEAD ngIRCd 0.6.x
- (none) - Conn_Close() now handles recurisive calls for the same link correctly.
ngIRCd 0.7.0-pre1 ngIRCd 0.6.1, 2002-01-21
- New signal handler (more secure, actions are executed outside).
- GCC: the compiler is now called with more warning options enabled.
- Replaced a lot of str[n]cpy(), str[n]cat() and sprintf() calls with the
more secure functions strlcpy(), strlcat() and snprintf(). On systems
that don't support strlcpy() and strlcat(), these functions are included
in the libngportab now (with prototypes in portab.h).
- If the server can't close a socket, it panics now. This is an error that
can't occur during normal operation so there is something broken.
- The order of log messages during disconnects is more "natural" now ;-)
- Cleaned up handling of server configuration structures: modifying and
removing servers during runtime works more reliable now.
- Compression code from "conn.[ch]" is now found in new "conn-zip.[ch]"
- Moved some connection functions from "conn.[ch]" to "conn-func.[ch]".
- New command CONNECT to enable and add server links. The syntax is not
RFC-compatible: use "CONNECT <name> <port>" to enable and connect an
configured server and "CONNECT <name> <port> <host> <mypwd> <peerpwd>"
to add a new server (ngIRCd tries to connect new servers only once!).
- Added DISCONNECT command ("DISCONNECT <name>") to disable servers.
- Restructured the documentation: Now the main language is English. The
german documentation has been removed (until there is a maintainer).
- Enhanced killing of users caused by a nickname collision.
- Better error detection for status code ("numerics") forwarding.
- Moved tool functions to own library: "libngtool".
- New command TRACE (you can trace only servers at the moment).
- New command HELP that lists all understood commands.
- There should no longer remain "unknown connections" (see e.g. LUSERS)
if an outgoing server link can't be established.
- Added AC_PREREQ(2.50) to configure.in for better autoconf compatibility.
- Conn_Close() now handles recursive calls for the same link correctly.
- ngIRCd can register itself with Rendezvous: to enable support pass the
new switch "--with-rendezvous" to configure.
- Added support for TCP Wrappers library: pass "--with-tcp-wrappers" to
configure to enable it.
- Changed some configure options to use "--with"/"--without" as prefix
instead of "--enable"/"--disable": "--without-syslog", "--without-zlib",
"--with-tcp-wrappers", and "--with-rendezvous".
- Better error reporting to clients on connect.
- Enhanced manual pages ngircd(8) and ngircd.conf(5).
- Documentation is now installed in $(datadir)/doc/ngircd.
- Enhanced hanling of NJOIN in case of nick collisions.
ngIRCd 0.6.1, 2003-01-21
- Fixed KILL: you can't crash the server by killing yourself any more, - Fixed KILL: you can't crash the server by killing yourself any more,
ngIRCd no longer sends a QUIT to other servers after the KILL, and you ngIRCd no longer sends a QUIT to other servers after the KILL, and you
@@ -68,7 +25,7 @@ ngIRCd 0.6.1, 2003-01-21
- The server sets a correct default AWAY message now when propagating - The server sets a correct default AWAY message now when propagating
between servers (bug introduced in 0.6.0). between servers (bug introduced in 0.6.0).
- Fixed up and enhanced CHANINFO command: channel keys and user limits - Fixed up and enhanced CHANINFO command: channel keys and user limits
are synchronized between servers now, too. are syncronized between servers now, too.
- MODE returns the key and user limit for channel members correctly now. - MODE returns the key and user limit for channel members correctly now.
- Non-members of a channel could crash the server when trying to change - Non-members of a channel could crash the server when trying to change
its modes or modes of its members. its modes or modes of its members.
@@ -437,4 +394,4 @@ ngIRCd 0.0.1, 31.12.2001
-- --
$Id: ChangeLog,v 1.189 2003/04/21 22:52:18 alex Exp $ $Id: ChangeLog,v 1.147.2.14 2003/03/09 20:16:57 alex Exp $

265
INSTALL
View File

@@ -1,161 +1,162 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- INSTALL -- -- INSTALL / Installation --
Ilja Osthoff, <ilja@glide.ath.cx>
+-----------------------------------------------------------------------+
I. Upgrade Information | Please note: English translations of some of the german documentation |
~~~~~~~~~~~~~~~~~~~~~~ | files can be found in the directory "doc/en" -- please have a look! |
+-----------------------------------------------------------------------+
Differences to version 0.6.x
- Some options of the configure script have been renamed:
--disable-syslog -> --without-syslog
--disable-zlib -> --without-zlib
Please call "./configure --help" to review the full list of options!
Differences to version 0.5.x
- Starting with version 0.6.0, other servers are identified using asynchronous
passwords: therefore the variable "Password" in [Server]-sections has been
replaced by "MyPassword" and "PeerPassword".
- New configuration variables, section [Global]: MaxConnections, MaxJoins
(see example configuration file "doc/sample-ngircd.conf"!).
II. Standard Installation 0. Update von frueheren Versionen
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ngIRCd is developed for UNIX-based systems, which means that the installation Unterschiede zu Version 0.5.x
on modern UNIX-like systems that are supported by GNU autoconf and GNU
automake ("configure") should be no problem.
The normal installation procedure after getting (and expanding) the source - Ab Version 0.6.0 werden asyncrone Passwoerter zur Identifikation anderer
files (using a distribution archive or CVS) is as following: Server, die Variable "Password" in [Server]-Abschnitten wird nicht mehr
unterstuetzt. Passwoerter fuer Server-Server-Links werden nun mit den
Variablen "MyPassword" und "PeerPassword" angegeben.
1) ./autogen.sh [only necessary when using CVS] - Neue Konfigurationsvariablen, Sektion [Global]: MaxConnections, MaxJoins
2) ./configure (vgl. auch Beispiel-Konfiguration "doc/sample-ngircd.conf"!)
3) make
4) make install
1): "autogen.sh" I. Standard-Installation
The first step, autogen.sh, is only necessary if the configure-script isn't
already generated. This never happens in official ("stable") releases in
tar.gz-archives, but when using CVS.
This step is therefore only interesting for developers.
autogen.sh produces the Makefile.in's, which are necessary for the configure
script itself, and some more files for make. To run autogen.sh you'll need
GNU autoconf and GNU automake (use recent versions! autoconf 2.53 and
automake 1.6.1 are known to work).
Again: "end users" do not need this step!
2): "./configure"
The configure-script is used to detect local system dependencies.
In the perfect case, configure should recognise all needed libraries, header
files and so on. If this shouldn't work, "./configure --help" shows all
possible options.
In addition, you can pass some command line options to "configure" to enable
and/or disable some features of ngIRCd. All these options are shown using
"./configure --help", too.
3): "make"
The make command uses the Makefiles produced by configure and compiles the
ngIRCd daemon.
4): "make install"
Use "make install" to install the server and a sample configuration file on
the local system. Normally, root privileges are necessary to complete this
step. If there is already an older configuration file present, it won't be
overwritten.
This files will be installed by default:
- /usr/local/sbin/ngircd: executable server
- /usr/local/etc/ngircd.conf: sample configuration (if not already present)
- /usr/local/share/doc/ngircd/: documentation
II. Useful make-targets
~~~~~~~~~~~~~~~~~~~~~~~
The Makefile produced by the configure-script contains always these useful
targets:
- clean: delete every product from the compiler/linker
next step: -> make
- distclean: the above plus erase all generated Makefiles
next step: -> ./configure
- maintainer-clean: erase all automatic generated files
next step: -> ./autogen.sh
III. Sample configuration file ngircd.conf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the sample configuration file, there are comments beginning with "#" OR
";" -- this is only for the better understanding of the file.
The file is separated in four blocks: [Global], [Operator], [Server], and
[Channel].
In the [Global] section, there is the main configuration like the server
name and the ports, on which the server should be listening. IRC operators
of this server are defined in [Operator] blocks. [Server] is the section
where server links are configured. And [Channel] blocks are used to
configure pre-defined ("persistent") IRC channels.
The meaning of the variables in the configuration file is explained in the
"doc/sample-ngircd.conf", which is used as sample configuration file in
/usr/local/etc after running "make install" (if you don't already have one)
and in the "ngircd.conf" manual page.
IV. Command line options
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
These parameters could be passed to the ngIRCd: ngIRCd ist fuer UNIXoide-Systeme konzipiert worden, das bedeutet, dass die
Installation auf einem modernen UNIX-aehnlichen System kein Problem dar-
stellen sollte. Das System muss nur von GNU automake und GNU autoconf
("configure") unterstuetzt werden.
Die Standard-Installation sieht so aus:
1) tar xzf ngircd-<Version>.tar.gz
2) cd ngircd-<Version>
3) ./autogen.sh [nur erforderlich, wenn ueber CVS bezogen]
4) ./configure
5) make
6) make install
zu 3): "autogen.sh"
Der erste Schritt, autogen.sh, ist nur notwendig, wenn das configure-Script
noch nicht vorhanden ist. Dies ist nie bei offiziellen ("stabilen") Versionen
in tar.gz-Archiven der Fall, jedoch immer, wenn der Source-Code ueber CVS
bezogen wurde.
Dieser Absatz ist also eigentlich ausschliesslich fuer Entwickler interessant.
autogen.sh erzeugt die fuer das configure-Script notwendigen Makefile.in's
sowie das configure-Script selber und weitere fuer den make-Lauf erforderliche
Dateien. Dazu wird sowohl GNU automake als auch GNU autoconf (in aktuellen
Versionen!) benoetigt.
(nochmal: "Endanwender" mussen diesen Schritt i.d.R. nicht ausfuehren!)
zu 4): "./configure"
Mit dem configure-Script wird ngIRCd, wie GNU Software meistens, an das
lokale System angepasst und die erforderlichen Makefile's erzeugt.
Im Optimalfall sollte configure alle benoetigten Libraries, Header etc. selber
erkennen und entsprechend reagieren. Sollte dies einmal nicht der Fall sein,
so zeigt "./configure --help" moegliche Optionen.
zu 5): "make"
Der make-Befehl bearbeitet die vom configure-Script erzeugten Makefile's und
uebersetzt den ngIRCd.
zu 6): "make install"
Mit "make install" wird der Server und ggf. eine Beispiels-Konfiguration
im System installiert; hierzu sind in der Regel root-Rechte erforderlich.
Eine bereits vorhandene Konfigurationsdatei wird nie ueberschrieben.
Folgende Dateien werden installiert:
- /usr/local/sbin/ngircd: ausfuehrbarer Server
- /usr/local/etc/ngircd.conf: Beispiel-Konfiguration, wenn nicht vorhanden
II. Nuetzliche make-Targets
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Die vom configure-Script erzeugten Makefile's enthalten immer die folgenden
nuetzlichen Targets:
- clean: alle Erzeugnisse des Compilers/Linkers loeschen.
Naechster Schritt: -> make
- distclean: zusaetzliche alle Makefile's loeschen.
Naechster Schritt: -> ./configure
- maintainer-clean: alle automat. erzeugten Dateien loeschen.
Naechster Schritt: -> ./autogen.sh
III. Konfigurationsdatei ngircd.conf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In der Konfigurationsdatei werden Kommentare durch "#" oder durch ";"
eingeleitet. Dieses dient nur der besseren Lesbarkeit.
Die Datei ist in drei Abschnitte unterteilt: [Global], [Operator] und
[Server]. Im [Global]-Teil werden die grundlegenden Einstellungen vor-
genommen, z.B. der Server-Name und die Ports, auf denen er Verbindungen
annehmen soll. In [Operator]-Abschnitten werden Server-Operatoren fest-
gelegt und unter [Server] werden die Einstellungen fuer die Verbindung
mit anderen Servern konfiguriert.
Die Bedeutung der einzelnen Variablen ist in der Beispiel-Konfiguration
"doc/sample-ngircd.conf" erklaert, die bei "make install" auch als
"ngircd.conf" in /usr/local/etc installiert wird, wenn dort noch keine
Konfigurationsdatei vorhanden ist.
IV. Kommandozeilen-Optionen
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Folgende Parameter koennen dem ngIRCd u.a. uebergeben werden:
-f, --config <file> -f, --config <file>
The daemon uses the file <file> as configuration file rather than Der Daemon wird angewiesen, statt der Standard-Konfigurationsdatei
the standard configuration /usr/local/etc/ngircd.conf. /usr/local/etc/ngircd.conf die Datei <file> einzulesen.
-n, --nodaemon -n, --nodaemon
ngIRCd should be running as a foreground process. ngIRCd soll im Fordergrund laufen; alle Meldungen werden zusaetzlich
zum Syslog auch auf der Konsole ausgegeben.
-p, --passive -p, --passive
Server-links won't be automatically established. Verbindungen zu anderen Servern (wie in der Konfigurationsdatei in
[Server]-Abschnitten definiert) werden nicht automatisch hergestellt.
--configtest --configtest
Reads, validates and dumps the configuration file as interpreted Die Konfigurationsdatei wird eingelesen, ueberprueft und so aus-
by the server. Then exits. gegeben, wie sie vom ngIRCd interpretiert wurde. Danach beendet
sich der Server wieder.
Use "--help" to see a short help text describing all available parameters Mit dem Parameter "--help" werden alle unterstuetzten Parameter angezeigt,
the server understands, with "--version" the ngIRCd shows its version mit "--version" die Versionsnummer. Bei beiden Parametern beendet sich der
number. In both cases the server exits after the output. Server nach der Ausgabe wieder.
-- --
$Id: INSTALL,v 1.16 2003/04/21 23:31:39 alex Exp $ $Id: INSTALL,v 1.9 2002/12/18 12:19:07 alex Exp $

File diff suppressed because it is too large Load Diff

36
NEWS
View File

@@ -1,41 +1,15 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- NEWS -- -- NEWS / Neuigkeiten --
ngIRCd CVS-HEAD
- (none)
ngIRCd 0.7.0-pre1
- New command CONNECT to enable and add server links. The syntax is not
RFC-compatible: use "CONNECT <name> <port>" to enable and connect an
configured server and "CONNECT <name> <port> <host> <mypwd> <peerpwd>"
to add a new server (ngIRCd tries to connect new servers only once!).
- Added DISCONNECT command ("DISCONNECT <name>") to disable servers.
- New command TRACE (you can trace only servers at the moment).
- New command HELP that lists all understood commands.
- ngIRCd can register itself with Rendezvous: to enable support pass the
new switch "--with-rendezvous" to configure.
- Added support for TCP Wrappers library: pass "--with-tcp-wrappers" to
configure to enable it.
- Changed some configure options to use "--with"/"--without" as prefix
insetead of "--enable"/"--disable": "--without-syslog", "--without-zlib",
"--with-tcp-wrappers", and "--with-rendezvous".
- Enhanced manual pages ngircd(8) and ngircd.conf(5).
- Documentation is now installed in $(datadir)/doc/ngircd.
Older news (sorry, only available in german language):
ngIRCd 0.6.0, 2002-12-24 ngIRCd 0.6.0, 2002-12-24
- beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR - beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR
@@ -165,4 +139,4 @@ ngIRCd 0.0.1, 31.12.2001
-- --
$Id: NEWS,v 1.54 2003/04/21 22:52:18 alex Exp $ $Id: NEWS,v 1.45.2.2 2002/12/24 13:53:54 alex Exp $

109
README
View File

@@ -1,86 +1,105 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- README -- -- README / Liesmich --
Ilja Osthoff, <ilja@glide.ath.cx> Ilja Osthoff, <ilja@glide.ath.cx>
I. Introduction +-----------------------------------------------------------------------+
~~~~~~~~~~~~~~~ | Please note: English translations of some of the german documentation |
| files can be found in the directory "doc/en" -- please have a look! |
+-----------------------------------------------------------------------+
ngIRCd is an Open-Source server for the Internet Relay Chat (IRC), which
is developed and published under the terms of the GNU General Public I. Einfuehrung
Licence (URL: http://www.gnu.org/licenses/gpl.html). ngIRCd means "next ~~~~~~~~~~~~~~
generation IRC daemon", it's written from scratch and not deduced from the
"grandfather of IRC daemons", the daemon of the IRCNet. ngIRCd ist ein Open-Source-Server fuer den Internet Relay Chat (IRC), der
unter der GNU General Public License (http://www.gnu.org/licenses/gpl.html)
entwickelt wird. ngIRCd steht fuer "next generation IRC daemon", er ist von
Grund auf neu geschrieben, also nicht wie die meisten anderen IRCd's vom
Urvater, dem Daemon des IRCNet abgeleitet.
II. Status II. Status
~~~~~~~~~~~ ~~~~~~~~~~~
At present, the ngIRCd is under active development, some features are not Zur Zeit befindet sich der ngIRCd noch in Entwicklung, manche Features sind
implemented, some only partly. noch nicht implementiert, andere nur teilweise.
Till today (more or less complete) implemented IRC-commands: Bisher (mehr oder wenig vollstaendig) implementierte IRC-Befehle:
ADMIN, AWAY, CHANINFO, CONNECT, DIE, DISCONNECT, ERROR, HELP, INVITE, ISON, ADMIN, AWAY, CHANINFO, CONNECT, DIE, ERROR, INVITE, ISON, JOIN, KICK, KILL,
JOIN, KICK, KILL, LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, NOTICE, OPER, PART,
NOTICE, OPER, PART, PASS, PING, PONG, PRIVMSG, QUIT, REHASH, RESTART, SERVER, PASS, PING, PONG, PRIVMSG, QUIT, RESTART, SERVER, SQUIT, TIME, TOPIC,
SQUIT, STATS, TIME, TOPIC, TRACE, USER, USERHOST, VERSION, WHO, WHOIS. USERHOST, USER, VERSION, WHO, WHOIS.
III. Features (or: why use ngIRCd?) III. Features (oder: warum gerade ngIRCd?)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- no problems with servers which have dynamic IP addresses - keine Probleme mit Servern, deren IP-Adresse dynamisch ist,
- simple, easy understandable configuration file, - einfache, uebersichtliche Konfigurationsdatei,
- freely published open-source C source code, - frei verfuegbarer C-Quellcode.
- ngIRCd will be developed on in the future. - ngIRCd wird aktiv weiterentwickelt.
- supported platforms (tested versions): AIX (3.2.5), A/UX (3.0.1), FreeBSD - unterstuetzte Plattformen (getestete Version): AIX (3.2.5), A/UX (3.0.1),
(4.5), HP-UX (10.20), IRIX (6.5), Linux (2.x), Mac OS X (10.x), NetBSD FreeBSD/i386 (4.5), HP-UX (10.20), IRIX (6.5), Linux (2.x), Mac OS X (10.x),
(1.5.2/i386, 1.5.3/m68k), Solaris (2.5.1, 2.6), and Windows with Cygwin. NetBSD (1.5.2/i386, 1.5.3/m68k), Solaris (2.5.1, 2.6), Windows mit Cygwin.
IV. Documentation IV. Dokumentation
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
More documentation can be found in the "doc/" directory and the homepage of Im Paket enthalten ist u.a.:
the ngIRCd: <http://arthur.ath.cx/~alex/ngircd/>.
- README: das Dokument, das Du gerade liest :-)
- INSTALL: Hinweise zur Installation des ngIRCd
- NEWS: sagt der Name schon :-)
- ChangeLog: die komplette History des ngIRCd
- doc/FAQ.txt: haeufige Fragen und Antworten zum ngIRCd
- doc/CVS.txt: Hinweise zum CVS-System
- doc/RFC.txt: Infos ueber die RFC's
- doc/sample-ngircd.conf: Beispiel-Konfigurationsdatei
- doc/README-AUX.txt: Installationshinweise fuer A/UX
- doc/README-BeOS.txt: dito fuer BeOS
- doc/en/: englischsprachige Dokumentation
V. Download V. Bezugsquellen
~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
The homepage of the ngIRCd is: <http://arthur.ath.cx/~alex/ngircd>; you Die Homepage des ngIRCd ist: <http://arthur.ath.cx/~alex/ngircd>; dort
will find the newest information about the ngIRCd and the most recent findest du immer die neusten Informationen ueber den ngIRCd und die aktuellen
("stable") releases there. freigegebenen ("stabilen") Releases.
If you are interested in the latest development versions (which are not Falls du dich fuer die aktuellen Entwicklungs-Versionen (die jedoch nicht
always stable), then please read the section "CVS" on the homepage and immer "stabil" sind) interessierst, dann lese bitte den Punkt "CVS" auf der
the file "doc/CVS.txt" which describes the use of CVS, the "Concurrent Homepage und die Datei "doc/CVS.txt", die die Verwendung des "Concurrent
Versioning System". Versioning System" (CVS) beschreibt.
VI. Bugs VI. Bugs
~~~~~~~~ ~~~~~~~~
If you find bugs in the ngIRCd (which might be there :-), please report Wenn du im ngIRCd Bugs finden solltest (so was soll ja auch vorkommen :-),
them at the following URL: dann lege bitte einen Bug-Report ueber diese URL an:
<http://arthur.ath.cx/~alex/ngircd/#bugs> <http://arthur.ath.cx/~alex/ngircd/#bugs>
There you can read about known bugs and limitations, too. Dort kannst du dich auch ueber bekannte Fehler informieren.
If you have critics, patches or something else, please feel free to post a Falls du noch Anregungen, Kritik, Patches etc. pp. zum ngIRCd hast, dann
mail to: <alex@barton.de> or <alex@arthur.ath.cx> bitte einfach eine Mail an <alex@barton.de> oder <alex@arthur.ath.cx>
schreiben.
-- --
$Id: README,v 1.17 2003/03/09 22:03:58 alex Exp $ $Id: README,v 1.14 2002/11/24 18:48:59 alex Exp $

View File

@@ -1,14 +1,16 @@
#!/bin/sh #!/bin/sh
# #
# $Id: autogen.sh,v 1.6 2003/04/13 22:34:17 alex Exp $ # $Id: autogen.sh,v 1.3 2002/03/12 14:37:51 alex Exp $
# #
export WANT_AUTOMAKE=1.6 if [ -f configure ]; then
echo "autogen.sh: configure-Skript existiert bereits ..."
fi
aclocal && \ aclocal && \
autoheader && \ autoheader && \
automake --add-missing && \ automake --add-missing && \
autoconf && \ autoconf && \
echo "Okay, autogen.sh done." echo "Okay, autogen.sh war erfolgreich."
# -eof- # -eof-

View File

@@ -8,16 +8,16 @@
# (at your option) any later version. # (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information. # Please read the file COPYING, README and AUTHORS for more information.
# #
# $Id: configure.in,v 1.89 2003/04/21 10:51:44 alex Exp $ # $Id: configure.in,v 1.69.2.6 2003/03/09 22:33:19 alex Exp $
# #
# -- Initialisierung -- # -- Initialisierung --
AC_INIT
AC_PREREQ(2.50) AC_PREREQ(2.50)
AC_INIT(ngircd, CVSHEAD)
AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
AC_CANONICAL_TARGET AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(1.6) AC_CONFIG_SRCDIR(src/config.h.in)
AM_INIT_AUTOMAKE(ngircd,0.6.x-CVS)
AM_CONFIG_HEADER(src/config.h) AM_CONFIG_HEADER(src/config.h)
# -- Templates fuer config.h -- # -- Templates fuer config.h --
@@ -28,9 +28,7 @@ AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant]) AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
AH_TEMPLATE([USE_SYSLOG], [Define if syslog should be used for logging]) AH_TEMPLATE([USE_SYSLOG], [Define if syslog should be used for logging])
AH_TEMPLATE([USE_ZLIB], [Define if zlib compression should be enabled]) AH_TEMPLATE([USE_ZLIB], [Define if zlib compression should be enabled])
AH_TEMPLATE([USE_TCPWRAP], [Define if TCP wrappers should be used])
AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used]) AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
AH_TEMPLATE([RENDEZVOUS], [Define if Rendezvous support should be included])
AH_TEMPLATE([TARGET_OS], [Target operating system name]) AH_TEMPLATE([TARGET_OS], [Target operating system name])
AH_TEMPLATE([TARGET_VENDOR], [Target system vendor]) AH_TEMPLATE([TARGET_VENDOR], [Target system vendor])
@@ -57,23 +55,16 @@ AC_C_CONST
# -- Defines -- # -- Defines --
if test `uname` = "Linux"; then
# define _POSIX_SOURCE, _GNU_SOURCE and _BSD_SOURCE when compiling
# on Linux (glibc-based systems):
AC_MSG_RESULT([detected Linux, defining _POSIX_SOURCE, _GNU_SOURCE and _BSD_SOURCE])
add_DEFINES="-D_POSIX_SOURCE -D_GNU_SOURCE -D_BSD_SOURCE $add_DEFINES"
fi
if test `uname` = "A/UX"; then if test `uname` = "A/UX"; then
# define _POSIX_SOURCE when compiling on A/UX: # unter A/UX sollte _POSIX_SOURCE definiert sein.
AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE]) AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE])
add_DEFINES="-D_POSIX_SOURCE $add_DEFINES" CFLAGS="$CFLAGS -D_POSIX_SOURCE"
fi fi
if test `uname` = "HP-UX"; then if test `uname` = "HP-UX"; then
# define _XOPEN_SOURCE_EXTENDED when compiling on HP-UX (11.11): # unter HP-UX 11.11 muss _XOPEN_SOURCE_EXTENDED definiert sein.
AC_MSG_RESULT([detected HP-UX, defining _XOPEN_SOURCE_EXTENDED]) AC_MSG_RESULT([detected HP-UX, defining _XOPEN_SOURCE_EXTENDED])
add_DEFINES="-D_XOPEN_SOURCE_EXTENDED $add_DEFINES" CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
fi fi
# -- Header -- # -- Header --
@@ -89,7 +80,7 @@ AC_CHECK_HEADERS([ \
strings.h sys/socket.h sys/time.h unistd.h \ strings.h sys/socket.h sys/time.h unistd.h \
],,AC_MSG_ERROR([required C header missing!])) ],,AC_MSG_ERROR([required C header missing!]))
AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdint.h varargs.h]) AC_CHECK_HEADERS(arpa/inet.h ctype.h malloc.h stdint.h sys/select.h varargs.h)
# -- Datentypen -- # -- Datentypen --
@@ -126,92 +117,44 @@ AC_FUNC_STRFTIME
AC_CHECK_FUNCS([ \ AC_CHECK_FUNCS([ \
bind gethostbyaddr gethostbyname gethostname inet_ntoa memmove \ bind gethostbyaddr gethostbyname gethostname inet_ntoa memmove \
memset setsockopt socket strcasecmp strchr strerror strstr waitpid \ memset select setsockopt socket strcasecmp strchr strerror \
strstr waitpid \
],,AC_MSG_ERROR([required function missing!])) ],,AC_MSG_ERROR([required function missing!]))
AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strlcpy strlcat) AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf)
AC_CHECK_FUNCS(select,[AC_CHECK_HEADERS(sys/select.h)],
AC_MSG_ERROR([required function select() is missing!])
)
# -- Konfigurationsoptionen -- # -- Konfigurationsoptionen --
x_syslog_on=no x_syslog_on=no
AC_ARG_WITH(syslog, AC_ARG_ENABLE(syslog,
[ --without-syslog disable syslog (autodetected by default)], [ --disable-syslog disable syslog (autodetected by default)],
[ if test "$withval" = "yes"; then [ if test "$enableval" = "yes"; then
AC_CHECK_LIB(be, syslog) AC_CHECK_HEADER(syslog.h, x_syslog_on=yes,
AC_CHECK_FUNCS(syslog, x_syslog_on=yes, AC_MSG_ERROR([Can't enable syslog: syslog.h not found!])
AC_MSG_ERROR([Can't enable syslog!])
) )
fi fi
], ],
[ [ AC_CHECK_HEADER(syslog.h, x_syslog_on=yes) ]
AC_CHECK_LIB(be, syslog)
AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
]
) )
if test "$x_syslog_on" = "yes"; then if test "$x_syslog_on" = "yes"; then
AC_DEFINE(USE_SYSLOG, 1) AC_DEFINE(USE_SYSLOG, 1)
AC_CHECK_HEADERS(syslog.h) AC_CHECK_LIB(be,syslog)
fi fi
x_zlib_on=no x_zlib_on=no
AC_ARG_WITH(zlib, AC_ARG_ENABLE(zlib,
[ --without-zlib disable zlib compression (autodetected by default)], [ --disable-zlib disable zlib compression (autodetected by default)],
[ if test "$withval" = "yes"; then [ if test "$enableval" = "yes"; then
AC_CHECK_LIB(z, deflate) AC_CHECK_HEADER(zlib.h, x_zlib_on=yes,
AC_CHECK_FUNCS(deflate, x_zlib_on=yes, AC_MSG_ERROR([Can't enable zlib: zlib.h not found!])
AC_MSG_ERROR([Can't enable zlib!])
) )
fi fi
], ],
[ AC_CHECK_LIB(z, deflate) [ AC_CHECK_HEADER(zlib.h, x_zlib_on=yes) ]
AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
]
) )
if test "$x_zlib_on" = "yes"; then if test "$x_zlib_on" = "yes"; then
AC_DEFINE(USE_ZLIB, 1) AC_DEFINE(USE_ZLIB, 1)
AC_CHECK_HEADERS(zlib.h) AC_CHECK_LIB(z,deflate)
fi
x_tcpwrap_on=no
AC_ARG_WITH(tcp-wrappers,
[ --with-tcp-wrappers enable TCP wrappers support],
[ if test "$withval" = "yes"; then
AC_CHECK_LIB(wrap, tcpd_warn)
AC_MSG_CHECKING(for hosts_access)
AC_TRY_LINK([
#include <tcpd.h>
],[
void *ptr;
ptr = hosts_access;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(USE_TCPWRAP, 1)
x_tcpwrap_on=yes
],[
AC_MSG_RESULT(no)
AC_MSG_ERROR([Can't enable TCP wrappers!])
])
fi
]
)
x_rendezvous_on=no
AC_ARG_WITH(rendezvous,
[ --with-rendezvous enable support for "Rendezvous"],
[ if test "$withval" = "yes"; then
AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_rendezvous_on=yes,
AC_MSG_ERROR([Can't enable Rendezvous!])
)
fi
]
)
if test "$x_rendezvous_on" = "yes"; then
AC_DEFINE(RENDEZVOUS, 1)
AC_CHECK_HEADERS(DNSServiceDiscovery/DNSServiceDiscovery.h mach/port.h)
fi fi
x_ircplus_on=yes x_ircplus_on=yes
@@ -223,7 +166,6 @@ if test "$x_ircplus_on" = "yes"; then
AC_DEFINE(IRCPLUS, 1) AC_DEFINE(IRCPLUS, 1)
fi fi
x_sniffer_on=no; x_debug_on=no
AC_ARG_ENABLE(sniffer, AC_ARG_ENABLE(sniffer,
[ --enable-sniffer enable IRC traffic sniffer (enables debug mode)], [ --enable-sniffer enable IRC traffic sniffer (enables debug mode)],
if test "$enableval" = "yes"; then if test "$enableval" = "yes"; then
@@ -240,7 +182,6 @@ if test "$x_debug_on" = "yes"; then
AC_DEFINE(DEBUG, 1) AC_DEFINE(DEBUG, 1)
fi fi
x_strict_rfc_on=no
AC_ARG_ENABLE(strict-rfc, AC_ARG_ENABLE(strict-rfc,
[ --enable-strict-rfc strict RFC conformance -- may break clients!], [ --enable-strict-rfc strict RFC conformance -- may break clients!],
if test "$enableval" = "yes"; then if test "$enableval" = "yes"; then
@@ -249,6 +190,7 @@ AC_ARG_ENABLE(strict-rfc,
fi fi
) )
# -- Definitionen -- # -- Definitionen --
AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" ) AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
@@ -258,35 +200,31 @@ AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
# -- Variablen -- # -- Variablen --
if test "$GCC" = "yes"; then if test "$GCC" = "yes"; then
the_CFLAGS="-Wmissing-declarations -Wpointer-arith -Wstrict-prototypes" CFLAGS="-Wall $CFLAGS"
add_CFLAGS="-Wall -W -ansi -pedantic $CFLAGS $CFLAGS_ADD"
else
the_CFLAGS="$CFLAGS"
add_CFLAGS="$CFLAGS_ADD"
fi fi
CFLAGS="$the_CFLAGS $add_CFLAGS $add_DEFINES -DSYSCONFDIR='\"\$(sysconfdir)\"'" the_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
# -- Ausgabe der Dateien -- # -- Ausgabe der Dateien --
AC_OUTPUT([ \ AC_OUTPUT([ \
Makefile \ Makefile \
doc/Makefile \ doc/Makefile \
doc/en/Makefile \
MacOSX/Makefile \ MacOSX/Makefile \
MacOSX/ngircd.pbproj/Makefile \ MacOSX/ngircd.pbproj/Makefile \
src/Makefile \ src/Makefile \
src/portab/Makefile \ src/portab/Makefile \
src/tool/Makefile \
src/ngircd/Makefile \ src/ngircd/Makefile \
src/testsuite/Makefile \ src/testsuite/Makefile \
man/Makefile \ man/Makefile \
contrib/Makefile \ contrib/Makefile \
]) ])
# -- Result -- # -- Ergebnis --
echo
echo "ngIRCd has been configured with the following options:"
echo echo
# Someone please show me a better way :) [borrowed by OpenSSH] # Someone please show me a better way :) [borrowed by OpenSSH]
@@ -294,58 +232,26 @@ B=`eval echo ${bindir}` ; B=`eval echo ${B}`
S=`eval echo ${sbindir}` ; S=`eval echo ${S}` S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}` C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
M=`eval echo ${mandir}` ; M=`eval echo ${M}` M=`eval echo ${mandir}` ; M=`eval echo ${M}`
D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}`
echo " Host: ${host}" echo " host: ${host}"
echo " Compiler: ${CC}" echo " compiler: ${CC}"
echo " Compiler flags: ${the_CFLAGS}" echo " compiler flags: ${the_CFLAGS}"
test -n "$add_CFLAGS" && echo " ${add_CFLAGS}" echo " preprocessor flags: ${CPPFLAGS}"
test -n "$add_DEFINES" && echo " ${add_DEFINES}" echo " linker flags: ${LDFLAGS}"
test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}" echo " libraries: ${LIBS}"
test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
test -n "$LIBS" && echo " Libraries: ${LIBS}"
echo echo
echo " 'ngircd' binary: $S" echo " 'ngircd' binary: $S"
echo " Configuration file: $C" echo " configuration file: $C"
echo " Manual pages: $M" echo " manual pages: $M"
echo " Documentation: $D"
echo echo
echo $ECHO_N " Syslog support: $ECHO_C" echo $ECHO_N " active options: $ECHO_C"
test "$x_syslog_on" = "yes" \ test "$x_syslog_on" = "yes" && echo $ECHO_N "Syslog $ECHO_C"
&& echo $ECHO_N "yes $ECHO_C" \ test "$x_zlib_on" = "yes" && echo $ECHO_N "zLib $ECHO_C"
|| echo $ECHO_N "no $ECHO_C" test "$x_debug_on" = "yes" && echo $ECHO_N "Debug $ECHO_C"
echo $ECHO_N " Enable debug code: $ECHO_C" test "$x_sniffer_on" = "yes" && echo $ECHO_N "Sniffer $ECHO_C"
test "$x_debug_on" = "yes" \ test "$x_strict_rfc_on" = "yes" && echo $ECHO_N "Strict-RFC $ECHO_C"
&& echo "yes" \ test "$x_ircplus_on" = "yes" && echo $ECHO_N "IRC+ $ECHO_C"
|| echo "no" echo; echo
echo $ECHO_N " zlib compression: $ECHO_C"
test "$x_zlib_on" = "yes" \
&& echo $ECHO_N "yes $ECHO_C" \
|| echo $ECHO_N "no $ECHO_C"
echo $ECHO_N " IRC sniffer: $ECHO_C"
test "$x_sniffer_on" = "yes" \
&& echo "yes" \
|| echo "no"
echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
test "$x_tcpwrap_on" = "yes" \
&& echo $ECHO_N "yes $ECHO_C" \
|| echo $ECHO_N "no $ECHO_C"
echo $ECHO_N " Strict RFC mode: $ECHO_C"
test "$x_strict_rfc_on" = "yes" \
&& echo "yes" \
|| echo "no"
echo $ECHO_N " Rendezvous support: $ECHO_C"
test "$x_rendezvous_on" = "yes" \
&& echo $ECHO_N "yes $ECHO_C" \
|| echo $ECHO_N "no $ECHO_C"
echo $ECHO_N " IRC+ protocol: $ECHO_C"
test "$x_ircplus_on" = "yes" \
&& echo "yes" \
|| echo "no"
echo
# -eof- # -eof-

View File

@@ -1,5 +1,5 @@
%define name ngircd %define name ngircd
%define version CurrentCVS %define version 0.6.1
%define release 1 %define release 1
%define prefix %{_prefix} %define prefix %{_prefix}

View File

@@ -1,56 +1,64 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- CVS.txt -- -- CVS.txt --
The source code of ngIRCd is maintained using the "Concurrent Versions Die Sourcen des ngIRCd werden mit dem "Concurrent Versions System" (CVS)
System" (CVS). Thereby several developers can work with the source tree at verwaltet. Somit koennen ohne Probleme mehrere Leute gleichzeitig die Sourcen
the same time. bearbeitet.
I. Anonymous read-only Access I. Anonymer "Nur-Lesen"-Zugang
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To access the source tree anonymously in read-only mode, follow these steps: Anonymer Zugriff auf die CVS-Repository von ngIRCd ist im "nur-lesen"-Modus
moeglich. Dazu sind folgende Schritte noetig:
Login to the CVS server: Beim CVS-Server anmelden
$ cvs -d:pserver:anonymous@arthur.ath.cx:/usr/local/CVS/ngircd login $ cvs -d:pserver:anonymous@arthur.ath.cx:/usr/local/CVS/ngircd login
Use "anonymous" as user name and no password (just hit Return). Now you can Als Benutzername wird "anonymous" mit einem leeren Passwort verwendet.
check out the sources: Nun ein "Check-Out" der Quellcodes durchfuehren:
$ cvs -d:pserver:anonymous@arthur.ath.cx:/usr/local/CVS/ngircd checkout ngircd $ cvs -d:pserver:anonymous@arthur.ath.cx:/usr/local/CVS/ngircd checkout ngircd
Thereby a new folder "ngircd" will be created containing all the individual Dadurch wird im aktuellen Verzeichnis der neue Ordner "ngircd" mit allen
source files. Quell-Dateien des ngIRCd erzeugt.
This is the "working folder", all CVS commands will be executed from within Dieses ist der "Arbeitsordner", alle CVS-Befehle werden in Zukunft aus
this folder in the future. diesem Ordner bzw. einem Unterordner davon ausgefuehrt.
Please note: When checking out a fresh copy of ngIRCd from CVS, the Wichtig: wenn ngIRCd "frisch" aus dem CVS compiliert werden soll, so
configure script doesn't exist; you have to run the autogen.sh shell script existiert das configure-Script noch nicht. Dieses muss zunaechst mit dem
(which is included in the source tree) to generate it. This requires you to Script "autogen.sh" erzeugt werden. Letzteres setzt ein installiertes GNU
have GNU automake and GNU autoconf installed on your system. automake und GNU autoconf voraus!
Updating the CVS tree: CVS-Tree aktualisieren:
$ cvs update -d -P [<filename>] $ cvs update
You can update a single file or the complete source tree. Dieser Befehl aktualisiert alle Dateien im aktuellen Verzeichnis sowie allen
Unterverzeichnissen.
$ cvs update <filename>
So kann eine einzelne Datei aktualisiert werden (auch dann, wenn sie lokal
z.B. geloescht wurde -- praktisch, um eigene "Experimente" rueckgaengig zu
machen ;-))
III. Write Access III. Schreibzugriff
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
If you want to contribute a couple of patches and write access to the CVS Wer Schreibzugriff auf die CVS-Repository wuenscht, der moege sich bitte
repository would be handy, please contact Alex Barton, <alex@barton.de>. mit Alex Barton, <alex@barton.de> in Verbindung setzen.
-- --
$Id: CVS.txt,v 1.7 2003/03/26 22:34:33 alex Exp $ $Id: CVS.txt,v 1.5 2002/02/15 15:15:22 alex Exp $

View File

@@ -1,63 +1,61 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- FAQ: Frequently Asked Questions -- -- FAQ: Frequently Asked Questions --
I. General I. Allgemein
~~~~~~~~~~ ~~~~~~~~~~~~
Q: Is it possible to link the ngIRCd with non-ngIRCd servers? Q: Kann der ngIRCd im Netz zusammen mit "normalen" Servern betrieben werden?
A: Yes. ngIRCd is compatible to the original ircd used by IRCNet. Actually A: Ja. ngIRCd ist zum Original kompatibel, getestet wird dies zur Zeit mit
this is being tested with version 2.10.3p3. der Version 2.10.3p3 des ircd.
Q: Is there a homepage with further information and downloads? Q: Gibt es eine Homepage mit Informationen und Downloads?
A: Yes. Please visit <http://arthur.ath.cx/~alex/ngircd/>. A: Ja. Die URL ist <http://arthur.ath.cx/~alex/ngircd/>.
II. Compilation II. Compilieren
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
Q: I did a "CVS checkout" but can't execute ./configure because the script Q: Ich habe die Sourcen von ngIRCd ueber CVS installiert. Nun kann ich
is missing in the generated directory!? ./configure nicht ausfuehren, da es nicht existiert!?
A: When using development versions via CVS, the configure script as well as A: Bei Builds direkt aus dem CVS-Tree muss das configure-Script zunaechst
the Makefile.in templates must be generated using GNU automake and GNU durch GNU autoconf sowie die Makefile.in's durch GNU automake generiert
autoconf. To simplify this task run the ./autogen.sh script which will werden. Um dies zu vereinfachen existiert das Script "./autogen.sh".
execute the required tools for you; then continue with executing the GNU automake und GNU autoconf werden -- im Gegensatz zu Builds aus den
./configure script as usual. Sourcen eines .tar.gz-Archivs -- hierbei benoetigt!
Q: The ./autogen.sh script complains "aclocal: command not found". Q: ./autogen.sh bricht mit der Meldung "autoheader: command not found" ab.
A: GNU automake is missing on your system but required for building CVS A: GNU autoconf ist nicht installiert, wird jedoch bei Builds direkt aus
versions of ngIRCd. Install GNU automake 1.6 or later and try again. dem CVS-Tree benoetigt.
Q: The ./autogen.sh script stops with "autoheader: command not found". Q: ./autogen.sh bricht mit der Meldung "autoconf: Undefined macros:
A: GNU autoconf is missing on your system but required for building CVS AC_FUNC_MALLOC" bzw. "AC_CONFIG_SRCDIR" ab.
versions of ngIRCd. Install GNU autoconf 2.52 or later and try again. A: Auf dem System ist eine zu alte Version von GNU autoconf installiert.
Ein Update auf z.B. Version 2.52 loest dieses Problem (eine installiete
Q: The ./autogen.sh script fails and the message "automake: configure.in: alte Version sollte ggf. zunaechst entfernt werden, bei RPM-Paketen z.B.
AM_INIT_AUTOMAKE must be used" is displayed. mit dem Befehl "rpm -e autoconf").
A: Most probably you are using version 1.5 of GNU automake which seems to be
incompatible to the build system of ngIRCd. Solution: upgrade to at least
version 1.6 of GNU automake.
(If you are using Debian 3.0 "Woody" you can try to downgrade to version
1.4 of GNU automake shipped with this distribution; it should work, too.)
III. Bugs!? III. Bugs!?
~~~~~~~~~~~ ~~~~~~~~~~~
Q: Is there a list of known bugs and desired feature enhancements? Q: Gibt es eine Liste der bekannten Bugs bzw. Feature-Wuensche?
A: Yes. Have a look at the bug tracking system (Bugzilla) for ngIRCd located A: Ja. Es existiert ein Bug-Tracking-System fuer den ngIRCd (Bugzilla):
at <http://arthur.ath.cx/bugzilla/ngircd/>. There you can file bug reports URL: <http://arthur.ath.cx/bugzilla/ngircd/>. Dort koennen Bugs ge-
and feature requests as well as search the bug database. meldet und Feature-Wunsche kundgetan werden. Bekannte Bugs koennen in
der Datenbank gesucht und aufgelistet werden.
Einen Account zum Suchen und Melden von Bugs bzw. Feature-Wuenschen
kannst du dir dort selber anlegen.
Q: What should I do if I found a bug? Q: Was mache ich, wenn ich einen Bug gefunden habe?
A: Please file a bug report at <http://arthur.ath.cx/bugzilla/ngircd/>! A: Am besten traegst du ihn in das Bug-Tracking-System des ngIRCd ein:
The author of the particular component will be notified automagically :-) URL: <http://arthur.ath.cx/bugzilla/ngircd/>
-- --
$Id: FAQ.txt,v 1.5 2003/04/05 11:37:17 alex Exp $ $Id: FAQ.txt,v 1.2 2002/02/19 20:05:02 alex Exp $

View File

@@ -1,6 +1,6 @@
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) # Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
# #
# Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen # Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# der GNU General Public License (GPL), wie von der Free Software Foundation # der GNU General Public License (GPL), wie von der Free Software Foundation
@@ -9,31 +9,21 @@
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. # der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
# #
# $Id: Makefile.am,v 1.16 2003/04/21 08:01:29 alex Exp $ # $Id: Makefile.am,v 1.10 2002/09/16 10:35:06 alex Exp $
# #
SUBDIRS = en
EXTRA_DIST = CVS.txt FAQ.txt Protocol.txt README-AUX.txt \ EXTRA_DIST = CVS.txt FAQ.txt Protocol.txt README-AUX.txt \
README-BeOS.txt RFC.txt sample-ngircd.conf README-BeOS.txt RFC.txt sample-ngircd.conf
maintainer-clean-local: maintainer-clean-local:
rm -f Makefile Makefile.in rm -f Makefile Makefile.in
docdir = $(datadir)/doc/$(PACKAGE)
documents = $(EXTRA_DIST) ../AUTHORS ../COPYING ../ChangeLog ../INSTALL \
../NEWS ../README
install-data-hook: install-data-hook:
$(mkinstalldirs) $(DESTDIR)$(sysconfdir) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
if [ ! -f $(DESTDIR)$(sysconfdir)/ngircd.conf ]; then \ if [ ! -f $(DESTDIR)$(sysconfdir)/ngircd.conf ]; then \
$(INSTALL) -m 600 -c $(srcdir)/sample-ngircd.conf $(DESTDIR)$(sysconfdir)/ngircd.conf; \ $(INSTALL) -m 600 -c $(srcdir)/sample-ngircd.conf $(DESTDIR)$(sysconfdir)/ngircd.conf; \
fi fi
$(mkinstalldirs) $(DESTDIR)$(docdir)
for f in $(documents); do \
$(INSTALL) -m 644 -c $(srcdir)/$$f $(DESTDIR)$(docdir)/; \
done
uninstall-hook:
rm -rf $(DESTDIR)$(docdir)
# -eof- # -eof-

View File

@@ -1,107 +1,115 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- Protocol.txt -- -- Protocol.txt --
I. Compatibility I. Kompatibilitaet
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
The ngIRCd implements the Internet Relay Chat (IRC) protocol version 2.10 Der ngIRCd haelt sich an das IRC-Protokoll Version 2.10, wie es in den RFCs
as defined in RFC ("request for comment") 1459 and 2810-2813. These (and 1459 und 2810-2813 beschrieben ist. Diese (und ggf. weitere fuer den ngIRCd
probably further relevant RFCs) are listed in doc/RFC.txt. relevante) RFCs sind in RFC.txt aufgefuehrt.
Unfortunately, even the "original" ircd doesn't follow these specifications Leider verhaelt sich aber schon der "Originalserver" nicht immer genau so,
in all details. But because the ngIRCd should be a fully compatible wie es in den RFCs beschrieben ist. Da der ngIRCd aber ein Ersatz fuer
replacement for this server ("ircd") it tries to emulate these differences. eben diesen Server sein soll, werden diese Abweichungen in der Regel vom
ngIRCd emuliert um die Kompatibilitaet zu wahren.
If you don't like this behavior please ./configure the ngIRCd using the Sollte dieses Verhalten nicht erwuenscht sein, so kann mit der configure-
"--enable-strict-rfc" command line option. But please not: not all IRC Option "--enable-strict-rfc" der ngIRCd so compiliert werden, dass er sich
clients are compatible with such an server, some can't even connect at all! strikt an die entsprechenden RFCs haelt.
Therefore this option isn't desired for "normal operation".
ACHTUNG: an einem so compilierten Server koennen sich andere Server und
Clients, die sich nicht genau an das Protokoll halten, u.U. nicht mehr
anmelden oder alle Funktionen nutzen! In der Regel ist diese Option daher
nicht erwuenscht.
II. The IRC+ Protocol II. Das IRC+-Protokoll
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
Starting with version 0.5.0, the ngIRCd extends the original IRC protocol Der ngIRCd unterstuetzt als Erweiterung zum IRC-Protokoll wie es in den RFCs
as defined in RFC 2810-2813. This enhanced protocol is named "IRC+". It is 2810-2813 beschrieben ist, das IRC+-Protokoll. Dieses Protokoll ist dabei
backwards compatible to the "plain" IRC protocol and will only be used by kompatibel zum IRC-Protokoll und wird nur verwendet, wenn der ngIRCd fest-
the ngIRCd if it detects that the peer supports it as well. stellt, dass ein connectierter Server ebenfalls dieses erweiterte Protokoll
unterstuetzt.
The "PASSV" command is used to detect the protocol and peer versions (see Die Protokoll- und Server-Erkennung wird mit dem "PASS"-Befehl durchgefuehrt
RFC 2813, section 4.1.1). (vgl. RFC 2813, Sektion 4.1.1):
II.1 Register new server link II.1 neuen Server-Link registrieren
Command: PASS Befehl: PASS
Parameters: <password> <version> <flags> [<options>] Parameter: <password> <version> <flags> [<options>]
Used by: servers only (with these parameters) Fuer: mit dieser Syntax nur Server
<password> is the password for this new server link as defined in the server <password> enthaelt das Passwort fur den neu aufzubauenden Server-Link,
configuration which is sent to the peer or received from it. so wie es in der Konfigurationsdatei definiert wurde.
<version> consists of two parts and is at least 4, at most 14 characters <version> setzt sich aus zwei Teilen zusammen und ist mindestens 4, maximal
long: the first four bytes contain the IRC protocol version number, whereas 14 Zeichen lang: die ersten vier Bytes enthalten die Versionsnummer des
the first two bytes represent the major version, the last two bytes the unterstuetzten IRC-Protokolls, wobei die ersten zwei Bytes die Major-, die
minor version (the string "0210" indicates version 2.10, e.g.). letzten beiden die Minor-Revision angeben. Der String "0210" steht also
fuer Protokollversion 2.10.
Die folgenden (optionalen!) 10 Bytes enthalten eine von der jeweiligen
Implementation abhaengige Versionsnummer. Server, die das IRC+-Protokoll
unterstuetzen, liefern hier "-IRC+".
The following optional(!) 10 bytes contain an implementation-dependent <flags> setzt sich ebenfalls aus zwei Bestandteilen zusammen und ist
version number. Servers supporting the IRC+ protocol as defined in this maximal 100 Bytes lang. Getrennt werden die beiden Teile mit dem Zeichen
document provide the string "-IRC+" here. "|". Der erste Teil enthaelt den Namen der Implementation, der ngIRCd
liefert hier z.B. "ngIRCd", der Originalserver "IRC". Anhand dieser "ID"
kann zwischen Serverimplementationen unterschieden werden. Der zweite Teil
(nach dem "|") ist implementationsabhaengig und wird nur ausgewertet,
wenn die Gegenseite das IRC+-Protokoll unterstuetzt. In diesem Fall wird
folgende Syntax erwartet: "<serverversion>[:<serverflags>]".
<flags> consists of two parts separated with the character "|" and is at <serverversion> ist hier eine ASCII-Klartext-Darstellung der Versionsnummer,
most 100 bytes long. The first part contains the name of the implementation <serverflags> zeigt die vom Server unterstuetzten Erweiterungen an (und
(ngIRCd sets this to "ngIRCd", the original ircd to "IRC", e.g.). The second kann die leere Menge sein).
part is implementation-dependent and should only be parsed if the peer
supports the IRC+ protocol as well. In this case the following syntax is
used: "<serverversion>[:<serverflags>]".
<serverversion> is an ASCII representation of the clear-text server version Mit dem optionalen Parameter <options> werden Server-Optionen uebermittelt,
number, <serverflags> indicates the supported IRC+ protocol extensions (and wie sie in RFC 2813, Sektion 4.1.1 definiert sind.
may be empty!).
The optional parameter <options> is used to propagate server options as Folgende <serverflags> sind zur Zeit definiert:
defined in RFC 2813, section 4.1.1.
The following <serverflags> are defined at the moment: - o: IRC-Operatoren duerfen auch dann Channel- und Channel-User-Modes
aendern, wenn sie kein Channel-Operator im betroffenen Channel sind.
- o: IRC operators are allowed to change channel- and channel-user-modes - C: der Server unterstuetzt den CHANINFO-Befehl.
even if they aren't channel-operator of the affected channel.
- C: The server supports the CHANINFO command.
II.2 Exchange channel-modes, topics, and persistent channels II.2 Channel-Modes, persistente Channel und Topic austauschen
Command: CHANINFO Befehl: CHANINFO
Parameters: <channel> +<modes> <key> <maxusers> [<topic>] Parameter: <channel> +<modes> [[<key> <maxusers>] <topic>]
Used by: servers only Fuer: Server
CHANINFO is used by servers to inform each other about a channel: its Mit CHANINFO Informiert ein Server den anderen ueber einen Channel: dessen
modes, channel key, user limits and its topic. <topic> is optional. Modes, Channel-Key, User-Limit und dessen Topic. <topic> ist optional.
If the channel already exists on the server receiving the CHANINFO command, Existiert auf dem Server, der das CHANINFO empfaengt, der Channel bereits,
it only adopts the <modes> (or the <topic>) if there are no modes (or topic) so uebernimmt er die Werte jeweils nur dann, wenn er selber noch keine
already set. It there are already values set the server ignores the Modes bzw. kein Topic definiert hat. Ansonsten wird der jeweilige Parameter
corresponding parameter. ignoriert.
If the channel doesn't exists at all it will be created. Existiert der Channel noch nicht, so wird er mit den entsprechenden Angaben
erzeugt.
The parameter <key> must be ignored if a channel has no key (the parameter Hat ein Channel keinen Key (in <modes> ist der Mode "k" nicht vorhanden),
<modes> doesn't list the "k" channel mode). In this case <key> should so muss der Parameter <key> ignoriert werden (da <key> vorhanden sein muss,
contain "*" because the parameter <key> is required by the CHANINFO syntax sollte in diesem Fall "*" uebergeben werden). Hat er kein User-Limit (kein
and therefore can't be omitted. The parameter <limit> must be ignored when "l" in <modes>), so muss <limit> ignoriert werden (<limit> sollte hierbei
a channel has no user limit (the parameter <modes> doesn't list the "l" als "0" uebergeben werden).
channel mode). In this case <limit> should be "0".
-- --
$Id: Protocol.txt,v 1.9 2003/04/21 12:48:40 alex Exp $ $Id: Protocol.txt,v 1.5.4.1 2003/01/08 20:36:57 alex Exp $

View File

@@ -1,67 +1,68 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- README-AUX.txt -- -- README-AUX.txt --
Since version 0.2.2-pre Apple's A/UX belongs to the officially supported Seit Version 0.2.2-pre gehoert Apple A/UX zu den offiziell unterstuetzten
platforms. It is not restricted in any way. Plattformen. Er ist im vollen Funktionsumfang nutzbar.
Since version 0.5.0 ngIRCd's source compiles with the native A/UX c Ab Version 0.5.0 compiliert zudem der ngIRCd mit dem nativen A/UX-Compiler,
compiler. GNU C isn't a must-have anymore. d.h. GNU C wird nicht mehr zwingend vorausgesetzt.
The following software packages are needed: Folgende Software wird jedoch benoetigt:
- GNU sed - GNU sed
Source: Bezugsquellen:
http://www.rezepte-im-web.de/appleux/sed-3.02.tar.gz http://www.rezepte-im-web.de/appleux/sed-3.02.tar.gz
ftp://arthur.ath.cx/pub/AUX/Software/Tools/sed-3.02.tar.gz ftp://arthur.ath.cx/pub/AUX/Software/Tools/sed-3.02.tar.gz
A/UX comes with /bin/sed which isn't supporting all functions needed A/UX beinhaltet ein /bin/sed, dieses unterstuetzt jedoch leider nicht
by GNU automake/autoconf. alle Funktionen, die GNU automake/autoconf nutzen.
Achtung: bitte bei der Installation von GNU sed sicherstellen, dass
Warning: When installing GNU sed please make sure that A/UX doesn't immer dieses und nie das von A/UX verwendet wird (also $PATH entsprechend
use the old one anymore which means set the $PATH or replace /bin/sed anpassen bzw. die A/UX-Version komplett ersetzen)!
at all.
- libUTIL.a - libUTIL.a
Source: Bezugsquellen:
http://ftp.mayn.de/pub/apple/apple_unix/Sys_stuff/libUTIL-2.1.tar.gz http://ftp.mayn.de/pub/apple/apple_unix/Sys_stuff/libUTIL-2.1.tar.gz
ftp://arthur.ath.cx/pub/AUX/Software/Libraries/libUTIL-2.1.tar.gz ftp://arthur.ath.cx/pub/AUX/Software/Libraries/libUTIL-2.1.tar.gz
This library contains functions that are common on other UNIX Diese Library beinhaltet Systemfunktionen, die auf UNIXoiden Systemen
systems but not on A/UX e.g. memmove(), strerror() und strdup(). gaengig, unter A/UX jedoch leider nicht verfuegbar sind. Dazu gehoert
u.a. memmove(), strerror() und strdup().
Nachdem diese Pakete entsprechend installiert sind, reicht ein ganz normales
"./configure" und "make" aus, um den ngIRCd unter A/UX zu compilieren.
After installation of these packages just do a "./configure" and "make" to Noch ein paar Hinweise, wenn es doch (noch) nicht klappt:
compile ngIRCd on A/UX.
- auf dem System muss entweder ein install vorhanden sein, welches so
A few hints in case of errors: "broken" ist, dass configure das eigene Shell-Skript waehlt, oder eben
eines, welches funktioniert. Leider ist mindestens ein Binary im Um-
- Either there's an 'install' on your system which is completely broken lauf, welches Probleme verursacht. Das Binary aus folgenden GNU
(so 'configure' uses its own shell script) or use a fully functionable one. fileutils funktioniert hier aber z.B.:
There's at least one binary "out there" causing problems. The one
of the GNU fileutils works fine:
ftp://arthur.ath.cx/pub/UNIX/AUX/Software/Tools/fileutils-4.0.tar.gz ftp://arthur.ath.cx/pub/UNIX/AUX/Software/Tools/fileutils-4.0.tar.gz
- The precompiled binary of the old 'bash' shouldn't be installed within - das sich im Umlauf befindende vorcompilierte Binary der alten Bash sollte
/bin (better do this in /usr/local/bin) because 'configure' would unbedingt ausserhalb von /bin (z.B. unter /usr/local/bin) installiert
choose it as its shell which wouldn't work. werden. Ansonsten waehlt es das configure-Script als Shell aus, leider
funktioniert das aber nicht.
- da die /bin/sh von A/UX recht limitiert ist, kann sie u.a. nicht zum
Erzeugen des "config.status"-Scripts verwendet werden.
Abhilfe: /bin/sh umbenennen (z.B. in "/bin/sh.AUX") und durch einen (am
besten symbolischen) Link auf /bin/ksh ersetzen.
Dieser Schritt sollte keine Probleme nach sich ziehen und ist daher immer,
auch unabhaengig vom ngIRCd, empfehlenswert.
- Because of limitations of /bin/sh on A/UX it can't be used to create
the 'config.status' script. Better rename /bin/sh to /bin/sh.AUX and
replace it by a symbolic link to /bin/ksh (ln -s /bin/ksh /bin/sh as
root).
These procedure should'nt cause you into problems and is recommended
even if you don't use ngIRCd.
-- --
$Id: README-AUX.txt,v 1.8 2003/04/21 21:59:34 goetz Exp $ $Id: README-AUX.txt,v 1.4 2002/11/11 00:59:11 alex Exp $

View File

@@ -1,21 +1,15 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- README-BeOS.txt -- -- README-BeOS.txt --
+--------------------------------------------------------------+
| This text is only available in german at the moment, sorry! |
| Contributors are welcome :-) |
+--------------------------------------------------------------+
BeOS gehoert im Moment (noch?) nicht zu den offiziell unterstuetzten Plat- BeOS gehoert im Moment (noch?) nicht zu den offiziell unterstuetzten Plat-
formen: der ngIRCd enthaelt zwar bereits einige Anpassungen an BeOS und formen: der ngIRCd enthaelt zwar bereits einige Anpassungen an BeOS und
compiliert auch, jedoch bricht er bei jedem Connect-Versuch eines Clients compiliert auch, jedoch bricht er bei jedem Connect-Versuch eines Clients
@@ -50,4 +44,4 @@ mir in Verbindung setzen (alex@barton.de), ich maile gerne meine Patches zu.
Fuer eine Aenderung im CVS ist es aber meiner Meinung nach noch zu frueh ... Fuer eine Aenderung im CVS ist es aber meiner Meinung nach noch zu frueh ...
-- --
$Id: README-BeOS.txt,v 1.6 2003/04/21 12:55:39 alex Exp $ $Id: README-BeOS.txt,v 1.3 2002/05/19 13:10:26 alex Exp $

View File

@@ -1,17 +1,16 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- RFC.txt -- -- RFC.txt --
The Internet Relay Chat (IRC) protocol is documented in these Request for Das IRC-Protokoll ist in diesen RFC's (Request For Comments) dokumentiert:
Comments (RFC), which you can get e.g. via <http://www.faqs.org/>:
1459 Oikarinen, J. & D. Reed, "Internet Relay Chat Protocol", 1459 Oikarinen, J. & D. Reed, "Internet Relay Chat Protocol",
May 1993, [IRC]. May 1993, [IRC].
@@ -30,4 +29,4 @@ Comments (RFC), which you can get e.g. via <http://www.faqs.org/>:
-- --
$Id: RFC.txt,v 1.6 2003/03/07 20:42:20 alex Exp $ $Id: RFC.txt,v 1.4 2002/01/23 18:20:04 alex Exp $

139
doc/en/INSTALL Normal file
View File

@@ -0,0 +1,139 @@
ngIRCd - Next Generation IRC Server
(c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd ist freie Software und steht unter
der GNU General Public License.
-- INSTALL --
0. Upgrade Information
~~~~~~~~~~~~~~~~~~~~~~
Differences to version 0.5.x
- Starting with version 0.6.0, other servers are identified using asyncronous
passwords: therefore the variable "Password" in [Server]-sections has been
replaced by "MyPassword" and "PeerPassword".
- New configuration variables, section [Global]: MaxConnections, MaxJoins
(see example configuration file "doc/en/sample-ngircd.conf"!).
I. Standard-Installation
~~~~~~~~~~~~~~~~~~~~~~~~
ngIRCd is developed for UNIX-like systems, which means, that the installation
on a modern UNIX-like system should be no problem. The only thing is, that
the system should be supported by GNU automake and GNU autoconf ("configure").
The normal installation is like that:
1) tar xzf ngircd-<Version>.tar.gz
2) cd ngircd-<Version>
3) ./autogen.sh [only necessary when using CVS]
4) ./configure
5) make
6) make install
3): "autogen.sh"
The first step, autogen.sh, is only necessary if the configure-script isn't
already generated. This never happens in official ("stable") releases in
tar.gz-archieves, but when using the CVS system.
The next is therefore only interesting for developpers.
autogen.sh produces the makefile.in's, which are necessary for the configure
script it self, and some more files for make. For this step, there must be
GNU automake and GNU autoconf (in recent versions).
(again: "end users" do not need this step!)
to 4): "./configure"
The configure-script is used to detect local system dependancies.
In the perfect case, configure should recognize all needed libraries, header
and so on. If this shouldn't work, "./configure --help" shows more options.
to 5): "make"
The make command uses the Makefiles produced by configure and compiles the
ngIRCd daemon.
to 6): "make install"
Use "make install" to install the server and a sample configuration file on
the local system. For this step, root privileges are necessary. If there is
already an older configuration file present, it won't be overwritten.
This are the files that are installed:
- /usr/local/sbin/ngircd: exectable server
- /usr/local/etc/ngircd.conf: sample configuration, if not there
II. Useful make-targets
~~~~~~~~~~~~~~~~~~~~~~~
The Makefile produced by the configure-script contain always these useful
targets:
- clean: delete every product from the compiler/linker
next step: -> make
- distclean: plus erase all generated Makefiles
next step: -> ./configure
- maintainer-clean: erease all automatic generated files
next step: -> ./autogen.sh
III. Sample configuration file ngircd.conf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the sample configuration file, there are comments beginning with "#" OR
";" -- this is only for the better understanding of the code.
The file is seperated in three blocks: [Global], [Operator], [Server]. In
the [Gobal] part, there is the main configuration, like the server-name
and the ports, on which the server should be listening. In the [Operator]
section, the server-operators are defined and [Server] is the section,
where the server-links are configured.
The meaning of the variables in the configuration file is explained in the
"doc/sample-ngircd.conf", which is also the sample configuration file in
/usr/local/etc after running "make install" (if you don't already have one).
IV. Command line options
~~~~~~~~~~~~~~~~~~~~~~~~
These parameters could be passed to the ngIRCd:
-f, --config <file>
The daemon uses the file <file> as configuration file rather than
the standard configuration /usr/local/etc/ngircd.conf.
-n, --nodaemon
ngIRCd should be running as a foreground process.
-p, --passive
Server-links won't be automatically established.
--configtest
Reads, validates and dumps the configuration file as interpreted
by the server. Then exits.
Use "--help" to see a short help text describing all available parameters
the server understands, with "--version" the ngIRCd shows its version
number. In both cases the server exits after the output.
--
$Id: INSTALL,v 1.3 2002/12/18 12:19:07 alex Exp $

20
doc/en/Makefile.am Normal file
View File

@@ -0,0 +1,20 @@
#
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
#
# Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# der GNU General Public License (GPL), wie von der Free Software Foundation
# herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
# der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
#
# $Id: Makefile.am,v 1.2 2002/11/18 14:06:29 alex Exp $
#
EXTRA_DIST = INSTALL README sample-ngircd.conf
maintainer-clean-local:
rm -f Makefile Makefile.in
# -eof-

101
doc/en/README Normal file
View File

@@ -0,0 +1,101 @@
ngIRCd - Next Generation IRC Server
(c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
terms of the GNU General Public License.
-- README --
Ilja Osthoff, <ilja@glide.ath.cx>
I. Introduction
~~~~~~~~~~~~~~~
ngIRCd is an Open-Source server for the Internet Realy Chat (IRC), which
is developped and published under the terms of the GNU General Public
Licence (URL: http://www.gnu.org/licenses/gpl.html). ngIRCd means "next
generation IRC daemon", it's written from scratch and not deduced from the
"grandfather of IRC daemons", the daemon of the IRCNet.
II. Status
~~~~~~~~~~~
At present, the ngIRCd is under active development, some features are not
implemented, some only partly.
Till today (more or less complete) implemented IRC-commands:
ADMIN, AWAY, CHANINFO, CONNECT, DIE, ERROR, INVITE, ISON, JOIN, KICK, KILL,
LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, NOTICE, OPER, PART,
PASS, PING, PONG, PRIVMSG, QUIT, RESTART, SERVER, SQUIT, TIME, TOPIC,
USERHOST, USER, VERSION, WHO, WHOIS.
III. Features (or: why use ngIRCd?)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- no problems with servers which have dynamic ip-adresses
- simple, easy understandable configuration file,
- freely published C-Sourcecode,
- ngIRCd will be developed on in the future.
- supported platforms (tested versions): AIX (3.2.5), A/UX (3.0.1), FreeBSD
(4.5), HP-UX (10.20), IRIX (6.5), Linux (2.x), Mac OS X (10.x), NetBSD
(1.5.2/i386, 1.5.3/m68k), Solaris (2.5.1, 2.6), and Windows with Cygwin.
IV. Documentation
~~~~~~~~~~~~~~~~~
English documentation:
- doc/en/README: the file that you are reading :-)
- doc/en/INSTALL: hints for the installation of the ngIRCd
German documentation:
- README: readme text in german
- INSTALL: german installation instructions
- NEWS: what do you think? :-)
- Changelog: the complete history of the ngIRCd
- doc/FAQ.txt: frequently asked questions and answers
- doc/CVS.txt: hints for the CVS-system
- doc/RFC.txt: information about the RFC's
- doc/sample-ngircd.conf: sample configuration file
- doc/README-AUX.txt: installation hints for A/UX
- doc/README-BeOS.txt: the same for BeOS
V. Download
~~~~~~~~~~~
The homepage of the ngIRCd is: <http://arthur.ath.cx/~alex/ngircd>; you
will find the newest information about the ngIRCd and the most recent
("stable") releases there.
If you are interested in the newest developper-versions (which are not
always stable), then please read the section "CVS" on the homepage and
the file "doc/CVS.txt" which describes the use of CVS, the "Concurrent
Versioning System".
VI. Bugs
~~~~~~~~
If you find bugs in the ngIRCd (which might be there :-), please report
them at the following URL:
<http://arthur.ath.cx/~alex/ngircd/#bugs>
There you can read about kown bugs, too.
If you have critics, patches or something else, please feel yourself free
to post a mail to: <alex@barton.de> or <alex@arthur.ath.cx>
--
$Id: README,v 1.7 2002/11/24 18:48:59 alex Exp $

138
doc/en/sample-ngircd.conf Normal file
View File

@@ -0,0 +1,138 @@
# $Id: sample-ngircd.conf,v 1.4 2002/12/18 12:19:07 alex Exp $
#
# This is a sample configuration for the ngIRCd, which must adept to the
# local preferences and needs.
#
# Comments are started with "#" or ";".
#
# Author: Alexander Barton, <alex@barton.de>
# Translation by Ilja Osthoff, <ilja@glide.ath.cx>
#
[Global]
# In the [global] section of this file, there is the place of the
# main server configuration. Needed is only the variable "Name",
# Info you can adjust, if you like to. For all the others variables,
# you can use the defaults, this means you can leave it by default.
# Server name in the IRC-network
Name = irc.the.net
# Info-text of the server. This will be shown i.e. by a WHOIS- or
# LINKS-request.
Info = Server Info Text
# Information about the server and administrator in the ADMIN-request
;AdminInfo1 = Description
;AdminInfo2 = Location
;AdminEMail = admin@irc.server
# Ports, on which the server will listen. There may be more than
# one port, separated with ";". (Default: 6667)
;Ports = 6667, 6668, 66694
# Textfile with the "message of the day" (MOTD). This will be shown
# on a user connection with the server.
;MotdFile = /usr/local/etc/ngircd.motd
# User-ID, under which the server is started (for that the server
# must be started with root-rights). You can use the name of the
# user or the numerical ID.
# ATTENTION: the configuration and the MOTD file must be readable
# by this user, otherwise RESTART won't work!
;ServerUID = 65534
# Group-ID, under which the server is running (for that the server
# must be started with root-rights). You can use the name of the
# group or the numerical ID.
;ServerGID = 65534
# After <PingTimeout> seconds, the server will send a ping after
# inactivity of this client.
;PingTimeout = 120
# If there is an answer of a client, to which the ping was sended,
# not after <PongTimeout> seconds, it will be disconnected.
;PongTimeout = 20
# The server tries every <ConnectRetry> seconds, not yet connected
# or not anymore connected servers to connect.
;ConnectRetry = 60
# Should IRC-operators be allowed to use the MODE command even if
# they are not(!) channel-operators?
;OperCanUseMode = no
# Maximum number of simultanous connection the server is allowed
# to accept (<=0: unlimited):
;MaxConnections = -1
# Maximum number of channels a user can be member of (<=0: no limit):
;MaxJoins = 10
[Operator]
# In this [operator]-section, there will be the configuration of
# the name and password of an IRC operator. There may be more than
# one operator-block (for each operator one).
# ID of the operator (may be different of the nick)
;Name = TheOper
# Password of the operator
;Password = ThePwd
[Server]
# In this [Server] section, there is the configuration of the
# servers, which are allowed to connect to your own server.
# There may be more than one server-block.
# If you configured a port for the connection, then the ngIRCd
# tries to connect to this port. If not, it waits for the other
# server.
#
# Server-groups:
# The ngIRCd allows "server-groups": that means, that you can assign
# server-groups for every server, to which you want the ngIRCd to
# connect to. If one server of a server-group won't answer, the
# ngIRCd tries the next one of this group.
# ATTENTION: Server-groups will only work if you defined a port!
# IRC-name of the server
;Name = irc2.the.net
# Hostname of the server
;Host = connect-to-host.the.net
# Port of the server, to which the ngIRCd should connect. If you
# assign no port, the ngIRCd waits for an answer of that server.
;Port = 6666
# Own password for the connection. This password has to be configured
# as "PeerPassword" on the other server.
;MyPassword = MySecret
# Foreign password for this connection. This password has to be
# configured as "MyPassword" on the other server.
;PeerPassword = PeerSecret
# Group of that server (optional)
;Group = 123
[Channel]
# In the [Channel] there can be defined "persistent channels". This
# means, that the server creates the channel and even if all users
# left this channel, it will persist. There may be more than one
# block. Signed with the mode "P", which can be set or unset, like
# normal modes.
# Name of the channel
;Name = #TheName
# Topic for the channel
;Topic = a great topic
# Channel-modes
;Modes = tn
# -eof-

View File

@@ -1,137 +1,164 @@
# $Id: sample-ngircd.conf,v 1.20 2003/03/10 00:23:34 alex Exp $ # $Id: sample-ngircd.conf,v 1.17 2002/12/18 12:19:07 alex Exp $
# #
# This is a sample configuration file for the ngIRCd, which must adept to # Das ist eine Beispiel-Konfiguration fuer den ngIRCd, die an die
# the local preferences and needs. # jeweiligen Beduerfnisse angepasst werden kann/muss.
# #
# Comments are started with "#" or ";". # Kommentare werden mit "#" oder ";" eingeleitet.
# #
# Author: Alexander Barton, <alex@barton.de> # +-----------------------------------------------------------------------+
# Initial translation by Ilja Osthoff, <ilja@glide.ath.cx> # | Please note: English translations of some of the german documentation |
# | files can be found in the directory "doc/en" -- please have a look! |
# +-----------------------------------------------------------------------+
#
# Autor: Alexander Barton, <alex@barton.de>
# Erweiterungen von Ilja Osthoff, <ilja@glide.ath.cx>
# #
[Global] [Global]
# The [Global] section of this file is used to define the main #
# configuration of the server, like the server name and the ports # Im [Global]-Abschnitt der Konfigurationsdatei wird der Server
# on which the server should be listening. # "an sich" konfiguriert. Notwendig ist nur die Variable "Name",
# Info ist in der Regel ebengalls anzupassen. Fuer alle uebrigen
# Variablen koennen oft die Defaults benutzt werden, d.h. hier
# muss die Variable nicht angegeben werden.
#
# Server name in the IRC-network # Servername im IRC-Netz
Name = irc.the.net Name = irc.the.net
# Info text of the server. This will be shown by WHOIS and # Info-Text des Servers. Dieser wird z.B. bei WHOIS- oder LINKS-
# LINKS requests for example. # Abfragen entsprechend mit ausgegeben.
Info = Server Info Text Info = Server Info Text
# Information about the server and the administrator, used by the # Informationen ueber den Server und Administrator fuer den
# ADMIN command. # ADMIN-Befehl:
;AdminInfo1 = Description ;AdminInfo1 = Beschreibung
;AdminInfo2 = Location ;AdminInfo2 = Standort
;AdminEMail = admin@irc.server ;AdminEMail = admin@irc.server
# Ports on which the server should listen. There may be more than # Ports, auf denen Verbindungen angenommen werden sollen. Es koennen
# one port, separated with ";". (Default: 6667) # mehrere Ports mit "," getrennt angegeben werden. (Default: 6667)
;Ports = 6667, 6668, 66694 ;Ports = 6667, 6668, 6669
# Text file with the "message of the day" (MOTD). This message will # Textdatei mit der "Message of the Day" (MOTD). Diese wird aus-
# be shown to all users connecting to the server: # gegeben, wenn sich ein User mit dem Server verbindet.
;MotdFile = /usr/local/etc/ngircd.motd ;MotdFile = /usr/local/etc/ngircd.motd
# User ID under which the server should run; you can use the name # User-ID, unter der der Daemon laufen soll (dazu muss der Server
# of the user or the numerical ID. ATTENTION: For this to work the # jedoch mit root-Rechten gestartet werden). Es kann der Name oder
# server must have been started with root privileges! In addition, # die numerische ID angegeben werden.
# the configuration and MOTD files must be readable by this user, # ACHTUNG: Die Konfigurations- und MOTD-Datei muessen fuer diesen
# otherwise RESTART and REHASH won't work! # Benutzer lesbar sein, ansonsten schlaegt ein RESTART fehl!
;ServerUID = 65534 ;ServerUID = ircd
# Group ID under which the ngircd should run; you can use the name # Group-ID, zu der der Daemon wechseln soll (hierzu muss der Server
# of the group or the numerical ID. ATTENTION: For this to work the # jedoch mit root-Rechten gestartet werden). Es kann der Name oder
# server must have been started with root privileges! # die numerische ID angegeben werden.
;ServerGID = 65534 ;ServerGID = daemon
# After <PingTimeout> seconds of inactivity the server will send a # Nach <PingTimeout> Sekunden verschickt der Server bei Inaktivitaet
# PING to the peer to test whether it is alive or not. # von einem Client diesem ein PING.
;PingTimeout = 120 ;PingTimeout = 120
# If a client fails to answer a PING with a PONG within <PongTimeout> # Antwortet ein Client, der ein PING bekam, nicht innerhalb von
# seconds, it will be disconnected by the server. # <PongTimeout> Sekunden mit einem PONG, so wird er disconnectiert.
;PongTimeout = 20 ;PongTimeout = 20
# The server tries every <ConnectRetry> seconds to establish a link # Der Server versucht alle <ConnectRetry> Sekunden, noch nicht bzw.
# to not yet (or no longer) connected servers. # nicht mehr connectierte Server-Links aufzubauen.
;ConnectRetry = 60 ;ConnectRetry = 60
# Should IRC Operators be allowed to use the MODE command even if # Sollen IRC-Operatoren immer den MODE-Befehl in Channel benutzen
# they are not(!) channel-operators? # koennen, auch wenn sie kein(!) Channel-Operator sind?
;OperCanUseMode = no ;OperCanUseMode = no
# Maximum number of simultaneous connection the server is allowed # Maximale Anzahl von gleichzeitigen Verbindungen, die dieser
# to accept (<=0: unlimited): # Server annehmen darf (<=0: unlimitiert).
;MaxConnections = -1 ;MaxConnections = -1
# Maximum number of channels a user can be member of (<=0: no limit): # Maximale Anzahl von Channels, in denen ein User zeitgleich
# Mitglied sein kann (<=0: unlimitiert).
;MaxJoins = 10 ;MaxJoins = 10
[Operator] [Operator]
# [Operator] sections are used to define IRC Operators. There may be
# more than one [Operator] block, one for each local operator.
# ID of the operator (may be different of the nick name) #
# Mit einem [Operator]-Block wird der Name und das Passwort eines
# IRC-Operators konfiguriert. Es darf mehrere [Operator]-Bloecke
# geben (fuer jeden Operator einen).
#
# ID des IRC-Operators (muss nicht mit dem Nick identisch sein).
;Name = TheOper ;Name = TheOper
# Password of the IRC operator # Passwort des IRC-Operators
;Password = ThePwd ;Password = ThePwd
[Server] [Server]
# Other servers are configured in [Server] sections. If you
# configure a port for the connection, then this ngircd tries to
# connect to to the other server on the given port; if not it waits
# for the other server to connect.
# There may be more than one server block.
#
# Server Groups:
# The ngIRCd allows "server groups": You can assign an "ID" to every
# server with which you want this ngIRCd to link. If a server of a
# group won't answer, the ngIRCd tries to connect to the next server
# in the given group. But the ngircd never tries to connect to two
# servers with the same group ID.
# IRC name of the server #
# In [Server]-Bloecken werden Server konfiguriert, zu denen sich
# dieser ngIRCd verbinden soll bzw. von denen Verbindungen angekommen
# werden duerfen.
# Es koennen mehrere Server konfiguriert werden, d.h. [Server]-
# Bloecke koennen mehrfach vorkommen.
# Wenn man fuer einen Server einen Port angegeben hat, dann versucht
# sich der ngIRCd mit der Gegenseite zu verbinden. Hat man keinen
# Port konfiguriert, dann wartet der ngIRCd darauf, dass sich die
# Gegenseite mit ihm verbindet.
#
# Server-Gruppen:
# Der ngIRCd unterstuetzt "Server-Gruppen": das bedeutet, man kann
# jedem Server, mit dem man sich verbinden will, einer Gruppe zu-
# ordnen. Wenn der ngIRCd sich dann mit einem Server aus der Gruppe
# verbinden will und keine Antwort erhaelt, dann wird der naechste
# Server aus der Gruppe versucht.
# Achtung: Gruppen werden nur beachtet, wenn man einen Port fur
# die Gegenseite angegeben hat!
#
# IRC-Name des Servers
;Name = irc2.the.net ;Name = irc2.the.net
# Internet host name of the peer # DNS-Hostname des Servers
;Host = connect-to-host.the.net ;Host = connect-to-host.the.net
# Port of the server to which the ngIRCd should connect. If you # Port, zu dem dieser Server eine Verbindung herstellen soll. Wird
# assign no port the ngIRCd waits for incoming connections. # kein Port angegeben, so wird auf eine Verbindung der Gegenseite
# gewartet.
;Port = 6666 ;Port = 6666
# Own password for the connection. This password has to be configured # Eigenes Passwort fuer diese Verbindung. Dieses Passwort muss auf
# as "PeerPassword" on the other server. # dem anderen Server als "PeerPassword" konfiguriert werden.
;MyPassword = MySecret ;MyPassword = MySecret
# Foreign password for this connection. This password has to be # Passwort des Peer-Servers fuer diese Verbindung. Dieses Passwort
# configured as "MyPassword" on the other server. # muss auf dem anderen Server als "MyPassword" konfiguriert sein.
;PeerPassword = PeerSecret ;PeerPassword = PeerSecret
# Group of this server (optional) # Gruppe, zu der dieser Server gehoert (optional).
;Group = 123 ;Group = 123
[Channel] [Channel]
# Pre-defined channels can be configured in [Channel] sections.
# Such channels are created by the server when starting up and even
# persist when there are no more members left.
# Persistent channels are marked with the mode 'P', which can be set
# and unset by IRC operators like other modes on the fly.
# There may be more than one [Channel] block.
# Name of the channel #
# Mit [Channel]-Bloecken werden "persistente Channels" definiert,
# die nach dem Start des Servers automatisch erzeugt werden und auch
# dann erhalten bleiben, wenn keine User mehr im Channel sind. Es
# koennen mehrere solcher Bloecke hier konfiguriert werden.
# Gekennzeichnet werden solche Channels mit dem Mode "P", der ganz
# normal gesetzt und geloescht werden kann.
#
# Name des Channels
;Name = #TheName ;Name = #TheName
# Topic for this channel # Topic, das gesetzt werden soll
;Topic = a great topic ;Topic = Ein tolles Topic
# Initial channel modes # Channel-Modes
;Modes = tn ;Modes = tn
# -eof- # -eof-

View File

@@ -1,7 +1,7 @@
.\" .\"
.\" $Id: ngircd.8,v 1.8 2003/03/10 00:58:06 alex Exp $ .\" $Id: ngircd.8,v 1.5 2002/11/18 18:49:34 alex Exp $
.\" .\"
.TH ngircd 8 "March 2003" ngircd "ngIRCd Manual" .TH ngircd 8 "September 2002" ngircd "ngIRCd Manual"
.SH NAME .SH NAME
ngircd \- the next generation IRC daemon ngircd \- the next generation IRC daemon
.SH SYNOPSIS .SH SYNOPSIS
@@ -9,63 +9,32 @@ ngircd \- the next generation IRC daemon
.I Options .I Options
.B ] .B ]
.SH DESCRIPTION .SH DESCRIPTION
.BR ngircd .B ngircd
is a free open source daemon for the Internet Relay Chat (IRC), is a portable IRC daemon written from scratch. It is easy to configure,
developed under the GNU General Public License (GPL). supports server links (even with original ircds) and runs on hosts with
.PP changing IP addresses (such as dial-in networks). Currently supported
It's written from scratch and is not based upon the original IRCd like platforms (tested versions) are: AIX (3.2.5), A/UX (3.0.1), FreeBSD
many others. It is easy to configure, supports server links (even with (4.5), HP-UX (10.20), IRIX (6.5), Linux (2.x), Mac OS X (10.x), NetBSD
original ircd's) and runs on hosts with changing IP addresses (such as (1.5.2/i386, 1.5.3/m68k), Solaris (2.5.1, 2.6), and Windows with Cygwin.
dial-in networks).
.PP
Currently supported platforms (tested versions) are: AIX (3.2.5 with IBM XL
C Compiler), A/UX (3.x, Apple pre-ANSI C Compiler and GNU C), FreeBSD
(4.5/i386, GNU C), HP-UX (10.20, GNU C), IRIX (6.5, SGI MIPSpro C 7.30),
Linux (2.2.x/i386, 2.4.x/i386 and 2.4.x/hppa, GNU C), Mac OS X (10.x, GNU C),
NetBSD (1.5.2/i386 and 1.5.3/m68k, GNU C), Solaris (2.5.1 and 2.6, GNU C),
and Windows with Cygwin (GNU C).
.PP
As ngIRCd relies on UNIX standards and uses GNU automake and GNU autoconf
there are good chances that it also supports other UNIX-based operating
systems.
.SH OPTIONS .SH OPTIONS
The default behaviour of .IP --configtest
.BR ngircd read, validate and display configuration; then exit.
is to read its standard configuration file (see below), to detach from the .IP "-f file, --config file"
controlling terminal and to wait for clients. use
.PP
You can use these options to modify this default:
.TP
\fB\-\-configtest\fR
Read, validate and display the configuration; then exit.
.TP
\fB\-f\fR \fIfile\fR, \fB\-\-config\fR \fIfile\fR
Use
.I file .I file
as configuration file. as configuration file.
.TP .IP "-n, --nodaemon"
\fB\-n\fR, \fB\-\-nodaemon\fR don't fork and don't detach from controlling terminal.
Don't fork a child and don't detach from controlling terminal. .IP "-p, --passive"
All log messages go to the console. disable automatic connections to other servers.
.TP .IP --version
\fB\-p\fR, \fB\-\-passive\fR output version information and exit.
Disable automatic connections to other servers. You can use the IRC command .IP --help
CONNECT later on as IRC Operator to link this ngIRCd to other servers. display brief help text and exit.
.TP
\fB\-\-version\fR
Output version information and exit.
.TP
\fB\-\-help\fR
Display a brief help text and exit.
.SH FILES .SH FILES
.I /usr/local/etc/ngircd.conf .I /usr/local/etc/ngircd.conf
.RS .RS
The system wide default configuration file. The system wide default configuration file.
.RE
.I /usr/local/etc/ngircd.motd
.RS
Default "message of the day" (MOTD).
.RE
.SH AUTHOR .SH AUTHOR
Alexander Barton, Alexander Barton,
.UR mailto:alex@barton.de .UR mailto:alex@barton.de

View File

@@ -1,195 +1,14 @@
.\" .\"
.\" $Id: ngircd.conf.5,v 1.9 2003/03/10 00:58:06 alex Exp $ .\" $Id: ngircd.conf.5,v 1.6 2002/09/16 11:11:21 alex Exp $
.\" .\"
.TH ngircd.conf 5 "March 2003" ngircd "ngIRCd Manual" .TH ngircd.conf 5 "September 2002" ngircd "ngIRCd Manual"
.SH NAME .SH NAME
ngircd.conf \- configuration file of ngIRCd ngircd.conf \- configuration file of ngircd
.SH SYNOPSIS .SH SYNOPSIS
.B /usr/local/etc/ngircd.conf .B /usr/local/etc/ngircd.conf
.SH DESCRIPTION .SH DESCRIPTION
.BR ngircd.conf (coming soon, please have a look at the sample configuration
is the configuration file for file "doc/sample-ngircd.conf" -- Thank you!)
.BR ngircd (8)
which you should adept to your local preferences and needs.
.SH "FILE FORMAT"
The file consists of sections and parameters. A section begins with the name
of the section in square brackets and continues until the next section
begins.
.PP
Sections contain parameters of the form
.PP
.RS
.I name
=
.I value
.RE
.PP
Any line beginning with a semicolon (';') or a hash ('#') character is
treated as a comment and ignored.
.PP
The file format is line-based - that means, each newline-terminated line
represents either a comment, a section name or a parameter.
.PP
Section and parameter names are not case sensitive.
.SH "SECTION OVERVIEW"
The file is separated in four blocks: [Global], [Operator], [Server],
and [Channel].
.PP
In the
.I [Global]
section, there is the main configuration like the server name and the
ports, on which the server should be listening. IRC operators of this
server are defined in
.I [Operator]
blocks.
.I [Server]
is the section where server links are configured. And
.I [Channel]
blocks are used to configure pre-defined ("persistent") IRC channels.
.SH [GLOBAL]
The
.I [Global]
section is used to define the server main configuration, like the server
name and the ports on which the server should be listening.
.TP
\fBName\fR
Server name in the IRC network
.TP
\fBInfo\fR
Info text of the server. This will be shown by WHOIS and LINKS requests for
example.
.TP
\fBAdminInfo1\fR, \fBAdminInfo2\fR, \fBAdminEMail\fR
Information about the server and the administrator, used by the ADMIN
command.
.TP
\fBPorts\fR
Ports on which the server should listen. There may be more than one port,
separated with ';'. Default: 6667.
.TP
\fBMotdFile\fR
Text file with the "message of the day" (MOTD). This message will be shown
to all users connecting to the server.
.TP
\fBServerUID\fR
User ID under which the server should run; you can use the name of the user
or the numerical ID.
.PP
.RS
.B Attention:
.br
For this to work the server must have been
started with root privileges! In addition, the configuration and MOTD files
must be readable by this user, otherwise RESTART and REHASH won't work!
.RE
.TP
\fBServerGID\fR
Group ID under which the ngIRCd should run; you can use the name of the
group or the numerical ID.
.PP
.RS
.B Attention:
.br
For this to work the server must have
been started with root privileges!
.RE
.TP
\fBPingTimeout\fR
After <PingTimeout> seconds of inactivity the server will send a PING to
the peer to test whether it is alive or not. Default: 120.
.TP
\fBPongTimeout\fR
If a client fails to answer a PING with a PONG within <PongTimeout>
seconds, it will be disconnected by the server. Default: 20.
.IT
\fBConnectRetry\fR
The server tries every <ConnectRetry> seconds to establish a link to not yet
(or no longer) connected servers. Default: 60.
.TP
\fBOperCanUseMode\fR
Should IRC Operators be allowed to use the MODE command even if they are
not(!) channel-operators? Default: no.
.TP
\fBMaxConnections\fR
Maximum number of simultaneous connection the server is allowed to accept
(<=0: unlimited). Default: -1.
.TP
\fBMaxJoins\fR
Maximum number of channels a user can be member of (<=0: no limit).
Default: 10.
.SH [OPERATOR]
.I [Operator]
sections are used to define IRC Operators. There may be more than one
.I [Operator]
block, one for each local operator.
.TP
\fBName\fR
ID of the operator (may be different of the nick name).
.TP
\fBPassword\fR
Password of the IRC operator.
.SH [SERVER]
Other servers are configured in
.I [Server]
sections. If you configure a port for the connection, then this ngIRCd
tries to connect to to the other server on the given port; if not, it waits
for the other server to connect.
.PP
The ngIRCd allows "server groups": You can assign an "ID" to every server
with which you want this ngIRCd to link. If a server of a group won't
answer, the ngIRCd tries to connect to the next server in the given group.
But ngIRCd never tries to connect to two servers with the same group ID.
.PP
There may be more than one
.I [Server]
block.
.TP
\fBName\fR
IRC name of the server
.TP
\fBHost\fR
Internet host name of the peer
.TP
\fBPort\fR
Port of the server to which the ngIRCd should connect. If you assign no port
the ngIRCd waits for incoming connections.
.TP
\fBMyPassword\fR
Own password for this connection. This password has to be configured as
"PeerPassword" on the other server.
.TP
\fBPeerPassword\fR
Foreign password for this connection. This password has to be configured as
"MyPassword" on the other server.
.TP
\fBGroup\fR
Group of this server (optional).
.SH [CHANNEL]
Pre-defined channels can be configured in
.I [Channel]
sections. Such channels are created by the server when starting up and even
persist when there are no more members left.
.PP
Persistent channels are marked with the mode 'P', which can be set and unset
by IRC operators like other modes on the fly.
.PP
There may be more than one
.I [Channel]
block.
.TP
\fBName\fR
Name of the channel
.TP
\fBTopic\fR
Topic for this channel
.TP
\fBModes\fR
Initial channel modes.
.SH HINTS
It's wise to use "ngircd --configtest" to validate the configuration file
after changing it. See
.BR ngircd (8)
for details.
.SH AUTHOR .SH AUTHOR
Alexander Barton, Alexander Barton,
.UR mailto:alex@barton.de .UR mailto:alex@barton.de
@@ -202,5 +21,6 @@ http://arthur.ath.cx/~alex/ngircd/
.UE .UE
.SH "SEE ALSO" .SH "SEE ALSO"
.BR ngircd (8) .BR ngircd (8)
.BR ircd (8)
.\" .\"
.\" -eof- .\" -eof-

View File

@@ -2,16 +2,17 @@
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) # Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
# #
# This program is free software; you can redistribute it and/or modify # Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# it under the terms of the GNU General Public License as published by # der GNU General Public License (GPL), wie von der Free Software Foundation
# the Free Software Foundation; either version 2 of the License, or # herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
# (at your option) any later version. # der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
# Please read the file COPYING, README and AUTHORS for more information. # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
# #
# $Id: Makefile.am,v 1.5 2003/01/13 12:20:16 alex Exp $ # $Id: Makefile.am,v 1.4 2002/09/09 10:00:15 alex Exp $
# #
SUBDIRS = portab tool ngircd testsuite SUBDIRS = portab ngircd testsuite
maintainer-clean-local: maintainer-clean-local:
rm -f Makefile Makefile.in config.h config.h.in stamp-h.in rm -f Makefile Makefile.in config.h config.h.in stamp-h.in

View File

@@ -1,37 +1,36 @@
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) # Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
# #
# This program is free software; you can redistribute it and/or modify # Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# it under the terms of the GNU General Public License as published by # der GNU General Public License (GPL), wie von der Free Software Foundation
# the Free Software Foundation; either version 2 of the License, or # herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
# (at your option) any later version. # der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
# Please read the file COPYING, README and AUTHORS for more information. # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
# #
# $Id: Makefile.am,v 1.39 2003/03/31 19:01:02 alex Exp $ # $Id: Makefile.am,v 1.31.2.1 2003/01/04 10:58:15 alex Exp $
# #
AUTOMAKE_OPTIONS = ../portab/ansi2knr AUTOMAKE_OPTIONS = ../portab/ansi2knr
INCLUDES = -I$(srcdir)/../portab -I$(srcdir)/../tool INCLUDES = -I$(srcdir)/../portab
LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN
sbin_PROGRAMS = ngircd sbin_PROGRAMS = ngircd
ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c conn-zip.c conn-func.c \ ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c hash.c irc.c \
hash.c irc.c irc-channel.c irc-info.c irc-login.c irc-mode.c irc-op.c \ irc-channel.c irc-info.c irc-login.c irc-mode.c irc-op.c irc-oper.c \
irc-oper.c irc-server.c irc-write.c lists.c log.c match.c parse.c \ irc-server.c irc-write.c lists.c log.c match.c parse.c resolve.c tool.c
rendezvous.c resolve.c
ngircd_LDFLAGS = -L../portab -L../tool ngircd_LDFLAGS = -L../portab
ngircd_LDADD = -lngportab -lngtool ngircd_LDADD = -lngportab
noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h conn-zip.h conn-func.h \ noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h hash.h irc.h \
hash.h irc.h irc-channel.h irc-info.h irc-login.h irc-mode.h irc-op.h \ irc-channel.h irc-info.h irc-login.h irc-mode.h irc-op.h irc-oper.h \
irc-oper.h irc-server.h irc-write.h lists.h log.h match.h parse.h \ irc-server.h irc-write.h lists.h log.h match.h parse.h resolve.h tool.h \
rendezvous.h resolve.h \
messages.h defines.h messages.h defines.h
clean-local: clean-local:

View File

@@ -17,14 +17,14 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: channel.c,v 1.42 2002/12/30 17:15:42 alex Exp $"; static char UNUSED id[] = "$Id: channel.c,v 1.38 2002/12/16 23:05:24 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "conn-func.h" #include "conn.h"
#include "client.h" #include "client.h"
#include "exp.h" #include "exp.h"
@@ -468,7 +468,7 @@ Channel_IsValidName( CHAR *Name )
if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return FALSE; if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return FALSE;
ptr = Name; ptr = Name;
strcpy( badchars, " ,:\007" ); strcpy( badchars, " ,:\x07" );
while( *ptr ) while( *ptr )
{ {
if( strchr( badchars, *ptr )) return FALSE; if( strchr( badchars, *ptr )) return FALSE;
@@ -494,7 +494,7 @@ Channel_ModeAdd( CHANNEL *Chan, CHAR Mode )
if( ! strchr( Chan->modes, x[0] )) if( ! strchr( Chan->modes, x[0] ))
{ {
/* Client hat den Mode noch nicht -> setzen */ /* Client hat den Mode noch nicht -> setzen */
strlcat( Chan->modes, x, sizeof( Chan->modes )); strcat( Chan->modes, x );
return TRUE; return TRUE;
} }
else return FALSE; else return FALSE;
@@ -547,7 +547,7 @@ Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, CHAR Mode )
if( ! strchr( cl2chan->modes, x[0] )) if( ! strchr( cl2chan->modes, x[0] ))
{ {
/* Client hat den Mode noch nicht -> setzen */ /* Client hat den Mode noch nicht -> setzen */
strlcat( cl2chan->modes, x, sizeof( cl2chan->modes )); strcat( cl2chan->modes, x );
return TRUE; return TRUE;
} }
else return FALSE; else return FALSE;
@@ -629,7 +629,8 @@ Channel_SetTopic( CHANNEL *Chan, CHAR *Topic )
assert( Chan != NULL ); assert( Chan != NULL );
assert( Topic != NULL ); assert( Topic != NULL );
strlcpy( Chan->topic, Topic, sizeof( Chan->topic )); strncpy( Chan->topic, Topic, CHANNEL_TOPIC_LEN - 1 );
Chan->topic[CHANNEL_TOPIC_LEN - 1] = '\0';
} /* Channel_SetTopic */ } /* Channel_SetTopic */
@@ -639,7 +640,8 @@ Channel_SetModes( CHANNEL *Chan, CHAR *Modes )
assert( Chan != NULL ); assert( Chan != NULL );
assert( Modes != NULL ); assert( Modes != NULL );
strlcpy( Chan->modes, Modes, sizeof( Chan->modes )); strncpy( Chan->modes, Modes, CHANNEL_MODE_LEN - 1 );
Chan->topic[CHANNEL_MODE_LEN - 1] = '\0';
} /* Channel_SetModes */ } /* Channel_SetModes */
@@ -649,7 +651,8 @@ Channel_SetKey( CHANNEL *Chan, CHAR *Key )
assert( Chan != NULL ); assert( Chan != NULL );
assert( Key != NULL ); assert( Key != NULL );
strlcpy( Chan->key, Key, sizeof( Chan->key )); strncpy( Chan->key, Key, CLIENT_PASS_LEN - 1 );
Chan->key[CLIENT_PASS_LEN - 1] = '\0';
Log( LOG_DEBUG, "Channel %s: Key is now \"%s\".", Chan->name, Chan->key ); Log( LOG_DEBUG, "Channel %s: Key is now \"%s\".", Chan->name, Chan->key );
} /* Channel_SetKey */ } /* Channel_SetKey */
@@ -707,7 +710,7 @@ Channel_Create( CHAR *Name )
return NULL; return NULL;
} }
c->next = NULL; c->next = NULL;
strlcpy( c->name, Name, sizeof( c->name )); strncpy( c->name, Name, CHANNEL_NAME_LEN - 1 );
c->name[CHANNEL_NAME_LEN - 1] = '\0'; c->name[CHANNEL_NAME_LEN - 1] = '\0';
strcpy( c->modes, "" ); strcpy( c->modes, "" );
strcpy( c->topic, "" ); strcpy( c->topic, "" );

View File

@@ -17,7 +17,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: client.c,v 1.74 2003/03/31 15:54:21 alex Exp $"; static char UNUSED id[] = "$Id: client.c,v 1.65.2.3 2003/01/08 23:13:45 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -59,10 +59,6 @@ LOCAL CLIENT *New_Client_Struct PARAMS(( VOID ));
LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client )); LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client ));
LOCAL VOID Adjust_Counters PARAMS(( CLIENT *Client )); LOCAL VOID Adjust_Counters PARAMS(( CLIENT *Client ));
#ifndef Client_DestroyNow
GLOBAL VOID Client_DestroyNow PARAMS((CLIENT *Client ));
#endif
LONG Max_Users = 0, My_Max_Users = 0; LONG Max_Users = 0, My_Max_Users = 0;
@@ -76,7 +72,7 @@ Client_Init( VOID )
if( ! This_Server ) if( ! This_Server )
{ {
Log( LOG_EMERG, "Can't allocate client structure for server! Going down." ); Log( LOG_EMERG, "Can't allocate client structure for server! Going down." );
Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 ); exit( 1 );
} }
@@ -90,7 +86,7 @@ Client_Init( VOID )
gethostname( This_Server->host, CLIENT_HOST_LEN ); gethostname( This_Server->host, CLIENT_HOST_LEN );
h = gethostbyname( This_Server->host ); h = gethostbyname( This_Server->host );
if( h ) strlcpy( This_Server->host, h->h_name, sizeof( This_Server->host )); if( h ) strcpy( This_Server->host, h->h_name );
Client_SetID( This_Server, Conf_ServerName ); Client_SetID( This_Server, Conf_ServerName );
Client_SetInfo( This_Server, Conf_ServerInfo ); Client_SetInfo( This_Server, Conf_ServerInfo );
@@ -105,7 +101,7 @@ Client_Exit( VOID )
CLIENT *c, *next; CLIENT *c, *next;
INT cnt; INT cnt;
if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, FALSE ); if( NGIRCd_Restart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, FALSE );
else Client_Destroy( This_Server, "Server going down.", NULL, FALSE ); else Client_Destroy( This_Server, "Server going down.", NULL, FALSE );
cnt = 0; cnt = 0;
@@ -179,7 +175,7 @@ Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *
if( Type == CLIENT_SERVER ) Generate_MyToken( client ); if( Type == CLIENT_SERVER ) Generate_MyToken( client );
/* ist der User away? */ /* ist der User away? */
if( strchr( client->modes, 'a' )) strlcpy( client->away, DEFAULT_AWAY_MSG, sizeof( client->away )); if( strchr( client->modes, 'a' )) strcpy( client->away, DEFAULT_AWAY_MSG );
/* Verketten */ /* Verketten */
client->next = (POINTER *)My_Clients; client->next = (POINTER *)My_Clients;
@@ -207,7 +203,7 @@ Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )
if( ! txt ) txt = "Reason unknown."; if( ! txt ) txt = "Reason unknown.";
/* Netz-Split-Nachricht vorbereiten (noch nicht optimal) */ /* Netz-Split-Nachricht vorbereiten (noch nicht optimal) */
if( Client->type == CLIENT_SERVER ) snprintf( msg, sizeof( msg ), "%s: lost server %s", This_Server->id, Client->id ); if( Client->type == CLIENT_SERVER ) sprintf( msg, "%s: lost server %s", This_Server->id, Client->id );
last = NULL; last = NULL;
c = My_Clients; c = My_Clients;
@@ -267,7 +263,7 @@ Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )
} }
/* andere Server informieren */ /* andere Server informieren */
if( ! NGIRCd_SignalQuit ) if( ! NGIRCd_Quit )
{ {
if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :%s", c->id, FwdMsg ); if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :%s", c->id, FwdMsg );
else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :", c->id ); else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :", c->id );
@@ -296,35 +292,6 @@ Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )
} /* Client_Destroy */ } /* Client_Destroy */
GLOBAL VOID
Client_DestroyNow( CLIENT *Client )
{
/* Destroy client structure immediately. This function is only
* intended for the connection layer to remove client structures
* of connections that can't be established! */
CLIENT *last, *c;
assert( Client != NULL );
last = NULL;
c = My_Clients;
while( c )
{
if( c == Client )
{
/* Wir haben den Client gefunden: entfernen */
if( last ) last->next = c->next;
else My_Clients = (CLIENT *)c->next;
free( c );
break;
}
last = c;
c = (CLIENT *)c->next;
}
} /* Client_DestroyNow */
GLOBAL VOID GLOBAL VOID
Client_SetHostname( CLIENT *Client, CHAR *Hostname ) Client_SetHostname( CLIENT *Client, CHAR *Hostname )
{ {
@@ -333,7 +300,8 @@ Client_SetHostname( CLIENT *Client, CHAR *Hostname )
assert( Client != NULL ); assert( Client != NULL );
assert( Hostname != NULL ); assert( Hostname != NULL );
strlcpy( Client->host, Hostname, sizeof( Client->host )); strncpy( Client->host, Hostname, CLIENT_HOST_LEN - 1 );
Client->host[CLIENT_HOST_LEN - 1] = '\0';
} /* Client_SetHostname */ } /* Client_SetHostname */
@@ -345,7 +313,8 @@ Client_SetID( CLIENT *Client, CHAR *ID )
assert( Client != NULL ); assert( Client != NULL );
assert( ID != NULL ); assert( ID != NULL );
strlcpy( Client->id, ID, sizeof( Client->id )); strncpy( Client->id, ID, CLIENT_ID_LEN - 1 );
Client->id[CLIENT_ID_LEN - 1] = '\0';
/* Hash */ /* Hash */
Client->hash = Hash( Client->id ); Client->hash = Hash( Client->id );
@@ -360,12 +329,13 @@ Client_SetUser( CLIENT *Client, CHAR *User, BOOLEAN Idented )
assert( Client != NULL ); assert( Client != NULL );
assert( User != NULL ); assert( User != NULL );
if( Idented ) strlcpy( Client->user, User, sizeof( Client->user )); if( Idented ) strncpy( Client->user, User, CLIENT_USER_LEN - 1 );
else else
{ {
Client->user[0] = '~'; Client->user[0] = '~';
strlcpy( Client->user + 1, User, sizeof( Client->user ) - 1 ); strncpy( Client->user + 1, User, CLIENT_USER_LEN - 2 );
} }
Client->user[CLIENT_USER_LEN - 1] = '\0';
} /* Client_SetUser */ } /* Client_SetUser */
@@ -377,7 +347,8 @@ Client_SetInfo( CLIENT *Client, CHAR *Info )
assert( Client != NULL ); assert( Client != NULL );
assert( Info != NULL ); assert( Info != NULL );
strlcpy( Client->info, Info, sizeof( Client->info )); strncpy( Client->info, Info, CLIENT_INFO_LEN - 1 );
Client->info[CLIENT_INFO_LEN - 1] = '\0';
} /* Client_SetInfo */ } /* Client_SetInfo */
@@ -389,7 +360,8 @@ Client_SetModes( CLIENT *Client, CHAR *Modes )
assert( Client != NULL ); assert( Client != NULL );
assert( Modes != NULL ); assert( Modes != NULL );
strlcpy( Client->modes, Modes, sizeof( Client->modes )); strncpy( Client->modes, Modes, CLIENT_MODE_LEN - 1 );
Client->modes[CLIENT_MODE_LEN - 1] = '\0';
} /* Client_SetModes */ } /* Client_SetModes */
@@ -401,7 +373,8 @@ Client_SetFlags( CLIENT *Client, CHAR *Flags )
assert( Client != NULL ); assert( Client != NULL );
assert( Flags != NULL ); assert( Flags != NULL );
strlcpy( Client->flags, Flags, sizeof( Client->flags )); strncpy( Client->flags, Flags, CLIENT_FLAGS_LEN - 1 );
Client->flags[CLIENT_FLAGS_LEN - 1] = '\0';
} /* Client_SetFlags */ } /* Client_SetFlags */
@@ -413,7 +386,8 @@ Client_SetPassword( CLIENT *Client, CHAR *Pwd )
assert( Client != NULL ); assert( Client != NULL );
assert( Pwd != NULL ); assert( Pwd != NULL );
strlcpy( Client->pwd, Pwd, sizeof( Client->pwd )); strncpy( Client->pwd, Pwd, CLIENT_PASS_LEN - 1 );
Client->pwd[CLIENT_PASS_LEN - 1] = '\0';
} /* Client_SetPassword */ } /* Client_SetPassword */
@@ -425,7 +399,8 @@ Client_SetAway( CLIENT *Client, CHAR *Txt )
assert( Client != NULL ); assert( Client != NULL );
assert( Txt != NULL ); assert( Txt != NULL );
strlcpy( Client->away, Txt, sizeof( Client->away )); strncpy( Client->away, Txt, CLIENT_AWAY_LEN - 1 );
Client->away[CLIENT_AWAY_LEN - 1] = '\0';
Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt ); Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
} /* Client_SetAway */ } /* Client_SetAway */
@@ -488,7 +463,7 @@ Client_ModeAdd( CLIENT *Client, CHAR Mode )
if( ! strchr( Client->modes, x[0] )) if( ! strchr( Client->modes, x[0] ))
{ {
/* Client hat den Mode noch nicht -> setzen */ /* Client hat den Mode noch nicht -> setzen */
strlcat( Client->modes, x, sizeof( Client->modes )); strcat( Client->modes, x );
return TRUE; return TRUE;
} }
else return FALSE; else return FALSE;
@@ -554,7 +529,8 @@ Client_Search( CHAR *Nick )
assert( Nick != NULL ); assert( Nick != NULL );
/* Nick kopieren und ggf. Host-Mask abschneiden */ /* Nick kopieren und ggf. Host-Mask abschneiden */
strlcpy( search_id, Nick, sizeof( search_id )); strncpy( search_id, Nick, CLIENT_ID_LEN - 1 );
search_id[CLIENT_ID_LEN - 1] = '\0';
ptr = strchr( search_id, '!' ); ptr = strchr( search_id, '!' );
if( ptr ) *ptr = '\0'; if( ptr ) *ptr = '\0';
@@ -822,7 +798,7 @@ Client_CheckID( CLIENT *Client, CHAR *ID )
if( strcasecmp( c->id, ID ) == 0 ) if( strcasecmp( c->id, ID ) == 0 )
{ {
/* die Server-ID gibt es bereits */ /* die Server-ID gibt es bereits */
snprintf( str, sizeof( str ), "ID \"%s\" already registered", ID ); sprintf( str, "ID \"%s\" already registered", ID );
if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id ); if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id );
else Log( LOG_ERR, "%s (via network)!", str ); else Log( LOG_ERR, "%s (via network)!", str );
Conn_Close( Client->conn_id, str, str, TRUE ); Conn_Close( Client->conn_id, str, str, TRUE );

View File

@@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
* *
* $Id: client.h,v 1.34 2003/01/15 14:28:25 alex Exp $ * $Id: client.h,v 1.32.2.1 2002/12/22 23:42:28 alex Exp $
* *
* Client management (header) * Client management (header)
*/ */
@@ -62,81 +62,78 @@ typedef POINTER CLIENT;
#endif #endif
GLOBAL VOID Client_Init PARAMS(( VOID )); GLOBAL VOID Client_Init PARAMS((VOID ));
GLOBAL VOID Client_Exit PARAMS(( VOID )); GLOBAL VOID Client_Exit PARAMS((VOID ));
GLOBAL CLIENT *Client_NewLocal PARAMS(( CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented )); GLOBAL CLIENT *Client_NewLocal PARAMS((CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented ));
GLOBAL CLIENT *Client_NewRemoteServer PARAMS(( CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented )); GLOBAL CLIENT *Client_NewRemoteServer PARAMS((CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented ));
GLOBAL CLIENT *Client_NewRemoteUser PARAMS(( CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented )); GLOBAL CLIENT *Client_NewRemoteUser PARAMS((CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented ));
GLOBAL CLIENT *Client_New PARAMS(( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented )); GLOBAL CLIENT *Client_New PARAMS((CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented ));
GLOBAL VOID Client_Destroy PARAMS(( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )); GLOBAL VOID Client_Destroy PARAMS((CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit ));
#ifdef CONN_MODULE
GLOBAL VOID Client_DestroyNow PARAMS(( CLIENT *Client ));
#endif
GLOBAL CLIENT *Client_ThisServer PARAMS(( VOID )); GLOBAL CLIENT *Client_ThisServer PARAMS((VOID ));
GLOBAL CLIENT *Client_GetFromConn PARAMS(( CONN_ID Idx )); GLOBAL CLIENT *Client_GetFromConn PARAMS((CONN_ID Idx ));
GLOBAL CLIENT *Client_GetFromToken PARAMS(( CLIENT *Client, INT Token )); GLOBAL CLIENT *Client_GetFromToken PARAMS((CLIENT *Client, INT Token ));
GLOBAL CLIENT *Client_Search PARAMS(( CHAR *ID )); GLOBAL CLIENT *Client_Search PARAMS((CHAR *ID ));
GLOBAL CLIENT *Client_First PARAMS(( VOID )); GLOBAL CLIENT *Client_First PARAMS((VOID ));
GLOBAL CLIENT *Client_Next PARAMS(( CLIENT *c )); GLOBAL CLIENT *Client_Next PARAMS((CLIENT *c ));
GLOBAL INT Client_Type PARAMS(( CLIENT *Client )); GLOBAL INT Client_Type PARAMS((CLIENT *Client ));
GLOBAL CONN_ID Client_Conn PARAMS(( CLIENT *Client )); GLOBAL CONN_ID Client_Conn PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_ID PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_ID PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Mask PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Mask PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Info PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Info PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_User PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_User PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Hostname PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Hostname PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Password PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Password PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Modes PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Modes PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Flags PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Flags PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_Introducer PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN Client_OperByMe PARAMS(( CLIENT *Client )); GLOBAL BOOLEAN Client_OperByMe PARAMS((CLIENT *Client ));
GLOBAL INT Client_Hops PARAMS(( CLIENT *Client )); GLOBAL INT Client_Hops PARAMS((CLIENT *Client ));
GLOBAL INT Client_Token PARAMS(( CLIENT *Client )); GLOBAL INT Client_Token PARAMS((CLIENT *Client ));
GLOBAL INT Client_MyToken PARAMS(( CLIENT *Client )); GLOBAL INT Client_MyToken PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_TopServer PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_TopServer PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_NextHop PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_NextHop PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Away PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Away PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN Client_HasMode PARAMS(( CLIENT *Client, CHAR Mode )); GLOBAL BOOLEAN Client_HasMode PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL VOID Client_SetHostname PARAMS(( CLIENT *Client, CHAR *Hostname )); GLOBAL VOID Client_SetHostname PARAMS((CLIENT *Client, CHAR *Hostname ));
GLOBAL VOID Client_SetID PARAMS(( CLIENT *Client, CHAR *Nick )); GLOBAL VOID Client_SetID PARAMS((CLIENT *Client, CHAR *Nick ));
GLOBAL VOID Client_SetUser PARAMS(( CLIENT *Client, CHAR *User, BOOLEAN Idented )); GLOBAL VOID Client_SetUser PARAMS((CLIENT *Client, CHAR *User, BOOLEAN Idented ));
GLOBAL VOID Client_SetInfo PARAMS(( CLIENT *Client, CHAR *Info )); GLOBAL VOID Client_SetInfo PARAMS((CLIENT *Client, CHAR *Info ));
GLOBAL VOID Client_SetPassword PARAMS(( CLIENT *Client, CHAR *Pwd )); GLOBAL VOID Client_SetPassword PARAMS((CLIENT *Client, CHAR *Pwd ));
GLOBAL VOID Client_SetType PARAMS(( CLIENT *Client, INT Type )); GLOBAL VOID Client_SetType PARAMS((CLIENT *Client, INT Type ));
GLOBAL VOID Client_SetHops PARAMS(( CLIENT *Client, INT Hops )); GLOBAL VOID Client_SetHops PARAMS((CLIENT *Client, INT Hops ));
GLOBAL VOID Client_SetToken PARAMS(( CLIENT *Client, INT Token )); GLOBAL VOID Client_SetToken PARAMS((CLIENT *Client, INT Token ));
GLOBAL VOID Client_SetOperByMe PARAMS(( CLIENT *Client, BOOLEAN OperByMe )); GLOBAL VOID Client_SetOperByMe PARAMS((CLIENT *Client, BOOLEAN OperByMe ));
GLOBAL VOID Client_SetModes PARAMS(( CLIENT *Client, CHAR *Modes )); GLOBAL VOID Client_SetModes PARAMS((CLIENT *Client, CHAR *Modes ));
GLOBAL VOID Client_SetFlags PARAMS(( CLIENT *Client, CHAR *Flags )); GLOBAL VOID Client_SetFlags PARAMS((CLIENT *Client, CHAR *Flags ));
GLOBAL VOID Client_SetIntroducer PARAMS(( CLIENT *Client, CLIENT *Introducer )); GLOBAL VOID Client_SetIntroducer PARAMS((CLIENT *Client, CLIENT *Introducer ));
GLOBAL VOID Client_SetAway PARAMS(( CLIENT *Client, CHAR *Txt )); GLOBAL VOID Client_SetAway PARAMS((CLIENT *Client, CHAR *Txt ));
GLOBAL BOOLEAN Client_ModeAdd PARAMS(( CLIENT *Client, CHAR Mode )); GLOBAL BOOLEAN Client_ModeAdd PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_ModeDel PARAMS(( CLIENT *Client, CHAR Mode )); GLOBAL BOOLEAN Client_ModeDel PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_CheckNick PARAMS(( CLIENT *Client, CHAR *Nick )); GLOBAL BOOLEAN Client_CheckNick PARAMS((CLIENT *Client, CHAR *Nick ));
GLOBAL BOOLEAN Client_CheckID PARAMS(( CLIENT *Client, CHAR *ID )); GLOBAL BOOLEAN Client_CheckID PARAMS((CLIENT *Client, CHAR *ID ));
GLOBAL LONG Client_UserCount PARAMS(( VOID )); GLOBAL LONG Client_UserCount PARAMS((VOID ));
GLOBAL LONG Client_ServiceCount PARAMS(( VOID )); GLOBAL LONG Client_ServiceCount PARAMS((VOID ));
GLOBAL LONG Client_ServerCount PARAMS(( VOID )); GLOBAL LONG Client_ServerCount PARAMS((VOID ));
GLOBAL LONG Client_OperCount PARAMS(( VOID )); GLOBAL LONG Client_OperCount PARAMS((VOID ));
GLOBAL LONG Client_UnknownCount PARAMS(( VOID )); GLOBAL LONG Client_UnknownCount PARAMS((VOID ));
GLOBAL LONG Client_MyUserCount PARAMS(( VOID )); GLOBAL LONG Client_MyUserCount PARAMS((VOID ));
GLOBAL LONG Client_MyServiceCount PARAMS(( VOID )); GLOBAL LONG Client_MyServiceCount PARAMS((VOID ));
GLOBAL LONG Client_MyServerCount PARAMS(( VOID )); GLOBAL LONG Client_MyServerCount PARAMS((VOID ));
GLOBAL LONG Client_MaxUserCount PARAMS(( VOID )); GLOBAL LONG Client_MaxUserCount PARAMS(( VOID ));
GLOBAL LONG Client_MyMaxUserCount PARAMS(( VOID )); GLOBAL LONG Client_MyMaxUserCount PARAMS(( VOID ));
GLOBAL BOOLEAN Client_IsValidNick PARAMS(( CHAR *Nick )); GLOBAL BOOLEAN Client_IsValidNick PARAMS((CHAR *Nick ));
#endif #endif

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: conf.c,v 1.57 2003/04/21 11:06:07 alex Exp $"; static char UNUSED id[] = "$Id: conf.c,v 1.47 2002/12/18 02:53:36 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -46,11 +46,9 @@ static char UNUSED id[] = "$Id: conf.c,v 1.57 2003/04/21 11:06:07 alex Exp $";
LOCAL BOOLEAN Use_Log = TRUE; LOCAL BOOLEAN Use_Log = TRUE;
LOCAL CONF_SERVER New_Server;
LOCAL INT New_Server_Idx;
LOCAL VOID Set_Defaults PARAMS(( BOOLEAN InitServers )); LOCAL VOID Set_Defaults PARAMS(( VOID ));
LOCAL VOID Read_Config PARAMS(( VOID )); LOCAL VOID Read_Config PARAMS(( VOID ));
LOCAL VOID Validate_Config PARAMS(( BOOLEAN TestOnly )); LOCAL VOID Validate_Config PARAMS(( BOOLEAN TestOnly ));
@@ -61,27 +59,16 @@ LOCAL VOID Handle_CHANNEL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
LOCAL VOID Config_Error PARAMS(( CONST INT Level, CONST CHAR *Format, ... )); LOCAL VOID Config_Error PARAMS(( CONST INT Level, CONST CHAR *Format, ... ));
LOCAL VOID Init_Server_Struct PARAMS(( CONF_SERVER *Server ));
GLOBAL VOID GLOBAL VOID
Conf_Init( VOID ) Conf_Init( VOID )
{ {
Set_Defaults( TRUE ); Set_Defaults( );
Read_Config( ); Read_Config( );
Validate_Config( FALSE ); Validate_Config( FALSE );
} /* Config_Init */ } /* Config_Init */
GLOBAL VOID
Conf_Rehash( VOID )
{
Set_Defaults( FALSE );
Read_Config( );
Validate_Config( FALSE );
} /* Config_Rehash */
GLOBAL INT GLOBAL INT
Conf_Test( VOID ) Conf_Test( VOID )
{ {
@@ -92,7 +79,7 @@ Conf_Test( VOID )
INT i; INT i;
Use_Log = FALSE; Use_Log = FALSE;
Set_Defaults( TRUE ); Set_Defaults( );
Read_Config( ); Read_Config( );
Validate_Config( TRUE ); Validate_Config( TRUE );
@@ -147,7 +134,7 @@ Conf_Test( VOID )
puts( "" ); puts( "" );
} }
for( i = 0; i < MAX_SERVERS; i++ ) for( i = 0; i < Conf_Server_Count; i++ )
{ {
if( ! Conf_Server[i].name[0] ) continue; if( ! Conf_Server[i].name[0] ) continue;
@@ -178,166 +165,20 @@ Conf_Test( VOID )
} /* Conf_Test */ } /* Conf_Test */
GLOBAL VOID
Conf_UnsetServer( CONN_ID Idx )
{
/* Set next time for next connection attempt, if this is a server
* link that is (still) configured here. If the server is set as
* "once", delete it from our configuration.
* Non-Server-Connections will be silently ignored. */
INT i;
/* Check all our configured servers */
for( i = 0; i < MAX_SERVERS; i++ )
{
if( Conf_Server[i].conn_id != Idx ) continue;
/* Gotcha! Mark server configuration as "unused": */
Conf_Server[i].conn_id = NONE;
if( Conf_Server[i].flags & CONF_SFLAG_ONCE )
{
/* Delete configuration here */
Init_Server_Struct( &Conf_Server[i] );
}
else
{
/* Set time for next connect attempt */
if( Conf_Server[i].lasttry < time( NULL ) - Conf_ConnectRetry )
{
/* Okay, the connection was established "long enough": */
Conf_Server[i].lasttry = time( NULL ) - Conf_ConnectRetry + RECONNECT_DELAY;
}
}
}
} /* Conf_UnsetServer */
GLOBAL VOID
Conf_SetServer( INT ConfServer, CONN_ID Idx )
{
/* Set connection for specified configured server */
assert( ConfServer > NONE );
assert( Idx > NONE );
Conf_Server[ConfServer].conn_id = Idx;
} /* Conf_SetServer */
GLOBAL INT
Conf_GetServer( CONN_ID Idx )
{
/* Get index of server in configuration structure */
INT i = 0;
assert( Idx > NONE );
for( i = 0; i < MAX_SERVERS; i++ )
{
if( Conf_Server[i].conn_id == Idx ) return i;
}
return NONE;
} /* Conf_GetServer */
GLOBAL BOOLEAN
Conf_EnableServer( CHAR *Name, INT Port )
{
/* Enable specified server and adjust port */
INT i;
assert( Name != NULL );
for( i = 0; i < MAX_SERVERS; i++ )
{
if( strcasecmp( Conf_Server[i].name, Name ) == 0 )
{
/* Gotcha! Set port and enable server: */
Conf_Server[i].port = Port;
Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED;
return TRUE;
}
}
return FALSE;
} /* Conf_EnableServer */
GLOBAL BOOLEAN
Conf_DisableServer( CHAR *Name )
{
/* Enable specified server and adjust port */
INT i;
assert( Name != NULL );
for( i = 0; i < MAX_SERVERS; i++ )
{
if( strcasecmp( Conf_Server[i].name, Name ) == 0 )
{
/* Gotcha! Disable and disconnect server: */
Conf_Server[i].flags |= CONF_SFLAG_DISABLED;
if( Conf_Server[i].conn_id > NONE ) Conn_Close( Conf_Server[i].conn_id, NULL, "Server link terminated on operator request", TRUE );
return TRUE;
}
}
return FALSE;
} /* Conf_DisableServer */
GLOBAL BOOLEAN
Conf_AddServer( CHAR *Name, INT Port, CHAR *Host, CHAR *MyPwd, CHAR *PeerPwd )
{
/* Add new server to configuration */
INT i;
assert( Name != NULL );
assert( Host != NULL );
assert( MyPwd != NULL );
assert( PeerPwd != NULL );
/* Search unused item in server configuration structure */
for( i = 0; i < MAX_SERVERS; i++ )
{
/* Is this item used? */
if( ! Conf_Server[i].name[0] ) break;
}
if( i >= MAX_SERVERS ) return FALSE;
Init_Server_Struct( &Conf_Server[i] );
strlcpy( Conf_Server[i].name, Name, sizeof( Conf_Server[i].name ));
strlcpy( Conf_Server[i].host, Host, sizeof( Conf_Server[i].host ));
strlcpy( Conf_Server[i].pwd_out, MyPwd, sizeof( Conf_Server[i].pwd_out ));
strlcpy( Conf_Server[i].pwd_in, PeerPwd, sizeof( Conf_Server[i].pwd_in ));
Conf_Server[i].port = Port;
Conf_Server[i].flags = CONF_SFLAG_ONCE;
return TRUE;
} /* Conf_AddServer */
LOCAL VOID LOCAL VOID
Set_Defaults( BOOLEAN InitServers ) Set_Defaults( VOID )
{ {
/* Initialize configuration variables with default values. */ /* Initialize configuration variables with default values. */
INT i;
strcpy( Conf_ServerName, "" ); strcpy( Conf_ServerName, "" );
sprintf( Conf_ServerInfo, "%s %s", PACKAGE_NAME, PACKAGE_VERSION ); sprintf( Conf_ServerInfo, "%s %s", PACKAGE, VERSION );
strcpy( Conf_ServerPwd, "" ); strcpy( Conf_ServerPwd, "" );
strcpy( Conf_ServerAdmin1, "" ); strcpy( Conf_ServerAdmin1, "" );
strcpy( Conf_ServerAdmin2, "" ); strcpy( Conf_ServerAdmin2, "" );
strcpy( Conf_ServerAdminMail, "" ); strcpy( Conf_ServerAdminMail, "" );
strlcpy( Conf_MotdFile, SYSCONFDIR, sizeof( Conf_MotdFile )); strcpy( Conf_MotdFile, MOTD_FILE );
strlcat( Conf_MotdFile, MOTD_FILE, sizeof( Conf_MotdFile ));
Conf_ListenPorts_Count = 0; Conf_ListenPorts_Count = 0;
@@ -349,15 +190,13 @@ Set_Defaults( BOOLEAN InitServers )
Conf_ConnectRetry = 60; Conf_ConnectRetry = 60;
Conf_Oper_Count = 0; Conf_Oper_Count = 0;
Conf_Server_Count = 0;
Conf_Channel_Count = 0; Conf_Channel_Count = 0;
Conf_OperCanMode = FALSE; Conf_OperCanMode = FALSE;
Conf_MaxConnections = -1; Conf_MaxConnections = -1;
Conf_MaxJoins = 10; Conf_MaxJoins = 10;
/* Initialize server configuration structures */
if( InitServers ) for( i = 0; i < MAX_SERVERS; Init_Server_Struct( &Conf_Server[i++] ));
} /* Set_Defaults */ } /* Set_Defaults */
@@ -367,63 +206,22 @@ Read_Config( VOID )
/* Read configuration file. */ /* Read configuration file. */
CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr; CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
INT line, i, n; INT line;
FILE *fd; FILE *fd;
/* Open configuration file */
fd = fopen( NGIRCd_ConfFile, "r" ); fd = fopen( NGIRCd_ConfFile, "r" );
if( ! fd ) if( ! fd )
{ {
/* No configuration file found! */ /* No configuration file found! */
Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno )); Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno ));
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 ); exit( 1 );
} }
Config_Error( LOG_INFO, "Reading configuration from \"%s\" ...", NGIRCd_ConfFile ); Config_Error( LOG_INFO, "Reading configuration from \"%s\" ...", NGIRCd_ConfFile );
/* Clean up server configuration structure: mark all already
* configured servers as "once" so that they are deleted
* after the next disconnect and delete all unused servers.
* And delete all servers which are "duplicates" of servers
* that are already marked as "once" (such servers have been
* created by the last rehash but are now useless). */
for( i = 0; i < MAX_SERVERS; i++ )
{
if( Conf_Server[i].conn_id == NONE ) Init_Server_Struct( &Conf_Server[i] );
else
{
/* This structure is in use ... */
if( Conf_Server[i].flags & CONF_SFLAG_ONCE )
{
/* Check for duplicates */
for( n = 0; n < MAX_SERVERS; n++ )
{
if( n == i ) continue;
if( Conf_Server[i].conn_id == Conf_Server[n].conn_id )
{
Init_Server_Struct( &Conf_Server[n] );
Log( LOG_DEBUG, "Deleted unused duplicate server %d (kept %d).", n, i );
}
}
}
else
{
/* Mark server as "once" */
Conf_Server[i].flags |= CONF_SFLAG_ONCE;
Log( LOG_DEBUG, "Marked server %d as \"once\"", i );
}
}
}
/* Initialize variables */
line = 0; line = 0;
strcpy( section, "" ); strcpy( section, "" );
Init_Server_Struct( &New_Server );
New_Server_Idx = NONE;
/* Read configuration file */
while( TRUE ) while( TRUE )
{ {
if( ! fgets( str, LINE_LEN, fd )) break; if( ! fgets( str, LINE_LEN, fd )) break;
@@ -436,7 +234,7 @@ Read_Config( VOID )
/* Is this the beginning of a new section? */ /* Is this the beginning of a new section? */
if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' )) if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' ))
{ {
strlcpy( section, str, sizeof( section )); strcpy( section, str );
if( strcasecmp( section, "[GLOBAL]" ) == 0 ) continue; if( strcasecmp( section, "[GLOBAL]" ) == 0 ) continue;
if( strcasecmp( section, "[OPERATOR]" ) == 0 ) if( strcasecmp( section, "[OPERATOR]" ) == 0 )
{ {
@@ -452,30 +250,21 @@ Read_Config( VOID )
} }
if( strcasecmp( section, "[SERVER]" ) == 0 ) if( strcasecmp( section, "[SERVER]" ) == 0 )
{ {
/* Check if there is already a server to add */ if( Conf_Server_Count + 1 > MAX_SERVERS ) Config_Error( LOG_ERR, "Too many servers configured." );
if( New_Server.name[0] ) else
{ {
/* Copy data to "real" server structure */ /* Initialize new server structure */
assert( New_Server_Idx > NONE ); strcpy( Conf_Server[Conf_Server_Count].host, "" );
Conf_Server[New_Server_Idx] = New_Server; strcpy( Conf_Server[Conf_Server_Count].ip, "" );
strcpy( Conf_Server[Conf_Server_Count].name, "" );
strcpy( Conf_Server[Conf_Server_Count].pwd_in, "" );
strcpy( Conf_Server[Conf_Server_Count].pwd_out, "" );
Conf_Server[Conf_Server_Count].port = 0;
Conf_Server[Conf_Server_Count].group = -1;
Conf_Server[Conf_Server_Count].lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
Conf_Server[Conf_Server_Count].res_stat = NULL;
Conf_Server_Count++;
} }
/* Re-init structure for new server */
Init_Server_Struct( &New_Server );
/* Search unused item in server configuration structure */
for( i = 0; i < MAX_SERVERS; i++ )
{
/* Is this item used? */
if( ! Conf_Server[i].name[0] ) break;
}
if( i >= MAX_SERVERS )
{
/* Oops, no free item found! */
Config_Error( LOG_ERR, "Too many servers configured." );
New_Server_Idx = NONE;
}
else New_Server_Idx = i;
continue; continue;
} }
if( strcasecmp( section, "[CHANNEL]" ) == 0 ) if( strcasecmp( section, "[CHANNEL]" ) == 0 )
@@ -514,17 +303,8 @@ Read_Config( VOID )
else Config_Error( LOG_ERR, "%s, line %d: Variable \"%s\" outside section!", NGIRCd_ConfFile, line, var ); else Config_Error( LOG_ERR, "%s, line %d: Variable \"%s\" outside section!", NGIRCd_ConfFile, line, var );
} }
/* Close configuration file */
fclose( fd ); fclose( fd );
/* Check if there is still a server to add */
if( New_Server.name[0] )
{
/* Copy data to "real" server structure */
assert( New_Server_Idx > NONE );
Conf_Server[New_Server_Idx] = New_Server;
}
/* If there are no ports configured use the default: 6667 */ /* If there are no ports configured use the default: 6667 */
if( Conf_ListenPorts_Count < 1 ) if( Conf_ListenPorts_Count < 1 )
{ {
@@ -549,37 +329,49 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
if( strcasecmp( Var, "Name" ) == 0 ) if( strcasecmp( Var, "Name" ) == 0 )
{ {
/* Server name */ /* Server name */
if( strlcpy( Conf_ServerName, Arg, sizeof( Conf_ServerName )) >= sizeof( Conf_ServerName )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_ServerName, Arg, CLIENT_ID_LEN - 1 );
Conf_ServerName[CLIENT_ID_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "Info" ) == 0 ) if( strcasecmp( Var, "Info" ) == 0 )
{ {
/* Info text of server */ /* Info text of server */
if( strlcpy( Conf_ServerInfo, Arg, sizeof( Conf_ServerInfo )) >= sizeof( Conf_ServerInfo )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Info\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_ServerInfo, Arg, CLIENT_INFO_LEN - 1 );
Conf_ServerInfo[CLIENT_INFO_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Info\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "Password" ) == 0 ) if( strcasecmp( Var, "Password" ) == 0 )
{ {
/* Global server password */ /* Global server password */
if( strlcpy( Conf_ServerPwd, Arg, sizeof( Conf_ServerPwd )) >= sizeof( Conf_ServerPwd )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_ServerPwd, Arg, CLIENT_PASS_LEN - 1 );
Conf_ServerPwd[CLIENT_PASS_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "AdminInfo1" ) == 0 ) if( strcasecmp( Var, "AdminInfo1" ) == 0 )
{ {
/* Administrative info #1 */ /* Administrative info #1 */
if( strlcpy( Conf_ServerAdmin1, Arg, sizeof( Conf_ServerAdmin1 )) >= sizeof( Conf_ServerAdmin1 )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo1\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_ServerAdmin1, Arg, CLIENT_INFO_LEN - 1 );
Conf_ServerAdmin1[CLIENT_INFO_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo1\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "AdminInfo2" ) == 0 ) if( strcasecmp( Var, "AdminInfo2" ) == 0 )
{ {
/* Administrative info #2 */ /* Administrative info #2 */
if( strlcpy( Conf_ServerAdmin2, Arg, sizeof( Conf_ServerAdmin2 )) >= sizeof( Conf_ServerAdmin2 )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo2\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_ServerAdmin2, Arg, CLIENT_INFO_LEN - 1 );
Conf_ServerAdmin2[CLIENT_INFO_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo2\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "AdminEMail" ) == 0 ) if( strcasecmp( Var, "AdminEMail" ) == 0 )
{ {
/* Administrative email contact */ /* Administrative email contact */
if( strlcpy( Conf_ServerAdminMail, Arg, sizeof( Conf_ServerAdminMail )) >= sizeof( Conf_ServerAdminMail )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminEMail\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_ServerAdminMail, Arg, CLIENT_INFO_LEN - 1 );
Conf_ServerAdminMail[CLIENT_INFO_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminEMail\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "Ports" ) == 0 ) if( strcasecmp( Var, "Ports" ) == 0 )
@@ -604,7 +396,9 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
if( strcasecmp( Var, "MotdFile" ) == 0 ) if( strcasecmp( Var, "MotdFile" ) == 0 )
{ {
/* "Message of the day" (MOTD) file */ /* "Message of the day" (MOTD) file */
if( strlcpy( Conf_MotdFile, Arg, sizeof( Conf_MotdFile )) >= sizeof( Conf_MotdFile )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MotdFile\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_MotdFile, Arg, FNAME_LEN - 1 );
Conf_MotdFile[FNAME_LEN - 1] = '\0';
if( strlen( Arg ) > FNAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MotdFile\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "ServerUID" ) == 0 ) if( strcasecmp( Var, "ServerUID" ) == 0 )
@@ -715,13 +509,17 @@ Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
if( strcasecmp( Var, "Name" ) == 0 ) if( strcasecmp( Var, "Name" ) == 0 )
{ {
/* Name of IRC operator */ /* Name of IRC operator */
if( strlcpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, sizeof( Conf_Oper[Conf_Oper_Count - 1].name )) >= sizeof( Conf_Oper[Conf_Oper_Count - 1].name )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, CLIENT_PASS_LEN - 1 );
Conf_Oper[Conf_Oper_Count - 1].name[CLIENT_PASS_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "Password" ) == 0 ) if( strcasecmp( Var, "Password" ) == 0 )
{ {
/* Password of IRC operator */ /* Password of IRC operator */
if( strlcpy( Conf_Oper[Conf_Oper_Count - 1].pwd, Arg, sizeof( Conf_Oper[Conf_Oper_Count - 1].pwd )) >= sizeof( Conf_Oper[Conf_Oper_Count - 1].pwd )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_Oper[Conf_Oper_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
Conf_Oper[Conf_Oper_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
@@ -738,38 +536,43 @@ Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
assert( Var != NULL ); assert( Var != NULL );
assert( Arg != NULL ); assert( Arg != NULL );
/* Ignore server block if no space is left in server configuration structure */
if( New_Server_Idx <= NONE ) return;
if( strcasecmp( Var, "Host" ) == 0 ) if( strcasecmp( Var, "Host" ) == 0 )
{ {
/* Hostname of the server */ /* Hostname of the server */
if( strlcpy( New_Server.host, Arg, sizeof( New_Server.host )) >= sizeof( New_Server.host )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Host\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_Server[Conf_Server_Count - 1].host, Arg, HOST_LEN - 1 );
Conf_Server[Conf_Server_Count - 1].host[HOST_LEN - 1] = '\0';
if( strlen( Arg ) > HOST_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Host\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "Name" ) == 0 ) if( strcasecmp( Var, "Name" ) == 0 )
{ {
/* Name of the server ("Nick"/"ID") */ /* Name of the server ("Nick"/"ID") */
if( strlcpy( New_Server.name, Arg, sizeof( New_Server.name )) >= sizeof( New_Server.name )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_Server[Conf_Server_Count - 1].name, Arg, CLIENT_ID_LEN - 1 );
Conf_Server[Conf_Server_Count - 1].name[CLIENT_ID_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "MyPassword" ) == 0 ) if( strcasecmp( Var, "MyPassword" ) == 0 )
{ {
/* Password of this server which is sent to the peer */ /* Password of this server which is sent to the peer */
if( strlcpy( New_Server.pwd_in, Arg, sizeof( New_Server.pwd_in )) >= sizeof( New_Server.pwd_in )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MyPassword\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_Server[Conf_Server_Count - 1].pwd_in, Arg, CLIENT_PASS_LEN - 1 );
Conf_Server[Conf_Server_Count - 1].pwd_in[CLIENT_PASS_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MyPassword\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "PeerPassword" ) == 0 ) if( strcasecmp( Var, "PeerPassword" ) == 0 )
{ {
/* Passwort of the peer which must be received */ /* Passwort of the peer which must be received */
if( strlcpy( New_Server.pwd_out, Arg, sizeof( New_Server.pwd_out )) >= sizeof( New_Server.pwd_out )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"PeerPassword\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_Server[Conf_Server_Count - 1].pwd_out, Arg, CLIENT_PASS_LEN - 1 );
Conf_Server[Conf_Server_Count - 1].pwd_out[CLIENT_PASS_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"PeerPassword\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "Port" ) == 0 ) if( strcasecmp( Var, "Port" ) == 0 )
{ {
/* Port to which this server should connect */ /* Port to which this server should connect */
port = atol( Arg ); port = atol( Arg );
if( port > 0 && port < 0xFFFF ) New_Server.port = (INT)port; if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = (INT)port;
else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port ); else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
return; return;
} }
@@ -780,7 +583,7 @@ Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Group\" is not a number!", NGIRCd_ConfFile, Line ); if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Group\" is not a number!", NGIRCd_ConfFile, Line );
else else
#endif #endif
New_Server.group = atoi( Arg ); Conf_Server[Conf_Server_Count - 1].group = atoi( Arg );
return; return;
} }
@@ -798,19 +601,25 @@ Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
if( strcasecmp( Var, "Name" ) == 0 ) if( strcasecmp( Var, "Name" ) == 0 )
{ {
/* Name of the channel */ /* Name of the channel */
if( strlcpy( Conf_Channel[Conf_Channel_Count - 1].name, Arg, sizeof( Conf_Channel[Conf_Channel_Count - 1].name )) >= sizeof( Conf_Channel[Conf_Channel_Count - 1].name )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_Channel[Conf_Channel_Count - 1].name, Arg, CHANNEL_NAME_LEN - 1 );
Conf_Channel[Conf_Channel_Count - 1].name[CHANNEL_NAME_LEN - 1] = '\0';
if( strlen( Arg ) > CHANNEL_NAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "Modes" ) == 0 ) if( strcasecmp( Var, "Modes" ) == 0 )
{ {
/* Initial modes */ /* Initial modes */
if( strlcpy( Conf_Channel[Conf_Channel_Count - 1].modes, Arg, sizeof( Conf_Channel[Conf_Channel_Count - 1].modes )) >= sizeof( Conf_Channel[Conf_Channel_Count - 1].modes )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Modes\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_Channel[Conf_Channel_Count - 1].modes, Arg, CHANNEL_MODE_LEN - 1 );
Conf_Channel[Conf_Channel_Count - 1].modes[CHANNEL_MODE_LEN - 1] = '\0';
if( strlen( Arg ) > CHANNEL_MODE_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Modes\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
if( strcasecmp( Var, "Topic" ) == 0 ) if( strcasecmp( Var, "Topic" ) == 0 )
{ {
/* Initial topic */ /* Initial topic */
if( strlcpy( Conf_Channel[Conf_Channel_Count - 1].topic, Arg, sizeof( Conf_Channel[Conf_Channel_Count - 1].topic )) >= sizeof( Conf_Channel[Conf_Channel_Count - 1].topic )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Topic\" too long!", NGIRCd_ConfFile, Line ); strncpy( Conf_Channel[Conf_Channel_Count - 1].topic, Arg, CHANNEL_TOPIC_LEN - 1 );
Conf_Channel[Conf_Channel_Count - 1].topic[CHANNEL_TOPIC_LEN - 1] = '\0';
if( strlen( Arg ) > CHANNEL_TOPIC_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Topic\" too long!", NGIRCd_ConfFile, Line );
return; return;
} }
@@ -823,17 +632,13 @@ Validate_Config( BOOLEAN Configtest )
{ {
/* Validate configuration settings. */ /* Validate configuration settings. */
#ifdef DEBUG
INT i, servers, servers_once;
#endif
if( ! Conf_ServerName[0] ) if( ! Conf_ServerName[0] )
{ {
/* No server name configured! */ /* No server name configured! */
Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile ); Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile );
if( ! Configtest ) if( ! Configtest )
{ {
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 ); exit( 1 );
} }
} }
@@ -845,7 +650,7 @@ Validate_Config( BOOLEAN Configtest )
Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile ); Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile );
if( ! Configtest ) if( ! Configtest )
{ {
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 ); exit( 1 );
} }
} }
@@ -865,19 +670,6 @@ Validate_Config( BOOLEAN Configtest )
#else #else
Config_Error( LOG_WARN, "Don't know how many file descriptors select() can handle on this system, don't set MaxConnections too high!" ); Config_Error( LOG_WARN, "Don't know how many file descriptors select() can handle on this system, don't set MaxConnections too high!" );
#endif #endif
#ifdef DEBUG
servers = servers_once = 0;
for( i = 0; i < MAX_SERVERS; i++ )
{
if( Conf_Server[i].name[0] )
{
servers++;
if( Conf_Server[i].flags & CONF_SFLAG_ONCE ) servers_once++;
}
}
Log( LOG_DEBUG, "Configuration: Operators=%d, Servers=%d[%d], Channels=%d", Conf_Oper_Count, servers, servers_once, Conf_Channel_Count );
#endif
} /* Validate_Config */ } /* Validate_Config */
@@ -913,26 +705,4 @@ va_dcl
} /* Config_Error */ } /* Config_Error */
LOCAL VOID
Init_Server_Struct( CONF_SERVER *Server )
{
/* Initialize server configuration structur to default values */
assert( Server != NULL );
strcpy( Server->host, "" );
strcpy( Server->ip, "" );
strcpy( Server->name, "" );
strcpy( Server->pwd_in, "" );
strcpy( Server->pwd_out, "" );
Server->port = 0;
Server->group = NONE;
Server->lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
Server->res_stat = NULL;
if( NGIRCd_Passive ) Server->flags = CONF_SFLAG_DISABLED;
else Server->flags = 0;
Server->conn_id = NONE;
} /* Init_Server_Struct */
/* -eof- */ /* -eof- */

View File

@@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
* *
* $Id: conf.h,v 1.26 2002/12/31 16:12:50 alex Exp $ * $Id: conf.h,v 1.24 2002/12/14 13:36:19 alex Exp $
* *
* Configuration management (header) * Configuration management (header)
*/ */
@@ -39,8 +39,6 @@ typedef struct _Conf_Server
INT group; /* Group of server */ INT group; /* Group of server */
time_t lasttry; /* Last connect attempt */ time_t lasttry; /* Last connect attempt */
RES_STAT *res_stat; /* Status of the resolver */ RES_STAT *res_stat; /* Status of the resolver */
INT flags; /* Flags */
CONN_ID conn_id; /* ID of server connection or NONE */
} CONF_SERVER; } CONF_SERVER;
typedef struct _Conf_Channel typedef struct _Conf_Channel
@@ -51,10 +49,6 @@ typedef struct _Conf_Channel
} CONF_CHANNEL; } CONF_CHANNEL;
#define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */
#define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */
/* Name ("Nick") of the servers */ /* Name ("Nick") of the servers */
GLOBAL CHAR Conf_ServerName[CLIENT_ID_LEN]; GLOBAL CHAR Conf_ServerName[CLIENT_ID_LEN];
@@ -93,6 +87,7 @@ GLOBAL INT Conf_Oper_Count;
/* Servers */ /* Servers */
GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS]; GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
GLOBAL INT Conf_Server_Count;
/* Pre-defined channels */ /* Pre-defined channels */
GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS]; GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
@@ -109,17 +104,8 @@ GLOBAL INT Conf_MaxJoins;
GLOBAL VOID Conf_Init PARAMS((VOID )); GLOBAL VOID Conf_Init PARAMS((VOID ));
GLOBAL VOID Conf_Rehash PARAMS((VOID ));
GLOBAL INT Conf_Test PARAMS((VOID )); GLOBAL INT Conf_Test PARAMS((VOID ));
GLOBAL VOID Conf_UnsetServer PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conf_SetServer PARAMS(( INT ConfServer, CONN_ID Idx ));
GLOBAL INT Conf_GetServer PARAMS(( CONN_ID Idx ));
GLOBAL BOOLEAN Conf_EnableServer PARAMS(( CHAR *Name, INT Port ));
GLOBAL BOOLEAN Conf_DisableServer PARAMS(( CHAR *Name ));
GLOBAL BOOLEAN Conf_AddServer PARAMS(( CHAR *Name, INT Port, CHAR *Host, CHAR *MyPwd, CHAR *PeerPwd ));
#endif #endif

View File

@@ -1,276 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* 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 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* Connection management: Global functions
*/
#define CONN_MODULE
#include "portab.h"
static char UNUSED id[] = "$Id: conn-func.c,v 1.1 2002/12/30 17:14:28 alex Exp $";
#include "imp.h"
#include <assert.h>
#include "conn.h"
#include "exp.h"
#include "conn-func.h"
GLOBAL VOID
Conn_UpdateIdle( CONN_ID Idx )
{
/* Idle-Timer zuruecksetzen */
assert( Idx > NONE );
My_Connections[Idx].lastprivmsg = time( NULL );
}
GLOBAL time_t
Conn_GetIdle( CONN_ID Idx )
{
/* Idle-Time einer Verbindung liefern (in Sekunden) */
assert( Idx > NONE );
return time( NULL ) - My_Connections[Idx].lastprivmsg;
} /* Conn_GetIdle */
GLOBAL time_t
Conn_LastPing( CONN_ID Idx )
{
/* Zeitpunkt des letzten PING liefern */
assert( Idx > NONE );
return My_Connections[Idx].lastping;
} /* Conn_LastPing */
GLOBAL VOID
Conn_SetPenalty( CONN_ID Idx, time_t Seconds )
{
/* Penalty-Delay fuer eine Verbindung (in Sekunden) setzen;
* waehrend dieser Zeit wird der entsprechende Socket vom Server
* bei Lese-Operationen komplett ignoriert. Der Delay kann mit
* dieser Funktion nur erhoeht, nicht aber verringert werden. */
time_t t;
assert( Idx > NONE );
assert( Seconds >= 0 );
t = time( NULL ) + Seconds;
if( t > My_Connections[Idx].delaytime ) My_Connections[Idx].delaytime = t;
} /* Conn_SetPenalty */
GLOBAL VOID
Conn_ResetPenalty( CONN_ID Idx )
{
assert( Idx > NONE );
My_Connections[Idx].delaytime = 0;
} /* Conn_ResetPenalty */
GLOBAL VOID
Conn_ClearFlags( VOID )
{
/* Alle Connection auf "nicht-markiert" setzen */
CONN_ID i;
for( i = 0; i < Pool_Size; i++ ) My_Connections[i].flag = 0;
} /* Conn_ClearFlags */
GLOBAL INT
Conn_Flag( CONN_ID Idx )
{
/* Ist eine Connection markiert (TRUE) oder nicht? */
assert( Idx > NONE );
return My_Connections[Idx].flag;
} /* Conn_Flag */
GLOBAL VOID
Conn_SetFlag( CONN_ID Idx, INT Flag )
{
/* Connection markieren */
assert( Idx > NONE );
My_Connections[Idx].flag = Flag;
} /* Conn_SetFlag */
GLOBAL CONN_ID
Conn_First( VOID )
{
/* Connection-Struktur der ersten Verbindung liefern;
* Ist keine Verbindung vorhanden, wird NONE geliefert. */
CONN_ID i;
for( i = 0; i < Pool_Size; i++ )
{
if( My_Connections[i].sock != NONE ) return i;
}
return NONE;
} /* Conn_First */
GLOBAL CONN_ID
Conn_Next( CONN_ID Idx )
{
/* Naechste Verbindungs-Struktur liefern; existiert keine
* weitere, so wird NONE geliefert. */
CONN_ID i = NONE;
assert( Idx > NONE );
for( i = Idx + 1; i < Pool_Size; i++ )
{
if( My_Connections[i].sock != NONE ) return i;
}
return NONE;
} /* Conn_Next */
GLOBAL VOID
Conn_SetOption( CONN_ID Idx, INT Option )
{
/* Option fuer Verbindung setzen.
* Initial sind alle Optionen _nicht_ gesetzt. */
assert( Idx > NONE );
assert( Option != 0 );
My_Connections[Idx].options |= Option;
} /* Conn_SetOption */
GLOBAL VOID
Conn_UnsetOption( CONN_ID Idx, INT Option )
{
/* Option fuer Verbindung loeschen */
assert( Idx > NONE );
assert( Option != 0 );
My_Connections[Idx].options &= ~Option;
} /* Conn_UnsetOption */
GLOBAL INT
Conn_Options( CONN_ID Idx )
{
assert( Idx > NONE );
return My_Connections[Idx].options;
} /* Conn_Options */
GLOBAL time_t
Conn_StartTime( CONN_ID Idx )
{
/* Zeitpunkt des Link-Starts liefern (in Sekunden) */
assert( Idx > NONE );
return My_Connections[Idx].starttime;
} /* Conn_Uptime */
GLOBAL INT
Conn_SendQ( CONN_ID Idx )
{
/* Laenge der Daten im Schreibbuffer liefern */
assert( Idx > NONE );
#ifdef USE_ZLIB
if( My_Connections[Idx].options & CONN_ZIP ) return My_Connections[Idx].zip.wdatalen;
else
#endif
return My_Connections[Idx].wdatalen;
} /* Conn_SendQ */
GLOBAL LONG
Conn_SendMsg( CONN_ID Idx )
{
/* Anzahl gesendeter Nachrichten liefern */
assert( Idx > NONE );
return My_Connections[Idx].msg_out;
} /* Conn_SendMsg */
GLOBAL LONG
Conn_SendBytes( CONN_ID Idx )
{
/* Anzahl gesendeter Bytes (unkomprimiert) liefern */
assert( Idx > NONE );
return My_Connections[Idx].bytes_out;
} /* Conn_SendBytes */
GLOBAL INT
Conn_RecvQ( CONN_ID Idx )
{
/* Laenge der Daten im Lesebuffer liefern */
assert( Idx > NONE );
#ifdef USE_ZLIB
if( My_Connections[Idx].options & CONN_ZIP ) return My_Connections[Idx].zip.rdatalen;
else
#endif
return My_Connections[Idx].rdatalen;
} /* Conn_RecvQ */
GLOBAL LONG
Conn_RecvMsg( CONN_ID Idx )
{
/* Anzahl empfangener Nachrichten liefern */
assert( Idx > NONE );
return My_Connections[Idx].msg_in;
} /* Conn_RecvMsg */
GLOBAL LONG
Conn_RecvBytes( CONN_ID Idx )
{
/* Anzahl empfangener Bytes (unkomprimiert) liefern */
assert( Idx > NONE );
return My_Connections[Idx].bytes_in;
} /* Conn_RecvBytes */
GLOBAL VOID
Conn_ResetWCounter( VOID )
{
WCounter = 0;
} /* Conn_ResetWCounter */
GLOBAL LONG
Conn_WCounter( VOID )
{
return WCounter;
} /* Conn_WCounter */
/* -eof- */

View File

@@ -1,61 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* 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 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conn-func.h,v 1.1 2002/12/30 17:14:28 alex Exp $
*
* Connection management: Global functions (header)
*/
#ifndef __conn_func_h__
#define __conn_func_h__
/* Include the header conn.h if this header is _not_ included by any module
* containing connection handling functions. So other modules must only
* include this conn-func.h header. */
#ifndef CONN_MODULE
# include "conn.h"
#endif
GLOBAL VOID Conn_UpdateIdle PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_StartTime PARAMS(( CONN_ID Idx ));
GLOBAL INT Conn_SendQ PARAMS(( CONN_ID Idx ));
GLOBAL INT Conn_RecvQ PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_SendMsg PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_RecvMsg PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_SendBytes PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_RecvBytes PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_SetPenalty PARAMS(( CONN_ID Idx, time_t Seconds ));
GLOBAL VOID Conn_ResetPenalty PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_ClearFlags PARAMS(( VOID ));
GLOBAL INT Conn_Flag PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_SetFlag PARAMS(( CONN_ID Idx, INT Flag ));
GLOBAL CONN_ID Conn_First PARAMS(( VOID ));
GLOBAL CONN_ID Conn_Next PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_SetOption PARAMS(( CONN_ID Idx, INT Option ));
GLOBAL VOID Conn_UnsetOption PARAMS(( CONN_ID Idx, INT Option ));
GLOBAL INT Conn_Options PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_ResetWCounter PARAMS(( VOID ));
GLOBAL LONG Conn_WCounter PARAMS(( VOID ));
#endif
/* -eof- */

View File

@@ -1,210 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* 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 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* Connection compression using ZLIB
*/
#include "portab.h"
#define CONN_MODULE
#ifdef USE_ZLIB
static char UNUSED id[] = "$Id: conn-zip.c,v 1.3 2003/04/21 10:52:26 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <string.h>
#include <zlib.h>
#include "conn.h"
#include "conn-func.h"
#include "log.h"
#include "exp.h"
#include "conn-zip.h"
GLOBAL BOOLEAN
Zip_InitConn( CONN_ID Idx )
{
/* Kompression fuer Link initialisieren */
assert( Idx > NONE );
My_Connections[Idx].zip.in.avail_in = 0;
My_Connections[Idx].zip.in.total_in = 0;
My_Connections[Idx].zip.in.total_out = 0;
My_Connections[Idx].zip.in.zalloc = NULL;
My_Connections[Idx].zip.in.zfree = NULL;
My_Connections[Idx].zip.in.data_type = Z_ASCII;
if( inflateInit( &My_Connections[Idx].zip.in ) != Z_OK )
{
/* Fehler! */
Log( LOG_ALERT, "Can't initialize compression on connection %d (zlib inflate)!", Idx );
return FALSE;
}
My_Connections[Idx].zip.out.total_in = 0;
My_Connections[Idx].zip.out.total_in = 0;
My_Connections[Idx].zip.out.zalloc = NULL;
My_Connections[Idx].zip.out.zfree = NULL;
My_Connections[Idx].zip.out.data_type = Z_ASCII;
if( deflateInit( &My_Connections[Idx].zip.out, Z_DEFAULT_COMPRESSION ) != Z_OK )
{
/* Fehler! */
Log( LOG_ALERT, "Can't initialize compression on connection %d (zlib deflate)!", Idx );
return FALSE;
}
My_Connections[Idx].zip.bytes_in = My_Connections[Idx].bytes_in;
My_Connections[Idx].zip.bytes_out = My_Connections[Idx].bytes_out;
Log( LOG_INFO, "Enabled link compression (zlib) on connection %d.", Idx );
Conn_SetOption( Idx, CONN_ZIP );
return TRUE;
} /* Zip_InitConn */
GLOBAL BOOLEAN
Zip_Buffer( CONN_ID Idx, CHAR *Data, INT Len )
{
/* Daten zum Komprimieren im "Kompressions-Puffer" sammeln.
* Es wird TRUE bei Erfolg, sonst FALSE geliefert. */
assert( Idx > NONE );
assert( Data != NULL );
assert( Len > 0 );
/* Ist noch Platz im Kompressions-Puffer? */
if( ZWRITEBUFFER_LEN - My_Connections[Idx].zip.wdatalen < Len + 50 )
{
/* Nein! Puffer zunaechst leeren ...*/
if( ! Zip_Flush( Idx )) return FALSE;
}
/* Daten kopieren */
memmove( My_Connections[Idx].zip.wbuf + My_Connections[Idx].zip.wdatalen, Data, Len );
My_Connections[Idx].zip.wdatalen += Len;
return TRUE;
} /* Zip_Buffer */
GLOBAL BOOLEAN
Zip_Flush( CONN_ID Idx )
{
/* Daten komprimieren und in Schreibpuffer kopieren.
* Es wird TRUE bei Erfolg, sonst FALSE geliefert. */
INT result, out_len;
z_stream *out;
out = &My_Connections[Idx].zip.out;
out->next_in = (VOID *)My_Connections[Idx].zip.wbuf;
out->avail_in = My_Connections[Idx].zip.wdatalen;
out->next_out = (VOID *)(My_Connections[Idx].wbuf + My_Connections[Idx].wdatalen);
out->avail_out = WRITEBUFFER_LEN - My_Connections[Idx].wdatalen;
result = deflate( out, Z_SYNC_FLUSH );
if(( result != Z_OK ) || ( out->avail_in > 0 ))
{
Log( LOG_ALERT, "Compression error: code %d!?", result );
Conn_Close( Idx, "Compression error!", NULL, FALSE );
return FALSE;
}
out_len = WRITEBUFFER_LEN - My_Connections[Idx].wdatalen - out->avail_out;
My_Connections[Idx].wdatalen += out_len;
My_Connections[Idx].bytes_out += out_len;
My_Connections[Idx].zip.bytes_out += My_Connections[Idx].zip.wdatalen;
My_Connections[Idx].zip.wdatalen = 0;
return TRUE;
} /* Zip_Flush */
GLOBAL BOOLEAN
Unzip_Buffer( CONN_ID Idx )
{
/* Daten entpacken und in Lesepuffer kopieren. Bei Fehlern
* wird FALSE geliefert, ansonsten TRUE. Der Fall, dass keine
* Daten mehr zu entpacken sind, ist _kein_ Fehler! */
INT result, in_len, out_len;
z_stream *in;
assert( Idx > NONE );
if( My_Connections[Idx].zip.rdatalen <= 0 ) return TRUE;
in = &My_Connections[Idx].zip.in;
in->next_in = (VOID *)My_Connections[Idx].zip.rbuf;
in->avail_in = My_Connections[Idx].zip.rdatalen;
in->next_out = (VOID *)(My_Connections[Idx].rbuf + My_Connections[Idx].rdatalen);
in->avail_out = READBUFFER_LEN - My_Connections[Idx].rdatalen - 1;
result = inflate( in, Z_SYNC_FLUSH );
if( result != Z_OK )
{
Log( LOG_ALERT, "Decompression error: code %d (ni=%d, ai=%d, no=%d, ao=%d)!?", result, in->next_in, in->avail_in, in->next_out, in->avail_out );
Conn_Close( Idx, "Decompression error!", NULL, FALSE );
return FALSE;
}
in_len = My_Connections[Idx].zip.rdatalen - in->avail_in;
out_len = READBUFFER_LEN - My_Connections[Idx].rdatalen - 1 - in->avail_out;
My_Connections[Idx].rdatalen += out_len;
if( in->avail_in > 0 )
{
/* es konnten nicht alle Daten entpackt werden, vermutlich war
* im Ziel-Puffer kein Platz mehr. Umkopieren ... */
My_Connections[Idx].zip.rdatalen -= in_len;
memmove( My_Connections[Idx].zip.rbuf, My_Connections[Idx].zip.rbuf + in_len, My_Connections[Idx].zip.rdatalen );
}
else My_Connections[Idx].zip.rdatalen = 0;
My_Connections[Idx].zip.bytes_in += out_len;
return TRUE;
} /* Unzip_Buffer */
GLOBAL LONG
Zip_SendBytes( CONN_ID Idx )
{
/* Anzahl gesendeter Bytes (komprimiert!) liefern */
assert( Idx > NONE );
return My_Connections[Idx].zip.bytes_out;
} /* Zip_SendBytes */
GLOBAL LONG
Zip_RecvBytes( CONN_ID Idx )
{
/* Anzahl gesendeter Bytes (komprimiert!) liefern */
assert( Idx > NONE );
return My_Connections[Idx].zip.bytes_in;
} /* Zip_RecvBytes */
#endif
/* -eof- */

View File

@@ -1,38 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* 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 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conn-zip.h,v 1.1 2002/12/30 16:07:23 alex Exp $
*
* Connection compression using ZLIB (header)
*/
#ifdef USE_ZLIB
#ifndef __conn_zip_h__
#define __conn_zip_h__
GLOBAL BOOLEAN Zip_InitConn PARAMS(( CONN_ID Idx ));
GLOBAL BOOLEAN Zip_Buffer PARAMS(( CONN_ID Idx, CHAR *Data, INT Len ));
GLOBAL BOOLEAN Zip_Flush PARAMS(( CONN_ID Idx ));
GLOBAL BOOLEAN Unzip_Buffer PARAMS(( CONN_ID Idx ));
GLOBAL LONG Zip_SendBytes PARAMS(( CONN_ID Idx ));
GLOBAL LONG Zip_RecvBytes PARAMS(( CONN_ID Idx ));
#endif /* __conn_zip_h__ */
#endif /* USE_ZLIB */
/* -eof- */

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
* *
* $Id: conn.h,v 1.31 2003/03/27 01:20:22 alex Exp $ * $Id: conn.h,v 1.26.2.1 2003/03/09 20:16:46 alex Exp $
* *
* Connection management (header) * Connection management (header)
*/ */
@@ -31,56 +31,6 @@
typedef INT CONN_ID; typedef INT CONN_ID;
#ifdef CONN_MODULE
#include "defines.h"
#include "resolve.h"
#ifdef USE_ZLIB
#include <zlib.h>
typedef struct _ZipData
{
z_stream in; /* "Handle" for input stream */
z_stream out; /* "Handle" for output stream */
CHAR rbuf[READBUFFER_LEN]; /* Read buffer */
INT rdatalen; /* Length of data in read buffer (compressed) */
CHAR wbuf[WRITEBUFFER_LEN]; /* Write buffer */
INT wdatalen; /* Length of data in write buffer (uncompressed) */
LONG bytes_in, bytes_out; /* Counter for statistics (uncompressed!) */
} ZIPDATA;
#endif /* USE_ZLIB */
typedef struct _Connection
{
INT sock; /* Socket handle */
struct sockaddr_in addr; /* Client address */
RES_STAT *res_stat; /* Status of resolver process, if any */
CHAR host[HOST_LEN]; /* Hostname */
CHAR rbuf[READBUFFER_LEN]; /* Read buffer */
INT rdatalen; /* Length of data in read buffer */
CHAR wbuf[WRITEBUFFER_LEN]; /* Write buffer */
INT wdatalen; /* Length of data in write buffer */
time_t starttime; /* Start time of link */
time_t lastdata; /* Last activity */
time_t lastping; /* Last PING */
time_t lastprivmsg; /* Last PRIVMSG */
time_t delaytime; /* Ignore link ("penalty") */
LONG bytes_in, bytes_out; /* Received and sent bytes */
LONG msg_in, msg_out; /* Received and sent IRC messages */
INT flag; /* Flag (see "irc-write" module) */
INT options; /* Link options */
#ifdef USE_ZLIB
ZIPDATA zip; /* Compression information */
#endif /* USE_ZLIB */
} CONNECTION;
GLOBAL CONNECTION *My_Connections;
GLOBAL CONN_ID Pool_Size;
GLOBAL LONG WCounter;
#endif /* CONN_MODULE */
GLOBAL VOID Conn_Init PARAMS((VOID )); GLOBAL VOID Conn_Init PARAMS((VOID ));
GLOBAL VOID Conn_Exit PARAMS(( VOID )); GLOBAL VOID Conn_Exit PARAMS(( VOID ));
@@ -96,7 +46,42 @@ GLOBAL BOOLEAN Conn_WriteStr PARAMS(( CONN_ID Idx, CHAR *Format, ... ));
GLOBAL VOID Conn_Close PARAMS(( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )); GLOBAL VOID Conn_Close PARAMS(( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient ));
GLOBAL VOID Conn_SyncServerStruct PARAMS(( VOID )); GLOBAL VOID Conn_UpdateIdle PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_StartTime PARAMS(( CONN_ID Idx ));
GLOBAL INT Conn_SendQ PARAMS(( CONN_ID Idx ));
GLOBAL INT Conn_RecvQ PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_SendMsg PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_RecvMsg PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_SendBytes PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_RecvBytes PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_SetPenalty PARAMS(( CONN_ID Idx, time_t Seconds ));
GLOBAL VOID Conn_ResetPenalty PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_ClearFlags PARAMS(( VOID ));
GLOBAL INT Conn_Flag PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_SetFlag PARAMS(( CONN_ID Idx, INT Flag ));
GLOBAL VOID Conn_SetServer PARAMS(( CONN_ID Idx, INT ConfServer ));
GLOBAL CONN_ID Conn_First PARAMS(( VOID ));
GLOBAL CONN_ID Conn_Next PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_SetOption PARAMS(( CONN_ID Idx, INT Option ));
GLOBAL VOID Conn_UnsetOption PARAMS(( CONN_ID Idx, INT Option ));
GLOBAL INT Conn_Options PARAMS(( CONN_ID Idx ));
#ifdef USE_ZLIB
GLOBAL BOOLEAN Conn_InitZip PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_SendBytesZip PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_RecvBytesZip PARAMS(( CONN_ID Idx ));
#endif
GLOBAL VOID Conn_ResetWCounter PARAMS(( VOID ));
GLOBAL LONG Conn_WCounter PARAMS(( VOID ));
GLOBAL INT Conn_MaxFD; GLOBAL INT Conn_MaxFD;

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
* *
* $Id: defines.h,v 1.42 2003/02/23 12:03:39 alex Exp $ * $Id: defines.h,v 1.40 2002/12/16 23:10:56 alex Exp $
* *
* Global defines of ngIRCd. * Global defines of ngIRCd.
*/ */
@@ -83,9 +83,13 @@
#define DEFAULT_AWAY_MSG "Away" /* Away-Meldung fuer User von anderen Servern */ #define DEFAULT_AWAY_MSG "Away" /* Away-Meldung fuer User von anderen Servern */
#define CONFIG_FILE "/ngircd.conf" #ifdef PROTOTYPES
#define MOTD_FILE "/ngircd.motd" # define CONFIG_FILE SYSCONFDIR"/ngircd.conf"
# define MOTD_FILE SYSCONFDIR"/ngircd.motd"
#else
# define CONFIG_FILE "ngircd.conf"
# define MOTD_FILE "ngircd.motd"
#endif
#define ERROR_DIR "/tmp" #define ERROR_DIR "/tmp"
#define MAX_LOG_MSG_LEN 256 /* max. Laenge einer Log-Meldung */ #define MAX_LOG_MSG_LEN 256 /* max. Laenge einer Log-Meldung */
@@ -94,10 +98,6 @@
#define NOTICE_TXTPREFIX "" /* Kennzeichnung fuer Server-NOTICEs an User */ #define NOTICE_TXTPREFIX "" /* Kennzeichnung fuer Server-NOTICEs an User */
#ifdef RENDEZVOUS
#define RENDEZVOUS_TYPE "_ircu._tcp." /* Service type to register with Rendezvous */
#endif
#endif #endif

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: hash.c,v 1.9 2002/12/26 16:25:43 alex Exp $"; static char UNUSED id[] = "$Id: hash.c,v 1.6 2002/12/12 12:24:18 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -38,7 +38,9 @@ Hash( CHAR *String )
CHAR buffer[LINE_LEN]; CHAR buffer[LINE_LEN];
strlcpy( buffer, String, sizeof( buffer )); strncpy( buffer, String, LINE_LEN - 1 );
buffer[LINE_LEN - 1] = '\0';
return jenkins_hash( (UINT8 *)ngt_LowerStr( buffer ), strlen( buffer ), 42 ); return jenkins_hash( (UINT8 *)ngt_LowerStr( buffer ), strlen( buffer ), 42 );
} /* Hash */ } /* Hash */
@@ -100,7 +102,7 @@ jenkins_hash( register UINT8 *k, register UINT32 length, register UINT32 initval
/* handle the last 11 bytes */ /* handle the last 11 bytes */
c += length; c += length;
switch( (INT)len ) /* all the case statements fall through */ switch(len) /* all the case statements fall through */
{ {
case 11: c+=((UINT32)k[10]<<24); case 11: c+=((UINT32)k[10]<<24);
case 10: c+=((UINT32)k[9]<<16); case 10: c+=((UINT32)k[9]<<16);

View File

@@ -14,12 +14,10 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-channel.c,v 1.25 2003/01/08 22:04:05 alex Exp $"; static char UNUSED id[] = "$Id: irc-channel.c,v 1.21.2.5 2003/01/08 23:09:34 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include "defines.h" #include "defines.h"
@@ -181,7 +179,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
if(( strchr( Channel_Modes( chan ), 'P' )) && ( strchr( Client_Modes( target ), 'o' ))) Channel_UserModeAdd( chan, target, 'o' ); if(( strchr( Channel_Modes( chan ), 'P' )) && ( strchr( Client_Modes( target ), 'o' ))) Channel_UserModeAdd( chan, target, 'o' );
/* Muessen Modes an andere Server gemeldet werden? */ /* Muessen Modes an andere Server gemeldet werden? */
strlcpy( &modes[1], Channel_UserModes( chan, target ), sizeof( modes ) - 1 ); strcpy( &modes[1], Channel_UserModes( chan, target ));
if( modes[1] ) modes[0] = 0x7; if( modes[1] ) modes[0] = 0x7;
else modes[0] = '\0'; else modes[0] = '\0';
@@ -364,9 +362,9 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_CHANINFO( CLIENT *Client, REQUEST *Req ) IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
{ {
CHAR modes_add[COMMAND_LEN], l[16], *ptr;
CLIENT *from; CLIENT *from;
CHANNEL *chan; CHANNEL *chan;
CHAR *ptr;
INT arg_topic; INT arg_topic;
assert( Client != NULL ); assert( Client != NULL );
@@ -397,40 +395,15 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
/* OK, this channel doesn't have modes jet, set the received ones: */ /* OK, this channel doesn't have modes jet, set the received ones: */
Channel_SetModes( chan, &Req->argv[1][1] ); Channel_SetModes( chan, &Req->argv[1][1] );
if( Req->argc == 5 )
{
if( strchr( Channel_Modes( chan ), 'k' )) Channel_SetKey( chan, Req->argv[2] );
if( strchr( Channel_Modes( chan ), 'l' )) Channel_SetMaxUsers( chan, atol( Req->argv[3] ));
}
else
{
/* Delete modes which we never want to inherit */ /* Delete modes which we never want to inherit */
Channel_ModeDel( chan, 'l' ); Channel_ModeDel( chan, 'l' );
Channel_ModeDel( chan, 'k' ); Channel_ModeDel( chan, 'k' );
}
strcpy( modes_add, "" );
ptr = Channel_Modes( chan );
while( *ptr )
{
if( *ptr == 'l' )
{
snprintf( l, sizeof( l ), " %ld", Channel_MaxUsers( chan ));
strlcat( modes_add, l, sizeof( modes_add ));
}
if( *ptr == 'k' )
{
strlcat( modes_add, " ", sizeof( modes_add ));
strlcat( modes_add, Channel_Key( chan ), sizeof( modes_add ));
}
ptr++;
}
/* Inform members of this channel */ /* Inform members of this channel */
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s%s", Req->argv[0], Channel_Modes( chan ), modes_add ); IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s", Req->argv[0], Channel_Modes( chan ));
} }
} }
else Log( LOG_WARNING, "CHANINFO: invalid MODE format ignored!" ); else Log( LOG_WARNING, "CHANNELINFO: invalid MODE format ignored!" );
if( arg_topic > 0 ) if( arg_topic > 0 )
{ {

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-info.c,v 1.16 2003/04/21 10:54:30 alex Exp $"; static char UNUSED id[] = "$Id: irc-info.c,v 1.8.2.2 2003/01/01 13:46:37 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -23,8 +23,7 @@ static char UNUSED id[] = "$Id: irc-info.c,v 1.16 2003/04/21 10:54:30 alex Exp $
#include <string.h> #include <string.h>
#include "ngircd.h" #include "ngircd.h"
#include "conn-func.h" #include "conn.h"
#include "conn-zip.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "resolve.h" #include "resolve.h"
@@ -105,8 +104,8 @@ IRC_ISON( CLIENT *Client, REQUEST *Req )
if( c && ( Client_Type( c ) == CLIENT_USER )) if( c && ( Client_Type( c ) == CLIENT_USER ))
{ {
/* Dieser Nick ist "online" */ /* Dieser Nick ist "online" */
strlcat( rpl, ptr, sizeof( rpl )); strcat( rpl, ptr );
strlcat( rpl, " ", sizeof( rpl )); strcat( rpl, " " );
} }
ptr = strtok( NULL, " " ); ptr = strtok( NULL, " " );
} }
@@ -297,20 +296,20 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req )
/* Nun noch alle Clients ausgeben, die in keinem Channel sind */ /* Nun noch alle Clients ausgeben, die in keinem Channel sind */
c = Client_First( ); c = Client_First( );
snprintf( rpl, sizeof( rpl ), RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" ); sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
while( c ) while( c )
{ {
if(( Client_Type( c ) == CLIENT_USER ) && ( Channel_FirstChannelOf( c ) == NULL ) && ( ! strchr( Client_Modes( c ), 'i' ))) if(( Client_Type( c ) == CLIENT_USER ) && ( Channel_FirstChannelOf( c ) == NULL ) && ( ! strchr( Client_Modes( c ), 'i' )))
{ {
/* Okay, das ist ein User: anhaengen */ /* Okay, das ist ein User: anhaengen */
if( rpl[strlen( rpl ) - 1] != ':' ) strlcat( rpl, " ", sizeof( rpl )); if( rpl[strlen( rpl ) - 1] != ':' ) strcat( rpl, " " );
strlcat( rpl, Client_ID( c ), sizeof( rpl )); strcat( rpl, Client_ID( c ));
if( strlen( rpl ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 )) if( strlen( rpl ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
{ {
/* Zeile wird zu lang: senden! */ /* Zeile wird zu lang: senden! */
if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED; if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED;
snprintf( rpl, sizeof( rpl ), RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" ); sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
} }
} }
@@ -376,7 +375,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
#ifdef USE_ZLIB #ifdef USE_ZLIB
if( Conn_Options( con ) & CONN_ZIP ) if( Conn_Options( con ) & CONN_ZIP )
{ {
if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFOZIP_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Zip_SendBytes( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Zip_RecvBytes( con ), Conn_RecvBytes( con ), (LONG)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED; if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFOZIP_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Conn_SendBytesZip( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Conn_RecvBytesZip( con ), Conn_RecvBytes( con ), (LONG)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED;
} }
else else
#endif #endif
@@ -437,7 +436,7 @@ IRC_TIME( CLIENT *Client, REQUEST *Req )
} }
t = time( NULL ); t = time( NULL );
(VOID)strftime( t_str, 60, "%A %B %d %Y -- %H:%M %Z", localtime( &t )); (VOID)strftime( t_str, 60, "%A %B %d %Y -- %H:%M %z", localtime( &t ));
return IRC_WriteStrClient( from, RPL_TIME_MSG, Client_ID( from ), Client_ID( Client_ThisServer( )), t_str ); return IRC_WriteStrClient( from, RPL_TIME_MSG, Client_ID( from ), Client_ID( Client_ThisServer( )), t_str );
} /* IRC_TIME */ } /* IRC_TIME */
@@ -465,15 +464,15 @@ IRC_USERHOST( CLIENT *Client, REQUEST *Req )
if( c && ( Client_Type( c ) == CLIENT_USER )) if( c && ( Client_Type( c ) == CLIENT_USER ))
{ {
/* Dieser Nick ist "online" */ /* Dieser Nick ist "online" */
strlcat( rpl, Client_ID( c ), sizeof( rpl )); strcat( rpl, Client_ID( c ));
if( Client_HasMode( c, 'o' )) strlcat( rpl, "*", sizeof( rpl )); if( Client_HasMode( c, 'o' )) strcat( rpl, "*" );
strlcat( rpl, "=", sizeof( rpl )); strcat( rpl, "=" );
if( Client_HasMode( c, 'a' )) strlcat( rpl, "-", sizeof( rpl )); if( Client_HasMode( c, 'a' )) strcat( rpl, "-" );
else strlcat( rpl, "+", sizeof( rpl )); else strcat( rpl, "+" );
strlcat( rpl, Client_User( c ), sizeof( rpl )); strcat( rpl, Client_User( c ));
strlcat( rpl, "@", sizeof( rpl )); strcat( rpl, "@" );
strlcat( rpl, Client_Hostname( c ), sizeof( rpl )); strcat( rpl, Client_Hostname( c ));
strlcat( rpl, " ", sizeof( rpl )); strcat( rpl, " " );
} }
} }
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0'; if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
@@ -513,7 +512,7 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req )
} }
/* mit Versionsinfo antworten */ /* mit Versionsinfo antworten */
return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( )); return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE, VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
} /* IRC_VERSION */ } /* IRC_VERSION */
@@ -573,7 +572,7 @@ IRC_WHO( CLIENT *Client, REQUEST *Req )
{ {
/* Flags zusammenbasteln */ /* Flags zusammenbasteln */
strcpy( flags, "H" ); strcpy( flags, "H" );
if( strchr( Client_Modes( c ), 'o' )) strlcat( flags, "*", sizeof( flags )); if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
/* ausgeben */ /* ausgeben */
cl2chan = Channel_FirstChannelOf( c ); cl2chan = Channel_FirstChannelOf( c );
@@ -636,7 +635,7 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
if( ! IRC_WriteStrClient( from, RPL_WHOISSERVER_MSG, Client_ID( from ), Client_ID( c ), Client_ID( Client_Introducer( c )), Client_Info( Client_Introducer( c )))) return DISCONNECTED; if( ! IRC_WriteStrClient( from, RPL_WHOISSERVER_MSG, Client_ID( from ), Client_ID( c ), Client_ID( Client_Introducer( c )), Client_Info( Client_Introducer( c )))) return DISCONNECTED;
/* Channels */ /* Channels */
snprintf( str, sizeof( str ), RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c )); sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
cl2chan = Channel_FirstChannelOf( c ); cl2chan = Channel_FirstChannelOf( c );
while( cl2chan ) while( cl2chan )
{ {
@@ -644,16 +643,16 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
assert( chan != NULL ); assert( chan != NULL );
/* Concatenate channel names */ /* Concatenate channel names */
if( str[strlen( str ) - 1] != ':' ) strlcat( str, " ", sizeof( str )); if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
if( strchr( Channel_UserModes( chan, c ), 'o' )) strlcat( str, "@", sizeof( str )); if( strchr( Channel_UserModes( chan, c ), 'o' )) strcat( str, "@" );
else if( strchr( Channel_UserModes( chan, c ), 'v' )) strlcat( str, "+", sizeof( str )); else if( strchr( Channel_UserModes( chan, c ), 'v' )) strcat( str, "+" );
strlcat( str, Channel_Name( chan ), sizeof( str )); strcat( str, Channel_Name( chan ));
if( strlen( str ) > ( LINE_LEN - CHANNEL_NAME_LEN - 4 )) if( strlen( str ) > ( LINE_LEN - CHANNEL_NAME_LEN - 4 ))
{ {
/* Line becomes too long: send it! */ /* Line becomes too long: send it! */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED; if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
snprintf( str, sizeof( str ), RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c )); sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
} }
/* next */ /* next */
@@ -794,7 +793,7 @@ IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan )
else is_member = FALSE; else is_member = FALSE;
/* Alle Mitglieder suchen */ /* Alle Mitglieder suchen */
snprintf( str, sizeof( str ), RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan )); sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
cl2chan = Channel_FirstMember( Chan ); cl2chan = Channel_FirstMember( Chan );
while( cl2chan ) while( cl2chan )
{ {
@@ -806,16 +805,16 @@ IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan )
if( is_member || is_visible ) if( is_member || is_visible )
{ {
/* Nick anhaengen */ /* Nick anhaengen */
if( str[strlen( str ) - 1] != ':' ) strlcat( str, " ", sizeof( str )); if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
if( strchr( Channel_UserModes( Chan, cl ), 'o' )) strlcat( str, "@", sizeof( str )); if( strchr( Channel_UserModes( Chan, cl ), 'o' )) strcat( str, "@" );
else if( strchr( Channel_UserModes( Chan, cl ), 'v' )) strlcat( str, "+", sizeof( str )); else if( strchr( Channel_UserModes( Chan, cl ), 'v' )) strcat( str, "+" );
strlcat( str, Client_ID( cl ), sizeof( str )); strcat( str, Client_ID( cl ));
if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 )) if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
{ {
/* Zeile wird zu lang: senden! */ /* Zeile wird zu lang: senden! */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED; if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
snprintf( str, sizeof( str ), RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan )); sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
} }
} }
@@ -859,9 +858,9 @@ IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps )
{ {
/* Flags zusammenbasteln */ /* Flags zusammenbasteln */
strcpy( flags, "H" ); strcpy( flags, "H" );
if( strchr( Client_Modes( c ), 'o' )) strlcat( flags, "*", sizeof( flags )); if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
if( strchr( Channel_UserModes( Chan, c ), 'o' )) strlcat( flags, "@", sizeof( flags )); if( strchr( Channel_UserModes( Chan, c ), 'o' )) strcat( flags, "@" );
else if( strchr( Channel_UserModes( Chan, c ), 'v' )) strlcat( flags, "+", sizeof( flags )); else if( strchr( Channel_UserModes( Chan, c ), 'v' )) strcat( flags, "+" );
/* ausgeben */ /* ausgeben */
if(( ! OnlyOps ) || ( strchr( Client_Modes( c ), 'o' ))) if(( ! OnlyOps ) || ( strchr( Client_Modes( c ), 'o' )))

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-login.c,v 1.34 2003/03/31 15:54:21 alex Exp $"; static char UNUSED id[] = "$Id: irc-login.c,v 1.27.2.2 2003/01/01 13:46:37 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -24,14 +24,13 @@ static char UNUSED id[] = "$Id: irc-login.c,v 1.34 2003/03/31 15:54:21 alex Exp
#include "ngircd.h" #include "ngircd.h"
#include "resolve.h" #include "resolve.h"
#include "conn-func.h"
#include "conf.h" #include "conf.h"
#include "conn.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "log.h" #include "log.h"
#include "messages.h" #include "messages.h"
#include "parse.h" #include "parse.h"
#include "irc.h"
#include "irc-info.h" #include "irc-info.h"
#include "irc-write.h" #include "irc-write.h"
@@ -445,12 +444,12 @@ Hello_User( CLIENT *Client )
IRC_WriteStrServers( NULL, "NICK %s 1 %s %s 1 +%s :%s", Client_ID( Client ), Client_User( Client ), Client_Hostname( Client ), Client_Modes( Client ), Client_Info( Client )); IRC_WriteStrServers( NULL, "NICK %s 1 %s %s 1 +%s :%s", Client_ID( Client ), Client_User( Client ), Client_Hostname( Client ), Client_Modes( Client ), Client_Info( Client ));
if( ! IRC_WriteStrClient( Client, RPL_WELCOME_MSG, Client_ID( Client ), Client_Mask( Client ))) return FALSE; if( ! IRC_WriteStrClient( Client, RPL_WELCOME_MSG, Client_ID( Client ), Client_Mask( Client ))) return FALSE;
if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return FALSE; if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), VERSION, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return FALSE;
if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return FALSE; if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return FALSE;
if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, USERMODES, CHANMODES )) return FALSE; if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), VERSION, USERMODES, CHANMODES )) return FALSE;
/* Features */ /* Features */
if( ! IRC_WriteStrClient( Client, RPL_ISUPPORT_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1, CHANNEL_TOPIC_LEN - 1, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED; if( ! IRC_WriteStrClient( Client, RPL_FEATURE_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1, CHANNEL_TOPIC_LEN - 1, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED;
Client_SetType( Client, CLIENT_USER ); Client_SetType( Client, CLIENT_USER );
@@ -464,18 +463,19 @@ Hello_User( CLIENT *Client )
LOCAL VOID LOCAL VOID
Kill_Nick( CHAR *Nick, CHAR *Reason ) Kill_Nick( CHAR *Nick, CHAR *Reason )
{ {
REQUEST r; CLIENT *c;
assert( Nick != NULL ); assert( Nick != NULL );
assert( Reason != NULL ); assert( Reason != NULL );
r.prefix = Client_ThisServer( );
r.argv[0] = Nick;
r.argv[1] = Reason;
r.argc = 2;
Log( LOG_ERR, "User(s) with nick \"%s\" will be disconnected: %s", Nick, Reason ); Log( LOG_ERR, "User(s) with nick \"%s\" will be disconnected: %s", Nick, Reason );
IRC_KILL( Client_ThisServer( ), &r );
/* andere Server benachrichtigen */
IRC_WriteStrServers( NULL, "KILL %s :%s", Nick, Reason );
/* Ggf. einen eigenen Client toeten */
c = Client_Search( Nick );
if( c && ( Client_Conn( c ) != NONE )) Conn_Close( Client_Conn( c ), NULL, Reason, TRUE );
} /* Kill_Nick */ } /* Kill_Nick */

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-mode.c,v 1.31 2003/01/21 21:04:16 alex Exp $"; static char UNUSED id[] = "$Id: irc-mode.c,v 1.24.2.5 2003/01/21 21:05:19 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -142,8 +142,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
else else
{ {
/* Append modifier character to result string */ /* Append modifier character to result string */
x[0] = *mode_ptr; x[0] = *mode_ptr; strcat( the_modes, x );
strlcat( the_modes, x, sizeof( the_modes ));
} }
if( *mode_ptr == '+' ) set = TRUE; if( *mode_ptr == '+' ) set = TRUE;
else set = FALSE; else set = FALSE;
@@ -200,13 +199,13 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
if( set ) if( set )
{ {
/* Set mode */ /* Set mode */
if( Client_ModeAdd( Target, x[0] )) strlcat( the_modes, x, sizeof( the_modes )); if( Client_ModeAdd( Target, x[0] )) strcat( the_modes, x );
} }
else else
{ {
/* Unset mode */ /* Unset mode */
if( Client_ModeDel( Target, x[0] )) strlcat( the_modes, x, sizeof( the_modes )); if( Client_ModeDel( Target, x[0] )) strcat( the_modes, x );
} }
} }
client_exit: client_exit:
@@ -253,7 +252,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
if( ! Channel_IsMemberOf( Channel, Origin )) return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), Channel_Modes( Channel )); if( ! Channel_IsMemberOf( Channel, Origin )) return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), Channel_Modes( Channel ));
/* The sender is a member: generate extended reply */ /* The sender is a member: generate extended reply */
strlcpy( the_modes, Channel_Modes( Channel ), sizeof( the_modes )); strcpy( the_modes, Channel_Modes( Channel ));
mode_ptr = the_modes; mode_ptr = the_modes;
strcpy( the_args, "" ); strcpy( the_args, "" );
while( *mode_ptr ) while( *mode_ptr )
@@ -262,16 +261,16 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
{ {
case 'l': case 'l':
snprintf( argadd, sizeof( argadd ), " %ld", Channel_MaxUsers( Channel )); snprintf( argadd, sizeof( argadd ), " %ld", Channel_MaxUsers( Channel ));
strlcat( the_args, argadd, sizeof( the_args )); strcat( the_args, argadd );
break; break;
case 'k': case 'k':
strlcat( the_args, " ", sizeof( the_args )); strcat( the_args, " " );
strlcat( the_args, Channel_Key( Channel ), sizeof( the_args )); strcat( the_args, Channel_Key( Channel ));
break; break;
} }
mode_ptr++; mode_ptr++;
} }
if( the_args[0] ) strlcat( the_modes, the_args, sizeof( the_modes )); if( the_args[0] ) strcat( the_modes, the_args );
return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), the_modes ); return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), the_modes );
} }
@@ -341,8 +340,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
else else
{ {
/* Append modifier character to result string */ /* Append modifier character to result string */
x[0] = *mode_ptr; x[0] = *mode_ptr; strcat( the_modes, x );
strlcat( the_modes, x, sizeof( the_modes ));
} }
if( *mode_ptr == '+' ) set = TRUE; if( *mode_ptr == '+' ) set = TRUE;
else set = FALSE; else set = FALSE;
@@ -427,7 +425,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
{ {
Channel_ModeDel( Channel, 'k' ); Channel_ModeDel( Channel, 'k' );
Channel_SetKey( Channel, Req->argv[arg_arg] ); Channel_SetKey( Channel, Req->argv[arg_arg] );
strlcpy( argadd, Channel_Key( Channel ), sizeof( argadd )); strcpy( argadd, Channel_Key( Channel ));
x[0] = *mode_ptr; x[0] = *mode_ptr;
} }
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel )); else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
@@ -453,7 +451,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
{ {
Channel_ModeDel( Channel, 'l' ); Channel_ModeDel( Channel, 'l' );
Channel_SetMaxUsers( Channel, l ); Channel_SetMaxUsers( Channel, l );
snprintf( argadd, sizeof( argadd ), "%ld", l ); sprintf( argadd, "%ld", l );
x[0] = *mode_ptr; x[0] = *mode_ptr;
} }
} }
@@ -524,9 +522,8 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* Channel-User-Mode */ /* Channel-User-Mode */
if( Channel_UserModeAdd( Channel, client, x[0] )) if( Channel_UserModeAdd( Channel, client, x[0] ))
{ {
strlcat( the_args, Client_ID( client ), sizeof( the_args )); strcat( the_args, Client_ID( client ));
strlcat( the_args, " ", sizeof( the_args )); strcat( the_args, " " ); strcat( the_modes, x );
strlcat( the_modes, x, sizeof( the_modes ));
Log( LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"", Client_Mask( client ), Channel_Name( Channel ), Channel_UserModes( Channel, client )); Log( LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"", Client_Mask( client ), Channel_Name( Channel ), Channel_UserModes( Channel, client ));
} }
} }
@@ -535,7 +532,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* Channel-Mode */ /* Channel-Mode */
if( Channel_ModeAdd( Channel, x[0] )) if( Channel_ModeAdd( Channel, x[0] ))
{ {
strlcat( the_modes, x, sizeof( the_modes )); strcat( the_modes, x );
Log( LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name( Channel ), Channel_Modes( Channel )); Log( LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name( Channel ), Channel_Modes( Channel ));
} }
} }
@@ -548,9 +545,8 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* Channel-User-Mode */ /* Channel-User-Mode */
if( Channel_UserModeDel( Channel, client, x[0] )) if( Channel_UserModeDel( Channel, client, x[0] ))
{ {
strlcat( the_args, Client_ID( client ), sizeof( the_args )); strcat( the_args, Client_ID( client ));
strlcat( the_args, " ", sizeof( the_args )); strcat( the_args, " " ); strcat( the_modes, x );
strlcat( the_modes, x, sizeof( the_modes ));
Log( LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"", Client_Mask( client ), Channel_Name( Channel ), Channel_UserModes( Channel, client )); Log( LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"", Client_Mask( client ), Channel_Name( Channel ), Channel_UserModes( Channel, client ));
} }
} }
@@ -559,7 +555,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* Channel-Mode */ /* Channel-Mode */
if( Channel_ModeDel( Channel, x[0] )) if( Channel_ModeDel( Channel, x[0] ))
{ {
strlcat( the_modes, x, sizeof( the_modes )); strcat( the_modes, x );
Log( LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name( Channel ), Channel_Modes( Channel )); Log( LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name( Channel ), Channel_Modes( Channel ));
} }
} }
@@ -568,8 +564,8 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* Are there additional arguments to add? */ /* Are there additional arguments to add? */
if( argadd[0] ) if( argadd[0] )
{ {
if( the_args[strlen( the_args ) - 1] != ' ' ) strlcat( the_args, " ", sizeof( the_args )); if( the_args[strlen( the_args ) - 1] != ' ' ) strcat( the_args, " " );
strlcat( the_args, argadd, sizeof( the_args )); strcat( the_args, argadd );
} }
} }
chan_exit: chan_exit:

View File

@@ -14,17 +14,16 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-oper.c,v 1.17 2002/12/31 16:10:55 alex Exp $"; static char UNUSED id[] = "$Id: irc-oper.c,v 1.13 2002/12/12 12:33:14 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "ngircd.h" #include "ngircd.h"
#include "resolve.h" #include "resolve.h"
#include "conn.h"
#include "conf.h" #include "conf.h"
#include "conn.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "irc-write.h" #include "irc-write.h"
@@ -83,19 +82,16 @@ IRC_OPER( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_DIE( CLIENT *Client, REQUEST *Req ) IRC_DIE( CLIENT *Client, REQUEST *Req )
{ {
/* Shut down server */
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Not a local IRC operator? */ /* Falsche Anzahl Parameter? */
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
/* Bad number of parameters? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
Log( LOG_NOTICE|LOG_snotice, "Got DIE command from \"%s\" ...", Client_Mask( Client )); if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
NGIRCd_SignalQuit = TRUE;
Log( LOG_NOTICE|LOG_snotice, "Got DIE command from \"%s\", going down!", Client_Mask( Client ));
NGIRCd_Quit = TRUE;
return CONNECTED; return CONNECTED;
} /* IRC_DIE */ } /* IRC_DIE */
@@ -103,19 +99,16 @@ IRC_DIE( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_REHASH( CLIENT *Client, REQUEST *Req ) IRC_REHASH( CLIENT *Client, REQUEST *Req )
{ {
/* Reload configuration file */
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Not a local IRC operator? */ /* Falsche Anzahl Parameter? */
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
/* Bad number of parameters? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
Log( LOG_NOTICE|LOG_snotice, "Got REHASH command from \"%s\" ...", Client_Mask( Client )); if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
NGIRCd_SignalRehash = TRUE;
Log( LOG_NOTICE|LOG_snotice, "Got REHASH command from \"%s\", re-reading configuration ...", Client_Mask( Client ));
NGIRCd_Rehash( );
return CONNECTED; return CONNECTED;
} /* IRC_REHASH */ } /* IRC_REHASH */
@@ -124,19 +117,16 @@ IRC_REHASH( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_RESTART( CLIENT *Client, REQUEST *Req ) IRC_RESTART( CLIENT *Client, REQUEST *Req )
{ {
/* Restart IRC server (fork a new process) */
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Not a local IRC operator? */ /* Falsche Anzahl Parameter? */
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
/* Bad number of parameters? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
Log( LOG_NOTICE|LOG_snotice, "Got RESTART command from \"%s\" ...", Client_Mask( Client )); if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
NGIRCd_SignalRestart = TRUE;
Log( LOG_NOTICE|LOG_snotice, "Got RESTART command from \"%s\", going down!", Client_Mask( Client ));
NGIRCd_Restart = TRUE;
return CONNECTED; return CONNECTED;
} /* IRC_RESTART */ } /* IRC_RESTART */
@@ -144,64 +134,20 @@ IRC_RESTART( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_CONNECT(CLIENT *Client, REQUEST *Req ) IRC_CONNECT(CLIENT *Client, REQUEST *Req )
{ {
/* Connect configured or new server */ /* Vorlaeufige Version zu Debug-Zwecken: es wird einfach
* der "passive mode" aufgehoben, mehr passiert nicht ... */
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Not a local IRC operator? */ /* Falsche Anzahl Parameter? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client )); if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
/* Bad number of parameters? */ Log( LOG_NOTICE|LOG_snotice, "Got CONNECT command from \"%s\".", Client_Mask( Client ));
if(( Req->argc != 2 ) && ( Req->argc != 5 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); NGIRCd_Passive = FALSE;
/* Invalid port number? */
if( atoi( Req->argv[1] ) < 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
Log( LOG_NOTICE|LOG_snotice, "Got CONNECT command from \"%s\" for \"%s\".", Client_Mask( Client ), Req->argv[0]);
if( Req->argc == 2 )
{
/* Connect configured server */
if( ! Conf_EnableServer( Req->argv[0], atoi( Req->argv[1] ))) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
}
else
{
/* Add server */
if( ! Conf_AddServer( Req->argv[0], atoi( Req->argv[1] ), Req->argv[2], Req->argv[3], Req->argv[4] )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
}
return CONNECTED; return CONNECTED;
} /* IRC_CONNECT */ } /* IRC_CONNECT */
GLOBAL BOOLEAN
IRC_DISCONNECT(CLIENT *Client, REQUEST *Req )
{
/* Disconnect and disable configured server */
CONN_ID my_conn;
assert( Client != NULL );
assert( Req != NULL );
/* Not a local IRC operator? */
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
/* Bad number of parameters? */
if( Req->argc != 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
Log( LOG_NOTICE|LOG_snotice, "Got DISCONNECT command from \"%s\" for0 \"%s\".", Client_Mask( Client ), Req->argv[0]);
/* Save ID of this connection */
my_conn = Client_Conn( Client );
/* Connect configured server */
if( ! Conf_DisableServer( Req->argv[0] )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
/* Are we still connected or were we killed, too? */
if( Client_GetFromConn( my_conn )) return CONNECTED;
else return DISCONNECTED;
} /* IRC_CONNECT */
/* -eof- */ /* -eof- */

View File

@@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
* *
* $Id: irc-oper.h,v 1.10 2002/12/31 16:11:06 alex Exp $ * $Id: irc-oper.h,v 1.9 2002/12/12 12:23:43 alex Exp $
* *
* IRC operator commands (header) * IRC operator commands (header)
*/ */
@@ -23,7 +23,6 @@ GLOBAL BOOLEAN IRC_DIE PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_REHASH PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_REHASH PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_DISCONNECT PARAMS((CLIENT *Client, REQUEST *Req ));
#endif #endif

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-server.c,v 1.32 2003/04/20 23:09:26 alex Exp $"; static char UNUSED id[] = "$Id: irc-server.c,v 1.24 2002/12/12 12:24:18 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -23,9 +23,8 @@ static char UNUSED id[] = "$Id: irc-server.c,v 1.32 2003/04/20 23:09:26 alex Exp
#include <string.h> #include <string.h>
#include "resolve.h" #include "resolve.h"
#include "conn.h"
#include "conn-zip.h"
#include "conf.h" #include "conf.h"
#include "conn.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "irc-write.h" #include "irc-write.h"
@@ -41,7 +40,7 @@ static char UNUSED id[] = "$Id: irc-server.c,v 1.32 2003/04/20 23:09:26 alex Exp
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_SERVER( CLIENT *Client, REQUEST *Req ) IRC_SERVER( CLIENT *Client, REQUEST *Req )
{ {
CHAR str[LINE_LEN], *ptr, *modes, *topic; CHAR str[LINE_LEN], *ptr;
CLIENT *from, *c, *cl; CLIENT *from, *c, *cl;
CL2CHAN *cl2chan; CL2CHAN *cl2chan;
INT max_hops, i; INT max_hops, i;
@@ -64,8 +63,8 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
if(( Req->argc != 2 ) && ( Req->argc != 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if(( Req->argc != 2 ) && ( Req->argc != 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Ist dieser Server bei uns konfiguriert? */ /* Ist dieser Server bei uns konfiguriert? */
for( i = 0; i < MAX_SERVERS; i++ ) if( strcasecmp( Req->argv[0], Conf_Server[i].name ) == 0 ) break; for( i = 0; i < Conf_Server_Count; i++ ) if( strcasecmp( Req->argv[0], Conf_Server[i].name ) == 0 ) break;
if( i >= MAX_SERVERS ) if( i >= Conf_Server_Count )
{ {
/* Server ist nicht konfiguriert! */ /* Server ist nicht konfiguriert! */
Log( LOG_ERR, "Connection %d: Server \"%s\" not configured here!", Client_Conn( Client ), Req->argv[0] ); Log( LOG_ERR, "Connection %d: Server \"%s\" not configured here!", Client_Conn( Client ), Req->argv[0] );
@@ -115,13 +114,13 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (connection %d, 1 hop - direct link).", Client_ID( Client ), con ); Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (connection %d, 1 hop - direct link).", Client_ID( Client ), con );
Client_SetType( Client, CLIENT_SERVER ); Client_SetType( Client, CLIENT_SERVER );
Conf_SetServer( i, con ); Conn_SetServer( con, i );
#ifdef USE_ZLIB #ifdef USE_ZLIB
/* Kompression initialisieren, wenn erforderlich */ /* Kompression initialisieren, wenn erforderlich */
if( strchr( Client_Flags( Client ), 'Z' )) if( strchr( Client_Flags( Client ), 'Z' ))
{ {
if( ! Zip_InitConn( con )) if( ! Conn_InitZip( con ))
{ {
/* Fehler! */ /* Fehler! */
Conn_Close( con, "Can't inizialize compression (zlib)!", NULL, FALSE ); Conn_Close( con, "Can't inizialize compression (zlib)!", NULL, FALSE );
@@ -179,53 +178,33 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
while( chan ) while( chan )
{ {
#ifdef IRCPLUS #ifdef IRCPLUS
/* Send CHANINFO if the peer supports it */ /* Wenn unterstuetzt, CHANINFO senden */
if( strchr( Client_Flags( Client ), 'C' )) if( strchr( Client_Flags( Client ), 'C' ))
{ {
modes = Channel_Modes( chan ); /* CHANINFO senden */
topic = Channel_Topic( chan ); if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s :%s", Channel_Name( chan ), Channel_Modes( chan ), Channel_Topic( chan ))) return DISCONNECTED;
if( *modes || *topic )
{
/* send CHANINFO */
if(( ! strchr( Channel_Modes( chan ), 'k' )) && ( ! strchr( Channel_Modes( chan ), 'l' )) && ( ! *topic ))
{
/* "CHANINFO <chan> +<modes>" */
if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s", Channel_Name( chan ), modes )) return DISCONNECTED;
}
else if(( ! strchr( Channel_Modes( chan ), 'k' )) && ( ! strchr( Channel_Modes( chan ), 'l' )))
{
/* "CHANINFO <chan> +<modes> :<topic>" */
if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s :%s", Channel_Name( chan ), modes, topic )) return DISCONNECTED;
}
else
{
/* "CHANINFO <chan> +<modes> <key> <limit> :<topic>" */
if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s %s %ld :%s", Channel_Name( chan ), modes, strchr( Channel_Modes( chan ), 'k' ) ? Channel_Key( chan ) : "*", strchr( Channel_Modes( chan ), 'l' ) ? Channel_MaxUsers( chan ) : 0L, topic )) return DISCONNECTED;
}
}
} }
#endif #endif
/* alle Member suchen */ /* alle Member suchen */
cl2chan = Channel_FirstMember( chan ); cl2chan = Channel_FirstMember( chan );
snprintf( str, sizeof( str ), "NJOIN %s :", Channel_Name( chan )); sprintf( str, "NJOIN %s :", Channel_Name( chan ));
while( cl2chan ) while( cl2chan )
{ {
cl = Channel_GetClient( cl2chan ); cl = Channel_GetClient( cl2chan );
assert( cl != NULL ); assert( cl != NULL );
/* Nick, ggf. mit Modes, anhaengen */ /* Nick, ggf. mit Modes, anhaengen */
if( str[strlen( str ) - 1] != ':' ) strlcat( str, ",", sizeof( str )); if( str[strlen( str ) - 1] != ':' ) strcat( str, "," );
if( strchr( Channel_UserModes( chan, cl ), 'v' )) strlcat( str, "+", sizeof( str )); if( strchr( Channel_UserModes( chan, cl ), 'v' )) strcat( str, "+" );
if( strchr( Channel_UserModes( chan, cl ), 'o' )) strlcat( str, "@", sizeof( str )); if( strchr( Channel_UserModes( chan, cl ), 'o' )) strcat( str, "@" );
strlcat( str, Client_ID( cl ), sizeof( str )); strcat( str, Client_ID( cl ));
if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 8 )) if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 8 ))
{ {
/* Zeile senden */ /* Zeile senden */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED; if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
snprintf( str, sizeof( str ), "NJOIN %s :", Channel_Name( chan )); sprintf( str, "NJOIN %s :", Channel_Name( chan ));
} }
cl2chan = Channel_NextMember( chan, cl2chan ); cl2chan = Channel_NextMember( chan, cl2chan );
@@ -278,7 +257,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
} }
/* Log-Meldung zusammenbauen und ausgeben */ /* Log-Meldung zusammenbauen und ausgeben */
if(( Client_Hops( c ) > 1 ) && ( Req->prefix[0] )) snprintf( str, sizeof( str ), "connected to %s, ", Client_ID( from )); if(( Client_Hops( c ) > 1 ) && ( Req->prefix[0] )) sprintf( str, "connected to %s, ", Client_ID( from ));
else strcpy( str, "" ); else strcpy( str, "" );
Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (via %s, %s%d hop%s).", Client_ID( c ), Client_ID( Client ), str, Client_Hops( c ), Client_Hops( c ) > 1 ? "s": "" ); Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (via %s, %s%d hop%s).", Client_ID( c ), Client_ID( Client ), str, Client_Hops( c ), Client_Hops( c ) > 1 ? "s": "" );
@@ -294,7 +273,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_NJOIN( CLIENT *Client, REQUEST *Req ) IRC_NJOIN( CLIENT *Client, REQUEST *Req )
{ {
CHAR nick_in[COMMAND_LEN], nick_out[COMMAND_LEN], *channame, *ptr, modes[8]; CHAR str[COMMAND_LEN], *channame, *ptr, modes[8];
BOOLEAN is_op, is_voiced; BOOLEAN is_op, is_voiced;
CHANNEL *chan; CHANNEL *chan;
CLIENT *c; CLIENT *c;
@@ -305,11 +284,11 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
/* Falsche Anzahl Parameter? */ /* Falsche Anzahl Parameter? */
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
strlcpy( nick_in, Req->argv[1], sizeof( nick_in )); strncpy( str, Req->argv[1], COMMAND_LEN - 1 );
strcpy( nick_out, "" ); str[COMMAND_LEN - 1] = '\0';
channame = Req->argv[0]; channame = Req->argv[0];
ptr = strtok( nick_in, "," ); ptr = strtok( str, "," );
while( ptr ) while( ptr )
{ {
is_op = is_voiced = FALSE; is_op = is_voiced = FALSE;
@@ -336,15 +315,12 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
IRC_WriteStrChannelPrefix( Client, chan, c, FALSE, "JOIN :%s", channame ); IRC_WriteStrChannelPrefix( Client, chan, c, FALSE, "JOIN :%s", channame );
/* Channel-User-Modes setzen */ /* Channel-User-Modes setzen */
strlcpy( modes, Channel_UserModes( chan, c ), sizeof( modes )); strcpy( modes, Channel_UserModes( chan, c ));
if( modes[0] ) if( modes[0] )
{ {
/* Modes im Channel bekannt machen */ /* Modes im Channel bekannt machen */
IRC_WriteStrChannelPrefix( Client, chan, Client, FALSE, "MODE %s +%s %s", channame, modes, Client_ID( c )); IRC_WriteStrChannelPrefix( Client, chan, Client, FALSE, "MODE %s +%s %s", channame, modes, Client_ID( c ));
} }
if( nick_out[0] != '\0' ) strlcat( nick_out, ",", sizeof( nick_out ));
strlcat( nick_out, ptr, sizeof( nick_out ));
} }
else Log( LOG_ERR, "Got NJOIN for unknown nick \"%s\" for channel \"%s\"!", ptr, channame ); else Log( LOG_ERR, "Got NJOIN for unknown nick \"%s\" for channel \"%s\"!", ptr, channame );
@@ -353,7 +329,7 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
} }
/* an andere Server weiterleiten */ /* an andere Server weiterleiten */
if( nick_out[0] != '\0' ) IRC_WriteStrServersPrefix( Client, Client_ThisServer( ), "NJOIN %s :%s", Req->argv[0], nick_out ); IRC_WriteStrServersPrefix( Client, Client_ThisServer( ), "NJOIN %s :%s", Req->argv[0], Req->argv[1] );
return CONNECTED; return CONNECTED;
} /* IRC_NJOIN */ } /* IRC_NJOIN */
@@ -384,9 +360,9 @@ IRC_SQUIT( CLIENT *Client, REQUEST *Req )
if( Req->argv[1][0] ) if( Req->argv[1][0] )
{ {
if( strlen( Req->argv[1] ) > LINE_LEN ) Req->argv[1][LINE_LEN] = '\0'; if( strlen( Req->argv[1] ) > LINE_LEN ) Req->argv[1][LINE_LEN] = '\0';
snprintf( msg, sizeof( msg ), "%s (SQUIT from %s).", Req->argv[1], Client_ID( Client )); sprintf( msg, "%s (SQUIT from %s).", Req->argv[1], Client_ID( Client ));
} }
else snprintf( msg, sizeof( msg ), "Got SQUIT from %s.", Client_ID( Client )); else sprintf( msg, "Got SQUIT from %s.", Client_ID( Client ));
if( Client_Conn( target ) > NONE ) if( Client_Conn( target ) > NONE )
{ {

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-write.c,v 1.14 2002/12/30 17:15:42 alex Exp $"; static char UNUSED id[] = "$Id: irc-write.c,v 1.13 2002/12/12 12:24:18 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -22,7 +22,7 @@ static char UNUSED id[] = "$Id: irc-write.c,v 1.14 2002/12/30 17:15:42 alex Exp
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "conn-func.h" #include "conn.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "defines.h" #include "defines.h"

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -14,18 +14,14 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc.c,v 1.120 2003/03/31 15:54:21 alex Exp $"; static char UNUSED id[] = "$Id: irc.c,v 1.107.2.3 2002/12/31 15:48:33 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "ngircd.h"
#include "conn.h" #include "conn.h"
#include "resolve.h"
#include "conf.h"
#include "conn-func.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "defines.h" #include "defines.h"
@@ -38,9 +34,6 @@ static char UNUSED id[] = "$Id: irc.c,v 1.120 2003/03/31 15:54:21 alex Exp $";
#include "irc.h" #include "irc.h"
LOCAL CHAR *Option_String PARAMS(( CONN_ID Idx ));
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_ERROR( CLIENT *Client, REQUEST *Req ) IRC_ERROR( CLIENT *Client, REQUEST *Req )
{ {
@@ -78,11 +71,11 @@ IRC_KILL( CLIENT *Client, REQUEST *Req )
prefix = Client_ThisServer( ); prefix = Client_ThisServer( );
} }
if( Client != Client_ThisServer( )) Log( LOG_NOTICE|LOG_snotice, "Got KILL command from \"%s\" for \"%s\": %s", Client_Mask( prefix ), Req->argv[0], Req->argv[1] ); Log( LOG_NOTICE|LOG_snotice, "Got KILL command from \"%s\" for \"%s\": %s", Client_Mask( prefix ), Req->argv[0], Req->argv[1] );
/* Build reason string */ /* Build reason string */
if( Client_Type( Client ) == CLIENT_USER ) snprintf( reason, sizeof( reason ), "KILLed by %s: %s", Client_ID( Client ), Req->argv[1] ); if( Client_Type( Client ) == CLIENT_USER ) sprintf( reason, "KILLed by %s: %s", Client_ID( Client ), Req->argv[1] );
else strlcpy( reason, Req->argv[1], sizeof( reason )); else strcpy( reason, Req->argv[1] );
/* Inform other servers */ /* Inform other servers */
IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], reason ); IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], reason );
@@ -92,23 +85,17 @@ IRC_KILL( CLIENT *Client, REQUEST *Req )
/* Do we host such a client? */ /* Do we host such a client? */
c = Client_Search( Req->argv[0] ); c = Client_Search( Req->argv[0] );
if( c ) if( c && Client_Type( c ) == CLIENT_USER )
{ {
/* Yes, there is such a client -- but is it a valid user? */ /* Yes, I found it! */
if( Client_Type( c ) == CLIENT_SERVER ) IRC_WriteStrClient( Client, ERR_CANTKILLSERVER_MSG, Client_ID( Client ));
else if( Client_Type( c ) != CLIENT_USER )IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
else
{
/* Kill user NOW! */
conn = Client_Conn( c ); conn = Client_Conn( c );
Client_Destroy( c, NULL, reason, FALSE ); Client_Destroy( c, NULL, reason, FALSE );
if( conn != NONE ) Conn_Close( conn, NULL, reason, TRUE ); if( conn != NONE ) Conn_Close( Client_Conn( c ), NULL, reason, TRUE );
}
} }
else Log( LOG_NOTICE, "Client with nick \"%s\" is unknown here.", Req->argv[0] ); else Log( LOG_NOTICE, "Client with nick \"%s\" is unknown here.", Req->argv[0] );
/* Are we still connected or were we killed, too? */ /* Are we still connected or were we killed, too? */
if(( my_conn > NONE ) && ( Client_GetFromConn( my_conn ))) return CONNECTED; if( Client_GetFromConn( my_conn )) return CONNECTED;
else return DISCONNECTED; else return DISCONNECTED;
} /* IRC_KILL */ } /* IRC_KILL */
@@ -183,106 +170,4 @@ IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
} /* IRC_PRIVMSG */ } /* IRC_PRIVMSG */
GLOBAL BOOLEAN
IRC_TRACE( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target, *c;
CONN_ID idx, idx2;
assert( Client != NULL );
assert( Req != NULL );
/* Bad number of arguments? */
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NORECIPIENT_MSG, Client_ID( Client ), Req->command );
/* Search sender */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Search target */
if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
else target = Client_ThisServer( );
/* Forward command to other server? */
if( target != Client_ThisServer( ))
{
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
/* Send RPL_TRACELINK back to initiator */
idx = Client_Conn( Client ); assert( idx > NONE );
idx2 = Client_Conn( Client_NextHop( target )); assert( idx2 > NONE );
if( ! IRC_WriteStrClient( from, RPL_TRACELINK_MSG, Client_ID( from ), PACKAGE_NAME, PACKAGE_VERSION, Client_ID( target ), Client_ID( Client_NextHop( target )), Option_String( idx2 ), time( NULL ) - Conn_StartTime( idx2 ), Conn_SendQ( idx ), Conn_SendQ( idx2 ))) return DISCONNECTED;
/* Forward command */
IRC_WriteStrClientPrefix( target, from, "TRACE %s", Req->argv[0] );
return CONNECTED;
}
/* Infos about all connected servers */
c = Client_First( );
while( c )
{
if( Client_Conn( c ) > NONE )
{
/* Local client */
if( Client_Type( c ) == CLIENT_SERVER )
{
/* Server link */
if( ! IRC_WriteStrClient( from, RPL_TRACESERVER_MSG, Client_ID( from ), Client_ID( c ), Client_Mask( c ), Option_String( Client_Conn( c )))) return DISCONNECTED;
}
if(( Client_Type( c ) == CLIENT_USER ) && ( strchr( Client_Modes( c ), 'o' )))
{
/* IRC Operator */
if( ! IRC_WriteStrClient( from, RPL_TRACEOPERATOR_MSG, Client_ID( from ), Client_ID( c ))) return DISCONNECTED;
}
}
c = Client_Next( c );
}
/* Some information about us */
if( ! IRC_WriteStrClient( from, RPL_TRACESERVER_MSG, Client_ID( from ), Conf_ServerName, Client_Mask( Client_ThisServer( )), Option_String( Client_Conn( Client )))) return DISCONNECTED;
return IRC_WriteStrClient( from, RPL_TRACEEND_MSG, Client_ID( from ), Conf_ServerName, PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel );
} /* IRC_TRACE */
GLOBAL BOOLEAN
IRC_HELP( CLIENT *Client, REQUEST *Req )
{
COMMAND *cmd;
assert( Client != NULL );
assert( Req != NULL );
/* Bad number of arguments? */
if( Req->argc > 0 ) return IRC_WriteStrClient( Client, ERR_NORECIPIENT_MSG, Client_ID( Client ), Req->command );
cmd = Parse_GetCommandStruct( );
while( cmd->name )
{
if( ! IRC_WriteStrClient( Client, "NOTICE %s :%s", Client_ID( Client ), cmd->name )) return DISCONNECTED;
cmd++;
}
return CONNECTED;
} /* IRC_HELP */
LOCAL CHAR *
Option_String( CONN_ID Idx )
{
STATIC CHAR option_txt[8];
INT options;
options = Conn_Options( Idx );
strcpy( option_txt, "F" ); /* No idea what this means but the original ircd sends it ... */
#ifdef USE_ZLIB
if( options & CONN_ZIP ) strcat( option_txt, "z" );
#endif
return option_txt;
} /* Option_String */
/* -eof- */ /* -eof- */

View File

@@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
* *
* $Id: irc.h,v 1.38 2003/01/15 13:49:20 alex Exp $ * $Id: irc.h,v 1.36 2002/12/12 12:23:43 alex Exp $
* *
* IRC commands (header) * IRC commands (header)
*/ */
@@ -22,8 +22,6 @@ GLOBAL BOOLEAN IRC_ERROR PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_KILL PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_KILL PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NOTICE PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_NOTICE PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_PRIVMSG PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_PRIVMSG PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_TRACE PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_HELP PARAMS(( CLIENT *Client, REQUEST *Req ));
#endif #endif

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: lists.c,v 1.11 2002/12/26 16:25:43 alex Exp $"; static char UNUSED id[] = "$Id: lists.c,v 1.10 2002/12/12 12:24:18 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -331,17 +331,19 @@ Lists_MakeMask( CHAR *Pattern )
if(( ! at ) && ( ! excl )) if(( ! at ) && ( ! excl ))
{ {
/* weder ! noch @ vorhanden: als Nick annehmen */ /* weder ! noch @<EFBFBD>vorhanden: als Nick annehmen */
strlcpy( TheMask, Pattern, sizeof( TheMask ) - 5 ); strncpy( TheMask, Pattern, MASK_LEN - 5 );
strlcat( TheMask, "!*@*", sizeof( TheMask )); TheMask[MASK_LEN - 5] = '\0';
strcat( TheMask, "!*@*" );
return TheMask; return TheMask;
} }
if(( ! at ) && ( excl )) if(( ! at ) && ( excl ))
{ {
/* Domain fehlt */ /* Domain fehlt */
strlcpy( TheMask, Pattern, sizeof( TheMask ) - 3 ); strncpy( TheMask, Pattern, MASK_LEN - 3 );
strlcat( TheMask, "@*", sizeof( TheMask )); TheMask[MASK_LEN - 3] = '\0';
strcat( TheMask, "@*" );
return TheMask; return TheMask;
} }
@@ -349,14 +351,17 @@ Lists_MakeMask( CHAR *Pattern )
{ {
/* User fehlt */ /* User fehlt */
*at = '\0'; at++; *at = '\0'; at++;
strlcpy( TheMask, Pattern, sizeof( TheMask ) - strlen( at ) - 4 ); strncpy( TheMask, Pattern, MASK_LEN - 4 );
strlcat( TheMask, "!*@", sizeof( TheMask )); TheMask[MASK_LEN - 4] = '\0';
strlcat( TheMask, at, sizeof( TheMask )); strcat( TheMask, "!*@" );
strncat( TheMask, at, strlen( TheMask ) - MASK_LEN - 1 );
TheMask[MASK_LEN - 1] = '\0';
return TheMask; return TheMask;
} }
/* alle Teile vorhanden */ /* alle Teile vorhanden */
strlcpy( TheMask, Pattern, sizeof( TheMask )); strncpy( TheMask, Pattern, MASK_LEN - 1 );
TheMask[MASK_LEN - 1] = '\0';
return TheMask; return TheMask;
} /* Lists_MakeMask */ } /* Lists_MakeMask */
@@ -377,7 +382,7 @@ New_C2C( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )
return NULL; return NULL;
} }
strlcpy( c2c->mask, Mask, sizeof( c2c->mask )); strncpy( c2c->mask, Mask, MASK_LEN );
c2c->channel = Chan; c2c->channel = Chan;
c2c->onlyonce = OnlyOnce; c2c->onlyonce = OnlyOnce;

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: log.c,v 1.43 2003/03/31 15:54:21 alex Exp $"; static char UNUSED id[] = "$Id: log.c,v 1.41 2002/12/12 12:24:18 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -52,7 +52,7 @@ Log_Init( VOID )
{ {
#ifdef USE_SYSLOG #ifdef USE_SYSLOG
/* Syslog initialisieren */ /* Syslog initialisieren */
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 ); openlog( PACKAGE, LOG_CONS|LOG_PID, LOG_LOCAL5 );
#endif #endif
/* Hello World! */ /* Hello World! */
@@ -95,7 +95,7 @@ Log_InitErrorfile( VOID )
* landen z.B. alle Ausgaben von assert()-Aufrufen. */ * landen z.B. alle Ausgaben von assert()-Aufrufen. */
/* Dateiname zusammen bauen */ /* Dateiname zusammen bauen */
sprintf( Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE_NAME, (LONG)getpid( )); sprintf( Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE, (LONG)getpid( ));
/* stderr umlenken */ /* stderr umlenken */
fflush( stderr ); fflush( stderr );
@@ -119,8 +119,8 @@ GLOBAL VOID
Log_Exit( VOID ) Log_Exit( VOID )
{ {
/* Good Bye! */ /* Good Bye! */
if( NGIRCd_SignalRestart ) Log( LOG_NOTICE, "%s done (restarting).", PACKAGE_NAME ); if( NGIRCd_Restart ) Log( LOG_NOTICE, "%s done (restarting).", PACKAGE );
else Log( LOG_NOTICE, "%s done.", PACKAGE_NAME ); else Log( LOG_NOTICE, "%s done.", PACKAGE );
/* Error-File (stderr) loeschen */ /* Error-File (stderr) loeschen */
if( unlink( Error_File ) != 0 ) Log( LOG_ERR, "Can't delete \"%s\": %s", Error_File, strerror( errno )); if( unlink( Error_File ) != 0 ) Log( LOG_ERR, "Can't delete \"%s\": %s", Error_File, strerror( errno ));
@@ -207,7 +207,7 @@ GLOBAL VOID
Log_Init_Resolver( VOID ) Log_Init_Resolver( VOID )
{ {
#ifdef USE_SYSLOG #ifdef USE_SYSLOG
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 ); openlog( PACKAGE, LOG_CONS|LOG_PID, LOG_LOCAL5 );
#endif #endif
} /* Log_Init_Resolver */ } /* Log_Init_Resolver */

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
* *
* $Id: messages.h,v 1.64 2003/03/19 21:16:16 alex Exp $ * $Id: messages.h,v 1.59.2.1 2002/12/22 23:42:28 alex Exp $
* *
* IRC numerics (Header) * IRC numerics (Header)
*/ */
@@ -22,11 +22,7 @@
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)" #define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
#define RPL_CREATED_MSG "003 %s :This server has been started %s" #define RPL_CREATED_MSG "003 %s :This server has been started %s"
#define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s" #define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s"
#define RPL_ISUPPORT_MSG "005 %s NICKLEN=%d TOPICLEN=%d AWAYLEN=%d MAXCHANNELS=%d :are supported on this server" #define RPL_FEATURE_MSG "005 %s NICKLEN=%d TOPICLEN=%d AWAYLEN=%d MAXCHANNELS=%d :are supported on this server"
#define RPL_TRACELINK_MSG "200 %s Link %s-%s %s %s V%s %ld %d %d"
#define RPL_TRACEOPERATOR_MSG "204 %s Oper 2 :%s"
#define RPL_TRACESERVER_MSG "206 %s Serv 1 0S 0C %s *!*@%s :V%s"
#define RPL_STATSLINKINFO_MSG "211 %s %s %d %ld %ld %ld %ld :%ld" #define RPL_STATSLINKINFO_MSG "211 %s %s %d %ld %ld %ld %ld :%ld"
#define RPL_STATSCOMMANDS_MSG "212 %s %s %ld %ld %ld" #define RPL_STATSCOMMANDS_MSG "212 %s %s %ld %ld %ld"
#define RPL_ENDOFSTATS_MSG "219 %s %c :End of STATS report" #define RPL_ENDOFSTATS_MSG "219 %s %c :End of STATS report"
@@ -40,7 +36,6 @@
#define RPL_ADMINLOC1_MSG "257 %s :%s" #define RPL_ADMINLOC1_MSG "257 %s :%s"
#define RPL_ADMINLOC2_MSG "258 %s :%s" #define RPL_ADMINLOC2_MSG "258 %s :%s"
#define RPL_ADMINEMAIL_MSG "259 %s :%s" #define RPL_ADMINEMAIL_MSG "259 %s :%s"
#define RPL_TRACEEND_MSG "262 %s %s %s-%s.%s :End of TRACE"
#define RPL_LOCALUSERS_MSG "265 %s :Current local users: %ld, Max: %ld" #define RPL_LOCALUSERS_MSG "265 %s :Current local users: %ld, Max: %ld"
#define RPL_NETUSERS_MSG "266 %s :Current global users: %ld, Max: %ld" #define RPL_NETUSERS_MSG "266 %s :Current global users: %ld, Max: %ld"
@@ -109,7 +104,6 @@
#define ERR_BADCHANNELKEY_MSG "475 %s %s :Cannot join channel (+k)" #define ERR_BADCHANNELKEY_MSG "475 %s %s :Cannot join channel (+k)"
#define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied" #define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied"
#define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator" #define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator"
#define ERR_CANTKILLSERVER_MSG "483 %s :You can't kill a server!"
#define ERR_RESTRICTED_MSG "484 %s :Your connection is restricted" #define ERR_RESTRICTED_MSG "484 %s :Your connection is restricted"
#define ERR_NOOPERHOST_MSG "491 %s :Not configured for your host" #define ERR_NOOPERHOST_MSG "491 %s :Not configured for your host"

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: ngircd.c,v 1.76 2003/03/31 15:54:21 alex Exp $"; static char UNUSED id[] = "$Id: ngircd.c,v 1.64.2.1 2003/01/01 13:47:42 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -43,10 +43,6 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.76 2003/03/31 15:54:21 alex Exp $";
#include "parse.h" #include "parse.h"
#include "irc.h" #include "irc.h"
#ifdef RENDEZVOUS
#include "rendezvous.h"
#endif
#include "exp.h" #include "exp.h"
#include "ngircd.h" #include "ngircd.h"
@@ -69,16 +65,17 @@ main( int argc, const char *argv[] )
umask( 0077 ); umask( 0077 );
NGIRCd_SignalQuit = NGIRCd_SignalRestart = NGIRCd_SignalRehash = FALSE; NGIRCd_Restart = FALSE;
NGIRCd_NoDaemon = NGIRCd_Passive = FALSE; NGIRCd_Quit = FALSE;
NGIRCd_NoDaemon = FALSE;
NGIRCd_Passive = FALSE;
#ifdef DEBUG #ifdef DEBUG
NGIRCd_Debug = FALSE; NGIRCd_Debug = FALSE;
#endif #endif
#ifdef SNIFFER #ifdef SNIFFER
NGIRCd_Sniffer = FALSE; NGIRCd_Sniffer = FALSE;
#endif #endif
strlcpy( NGIRCd_ConfFile, SYSCONFDIR, sizeof( NGIRCd_ConfFile )); strcpy( NGIRCd_ConfFile, CONFIG_FILE );
strlcat( NGIRCd_ConfFile, CONFIG_FILE, sizeof( NGIRCd_ConfFile ));
/* Kommandozeile parsen */ /* Kommandozeile parsen */
for( i = 1; i < argc; i++ ) for( i = 1; i < argc; i++ )
@@ -92,10 +89,11 @@ main( int argc, const char *argv[] )
{ {
if( i + 1 < argc ) if( i + 1 < argc )
{ {
/* Ok, there's an parameter left */ /* Ok, danach kommt noch ein Parameter */
strlcpy( NGIRCd_ConfFile, argv[i + 1], sizeof( NGIRCd_ConfFile )); strncpy( NGIRCd_ConfFile, argv[i + 1], FNAME_LEN - 1 );
NGIRCd_ConfFile[FNAME_LEN - 1] = '\0';
/* next parameter */ /* zum uebernaechsten Parameter */
i++; ok = TRUE; i++; ok = TRUE;
} }
} }
@@ -158,10 +156,11 @@ main( int argc, const char *argv[] )
{ {
if(( ! argv[i][n + 1] ) && ( i + 1 < argc )) if(( ! argv[i][n + 1] ) && ( i + 1 < argc ))
{ {
/* Ok, next character is a blank */ /* Ok, danach kommt ein Leerzeichen */
strlcpy( NGIRCd_ConfFile, argv[i + 1], sizeof( NGIRCd_ConfFile )); strncpy( NGIRCd_ConfFile, argv[i + 1], FNAME_LEN - 1 );
NGIRCd_ConfFile[FNAME_LEN - 1] = '\0';
/* go to the following parameter */ /* zum uebernaechsten Parameter */
i++; n = (LONG)strlen( argv[i] ); i++; n = (LONG)strlen( argv[i] );
ok = TRUE; ok = TRUE;
} }
@@ -186,8 +185,8 @@ main( int argc, const char *argv[] )
if( ! ok ) if( ! ok )
{ {
printf( "%s: invalid option \"-%c\"!\n", PACKAGE_NAME, argv[i][n] ); printf( "%s: invalid option \"-%c\"!\n", PACKAGE, argv[i][n] );
printf( "Try \"%s --help\" for more information.\n", PACKAGE_NAME ); printf( "Try \"%s --help\" for more information.\n", PACKAGE );
exit( 1 ); exit( 1 );
} }
} }
@@ -195,8 +194,8 @@ main( int argc, const char *argv[] )
} }
if( ! ok ) if( ! ok )
{ {
printf( "%s: invalid option \"%s\"!\n", PACKAGE_NAME, argv[i] ); printf( "%s: invalid option \"%s\"!\n", PACKAGE, argv[i] );
printf( "Try \"%s --help\" for more information.\n", PACKAGE_NAME ); printf( "Try \"%s --help\" for more information.\n", PACKAGE );
exit( 1 ); exit( 1 );
} }
} }
@@ -221,7 +220,7 @@ main( int argc, const char *argv[] )
exit( Conf_Test( )); exit( Conf_Test( ));
} }
while( ! NGIRCd_SignalQuit ) while( ! NGIRCd_Quit )
{ {
/* In der Regel wird ein Sub-Prozess ge-fork()'t, der /* In der Regel wird ein Sub-Prozess ge-fork()'t, der
* nicht mehr mit dem Terminal verbunden ist. Mit der * nicht mehr mit dem Terminal verbunden ist. Mit der
@@ -239,7 +238,7 @@ main( int argc, const char *argv[] )
if( pid < 0 ) if( pid < 0 )
{ {
/* Fehler */ /* Fehler */
printf( "%s: Can't fork: %s!\nFatal error, exiting now ...\n", PACKAGE_NAME, strerror( errno )); printf( "%s: Can't fork: %s!\nFatal error, exiting now ...\n", PACKAGE, strerror( errno ));
exit( 1 ); exit( 1 );
} }
@@ -251,9 +250,8 @@ main( int argc, const char *argv[] )
/* Globale Variablen initialisieren */ /* Globale Variablen initialisieren */
NGIRCd_Start = time( NULL ); NGIRCd_Start = time( NULL );
(VOID)strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start )); (VOID)strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start ));
NGIRCd_SignalRehash = FALSE; NGIRCd_Restart = FALSE;
NGIRCd_SignalRestart = FALSE; NGIRCd_Quit = FALSE;
NGIRCd_SignalQuit = FALSE;
/* Module initialisieren */ /* Module initialisieren */
Log_Init( ); Log_Init( );
@@ -262,9 +260,6 @@ main( int argc, const char *argv[] )
Lists_Init( ); Lists_Init( );
Channel_Init( ); Channel_Init( );
Client_Init( ); Client_Init( );
#ifdef RENDEZVOUS
Rendezvous_Init( );
#endif
Conn_Init( ); Conn_Init( );
/* Wenn als root ausgefuehrt und eine andere UID /* Wenn als root ausgefuehrt und eine andere UID
@@ -297,13 +292,13 @@ main( int argc, const char *argv[] )
* beim PASS-Befehl verwendete Syntax sowie die erweiterten Flags * beim PASS-Befehl verwendete Syntax sowie die erweiterten Flags
* sind in doc/Protocol.txt beschrieben. */ * sind in doc/Protocol.txt beschrieben. */
#ifdef IRCPLUS #ifdef IRCPLUS
sprintf( NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE_NAME, PACKAGE_VERSION, IRCPLUSFLAGS ); sprintf( NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE, VERSION, IRCPLUSFLAGS );
#ifdef USE_ZLIB #ifdef USE_ZLIB
strcat( NGIRCd_ProtoID, "Z" ); strcat( NGIRCd_ProtoID, "Z" );
#endif #endif
if( Conf_OperCanMode ) strcat( NGIRCd_ProtoID, "o" ); if( Conf_OperCanMode ) strcat( NGIRCd_ProtoID, "o" );
#else #else
sprintf( NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE_NAME, PACKAGE_VERSION ); sprintf( NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE, VERSION );
#endif #endif
strcat( NGIRCd_ProtoID, " P" ); strcat( NGIRCd_ProtoID, " P" );
#ifdef USE_ZLIB #ifdef USE_ZLIB
@@ -318,7 +313,7 @@ main( int argc, const char *argv[] )
if( Conn_InitListeners( ) < 1 ) if( Conn_InitListeners( ) < 1 )
{ {
Log( LOG_ALERT, "Server isn't listening on a single port!" ); Log( LOG_ALERT, "Server isn't listening on a single port!" );
Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 ); exit( 1 );
} }
@@ -327,9 +322,6 @@ main( int argc, const char *argv[] )
/* Alles abmelden */ /* Alles abmelden */
Conn_Exit( ); Conn_Exit( );
#ifdef RENDEZVOUS
Rendezvous_Exit( );
#endif
Client_Exit( ); Client_Exit( );
Channel_Exit( ); Channel_Exit( );
Lists_Exit( ); Lists_Exit( );
@@ -346,9 +338,9 @@ NGIRCd_Version( VOID )
STATIC CHAR version[126]; STATIC CHAR version[126];
#ifdef CVSDATE #ifdef CVSDATE
sprintf( version, "%s %s(%s)-%s", PACKAGE_NAME, PACKAGE_VERSION, CVSDATE, NGIRCd_VersionAddition( )); sprintf( version, "%s %s(%s)-%s", PACKAGE, VERSION, CVSDATE, NGIRCd_VersionAddition( ));
#else #else
sprintf( version, "%s %s-%s", PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_VersionAddition( )); sprintf( version, "%s %s-%s", PACKAGE, VERSION, NGIRCd_VersionAddition( ));
#endif #endif
return version; return version;
} /* NGIRCd_Version */ } /* NGIRCd_Version */
@@ -357,7 +349,7 @@ NGIRCd_Version( VOID )
GLOBAL CHAR * GLOBAL CHAR *
NGIRCd_VersionAddition( VOID ) NGIRCd_VersionAddition( VOID )
{ {
STATIC CHAR txt[200]; STATIC CHAR txt[64];
strcpy( txt, "" ); strcpy( txt, "" );
@@ -369,14 +361,6 @@ NGIRCd_VersionAddition( VOID )
if( txt[0] ) strcat( txt, "+" ); if( txt[0] ) strcat( txt, "+" );
strcat( txt, "ZLIB" ); strcat( txt, "ZLIB" );
#endif #endif
#ifdef USE_TCPWRAP
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "TCPWRAP" );
#endif
#ifdef RENDEZVOUS
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "RENDEZVOUS" );
#endif
#ifdef DEBUG #ifdef DEBUG
if( txt[0] ) strcat( txt, "+" ); if( txt[0] ) strcat( txt, "+" );
strcat( txt, "DEBUG" ); strcat( txt, "DEBUG" );
@@ -394,12 +378,12 @@ NGIRCd_VersionAddition( VOID )
strcat( txt, "IRCPLUS" ); strcat( txt, "IRCPLUS" );
#endif #endif
if( txt[0] ) strlcat( txt, "-", sizeof( txt )); if( txt[0] ) strcat( txt, "-" );
strlcat( txt, TARGET_CPU, sizeof( txt )); strcat( txt, TARGET_CPU );
strlcat( txt, "/", sizeof( txt )); strcat( txt, "/" );
strlcat( txt, TARGET_VENDOR, sizeof( txt )); strcat( txt, TARGET_VENDOR );
strlcat( txt, "/", sizeof( txt )); strcat( txt, "/" );
strlcat( txt, TARGET_OS, sizeof( txt )); strcat( txt, TARGET_OS );
return txt; return txt;
} /* NGIRCd_VersionAddition */ } /* NGIRCd_VersionAddition */
@@ -410,18 +394,14 @@ NGIRCd_Rehash( VOID )
{ {
CHAR old_name[CLIENT_ID_LEN]; CHAR old_name[CLIENT_ID_LEN];
Log( LOG_NOTICE|LOG_snotice, "Re-reading configuration NOW!" );
NGIRCd_SignalRehash = FALSE;
/* Alle Listen-Sockets schliessen */ /* Alle Listen-Sockets schliessen */
Conn_ExitListeners( ); Conn_ExitListeners( );
/* Alten Server-Namen merken */ /* Alten Server-Namen merken */
assert( sizeof( old_name ) == sizeof( Conf_ServerName ));
strcpy( old_name, Conf_ServerName ); strcpy( old_name, Conf_ServerName );
/* Konfiguration neu lesen ... */ /* Konfiguration neu lesen ... */
Conf_Rehash( ); Conf_Init( );
/* Alten Server-Namen wiederherstellen: dieser /* Alten Server-Namen wiederherstellen: dieser
* kann nicht zur Laufzeit geaendert werden ... */ * kann nicht zur Laufzeit geaendert werden ... */
@@ -437,10 +417,7 @@ NGIRCd_Rehash( VOID )
/* Listen-Sockets neu anlegen: */ /* Listen-Sockets neu anlegen: */
Conn_InitListeners( ); Conn_InitListeners( );
/* Sync configuration with established connections */ Log( LOG_INFO, "Re-reading of configuration done." );
Conn_SyncServerStruct( );
Log( LOG_NOTICE|LOG_snotice, "Re-reading of configuration done." );
} /* NGIRCd_Rehash */ } /* NGIRCd_Rehash */
@@ -504,21 +481,23 @@ Signal_Handler( INT Signal )
case SIGINT: case SIGINT:
case SIGQUIT: case SIGQUIT:
/* wir soll(t)en uns wohl beenden ... */ /* wir soll(t)en uns wohl beenden ... */
NGIRCd_SignalQuit = TRUE; if( Signal == SIGTERM ) Log( LOG_WARNING|LOG_snotice, "Got TERM signal, terminating now ..." );
else if( Signal == SIGINT ) Log( LOG_WARNING|LOG_snotice, "Got INT signal, terminating now ..." );
else if( Signal == SIGQUIT ) Log( LOG_WARNING|LOG_snotice, "Got QUIT signal, terminating now ..." );
NGIRCd_Quit = TRUE;
break; break;
case SIGHUP: case SIGHUP:
/* Konfiguration neu einlesen: */ /* Konfiguration neu einlesen: */
NGIRCd_SignalRehash = TRUE; Log( LOG_WARNING|LOG_snotice, "Got HUP signal, re-reading configuration ..." );
NGIRCd_Rehash( );
break; break;
case SIGCHLD: case SIGCHLD:
/* Child-Prozess wurde beendet. Zombies vermeiden: */ /* Child-Prozess wurde beendet. Zombies vermeiden: */
while( waitpid( -1, NULL, WNOHANG ) > 0); while( waitpid( -1, NULL, WNOHANG ) > 0);
break; break;
#ifdef DEBUG
default: default:
/* unbekanntes bzw. unbehandeltes Signal */ /* unbekanntes bzw. unbehandeltes Signal */
Log( LOG_DEBUG, "Got signal %d! Ignored.", Signal ); Log( LOG_NOTICE, "Got signal %d! Ignored.", Signal );
#endif
} }
} /* Signal_Handler */ } /* Signal_Handler */

View File

@@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
* *
* $Id: ngircd.h,v 1.19 2002/12/26 16:48:14 alex Exp $ * $Id: ngircd.h,v 1.17 2002/12/12 11:30:23 alex Exp $
* *
* Prototypes of the "main module". * Prototypes of the "main module".
*/ */
@@ -37,15 +37,14 @@ GLOBAL BOOLEAN NGIRCd_NoDaemon; /* nicht im Hintergrund laufen */
GLOBAL BOOLEAN NGIRCd_Passive; /* nicht zu anderen Servern connecten */ GLOBAL BOOLEAN NGIRCd_Passive; /* nicht zu anderen Servern connecten */
GLOBAL BOOLEAN NGIRCd_SignalQuit; /* TRUE: quit server*/ GLOBAL BOOLEAN NGIRCd_Quit; /* TRUE: ngIRCd beenden */
GLOBAL BOOLEAN NGIRCd_SignalRestart; /* TRUE: restart server */ GLOBAL BOOLEAN NGIRCd_Restart; /* TRUE: neu starten */
GLOBAL BOOLEAN NGIRCd_SignalRehash; /* TRUE: reload configuration */
GLOBAL CHAR NGIRCd_DebugLevel[2]; /* Debug-Level fuer IRC_VERSION() */ GLOBAL CHAR NGIRCd_DebugLevel[2]; /* Debug-Level fuer IRC_VERSION() */
GLOBAL CHAR NGIRCd_ConfFile[FNAME_LEN]; /* Konfigurationsdatei */ GLOBAL CHAR NGIRCd_ConfFile[FNAME_LEN]; /* Konfigurationsdatei */
GLOBAL CHAR NGIRCd_ProtoID[COMMAND_LEN];/* Protokoll- und Server-Identifikation */ GLOBAL CHAR NGIRCd_ProtoID[1024]; /* Protokoll- und Server-Identifikation */
GLOBAL CHAR *NGIRCd_Version PARAMS((VOID )); GLOBAL CHAR *NGIRCd_Version PARAMS((VOID ));

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: parse.c,v 1.59 2003/01/15 13:49:20 alex Exp $"; static char UNUSED id[] = "$Id: parse.c,v 1.52 2002/12/18 13:53:20 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -24,7 +24,7 @@ static char UNUSED id[] = "$Id: parse.c,v 1.59 2003/01/15 13:49:20 alex Exp $";
#include "ngircd.h" #include "ngircd.h"
#include "defines.h" #include "defines.h"
#include "conn-func.h" #include "conn.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "log.h" #include "log.h"
@@ -54,9 +54,7 @@ COMMAND My_Commands[] =
{ "AWAY", IRC_AWAY, CLIENT_USER, 0, 0, 0 }, { "AWAY", IRC_AWAY, CLIENT_USER, 0, 0, 0 },
{ "CONNECT", IRC_CONNECT, CLIENT_USER, 0, 0, 0 }, { "CONNECT", IRC_CONNECT, CLIENT_USER, 0, 0, 0 },
{ "DIE", IRC_DIE, CLIENT_USER, 0, 0, 0 }, { "DIE", IRC_DIE, CLIENT_USER, 0, 0, 0 },
{ "DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 0, 0, 0 },
{ "ERROR", IRC_ERROR, 0xFFFF, 0, 0, 0 }, { "ERROR", IRC_ERROR, 0xFFFF, 0, 0, 0 },
{ "HELP", IRC_HELP, CLIENT_USER, 0, 0, 0 },
{ "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "ISON", IRC_ISON, CLIENT_USER, 0, 0, 0 }, { "ISON", IRC_ISON, CLIENT_USER, 0, 0, 0 },
{ "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
@@ -85,7 +83,6 @@ COMMAND My_Commands[] =
{ "STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "TRACE", IRC_TRACE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "USER", IRC_USER, 0xFFFF, 0, 0, 0 }, { "USER", IRC_USER, 0xFFFF, 0, 0, 0 },
{ "USERHOST", IRC_USERHOST, CLIENT_USER, 0, 0, 0 }, { "USERHOST", IRC_USERHOST, CLIENT_USER, 0, 0, 0 },
{ "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
@@ -166,7 +163,7 @@ Parse_Request( CONN_ID Idx, CHAR *Request )
*ptr = '\0'; *ptr = '\0';
#ifndef STRICT_RFC #ifndef STRICT_RFC
/* multiple Leerzeichen als Trenner vor /* multiple Leerzeichen als Trenner vor
* Parametern ignorieren */ *Parametertrennern ignorieren */
while( *(ptr + 1) == ' ' ) ptr++; while( *(ptr + 1) == ' ' ) ptr++;
#endif #endif
} }
@@ -329,50 +326,46 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
client = Client_GetFromConn( Idx ); client = Client_GetFromConn( Idx );
assert( client != NULL ); assert( client != NULL );
/* Statuscode? */ /* Statuscode, der geforwarded werden muss? */
if(( Client_Type( client ) == CLIENT_SERVER ) && ( strlen( Req->command ) == 3 ) && ( atoi( Req->command ) > 100 )) if(( strlen( Req->command ) == 3 ) && ( atoi( Req->command ) > 100 ))
{ {
/* Command is a status code from an other server */ /* Befehl ist ein Statuscode */
/* Determine target */ /* Zielserver ermitteln */
if( Req->argc > 0 ) target = Client_Search( Req->argv[0] ); if(( Client_Type( client ) == CLIENT_SERVER ) && ( Req->argc > 0 )) target = Client_Search( Req->argv[0] );
else target = NULL; else target = NULL;
if( ! target ) if( ! target )
{ {
/* Status code without target!? */
if( Req->argc > 0 ) Log( LOG_WARNING, "Unknown target for status code %s: \"%s\"", Req->command, Req->argv[0] ); if( Req->argc > 0 ) Log( LOG_WARNING, "Unknown target for status code %s: \"%s\"", Req->command, Req->argv[0] );
else Log( LOG_WARNING, "Unknown target for status code %s!", Req->command ); else Log( LOG_WARNING, "Unknown target for status code %s!", Req->command );
return TRUE; return TRUE;
} }
if( target == Client_ThisServer( )) if( target == Client_ThisServer( ))
{ {
/* This server is the target, ignore it */
Log( LOG_DEBUG, "Ignored status code %s from \"%s\".", Req->command, Client_ID( client )); Log( LOG_DEBUG, "Ignored status code %s from \"%s\".", Req->command, Client_ID( client ));
return TRUE; return TRUE;
} }
/* Determine source */ /* Quell-Client ermitteln */
if( ! Req->prefix[0] ) if( ! Req->prefix[0] )
{ {
/* Oops, no prefix!? */ Log( LOG_WARNING, "Got status code without prefix!?" );
Log( LOG_WARNING, "Got status code %s from \"%s\" without prefix!?", Req->command, Client_ID( client ));
return TRUE; return TRUE;
} }
else prefix = Client_Search( Req->prefix ); else prefix = Client_Search( Req->prefix );
if( ! prefix ) if( ! prefix )
{ {
/* Oops, unknown prefix!? */ Log( LOG_WARNING, "Got status code from unknown source: \"%s\"", Req->prefix );
Log( LOG_WARNING, "Got status code %s from unknown source: \"%s\"", Req->command, Req->prefix );
return TRUE; return TRUE;
} }
/* Forward status code */ /* Statuscode weiterleiten */
strlcpy( str, Req->command, sizeof( str )); strcpy( str, Req->command );
for( i = 0; i < Req->argc; i++ ) for( i = 0; i < Req->argc; i++ )
{ {
if( i < Req->argc - 1 ) strlcat( str, " ", sizeof( str )); if( i < Req->argc - 1 ) strcat( str, " " );
else strlcat( str, " :", sizeof( str )); else strcat( str, " :" );
strlcat( str, Req->argv[i], sizeof( str )); strcat( str, Req->argv[i] );
} }
return IRC_WriteStrClientPrefix( target, prefix, "%s", str ); return IRC_WriteStrClientPrefix( target, prefix, "%s", str );
} }

View File

@@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
* *
* $Id: parse.h,v 1.10 2003/01/03 22:03:51 alex Exp $ * $Id: parse.h,v 1.9 2002/12/18 13:53:20 alex Exp $
* *
* IRC command parser and validator (header) * IRC command parser and validator (header)
*/ */
@@ -30,7 +30,7 @@ typedef struct _REQUEST /* vgl. RFC 2812, 2.3 */
typedef struct _COMMAND typedef struct _COMMAND
{ {
CHAR *name; /* command name */ CHAR *name; /* command name */
BOOLEAN (*function) PARAMS(( CLIENT *Client, REQUEST *Request )); BOOLEAN (*function)( CLIENT *Client, REQUEST *Request );
CLIENT_TYPE type; /* valid client types (bit mask) */ CLIENT_TYPE type; /* valid client types (bit mask) */
LONG lcount, rcount; /* number of local and remote calls */ LONG lcount, rcount; /* number of local and remote calls */
LONG bytes; /* number of bytes created */ LONG bytes; /* number of bytes created */

View File

@@ -1,229 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
*
* 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 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* Rendezvous service registration (using Mach Ports, e.g. Mac OS X)
*/
#include "portab.h"
#ifdef RENDEZVOUS
static char UNUSED id[] = "$Id: rendezvous.c,v 1.2 2003/03/27 01:24:32 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_MACH_PORT_H
#include "mach/port.h"
#include "mach/message.h"
#endif
#ifdef HAVE_DNSSERVICEDISCOVERY_DNSSERVICEDISCOVERY_H
#include <DNSServiceDiscovery/DNSServiceDiscovery.h>
#endif
#include "defines.h"
#include "log.h"
#include "exp.h"
#include "rendezvous.h"
typedef struct _service
{
dns_service_discovery_ref Discovery_Ref;
mach_port_t Mach_Port;
CHAR Desc[CLIENT_ID_LEN];
} SERVICE;
LOCAL VOID Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, VOID *Context );
LOCAL VOID Unregister( INT Idx );
#define MAX_RENDEZVOUS 1000
#define MAX_MACH_MSG_SIZE 512
LOCAL SERVICE My_Rendezvous[MAX_RENDEZVOUS];
GLOBAL VOID Rendezvous_Init( VOID )
{
/* Initialize structures */
INT i;
for( i = 0; i < MAX_RENDEZVOUS; i++ )
{
My_Rendezvous[i].Discovery_Ref = 0;
My_Rendezvous[i].Mach_Port = 0;
}
} /* Rendezvous_Init */
GLOBAL VOID Rendezvous_Exit( VOID )
{
/* Clean up & exit module */
INT i;
for( i = 0; i < MAX_RENDEZVOUS; i++ )
{
if( My_Rendezvous[i].Discovery_Ref ) Unregister( i );
}
} /* Rendezvous_Exit */
GLOBAL BOOLEAN Rendezvous_Register( CHAR *Name, CHAR *Type, UINT Port )
{
/* Register new service */
INT i;
/* Search free port structure */
for( i = 0; i < MAX_RENDEZVOUS; i++ ) if( ! My_Rendezvous[i].Discovery_Ref ) break;
if( i >= MAX_RENDEZVOUS )
{
Log( LOG_ERR, "Can't register \"%s\" with Rendezvous: limit (%d) reached!", Name, MAX_RENDEZVOUS );
return FALSE;
}
strlcpy( My_Rendezvous[i].Desc, Name, sizeof( My_Rendezvous[i].Desc ));
/* Register new service */
My_Rendezvous[i].Discovery_Ref = DNSServiceRegistrationCreate( Name, Type, "", htonl( Port ), "", Registration_Reply_Handler, My_Rendezvous[i].Desc );
if( ! My_Rendezvous[i].Discovery_Ref )
{
Log( LOG_ERR, "Can't register \"%s\" with Rendezvous: can't register service!", My_Rendezvous[i].Desc );
return FALSE;
}
/* Get and save the corresponding Mach Port */
My_Rendezvous[i].Mach_Port = DNSServiceDiscoveryMachPort( My_Rendezvous[i].Discovery_Ref );
if( ! My_Rendezvous[i].Mach_Port )
{
Log( LOG_ERR, "Can't register \"%s\" with Rendezvous: got no Mach Port!", My_Rendezvous[i].Desc );
/* Here we actually leek a descriptor :-( */
My_Rendezvous[i].Discovery_Ref = 0;
return FALSE;
}
Log( LOG_DEBUG, "Rendezvous: Registering \"%s\" ...", My_Rendezvous[i].Desc );
return TRUE;
} /* Rendezvous_Register */
GLOBAL BOOLEAN Rendezvous_Unregister( CHAR *Name )
{
/* Unregister service from rendezvous */
INT i;
BOOLEAN ok;
ok = FALSE;
for( i = 0; i < MAX_RENDEZVOUS; i++ )
{
if( strcmp( Name, My_Rendezvous[i].Desc ) == 0 )
{
Unregister( i );
ok = TRUE;
}
}
return ok;
} /* Rendezvous_Unregister */
GLOBAL VOID Rendezvous_UnregisterListeners( VOID )
{
/* Unregister all our listening sockets from Rendezvous */
INT i;
for( i = 0; i < MAX_RENDEZVOUS; i++ )
{
if( My_Rendezvous[i].Discovery_Ref ) Unregister( i );
}
} /* Rendezvous_UnregisterListeners */
GLOBAL VOID Rendezvous_Handler( VOID )
{
/* Handle all Rendezvous stuff; this function must be called
* periodically from the run loop of the main program */
INT i;
CHAR buffer[MAX_MACH_MSG_SIZE];
mach_msg_return_t result;
mach_msg_header_t *msg;
for( i = 0; i < MAX_RENDEZVOUS; i++ )
{
if( ! My_Rendezvous[i].Discovery_Ref ) continue;
/* Read message from Mach Port */
msg = (mach_msg_header_t *)buffer;
result = mach_msg( msg, MACH_RCV_MSG|MACH_RCV_TIMEOUT, 0, MAX_MACH_MSG_SIZE, My_Rendezvous[i].Mach_Port, 1, 0 );
/* Handle message */
if( result == MACH_MSG_SUCCESS ) DNSServiceDiscovery_handleReply( msg );
#ifdef DEBUG
else if( result != MACH_RCV_TIMED_OUT ) Log( LOG_DEBUG, "mach_msg(): %ld", (LONG)result );
#endif
}
} /* Rendezvous_Handler */
LOCAL VOID Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, VOID *Context )
{
CHAR txt[50];
if( ErrCode == kDNSServiceDiscoveryNoError )
{
/* Success! */
Log( LOG_INFO, "Successfully registered \"%s\" with Rendezvous.", Context ? Context : "NULL" );
return;
}
switch( ErrCode )
{
case kDNSServiceDiscoveryAlreadyRegistered:
strcpy( txt, "name already registered!" );
break;
case kDNSServiceDiscoveryNameConflict:
strcpy( txt, "name conflict!" );
break;
default:
sprintf( txt, "error code %ld!", (LONG)ErrCode );
}
Log( LOG_INFO, "Can't register \"%s\" with Rendezvous: %s", Context ? Context : "NULL", txt );
} /* Registration_Reply_Handler */
LOCAL VOID Unregister( INT Idx )
{
/* Unregister service */
DNSServiceDiscoveryDeallocate( My_Rendezvous[Idx].Discovery_Ref );
Log( LOG_INFO, "Unregistered \"%s\" from Rendezvous.", My_Rendezvous[Idx].Desc );
My_Rendezvous[Idx].Discovery_Ref = 0;
} /* Unregister */
#endif /* RENDEZVOUS */
/* -eof- */

View File

@@ -1,39 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
*
* 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 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: rendezvous.h,v 1.1 2003/02/23 12:02:26 alex Exp $
*
* "Rendezvous" functions (Header)
*/
#ifdef RENDEZVOUS
#ifndef __rdezvous_h__
#define __rdezvous_h__
GLOBAL VOID Rendezvous_Init( VOID );
GLOBAL VOID Rendezvous_Exit( VOID );
GLOBAL BOOLEAN Rendezvous_Register( CHAR *Name, CHAR *Type, UINT Port );
GLOBAL BOOLEAN Rendezvous_Unregister( CHAR *Name );
GLOBAL VOID Rendezvous_UnregisterListeners( VOID );
GLOBAL VOID Rendezvous_Handler( VOID );
#endif /* __rdezvous_h__ */
#endif /* RENDEZVOUS */
/* -eof- */

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: resolve.c,v 1.6 2003/04/21 10:52:51 alex Exp $"; static char UNUSED id[] = "$Id: resolve.c,v 1.4 2002/12/12 12:24:18 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -174,7 +174,7 @@ Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd )
/* Namen aufloesen */ /* Namen aufloesen */
h = gethostbyaddr( (CHAR *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET ); h = gethostbyaddr( (CHAR *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET );
if( h ) strlcpy( hostname, h->h_name, sizeof( hostname )); if( h ) strcpy( hostname, h->h_name );
else else
{ {
#ifdef h_errno #ifdef h_errno
@@ -182,11 +182,11 @@ Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd )
#else #else
Log_Resolver( LOG_WARNING, "Can't resolve address \"%s\"!", inet_ntoa( Addr->sin_addr )); Log_Resolver( LOG_WARNING, "Can't resolve address \"%s\"!", inet_ntoa( Addr->sin_addr ));
#endif #endif
strlcpy( hostname, inet_ntoa( Addr->sin_addr ), sizeof( hostname )); strcpy( hostname, inet_ntoa( Addr->sin_addr ));
} }
/* Antwort an Parent schreiben */ /* Antwort an Parent schreiben */
if( (size_t)write( w_fd, hostname, strlen( hostname ) + 1 ) != (size_t)( strlen( hostname ) + 1 )) if( write( w_fd, hostname, strlen( hostname ) + 1 ) != ( strlen( hostname ) + 1 ))
{ {
Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno )); Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
close( w_fd ); close( w_fd );
@@ -213,7 +213,7 @@ Do_ResolveName( CHAR *Host, INT w_fd )
if( h ) if( h )
{ {
addr = (struct in_addr *)h->h_addr; addr = (struct in_addr *)h->h_addr;
strlcpy( ip, inet_ntoa( *addr ), sizeof( ip )); strcpy( ip, inet_ntoa( *addr ));
} }
else else
{ {
@@ -226,7 +226,7 @@ Do_ResolveName( CHAR *Host, INT w_fd )
} }
/* Antwort an Parent schreiben */ /* Antwort an Parent schreiben */
if( (size_t)write( w_fd, ip, strlen( ip ) + 1 ) != (size_t)( strlen( ip ) + 1 )) if( write( w_fd, ip, strlen( ip ) + 1 ) != ( strlen( ip ) + 1 ))
{ {
Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno )); Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
close( w_fd ); close( w_fd );

View File

@@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
* *
* $Id: resolve.h,v 1.5 2003/04/21 10:53:10 alex Exp $ * $Id: resolve.h,v 1.3 2002/12/12 12:23:43 alex Exp $
* *
* Asynchronous resolver (header) * Asynchronous resolver (header)
*/ */
@@ -18,11 +18,11 @@
#define __resolve_h__ #define __resolve_h__
#include <sys/types.h>
#include <netinet/in.h>
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
# include <sys/select.h> # include <sys/select.h>
#endif #endif
#include <sys/types.h>
#include <netinet/in.h>
typedef struct _Res_Stat typedef struct _Res_Stat

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: tool.c,v 1.1 2003/01/13 12:20:16 alex Exp $"; static char UNUSED id[] = "$Id: tool.c,v 1.10 2002/12/12 12:24:18 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>

View File

@@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
* *
* $Id: tool.h,v 1.1 2003/01/13 12:20:16 alex Exp $ * $Id: tool.h,v 1.9 2002/12/12 12:23:43 alex Exp $
* *
* Tool functions (Header) * Tool functions (Header)
*/ */

View File

@@ -9,23 +9,19 @@
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. # der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
# #
# $Id: Makefile.am,v 1.7 2003/01/03 22:04:14 alex Exp $ # $Id: Makefile.am,v 1.4 2002/05/22 09:09:43 alex Exp $
# #
AUTOMAKE_OPTIONS = ansi2knr AUTOMAKE_OPTIONS = ansi2knr
noinst_LIBRARIES = libngportab.a noinst_LIBRARIES = libngportab.a
libngportab_a_SOURCES = strlcpy.c vsnprintf.c libngportab_a_SOURCES = vsnprintf.c
check_PROGRAMS = portabtest check_PROGRAMS = portabtest
portabtest_SOURCES = portabtest.c portabtest_SOURCES = portabtest.c
portabtest_LDFLAGS = -L.
portabtest_LDADD = -lngportab
noinst_HEADERS = imp.h exp.h portab.h noinst_HEADERS = imp.h exp.h portab.h
maintainer-clean-local: maintainer-clean-local:

View File

@@ -1,16 +1,17 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: portab.h,v 1.15 2003/03/31 19:01:02 alex Exp $ * $Id: portab.h,v 1.9 2002/12/12 11:26:08 alex Exp $
* *
* Portability functions and declarations (header for libngbportab). * portab.h: "Portabilitaets-Definitionen"
*/ */
@@ -20,12 +21,8 @@
#include "config.h" #include "config.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
/* Compiler Features */
/* compiler features */
#ifdef __GNUC__ #ifdef __GNUC__
# define PUNUSED(x) __attribute__ ((unused)) x # define PUNUSED(x) __attribute__ ((unused)) x
@@ -44,7 +41,7 @@
#endif #endif
/* keywords */ /* Keywords */
#define EXTERN extern #define EXTERN extern
#define STATIC static #define STATIC static
@@ -53,7 +50,7 @@
#define REGISTER register #define REGISTER register
/* datatypes */ /* Datatentypen */
#ifndef PROTOTYPES #ifndef PROTOTYPES
# ifndef signed # ifndef signed
@@ -108,7 +105,18 @@ typedef UINT8 BOOLEAN;
#endif #endif
/* target constants */ /* configure-Optionen */
#ifndef HAVE_socklen_t
#define socklen_t int /* u.a. fuer Mac OS X */
#endif
#if OS_UNIX_AUX
#define _POSIX_SOURCE /* muss unter A/UX definiert sein */
#endif
/* Konstanten */
#ifndef TARGET_OS #ifndef TARGET_OS
#define TARGET_OS "unknown" #define TARGET_OS "unknown"
@@ -123,38 +131,6 @@ typedef UINT8 BOOLEAN;
#endif #endif
/* configure options */
#ifndef HAVE_socklen_t
#define socklen_t int /* u.a. fuer Mac OS X */
#endif
#ifndef HAVE_SNPRINTF
EXTERN INT snprintf PARAMS(( CHAR *str, size_t count, CONST CHAR *fmt, ... ));
#endif
#ifndef HAVE_STRLCAT
EXTERN size_t strlcat PARAMS(( CHAR *dst, CONST CHAR *src, size_t size ));
#endif
#ifndef HAVE_STRLCPY
EXTERN size_t strlcpy PARAMS(( CHAR *dst, CONST CHAR *src, size_t size ));
#endif
#ifndef HAVE_VSNPRINTF
#include <stdarg.h>
EXTERN INT vsnprintf PARAMS(( CHAR *str, size_t count, CONST CHAR *fmt, va_list args ));
#endif
#ifndef PACKAGE_NAME
#define PACKAGE_NAME PACKAGE
#endif
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION VERSION
#endif
#endif #endif

View File

@@ -14,53 +14,30 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: portabtest.c,v 1.11 2003/01/04 10:40:01 alex Exp $"; static char UNUSED id[] = "$Id: portabtest.c,v 1.9 2002/12/12 11:38:46 alex Exp $";
#include "imp.h" #include "imp.h"
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "exp.h" #include "exp.h"
LOCAL VOID Panic PARAMS (( CHAR *Reason, INT Code ));
GLOBAL int GLOBAL int
main( VOID ) main( VOID )
{ {
/* validate datatypes */ /* Datentypen pruefen */
if( FALSE != 0 ) Panic( "FALSE", 1 ); if( FALSE != 0 ) return 1;
if( TRUE != 1 ) Panic( "TRUE", 1 ); if( TRUE != 1 ) return 1;
if( sizeof( INT8 ) != 1 ) Panic( "INT8", 1 ); if( sizeof( INT8 ) != 1 ) return 1;
if( sizeof( UINT8 ) != 1 ) Panic( "UINT8", 1 ); if( sizeof( UINT8 ) != 1 ) return 1;
if( sizeof( INT16 ) != 2 ) Panic( "INT16", 1 ); if( sizeof( INT16 ) != 2 ) return 1;
if( sizeof( UINT16 ) != 2 ) Panic( "UINT16", 1 ); if( sizeof( UINT16 ) != 2 ) return 1;
if( sizeof( INT32 ) != 4 ) Panic( "INT32", 1 ); if( sizeof( INT32 ) != 4 ) return 1;
if( sizeof( UINT32 ) != 4 ) Panic( "UINT32", 1 ); if( sizeof( UINT32 ) != 4 ) return 1;
#ifdef PROTOTYPES /* kein Fehler */
/* check functions */
if( ! snprintf ) Panic( "snprintf", 2 );
if( ! vsnprintf ) Panic( "vsnprintf", 2 );
if( ! strlcpy ) Panic( "strlcpy", 2 );
if( ! strlcat ) Panic( "strlcat", 2 );
#endif
/* ok, no error */
return 0; return 0;
} /* portab_check_types */ } /* portab_check_types */
LOCAL VOID
Panic( CHAR *Reason, INT Code )
{
/* Oops, something failed!? */
fprintf( stderr, "Oops, test for %s failed!?", Reason );
exit( Code );
} /* Panic */
/* -eof- */ /* -eof- */

View File

@@ -1,75 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* 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 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* strlcpy() and strlcat() replacement functions.
* See <http://www.openbsd.org/papers/strlcpy-paper.ps> for details.
*
* Code partially borrowed from compat.c of rsync, written by Andrew
* Tridgell (1998) and Martin Pool (2002):
* <http://samba.anu.edu.au/rsync/doxygen/head/lib_2compat_8c.html>
*/
#include "portab.h"
static char UNUSED id[] = "$Id: strlcpy.c,v 1.2 2002/12/26 14:34:11 alex Exp $";
#include "imp.h"
#include <string.h>
#include <sys/types.h>
#include "exp.h"
#ifndef HAVE_STRLCAT
GLOBAL size_t
strlcat( CHAR *dst, CONST CHAR *src, size_t size )
{
/* Like strncat() but does not 0 fill the buffer and
* always null terminates. */
size_t len1 = strlen( dst );
size_t len2 = strlen( src );
size_t ret = len1 + len2;
if( len1 + len2 >= size ) len2 = size - ( len1 + 1 );
if( len2 > 0 )
{
memcpy( dst + len1, src, len2 );
dst[len1 + len2] = 0;
}
return ret;
} /* strlcat */
#endif
#ifndef HAVE_STRLCPY
GLOBAL size_t
strlcpy( CHAR *dst, CONST CHAR *src, size_t size )
{
/* Like strncpy but does not 0 fill the buffer and
* always null terminates. */
size_t len = strlen( src );
if( size <= 0 ) return len;
if( len >= size ) len = size - 1;
memcpy( dst, src, len );
dst[len] = 0;
return len;
} /* strlcpy */
#endif
/* -eof- */

View File

@@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: vsnprintf.c,v 1.5 2003/04/21 10:53:38 alex Exp $"; static char UNUSED id[] = "$Id: vsnprintf.c,v 1.4 2002/12/12 11:37:11 alex Exp $";
#include "imp.h" #include "imp.h"
@@ -98,7 +98,6 @@ static char UNUSED id[] = "$Id: vsnprintf.c,v 1.5 2003/04/21 10:53:38 alex Exp $
/* only include stdio.h if we are not re-defining snprintf or vsnprintf */ /* only include stdio.h if we are not re-defining snprintf or vsnprintf */
#include <stdio.h> #include <stdio.h>
/* make the compiler happy with an empty file */ /* make the compiler happy with an empty file */
void dummy_snprintf PARAMS(( void ));
void dummy_snprintf PARAMS(( void )) { } void dummy_snprintf PARAMS(( void )) { }
#else #else

View File

@@ -1,27 +0,0 @@
#
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
#
# 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 of the License, or
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# $Id: Makefile.am,v 1.1 2003/01/13 12:20:16 alex Exp $
#
AUTOMAKE_OPTIONS = ansi2knr
INCLUDES = -I$(srcdir)/../portab
noinst_LIBRARIES = libngtool.a
libngtool_a_SOURCES = tool.c
noinst_HEADERS = tool.h
maintainer-clean-local:
rm -f Makefile Makefile.in
# -eof-