Index: AUTHORS =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/AUTHORS,v retrieving revision 1.3 retrieving revision 1.5 diff -u -u -r1.3 -r1.5 --- AUTHORS 2 Jan 2002 02:52:09 -0000 1.3 +++ AUTHORS 21 Apr 2003 21:33:18 -0000 1.5 @@ -1,13 +1,26 @@ ngIRCd - Next Generation IRC Server - (c)2001,2002 by Alexander Barton, + (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ - ngIRCd ist freie Software und steht unter - der GNU General Public License. + ngIRCd is free software and published under the + terms of the GNU General Public License. - -- AUTHORS / Autoren -- + -- AUTHORS and CONTRIBUTORS -- -Alexander Barton, alex@arthur.ath.cx +Main Authors +~~~~~~~~~~~~ +Alexander Barton, , "alex" + + +Contributors +~~~~~~~~~~~~ +Goetz Hoffart, +Ilja Osthoff, +Sean Reifschneider, + + +-- +$Id: AUTHORS,v 1.5 2003/04/21 21:33:18 alex Exp $ Index: ChangeLog =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/ChangeLog,v retrieving revision 1.147.2.13 retrieving revision 1.188.2.13 diff -u -u -r1.147.2.13 -r1.188.2.13 --- ChangeLog 21 Jan 2003 21:20:19 -0000 1.147.2.13 +++ ChangeLog 1 May 2003 10:15:02 -0000 1.188.2.13 @@ -1,16 +1,73 @@ ngIRCd - Next Generation IRC Server - (c)2001,2002 by Alexander Barton, + (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ - ngIRCd ist freie Software und steht unter - der GNU General Public License. + ngIRCd is free software and published under the + terms of the GNU General Public License. - -- ChangeLog / Aenderungen -- + -- ChangeLog -- -ngIRCd 0.6.1, 2002-01-21 +ngIRCd 0.7.0 (2003-05-01) + - "ServerName" is checked better now: a dot (".") is required. + - The KILL comand verifies and logs more parameters. + + ngIRCd 0.7.0-pre2 (2003-04-27) + - CVS build system fixes (made autogen.sh more portable). + - Fixed compilation and test-suite on Solaris (tested with 2.6). + - New documentation file "doc/Platforms.txt" describing the status of + ngIRCd on the various tested platforms. + - Test for broken GCC on Mac OS X and disable "-pedantic" in this case. + - Disable "-ansi" on Cygwin: system headers are incompatible. + - The server tried to connect to other servers only once when DNS or + socket failures occured. + - Fixed --configtest: There is no variable "ServerPwd", it's "Password". + + ngIRCd 0.7.0-pre1 (2003-04-22) + - 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 " to enable and connect an + configured server and "CONNECT " + to add a new server (ngIRCd tries to connect new servers only once!). + - Added DISCONNECT command ("DISCONNECT ") 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, ngIRCd no longer sends a QUIT to other servers after the KILL, and you @@ -21,7 +78,7 @@ - The server sets a correct default AWAY message now when propagating between servers (bug introduced in 0.6.0). - Fixed up and enhanced CHANINFO command: channel keys and user limits - are syncronized between servers now, too. + are synchronized between servers now, too. - 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 its modes or modes of its members. @@ -390,4 +447,4 @@ -- -$Id: ChangeLog,v 1.147.2.13 2003/01/21 21:20:19 alex Exp $ +$Id: ChangeLog,v 1.188.2.13 2003/05/01 10:15:02 alex Exp $ Index: INSTALL =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/INSTALL,v retrieving revision 1.9 retrieving revision 1.15.2.1 diff -u -u -r1.9 -r1.15.2.1 --- INSTALL 18 Dec 2002 12:19:07 -0000 1.9 +++ INSTALL 22 Apr 2003 20:00:32 -0000 1.15.2.1 @@ -1,162 +1,161 @@ ngIRCd - Next Generation IRC Server - (c)2001,2002 by Alexander Barton, + (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ - ngIRCd ist freie Software und steht unter - der GNU General Public License. + ngIRCd is free software and published under the + terms of the GNU General Public License. + + -- INSTALL -- - -- INSTALL / Installation -- - Ilja Osthoff, +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! -0. Update von frueheren Versionen -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Differences to version 0.5.x -Unterschiede zu 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". -- Ab Version 0.6.0 werden asyncrone Passwoerter zur Identifikation anderer - 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. +- New configuration variables, section [Global]: MaxConnections, MaxJoins + (see example configuration file "doc/sample-ngircd.conf"!). -- Neue Konfigurationsvariablen, Sektion [Global]: MaxConnections, MaxJoins - (vgl. auch Beispiel-Konfiguration "doc/sample-ngircd.conf"!) +II. Standard Installation +~~~~~~~~~~~~~~~~~~~~~~~~~ -I. Standard-Installation -~~~~~~~~~~~~~~~~~~~~~~~~ +ngIRCd is developed for UNIX-based systems, which means that the installation +on modern UNIX-like systems that are supported by GNU autoconf and GNU +automake ("configure") should be no problem. -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. +The normal installation procedure after getting (and expanding) the source +files (using a distribution archive or CVS) is as following: -Die Standard-Installation sieht so aus: + 1) ./autogen.sh [only necessary when using CVS] + 2) ./configure + 3) make + 4) make install - 1) tar xzf ngircd-.tar.gz - 2) cd ngircd- - 3) ./autogen.sh [nur erforderlich, wenn ueber CVS bezogen] - 4) ./configure - 5) make - 6) make install +1): "autogen.sh" -zu 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-archives, but when using CVS. -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. +This step is therefore only interesting for developers. -Dieser Absatz ist also eigentlich ausschliesslich fuer Entwickler interessant. +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). -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. +Again: "end users" do not need this step! -(nochmal: "Endanwender" mussen diesen Schritt i.d.R. nicht ausfuehren!) +2): "./configure" -zu 4): "./configure" +The configure-script is used to detect local system dependencies. -Mit dem configure-Script wird ngIRCd, wie GNU Software meistens, an das -lokale System angepasst und die erforderlichen Makefile's erzeugt. +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. -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. +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. -zu 5): "make" +3): "make" -Der make-Befehl bearbeitet die vom configure-Script erzeugten Makefile's und -uebersetzt den ngIRCd. +The make command uses the Makefiles produced by configure and compiles the +ngIRCd daemon. -zu 6): "make install" +4): "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. +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. -Folgende Dateien werden installiert: +This files will be installed by default: -- /usr/local/sbin/ngircd: ausfuehrbarer Server -- /usr/local/etc/ngircd.conf: Beispiel-Konfiguration, wenn nicht vorhanden +- /usr/local/sbin/ngircd: executable server +- /usr/local/etc/ngircd.conf: sample configuration (if not already present) +- /usr/local/share/doc/ngircd/: documentation -II. Nuetzliche make-Targets -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +II. Useful make-targets +~~~~~~~~~~~~~~~~~~~~~~~ -Die vom configure-Script erzeugten Makefile's enthalten immer die folgenden -nuetzlichen Targets: +The Makefile produced by the configure-script contains always these useful +targets: - - clean: alle Erzeugnisse des Compilers/Linkers loeschen. - Naechster Schritt: -> make + - clean: delete every product from the compiler/linker + next step: -> make - - distclean: zusaetzliche alle Makefile's loeschen. - Naechster Schritt: -> ./configure + - distclean: the above plus erase all generated Makefiles + next step: -> ./configure - - maintainer-clean: alle automat. erzeugten Dateien loeschen. - Naechster Schritt: -> ./autogen.sh + - maintainer-clean: erase all automatic generated files + next step: -> ./autogen.sh +III. Sample configuration file ngircd.conf +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -III. Konfigurationsdatei ngircd.conf -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In the sample configuration file, there are comments beginning with "#" OR +";" -- this is only for the better understanding of the file. -In der Konfigurationsdatei werden Kommentare durch "#" oder durch ";" -eingeleitet. Dieses dient nur der besseren Lesbarkeit. +The file is separated in four blocks: [Global], [Operator], [Server], and +[Channel]. -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. +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. -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. +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. Kommandozeilen-Optionen -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +IV. Command line options +~~~~~~~~~~~~~~~~~~~~~~~~ -Folgende Parameter koennen dem ngIRCd u.a. uebergeben werden: +These parameters could be passed to the ngIRCd: -f, --config - Der Daemon wird angewiesen, statt der Standard-Konfigurationsdatei - /usr/local/etc/ngircd.conf die Datei einzulesen. + The daemon uses the file as configuration file rather than + the standard configuration /usr/local/etc/ngircd.conf. -n, --nodaemon - ngIRCd soll im Fordergrund laufen; alle Meldungen werden zusaetzlich - zum Syslog auch auf der Konsole ausgegeben. + ngIRCd should be running as a foreground process. -p, --passive - Verbindungen zu anderen Servern (wie in der Konfigurationsdatei in - [Server]-Abschnitten definiert) werden nicht automatisch hergestellt. + Server-links won't be automatically established. --configtest - Die Konfigurationsdatei wird eingelesen, ueberprueft und so aus- - gegeben, wie sie vom ngIRCd interpretiert wurde. Danach beendet - sich der Server wieder. - -Mit dem Parameter "--help" werden alle unterstuetzten Parameter angezeigt, -mit "--version" die Versionsnummer. Bei beiden Parametern beendet sich der -Server nach der Ausgabe wieder. + 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.9 2002/12/18 12:19:07 alex Exp $ +$Id: INSTALL,v 1.15.2.1 2003/04/22 20:00:32 alex Exp $ Index: NEWS =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/NEWS,v retrieving revision 1.45.2.2 retrieving revision 1.53.2.2 diff -u -u -r1.45.2.2 -r1.53.2.2 --- NEWS 24 Dec 2002 13:53:54 -0000 1.45.2.2 +++ NEWS 27 Apr 2003 18:33:26 -0000 1.53.2.2 @@ -1,15 +1,37 @@ ngIRCd - Next Generation IRC Server - (c)2001,2002 by Alexander Barton, + (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ - ngIRCd ist freie Software und steht unter - der GNU General Public License. + ngIRCd is free software and published under the + terms of the GNU General Public License. - -- NEWS / Neuigkeiten -- + -- NEWS -- +ngIRCd 0.7.0 + + - New command CONNECT to enable and add server links. The syntax is not + RFC-compatible: use "CONNECT " to enable and connect an + configured server and "CONNECT " + to add a new server (ngIRCd tries to connect new servers only once!). + - Added DISCONNECT command ("DISCONNECT ") 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 - beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR @@ -139,4 +161,4 @@ -- -$Id: NEWS,v 1.45.2.2 2002/12/24 13:53:54 alex Exp $ +$Id: NEWS,v 1.53.2.2 2003/04/27 18:33:26 alex Exp $ Index: README =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/README,v retrieving revision 1.14 retrieving revision 1.17 diff -u -u -r1.14 -r1.17 --- README 24 Nov 2002 18:48:59 -0000 1.14 +++ README 9 Mar 2003 22:03:58 -0000 1.17 @@ -1,105 +1,86 @@ - + ngIRCd - Next Generation IRC Server - (c)2001,2002 by Alexander Barton, + (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ - ngIRCd ist freie Software und steht unter - der GNU General Public License. + ngIRCd is free software and published under the + terms of the GNU General Public License. - -- README / Liesmich -- + -- README -- Ilja Osthoff, - +-----------------------------------------------------------------------+ - | Please note: English translations of some of the german documentation | - | files can be found in the directory "doc/en" -- please have a look! | - +-----------------------------------------------------------------------+ - +I. Introduction +~~~~~~~~~~~~~~~ -I. Einfuehrung -~~~~~~~~~~~~~~ - -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. +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 +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 ~~~~~~~~~~~ -Zur Zeit befindet sich der ngIRCd noch in Entwicklung, manche Features sind -noch nicht implementiert, andere nur teilweise. +At present, the ngIRCd is under active development, some features are not +implemented, some only partly. -Bisher (mehr oder wenig vollstaendig) implementierte IRC-Befehle: +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. +ADMIN, AWAY, CHANINFO, CONNECT, DIE, DISCONNECT, ERROR, HELP, INVITE, ISON, +JOIN, KICK, KILL, LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, +NOTICE, OPER, PART, PASS, PING, PONG, PRIVMSG, QUIT, REHASH, RESTART, SERVER, +SQUIT, STATS, TIME, TOPIC, TRACE, USER, USERHOST, VERSION, WHO, WHOIS. -III. Features (oder: warum gerade ngIRCd?) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +III. Features (or: why use ngIRCd?) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- keine Probleme mit Servern, deren IP-Adresse dynamisch ist, -- einfache, uebersichtliche Konfigurationsdatei, -- frei verfuegbarer C-Quellcode. -- ngIRCd wird aktiv weiterentwickelt. -- unterstuetzte Plattformen (getestete Version): AIX (3.2.5), A/UX (3.0.1), - FreeBSD/i386 (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), Windows mit Cygwin. +- no problems with servers which have dynamic IP addresses +- simple, easy understandable configuration file, +- freely published open-source C source code, +- 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. Dokumentation +IV. Documentation ~~~~~~~~~~~~~~~~~ -Im Paket enthalten ist u.a.: +More documentation can be found in the "doc/" directory and the homepage of +the ngIRCd: . + + +V. Download +~~~~~~~~~~~ -- 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. Bezugsquellen -~~~~~~~~~~~~~~~~ - -Die Homepage des ngIRCd ist: ; dort -findest du immer die neusten Informationen ueber den ngIRCd und die aktuellen -freigegebenen ("stabilen") Releases. - -Falls du dich fuer die aktuellen Entwicklungs-Versionen (die jedoch nicht -immer "stabil" sind) interessierst, dann lese bitte den Punkt "CVS" auf der -Homepage und die Datei "doc/CVS.txt", die die Verwendung des "Concurrent -Versioning System" (CVS) beschreibt. +The homepage of the ngIRCd is: ; you +will find the newest information about the ngIRCd and the most recent +("stable") releases there. + +If you are interested in the latest development 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 ~~~~~~~~ -Wenn du im ngIRCd Bugs finden solltest (so was soll ja auch vorkommen :-), -dann lege bitte einen Bug-Report ueber diese URL an: +If you find bugs in the ngIRCd (which might be there :-), please report +them at the following URL: -Dort kannst du dich auch ueber bekannte Fehler informieren. +There you can read about known bugs and limitations, too. -Falls du noch Anregungen, Kritik, Patches etc. pp. zum ngIRCd hast, dann -bitte einfach eine Mail an oder -schreiben. +If you have critics, patches or something else, please feel free to post a +mail to: or -- -$Id: README,v 1.14 2002/11/24 18:48:59 alex Exp $ +$Id: README,v 1.17 2003/03/09 22:03:58 alex Exp $ Index: autogen.sh =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/autogen.sh,v retrieving revision 1.3 retrieving revision 1.6.2.1 diff -u -u -r1.3 -r1.6.2.1 --- autogen.sh 12 Mar 2002 14:37:51 -0000 1.3 +++ autogen.sh 22 Apr 2003 10:18:41 -0000 1.6.2.1 @@ -1,16 +1,15 @@ #!/bin/sh # -# $Id: autogen.sh,v 1.3 2002/03/12 14:37:51 alex Exp $ +# $Id: autogen.sh,v 1.6.2.1 2003/04/22 10:18:41 alex Exp $ # -if [ -f configure ]; then - echo "autogen.sh: configure-Skript existiert bereits ..." -fi +WANT_AUTOMAKE=1.6 +export WANT_AUTOMAKE aclocal && \ autoheader && \ automake --add-missing && \ autoconf && \ - echo "Okay, autogen.sh war erfolgreich." + echo "Okay, autogen.sh done." # -eof- Index: configure.in =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/configure.in,v retrieving revision 1.69.2.5 retrieving revision 1.89.2.6 diff -u -u -r1.69.2.5 -r1.89.2.6 --- configure.in 21 Jan 2003 21:23:34 -0000 1.69.2.5 +++ configure.in 1 May 2003 10:15:02 -0000 1.89.2.6 @@ -8,16 +8,16 @@ # (at your option) any later version. # Please read the file COPYING, README and AUTHORS for more information. # -# $Id: configure.in,v 1.69.2.5 2003/01/21 21:23:34 alex Exp $ +# $Id: configure.in,v 1.89.2.6 2003/05/01 10:15:02 alex Exp $ # # -- Initialisierung -- -AC_INIT AC_PREREQ(2.50) +AC_INIT(ngircd, 0.7.0) +AC_CONFIG_SRCDIR(src/ngircd/ngircd.c) AC_CANONICAL_TARGET -AC_CONFIG_SRCDIR(src/config.h.in) -AM_INIT_AUTOMAKE(ngircd,0.6.1) +AM_INIT_AUTOMAKE(1.6) AM_CONFIG_HEADER(src/config.h) # -- Templates fuer config.h -- @@ -28,7 +28,9 @@ 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_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([RENDEZVOUS], [Define if Rendezvous support should be included]) AH_TEMPLATE([TARGET_OS], [Target operating system name]) AH_TEMPLATE([TARGET_VENDOR], [Target system vendor]) @@ -55,16 +57,30 @@ # -- 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 - # unter A/UX sollte _POSIX_SOURCE definiert sein. + # define _POSIX_SOURCE when compiling on A/UX: AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE]) - CFLAGS="$CFLAGS -D_POSIX_SOURCE" + add_DEFINES="-D_POSIX_SOURCE $add_DEFINES" fi if test `uname` = "HP-UX"; then - # unter HP-UX 11.11 muss _XOPEN_SOURCE_EXTENDED definiert sein. + # define _XOPEN_SOURCE_EXTENDED when compiling on HP-UX (11.11): AC_MSG_RESULT([detected HP-UX, defining _XOPEN_SOURCE_EXTENDED]) - CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" + add_DEFINES="-D_XOPEN_SOURCE_EXTENDED $add_DEFINES" +fi + +if test `uname` = "SunOS"; then + # define _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED=1 and __EXTENSIONS__ + # when compiling on SunOS (tested with 5.6): + AC_MSG_RESULT([detected SunOS, defining _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED=1 and __EXTENSIONS__]) + add_DEFINES="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__ $add_DEFINES" fi # -- Header -- @@ -80,7 +96,7 @@ strings.h sys/socket.h sys/time.h unistd.h \ ],,AC_MSG_ERROR([required C header missing!])) -AC_CHECK_HEADERS(arpa/inet.h ctype.h malloc.h stdint.h sys/select.h varargs.h) +AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdint.h varargs.h]) # -- Datentypen -- @@ -117,44 +133,92 @@ AC_CHECK_FUNCS([ \ bind gethostbyaddr gethostbyname gethostname inet_ntoa memmove \ - memset select setsockopt socket strcasecmp strchr strerror \ - strstr waitpid \ + memset setsockopt socket strcasecmp strchr strerror strstr waitpid \ ],,AC_MSG_ERROR([required function missing!])) -AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf) +AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strlcpy strlcat) + +AC_CHECK_FUNCS(select,[AC_CHECK_HEADERS(sys/select.h)], + AC_MSG_ERROR([required function select() is missing!]) +) # -- Konfigurationsoptionen -- x_syslog_on=no -AC_ARG_ENABLE(syslog, - [ --disable-syslog disable syslog (autodetected by default)], - [ if test "$enableval" = "yes"; then - AC_CHECK_HEADER(syslog.h, x_syslog_on=yes, - AC_MSG_ERROR([Can't enable syslog: syslog.h not found!]) +AC_ARG_WITH(syslog, + [ --without-syslog disable syslog (autodetected by default)], + [ if test "$withval" = "yes"; then + AC_CHECK_LIB(be, syslog) + AC_CHECK_FUNCS(syslog, x_syslog_on=yes, + AC_MSG_ERROR([Can't enable syslog!]) ) 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 AC_DEFINE(USE_SYSLOG, 1) - AC_CHECK_LIB(be,syslog) + AC_CHECK_HEADERS(syslog.h) fi x_zlib_on=no -AC_ARG_ENABLE(zlib, - [ --disable-zlib disable zlib compression (autodetected by default)], - [ if test "$enableval" = "yes"; then - AC_CHECK_HEADER(zlib.h, x_zlib_on=yes, - AC_MSG_ERROR([Can't enable zlib: zlib.h not found!]) +AC_ARG_WITH(zlib, + [ --without-zlib disable zlib compression (autodetected by default)], + [ if test "$withval" = "yes"; then + AC_CHECK_LIB(z, deflate) + AC_CHECK_FUNCS(deflate, x_zlib_on=yes, + AC_MSG_ERROR([Can't enable zlib!]) ) fi ], - [ AC_CHECK_HEADER(zlib.h, x_zlib_on=yes) ] + [ AC_CHECK_LIB(z, deflate) + AC_CHECK_FUNCS(deflate, x_zlib_on=yes) + ] ) if test "$x_zlib_on" = "yes"; then AC_DEFINE(USE_ZLIB, 1) - AC_CHECK_LIB(z,deflate) + AC_CHECK_HEADERS(zlib.h) +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 + ],[ + 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 x_ircplus_on=yes @@ -166,6 +230,7 @@ AC_DEFINE(IRCPLUS, 1) fi +x_sniffer_on=no; x_debug_on=no AC_ARG_ENABLE(sniffer, [ --enable-sniffer enable IRC traffic sniffer (enables debug mode)], if test "$enableval" = "yes"; then @@ -182,6 +247,7 @@ AC_DEFINE(DEBUG, 1) fi +x_strict_rfc_on=no AC_ARG_ENABLE(strict-rfc, [ --enable-strict-rfc strict RFC conformance -- may break clients!], if test "$enableval" = "yes"; then @@ -190,7 +256,6 @@ fi ) - # -- Definitionen -- AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" ) @@ -200,58 +265,113 @@ # -- Variablen -- if test "$GCC" = "yes"; then - CFLAGS="-Wall $CFLAGS" -fi + the_CFLAGS="-Wmissing-declarations -Wpointer-arith -Wstrict-prototypes" + ansi=" -ansi" + pedantic=" -pedantic" + + $CC --version | grep 20020420 > /dev/null 2>&1 + if test $? -eq 0; then + # Mac OS X (and Darwin?) ship with a slightly broken + # prerelease of GCC 3.1 which don't like -pedantic: + AC_MSG_RESULT([detected broken GNU C compiler, disabling "-pedantic"]) + pedantic="" + fi -the_CFLAGS="$CFLAGS" + uname | grep "CYGWIN" > /dev/null 2>&1 + if test $? -eq 0; then + # The include files of Cygwin don't like -ansi, + # so we disable it: + AC_MSG_RESULT([detected Cygwin, disabling "-ansi"]) + ansi="" + fi + + add_CFLAGS="-Wall -W${ansi}${pedantic} $CFLAGS $CFLAGS_ADD" +else + the_CFLAGS="$CFLAGS" + add_CFLAGS="$CFLAGS_ADD" +fi -CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'" +CFLAGS="$the_CFLAGS $add_CFLAGS $add_DEFINES -DSYSCONFDIR='\"\$(sysconfdir)\"'" # -- Ausgabe der Dateien -- AC_OUTPUT([ \ Makefile \ doc/Makefile \ - doc/en/Makefile \ MacOSX/Makefile \ MacOSX/ngircd.pbproj/Makefile \ src/Makefile \ src/portab/Makefile \ + src/tool/Makefile \ src/ngircd/Makefile \ src/testsuite/Makefile \ man/Makefile \ contrib/Makefile \ ]) -# -- Ergebnis -- +# -- Result -- echo +echo "ngIRCd has been configured with the following options:" +echo # Someone please show me a better way :) [borrowed by OpenSSH] B=`eval echo ${bindir}` ; B=`eval echo ${B}` S=`eval echo ${sbindir}` ; S=`eval echo ${S}` C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}` M=`eval echo ${mandir}` ; M=`eval echo ${M}` +D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}` -echo " host: ${host}" -echo " compiler: ${CC}" -echo " compiler flags: ${the_CFLAGS}" -echo " preprocessor flags: ${CPPFLAGS}" -echo " linker flags: ${LDFLAGS}" -echo " libraries: ${LIBS}" +echo " Host: ${host}" +echo " Compiler: ${CC}" +echo " Compiler flags: ${the_CFLAGS}" +test -n "$add_CFLAGS" && echo " ${add_CFLAGS}" +test -n "$add_DEFINES" && echo " ${add_DEFINES}" +test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}" +test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}" +test -n "$LIBS" && echo " Libraries: ${LIBS}" echo -echo " 'ngircd' binary: $S" -echo " configuration file: $C" -echo " manual pages: $M" +echo " 'ngircd' binary: $S" +echo " Configuration file: $C" +echo " Manual pages: $M" +echo " Documentation: $D" echo -echo $ECHO_N " active options: $ECHO_C" -test "$x_syslog_on" = "yes" && echo $ECHO_N "Syslog $ECHO_C" -test "$x_zlib_on" = "yes" && echo $ECHO_N "zLib $ECHO_C" -test "$x_debug_on" = "yes" && echo $ECHO_N "Debug $ECHO_C" -test "$x_sniffer_on" = "yes" && echo $ECHO_N "Sniffer $ECHO_C" -test "$x_strict_rfc_on" = "yes" && echo $ECHO_N "Strict-RFC $ECHO_C" -test "$x_ircplus_on" = "yes" && echo $ECHO_N "IRC+ $ECHO_C" -echo; echo +echo $ECHO_N " Syslog support: $ECHO_C" +test "$x_syslog_on" = "yes" \ + && echo $ECHO_N "yes $ECHO_C" \ + || echo $ECHO_N "no $ECHO_C" +echo $ECHO_N " Enable debug code: $ECHO_C" +test "$x_debug_on" = "yes" \ + && echo "yes" \ + || echo "no" + +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- Index: MacOSX/ngircd.pbproj/project.pbxproj =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/MacOSX/ngircd.pbproj/project.pbxproj,v retrieving revision 1.24 retrieving revision 1.26 diff -u -u -r1.24 -r1.26 --- MacOSX/ngircd.pbproj/project.pbxproj 30 Nov 2002 17:39:56 -0000 1.24 +++ MacOSX/ngircd.pbproj/project.pbxproj 19 Mar 2003 20:09:51 -0000 1.26 @@ -54,6 +54,7 @@ 014CEA520018CE5811CA2923, 014CEA530018CE5811CA2923, ); + hasScannedForEncodings = 1; isa = PBXProject; mainGroup = 08FB7794FE84155DC02AAC07; projectDirPath = ""; @@ -100,7 +101,7 @@ LIBRARY_SEARCH_PATHS = ""; OPTIMIZATION_CFLAGS = "-O2"; OTHER_CFLAGS = "-DSYSCONFDIR=\\\\\\\"/usr/local/etc\\\\\\\""; - OTHER_LDFLAGS = "-lz"; + OTHER_LDFLAGS = "-lz -lwrap"; OTHER_REZFLAGS = ""; PRODUCT_NAME = ngircd; REZ_EXECUTABLE = YES; @@ -114,14 +115,12 @@ productInstallPath = "$(HOME)/bin"; productName = ngircd; productReference = 034768E8FF38A79811DB9C8B; - shouldUseHeadermap = 1; }; 08FB77A0FE84155DC02AAC07 = { buildActionMask = 2147483647; files = ( F52162CE01C7B904012300F4, F52162CF01C7B904012300F4, - F52162D001C7B904012300F4, F52162D901C7BAAE012300F4, F52162DC01C7BCDD012300F4, F52162E401C7C79E012300F4, @@ -147,6 +146,10 @@ F5BEF13302A12AFE01A85B03, F5E9448502C9F49D01A85B04, F5D5CC9403990FED0155B873, + FA42C8B003C0A01400A85B04, + FA42C8B403C0B30700A85B04, + FA550F2E03D59C8D00A85B04, + FAC51A0F042905AF00214FB8, ); isa = PBXHeadersBuildPhase; runOnlyForDeploymentPostprocessing = 0; @@ -156,7 +159,6 @@ files = ( F52162D101C7B904012300F4, F52162D201C7B904012300F4, - F52162D301C7B904012300F4, F52162DD01C7BCDD012300F4, F52162E501C7C79E012300F4, F51D17FF01C8F5B701E11C2E, @@ -176,6 +178,11 @@ F5BEF13502A24F1001A85B03, F5E9448602C9F49D01A85B04, F5D5CC9603990FFA0155B873, + FAC0384003BB335400A85B04, + FA42C8AE03C0A00B00A85B04, + FA42C8B203C0B2F300A85B04, + FA550F2D03D59C8C00A85B04, + FAC51A0E042905AF00214FB8, ); isa = PBXSourcesBuildPhase; runOnlyForDeploymentPostprocessing = 0; @@ -224,16 +231,18 @@ //F53 //F54 F51044520297ABF80173DE11 = { + fileEncoding = 5; isa = PBXFileReference; name = vsnprintf.c; - path = /Users/alex/Develop/ngircd/src/portab/vsnprintf.c; - refType = 0; + path = ../src/portab/vsnprintf.c; + refType = 2; }; F51044540297AC170173DE11 = { + fileEncoding = 5; isa = PBXFileReference; name = splint.h; - path = portab/splint.h; - refType = 4; + path = ../src/portab/splint.h; + refType = 2; }; F51044550297AC170173DE11 = { fileRef = F51044540297AC170173DE11; @@ -248,12 +257,14 @@ }; }; F51D17FC01C8F5B701E11C2E = { + fileEncoding = 5; isa = PBXFileReference; name = client.c; path = ../src/ngircd/client.c; refType = 2; }; F51D17FD01C8F5B701E11C2E = { + fileEncoding = 5; isa = PBXFileReference; name = client.h; path = ../src/ngircd/client.h; @@ -272,24 +283,28 @@ }; }; F51D180001C8FDD001E11C2E = { + fileEncoding = 5; isa = PBXFileReference; name = channel.c; path = ../src/ngircd/channel.c; refType = 2; }; F51D180101C8FDD001E11C2E = { + fileEncoding = 5; isa = PBXFileReference; name = channel.h; path = ../src/ngircd/channel.h; refType = 2; }; F51D180201C8FDD001E11C2E = { + fileEncoding = 5; isa = PBXFileReference; name = irc.c; path = ../src/ngircd/irc.c; refType = 2; }; F51D180301C8FDD001E11C2E = { + fileEncoding = 5; isa = PBXFileReference; name = irc.h; path = ../src/ngircd/irc.h; @@ -314,14 +329,18 @@ }; }; F51DBB13022D95E801A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-write.c"; - refType = 4; + name = "irc-write.c"; + path = "../src/ngircd/irc-write.c"; + refType = 2; }; F51DBB14022D95E801A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-write.h"; - refType = 4; + name = "irc-write.h"; + path = "../src/ngircd/irc-write.h"; + refType = 2; }; F51DBB15022D95E801A85B04 = { fileRef = F51DBB14022D95E801A85B04; @@ -336,14 +355,18 @@ }; }; F51DBB17022D995501A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-mode.c"; - refType = 4; + name = "irc-mode.c"; + path = "../src/ngircd/irc-mode.c"; + refType = 2; }; F51DBB18022D995501A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-mode.h"; - refType = 4; + name = "irc-mode.h"; + path = "../src/ngircd/irc-mode.h"; + refType = 2; }; F51DBB19022D995501A85B04 = { fileRef = F51DBB18022D995501A85B04; @@ -358,14 +381,18 @@ }; }; F51DBB1B022D9D8F01A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-login.c"; - refType = 4; + name = "irc-login.c"; + path = "../src/ngircd/irc-login.c"; + refType = 2; }; F51DBB1C022D9D8F01A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-login.h"; - refType = 4; + name = "irc-login.h"; + path = "../src/ngircd/irc-login.h"; + refType = 2; }; F51DBB1D022D9D8F01A85B04 = { fileRef = F51DBB1C022D9D8F01A85B04; @@ -380,6 +407,7 @@ }; }; F51F791201DFC95301D13771 = { + fileEncoding = 5; isa = PBXFileReference; name = defines.h; path = ../src/ngircd/defines.h; @@ -393,7 +421,7 @@ }; F51F791401DFD0DE01D13771 = { children = ( - F5E9447B02C9EE0E01A85B04, + FA550F3103D59CB300A85B04, F5263AEF01E2A9B801CE8F8F, F51F791501DFD0DE01D13771, F5E9447D02C9EE2801A85B04, @@ -409,19 +437,25 @@ refType = 0; }; F51F791501DFD0DE01D13771 = { + fileEncoding = 5; isa = PBXFileReference; - path = CVS.txt; - refType = 4; + name = CVS.txt; + path = ../doc/CVS.txt; + refType = 2; }; F51F791601DFD0DE01D13771 = { + fileEncoding = 5; isa = PBXFileReference; - path = RFC.txt; - refType = 4; + name = RFC.txt; + path = ../doc/RFC.txt; + refType = 2; }; F51F791701DFD0DE01D13771 = { + fileEncoding = 5; isa = PBXFileReference; - path = "sample-ngircd.conf"; - refType = 4; + name = "sample-ngircd.conf"; + path = "../doc/sample-ngircd.conf"; + refType = 2; }; F520AEA80335E29001A85B04 = { children = ( @@ -447,79 +481,109 @@ refType = 0; }; F520AEA90335E29001A85B04 = { + fileEncoding = 5; isa = PBXExecutableFileReference; - path = "channel-test"; - refType = 4; + name = "channel-test"; + path = ../src/testsuite/tests.sh; + refType = 2; }; F520AEAA0335E29001A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "channel-test.e"; - refType = 4; + name = "channel-test.e"; + path = "../src/testsuite/channel-test.e"; + refType = 2; }; F520AEAC0335E29001A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "check-idle.e"; - refType = 4; + name = "check-idle.e"; + path = "../src/testsuite/check-idle.e"; + refType = 2; }; F520AEAD0335E29001A85B04 = { + fileEncoding = 5; isa = PBXExecutableFileReference; - path = "connect-test"; - refType = 4; + name = "connect-test"; + path = ../src/testsuite/tests.sh; + refType = 2; }; F520AEAE0335E29001A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "connect-test.e"; - refType = 4; + name = "connect-test.e"; + path = "../src/testsuite/connect-test.e"; + refType = 2; }; F520AECA0335E29001A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = Makefile.am; - refType = 4; + name = Makefile.am; + path = ../src/testsuite/Makefile.am; + refType = 2; }; F520AECC0335E29001A85B04 = { + fileEncoding = 5; isa = PBXExecutableFileReference; - path = "mode-test"; - refType = 4; + name = "mode-test"; + path = ../src/testsuite/tests.sh; + refType = 2; }; F520AECD0335E29001A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "mode-test.e"; - refType = 4; + name = "mode-test.e"; + path = "../src/testsuite/mode-test.e"; + refType = 2; }; F520AED00335E29001A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "ngircd-test.conf"; - refType = 4; + name = "ngircd-test.conf"; + path = "../src/testsuite/ngircd-test.conf"; + refType = 2; }; F520AED40335E29001A85B04 = { + fileEncoding = 5; isa = PBXExecutableFileReference; - path = "start-server.sh"; - refType = 4; + name = "start-server.sh"; + path = "../src/testsuite/start-server.sh"; + refType = 2; }; F520AED50335E29001A85B04 = { + fileEncoding = 5; isa = PBXExecutableFileReference; - path = "stop-server.sh"; - refType = 4; + name = "stop-server.sh"; + path = "../src/testsuite/stop-server.sh"; + refType = 2; }; F520AED60335E29001A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "stress-A.e"; - refType = 4; + name = "stress-A.e"; + path = "../src/testsuite/stress-A.e"; + refType = 2; }; F520AED70335E29001A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "stress-B.e"; - refType = 4; + name = "stress-B.e"; + path = "../src/testsuite/stress-B.e"; + refType = 2; }; F520AED80335E29001A85B04 = { + fileEncoding = 5; isa = PBXExecutableFileReference; - path = "stress-server.sh"; - refType = 4; + name = "stress-server.sh"; + path = "../src/testsuite/stress-server.sh"; + refType = 2; }; F520AF0C0335E29001A85B04 = { + fileEncoding = 5; isa = PBXExecutableFileReference; - path = tests.sh; - refType = 4; + name = tests.sh; + path = ../src/testsuite/tests.sh; + refType = 2; }; F520AF150335F1B801A85B04 = { children = ( @@ -533,19 +597,25 @@ refType = 0; }; F520AF180335F1B801A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = Makefile.am; - refType = 4; + name = Makefile.am; + path = ../man/Makefile.am; + refType = 2; }; F520AF1A0335F1B801A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = ngircd.8; - refType = 4; + name = ngircd.8; + path = ../man/ngircd.8; + refType = 2; }; F520AF1B0335F1B801A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = ngircd.conf.5; - refType = 4; + name = ngircd.conf.5; + path = ../man/ngircd.conf.5; + refType = 2; }; F52162B301C7B904012300F4 = { children = ( @@ -553,6 +623,7 @@ F52162D801C7BAAE012300F4, F52162B901C7B904012300F4, F5F18132023EC61E01A85B04, + FA550F2903D59C4D00A85B04, F520AEA80335E29001A85B04, ); isa = PBXGroup; @@ -561,9 +632,11 @@ refType = 2; }; F52162B801C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; - path = Makefile.am; - refType = 4; + name = Makefile.am; + path = ../src/Makefile.am; + refType = 2; }; F52162B901C7B904012300F4 = { children = ( @@ -578,6 +651,10 @@ F52162E301C7C77B012300F4, F52162DA01C7BCDC012300F4, F52162DB01C7BCDC012300F4, + FA42C8B103C0B2F300A85B04, + FA42C8B303C0B30700A85B04, + FA42C8AD03C0A00B00A85B04, + FA42C8AF03C0A01400A85B04, F55047BA0240F6E501A85B04, F55047BB0240F6E501A85B04, F51D180201C8FDD001E11C2E, @@ -606,10 +683,10 @@ F5E9448302C9F49D01A85B04, F576ABFA01D5E77301A85B03, F576ABFB01D5E77301A85B03, + FAC51A0C042905AF00214FB8, + FAC51A0D042905AF00214FB8, F5BEF13102A12AFE01A85B03, F5BEF13202A12AFE01A85B03, - F52162C001C7B904012300F4, - F52162C101C7B904012300F4, F51F791201DFC95301D13771, F576ABFE01D61D7401A85B03, ); @@ -618,89 +695,98 @@ refType = 4; }; F52162BB01C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; - path = log.c; - refType = 4; + name = log.c; + path = ../src/ngircd/log.c; + refType = 2; }; F52162BC01C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; - path = log.h; - refType = 4; + name = log.h; + path = ../src/ngircd/log.h; + refType = 2; }; F52162BD01C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; - path = Makefile.am; - refType = 4; + name = Makefile.am; + path = ../src/ngircd/Makefile.am; + refType = 2; }; F52162BE01C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; - path = ngircd.c; - refType = 4; + name = ngircd.c; + path = ../src/ngircd/ngircd.c; + refType = 2; }; F52162BF01C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; - path = ngircd.h; - refType = 4; - }; - F52162C001C7B904012300F4 = { - isa = PBXFileReference; - path = tool.c; - refType = 4; - }; - F52162C101C7B904012300F4 = { - isa = PBXFileReference; - path = tool.h; - refType = 4; + name = ngircd.h; + path = ../src/ngircd/ngircd.h; + refType = 2; }; F52162C301C7B904012300F4 = { + fileEncoding = 5; isa = PBXExecutableFileReference; name = autogen.sh; path = ../autogen.sh; refType = 2; }; F52162C401C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = configure.in; path = ../configure.in; refType = 2; }; F52162C501C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = Makefile.am; path = ../Makefile.am; refType = 2; }; F52162C601C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = INSTALL; path = ../INSTALL; refType = 2; }; F52162C701C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = AUTHORS; path = ../AUTHORS; refType = 2; }; F52162C801C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = ChangeLog; path = ../ChangeLog; refType = 2; }; F52162C901C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = COPYING; path = ../COPYING; refType = 2; }; F52162CA01C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = NEWS; path = ../NEWS; refType = 2; }; F52162CB01C7B904012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = README; path = ../README; @@ -718,12 +804,6 @@ settings = { }; }; - F52162D001C7B904012300F4 = { - fileRef = F52162C101C7B904012300F4; - isa = PBXBuildFile; - settings = { - }; - }; F52162D101C7B904012300F4 = { fileRef = F52162BB01C7B904012300F4; isa = PBXBuildFile; @@ -736,13 +816,8 @@ settings = { }; }; - F52162D301C7B904012300F4 = { - fileRef = F52162C001C7B904012300F4; - isa = PBXBuildFile; - settings = { - }; - }; F52162D801C7BAAE012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = config.h; path = ../src/config.h; @@ -755,12 +830,14 @@ }; }; F52162DA01C7BCDC012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = conn.c; path = ../src/ngircd/conn.c; refType = 2; }; F52162DB01C7BCDC012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = conn.h; path = ../src/ngircd/conn.h; @@ -779,12 +856,14 @@ }; }; F52162E201C7C77B012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = conf.c; path = ../src/ngircd/conf.c; refType = 2; }; F52162E301C7C77B012300F4 = { + fileEncoding = 5; isa = PBXFileReference; name = conf.h; path = ../src/ngircd/conf.h; @@ -809,6 +888,7 @@ }; }; F5263AEF01E2A9B801CE8F8F = { + fileEncoding = 5; isa = PBXFileReference; name = Makefile.am; path = ../doc/Makefile.am; @@ -844,7 +924,6 @@ productInstallPath = /usr/local/bin; productName = portabtest; productReference = F538241D024F89BC01A85B04; - shouldUseHeadermap = 0; }; F538241F024F89BC01A85B04 = { buildActionMask = 2147483647; @@ -852,6 +931,8 @@ F5382420024F89BC01A85B04, F5382421024F89BC01A85B04, F5382422024F89BC01A85B04, + FAC0383D03BB318600A85B04, + FA550F3003D59C9100A85B04, ); isa = PBXHeadersBuildPhase; runOnlyForDeploymentPostprocessing = 0; @@ -878,6 +959,9 @@ buildActionMask = 2147483647; files = ( F5382424024F89BC01A85B04, + FAC0383C03BB318400A85B04, + FAC0383F03BB335400A85B04, + FA550F2F03D59C9000A85B04, ); isa = PBXSourcesBuildPhase; runOnlyForDeploymentPostprocessing = 0; @@ -903,14 +987,18 @@ runOnlyForDeploymentPostprocessing = 0; }; F55047BA0240F6E501A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = hash.c; - refType = 4; + name = hash.c; + path = ../src/ngircd/hash.c; + refType = 2; }; F55047BB0240F6E501A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = hash.h; - refType = 4; + name = hash.h; + path = ../src/ngircd/hash.h; + refType = 2; }; F55047BC0240F6E501A85B04 = { fileRef = F55047BB0240F6E501A85B04; @@ -935,9 +1023,10 @@ refType = 2; }; F56D8B9F01E0BFA00155ADA7 = { + fileEncoding = 5; isa = PBXFileReference; path = Makefile.am; - refType = 4; + refType = 2; }; F56D8BA001E0BFA00155ADA7 = { children = ( @@ -948,19 +1037,25 @@ refType = 4; }; F56D8BA101E0BFA00155ADA7 = { + fileEncoding = 5; isa = PBXFileReference; - path = Makefile.am; - refType = 4; + name = Makefile.am; + path = ngircd.pbproj/Makefile.am; + refType = 2; }; F576ABFA01D5E77301A85B03 = { + fileEncoding = 5; isa = PBXFileReference; - path = parse.c; - refType = 4; + name = parse.c; + path = ../src/ngircd/parse.c; + refType = 2; }; F576ABFB01D5E77301A85B03 = { + fileEncoding = 5; isa = PBXFileReference; - path = parse.h; - refType = 4; + name = parse.h; + path = ../src/ngircd/parse.h; + refType = 2; }; F576ABFC01D5E77301A85B03 = { fileRef = F576ABFB01D5E77301A85B03; @@ -975,6 +1070,7 @@ }; }; F576ABFE01D61D7401A85B03 = { + fileEncoding = 5; isa = PBXFileReference; name = messages.h; path = ../src/ngircd/messages.h; @@ -987,14 +1083,18 @@ }; }; F57C88850232853501A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-oper.c"; - refType = 4; + name = "irc-oper.c"; + path = "../src/ngircd/irc-oper.c"; + refType = 2; }; F57C88860232853501A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-oper.h"; - refType = 4; + name = "irc-oper.h"; + path = "../src/ngircd/irc-oper.h"; + refType = 2; }; F57C88870232853501A85B04 = { fileRef = F57C88860232853501A85B04; @@ -1009,14 +1109,18 @@ }; }; F57C88890232884501A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-server.c"; - refType = 4; + name = "irc-server.c"; + path = "../src/ngircd/irc-server.c"; + refType = 2; }; F57C888A0232884501A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-server.h"; - refType = 4; + name = "irc-server.h"; + path = "../src/ngircd/irc-server.h"; + refType = 2; }; F57C888B0232884501A85B04 = { fileRef = F57C888A0232884501A85B04; @@ -1031,14 +1135,18 @@ }; }; F57C888D02328D7201A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-channel.c"; - refType = 4; + name = "irc-channel.c"; + path = "../src/ngircd/irc-channel.c"; + refType = 2; }; F57C888E02328D7201A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-channel.h"; - refType = 4; + name = "irc-channel.h"; + path = "../src/ngircd/irc-channel.h"; + refType = 2; }; F57C888F02328D7201A85B04 = { fileRef = F57C888E02328D7201A85B04; @@ -1053,22 +1161,25 @@ }; }; F5B565290325412B01A85B04 = { + fileEncoding = 5; isa = PBXFileReference; name = Protocol.txt; path = ../doc/Protocol.txt; refType = 2; }; F5BEF12802A0EFE201A85B03 = { + fileEncoding = 5; isa = PBXFileReference; name = lists.c; - path = /Users/alex/Develop/ngircd/src/ngircd/lists.c; - refType = 0; + path = ../src/ngircd/lists.c; + refType = 2; }; F5BEF12902A0EFE201A85B03 = { + fileEncoding = 5; isa = PBXFileReference; name = lists.h; - path = /Users/alex/Develop/ngircd/src/ngircd/lists.h; - refType = 0; + path = ../src/ngircd/lists.h; + refType = 2; }; F5BEF12A02A0EFE201A85B03 = { fileRef = F5BEF12902A0EFE201A85B03; @@ -1083,14 +1194,18 @@ }; }; F5BEF12C02A1169C01A85B03 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-op.c"; - refType = 4; + name = "irc-op.c"; + path = "../src/ngircd/irc-op.c"; + refType = 2; }; F5BEF12D02A1169C01A85B03 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-op.h"; - refType = 4; + name = "irc-op.h"; + path = "../src/ngircd/irc-op.h"; + refType = 2; }; F5BEF12E02A1169C01A85B03 = { fileRef = F5BEF12D02A1169C01A85B03; @@ -1121,21 +1236,25 @@ ); isa = PBXLegacyTarget; name = "ngIRCd Makefile"; + passBuildSettingsInEnvironment = 1; productName = "ngIRCd Makefile"; settingsToExpand = 6; settingsToPassInEnvironment = 287; settingsToPassOnCommandLine = 280; - shouldUseHeadermap = 0; }; F5BEF13102A12AFE01A85B03 = { + fileEncoding = 5; isa = PBXFileReference; - path = resolve.c; - refType = 4; + name = resolve.c; + path = ../src/ngircd/resolve.c; + refType = 2; }; F5BEF13202A12AFE01A85B03 = { + fileEncoding = 5; isa = PBXFileReference; - path = resolve.h; - refType = 4; + name = resolve.h; + path = ../src/ngircd/resolve.h; + refType = 2; }; F5BEF13302A12AFE01A85B03 = { fileRef = F5BEF13202A12AFE01A85B03; @@ -1159,27 +1278,25 @@ refType = 4; }; F5D3536203892AD201A85B04 = { + fileEncoding = 5; isa = PBXFileReference; name = Makefile.am; - path = /Users/alex/Develop/ngircd/contrib/Makefile.am; - refType = 0; + path = ../contrib/Makefile.am; + refType = 2; }; F5D3536303892AD201A85B04 = { + fileEncoding = 5; isa = PBXFileReference; name = ngircd.spec; - path = /Users/alex/Develop/ngircd/contrib/ngircd.spec; - refType = 0; - }; - F5D3536403892AFE01A85B04 = { - isa = PBXFileReference; - name = "sample-ngircd.conf"; - path = "en/sample-ngircd.conf"; - refType = 4; + path = ../contrib/ngircd.spec; + refType = 2; }; F5D5CC9303990FED0155B873 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-info.h"; - refType = 4; + name = "irc-info.h"; + path = "../src/ngircd/irc-info.h"; + refType = 2; }; F5D5CC9403990FED0155B873 = { fileRef = F5D5CC9303990FED0155B873; @@ -1188,9 +1305,11 @@ }; }; F5D5CC9503990FFA0155B873 = { + fileEncoding = 5; isa = PBXFileReference; - path = "irc-info.c"; - refType = 4; + name = "irc-info.c"; + path = "../src/ngircd/irc-info.c"; + refType = 2; }; F5D5CC9603990FFA0155B873 = { fileRef = F5D5CC9503990FFA0155B873; @@ -1198,59 +1317,40 @@ settings = { }; }; - F5E9447B02C9EE0E01A85B04 = { - children = ( - F5E9448002C9EE4901A85B04, - F5E9448202C9EE4901A85B04, - F5E9448102C9EE4901A85B04, - F5D3536403892AFE01A85B04, - ); - isa = PBXGroup; - name = en; - refType = 4; - }; F5E9447D02C9EE2801A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = FAQ.txt; - refType = 4; + name = FAQ.txt; + path = ../doc/FAQ.txt; + refType = 2; }; F5E9447E02C9EE2801A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "README-AUX.txt"; - refType = 4; + name = "README-AUX.txt"; + path = "../doc/README-AUX.txt"; + refType = 2; }; F5E9447F02C9EE2801A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = "README-BeOS.txt"; - refType = 4; - }; - F5E9448002C9EE4901A85B04 = { - isa = PBXFileReference; - name = Makefile.am; - path = en/Makefile.am; - refType = 4; - }; - F5E9448102C9EE4901A85B04 = { - isa = PBXFileReference; - name = INSTALL; - path = en/INSTALL; - refType = 4; - }; - F5E9448202C9EE4901A85B04 = { - isa = PBXFileReference; - name = README; - path = en/README; - refType = 4; + name = "README-BeOS.txt"; + path = "../doc/README-BeOS.txt"; + refType = 2; }; F5E9448302C9F49D01A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = match.h; - refType = 4; + name = match.h; + path = ../src/ngircd/match.h; + refType = 2; }; F5E9448402C9F49D01A85B04 = { + fileEncoding = 5; isa = PBXFileReference; - path = match.c; - refType = 4; + name = match.c; + path = ../src/ngircd/match.c; + refType = 2; }; F5E9448502C9F49D01A85B04 = { fileRef = F5E9448302C9F49D01A85B04; @@ -1273,6 +1373,7 @@ F5F18137023EC63701A85B04, F51044540297AC170173DE11, F51044520297ABF80173DE11, + FAC0383E03BB335400A85B04, ); isa = PBXGroup; name = portab; @@ -1280,34 +1381,39 @@ refType = 0; }; F5F18133023EC63701A85B04 = { + fileEncoding = 5; isa = PBXFileReference; name = Makefile.am; - path = portab/Makefile.am; - refType = 4; + path = ../src/portab/Makefile.am; + refType = 2; }; F5F18134023EC63701A85B04 = { + fileEncoding = 5; isa = PBXFileReference; name = exp.h; - path = portab/exp.h; - refType = 4; + path = ../src/portab/exp.h; + refType = 2; }; F5F18135023EC63701A85B04 = { + fileEncoding = 5; isa = PBXFileReference; name = imp.h; - path = portab/imp.h; - refType = 4; + path = ../src/portab/imp.h; + refType = 2; }; F5F18136023EC63701A85B04 = { + fileEncoding = 5; isa = PBXFileReference; name = portab.h; - path = portab/portab.h; - refType = 4; + path = ../src/portab/portab.h; + refType = 2; }; F5F18137023EC63701A85B04 = { + fileEncoding = 5; isa = PBXFileReference; name = portabtest.c; - path = portab/portabtest.c; - refType = 4; + path = ../src/portab/portabtest.c; + refType = 2; }; F5F18138023EC63701A85B04 = { fileRef = F5F18134023EC63701A85B04; @@ -1323,6 +1429,267 @@ }; F5F1813A023EC63701A85B04 = { fileRef = F5F18136023EC63701A85B04; + isa = PBXBuildFile; + settings = { + }; + }; +//F50 +//F51 +//F52 +//F53 +//F54 +//FA0 +//FA1 +//FA2 +//FA3 +//FA4 + FA42C8AD03C0A00B00A85B04 = { + fileEncoding = 4; + isa = PBXFileReference; + name = "conn-zip.c"; + path = "../src/ngircd/conn-zip.c"; + refType = 2; + }; + FA42C8AE03C0A00B00A85B04 = { + fileRef = FA42C8AD03C0A00B00A85B04; + isa = PBXBuildFile; + settings = { + }; + }; + FA42C8AF03C0A01400A85B04 = { + fileEncoding = 4; + isa = PBXFileReference; + name = "conn-zip.h"; + path = "../src/ngircd/conn-zip.h"; + refType = 2; + }; + FA42C8B003C0A01400A85B04 = { + fileRef = FA42C8AF03C0A01400A85B04; + isa = PBXBuildFile; + settings = { + }; + }; + FA42C8B103C0B2F300A85B04 = { + fileEncoding = 4; + isa = PBXFileReference; + name = "conn-func.c"; + path = "../src/ngircd/conn-func.c"; + refType = 2; + }; + FA42C8B203C0B2F300A85B04 = { + fileRef = FA42C8B103C0B2F300A85B04; + isa = PBXBuildFile; + settings = { + }; + }; + FA42C8B303C0B30700A85B04 = { + fileEncoding = 4; + isa = PBXFileReference; + name = "conn-func.h"; + path = "../src/ngircd/conn-func.h"; + refType = 2; + }; + FA42C8B403C0B30700A85B04 = { + fileRef = FA42C8B303C0B30700A85B04; + isa = PBXBuildFile; + settings = { + }; + }; + FA550F2903D59C4D00A85B04 = { + children = ( + FA550F2A03D59C8200A85B04, + FA550F2B03D59C8200A85B04, + FA550F2C03D59C8200A85B04, + ); + isa = PBXGroup; + name = tool; + refType = 4; + }; + FA550F2A03D59C8200A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = Makefile.am; + path = ../src/tool/Makefile.am; + refType = 2; + }; + FA550F2B03D59C8200A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = tool.c; + path = ../src/tool/tool.c; + refType = 2; + }; + FA550F2C03D59C8200A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = tool.h; + path = ../src/tool/tool.h; + refType = 2; + }; + FA550F2D03D59C8C00A85B04 = { + fileRef = FA550F2B03D59C8200A85B04; + isa = PBXBuildFile; + settings = { + }; + }; + FA550F2E03D59C8D00A85B04 = { + fileRef = FA550F2C03D59C8200A85B04; + isa = PBXBuildFile; + settings = { + }; + }; + FA550F2F03D59C9000A85B04 = { + fileRef = FA550F2B03D59C8200A85B04; + isa = PBXBuildFile; + settings = { + }; + }; + FA550F3003D59C9100A85B04 = { + fileRef = FA550F2C03D59C8200A85B04; + isa = PBXBuildFile; + settings = { + }; + }; + FA550F3103D59CB300A85B04 = { + children = ( + FA550F3503D59CD800A85B04, + FA550F3403D59CD800A85B04, + FA550F3703D59CD800A85B04, + FA550F3203D59CD800A85B04, + FA550F3303D59CD800A85B04, + FA550F3603D59CD800A85B04, + FA550F3803D59CD800A85B04, + FA550F3903D59CD800A85B04, + FA550F3A03D59CD800A85B04, + FA550F3B03D59CD800A85B04, + ); + isa = PBXGroup; + name = de; + refType = 4; + }; + FA550F3203D59CD800A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = CVS.txt; + path = ../doc/de/CVS.txt; + refType = 2; + }; + FA550F3303D59CD800A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = FAQ.txt; + path = ../doc/de/FAQ.txt; + refType = 2; + }; + FA550F3403D59CD800A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = INSTALL; + path = ../doc/de/INSTALL; + refType = 2; + }; + FA550F3503D59CD800A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = Makefile.am; + path = ../doc/de/Makefile.am; + refType = 2; + }; + FA550F3603D59CD800A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = Protocol.txt; + path = ../doc/de/Protocol.txt; + refType = 2; + }; + FA550F3703D59CD800A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = README; + path = ../doc/de/README; + refType = 2; + }; + FA550F3803D59CD800A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = "README-AUX.txt"; + path = "../doc/de/README-AUX.txt"; + refType = 2; + }; + FA550F3903D59CD800A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = "README-BeOS.txt"; + path = "../doc/de/README-BeOS.txt"; + refType = 2; + }; + FA550F3A03D59CD800A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = RFC.txt; + path = ../doc/de/RFC.txt; + refType = 2; + }; + FA550F3B03D59CD800A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = "sample-ngircd.conf"; + path = "../doc/de/sample-ngircd.conf"; + refType = 2; + }; + FAC0383C03BB318400A85B04 = { + fileRef = F51044520297ABF80173DE11; + isa = PBXBuildFile; + settings = { + }; + }; + FAC0383D03BB318600A85B04 = { + fileRef = F51044540297AC170173DE11; + isa = PBXBuildFile; + settings = { + }; + }; + FAC0383E03BB335400A85B04 = { + fileEncoding = 4; + isa = PBXFileReference; + name = strlcpy.c; + path = ../src/portab/strlcpy.c; + refType = 2; + }; + FAC0383F03BB335400A85B04 = { + fileRef = FAC0383E03BB335400A85B04; + isa = PBXBuildFile; + settings = { + }; + }; + FAC0384003BB335400A85B04 = { + fileRef = FAC0383E03BB335400A85B04; + isa = PBXBuildFile; + settings = { + }; + }; + FAC51A0C042905AF00214FB8 = { + fileEncoding = 5; + isa = PBXFileReference; + name = rendezvous.c; + path = ../src/ngircd/rendezvous.c; + refType = 2; + }; + FAC51A0D042905AF00214FB8 = { + fileEncoding = 5; + isa = PBXFileReference; + name = rendezvous.h; + path = ../src/ngircd/rendezvous.h; + refType = 2; + }; + FAC51A0E042905AF00214FB8 = { + fileRef = FAC51A0C042905AF00214FB8; + isa = PBXBuildFile; + settings = { + }; + }; + FAC51A0F042905AF00214FB8 = { + fileRef = FAC51A0D042905AF00214FB8; isa = PBXBuildFile; settings = { }; Index: contrib/ngircd.spec =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/contrib/ngircd.spec,v retrieving revision 1.2.2.5 retrieving revision 1.2.4.3 diff -u -u -r1.2.2.5 -r1.2.4.3 --- contrib/ngircd.spec 21 Jan 2003 21:23:34 -0000 1.2.2.5 +++ contrib/ngircd.spec 1 May 2003 10:15:02 -0000 1.2.4.3 @@ -1,5 +1,5 @@ %define name ngircd -%define version 0.6.1 +%define version 0.7.0 %define release 1 %define prefix %{_prefix} Index: doc/CVS.txt =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/doc/CVS.txt,v retrieving revision 1.5 retrieving revision 1.7 diff -u -u -r1.5 -r1.7 --- doc/CVS.txt 15 Feb 2002 15:15:22 -0000 1.5 +++ doc/CVS.txt 26 Mar 2003 22:34:33 -0000 1.7 @@ -1,64 +1,56 @@ ngIRCd - Next Generation IRC Server - (c)2001,2002 by Alexander Barton, + (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ - ngIRCd ist freie Software und steht unter - der GNU General Public License. + ngIRCd is free software and published under the + terms of the GNU General Public License. -- CVS.txt -- -Die Sourcen des ngIRCd werden mit dem "Concurrent Versions System" (CVS) -verwaltet. Somit koennen ohne Probleme mehrere Leute gleichzeitig die Sourcen -bearbeitet. +The source code of ngIRCd is maintained using the "Concurrent Versions +System" (CVS). Thereby several developers can work with the source tree at +the same time. -I. Anonymer "Nur-Lesen"-Zugang -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Anonymer Zugriff auf die CVS-Repository von ngIRCd ist im "nur-lesen"-Modus -moeglich. Dazu sind folgende Schritte noetig: +I. Anonymous read-only Access +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +To access the source tree anonymously in read-only mode, follow these steps: -Beim CVS-Server anmelden +Login to the CVS server: $ cvs -d:pserver:anonymous@arthur.ath.cx:/usr/local/CVS/ngircd login -Als Benutzername wird "anonymous" mit einem leeren Passwort verwendet. -Nun ein "Check-Out" der Quellcodes durchfuehren: +Use "anonymous" as user name and no password (just hit Return). Now you can +check out the sources: $ cvs -d:pserver:anonymous@arthur.ath.cx:/usr/local/CVS/ngircd checkout ngircd -Dadurch wird im aktuellen Verzeichnis der neue Ordner "ngircd" mit allen -Quell-Dateien des ngIRCd erzeugt. +Thereby a new folder "ngircd" will be created containing all the individual +source files. -Dieses ist der "Arbeitsordner", alle CVS-Befehle werden in Zukunft aus -diesem Ordner bzw. einem Unterordner davon ausgefuehrt. +This is the "working folder", all CVS commands will be executed from within +this folder in the future. -Wichtig: wenn ngIRCd "frisch" aus dem CVS compiliert werden soll, so -existiert das configure-Script noch nicht. Dieses muss zunaechst mit dem -Script "autogen.sh" erzeugt werden. Letzteres setzt ein installiertes GNU -automake und GNU autoconf voraus! +Please note: When checking out a fresh copy of ngIRCd from CVS, the +configure script doesn't exist; you have to run the autogen.sh shell script +(which is included in the source tree) to generate it. This requires you to +have GNU automake and GNU autoconf installed on your system. -CVS-Tree aktualisieren: +Updating the CVS tree: - $ cvs update + $ cvs update -d -P [] -Dieser Befehl aktualisiert alle Dateien im aktuellen Verzeichnis sowie allen -Unterverzeichnissen. +You can update a single file or the complete source tree. - $ cvs update -So kann eine einzelne Datei aktualisiert werden (auch dann, wenn sie lokal -z.B. geloescht wurde -- praktisch, um eigene "Experimente" rueckgaengig zu -machen ;-)) - - -III. Schreibzugriff -~~~~~~~~~~~~~~~~~~~ -Wer Schreibzugriff auf die CVS-Repository wuenscht, der moege sich bitte -mit Alex Barton, in Verbindung setzen. +III. Write Access +~~~~~~~~~~~~~~~~~ +If you want to contribute a couple of patches and write access to the CVS +repository would be handy, please contact Alex Barton, . -- -$Id: CVS.txt,v 1.5 2002/02/15 15:15:22 alex Exp $ +$Id: CVS.txt,v 1.7 2003/03/26 22:34:33 alex Exp $ Index: doc/FAQ.txt =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/doc/FAQ.txt,v retrieving revision 1.2 retrieving revision 1.5.2.1 diff -u -u -r1.2 -r1.5.2.1 --- doc/FAQ.txt 19 Feb 2002 20:05:02 -0000 1.2 +++ doc/FAQ.txt 29 Apr 2003 13:45:09 -0000 1.5.2.1 @@ -1,61 +1,67 @@ ngIRCd - Next Generation IRC Server - (c)2001,2002 by Alexander Barton, + (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ - ngIRCd ist freie Software und steht unter - der GNU General Public License. + ngIRCd is free software and published under the + terms of the GNU General Public License. -- FAQ: Frequently Asked Questions -- -I. Allgemein -~~~~~~~~~~~~ -Q: Kann der ngIRCd im Netz zusammen mit "normalen" Servern betrieben werden? -A: Ja. ngIRCd ist zum Original kompatibel, getestet wird dies zur Zeit mit - der Version 2.10.3p3 des ircd. +I. General +~~~~~~~~~~ +Q: Is it possible to link the ngIRCd with non-ngIRCd servers? +A: Yes. ngIRCd is compatible to the original ircd used by IRCNet. Actually + this is being tested with version 2.10.3p3. -Q: Gibt es eine Homepage mit Informationen und Downloads? -A: Ja. Die URL ist . +Q: Is there a homepage with further information and downloads? +A: Yes. Please visit . +Q: Why should I use ngIRCd instead of the original one? +A: ngIRCd offers several benefits: no problems with dynamic IPs, easy to + configure, open source (GPL), under active development. -II. Compilieren + +II. Compilation ~~~~~~~~~~~~~~~ -Q: Ich habe die Sourcen von ngIRCd ueber CVS installiert. Nun kann ich - ./configure nicht ausfuehren, da es nicht existiert!? -A: Bei Builds direkt aus dem CVS-Tree muss das configure-Script zunaechst - durch GNU autoconf sowie die Makefile.in's durch GNU automake generiert - werden. Um dies zu vereinfachen existiert das Script "./autogen.sh". - GNU automake und GNU autoconf werden -- im Gegensatz zu Builds aus den - Sourcen eines .tar.gz-Archivs -- hierbei benoetigt! - -Q: ./autogen.sh bricht mit der Meldung "autoheader: command not found" ab. -A: GNU autoconf ist nicht installiert, wird jedoch bei Builds direkt aus - dem CVS-Tree benoetigt. - -Q: ./autogen.sh bricht mit der Meldung "autoconf: Undefined macros: - AC_FUNC_MALLOC" bzw. "AC_CONFIG_SRCDIR" ab. -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 - alte Version sollte ggf. zunaechst entfernt werden, bei RPM-Paketen z.B. - mit dem Befehl "rpm -e autoconf"). +Q: I did a "CVS checkout" but can't execute ./configure because the script + is missing in the generated directory!? +A: When using development versions via CVS, the configure script as well as + the Makefile.in templates must be generated using GNU automake and GNU + autoconf. To simplify this task run the ./autogen.sh script which will + execute the required tools for you; then continue with executing the + ./configure script as usual. + +Q: The ./autogen.sh script complains "aclocal: command not found". +A: GNU automake is missing on your system but required for building CVS + versions of ngIRCd. Install GNU automake 1.6 or later and try again. + +Q: The ./autogen.sh script stops with "autoheader: command not found". +A: GNU autoconf is missing on your system but required for building CVS + versions of ngIRCd. Install GNU autoconf 2.52 or later and try again. + +Q: The ./autogen.sh script fails and the message "automake: configure.in: + AM_INIT_AUTOMAKE must be used" is displayed. +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!? ~~~~~~~~~~~ -Q: Gibt es eine Liste der bekannten Bugs bzw. Feature-Wuensche? -A: Ja. Es existiert ein Bug-Tracking-System fuer den ngIRCd (Bugzilla): - URL: . Dort koennen Bugs ge- - 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: Was mache ich, wenn ich einen Bug gefunden habe? -A: Am besten traegst du ihn in das Bug-Tracking-System des ngIRCd ein: - URL: +Q: Is there a list of known bugs and desired feature enhancements? +A: Yes. Have a look at the bug tracking system (Bugzilla) for ngIRCd located + at . There you can file bug reports + and feature requests as well as search the bug database. + +Q: What should I do if I found a bug? +A: Please file a bug report at ! + The author of the particular component will be notified automagically :-) -- -$Id: FAQ.txt,v 1.2 2002/02/19 20:05:02 alex Exp $ +$Id: FAQ.txt,v 1.5.2.1 2003/04/29 13:45:09 alex Exp $ Index: doc/Makefile.am =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/doc/Makefile.am,v retrieving revision 1.10 retrieving revision 1.16.2.1 diff -u -u -r1.10 -r1.16.2.1 --- doc/Makefile.am 16 Sep 2002 10:35:06 -0000 1.10 +++ doc/Makefile.am 22 Apr 2003 23:52:48 -0000 1.16.2.1 @@ -1,6 +1,6 @@ # # ngIRCd -- The Next Generation IRC Daemon -# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) +# Copyright (c)2001-2003 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 @@ -9,21 +9,31 @@ # 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.10 2002/09/16 10:35:06 alex Exp $ +# $Id: Makefile.am,v 1.16.2.1 2003/04/22 23:52:48 alex Exp $ # -SUBDIRS = en - -EXTRA_DIST = CVS.txt FAQ.txt Protocol.txt README-AUX.txt \ - README-BeOS.txt RFC.txt sample-ngircd.conf +EXTRA_DIST = CVS.txt FAQ.txt Protocol.txt Platforms.txt \ + README-AUX.txt README-BeOS.txt RFC.txt sample-ngircd.conf maintainer-clean-local: rm -f Makefile Makefile.in +docdir = $(datadir)/doc/$(PACKAGE) + +documents = $(EXTRA_DIST) ../AUTHORS ../COPYING ../ChangeLog ../INSTALL \ + ../NEWS ../README + install-data-hook: $(mkinstalldirs) $(DESTDIR)$(sysconfdir) if [ ! -f $(DESTDIR)$(sysconfdir)/ngircd.conf ]; then \ $(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- Index: doc/Protocol.txt =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/doc/Protocol.txt,v retrieving revision 1.5.4.1 retrieving revision 1.9.2.1 diff -u -u -r1.5.4.1 -r1.9.2.1 --- doc/Protocol.txt 8 Jan 2003 20:36:57 -0000 1.5.4.1 +++ doc/Protocol.txt 29 Apr 2003 13:42:24 -0000 1.9.2.1 @@ -1,115 +1,107 @@ ngIRCd - Next Generation IRC Server - (c)2001,2002 by Alexander Barton, + (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ - ngIRCd ist freie Software und steht unter - der GNU General Public License. + ngIRCd is free software and published under the + terms of the GNU General Public License. -- Protocol.txt -- -I. Kompatibilitaet -~~~~~~~~~~~~~~~~~~ +I. Compatibility +~~~~~~~~~~~~~~~~ -Der ngIRCd haelt sich an das IRC-Protokoll Version 2.10, wie es in den RFCs -1459 und 2810-2813 beschrieben ist. Diese (und ggf. weitere fuer den ngIRCd -relevante) RFCs sind in RFC.txt aufgefuehrt. +The ngIRCd implements the Internet Relay Chat (IRC) protocol version 2.10 +as defined in RFC ("request for comment") 1459 and 2810-2813. These (and +probably further relevant RFCs) are listed in doc/RFC.txt. -Leider verhaelt sich aber schon der "Originalserver" nicht immer genau so, -wie es in den RFCs beschrieben ist. Da der ngIRCd aber ein Ersatz fuer -eben diesen Server sein soll, werden diese Abweichungen in der Regel vom -ngIRCd emuliert um die Kompatibilitaet zu wahren. +Unfortunately, even the "original" ircd doesn't follow these specifications +in all details. But because the ngIRCd should be a fully compatible +replacement for this server ("ircd") it tries to emulate these differences. -Sollte dieses Verhalten nicht erwuenscht sein, so kann mit der configure- -Option "--enable-strict-rfc" der ngIRCd so compiliert werden, dass er sich -strikt an die entsprechenden RFCs haelt. +If you don't like this behavior please ./configure the ngIRCd using the +"--enable-strict-rfc" command line option. But please note: not all IRC +clients are compatible with such an server, some can't even connect at all! +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 +as defined in RFC 2810-2813. This enhanced protocol is named "IRC+". It is +backwards compatible to the "plain" IRC protocol and will only be used by +the ngIRCd if it detects that the peer supports it as well. -Der ngIRCd unterstuetzt als Erweiterung zum IRC-Protokoll wie es in den RFCs -2810-2813 beschrieben ist, das IRC+-Protokoll. Dieses Protokoll ist dabei -kompatibel zum IRC-Protokoll und wird nur verwendet, wenn der ngIRCd fest- -stellt, dass ein connectierter Server ebenfalls dieses erweiterte Protokoll -unterstuetzt. +The "PASSV" command is used to detect the protocol and peer versions (see +RFC 2813, section 4.1.1). -Die Protokoll- und Server-Erkennung wird mit dem "PASS"-Befehl durchgefuehrt -(vgl. RFC 2813, Sektion 4.1.1): +II.1 Register new server link -II.1 neuen Server-Link registrieren + Command: PASS + Parameters: [] + Used by: servers only (with these parameters) - Befehl: PASS - Parameter: [] - Fuer: mit dieser Syntax nur Server + is the password for this new server link as defined in the server +configuration which is sent to the peer or received from it. - enthaelt das Passwort fur den neu aufzubauenden Server-Link, -so wie es in der Konfigurationsdatei definiert wurde. + consists of two parts and is at least 4, at most 14 characters +long: the first four bytes contain the IRC protocol version number, whereas +the first two bytes represent the major version, the last two bytes the +minor version (the string "0210" indicates version 2.10, e.g.). - setzt sich aus zwei Teilen zusammen und ist mindestens 4, maximal -14 Zeichen lang: die ersten vier Bytes enthalten die Versionsnummer des -unterstuetzten IRC-Protokolls, wobei die ersten zwei Bytes die Major-, die -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 +version number. Servers supporting the IRC+ protocol as defined in this +document provide the string "-IRC+" here. - setzt sich ebenfalls aus zwei Bestandteilen zusammen und ist -maximal 100 Bytes lang. Getrennt werden die beiden Teile mit dem Zeichen -"|". 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: "[:]". + consists of two parts separated with the character "|" and is at +most 100 bytes long. The first part contains the name of the implementation +(ngIRCd sets this to "ngIRCd", the original ircd to "IRC", e.g.). The second +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: "[:]". - ist hier eine ASCII-Klartext-Darstellung der Versionsnummer, - zeigt die vom Server unterstuetzten Erweiterungen an (und -kann die leere Menge sein). + is an ASCII representation of the clear-text server version +number, indicates the supported IRC+ protocol extensions (and +may be empty!). -Mit dem optionalen Parameter werden Server-Optionen uebermittelt, -wie sie in RFC 2813, Sektion 4.1.1 definiert sind. +The optional parameter is used to propagate server options as +defined in RFC 2813, section 4.1.1. -Folgende sind zur Zeit definiert: +The following 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 + even if they aren't channel-operator of the affected channel. -- C: der Server unterstuetzt den CHANINFO-Befehl. +- C: The server supports the CHANINFO command. -II.2 Channel-Modes, persistente Channel und Topic austauschen +II.2 Exchange channel-modes, topics, and persistent channels - Befehl: CHANINFO - Parameter: + [[ ] ] - Fuer: Server + Command: CHANINFO + Parameters: + [] + Used by: servers only -Mit CHANINFO Informiert ein Server den anderen ueber einen Channel: dessen -Modes, Channel-Key, User-Limit und dessen Topic. ist optional. +CHANINFO is used by servers to inform each other about a channel: its +modes, channel key, user limits and its topic. is optional. -Existiert auf dem Server, der das CHANINFO empfaengt, der Channel bereits, -so uebernimmt er die Werte jeweils nur dann, wenn er selber noch keine -Modes bzw. kein Topic definiert hat. Ansonsten wird der jeweilige Parameter -ignoriert. +If the channel already exists on the server receiving the CHANINFO command, +it only adopts the (or the ) if there are no modes (or topic) +already set. It there are already values set the server ignores the +corresponding parameter. -Existiert der Channel noch nicht, so wird er mit den entsprechenden Angaben -erzeugt. +If the channel doesn't exists at all it will be created. -Hat ein Channel keinen Key (in ist der Mode "k" nicht vorhanden), -so muss der Parameter ignoriert werden (da vorhanden sein muss, -sollte in diesem Fall "*" uebergeben werden). Hat er kein User-Limit (kein -"l" in ), so muss ignoriert werden ( sollte hierbei -als "0" uebergeben werden). +The parameter must be ignored if a channel has no key (the parameter + doesn't list the "k" channel mode). In this case should +contain "*" because the parameter is required by the CHANINFO syntax +and therefore can't be omitted. The parameter must be ignored when +a channel has no user limit (the parameter doesn't list the "l" +channel mode). In this case should be "0". -- -$Id: Protocol.txt,v 1.5.4.1 2003/01/08 20:36:57 alex Exp $ +$Id: Protocol.txt,v 1.9.2.1 2003/04/29 13:42:24 alex Exp $ Index: doc/README-AUX.txt =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/doc/README-AUX.txt,v retrieving revision 1.4 retrieving revision 1.8 diff -u -u -r1.4 -r1.8 --- doc/README-AUX.txt 11 Nov 2002 00:59:11 -0000 1.4 +++ doc/README-AUX.txt 21 Apr 2003 21:59:34 -0000 1.8 @@ -1,68 +1,67 @@ - ngIRCd - Next Generation IRC Server + ngIRCd - Next Generation IRC Server - (c)2001,2002 by Alexander Barton, - alex@barton.de, http://www.barton.de/ + (c)2001-2003 by Alexander Barton, + alex@barton.de, http://www.barton.de/ - ngIRCd ist freie Software und steht unter - der GNU General Public License. + ngIRCd is free software and published under the + terms of the GNU General Public License. - -- README-AUX.txt -- + -- README-AUX.txt -- -Seit Version 0.2.2-pre gehoert Apple A/UX zu den offiziell unterstuetzten -Plattformen. Er ist im vollen Funktionsumfang nutzbar. -Ab Version 0.5.0 compiliert zudem der ngIRCd mit dem nativen A/UX-Compiler, -d.h. GNU C wird nicht mehr zwingend vorausgesetzt. +Since version 0.2.2-pre Apple's A/UX belongs to the officially supported +platforms. It is not restricted in any way. -Folgende Software wird jedoch benoetigt: +Since version 0.5.0 ngIRCd's source compiles with the native A/UX c +compiler. GNU C isn't a must-have anymore. - - GNU sed - Bezugsquellen: - 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 +The following software packages are needed: - A/UX beinhaltet ein /bin/sed, dieses unterstuetzt jedoch leider nicht - alle Funktionen, die GNU automake/autoconf nutzen. - Achtung: bitte bei der Installation von GNU sed sicherstellen, dass - immer dieses und nie das von A/UX verwendet wird (also $PATH entsprechend - anpassen bzw. die A/UX-Version komplett ersetzen)! + - GNU sed + Source: + 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 - - libUTIL.a - Bezugsquellen: - 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 + A/UX comes with /bin/sed which isn't supporting all functions needed + by GNU automake/autoconf. - Diese Library beinhaltet Systemfunktionen, die auf UNIXoiden Systemen - gaengig, unter A/UX jedoch leider nicht verfuegbar sind. Dazu gehoert - u.a. memmove(), strerror() und strdup(). + Warning: When installing GNU sed please make sure that A/UX doesn't + use the old one anymore which means set the $PATH or replace /bin/sed + at all. -Nachdem diese Pakete entsprechend installiert sind, reicht ein ganz normales -"./configure" und "make" aus, um den ngIRCd unter A/UX zu compilieren. + - libUTIL.a + Source: + 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 + This library contains functions that are common on other UNIX + systems but not on A/UX e.g. memmove(), strerror() und strdup(). -Noch ein paar Hinweise, wenn es doch (noch) nicht klappt: - - auf dem System muss entweder ein install vorhanden sein, welches so - "broken" ist, dass configure das eigene Shell-Skript waehlt, oder eben - eines, welches funktioniert. Leider ist mindestens ein Binary im Um- - lauf, welches Probleme verursacht. Das Binary aus folgenden GNU - fileutils funktioniert hier aber z.B.: - ftp://arthur.ath.cx/pub/UNIX/AUX/Software/Tools/fileutils-4.0.tar.gz +After installation of these packages just do a "./configure" and "make" to +compile ngIRCd on A/UX. - - das sich im Umlauf befindende vorcompilierte Binary der alten Bash sollte - unbedingt ausserhalb von /bin (z.B. unter /usr/local/bin) installiert - 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. +A few hints in case of errors: + - Either there's an 'install' on your system which is completely broken + (so 'configure' uses its own shell script) or use a fully functionable one. + 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 + + - The precompiled binary of the old 'bash' shouldn't be installed within + /bin (better do this in /usr/local/bin) because 'configure' would + choose it as its shell which wouldn't work. + + - 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.4 2002/11/11 00:59:11 alex Exp $ +$Id: README-AUX.txt,v 1.8 2003/04/21 21:59:34 goetz Exp $ Index: doc/README-BeOS.txt =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/doc/README-BeOS.txt,v retrieving revision 1.3 retrieving revision 1.6 diff -u -u -r1.3 -r1.6 --- doc/README-BeOS.txt 19 May 2002 13:10:26 -0000 1.3 +++ doc/README-BeOS.txt 21 Apr 2003 12:55:39 -0000 1.6 @@ -1,15 +1,21 @@ ngIRCd - Next Generation IRC Server - (c)2001,2002 by Alexander Barton, + (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ - ngIRCd ist freie Software und steht unter - der GNU General Public License. + ngIRCd is free software and published under the + terms of the GNU General Public License. -- 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- formen: der ngIRCd enthaelt zwar bereits einige Anpassungen an BeOS und compiliert auch, jedoch bricht er bei jedem Connect-Versuch eines Clients @@ -44,4 +50,4 @@ Fuer eine Aenderung im CVS ist es aber meiner Meinung nach noch zu frueh ... -- -$Id: README-BeOS.txt,v 1.3 2002/05/19 13:10:26 alex Exp $ +$Id: README-BeOS.txt,v 1.6 2003/04/21 12:55:39 alex Exp $ Index: doc/RFC.txt =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/doc/RFC.txt,v retrieving revision 1.4 retrieving revision 1.6 diff -u -u -r1.4 -r1.6 --- doc/RFC.txt 23 Jan 2002 18:20:04 -0000 1.4 +++ doc/RFC.txt 7 Mar 2003 20:42:20 -0000 1.6 @@ -1,16 +1,17 @@ ngIRCd - Next Generation IRC Server - (c)2001,2002 by Alexander Barton, + (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ - ngIRCd ist freie Software und steht unter - der GNU General Public License. + ngIRCd is free software and published under the + terms of the GNU General Public License. -- RFC.txt -- -Das IRC-Protokoll ist in diesen RFC's (Request For Comments) dokumentiert: +The Internet Relay Chat (IRC) protocol is documented in these Request for +Comments (RFC), which you can get e.g. via : 1459 Oikarinen, J. & D. Reed, "Internet Relay Chat Protocol", May 1993, [IRC]. @@ -29,4 +30,4 @@ -- -$Id: RFC.txt,v 1.4 2002/01/23 18:20:04 alex Exp $ +$Id: RFC.txt,v 1.6 2003/03/07 20:42:20 alex Exp $ Index: doc/sample-ngircd.conf =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/doc/sample-ngircd.conf,v retrieving revision 1.17 retrieving revision 1.20.2.2 diff -u -u -r1.17 -r1.20.2.2 --- doc/sample-ngircd.conf 18 Dec 2002 12:19:07 -0000 1.17 +++ doc/sample-ngircd.conf 29 Apr 2003 12:37:17 -0000 1.20.2.2 @@ -1,164 +1,141 @@ -# $Id: sample-ngircd.conf,v 1.17 2002/12/18 12:19:07 alex Exp $ +# $Id: sample-ngircd.conf,v 1.20.2.2 2003/04/29 12:37:17 alex Exp $ # -# Das ist eine Beispiel-Konfiguration fuer den ngIRCd, die an die -# jeweiligen Beduerfnisse angepasst werden kann/muss. +# This is a sample configuration file for the ngIRCd, which must adept to +# the local preferences and needs. # -# Kommentare werden mit "#" oder ";" eingeleitet. +# Comments are started with "#" or ";". # -# +-----------------------------------------------------------------------+ -# | 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, -# Erweiterungen von Ilja Osthoff, +# Author: Alexander Barton, +# Initial translation by Ilja Osthoff, # [Global] - # - # Im [Global]-Abschnitt der Konfigurationsdatei wird der Server - # "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. - # - - # Servername im IRC-Netz + # The [Global] section of this file is used to define the main + # configuration of the server, like the server name and the ports + # on which the server should be listening. + + # Server name in the IRC network, must contain at least one dot + # (".") and be unique in the IRC network. Name = irc.the.net - - # Info-Text des Servers. Dieser wird z.B. bei WHOIS- oder LINKS- - # Abfragen entsprechend mit ausgegeben. + + # Info text of the server. This will be shown by WHOIS and + # LINKS requests for example. Info = Server Info Text - # Informationen ueber den Server und Administrator fuer den - # ADMIN-Befehl: - ;AdminInfo1 = Beschreibung - ;AdminInfo2 = Standort + # Global password for all users needed to connect to the server + ;Password = abc + + # Information about the server and the administrator, used by the + # ADMIN command. + ;AdminInfo1 = Description + ;AdminInfo2 = Location ;AdminEMail = admin@irc.server - - # Ports, auf denen Verbindungen angenommen werden sollen. Es koennen - # mehrere Ports mit "," getrennt angegeben werden. (Default: 6667) - ;Ports = 6667, 6668, 6669 - - # Textdatei mit der "Message of the Day" (MOTD). Diese wird aus- - # gegeben, wenn sich ein User mit dem Server verbindet. + + # Ports on which the server should listen. There may be more than + # one port, separated with ";". (Default: 6667) + ;Ports = 6667, 6668, 66694 + + # Text file with the "message of the day" (MOTD). This message will + # be shown to all users connecting to the server: ;MotdFile = /usr/local/etc/ngircd.motd - # User-ID, unter der der Daemon laufen soll (dazu muss der Server - # jedoch mit root-Rechten gestartet werden). Es kann der Name oder - # die numerische ID angegeben werden. - # ACHTUNG: Die Konfigurations- und MOTD-Datei muessen fuer diesen - # Benutzer lesbar sein, ansonsten schlaegt ein RESTART fehl! - ;ServerUID = ircd - - # Group-ID, zu der der Daemon wechseln soll (hierzu muss der Server - # jedoch mit root-Rechten gestartet werden). Es kann der Name oder - # die numerische ID angegeben werden. - ;ServerGID = daemon + # User ID under which the server should run; you can use the name + # of the user or the numerical ID. ATTENTION: 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! + ;ServerUID = 65534 + + # Group ID under which the ngircd should run; you can use the name + # of the group or the numerical ID. ATTENTION: For this to work the + # server must have been started with root privileges! + ;ServerGID = 65534 - # Nach Sekunden verschickt der Server bei Inaktivitaet - # von einem Client diesem ein PING. + # After seconds of inactivity the server will send a + # PING to the peer to test whether it is alive or not. ;PingTimeout = 120 - # Antwortet ein Client, der ein PING bekam, nicht innerhalb von - # Sekunden mit einem PONG, so wird er disconnectiert. + # If a client fails to answer a PING with a PONG within + # seconds, it will be disconnected by the server. ;PongTimeout = 20 - # Der Server versucht alle Sekunden, noch nicht bzw. - # nicht mehr connectierte Server-Links aufzubauen. + # The server tries every seconds to establish a link + # to not yet (or no longer) connected servers. ;ConnectRetry = 60 - - # Sollen IRC-Operatoren immer den MODE-Befehl in Channel benutzen - # koennen, auch wenn sie kein(!) Channel-Operator sind? + + # Should IRC Operators be allowed to use the MODE command even if + # they are not(!) channel-operators? ;OperCanUseMode = no - # Maximale Anzahl von gleichzeitigen Verbindungen, die dieser - # Server annehmen darf (<=0: unlimitiert). + # Maximum number of simultaneous connection the server is allowed + # to accept (<=0: unlimited): ;MaxConnections = -1 - # Maximale Anzahl von Channels, in denen ein User zeitgleich - # Mitglied sein kann (<=0: unlimitiert). + # Maximum number of channels a user can be member of (<=0: no limit): ;MaxJoins = 10 [Operator] - - # - # 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). + # [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) ;Name = TheOper - # Passwort des IRC-Operators + # Password of the IRC operator ;Password = ThePwd [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 + # 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 ;Name = irc2.the.net - - # DNS-Hostname des Servers + + # Internet host name of the peer ;Host = connect-to-host.the.net - # Port, zu dem dieser Server eine Verbindung herstellen soll. Wird - # kein Port angegeben, so wird auf eine Verbindung der Gegenseite - # gewartet. + # Port of the server to which the ngIRCd should connect. If you + # assign no port the ngIRCd waits for incoming connections. ;Port = 6666 - # Eigenes Passwort fuer diese Verbindung. Dieses Passwort muss auf - # dem anderen Server als "PeerPassword" konfiguriert werden. + # Own password for the connection. This password has to be configured + # as "PeerPassword" on the other server. ;MyPassword = MySecret - # Passwort des Peer-Servers fuer diese Verbindung. Dieses Passwort - # muss auf dem anderen Server als "MyPassword" konfiguriert sein. + # Foreign password for this connection. This password has to be + # configured as "MyPassword" on the other server. ;PeerPassword = PeerSecret - - # Gruppe, zu der dieser Server gehoert (optional). + + # Group of this server (optional) ;Group = 123 [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 + # 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 ;Name = #TheName - # Topic, das gesetzt werden soll - ;Topic = Ein tolles Topic - - # Channel-Modes + # Topic for this channel + ;Topic = a great topic + + # Initial channel modes ;Modes = tn # -eof- Index: man/ngircd.8 =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/man/ngircd.8,v retrieving revision 1.5 retrieving revision 1.8 diff -u -u -r1.5 -r1.8 --- man/ngircd.8 18 Nov 2002 18:49:34 -0000 1.5 +++ man/ngircd.8 10 Mar 2003 00:58:06 -0000 1.8 @@ -1,7 +1,7 @@ .\" -.\" $Id: ngircd.8,v 1.5 2002/11/18 18:49:34 alex Exp $ +.\" $Id: ngircd.8,v 1.8 2003/03/10 00:58:06 alex Exp $ .\" -.TH ngircd 8 "September 2002" ngircd "ngIRCd Manual" +.TH ngircd 8 "March 2003" ngircd "ngIRCd Manual" .SH NAME ngircd \- the next generation IRC daemon .SH SYNOPSIS @@ -9,32 +9,63 @@ .I Options .B ] .SH DESCRIPTION -.B ngircd -is a portable IRC daemon written from scratch. It is easy to configure, -supports server links (even with original ircds) and runs on hosts with -changing IP addresses (such as dial-in networks). Currently supported -platforms (tested versions) are: 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. +.BR ngircd +is a free open source daemon for the Internet Relay Chat (IRC), +developed under the GNU General Public License (GPL). +.PP +It's written from scratch and is not based upon the original IRCd like +many others. It is easy to configure, supports server links (even with +original ircd's) and runs on hosts with changing IP addresses (such as +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 -.IP --configtest -read, validate and display configuration; then exit. -.IP "-f file, --config file" -use +The default behaviour of +.BR ngircd +is to read its standard configuration file (see below), to detach from the +controlling terminal and to wait for clients. +.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 as configuration file. -.IP "-n, --nodaemon" -don't fork and don't detach from controlling terminal. -.IP "-p, --passive" -disable automatic connections to other servers. -.IP --version -output version information and exit. -.IP --help -display brief help text and exit. +.TP +\fB\-n\fR, \fB\-\-nodaemon\fR +Don't fork a child and don't detach from controlling terminal. +All log messages go to the console. +.TP +\fB\-p\fR, \fB\-\-passive\fR +Disable automatic connections to other servers. You can use the IRC command +CONNECT later on as IRC Operator to link this ngIRCd to other servers. +.TP +\fB\-\-version\fR +Output version information and exit. +.TP +\fB\-\-help\fR +Display a brief help text and exit. .SH FILES .I /usr/local/etc/ngircd.conf .RS The system wide default configuration file. +.RE +.I /usr/local/etc/ngircd.motd +.RS +Default "message of the day" (MOTD). +.RE .SH AUTHOR Alexander Barton, .UR mailto:alex@barton.de Index: man/ngircd.conf.5 =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/man/ngircd.conf.5,v retrieving revision 1.6 retrieving revision 1.9 diff -u -u -r1.6 -r1.9 --- man/ngircd.conf.5 16 Sep 2002 11:11:21 -0000 1.6 +++ man/ngircd.conf.5 10 Mar 2003 00:58:06 -0000 1.9 @@ -1,14 +1,195 @@ .\" -.\" $Id: ngircd.conf.5,v 1.6 2002/09/16 11:11:21 alex Exp $ +.\" $Id: ngircd.conf.5,v 1.9 2003/03/10 00:58:06 alex Exp $ .\" -.TH ngircd.conf 5 "September 2002" ngircd "ngIRCd Manual" +.TH ngircd.conf 5 "March 2003" ngircd "ngIRCd Manual" .SH NAME -ngircd.conf \- configuration file of ngircd +ngircd.conf \- configuration file of ngIRCd .SH SYNOPSIS .B /usr/local/etc/ngircd.conf .SH DESCRIPTION -(coming soon, please have a look at the sample configuration -file "doc/sample-ngircd.conf" -- Thank you!) +.BR ngircd.conf +is the configuration file for +.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 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 +seconds, it will be disconnected by the server. Default: 20. +.IT +\fBConnectRetry\fR +The server tries every 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 Alexander Barton, .UR mailto:alex@barton.de @@ -21,6 +202,5 @@ .UE .SH "SEE ALSO" .BR ngircd (8) -.BR ircd (8) .\" .\" -eof- Index: src/Makefile.am =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- src/Makefile.am 9 Sep 2002 10:00:15 -0000 1.4 +++ src/Makefile.am 13 Jan 2003 12:20:16 -0000 1.5 @@ -2,17 +2,16 @@ # 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. +# 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.4 2002/09/09 10:00:15 alex Exp $ +# $Id: Makefile.am,v 1.5 2003/01/13 12:20:16 alex Exp $ # -SUBDIRS = portab ngircd testsuite +SUBDIRS = portab tool ngircd testsuite maintainer-clean-local: rm -f Makefile Makefile.in config.h config.h.in stamp-h.in Index: src/ngircd/Makefile.am =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/Makefile.am,v retrieving revision 1.31.2.1 retrieving revision 1.39 diff -u -u -r1.31.2.1 -r1.39 --- src/ngircd/Makefile.am 4 Jan 2003 10:58:15 -0000 1.31.2.1 +++ src/ngircd/Makefile.am 31 Mar 2003 19:01:02 -0000 1.39 @@ -1,36 +1,37 @@ # # ngIRCd -- The Next Generation IRC Daemon -# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) +# Copyright (c)2001-2003 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. +# 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.31.2.1 2003/01/04 10:58:15 alex Exp $ +# $Id: Makefile.am,v 1.39 2003/03/31 19:01:02 alex Exp $ # AUTOMAKE_OPTIONS = ../portab/ansi2knr -INCLUDES = -I$(srcdir)/../portab +INCLUDES = -I$(srcdir)/../portab -I$(srcdir)/../tool LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN sbin_PROGRAMS = ngircd -ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c hash.c irc.c \ - irc-channel.c irc-info.c irc-login.c irc-mode.c irc-op.c irc-oper.c \ - irc-server.c irc-write.c lists.c log.c match.c parse.c resolve.c tool.c - -ngircd_LDFLAGS = -L../portab - -ngircd_LDADD = -lngportab - -noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h hash.h irc.h \ - irc-channel.h irc-info.h irc-login.h irc-mode.h irc-op.h irc-oper.h \ - irc-server.h irc-write.h lists.h log.h match.h parse.h resolve.h tool.h \ +ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c conn-zip.c conn-func.c \ + hash.c irc.c irc-channel.c irc-info.c irc-login.c irc-mode.c irc-op.c \ + irc-oper.c irc-server.c irc-write.c lists.c log.c match.c parse.c \ + rendezvous.c resolve.c + +ngircd_LDFLAGS = -L../portab -L../tool + +ngircd_LDADD = -lngportab -lngtool + +noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h conn-zip.h conn-func.h \ + hash.h irc.h irc-channel.h irc-info.h irc-login.h irc-mode.h irc-op.h \ + irc-oper.h irc-server.h irc-write.h lists.h log.h match.h parse.h \ + rendezvous.h resolve.h \ messages.h defines.h clean-local: Index: src/ngircd/channel.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/channel.c,v retrieving revision 1.38 retrieving revision 1.42 diff -u -u -r1.38 -r1.42 --- src/ngircd/channel.c 16 Dec 2002 23:05:24 -0000 1.38 +++ src/ngircd/channel.c 30 Dec 2002 17:15:42 -0000 1.42 @@ -17,14 +17,14 @@ #include "portab.h" -static char UNUSED id[] = "$Id: channel.c,v 1.38 2002/12/16 23:05:24 alex Exp $"; +static char UNUSED id[] = "$Id: channel.c,v 1.42 2002/12/30 17:15:42 alex Exp $"; #include "imp.h" #include #include #include -#include "conn.h" +#include "conn-func.h" #include "client.h" #include "exp.h" @@ -468,7 +468,7 @@ if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return FALSE; ptr = Name; - strcpy( badchars, " ,:\x07" ); + strcpy( badchars, " ,:\007" ); while( *ptr ) { if( strchr( badchars, *ptr )) return FALSE; @@ -494,7 +494,7 @@ if( ! strchr( Chan->modes, x[0] )) { /* Client hat den Mode noch nicht -> setzen */ - strcat( Chan->modes, x ); + strlcat( Chan->modes, x, sizeof( Chan->modes )); return TRUE; } else return FALSE; @@ -547,7 +547,7 @@ if( ! strchr( cl2chan->modes, x[0] )) { /* Client hat den Mode noch nicht -> setzen */ - strcat( cl2chan->modes, x ); + strlcat( cl2chan->modes, x, sizeof( cl2chan->modes )); return TRUE; } else return FALSE; @@ -629,8 +629,7 @@ assert( Chan != NULL ); assert( Topic != NULL ); - strncpy( Chan->topic, Topic, CHANNEL_TOPIC_LEN - 1 ); - Chan->topic[CHANNEL_TOPIC_LEN - 1] = '\0'; + strlcpy( Chan->topic, Topic, sizeof( Chan->topic )); } /* Channel_SetTopic */ @@ -640,8 +639,7 @@ assert( Chan != NULL ); assert( Modes != NULL ); - strncpy( Chan->modes, Modes, CHANNEL_MODE_LEN - 1 ); - Chan->topic[CHANNEL_MODE_LEN - 1] = '\0'; + strlcpy( Chan->modes, Modes, sizeof( Chan->modes )); } /* Channel_SetModes */ @@ -651,8 +649,7 @@ assert( Chan != NULL ); assert( Key != NULL ); - strncpy( Chan->key, Key, CLIENT_PASS_LEN - 1 ); - Chan->key[CLIENT_PASS_LEN - 1] = '\0'; + strlcpy( Chan->key, Key, sizeof( Chan->key )); Log( LOG_DEBUG, "Channel %s: Key is now \"%s\".", Chan->name, Chan->key ); } /* Channel_SetKey */ @@ -710,7 +707,7 @@ return NULL; } c->next = NULL; - strncpy( c->name, Name, CHANNEL_NAME_LEN - 1 ); + strlcpy( c->name, Name, sizeof( c->name )); c->name[CHANNEL_NAME_LEN - 1] = '\0'; strcpy( c->modes, "" ); strcpy( c->topic, "" ); Index: src/ngircd/client.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/client.c,v retrieving revision 1.65.2.3 retrieving revision 1.74 diff -u -u -r1.65.2.3 -r1.74 --- src/ngircd/client.c 8 Jan 2003 23:13:45 -0000 1.65.2.3 +++ src/ngircd/client.c 31 Mar 2003 15:54:21 -0000 1.74 @@ -17,7 +17,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: client.c,v 1.65.2.3 2003/01/08 23:13:45 alex Exp $"; +static char UNUSED id[] = "$Id: client.c,v 1.74 2003/03/31 15:54:21 alex Exp $"; #include "imp.h" #include @@ -59,6 +59,10 @@ LOCAL VOID Generate_MyToken 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; @@ -72,7 +76,7 @@ if( ! This_Server ) { Log( LOG_EMERG, "Can't allocate client structure for server! Going down." ); - Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE ); + Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); exit( 1 ); } @@ -86,7 +90,7 @@ gethostname( This_Server->host, CLIENT_HOST_LEN ); h = gethostbyname( This_Server->host ); - if( h ) strcpy( This_Server->host, h->h_name ); + if( h ) strlcpy( This_Server->host, h->h_name, sizeof( This_Server->host )); Client_SetID( This_Server, Conf_ServerName ); Client_SetInfo( This_Server, Conf_ServerInfo ); @@ -101,7 +105,7 @@ CLIENT *c, *next; INT cnt; - if( NGIRCd_Restart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, FALSE ); + if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, FALSE ); else Client_Destroy( This_Server, "Server going down.", NULL, FALSE ); cnt = 0; @@ -175,7 +179,7 @@ if( Type == CLIENT_SERVER ) Generate_MyToken( client ); /* ist der User away? */ - if( strchr( client->modes, 'a' )) strcpy( client->away, DEFAULT_AWAY_MSG ); + if( strchr( client->modes, 'a' )) strlcpy( client->away, DEFAULT_AWAY_MSG, sizeof( client->away )); /* Verketten */ client->next = (POINTER *)My_Clients; @@ -203,7 +207,7 @@ if( ! txt ) txt = "Reason unknown."; /* Netz-Split-Nachricht vorbereiten (noch nicht optimal) */ - if( Client->type == CLIENT_SERVER ) sprintf( msg, "%s: lost server %s", This_Server->id, Client->id ); + if( Client->type == CLIENT_SERVER ) snprintf( msg, sizeof( msg ), "%s: lost server %s", This_Server->id, Client->id ); last = NULL; c = My_Clients; @@ -263,7 +267,7 @@ } /* andere Server informieren */ - if( ! NGIRCd_Quit ) + if( ! NGIRCd_SignalQuit ) { 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 ); @@ -293,6 +297,35 @@ 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 Client_SetHostname( CLIENT *Client, CHAR *Hostname ) { /* Hostname eines Clients setzen */ @@ -300,8 +333,7 @@ assert( Client != NULL ); assert( Hostname != NULL ); - strncpy( Client->host, Hostname, CLIENT_HOST_LEN - 1 ); - Client->host[CLIENT_HOST_LEN - 1] = '\0'; + strlcpy( Client->host, Hostname, sizeof( Client->host )); } /* Client_SetHostname */ @@ -313,8 +345,7 @@ assert( Client != NULL ); assert( ID != NULL ); - strncpy( Client->id, ID, CLIENT_ID_LEN - 1 ); - Client->id[CLIENT_ID_LEN - 1] = '\0'; + strlcpy( Client->id, ID, sizeof( Client->id )); /* Hash */ Client->hash = Hash( Client->id ); @@ -329,13 +360,12 @@ assert( Client != NULL ); assert( User != NULL ); - if( Idented ) strncpy( Client->user, User, CLIENT_USER_LEN - 1 ); + if( Idented ) strlcpy( Client->user, User, sizeof( Client->user )); else { Client->user[0] = '~'; - strncpy( Client->user + 1, User, CLIENT_USER_LEN - 2 ); + strlcpy( Client->user + 1, User, sizeof( Client->user ) - 1 ); } - Client->user[CLIENT_USER_LEN - 1] = '\0'; } /* Client_SetUser */ @@ -347,8 +377,7 @@ assert( Client != NULL ); assert( Info != NULL ); - strncpy( Client->info, Info, CLIENT_INFO_LEN - 1 ); - Client->info[CLIENT_INFO_LEN - 1] = '\0'; + strlcpy( Client->info, Info, sizeof( Client->info )); } /* Client_SetInfo */ @@ -360,8 +389,7 @@ assert( Client != NULL ); assert( Modes != NULL ); - strncpy( Client->modes, Modes, CLIENT_MODE_LEN - 1 ); - Client->modes[CLIENT_MODE_LEN - 1] = '\0'; + strlcpy( Client->modes, Modes, sizeof( Client->modes )); } /* Client_SetModes */ @@ -373,8 +401,7 @@ assert( Client != NULL ); assert( Flags != NULL ); - strncpy( Client->flags, Flags, CLIENT_FLAGS_LEN - 1 ); - Client->flags[CLIENT_FLAGS_LEN - 1] = '\0'; + strlcpy( Client->flags, Flags, sizeof( Client->flags )); } /* Client_SetFlags */ @@ -386,8 +413,7 @@ assert( Client != NULL ); assert( Pwd != NULL ); - strncpy( Client->pwd, Pwd, CLIENT_PASS_LEN - 1 ); - Client->pwd[CLIENT_PASS_LEN - 1] = '\0'; + strlcpy( Client->pwd, Pwd, sizeof( Client->pwd )); } /* Client_SetPassword */ @@ -395,12 +421,11 @@ Client_SetAway( CLIENT *Client, CHAR *Txt ) { /* Set AWAY reason of client */ - + assert( Client != NULL ); assert( Txt != NULL ); - strncpy( Client->away, Txt, CLIENT_AWAY_LEN - 1 ); - Client->away[CLIENT_AWAY_LEN - 1] = '\0'; + strlcpy( Client->away, Txt, sizeof( Client->away )); Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt ); } /* Client_SetAway */ @@ -463,7 +488,7 @@ if( ! strchr( Client->modes, x[0] )) { /* Client hat den Mode noch nicht -> setzen */ - strcat( Client->modes, x ); + strlcat( Client->modes, x, sizeof( Client->modes )); return TRUE; } else return FALSE; @@ -529,8 +554,7 @@ assert( Nick != NULL ); /* Nick kopieren und ggf. Host-Mask abschneiden */ - strncpy( search_id, Nick, CLIENT_ID_LEN - 1 ); - search_id[CLIENT_ID_LEN - 1] = '\0'; + strlcpy( search_id, Nick, sizeof( search_id )); ptr = strchr( search_id, '!' ); if( ptr ) *ptr = '\0'; @@ -798,7 +822,7 @@ if( strcasecmp( c->id, ID ) == 0 ) { /* die Server-ID gibt es bereits */ - sprintf( str, "ID \"%s\" already registered", ID ); + snprintf( str, sizeof( str ), "ID \"%s\" already registered", 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 ); Conn_Close( Client->conn_id, str, str, TRUE ); Index: src/ngircd/client.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/client.h,v retrieving revision 1.32.2.1 retrieving revision 1.34 diff -u -u -r1.32.2.1 -r1.34 --- src/ngircd/client.h 22 Dec 2002 23:42:28 -0000 1.32.2.1 +++ src/ngircd/client.h 15 Jan 2003 14:28:25 -0000 1.34 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: client.h,v 1.32.2.1 2002/12/22 23:42:28 alex Exp $ + * $Id: client.h,v 1.34 2003/01/15 14:28:25 alex Exp $ * * Client management (header) */ @@ -62,78 +62,81 @@ #endif -GLOBAL VOID Client_Init PARAMS((VOID )); -GLOBAL VOID Client_Exit PARAMS((VOID )); +GLOBAL VOID Client_Init 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_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_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 CLIENT *Client_ThisServer PARAMS((VOID )); - -GLOBAL CLIENT *Client_GetFromConn PARAMS((CONN_ID Idx )); -GLOBAL CLIENT *Client_GetFromToken PARAMS((CLIENT *Client, INT Token )); - -GLOBAL CLIENT *Client_Search PARAMS((CHAR *ID )); -GLOBAL CLIENT *Client_First PARAMS((VOID )); -GLOBAL CLIENT *Client_Next PARAMS((CLIENT *c )); - -GLOBAL INT Client_Type PARAMS((CLIENT *Client )); -GLOBAL CONN_ID Client_Conn PARAMS((CLIENT *Client )); -GLOBAL CHAR *Client_ID PARAMS((CLIENT *Client )); -GLOBAL CHAR *Client_Mask PARAMS((CLIENT *Client )); -GLOBAL CHAR *Client_Info PARAMS((CLIENT *Client )); -GLOBAL CHAR *Client_User PARAMS((CLIENT *Client )); -GLOBAL CHAR *Client_Hostname PARAMS((CLIENT *Client )); -GLOBAL CHAR *Client_Password PARAMS((CLIENT *Client )); -GLOBAL CHAR *Client_Modes PARAMS((CLIENT *Client )); -GLOBAL CHAR *Client_Flags PARAMS((CLIENT *Client )); -GLOBAL CLIENT *Client_Introducer PARAMS((CLIENT *Client )); -GLOBAL BOOLEAN Client_OperByMe PARAMS((CLIENT *Client )); -GLOBAL INT Client_Hops PARAMS((CLIENT *Client )); -GLOBAL INT Client_Token PARAMS((CLIENT *Client )); -GLOBAL INT Client_MyToken PARAMS((CLIENT *Client )); -GLOBAL CLIENT *Client_TopServer PARAMS((CLIENT *Client )); -GLOBAL CLIENT *Client_NextHop PARAMS((CLIENT *Client )); -GLOBAL CHAR *Client_Away PARAMS((CLIENT *Client )); - -GLOBAL BOOLEAN Client_HasMode PARAMS((CLIENT *Client, CHAR Mode )); - -GLOBAL VOID Client_SetHostname PARAMS((CLIENT *Client, CHAR *Hostname )); -GLOBAL VOID Client_SetID PARAMS((CLIENT *Client, CHAR *Nick )); -GLOBAL VOID Client_SetUser PARAMS((CLIENT *Client, CHAR *User, BOOLEAN Idented )); -GLOBAL VOID Client_SetInfo PARAMS((CLIENT *Client, CHAR *Info )); -GLOBAL VOID Client_SetPassword PARAMS((CLIENT *Client, CHAR *Pwd )); -GLOBAL VOID Client_SetType PARAMS((CLIENT *Client, INT Type )); -GLOBAL VOID Client_SetHops PARAMS((CLIENT *Client, INT Hops )); -GLOBAL VOID Client_SetToken PARAMS((CLIENT *Client, INT Token )); -GLOBAL VOID Client_SetOperByMe PARAMS((CLIENT *Client, BOOLEAN OperByMe )); -GLOBAL VOID Client_SetModes PARAMS((CLIENT *Client, CHAR *Modes )); -GLOBAL VOID Client_SetFlags PARAMS((CLIENT *Client, CHAR *Flags )); -GLOBAL VOID Client_SetIntroducer PARAMS((CLIENT *Client, CLIENT *Introducer )); -GLOBAL VOID Client_SetAway PARAMS((CLIENT *Client, CHAR *Txt )); - -GLOBAL BOOLEAN Client_ModeAdd 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_CheckID PARAMS((CLIENT *Client, CHAR *ID )); - -GLOBAL LONG Client_UserCount PARAMS((VOID )); -GLOBAL LONG Client_ServiceCount PARAMS((VOID )); -GLOBAL LONG Client_ServerCount PARAMS((VOID )); -GLOBAL LONG Client_OperCount PARAMS((VOID )); -GLOBAL LONG Client_UnknownCount PARAMS((VOID )); -GLOBAL LONG Client_MyUserCount PARAMS((VOID )); -GLOBAL LONG Client_MyServiceCount PARAMS((VOID )); -GLOBAL LONG Client_MyServerCount PARAMS((VOID )); -GLOBAL LONG Client_MaxUserCount PARAMS(( VOID )); -GLOBAL LONG Client_MyMaxUserCount PARAMS(( VOID )); +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_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 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_GetFromConn PARAMS(( CONN_ID Idx )); +GLOBAL CLIENT *Client_GetFromToken PARAMS(( CLIENT *Client, INT Token )); + +GLOBAL CLIENT *Client_Search PARAMS(( CHAR *ID )); +GLOBAL CLIENT *Client_First PARAMS(( VOID )); +GLOBAL CLIENT *Client_Next PARAMS(( CLIENT *c )); + +GLOBAL INT Client_Type PARAMS(( CLIENT *Client )); +GLOBAL CONN_ID Client_Conn PARAMS(( CLIENT *Client )); +GLOBAL CHAR *Client_ID PARAMS(( CLIENT *Client )); +GLOBAL CHAR *Client_Mask PARAMS(( CLIENT *Client )); +GLOBAL CHAR *Client_Info PARAMS(( CLIENT *Client )); +GLOBAL CHAR *Client_User PARAMS(( CLIENT *Client )); +GLOBAL CHAR *Client_Hostname PARAMS(( CLIENT *Client )); +GLOBAL CHAR *Client_Password PARAMS(( CLIENT *Client )); +GLOBAL CHAR *Client_Modes PARAMS(( CLIENT *Client )); +GLOBAL CHAR *Client_Flags PARAMS(( CLIENT *Client )); +GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client )); +GLOBAL BOOLEAN Client_OperByMe PARAMS(( CLIENT *Client )); +GLOBAL INT Client_Hops PARAMS(( CLIENT *Client )); +GLOBAL INT Client_Token PARAMS(( CLIENT *Client )); +GLOBAL INT Client_MyToken PARAMS(( CLIENT *Client )); +GLOBAL CLIENT *Client_TopServer PARAMS(( CLIENT *Client )); +GLOBAL CLIENT *Client_NextHop PARAMS(( CLIENT *Client )); +GLOBAL CHAR *Client_Away PARAMS(( CLIENT *Client )); + +GLOBAL BOOLEAN Client_HasMode PARAMS(( CLIENT *Client, CHAR Mode )); + +GLOBAL VOID Client_SetHostname PARAMS(( CLIENT *Client, CHAR *Hostname )); +GLOBAL VOID Client_SetID PARAMS(( CLIENT *Client, CHAR *Nick )); +GLOBAL VOID Client_SetUser PARAMS(( CLIENT *Client, CHAR *User, BOOLEAN Idented )); +GLOBAL VOID Client_SetInfo PARAMS(( CLIENT *Client, CHAR *Info )); +GLOBAL VOID Client_SetPassword PARAMS(( CLIENT *Client, CHAR *Pwd )); +GLOBAL VOID Client_SetType PARAMS(( CLIENT *Client, INT Type )); +GLOBAL VOID Client_SetHops PARAMS(( CLIENT *Client, INT Hops )); +GLOBAL VOID Client_SetToken PARAMS(( CLIENT *Client, INT Token )); +GLOBAL VOID Client_SetOperByMe PARAMS(( CLIENT *Client, BOOLEAN OperByMe )); +GLOBAL VOID Client_SetModes PARAMS(( CLIENT *Client, CHAR *Modes )); +GLOBAL VOID Client_SetFlags PARAMS(( CLIENT *Client, CHAR *Flags )); +GLOBAL VOID Client_SetIntroducer PARAMS(( CLIENT *Client, CLIENT *Introducer )); +GLOBAL VOID Client_SetAway PARAMS(( CLIENT *Client, CHAR *Txt )); + +GLOBAL BOOLEAN Client_ModeAdd 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_CheckID PARAMS(( CLIENT *Client, CHAR *ID )); + +GLOBAL LONG Client_UserCount PARAMS(( VOID )); +GLOBAL LONG Client_ServiceCount PARAMS(( VOID )); +GLOBAL LONG Client_ServerCount PARAMS(( VOID )); +GLOBAL LONG Client_OperCount PARAMS(( VOID )); +GLOBAL LONG Client_UnknownCount PARAMS(( VOID )); +GLOBAL LONG Client_MyUserCount PARAMS(( VOID )); +GLOBAL LONG Client_MyServiceCount PARAMS(( VOID )); +GLOBAL LONG Client_MyServerCount PARAMS(( VOID )); +GLOBAL LONG Client_MaxUserCount PARAMS(( VOID )); +GLOBAL LONG Client_MyMaxUserCount PARAMS(( VOID )); -GLOBAL BOOLEAN Client_IsValidNick PARAMS((CHAR *Nick )); +GLOBAL BOOLEAN Client_IsValidNick PARAMS(( CHAR *Nick )); #endif Index: src/ngircd/conf.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/conf.c,v retrieving revision 1.47 retrieving revision 1.57.2.2 diff -u -u -r1.47 -r1.57.2.2 --- src/ngircd/conf.c 18 Dec 2002 02:53:36 -0000 1.47 +++ src/ngircd/conf.c 29 Apr 2003 12:37:18 -0000 1.57.2.2 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: conf.c,v 1.47 2002/12/18 02:53:36 alex Exp $"; +static char UNUSED id[] = "$Id: conf.c,v 1.57.2.2 2003/04/29 12:37:18 alex Exp $"; #include "imp.h" #include @@ -46,9 +46,11 @@ LOCAL BOOLEAN Use_Log = TRUE; +LOCAL CONF_SERVER New_Server; +LOCAL INT New_Server_Idx; -LOCAL VOID Set_Defaults PARAMS(( VOID )); +LOCAL VOID Set_Defaults PARAMS(( BOOLEAN InitServers )); LOCAL VOID Read_Config PARAMS(( VOID )); LOCAL VOID Validate_Config PARAMS(( BOOLEAN TestOnly )); @@ -59,16 +61,27 @@ LOCAL VOID Config_Error PARAMS(( CONST INT Level, CONST CHAR *Format, ... )); +LOCAL VOID Init_Server_Struct PARAMS(( CONF_SERVER *Server )); + GLOBAL VOID Conf_Init( VOID ) { - Set_Defaults( ); + Set_Defaults( TRUE ); Read_Config( ); Validate_Config( FALSE ); } /* Config_Init */ +GLOBAL VOID +Conf_Rehash( VOID ) +{ + Set_Defaults( FALSE ); + Read_Config( ); + Validate_Config( FALSE ); +} /* Config_Rehash */ + + GLOBAL INT Conf_Test( VOID ) { @@ -79,7 +92,7 @@ INT i; Use_Log = FALSE; - Set_Defaults( ); + Set_Defaults( TRUE ); Read_Config( ); Validate_Config( TRUE ); @@ -95,7 +108,7 @@ puts( "[GLOBAL]" ); printf( " ServerName = %s\n", Conf_ServerName ); printf( " ServerInfo = %s\n", Conf_ServerInfo ); - printf( " ServerPwd = %s\n", Conf_ServerPwd ); + printf( " Password = %s\n", Conf_ServerPwd ); printf( " AdminInfo1 = %s\n", Conf_ServerAdmin1 ); printf( " AdminInfo2 = %s\n", Conf_ServerAdmin2 ); printf( " AdminEMail = %s\n", Conf_ServerAdminMail ); @@ -134,7 +147,7 @@ puts( "" ); } - for( i = 0; i < Conf_Server_Count; i++ ) + for( i = 0; i < MAX_SERVERS; i++ ) { if( ! Conf_Server[i].name[0] ) continue; @@ -165,20 +178,166 @@ } /* 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 -Set_Defaults( VOID ) +Set_Defaults( BOOLEAN InitServers ) { /* Initialize configuration variables with default values. */ + INT i; + strcpy( Conf_ServerName, "" ); - sprintf( Conf_ServerInfo, "%s %s", PACKAGE, VERSION ); + sprintf( Conf_ServerInfo, "%s %s", PACKAGE_NAME, PACKAGE_VERSION ); strcpy( Conf_ServerPwd, "" ); strcpy( Conf_ServerAdmin1, "" ); strcpy( Conf_ServerAdmin2, "" ); strcpy( Conf_ServerAdminMail, "" ); - strcpy( Conf_MotdFile, MOTD_FILE ); + strlcpy( Conf_MotdFile, SYSCONFDIR, sizeof( Conf_MotdFile )); + strlcat( Conf_MotdFile, MOTD_FILE, sizeof( Conf_MotdFile )); Conf_ListenPorts_Count = 0; @@ -190,13 +349,15 @@ Conf_ConnectRetry = 60; Conf_Oper_Count = 0; - Conf_Server_Count = 0; Conf_Channel_Count = 0; Conf_OperCanMode = FALSE; Conf_MaxConnections = -1; Conf_MaxJoins = 10; + + /* Initialize server configuration structures */ + if( InitServers ) for( i = 0; i < MAX_SERVERS; Init_Server_Struct( &Conf_Server[i++] )); } /* Set_Defaults */ @@ -206,22 +367,63 @@ /* Read configuration file. */ CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr; - INT line; + INT line, i, n; FILE *fd; + /* Open configuration file */ fd = fopen( NGIRCd_ConfFile, "r" ); if( ! fd ) { /* No configuration file found! */ 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 ); + Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); exit( 1 ); } 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; strcpy( section, "" ); + Init_Server_Struct( &New_Server ); + New_Server_Idx = NONE; + + /* Read configuration file */ while( TRUE ) { if( ! fgets( str, LINE_LEN, fd )) break; @@ -234,7 +436,7 @@ /* Is this the beginning of a new section? */ if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' )) { - strcpy( section, str ); + strlcpy( section, str, sizeof( section )); if( strcasecmp( section, "[GLOBAL]" ) == 0 ) continue; if( strcasecmp( section, "[OPERATOR]" ) == 0 ) { @@ -250,21 +452,30 @@ } if( strcasecmp( section, "[SERVER]" ) == 0 ) { - if( Conf_Server_Count + 1 > MAX_SERVERS ) Config_Error( LOG_ERR, "Too many servers configured." ); - else + /* Check if there is already a server to add */ + if( New_Server.name[0] ) { - /* Initialize new server structure */ - strcpy( Conf_Server[Conf_Server_Count].host, "" ); - 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++; + /* Copy data to "real" server structure */ + assert( New_Server_Idx > NONE ); + Conf_Server[New_Server_Idx] = New_Server; } + + /* 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; } if( strcasecmp( section, "[CHANNEL]" ) == 0 ) @@ -302,8 +513,17 @@ else if( strcasecmp( section, "[CHANNEL]" ) == 0 ) Handle_CHANNEL( line, var, arg ); else Config_Error( LOG_ERR, "%s, line %d: Variable \"%s\" outside section!", NGIRCd_ConfFile, line, var ); } - + + /* Close configuration file */ 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( Conf_ListenPorts_Count < 1 ) @@ -329,49 +549,37 @@ if( strcasecmp( Var, "Name" ) == 0 ) { /* Server name */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "Info" ) == 0 ) { /* Info text of server */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "Password" ) == 0 ) { /* Global server password */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "AdminInfo1" ) == 0 ) { /* Administrative info #1 */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "AdminInfo2" ) == 0 ) { /* Administrative info #2 */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "AdminEMail" ) == 0 ) { /* Administrative email contact */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "Ports" ) == 0 ) @@ -396,9 +604,7 @@ if( strcasecmp( Var, "MotdFile" ) == 0 ) { /* "Message of the day" (MOTD) file */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "ServerUID" ) == 0 ) @@ -509,17 +715,13 @@ if( strcasecmp( Var, "Name" ) == 0 ) { /* Name of IRC operator */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "Password" ) == 0 ) { /* Password of IRC operator */ - 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 ); + 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 ); return; } @@ -536,43 +738,38 @@ assert( Var != 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 ) { /* Hostname of the server */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "Name" ) == 0 ) { /* Name of the server ("Nick"/"ID") */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "MyPassword" ) == 0 ) { /* Password of this server which is sent to the peer */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "PeerPassword" ) == 0 ) { /* Passwort of the peer which must be received */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "Port" ) == 0 ) { /* Port to which this server should connect */ port = atol( Arg ); - if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = (INT)port; + if( port > 0 && port < 0xFFFF ) New_Server.port = (INT)port; else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port ); return; } @@ -583,7 +780,7 @@ if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Group\" is not a number!", NGIRCd_ConfFile, Line ); else #endif - Conf_Server[Conf_Server_Count - 1].group = atoi( Arg ); + New_Server.group = atoi( Arg ); return; } @@ -601,25 +798,19 @@ if( strcasecmp( Var, "Name" ) == 0 ) { /* Name of the channel */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "Modes" ) == 0 ) { /* Initial modes */ - 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 ); + 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 ); return; } if( strcasecmp( Var, "Topic" ) == 0 ) { /* Initial topic */ - 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 ); + 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 ); return; } @@ -631,14 +822,29 @@ Validate_Config( BOOLEAN Configtest ) { /* Validate configuration settings. */ - + +#ifdef DEBUG + INT i, servers, servers_once; +#endif + if( ! Conf_ServerName[0] ) { /* No server name configured! */ Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile ); if( ! Configtest ) { - Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE ); + Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); + exit( 1 ); + } + } + + if( ! strchr( Conf_ServerName, '.' )) + { + /* No dot in server name! */ + Config_Error( LOG_ALERT, "Invalid server name configured in \"%s\" ('ServerName'): Dot missing!", NGIRCd_ConfFile ); + if( ! Configtest ) + { + Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); exit( 1 ); } } @@ -650,7 +856,7 @@ Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile ); if( ! Configtest ) { - Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE ); + Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); exit( 1 ); } } @@ -670,6 +876,19 @@ #else Config_Error( LOG_WARN, "Don't know how many file descriptors select() can handle on this system, don't set MaxConnections too high!" ); #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 */ @@ -703,6 +922,28 @@ if( Use_Log ) Log( Level, "%s", msg ); else puts( msg ); } /* 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- */ Index: src/ngircd/conf.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/conf.h,v retrieving revision 1.24 retrieving revision 1.26 diff -u -u -r1.24 -r1.26 --- src/ngircd/conf.h 14 Dec 2002 13:36:19 -0000 1.24 +++ src/ngircd/conf.h 31 Dec 2002 16:12:50 -0000 1.26 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: conf.h,v 1.24 2002/12/14 13:36:19 alex Exp $ + * $Id: conf.h,v 1.26 2002/12/31 16:12:50 alex Exp $ * * Configuration management (header) */ @@ -39,6 +39,8 @@ INT group; /* Group of server */ time_t lasttry; /* Last connect attempt */ RES_STAT *res_stat; /* Status of the resolver */ + INT flags; /* Flags */ + CONN_ID conn_id; /* ID of server connection or NONE */ } CONF_SERVER; typedef struct _Conf_Channel @@ -49,6 +51,10 @@ } 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 */ GLOBAL CHAR Conf_ServerName[CLIENT_ID_LEN]; @@ -87,7 +93,6 @@ /* Servers */ GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS]; -GLOBAL INT Conf_Server_Count; /* Pre-defined channels */ GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS]; @@ -104,7 +109,16 @@ GLOBAL VOID Conf_Init PARAMS((VOID )); +GLOBAL VOID Conf_Rehash 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 Index: src/ngircd/conn.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/conn.c,v retrieving revision 1.106 retrieving revision 1.122.2.1 diff -u -u -r1.106 -r1.122.2.1 --- src/ngircd/conn.c 18 Dec 2002 13:50:22 -0000 1.106 +++ src/ngircd/conn.c 25 Apr 2003 16:50:53 -0000 1.122.2.1 @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) + * 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 @@ -12,9 +12,11 @@ */ +#define CONN_MODULE + #include "portab.h" -static char UNUSED id[] = "$Id: conn.c,v 1.106 2002/12/18 13:50:22 alex Exp $"; +static char UNUSED id[] = "$Id: conn.c,v 1.122.2.1 2003/04/25 16:50:53 alex Exp $"; #include "imp.h" #include @@ -38,71 +40,39 @@ #endif #ifdef HAVE_STDINT_H -#include /* u.a. fuer Mac OS X */ +#include /* e.g. for Mac OS X */ #endif -#ifdef USE_ZLIB -#include +#ifdef USE_TCPWRAP +#include /* for TCP Wrappers */ #endif +#include "defines.h" +#include "resolve.h" + #include "exp.h" #include "conn.h" #include "imp.h" #include "ngircd.h" #include "client.h" -#include "resolve.h" #include "conf.h" +#include "conn-zip.h" +#include "conn-func.h" #include "log.h" #include "parse.h" #include "tool.h" +#ifdef RENDEZVOUS +#include "rendezvous.h" +#endif + #include "exp.h" #define SERVER_WAIT (NONE - 1) -#ifdef USE_ZLIB -typedef struct _ZipData -{ - z_stream in; /* "Handle" fuer Input-Stream */ - z_stream out; /* "Handle" fuer Output-Stream */ - CHAR rbuf[READBUFFER_LEN]; /* Lesepuffer */ - INT rdatalen; /* Laenge der Daten im Lesepuffer (komprimiert) */ - CHAR wbuf[WRITEBUFFER_LEN]; /* Schreibpuffer */ - INT wdatalen; /* Laenge der Daten im Schreibpuffer (unkomprimiert) */ - LONG bytes_in, bytes_out; /* Counter fuer Statistik (unkomprimiert!) */ -} ZIPDATA; -#endif - - -typedef struct _Connection -{ - INT sock; /* Socket Handle */ - struct sockaddr_in addr; /* Adresse des Client */ - RES_STAT *res_stat; /* "Resolver-Status", s.o. */ - CHAR host[HOST_LEN]; /* Hostname */ - CHAR rbuf[READBUFFER_LEN]; /* Lesepuffer */ - INT rdatalen; /* Laenge der Daten im Lesepuffer */ - CHAR wbuf[WRITEBUFFER_LEN]; /* Schreibpuffer */ - INT wdatalen; /* Laenge der Daten im Schreibpuffer */ - INT our_server; /* wenn von uns zu connectender Server: ID */ - time_t starttime; /* Startzeit des Links */ - time_t lastdata; /* Letzte Aktivitaet */ - time_t lastping; /* Letzter PING */ - time_t lastprivmsg; /* Letzte PRIVMSG */ - time_t delaytime; /* Nicht beachten bis ("penalty") */ - LONG bytes_in, bytes_out; /* Empfangene uns gesendete Bytes */ - LONG msg_in, msg_out; /* Empfangene uns gesendete Nachtichten */ - INT flag; /* "Markierungs-Flag" (vgl. "irc-write"-Modul) */ - INT options; /* Link-Optionen */ -#ifdef USE_ZLIB - ZIPDATA zip; /* Kompressionsinformationen */ -#endif -} CONNECTION; - - LOCAL VOID Handle_Read PARAMS(( INT sock )); LOCAL BOOLEAN Handle_Write PARAMS(( CONN_ID Idx )); LOCAL VOID New_Connection PARAMS(( INT Sock )); @@ -112,24 +82,20 @@ LOCAL BOOLEAN Handle_Buffer PARAMS(( CONN_ID Idx )); LOCAL VOID Check_Connections PARAMS(( VOID )); LOCAL VOID Check_Servers PARAMS(( VOID )); -LOCAL VOID Init_Conn_Struct PARAMS(( LONG Idx )); +LOCAL VOID Init_Conn_Struct PARAMS(( CONN_ID Idx )); LOCAL BOOLEAN Init_Socket PARAMS(( INT Sock )); LOCAL VOID New_Server PARAMS(( INT Server, CONN_ID Idx )); LOCAL VOID Read_Resolver_Result PARAMS(( INT r_fd )); - -#ifdef USE_ZLIB -LOCAL BOOLEAN Zip_Buffer PARAMS(( CONN_ID Idx, CHAR *Data, INT Len )); -LOCAL BOOLEAN Zip_Flush PARAMS(( CONN_ID Idx )); -LOCAL BOOLEAN Unzip_Buffer PARAMS(( CONN_ID Idx )); -#endif - +LOCAL VOID Simple_Message PARAMS(( INT Sock, CHAR *Msg )); LOCAL fd_set My_Listeners; LOCAL fd_set My_Sockets; LOCAL fd_set My_Connects; -LOCAL CONNECTION *My_Connections; -LOCAL LONG Pool_Size, WCounter; +#ifdef USE_TCPWRAP +INT allow_severity = LOG_INFO; +INT deny_severity = LOG_ERR; +#endif GLOBAL VOID @@ -153,7 +119,7 @@ Log( LOG_EMERG, "Can't allocate memory! [Conn_Init]" ); exit( 1 ); } - Log( LOG_DEBUG, "Allocted connection pool for %ld items (%ld bytes).", Pool_Size, sizeof( CONNECTION ) * Pool_Size ); + Log( LOG_DEBUG, "Allocted connection pool for %d items (%ld bytes).", Pool_Size, sizeof( CONNECTION ) * Pool_Size ); /* zu Beginn haben wir keine Verbindungen */ FD_ZERO( &My_Listeners ); @@ -180,8 +146,13 @@ CONN_ID idx; INT i; - /* Sockets schliessen */ Log( LOG_DEBUG, "Shutting down all connections ..." ); + +#ifdef RENDEZVOUS + Rendezvous_UnregisterListeners( ); +#endif + + /* Sockets schliessen */ for( i = 0; i < Conn_MaxFD + 1; i++ ) { if( FD_ISSET( i, &My_Sockets )) @@ -202,7 +173,7 @@ } else if( idx < Pool_Size ) { - if( NGIRCd_Restart ) Conn_Close( idx, NULL, "Server going down (restarting)", TRUE ); + if( NGIRCd_SignalRestart ) Conn_Close( idx, NULL, "Server going down (restarting)", TRUE ); else Conn_Close( idx, NULL, "Server going down", TRUE ); } else @@ -212,7 +183,7 @@ } } } - + free( My_Connections ); My_Connections = NULL; Pool_Size = 0; @@ -222,8 +193,7 @@ GLOBAL INT Conn_InitListeners( VOID ) { - /* Ports, auf denen der Server Verbindungen entgegennehmen - * soll, initialisieren */ + /* Initialize ports on which the server should accept connections */ INT created, i; @@ -240,10 +210,14 @@ GLOBAL VOID Conn_ExitListeners( VOID ) { - /* Alle "Listen-Sockets" schliessen */ + /* Close down all listening sockets */ INT i; +#ifdef RENDEZVOUS + Rendezvous_UnregisterListeners( ); +#endif + Log( LOG_INFO, "Shutting down all listening sockets ..." ); for( i = 0; i < Conn_MaxFD + 1; i++ ) { @@ -259,12 +233,13 @@ GLOBAL BOOLEAN Conn_NewListener( CONST UINT Port ) { - /* Neuen Listen-Socket erzeugen: der Server wartet dann auf - * dem angegebenen Port auf Verbindungen. Kann der Listen- - * Socket nicht erteugt werden, so wird NULL geliefert.*/ + /* Create new listening socket on specified port */ struct sockaddr_in addr; INT sock; +#ifdef RENDEZVOUS + CHAR name[CLIENT_ID_LEN], *info; +#endif /* Server-"Listen"-Socket initialisieren */ memset( &addr, 0, sizeof( addr )); @@ -306,6 +281,34 @@ Log( LOG_INFO, "Now listening on port %d (socket %d).", Port, sock ); +#ifdef RENDEZVOUS + /* Get best server description text */ + if( ! Conf_ServerInfo[0] ) info = Conf_ServerName; + else + { + /* Use server info string */ + info = NULL; + if( Conf_ServerInfo[0] == '[' ) + { + /* Cut off leading hostname part in "[]" */ + info = strchr( Conf_ServerInfo, ']' ); + if( info ) + { + info++; + while( *info == ' ' ) info++; + } + } + if( ! info ) info = Conf_ServerInfo; + } + + /* Add port number to description if non-standard */ + if( Port != 6667 ) snprintf( name, sizeof( name ), "%s (port %u)", info, Port ); + else strlcpy( name, info, sizeof( name )); + + /* Register service */ + Rendezvous_Register( name, RENDEZVOUS_TYPE, Port ); +#endif + return TRUE; } /* Conn_NewListener */ @@ -328,16 +331,23 @@ fd_set read_sockets, write_sockets; struct timeval tv; time_t start, t; - LONG i, idx; + CONN_ID i, idx; BOOLEAN timeout; start = time( NULL ); - while(( ! NGIRCd_Quit ) && ( ! NGIRCd_Restart )) + while(( ! NGIRCd_SignalQuit ) && ( ! NGIRCd_SignalRestart )) { timeout = TRUE; - - Check_Servers( ); +#ifdef RENDEZVOUS + Rendezvous_Handler( ); +#endif + + /* Should the configuration be reloaded? */ + if( NGIRCd_SignalRehash ) NGIRCd_Rehash( ); + + /* Check configured servers and established links */ + Check_Servers( ); Check_Connections( ); /* noch volle Lese-Buffer suchen */ @@ -364,6 +374,7 @@ FD_SET( My_Connections[i].sock, &write_sockets ); } } + /* Sockets mit im Aufbau befindlichen ausgehenden Verbindungen suchen */ for( i = 0; i < Pool_Size; i++ ) { @@ -389,7 +400,6 @@ { /* Fuer die Verbindung ist eine "Penalty-Zeit" gesetzt */ FD_CLR( My_Connections[i].sock, &read_sockets ); - FD_CLR( My_Connections[i].sock, &write_sockets ); } } for( i = 0; i < Conn_MaxFD + 1; i++ ) @@ -405,7 +415,7 @@ tv.tv_usec = 0; if( timeout ) tv.tv_sec = TIME_RES; else tv.tv_sec = 0; - + /* Auf Aktivitaet warten */ i = select( Conn_MaxFD + 1, &read_sockets, &write_sockets, NULL, &tv ); if( i == 0 ) @@ -419,7 +429,7 @@ if( errno != EINTR ) { Log( LOG_EMERG, "Conn_Handler(): select(): %s!", strerror( errno )); - Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE ); + Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); exit( 1 ); } continue; @@ -433,7 +443,7 @@ /* Es kann geschrieben werden ... */ idx = Socket2Index( i ); if( idx == NONE ) continue; - + if( ! Handle_Write( idx )) { /* Fehler beim Schreiben! Diesen Socket nun @@ -448,6 +458,9 @@ if( FD_ISSET( i, &read_sockets )) Handle_Read( i ); } } + + if( NGIRCd_SignalQuit ) Log( LOG_NOTICE|LOG_snotice, "Server going down NOW!" ); + else if( NGIRCd_SignalRestart ) Log( LOG_NOTICE|LOG_snotice, "Server restarting NOW!" ); } /* Conn_Handler */ @@ -489,7 +502,7 @@ if( NGIRCd_Sniffer ) Log( LOG_DEBUG, " -> connection %d: '%s'.", Idx, buffer ); #endif - strcat( buffer, "\r\n" ); + strlcat( buffer, "\r\n", sizeof( buffer )); ok = Conn_Write( Idx, buffer, strlen( buffer )); My_Connections[Idx].msg_out++; @@ -561,8 +574,8 @@ GLOBAL VOID Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient ) { - /* Verbindung schliessen. Evtl. noch von Resolver - * Sub-Prozessen offene Pipes werden geschlossen. */ + /* Close connection. Open pipes of asyncronous resolver + * sub-processes are closed down. */ CLIENT *c; DOUBLE in_k, out_k; @@ -574,80 +587,90 @@ assert( Idx > NONE ); assert( My_Connections[Idx].sock > NONE ); + /* Is this link already shutting down? */ + if( My_Connections[Idx].options & CONN_ISCLOSING ) + { + /* Conn_Close() has been called recursively for this link; + * probabe reason: Try_Write() failed -- see below. */ + return; + } + + /* Mark link as "closing" */ + My_Connections[Idx].options |= CONN_ISCLOSING; + + /* Search client, if any */ c = Client_GetFromConn( Idx ); + /* Should the client be informed? */ if( InformClient ) { #ifndef STRICT_RFC - /* Statistik an Client melden, wenn User */ + /* Send statistics to client if registered as user: */ if(( c != NULL ) && ( Client_Type( c ) == CLIENT_USER )) { Conn_WriteStr( Idx, "NOTICE %s :%sConnection statistics: client %.1f kb, server %.1f kb.", Client_ThisServer( ), NOTICE_TXTPREFIX, (DOUBLE)My_Connections[Idx].bytes_in / 1024, (DOUBLE)My_Connections[Idx].bytes_out / 1024 ); } #endif - /* ERROR an Client schicken (von RFC so vorgesehen!) */ + /* Send ERROR to client (see RFC!) */ if( FwdMsg ) Conn_WriteStr( Idx, "ERROR :%s", FwdMsg ); else Conn_WriteStr( Idx, "ERROR :Closing connection." ); if( My_Connections[Idx].sock == NONE ) return; } - /* zunaechst versuchen, noch im Schreibpuffer vorhandene - * Daten auf den Socket zu schreiben ... */ - Try_Write( Idx ); + /* Try to write out the write buffer */ + (VOID)Try_Write( Idx ); + /* Shut down socket */ if( close( My_Connections[Idx].sock ) != 0 ) { - Log( LOG_ERR, "Error closing connection %d (socket %d) with %s:%d - %s!", Idx, My_Connections[Idx].sock, My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port), strerror( errno )); - } - else - { - in_k = (DOUBLE)My_Connections[Idx].bytes_in / 1024; - out_k = (DOUBLE)My_Connections[Idx].bytes_out / 1024; -#ifdef USE_ZLIB - if( My_Connections[Idx].options & CONN_ZIP ) - { - in_z_k = (DOUBLE)My_Connections[Idx].zip.bytes_in / 1024; - out_z_k = (DOUBLE)My_Connections[Idx].zip.bytes_out / 1024; - in_p = (INT)(( in_k * 100 ) / in_z_k ); - out_p = (INT)(( out_k * 100 ) / out_z_k ); - Log( LOG_INFO, "Connection %d with %s:%d closed (in: %.1fk/%.1fk/%d%%, out: %.1fk/%.1fk/%d%%).", Idx, My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port ), in_k, in_z_k, in_p, out_k, out_z_k, out_p ); - } - else -#endif - { - Log( LOG_INFO, "Connection %d with %s:%d closed (in: %.1fk, out: %.1fk).", Idx, My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port ), in_k, out_k ); - } + /* Oops, we can't close the socket!? This is fatal! */ + Log( LOG_EMERG, "Error closing connection %d (socket %d) with %s:%d - %s!", Idx, My_Connections[Idx].sock, My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port), strerror( errno )); + Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); + exit( 1 ); } - - /* Socket als "ungueltig" markieren */ + + /* Mark socket as invalid: */ FD_CLR( My_Connections[Idx].sock, &My_Sockets ); FD_CLR( My_Connections[Idx].sock, &My_Connects ); My_Connections[Idx].sock = NONE; + /* If there is still a client, unregister it now */ if( c ) Client_Destroy( c, LogMsg, FwdMsg, TRUE ); + /* Calculate statistics and log information */ + in_k = (DOUBLE)My_Connections[Idx].bytes_in / 1024; + out_k = (DOUBLE)My_Connections[Idx].bytes_out / 1024; +#ifdef USE_ZLIB + if( My_Connections[Idx].options & CONN_ZIP ) + { + in_z_k = (DOUBLE)My_Connections[Idx].zip.bytes_in / 1024; + out_z_k = (DOUBLE)My_Connections[Idx].zip.bytes_out / 1024; + in_p = (INT)(( in_k * 100 ) / in_z_k ); + out_p = (INT)(( out_k * 100 ) / out_z_k ); + Log( LOG_INFO, "Connection %d with %s:%d closed (in: %.1fk/%.1fk/%d%%, out: %.1fk/%.1fk/%d%%).", Idx, My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port ), in_k, in_z_k, in_p, out_k, out_z_k, out_p ); + } + else +#endif + { + Log( LOG_INFO, "Connection %d with %s:%d closed (in: %.1fk, out: %.1fk).", Idx, My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port ), in_k, out_k ); + } + + /* Is there a resolver sub-process running? */ if( My_Connections[Idx].res_stat ) { - /* Resolver-Strukturen freigeben, wenn noch nicht geschehen */ + /* Free resolver structures */ FD_CLR( My_Connections[Idx].res_stat->pipe[0], &Resolver_FDs ); close( My_Connections[Idx].res_stat->pipe[0] ); close( My_Connections[Idx].res_stat->pipe[1] ); free( My_Connections[Idx].res_stat ); } - /* Startzeit des naechsten Connect-Versuchs modifizieren? */ - if(( My_Connections[Idx].our_server > NONE ) && ( Conf_Server[My_Connections[Idx].our_server].lasttry < time( NULL ) - Conf_ConnectRetry )) - { - /* Okay, die Verbindung stand schon "genuegend lange": - * lasttry-Zeitpunkt so setzen, dass der naechste - * Verbindungsversuch in RECONNECT_DELAY Sekunden - * gestartet wird. */ - Conf_Server[My_Connections[Idx].our_server].lasttry = time( NULL ) - Conf_ConnectRetry + RECONNECT_DELAY; - } + /* Servers: Modify time of next connect attempt? */ + Conf_UnsetServer( Idx ); #ifdef USE_ZLIB - /* Ggf. zlib abmelden */ + /* Clean up zlib, if link was compressed */ if( Conn_Options( Idx ) & CONN_ZIP ) { inflateEnd( &My_Connections[Idx].zip.in ); @@ -655,336 +678,40 @@ } #endif - /* Connection-Struktur loeschen (=freigeben) */ + /* Clean up connection structure (=free it) */ Init_Conn_Struct( Idx ); } /* Conn_Close */ 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 ) +Conn_SyncServerStruct( VOID ) { - assert( Idx > NONE ); - My_Connections[Idx].delaytime = 0; -} /* Conn_ResetPenalty */ + /* Synchronize server structures (connection IDs): + * connections <-> configuration */ + CLIENT *client; + CONN_ID i; + INT c; -GLOBAL VOID -Conn_ClearFlags( VOID ) -{ - /* Alle Connection auf "nicht-markiert" setzen */ - - LONG 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. */ - - LONG 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. */ - - LONG 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_SetServer( CONN_ID Idx, INT ConfServer ) -{ - /* Connection als Server markieren: Index des konfigurierten - * Servers speichern. Verbindung muss bereits bestehen! */ - - assert( Idx > NONE ); - assert( My_Connections[Idx].sock > NONE ); - - My_Connections[Idx].our_server = ConfServer; -} /* Conn_SetServer */ - - -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 */ - - -#ifdef USE_ZLIB - -GLOBAL BOOLEAN -Conn_InitZip( CONN_ID Idx ) -{ - /* Kompression fuer Link initialisieren */ + /* Established connection? */ + if( My_Connections[i].sock <= NONE ) continue; - 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; + /* Server connection? */ + client = Client_GetFromConn( i ); + if(( ! client ) || ( Client_Type( client ) != CLIENT_SERVER )) continue; - 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; + for( c = 0; c < MAX_SERVERS; c++ ) + { + /* Configured server? */ + if( ! Conf_Server[c].host[0] ) continue; - 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; + /* Duplicate? */ + if( strcmp( Conf_Server[c].name, Client_ID( client )) == 0 ) Conf_Server[c].conn_id = i; + } } - - 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; -} /* Conn_InitZip */ - - -GLOBAL LONG -Conn_SendBytesZip( CONN_ID Idx ) -{ - /* Anzahl gesendeter Bytes (komprimiert!) liefern */ - - assert( Idx > NONE ); - return My_Connections[Idx].zip.bytes_out; -} /* Conn_SendBytesZip */ - - -GLOBAL LONG -Conn_RecvBytesZip( CONN_ID Idx ) -{ - /* Anzahl gesendeter Bytes (komprimiert!) liefern */ - - assert( Idx > NONE ); - return My_Connections[Idx].zip.bytes_in; -} /* Conn_RecvBytesZip */ - -#endif - - -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 */ +} /* SyncServerStruct */ LOCAL BOOLEAN @@ -1071,6 +798,8 @@ /* Daten aus Schreibpuffer versenden bzw. Connection aufbauen */ INT len, res, err; + socklen_t sock_len; + CLIENT *c; assert( Idx > NONE ); assert( My_Connections[Idx].sock > NONE ); @@ -1083,31 +812,34 @@ FD_CLR( My_Connections[Idx].sock, &My_Connects ); /* Ergebnis des connect() ermitteln */ - len = sizeof( err ); - res = getsockopt( My_Connections[Idx].sock, SOL_SOCKET, SO_ERROR, &err, &len ); - assert( len == sizeof( err )); + sock_len = sizeof( err ); + res = getsockopt( My_Connections[Idx].sock, SOL_SOCKET, SO_ERROR, &err, &sock_len ); + assert( sock_len == sizeof( err )); /* Fehler aufgetreten? */ if(( res != 0 ) || ( err != 0 )) { /* Fehler! */ if( res != 0 ) Log( LOG_CRIT, "getsockopt (connection %d): %s!", Idx, strerror( errno )); - else Log( LOG_CRIT, "Can't connect socket to \"%s:%d\" (connection %d): %s!", My_Connections[Idx].host, Conf_Server[My_Connections[Idx].our_server].port, Idx, strerror( err )); + else Log( LOG_CRIT, "Can't connect socket to \"%s:%d\" (connection %d): %s!", My_Connections[Idx].host, Conf_Server[Conf_GetServer( Idx )].port, Idx, strerror( err )); - /* Socket etc. pp. aufraeumen */ + /* Clean up socket, connection and client structures */ FD_CLR( My_Connections[Idx].sock, &My_Sockets ); + c = Client_GetFromConn( Idx ); + if( c ) Client_DestroyNow( c ); close( My_Connections[Idx].sock ); Init_Conn_Struct( Idx ); /* Bei Server-Verbindungen lasttry-Zeitpunkt auf "jetzt" setzen */ - Conf_Server[My_Connections[Idx].our_server].lasttry = time( NULL ); + Conf_Server[Conf_GetServer( Idx )].lasttry = time( NULL ); + Conf_UnsetServer( Idx ); return FALSE; } - Log( LOG_DEBUG, "Connection %d with \"%s:%d\" established, now sendig PASS and SERVER ...", Idx, My_Connections[Idx].host, Conf_Server[My_Connections[Idx].our_server].port ); + Log( LOG_DEBUG, "Connection %d with \"%s:%d\" established, now sendig PASS and SERVER ...", Idx, My_Connections[Idx].host, Conf_Server[Conf_GetServer( Idx )].port ); /* PASS und SERVER verschicken */ - Conn_WriteStr( Idx, "PASS %s %s", Conf_Server[My_Connections[Idx].our_server].pwd_out, NGIRCd_ProtoID ); + Conn_WriteStr( Idx, "PASS %s %s", Conf_Server[Conf_GetServer( Idx )].pwd_out, NGIRCd_ProtoID ); return Conn_WriteStr( Idx, "SERVER %s :%s", Conf_ServerName, Conf_ServerInfo ); } @@ -1146,6 +878,9 @@ /* Neue Client-Verbindung von Listen-Socket annehmen und * CLIENT-Struktur anlegen. */ +#ifdef USE_TCPWRAP + struct request_info req; +#endif struct sockaddr_in new_addr; INT new_sock, new_sock_len; RES_STAT *s; @@ -1165,6 +900,19 @@ return; } +#ifdef USE_TCPWRAP + /* Validate socket using TCP Wrappers */ + request_init( &req, RQ_DAEMON, PACKAGE_NAME, RQ_FILE, new_sock, RQ_CLIENT_SIN, &new_addr, NULL ); + if( ! hosts_access( &req )) + { + /* Access denied! */ + Log( deny_severity, "Refused connection from %s (by TCP Wrappers)!", inet_ntoa( new_addr.sin_addr )); + Simple_Message( new_sock, "ERROR :Connection refused" ); + close( new_sock ); + return; + } +#endif + /* Socket initialisieren */ Init_Socket( new_sock ); @@ -1173,10 +921,10 @@ if( idx >= Pool_Size ) { new_size = Pool_Size + CONNECTION_POOL; - + /* Im bisherigen Pool wurde keine freie Connection-Struktur mehr gefunden. * Wenn erlaubt und moeglich muss nun der Pool vergroessert werden: */ - + if( Conf_MaxConnections > 0 ) { /* Es ist ein Limit konfiguriert */ @@ -1184,12 +932,20 @@ { /* Mehr Verbindungen duerfen wir leider nicht mehr annehmen ... */ Log( LOG_ALERT, "Can't accept connection: limit (%d) reached!", Pool_Size ); + Simple_Message( new_sock, "ERROR :Connection limit reached" ); close( new_sock ); return; } if( new_size > Conf_MaxConnections ) new_size = Conf_MaxConnections; } - + if( new_size < Pool_Size ) + { + Log( LOG_ALERT, "Can't accespt connection: limit (%d) reached -- overflow!", Pool_Size ); + Simple_Message( new_sock, "ERROR :Connection limit reached" ); + close( new_sock ); + return; + } + /* zunaechst realloc() versuchen; wenn das scheitert, malloc() versuchen * und Daten ggf. "haendisch" umkopieren. (Haesslich! Eine wirklich * dynamische Verwaltung waere wohl _deutlich_ besser ...) */ @@ -1202,24 +958,25 @@ { /* Offenbar steht kein weiterer Sepeicher zur Verfuegung :-( */ Log( LOG_EMERG, "Can't allocate memory! [New_Connection]" ); + Simple_Message( new_sock, "ERROR: Internal error" ); close( new_sock ); return; } - + /* Struktur umkopieren ... */ memcpy( ptr, My_Connections, sizeof( CONNECTION ) * Pool_Size ); - + Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [malloc()/memcpy()]", new_size, sizeof( CONNECTION ) * new_size ); } else Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [realloc()]", new_size, sizeof( CONNECTION ) * new_size ); - + /* Adjust pointer to new block */ My_Connections = ptr; - + /* Initialize new items */ for( idx = Pool_Size; idx < new_size; idx++ ) Init_Conn_Struct( idx ); idx = Pool_Size; - + /* Adjust new pool size */ Pool_Size = new_size; } @@ -1229,6 +986,7 @@ if( ! c ) { Log( LOG_ALERT, "Can't accept connection: can't create client structure!" ); + Simple_Message( new_sock, "ERROR :Internal error" ); close( new_sock ); return; } @@ -1245,7 +1003,7 @@ Log( LOG_INFO, "Accepted connection %d from %s:%d on socket %d.", idx, inet_ntoa( new_addr.sin_addr ), ntohs( new_addr.sin_port), Sock ); /* Hostnamen ermitteln */ - strcpy( My_Connections[idx].host, inet_ntoa( new_addr.sin_addr )); + strlcpy( My_Connections[idx].host, inet_ntoa( new_addr.sin_addr ), sizeof( My_Connections[idx].host )); Client_SetHostname( c, My_Connections[idx].host ); s = Resolve_Addr( &new_addr ); if( s ) @@ -1253,7 +1011,7 @@ /* Sub-Prozess wurde asyncron gestartet */ My_Connections[idx].res_stat = s; } - + /* Penalty-Zeit setzen */ Conn_SetPenalty( idx, 4 ); } /* New_Connection */ @@ -1384,14 +1142,14 @@ if( ! Unzip_Buffer( Idx )) return FALSE; } #endif - + if( My_Connections[Idx].rdatalen < 1 ) break; /* Eine komplette Anfrage muss mit CR+LF enden, vgl. * RFC 2812. Haben wir eine? */ My_Connections[Idx].rbuf[My_Connections[Idx].rdatalen] = '\0'; ptr = strstr( My_Connections[Idx].rbuf, "\r\n" ); - + if( ptr ) delta = 2; #ifndef STRICT_RFC else @@ -1406,7 +1164,7 @@ else if( ptr2 ) ptr = ptr2; } #endif - + action = FALSE; if( ptr ) { @@ -1461,10 +1219,10 @@ } #endif } - + if( action ) result = TRUE; } while( action ); - + return result; } /* Handle_Buffer */ @@ -1477,7 +1235,7 @@ * auch das nicht "hilft", Client disconnectieren. */ CLIENT *c; - LONG i; + CONN_ID i; for( i = 0; i < Pool_Size; i++ ) { @@ -1522,51 +1280,45 @@ LOCAL VOID Check_Servers( VOID ) { - /* Pruefen, ob Server-Verbindungen aufgebaut werden - * muessen bzw. koennen */ + /* Check if we can establish further server links */ RES_STAT *s; - LONG idx, n; - INT i; - - /* Wenn "Passive-Mode" aktiv: nicht verbinden */ - if( NGIRCd_Passive ) return; + CONN_ID idx; + INT i, n; - for( i = 0; i < Conf_Server_Count; i++ ) + /* Serach all connections, are there results from the resolver? */ + for( idx = 0; idx < Pool_Size; idx++ ) { - /* Ist ein Hostname und Port definiert? */ - if(( ! Conf_Server[i].host[0] ) || ( ! Conf_Server[i].port > 0 )) continue; + if( My_Connections[idx].sock != SERVER_WAIT ) continue; - /* Haben wir schon eine Verbindung? */ - for( n = 0; n < Pool_Size; n++ ) - { - if( My_Connections[n].sock == NONE ) continue; - - /* Verbindung zu diesem Server? */ - if( My_Connections[n].our_server == i ) - { - /* Komplett aufgebaute Verbindung? */ - if( My_Connections[n].sock > NONE ) break; + /* IP resolved? */ + if( My_Connections[idx].res_stat == NULL ) New_Server( Conf_GetServer( idx ), idx ); + } - /* IP schon aufgeloest? */ - if( My_Connections[n].res_stat == NULL ) New_Server( i, n ); - } + /* Check all configured servers */ + for( i = 0; i < MAX_SERVERS; i++ ) + { + /* Valid outgoing server which isn't already connected or disabled? */ + if(( ! Conf_Server[i].host[0] ) || ( ! Conf_Server[i].port > 0 ) || ( Conf_Server[i].conn_id > NONE ) || ( Conf_Server[i].flags & CONF_SFLAG_DISABLED )) continue; - /* Verbindung in dieser Server-Gruppe? */ - if(( My_Connections[n].our_server != NONE ) && ( Conf_Server[i].group != NONE )) + /* Is there already a connection in this group? */ + if( Conf_Server[i].group > NONE ) + { + for( n = 0; n < MAX_SERVERS; n++ ) { - if( Conf_Server[My_Connections[n].our_server].group == Conf_Server[i].group ) break; + if( n == i ) continue; + if(( Conf_Server[n].conn_id > NONE ) && ( Conf_Server[n].group == Conf_Server[i].group )) break; } + if( n < MAX_SERVERS ) continue; } - if( n < Pool_Size ) continue; - /* Wann war der letzte Connect-Versuch? */ + /* Check last connect attempt? */ if( Conf_Server[i].lasttry > time( NULL ) - Conf_ConnectRetry ) continue; - /* Okay, Verbindungsaufbau versuchen */ + /* Okay, try to connect now */ Conf_Server[i].lasttry = time( NULL ); - /* Freie Connection-Struktur suschen */ + /* Search free connection structure */ for( idx = 0; idx < Pool_Size; idx++ ) if( My_Connections[idx].sock == NONE ) break; if( idx >= Pool_Size ) { @@ -1578,12 +1330,11 @@ /* Verbindungs-Struktur initialisieren */ Init_Conn_Struct( idx ); My_Connections[idx].sock = SERVER_WAIT; - My_Connections[idx].our_server = i; + Conf_Server[i].conn_id = idx; - /* Hostnamen in IP aufloesen (Default bzw. im Fehlerfall: versuchen, den - * konfigurierten Text direkt als IP-Adresse zu verwenden ... */ - strcpy( Conf_Server[My_Connections[idx].our_server].ip, Conf_Server[i].host ); - strcpy( My_Connections[idx].host, Conf_Server[i].host ); + /* Resolve Hostname. If this fails, try to use it as an IP address */ + strlcpy( Conf_Server[i].ip, Conf_Server[i].host, sizeof( Conf_Server[i].ip )); + strlcpy( My_Connections[idx].host, Conf_Server[i].host, sizeof( My_Connections[idx].host )); s = Resolve_Name( Conf_Server[i].host ); if( s ) { @@ -1597,7 +1348,7 @@ LOCAL VOID New_Server( INT Server, CONN_ID Idx ) { - /* Neue Server-Verbindung aufbauen */ + /* Establish new server link */ struct sockaddr_in new_addr; struct in_addr inaddr; @@ -1607,11 +1358,12 @@ assert( Server > NONE ); assert( Idx > NONE ); - /* Wurde eine gueltige IP-Adresse gefunden? */ + /* Did we get a valid IP address? */ if( ! Conf_Server[Server].ip[0] ) { - /* Nein. Verbindung wieder freigeben: */ + /* No. Free connection structure and abort: */ Init_Conn_Struct( Idx ); + Conf_Server[Server].conn_id = NONE; Log( LOG_ERR, "Can't connect to \"%s\" (connection %d): ip address unknown!", Conf_Server[Server].host, Idx ); return; } @@ -1626,8 +1378,9 @@ if( inaddr.s_addr == (unsigned)-1 ) #endif { - /* Konnte Adresse nicht konvertieren */ + /* Can't convert IP address */ Init_Conn_Struct( Idx ); + Conf_Server[Server].conn_id = NONE; Log( LOG_ERR, "Can't connect to \"%s\" (connection %d): can't convert ip address %s!", Conf_Server[Server].host, Idx, Conf_Server[Server].ip ); return; } @@ -1640,7 +1393,9 @@ new_sock = socket( PF_INET, SOCK_STREAM, 0 ); if ( new_sock < 0 ) { + /* Can't create socket */ Init_Conn_Struct( Idx ); + Conf_Server[Server].conn_id = NONE; Log( LOG_CRIT, "Can't create socket: %s!", strerror( errno )); return; } @@ -1650,9 +1405,11 @@ res = connect( new_sock, (struct sockaddr *)&new_addr, sizeof( new_addr )); if(( res != 0 ) && ( errno != EINPROGRESS )) { + /* Can't connect socket */ Log( LOG_CRIT, "Can't connect socket: %s!", strerror( errno )); close( new_sock ); Init_Conn_Struct( Idx ); + Conf_Server[Server].conn_id = NONE; return; } @@ -1660,30 +1417,32 @@ c = Client_NewLocal( Idx, inet_ntoa( new_addr.sin_addr ), CLIENT_UNKNOWNSERVER, FALSE ); if( ! c ) { + /* Can't create new client structure */ close( new_sock ); Init_Conn_Struct( Idx ); + Conf_Server[Server].conn_id = NONE; Log( LOG_ALERT, "Can't establish connection: can't create client structure!" ); return; } Client_SetIntroducer( c, c ); Client_SetToken( c, TOKEN_OUTBOUND ); - /* Verbindung registrieren */ + /* Register connection */ My_Connections[Idx].sock = new_sock; My_Connections[Idx].addr = new_addr; - strcpy( My_Connections[Idx].host, Conf_Server[Server].host ); + strlcpy( My_Connections[Idx].host, Conf_Server[Server].host, sizeof( My_Connections[Idx].host )); - /* Neuen Socket registrieren */ + /* Register new socket */ FD_SET( new_sock, &My_Sockets ); FD_SET( new_sock, &My_Connects ); if( new_sock > Conn_MaxFD ) Conn_MaxFD = new_sock; - + Log( LOG_DEBUG, "Registered new connection %d on socket %d.", Idx, My_Connections[Idx].sock ); } /* New_Server */ LOCAL VOID -Init_Conn_Struct( LONG Idx ) +Init_Conn_Struct( CONN_ID Idx ) { /* Connection-Struktur initialisieren */ @@ -1694,7 +1453,6 @@ My_Connections[Idx].rdatalen = 0; My_Connections[Idx].wbuf[0] = '\0'; My_Connections[Idx].wdatalen = 0; - My_Connections[Idx].our_server = NONE; My_Connections[Idx].starttime = time( NULL ); My_Connections[Idx].lastdata = time( NULL ); My_Connections[Idx].lastping = 0; @@ -1751,7 +1509,7 @@ CHAR result[HOST_LEN]; CLIENT *c; - INT len, i; + INT len, i, n; FD_CLR( r_fd, &Resolver_FDs ); @@ -1781,7 +1539,7 @@ } Log( LOG_DEBUG, "Resolver: %s is \"%s\".", My_Connections[i].host, result ); - + /* Aufraeumen */ close( My_Connections[i].res_stat->pipe[0] ); close( My_Connections[i].res_stat->pipe[1] ); @@ -1793,14 +1551,15 @@ /* Eingehende Verbindung: Hostnamen setzen */ c = Client_GetFromConn( i ); assert( c != NULL ); - strcpy( My_Connections[i].host, result ); + strlcpy( My_Connections[i].host, result, sizeof( My_Connections[i].host )); Client_SetHostname( c, result ); } else { /* Ausgehende Verbindung (=Server): IP setzen */ - assert( My_Connections[i].our_server > NONE ); - strcpy( Conf_Server[My_Connections[i].our_server].ip, result ); + n = Conf_GetServer( i ); + if( n > NONE ) strlcpy( Conf_Server[n].ip, result, sizeof( Conf_Server[n].ip )); + else Log( LOG_ERR, "Got resolver result for non-configured server!?" ); } /* Penalty-Zeit zurueck setzen */ @@ -1808,115 +1567,19 @@ } /* Read_Resolver_Result */ -#ifdef USE_ZLIB - -LOCAL 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 */ - - -LOCAL 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 = My_Connections[Idx].zip.wbuf; - out->avail_in = My_Connections[Idx].zip.wdatalen; - out->next_out = 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 */ - - -LOCAL BOOLEAN -Unzip_Buffer( CONN_ID Idx ) +LOCAL VOID +Simple_Message( INT Sock, CHAR *Msg ) { - /* 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 = My_Connections[Idx].zip.rbuf; - in->avail_in = My_Connections[Idx].zip.rdatalen; - in->next_out = 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 */ + /* Write "simple" message to socket, without using compression + * or even the connection write buffers. Used e.g. for error + * messages by New_Connection(). */ + assert( Sock > NONE ); + assert( Msg != NULL ); -#endif + (VOID)send( Sock, Msg, strlen( Msg ), 0 ); + (VOID)send( Sock, "\r\n", 2, 0 ); +} /* Simple_Error */ /* -eof- */ Index: src/ngircd/conn.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/conn.h,v retrieving revision 1.26 retrieving revision 1.31 diff -u -u -r1.26 -r1.31 --- src/ngircd/conn.h 18 Dec 2002 13:50:22 -0000 1.26 +++ src/ngircd/conn.h 27 Mar 2003 01:20:22 -0000 1.31 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: conn.h,v 1.26 2002/12/18 13:50:22 alex Exp $ + * $Id: conn.h,v 1.31 2003/03/27 01:20:22 alex Exp $ * * Connection management (header) */ @@ -18,17 +18,69 @@ #define __conn_h__ -#include /* wg. time_t, s.u. */ +#include /* fro time_t, see below */ +#define CONN_ISCLOSING 1 /* Conn_Close() already called */ + #ifdef USE_ZLIB -#define CONN_ZIP 4 /* Kompression mit zlib */ +#define CONN_ZIP 2 /* zlib compressed link */ #endif typedef INT CONN_ID; +#ifdef CONN_MODULE + +#include "defines.h" +#include "resolve.h" + +#ifdef USE_ZLIB +#include +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_Exit PARAMS(( VOID )); @@ -44,42 +96,7 @@ GLOBAL VOID Conn_Close PARAMS(( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )); -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 VOID Conn_SyncServerStruct PARAMS(( VOID )); GLOBAL INT Conn_MaxFD; Index: src/ngircd/defines.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/defines.h,v retrieving revision 1.40 retrieving revision 1.42 diff -u -u -r1.40 -r1.42 --- src/ngircd/defines.h 16 Dec 2002 23:10:56 -0000 1.40 +++ src/ngircd/defines.h 23 Feb 2003 12:03:39 -0000 1.42 @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) + * 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 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: defines.h,v 1.40 2002/12/16 23:10:56 alex Exp $ + * $Id: defines.h,v 1.42 2003/02/23 12:03:39 alex Exp $ * * Global defines of ngIRCd. */ @@ -83,13 +83,9 @@ #define DEFAULT_AWAY_MSG "Away" /* Away-Meldung fuer User von anderen Servern */ -#ifdef PROTOTYPES -# 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 CONFIG_FILE "/ngircd.conf" +#define MOTD_FILE "/ngircd.motd" + #define ERROR_DIR "/tmp" #define MAX_LOG_MSG_LEN 256 /* max. Laenge einer Log-Meldung */ @@ -97,6 +93,10 @@ #define TOKEN_OUTBOUND -2 /* Kennzeichnung fuer ausgehende Server-Links im Aufbau */ #define NOTICE_TXTPREFIX "" /* Kennzeichnung fuer Server-NOTICEs an User */ + +#ifdef RENDEZVOUS +#define RENDEZVOUS_TYPE "_ircu._tcp." /* Service type to register with Rendezvous */ +#endif #endif Index: src/ngircd/hash.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/hash.c,v retrieving revision 1.6 retrieving revision 1.9 diff -u -u -r1.6 -r1.9 --- src/ngircd/hash.c 12 Dec 2002 12:24:18 -0000 1.6 +++ src/ngircd/hash.c 26 Dec 2002 16:25:43 -0000 1.9 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: hash.c,v 1.6 2002/12/12 12:24:18 alex Exp $"; +static char UNUSED id[] = "$Id: hash.c,v 1.9 2002/12/26 16:25:43 alex Exp $"; #include "imp.h" #include @@ -38,9 +38,7 @@ CHAR buffer[LINE_LEN]; - strncpy( buffer, String, LINE_LEN - 1 ); - buffer[LINE_LEN - 1] = '\0'; - + strlcpy( buffer, String, sizeof( buffer )); return jenkins_hash( (UINT8 *)ngt_LowerStr( buffer ), strlen( buffer ), 42 ); } /* Hash */ @@ -102,7 +100,7 @@ /* handle the last 11 bytes */ c += length; - switch(len) /* all the case statements fall through */ + switch( (INT)len ) /* all the case statements fall through */ { case 11: c+=((UINT32)k[10]<<24); case 10: c+=((UINT32)k[9]<<16); Index: src/ngircd/irc-channel.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-channel.c,v retrieving revision 1.21.2.5 retrieving revision 1.25 diff -u -u -r1.21.2.5 -r1.25 --- src/ngircd/irc-channel.c 8 Jan 2003 23:09:34 -0000 1.21.2.5 +++ src/ngircd/irc-channel.c 8 Jan 2003 22:04:05 -0000 1.25 @@ -14,10 +14,12 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-channel.c,v 1.21.2.5 2003/01/08 23:09:34 alex Exp $"; +static char UNUSED id[] = "$Id: irc-channel.c,v 1.25 2003/01/08 22:04:05 alex Exp $"; #include "imp.h" #include +#include +#include #include #include "defines.h" @@ -179,7 +181,7 @@ if(( strchr( Channel_Modes( chan ), 'P' )) && ( strchr( Client_Modes( target ), 'o' ))) Channel_UserModeAdd( chan, target, 'o' ); /* Muessen Modes an andere Server gemeldet werden? */ - strcpy( &modes[1], Channel_UserModes( chan, target )); + strlcpy( &modes[1], Channel_UserModes( chan, target ), sizeof( modes ) - 1 ); if( modes[1] ) modes[0] = 0x7; else modes[0] = '\0'; @@ -362,9 +364,9 @@ GLOBAL BOOLEAN IRC_CHANINFO( CLIENT *Client, REQUEST *Req ) { + CHAR modes_add[COMMAND_LEN], l[16], *ptr; CLIENT *from; CHANNEL *chan; - CHAR *ptr; INT arg_topic; assert( Client != NULL ); @@ -395,15 +397,40 @@ /* OK, this channel doesn't have modes jet, set the received ones: */ Channel_SetModes( chan, &Req->argv[1][1] ); - /* Delete modes which we never want to inherit */ - Channel_ModeDel( chan, 'l' ); - Channel_ModeDel( chan, 'k' ); + 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 */ + Channel_ModeDel( chan, 'l' ); + 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 */ - IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s", Req->argv[0], Channel_Modes( chan )); + IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s%s", Req->argv[0], Channel_Modes( chan ), modes_add ); } } - else Log( LOG_WARNING, "CHANNELINFO: invalid MODE format ignored!" ); + else Log( LOG_WARNING, "CHANINFO: invalid MODE format ignored!" ); if( arg_topic > 0 ) { Index: src/ngircd/irc-info.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-info.c,v retrieving revision 1.8.2.2 retrieving revision 1.16 diff -u -u -r1.8.2.2 -r1.16 --- src/ngircd/irc-info.c 1 Jan 2003 13:46:37 -0000 1.8.2.2 +++ src/ngircd/irc-info.c 21 Apr 2003 10:54:30 -0000 1.16 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-info.c,v 1.8.2.2 2003/01/01 13:46:37 alex Exp $"; +static char UNUSED id[] = "$Id: irc-info.c,v 1.16 2003/04/21 10:54:30 alex Exp $"; #include "imp.h" #include @@ -23,7 +23,8 @@ #include #include "ngircd.h" -#include "conn.h" +#include "conn-func.h" +#include "conn-zip.h" #include "client.h" #include "channel.h" #include "resolve.h" @@ -104,8 +105,8 @@ if( c && ( Client_Type( c ) == CLIENT_USER )) { /* Dieser Nick ist "online" */ - strcat( rpl, ptr ); - strcat( rpl, " " ); + strlcat( rpl, ptr, sizeof( rpl )); + strlcat( rpl, " ", sizeof( rpl )); } ptr = strtok( NULL, " " ); } @@ -296,20 +297,20 @@ /* Nun noch alle Clients ausgeben, die in keinem Channel sind */ c = Client_First( ); - sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" ); + snprintf( rpl, sizeof( rpl ), RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" ); while( c ) { if(( Client_Type( c ) == CLIENT_USER ) && ( Channel_FirstChannelOf( c ) == NULL ) && ( ! strchr( Client_Modes( c ), 'i' ))) { /* Okay, das ist ein User: anhaengen */ - if( rpl[strlen( rpl ) - 1] != ':' ) strcat( rpl, " " ); - strcat( rpl, Client_ID( c )); + if( rpl[strlen( rpl ) - 1] != ':' ) strlcat( rpl, " ", sizeof( rpl )); + strlcat( rpl, Client_ID( c ), sizeof( rpl )); if( strlen( rpl ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 )) { /* Zeile wird zu lang: senden! */ if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED; - sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" ); + snprintf( rpl, sizeof( rpl ), RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" ); } } @@ -375,7 +376,7 @@ #ifdef USE_ZLIB 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 ), Conn_SendBytesZip( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Conn_RecvBytesZip( 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 ), Zip_SendBytes( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Zip_RecvBytes( con ), Conn_RecvBytes( con ), (LONG)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED; } else #endif @@ -436,7 +437,7 @@ } 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 ); } /* IRC_TIME */ @@ -464,15 +465,15 @@ if( c && ( Client_Type( c ) == CLIENT_USER )) { /* Dieser Nick ist "online" */ - strcat( rpl, Client_ID( c )); - if( Client_HasMode( c, 'o' )) strcat( rpl, "*" ); - strcat( rpl, "=" ); - if( Client_HasMode( c, 'a' )) strcat( rpl, "-" ); - else strcat( rpl, "+" ); - strcat( rpl, Client_User( c )); - strcat( rpl, "@" ); - strcat( rpl, Client_Hostname( c )); - strcat( rpl, " " ); + strlcat( rpl, Client_ID( c ), sizeof( rpl )); + if( Client_HasMode( c, 'o' )) strlcat( rpl, "*", sizeof( rpl )); + strlcat( rpl, "=", sizeof( rpl )); + if( Client_HasMode( c, 'a' )) strlcat( rpl, "-", sizeof( rpl )); + else strlcat( rpl, "+", sizeof( rpl )); + strlcat( rpl, Client_User( c ), sizeof( rpl )); + strlcat( rpl, "@", sizeof( rpl )); + strlcat( rpl, Client_Hostname( c ), sizeof( rpl )); + strlcat( rpl, " ", sizeof( rpl )); } } if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0'; @@ -512,7 +513,7 @@ } /* mit Versionsinfo antworten */ - return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE, VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( )); + return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( )); } /* IRC_VERSION */ @@ -572,7 +573,7 @@ { /* Flags zusammenbasteln */ strcpy( flags, "H" ); - if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" ); + if( strchr( Client_Modes( c ), 'o' )) strlcat( flags, "*", sizeof( flags )); /* ausgeben */ cl2chan = Channel_FirstChannelOf( c ); @@ -635,7 +636,7 @@ 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 */ - sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c )); + snprintf( str, sizeof( str ), RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c )); cl2chan = Channel_FirstChannelOf( c ); while( cl2chan ) { @@ -643,16 +644,16 @@ assert( chan != NULL ); /* Concatenate channel names */ - if( str[strlen( str ) - 1] != ':' ) strcat( str, " " ); - if( strchr( Channel_UserModes( chan, c ), 'o' )) strcat( str, "@" ); - else if( strchr( Channel_UserModes( chan, c ), 'v' )) strcat( str, "+" ); - strcat( str, Channel_Name( chan )); + if( str[strlen( str ) - 1] != ':' ) strlcat( str, " ", sizeof( str )); + if( strchr( Channel_UserModes( chan, c ), 'o' )) strlcat( str, "@", sizeof( str )); + else if( strchr( Channel_UserModes( chan, c ), 'v' )) strlcat( str, "+", sizeof( str )); + strlcat( str, Channel_Name( chan ), sizeof( str )); if( strlen( str ) > ( LINE_LEN - CHANNEL_NAME_LEN - 4 )) { /* Line becomes too long: send it! */ if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED; - sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c )); + snprintf( str, sizeof( str ), RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c )); } /* next */ @@ -793,7 +794,7 @@ else is_member = FALSE; /* Alle Mitglieder suchen */ - sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan )); + snprintf( str, sizeof( str ), RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan )); cl2chan = Channel_FirstMember( Chan ); while( cl2chan ) { @@ -805,16 +806,16 @@ if( is_member || is_visible ) { /* Nick anhaengen */ - if( str[strlen( str ) - 1] != ':' ) strcat( str, " " ); - if( strchr( Channel_UserModes( Chan, cl ), 'o' )) strcat( str, "@" ); - else if( strchr( Channel_UserModes( Chan, cl ), 'v' )) strcat( str, "+" ); - strcat( str, Client_ID( cl )); + if( str[strlen( str ) - 1] != ':' ) strlcat( str, " ", sizeof( str )); + if( strchr( Channel_UserModes( Chan, cl ), 'o' )) strlcat( str, "@", sizeof( str )); + else if( strchr( Channel_UserModes( Chan, cl ), 'v' )) strlcat( str, "+", sizeof( str )); + strlcat( str, Client_ID( cl ), sizeof( str )); if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 )) { /* Zeile wird zu lang: senden! */ if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED; - sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan )); + snprintf( str, sizeof( str ), RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan )); } } @@ -858,9 +859,9 @@ { /* Flags zusammenbasteln */ strcpy( flags, "H" ); - if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" ); - if( strchr( Channel_UserModes( Chan, c ), 'o' )) strcat( flags, "@" ); - else if( strchr( Channel_UserModes( Chan, c ), 'v' )) strcat( flags, "+" ); + if( strchr( Client_Modes( c ), 'o' )) strlcat( flags, "*", sizeof( flags )); + if( strchr( Channel_UserModes( Chan, c ), 'o' )) strlcat( flags, "@", sizeof( flags )); + else if( strchr( Channel_UserModes( Chan, c ), 'v' )) strlcat( flags, "+", sizeof( flags )); /* ausgeben */ if(( ! OnlyOps ) || ( strchr( Client_Modes( c ), 'o' ))) Index: src/ngircd/irc-login.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-login.c,v retrieving revision 1.27.2.2 retrieving revision 1.34 diff -u -u -r1.27.2.2 -r1.34 --- src/ngircd/irc-login.c 1 Jan 2003 13:46:37 -0000 1.27.2.2 +++ src/ngircd/irc-login.c 31 Mar 2003 15:54:21 -0000 1.34 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-login.c,v 1.27.2.2 2003/01/01 13:46:37 alex Exp $"; +static char UNUSED id[] = "$Id: irc-login.c,v 1.34 2003/03/31 15:54:21 alex Exp $"; #include "imp.h" #include @@ -24,13 +24,14 @@ #include "ngircd.h" #include "resolve.h" +#include "conn-func.h" #include "conf.h" -#include "conn.h" #include "client.h" #include "channel.h" #include "log.h" #include "messages.h" #include "parse.h" +#include "irc.h" #include "irc-info.h" #include "irc-write.h" @@ -444,12 +445,12 @@ 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_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), VERSION, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) 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_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return FALSE; - if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), VERSION, USERMODES, CHANMODES )) return FALSE; + if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, USERMODES, CHANMODES )) return FALSE; /* Features */ - 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; + 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; Client_SetType( Client, CLIENT_USER ); @@ -463,19 +464,18 @@ LOCAL VOID Kill_Nick( CHAR *Nick, CHAR *Reason ) { - CLIENT *c; + REQUEST r; assert( Nick != NULL ); assert( Reason != NULL ); - Log( LOG_ERR, "User(s) with nick \"%s\" will be disconnected: %s", Nick, Reason ); - - /* andere Server benachrichtigen */ - IRC_WriteStrServers( NULL, "KILL %s :%s", Nick, Reason ); + r.prefix = Client_ThisServer( ); + r.argv[0] = Nick; + r.argv[1] = Reason; + r.argc = 2; - /* Ggf. einen eigenen Client toeten */ - c = Client_Search( Nick ); - if( c && ( Client_Conn( c ) != NONE )) Conn_Close( Client_Conn( c ), NULL, Reason, TRUE ); + Log( LOG_ERR, "User(s) with nick \"%s\" will be disconnected: %s", Nick, Reason ); + IRC_KILL( Client_ThisServer( ), &r ); } /* Kill_Nick */ Index: src/ngircd/irc-mode.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-mode.c,v retrieving revision 1.24.2.5 retrieving revision 1.31 diff -u -u -r1.24.2.5 -r1.31 --- src/ngircd/irc-mode.c 21 Jan 2003 21:05:19 -0000 1.24.2.5 +++ src/ngircd/irc-mode.c 21 Jan 2003 21:04:16 -0000 1.31 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-mode.c,v 1.24.2.5 2003/01/21 21:05:19 alex Exp $"; +static char UNUSED id[] = "$Id: irc-mode.c,v 1.31 2003/01/21 21:04:16 alex Exp $"; #include "imp.h" #include @@ -142,7 +142,8 @@ else { /* Append modifier character to result string */ - x[0] = *mode_ptr; strcat( the_modes, x ); + x[0] = *mode_ptr; + strlcat( the_modes, x, sizeof( the_modes )); } if( *mode_ptr == '+' ) set = TRUE; else set = FALSE; @@ -199,13 +200,13 @@ if( set ) { /* Set mode */ - if( Client_ModeAdd( Target, x[0] )) strcat( the_modes, x ); + if( Client_ModeAdd( Target, x[0] )) strlcat( the_modes, x, sizeof( the_modes )); } else { /* Unset mode */ - if( Client_ModeDel( Target, x[0] )) strcat( the_modes, x ); + if( Client_ModeDel( Target, x[0] )) strlcat( the_modes, x, sizeof( the_modes )); } } client_exit: @@ -252,7 +253,7 @@ 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 */ - strcpy( the_modes, Channel_Modes( Channel )); + strlcpy( the_modes, Channel_Modes( Channel ), sizeof( the_modes )); mode_ptr = the_modes; strcpy( the_args, "" ); while( *mode_ptr ) @@ -261,16 +262,16 @@ { case 'l': snprintf( argadd, sizeof( argadd ), " %ld", Channel_MaxUsers( Channel )); - strcat( the_args, argadd ); + strlcat( the_args, argadd, sizeof( the_args )); break; case 'k': - strcat( the_args, " " ); - strcat( the_args, Channel_Key( Channel )); + strlcat( the_args, " ", sizeof( the_args )); + strlcat( the_args, Channel_Key( Channel ), sizeof( the_args )); break; } mode_ptr++; } - if( the_args[0] ) strcat( the_modes, the_args ); + if( the_args[0] ) strlcat( the_modes, the_args, sizeof( the_modes )); return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), the_modes ); } @@ -340,7 +341,8 @@ else { /* Append modifier character to result string */ - x[0] = *mode_ptr; strcat( the_modes, x ); + x[0] = *mode_ptr; + strlcat( the_modes, x, sizeof( the_modes )); } if( *mode_ptr == '+' ) set = TRUE; else set = FALSE; @@ -425,7 +427,7 @@ { Channel_ModeDel( Channel, 'k' ); Channel_SetKey( Channel, Req->argv[arg_arg] ); - strcpy( argadd, Channel_Key( Channel )); + strlcpy( argadd, Channel_Key( Channel ), sizeof( argadd )); x[0] = *mode_ptr; } else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel )); @@ -451,7 +453,7 @@ { Channel_ModeDel( Channel, 'l' ); Channel_SetMaxUsers( Channel, l ); - sprintf( argadd, "%ld", l ); + snprintf( argadd, sizeof( argadd ), "%ld", l ); x[0] = *mode_ptr; } } @@ -522,8 +524,9 @@ /* Channel-User-Mode */ if( Channel_UserModeAdd( Channel, client, x[0] )) { - strcat( the_args, Client_ID( client )); - strcat( the_args, " " ); strcat( the_modes, x ); + strlcat( the_args, Client_ID( client ), sizeof( the_args )); + strlcat( the_args, " ", sizeof( the_args )); + 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 )); } } @@ -532,7 +535,7 @@ /* Channel-Mode */ if( Channel_ModeAdd( Channel, x[0] )) { - strcat( the_modes, x ); + strlcat( the_modes, x, sizeof( the_modes )); Log( LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name( Channel ), Channel_Modes( Channel )); } } @@ -545,8 +548,9 @@ /* Channel-User-Mode */ if( Channel_UserModeDel( Channel, client, x[0] )) { - strcat( the_args, Client_ID( client )); - strcat( the_args, " " ); strcat( the_modes, x ); + strlcat( the_args, Client_ID( client ), sizeof( the_args )); + strlcat( the_args, " ", sizeof( the_args )); + 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 )); } } @@ -555,7 +559,7 @@ /* Channel-Mode */ if( Channel_ModeDel( Channel, x[0] )) { - strcat( the_modes, x ); + strlcat( the_modes, x, sizeof( the_modes )); Log( LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name( Channel ), Channel_Modes( Channel )); } } @@ -564,8 +568,8 @@ /* Are there additional arguments to add? */ if( argadd[0] ) { - if( the_args[strlen( the_args ) - 1] != ' ' ) strcat( the_args, " " ); - strcat( the_args, argadd ); + if( the_args[strlen( the_args ) - 1] != ' ' ) strlcat( the_args, " ", sizeof( the_args )); + strlcat( the_args, argadd, sizeof( the_args )); } } chan_exit: Index: src/ngircd/irc-oper.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-oper.c,v retrieving revision 1.13 retrieving revision 1.17 diff -u -u -r1.13 -r1.17 --- src/ngircd/irc-oper.c 12 Dec 2002 12:33:14 -0000 1.13 +++ src/ngircd/irc-oper.c 31 Dec 2002 16:10:55 -0000 1.17 @@ -14,16 +14,17 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-oper.c,v 1.13 2002/12/12 12:33:14 alex Exp $"; +static char UNUSED id[] = "$Id: irc-oper.c,v 1.17 2002/12/31 16:10:55 alex Exp $"; #include "imp.h" #include +#include #include #include "ngircd.h" #include "resolve.h" -#include "conf.h" #include "conn.h" +#include "conf.h" #include "client.h" #include "channel.h" #include "irc-write.h" @@ -82,16 +83,19 @@ GLOBAL BOOLEAN IRC_DIE( CLIENT *Client, REQUEST *Req ) { + /* Shut down server */ + assert( Client != NULL ); assert( Req != NULL ); - /* Falsche Anzahl Parameter? */ - if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); - + /* 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 != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); - Log( LOG_NOTICE|LOG_snotice, "Got DIE command from \"%s\", going down!", Client_Mask( Client )); - NGIRCd_Quit = TRUE; + Log( LOG_NOTICE|LOG_snotice, "Got DIE command from \"%s\" ...", Client_Mask( Client )); + NGIRCd_SignalQuit = TRUE; return CONNECTED; } /* IRC_DIE */ @@ -99,16 +103,19 @@ GLOBAL BOOLEAN IRC_REHASH( CLIENT *Client, REQUEST *Req ) { + /* Reload configuration file */ + assert( Client != NULL ); assert( Req != NULL ); - /* Falsche Anzahl Parameter? */ - if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); - + /* Not a local IRC operator? */ if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client )); - Log( LOG_NOTICE|LOG_snotice, "Got REHASH command from \"%s\", re-reading configuration ...", Client_Mask( Client )); - NGIRCd_Rehash( ); + /* Bad number of parameters? */ + 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 )); + NGIRCd_SignalRehash = TRUE; return CONNECTED; } /* IRC_REHASH */ @@ -117,16 +124,19 @@ GLOBAL BOOLEAN IRC_RESTART( CLIENT *Client, REQUEST *Req ) { + /* Restart IRC server (fork a new process) */ + assert( Client != NULL ); assert( Req != NULL ); - /* Falsche Anzahl Parameter? */ - if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); - + /* Not a local IRC operator? */ if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client )); - Log( LOG_NOTICE|LOG_snotice, "Got RESTART command from \"%s\", going down!", Client_Mask( Client )); - NGIRCd_Restart = TRUE; + /* Bad number of parameters? */ + 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 )); + NGIRCd_SignalRestart = TRUE; return CONNECTED; } /* IRC_RESTART */ @@ -134,19 +144,63 @@ GLOBAL BOOLEAN IRC_CONNECT(CLIENT *Client, REQUEST *Req ) { - /* Vorlaeufige Version zu Debug-Zwecken: es wird einfach - * der "passive mode" aufgehoben, mehr passiert nicht ... */ + /* Connect configured or new server */ assert( Client != NULL ); assert( Req != NULL ); - /* Falsche Anzahl Parameter? */ - if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); + /* Not a local IRC operator? */ if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client )); - Log( LOG_NOTICE|LOG_snotice, "Got CONNECT command from \"%s\".", Client_Mask( Client )); - NGIRCd_Passive = FALSE; + /* Bad number of parameters? */ + if(( Req->argc != 2 ) && ( Req->argc != 5 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); + + /* 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; +} /* 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 */ Index: src/ngircd/irc-oper.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-oper.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- src/ngircd/irc-oper.h 12 Dec 2002 12:23:43 -0000 1.9 +++ src/ngircd/irc-oper.h 31 Dec 2002 16:11:06 -0000 1.10 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc-oper.h,v 1.9 2002/12/12 12:23:43 alex Exp $ + * $Id: irc-oper.h,v 1.10 2002/12/31 16:11:06 alex Exp $ * * IRC operator commands (header) */ @@ -23,6 +23,7 @@ GLOBAL BOOLEAN IRC_REHASH 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_DISCONNECT PARAMS((CLIENT *Client, REQUEST *Req )); #endif Index: src/ngircd/irc-server.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-server.c,v retrieving revision 1.24 retrieving revision 1.32 diff -u -u -r1.24 -r1.32 --- src/ngircd/irc-server.c 12 Dec 2002 12:24:18 -0000 1.24 +++ src/ngircd/irc-server.c 20 Apr 2003 23:09:26 -0000 1.32 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-server.c,v 1.24 2002/12/12 12:24:18 alex Exp $"; +static char UNUSED id[] = "$Id: irc-server.c,v 1.32 2003/04/20 23:09:26 alex Exp $"; #include "imp.h" #include @@ -23,8 +23,9 @@ #include #include "resolve.h" -#include "conf.h" #include "conn.h" +#include "conn-zip.h" +#include "conf.h" #include "client.h" #include "channel.h" #include "irc-write.h" @@ -40,7 +41,7 @@ GLOBAL BOOLEAN IRC_SERVER( CLIENT *Client, REQUEST *Req ) { - CHAR str[LINE_LEN], *ptr; + CHAR str[LINE_LEN], *ptr, *modes, *topic; CLIENT *from, *c, *cl; CL2CHAN *cl2chan; INT max_hops, i; @@ -63,8 +64,8 @@ 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? */ - for( i = 0; i < Conf_Server_Count; i++ ) if( strcasecmp( Req->argv[0], Conf_Server[i].name ) == 0 ) break; - if( i >= Conf_Server_Count ) + for( i = 0; i < MAX_SERVERS; i++ ) if( strcasecmp( Req->argv[0], Conf_Server[i].name ) == 0 ) break; + if( i >= MAX_SERVERS ) { /* Server ist nicht konfiguriert! */ Log( LOG_ERR, "Connection %d: Server \"%s\" not configured here!", Client_Conn( Client ), Req->argv[0] ); @@ -114,13 +115,13 @@ Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (connection %d, 1 hop - direct link).", Client_ID( Client ), con ); Client_SetType( Client, CLIENT_SERVER ); - Conn_SetServer( con, i ); + Conf_SetServer( i, con ); #ifdef USE_ZLIB /* Kompression initialisieren, wenn erforderlich */ if( strchr( Client_Flags( Client ), 'Z' )) { - if( ! Conn_InitZip( con )) + if( ! Zip_InitConn( con )) { /* Fehler! */ Conn_Close( con, "Can't inizialize compression (zlib)!", NULL, FALSE ); @@ -178,33 +179,53 @@ while( chan ) { #ifdef IRCPLUS - /* Wenn unterstuetzt, CHANINFO senden */ + /* Send CHANINFO if the peer supports it */ if( strchr( Client_Flags( Client ), 'C' )) { - /* CHANINFO senden */ - if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s :%s", Channel_Name( chan ), Channel_Modes( chan ), Channel_Topic( chan ))) return DISCONNECTED; + modes = Channel_Modes( chan ); + topic = Channel_Topic( chan ); + + if( *modes || *topic ) + { + /* send CHANINFO */ + if(( ! strchr( Channel_Modes( chan ), 'k' )) && ( ! strchr( Channel_Modes( chan ), 'l' )) && ( ! *topic )) + { + /* "CHANINFO +" */ + 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 + :" */ + if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s :%s", Channel_Name( chan ), modes, topic )) return DISCONNECTED; + } + else + { + /* "CHANINFO + :" */ + 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 /* alle Member suchen */ cl2chan = Channel_FirstMember( chan ); - sprintf( str, "NJOIN %s :", Channel_Name( chan )); + snprintf( str, sizeof( str ), "NJOIN %s :", Channel_Name( chan )); while( cl2chan ) { cl = Channel_GetClient( cl2chan ); assert( cl != NULL ); /* Nick, ggf. mit Modes, anhaengen */ - if( str[strlen( str ) - 1] != ':' ) strcat( str, "," ); - if( strchr( Channel_UserModes( chan, cl ), 'v' )) strcat( str, "+" ); - if( strchr( Channel_UserModes( chan, cl ), 'o' )) strcat( str, "@" ); - strcat( str, Client_ID( cl )); + if( str[strlen( str ) - 1] != ':' ) strlcat( str, ",", sizeof( str )); + if( strchr( Channel_UserModes( chan, cl ), 'v' )) strlcat( str, "+", sizeof( str )); + if( strchr( Channel_UserModes( chan, cl ), 'o' )) strlcat( str, "@", sizeof( str )); + strlcat( str, Client_ID( cl ), sizeof( str )); if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 8 )) { /* Zeile senden */ if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED; - sprintf( str, "NJOIN %s :", Channel_Name( chan )); + snprintf( str, sizeof( str ), "NJOIN %s :", Channel_Name( chan )); } cl2chan = Channel_NextMember( chan, cl2chan ); @@ -257,7 +278,7 @@ } /* Log-Meldung zusammenbauen und ausgeben */ - if(( Client_Hops( c ) > 1 ) && ( Req->prefix[0] )) sprintf( str, "connected to %s, ", Client_ID( from )); + if(( Client_Hops( c ) > 1 ) && ( Req->prefix[0] )) snprintf( str, sizeof( str ), "connected to %s, ", Client_ID( from )); 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": "" ); @@ -273,7 +294,7 @@ GLOBAL BOOLEAN IRC_NJOIN( CLIENT *Client, REQUEST *Req ) { - CHAR str[COMMAND_LEN], *channame, *ptr, modes[8]; + CHAR nick_in[COMMAND_LEN], nick_out[COMMAND_LEN], *channame, *ptr, modes[8]; BOOLEAN is_op, is_voiced; CHANNEL *chan; CLIENT *c; @@ -284,11 +305,11 @@ /* Falsche Anzahl Parameter? */ if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); - strncpy( str, Req->argv[1], COMMAND_LEN - 1 ); - str[COMMAND_LEN - 1] = '\0'; + strlcpy( nick_in, Req->argv[1], sizeof( nick_in )); + strcpy( nick_out, "" ); channame = Req->argv[0]; - ptr = strtok( str, "," ); + ptr = strtok( nick_in, "," ); while( ptr ) { is_op = is_voiced = FALSE; @@ -315,12 +336,15 @@ IRC_WriteStrChannelPrefix( Client, chan, c, FALSE, "JOIN :%s", channame ); /* Channel-User-Modes setzen */ - strcpy( modes, Channel_UserModes( chan, c )); + strlcpy( modes, Channel_UserModes( chan, c ), sizeof( modes )); if( modes[0] ) { /* Modes im Channel bekannt machen */ 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 ); @@ -329,7 +353,7 @@ } /* an andere Server weiterleiten */ - IRC_WriteStrServersPrefix( Client, Client_ThisServer( ), "NJOIN %s :%s", Req->argv[0], Req->argv[1] ); + if( nick_out[0] != '\0' ) IRC_WriteStrServersPrefix( Client, Client_ThisServer( ), "NJOIN %s :%s", Req->argv[0], nick_out ); return CONNECTED; } /* IRC_NJOIN */ @@ -360,9 +384,9 @@ if( Req->argv[1][0] ) { if( strlen( Req->argv[1] ) > LINE_LEN ) Req->argv[1][LINE_LEN] = '\0'; - sprintf( msg, "%s (SQUIT from %s).", Req->argv[1], Client_ID( Client )); + snprintf( msg, sizeof( msg ), "%s (SQUIT from %s).", Req->argv[1], Client_ID( Client )); } - else sprintf( msg, "Got SQUIT from %s.", Client_ID( Client )); + else snprintf( msg, sizeof( msg ), "Got SQUIT from %s.", Client_ID( Client )); if( Client_Conn( target ) > NONE ) { Index: src/ngircd/irc-write.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-write.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -u -r1.13 -r1.14 --- src/ngircd/irc-write.c 12 Dec 2002 12:24:18 -0000 1.13 +++ src/ngircd/irc-write.c 30 Dec 2002 17:15:42 -0000 1.14 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-write.c,v 1.13 2002/12/12 12:24:18 alex Exp $"; +static char UNUSED id[] = "$Id: irc-write.c,v 1.14 2002/12/30 17:15:42 alex Exp $"; #include "imp.h" #include @@ -22,7 +22,7 @@ #include #include -#include "conn.h" +#include "conn-func.h" #include "client.h" #include "channel.h" #include "defines.h" Index: src/ngircd/irc.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc.c,v retrieving revision 1.107.2.3 retrieving revision 1.120.2.1 diff -u -u -r1.107.2.3 -r1.120.2.1 --- src/ngircd/irc.c 31 Dec 2002 15:48:33 -0000 1.107.2.3 +++ src/ngircd/irc.c 29 Apr 2003 12:20:14 -0000 1.120.2.1 @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) + * 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 @@ -14,14 +14,18 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc.c,v 1.107.2.3 2002/12/31 15:48:33 alex Exp $"; +static char UNUSED id[] = "$Id: irc.c,v 1.120.2.1 2003/04/29 12:20:14 alex Exp $"; #include "imp.h" #include #include #include +#include "ngircd.h" #include "conn.h" +#include "resolve.h" +#include "conf.h" +#include "conn-func.h" #include "client.h" #include "channel.h" #include "defines.h" @@ -34,6 +38,9 @@ #include "irc.h" +LOCAL CHAR *Option_String PARAMS(( CONN_ID Idx )); + + GLOBAL BOOLEAN IRC_ERROR( CLIENT *Client, REQUEST *Req ) { @@ -71,31 +78,59 @@ prefix = Client_ThisServer( ); } - Log( LOG_NOTICE|LOG_snotice, "Got KILL command from \"%s\" for \"%s\": %s", Client_Mask( prefix ), Req->argv[0], Req->argv[1] ); + 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] ); /* Build reason string */ - if( Client_Type( Client ) == CLIENT_USER ) sprintf( reason, "KILLed by %s: %s", Client_ID( Client ), Req->argv[1] ); - else strcpy( reason, Req->argv[1] ); + if( Client_Type( Client ) == CLIENT_USER ) snprintf( reason, sizeof( reason ), "KILLed by %s: %s", Client_ID( Client ), Req->argv[1] ); + else strlcpy( reason, Req->argv[1], sizeof( reason )); /* Inform other servers */ IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], reason ); - + /* Save ID of this connection */ my_conn = Client_Conn( Client ); - + /* Do we host such a client? */ c = Client_Search( Req->argv[0] ); - if( c && Client_Type( c ) == CLIENT_USER ) + if( c ) { - /* Yes, I found it! */ - conn = Client_Conn( c ); - Client_Destroy( c, NULL, reason, FALSE ); - if( conn != NONE ) Conn_Close( Client_Conn( c ), NULL, reason, TRUE ); + /* Yes, there is such a client -- but is it a valid user? */ + if( Client_Type( c ) == CLIENT_SERVER ) + { + if( Client != Client_ThisServer( )) IRC_WriteStrClient( Client, ERR_CANTKILLSERVER_MSG, Client_ID( Client )); + else + { + /* Oops, I should kill another server!? */ + Log( LOG_ERR, "Can't KILL server \"%s\"!", Req->argv[0] ); + conn = Client_Conn( Client_NextHop( c )); + assert( conn > NONE ); + Conn_Close( conn, NULL, "Nick collision for server!?", TRUE ); + } + } + else if( Client_Type( c ) != CLIENT_USER ) + { + if( Client != Client_ThisServer( )) IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client )); + else + { + /* Oops, what sould I close?? */ + Log( LOG_ERR, "Can't KILL \"%s\": invalid client type!", Req->argv[0] ); + conn = Client_Conn( Client_NextHop( c )); + assert( conn > NONE ); + Conn_Close( conn, NULL, "Collision for invalid client type!?", TRUE ); + } + } + else + { + /* Kill user NOW! */ + conn = Client_Conn( c ); + Client_Destroy( c, NULL, reason, FALSE ); + if( conn != NONE ) Conn_Close( conn, NULL, reason, TRUE ); + } } else Log( LOG_NOTICE, "Client with nick \"%s\" is unknown here.", Req->argv[0] ); /* Are we still connected or were we killed, too? */ - if( Client_GetFromConn( my_conn )) return CONNECTED; + if(( my_conn > NONE ) && ( Client_GetFromConn( my_conn ))) return CONNECTED; else return DISCONNECTED; } /* IRC_KILL */ @@ -168,6 +203,108 @@ return IRC_WriteStrClient( from, ERR_NOSUCHNICK_MSG, Client_ID( from ), Req->argv[0] ); } /* 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- */ Index: src/ngircd/irc.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc.h,v retrieving revision 1.36 retrieving revision 1.38 diff -u -u -r1.36 -r1.38 --- src/ngircd/irc.h 12 Dec 2002 12:23:43 -0000 1.36 +++ src/ngircd/irc.h 15 Jan 2003 13:49:20 -0000 1.38 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc.h,v 1.36 2002/12/12 12:23:43 alex Exp $ + * $Id: irc.h,v 1.38 2003/01/15 13:49:20 alex Exp $ * * IRC commands (header) */ @@ -22,6 +22,8 @@ GLOBAL BOOLEAN IRC_KILL 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_TRACE PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL BOOLEAN IRC_HELP PARAMS(( CLIENT *Client, REQUEST *Req )); #endif Index: src/ngircd/lists.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/lists.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -u -r1.10 -r1.11 --- src/ngircd/lists.c 12 Dec 2002 12:24:18 -0000 1.10 +++ src/ngircd/lists.c 26 Dec 2002 16:25:43 -0000 1.11 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: lists.c,v 1.10 2002/12/12 12:24:18 alex Exp $"; +static char UNUSED id[] = "$Id: lists.c,v 1.11 2002/12/26 16:25:43 alex Exp $"; #include "imp.h" #include @@ -331,19 +331,17 @@ if(( ! at ) && ( ! excl )) { - /* weder ! noch @Êvorhanden: als Nick annehmen */ - strncpy( TheMask, Pattern, MASK_LEN - 5 ); - TheMask[MASK_LEN - 5] = '\0'; - strcat( TheMask, "!*@*" ); + /* weder ! noch @ vorhanden: als Nick annehmen */ + strlcpy( TheMask, Pattern, sizeof( TheMask ) - 5 ); + strlcat( TheMask, "!*@*", sizeof( TheMask )); return TheMask; } if(( ! at ) && ( excl )) { /* Domain fehlt */ - strncpy( TheMask, Pattern, MASK_LEN - 3 ); - TheMask[MASK_LEN - 3] = '\0'; - strcat( TheMask, "@*" ); + strlcpy( TheMask, Pattern, sizeof( TheMask ) - 3 ); + strlcat( TheMask, "@*", sizeof( TheMask )); return TheMask; } @@ -351,17 +349,14 @@ { /* User fehlt */ *at = '\0'; at++; - strncpy( TheMask, Pattern, MASK_LEN - 4 ); - TheMask[MASK_LEN - 4] = '\0'; - strcat( TheMask, "!*@" ); - strncat( TheMask, at, strlen( TheMask ) - MASK_LEN - 1 ); - TheMask[MASK_LEN - 1] = '\0'; + strlcpy( TheMask, Pattern, sizeof( TheMask ) - strlen( at ) - 4 ); + strlcat( TheMask, "!*@", sizeof( TheMask )); + strlcat( TheMask, at, sizeof( TheMask )); return TheMask; } /* alle Teile vorhanden */ - strncpy( TheMask, Pattern, MASK_LEN - 1 ); - TheMask[MASK_LEN - 1] = '\0'; + strlcpy( TheMask, Pattern, sizeof( TheMask )); return TheMask; } /* Lists_MakeMask */ @@ -382,7 +377,7 @@ return NULL; } - strncpy( c2c->mask, Mask, MASK_LEN ); + strlcpy( c2c->mask, Mask, sizeof( c2c->mask )); c2c->channel = Chan; c2c->onlyonce = OnlyOnce; Index: src/ngircd/log.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/log.c,v retrieving revision 1.41 retrieving revision 1.43 diff -u -u -r1.41 -r1.43 --- src/ngircd/log.c 12 Dec 2002 12:24:18 -0000 1.41 +++ src/ngircd/log.c 31 Mar 2003 15:54:21 -0000 1.43 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: log.c,v 1.41 2002/12/12 12:24:18 alex Exp $"; +static char UNUSED id[] = "$Id: log.c,v 1.43 2003/03/31 15:54:21 alex Exp $"; #include "imp.h" #include @@ -52,7 +52,7 @@ { #ifdef USE_SYSLOG /* Syslog initialisieren */ - openlog( PACKAGE, LOG_CONS|LOG_PID, LOG_LOCAL5 ); + openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 ); #endif /* Hello World! */ @@ -95,7 +95,7 @@ * landen z.B. alle Ausgaben von assert()-Aufrufen. */ /* Dateiname zusammen bauen */ - sprintf( Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE, (LONG)getpid( )); + sprintf( Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE_NAME, (LONG)getpid( )); /* stderr umlenken */ fflush( stderr ); @@ -119,8 +119,8 @@ Log_Exit( VOID ) { /* Good Bye! */ - if( NGIRCd_Restart ) Log( LOG_NOTICE, "%s done (restarting).", PACKAGE ); - else Log( LOG_NOTICE, "%s done.", PACKAGE ); + if( NGIRCd_SignalRestart ) Log( LOG_NOTICE, "%s done (restarting).", PACKAGE_NAME ); + else Log( LOG_NOTICE, "%s done.", PACKAGE_NAME ); /* Error-File (stderr) loeschen */ if( unlink( Error_File ) != 0 ) Log( LOG_ERR, "Can't delete \"%s\": %s", Error_File, strerror( errno )); @@ -207,7 +207,7 @@ Log_Init_Resolver( VOID ) { #ifdef USE_SYSLOG - openlog( PACKAGE, LOG_CONS|LOG_PID, LOG_LOCAL5 ); + openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 ); #endif } /* Log_Init_Resolver */ Index: src/ngircd/messages.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/messages.h,v retrieving revision 1.59.2.1 retrieving revision 1.64 diff -u -u -r1.59.2.1 -r1.64 --- src/ngircd/messages.h 22 Dec 2002 23:42:28 -0000 1.59.2.1 +++ src/ngircd/messages.h 19 Mar 2003 21:16:16 -0000 1.64 @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) + * 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 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: messages.h,v 1.59.2.1 2002/12/22 23:42:28 alex Exp $ + * $Id: messages.h,v 1.64 2003/03/19 21:16:16 alex Exp $ * * IRC numerics (Header) */ @@ -22,7 +22,11 @@ #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_MYINFO_MSG "004 %s %s ngircd-%s %s %s" -#define RPL_FEATURE_MSG "005 %s NICKLEN=%d TOPICLEN=%d AWAYLEN=%d MAXCHANNELS=%d :are supported on this server" +#define RPL_ISUPPORT_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_STATSCOMMANDS_MSG "212 %s %s %ld %ld %ld" #define RPL_ENDOFSTATS_MSG "219 %s %c :End of STATS report" @@ -36,6 +40,7 @@ #define RPL_ADMINLOC1_MSG "257 %s :%s" #define RPL_ADMINLOC2_MSG "258 %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_NETUSERS_MSG "266 %s :Current global users: %ld, Max: %ld" @@ -104,6 +109,7 @@ #define ERR_BADCHANNELKEY_MSG "475 %s %s :Cannot join channel (+k)" #define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied" #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_NOOPERHOST_MSG "491 %s :Not configured for your host" Index: src/ngircd/ngircd.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/ngircd.c,v retrieving revision 1.64.2.1 retrieving revision 1.76 diff -u -u -r1.64.2.1 -r1.76 --- src/ngircd/ngircd.c 1 Jan 2003 13:47:42 -0000 1.64.2.1 +++ src/ngircd/ngircd.c 31 Mar 2003 15:54:21 -0000 1.76 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: ngircd.c,v 1.64.2.1 2003/01/01 13:47:42 alex Exp $"; +static char UNUSED id[] = "$Id: ngircd.c,v 1.76 2003/03/31 15:54:21 alex Exp $"; #include "imp.h" #include @@ -43,6 +43,10 @@ #include "parse.h" #include "irc.h" +#ifdef RENDEZVOUS +#include "rendezvous.h" +#endif + #include "exp.h" #include "ngircd.h" @@ -65,17 +69,16 @@ umask( 0077 ); - NGIRCd_Restart = FALSE; - NGIRCd_Quit = FALSE; - NGIRCd_NoDaemon = FALSE; - NGIRCd_Passive = FALSE; + NGIRCd_SignalQuit = NGIRCd_SignalRestart = NGIRCd_SignalRehash = FALSE; + NGIRCd_NoDaemon = NGIRCd_Passive = FALSE; #ifdef DEBUG NGIRCd_Debug = FALSE; #endif #ifdef SNIFFER NGIRCd_Sniffer = FALSE; #endif - strcpy( NGIRCd_ConfFile, CONFIG_FILE ); + strlcpy( NGIRCd_ConfFile, SYSCONFDIR, sizeof( NGIRCd_ConfFile )); + strlcat( NGIRCd_ConfFile, CONFIG_FILE, sizeof( NGIRCd_ConfFile )); /* Kommandozeile parsen */ for( i = 1; i < argc; i++ ) @@ -89,11 +92,10 @@ { if( i + 1 < argc ) { - /* Ok, danach kommt noch ein Parameter */ - strncpy( NGIRCd_ConfFile, argv[i + 1], FNAME_LEN - 1 ); - NGIRCd_ConfFile[FNAME_LEN - 1] = '\0'; + /* Ok, there's an parameter left */ + strlcpy( NGIRCd_ConfFile, argv[i + 1], sizeof( NGIRCd_ConfFile )); - /* zum uebernaechsten Parameter */ + /* next parameter */ i++; ok = TRUE; } } @@ -156,11 +158,10 @@ { if(( ! argv[i][n + 1] ) && ( i + 1 < argc )) { - /* Ok, danach kommt ein Leerzeichen */ - strncpy( NGIRCd_ConfFile, argv[i + 1], FNAME_LEN - 1 ); - NGIRCd_ConfFile[FNAME_LEN - 1] = '\0'; + /* Ok, next character is a blank */ + strlcpy( NGIRCd_ConfFile, argv[i + 1], sizeof( NGIRCd_ConfFile )); - /* zum uebernaechsten Parameter */ + /* go to the following parameter */ i++; n = (LONG)strlen( argv[i] ); ok = TRUE; } @@ -185,8 +186,8 @@ if( ! ok ) { - printf( "%s: invalid option \"-%c\"!\n", PACKAGE, argv[i][n] ); - printf( "Try \"%s --help\" for more information.\n", PACKAGE ); + printf( "%s: invalid option \"-%c\"!\n", PACKAGE_NAME, argv[i][n] ); + printf( "Try \"%s --help\" for more information.\n", PACKAGE_NAME ); exit( 1 ); } } @@ -194,8 +195,8 @@ } if( ! ok ) { - printf( "%s: invalid option \"%s\"!\n", PACKAGE, argv[i] ); - printf( "Try \"%s --help\" for more information.\n", PACKAGE ); + printf( "%s: invalid option \"%s\"!\n", PACKAGE_NAME, argv[i] ); + printf( "Try \"%s --help\" for more information.\n", PACKAGE_NAME ); exit( 1 ); } } @@ -220,7 +221,7 @@ exit( Conf_Test( )); } - while( ! NGIRCd_Quit ) + while( ! NGIRCd_SignalQuit ) { /* In der Regel wird ein Sub-Prozess ge-fork()'t, der * nicht mehr mit dem Terminal verbunden ist. Mit der @@ -238,7 +239,7 @@ if( pid < 0 ) { /* Fehler */ - printf( "%s: Can't fork: %s!\nFatal error, exiting now ...\n", PACKAGE, strerror( errno )); + printf( "%s: Can't fork: %s!\nFatal error, exiting now ...\n", PACKAGE_NAME, strerror( errno )); exit( 1 ); } @@ -250,8 +251,9 @@ /* Globale Variablen initialisieren */ NGIRCd_Start = time( NULL ); (VOID)strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start )); - NGIRCd_Restart = FALSE; - NGIRCd_Quit = FALSE; + NGIRCd_SignalRehash = FALSE; + NGIRCd_SignalRestart = FALSE; + NGIRCd_SignalQuit = FALSE; /* Module initialisieren */ Log_Init( ); @@ -260,6 +262,9 @@ Lists_Init( ); Channel_Init( ); Client_Init( ); +#ifdef RENDEZVOUS + Rendezvous_Init( ); +#endif Conn_Init( ); /* Wenn als root ausgefuehrt und eine andere UID @@ -292,13 +297,13 @@ * beim PASS-Befehl verwendete Syntax sowie die erweiterten Flags * sind in doc/Protocol.txt beschrieben. */ #ifdef IRCPLUS - sprintf( NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE, VERSION, IRCPLUSFLAGS ); + sprintf( NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE_NAME, PACKAGE_VERSION, IRCPLUSFLAGS ); #ifdef USE_ZLIB strcat( NGIRCd_ProtoID, "Z" ); #endif if( Conf_OperCanMode ) strcat( NGIRCd_ProtoID, "o" ); #else - sprintf( NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE, VERSION ); + sprintf( NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE_NAME, PACKAGE_VERSION ); #endif strcat( NGIRCd_ProtoID, " P" ); #ifdef USE_ZLIB @@ -313,7 +318,7 @@ if( Conn_InitListeners( ) < 1 ) { Log( LOG_ALERT, "Server isn't listening on a single port!" ); - Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE ); + Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); exit( 1 ); } @@ -322,6 +327,9 @@ /* Alles abmelden */ Conn_Exit( ); +#ifdef RENDEZVOUS + Rendezvous_Exit( ); +#endif Client_Exit( ); Channel_Exit( ); Lists_Exit( ); @@ -338,9 +346,9 @@ STATIC CHAR version[126]; #ifdef CVSDATE - sprintf( version, "%s %s(%s)-%s", PACKAGE, VERSION, CVSDATE, NGIRCd_VersionAddition( )); + sprintf( version, "%s %s(%s)-%s", PACKAGE_NAME, PACKAGE_VERSION, CVSDATE, NGIRCd_VersionAddition( )); #else - sprintf( version, "%s %s-%s", PACKAGE, VERSION, NGIRCd_VersionAddition( )); + sprintf( version, "%s %s-%s", PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_VersionAddition( )); #endif return version; } /* NGIRCd_Version */ @@ -349,7 +357,7 @@ GLOBAL CHAR * NGIRCd_VersionAddition( VOID ) { - STATIC CHAR txt[64]; + STATIC CHAR txt[200]; strcpy( txt, "" ); @@ -361,6 +369,14 @@ if( txt[0] ) strcat( txt, "+" ); strcat( txt, "ZLIB" ); #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 if( txt[0] ) strcat( txt, "+" ); strcat( txt, "DEBUG" ); @@ -378,12 +394,12 @@ strcat( txt, "IRCPLUS" ); #endif - if( txt[0] ) strcat( txt, "-" ); - strcat( txt, TARGET_CPU ); - strcat( txt, "/" ); - strcat( txt, TARGET_VENDOR ); - strcat( txt, "/" ); - strcat( txt, TARGET_OS ); + if( txt[0] ) strlcat( txt, "-", sizeof( txt )); + strlcat( txt, TARGET_CPU, sizeof( txt )); + strlcat( txt, "/", sizeof( txt )); + strlcat( txt, TARGET_VENDOR, sizeof( txt )); + strlcat( txt, "/", sizeof( txt )); + strlcat( txt, TARGET_OS, sizeof( txt )); return txt; } /* NGIRCd_VersionAddition */ @@ -393,15 +409,19 @@ NGIRCd_Rehash( VOID ) { CHAR old_name[CLIENT_ID_LEN]; - + + Log( LOG_NOTICE|LOG_snotice, "Re-reading configuration NOW!" ); + NGIRCd_SignalRehash = FALSE; + /* Alle Listen-Sockets schliessen */ Conn_ExitListeners( ); /* Alten Server-Namen merken */ + assert( sizeof( old_name ) == sizeof( Conf_ServerName )); strcpy( old_name, Conf_ServerName ); /* Konfiguration neu lesen ... */ - Conf_Init( ); + Conf_Rehash( ); /* Alten Server-Namen wiederherstellen: dieser * kann nicht zur Laufzeit geaendert werden ... */ @@ -417,7 +437,10 @@ /* Listen-Sockets neu anlegen: */ Conn_InitListeners( ); - Log( LOG_INFO, "Re-reading of configuration done." ); + /* Sync configuration with established connections */ + Conn_SyncServerStruct( ); + + Log( LOG_NOTICE|LOG_snotice, "Re-reading of configuration done." ); } /* NGIRCd_Rehash */ @@ -481,23 +504,21 @@ case SIGINT: case SIGQUIT: /* wir soll(t)en uns wohl beenden ... */ - 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; + NGIRCd_SignalQuit = TRUE; break; case SIGHUP: /* Konfiguration neu einlesen: */ - Log( LOG_WARNING|LOG_snotice, "Got HUP signal, re-reading configuration ..." ); - NGIRCd_Rehash( ); + NGIRCd_SignalRehash = TRUE; break; case SIGCHLD: /* Child-Prozess wurde beendet. Zombies vermeiden: */ while( waitpid( -1, NULL, WNOHANG ) > 0); break; +#ifdef DEBUG default: /* unbekanntes bzw. unbehandeltes Signal */ - Log( LOG_NOTICE, "Got signal %d! Ignored.", Signal ); + Log( LOG_DEBUG, "Got signal %d! Ignored.", Signal ); +#endif } } /* Signal_Handler */ Index: src/ngircd/ngircd.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/ngircd.h,v retrieving revision 1.17 retrieving revision 1.19 diff -u -u -r1.17 -r1.19 --- src/ngircd/ngircd.h 12 Dec 2002 11:30:23 -0000 1.17 +++ src/ngircd/ngircd.h 26 Dec 2002 16:48:14 -0000 1.19 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: ngircd.h,v 1.17 2002/12/12 11:30:23 alex Exp $ + * $Id: ngircd.h,v 1.19 2002/12/26 16:48:14 alex Exp $ * * Prototypes of the "main module". */ @@ -37,14 +37,15 @@ GLOBAL BOOLEAN NGIRCd_Passive; /* nicht zu anderen Servern connecten */ -GLOBAL BOOLEAN NGIRCd_Quit; /* TRUE: ngIRCd beenden */ -GLOBAL BOOLEAN NGIRCd_Restart; /* TRUE: neu starten */ +GLOBAL BOOLEAN NGIRCd_SignalQuit; /* TRUE: quit server*/ +GLOBAL BOOLEAN NGIRCd_SignalRestart; /* TRUE: restart server */ +GLOBAL BOOLEAN NGIRCd_SignalRehash; /* TRUE: reload configuration */ GLOBAL CHAR NGIRCd_DebugLevel[2]; /* Debug-Level fuer IRC_VERSION() */ GLOBAL CHAR NGIRCd_ConfFile[FNAME_LEN]; /* Konfigurationsdatei */ -GLOBAL CHAR NGIRCd_ProtoID[1024]; /* Protokoll- und Server-Identifikation */ +GLOBAL CHAR NGIRCd_ProtoID[COMMAND_LEN];/* Protokoll- und Server-Identifikation */ GLOBAL CHAR *NGIRCd_Version PARAMS((VOID )); Index: src/ngircd/parse.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/parse.c,v retrieving revision 1.52 retrieving revision 1.59 diff -u -u -r1.52 -r1.59 --- src/ngircd/parse.c 18 Dec 2002 13:53:20 -0000 1.52 +++ src/ngircd/parse.c 15 Jan 2003 13:49:20 -0000 1.59 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: parse.c,v 1.52 2002/12/18 13:53:20 alex Exp $"; +static char UNUSED id[] = "$Id: parse.c,v 1.59 2003/01/15 13:49:20 alex Exp $"; #include "imp.h" #include @@ -24,7 +24,7 @@ #include "ngircd.h" #include "defines.h" -#include "conn.h" +#include "conn-func.h" #include "client.h" #include "channel.h" #include "log.h" @@ -54,7 +54,9 @@ { "AWAY", IRC_AWAY, CLIENT_USER, 0, 0, 0 }, { "CONNECT", IRC_CONNECT, 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 }, + { "HELP", IRC_HELP, CLIENT_USER, 0, 0, 0 }, { "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "ISON", IRC_ISON, CLIENT_USER, 0, 0, 0 }, { "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, @@ -83,6 +85,7 @@ { "STATS", IRC_STATS, 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 }, + { "TRACE", IRC_TRACE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "USER", IRC_USER, 0xFFFF, 0, 0, 0 }, { "USERHOST", IRC_USERHOST, CLIENT_USER, 0, 0, 0 }, { "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, @@ -163,7 +166,7 @@ *ptr = '\0'; #ifndef STRICT_RFC /* multiple Leerzeichen als Trenner vor - *Parametertrennern ignorieren */ + * Parametern ignorieren */ while( *(ptr + 1) == ' ' ) ptr++; #endif } @@ -326,46 +329,50 @@ client = Client_GetFromConn( Idx ); assert( client != NULL ); - /* Statuscode, der geforwarded werden muss? */ - if(( strlen( Req->command ) == 3 ) && ( atoi( Req->command ) > 100 )) + /* Statuscode? */ + if(( Client_Type( client ) == CLIENT_SERVER ) && ( strlen( Req->command ) == 3 ) && ( atoi( Req->command ) > 100 )) { - /* Befehl ist ein Statuscode */ + /* Command is a status code from an other server */ - /* Zielserver ermitteln */ - if(( Client_Type( client ) == CLIENT_SERVER ) && ( Req->argc > 0 )) target = Client_Search( Req->argv[0] ); + /* Determine target */ + if( Req->argc > 0 ) target = Client_Search( Req->argv[0] ); else target = NULL; 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] ); else Log( LOG_WARNING, "Unknown target for status code %s!", Req->command ); return TRUE; } 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 )); return TRUE; } - /* Quell-Client ermitteln */ + /* Determine source */ if( ! Req->prefix[0] ) { - Log( LOG_WARNING, "Got status code without prefix!?" ); + /* Oops, no prefix!? */ + Log( LOG_WARNING, "Got status code %s from \"%s\" without prefix!?", Req->command, Client_ID( client )); return TRUE; } else prefix = Client_Search( Req->prefix ); if( ! prefix ) { - Log( LOG_WARNING, "Got status code from unknown source: \"%s\"", Req->prefix ); + /* Oops, unknown prefix!? */ + Log( LOG_WARNING, "Got status code %s from unknown source: \"%s\"", Req->command, Req->prefix ); return TRUE; } - /* Statuscode weiterleiten */ - strcpy( str, Req->command ); + /* Forward status code */ + strlcpy( str, Req->command, sizeof( str )); for( i = 0; i < Req->argc; i++ ) { - if( i < Req->argc - 1 ) strcat( str, " " ); - else strcat( str, " :" ); - strcat( str, Req->argv[i] ); + if( i < Req->argc - 1 ) strlcat( str, " ", sizeof( str )); + else strlcat( str, " :", sizeof( str )); + strlcat( str, Req->argv[i], sizeof( str )); } return IRC_WriteStrClientPrefix( target, prefix, "%s", str ); } Index: src/ngircd/parse.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/parse.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- src/ngircd/parse.h 18 Dec 2002 13:53:20 -0000 1.9 +++ src/ngircd/parse.h 3 Jan 2003 22:03:51 -0000 1.10 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: parse.h,v 1.9 2002/12/18 13:53:20 alex Exp $ + * $Id: parse.h,v 1.10 2003/01/03 22:03:51 alex Exp $ * * IRC command parser and validator (header) */ @@ -30,7 +30,7 @@ typedef struct _COMMAND { CHAR *name; /* command name */ - BOOLEAN (*function)( CLIENT *Client, REQUEST *Request ); + BOOLEAN (*function) PARAMS(( CLIENT *Client, REQUEST *Request )); CLIENT_TYPE type; /* valid client types (bit mask) */ LONG lcount, rcount; /* number of local and remote calls */ LONG bytes; /* number of bytes created */ Index: src/ngircd/resolve.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/resolve.c,v retrieving revision 1.4 retrieving revision 1.6 diff -u -u -r1.4 -r1.6 --- src/ngircd/resolve.c 12 Dec 2002 12:24:18 -0000 1.4 +++ src/ngircd/resolve.c 21 Apr 2003 10:52:51 -0000 1.6 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: resolve.c,v 1.4 2002/12/12 12:24:18 alex Exp $"; +static char UNUSED id[] = "$Id: resolve.c,v 1.6 2003/04/21 10:52:51 alex Exp $"; #include "imp.h" #include @@ -174,7 +174,7 @@ /* Namen aufloesen */ h = gethostbyaddr( (CHAR *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET ); - if( h ) strcpy( hostname, h->h_name ); + if( h ) strlcpy( hostname, h->h_name, sizeof( hostname )); else { #ifdef h_errno @@ -182,11 +182,11 @@ #else Log_Resolver( LOG_WARNING, "Can't resolve address \"%s\"!", inet_ntoa( Addr->sin_addr )); #endif - strcpy( hostname, inet_ntoa( Addr->sin_addr )); + strlcpy( hostname, inet_ntoa( Addr->sin_addr ), sizeof( hostname )); } /* Antwort an Parent schreiben */ - if( write( w_fd, hostname, strlen( hostname ) + 1 ) != ( strlen( hostname ) + 1 )) + if( (size_t)write( w_fd, hostname, strlen( hostname ) + 1 ) != (size_t)( strlen( hostname ) + 1 )) { Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno )); close( w_fd ); @@ -213,7 +213,7 @@ if( h ) { addr = (struct in_addr *)h->h_addr; - strcpy( ip, inet_ntoa( *addr )); + strlcpy( ip, inet_ntoa( *addr ), sizeof( ip )); } else { @@ -226,7 +226,7 @@ } /* Antwort an Parent schreiben */ - if( write( w_fd, ip, strlen( ip ) + 1 ) != ( strlen( ip ) + 1 )) + if( (size_t)write( w_fd, ip, strlen( ip ) + 1 ) != (size_t)( strlen( ip ) + 1 )) { Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno )); close( w_fd ); Index: src/ngircd/resolve.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/resolve.h,v retrieving revision 1.3 retrieving revision 1.5 diff -u -u -r1.3 -r1.5 --- src/ngircd/resolve.h 12 Dec 2002 12:23:43 -0000 1.3 +++ src/ngircd/resolve.h 21 Apr 2003 10:53:10 -0000 1.5 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: resolve.h,v 1.3 2002/12/12 12:23:43 alex Exp $ + * $Id: resolve.h,v 1.5 2003/04/21 10:53:10 alex Exp $ * * Asynchronous resolver (header) */ @@ -18,11 +18,11 @@ #define __resolve_h__ -#include -#include #ifdef HAVE_SYS_SELECT_H # include #endif +#include +#include typedef struct _Res_Stat Index: src/portab/Makefile.am =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/portab/Makefile.am,v retrieving revision 1.4 retrieving revision 1.7 diff -u -u -r1.4 -r1.7 --- src/portab/Makefile.am 22 May 2002 09:09:43 -0000 1.4 +++ src/portab/Makefile.am 3 Jan 2003 22:04:14 -0000 1.7 @@ -9,18 +9,22 @@ # 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.4 2002/05/22 09:09:43 alex Exp $ +# $Id: Makefile.am,v 1.7 2003/01/03 22:04:14 alex Exp $ # AUTOMAKE_OPTIONS = ansi2knr noinst_LIBRARIES = libngportab.a -libngportab_a_SOURCES = vsnprintf.c +libngportab_a_SOURCES = strlcpy.c vsnprintf.c check_PROGRAMS = portabtest portabtest_SOURCES = portabtest.c + +portabtest_LDFLAGS = -L. + +portabtest_LDADD = -lngportab noinst_HEADERS = imp.h exp.h portab.h Index: src/portab/portab.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/portab/portab.h,v retrieving revision 1.9 retrieving revision 1.15 diff -u -u -r1.9 -r1.15 --- src/portab/portab.h 12 Dec 2002 11:26:08 -0000 1.9 +++ src/portab/portab.h 31 Mar 2003 19:01:02 -0000 1.15 @@ -1,17 +1,16 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) + * Copyright (c)2001-2003 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. + * 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: portab.h,v 1.9 2002/12/12 11:26:08 alex Exp $ + * $Id: portab.h,v 1.15 2003/03/31 19:01:02 alex Exp $ * - * portab.h: "Portabilitaets-Definitionen" + * Portability functions and declarations (header for libngbportab). */ @@ -21,8 +20,12 @@ #include "config.h" +#ifdef HAVE_SYS_TYPES_H +#include +#endif + -/* Compiler Features */ +/* compiler features */ #ifdef __GNUC__ # define PUNUSED(x) __attribute__ ((unused)) x @@ -41,7 +44,7 @@ #endif -/* Keywords */ +/* keywords */ #define EXTERN extern #define STATIC static @@ -50,7 +53,7 @@ #define REGISTER register -/* Datatentypen */ +/* datatypes */ #ifndef PROTOTYPES # ifndef signed @@ -105,29 +108,50 @@ #endif -/* configure-Optionen */ +/* target constants */ + +#ifndef TARGET_OS +#define TARGET_OS "unknown" +#endif + +#ifndef TARGET_CPU +#define TARGET_CPU "unknown" +#endif + +#ifndef TARGET_VENDOR +#define TARGET_VENDOR "unknown" +#endif + + +/* configure options */ #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 */ +#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 -/* Konstanten */ +#ifndef HAVE_STRLCPY +EXTERN size_t strlcpy PARAMS(( CHAR *dst, CONST CHAR *src, size_t size )); +#endif -#ifndef TARGET_OS -#define TARGET_OS "unknown" +#ifndef HAVE_VSNPRINTF +#include +EXTERN INT vsnprintf PARAMS(( CHAR *str, size_t count, CONST CHAR *fmt, va_list args )); #endif -#ifndef TARGET_CPU -#define TARGET_CPU "unknown" +#ifndef PACKAGE_NAME +#define PACKAGE_NAME PACKAGE #endif -#ifndef TARGET_VENDOR -#define TARGET_VENDOR "unknown" +#ifndef PACKAGE_VERSION +#define PACKAGE_VERSION VERSION #endif Index: src/portab/portabtest.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/portab/portabtest.c,v retrieving revision 1.9 retrieving revision 1.11 diff -u -u -r1.9 -r1.11 --- src/portab/portabtest.c 12 Dec 2002 11:38:46 -0000 1.9 +++ src/portab/portabtest.c 4 Jan 2003 10:40:01 -0000 1.11 @@ -14,30 +14,53 @@ #include "portab.h" -static char UNUSED id[] = "$Id: portabtest.c,v 1.9 2002/12/12 11:38:46 alex Exp $"; +static char UNUSED id[] = "$Id: portabtest.c,v 1.11 2003/01/04 10:40:01 alex Exp $"; #include "imp.h" +#include #include +#include +#include #include "exp.h" +LOCAL VOID Panic PARAMS (( CHAR *Reason, INT Code )); + + GLOBAL int main( VOID ) { - /* Datentypen pruefen */ - if( FALSE != 0 ) return 1; - if( TRUE != 1 ) return 1; - if( sizeof( INT8 ) != 1 ) return 1; - if( sizeof( UINT8 ) != 1 ) return 1; - if( sizeof( INT16 ) != 2 ) return 1; - if( sizeof( UINT16 ) != 2 ) return 1; - if( sizeof( INT32 ) != 4 ) return 1; - if( sizeof( UINT32 ) != 4 ) return 1; + /* validate datatypes */ + if( FALSE != 0 ) Panic( "FALSE", 1 ); + if( TRUE != 1 ) Panic( "TRUE", 1 ); + if( sizeof( INT8 ) != 1 ) Panic( "INT8", 1 ); + if( sizeof( UINT8 ) != 1 ) Panic( "UINT8", 1 ); + if( sizeof( INT16 ) != 2 ) Panic( "INT16", 1 ); + if( sizeof( UINT16 ) != 2 ) Panic( "UINT16", 1 ); + if( sizeof( INT32 ) != 4 ) Panic( "INT32", 1 ); + if( sizeof( UINT32 ) != 4 ) Panic( "UINT32", 1 ); + +#ifdef PROTOTYPES + /* check functions */ + if( ! snprintf ) Panic( "snprintf", 2 ); + if( ! vsnprintf ) Panic( "vsnprintf", 2 ); + if( ! strlcpy ) Panic( "strlcpy", 2 ); + if( ! strlcat ) Panic( "strlcat", 2 ); +#endif - /* kein Fehler */ + /* ok, no error */ return 0; } /* 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- */ Index: src/portab/vsnprintf.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/portab/vsnprintf.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- src/portab/vsnprintf.c 12 Dec 2002 11:37:11 -0000 1.4 +++ src/portab/vsnprintf.c 21 Apr 2003 10:53:38 -0000 1.5 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: vsnprintf.c,v 1.4 2002/12/12 11:37:11 alex Exp $"; +static char UNUSED id[] = "$Id: vsnprintf.c,v 1.5 2003/04/21 10:53:38 alex Exp $"; #include "imp.h" @@ -98,6 +98,7 @@ /* only include stdio.h if we are not re-defining snprintf or vsnprintf */ #include /* make the compiler happy with an empty file */ +void dummy_snprintf PARAMS(( void )); void dummy_snprintf PARAMS(( void )) { } #else Index: src/testsuite/getpid.sh =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/testsuite/getpid.sh,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -u -u -r1.2 -r1.2.4.1 --- src/testsuite/getpid.sh 10 Nov 2002 14:28:06 -0000 1.2 +++ src/testsuite/getpid.sh 22 Apr 2003 20:01:23 -0000 1.2.4.1 @@ -1,6 +1,6 @@ #!/bin/sh # ngIRCd Test Suite -# $Id: getpid.sh,v 1.2 2002/11/10 14:28:06 alex Exp $ +# $Id: getpid.sh,v 1.2.4.1 2003/04/22 20:01:23 alex Exp $ # wurde ein Name uebergeben? [ $# -ne 1 ] && exit 1 @@ -18,7 +18,9 @@ # PID ermitteln ps $PS_FLAGS > procs.tmp -pid=$( cat procs.tmp | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n | head $HEAD_FLAGS ) +cat procs.tmp | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n > pids.tmp +pid=`head $HEAD_FLAGS pids.tmp` +rm -rf procs.tmp pids.tmp # ermittelte PID validieren [ "$pid" -gt 1 ] > /dev/null 2>&1 Index: src/testsuite/stress-server.sh =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/testsuite/stress-server.sh,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -u -u -r1.6 -r1.6.4.1 --- src/testsuite/stress-server.sh 23 Sep 2002 22:07:43 -0000 1.6 +++ src/testsuite/stress-server.sh 22 Apr 2003 20:01:23 -0000 1.6.4.1 @@ -1,10 +1,10 @@ #!/bin/sh # ngIRCd Test Suite -# $Id: stress-server.sh,v 1.6 2002/09/23 22:07:43 alex Exp $ +# $Id: stress-server.sh,v 1.6.4.1 2003/04/22 20:01:23 alex Exp $ [ -z "$srcdir" ] && srcdir=`dirname $0` -[ $1 -gt 0 ] 2> /dev/null && CLIENTS=$1 || CLIENTS=5 +[ "$1" -gt 0 ] 2> /dev/null && CLIENTS="$1" || CLIENTS=5 name=`basename $0` test=`echo ${name} | cut -d '.' -f 1`