1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-11-04 16:03:00 +00:00

Compare commits

..

37 Commits

Author SHA1 Message Date
Alexander Barton
bb180adb49 - Versionsnummer auf 0.5.3 angehoben. 2002-11-08 21:17:17 +00:00
Alexander Barton
e2c896cb7e - Dokumentation aktualisiert. 2002-11-08 21:17:03 +00:00
Alexander Barton
2c7b276cc5 - Dokumentation aktualisiert. 2002-11-04 20:03:38 +00:00
Alexander Barton
4decf352fa - Versionsnummer auf 0.5.3-pre1 angehoben. 2002-11-04 19:34:28 +00:00
Alexander Barton
19c2e79b72 - Code-Formatierung korrigiert: da waren Tabs wo keine hin gehoerten. 2002-11-04 19:27:23 +00:00
Alexander Barton
49d9585242 - "back-ports" aus CVS-HEAD fuer Version 0.5.3 2002-11-04 19:18:39 +00:00
Alexander Barton
9487976620 - Versionsnummer auf 0.5.3-pre1 angehoben. 2002-11-04 19:17:52 +00:00
Alexander Barton
35d1c2fc06 - fehlende $Id$-Tags ergaenzt. 2002-10-04 13:12:46 +00:00
Alexander Barton
c557a2920e - Versionsnummer auf 0.5.2 angehoben. 2002-10-04 12:47:14 +00:00
Alexander Barton
845b295e7d - Dokumentation aktualisiert. 2002-10-04 12:43:53 +00:00
Alexander Barton
59b5b0e025 - aus HEAD: der Buffer fuer das Prefix war zu klein. 2002-10-04 12:40:58 +00:00
Alexander Barton
bdd23ece63 - Backports aus HEAD: Format-String- und Buffer-Overflow-Bugs behoben,
die zum Abbruch des Servers fuehren konnten.
2002-10-04 11:31:28 +00:00
Alexander Barton
a119700c62 - Version angepasst. 2002-10-03 17:09:00 +00:00
Alexander Barton
b0e7f564c7 - Dokumentation aktualisiert. 2002-10-03 17:08:53 +00:00
Alexander Barton
d69410f28d - Backports aus CVS HEAD. 2002-10-03 16:13:38 +00:00
Alexander Barton
d5fa1f76bb - Versionsnummer auf 0.5.1 angehoben. 2002-10-03 16:10:25 +00:00
Alexander Barton
3dec467ebc - Dokumentation aktualisiert. 2002-10-03 16:09:50 +00:00
Alexander Barton
a5fe6d6783 Test-Suite: es werden nun nur noch 5 Sessions parallel gestartet. 2002-09-23 21:55:06 +00:00
Alexander Barton
37b579f3cd - Dokumentation aktualisiert. 2002-09-23 21:54:43 +00:00
Alexander Barton
268d02b90d - Versionsnummer auf "0.5.CVS" angepasst. 2002-09-22 21:39:23 +00:00
Alexander Barton
037418e8c0 - Dokumentation aktualisiert. 2002-09-22 21:38:34 +00:00
Alexander Barton
45c3886800 - in RPL_YOURHOST_MSG wurde ein fehlerhafter Versionsstring geliefert. 2002-09-22 21:37:06 +00:00
Alexander Barton
38f387146f - Dokumentation aktualisiert. 2002-09-20 17:20:48 +00:00
Alexander Barton
fcbd44caa9 - Version auf 0.5.0 angehoben. 2002-09-20 16:16:20 +00:00
Alexander Barton
f027308798 - Dokumentation aktualisiert. 2002-09-20 15:44:53 +00:00
Alexander Barton
462540e079 - getpid.sh wird nun auch bei "make distcheck" gefunden. 2002-09-20 15:39:55 +00:00
Alexander Barton
7721c79747 - Dokumentation aktualisiert. 2002-09-20 15:25:50 +00:00
Alexander Barton
678a4dfba0 - neues Script getpid.sh (aus HEAD): dieses ermittelt nun die PID des Servers. 2002-09-20 15:19:55 +00:00
Alexander Barton
8c956d25b7 - Backports aus CVS-HEAD: neues Script getpid.sh ermittelt nun die PID. 2002-09-20 15:18:56 +00:00
Alexander Barton
9f9f676716 - die ermittelte PID des ngIRCd wird besser validiert (leer?). 2002-09-20 13:55:51 +00:00
Alexander Barton
cf20b16d2a - Flags bei "ps" werden in anderer Reihenfolge geprueft (aus CVS-HEAD). 2002-09-20 13:46:22 +00:00
Alexander Barton
97d4e580ae - Dokumentation aktualisiert. 2002-09-19 10:18:29 +00:00
Alexander Barton
b072b7712c - Fehler bei Validierung von ServerAdminInfo2 behoben. 2002-09-19 10:17:50 +00:00
Alexander Barton
fd6a7f67ce - Dokumentation aktualisiert. 2002-09-19 09:35:21 +00:00
Alexander Barton
6c04ba84cd - Versionsnummer auf 0.5.0-pre2 angehoben. 2002-09-17 17:29:38 +00:00
Alexander Barton
ef6b7c7c63 - Fix in IRC_WriteStrServersPrefix() war "badly broken" -- behoben. 2002-09-17 17:29:20 +00:00
Alexander Barton
2592e73da0 - Dokumentation aktualisiert. 2002-09-17 17:28:45 +00:00
116 changed files with 5231 additions and 11055 deletions

32
AUTHORS
View File

@@ -1,35 +1,13 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2005 Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- AUTHORS and CONTRIBUTORS -- -- AUTHORS / Autoren --
Main Authors Alexander Barton, alex@arthur.ath.cx
~~~~~~~~~~~~
Alexander Barton, <alex@barton.de> (alex)
Contributors
~~~~~~~~~~~~
Goetz Hoffart, <goetz@hoffart.de> (goetz)
Ilja Osthoff, <i.osthoff@gmx.net> (ilja)
Benjamin Pineau, <ben@zouh.org>
Sean Reifschneider, <jafo-rpms@tummy.com>
Florian Westphal, <westphal@foo.fh-furtwangen.de>
Code snippets
~~~~~~~~~~~~~
J. Kercheval: pattern matching functions
Patrick Powell, <papowell@astart.com>: snprintf()-function
Andrew Tridgell & Martin Pool: strl{cpy|cat}()-functions
--
$Id: AUTHORS,v 1.8.2.2 2005/01/26 13:26:41 alex Exp $

268
ChangeLog
View File

@@ -1,272 +1,15 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2005 Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- ChangeLog -- -- ChangeLog / Aenderungen --
ngircd 0.8.2 (2005-01-26)
- Added doc/SSL.txt to distribution.
- Fixed a buffer overflow that could cause the daemon to crash. Bug found
by Florian Westphal, <westphal@foo.fh-furtwangen.de>.
- Fixed a possible buffer underrun when reading the MOTD file. Thanks
to Florian Westphal, <westphal@foo.fh-furtwangen.de>.
- Fixed detection of IRC lines which are too long to send. Detected by
Florian Westphal, <westphal@foo.fh-furtwangen.de>.
- Fixed return values of our own implementation of strlcpy(). The code has
been taken from rsync and they fixed it, but we didn't until today :-/
It has only been used when the system didn't implement strlcpy by itself,
not on "modern" systems. Florian Westphal, <westphal@foo.fh-furtwangen.de>.
ngircd 0.8.1 (2004-12-25)
- Autoconf: Updated config.guess and config.sub
- Added some more debug code ...
- Fixed wrong variable names in output of "ngircd --configtest".
- Debian: Fxied the name of the "default file" in the init script for
ngircd-full packages. And do the test if the binary is executable after
reading this file.
- Enhanced the "test suite": please have a look at src/testsuite/README!
ngircd 0.8.0 (2004-06-26)
- Fixed wrong buffer size calculation for results of the resolver.
ngircd 0.8.0-pre2 (2004-05-16)
- Enhanced logging to console when running in "no-detached mode": added
PID and log messages of resolver sub-processes.
- Fixed host name lookups when using IDENT user lookups.
- "make clean" and "make maintainer-clean" remove more files mow.
ngIRCd 0.8.0-pre1 (2004-05-07)
- Two new configuration options: "ChrootDir" and "MotdPhrase", thanks to
Benjamin Pineau <ben@zouh.org>. Now you can force the daemon to change
its root and working directory to something "safe". MotdPhrase is used
to define an "MOTD string" instead of a whole file, useful if the
"real" MOTD file would be outside the "jail".
- INVITE- and BAN-lists become synchronized between IRC+ servers when
establishing new connections, if the peer supports this as well.
- Reorganized autogen.sh and configure scripts.
- Fixed a wrong assert() which could cause the daemon to exit spuriously
when closing down connections.
- Better logging of decompression errors returned by zlib.
- Servers other than the destination server didn't clean up the invite
list of an "invite-only" channel properly when an INVITE'd user joined.
- Changed the reply of the MODE command to match the syntax of the
original ircd exactly: the unnecessary but missing ":" before the last
parameter has been added.
- Fixed TRACE: don't output "Serv" lines for ourself; display more info.
- Results of the resolver (hostnames and IDENT names) are discarded after
the client is successfully registered with the server.
- Better logging while establishing and shutting down connections.
- The type of service (TOS) of all sockets is set to "interactive" now.
- Added short command line option "-t" as alternative to "--configtest".
- Added optional support for "IDENT" lookups on incoming connections. You
have to enable this function with the ./configure switch "--with-ident".
The default is not to do IDENT lookups.
ngIRCd 0.7.7 (2004-02-05)
- The info text ("real name") of users is set to "-" if none has been
specified using the USER command (e. g. "USER user * * :"). Reason:
the original ircd doesn't like empty ones and would KILL such users.
- Fixed (optional) TCP Wrapper test which was broken and could result in
false results. Thanks to Fuminori Tanizaki <tany@mcnet.ad.jp>!
- Removed "USE_" prefixes of configuration #defines.
ngIRCd 0.7.6 (2003-12-05)
- Fixed abort() ("server crash") when INVITE'ing users to nonexistent
channels. Bug found by <hiddenx@wp.pl>.
- Extended version numbering of CVS versions (added date).
- Enhanced/fixed doc/Protocol.txt;
ngIRCd 0.7.5 (2003-11-07)
- Fixed ban behavior: users which are banned from a channel can't no
longer send PRIVMSG's to this channel (fixes Bug #47).
- Fixed and enhanced the "penalty handling" of the server: commands that
require more resources block the client for a short time.
- Changed the internal time resolution to one second.
- New configuration variable "MaxConnectionsIP" to limit the number of
simultaneous connections from a single IP that the server will accept.
This configuration options lowers the risk of denial of service attacks
(DoS), the default is 5 connections per client IP.
- Fixed build problems under Mac OS X 10.3.
- Use "-pipe" when compiling with gcc, speeds things up a little :-)
- Added new configuration variable "Listen" to bind all listening
sockets of the server to a single IP address.
- Suppress misleading error message of diff during make run.
- Enhanced test-suite and made it work on GNU/Hurd.
- Fixed minor typo in debug output :-)
ngIRCd 0.7.1 (2003-07-18)
- Included files to build Debian packages (located in "debian/").
- Updated config.guess and config.sub to newer upstream versions.
- NJOIN propagates user channel modes correctly again ... Upsa.
- Made Makefile more compatible with "make -j<n>".
- Added support for GNU/Hurd.
- Fixed a compiler warning related to an unnecessary assert().
- Enhanced VERSION command when using debug versions.
ngIRCd 0.7.0 (2003-05-01)
- "ServerName" is checked better now: a dot (".") is required.
- The KILL command 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 occurred.
- 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 <name> <port>" to enable and connect an
configured server and "CONNECT <name> <port> <host> <mypwd> <peerpwd>"
to add a new server (ngIRCd tries to connect new servers only once!).
- Added DISCONNECT command ("DISCONNECT <name>") to disable servers.
- Restructured the documentation: Now the main language is English. The
german documentation has been removed (until there is a maintainer).
- Enhanced killing of users caused by a nickname collision.
- Better error detection for status code ("numerics") forwarding.
- Moved tool functions to own library: "libngtool".
- New command TRACE (you can trace only servers at the moment).
- New command HELP that lists all understood commands.
- There should no longer remain "unknown connections" (see e.g. LUSERS)
if an outgoing server link can't be established.
- Added AC_PREREQ(2.50) to configure.in for better autoconf compatibility.
- Conn_Close() now handles recursive calls for the same link correctly.
- ngIRCd can register itself with Rendezvous: to enable support pass the
new switch "--with-rendezvous" to configure.
- Added support for TCP Wrappers library: pass "--with-tcp-wrappers" to
configure to enable it.
- Changed some configure options to use "--with"/"--without" as prefix
instead of "--enable"/"--disable": "--without-syslog", "--without-zlib",
"--with-tcp-wrappers", and "--with-rendezvous".
- Better error reporting to clients on connect.
- Enhanced manual pages ngircd(8) and ngircd.conf(5).
- Documentation is now installed in $(datadir)/doc/ngircd.
- Enhanced hanling of NJOIN in case of nick collisions.
ngIRCd 0.6.1, 2003-01-21
- Fixed KILL: you can't crash the server by killing yourself any more,
ngIRCd no longer sends a QUIT to other servers after the KILL, and you
can kill only valid users now.
- The server no longer forwards commands to ordinary users, instead it
answers with the correct error message ("no such server") now.
- WHOIS commands weren't always forwarded as requested.
- 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 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.
- The server didn't validate weather a target user is a valid channel
member when changing his channel user modes which could crash ngIRCd.
Older changes (sorry, only available in german language):
ngIRCd 0.6.0, 2002-12-24
ngIRCd 0.6.0-pre2, 2002-12-23
- neuer Numeric 005 ("Features") beim Connect.
- LUSERS erweitert: nun wird die maximale Anzahl der lokalen und globalen
Clients, die dem Server bzw. im Netzwerk seit dem letzten (Re-)Start
dem Server gleichzeitig bekannt waren, angezeigt.
ngIRCd 0.6.0-pre1, 2002-12-18
- beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR
noch eine Statistik ueber die empfangene und gesendete Datenmenge an.
- der Server wartet bei einer eingehenden Verbindung nun laenger auf den
Resolver (4 Sekunden), wenn das Ergebnis eintrifft setzt er aber den
Login sofort fort (bisher wurde immer mind. 1 Sekunde gewartet).
- Connection-Strukturen werden nun "pool-weise" verwaltet; der Pool wird
bei Bedarf bis zu einem konfigurierten Limit vergroessert.
- Mit der neuen Konfigurationsvariable "MaxConnections" (Sektion "Global")
kann die maximale Anzahl gleichzeitiger Verbindungen begrenzt werden.
Der Default ist -1, "unlimitiert".
- der Server erkennt nun, ob bereits eine eingehende Verbindung von einem
Peer-Server besteht und versucht dann nicht mehr, selber eine eigene
ausgehende Verbindung zu diesem auufzubauen. Dadurch kann nun auf beiden
Servern in der Konfiguration ein Port fuer den Connect konfiguriert
werden (beide Server versuchen sich dann gegenseitig zu connectieren).
- Test-Suite und Dokumentation an A/UX angepasst.
- unter HP-UX definiert das configure-Script nun _XOPEN_SOURCE_EXTENDED.
- Server identifizieren sich nun mit asyncronen Passwoertern, d.h. das
Passwort, welches A an B schickt, kann ein anderes sein als das, welches
B als Antwort an A sendet. In der Konfig.-Datei, Abschnitt "Server",
wurde "Password" dazu durch "MyPassword" und "PeerPassword" ersetzt.
- Der Server kann nun zur Laufzeit die Konfiguration neu einlesen: dies
macht er nach dem Befehl REHASH oder wenn ein HUP-Signal empfangen wird.
- Channel-Mode "P" ("persistent") kann nur noch von IRC-Operatoren gesetzt
werden. Grund: User koennen den Server sonst leicht "Channel-Flooden".
- MOTD kann nun an andere Server geforwarded werden.
- IRC-Befehl "TIME" implementiert.
- Server-Server-Links koennen nun komprimiert werden, dazu wird die zlib
(www.zlib.org) benoetigt. Unterstuetzt die Gegenseite die Komprimierung
nicht, wird automatisch unkomprimiert kommuniziert. Das Verfahren ist
kompatibel mit dem Original-ircd 2.10.3, d.h. beide Server koennen
miteinander ueber komprimiert Links kommunizieren.
- Handling der Schreibpuffer umgestellt: Server sollte schneller arbeiten.
- Prefix-Fehler werden besser protokolliert (mit verursachendem Befehl).
- SQUIT wird nicht mehr doppelt an andere Server weitergeleitet.
- Der Server versucht nun vor dem Schliessen einer Verbindung Daten, die
noch im Schreibpuffer stehen, zu senden.
- Source in weiteres Modul "irc-info" aufgespalten.
- Konfigurationsvariablen werden besser validiert: Laengen, Zahlen, ...
- neuen Befehl STATS begonnen: bisher unterstuetzt wird "l" und "m".
- bei ISON und USERHOST fehlte im Ergebnis-String der korrekte Absender.
- IRC Operatoren koennen nun mit KILL User toeten. Achtung: ein Grund muss
zwingend als zweiter Parameter angegeben werden!
- neue Konfigurations-Variable "MaxJoins": Hiermit kann die maximale Zahl
der Channels, in denen ein User Mitglied sein kann, begrent werden.
- neuer, deutlich flexiblerer Parser fuer den MODE Befehl.
- neue Channel-Modes l (User-Limit) und k (Channel-Key) implementiert.
ngIRCd 0.5.4, 24.11.2002
- Fehler-Handling von connect() gefixed: der Server kann sich nun auch
unter A/UX wieder zu anderen verbinden.
- in den Konfigurationsvariablen ServerUID und ServerGID kann nun nicht
nur die numerische ID, sondern auch der Name des Users bzw. der Gruppe
verwendet werden. Beim Start des Daemons wird nun beides angezeigt.
- Besseres Logging von Prefix-Fehlern.
- angenommene Sockets werden nun korrekt auf "non-blocking" konfiguriert,
beim Senden und Empfangen werden Blockierungen besser abgefangen.
- RPL_UMODEIS hat Code 221, nicht 211 ... *argl*
- select() in Try_Write() hat falschen (keinen!) Timeout verwendet;
die "Zeit-Aufloesung" des Servers sind zudem nun 2 Sekunden (TIME_RES).
Insgesamt sollte die Reaktionszeit des Server nun besser sein.
ngIRCd 0.5.3, 08.11.2002 ngIRCd 0.5.3, 08.11.2002
- NOTICE liefert nun wirklich nie mehr einen Fehler, auch dann nicht, - NOTICE liefert nun wirklich nie mehr einen Fehler, auch dann nicht,
@@ -508,6 +251,7 @@ ngIRCd 0.1.0, 29.01.2002
- Clients werden nun korrekt sowohl nur ueber den Nickname als auch die - Clients werden nun korrekt sowohl nur ueber den Nickname als auch die
komplette "Host Mask" erkannt. komplette "Host Mask" erkannt.
ngIRCd 0.0.3, 16.01.2002 ngIRCd 0.0.3, 16.01.2002
- Server-Links vollstaendig implementiert: der ngIRCd kann nun auch - Server-Links vollstaendig implementiert: der ngIRCd kann nun auch
@@ -554,4 +298,4 @@ ngIRCd 0.0.1, 31.12.2001
-- --
$Id: ChangeLog,v 1.233.2.17 2005/01/26 22:05:26 alex Exp $ $Id: ChangeLog,v 1.87.2.12 2002/11/08 21:17:03 alex Exp $

282
INSTALL
View File

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

21
MacOSX/Makefile.am Normal file
View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +1,26 @@
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) # Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
# #
# This program is free software; you can redistribute it and/or modify # Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# it under the terms of the GNU General Public License as published by # der GNU General Public License (GPL), wie von der Free Software Foundation
# the Free Software Foundation; either version 2 of the License, or # herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
# (at your option) any later version. # der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
# Please read the file COPYING, README and AUTHORS for more information. # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
# #
# $Id: Makefile.am,v 1.14.2.1 2004/05/11 00:38:17 alex Exp $ # $Id: Makefile.am,v 1.9.2.1 2002/10/03 16:13:38 alex Exp $
# #
AUTOMAKE_OPTIONS = gnu AUTOMAKE_OPTIONS = gnu
SUBDIRS = doc src man contrib SUBDIRS = doc MacOSX src man contrib
clean-local:
rm -f build-stamp*
maintainer-clean-local: maintainer-clean-local:
rm -rf autom4te.cache rm -rf autom4te.cache
rm -f Makefile.in Makefile aclocal.m4 configure rm -f Makefile.in Makefile aclocal.m4 configure
rm -f mkinstalldirs missing depcomp install-sh rm -f mkinstalldirs missing depcomp install-sh
rm -f config.log debian rm -f config.log
lint: lint:
make -C src/ngircd lint make -C src/ngircd lint
@@ -30,8 +28,4 @@ lint:
rpm: distcheck rpm: distcheck
rpm -ta ngircd-*.tar.gz rpm -ta ngircd-*.tar.gz
deb:
[ -f debian/rules ] || ln -s contrib/Debian debian
dpkg-buildpackage -rfakeroot
# -eof- # -eof-

89
NEWS
View File

@@ -1,94 +1,15 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2004 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- NEWS -- -- NEWS / Neuigkeiten --
ngIRCd 0.8.0 (2004-06-26)
- Two new configuration options: "ChrootDir" and "MotdPhrase", thanks to
Benjamin Pineau <ben@zouh.org>. Now you can force the daemon to change
its root and working directory to something "safe". MotdPhrase is used
to define an "MOTD string" instead of a whole file, useful if the
"real" MOTD file would be outside the "jail".
- INVITE- and BAN-lists become synchronized between IRC+ servers when
establishing new connections, if the peer supports this as well.
- The type of service (TOS) of all sockets is set to "interactive" now.
- Added short command line option "-t" as alternative to "--configtest".
- Added optional support for "IDENT" lookups on incoming connections. You
have to enable this function with the ./configure switch "--with-ident".
The default is not to do IDENT lookups.
ngIRCd 0.7.5 (2003-07-11)
- New configuration variable "MaxConnectionsIP" to limit the number of
simultaneous connections from a single IP that the server will accept.
This configuration options lowers the risk of denial of service attacks
(DoS), the default is 5 connections per client IP.
- Added new configuration variable "Listen" to bind all listening
sockets of the server to a single IP address.
ngIRCd 0.7.1 (2003-07-18)
- Added support for GNU/Hurd.
ngIRCd 0.7.0 (2003-05-01)
- New command CONNECT to enable and add server links. The syntax is not
RFC-compatible: use "CONNECT <name> <port>" to enable and connect an
configured server and "CONNECT <name> <port> <host> <mypwd> <peerpwd>"
to add a new server (ngIRCd tries to connect new servers only once!).
- Added DISCONNECT command ("DISCONNECT <name>") to disable servers.
- New command TRACE (you can trace only servers at the moment).
- New command HELP that lists all understood commands.
- ngIRCd can register itself with Rendezvous: to enable support pass the
new switch "--with-rendezvous" to configure.
- Added support for TCP Wrappers library: pass "--with-tcp-wrappers" to
configure to enable it.
- Changed some configure options to use "--with"/"--without" as prefix
insetead of "--enable"/"--disable": "--without-syslog", "--without-zlib",
"--with-tcp-wrappers", and "--with-rendezvous".
- Enhanced manual pages ngircd(8) and ngircd.conf(5).
- Documentation is now installed in $(datadir)/doc/ngircd.
Older news (sorry, only available in german language):
ngIRCd 0.6.0, 2002-12-24
- beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR
noch eine Statistik ueber die empfangene und gesendete Datenmenge an.
- Connection-Strukturen werden nun "pool-weise" verwaltet; der Pool wird
bei Bedarf bis zu einem konfigurierten Limit vergroessert.
- Mit der neuen Konfigurationsvariable "MaxConnections" (Sekion "Global")
kann die maximale Anzahl gleichzeitiger Verbindungen begrenzt werden.
Der Default ist -1, "unlimitiert".
- der Server erkennt nun, ob bereits eine eingehende Verbindung von einem
Peer-Server besteht und versucht dann nicht mehr, selber eine eigene
ausgehende Verbindung zu diesem auufzubauen. Dadurch kann nun auf beiden
Servern in der Konfiguration ein Port fuer den Connect konfiguriert
werden (beide Server versuchen sich dann gegenseitig zu connectieren).
- Server identifizieren sich nun mit asyncronen Passwoertern, d.h. das
Passwort, welches A an B schickt, kann ein anderes sein als das, welches
B als Antwort an A sendet. In der Konfig.-Datei, Abschnitt "Server",
wurde "Password" dazu durch "MyPassword" und "PeerPassword" ersetzt.
- Der Server kann nun zur Laufzeit die Konfiguration neu einlesen: dies
macht er nach dem Befehl REHASH oder wenn ein HUP-Signal empfangen wird.
- Server-Server-Links koennen nun komprimiert werden, dazu wird die zlib
(www.zlib.org) benoetigt. Unterstuetzt die Gegenseite die Komprimierung
nicht, wird automatisch unkomprimiert kommuniziert. Das Verfahren ist
kompatibel mit dem Original-ircd 2.10.3, d.h. beide Server koennen
miteinander ueber komprimiert Links kommunizieren.
- neue Konfigurations-Variable "MaxJoins": Hiermit kann die maximale Zahl
der Channels, in denen ein User Mitglied sein kann, begrent werden.
- neue Channel-Modes l (User-Limit) und k (Channel-Key) implementiert.
ngIRCd 0.5.0, 20.09.2002 ngIRCd 0.5.0, 20.09.2002
- AIX (3.2.5), HP-UX (10.20), IRIX (6.5), NetBSD (1.5.3/m68k) und Solaris - AIX (3.2.5), HP-UX (10.20), IRIX (6.5), NetBSD (1.5.3/m68k) und Solaris
@@ -189,4 +110,4 @@ ngIRCd 0.0.1, 31.12.2001
-- --
$Id: NEWS,v 1.64.2.3 2004/06/26 09:12:38 alex Exp $ $Id: NEWS,v 1.38.2.4 2002/10/03 16:09:50 alex Exp $

110
README
View File

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

View File

@@ -1,183 +1,16 @@
#!/bin/sh #!/bin/sh
# #
# ngIRCd -- The Next Generation IRC Daemon # $Id: autogen.sh,v 1.3 2002/03/12 14:37:51 alex Exp $
# Copyright (c)2001-2004 Alexander Barton <alex@barton.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# $Id: autogen.sh,v 1.12 2004/04/05 12:02:21 alex Exp $
# #
# if [ -f configure ]; then
# Usage: [VAR=<value>] ./autogen.sh [<configure-args>] echo "autogen.sh: configure-Skript existiert bereits ..."
#
# This script generates the ./configure script using GNU automake and
# GNU autoconf. It tries to be smart in finding the correct/usable/available
# installed versions of these tools on your system.
#
# The following strategy is used for each of aclocal, autoheader, automake,
# and autoconf: first, "tool" (the regular name of the tool, e. g. "autoconf"
# or "automake") is checked. If this fails, "tool<major><minor>" (for example
# "automake16") and "tool-<major>.<minor>" (e. g. "autoconf-2.54") are tried
# with <major> being 2 for tool of GNU autoconf and 1 for tools of automake;
# <minor> is tried from 99 to 0. The first occurrence will be used.
#
# When you pass <configure-args> to autogen.sh it will call the generated
# ./configure script on success and pass these parameters to it.
#
# You can tweak the behaviour using these environment variables:
#
# - ACLOCAL=<cmd>, AUTOHEADER=<cmd>, AUTOMAKE=<cmd>, AUTOCONF=<cmd>
# Name and optionally path to the particular tool.
# - PREFIX=<path>
# Search the GNU autoconf and GNU automake tools in <path> first. If the
# generated ./configure script will be called, pass "--prefix=<path>" to it.
# - EXIST=<tool>
# Use <tool> to test for aclocal, autoheader etc. pp. ...
# When not specified, either "type" or "which" is used.
# - VERBOSE=1
# Output the detected names of the GNU automake and GNU autoconf tools.
# - GO=1
# Call ./configure even if no arguments have been passed to autogen.sh.
#
# Examples:
#
# - ./autogen.sh
# Generates the ./configure script.
# - GO=1 ./autogen.sh
# Generates the ./configure script and runs it as "./configure".
# - VERBOSE=1 ./autogen.sh --with-ident
# Show tool names, generates the ./configure script, and runs it with
# these arguments: "./configure --with-ident".
# - ACLOCAL=aclocal-1.6 GO=1 PREFIX=$HOME ./autogen.sh
# Uses "aclocal-1.6" as aclocal tool, generates the ./configure script,
# and runs it with these arguments: "./configure --prefix=$HOME".
#
Search()
{
[ $# -eq 2 ] || exit 1
searchlist="$1"
major="$2"
minor=99
[ -n "$PREFIX" ] && searchlist="${PREFIX}/$1 ${PREFIX}/bin/$1 $searchlist"
for name in $searchlist; do
$EXIST "${name}" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "${name}"
return 0
fi
done
while [ $minor -ge 0 ]; do
for name in $searchlist; do
$EXIST "${name}${major}${minor}" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "${name}${major}${minor}"
return 0
fi
$EXIST "${name}-${major}.${minor}" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "${name}-${major}.${minor}" >/dev/null 2>&1
return 0
fi
done
minor=`expr $minor - 1`
done
return 1
}
Notfound()
{
echo "Error: $* not found!"
echo "Please install recent versions of GNU autoconf and GNU automake."
exit 1
}
# Reset locale settings to suppress warning messages of Perl
unset LC_ALL
unset LANG
# Which command should be used to detect the automake/autoconf tools?
[ -z "$EXIST" ] && existlist="type which" || existlist="$EXIST"
EXIST=""
for t in $existlist; do
$t /bin/ls >/dev/null 2>&1
if [ $? -eq 0 ]; then
rm -f /tmp/test.$$
$t /tmp/test.$$ >/dev/null 2>&1
[ $? -ne 0 ] && EXIST="$t"
fi
[ -n "$EXIST" ] && break
done
if [ -z "$EXIST" ]; then
echo "Didn't detect a working command to test for the autoconf/automake tools!"
echo "Searchlist: $existlist"
exit 1
fi fi
[ "$VERBOSE" = "1" ] && echo "Using \"$EXIST\" to test for tools."
# We want to use GNU automake 1.7, if available (WANT_AUTOMAKE is used by aclocal && \
# the wrapper scripts of Gentoo Linux): autoheader && \
WANT_AUTOMAKE=1.7 automake --add-missing && \
export WANT_AUTOMAKE autoconf && \
echo "Okay, autogen.sh war erfolgreich."
# Try to detect the needed tools when no environment variable already
# spezifies one:
echo "Searching tools ..."
[ -z "$ACLOCAL" ] && ACLOCAL=`Search aclocal 1`
[ "$VERBOSE" = "1" ] && echo "ACLOCAL=$ACLOCAL"
[ -z "$AUTOHEADER" ] && AUTOHEADER=`Search autoheader 2`
[ "$VERBOSE" = "1" ] && echo "AUTOHEADER=$AUTOHEADER"
[ -z "$AUTOMAKE" ] && AUTOMAKE=`Search automake 1`
[ "$VERBOSE" = "1" ] && echo "AUTOMAKE=$AUTOMAKE"
[ -z "$AUTOCONF" ] && AUTOCONF=`Search autoconf 2`
[ "$VERBOSE" = "1" ] && echo "AUTOCONF=$AUTOCONF"
# Call ./configure when parameters have been passed to this script and
# GO isn't already defined.
[ -z "$GO" -a $# -gt 0 ] && GO=1
# Verify that all tools have been found
[ -z "$AUTOCONF" ] && Notfound autoconf
[ -z "$AUTOHEADER" ] && Notfound autoheader
[ -z "$AUTOMAKE" ] && Notfound automake
[ -z "$AUTOCONF" ] && Notfound autoconf
export AUTOCONF AUTOHEADER AUTOMAKE AUTOCONF
# Generate files
echo "Generating files ..."
$ACLOCAL && \
$AUTOHEADER && \
$AUTOMAKE --add-missing && \
$AUTOCONF
if [ $? -eq 0 -a -x ./configure ]; then
# Success: if we got some parameters we call ./configure and pass
# all of them to it.
if [ "$GO" = "1" ]; then
[ -n "$PREFIX" ] && p=" --prefix=$PREFIX" || p=""
[ -n "$*" ] && a=" $*" || a=""
c="./configure${p}${a}"
echo "Calling \"$c\" ..."
$c
exit $?
else
echo "Okay, autogen.sh done; now run the \"configure\" script."
exit 0
fi
else
# Failure!?
echo "Error! Check your installation of GNU automake and autoconf!"
exit 1
fi
# -eof- # -eof-

380
config.guess vendored
View File

@@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2004-08-13' timestamp='2002-03-04'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc. Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
@@ -88,42 +88,30 @@ if test $# != 0; then
exit 1 exit 1
fi fi
trap 'exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a dummy=dummy-$$
# compiler to aid in system detection is discouraged as it requires trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# CC_FOR_BUILD -- compiler used by this script.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated. # use `HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int dummy(){}" > $dummy.c ;
set_cc_for_build=' for c in cc gcc c89 ; do
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; if test $? = 0 ; then
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ; CC_FOR_BUILD="$c"; break ;
fi ; fi ;
done ; done ;
rm -f $dummy.c $dummy.o $dummy.rel ;
if test x"$CC_FOR_BUILD" = x ; then if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ; CC_FOR_BUILD=no_compiler_found ;
fi fi
;; ;;
,,*) CC_FOR_BUILD=$CC ;; ,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac ;' esac'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe. # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24) # (ghazi@noc.rutgers.edu 1994-08-24)
@@ -154,7 +142,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)` /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
case "${UNAME_MACHINE_ARCH}" in case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;; arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;; sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;; sh3eb) machine=sh-unknown ;;
@@ -180,38 +167,21 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
;; ;;
esac esac
# The OS release # The OS release
# Debian GNU/NetBSD machines have a different userland, and release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in
Debian*)
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form: # contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}" echo "${machine}-${os}${release}"
exit 0 ;; exit 0 ;;
amd64:OpenBSD:*:*)
echo x86_64-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*) amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
cats:OpenBSD:*:*) arc:OpenBSD:*:*)
echo arm-unknown-openbsd${UNAME_RELEASE} echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
hp300:OpenBSD:*:*) hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
luna88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*) mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@@ -227,76 +197,83 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
mvmeppc:OpenBSD:*:*) mvmeppc:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE} echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*) sgi:OpenBSD:*:*)
echo mips64-unknown-openbsd${UNAME_RELEASE} echo mipseb-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
sun3:OpenBSD:*:*) sun3:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:OpenBSD:*:*) *:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit 0 ;;
macppc:MirBSD:*:*)
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
exit 0 ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit 0 ;;
alpha:OSF1:*:*) alpha:OSF1:*:*)
case $UNAME_RELEASE in if test $UNAME_RELEASE = "V4.0"; then
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;; fi
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE="alpha" ;;
"EV4.5 (21064)")
UNAME_MACHINE="alpha" ;;
"LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;;
"EV5 (21164)")
UNAME_MACHINE="alphaev5" ;;
"EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;;
"EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;;
"EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;;
"EV6 (21264)")
UNAME_MACHINE="alphaev6" ;;
"EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;;
"EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;;
"EV7 (21364)")
UNAME_MACHINE="alphaev7" ;;
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version. # A Vn.n version is a released version.
# A Tn.n version is a released field test version. # A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel. # A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r. # 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` cat <<EOF >$dummy.s
.data
\$Lformat:
.byte 37,100,45,37,120,10,0 # "%d-%x\n"
.text
.globl main
.align 4
.ent main
main:
.frame \$30,16,\$26,0
ldgp \$29,0(\$27)
.prologue 1
.long 0x47e03d80 # implver \$0
lda \$2,-1
.long 0x47e20c21 # amask \$2,\$1
lda \$16,\$Lformat
mov \$0,\$17
not \$1,\$18
jsr \$26,printf
ldgp \$29,0(\$26)
mov 0,\$16
jsr \$26,exit
.end main
EOF
eval $set_cc_for_build
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
case `./$dummy` in
0-0)
UNAME_MACHINE="alpha"
;;
1-0)
UNAME_MACHINE="alphaev5"
;;
1-1)
UNAME_MACHINE="alphaev56"
;;
1-101)
UNAME_MACHINE="alphapca56"
;;
2-303)
UNAME_MACHINE="alphaev6"
;;
2-307)
UNAME_MACHINE="alphaev67"
;;
2-1307)
UNAME_MACHINE="alphaev68"
;;
esac
fi
rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;; exit 0 ;;
Alpha\ *:Windows_NT*:*) Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem? # How do we know it's Interix rather than the generic POSIX subsystem?
@@ -319,9 +296,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:OS/390:*:*) *:OS/390:*:*)
echo i370-ibm-openedition echo i370-ibm-openedition
exit 0 ;; exit 0 ;;
*:OS400:*:*)
echo powerpc-ibm-os400
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE} echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;; exit 0;;
@@ -339,13 +313,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
NILE*:*:*:dcosx) NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4 echo pyramid-pyramid-svr4
exit 0 ;; exit 0 ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
exit 0 ;;
DRS?6000:UNIX_SV:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7 && exit 0 ;;
esac ;;
sun4H:SunOS:5.*:*) sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;; exit 0 ;;
@@ -414,9 +381,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE} echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*) powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE} echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@@ -455,20 +419,15 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit (-1); exit (-1);
} }
EOF EOF
$CC_FOR_BUILD -o $dummy $dummy.c \ $CC_FOR_BUILD $dummy.c -o $dummy \
&& $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& exit 0 && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE} echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
Motorola:PowerMAX_OS:*:*) Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax echo powerpc-motorola-powermax
exit 0 ;; exit 0 ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit 0 ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
exit 0 ;;
Night_Hawk:Power_UNIX:*:*) Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix echo powerpc-harris-powerunix
exit 0 ;; exit 0 ;;
@@ -541,7 +500,8 @@ EOF
exit(0); exit(0);
} }
EOF EOF
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5 echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4 echo rs6000-ibm-aix3.2.4
@@ -639,21 +599,11 @@ EOF
exit (0); exit (0);
} }
EOF EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
rm -f $dummy.c $dummy
fi ;; fi ;;
esac esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
# avoid double evaluation of $set_cc_for_build
test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
then
HP_ARCH="hppa2.0w"
else
HP_ARCH="hppa64"
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV} echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;; exit 0 ;;
ia64:HP-UX:*:*) ia64:HP-UX:*:*)
@@ -687,7 +637,8 @@ EOF
exit (0); exit (0);
} }
EOF EOF
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2 echo unknown-hitachi-hiuxwe2
exit 0 ;; exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@@ -745,26 +696,21 @@ EOF
CRAY*TS:*:*:*) CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;; exit 0 ;;
CRAY*T3D:*:*:*)
echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3E:*:*:*) CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;; exit 0 ;;
CRAY*SV1:*:*:*) CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;; exit 0 ;;
*:UNICOS/mp:*:*)
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;; exit 0 ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@@ -786,17 +732,14 @@ EOF
i*:PW*:*) i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32 echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;; exit 0 ;;
x86:Interix*:[34]*) x86:Interix*:3*)
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' echo i386-pc-interix3
exit 0 ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit 0 ;; exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*) i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem? # How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386? # UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix echo i386-pc-interix
exit 0 ;; exit 0 ;;
i*:UWIN*:*) i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin echo ${UNAME_MACHINE}-pc-uwin
@@ -808,27 +751,16 @@ EOF
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;; exit 0 ;;
*:GNU:*:*) *:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;; exit 0 ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
exit 0 ;;
i*86:Minix:*:*) i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix echo ${UNAME_MACHINE}-pc-minix
exit 0 ;; exit 0 ;;
arm*:Linux:*:*) arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;; exit 0 ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
exit 0 ;;
ia64:Linux:*:*) ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux
exit 0 ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;; exit 0 ;;
m68*:Linux:*:*) m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -850,26 +782,8 @@ EOF
#endif #endif
EOF EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 rm -f $dummy.c
;; test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips64
#undef mips64el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mips64el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips64
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
;; ;;
ppc:Linux:*:*) ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu echo powerpc-unknown-linux-gnu
@@ -905,9 +819,6 @@ EOF
s390:Linux:*:* | s390x:Linux:*:*) s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux echo ${UNAME_MACHINE}-ibm-linux
exit 0 ;; exit 0 ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
sh*:Linux:*:*) sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;; exit 0 ;;
@@ -965,11 +876,9 @@ EOF
LIBC=gnuaout LIBC=gnuaout
#endif #endif
#endif #endif
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
rm -f $dummy.c
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;; ;;
@@ -987,26 +896,6 @@ EOF
# Use sysv4.2uw... so that sysv4* matches it. # Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;; exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit 0 ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
@@ -1028,19 +917,22 @@ EOF
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586 && UNAME_MACHINE=i586
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
&& UNAME_MACHINE=i686 && UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686 && UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else else
echo ${UNAME_MACHINE}-pc-sysv32 echo ${UNAME_MACHINE}-pc-sysv32
fi fi
exit 0 ;; exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
pc:*:*:*) pc:*:*:*)
# Left here for compatibility: # Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about # uname -m prints for DJGPP always 'pc', but it prints nothing about
@@ -1064,15 +956,9 @@ EOF
# "miniframe" # "miniframe"
echo m68010-convergent-sysv echo m68010-convergent-sysv
exit 0 ;; exit 0 ;;
mc68k:UNIX:SYSTEM5:3.51m) M68*:*:R3V[567]*:*)
echo m68k-convergent-sysv
exit 0 ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
exit 0 ;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
OS_REL='' OS_REL=''
test -r /etc/.relid \ test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -1089,6 +975,9 @@ EOF
mc68030:UNIX_System_V:4.*:*) mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4 echo m68k-atari-sysv4
exit 0 ;; exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*) TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE} echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@@ -1160,9 +1049,6 @@ EOF
SX-5:SUPER-UX:*:*) SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE} echo sx5-nec-superux${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit 0 ;;
Power*:Rhapsody:*:*) Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE} echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@@ -1170,25 +1056,20 @@ EOF
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:Darwin:*:*) *:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown echo `uname -p`-apple-darwin${UNAME_RELEASE}
case $UNAME_PROCESSOR in
*86) UNAME_PROCESSOR=i686 ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*) *:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p` if test "${UNAME_MACHINE}" = "x86pc"; then
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc UNAME_MACHINE=pc
echo i386-${UNAME_MACHINE}-nto-qnx
else
echo `uname -p`-${UNAME_MACHINE}-nto-qnx
fi fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:QNX:*:4*) *:QNX:*:4*)
echo i386-pc-qnx echo i386-pc-qnx
exit 0 ;; exit 0 ;;
NSR-?:NONSTOP_KERNEL:*:*) NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE} echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:NonStop-UX:*:*) *:NonStop-UX:*:*)
@@ -1211,6 +1092,11 @@ EOF
fi fi
echo ${UNAME_MACHINE}-unknown-plan9 echo ${UNAME_MACHINE}-unknown-plan9
exit 0 ;; exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
*:TOPS-10:*:*) *:TOPS-10:*:*)
echo pdp10-unknown-tops10 echo pdp10-unknown-tops10
exit 0 ;; exit 0 ;;
@@ -1229,19 +1115,12 @@ EOF
*:ITS:*:*) *:ITS:*:*)
echo pdp10-unknown-its echo pdp10-unknown-its
exit 0 ;; exit 0 ;;
SEI:*:*:SEIUX) i*86:XTS-300:*:STOP)
echo mips-sei-seiux${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-stop
exit 0 ;; exit 0 ;;
*:DragonFly:*:*) i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;; exit 0 ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms && exit 0 ;;
I*) echo ia64-dec-vms && exit 0 ;;
V*) echo vax-dec-vms && exit 0 ;;
esac
esac esac
#echo '(No uname command or uname output not recognized.)' 1>&2 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1362,7 +1241,8 @@ main ()
} }
EOF EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
# Apollos put the system type in the environment. # Apollos put the system type in the environment.

259
config.sub vendored
View File

@@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2004-06-24' timestamp='2002-03-04'
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
@@ -70,7 +70,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc. Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
@@ -118,8 +118,7 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations. # Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;; ;;
@@ -145,7 +144,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray) -apple | -axis)
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
@@ -229,42 +228,28 @@ case $basic_machine in
| a29k \ | a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| c4x | clipper \ | c4x | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dsp16xx \
| fr30 | frv \ | fr30 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \ | m32r | m68000 | m68k | m88k | mcore \
| m32r | m32rle | m68000 | m68k | m88k | mcore \ | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips64vr4100 | mips64vr4100el | mips64vr4300 \
| mips16 \ | mips64vr4300el | mips64vr5000 | mips64vr5000el \
| mips64 | mips64el \ | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
| mips64vr | mips64vrel \ | mipsisa32 \
| mips64orion | mips64orionel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \ | mn10200 | mn10300 \
| msp430 \
| ns16k | ns32k \ | ns16k | ns32k \
| openrisc | or32 \ | openrisc | or32 \
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \ | pyramid \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \
| sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
| strongarm \ | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \ | tahoe | thumb | tic80 | tron \
| v850 | v850e \ | v850 | v850e \
| we32k \ | we32k \
| x86 | xscale | xstormy16 | xtensa \ | x86 | xscale | xstormy16 | xtensa \
@@ -296,51 +281,34 @@ case $basic_machine in
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | arm-* | armbe-* | armle-* | armv*-* \
| avr-* \ | avr-* \
| bs2000-* \ | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \
| clipper-* | craynv-* | cydra-* \ | clipper-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* \
| elxsi-* \ | elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fr30-* | fx80-* \
| h8300-* | h8500-* \ | h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \ | i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \ | m32r-* \
| m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \ | m88110-* | m88k-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
| mips16-* \ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
| mips64-* | mips64el-* \ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
| mips64vr-* | mips64vrel-* \ | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
| mips64orion-* | mips64orionel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| msp430-* \
| none-* | np1-* | ns16k-* | ns32k-* \ | none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \ | orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \ | pyramid-* \
| romp-* | rs6000-* \ | romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \ | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
| v850-* | v850e-* | vax-* \ | v850-* | v850e-* | vax-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
@@ -364,9 +332,6 @@ case $basic_machine in
basic_machine=a29k-amd basic_machine=a29k-amd
os=-udi os=-udi
;; ;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k) adobe68k)
basic_machine=m68010-adobe basic_machine=m68010-adobe
os=-scout os=-scout
@@ -381,12 +346,6 @@ case $basic_machine in
basic_machine=a29k-none basic_machine=a29k-none
os=-bsd os=-bsd
;; ;;
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl) amdahl)
basic_machine=580-amdahl basic_machine=580-amdahl
os=-sysv os=-sysv
@@ -446,24 +405,12 @@ case $basic_machine in
basic_machine=j90-cray basic_machine=j90-cray
os=-unicos os=-unicos
;; ;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16c)
basic_machine=cr16c-unknown
os=-elf
;;
crds | unos) crds | unos)
basic_machine=m68k-crds basic_machine=m68k-crds
;; ;;
cris | cris-* | etrax*) cris | cris-* | etrax*)
basic_machine=cris-axis basic_machine=cris-axis
;; ;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*) da30 | da30-*)
basic_machine=m68k-da30 basic_machine=m68k-da30
;; ;;
@@ -664,6 +611,10 @@ case $basic_machine in
mips3*) mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;; ;;
mmix*)
basic_machine=mmix-knuth
os=-mmixware
;;
monitor) monitor)
basic_machine=m68k-rom68k basic_machine=m68k-rom68k
os=-coff os=-coff
@@ -755,10 +706,6 @@ case $basic_machine in
basic_machine=or32-unknown basic_machine=or32-unknown
os=-coff os=-coff
;; ;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000) OSE68000 | ose68000)
basic_machine=m68000-ericsson basic_machine=m68000-ericsson
os=-ose os=-ose
@@ -781,55 +728,49 @@ case $basic_machine in
pbb) pbb)
basic_machine=m68k-tti basic_machine=m68k-tti
;; ;;
pc532 | pc532-*) pc532 | pc532-*)
basic_machine=ns32k-pc532 basic_machine=ns32k-pc532
;; ;;
pentium | p5 | k5 | k6 | nexgen | viac3) pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc basic_machine=i586-pc
;; ;;
pentiumpro | p6 | 6x86 | athlon | athlon_*) pentiumpro | p6 | 6x86 | athlon)
basic_machine=i686-pc basic_machine=i686-pc
;; ;;
pentiumii | pentium2 | pentiumiii | pentium3) pentiumii | pentium2)
basic_machine=i686-pc basic_machine=i686-pc
;; ;;
pentium4)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
pentiumpro-* | p6-* | 6x86-* | athlon-*) pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) pentiumii-* | pentium2-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
pentium4-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn) pn)
basic_machine=pn-gould basic_machine=pn-gould
;; ;;
power) basic_machine=power-ibm power) basic_machine=power-ibm
;; ;;
ppc) basic_machine=powerpc-unknown ppc) basic_machine=powerpc-unknown
;; ;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppcle | powerpclittle | ppc-le | powerpc-little) ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown basic_machine=powerpcle-unknown
;; ;;
ppcle-* | powerpclittle-*) ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppc64) basic_machine=powerpc64-unknown ppc64) basic_machine=powerpc64-unknown
;; ;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little) ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown basic_machine=powerpc64le-unknown
;; ;;
ppc64le-* | powerpc64little-*) ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
@@ -860,16 +801,6 @@ case $basic_machine in
basic_machine=a29k-amd basic_machine=a29k-amd
os=-udi os=-udi
;; ;;
sb1)
basic_machine=mipsisa64sb1-unknown
;;
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sei)
basic_machine=mips-sei
os=-seiux
;;
sequent) sequent)
basic_machine=i386-sequent basic_machine=i386-sequent
;; ;;
@@ -877,9 +808,6 @@ case $basic_machine in
basic_machine=sh-hitachi basic_machine=sh-hitachi
os=-hms os=-hms
;; ;;
sh64)
basic_machine=sh64-unknown
;;
sparclite-wrs | simso-wrs) sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs basic_machine=sparclite-wrs
os=-vxworks os=-vxworks
@@ -938,7 +866,7 @@ case $basic_machine in
sun386 | sun386i | roadrunner) sun386 | sun386i | roadrunner)
basic_machine=i386-sun basic_machine=i386-sun
;; ;;
sv1) sv1)
basic_machine=sv1-cray basic_machine=sv1-cray
os=-unicos os=-unicos
;; ;;
@@ -946,6 +874,10 @@ case $basic_machine in
basic_machine=i386-sequent basic_machine=i386-sequent
os=-dynix os=-dynix
;; ;;
t3d)
basic_machine=alpha-cray
os=-unicos
;;
t3e) t3e)
basic_machine=alphaev5-cray basic_machine=alphaev5-cray
os=-unicos os=-unicos
@@ -958,14 +890,6 @@ case $basic_machine in
basic_machine=tic54x-unknown basic_machine=tic54x-unknown
os=-coff os=-coff
;; ;;
tic55x | c55x*)
basic_machine=tic55x-unknown
os=-coff
;;
tic6x | c6x*)
basic_machine=tic6x-unknown
os=-coff
;;
tx39) tx39)
basic_machine=mipstx39-unknown basic_machine=mipstx39-unknown
;; ;;
@@ -979,10 +903,6 @@ case $basic_machine in
tower | tower-32) tower | tower-32)
basic_machine=m68k-ncr basic_machine=m68k-ncr
;; ;;
tpf)
basic_machine=s390x-ibm
os=-tpf
;;
udi29k) udi29k)
basic_machine=a29k-amd basic_machine=a29k-amd
os=-udi os=-udi
@@ -1004,8 +924,8 @@ case $basic_machine in
os=-vms os=-vms
;; ;;
vpp*|vx|vx-*) vpp*|vx|vx-*)
basic_machine=f301-fujitsu basic_machine=f301-fujitsu
;; ;;
vxworks960) vxworks960)
basic_machine=i960-wrs basic_machine=i960-wrs
os=-vxworks os=-vxworks
@@ -1026,7 +946,11 @@ case $basic_machine in
basic_machine=hppa1.1-winbond basic_machine=hppa1.1-winbond
os=-proelf os=-proelf
;; ;;
xps | xps100) windows32)
basic_machine=i386-pc
os=-windows32-msvcrt
;;
xps | xps100)
basic_machine=xps100-honeywell basic_machine=xps100-honeywell
;; ;;
ymp) ymp)
@@ -1056,9 +980,6 @@ case $basic_machine in
romp) romp)
basic_machine=romp-ibm basic_machine=romp-ibm
;; ;;
mmix)
basic_machine=mmix-knuth
;;
rs6000) rs6000)
basic_machine=rs6000-ibm basic_machine=rs6000-ibm
;; ;;
@@ -1075,16 +996,16 @@ case $basic_machine in
we32k) we32k)
basic_machine=we32k-att basic_machine=we32k-att
;; ;;
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) sh3 | sh4 | sh3eb | sh4eb)
basic_machine=sh-unknown basic_machine=sh-unknown
;; ;;
sh64) sh64)
basic_machine=sh64-unknown basic_machine=sh64-unknown
;; ;;
sparc | sparcv8 | sparcv9 | sparcv9b) sparc | sparcv9 | sparcv9b)
basic_machine=sparc-sun basic_machine=sparc-sun
;; ;;
cydra) cydra)
basic_machine=cydra-cydrome basic_machine=cydra-cydrome
;; ;;
orion) orion)
@@ -1099,6 +1020,10 @@ case $basic_machine in
pmac | pmac-mpw) pmac | pmac-mpw)
basic_machine=powerpc-apple basic_machine=powerpc-apple
;; ;;
c4x*)
basic_machine=c4x-none
os=-coff
;;
*-unknown) *-unknown)
# Make sure to match an already-canonicalized machine name. # Make sure to match an already-canonicalized machine name.
;; ;;
@@ -1154,20 +1079,18 @@ case $os in
| -aos* \ | -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \ | -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova*)
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
@@ -1179,10 +1102,8 @@ case $os in
;; ;;
esac esac
;; ;;
-nto-qnx*)
;;
-nto*) -nto*)
os=`echo $os | sed -e 's|nto|nto-qnx|'` os=-nto-qnx
;; ;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
@@ -1191,9 +1112,6 @@ case $os in
-mac*) -mac*)
os=`echo $os | sed -e 's|mac|macos|'` os=`echo $os | sed -e 's|mac|macos|'`
;; ;;
-linux-dietlibc)
os=-linux-dietlibc
;;
-linux*) -linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'` os=`echo $os | sed -e 's|linux|linux-gnu|'`
;; ;;
@@ -1206,9 +1124,6 @@ case $os in
-opened*) -opened*)
os=-openedition os=-openedition
;; ;;
-os400*)
os=-os400
;;
-wince*) -wince*)
os=-wince os=-wince
;; ;;
@@ -1230,9 +1145,6 @@ case $os in
-atheos*) -atheos*)
os=-atheos os=-atheos
;; ;;
-syllable*)
os=-syllable
;;
-386bsd) -386bsd)
os=-bsd os=-bsd
;; ;;
@@ -1243,7 +1155,7 @@ case $os in
os=-rtmk-nova os=-rtmk-nova
;; ;;
-ns2 ) -ns2 )
os=-nextstep2 os=-nextstep2
;; ;;
-nsk*) -nsk*)
os=-nsk os=-nsk
@@ -1255,9 +1167,6 @@ case $os in
-sinix*) -sinix*)
os=-sysv4 os=-sysv4
;; ;;
-tpf*)
os=-tpf
;;
-triton*) -triton*)
os=-sysv3 os=-sysv3
;; ;;
@@ -1285,14 +1194,8 @@ case $os in
-xenix) -xenix)
os=-xenix os=-xenix
;; ;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint os=-mint
;;
-aros*)
os=-aros
;;
-kaos*)
os=-kaos
;; ;;
-none) -none)
;; ;;
@@ -1325,14 +1228,11 @@ case $basic_machine in
arm*-semi) arm*-semi)
os=-aout os=-aout
;; ;;
c4x-* | tic4x-*)
os=-coff
;;
# This must come before the *-dec entry. # This must come before the *-dec entry.
pdp10-*) pdp10-*)
os=-tops20 os=-tops20
;; ;;
pdp11-*) pdp11-*)
os=-none os=-none
;; ;;
*-dec | vax-*) *-dec | vax-*)
@@ -1374,9 +1274,6 @@ case $basic_machine in
*-ibm) *-ibm)
os=-aix os=-aix
;; ;;
*-knuth)
os=-mmixware
;;
*-wec) *-wec)
os=-proelf os=-proelf
;; ;;
@@ -1428,19 +1325,19 @@ case $basic_machine in
*-next) *-next)
os=-nextstep3 os=-nextstep3
;; ;;
*-gould) *-gould)
os=-sysv os=-sysv
;; ;;
*-highlevel) *-highlevel)
os=-bsd os=-bsd
;; ;;
*-encore) *-encore)
os=-bsd os=-bsd
;; ;;
*-sgi) *-sgi)
os=-irix os=-irix
;; ;;
*-siemens) *-siemens)
os=-sysv4 os=-sysv4
;; ;;
*-masscomp) *-masscomp)
@@ -1509,16 +1406,10 @@ case $basic_machine in
-mvs* | -opened*) -mvs* | -opened*)
vendor=ibm vendor=ibm
;; ;;
-os400*)
vendor=ibm
;;
-ptx*) -ptx*)
vendor=sequent vendor=sequent
;; ;;
-tpf*) -vxsim* | -vxworks*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs vendor=wrs
;; ;;
-aux*) -aux*)

View File

@@ -1,37 +1,34 @@
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2005 Alexander Barton <alex@barton.de> # Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
# #
# This program is free software; you can redistribute it and/or modify # Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# it under the terms of the GNU General Public License as published by # der GNU General Public License (GPL), wie von der Free Software Foundation
# the Free Software Foundation; either version 2 of the License, or # herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
# (at your option) any later version. # der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
# Please read the file COPYING, README and AUTHORS for more information. # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
# #
# $Id: configure.in,v 1.102.2.6 2005/01/26 22:05:26 alex Exp $ # $Id: configure.in,v 1.58.2.8 2002/11/08 21:17:17 alex Exp $
# #
# -- Initialisation -- # -- Initialisierung --
AC_INIT
AC_PREREQ(2.50) AC_PREREQ(2.50)
AC_INIT(ngircd, 0.8.2)
AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
AC_CANONICAL_TARGET AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(1.6) AC_CONFIG_SRCDIR(src/config.h.in)
AM_INIT_AUTOMAKE(ngircd,0.5.3)
AM_CONFIG_HEADER(src/config.h) AM_CONFIG_HEADER(src/config.h)
# -- Templates for config.h -- # -- Templates fuer config.h --
AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled]) AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists]) AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled]) AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant]) AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging]) AH_TEMPLATE([USE_SYSLOG], [Define if syslog should be used for logging])
AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used]) AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
AH_TEMPLATE([RENDEZVOUS], [Define if Rendezvous support should be included])
AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
AH_TEMPLATE([TARGET_OS], [Target operating system name]) AH_TEMPLATE([TARGET_OS], [Target operating system name])
AH_TEMPLATE([TARGET_VENDOR], [Target system vendor]) AH_TEMPLATE([TARGET_VENDOR], [Target system vendor])
@@ -41,7 +38,7 @@ AH_TEMPLATE([TARGET_CPU], [Target CPU name])
AC_PROG_CC AC_PROG_CC
# -- Helper programs -- # -- Hilfsprogramme --
AC_PROG_AWK AC_PROG_AWK
AC_PROG_INSTALL AC_PROG_INSTALL
@@ -51,33 +48,17 @@ AC_PROG_RANLIB
# -- Compiler Features -- # -- Compiler Features --
AC_LANG_C
AM_C_PROTOTYPES AM_C_PROTOTYPES
AC_C_CONST AC_C_CONST
# -- Hard coded system and compiler dependencies/features/options ... -- # -- Header --
if test "$GCC" = "yes"; then
# We are using the GNU C compiler. Good!
CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
fi
case "$target_os" in
hpux*)
# This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
# (tested with HP/UX 11.11)
CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
;;
esac
# Add additional CFLAGS, eventually specified on the command line:
test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
# -- Headers --
AC_HEADER_STDC AC_HEADER_STDC
AC_HEADER_TIME AC_HEADER_TIME
AC_HEADER_SYS_WAIT AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([ \ AC_CHECK_HEADERS([ \
@@ -85,9 +66,9 @@ AC_CHECK_HEADERS([ \
strings.h sys/socket.h sys/time.h unistd.h \ strings.h sys/socket.h sys/time.h unistd.h \
],,AC_MSG_ERROR([required C header missing!])) ],,AC_MSG_ERROR([required C header missing!]))
AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdint.h varargs.h]) AC_CHECK_HEADERS(arpa/inet.h malloc.h stdint.h sys/select.h varargs.h)
# -- Datatypes -- # -- Datentypen --
AC_MSG_CHECKING(whether socklen_t exists) AC_MSG_CHECKING(whether socklen_t exists)
AC_TRY_COMPILE([ AC_TRY_COMPILE([
@@ -103,6 +84,7 @@ AC_TRY_COMPILE([
]) ])
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_TYPE_SIZE_T AC_TYPE_SIZE_T
# -- Libraries -- # -- Libraries --
@@ -111,115 +93,38 @@ AC_CHECK_LIB(UTIL,memmove)
AC_CHECK_LIB(socket,bind) AC_CHECK_LIB(socket,bind)
AC_CHECK_LIB(nsl,gethostent) AC_CHECK_LIB(nsl,gethostent)
# -- Functions -- # -- Funktionen --
AC_FUNC_MALLOC
AC_FUNC_FORK AC_FUNC_FORK
AC_FUNC_STRFTIME AC_FUNC_STRFTIME
AC_CHECK_FUNCS([ \ AC_CHECK_FUNCS([ \
bind gethostbyaddr gethostbyname gethostname inet_ntoa malloc memmove \ bind gethostbyaddr gethostbyname gethostname inet_ntoa memmove \
memset realloc setsid setsockopt socket strcasecmp strchr strerror \ memset select setsockopt socket strcasecmp strchr strerror \
strstr waitpid],,AC_MSG_ERROR([required function missing!])) strstr waitpid \
],,AC_MSG_ERROR([required function missing!]))
AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strlcpy strlcat) AC_CHECK_FUNCS(inet_aton sigaction snprintf vsnprintf)
AC_CHECK_FUNCS(select,[AC_CHECK_HEADERS(sys/select.h)], # -- Konfigurationsoptionen --
AC_MSG_ERROR([required function select() is missing!])
)
# -- Configuration options --
x_syslog_on=no x_syslog_on=no
AC_ARG_WITH(syslog, AC_ARG_ENABLE(syslog,
[ --without-syslog disable syslog (autodetected by default)], [ --disable-syslog disable syslog (autodetected by default)],
[ if test "$withval" = "yes"; then [ if test "$enableval" = "yes"; then
AC_CHECK_LIB(be, syslog) AC_CHECK_HEADER(syslog.h, x_syslog_on=yes,
AC_CHECK_FUNCS(syslog, x_syslog_on=yes, AC_MSG_ERROR([Can't enable syslog: syslog.h not found!])
AC_MSG_ERROR([Can't enable syslog!])
) )
fi fi
], ],
[ [ AC_CHECK_HEADER(syslog.h, x_syslog_on=yes) ]
AC_CHECK_LIB(be, syslog)
AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
]
) )
if test "$x_syslog_on" = "yes"; then if test "$x_syslog_on" = "yes"; then
AC_DEFINE(SYSLOG, 1) AC_DEFINE(USE_SYSLOG, 1)
AC_CHECK_HEADERS(syslog.h) AC_CHECK_LIB(be,syslog)
fi
x_zlib_on=no
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_LIB(z, deflate)
AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
]
)
if test "$x_zlib_on" = "yes"; then
AC_DEFINE(ZLIB, 1)
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 <tcpd.h>
],[
void *ptr;
ptr = hosts_access;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(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_identauth_on=no
AC_ARG_WITH(ident,
[ --with-ident enable "IDENT" ("AUTH") protocol support],
[ if test "$withval" = "yes"; then
AC_CHECK_LIB(ident, ident_id)
AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
AC_MSG_ERROR([Can't enable IDENT support!])
)
fi
]
)
if test "$x_identauth_on" = "yes"; then
AC_DEFINE(IDENTAUTH, 1)
AC_CHECK_HEADERS(ident.h)
fi fi
x_ircplus_on=yes x_ircplus_on=yes
@@ -231,7 +136,6 @@ if test "$x_ircplus_on" = "yes"; then
AC_DEFINE(IRCPLUS, 1) AC_DEFINE(IRCPLUS, 1)
fi fi
x_sniffer_on=no; x_debug_on=no
AC_ARG_ENABLE(sniffer, AC_ARG_ENABLE(sniffer,
[ --enable-sniffer enable IRC traffic sniffer (enables debug mode)], [ --enable-sniffer enable IRC traffic sniffer (enables debug mode)],
if test "$enableval" = "yes"; then if test "$enableval" = "yes"; then
@@ -246,10 +150,8 @@ AC_ARG_ENABLE(debug,
) )
if test "$x_debug_on" = "yes"; then if test "$x_debug_on" = "yes"; then
AC_DEFINE(DEBUG, 1) AC_DEFINE(DEBUG, 1)
test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
fi fi
x_strict_rfc_on=no
AC_ARG_ENABLE(strict-rfc, AC_ARG_ENABLE(strict-rfc,
[ --enable-strict-rfc strict RFC conformance -- may break clients!], [ --enable-strict-rfc strict RFC conformance -- may break clients!],
if test "$enableval" = "yes"; then if test "$enableval" = "yes"; then
@@ -258,44 +160,45 @@ AC_ARG_ENABLE(strict-rfc,
fi fi
) )
# -- Definitions --
# -- Definitionen --
AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" ) AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" ) AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" ) AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
# Add additional CFLAGS, eventually specified on the command line, but after if test `uname` = "A/UX"; then
# running this configure script. Useful for "-Werror" for example. # unter A/UX sollte _POSIX_SOURCE definiert sein.
test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END" AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE])
CFLAGS="$CFLAGS -D_POSIX_SOURCE"
fi
# -- Generate files -- # -- Variablen --
if test "$GCC" = "yes"; then
CFLAGS="-Wall $CFLAGS"
fi
CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
# -- Ausgabe der Dateien --
AC_OUTPUT([ \ AC_OUTPUT([ \
Makefile \ Makefile \
doc/Makefile \ doc/Makefile \
doc/en/Makefile \
MacOSX/Makefile \
MacOSX/ngircd.pbproj/Makefile \
src/Makefile \ src/Makefile \
src/portab/Makefile \ src/portab/Makefile \
src/tool/Makefile \
src/ngircd/Makefile \ src/ngircd/Makefile \
src/testsuite/Makefile \ src/testsuite/Makefile \
man/Makefile \ man/Makefile \
contrib/Makefile \ contrib/Makefile \
contrib/Debian/Makefile \
contrib/MacOSX/Makefile \
]) ])
type dpkg >/dev/null 2>&1 # -- Ergebnis --
if test $? -eq 0; then
# Generate debian/ link if the dpkg command exists
# (read: if we are running on a debian compatible system)
echo "creating Debian-specific links ..."
test -f debian/rules || ln -s contrib/Debian debian
fi
# -- Result --
echo
echo "ngIRCd has been configured with the following options:"
echo echo
# Someone please show me a better way :) [borrowed by OpenSSH] # Someone please show me a better way :) [borrowed by OpenSSH]
@@ -303,63 +206,26 @@ B=`eval echo ${bindir}` ; B=`eval echo ${B}`
S=`eval echo ${sbindir}` ; S=`eval echo ${S}` S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}` C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
M=`eval echo ${mandir}` ; M=`eval echo ${M}` M=`eval echo ${mandir}` ; M=`eval echo ${M}`
D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}`
echo " Target: ${target}" echo " host: ${host}"
test "$target" != "$host" && echo " Host: ${host}" echo " compiler: ${CC}"
echo " Compiler: ${CC}" echo " compiler flags: ${CFLAGS}"
test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}" echo " preprocessor flags: ${CPPFLAGS}"
test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}" echo " linker flags: ${LDFLAGS}"
test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}" echo " libraries: ${LIBS}"
test -n "$LIBS" && echo " Libraries: ${LIBS}"
echo
echo " 'ngircd' binary: $S"
echo " Configuration file: $C"
echo " Manual pages: $M"
echo " Documentation: $D"
echo echo
echo $ECHO_N " Syslog support: $ECHO_C" echo " 'ngircd' binary: $S"
test "$x_syslog_on" = "yes" \ echo " configuration file: $C"
&& echo $ECHO_N "yes $ECHO_C" \ echo " manual pages: $M"
|| echo $ECHO_N "no $ECHO_C" echo
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 $ECHO_N " IDENT support: $ECHO_C"
test "$x_identauth_on" = "yes" \
&& echo $ECHO_N "yes $ECHO_C" \
|| echo $ECHO_N "no $ECHO_C"
echo $ECHO_N " active options: $ECHO_C"
test "$x_syslog_on" = "yes" && echo $ECHO_N "Syslog $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
# -eof- # -eof-

View File

@@ -1,28 +0,0 @@
#
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# $Id: Makefile.am,v 1.3.2.1 2004/05/11 00:38:17 alex Exp $
#
EXTRA_DIST = rules changelog compat control copyright \
ngircd.init ngircd.postinst
maintainer-clean-local:
rm -f Makefile Makefile.in
clean-local:
rm -f ngircd.postinst.debhelper ngircd.postrm.debhelper \
ngircd.prerm.debhelper ngircd.substvars
rm -f ngircd-full.postinst.debhelper ngircd-full.postrm.debhelper \
ngircd-full.prerm.debhelper ngircd-full.substvars
rm -rf ngircd ngircd-full
rm -f files
# -eof-

View File

@@ -1,149 +0,0 @@
ngircd (0.8.2-0ab1) unstable; urgency=high
* New "upstream release", including security fixes.
-- alex <alex@Arthur.Ath.CX> Wed, 26 Jan 2005 23:14:12 +0100
ngircd (0.8.1-0ab1) unstable; urgency=low
* New "upstream release".
-- Alexander Barton <alex@Arthur.Ath.CX> Sat, 25 Dec 2004 01:18:32 +0100
ngircd (0.8.0-0ab2) unstable; urgency=low
* Added missing commas to debian control file, fixes bug #56.
Thanks to Kevin Otte.
-- Alexander Barton <alex@Arthur.Ath.CX> Thu, 15 Jul 2004 10:53:39 +0200
ngircd (0.8.0-0ab1) unstable; urgency=low
* New upstream version.
-- Alexander Barton <alex@Arthur.Ath.CX> Sat, 26 Jun 2004 11:25:59 +0200
ngircd (0.7.7+HEAD-0ab5) unstable; urgency=low
* Updates from CVS HEAD branch, most notably: "INVITE- and BAN-lists
become synchronized between IRC+ servers when establishing new
connections, if the peer supports this as well."
-- Alexander Barton <alex@Arthur.Ath.CX> Mon, 26 Apr 2004 01:53:15 +0200
ngircd (0.7.7+HEAD-0ab4) unstable; urgency=low
* This version includes fixes for INVITE command and the handling of the
invite and ban lists from CVS-HEAD.
-- Alexander Barton <alex@Arthur.Ath.CX> Fri, 9 Apr 2004 23:55:13 +0200
ngircd (0.7.7+HEAD-0ab3) unstable; urgency=low
* Included MODE fix from CVS-HEAD branch.
-- Alexander Barton <alex@Arthur.Ath.CX> Mon, 5 Apr 2004 13:09:24 +0200
ngircd (0.7.7+HEAD-0ab2) unstable; urgency=low
* Incorporated more fixes and enhancements of CVS-HEAD version,
e. g. better connection logging and fixed TRACE command.
-- Alexander Barton <alex@Arthur.Ath.CX> Sat, 28 Feb 2004 03:20:32 +0100
ngircd (0.7.7+HEAD-0ab1) unstable; urgency=low
* New upstream version. This debian package includes all features of
ngIRCd 0.7.7 and changes of the CVS-HEAD development tree.
-- Alexander Barton <alex@Arthur.Ath.CX> Thu, 5 Feb 2004 15:23:22 +0100
ngircd (0.7.6+HEAD-0ab2) unstable; urgency=low
* Included new fixes and additions from the CVS-HEAD upstream branch,
e. g. the setting of type of service (TOS) on sockets.
-- Alexander Barton <alex@Arthur.Ath.CX> Mon, 26 Jan 2004 04:05:41 +0100
ngircd (0.7.6+HEAD-0ab1) unstable; urgency=low
* Included all changes from the CVS-HEAD upstream version.
* Restructured debian packaging system: now there are two packages, a
"standard" version that includes all the default options and a "full"
version that additionally includes support for TCP wrappers and IDENT
lookups.
-- Alexander Barton <alex@Arthur.Ath.CX> Thu, 1 Jan 2004 23:12:11 +0100
ngircd (0.7.6-0ab1) unstable; urgency=medium
* New upstream version.
* Changed version numvering scheme of debian package.
-- Alexander Barton <alex@Arthur.Ath.CX> Fri, 5 Dec 2003 14:26:41 +0100
ngircd (0.7.5-0.2ab) unstable; urgency=low
* Updated RPM and Debian package description and configuration.
-- Alexander Barton <alex@Arthur.Ath.CX> Sat, 29 Nov 2003 21:24:32 +0100
ngircd (0.7.5-0.1ab) unstable; urgency=low
* New upstream version.
-- Alexander Barton <alex@Arthur.Ath.CX> Fri, 7 Nov 2003 21:59:58 +0100
ngircd (0.7.1-0.1ab) unstable; urgency=low
* New upstream version :-)
-- Alexander Barton <alex@Arthur.Ath.CX> Fri, 18 Jul 2003 22:53:02 +0200
ngircd (0.7.0-0.7ab) unstable; urgency=low
* Fixed up post installation script (added interpreter, fixed chmod call).
-- Alexander Barton <alex@Arthur.Ath.CX> Sun, 13 Jul 2003 00:52:38 +0200
ngircd (0.7.0-0.6ab) unstable; urgency=low
* Added /etc/default/ngircd.
* Included own post installation script.
-- Alexander Barton <alex@Arthur.Ath.CX> Sat, 12 Jul 2003 20:31:09 +0200
ngircd (0.7.0-0.5ab) unstable; urgency=low
* Enhanced init script.
* Included NJOIN fix from actual CVS "HEAD" branch.
-- Alexander Barton <alex@Arthur.Ath.CX> Wed, 9 Jul 2003 22:40:49 +0200
ngircd (0.7.0-0.4ab) unstable; urgency=low
* Reverted use of dh_installexamples.
-- Alexander Barton <alex@Arthur.Ath.CX> Thu, 22 May 2003 00:15:03 +0200
ngircd (0.7.0-0.3ab) unstable; urgency=low
* Removed "debian/docs" and "debian/conffiles"; debhelper takes care of
this for us automagically.
* Excluded "etc/ngircd.conf" from dh_fixperms.
-- Alexander Barton <alex@Arthur.Ath.CX> Wed, 21 May 2003 23:25:05 +0200
ngircd (0.7.0-0.2ab) unstable; urgency=low
* Fixed wrong variable substitution in init script.
* Added some CVS "Id-Tags" (but not checked in, yet).
* Removed own "Provides:" from control file.
-- Alexander Barton <alex@barton.de> Wed, 21 May 2003 12:32:34 +0200
ngircd (0.7.0-0.1ab) unstable; urgency=low
* Initial Release.
-- Alexander Barton <alex@barton.de> Wed, 21 May 2003 02:36:52 +0200

View File

@@ -1 +0,0 @@
4

View File

@@ -1,47 +0,0 @@
Source: ngircd
Section: net
Priority: optional
Maintainer: Alexander Barton <alex@barton.de>
Build-Depends: debhelper (>> 4.0.0), libz-dev, libwrap-dev, libident-dev
Standards-Version: 3.5.8
Package: ngircd
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: A lightweight daemon for the Internet Relay Chat (IRC)
ngIRCd is a free open source daemon for the Internet Relay Chat (IRC)
network. It is written from scratch and is not based upon the original
IRCd like many others.
.
This package contains the "standard distribution", including support for
syslog logging and compressed server-links using zlib.
.
Advantages of ngIRCd:
- no problems with servers using changing/non-static IP addresses.
- small and lean configuration file.
- free, modern and open source C code.
- still under active development.
.
ngIRCd is compatible to the "original" ircd 2.10.3p3, so you can run
mixed networks.
Package: ngircd-full
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Conflicts: ngircd
Description: A lightweight daemon for the Internet Relay Chat (IRC)
ngIRCd is a free open source daemon for the Internet Relay Chat (IRC)
network. It is written from scratch and is not based upon the original
IRCd like many others.
.
This package includes support for TCP wrappers and IDENT requests in
addition to the features of the "standard package".
.
Advantages of ngIRCd:
- no problems with servers using changing/non-static IP addresses.
- small and lean configuration file.
- free, modern and open source C code.
- still under active development.
.
ngIRCd is compatible to the "original" ircd 2.10.3p3, so you can run
mixed networks.

View File

@@ -1,13 +0,0 @@
This package was debianized by Alexander Barton <alex@barton.de> on
Tue, 20 May 2003 15:47:40 +0200.
It was downloaded from ftp://Arthur.Ath.CX/pub/Users/alex/ngircd/
Upstream Author: Alexander Barton <alex@barton.de>
This software is copyright (c) 1999-2003 by Alexander Barton.
You are free to distribute this software under the terms of the
GNU General Public License.
On Debian systems, the complete text of the GNU General Public
License can be found in /usr/share/common-licenses/GPL file.

View File

@@ -1,12 +0,0 @@
#
# Defaults for ngIRCd start and stop script
#
# $Id: ngircd.default,v 1.1 2003/12/31 17:20:11 alex Exp $
#
# Parameters to pass to the ngircd daemon on startup, see ngircd(8) for
# possible options (default: empty).
PARAMS=""
# -eof-

View File

@@ -1,72 +0,0 @@
#!/bin/sh
#
# ngIRCd start and stop script for Debian-based systems
#
# $Id: ngircd.init,v 1.1.2.1 2004/09/06 00:36:49 alex Exp $
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/ngircd
NAME=ngIRCd
BASENAME=`basename $0`
DESC="IRC daemon"
PARAMS=""
test -f /etc/default/$BASENAME && . /etc/default/$BASENAME
test -x $DAEMON || exit 0
Check_Config()
{
$DAEMON --configtest >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Configuration of $NAME is not valide, won't (re)start!"
echo "Please run \"$DAEMON --configtest\" manually and fix it up ..."
exit 1
fi
}
Try_Start()
{
start-stop-daemon --start --quiet --exec $DAEMON -- $PARAMS
if [ $? -ne 0 ]; then
echo "$NAME failed!"
exit 1
fi
echo "$NAME."
}
case "$1" in
start)
Check_Config
echo -n "Starting $DESC: "
Try_Start
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --exec $DAEMON \
&& echo "$NAME." \
|| echo "(none running)"
;;
reload|force-reload)
Check_Config
echo "Reloading $DESC configuration files."
start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
;;
restart)
Check_Config
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
sleep 1
Try_Start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0
# -eof-

View File

@@ -1,14 +0,0 @@
#!/bin/sh
#
# Debian post-installation script
# $Id: ngircd.postinst,v 1.1 2003/12/31 17:20:11 alex Exp $
#
if [ -f /etc/ngircd/ngircd.conf ]; then
# make sure that configuration file is not world readable
chmod o= /etc/ngircd/ngircd.conf
fi
#DEBHELPER#
# -eof-

View File

@@ -1,156 +0,0 @@
#!/usr/bin/make -f
#
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# debian/rules for ngIRCd
#
# $Id: rules,v 1.2 2004/01/01 22:24:48 alex Exp $
#
# Based on the sample debian/rules that uses debhelper,
# GNU copyright 1997 to 1999 by Joey Hess.
#
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
configure-ngircd: configure
dh_testdir
# configure "standard" variant:
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr \
--sysconfdir=/etc/ngircd \
--mandir=\$${prefix}/share/man \
--with-syslog --with-zlib
configure-ngircd-full: configure
dh_testdir
# configure "full" variant:
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr \
--sysconfdir=/etc/ngircd \
--mandir=\$${prefix}/share/man \
--with-syslog --with-zlib --with-tcp-wrappers --with-ident
build:
dh_clean -k
build-ngircd: build-stamp-ngircd
build-stamp-ngircd: configure-ngircd
dh_testdir
rm -f build-stamp-*
# Add here commands to compile the "standard" package:
$(MAKE)
touch build-stamp-ngircd
build-ngircd-full: build-stamp-ngircd-full
build-stamp-ngircd-full: configure-ngircd-full
dh_testdir
rm -f build-stamp-*
# Add here commands to compile the "full" package:
$(MAKE)
touch build-stamp-ngircd-full
clean:
dh_testdir
dh_testroot
rm -f build-stamp*
rm -f $(CURDIR)/debian/ngircd-full.default
rm -f $(CURDIR)/debian/ngircd-full.init
rm -f $(CURDIR)/debian/ngircd-full.postinst
# Add here commands to clean up after the build process:
-$(MAKE) clean
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
cp -f /usr/share/misc/config.guess config.guess
endif
dh_clean
install: install-ngircd install-ngircd-full
install-ngircd: build-ngircd
dh_testdir
dh_testroot
dh_installdirs
# Add here commands to install the "standard" package into debian/ngircd:
$(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd
rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/INSTALL*
rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/COPYING*
install-ngircd-full: build-ngircd-full
dh_testdir
dh_testroot
dh_installdirs
# Add here commands to install the "full" package into debian/ngircd-full:
$(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full
rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/INSTALL*
rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/COPYING*
mv $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd \
$(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full
# Build architecture-independent files here.
binary-indep:
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
ln -s $(CURDIR)/debian/ngircd.default \
$(CURDIR)/debian/ngircd-full.default
ln -s $(CURDIR)/debian/ngircd.init \
$(CURDIR)/debian/ngircd-full.init
ln -s $(CURDIR)/debian/ngircd.postinst \
$(CURDIR)/debian/ngircd-full.postinst
dh_testdir
dh_testroot
dh_installchangelogs -a -A ChangeLog
dh_installdocs -a
dh_installinit -a
dh_strip -a
dh_compress -a
dh_fixperms -a
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
# -eof-

View File

@@ -1,20 +0,0 @@
#
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2004 Alexander Barton <alex@barton.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# $Id: Makefile.am,v 1.1.2.1 2004/05/11 00:38:17 alex Exp $
#
clean-local:
rm -rf build
maintainer-clean-local:
rm -f Makefile Makefile.in
# -eof-

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2004 Alexander Barton <alex@barton.de> # Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
# #
# Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen # Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# der GNU General Public License (GPL), wie von der Free Software Foundation # der GNU General Public License (GPL), wie von der Free Software Foundation
@@ -9,12 +9,10 @@
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. # der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
# #
# $Id: Makefile.am,v 1.4 2004/04/28 12:18:02 alex Exp $ # $Id: Makefile.am,v 1.1.2.1 2002/10/03 16:13:38 alex Exp $
# #
SUBDIRS = Debian MacOSX EXTRA_DIST = ngircd.spec
EXTRA_DIST = README ngircd.spec systrace.policy
maintainer-clean-local: maintainer-clean-local:
rm -f Makefile Makefile.in rm -f Makefile Makefile.in

View File

@@ -1,27 +0,0 @@
ngIRCd - Next Generation IRC Server
(c)2001-2004 by Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
terms of the GNU General Public License.
-- Contributions --
MacOSX/
- Project file for XCode "project builder" of Mac OS X.
Debian/
- Various files for building Debian packages.
ngircd.spec
- RPM "spec" file.
systrace.policy
- Systrace policy file for OpenBSD (and probably NetBSD).
--
$Id: README,v 1.1 2004/04/28 12:18:50 alex Exp $

View File

@@ -1,9 +1,9 @@
%define name ngircd %define name ngircd
%define version 0.8.2 %define version 0.5.3
%define release 1 %define release 1
%define prefix %{_prefix} %define prefix %{_prefix}
Summary: A lightweight daemon for the Internet Relay Chat (IRC) Summary: Next Generation Internet Relay Chat Daemon
Name: %{name} Name: %{name}
Version: %{version} Version: %{version}
Release: %{release} Release: %{release}
@@ -15,18 +15,17 @@ Packager: Sean Reifschneider <jafo-rpms@tummy.com>
BuildRoot: /var/tmp/%{name}-root BuildRoot: /var/tmp/%{name}-root
%description %description
ngIRCd is a free open source daemon for the Internet Relay Chat (IRC), ngIRCd is a free open source daemon for Internet Relay Chat (IRC),
developed under the GNU General Public License (GPL). It's written from developed under the GNU General Public License (GPL). It's written from
scratch and is not based upon the original IRCd like many others. scratch and is not based upon the original IRCd like many others.
Advantages: Why should you use ngIRCd? Because ...
- no problems with servers using changing/non-static IP addresses.
- small and lean configuration file.
- free, modern and open source C code.
- still under active development.
ngIRCd is compatible to the "original" ircd 2.10.3p3, so you can run * ... there are no problems with servers on changing or non-static IP
mixed networks. addresses.
* ... there is a small and lean configuration file.
* ... there is a free, modern and open source C source code.
* ... it is still under active development.
%prep %prep
%setup %setup
@@ -52,4 +51,4 @@ make
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README %doc AUTHORS COPYING ChangeLog INSTALL NEWS README
%config(noreplace) /etc %config(noreplace) /etc
%{_prefix}/sbin %{_prefix}/sbin
%{_prefix}/share/man/ %attr(644,root,root) %{_prefix}/share/man/

View File

@@ -1,77 +0,0 @@
#
# Sample systrace policy for ngIRCd on OpenBSD
# Author: Benjamin Pineau <ben@zouh.org>
#
# $Id: systrace.policy,v 1.1 2004/04/28 12:16:59 alex Exp $
#
# Tune me, put me in /etc/systrace/usr_local_bin_ngircd and start ngIRCd
# (with root privileges) as:
#
# systrace -a /usr/local/bin/ngircd
#
# I didn't tried this on NetBSD, but it should work as is.
#
# On systems with pf, it can be supplemented by strict firewall rules:
# for a ngircd running as '$ircuser', binding on '$ircport' and accepting
# 30 connections:
#
# block out log quick proto tcp from any port $ircport to any \
# user != $ircuser
# pass in inet proto tcp from any to any port $ircport user $ircuser \
# keep state (max 30) flags S/SA
#
Policy: /usr/local/bin/ngircd, Emulation: native
native-__sysctl: permit
native-fsread: filename eq "/etc/malloc.conf" then permit
native-fsread: filename sub "/usr/share/zoneinfo/" then permit
native-fsread: filename eq "/usr/local/etc/ngircd.conf" then permit
native-fsread: filename eq "/usr/local/etc/ngircd.motd" then permit
native-fsread: filename eq "/etc/ngircd.conf" then permit
native-fsread: filename eq "/etc/ngircd.motd" then permit
native-fsread: filename eq "/etc/spwd.db" then deny[eperm]
native-fsread: filename eq "/etc/group" then permit
native-fsread: filename eq "/etc/resolv.conf" then permit
native-fsread: filename eq "/etc/localtime" then permit
native-fsread: filename eq "/etc/hosts" then permit
native-fsread: filename sub "<non-existent filename>" then deny[enoent]
native-socket: sockdom eq "AF_UNIX" and socktype eq "SOCK_DGRAM" then permit
native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit
native-bind: sockaddr match "inet-*:6667" then permit, if user != root
native-connect: sockaddr eq "/dev/log" then permit, if user != root
native-connect: sockaddr match "inet-*:53" then permit, if user != root
native-setsockopt: permit, if user != root
native-listen: permit, if user != root
native-accept: permit, if user != root
native-sendto: true then permit, if user != root
native-recvfrom: permit, if user != root
native-read: permit
native-pread: permit
native-write: permit, if user != root
native-mmap: permit
native-munmap: permit
native-mprotect: permit
native-break: permit
native-umask: permit
native-fork: permit
native-setsid: permit
native-chdir: permit
native-chroot: permit
native-setgid: gid neq "0" then permit
native-setuid: uid neq "0" and uname neq "root" then permit
native-getuid: permit
native-getgid: permit
native-gettimeofday: permit
native-getpid: permit
native-select: permit
native-fcntl: permit
native-fstat: permit
native-issetugid: permit
native-sigaction: permit
native-pipe: permit
native-sigreturn: permit
native-close: permit
native-exit: permit
native-fswrite: deny[eperm]
# -eof-

View File

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

View File

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

View File

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

View File

@@ -1,63 +0,0 @@
ngIRCd - Next Generation IRC Server
(c)2001-2004 Alexander Barton
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
terms of the GNU General Public License.
-- Platforms.txt --
This file lists the status of all platforms on which the ngIRCd has been
tested. Included is the date and version of the last "official" test and
the name of the tester/maintainer.
If you successfully compiled and tested ngIRCd on a platform that isn't
listed here, please contact Alexander Barton, <alex@barton.de>, so that this
list can be updated. Thanks for your help!
the executable works ("runs") as expected --+
tests run successfully ("make check") --+ |
ngIRCd compiles ("make") --+ | |
./configure works --+ | | |
| | | |
Platform Compiler ngIRCd Date Tester C M T R See
--------------------------- ------------ ---------- -------- ------ - - - - ---
hppa/unknown/openbsd3.5 gcc 2.95.3 CVSHEAD 04-05-25 alex Y Y Y Y
hppa1.1/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
i386/pc/solaris2.9 gcc 3.2.2 CVSHEAD 04-02-24 alex Y Y Y Y
i386/unknown/freebsd5.2.1 gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
i386/unknown/gnu0.3 gcc 3.3.3 0.8.0 04-05-30 alex Y Y n Y
i386/unknown/netbsdelf1.6.1 gcc 2.95.3 CVSHEAD 04-02-24 alex Y Y Y Y
i686/pc/cygwin gcc 3.3.1 0.8.0 04-05-30 alex Y Y n Y
i686/pc/linux-gnu gcc 2.95.4 0.8.0 04-05-30 alex Y Y Y Y (1)
i686/pc/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y (1)
m68k/apple/aux3.1.1 Orig. A/UX 0.7.x-CVS 03-04-22 alex Y Y Y Y (2)
m68k/hp/hp-ux9.10 Orig. HPUX 0.7.x-CVS 03-04-30 goetz Y Y Y Y
m88k/dg/dgux5.4R3.10 gcc 2.5.8 CVSHEAD 04-03-15 alex Y Y ? ?
powerpc/apple/darwin6.5 gcc 3.1 0.7.x-CVS 03-04-23 alex Y Y Y Y
powerpc/apple/darwin7.4.0 gcc 3.3 0.8.0 04-05-30 alex Y Y Y Y
powerpc/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
sparc/sun/solaris2.6 gcc 2.95.3 0.7.x-CVS 03-04-22 alex Y Y Y Y
sparc/sun/solaris2.7 gcc 3.3 0.8.0 04-05-30 alex Y Y Y Y
sparc/unkn./netbsdelf1.6.1 gcc 2.95.3 0.8.0 04-05-30 alex Y Y Y Y
Notes
~~~~~
(1) i686/pc/linux-gnu:
ngIRCd has been tested with various Linux distributions, such as SuSE,
RedHat, Debian, and Gentoo using Kernels 2.2.x, 2.4.x and 2.6.x with
various versions of the GNU C compiler (2.95.3, 3.0, 3.2, and 3.3). The
eldest glibc used was glibc-2.0.7. ngIRCd compiled and run on all these
systems without problems.
(2) This compiler is an pre-ANSI C compiler, therefore the source code is
automatically converted using the included ansi2knr tool while building.
--
$Id: Platforms.txt,v 1.11.2.1 2004/11/09 10:58:01 alex Exp $

View File

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

View File

@@ -1,67 +1,71 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton, (c)2001,2002 by Alexander Barton,
alex@barton.de, http://www.barton.de/ alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd ist freie Software und steht unter
terms of the GNU General Public License. der GNU General Public License.
-- README-AUX.txt --
-- README-AUX.txt -- Seit Version 0.2.2-pre gehoert Apple A/UX zu den offiziell unterstuetzten
Platformen. Er ist im vollen Funktionsumfang nutzbar.
Folgende Software wird jedoch benoetigt:
- GNU C Compiler (gcc)
Bezugsquellen:
http://www.rezepte-im-web.de/appleux/gcc281.tar.gz
ftp://arthur.ath.cx/pub/AUX/Software/Development/gcc-2.8.1-auxbin.tar.gz
- GNU make
Bezugsquellen:
http://www.rezepte-im-web.de/appleux/make-3.79.tar.gz
ftp://arthur.ath.cx/pub/AUX/Software/Development/make-3.79.tar.gz
- 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
- install (z.B. aus den GNU fileutils)
Ein install, welches entweder so "broken" ist, dass configure das eigene
Shell-Script waehlt, oder eines, das funktioniert. Leider ist mindestens
ein Binary im Umlauf, das Probleme macht.
Bezugsquelle:
ftp://arthur.ath.cx/pub/UNIX/AUX/Software/Tools/fileutils-4.0.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
Nachdem diese Pakete entsprechend installiert sind, reicht ein ganz normales
"./configure" und "make" aus, um den ngIRCd unter A/UX zu compilieren.
Since version 0.2.2-pre Apple's A/UX belongs to the officially supported Noch ein paar Hinweise, wenn es doch (noch) nicht klappt:
platforms. It is not restricted in any way.
Since version 0.5.0 ngIRCd's source compiles with the native A/UX c - auf dem System muss entweder ein install vorhanden sein, welches so
compiler. GNU C isn't a must-have anymore. "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
The following software packages are needed: - das sich im Umlauf befindende vorcompilierte Binary der alten Bash sollte
unbedingt ausserhalb von /bin (z.B. unter /usr/local/bin) installiert
- GNU sed werden. Ansonsten waehlt es das configure-Script als Shell aus, leider
Source: funktioniert das aber nicht.
http://www.rezepte-im-web.de/appleux/sed-3.02.tar.gz Das config.status-Script sollte mit der ksh als Interpreter erstellt
ftp://arthur.ath.cx/pub/AUX/Software/Tools/sed-3.02.tar.gz worden sein (siehe erste Zeile davon!).
A/UX comes with /bin/sed which isn't supporting all functions needed
by GNU automake/autoconf.
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.
- 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().
After installation of these packages just do a "./configure" and "make" to Hier die Zeiten von Alex System (Macintosh SE/30, 32 MB, A/UX 3.0.1):
compile ngIRCd on A/UX. configure: 7:33, make: 12:02
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.8 2003/04/21 21:59:34 goetz Exp $ $Id: README-AUX.txt,v 1.3 2002/04/29 14:19:48 alex Exp $

View File

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

View File

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

View File

@@ -1,58 +0,0 @@
ngIRCd - Next Generation IRC Server
(c)2001-2004 by Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
terms of the GNU General Public License.
-- SSL.txt --
ngIRCd actually doesn't support secure connections for client-server or
server-server links using SSL, the Secure Socket Layer, by itself. But you can
use the stunnel(8) command to make this work.
<http://stunnel.mirt.net/>
<http://www.stunnel.org/>
Stefan Sperling (stefan at binarchy dot net) mailed me the following text as a
short "how-to", thanks Stefan!
=== snip ===
! This guide applies to stunnel 4.x !
Put this in your stunnel.conf:
[ircs]
accept = 6667
connect = 6668
This makes stunnel listen for incoming connections
on port 6667 and forward decrypted data to port 6668.
We call the connection 'ircs'. Stunnel will use this
name when logging connection attempts via syslog.
You can also use the name in /etc/hosts.{allow,deny}
if you run tcp-wrappers.
To make sure ngircd is listening on the port where
the decrypted data arrives, set
Ports = 6668
in your ngircd.conf.
Start stunnel and restart ngircd.
That's it.
Don't forget to activate ssl support in your irc client ;)
=== snip ===
Probably ngIRCd will include support for SSL in the future ...
--
$Id: SSL.txt,v 1.2.2.1 2005/01/26 21:47:47 alex Exp $

126
doc/en/INSTALL Normal file
View File

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

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

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

101
doc/en/README Normal file
View File

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

View File

@@ -1,160 +1,144 @@
# $Id: sample-ngircd.conf,v 1.25.2.1 2004/05/07 11:24:17 alex Exp $ # $Id: sample-ngircd.conf,v 1.11 2002/09/16 10:33:09 alex Exp $
# #
# This is a sample configuration file for the ngIRCd, which must be adepted # Das ist eine Beispiel-Konfiguration fuer den ngIRCd, die an die
# to the local preferences and needs. # jeweiligen Beduerfnisse angepasst werden kann/muss.
# #
# Comments are started with "#" or ";". # Kommentare werden mit "#" oder ";" eingeleitet.
# #
# Use "ngircd --configtest" (see manual page ngircd(8)) to validate that the # Autor: Alexander Barton, <alex@barton.de>
# server interpreted the configuration file as expected! # Erweiterungen von Ilja Osthoff, <ilja@glide.ath.cx>
# #
[Global] [Global]
# The [Global] section of this file is used to define the main #
# configuration of the server, like the server name and the ports # Im [Global]-Abschnitt der Konfigurationsdatei wird der Server
# on which the server should be listening. # "an sich" konfiguriert. Notwendig ist nur die Variable "Name",
# Info ist in der Regel ebengalls anzupassen. Fuer alle uebrigen
# Variablen koennen oft die Defaults benutzt werden, d.h. hier
# muss die Variable nicht angegeben werden.
#
# Server name in the IRC network, must contain at least one dot # Servername im IRC-Netz
# (".") and be unique in the IRC network. Required!
Name = irc.the.net Name = irc.the.net
# Info text of the server. This will be shown by WHOIS and # Info-Text des Servers. Dieser wird z.B. bei WHOIS- oder LINKS-
# LINKS requests for example. # Abfragen entsprechend mit ausgegeben.
Info = Server Info Text Info = Server Info Text
# Global password for all users needed to connect to the server # Informationen ueber den Server und Administrator fuer den
;Password = abc # ADMIN-Befehl:
;AdminInfo1 = Beschreibung
# Information about the server and the administrator, used by the ;AdminInfo2 = Standort
# ADMIN command. Not required by server but by RFC!
;AdminInfo1 = Description
;AdminInfo2 = Location
;AdminEMail = admin@irc.server ;AdminEMail = admin@irc.server
# Ports on which the server should listen. There may be more than # Ports, auf denen Verbindungen angenommen werden sollen. Es koennen
# one port, separated with ";". (Default: 6667) # mehrere Ports mit "," getrennt angegeben werden. (Default: 6667)
;Ports = 6667, 6668, 66694 ;Ports = 6667, 6668, 6669
# IP address on which the server should listen. (Default: empty, # Textdatei mit der "Message of the Day" (MOTD). Diese wird aus-
# so the server listens on all IP addresses of the system) # gegeben, wenn sich ein User mit dem Server verbindet.
;Listen = 1.2.3.4
# 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 ;MotdFile = /usr/local/etc/ngircd.motd
# A simple Phrase (<256 chars) if you don't want to use a motd file. # User-ID, unter der der Daemon laufen soll (dazu muss der Server
# If it is set no MotdFile will be read at all. # jedoch mit root-Rechten gestartet werden).
;MotdPhrase = "Hello world!" # ACHTUNG: Die Konfigurations- und MOTD-Datei muessen fuer diesen
# Benutzer lesbar sein, ansonsten schlaegt ein RESTART fehl!
# 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 ;ServerUID = 65534
# Group ID under which the ngircd should run; you can use the name # Group-ID, zu der der Daemon wechseln soll (hierzu muss der Server
# of the group or the numerical ID. ATTENTION: For this to work the # jedoch mit root-Rechten gestartet werden)
# server must have been started with root privileges!
;ServerGID = 65534 ;ServerGID = 65534
# A directory to chroot in when everything is initialized. It # Nach <PingTimeout> Sekunden verschickt der Server bei Inaktivitaet
# doesn't need to be populated if ngIRCd is compiled as a static # von einem Client diesem ein PING.
# binary. By default ngIRCd won't use the chroot() feature.
# ATTENTION: For this to work the server must have been started
# with root privileges!
;ChrootDir = /var/empty
# After <PingTimeout> seconds of inactivity the server will send a
# PING to the peer to test whether it is alive or not.
;PingTimeout = 120 ;PingTimeout = 120
# If a client fails to answer a PING with a PONG within <PongTimeout> # Antwortet ein Client, der ein PING bekam, nicht innerhalb von
# seconds, it will be disconnected by the server. # <PongTimeout> Sekunden mit einem PONG, so wird er disconnectiert.
;PongTimeout = 20 ;PongTimeout = 20
# The server tries every <ConnectRetry> seconds to establish a link # Der Server versucht alle <ConnectRetry> Sekunden, noch nicht bzw.
# to not yet (or no longer) connected servers. # nicht mehr connectierte Server-Links aufzubauen.
;ConnectRetry = 60 ;ConnectRetry = 60
# Should IRC Operators be allowed to use the MODE command even if # Sollen IRC-Operatoren immer den MODE-Befehl in Channel benutzen
# they are not(!) channel-operators? # koennen, auch wenn sie kein(!) Channel-Operator sind?
;OperCanUseMode = no ;OperCanUseMode = no
# Maximum number of simultaneous connection the server is allowed
# to accept (<=0: unlimited):
;MaxConnections = -1
# Maximum number of simultaneous connections from a single IP address
# the server will accept (<=0: unlimited):
;MaxConnectionsIP = 5
# Maximum number of channels a user can be member of (<=0: no limit):
;MaxJoins = 10
[Operator] [Operator]
# [Operator] sections are used to define IRC Operators. There may be
# more than one [Operator] block, one for each local operator.
# ID of the operator (may be different of the nick name) #
# Mit einem [Operator]-Block wird der Name und das Passwort eines
# IRC-Operators konfiguriert. Es darf mehrere [Operator]-Bloecke
# geben (fuer jeden Operator einen).
#
# ID des IRC-Operators (muss nicht mit dem Nick identisch sein).
;Name = TheOper ;Name = TheOper
# Password of the IRC operator # Passwort des IRC-Operators
;Password = ThePwd ;Password = ThePwd
[Server] [Server]
# Other servers are configured in [Server] sections. If you
# configure a port for the connection, then this ngircd tries to #
# connect to to the other server on the given port; if not it waits # In [Server]-Bloecken werden Server konfiguriert, zu denen sich
# for the other server to connect. # dieser ngIRCd verbinden soll bzw. von denen Verbindungen angekommen
# There may be more than one server block. # 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!
# #
# 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 # Hostname des Servers
;Name = irc2.the.net
# Internet host name of the peer
;Host = connect-to-host.the.net ;Host = connect-to-host.the.net
# Port of the server to which the ngIRCd should connect. If you # IRC-Name des Servers
# assign no port the ngIRCd waits for incoming connections. ;Name = irc2.the.net
# Port, zu dem dieser Server eine Verbindung herstellen soll. Wird
# kein Port angegeben, so wird auf eine Verbindung der Gegenseite
# gewartet.
;Port = 6666 ;Port = 6666
# Own password for the connection. This password has to be configured # Passwort fuer diese Verbindung
# as "PeerPassword" on the other server. ;Password = ThePwd1
;MyPassword = MySecret
# Foreign password for this connection. This password has to be # Gruppe, zu der dieser Server gehoert (optional).
# configured as "MyPassword" on the other server.
;PeerPassword = PeerSecret
# Group of this server (optional)
;Group = 123 ;Group = 123
[Channel] [Channel]
# Pre-defined channels can be configured in [Channel] sections.
# Such channels are created by the server when starting up and even
# persist when there are no more members left.
# Persistent channels are marked with the mode 'P', which can be set
# and unset by IRC operators like other modes on the fly.
# There may be more than one [Channel] block.
# Name of the channel #
# Mit [Channel]-Bloecken werden "persistente Channels" definiert,
# die nach dem Start des Servers automatisch erzeugt werden und auch
# dann erhalten bleiben, wenn keine User mehr im Channel sind. Es
# koennen mehrere solcher Bloecke hier konfiguriert werden.
# Gekennzeichnet werden solche Channels mit dem Mode "P", der ganz
# normal gesetzt und geloescht werden kann.
#
# Name des Channels
;Name = #TheName ;Name = #TheName
# Topic for this channel # Topic, das gesetzt werden soll
;Topic = a great topic ;Topic = Ein tolles Topic
# Initial channel modes # Channel-Modes
;Modes = tn ;Modes = tn
# -eof- # -eof-

View File

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

View File

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

View File

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

View File

@@ -1,41 +1,40 @@
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) # Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
# #
# This program is free software; you can redistribute it and/or modify # Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# it under the terms of the GNU General Public License as published by # der GNU General Public License (GPL), wie von der Free Software Foundation
# the Free Software Foundation; either version 2 of the License, or # herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
# (at your option) any later version. # der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
# Please read the file COPYING, README and AUTHORS for more information. # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
# #
# $Id: Makefile.am,v 1.42 2003/12/04 14:05:16 alex Exp $ # $Id: Makefile.am,v 1.27 2002/09/07 18:06:29 alex Exp $
# #
AUTOMAKE_OPTIONS = ../portab/ansi2knr AUTOMAKE_OPTIONS = ../portab/ansi2knr
INCLUDES = -I$(srcdir)/../portab -I$(srcdir)/../tool INCLUDES = -I$(srcdir)/../portab
LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN
sbin_PROGRAMS = ngircd sbin_PROGRAMS = ngircd
ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c conn-zip.c conn-func.c \ ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c hash.c irc.c \
hash.c irc.c irc-channel.c irc-info.c irc-login.c irc-mode.c irc-op.c \ irc-channel.c irc-login.c irc-mode.c irc-op.c irc-oper.c irc-server.c \
irc-oper.c irc-server.c irc-write.c lists.c log.c match.c parse.c \ irc-write.c lists.c log.c match.c parse.c resolve.c tool.c
rendezvous.c resolve.c
ngircd_LDFLAGS = -L../portab -L../tool ngircd_LDFLAGS = -L../portab
ngircd_LDADD = -lngportab -lngtool ngircd_LDADD = -lngportab
noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h conn-zip.h conn-func.h \ noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h hash.h irc.h \
hash.h irc.h irc-channel.h irc-info.h irc-login.h irc-mode.h irc-op.h \ irc-channel.h irc-login.h irc-mode.h irc-op.h irc-oper.h irc-server.h \
irc-oper.h irc-server.h irc-write.h lists.h log.h match.h parse.h \ irc-write.h lists.h log.h match.h parse.h resolve.h tool.h \
rendezvous.h resolve.h \
messages.h defines.h messages.h defines.h
clean-local: clean-local:
rm -f check-version check-help lint.out cvs-version.* rm -f check-version check-help lint.out
maintainer-clean-local: maintainer-clean-local:
rm -f Makefile Makefile.in rm -f Makefile Makefile.in
@@ -61,23 +60,6 @@ lint:
fi; \ fi; \
done; done;
ngircd.c: cvs-version.h
irc-login.c: cvs-version.h
irc-info.c: cvs-version.h
cvs-version.h: cvs-date
cvs-date:
grep VERSION ../config.h | grep "CVS" \
&& echo "#define CVSDATE \"$$( grep "\$$Id" $(srcdir)/*.c \
| $(AWK) "{ print \$$9 }" | sort | tail -1 \
| sed -e "s/\//-/g" )\"" > cvs-version.new \
|| echo "" > cvs-version.new
diff cvs-version.h cvs-version.new 2>/dev/null \
|| cp cvs-version.new cvs-version.h
TESTS = check-version check-help TESTS = check-version check-help
# -eof- # -eof-

View File

@@ -2,13 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Channel management * $Id: channel.c,v 1.32.2.1 2002/11/04 19:18:39 alex Exp $
*
* channel.c: Management der Channels
*/ */
@@ -17,15 +20,12 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: channel.c,v 1.45 2004/03/11 22:16:31 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include "conn-func.h" #include "conn.h"
#include "client.h" #include "client.h"
#include "exp.h" #include "exp.h"
@@ -89,14 +89,6 @@ Channel_InitPredefined( VOID )
continue; continue;
} }
/* Gibt es den Channel bereits? */
chan = Channel_Search( Conf_Channel[i].name );
if( chan )
{
Log( LOG_INFO, "Can't create pre-defined channel \"%s\": name already in use.", Conf_Channel[i].name );
continue;
}
/* Channel anlegen */ /* Channel anlegen */
chan = Channel_Create( Conf_Channel[i].name ); chan = Channel_Create( Conf_Channel[i].name );
if( chan ) if( chan )
@@ -293,48 +285,6 @@ Channel_MemberCount( CHANNEL *Chan )
} /* Channel_MemberCount */ } /* Channel_MemberCount */
GLOBAL INT
Channel_CountForUser( CLIENT *Client )
{
/* Count number of channels a user is member of. */
CL2CHAN *cl2chan;
INT count;
assert( Client != NULL );
count = 0;
cl2chan = My_Cl2Chan;
while( cl2chan )
{
if( cl2chan->client == Client ) count++;
cl2chan = cl2chan->next;
}
return count;
} /* Channel_CountForUser */
GLOBAL INT
Channel_PCount( VOID )
{
/* Count the number of persistent (mode 'P') channels */
CHANNEL *chan;
INT count;
count = 0;
chan = My_Channels;
while( chan )
{
if( strchr( chan->modes, 'P' )) count++;
chan = chan->next;
}
return count;
} /* Channel_PCount */
GLOBAL CHAR * GLOBAL CHAR *
Channel_Name( CHANNEL *Chan ) Channel_Name( CHANNEL *Chan )
{ {
@@ -351,22 +301,6 @@ Channel_Modes( CHANNEL *Chan )
} /* Channel_Modes */ } /* Channel_Modes */
GLOBAL CHAR *
Channel_Key( CHANNEL *Chan )
{
assert( Chan != NULL );
return Chan->key;
} /* Channel_Key */
GLOBAL LONG
Channel_MaxUsers( CHANNEL *Chan )
{
assert( Chan != NULL );
return Chan->maxusers;
} /* Channel_MaxUsers */
GLOBAL CHANNEL * GLOBAL CHANNEL *
Channel_First( VOID ) Channel_First( VOID )
{ {
@@ -469,7 +403,7 @@ Channel_IsValidName( CHAR *Name )
if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return FALSE; if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return FALSE;
ptr = Name; ptr = Name;
strcpy( badchars, " ,:\007" ); strcpy( badchars, " ,:\x07" );
while( *ptr ) while( *ptr )
{ {
if( strchr( badchars, *ptr )) return FALSE; if( strchr( badchars, *ptr )) return FALSE;
@@ -495,7 +429,7 @@ Channel_ModeAdd( CHANNEL *Chan, CHAR Mode )
if( ! strchr( Chan->modes, x[0] )) if( ! strchr( Chan->modes, x[0] ))
{ {
/* Client hat den Mode noch nicht -> setzen */ /* Client hat den Mode noch nicht -> setzen */
strlcat( Chan->modes, x, sizeof( Chan->modes )); strcat( Chan->modes, x );
return TRUE; return TRUE;
} }
else return FALSE; else return FALSE;
@@ -548,7 +482,7 @@ Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, CHAR Mode )
if( ! strchr( cl2chan->modes, x[0] )) if( ! strchr( cl2chan->modes, x[0] ))
{ {
/* Client hat den Mode noch nicht -> setzen */ /* Client hat den Mode noch nicht -> setzen */
strlcat( cl2chan->modes, x, sizeof( cl2chan->modes )); strcat( cl2chan->modes, x );
return TRUE; return TRUE;
} }
else return FALSE; else return FALSE;
@@ -630,7 +564,8 @@ Channel_SetTopic( CHANNEL *Chan, CHAR *Topic )
assert( Chan != NULL ); assert( Chan != NULL );
assert( Topic != NULL ); assert( Topic != NULL );
strlcpy( Chan->topic, Topic, sizeof( Chan->topic )); strncpy( Chan->topic, Topic, CHANNEL_TOPIC_LEN - 1 );
Chan->topic[CHANNEL_TOPIC_LEN - 1] = '\0';
} /* Channel_SetTopic */ } /* Channel_SetTopic */
@@ -640,37 +575,18 @@ Channel_SetModes( CHANNEL *Chan, CHAR *Modes )
assert( Chan != NULL ); assert( Chan != NULL );
assert( Modes != NULL ); assert( Modes != NULL );
strlcpy( Chan->modes, Modes, sizeof( Chan->modes )); strncpy( Chan->modes, Modes, CHANNEL_MODE_LEN - 1 );
Chan->topic[CHANNEL_MODE_LEN - 1] = '\0';
} /* Channel_SetModes */ } /* Channel_SetModes */
GLOBAL VOID
Channel_SetKey( CHANNEL *Chan, CHAR *Key )
{
assert( Chan != NULL );
assert( Key != NULL );
strlcpy( Chan->key, Key, sizeof( Chan->key ));
Log( LOG_DEBUG, "Channel %s: Key is now \"%s\".", Chan->name, Chan->key );
} /* Channel_SetKey */
GLOBAL VOID
Channel_SetMaxUsers( CHANNEL *Chan, LONG Count )
{
assert( Chan != NULL );
Chan->maxusers = Count;
Log( LOG_DEBUG, "Channel %s: Member limit is now %ld.", Chan->name, Chan->maxusers );
} /* Channel_SetMaxUsers */
GLOBAL BOOLEAN GLOBAL BOOLEAN
Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text ) Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
{ {
BOOLEAN is_member, has_voice, is_op, ok; BOOLEAN is_member, has_voice, is_op, ok;
/* Okay, target is a channel */ /* Okay, Ziel ist ein Channel */
is_member = has_voice = is_op = FALSE; is_member = has_voice = is_op = FALSE;
if( Channel_IsMemberOf( Chan, From )) if( Channel_IsMemberOf( Chan, From ))
{ {
@@ -679,21 +595,14 @@ Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
if( strchr( Channel_UserModes( Chan, From ), 'o' )) is_op = TRUE; if( strchr( Channel_UserModes( Chan, From ), 'o' )) is_op = TRUE;
} }
/* Check weather client is allowed to write to channel */ /* pruefen, ob Client in Channel schreiben darf */
ok = TRUE; ok = TRUE;
if( strchr( Channel_Modes( Chan ), 'n' ) && ( ! is_member )) ok = FALSE; if( strchr( Channel_Modes( Chan ), 'n' ) && ( ! is_member )) ok = FALSE;
if( strchr( Channel_Modes( Chan ), 'm' ) && ( ! is_op ) && ( ! has_voice )) ok = FALSE; if( strchr( Channel_Modes( Chan ), 'm' ) && ( ! is_op ) && ( ! has_voice )) ok = FALSE;
/* Is the client banned? */
if( Lists_CheckBanned( From, Chan ))
{
/* Client is banned, bus is he channel operator or has voice? */
if(( ! has_voice ) && ( ! is_op )) ok = FALSE;
}
if( ! ok ) return IRC_WriteStrClient( From, ERR_CANNOTSENDTOCHAN_MSG, Client_ID( From ), Channel_Name( Chan )); if( ! ok ) return IRC_WriteStrClient( From, ERR_CANNOTSENDTOCHAN_MSG, Client_ID( From ), Channel_Name( Chan ));
/* Send text */ /* Text senden */
if( Client_Conn( From ) > NONE ) Conn_UpdateIdle( Client_Conn( From )); if( Client_Conn( From ) > NONE ) Conn_UpdateIdle( Client_Conn( From ));
return IRC_WriteStrChannelPrefix( Client, Chan, From, TRUE, "PRIVMSG %s :%s", Channel_Name( Chan ), Text ); return IRC_WriteStrChannelPrefix( Client, Chan, From, TRUE, "PRIVMSG %s :%s", Channel_Name( Chan ), Text );
} /* Channel_Write */ } /* Channel_Write */
@@ -708,20 +617,18 @@ Channel_Create( CHAR *Name )
assert( Name != NULL ); assert( Name != NULL );
c = (CHANNEL *)malloc( sizeof( CHANNEL )); c = malloc( sizeof( CHANNEL ));
if( ! c ) if( ! c )
{ {
Log( LOG_EMERG, "Can't allocate memory! [New_Chan]" ); Log( LOG_EMERG, "Can't allocate memory! [New_Chan]" );
return NULL; return NULL;
} }
c->next = NULL; c->next = NULL;
strlcpy( c->name, Name, sizeof( c->name )); strncpy( c->name, Name, CHANNEL_NAME_LEN - 1 );
c->name[CHANNEL_NAME_LEN - 1] = '\0'; c->name[CHANNEL_NAME_LEN - 1] = '\0';
strcpy( c->modes, "" ); strcpy( c->modes, "" );
strcpy( c->topic, "" ); strcpy( c->topic, "" );
c->hash = Hash( c->name ); c->hash = Hash( c->name );
strcpy( c->key, "" );
c->maxusers = 0;
/* Verketten */ /* Verketten */
c->next = My_Channels; c->next = My_Channels;
@@ -760,7 +667,7 @@ Add_Client( CHANNEL *Chan, CLIENT *Client )
assert( Client != NULL ); assert( Client != NULL );
/* neue CL2CHAN-Struktur anlegen */ /* neue CL2CHAN-Struktur anlegen */
cl2chan = (CL2CHAN *)malloc( sizeof( CL2CHAN )); cl2chan = malloc( sizeof( CL2CHAN ));
if( ! cl2chan ) if( ! cl2chan )
{ {
Log( LOG_EMERG, "Can't allocate memory! [Add_Client]" ); Log( LOG_EMERG, "Can't allocate memory! [Add_Client]" );

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: channel.h,v 1.26 2002/12/16 23:05:24 alex Exp $ * $Id: channel.h,v 1.21.2.1 2002/11/04 19:18:39 alex Exp $
* *
* Channel management (header) * channel.h: Management der Channels (Header)
*/ */
@@ -25,12 +26,10 @@
typedef struct _CHANNEL typedef struct _CHANNEL
{ {
struct _CHANNEL *next; struct _CHANNEL *next;
CHAR name[CHANNEL_NAME_LEN]; /* Name of the channel */ CHAR name[CHANNEL_NAME_LEN]; /* Name des Channel */
UINT32 hash; /* Hash of the (lowecase!) name */ UINT32 hash; /* Hash ueber (kleingeschrieben) Namen */
CHAR modes[CHANNEL_MODE_LEN]; /* Channel modes */ CHAR modes[CHANNEL_MODE_LEN]; /* Channel-Modes */
CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic of the channel */ CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic des Channels */
CHAR key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
LONG maxusers; /* Maximum number of members (mode "l") */
} CHANNEL; } CHANNEL;
typedef struct _CLIENT2CHAN typedef struct _CLIENT2CHAN
@@ -49,60 +48,54 @@ typedef POINTER CL2CHAN;
#endif #endif
GLOBAL VOID Channel_Init PARAMS(( VOID )); GLOBAL VOID Channel_Init PARAMS((VOID ));
GLOBAL VOID Channel_InitPredefined PARAMS(( VOID )); GLOBAL VOID Channel_InitPredefined PARAMS(( VOID ));
GLOBAL VOID Channel_Exit PARAMS(( VOID )); GLOBAL VOID Channel_Exit PARAMS((VOID ));
GLOBAL BOOLEAN Channel_Join PARAMS(( CLIENT *Client, CHAR *Name )); GLOBAL BOOLEAN Channel_Join PARAMS((CLIENT *Client, CHAR *Name ));
GLOBAL BOOLEAN Channel_Part PARAMS(( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason )); GLOBAL BOOLEAN Channel_Part PARAMS((CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ));
GLOBAL VOID Channel_Quit PARAMS(( CLIENT *Client, CHAR *Reason )); GLOBAL VOID Channel_Quit PARAMS((CLIENT *Client, CHAR *Reason ));
GLOBAL VOID Channel_Kick PARAMS(( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason )); GLOBAL VOID Channel_Kick PARAMS(( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ));
GLOBAL LONG Channel_Count PARAMS(( VOID )); GLOBAL LONG Channel_Count PARAMS((VOID ));
GLOBAL LONG Channel_MemberCount PARAMS(( CHANNEL *Chan )); GLOBAL LONG Channel_MemberCount PARAMS((CHANNEL *Chan ));
GLOBAL INT Channel_CountForUser PARAMS(( CLIENT *Client ));
GLOBAL INT Channel_PCount PARAMS(( VOID ));
GLOBAL CHAR *Channel_Name PARAMS(( CHANNEL *Chan )); GLOBAL CHAR *Channel_Name PARAMS((CHANNEL *Chan ));
GLOBAL CHAR *Channel_Modes PARAMS(( CHANNEL *Chan )); GLOBAL CHAR *Channel_Modes PARAMS((CHANNEL *Chan ));
GLOBAL CHAR *Channel_Topic PARAMS(( CHANNEL *Chan )); GLOBAL CHAR *Channel_Topic PARAMS((CHANNEL *Chan ));
GLOBAL CHAR *Channel_Key PARAMS(( CHANNEL *Chan ));
GLOBAL LONG Channel_MaxUsers PARAMS(( CHANNEL *Chan ));
GLOBAL VOID Channel_SetTopic PARAMS(( CHANNEL *Chan, CHAR *Topic )); GLOBAL VOID Channel_SetTopic PARAMS((CHANNEL *Chan, CHAR *Topic ));
GLOBAL VOID Channel_SetModes PARAMS(( CHANNEL *Chan, CHAR *Modes )); GLOBAL VOID Channel_SetModes PARAMS((CHANNEL *Chan, CHAR *Modes ));
GLOBAL VOID Channel_SetKey PARAMS(( CHANNEL *Chan, CHAR *Key ));
GLOBAL VOID Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, LONG Count ));
GLOBAL CHANNEL *Channel_Search PARAMS(( CHAR *Name )); GLOBAL CHANNEL *Channel_Search PARAMS((CHAR *Name ));
GLOBAL CHANNEL *Channel_First PARAMS(( VOID )); GLOBAL CHANNEL *Channel_First PARAMS((VOID ));
GLOBAL CHANNEL *Channel_Next PARAMS(( CHANNEL *Chan )); GLOBAL CHANNEL *Channel_Next PARAMS((CHANNEL *Chan ));
GLOBAL CL2CHAN *Channel_FirstMember PARAMS(( CHANNEL *Chan )); GLOBAL CL2CHAN *Channel_FirstMember PARAMS((CHANNEL *Chan ));
GLOBAL CL2CHAN *Channel_NextMember PARAMS(( CHANNEL *Chan, CL2CHAN *Cl2Chan )); GLOBAL CL2CHAN *Channel_NextMember PARAMS((CHANNEL *Chan, CL2CHAN *Cl2Chan ));
GLOBAL CL2CHAN *Channel_FirstChannelOf PARAMS(( CLIENT *Client )); GLOBAL CL2CHAN *Channel_FirstChannelOf PARAMS((CLIENT *Client ));
GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS(( CLIENT *Client, CL2CHAN *Cl2Chan )); GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS((CLIENT *Client, CL2CHAN *Cl2Chan ));
GLOBAL CLIENT *Channel_GetClient PARAMS(( CL2CHAN *Cl2Chan )); GLOBAL CLIENT *Channel_GetClient PARAMS((CL2CHAN *Cl2Chan ));
GLOBAL CHANNEL *Channel_GetChannel PARAMS(( CL2CHAN *Cl2Chan )); GLOBAL CHANNEL *Channel_GetChannel PARAMS((CL2CHAN *Cl2Chan ));
GLOBAL BOOLEAN Channel_IsValidName PARAMS(( CHAR *Name )); GLOBAL BOOLEAN Channel_IsValidName PARAMS((CHAR *Name ));
GLOBAL BOOLEAN Channel_ModeAdd PARAMS(( CHANNEL *Chan, CHAR Mode )); GLOBAL BOOLEAN Channel_ModeAdd PARAMS((CHANNEL *Chan, CHAR Mode ));
GLOBAL BOOLEAN Channel_ModeDel PARAMS(( CHANNEL *Chan, CHAR Mode )); GLOBAL BOOLEAN Channel_ModeDel PARAMS((CHANNEL *Chan, CHAR Mode ));
GLOBAL BOOLEAN Channel_UserModeAdd PARAMS(( CHANNEL *Chan, CLIENT *Client, CHAR Mode )); GLOBAL BOOLEAN Channel_UserModeAdd PARAMS((CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Channel_UserModeDel PARAMS(( CHANNEL *Chan, CLIENT *Client, CHAR Mode )); GLOBAL BOOLEAN Channel_UserModeDel PARAMS((CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
GLOBAL CHAR *Channel_UserModes PARAMS(( CHANNEL *Chan, CLIENT *Client )); GLOBAL CHAR *Channel_UserModes PARAMS((CHANNEL *Chan, CLIENT *Client ));
GLOBAL BOOLEAN Channel_IsMemberOf PARAMS(( CHANNEL *Chan, CLIENT *Client )); GLOBAL BOOLEAN Channel_IsMemberOf PARAMS((CHANNEL *Chan, CLIENT *Client ));
GLOBAL BOOLEAN Channel_Write PARAMS(( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )); GLOBAL BOOLEAN Channel_Write PARAMS((CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text ));
GLOBAL CHANNEL *Channel_Create PARAMS(( CHAR *Name )); GLOBAL CHANNEL *Channel_Create PARAMS((CHAR *Name ));
#endif #endif

View File

@@ -2,13 +2,23 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Client management. * $Id: client.c,v 1.60.2.2 2002/11/04 19:18:39 alex Exp $
*
* client.c: Management aller Clients
*
* Der Begriff "Client" ist in diesem Fall evtl. etwas verwirrend: Clients sind
* alle Verbindungen, die im gesamten(!) IRC-Netzwerk bekannt sind. Das sind IRC-
* Clients (User), andere Server und IRC-Services.
* Ueber welchen IRC-Server die Verbindung nun tatsaechlich in das Netzwerk her-
* gestellt wurde, muss der jeweiligen Struktur entnommen werden. Ist es dieser
* Server gewesen, so existiert eine entsprechende CONNECTION-Struktur.
*/ */
@@ -17,15 +27,12 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: client.c,v 1.76 2004/03/11 22:16:31 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include <netdb.h> #include <netdb.h>
#include "conn.h" #include "conn.h"
@@ -58,14 +65,6 @@ LOCAL LONG MyCount PARAMS(( CLIENT_TYPE Type ));
LOCAL CLIENT *New_Client_Struct PARAMS(( VOID )); LOCAL CLIENT *New_Client_Struct PARAMS(( VOID ));
LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client )); LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client ));
LOCAL VOID Adjust_Counters PARAMS(( CLIENT *Client ));
#ifndef Client_DestroyNow
GLOBAL VOID Client_DestroyNow PARAMS((CLIENT *Client ));
#endif
LONG Max_Users = 0, My_Max_Users = 0;
GLOBAL VOID GLOBAL VOID
@@ -77,7 +76,7 @@ Client_Init( VOID )
if( ! This_Server ) if( ! This_Server )
{ {
Log( LOG_EMERG, "Can't allocate client structure for server! Going down." ); Log( LOG_EMERG, "Can't allocate client structure for server! Going down." );
Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 ); exit( 1 );
} }
@@ -91,7 +90,7 @@ Client_Init( VOID )
gethostname( This_Server->host, CLIENT_HOST_LEN ); gethostname( This_Server->host, CLIENT_HOST_LEN );
h = gethostbyname( This_Server->host ); h = gethostbyname( This_Server->host );
if( h ) strlcpy( This_Server->host, h->h_name, sizeof( This_Server->host )); if( h ) strcpy( This_Server->host, h->h_name );
Client_SetID( This_Server, Conf_ServerName ); Client_SetID( This_Server, Conf_ServerName );
Client_SetInfo( This_Server, Conf_ServerInfo ); Client_SetInfo( This_Server, Conf_ServerInfo );
@@ -106,7 +105,7 @@ Client_Exit( VOID )
CLIENT *c, *next; CLIENT *c, *next;
INT cnt; INT cnt;
if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, FALSE ); if( NGIRCd_Restart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, FALSE );
else Client_Destroy( This_Server, "Server going down.", NULL, FALSE ); else Client_Destroy( This_Server, "Server going down.", NULL, FALSE );
cnt = 0; cnt = 0;
@@ -180,15 +179,12 @@ Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *
if( Type == CLIENT_SERVER ) Generate_MyToken( client ); if( Type == CLIENT_SERVER ) Generate_MyToken( client );
/* ist der User away? */ /* ist der User away? */
if( strchr( client->modes, 'a' )) strlcpy( client->away, DEFAULT_AWAY_MSG, sizeof( client->away )); if( strchr( client->modes, 'a' )) strcpy( client->away, DEFAULT_AWAY_MSG );
/* Verketten */ /* Verketten */
client->next = (POINTER *)My_Clients; client->next = (POINTER *)My_Clients;
My_Clients = client; My_Clients = client;
/* Adjust counters */
Adjust_Counters( client );
return client; return client;
} /* Client_New */ } /* Client_New */
@@ -208,7 +204,7 @@ Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )
if( ! txt ) txt = "Reason unknown."; if( ! txt ) txt = "Reason unknown.";
/* Netz-Split-Nachricht vorbereiten (noch nicht optimal) */ /* Netz-Split-Nachricht vorbereiten (noch nicht optimal) */
if( Client->type == CLIENT_SERVER ) snprintf( msg, sizeof( msg ), "%s: lost server %s", This_Server->id, Client->id ); if( Client->type == CLIENT_SERVER ) sprintf( msg, "%s: lost server %s", This_Server->id, Client->id );
last = NULL; last = NULL;
c = My_Clients; c = My_Clients;
@@ -268,7 +264,7 @@ Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )
} }
/* andere Server informieren */ /* andere Server informieren */
if( ! NGIRCd_SignalQuit ) if( ! NGIRCd_Quit )
{ {
if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :%s", c->id, FwdMsg ); if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :%s", c->id, FwdMsg );
else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :", c->id ); else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :", c->id );
@@ -297,35 +293,6 @@ Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )
} /* Client_Destroy */ } /* Client_Destroy */
GLOBAL VOID
Client_DestroyNow( CLIENT *Client )
{
/* Destroy client structure immediately. This function is only
* intended for the connection layer to remove client structures
* of connections that can't be established! */
CLIENT *last, *c;
assert( Client != NULL );
last = NULL;
c = My_Clients;
while( c )
{
if( c == Client )
{
/* Wir haben den Client gefunden: entfernen */
if( last ) last->next = c->next;
else My_Clients = (CLIENT *)c->next;
free( c );
break;
}
last = c;
c = (CLIENT *)c->next;
}
} /* Client_DestroyNow */
GLOBAL VOID GLOBAL VOID
Client_SetHostname( CLIENT *Client, CHAR *Hostname ) Client_SetHostname( CLIENT *Client, CHAR *Hostname )
{ {
@@ -334,7 +301,8 @@ Client_SetHostname( CLIENT *Client, CHAR *Hostname )
assert( Client != NULL ); assert( Client != NULL );
assert( Hostname != NULL ); assert( Hostname != NULL );
strlcpy( Client->host, Hostname, sizeof( Client->host )); strncpy( Client->host, Hostname, CLIENT_HOST_LEN - 1 );
Client->host[CLIENT_HOST_LEN - 1] = '\0';
} /* Client_SetHostname */ } /* Client_SetHostname */
@@ -346,7 +314,8 @@ Client_SetID( CLIENT *Client, CHAR *ID )
assert( Client != NULL ); assert( Client != NULL );
assert( ID != NULL ); assert( ID != NULL );
strlcpy( Client->id, ID, sizeof( Client->id )); strncpy( Client->id, ID, CLIENT_ID_LEN - 1 );
Client->id[CLIENT_ID_LEN - 1] = '\0';
/* Hash */ /* Hash */
Client->hash = Hash( Client->id ); Client->hash = Hash( Client->id );
@@ -361,12 +330,13 @@ Client_SetUser( CLIENT *Client, CHAR *User, BOOLEAN Idented )
assert( Client != NULL ); assert( Client != NULL );
assert( User != NULL ); assert( User != NULL );
if( Idented ) strlcpy( Client->user, User, sizeof( Client->user )); if( Idented ) strncpy( Client->user, User, CLIENT_USER_LEN - 1 );
else else
{ {
Client->user[0] = '~'; Client->user[0] = '~';
strlcpy( Client->user + 1, User, sizeof( Client->user ) - 1 ); strncpy( Client->user + 1, User, CLIENT_USER_LEN - 2 );
} }
Client->user[CLIENT_USER_LEN - 1] = '\0';
} /* Client_SetUser */ } /* Client_SetUser */
@@ -378,7 +348,8 @@ Client_SetInfo( CLIENT *Client, CHAR *Info )
assert( Client != NULL ); assert( Client != NULL );
assert( Info != NULL ); assert( Info != NULL );
strlcpy( Client->info, Info, sizeof( Client->info )); strncpy( Client->info, Info, CLIENT_INFO_LEN - 1 );
Client->info[CLIENT_INFO_LEN - 1] = '\0';
} /* Client_SetInfo */ } /* Client_SetInfo */
@@ -390,7 +361,8 @@ Client_SetModes( CLIENT *Client, CHAR *Modes )
assert( Client != NULL ); assert( Client != NULL );
assert( Modes != NULL ); assert( Modes != NULL );
strlcpy( Client->modes, Modes, sizeof( Client->modes )); strncpy( Client->modes, Modes, CLIENT_MODE_LEN - 1 );
Client->modes[CLIENT_MODE_LEN - 1] = '\0';
} /* Client_SetModes */ } /* Client_SetModes */
@@ -402,7 +374,8 @@ Client_SetFlags( CLIENT *Client, CHAR *Flags )
assert( Client != NULL ); assert( Client != NULL );
assert( Flags != NULL ); assert( Flags != NULL );
strlcpy( Client->flags, Flags, sizeof( Client->flags )); strncpy( Client->flags, Flags, CLIENT_FLAGS_LEN - 1 );
Client->modes[CLIENT_FLAGS_LEN - 1] = '\0';
} /* Client_SetFlags */ } /* Client_SetFlags */
@@ -414,20 +387,32 @@ Client_SetPassword( CLIENT *Client, CHAR *Pwd )
assert( Client != NULL ); assert( Client != NULL );
assert( Pwd != NULL ); assert( Pwd != NULL );
strlcpy( Client->pwd, Pwd, sizeof( Client->pwd )); strncpy( Client->pwd, Pwd, CLIENT_PASS_LEN - 1 );
Client->pwd[CLIENT_PASS_LEN - 1] = '\0';
} /* Client_SetPassword */ } /* Client_SetPassword */
GLOBAL VOID GLOBAL VOID
Client_SetAway( CLIENT *Client, CHAR *Txt ) Client_SetAway( CLIENT *Client, CHAR *Txt )
{ {
/* Set AWAY reason of client */ /* Von einem Client gelieferte AWAY-Nachricht */
assert( Client != NULL ); assert( Client != NULL );
assert( Txt != NULL );
strlcpy( Client->away, Txt, sizeof( Client->away )); if( Txt )
Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt ); {
/* Client AWAY setzen */
strncpy( Client->away, Txt, CLIENT_AWAY_LEN - 1 );
Client->away[CLIENT_AWAY_LEN - 1] = '\0';
Client_ModeAdd( Client, 'a' );
Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
}
else
{
/* AWAY loeschen */
Client_ModeDel( Client, 'a' );
Log( LOG_DEBUG, "User \"%s\" is no longer away.", Client_Mask( Client ));
}
} /* Client_SetAway */ } /* Client_SetAway */
@@ -437,7 +422,6 @@ Client_SetType( CLIENT *Client, INT Type )
assert( Client != NULL ); assert( Client != NULL );
Client->type = Type; Client->type = Type;
if( Type == CLIENT_SERVER ) Generate_MyToken( Client ); if( Type == CLIENT_SERVER ) Generate_MyToken( Client );
Adjust_Counters( Client );
} /* Client_SetType */ } /* Client_SetType */
@@ -489,7 +473,7 @@ Client_ModeAdd( CLIENT *Client, CHAR Mode )
if( ! strchr( Client->modes, x[0] )) if( ! strchr( Client->modes, x[0] ))
{ {
/* Client hat den Mode noch nicht -> setzen */ /* Client hat den Mode noch nicht -> setzen */
strlcat( Client->modes, x, sizeof( Client->modes )); strcat( Client->modes, x );
return TRUE; return TRUE;
} }
else return FALSE; else return FALSE;
@@ -555,7 +539,8 @@ Client_Search( CHAR *Nick )
assert( Nick != NULL ); assert( Nick != NULL );
/* Nick kopieren und ggf. Host-Mask abschneiden */ /* Nick kopieren und ggf. Host-Mask abschneiden */
strlcpy( search_id, Nick, sizeof( search_id )); strncpy( search_id, Nick, CLIENT_ID_LEN - 1 );
search_id[CLIENT_ID_LEN - 1] = '\0';
ptr = strchr( search_id, '!' ); ptr = strchr( search_id, '!' );
if( ptr ) *ptr = '\0'; if( ptr ) *ptr = '\0';
@@ -823,9 +808,8 @@ Client_CheckID( CLIENT *Client, CHAR *ID )
if( strcasecmp( c->id, ID ) == 0 ) if( strcasecmp( c->id, ID ) == 0 )
{ {
/* die Server-ID gibt es bereits */ /* die Server-ID gibt es bereits */
snprintf( str, sizeof( str ), "ID \"%s\" already registered", ID ); sprintf( str, "ID \"%s\" already registered!", ID );
if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id ); Log( LOG_ERR, "%s (on connection %d)", str, Client->conn_id );
else Log( LOG_ERR, "%s (via network)!", str );
Conn_Close( Client->conn_id, str, str, TRUE ); Conn_Close( Client->conn_id, str, str, TRUE );
return FALSE; return FALSE;
} }
@@ -942,20 +926,6 @@ Client_UnknownCount( VOID )
} /* Client_UnknownCount */ } /* Client_UnknownCount */
GLOBAL LONG
Client_MaxUserCount( VOID )
{
return Max_Users;
} /* Client_MaxUserCount */
GLOBAL LONG
Client_MyMaxUserCount( VOID )
{
return My_Max_Users;
} /* Client_MyMaxUserCount */
GLOBAL BOOLEAN GLOBAL BOOLEAN
Client_IsValidNick( CHAR *Nick ) Client_IsValidNick( CHAR *Nick )
{ {
@@ -1024,7 +994,7 @@ New_Client_Struct( VOID )
CLIENT *c; CLIENT *c;
c = (CLIENT *)malloc( sizeof( CLIENT )); c = malloc( sizeof( CLIENT ));
if( ! c ) if( ! c )
{ {
Log( LOG_EMERG, "Can't allocate memory! [New_Client_Struct]" ); Log( LOG_EMERG, "Can't allocate memory! [New_Client_Struct]" );
@@ -1078,24 +1048,4 @@ Generate_MyToken( CLIENT *Client )
} /* Generate_MyToken */ } /* Generate_MyToken */
LOCAL VOID
Adjust_Counters( CLIENT *Client )
{
LONG count;
assert( Client != NULL );
if( Client->type != CLIENT_USER ) return;
if( Client->conn_id != NONE )
{
/* Local connection */
count = Client_MyUserCount( );
if( count > My_Max_Users ) My_Max_Users = count;
}
count = Client_UserCount( );
if( count > Max_Users ) Max_Users = count;
} /* Adjust_Counters */
/* -eof- */ /* -eof- */

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: client.h,v 1.34 2003/01/15 14:28:25 alex Exp $ * $Id: client.h,v 1.29.2.1 2002/11/04 19:18:39 alex Exp $
* *
* Client management (header) * client.h: Konfiguration des ngircd (Header)
*/ */
@@ -18,17 +19,18 @@
#define __client_h__ #define __client_h__
#define CLIENT_UNKNOWN 1 /* connection of unknown type */ typedef enum
#define CLIENT_GOTPASS 2 /* client did send PASS */ {
#define CLIENT_GOTNICK 4 /* client did send NICK */ CLIENT_UNKNOWN, /* Verbindung mit (noch) unbekanntem Typ */
#define CLIENT_GOTUSER 8 /* client did send USER */ CLIENT_GOTPASS, /* Client hat PASS gesendet */
#define CLIENT_USER 16 /* client is an IRC user */ CLIENT_GOTNICK, /* Client hat NICK gesendet */
#define CLIENT_UNKNOWNSERVER 32 /* unregistered server connection */ CLIENT_GOTUSER, /* Client hat USER gesendet */
#define CLIENT_GOTPASSSERVER 64 /* client did send PASS in "server style" */ CLIENT_USER, /* Client ist ein Benutzer (USER wurde gesendet) */
#define CLIENT_SERVER 128 /* client is a server */ CLIENT_UNKNOWNSERVER, /* unregistrierte Server-Verbindung */
#define CLIENT_SERVICE 256 /* client is a service */ CLIENT_GOTPASSSERVER, /* Client hat PASS nach "Server-Art" gesendet */
CLIENT_SERVER, /* Client ist ein Server */
#define CLIENT_TYPE INT CLIENT_SERVICE /* Client ist ein Service */
} CLIENT_TYPE;
#if defined(__client_c__) | defined(S_SPLINT_S) #if defined(__client_c__) | defined(S_SPLINT_S)
@@ -37,22 +39,22 @@
typedef struct _CLIENT typedef struct _CLIENT
{ {
CHAR id[CLIENT_ID_LEN]; /* nick (user) / ID (server) */ CHAR id[CLIENT_ID_LEN]; /* Nick (User) bzw. ID (Server) */
UINT32 hash; /* hash of lower-case ID */ UINT32 hash; /* Hash ueber die (kleingeschriebene) ID */
POINTER *next; /* pointer to next client structure */ POINTER *next; /* Zeiger auf naechste Client-Struktur */
CLIENT_TYPE type; /* type of client, see CLIENT_xxx */ CLIENT_TYPE type; /* Typ des Client, vgl. CLIENT_TYPE */
CONN_ID conn_id; /* ID of the connection (if local) or NONE (remote) */ CONN_ID conn_id; /* ID der Connection (wenn lokal) bzw. NONE (remote) */
struct _CLIENT *introducer; /* ID of the servers which the client is connected to */ struct _CLIENT *introducer; /* ID des Servers, der die Verbindung hat */
struct _CLIENT *topserver; /* toplevel servers (only valid if client is a server) */ struct _CLIENT *topserver; /* Toplevel-Servers (nur gueltig, wenn Client ein Server ist) */
CHAR pwd[CLIENT_PASS_LEN]; /* password received of the client */ CHAR pwd[CLIENT_PASS_LEN]; /* Passwort, welches der Client angegeben hat */
CHAR host[CLIENT_HOST_LEN]; /* hostname of the client */ CHAR host[CLIENT_HOST_LEN]; /* Hostname des Client */
CHAR user[CLIENT_USER_LEN]; /* user name ("login") */ CHAR user[CLIENT_USER_LEN]; /* Benutzername ("Login") */
CHAR info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */ CHAR info[CLIENT_INFO_LEN]; /* Langer Benutzername (User) bzw. Infotext (Server) */
CHAR modes[CLIENT_MODE_LEN]; /* client modes */ CHAR modes[CLIENT_MODE_LEN]; /* Client Modes */
INT hops, token, mytoken; /* "hops" and "Token" (see SERVER command) */ INT hops, token, mytoken; /* "Hops" und "Token" (-> SERVER-Befehl) */
BOOLEAN oper_by_me; /* client is local IRC operator on this server? */ BOOLEAN oper_by_me; /* IRC-Operator-Status durch diesen Server? */
CHAR away[CLIENT_AWAY_LEN]; /* AWAY text (valid if mode 'a' is set) */ CHAR away[CLIENT_AWAY_LEN]; /* AWAY-Text, wenn Mode 'a' gesetzt */
CHAR flags[CLIENT_FLAGS_LEN]; /* flags of the client */ CHAR flags[CLIENT_FLAGS_LEN]; /* Flags des Client (aktuell nur bei Servern) */
} CLIENT; } CLIENT;
#else #else
@@ -62,81 +64,76 @@ typedef POINTER CLIENT;
#endif #endif
GLOBAL VOID Client_Init PARAMS(( VOID )); GLOBAL VOID Client_Init PARAMS((VOID ));
GLOBAL VOID Client_Exit PARAMS(( VOID )); GLOBAL VOID Client_Exit PARAMS((VOID ));
GLOBAL CLIENT *Client_NewLocal PARAMS(( CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented )); GLOBAL CLIENT *Client_NewLocal PARAMS((CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented ));
GLOBAL CLIENT *Client_NewRemoteServer PARAMS(( CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented )); GLOBAL CLIENT *Client_NewRemoteServer PARAMS((CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented ));
GLOBAL CLIENT *Client_NewRemoteUser PARAMS(( CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented )); GLOBAL CLIENT *Client_NewRemoteUser PARAMS((CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented ));
GLOBAL CLIENT *Client_New PARAMS(( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented )); GLOBAL CLIENT *Client_New PARAMS((CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented ));
GLOBAL VOID Client_Destroy PARAMS(( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )); GLOBAL VOID Client_Destroy PARAMS((CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit ));
#ifdef CONN_MODULE
GLOBAL VOID Client_DestroyNow PARAMS(( CLIENT *Client ));
#endif
GLOBAL CLIENT *Client_ThisServer PARAMS(( VOID )); GLOBAL CLIENT *Client_ThisServer PARAMS((VOID ));
GLOBAL CLIENT *Client_GetFromConn PARAMS(( CONN_ID Idx )); GLOBAL CLIENT *Client_GetFromConn PARAMS((CONN_ID Idx ));
GLOBAL CLIENT *Client_GetFromToken PARAMS(( CLIENT *Client, INT Token )); GLOBAL CLIENT *Client_GetFromToken PARAMS((CLIENT *Client, INT Token ));
GLOBAL CLIENT *Client_Search PARAMS(( CHAR *ID )); GLOBAL CLIENT *Client_Search PARAMS((CHAR *ID ));
GLOBAL CLIENT *Client_First PARAMS(( VOID )); GLOBAL CLIENT *Client_First PARAMS((VOID ));
GLOBAL CLIENT *Client_Next PARAMS(( CLIENT *c )); GLOBAL CLIENT *Client_Next PARAMS((CLIENT *c ));
GLOBAL INT Client_Type PARAMS(( CLIENT *Client )); GLOBAL INT Client_Type PARAMS((CLIENT *Client ));
GLOBAL CONN_ID Client_Conn PARAMS(( CLIENT *Client )); GLOBAL CONN_ID Client_Conn PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_ID PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_ID PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Mask PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Mask PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Info PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Info PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_User PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_User PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Hostname PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Hostname PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Password PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Password PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Modes PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Modes PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Flags PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Flags PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_Introducer PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN Client_OperByMe PARAMS(( CLIENT *Client )); GLOBAL BOOLEAN Client_OperByMe PARAMS((CLIENT *Client ));
GLOBAL INT Client_Hops PARAMS(( CLIENT *Client )); GLOBAL INT Client_Hops PARAMS((CLIENT *Client ));
GLOBAL INT Client_Token PARAMS(( CLIENT *Client )); GLOBAL INT Client_Token PARAMS((CLIENT *Client ));
GLOBAL INT Client_MyToken PARAMS(( CLIENT *Client )); GLOBAL INT Client_MyToken PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_TopServer PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_TopServer PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_NextHop PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_NextHop PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Away PARAMS(( CLIENT *Client )); GLOBAL CHAR *Client_Away PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN Client_HasMode PARAMS(( CLIENT *Client, CHAR Mode )); GLOBAL BOOLEAN Client_HasMode PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL VOID Client_SetHostname PARAMS(( CLIENT *Client, CHAR *Hostname )); GLOBAL VOID Client_SetHostname PARAMS((CLIENT *Client, CHAR *Hostname ));
GLOBAL VOID Client_SetID PARAMS(( CLIENT *Client, CHAR *Nick )); GLOBAL VOID Client_SetID PARAMS((CLIENT *Client, CHAR *Nick ));
GLOBAL VOID Client_SetUser PARAMS(( CLIENT *Client, CHAR *User, BOOLEAN Idented )); GLOBAL VOID Client_SetUser PARAMS((CLIENT *Client, CHAR *User, BOOLEAN Idented ));
GLOBAL VOID Client_SetInfo PARAMS(( CLIENT *Client, CHAR *Info )); GLOBAL VOID Client_SetInfo PARAMS((CLIENT *Client, CHAR *Info ));
GLOBAL VOID Client_SetPassword PARAMS(( CLIENT *Client, CHAR *Pwd )); GLOBAL VOID Client_SetPassword PARAMS((CLIENT *Client, CHAR *Pwd ));
GLOBAL VOID Client_SetType PARAMS(( CLIENT *Client, INT Type )); GLOBAL VOID Client_SetType PARAMS((CLIENT *Client, INT Type ));
GLOBAL VOID Client_SetHops PARAMS(( CLIENT *Client, INT Hops )); GLOBAL VOID Client_SetHops PARAMS((CLIENT *Client, INT Hops ));
GLOBAL VOID Client_SetToken PARAMS(( CLIENT *Client, INT Token )); GLOBAL VOID Client_SetToken PARAMS((CLIENT *Client, INT Token ));
GLOBAL VOID Client_SetOperByMe PARAMS(( CLIENT *Client, BOOLEAN OperByMe )); GLOBAL VOID Client_SetOperByMe PARAMS((CLIENT *Client, BOOLEAN OperByMe ));
GLOBAL VOID Client_SetModes PARAMS(( CLIENT *Client, CHAR *Modes )); GLOBAL VOID Client_SetModes PARAMS((CLIENT *Client, CHAR *Modes ));
GLOBAL VOID Client_SetFlags PARAMS(( CLIENT *Client, CHAR *Flags )); GLOBAL VOID Client_SetFlags PARAMS((CLIENT *Client, CHAR *Flags ));
GLOBAL VOID Client_SetIntroducer PARAMS(( CLIENT *Client, CLIENT *Introducer )); GLOBAL VOID Client_SetIntroducer PARAMS((CLIENT *Client, CLIENT *Introducer ));
GLOBAL VOID Client_SetAway PARAMS(( CLIENT *Client, CHAR *Txt )); GLOBAL VOID Client_SetAway PARAMS((CLIENT *Client, CHAR *Txt ));
GLOBAL BOOLEAN Client_ModeAdd PARAMS(( CLIENT *Client, CHAR Mode )); GLOBAL BOOLEAN Client_ModeAdd PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_ModeDel PARAMS(( CLIENT *Client, CHAR Mode )); GLOBAL BOOLEAN Client_ModeDel PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_CheckNick PARAMS(( CLIENT *Client, CHAR *Nick )); GLOBAL BOOLEAN Client_CheckNick PARAMS((CLIENT *Client, CHAR *Nick ));
GLOBAL BOOLEAN Client_CheckID PARAMS(( CLIENT *Client, CHAR *ID )); GLOBAL BOOLEAN Client_CheckID PARAMS((CLIENT *Client, CHAR *ID ));
GLOBAL LONG Client_UserCount PARAMS(( VOID )); GLOBAL LONG Client_UserCount PARAMS((VOID ));
GLOBAL LONG Client_ServiceCount PARAMS(( VOID )); GLOBAL LONG Client_ServiceCount PARAMS((VOID ));
GLOBAL LONG Client_ServerCount PARAMS(( VOID )); GLOBAL LONG Client_ServerCount PARAMS((VOID ));
GLOBAL LONG Client_OperCount PARAMS(( VOID )); GLOBAL LONG Client_OperCount PARAMS((VOID ));
GLOBAL LONG Client_UnknownCount PARAMS(( VOID )); GLOBAL LONG Client_UnknownCount PARAMS((VOID ));
GLOBAL LONG Client_MyUserCount PARAMS(( VOID )); GLOBAL LONG Client_MyUserCount PARAMS((VOID ));
GLOBAL LONG Client_MyServiceCount PARAMS(( VOID )); GLOBAL LONG Client_MyServiceCount PARAMS((VOID ));
GLOBAL LONG Client_MyServerCount PARAMS(( VOID )); GLOBAL LONG Client_MyServerCount PARAMS((VOID ));
GLOBAL LONG Client_MaxUserCount PARAMS(( VOID ));
GLOBAL LONG Client_MyMaxUserCount PARAMS(( VOID ));
GLOBAL BOOLEAN Client_IsValidNick PARAMS(( CHAR *Nick )); GLOBAL BOOLEAN Client_IsValidNick PARAMS((CHAR *Nick ));
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: conf.h,v 1.28.2.1 2004/05/07 11:24:18 alex Exp $ * $Id: conf.h,v 1.19 2002/09/16 09:13:40 alex Exp $
* *
* Configuration management (header) * conf.h: Konfiguration des ngircd (Header)
*/ */
@@ -24,114 +25,80 @@
typedef struct _Conf_Oper typedef struct _Conf_Oper
{ {
CHAR name[CLIENT_PASS_LEN]; /* Name (ID) of IRC operator */ CHAR name[CLIENT_PASS_LEN]; /* Name (ID) des IRC-OPs */
CHAR pwd[CLIENT_PASS_LEN]; /* Password */ CHAR pwd[CLIENT_PASS_LEN]; /* Passwort */
} CONF_OPER; } CONF_OPER;
typedef struct _Conf_Server typedef struct _Conf_Server
{ {
CHAR host[HOST_LEN]; /* Hostname */ CHAR host[HOST_LEN]; /* Hostname */
CHAR ip[16]; /* IP address (Resolver) */ CHAR ip[16]; /* IP-Adresse (von Resolver) */
CHAR name[CLIENT_ID_LEN]; /* IRC-Client-ID */ CHAR name[CLIENT_ID_LEN]; /* IRC-Client-ID */
CHAR pwd_in[CLIENT_PASS_LEN]; /* Password which must be received */ CHAR pwd[CLIENT_PASS_LEN]; /* Passwort */
CHAR pwd_out[CLIENT_PASS_LEN]; /* Password to send to peer */ INT port; /* Server-Port */
INT port; /* Server port */ INT group; /* Gruppe des Servers */
INT group; /* Group of server */ time_t lasttry; /* Letzter Connect-Versuch */
time_t lasttry; /* Last connect attempt */ RES_STAT *res_stat; /* Status des Resolver */
RES_STAT *res_stat; /* Status of the resolver */
INT flags; /* Flags */
CONN_ID conn_id; /* ID of server connection or NONE */
} CONF_SERVER; } CONF_SERVER;
typedef struct _Conf_Channel typedef struct _Conf_Channel
{ {
CHAR name[CHANNEL_NAME_LEN]; /* Name of the channel */ CHAR name[CHANNEL_NAME_LEN]; /* Name des Channel */
CHAR modes[CHANNEL_MODE_LEN]; /* Initial channel modes */ CHAR modes[CHANNEL_MODE_LEN]; /* Channel-Modes */
CHAR topic[CHANNEL_TOPIC_LEN]; /* Initial topic */ CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic des Channels */
} CONF_CHANNEL; } CONF_CHANNEL;
#define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */ /* Name ("Nick") des Servers */
#define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */
/* Name ("Nick") of the servers */
GLOBAL CHAR Conf_ServerName[CLIENT_ID_LEN]; GLOBAL CHAR Conf_ServerName[CLIENT_ID_LEN];
/* Server info text */ /* Server-Info-Text */
GLOBAL CHAR Conf_ServerInfo[CLIENT_INFO_LEN]; GLOBAL CHAR Conf_ServerInfo[CLIENT_INFO_LEN];
/* Global server passwort */ /* Server-Passwort */
GLOBAL CHAR Conf_ServerPwd[CLIENT_PASS_LEN]; GLOBAL CHAR Conf_ServerPwd[CLIENT_PASS_LEN];
/* Administrative information */ /* Admin-Info-Texte */
GLOBAL CHAR Conf_ServerAdmin1[CLIENT_INFO_LEN]; GLOBAL CHAR Conf_ServerAdmin1[CLIENT_INFO_LEN];
GLOBAL CHAR Conf_ServerAdmin2[CLIENT_INFO_LEN]; GLOBAL CHAR Conf_ServerAdmin2[CLIENT_INFO_LEN];
GLOBAL CHAR Conf_ServerAdminMail[CLIENT_INFO_LEN]; GLOBAL CHAR Conf_ServerAdminMail[CLIENT_INFO_LEN];
/* File with MOTD text */ /* Datei mit MOTD-Text */
GLOBAL CHAR Conf_MotdFile[FNAME_LEN]; GLOBAL CHAR Conf_MotdFile[FNAME_LEN];
/* Phrase with MOTD text */ /* Ports, auf denen der Server Verbindungen entgegen nimmt */
GLOBAL CHAR Conf_MotdPhrase[LINE_LEN];
/* Ports the server should listen on */
GLOBAL UINT Conf_ListenPorts[MAX_LISTEN_PORTS]; GLOBAL UINT Conf_ListenPorts[MAX_LISTEN_PORTS];
GLOBAL INT Conf_ListenPorts_Count; GLOBAL INT Conf_ListenPorts_Count;
/* Address to which the socket should be bound or empty (=all) */ /* User- und Group-ID, zu denen der Daemon wechseln soll */
GLOBAL CHAR Conf_ListenAddress[16];
/* User and group ID the server should run with */
GLOBAL UINT Conf_UID; GLOBAL UINT Conf_UID;
GLOBAL UINT Conf_GID; GLOBAL UINT Conf_GID;
/* A directory to chroot() in */ /* Timeouts fuer PING und PONG */
GLOBAL CHAR Conf_Chroot[FNAME_LEN];
/* Timeouts for PING and PONG */
GLOBAL INT Conf_PingTimeout; GLOBAL INT Conf_PingTimeout;
GLOBAL INT Conf_PongTimeout; GLOBAL INT Conf_PongTimeout;
/* Seconds between connect attempts to other servers */ /* Sekunden zwischen Verbindungsversuchen zu anderen Servern */
GLOBAL INT Conf_ConnectRetry; GLOBAL INT Conf_ConnectRetry;
/* Operators */ /* Operatoren */
GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS]; GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS];
GLOBAL INT Conf_Oper_Count; GLOBAL INT Conf_Oper_Count;
/* Servers */ /* Server */
GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS]; GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
GLOBAL INT Conf_Server_Count;
/* Pre-defined channels */ /* Vorkonfigurierte Channels */
GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS]; GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
GLOBAL INT Conf_Channel_Count; GLOBAL INT Conf_Channel_Count;
/* Are IRC operators allowed to always use MODE? */ /* Koennen IRC OPs immer Modes setzen? */
GLOBAL BOOLEAN Conf_OperCanMode; GLOBAL BOOLEAN Conf_OperCanMode;
/* Maximum number of connections to this server */
GLOBAL LONG Conf_MaxConnections;
/* Maximum number of channels a user can join */
GLOBAL INT Conf_MaxJoins;
/* Maximum number of connections per IP address */
GLOBAL INT Conf_MaxConnectionsIP;
GLOBAL VOID Conf_Init PARAMS((VOID )); GLOBAL VOID Conf_Init PARAMS((VOID ));
GLOBAL VOID Conf_Rehash PARAMS((VOID ));
GLOBAL INT Conf_Test PARAMS((VOID )); GLOBAL INT Conf_Test PARAMS((VOID ));
GLOBAL VOID Conf_UnsetServer PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conf_SetServer PARAMS(( INT ConfServer, CONN_ID Idx ));
GLOBAL INT Conf_GetServer PARAMS(( CONN_ID Idx ));
GLOBAL BOOLEAN Conf_EnableServer PARAMS(( CHAR *Name, INT Port ));
GLOBAL BOOLEAN Conf_DisableServer PARAMS(( CHAR *Name ));
GLOBAL BOOLEAN Conf_AddServer PARAMS(( CHAR *Name, INT Port, CHAR *Host, CHAR *MyPwd, CHAR *PeerPwd ));
#endif #endif

View File

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

View File

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

View File

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

View File

@@ -1,38 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conn-zip.h,v 1.2 2003/12/26 15:55:07 alex Exp $
*
* Connection compression using ZLIB (header)
*/
#ifdef ZLIB
#ifndef __conn_zip_h__
#define __conn_zip_h__
GLOBAL BOOLEAN Zip_InitConn PARAMS(( CONN_ID Idx ));
GLOBAL BOOLEAN Zip_Buffer PARAMS(( CONN_ID Idx, CHAR *Data, INT Len ));
GLOBAL BOOLEAN Zip_Flush PARAMS(( CONN_ID Idx ));
GLOBAL BOOLEAN Unzip_Buffer PARAMS(( CONN_ID Idx ));
GLOBAL LONG Zip_SendBytes PARAMS(( CONN_ID Idx ));
GLOBAL LONG Zip_RecvBytes PARAMS(( CONN_ID Idx ));
#endif /* __conn_zip_h__ */
#endif /* ZLIB */
/* -eof- */

File diff suppressed because it is too large Load Diff

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: conn.h,v 1.32 2003/12/26 15:55:07 alex Exp $ * $Id: conn.h,v 1.17 2002/08/26 00:03:15 alex Exp $
* *
* Connection management (header) * conn.h: Verwaltung aller Netz-Verbindungen ("connections") (Header)
*/ */
@@ -18,75 +19,15 @@
#define __conn_h__ #define __conn_h__
#include <time.h> /* fro time_t, see below */ #include <time.h>
#define CONN_ISCLOSING 1 /* Conn_Close() already called */
#ifdef ZLIB
#define CONN_ZIP 2 /* zlib compressed link */
#endif
typedef INT CONN_ID; typedef INT CONN_ID;
#ifdef CONN_MODULE
#include "defines.h"
#include "resolve.h"
#ifdef ZLIB
#include <zlib.h>
typedef struct _ZipData
{
z_stream in; /* "Handle" for input stream */
z_stream out; /* "Handle" for output stream */
CHAR rbuf[READBUFFER_LEN]; /* Read buffer */
INT rdatalen; /* Length of data in read buffer (compressed) */
CHAR wbuf[WRITEBUFFER_LEN]; /* Write buffer */
INT wdatalen; /* Length of data in write buffer (uncompressed) */
LONG bytes_in, bytes_out; /* Counter for statistics (uncompressed!) */
} ZIPDATA;
#endif /* 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 ZLIB
ZIPDATA zip; /* Compression information */
#endif /* ZLIB */
} CONNECTION;
GLOBAL CONNECTION *My_Connections;
GLOBAL CONN_ID Pool_Size;
GLOBAL LONG WCounter;
#endif /* CONN_MODULE */
GLOBAL VOID Conn_Init PARAMS((VOID )); GLOBAL VOID Conn_Init PARAMS((VOID ));
GLOBAL VOID Conn_Exit PARAMS(( VOID )); GLOBAL VOID Conn_Exit PARAMS(( VOID ));
GLOBAL INT Conn_InitListeners PARAMS(( VOID ));
GLOBAL VOID Conn_ExitListeners PARAMS(( VOID ));
GLOBAL BOOLEAN Conn_NewListener PARAMS(( CONST UINT Port )); GLOBAL BOOLEAN Conn_NewListener PARAMS(( CONST UINT Port ));
GLOBAL VOID Conn_Handler PARAMS(( VOID )); GLOBAL VOID Conn_Handler PARAMS(( VOID ));
@@ -96,7 +37,12 @@ GLOBAL BOOLEAN Conn_WriteStr PARAMS(( CONN_ID Idx, CHAR *Format, ... ));
GLOBAL VOID Conn_Close PARAMS(( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )); GLOBAL VOID Conn_Close PARAMS(( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient ));
GLOBAL VOID Conn_SyncServerStruct PARAMS(( VOID )); GLOBAL VOID Conn_UpdateIdle PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_SetPenalty PARAMS(( CONN_ID Idx, time_t Seconds ));
GLOBAL INT Conn_MaxFD; GLOBAL INT Conn_MaxFD;

View File

@@ -1,16 +1,17 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: defines.h,v 1.45.2.1 2004/05/07 11:24:18 alex Exp $ * $Id: defines.h,v 1.33 2002/09/07 17:58:00 alex Exp $
* *
* Global defines of ngIRCd. * defines.h: (globale) Konstanten
*/ */
#ifndef __defines_h__ #ifndef __defines_h__
@@ -33,9 +34,7 @@
#define MAX_DEFCHANNELS 16 /* max. Anzahl vorkonfigurierbarerr Channels */ #define MAX_DEFCHANNELS 16 /* max. Anzahl vorkonfigurierbarerr Channels */
#define MAX_SERVICES 8 /* maximum number of configurable services */ #define MAX_CONNECTIONS 100 /* max. Anzahl von Verbindungen an diesem Server */
#define CONNECTION_POOL 100 /* Anzahl Verbindungs-Strukturen, die blockweise alloziert werden */
#define CLIENT_ID_LEN 64 /* max. ID-Laenge; vgl. RFC 2812, 1.1 und 1.2.1 */ #define CLIENT_ID_LEN 64 /* max. ID-Laenge; vgl. RFC 2812, 1.1 und 1.2.1 */
#define CLIENT_NICK_LEN 10 /* max. Nick-Laenge; vgl. RFC 2812, 1.2.1 */ #define CLIENT_NICK_LEN 10 /* max. Nick-Laenge; vgl. RFC 2812, 1.2.1 */
@@ -54,50 +53,41 @@
#define COMMAND_LEN 513 /* max. Laenge eines Befehls, vgl. RFC 2812, 3.2 */ #define COMMAND_LEN 513 /* max. Laenge eines Befehls, vgl. RFC 2812, 3.2 */
#define READBUFFER_LEN 2048 /* Laenge des Lesepuffers je Verbindung (Bytes) */ #define READBUFFER_LEN 2 * COMMAND_LEN /* Laenge des Lesepuffers je Verbindung (Bytes) */
#define WRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers je Verbindung (Bytes) */ #define WRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers je Verbindung (Bytes) */
#ifdef ZLIB
#define ZREADBUFFER_LEN 1024 /* Laenge des Lesepuffers je Verbindung (Bytes) */
#define ZWRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers fuer Kompression (Bytes) */
#endif
#define PROTOVER "0210" /* implementierte Protokoll-Version (RFC 2813, 4.1.1) */ #define PROTOVER "0210" /* implementierte Protokoll-Version (RFC 2813, 4.1.1) */
#define PROTOIRC "-IRC" /* Protokoll-Suffix (RFC 2813, 4.1.1) */ #define PROTOIRC "-IRC" /* Protokoll-Suffix (RFC 2813, 4.1.1) */
#define PROTOIRCPLUS "-IRC+" /* Protokoll-Suffix f<>r IRC+-Protokoll */ #define PROTOIRCPLUS "-IRC+" /* Protokoll-Suffix f<>r IRC+-Protokoll */
#ifdef IRCPLUS #ifdef IRCPLUS
# define IRCPLUSFLAGS "CL" /* IRC+-Flags, die immer zutreffen */ # define IRCPLUSFLAGS "C" /* IRC+-Flags, die immer zutreffen */
#endif #endif
#define STARTUP_DELAY 1 /* Erst n Sek. nach Start zu anderen Servern verbinden */ #define STARTUP_DELAY 1 /* Erst n Sek. nach Start zu anderen Servern verbinden */
#define RECONNECT_DELAY 3 /* Server-Links erst nach 3 Sekunden versuchen, wieder aufzubauen */ #define RECONNECT_DELAY 3 /* Server-Links erst nach 3 Sekunden versuchen, wieder aufzubauen */
#define USERMODES "aios" /* unterstuetzte User-Modes */ #define USERMODES "aios" /* unterstuetzte User-Modes */
#define CHANMODES "biklImnoPtv" /* unterstuetzte Channel-Modes */ #define CHANMODES "biImnoPtv" /* unterstuetzte Channel-Modes */
#define CONNECTED TRUE /* fuer die irc-xxx-Module */ #define CONNECTED TRUE /* fuer die irc-xxx-Module */
#define DISCONNECTED FALSE #define DISCONNECTED FALSE
#define DEFAULT_AWAY_MSG "Away" /* Away-Meldung fuer User von anderen Servern */ #define DEFAULT_AWAY_MSG "Away" /* Away-Meldung fuer User von anderen Servern */
#define CONFIG_FILE "/ngircd.conf" #ifdef PROTOTYPES
#define MOTD_FILE "/ngircd.motd" # define CONFIG_FILE SYSCONFDIR"/ngircd.conf"
#define MOTD_PHRASE "" # define MOTD_FILE SYSCONFDIR"/ngircd.motd"
#define CHROOT_DIR "" #else
# define CONFIG_FILE "ngircd.conf"
# define MOTD_FILE "ngircd.motd"
#endif
#define ERROR_DIR "/tmp" #define ERROR_DIR "/tmp"
#define MAX_LOG_MSG_LEN 256 /* max. Laenge einer Log-Meldung */ #define MAX_LOG_MSG_LEN 256 /* max. Laenge einer Log-Meldung */
#define TOKEN_OUTBOUND -2 /* Kennzeichnung fuer ausgehende Server-Links im Aufbau */ #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 #endif

View File

@@ -2,20 +2,21 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Hash calculation * $Id: hash.c,v 1.5 2002/05/27 12:54:07 alex Exp $
*
* hash.c: Hash-Werte berechnen
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: hash.c,v 1.9 2002/12/26 16:25:43 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
@@ -38,7 +39,9 @@ Hash( CHAR *String )
CHAR buffer[LINE_LEN]; CHAR buffer[LINE_LEN];
strlcpy( buffer, String, sizeof( buffer )); strncpy( buffer, String, LINE_LEN - 1 );
buffer[LINE_LEN - 1] = '\0';
return jenkins_hash( (UINT8 *)ngt_LowerStr( buffer ), strlen( buffer ), 42 ); return jenkins_hash( (UINT8 *)ngt_LowerStr( buffer ), strlen( buffer ), 42 );
} /* Hash */ } /* Hash */
@@ -100,7 +103,7 @@ jenkins_hash( register UINT8 *k, register UINT32 length, register UINT32 initval
/* handle the last 11 bytes */ /* handle the last 11 bytes */
c += length; c += length;
switch( (INT)len ) /* all the case statements fall through */ switch(len) /* all the case statements fall through */
{ {
case 11: c+=((UINT32)k[10]<<24); case 11: c+=((UINT32)k[10]<<24);
case 10: c+=((UINT32)k[9]<<16); case 10: c+=((UINT32)k[9]<<16);

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: hash.h,v 1.4 2002/12/12 12:23:43 alex Exp $ * $Id: hash.h,v 1.3 2002/05/27 12:54:07 alex Exp $
* *
* Hash calculation (header) * hash.h: Hash-Werte berechnen (Header)
*/ */

View File

@@ -2,24 +2,23 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* IRC channel commands * $Id: irc-channel.c,v 1.15 2002/09/16 09:16:17 alex Exp $
*
* irc-channel.c: IRC-Channel-Befehle
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-channel.c,v 1.27 2004/04/09 20:46:48 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include "defines.h" #include "defines.h"
@@ -31,10 +30,8 @@ static char UNUSED id[] = "$Id: irc-channel.c,v 1.27 2004/04/09 20:46:48 alex Ex
#include "match.h" #include "match.h"
#include "messages.h" #include "messages.h"
#include "parse.h" #include "parse.h"
#include "irc-info.h" #include "irc.h"
#include "irc-write.h" #include "irc-write.h"
#include "resolve.h"
#include "conf.h"
#include "exp.h" #include "exp.h"
#include "irc-channel.h" #include "irc-channel.h"
@@ -43,7 +40,7 @@ static char UNUSED id[] = "$Id: irc-channel.c,v 1.27 2004/04/09 20:46:48 alex Ex
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_JOIN( CLIENT *Client, REQUEST *Req ) IRC_JOIN( CLIENT *Client, REQUEST *Req )
{ {
CHAR *channame, *key, *flags, *topic, modes[8]; CHAR *channame, *flags, *topic, modes[8];
BOOLEAN is_new_chan, is_invited, is_banned; BOOLEAN is_new_chan, is_invited, is_banned;
CLIENT *target; CLIENT *target;
CHANNEL *chan; CHANNEL *chan;
@@ -51,24 +48,22 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Bad number of arguments? */ if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Who is the sender? */ /* Falsche Anzahl Parameter? */
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Wer ist der Absender? */
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix ); if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
else target = Client; else target = Client;
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix ); if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Are channel keys given? */
if( Req->argc > 1 ) key = Req->argv[1];
else key = NULL;
/* Channel-Namen durchgehen */ /* Channel-Namen durchgehen */
chan = NULL; chan = NULL;
channame = strtok( Req->argv[0], "," ); channame = strtok( Req->argv[0], "," );
while( channame ) while( channame )
{ {
chan = NULL; flags = NULL; chan = flags = NULL;
/* wird der Channel neu angelegt? */ /* wird der Channel neu angelegt? */
if( Channel_Search( channame )) is_new_chan = FALSE; if( Channel_Search( channame )) is_new_chan = FALSE;
@@ -86,19 +81,9 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
} }
} }
/* Local client? */ /* Lokaler Client? */
if( Client_Type( Client ) == CLIENT_USER ) if( Client_Type( Client ) == CLIENT_USER )
{ {
/* Test if the user has reached his maximum channel count */
if( Client_Type( Client ) == CLIENT_USER )
{
if(( Conf_MaxJoins > 0 ) && ( Channel_CountForUser( Client ) >= Conf_MaxJoins ))
{
IRC_WriteStrClient( Client, ERR_TOOMANYCHANNELS_MSG, Client_ID( Client ), channame );
return CONNECTED;
}
}
/* Existiert der Channel bereits, oder wird er im Moment neu erzeugt? */ /* Existiert der Channel bereits, oder wird er im Moment neu erzeugt? */
if( is_new_chan ) if( is_new_chan )
{ {
@@ -120,55 +105,23 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
/* Client ist gebanned (und nicht invited): */ /* Client ist gebanned (und nicht invited): */
IRC_WriteStrClient( Client, ERR_BANNEDFROMCHAN_MSG, Client_ID( Client ), channame ); IRC_WriteStrClient( Client, ERR_BANNEDFROMCHAN_MSG, Client_ID( Client ), channame );
/* Try next name, if any */ /* naechsten Namen ermitteln */
channame = strtok( NULL, "," ); channame = strtok( NULL, "," );
continue; continue;
} }
/* Ist der Channel "invite-only"? */ /* Ist der Channel "invite-only"? */
if(( strchr( Channel_Modes( chan ), 'i' )) && ( is_invited == FALSE )) if(( strchr( Channel_Modes( chan ), 'i' ) != NULL ) && ( is_invited == FALSE ))
{ {
/* Channel ist "invite-only" und Client wurde nicht invited: */ /* Channel ist "invite-only" und Client wurde nicht invited: */
IRC_WriteStrClient( Client, ERR_INVITEONLYCHAN_MSG, Client_ID( Client ), channame ); IRC_WriteStrClient( Client, ERR_INVITEONLYCHAN_MSG, Client_ID( Client ), channame );
/* Try next name, if any */ /* naechsten Namen ermitteln */
channame = strtok( NULL, "," );
continue;
}
/* Is the channel protected by a key? */
if(( strchr( Channel_Modes( chan ), 'k' )) && ( strcmp( Channel_Key( chan ), key ? key : "" ) != 0 ))
{
/* Bad channel key! */
IRC_WriteStrClient( Client, ERR_BADCHANNELKEY_MSG, Client_ID( Client ), channame );
/* Try next name, if any */
channame = strtok( NULL, "," );
continue;
}
/* Are there already too many members? */
if(( strchr( Channel_Modes( chan ), 'l' )) && ( Channel_MaxUsers( chan ) <= Channel_MemberCount( chan )))
{
/* Bad channel key! */
IRC_WriteStrClient( Client, ERR_CHANNELISFULL_MSG, Client_ID( Client ), channame );
/* Try next name, if any */
channame = strtok( NULL, "," ); channame = strtok( NULL, "," );
continue; continue;
} }
} }
} }
else
{
/* Remote server: we don't need to know whether the
* client is invited or not, but we have to make sure
* that the "one shot" entries (generated by INVITE
* commands) in this list become deleted when a user
* joins a channel this way. */
chan = Channel_Search( channame );
if( chan != NULL ) (VOID)Lists_CheckInvited( target, chan );
}
/* Channel joinen (und ggf. anlegen) */ /* Channel joinen (und ggf. anlegen) */
if( ! Channel_Join( target, channame )) if( ! Channel_Join( target, channame ))
@@ -191,7 +144,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
if(( strchr( Channel_Modes( chan ), 'P' )) && ( strchr( Client_Modes( target ), 'o' ))) Channel_UserModeAdd( chan, target, 'o' ); if(( strchr( Channel_Modes( chan ), 'P' )) && ( strchr( Client_Modes( target ), 'o' ))) Channel_UserModeAdd( chan, target, 'o' );
/* Muessen Modes an andere Server gemeldet werden? */ /* Muessen Modes an andere Server gemeldet werden? */
strlcpy( &modes[1], Channel_UserModes( chan, target ), sizeof( modes ) - 1 ); strcpy( &modes[1], Channel_UserModes( chan, target ));
if( modes[1] ) modes[0] = 0x7; if( modes[1] ) modes[0] = 0x7;
else modes[0] = '\0'; else modes[0] = '\0';
@@ -236,6 +189,8 @@ IRC_PART( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */ /* Falsche Anzahl Parameter? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -272,6 +227,8 @@ IRC_TOPIC( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */ /* Falsche Anzahl Parameter? */
if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -323,6 +280,8 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */ /* Falsche Anzahl Parameter? */
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -338,7 +297,7 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
{ {
/* an anderen Server forwarden */ /* an anderen Server forwarden */
target = Client_Search( Req->argv[1] ); target = Client_Search( Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] ); if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if( target != Client_ThisServer( )) if( target != Client_ThisServer( ))
{ {
@@ -374,27 +333,23 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_CHANINFO( CLIENT *Client, REQUEST *Req ) IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
{ {
CHAR modes_add[COMMAND_LEN], l[16], *ptr;
CLIENT *from; CLIENT *from;
CHANNEL *chan; CHANNEL *chan;
INT arg_topic; CHAR *ptr;
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Bad number of parameters? */ if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
if(( Req->argc < 2 ) || ( Req->argc == 4 ) || ( Req->argc > 5 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Compatibility kludge */ /* Falsche Anzahl Parameter? */
if( Req->argc == 5 ) arg_topic = 4; if(( Req->argc < 1 ) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
else if( Req->argc == 3 ) arg_topic = 2;
else arg_topic = -1;
/* Search origin */ /* From-Server suchen */
from = Client_Search( Req->prefix ); from = Client_Search( Req->prefix );
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix ); if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Search or create channel */ /* Channel suchen bzw. erzeugen */
chan = Channel_Search( Req->argv[0] ); chan = Channel_Search( Req->argv[0] );
if( ! chan ) chan = Channel_Create( Req->argv[0] ); if( ! chan ) chan = Channel_Create( Req->argv[0] );
if( ! chan ) return CONNECTED; if( ! chan ) return CONNECTED;
@@ -404,61 +359,27 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
ptr = Channel_Modes( chan ); ptr = Channel_Modes( chan );
if( ! *ptr ) if( ! *ptr )
{ {
/* OK, this channel doesn't have modes jet, set the received ones: */ /* OK, es sind noch keine Modes gesetzt */
Channel_SetModes( chan, &Req->argv[1][1] ); Channel_SetModes( chan, &Req->argv[1][1] );
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s", Req->argv[0], &Req->argv[1][1] );
if( Req->argc == 5 )
{
if( strchr( Channel_Modes( chan ), 'k' )) Channel_SetKey( chan, Req->argv[2] );
if( strchr( Channel_Modes( chan ), 'l' )) Channel_SetMaxUsers( chan, atol( Req->argv[3] ));
}
else
{
/* Delete modes which we never want to inherit */
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%s", Req->argv[0], Channel_Modes( chan ), modes_add );
} }
} }
else Log( LOG_WARNING, "CHANINFO: invalid MODE format ignored!" ); else Log( LOG_WARNING, "CHANNELINFO: invalid MODE format ignored!" );
if( arg_topic > 0 ) if( Req->argc == 3 )
{ {
/* We got a topic */ /* Es wurde auch ein Topic mit uebermittelt */
ptr = Channel_Topic( chan ); ptr = Channel_Topic( chan );
if(( ! *ptr ) && ( Req->argv[arg_topic][0] )) if( ! *ptr )
{ {
/* OK, there is no topic jet */ /* OK, es ist bisher kein Topic gesetzt */
Channel_SetTopic( chan, Req->argv[arg_topic] ); Channel_SetTopic( chan, Req->argv[2] );
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Channel_Topic( chan )); IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Req->argv[2] );
} }
} }
/* Forward CHANINFO to other serevrs */ /* an andere Server forwarden */
if( Req->argc == 5 ) IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2], Req->argv[3], Req->argv[4] ); IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2] );
else if( Req->argc == 3 ) IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2] );
else IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s", Req->argv[0], Req->argv[1] );
return CONNECTED; return CONNECTED;
} /* IRC_CHANINFO */ } /* IRC_CHANINFO */

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: irc-channel.h,v 1.6 2002/12/12 12:23:43 alex Exp $ * $Id: irc-channel.h,v 1.5 2002/09/03 23:56:55 alex Exp $
* *
* IRC channel commands (header) * irc-channel.h: IRC-Channel-Befehle (Header)
*/ */

View File

@@ -1,912 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* IRC info commands
*/
#include "portab.h"
static char UNUSED id[] = "$Id: irc-info.c,v 1.21.2.2 2005/01/24 14:22:30 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include "ngircd.h"
#include "cvs-version.h"
#include "conn-func.h"
#include "conn-zip.h"
#include "client.h"
#include "channel.h"
#include "resolve.h"
#include "conf.h"
#include "defines.h"
#include "log.h"
#include "messages.h"
#include "tool.h"
#include "parse.h"
#include "irc-write.h"
#include "exp.h"
#include "irc-info.h"
GLOBAL BOOLEAN
IRC_ADMIN(CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *prefix;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Ziel suchen */
if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
else target = Client_ThisServer( );
/* Prefix ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
else prefix = Client;
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* An anderen Server weiterleiten? */
if( target != Client_ThisServer( ))
{
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
/* forwarden */
IRC_WriteStrClientPrefix( target, prefix, "ADMIN %s", Req->argv[0] );
return CONNECTED;
}
/* mit Versionsinfo antworten */
if( ! IRC_WriteStrClient( Client, RPL_ADMINME_MSG, Client_ID( prefix ), Conf_ServerName )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC1_MSG, Client_ID( prefix ), Conf_ServerAdmin1 )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC2_MSG, Client_ID( prefix ), Conf_ServerAdmin2 )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, RPL_ADMINEMAIL_MSG, Client_ID( prefix ), Conf_ServerAdminMail )) return DISCONNECTED;
IRC_SetPenalty( Client, 1 );
return CONNECTED;
} /* IRC_ADMIN */
GLOBAL BOOLEAN
IRC_ISON( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN];
CLIENT *c;
CHAR *ptr;
INT i;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
strcpy( rpl, RPL_ISON_MSG );
for( i = 0; i < Req->argc; i++ )
{
ptr = strtok( Req->argv[i], " " );
while( ptr )
{
ngt_TrimStr( ptr );
c = Client_Search( ptr );
if( c && ( Client_Type( c ) == CLIENT_USER ))
{
/* Dieser Nick ist "online" */
strlcat( rpl, ptr, sizeof( rpl ));
strlcat( rpl, " ", sizeof( rpl ));
}
ptr = strtok( NULL, " " );
}
}
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
} /* IRC_ISON */
GLOBAL BOOLEAN
IRC_LINKS( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *from, *c;
CHAR *mask;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Server-Mask ermitteln */
if( Req->argc > 0 ) mask = Req->argv[Req->argc - 1];
else mask = "*";
/* Absender ermitteln */
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 );
/* An anderen Server forwarden? */
if( Req->argc == 2 )
{
target = Client_Search( Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LINKS %s %s", Req->argv[0], Req->argv[1] );
}
/* Wer ist der Absender? */
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
else target = Client;
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
c = Client_First( );
while( c )
{
if( Client_Type( c ) == CLIENT_SERVER )
{
if( ! IRC_WriteStrClient( target, RPL_LINKS_MSG, Client_ID( target ), Client_ID( c ), Client_ID( Client_TopServer( c ) ? Client_TopServer( c ) : Client_ThisServer( )), Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
}
c = Client_Next( c );
}
IRC_SetPenalty( target, 1 );
return IRC_WriteStrClient( target, RPL_ENDOFLINKS_MSG, Client_ID( target ), mask );
} /* IRC_LINKS */
GLOBAL BOOLEAN
IRC_LUSERS( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *from;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Absender ermitteln */
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 );
/* An anderen Server forwarden? */
if( Req->argc == 2 )
{
target = Client_Search( Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LUSERS %s %s", Req->argv[0], Req->argv[1] );
}
/* Wer ist der Absender? */
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
else target = Client;
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
IRC_Send_LUSERS( target );
IRC_SetPenalty( target, 1 );
return CONNECTED;
} /* IRC_LUSERS */
GLOBAL BOOLEAN
IRC_MOTD( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* From aus Prefix ermitteln */
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 );
if( Req->argc == 1 )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
if( target != Client_ThisServer( ))
{
/* Ok, anderer Server ist das Ziel: forwarden */
return IRC_WriteStrClientPrefix( target, from, "MOTD %s", Req->argv[0] );
}
}
IRC_SetPenalty( from, 3 );
return IRC_Show_MOTD( from );
} /* IRC_MOTD */
GLOBAL BOOLEAN
IRC_NAMES( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN], *ptr;
CLIENT *target, *from, *c;
CHANNEL *chan;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* From aus Prefix ermitteln */
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 );
if( Req->argc == 2 )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
/* Ok, anderer Server ist das Ziel: forwarden */
return IRC_WriteStrClientPrefix( target, from, "NAMES %s :%s", Req->argv[0], Req->argv[1] );
}
}
if( Req->argc > 0 )
{
/* bestimmte Channels durchgehen */
ptr = strtok( Req->argv[0], "," );
while( ptr )
{
chan = Channel_Search( ptr );
if( chan )
{
/* Namen ausgeben */
if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
}
if( ! IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), ptr )) return DISCONNECTED;
/* naechsten Namen ermitteln */
ptr = strtok( NULL, "," );
}
return CONNECTED;
}
/* alle Channels durchgehen */
chan = Channel_First( );
while( chan )
{
/* Namen ausgeben */
if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
/* naechster Channel */
chan = Channel_Next( chan );
}
/* Nun noch alle Clients ausgeben, die in keinem Channel sind */
c = Client_First( );
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] != ':' ) 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;
snprintf( rpl, sizeof( rpl ), RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
}
}
/* naechster Client */
c = Client_Next( c );
}
if( rpl[strlen( rpl ) - 1] != ':')
{
/* es wurden User gefunden */
if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED;
}
IRC_SetPenalty( from, 1 );
return IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), "*" );
} /* IRC_NAMES */
GLOBAL BOOLEAN
IRC_STATS( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target, *cl;
CONN_ID con;
CHAR query;
COMMAND *cmd;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* From aus Prefix ermitteln */
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 );
if( Req->argc == 2 )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
/* Ok, anderer Server ist das Ziel: forwarden */
return IRC_WriteStrClientPrefix( target, from, "STATS %s %s", Req->argv[0], Req->argv[1] );
}
}
if( Req->argc > 0 ) query = Req->argv[0][0] ? Req->argv[0][0] : '*';
else query = '*';
switch ( query )
{
case 'l': /* Links */
case 'L':
con = Conn_First( );
while( con != NONE )
{
cl = Client_GetFromConn( con );
if( cl && (( Client_Type( cl ) == CLIENT_SERVER ) || ( cl == Client )))
{
/* Server link or our own connection */
#ifdef 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 ), 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
{
if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFO_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Conn_RecvBytes( con ), (LONG)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED;
}
}
con = Conn_Next( con );
}
break;
case 'm': /* IRC-Befehle */
case 'M':
cmd = Parse_GetCommandStruct( );
while( cmd->name )
{
if( cmd->lcount > 0 || cmd->rcount > 0 )
{
if( ! IRC_WriteStrClient( from, RPL_STATSCOMMANDS_MSG, Client_ID( from ), cmd->name, cmd->lcount, cmd->bytes, cmd->rcount )) return DISCONNECTED;
}
cmd++;
}
break;
}
IRC_SetPenalty( from, 2 );
return IRC_WriteStrClient( from, RPL_ENDOFSTATS_MSG, Client_ID( from ), query );
} /* IRC_STATS */
GLOBAL BOOLEAN
IRC_TIME( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target;
CHAR t_str[64];
time_t t;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* From aus Prefix ermitteln */
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 );
if( Req->argc == 1 )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
if( target != Client_ThisServer( ))
{
/* Ok, anderer Server ist das Ziel: forwarden */
return IRC_WriteStrClientPrefix( target, from, "TIME %s", Req->argv[0] );
}
}
t = time( NULL );
(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 */
GLOBAL BOOLEAN
IRC_USERHOST( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN];
CLIENT *c;
INT max, i;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if( Req->argc > 5 ) max = 5;
else max = Req->argc;
strcpy( rpl, RPL_USERHOST_MSG );
for( i = 0; i < max; i++ )
{
c = Client_Search( Req->argv[i] );
if( c && ( Client_Type( c ) == CLIENT_USER ))
{
/* Dieser Nick ist "online" */
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';
return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
} /* IRC_USERHOST */
GLOBAL BOOLEAN
IRC_VERSION( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *prefix;
#ifdef CVSDATE
CHAR ver[12], vertxt[30];
#endif
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Ziel suchen */
if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
else target = Client_ThisServer( );
/* Prefix ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
else prefix = Client;
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* An anderen Server weiterleiten? */
if( target != Client_ThisServer( ))
{
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
/* forwarden */
IRC_WriteStrClientPrefix( target, prefix, "VERSION %s", Req->argv[0] );
return CONNECTED;
}
/* mit Versionsinfo antworten */
IRC_SetPenalty( Client, 1 );
#ifdef CVSDATE
strlcpy( ver, CVSDATE, sizeof( ver ));
strncpy( ver + 4, ver + 5, 2 );
strncpy( ver + 6, ver + 8, 3 );
snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver );
return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, vertxt, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
#else
return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
#endif
} /* IRC_VERSION */
GLOBAL BOOLEAN
IRC_WHO( CLIENT *Client, REQUEST *Req )
{
BOOLEAN ok, only_ops;
CHAR flags[8], *ptr;
CL2CHAN *cl2chan;
CHANNEL *chan;
CLIENT *c;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
only_ops = FALSE;
chan = NULL;
if( Req->argc == 2 )
{
/* Nur OPs anzeigen? */
if( strcmp( Req->argv[1], "o" ) == 0 ) only_ops = TRUE;
#ifdef STRICT_RFC
else return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
#endif
}
if( Req->argc >= 1 )
{
/* wurde ein Channel oder Nick-Mask angegeben? */
chan = Channel_Search( Req->argv[0] );
}
if( chan )
{
/* User eines Channels ausgeben */
if( ! IRC_Send_WHO( Client, chan, only_ops )) return DISCONNECTED;
}
c = Client_First( );
while( c )
{
if(( Client_Type( c ) == CLIENT_USER ) && ( ! strchr( Client_Modes( c ), 'i' )))
{
ok = FALSE;
if( Req->argc == 0 ) ok = TRUE;
else
{
if( strcasecmp( Req->argv[0], Client_ID( c )) == 0 ) ok = TRUE;
else if( strcmp( Req->argv[0], "0" ) == 0 ) ok = TRUE;
}
if( ok && (( ! only_ops ) || ( strchr( Client_Modes( c ), 'o' ))))
{
/* Flags zusammenbasteln */
strcpy( flags, "H" );
if( strchr( Client_Modes( c ), 'o' )) strlcat( flags, "*", sizeof( flags ));
/* ausgeben */
cl2chan = Channel_FirstChannelOf( c );
if( cl2chan ) ptr = Channel_Name( Channel_GetChannel( cl2chan ));
else ptr = "*";
if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), ptr, Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
}
}
/* naechster Client */
c = Client_Next( c );
}
if( chan ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Channel_Name( chan ));
else if( Req->argc == 0 ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), "*" );
else return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Req->argv[0] );
} /* IRC_WHO */
GLOBAL BOOLEAN
IRC_WHOIS( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target, *c;
CHAR str[LINE_LEN + 1];
CL2CHAN *cl2chan;
CHANNEL *chan;
assert( Client != NULL );
assert( Req != NULL );
/* Bad number of parameters? */
if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Search client */
c = Client_Search( Req->argv[Req->argc - 1] );
if(( ! c ) || ( Client_Type( c ) != CLIENT_USER )) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[Req->argc - 1] );
/* Search sender of the WHOIS */
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 );
/* Forward to other server? */
if( Req->argc > 1 )
{
/* Search target server (can be specified as nick of that server!) */
target = Client_Search( Req->argv[0] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
}
else target = Client_ThisServer( );
assert( target != NULL );
if(( Client_NextHop( target ) != Client_ThisServer( )) && ( Client_Type( Client_NextHop( target )) == CLIENT_SERVER )) return IRC_WriteStrClientPrefix( target, from, "WHOIS %s :%s", Req->argv[0], Req->argv[1] );
/* Nick, user and name */
if( ! IRC_WriteStrClient( from, RPL_WHOISUSER_MSG, Client_ID( from ), Client_ID( c ), Client_User( c ), Client_Hostname( c ), Client_Info( c ))) return DISCONNECTED;
/* Server */
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 */
snprintf( str, sizeof( str ), RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
cl2chan = Channel_FirstChannelOf( c );
while( cl2chan )
{
chan = Channel_GetChannel( cl2chan );
assert( chan != NULL );
/* Concatenate channel names */
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;
snprintf( str, sizeof( str ), RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
}
/* next */
cl2chan = Channel_NextChannelOf( c, cl2chan );
}
if( str[strlen( str ) - 1] != ':')
{
/* There is data left to send: */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
}
/* IRC-Operator? */
if( Client_HasMode( c, 'o' ))
{
if( ! IRC_WriteStrClient( from, RPL_WHOISOPERATOR_MSG, Client_ID( from ), Client_ID( c ))) return DISCONNECTED;
}
/* Idle (only local clients) */
if( Client_Conn( c ) > NONE )
{
if( ! IRC_WriteStrClient( from, RPL_WHOISIDLE_MSG, Client_ID( from ), Client_ID( c ), Conn_GetIdle( Client_Conn ( c )))) return DISCONNECTED;
}
/* Away? */
if( Client_HasMode( c, 'a' ))
{
if( ! IRC_WriteStrClient( from, RPL_AWAY_MSG, Client_ID( from ), Client_ID( c ), Client_Away( c ))) return DISCONNECTED;
}
/* End of Whois */
return IRC_WriteStrClient( from, RPL_ENDOFWHOIS_MSG, Client_ID( from ), Client_ID( c ));
} /* IRC_WHOIS */
GLOBAL BOOLEAN
IRC_WHOWAS( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 ) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* ... */
return CONNECTED;
} /* IRC_WHOWAS */
GLOBAL BOOLEAN
IRC_Send_LUSERS( CLIENT *Client )
{
LONG cnt;
assert( Client != NULL );
/* Users, services and serevers in the network */
if( ! IRC_WriteStrClient( Client, RPL_LUSERCLIENT_MSG, Client_ID( Client ), Client_UserCount( ), Client_ServiceCount( ), Client_ServerCount( ))) return DISCONNECTED;
/* Number of IRC operators */
cnt = Client_OperCount( );
if( cnt > 0 )
{
if( ! IRC_WriteStrClient( Client, RPL_LUSEROP_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
}
/* Unknown connections */
cnt = Client_UnknownCount( );
if( cnt > 0 )
{
if( ! IRC_WriteStrClient( Client, RPL_LUSERUNKNOWN_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
}
/* Number of created channels */
if( ! IRC_WriteStrClient( Client, RPL_LUSERCHANNELS_MSG, Client_ID( Client ), Channel_Count( ))) return DISCONNECTED;
/* Number of local users, services and servers */
if( ! IRC_WriteStrClient( Client, RPL_LUSERME_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyServiceCount( ), Client_MyServerCount( ))) return DISCONNECTED;
#ifndef STRICT_RFC
/* Maximum number of local users */
if( ! IRC_WriteStrClient( Client, RPL_LOCALUSERS_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyMaxUserCount( ))) return DISCONNECTED;
/* Maximum number of users in the network */
if( ! IRC_WriteStrClient( Client, RPL_NETUSERS_MSG, Client_ID( Client ), Client_UserCount( ), Client_MaxUserCount( ))) return DISCONNECTED;
#endif
return CONNECTED;
} /* IRC_Send_LUSERS */
GLOBAL BOOLEAN
IRC_Show_MOTD( CLIENT *Client )
{
BOOLEAN ok;
CHAR line[127];
FILE *fd;
UINT line_len;
assert( Client != NULL );
if( Conf_MotdPhrase[0] )
{
if( ! IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )))) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), Conf_MotdPhrase )) return DISCONNECTED;
return IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client ));
}
fd = fopen( Conf_MotdFile, "r" );
if( ! fd )
{
Log( LOG_WARNING, "Can't read MOTD file \"%s\": %s", Conf_MotdFile, strerror( errno ));
return IRC_WriteStrClient( Client, ERR_NOMOTD_MSG, Client_ID( Client ) );
}
if( ! IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )))) return DISCONNECTED;
while( TRUE )
{
if( ! fgets( line, sizeof( line ), fd )) break;
line_len = strlen( line );
if( line_len > 0 ) line_len--;
if( line[line_len] == '\n' ) line[line_len] = '\0';
if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), line ))
{
fclose( fd );
return FALSE;
}
}
ok = IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client ) );
fclose( fd );
return ok;
} /* IRC_Show_MOTD */
GLOBAL BOOLEAN
IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan )
{
BOOLEAN is_visible, is_member;
CHAR str[LINE_LEN + 1];
CL2CHAN *cl2chan;
CLIENT *cl;
assert( Client != NULL );
assert( Chan != NULL );
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
else is_member = FALSE;
/* Alle Mitglieder suchen */
snprintf( str, sizeof( str ), RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
cl2chan = Channel_FirstMember( Chan );
while( cl2chan )
{
cl = Channel_GetClient( cl2chan );
if( strchr( Client_Modes( cl ), 'i' )) is_visible = FALSE;
else is_visible = TRUE;
if( is_member || is_visible )
{
/* Nick anhaengen */
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;
snprintf( str, sizeof( str ), RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
}
}
/* naechstes Mitglied suchen */
cl2chan = Channel_NextMember( Chan, cl2chan );
}
if( str[strlen( str ) - 1] != ':')
{
/* Es sind noch Daten da, die gesendet werden muessen */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
}
return CONNECTED;
} /* IRC_Send_NAMES */
GLOBAL BOOLEAN
IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps )
{
BOOLEAN is_visible, is_member;
CL2CHAN *cl2chan;
CHAR flags[8];
CLIENT *c;
assert( Client != NULL );
assert( Chan != NULL );
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
else is_member = FALSE;
/* Alle Mitglieder suchen */
cl2chan = Channel_FirstMember( Chan );
while( cl2chan )
{
c = Channel_GetClient( cl2chan );
if( strchr( Client_Modes( c ), 'i' )) is_visible = FALSE;
else is_visible = TRUE;
if( is_member || is_visible )
{
/* Flags zusammenbasteln */
strcpy( flags, "H" );
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' )))
{
if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), Channel_Name( Chan ), Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
}
}
/* naechstes Mitglied suchen */
cl2chan = Channel_NextMember( Chan, cl2chan );
}
return CONNECTED;
} /* IRC_Send_WHO */
/* -eof- */

View File

@@ -1,44 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-info.h,v 1.2 2002/12/12 12:23:43 alex Exp $
*
* IRC info commands (header)
*/
#ifndef __irc_info_h__
#define __irc_info_h__
GLOBAL BOOLEAN IRC_ADMIN PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_ISON PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_LINKS PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_LUSERS PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_MOTD PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NAMES PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_STATS PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_TIME PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_USERHOST PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_VERSION PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHO PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHOIS PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHOWAS PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_Send_LUSERS PARAMS(( CLIENT *Client ));
GLOBAL BOOLEAN IRC_Send_NAMES PARAMS(( CLIENT *Client, CHANNEL *Chan ));
GLOBAL BOOLEAN IRC_Show_MOTD PARAMS(( CLIENT *Client ));
GLOBAL BOOLEAN IRC_Send_WHO PARAMS(( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps ));
#endif
/* -eof- */

View File

@@ -2,40 +2,38 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Login and logout * $Id: irc-login.c,v 1.21.2.1 2002/09/22 21:37:06 alex Exp $
*
* irc-login.c: Anmeldung und Abmeldung im IRC
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-login.c,v 1.40 2004/03/11 22:16:31 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include "ngircd.h" #include "ngircd.h"
#include "resolve.h" #include "resolve.h"
#include "conn-func.h"
#include "conf.h" #include "conf.h"
#include "conn.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "log.h" #include "log.h"
#include "messages.h" #include "messages.h"
#include "parse.h" #include "parse.h"
#include "irc.h" #include "irc.h"
#include "irc-info.h"
#include "irc-write.h" #include "irc-write.h"
#include "cvs-version.h"
#include "exp.h" #include "exp.h"
#include "irc-login.h" #include "irc-login.h"
@@ -67,7 +65,7 @@ IRC_PASS( CLIENT *Client, REQUEST *Req )
} }
else if((( Client_Type( Client ) == CLIENT_UNKNOWN ) || ( Client_Type( Client ) == CLIENT_UNKNOWNSERVER )) && (( Req->argc == 3 ) || ( Req->argc == 4 ))) else if((( Client_Type( Client ) == CLIENT_UNKNOWN ) || ( Client_Type( Client ) == CLIENT_UNKNOWNSERVER )) && (( Req->argc == 3 ) || ( Req->argc == 4 )))
{ {
CHAR c2, c4, *type, *impl, *serverver, *flags, *ptr, *ircflags; CHAR c2, c4, *type, *impl, *serverver, *flags, *ptr;
INT protohigh, protolow; INT protohigh, protolow;
/* noch nicht registrierte Server-Verbindung */ /* noch nicht registrierte Server-Verbindung */
@@ -96,10 +94,6 @@ IRC_PASS( CLIENT *Client, REQUEST *Req )
if( strlen( Req->argv[1] ) > 4 ) type = &Req->argv[1][4]; if( strlen( Req->argv[1] ) > 4 ) type = &Req->argv[1][4];
else type = NULL; else type = NULL;
/* IRC-Flags (nach RFC 2813) */
if( Req->argc >= 4 ) ircflags = Req->argv[3];
else ircflags = "";
/* Implementation, Version und ngIRCd-Flags */ /* Implementation, Version und ngIRCd-Flags */
impl = Req->argv[2]; impl = Req->argv[2];
ptr = strchr( impl, '|' ); ptr = strchr( impl, '|' );
@@ -117,16 +111,12 @@ IRC_PASS( CLIENT *Client, REQUEST *Req )
flags++; flags++;
} }
else flags = ""; else flags = "";
Log( LOG_INFO, "Peer announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").", impl, serverver, protohigh, protolow, flags ); Log( LOG_INFO, "Connection %d: Peer announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").", Client_Conn( Client ), impl, serverver, protohigh, protolow, flags );
} }
else else
{ {
/* auf der anderen Seite laeuft ein Server, der serverver = flags = "";
* nur das Originalprotokoll unterstuetzt */ Log( LOG_INFO, "Connection %d: Peer announces itself as \"%s\" using protocol %d.%d.", Client_Conn( Client ), impl, protohigh, protolow );
serverver = "";
if( strchr( ircflags, 'Z' )) flags = "Z";
else flags = "";
Log( LOG_INFO, "Peer announces itself as \"%s\" using protocol %d.%d (flags: \"%s\").", impl, protohigh, protolow, flags );
} }
Client_SetType( Client, CLIENT_GOTPASSSERVER ); Client_SetType( Client, CLIENT_GOTPASSSERVER );
@@ -225,7 +215,6 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
/* neuen Client-Nick speichern */ /* neuen Client-Nick speichern */
Client_SetID( target, Req->argv[0] ); Client_SetID( target, Req->argv[0] );
IRC_SetPenalty( target, 2 );
} }
return CONNECTED; return CONNECTED;
@@ -286,10 +275,6 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_USER( CLIENT *Client, REQUEST *Req ) IRC_USER( CLIENT *Client, REQUEST *Req )
{ {
#ifdef IDENTAUTH
CHAR *ptr;
#endif
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
@@ -299,21 +284,11 @@ IRC_USER( CLIENT *Client, REQUEST *Req )
if( Client_Type( Client ) == CLIENT_GOTNICK || Client_Type( Client ) == CLIENT_GOTPASS ) if( Client_Type( Client ) == CLIENT_GOTNICK || Client_Type( Client ) == CLIENT_GOTPASS )
#endif #endif
{ {
/* Wrong number of parameters? */ /* Falsche Anzahl Parameter? */
if( Req->argc != 4 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc != 4 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* User name */
#ifdef IDENTAUTH
ptr = Client_User( Client );
if( ! ptr || ! *ptr || *ptr == '~' ) Client_SetUser( Client, Req->argv[0], FALSE );
#else
Client_SetUser( Client, Req->argv[0], FALSE ); Client_SetUser( Client, Req->argv[0], FALSE );
#endif Client_SetInfo( Client, Req->argv[3] );
/* "Real name" or user info text: Don't set it to the empty string, the original ircd
* can't deal with such "real names" (e. g. "USER user * * :") ... */
if( *Req->argv[3] ) Client_SetInfo( Client, Req->argv[3] );
else Client_SetInfo( Client, "-" );
Log( LOG_DEBUG, "Connection %d: got valid USER command ...", Client_Conn( Client )); Log( LOG_DEBUG, "Connection %d: got valid USER command ...", Client_Conn( Client ));
if( Client_Type( Client ) == CLIENT_GOTNICK ) return Hello_User( Client ); if( Client_Type( Client ) == CLIENT_GOTNICK ) return Hello_User( Client );
@@ -379,6 +354,8 @@ IRC_PING( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */ /* Falsche Anzahl Parameter? */
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client )); if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
#ifdef STRICT_RFC #ifdef STRICT_RFC
@@ -389,7 +366,7 @@ IRC_PING( CLIENT *Client, REQUEST *Req )
{ {
/* es wurde ein Ziel-Client angegeben */ /* es wurde ein Ziel-Client angegeben */
target = Client_Search( Req->argv[1] ); target = Client_Search( Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] ); if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if( target != Client_ThisServer( )) if( target != Client_ThisServer( ))
{ {
/* ok, forwarden */ /* ok, forwarden */
@@ -413,6 +390,8 @@ IRC_PONG( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */ /* Falsche Anzahl Parameter? */
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client )); if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -421,7 +400,7 @@ IRC_PONG( CLIENT *Client, REQUEST *Req )
if( Req->argc == 2 ) if( Req->argc == 2 )
{ {
target = Client_Search( Req->argv[1] ); target = Client_Search( Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] ); if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if( target != Client_ThisServer( )) if( target != Client_ThisServer( ))
{ {
/* ok, forwarden */ /* ok, forwarden */
@@ -445,16 +424,12 @@ IRC_PONG( CLIENT *Client, REQUEST *Req )
LOCAL BOOLEAN LOCAL BOOLEAN
Hello_User( CLIENT *Client ) Hello_User( CLIENT *Client )
{ {
#ifdef CVSDATE
CHAR ver[12], vertxt[30];
#endif
assert( Client != NULL ); assert( Client != NULL );
/* Check password ... */ /* Passwort ueberpruefen */
if( strcmp( Client_Password( Client ), Conf_ServerPwd ) != 0 ) if( strcmp( Client_Password( Client ), Conf_ServerPwd ) != 0 )
{ {
/* Bad password! */ /* Falsches Passwort */
Log( LOG_ERR, "User \"%s\" rejected (connection %d): Bad password!", Client_Mask( Client ), Client_Conn( Client )); Log( LOG_ERR, "User \"%s\" rejected (connection %d): Bad password!", Client_Mask( Client ), Client_Conn( Client ));
Conn_Close( Client_Conn( Client ), NULL, "Bad password", TRUE ); Conn_Close( Client_Conn( Client ), NULL, "Bad password", TRUE );
return DISCONNECTED; return DISCONNECTED;
@@ -462,41 +437,19 @@ Hello_User( CLIENT *Client )
Log( LOG_NOTICE, "User \"%s\" registered (connection %d).", Client_Mask( Client ), Client_Conn( Client )); Log( LOG_NOTICE, "User \"%s\" registered (connection %d).", Client_Mask( Client ), Client_Conn( Client ));
/* Inform other servers */ /* Andere Server informieren */
IRC_WriteStrServers( NULL, "NICK %s 1 %s %s 1 +%s :%s", Client_ID( Client ), Client_User( Client ), Client_Hostname( Client ), Client_Modes( Client ), Client_Info( Client )); IRC_WriteStrServers( NULL, "NICK %s 1 %s %s 1 +%s :%s", Client_ID( Client ), Client_User( Client ), Client_Hostname( Client ), Client_Modes( Client ), Client_Info( Client ));
/* Welcome :-) */
if( ! IRC_WriteStrClient( Client, RPL_WELCOME_MSG, Client_ID( Client ), Client_Mask( Client ))) return FALSE; if( ! IRC_WriteStrClient( Client, RPL_WELCOME_MSG, Client_ID( Client ), Client_Mask( Client ))) return FALSE;
if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), VERSION, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return FALSE;
/* Version and system type */
#ifdef CVSDATE
strlcpy( ver, CVSDATE, sizeof( ver ));
strncpy( ver + 4, ver + 5, 2 );
strncpy( ver + 6, ver + 8, 3 );
snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver );
if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), vertxt, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return FALSE;
#else
if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return FALSE;
#endif
if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return FALSE; if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return FALSE;
#ifdef CVSDATE 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( )), vertxt, USERMODES, CHANMODES )) return FALSE;
#else
if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, USERMODES, CHANMODES )) return FALSE;
#endif
/* Features */
if( ! IRC_WriteStrClient( Client, RPL_ISUPPORT_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1, CHANNEL_TOPIC_LEN - 1, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED;
Client_SetType( Client, CLIENT_USER ); Client_SetType( Client, CLIENT_USER );
if( ! IRC_Send_LUSERS( Client )) return DISCONNECTED; if( ! IRC_Send_LUSERS( Client )) return DISCONNECTED;
if( ! IRC_Show_MOTD( Client )) return DISCONNECTED; if( ! IRC_Show_MOTD( Client )) return DISCONNECTED;
/* Suspend the client for a second ... */
IRC_SetPenalty( Client, 1 );
return CONNECTED; return CONNECTED;
} /* Hello_User */ } /* Hello_User */
@@ -504,18 +457,19 @@ Hello_User( CLIENT *Client )
LOCAL VOID LOCAL VOID
Kill_Nick( CHAR *Nick, CHAR *Reason ) Kill_Nick( CHAR *Nick, CHAR *Reason )
{ {
REQUEST r; CLIENT *c;
assert( Nick != NULL ); assert( Nick != NULL );
assert( Reason != NULL ); assert( Reason != NULL );
r.prefix = (CHAR *)Client_ThisServer( );
r.argv[0] = Nick;
r.argv[1] = Reason;
r.argc = 2;
Log( LOG_ERR, "User(s) with nick \"%s\" will be disconnected: %s", Nick, Reason ); Log( LOG_ERR, "User(s) with nick \"%s\" will be disconnected: %s", Nick, Reason );
IRC_KILL( Client_ThisServer( ), &r );
/* andere Server benachrichtigen */
IRC_WriteStrServers( NULL, "KILL %s :%s", Nick, Reason );
/* Ggf. einen eigenen Client toeten */
c = Client_Search( Nick );
if( c && ( Client_Conn( c ) != NONE )) Conn_Close( Client_Conn( c ), NULL, Reason, TRUE );
} /* Kill_Nick */ } /* Kill_Nick */

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: irc-login.h,v 1.5 2002/12/12 12:23:43 alex Exp $ * $Id: irc-login.h,v 1.4 2002/05/27 13:09:27 alex Exp $
* *
* Login and logout (header) * irc-login.h: Anmeldung und Abmeldung im IRC (Header)
*/ */

File diff suppressed because it is too large Load Diff

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: irc-mode.h,v 1.5 2002/12/12 12:23:43 alex Exp $ * $Id: irc-mode.h,v 1.4 2002/05/27 13:09:27 alex Exp $
* *
* IRC commands for mode changes (header) * irc-mode.h: IRC-Befehle zur Mode-Aenderung (MODE, AWAY, ...) (Header)
*/ */

View File

@@ -1,21 +1,22 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Channel operator commands * $Id: irc-op.c,v 1.9 2002/09/08 17:06:54 alex Exp $
*
* irc-op.c: Befehle zur Channel-Verwaltung
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-op.c,v 1.13 2004/04/09 21:41:52 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
@@ -43,6 +44,9 @@ IRC_KICK( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Valider Client? */
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */ /* Falsche Anzahl Parameter? */
if(( Req->argc < 2) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if(( Req->argc < 2) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -69,14 +73,17 @@ IRC_INVITE( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Wrong number of parameters? */ /* Valider Client? */
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix ); if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client; else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix ); if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Search user */ /* User suchen */
target = Client_Search( Req->argv[0] ); target = Client_Search( Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_USER )) return IRC_WriteStrClient( from, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[0] ); if(( ! target ) || ( Client_Type( target ) != CLIENT_USER )) return IRC_WriteStrClient( from, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[0] );
@@ -84,38 +91,36 @@ IRC_INVITE( CLIENT *Client, REQUEST *Req )
if( chan ) if( chan )
{ {
/* Channel exists. Is the user a valid member of the channel? */ /* Der Channel existiert bereits; ist der User Mitglied? */
if( ! Channel_IsMemberOf( chan, from )) return IRC_WriteStrClient( from, ERR_NOTONCHANNEL_MSG, Client_ID( Client ), Req->argv[1] ); if( ! Channel_IsMemberOf( chan, from )) return IRC_WriteStrClient( from, ERR_NOTONCHANNEL_MSG, Client_ID( Client ), Req->argv[1] );
/* Is the channel "invite-only"? */ /* Ist der Channel "invite-only"? */
if( strchr( Channel_Modes( chan ), 'i' )) if( strchr( Channel_Modes( chan ), 'i' ))
{ {
/* Yes. The user must be channel operator! */ /* Ja. Der User muss Channel-Operator sein! */
if( ! strchr( Channel_UserModes( chan, from ), 'o' )) return IRC_WriteStrClient( from, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( from ), Channel_Name( chan )); if( ! strchr( Channel_UserModes( chan, from ), 'o' )) return IRC_WriteStrClient( from, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( from ), Channel_Name( chan ));
remember = TRUE; remember = TRUE;
} }
/* Is the target user already member of the channel? */ /* Ist der Ziel-User bereits Mitglied? */
if( Channel_IsMemberOf( chan, target )) return IRC_WriteStrClient( from, ERR_USERONCHANNEL_MSG, Client_ID( from ), Req->argv[0], Req->argv[1] ); if( Channel_IsMemberOf( chan, target )) return IRC_WriteStrClient( from, ERR_USERONCHANNEL_MSG, Client_ID( from ), Req->argv[0], Req->argv[1] );
/* If the target user is banned on that channel: remember invite */
if( Lists_CheckBanned( target, chan )) remember = TRUE;
if( remember )
{
/* We must memember this invite */
if( ! Lists_AddInvited( Client_Mask( target ), chan, TRUE )) return CONNECTED;
}
} }
Log( LOG_DEBUG, "User \"%s\" invites \"%s\" to \"%s\" ...", Client_Mask( from ), Req->argv[0], Req->argv[1] ); /* Wenn der User gebanned ist, so muss das Invite auch gespeichert werden */
if( Lists_CheckBanned( target, chan )) remember = TRUE;
/* Inform target client */ Log( LOG_DEBUG, "User \"%s\" invites \"%s\" to \"%s\" ...", Client_Mask( from ), Req->argv[0], Req->argv[1] );
if( remember )
{
if( ! Lists_AddInvited( from, Client_Mask( target ), chan, TRUE )) return CONNECTED;
}
/* an Ziel-Client forwarden ... */
IRC_WriteStrClientPrefix( target, from, "INVITE %s %s", Req->argv[0], Req->argv[1] ); IRC_WriteStrClientPrefix( target, from, "INVITE %s %s", Req->argv[0], Req->argv[1] );
if( Client_Conn( target ) > NONE ) if( Client_Conn( target ) > NONE )
{ {
/* The target user is local, so we have to send the status code */ /* lokaler Ziel-Client, Status-Code melden */
if( ! IRC_WriteStrClientPrefix( from, target, RPL_INVITING_MSG, Client_ID( from ), Req->argv[0], Req->argv[1] )) return DISCONNECTED; if( ! IRC_WriteStrClientPrefix( from, target, RPL_INVITING_MSG, Client_ID( from ), Req->argv[0], Req->argv[1] )) return DISCONNECTED;
} }

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: irc-op.h,v 1.3 2002/12/12 12:23:43 alex Exp $ * $Id: irc-op.h,v 1.2 2002/09/08 00:52:55 alex Exp $
* *
* Channel operator commands (header) * irc-op.h: Befehle zur Channel-Verwaltung (Header)
*/ */

View File

@@ -2,29 +2,29 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* IRC operator commands * $Id: irc-oper.c,v 1.8 2002/09/03 23:54:59 alex Exp $
*
* irc-oper.c: IRC-Operator-Befehle
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-oper.c,v 1.17 2002/12/31 16:10:55 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "ngircd.h" #include "ngircd.h"
#include "resolve.h" #include "resolve.h"
#include "conn.h"
#include "conf.h" #include "conf.h"
#include "conn.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "irc-write.h" #include "irc-write.h"
@@ -44,6 +44,8 @@ IRC_OPER( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */ /* Falsche Anzahl Parameter? */
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -83,60 +85,37 @@ IRC_OPER( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_DIE( CLIENT *Client, REQUEST *Req ) IRC_DIE( CLIENT *Client, REQUEST *Req )
{ {
/* Shut down server */
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Not a local IRC operator? */ if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
/* Bad number of parameters? */ /* Falsche Anzahl Parameter? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
Log( LOG_NOTICE|LOG_snotice, "Got DIE command from \"%s\" ...", Client_Mask( Client )); if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
NGIRCd_SignalQuit = TRUE;
Log( LOG_NOTICE|LOG_snotice, "Got DIE command from \"%s\", going down!", Client_Mask( Client ));
NGIRCd_Quit = TRUE;
return CONNECTED; return CONNECTED;
} /* IRC_DIE */ } /* IRC_DIE */
GLOBAL BOOLEAN
IRC_REHASH( CLIENT *Client, REQUEST *Req )
{
/* Reload configuration file */
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 != 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 */
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_RESTART( CLIENT *Client, REQUEST *Req ) IRC_RESTART( CLIENT *Client, REQUEST *Req )
{ {
/* Restart IRC server (fork a new process) */
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Not a local IRC operator? */ if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
/* Bad number of parameters? */ /* Falsche Anzahl Parameter? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
Log( LOG_NOTICE|LOG_snotice, "Got RESTART command from \"%s\" ...", Client_Mask( Client )); if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
NGIRCd_SignalRestart = TRUE;
Log( LOG_NOTICE|LOG_snotice, "Got RESTART command from \"%s\", going down!", Client_Mask( Client ));
NGIRCd_Restart = TRUE;
return CONNECTED; return CONNECTED;
} /* IRC_RESTART */ } /* IRC_RESTART */
@@ -144,64 +123,22 @@ IRC_RESTART( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_CONNECT(CLIENT *Client, REQUEST *Req ) IRC_CONNECT(CLIENT *Client, REQUEST *Req )
{ {
/* Connect configured or new server */ /* Vorlaeufige Version zu Debug-Zwecken: es wird einfach
* der "passive mode" aufgehoben, mehr passiert nicht ... */
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Not a local IRC operator? */ if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client )); if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
/* Bad number of parameters? */ Log( LOG_NOTICE|LOG_snotice, "Got CONNECT command from \"%s\".", Client_Mask( Client ));
if(( Req->argc != 2 ) && ( Req->argc != 5 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); NGIRCd_Passive = FALSE;
/* Invalid port number? */
if( atoi( Req->argv[1] ) < 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
Log( LOG_NOTICE|LOG_snotice, "Got CONNECT command from \"%s\" for \"%s\".", Client_Mask( Client ), Req->argv[0]);
if( Req->argc == 2 )
{
/* Connect configured server */
if( ! Conf_EnableServer( Req->argv[0], atoi( Req->argv[1] ))) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
}
else
{
/* Add server */
if( ! Conf_AddServer( Req->argv[0], atoi( Req->argv[1] ), Req->argv[2], Req->argv[3], Req->argv[4] )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
}
return CONNECTED; return CONNECTED;
} /* IRC_CONNECT */ } /* IRC_CONNECT */
GLOBAL BOOLEAN
IRC_DISCONNECT(CLIENT *Client, REQUEST *Req )
{
/* Disconnect and disable configured server */
CONN_ID my_conn;
assert( Client != NULL );
assert( Req != NULL );
/* Not a local IRC operator? */
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
/* Bad number of parameters? */
if( Req->argc != 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
Log( LOG_NOTICE|LOG_snotice, "Got DISCONNECT command from \"%s\" for0 \"%s\".", Client_Mask( Client ), Req->argv[0]);
/* Save ID of this connection */
my_conn = Client_Conn( Client );
/* Connect configured server */
if( ! Conf_DisableServer( Req->argv[0] )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
/* Are we still connected or were we killed, too? */
if( Client_GetFromConn( my_conn )) return CONNECTED;
else return DISCONNECTED;
} /* IRC_CONNECT */
/* -eof- */ /* -eof- */

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: irc-oper.h,v 1.10 2002/12/31 16:11:06 alex Exp $ * $Id: irc-oper.h,v 1.6 2002/09/03 23:54:59 alex Exp $
* *
* IRC operator commands (header) * irc-oper.h: IRC-Operator-Befehle (Header)
*/ */
@@ -20,10 +21,8 @@
GLOBAL BOOLEAN IRC_OPER PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_OPER PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_DIE PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_DIE PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_REHASH PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_DISCONNECT PARAMS((CLIENT *Client, REQUEST *Req ));
#endif #endif

View File

@@ -2,36 +2,33 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* IRC commands for server links * $Id: irc-server.c,v 1.17.2.2 2002/10/04 13:12:46 alex Exp $
*
* irc-server.c: IRC-Befehle fuer Server-Links
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-server.c,v 1.36.2.1 2004/05/15 23:52:17 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include "defines.h"
#include "resolve.h" #include "resolve.h"
#include "conn.h"
#include "conn-zip.h"
#include "conf.h" #include "conf.h"
#include "conn.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "irc-write.h" #include "irc-write.h"
#include "lists.h"
#include "log.h" #include "log.h"
#include "messages.h" #include "messages.h"
#include "parse.h" #include "parse.h"
@@ -44,13 +41,12 @@ static char UNUSED id[] = "$Id: irc-server.c,v 1.36.2.1 2004/05/15 23:52:17 alex
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_SERVER( CLIENT *Client, REQUEST *Req ) IRC_SERVER( CLIENT *Client, REQUEST *Req )
{ {
CHAR str[LINE_LEN], *ptr, *modes, *topic; CHAR str[LINE_LEN], *ptr;
CLIENT *from, *c, *cl; CLIENT *from, *c, *cl;
CL2CHAN *cl2chan; CL2CHAN *cl2chan;
INT max_hops, i; INT max_hops, i;
CHANNEL *chan; CHANNEL *chan;
BOOLEAN ok; BOOLEAN ok;
CONN_ID con;
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
@@ -67,18 +63,18 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
if(( Req->argc != 2 ) && ( Req->argc != 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if(( Req->argc != 2 ) && ( Req->argc != 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Ist dieser Server bei uns konfiguriert? */ /* Ist dieser Server bei uns konfiguriert? */
for( i = 0; i < MAX_SERVERS; i++ ) if( strcasecmp( Req->argv[0], Conf_Server[i].name ) == 0 ) break; for( i = 0; i < Conf_Server_Count; i++ ) if( strcasecmp( Req->argv[0], Conf_Server[i].name ) == 0 ) break;
if( i >= MAX_SERVERS ) if( i >= Conf_Server_Count )
{ {
/* Server ist nicht konfiguriert! */ /* Server ist nicht konfiguriert! */
Log( LOG_ERR, "Connection %d: Server \"%s\" not configured here!", Client_Conn( Client ), Req->argv[0] ); Log( LOG_ERR, "Connection %d: Server \"%s\" not configured here!", Client_Conn( Client ), Req->argv[0] );
Conn_Close( Client_Conn( Client ), NULL, "Server not configured here", TRUE ); Conn_Close( Client_Conn( Client ), NULL, "Server not configured here", TRUE );
return DISCONNECTED; return DISCONNECTED;
} }
if( strcmp( Client_Password( Client ), Conf_Server[i].pwd_in ) != 0 ) if( strcmp( Client_Password( Client ), Conf_Server[i].pwd ) != 0 )
{ {
/* Falsches Passwort */ /* Falsches Passwort */
Log( LOG_ERR, "Connection %d: Got bad password from server \"%s\"!", Client_Conn( Client ), Req->argv[0] ); Log( LOG_ERR, "Connection %d: Bad password for server \"%s\"!", Client_Conn( Client ), Req->argv[0] );
Conn_Close( Client_Conn( Client ), NULL, "Bad password", TRUE ); Conn_Close( Client_Conn( Client ), NULL, "Bad password", TRUE );
return DISCONNECTED; return DISCONNECTED;
} }
@@ -93,16 +89,15 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
/* Meldet sich der Server bei uns an (d.h., bauen nicht wir /* Meldet sich der Server bei uns an (d.h., bauen nicht wir
* selber die Verbindung zu einem anderen Server auf)? */ * selber die Verbindung zu einem anderen Server auf)? */
con = Client_Conn( Client );
if( Client_Token( Client ) != TOKEN_OUTBOUND ) if( Client_Token( Client ) != TOKEN_OUTBOUND )
{ {
/* Eingehende Verbindung: Unseren SERVER- und PASS-Befehl senden */ /* Eingehende Verbindung: Unseren SERVER- und PASS-Befehl senden */
ok = TRUE; ok = TRUE;
if( ! IRC_WriteStrClient( Client, "PASS %s %s", Conf_Server[i].pwd_out, NGIRCd_ProtoID )) ok = FALSE; if( ! IRC_WriteStrClient( Client, "PASS %s %s", Conf_Server[i].pwd, NGIRCd_ProtoID )) ok = FALSE;
else ok = IRC_WriteStrClient( Client, "SERVER %s 1 :%s", Conf_ServerName, Conf_ServerInfo ); else ok = IRC_WriteStrClient( Client, "SERVER %s 1 :%s", Conf_ServerName, Conf_ServerInfo );
if( ! ok ) if( ! ok )
{ {
Conn_Close( con, "Unexpected server behavior!", NULL, FALSE ); Conn_Close( Client_Conn( Client ), "Unexpected server behavior!", NULL, FALSE );
return DISCONNECTED; return DISCONNECTED;
} }
Client_SetIntroducer( Client, Client ); Client_SetIntroducer( Client, Client );
@@ -115,23 +110,9 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
Client_SetToken( Client, atoi( Req->argv[1] )); Client_SetToken( Client, atoi( Req->argv[1] ));
} }
Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (connection %d, 1 hop - direct link).", Client_ID( Client ), con ); Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (connection %d, 1 hop - direct link).", Client_ID( Client ), Client_Conn( Client ));
Client_SetType( Client, CLIENT_SERVER ); Client_SetType( Client, CLIENT_SERVER );
Conf_SetServer( i, con );
#ifdef ZLIB
/* Kompression initialisieren, wenn erforderlich */
if( strchr( Client_Flags( Client ), 'Z' ))
{
if( ! Zip_InitConn( con ))
{
/* Fehler! */
Conn_Close( con, "Can't inizialize compression (zlib)!", NULL, FALSE );
return DISCONNECTED;
}
}
#endif
/* maximalen Hop Count ermitteln */ /* maximalen Hop Count ermitteln */
max_hops = 0; max_hops = 0;
@@ -182,56 +163,33 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
while( chan ) while( chan )
{ {
#ifdef IRCPLUS #ifdef IRCPLUS
/* Send CHANINFO if the peer supports it */ /* Wenn unterstuetzt, CHANINFO senden */
if( strchr( Client_Flags( Client ), 'C' )) if( strchr( Client_Flags( Client ), 'C' ))
{ {
#ifdef DEBUG /* CHANINFO senden */
Log( LOG_DEBUG, "Sending CHANINFO commands ..." ); if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s :%s", Channel_Name( chan ), Channel_Modes( chan ), Channel_Topic( chan ))) return DISCONNECTED;
#endif
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 <chan> +<modes>" */
if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s", Channel_Name( chan ), modes )) return DISCONNECTED;
}
else if(( ! strchr( Channel_Modes( chan ), 'k' )) && ( ! strchr( Channel_Modes( chan ), 'l' )))
{
/* "CHANINFO <chan> +<modes> :<topic>" */
if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s :%s", Channel_Name( chan ), modes, topic )) return DISCONNECTED;
}
else
{
/* "CHANINFO <chan> +<modes> <key> <limit> :<topic>" */
if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s %s %ld :%s", Channel_Name( chan ), modes, strchr( Channel_Modes( chan ), 'k' ) ? Channel_Key( chan ) : "*", strchr( Channel_Modes( chan ), 'l' ) ? Channel_MaxUsers( chan ) : 0L, topic )) return DISCONNECTED;
}
}
} }
#endif #endif
/* alle Member suchen */ /* alle Member suchen */
cl2chan = Channel_FirstMember( chan ); cl2chan = Channel_FirstMember( chan );
snprintf( str, sizeof( str ), "NJOIN %s :", Channel_Name( chan )); sprintf( str, "NJOIN %s :", Channel_Name( chan ));
while( cl2chan ) while( cl2chan )
{ {
cl = Channel_GetClient( cl2chan ); cl = Channel_GetClient( cl2chan );
assert( cl != NULL ); assert( cl != NULL );
/* Nick, ggf. mit Modes, anhaengen */ /* Nick, ggf. mit Modes, anhaengen */
if( str[strlen( str ) - 1] != ':' ) strlcat( str, ",", sizeof( str )); if( str[strlen( str ) - 1] != ':' ) strcat( str, "," );
if( strchr( Channel_UserModes( chan, cl ), 'v' )) strlcat( str, "+", sizeof( str )); if( strchr( Channel_UserModes( chan, cl ), 'v' )) strcat( str, "+" );
if( strchr( Channel_UserModes( chan, cl ), 'o' )) strlcat( str, "@", sizeof( str )); if( strchr( Channel_UserModes( chan, cl ), 'o' )) strcat( str, "@" );
strlcat( str, Client_ID( cl ), sizeof( str )); strcat( str, Client_ID( cl ));
if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 8 )) if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 8 ))
{ {
/* Zeile senden */ /* Zeile senden */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED; if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
snprintf( str, sizeof( str ), "NJOIN %s :", Channel_Name( chan )); sprintf( str, "NJOIN %s :", Channel_Name( chan ));
} }
cl2chan = Channel_NextMember( chan, cl2chan ); cl2chan = Channel_NextMember( chan, cl2chan );
@@ -244,18 +202,6 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED; if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
} }
#ifdef IRCPLUS
if( strchr( Client_Flags( Client ), 'L' ))
{
#ifdef DEBUG
Log( LOG_DEBUG, "Synchronizing INVITE- and BAN-lists ..." );
#endif
/* Synchronize INVITE- and BAN-lists */
if( ! Lists_SendInvites( Client )) return DISCONNECTED;
if( ! Lists_SendBans( Client )) return DISCONNECTED;
}
#endif
/* naechsten Channel suchen */ /* naechsten Channel suchen */
chan = Channel_Next( chan ); chan = Channel_Next( chan );
} }
@@ -296,7 +242,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
} }
/* Log-Meldung zusammenbauen und ausgeben */ /* Log-Meldung zusammenbauen und ausgeben */
if(( Client_Hops( c ) > 1 ) && ( Req->prefix[0] )) snprintf( str, sizeof( str ), "connected to %s, ", Client_ID( from )); if(( Client_Hops( c ) > 1 ) && ( Req->prefix[0] )) sprintf( str, "connected to %s, ", Client_ID( from ));
else strcpy( str, "" ); else strcpy( str, "" );
Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (via %s, %s%d hop%s).", Client_ID( c ), Client_ID( Client ), str, Client_Hops( c ), Client_Hops( c ) > 1 ? "s": "" ); Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (via %s, %s%d hop%s).", Client_ID( c ), Client_ID( Client ), str, Client_Hops( c ), Client_Hops( c ) > 1 ? "s": "" );
@@ -312,7 +258,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN GLOBAL BOOLEAN
IRC_NJOIN( CLIENT *Client, REQUEST *Req ) IRC_NJOIN( CLIENT *Client, REQUEST *Req )
{ {
CHAR nick_in[COMMAND_LEN], nick_out[COMMAND_LEN], *channame, *ptr, modes[8]; CHAR str[COMMAND_LEN], *channame, *ptr, modes[8];
BOOLEAN is_op, is_voiced; BOOLEAN is_op, is_voiced;
CHANNEL *chan; CHANNEL *chan;
CLIENT *c; CLIENT *c;
@@ -320,14 +266,16 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTEREDSERVER_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */ /* Falsche Anzahl Parameter? */
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
strlcpy( nick_in, Req->argv[1], sizeof( nick_in )); strncpy( str, Req->argv[1], COMMAND_LEN - 1 );
strcpy( nick_out, "" ); str[COMMAND_LEN - 1] = '\0';
channame = Req->argv[0]; channame = Req->argv[0];
ptr = strtok( nick_in, "," ); ptr = strtok( str, "," );
while( ptr ) while( ptr )
{ {
is_op = is_voiced = FALSE; is_op = is_voiced = FALSE;
@@ -354,17 +302,12 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
IRC_WriteStrChannelPrefix( Client, chan, c, FALSE, "JOIN :%s", channame ); IRC_WriteStrChannelPrefix( Client, chan, c, FALSE, "JOIN :%s", channame );
/* Channel-User-Modes setzen */ /* Channel-User-Modes setzen */
strlcpy( modes, Channel_UserModes( chan, c ), sizeof( modes )); strcpy( modes, Channel_UserModes( chan, c ));
if( modes[0] ) if( modes[0] )
{ {
/* Modes im Channel bekannt machen */ /* Modes im Channel bekannt machen */
IRC_WriteStrChannelPrefix( Client, chan, Client, FALSE, "MODE %s +%s %s", channame, modes, Client_ID( c )); IRC_WriteStrChannelPrefix( Client, chan, Client, FALSE, "MODE %s +%s %s", channame, modes, Client_ID( c ));
} }
if( nick_out[0] != '\0' ) strlcat( nick_out, ",", sizeof( nick_out ));
if( is_op ) strlcat( nick_out, "@", sizeof( nick_out ));
if( is_voiced ) strlcat( nick_out, "+", sizeof( nick_out ));
strlcat( nick_out, ptr, sizeof( nick_out ));
} }
else Log( LOG_ERR, "Got NJOIN for unknown nick \"%s\" for channel \"%s\"!", ptr, channame ); else Log( LOG_ERR, "Got NJOIN for unknown nick \"%s\" for channel \"%s\"!", ptr, channame );
@@ -373,7 +316,7 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
} }
/* an andere Server weiterleiten */ /* an andere Server weiterleiten */
if( nick_out[0] != '\0' ) IRC_WriteStrServersPrefix( Client, Client_ThisServer( ), "NJOIN %s :%s", Req->argv[0], nick_out ); IRC_WriteStrServersPrefix( Client, Client_ThisServer( ), "NJOIN %s :%s", Req->argv[0], Req->argv[1] );
return CONNECTED; return CONNECTED;
} /* IRC_NJOIN */ } /* IRC_NJOIN */
@@ -388,11 +331,17 @@ IRC_SQUIT( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* SQUIT ist nur fuer Server erlaubt */
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */ /* Falsche Anzahl Parameter? */
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
Log( LOG_DEBUG, "Got SQUIT from %s for \"%s\": \"%s\" ...", Client_ID( Client ), Req->argv[0], Req->argv[1] ); Log( LOG_DEBUG, "Got SQUIT from %s for \"%s\": \"%s\" ...", Client_ID( Client ), Req->argv[0], Req->argv[1] );
/* SQUIT an alle Server weiterleiten */
IRC_WriteStrServers( Client, "SQUIT %s :%s", Req->argv[0], Req->argv[1] );
target = Client_Search( Req->argv[0] ); target = Client_Search( Req->argv[0] );
if( ! target ) if( ! target )
{ {
@@ -404,9 +353,9 @@ IRC_SQUIT( CLIENT *Client, REQUEST *Req )
if( Req->argv[1][0] ) if( Req->argv[1][0] )
{ {
if( strlen( Req->argv[1] ) > LINE_LEN ) Req->argv[1][LINE_LEN] = '\0'; if( strlen( Req->argv[1] ) > LINE_LEN ) Req->argv[1][LINE_LEN] = '\0';
snprintf( msg, sizeof( msg ), "%s (SQUIT from %s).", Req->argv[1], Client_ID( Client )); sprintf( msg, "%s (SQUIT from %s).", Req->argv[1], Client_ID( Client ));
} }
else snprintf( msg, sizeof( msg ), "Got SQUIT from %s.", Client_ID( Client )); else sprintf( msg, "Got SQUIT from %s.", Client_ID( Client ));
if( Client_Conn( target ) > NONE ) if( Client_Conn( target ) > NONE )
{ {

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: irc-server.h,v 1.4 2002/12/12 12:23:43 alex Exp $ * $Id: irc-server.h,v 1.3 2002/05/27 13:09:27 alex Exp $
* *
* IRC commands for server links (header) * irc-server.h: IRC-Befehle fuer Server-Links (Header)
*/ */

View File

@@ -2,27 +2,28 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Sending IRC commands over the network * $Id: irc-write.c,v 1.7.2.3 2002/10/04 13:12:46 alex Exp $
*
* irc-write.c: IRC-Texte und Befehle ueber Netzwerk versenden
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-write.c,v 1.15 2003/11/05 23:24:48 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "conn-func.h" #include "conn.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "defines.h" #include "defines.h"
@@ -31,10 +32,6 @@ static char UNUSED id[] = "$Id: irc-write.c,v 1.15 2003/11/05 23:24:48 alex Exp
#include "irc-write.h" #include "irc-write.h"
#define SEND_TO_USER 1
#define SEND_TO_SERVER 2
LOCAL CHAR *Get_Prefix PARAMS(( CLIENT *Target, CLIENT *Client )); LOCAL CHAR *Get_Prefix PARAMS(( CLIENT *Target, CLIENT *Client ));
@@ -149,11 +146,11 @@ CHAR *Format;
va_dcl va_dcl
#endif #endif
{ {
BOOLEAN ok = CONNECTED; BOOLEAN sock[MAX_CONNECTIONS], is_server[MAX_CONNECTIONS], ok = CONNECTED;
CHAR buffer[1000]; CHAR buffer[1000];
CL2CHAN *cl2chan; CL2CHAN *cl2chan;
CONN_ID conn;
CLIENT *c; CLIENT *c;
INT s, i;
va_list ap; va_list ap;
assert( Client != NULL ); assert( Client != NULL );
@@ -169,7 +166,7 @@ va_dcl
vsnprintf( buffer, 1000, Format, ap ); vsnprintf( buffer, 1000, Format, ap );
va_end( ap ); va_end( ap );
Conn_ClearFlags( ); for( i = 0; i < MAX_CONNECTIONS; i++ ) sock[i] = FALSE;
/* An alle Clients, die in den selben Channels sind. /* An alle Clients, die in den selben Channels sind.
* Dabei aber nur einmal je Remote-Server */ * Dabei aber nur einmal je Remote-Server */
@@ -187,26 +184,26 @@ va_dcl
if( c && ( c != Client )) if( c && ( c != Client ))
{ {
/* Ok, anderer Client */ /* Ok, anderer Client */
conn = Client_Conn( c ); s = Client_Conn( c );
if( Client_Type( c ) == CLIENT_SERVER ) Conn_SetFlag( conn, SEND_TO_SERVER ); assert( s >= 0 );
else Conn_SetFlag( conn, SEND_TO_USER ); assert( s < MAX_CONNECTIONS );
sock[s] = TRUE;
if( Client_Type( c ) == CLIENT_SERVER ) is_server[s] = TRUE;
else is_server[s] = FALSE;
} }
cl2chan = Channel_NextMember( Chan, cl2chan ); cl2chan = Channel_NextMember( Chan, cl2chan );
} }
/* Senden: alle Verbindungen durchgehen ... */ /* Senden ... */
conn = Conn_First( ); for( i = 0; i < MAX_CONNECTIONS; i++ )
while( conn != NONE )
{ {
/* muessen Daten ueber diese Verbindung verschickt werden? */ if( sock[i] )
if( Conn_Flag( conn ) == SEND_TO_SERVER) ok = Conn_WriteStr( conn, ":%s %s", Client_ID( Prefix ), buffer ); {
else if( Conn_Flag( conn ) == SEND_TO_USER ) ok = Conn_WriteStr( conn, ":%s %s", Client_Mask( Prefix ), buffer ); if( is_server[i] ) ok = Conn_WriteStr( i, ":%s %s", Client_ID( Prefix ), buffer );
if( ! ok ) break; else ok = Conn_WriteStr( i, ":%s %s", Client_Mask( Prefix ), buffer );
if( ! ok ) break;
/* naechste Verbindung testen */ }
conn = Conn_Next( conn );
} }
return ok; return ok;
} /* IRC_WriteStrChannelPrefix */ } /* IRC_WriteStrChannelPrefix */
@@ -324,13 +321,13 @@ CHAR *Format;
va_dcl va_dcl
#endif #endif
{ {
BOOLEAN ok = CONNECTED; BOOLEAN sock[MAX_CONNECTIONS], is_server[MAX_CONNECTIONS], ok = CONNECTED;
CL2CHAN *chan_cl2chan, *cl2chan; CL2CHAN *chan_cl2chan, *cl2chan;
CHAR buffer[1000]; CHAR buffer[1000];
CHANNEL *chan; CHANNEL *chan;
CONN_ID conn;
va_list ap; va_list ap;
CLIENT *c; CLIENT *c;
INT i, s;
assert( Client != NULL ); assert( Client != NULL );
assert( Prefix != NULL ); assert( Prefix != NULL );
@@ -345,7 +342,7 @@ va_dcl
va_end( ap ); va_end( ap );
/* initialisieren */ /* initialisieren */
Conn_ClearFlags( ); for( i = 0; i < MAX_CONNECTIONS; i++ ) sock[i] = FALSE;
/* An alle Clients, die in einem Channel mit dem "Ausloeser" sind, /* An alle Clients, die in einem Channel mit dem "Ausloeser" sind,
* den Text schicken. An Remote-Server aber jeweils nur einmal. */ * den Text schicken. An Remote-Server aber jeweils nur einmal. */
@@ -368,9 +365,12 @@ va_dcl
if( c && ( c != Client )) if( c && ( c != Client ))
{ {
/* Ok, anderer Client */ /* Ok, anderer Client */
conn = Client_Conn( c ); s = Client_Conn( c );
if( Client_Type( c ) == CLIENT_SERVER ) Conn_SetFlag( conn, SEND_TO_SERVER ); assert( s >= 0 );
else Conn_SetFlag( conn, SEND_TO_USER ); assert( s < MAX_CONNECTIONS );
sock[s] = TRUE;
if( Client_Type( c ) == CLIENT_SERVER ) is_server[s] = TRUE;
else is_server[s] = FALSE;
} }
cl2chan = Channel_NextMember( chan, cl2chan ); cl2chan = Channel_NextMember( chan, cl2chan );
} }
@@ -379,37 +379,20 @@ va_dcl
chan_cl2chan = Channel_NextChannelOf( Client, chan_cl2chan ); chan_cl2chan = Channel_NextChannelOf( Client, chan_cl2chan );
} }
/* Senden: alle Verbindungen durchgehen ... */ /* Senden ... */
conn = Conn_First( ); for( i = 0; i < MAX_CONNECTIONS; i++ )
while( conn != NONE )
{ {
/* muessen ueber diese Verbindung Daten gesendet werden? */ if( sock[i] )
if( Conn_Flag( conn ) == SEND_TO_SERVER ) ok = Conn_WriteStr( conn, ":%s %s", Client_ID( Prefix ), buffer ); {
else if( Conn_Flag( conn ) == SEND_TO_USER ) ok = Conn_WriteStr( conn, ":%s %s", Client_Mask( Prefix ), buffer ); if( is_server[i] ) ok = Conn_WriteStr( i, ":%s %s", Client_ID( Prefix ), buffer );
if( ! ok ) break; else ok = Conn_WriteStr( i, ":%s %s", Client_Mask( Prefix ), buffer );
if( ! ok ) break;
/* naechste Verbindung testen */ }
conn = Conn_Next( conn );
} }
return ok; return ok;
} /* IRC_WriteStrRelatedPrefix */ } /* IRC_WriteStrRelatedPrefix */
GLOBAL VOID
IRC_SetPenalty( CLIENT *Client, INT Seconds )
{
CONN_ID c;
assert( Client != NULL );
assert( Seconds > 0 );
if( Client_Type( Client ) == CLIENT_SERVER ) return;
c = Client_Conn( Client );
if( c > NONE ) Conn_SetPenalty( c, Seconds );
} /* IRC_SetPenalty */
LOCAL CHAR * LOCAL CHAR *
Get_Prefix( CLIENT *Target, CLIENT *Client ) Get_Prefix( CLIENT *Target, CLIENT *Client )
{ {

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: irc-write.h,v 1.6 2003/11/05 23:24:48 alex Exp $ * $Id: irc-write.h,v 1.4 2002/09/03 23:56:06 alex Exp $
* *
* Sending IRC commands over the network (header) * irc-write.h: IRC-Texte und Befehle ueber Netzwerk versenden (Header)
*/ */
@@ -18,19 +19,17 @@
#define __irc_write_h__ #define __irc_write_h__
GLOBAL BOOLEAN IRC_WriteStrClient PARAMS(( CLIENT *Client, CHAR *Format, ... )); GLOBAL BOOLEAN IRC_WriteStrClient PARAMS((CLIENT *Client, CHAR *Format, ... ));
GLOBAL BOOLEAN IRC_WriteStrClientPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... )); GLOBAL BOOLEAN IRC_WriteStrClientPrefix PARAMS((CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... ));
GLOBAL BOOLEAN IRC_WriteStrChannel PARAMS(( CLIENT *Client, CHANNEL *Chan, BOOLEAN Remote, CHAR *Format, ... )); GLOBAL BOOLEAN IRC_WriteStrChannel PARAMS((CLIENT *Client, CHANNEL *Chan, BOOLEAN Remote, CHAR *Format, ... ));
GLOBAL BOOLEAN IRC_WriteStrChannelPrefix PARAMS(( CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )); GLOBAL BOOLEAN IRC_WriteStrChannelPrefix PARAMS((CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... ));
GLOBAL VOID IRC_WriteStrServers PARAMS(( CLIENT *ExceptOf, CHAR *Format, ... )); GLOBAL VOID IRC_WriteStrServers PARAMS((CLIENT *ExceptOf, CHAR *Format, ... ));
GLOBAL VOID IRC_WriteStrServersPrefix PARAMS(( CLIENT *ExceptOf, CLIENT *Prefix, CHAR *Format, ... )); GLOBAL VOID IRC_WriteStrServersPrefix PARAMS((CLIENT *ExceptOf, CLIENT *Prefix, CHAR *Format, ... ));
GLOBAL VOID IRC_WriteStrServersPrefixFlag PARAMS(( CLIENT *ExceptOf, CLIENT *Prefix, CHAR Flag, CHAR *Format, ... )); GLOBAL VOID IRC_WriteStrServersPrefixFlag PARAMS((CLIENT *ExceptOf, CLIENT *Prefix, CHAR Flag, CHAR *Format, ... ));
GLOBAL BOOLEAN IRC_WriteStrRelatedPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )); GLOBAL BOOLEAN IRC_WriteStrRelatedPrefix PARAMS((CLIENT *Client, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... ));
GLOBAL VOID IRC_SetPenalty PARAMS(( CLIENT *Client, INT Seconds ));
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: irc.h,v 1.38 2003/01/15 13:49:20 alex Exp $ * $Id: irc.h,v 1.32 2002/09/16 09:14:45 alex Exp $
* *
* IRC commands (header) * irc.h: IRC-Befehle (Header)
*/ */
@@ -18,12 +19,28 @@
#define __irc_h__ #define __irc_h__
GLOBAL BOOLEAN IRC_ERROR PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_MOTD PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_KILL PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_LUSERS PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NOTICE PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_LINKS PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_PRIVMSG PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_VERSION PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_TRACE PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL BOOLEAN IRC_ADMIN PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_HELP PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_PRIVMSG PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NOTICE PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NAMES PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_ISON PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHOIS PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_USERHOST PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHO PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_ERROR PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_KILL PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_Send_NAMES PARAMS((CLIENT *Client, CHANNEL *Chan ));
GLOBAL BOOLEAN IRC_Send_LUSERS PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN IRC_Show_MOTD PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN IRC_Send_WHO PARAMS((CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps ));
#endif #endif

View File

@@ -1,21 +1,22 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2005 Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Management of IRC lists: ban, invite, ... * $Id: lists.c,v 1.8.2.2 2002/10/04 13:12:46 alex Exp $
*
* lists.c: Verwaltung der "IRC-Listen": Ban, Invite, ...
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: lists.c,v 1.15.2.1 2005/01/26 13:27:01 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@@ -30,7 +31,6 @@ static char UNUSED id[] = "$Id: lists.c,v 1.15.2.1 2005/01/26 13:27:01 alex Exp
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include "exp.h" #include "exp.h"
#include "lists.h" #include "lists.h"
@@ -102,24 +102,19 @@ Lists_CheckInvited( CLIENT *Client, CHANNEL *Chan )
GLOBAL BOOLEAN GLOBAL BOOLEAN
Lists_IsInviteEntry( CHAR *Mask, CHANNEL *Chan ) Lists_AddInvited( CLIENT *From, CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )
{
assert( Mask != NULL );
assert( Chan != NULL );
return Already_Registered( My_Invites, Mask, Chan );
} /* Lists_IsInviteEntry */
GLOBAL BOOLEAN
Lists_AddInvited( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )
{ {
C2C *c2c; C2C *c2c;
assert( Mask != NULL ); assert( Mask != NULL );
assert( Chan != NULL ); assert( Chan != NULL );
if( Already_Registered( My_Invites, Mask, Chan )) return TRUE; if( Already_Registered( My_Invites, Mask, Chan ))
{
/* Eintrag ist bereits vorhanden */
IRC_WriteStrClient( From, RPL_INVITELIST_MSG, Client_ID( From ), Channel_Name( Chan ), Mask );
return FALSE;
}
c2c = New_C2C( Mask, Chan, OnlyOnce ); c2c = New_C2C( Mask, Chan, OnlyOnce );
if( ! c2c ) if( ! c2c )
@@ -186,40 +181,6 @@ Lists_ShowInvites( CLIENT *Client, CHANNEL *Channel )
} /* Lists_ShowInvites */ } /* Lists_ShowInvites */
GLOBAL BOOLEAN
Lists_SendInvites( CLIENT *Client )
{
C2C *c2c;
assert( Client != NULL );
c2c = My_Invites;
while( c2c )
{
if( ! IRC_WriteStrClient( Client, "MODE %s +I %s", Channel_Name( c2c->channel ), c2c->mask )) return DISCONNECTED;
c2c = c2c->next;
}
return CONNECTED;
} /* Lists_SendInvites */
GLOBAL BOOLEAN
Lists_SendBans( CLIENT *Client )
{
C2C *c2c;
assert( Client != NULL );
c2c = My_Bans;
while( c2c )
{
if( ! IRC_WriteStrClient( Client, "MODE %s +b %s", Channel_Name( c2c->channel ), c2c->mask )) return DISCONNECTED;
c2c = c2c->next;
}
return CONNECTED;
} /* Lists_SendBans */
GLOBAL BOOLEAN GLOBAL BOOLEAN
Lists_CheckBanned( CLIENT *Client, CHANNEL *Chan ) Lists_CheckBanned( CLIENT *Client, CHANNEL *Chan )
{ {
@@ -228,24 +189,19 @@ Lists_CheckBanned( CLIENT *Client, CHANNEL *Chan )
GLOBAL BOOLEAN GLOBAL BOOLEAN
Lists_IsBanEntry( CHAR *Mask, CHANNEL *Chan ) Lists_AddBanned( CLIENT *From, CHAR *Mask, CHANNEL *Chan )
{
assert( Mask != NULL );
assert( Chan != NULL );
return Already_Registered( My_Bans, Mask, Chan );
} /* Lists_IsBanEntry */
GLOBAL BOOLEAN
Lists_AddBanned( CHAR *Mask, CHANNEL *Chan )
{ {
C2C *c2c; C2C *c2c;
assert( Mask != NULL ); assert( Mask != NULL );
assert( Chan != NULL ); assert( Chan != NULL );
if( Already_Registered( My_Bans, Mask, Chan )) return TRUE; if( Already_Registered( My_Bans, Mask, Chan ))
{
/* Eintrag ist bereits vorhanden */
IRC_WriteStrClient( From, RPL_BANLIST_MSG, Client_ID( From ), Channel_Name( Chan ), Mask );
return FALSE;
}
c2c = New_C2C( Mask, Chan, FALSE ); c2c = New_C2C( Mask, Chan, FALSE );
if( ! c2c ) if( ! c2c )
@@ -360,10 +316,9 @@ Lists_DeleteChannel( CHANNEL *Chan )
GLOBAL CHAR * GLOBAL CHAR *
Lists_MakeMask( CHAR *Pattern ) Lists_MakeMask( CHAR *Pattern )
{ {
/* This function generats a valid IRC mask of "any" string. This /* Hier wird aus einem "beliebigen" Pattern eine gueltige IRC-Mask erzeugt.
* mask is only valid until the next call to Lists_MakeMask(), * Diese ist aber nur bis zum naechsten Aufruf von Lists_MakeMask() gueltig,
* because a single global buffer is used. You have to copy the * da ein einziger globaler Puffer verwendet wird. ->Umkopieren!*/
* generated mask to some sane location yourself! */
STATIC CHAR TheMask[MASK_LEN]; STATIC CHAR TheMask[MASK_LEN];
CHAR *excl, *at; CHAR *excl, *at;
@@ -377,32 +332,37 @@ Lists_MakeMask( CHAR *Pattern )
if(( ! at ) && ( ! excl )) if(( ! at ) && ( ! excl ))
{ {
/* Neither "!" nor "@" found: use string as nick name */ /* weder ! noch @<40>vorhanden: als Nick annehmen */
strlcpy( TheMask, Pattern, sizeof( TheMask ) - 5 ); strncpy( TheMask, Pattern, MASK_LEN - 5 );
strlcat( TheMask, "!*@*", sizeof( TheMask )); TheMask[MASK_LEN - 5] = '\0';
strcat( TheMask, "!*@*" );
return TheMask; return TheMask;
} }
if(( ! at ) && ( excl )) if(( ! at ) && ( excl ))
{ {
/* Domain part is missing */ /* Domain fehlt */
strlcpy( TheMask, Pattern, sizeof( TheMask ) - 3 ); strncpy( TheMask, Pattern, MASK_LEN - 3 );
strlcat( TheMask, "@*", sizeof( TheMask )); TheMask[MASK_LEN - 3] = '\0';
strcat( TheMask, "@*" );
return TheMask; return TheMask;
} }
if(( at ) && ( ! excl )) if(( at ) && ( ! excl ))
{ {
/* User name is missing */ /* User fehlt */
*at = '\0'; at++; *at = '\0'; at++;
strlcpy( TheMask, Pattern, sizeof( TheMask ) - 5 ); strncpy( TheMask, Pattern, MASK_LEN - 4 );
strlcat( TheMask, "!*@", sizeof( TheMask )); TheMask[MASK_LEN - 4] = '\0';
strlcat( TheMask, at, sizeof( TheMask )); strcat( TheMask, "!*@" );
strncat( TheMask, at, strlen( TheMask ) - MASK_LEN - 1 );
TheMask[MASK_LEN - 1] = '\0';
return TheMask; return TheMask;
} }
/* All parts (nick, user and domain name) are given */ /* alle Teile vorhanden */
strlcpy( TheMask, Pattern, sizeof( TheMask )); strncpy( TheMask, Pattern, MASK_LEN - 1 );
TheMask[MASK_LEN - 1] = '\0';
return TheMask; return TheMask;
} /* Lists_MakeMask */ } /* Lists_MakeMask */
@@ -416,14 +376,14 @@ New_C2C( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )
assert( Chan != NULL ); assert( Chan != NULL );
/* Speicher fuer Eintrag anfordern */ /* Speicher fuer Eintrag anfordern */
c2c = (C2C *)malloc( sizeof( C2C )); c2c = malloc( sizeof( C2C ));
if( ! c2c ) if( ! c2c )
{ {
Log( LOG_EMERG, "Can't allocate memory! [New_C2C]" ); Log( LOG_EMERG, "Can't allocate memory! [New_C2C]" );
return NULL; return NULL;
} }
strlcpy( c2c->mask, Mask, sizeof( c2c->mask )); strncpy( c2c->mask, Mask, MASK_LEN );
c2c->channel = Chan; c2c->channel = Chan;
c2c->onlyonce = OnlyOnce; c2c->onlyonce = OnlyOnce;

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: lists.h,v 1.11 2004/04/25 15:40:19 alex Exp $ * $Id: lists.h,v 1.8 2002/09/08 17:05:25 alex Exp $
* *
* Management of IRC lists: ban, invite, ... (header) * lists.h: Verwaltung der "IRC-Listen": Ban, Invite, ... (Header)
*/ */
@@ -22,18 +23,14 @@ GLOBAL VOID Lists_Init PARAMS(( VOID ));
GLOBAL VOID Lists_Exit PARAMS(( VOID )); GLOBAL VOID Lists_Exit PARAMS(( VOID ));
GLOBAL BOOLEAN Lists_CheckInvited PARAMS(( CLIENT *Client, CHANNEL *Chan )); GLOBAL BOOLEAN Lists_CheckInvited PARAMS(( CLIENT *Client, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_AddInvited PARAMS(( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )); GLOBAL BOOLEAN Lists_AddInvited PARAMS(( CLIENT *From, CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce ));
GLOBAL VOID Lists_DelInvited PARAMS(( CHAR *Mask, CHANNEL *Chan )); GLOBAL VOID Lists_DelInvited PARAMS(( CHAR *Mask, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_ShowInvites PARAMS(( CLIENT *Client, CHANNEL *Channel )); GLOBAL BOOLEAN Lists_ShowInvites PARAMS(( CLIENT *Client, CHANNEL *Channel ));
GLOBAL BOOLEAN Lists_SendInvites PARAMS(( CLIENT *Client ));
GLOBAL BOOLEAN Lists_IsInviteEntry PARAMS(( CHAR *Mask, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_CheckBanned PARAMS(( CLIENT *Client, CHANNEL *Chan )); GLOBAL BOOLEAN Lists_CheckBanned PARAMS(( CLIENT *Client, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_AddBanned PARAMS(( CHAR *Mask, CHANNEL *Chan )); GLOBAL BOOLEAN Lists_AddBanned PARAMS(( CLIENT *From, CHAR *Mask, CHANNEL *Chan ));
GLOBAL VOID Lists_DelBanned PARAMS(( CHAR *Mask, CHANNEL *Chan )); GLOBAL VOID Lists_DelBanned PARAMS(( CHAR *Mask, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_ShowBans PARAMS(( CLIENT *Client, CHANNEL *Channel )); GLOBAL BOOLEAN Lists_ShowBans PARAMS(( CLIENT *Client, CHANNEL *Channel ));
GLOBAL BOOLEAN Lists_SendBans PARAMS(( CLIENT *Client ));
GLOBAL BOOLEAN Lists_IsBanEntry PARAMS(( CHAR *Mask, CHANNEL *Chan ));
GLOBAL VOID Lists_DeleteChannel PARAMS(( CHANNEL *Chan )); GLOBAL VOID Lists_DeleteChannel PARAMS(( CHANNEL *Chan ));

View File

@@ -2,20 +2,21 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Logging functions * $Id: log.c,v 1.37.2.3 2002/11/04 19:18:39 alex Exp $
*
* log.c: Logging-Funktionen
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: log.c,v 1.44.2.3 2004/06/26 09:06:27 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
@@ -25,7 +26,7 @@ static char UNUSED id[] = "$Id: log.c,v 1.44.2.3 2004/06/26 09:06:27 alex Exp $"
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#ifdef SYSLOG #ifdef USE_SYSLOG
#include <syslog.h> #include <syslog.h>
#endif #endif
@@ -50,9 +51,9 @@ LOCAL VOID Wall_ServerNotice PARAMS(( CHAR *Msg ));
GLOBAL VOID GLOBAL VOID
Log_Init( VOID ) Log_Init( VOID )
{ {
#ifdef SYSLOG #ifdef USE_SYSLOG
/* Syslog initialisieren */ /* Syslog initialisieren */
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 ); openlog( PACKAGE, LOG_CONS|LOG_PID, LOG_LOCAL5 );
#endif #endif
/* Hello World! */ /* Hello World! */
@@ -85,8 +86,6 @@ Log_Init( VOID )
} }
#endif #endif
if( Init_Txt[0] ) Log( LOG_INFO, "Activating: %s.", Init_Txt ); if( Init_Txt[0] ) Log( LOG_INFO, "Activating: %s.", Init_Txt );
Error_File[0] = '\0';
} /* Log_Init */ } /* Log_Init */
@@ -97,7 +96,7 @@ Log_InitErrorfile( VOID )
* landen z.B. alle Ausgaben von assert()-Aufrufen. */ * landen z.B. alle Ausgaben von assert()-Aufrufen. */
/* Dateiname zusammen bauen */ /* Dateiname zusammen bauen */
sprintf( Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE_NAME, (LONG)getpid( )); sprintf( Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE, (LONG)getpid( ));
/* stderr umlenken */ /* stderr umlenken */
fflush( stderr ); fflush( stderr );
@@ -121,16 +120,13 @@ GLOBAL VOID
Log_Exit( VOID ) Log_Exit( VOID )
{ {
/* Good Bye! */ /* Good Bye! */
if( NGIRCd_SignalRestart ) Log( LOG_NOTICE, "%s done (restarting).", PACKAGE_NAME ); if( NGIRCd_Restart ) Log( LOG_NOTICE, "%s done (restarting).", PACKAGE );
else Log( LOG_NOTICE, "%s done.", PACKAGE_NAME ); else Log( LOG_NOTICE, "%s done.", PACKAGE );
if( Error_File[0] ) /* Error-File (stderr) loeschen */
{ if( unlink( Error_File ) != 0 ) Log( LOG_ERR, "Can't delete \"%s\": %s", Error_File, strerror( errno ));
/* Error-File (stderr) loeschen */
if( unlink( Error_File ) != 0 ) Log( LOG_ERR, "Can't delete \"%s\": %s", Error_File, strerror( errno ));
}
#ifdef SYSLOG #ifdef USE_SYSLOG
/* syslog abmelden */ /* syslog abmelden */
closelog( ); closelog( );
#endif #endif
@@ -182,10 +178,10 @@ va_dcl
if( NGIRCd_NoDaemon ) if( NGIRCd_NoDaemon )
{ {
/* auf Konsole ausgeben */ /* auf Konsole ausgeben */
fprintf( stdout, "[%d:%d] %s\n", (INT)getpid( ), Level, msg ); fprintf( stdout, "[%d] %s\n", Level, msg );
fflush( stdout ); fflush( stdout );
} }
#ifdef SYSLOG #ifdef USE_SYSLOG
else else
{ {
/* Syslog */ /* Syslog */
@@ -211,18 +207,16 @@ va_dcl
GLOBAL VOID GLOBAL VOID
Log_Init_Resolver( VOID ) Log_Init_Resolver( VOID )
{ {
#ifdef SYSLOG #ifdef USE_SYSLOG
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 ); openlog( PACKAGE, LOG_CONS|LOG_PID, LOG_LOCAL5 );
#endif #endif
Log_Resolver( LOG_DEBUG, "Resolver sub-process starting, PID %d.", getpid( ));
} /* Log_Init_Resolver */ } /* Log_Init_Resolver */
GLOBAL VOID GLOBAL VOID
Log_Exit_Resolver( VOID ) Log_Exit_Resolver( VOID )
{ {
Log_Resolver( LOG_DEBUG, "Resolver sub-process %d done.", getpid( )); #ifdef USE_SYSLOG
#ifdef SYSLOG
closelog( ); closelog( );
#endif #endif
} /* Log_Exit_Resolver */ } /* Log_Exit_Resolver */
@@ -241,11 +235,17 @@ va_dcl
{ {
/* Eintrag des Resolver in Logfile(s) schreiben */ /* Eintrag des Resolver in Logfile(s) schreiben */
#ifndef USE_SYSLOG
return;
#else
CHAR msg[MAX_LOG_MSG_LEN]; CHAR msg[MAX_LOG_MSG_LEN];
va_list ap; va_list ap;
assert( Format != NULL ); assert( Format != NULL );
if( NGIRCd_NoDaemon ) return;
#ifdef DEBUG #ifdef DEBUG
if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return; if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
#else #else
@@ -261,15 +261,9 @@ va_dcl
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap ); vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
va_end( ap ); va_end( ap );
/* Output */ /* ... und ausgeben */
if( NGIRCd_NoDaemon ) syslog( Level, msg );
{
/* Output to console */
fprintf( stdout, "[%d:%d] %s\n", (INT)getpid( ), Level, msg );
fflush( stdout );
}
#ifdef SYSLOG
else syslog( Level, msg );
#endif #endif
} /* Log_Resolver */ } /* Log_Resolver */
@@ -286,7 +280,7 @@ Wall_ServerNotice( CHAR *Msg )
c = Client_First( ); c = Client_First( );
while( c ) while( c )
{ {
if(( Client_Conn( c ) > NONE ) && ( Client_HasMode( c, 's' ))) IRC_WriteStrClient( c, "NOTICE %s :%s%s", Client_ThisServer( ), NOTICE_TXTPREFIX, Msg ); if(( Client_Conn( c ) > NONE ) && ( Client_HasMode( c, 's' ))) IRC_WriteStrClient( c, "NOTICE %s :%s", Client_ThisServer( ), Msg );
c = Client_Next( c ); c = Client_Next( c );
} }
} /* Wall_ServerNotice */ } /* Wall_ServerNotice */

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: log.h,v 1.14 2003/12/26 15:55:07 alex Exp $ * $Id: log.h,v 1.12 2002/05/27 13:09:27 alex Exp $
* *
* Logging functions (header) * log.h: Logging-Funktionen (Header)
*/ */
@@ -18,7 +19,7 @@
#define __log_h__ #define __log_h__
#ifdef SYSLOG #ifdef USE_SYSLOG
# include <syslog.h> # include <syslog.h>
#else #else
# define LOG_EMERG 0 # define LOG_EMERG 0

View File

@@ -2,20 +2,21 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Wildcard pattern matching * $Id: match.c,v 1.1 2002/06/26 15:42:58 alex Exp $
*
* match.c: Wildcard Pattern Matching
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: match.c,v 1.2 2002/12/12 12:24:18 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: match.h,v 1.2 2002/12/12 12:23:43 alex Exp $ * $Id: match.h,v 1.1 2002/06/26 15:42:58 alex Exp $
* *
* Wildcard pattern matching (header) * match.h: Wildcard Pattern Matching (Header)
*/ */

View File

@@ -1,16 +1,17 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2004 Alexander Barton <alex@barton.de> * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: messages.h,v 1.66 2004/02/28 02:18:16 alex Exp $ * $Id: messages.h,v 1.46.2.3 2002/11/04 19:27:23 alex Exp $
* *
* IRC numerics (Header) * irc.h: IRC-Befehle (Header)
*/ */
@@ -22,15 +23,7 @@
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)" #define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
#define RPL_CREATED_MSG "003 %s :This server has been started %s" #define RPL_CREATED_MSG "003 %s :This server has been started %s"
#define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s" #define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s"
#define RPL_ISUPPORT_MSG "005 %s NICKLEN=%d TOPICLEN=%d AWAYLEN=%d MAXCHANNELS=%d :are supported on this server" #define RPL_UMODEIS_MSG "211 %s +%s"
#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@%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"
#define RPL_UMODEIS_MSG "221 %s +%s"
#define RPL_LUSERCLIENT_MSG "251 %s :There are %ld users and %ld services on %ld servers" #define RPL_LUSERCLIENT_MSG "251 %s :There are %ld users and %ld services on %ld servers"
#define RPL_LUSEROP_MSG "252 %s %ld :operator(s) online" #define RPL_LUSEROP_MSG "252 %s %ld :operator(s) online"
#define RPL_LUSERUNKNOWN_MSG "253 %s %ld :unknown connection(s)" #define RPL_LUSERUNKNOWN_MSG "253 %s %ld :unknown connection(s)"
@@ -40,9 +33,6 @@
#define RPL_ADMINLOC1_MSG "257 %s :%s" #define RPL_ADMINLOC1_MSG "257 %s :%s"
#define RPL_ADMINLOC2_MSG "258 %s :%s" #define RPL_ADMINLOC2_MSG "258 %s :%s"
#define RPL_ADMINEMAIL_MSG "259 %s :%s" #define RPL_ADMINEMAIL_MSG "259 %s :%s"
#define RPL_TRACEEND_MSG "262 %s %s %s-%s.%s :End of TRACE"
#define RPL_LOCALUSERS_MSG "265 %s :Current local users: %ld, Max: %ld"
#define RPL_NETUSERS_MSG "266 %s :Current global users: %ld, Max: %ld"
#define RPL_AWAY_MSG "301 %s %s :%s" #define RPL_AWAY_MSG "301 %s %s :%s"
#define RPL_USERHOST_MSG "302 %s :" #define RPL_USERHOST_MSG "302 %s :"
@@ -52,7 +42,6 @@
#define RPL_WHOISUSER_MSG "311 %s %s %s %s * :%s" #define RPL_WHOISUSER_MSG "311 %s %s %s %s * :%s"
#define RPL_WHOISSERVER_MSG "312 %s %s %s :%s" #define RPL_WHOISSERVER_MSG "312 %s %s %s :%s"
#define RPL_WHOISOPERATOR_MSG "313 %s %s :is an IRC operator" #define RPL_WHOISOPERATOR_MSG "313 %s %s :is an IRC operator"
#define RPL_WHOWASUSER_MSG "314 %s %s %s %s * :%s"
#define RPL_ENDOFWHO_MSG "315 %s %s :End of WHO list" #define RPL_ENDOFWHO_MSG "315 %s %s :End of WHO list"
#define RPL_WHOISIDLE_MSG "317 %s %s %ld :seconds idle" #define RPL_WHOISIDLE_MSG "317 %s %s %ld :seconds idle"
#define RPL_ENDOFWHOIS_MSG "318 %s %s :End of WHOIS list" #define RPL_ENDOFWHOIS_MSG "318 %s %s :End of WHOIS list"
@@ -73,20 +62,15 @@
#define RPL_ENDOFNAMES_MSG "366 %s %s :End of NAMES list" #define RPL_ENDOFNAMES_MSG "366 %s %s :End of NAMES list"
#define RPL_BANLIST_MSG "367 %s %s %s" #define RPL_BANLIST_MSG "367 %s %s %s"
#define RPL_ENDOFBANLIST_MSG "368 %s %s :End of channel ban list" #define RPL_ENDOFBANLIST_MSG "368 %s %s :End of channel ban list"
#define RPL_ENDOFWHOWAS_MSG "369 %s %s :End of WHOWAS list"
#define RPL_MOTD_MSG "372 %s :- %s" #define RPL_MOTD_MSG "372 %s :- %s"
#define RPL_MOTDSTART_MSG "375 %s :- %s message of the day" #define RPL_MOTDSTART_MSG "375 %s :- %s message of the day"
#define RPL_ENDOFMOTD_MSG "376 %s :End of MOTD command" #define RPL_ENDOFMOTD_MSG "376 %s :End of MOTD command"
#define RPL_YOUREOPER_MSG "381 %s :You are now an IRC Operator" #define RPL_YOUREOPER_MSG "381 %s :You are now an IRC Operator"
#define RPL_YOURESERVICE_MSG "383 %s :You are service %s"
#define RPL_TIME_MSG "391 %s %s :%s"
#define ERR_NOSUCHNICK_MSG "401 %s %s :No such nick or channel name" #define ERR_NOSUCHNICK_MSG "401 %s %s :No such nick or channel name"
#define ERR_NOSUCHSERVER_MSG "402 %s %s :No such server" #define ERR_NOSUCHSERVER_MSG "402 %s %s :No such server"
#define ERR_NOSUCHCHANNEL_MSG "403 %s %s :No such channel" #define ERR_NOSUCHCHANNEL_MSG "403 %s %s :No such channel"
#define ERR_CANNOTSENDTOCHAN_MSG "404 %s %s :Cannot send to channel" #define ERR_CANNOTSENDTOCHAN_MSG "404 %s %s :Cannot send to channel"
#define ERR_TOOMANYCHANNELS_MSG "405 %s %s :You have joined too many channels"
#define ERR_WASNOSUCHNICK_MSG "406 %s %s :There was no such nickname"
#define ERR_NOORIGIN_MSG "409 %s :No origin specified" #define ERR_NOORIGIN_MSG "409 %s :No origin specified"
#define ERR_NORECIPIENT_MSG "411 %s :No receipient given (%s)" #define ERR_NORECIPIENT_MSG "411 %s :No receipient given (%s)"
#define ERR_NOTEXTTOSEND_MSG "412 %s :No text to send" #define ERR_NOTEXTTOSEND_MSG "412 %s :No text to send"
@@ -101,15 +85,12 @@
#define ERR_NOTREGISTEREDSERVER_MSG "451 %s :Connection not registered as server link" #define ERR_NOTREGISTEREDSERVER_MSG "451 %s :Connection not registered as server link"
#define ERR_NEEDMOREPARAMS_MSG "461 %s %s :Syntax error" #define ERR_NEEDMOREPARAMS_MSG "461 %s %s :Syntax error"
#define ERR_ALREADYREGISTRED_MSG "462 %s :Connection already registered" #define ERR_ALREADYREGISTRED_MSG "462 %s :Connection already registered"
#define ERR_PASSWDMISMATCH_MSG "464 %s :Invalid password" #define ERR_PASSWDMISMATCH_MSG "464 %s: Invalid password"
#define ERR_CHANNELISFULL_MSG "471 %s %s :Cannot join channel (+l)"
#define ERR_UNKNOWNMODE_MSG "472 %s: %c :is unknown mode char for %s" #define ERR_UNKNOWNMODE_MSG "472 %s: %c :is unknown mode char for %s"
#define ERR_INVITEONLYCHAN_MSG "473 %s %s :Cannot join channel (+i)" #define ERR_INVITEONLYCHAN_MSG "473 %s %s :Cannot join channel (+i)"
#define ERR_BANNEDFROMCHAN_MSG "474 %s %s :Cannot join channel (+b)" #define ERR_BANNEDFROMCHAN_MSG "474 %s %s :Cannot join channel (+b)"
#define ERR_BADCHANNELKEY_MSG "475 %s %s :Cannot join channel (+k)"
#define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied" #define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied"
#define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator" #define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator"
#define ERR_CANTKILLSERVER_MSG "483 %s :You can't kill a server!"
#define ERR_RESTRICTED_MSG "484 %s :Your connection is restricted" #define ERR_RESTRICTED_MSG "484 %s :Your connection is restricted"
#define ERR_NOOPERHOST_MSG "491 %s :Not configured for your host" #define ERR_NOOPERHOST_MSG "491 %s :Not configured for your host"
@@ -117,10 +98,6 @@
#define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\"" #define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\""
#define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users" #define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users"
#ifdef ZLIB
#define RPL_STATSLINKINFOZIP_MSG "211 %s %s %d %ld %ld/%ld %ld %ld/%ld :%ld"
#endif
#endif #endif

View File

@@ -1,21 +1,22 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2005 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Main program -- main() * $Id: ngircd.c,v 1.54.2.3 2002/11/04 19:18:39 alex Exp $
*
* ngircd.c: Hier beginnt alles ;-)
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: ngircd.c,v 1.83.2.3 2005/01/26 22:02:36 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
@@ -24,29 +25,22 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.83.2.3 2005/01/26 22:02:36 alex Exp
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <pwd.h> #include <time.h>
#include <grp.h>
#include "defines.h"
#include "resolve.h" #include "resolve.h"
#include "conn.h" #include "conn.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "conf.h" #include "conf.h"
#include "cvs-version.h" #include "defines.h"
#include "lists.h" #include "lists.h"
#include "log.h" #include "log.h"
#include "parse.h" #include "parse.h"
#include "irc.h" #include "irc.h"
#ifdef RENDEZVOUS
#include "rendezvous.h"
#endif
#include "exp.h" #include "exp.h"
#include "ngircd.h" #include "ngircd.h"
@@ -54,6 +48,8 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.83.2.3 2005/01/26 22:02:36 alex Exp
LOCAL VOID Initialize_Signal_Handler PARAMS(( VOID )); LOCAL VOID Initialize_Signal_Handler PARAMS(( VOID ));
LOCAL VOID Signal_Handler PARAMS(( INT Signal )); LOCAL VOID Signal_Handler PARAMS(( INT Signal ));
LOCAL VOID Initialize_Listen_Ports PARAMS(( VOID ));
LOCAL VOID Show_Version PARAMS(( VOID )); LOCAL VOID Show_Version PARAMS(( VOID ));
LOCAL VOID Show_Help PARAMS(( VOID )); LOCAL VOID Show_Help PARAMS(( VOID ));
@@ -61,24 +57,23 @@ LOCAL VOID Show_Help PARAMS(( VOID ));
GLOBAL int GLOBAL int
main( int argc, const char *argv[] ) main( int argc, const char *argv[] )
{ {
struct passwd *pwd;
struct group *grp;
BOOLEAN ok, configtest = FALSE; BOOLEAN ok, configtest = FALSE;
LONG pid, n; LONG pid, n;
INT i; INT i;
umask( 0077 ); umask( 0077 );
NGIRCd_SignalQuit = NGIRCd_SignalRestart = NGIRCd_SignalRehash = FALSE; NGIRCd_Restart = FALSE;
NGIRCd_NoDaemon = NGIRCd_Passive = FALSE; NGIRCd_Quit = FALSE;
NGIRCd_NoDaemon = FALSE;
NGIRCd_Passive = FALSE;
#ifdef DEBUG #ifdef DEBUG
NGIRCd_Debug = FALSE; NGIRCd_Debug = FALSE;
#endif #endif
#ifdef SNIFFER #ifdef SNIFFER
NGIRCd_Sniffer = FALSE; NGIRCd_Sniffer = FALSE;
#endif #endif
strlcpy( NGIRCd_ConfFile, SYSCONFDIR, sizeof( NGIRCd_ConfFile )); strcpy( NGIRCd_ConfFile, CONFIG_FILE );
strlcat( NGIRCd_ConfFile, CONFIG_FILE, sizeof( NGIRCd_ConfFile ));
/* Kommandozeile parsen */ /* Kommandozeile parsen */
for( i = 1; i < argc; i++ ) for( i = 1; i < argc; i++ )
@@ -92,10 +87,11 @@ main( int argc, const char *argv[] )
{ {
if( i + 1 < argc ) if( i + 1 < argc )
{ {
/* Ok, there's an parameter left */ /* Ok, danach kommt noch ein Parameter */
strlcpy( NGIRCd_ConfFile, argv[i + 1], sizeof( NGIRCd_ConfFile )); strncpy( NGIRCd_ConfFile, argv[i + 1], FNAME_LEN - 1 );
NGIRCd_ConfFile[FNAME_LEN - 1] = '\0';
/* next parameter */ /* zum uebernaechsten Parameter */
i++; ok = TRUE; i++; ok = TRUE;
} }
} }
@@ -158,10 +154,11 @@ main( int argc, const char *argv[] )
{ {
if(( ! argv[i][n + 1] ) && ( i + 1 < argc )) if(( ! argv[i][n + 1] ) && ( i + 1 < argc ))
{ {
/* Ok, next character is a blank */ /* Ok, danach kommt ein Leerzeichen */
strlcpy( NGIRCd_ConfFile, argv[i + 1], sizeof( NGIRCd_ConfFile )); strncpy( NGIRCd_ConfFile, argv[i + 1], FNAME_LEN - 1 );
NGIRCd_ConfFile[FNAME_LEN - 1] = '\0';
/* go to the following parameter */ /* zum uebernaechsten Parameter */
i++; n = (LONG)strlen( argv[i] ); i++; n = (LONG)strlen( argv[i] );
ok = TRUE; ok = TRUE;
} }
@@ -183,16 +180,11 @@ main( int argc, const char *argv[] )
ok = TRUE; ok = TRUE;
} }
#endif #endif
if( argv[i][n] == 't' )
{
configtest = TRUE;
ok = TRUE;
}
if( ! ok ) if( ! ok )
{ {
printf( "%s: invalid option \"-%c\"!\n", PACKAGE_NAME, argv[i][n] ); printf( "%s: invalid option \"-%c\"!\n", PACKAGE, argv[i][n] );
printf( "Try \"%s --help\" for more information.\n", PACKAGE_NAME ); printf( "Try \"%s --help\" for more information.\n", PACKAGE );
exit( 1 ); exit( 1 );
} }
} }
@@ -200,8 +192,8 @@ main( int argc, const char *argv[] )
} }
if( ! ok ) if( ! ok )
{ {
printf( "%s: invalid option \"%s\"!\n", PACKAGE_NAME, argv[i] ); printf( "%s: invalid option \"%s\"!\n", PACKAGE, argv[i] );
printf( "Try \"%s --help\" for more information.\n", PACKAGE_NAME ); printf( "Try \"%s --help\" for more information.\n", PACKAGE );
exit( 1 ); exit( 1 );
} }
} }
@@ -226,40 +218,8 @@ main( int argc, const char *argv[] )
exit( Conf_Test( )); exit( Conf_Test( ));
} }
while( ! NGIRCd_SignalQuit ) while( ! NGIRCd_Quit )
{ {
/* Initialize global variables */
NGIRCd_Start = time( NULL );
(VOID)strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start ));
NGIRCd_SignalRehash = FALSE;
NGIRCd_SignalRestart = FALSE;
NGIRCd_SignalQuit = FALSE;
/* Initialize modules, part I */
Log_Init( );
Conf_Init( );
if( Conf_Chroot[0] )
{
/* Chroot */
if( chdir( Conf_Chroot ) != 0 ) Log( LOG_ERR, "Can't chdir() in ChrootDir (%s): %s", Conf_Chroot, strerror( errno ));
if( chroot( Conf_Chroot ) != 0 ) Log( LOG_ERR, "Can't change root directory to \"%s\": %s", Conf_Chroot, strerror( errno ));
else Log( LOG_INFO, "Changed root and working directory to \"%s\".", Conf_Chroot );
}
if( Conf_GID != 0 )
{
/* Set new group ID */
if( setgid( Conf_GID ) != 0 ) Log( LOG_ERR, "Can't change group ID to %u: %s", Conf_GID, strerror( errno ));
}
if( Conf_UID != 0 )
{
/* Set new user ID */
if( setuid( Conf_UID ) != 0 ) Log( LOG_ERR, "Can't change user ID to %u: %s", Conf_UID, strerror( errno ));
}
/* In der Regel wird ein Sub-Prozess ge-fork()'t, der /* In der Regel wird ein Sub-Prozess ge-fork()'t, der
* nicht mehr mit dem Terminal verbunden ist. Mit der * nicht mehr mit dem Terminal verbunden ist. Mit der
* Option "--nodaemon" kann dies (z.B. zum Debuggen) * Option "--nodaemon" kann dies (z.B. zum Debuggen)
@@ -276,7 +236,7 @@ main( int argc, const char *argv[] )
if( pid < 0 ) if( pid < 0 )
{ {
/* Fehler */ /* Fehler */
printf( "%s: Can't fork: %s!\nFatal error, exiting now ...\n", PACKAGE_NAME, strerror( errno )); printf( "%s: Can't fork: %s!\nFatal error, exiting now ...\n", PACKAGE, strerror( errno ));
exit( 1 ); exit( 1 );
} }
@@ -285,26 +245,39 @@ main( int argc, const char *argv[] )
chdir( "/" ); chdir( "/" );
} }
/* Initialize modules, part II: these functions are eventually /* Globale Variablen initialisieren */
* called with already dropped privileges ... */ 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;
/* Module initialisieren */
Log_Init( );
Resolve_Init( ); Resolve_Init( );
Conf_Init( );
Lists_Init( ); Lists_Init( );
Channel_Init( ); Channel_Init( );
Client_Init( ); Client_Init( );
#ifdef RENDEZVOUS
Rendezvous_Init( );
#endif
Conn_Init( ); Conn_Init( );
/* Show user, group, and PID of the running daemon */ /* Wenn als root ausgefuehrt und eine andere UID
pwd = getpwuid( getuid( )); grp = getgrgid( getgid( )); * konfiguriert ist, jetzt zu dieser wechseln */
Log( LOG_INFO, "Running as user %s(%ld), group %s(%ld), with PID %ld.", pwd ? pwd->pw_name : "unknown", (LONG)getuid( ), grp ? grp->gr_name : "unknown", (LONG)getgid( ), (LONG)getpid( )); if( getuid( ) == 0 )
{
if( Conf_GID != 0 )
{
/* Neue Group-ID setzen */
if( setgid( Conf_GID ) != 0 ) Log( LOG_ERR, "Can't change Group-ID to %u: %s", Conf_GID, strerror( errno ));
}
if( Conf_UID != 0 )
{
/* Neue User-ID setzen */
if( setuid( Conf_UID ) != 0 ) Log( LOG_ERR, "Can't change User-ID to %u: %s", Conf_UID, strerror( errno ));
}
}
Log( LOG_INFO, "Running as user %ld, group %ld, with PID %ld.", (LONG)getuid( ), (LONG)getgid( ), (LONG)getpid( ));
/* Redirect stderr handle to "error file" for debugging. Log_InitErrorfile( );
* But don't try to write in the chroot jail, since it's more
* secure to have a chroot dir not writable by the daemon.
*/
if( ! Conf_Chroot[0] ) Log_InitErrorfile( );
/* Signal-Handler initialisieren */ /* Signal-Handler initialisieren */
Initialize_Signal_Handler( ); Initialize_Signal_Handler( );
@@ -313,39 +286,25 @@ main( int argc, const char *argv[] )
* beim PASS-Befehl verwendete Syntax sowie die erweiterten Flags * beim PASS-Befehl verwendete Syntax sowie die erweiterten Flags
* sind in doc/Protocol.txt beschrieben. */ * sind in doc/Protocol.txt beschrieben. */
#ifdef IRCPLUS #ifdef IRCPLUS
sprintf( NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE_NAME, PACKAGE_VERSION, IRCPLUSFLAGS ); sprintf( NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE, VERSION, IRCPLUSFLAGS );
#ifdef ZLIB
strcat( NGIRCd_ProtoID, "Z" );
#endif
if( Conf_OperCanMode ) strcat( NGIRCd_ProtoID, "o" ); if( Conf_OperCanMode ) strcat( NGIRCd_ProtoID, "o" );
#else #else
sprintf( NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE_NAME, PACKAGE_VERSION ); sprintf( NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE, VERSION );
#endif #endif
strcat( NGIRCd_ProtoID, " P" ); strcat( NGIRCd_ProtoID, " P" );
#ifdef ZLIB
strcat( NGIRCd_ProtoID, "Z" );
#endif
Log( LOG_DEBUG, "Protocol and server ID is \"%s\".", NGIRCd_ProtoID ); Log( LOG_DEBUG, "Protocol and server ID is \"%s\".", NGIRCd_ProtoID );
/* Vordefinierte Channels anlegen */ /* Vordefinierte Channels anlegen */
Channel_InitPredefined( ); Channel_InitPredefined( );
/* Listen-Ports initialisieren */ /* Listen-Ports initialisieren */
if( Conn_InitListeners( ) < 1 ) Initialize_Listen_Ports( );
{
Log( LOG_ALERT, "Server isn't listening on a single port!" );
Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME );
exit( 1 );
}
/* Hauptschleife */ /* Hauptschleife */
Conn_Handler( ); Conn_Handler( );
/* Alles abmelden */ /* Alles abmelden */
Conn_Exit( ); Conn_Exit( );
#ifdef RENDEZVOUS
Rendezvous_Exit( );
#endif
Client_Exit( ); Client_Exit( );
Channel_Exit( ); Channel_Exit( );
Lists_Exit( ); Lists_Exit( );
@@ -361,11 +320,7 @@ NGIRCd_Version( VOID )
{ {
STATIC CHAR version[126]; STATIC CHAR version[126];
#ifdef CVSDATE sprintf( version, "%s %s-%s", PACKAGE, VERSION, NGIRCd_VersionAddition( ));
sprintf( version, "%s %s(%s)-%s", PACKAGE_NAME, PACKAGE_VERSION, CVSDATE, NGIRCd_VersionAddition( ));
#else
sprintf( version, "%s %s-%s", PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_VersionAddition( ));
#endif
return version; return version;
} /* NGIRCd_Version */ } /* NGIRCd_Version */
@@ -373,30 +328,14 @@ NGIRCd_Version( VOID )
GLOBAL CHAR * GLOBAL CHAR *
NGIRCd_VersionAddition( VOID ) NGIRCd_VersionAddition( VOID )
{ {
STATIC CHAR txt[200]; STATIC CHAR txt[64];
strcpy( txt, "" ); strcpy( txt, "" );
#ifdef SYSLOG #ifdef USE_SYSLOG
if( txt[0] ) strcat( txt, "+" ); if( txt[0] ) strcat( txt, "+" );
strcat( txt, "SYSLOG" ); strcat( txt, "SYSLOG" );
#endif #endif
#ifdef ZLIB
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "ZLIB" );
#endif
#ifdef TCPWRAP
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "TCPWRAP" );
#endif
#ifdef RENDEZVOUS
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "RENDEZVOUS" );
#endif
#ifdef IDENTAUTH
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "IDENT" );
#endif
#ifdef DEBUG #ifdef DEBUG
if( txt[0] ) strcat( txt, "+" ); if( txt[0] ) strcat( txt, "+" );
strcat( txt, "DEBUG" ); strcat( txt, "DEBUG" );
@@ -414,54 +353,17 @@ NGIRCd_VersionAddition( VOID )
strcat( txt, "IRCPLUS" ); strcat( txt, "IRCPLUS" );
#endif #endif
if( txt[0] ) strlcat( txt, "-", sizeof( txt )); if( txt[0] ) strcat( txt, "-" );
strlcat( txt, TARGET_CPU, sizeof( txt )); strcat( txt, TARGET_CPU );
strlcat( txt, "/", sizeof( txt )); strcat( txt, "/" );
strlcat( txt, TARGET_VENDOR, sizeof( txt )); strcat( txt, TARGET_VENDOR );
strlcat( txt, "/", sizeof( txt )); strcat( txt, "/" );
strlcat( txt, TARGET_OS, sizeof( txt )); strcat( txt, TARGET_OS );
return txt; return txt;
} /* NGIRCd_VersionAddition */ } /* NGIRCd_VersionAddition */
GLOBAL VOID
NGIRCd_Rehash( VOID )
{
CHAR old_name[CLIENT_ID_LEN];
Log( LOG_NOTICE|LOG_snotice, "Re-reading configuration NOW!" );
NGIRCd_SignalRehash = FALSE;
/* Close down all listening sockets */
Conn_ExitListeners( );
/* Remember old server name */
strcpy( old_name, Conf_ServerName );
/* Re-read configuration ... */
Conf_Rehash( );
/* Recover old server name: it can't be changed during run-time */
if( strcmp( old_name, Conf_ServerName ) != 0 )
{
strcpy( Conf_ServerName, old_name );
Log( LOG_ERR, "Can't change \"ServerName\" on runtime! Ignored new name." );
}
/* Create new pre-defined channels */
Channel_InitPredefined( );
/* Start listening on sockets */
Conn_InitListeners( );
/* Sync configuration with established connections */
Conn_SyncServerStruct( );
Log( LOG_NOTICE|LOG_snotice, "Re-reading of configuration done." );
} /* NGIRCd_Rehash */
LOCAL VOID LOCAL VOID
Initialize_Signal_Handler( VOID ) Initialize_Signal_Handler( VOID )
{ {
@@ -522,30 +424,56 @@ Signal_Handler( INT Signal )
case SIGINT: case SIGINT:
case SIGQUIT: case SIGQUIT:
/* wir soll(t)en uns wohl beenden ... */ /* wir soll(t)en uns wohl beenden ... */
NGIRCd_SignalQuit = TRUE; if( Signal == SIGTERM ) Log( LOG_WARNING, "Got TERM signal, terminating now ..." );
else if( Signal == SIGINT ) Log( LOG_WARNING, "Got INT signal, terminating now ..." );
else if( Signal == SIGQUIT ) Log( LOG_WARNING, "Got QUIT signal, terminating now ..." );
NGIRCd_Quit = TRUE;
break; break;
case SIGHUP: case SIGHUP:
/* Konfiguration neu einlesen: */ /* neu starten */
NGIRCd_SignalRehash = TRUE; Log( LOG_WARNING, "Got HUP signal, restarting now ..." );
NGIRCd_Restart = TRUE;
break; break;
case SIGCHLD: case SIGCHLD:
/* Child-Prozess wurde beendet. Zombies vermeiden: */ /* Child-Prozess wurde beendet. Zombies vermeiden: */
while( waitpid( -1, NULL, WNOHANG ) > 0); while( waitpid( -1, NULL, WNOHANG ) > 0);
break; break;
#ifdef DEBUG
default: default:
/* unbekanntes bzw. unbehandeltes Signal */ /* unbekanntes bzw. unbehandeltes Signal */
Log( LOG_DEBUG, "Got signal %d! Ignored.", Signal ); Log( LOG_NOTICE, "Got signal %d! Ignored.", Signal );
#endif
} }
} /* Signal_Handler */ } /* Signal_Handler */
LOCAL VOID
Initialize_Listen_Ports( VOID )
{
/* Ports, auf denen der Server Verbindungen entgegennehmen
* soll, initialisieren */
INT created, i;
created = 0;
for( i = 0; i < Conf_ListenPorts_Count; i++ )
{
if( Conn_NewListener( Conf_ListenPorts[i] )) created++;
else Log( LOG_ERR, "Can't listen on port %u!", Conf_ListenPorts[i] );
}
if( created < 1 )
{
Log( LOG_ALERT, "Server isn't listening on a single port!" );
Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 );
}
} /* Initialize_Listen_Ports */
LOCAL VOID LOCAL VOID
Show_Version( VOID ) Show_Version( VOID )
{ {
puts( NGIRCd_Version( )); puts( NGIRCd_Version( ));
puts( "Copyright (c)2001-2005 by Alexander Barton (<alex@barton.de>)." ); puts( "Copyright (c)2001,2002 by Alexander Barton (<alex@barton.de>)." );
puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" ); puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
puts( "This is free software; see the source for copying conditions. There is NO" ); puts( "This is free software; see the source for copying conditions. There is NO" );
puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." ); puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
@@ -559,12 +487,12 @@ Show_Help( VOID )
puts( " -d, --debug log extra debug messages" ); puts( " -d, --debug log extra debug messages" );
#endif #endif
puts( " -f, --config <f> use file <f> as configuration file" ); puts( " -f, --config <f> use file <f> as configuration file" );
puts( " -n, --nodaemon don't fork and don't detach from controlling terminal" ); puts( " -n, --nodaemon don't fork and don't detatch from controlling terminal" );
puts( " -p, --passive disable automatic connections to other servers" ); puts( " -p, --passive disable automatic connections to other servers" );
#ifdef SNIFFER #ifdef SNIFFER
puts( " -s, --sniffer enable network sniffer and display all IRC traffic" ); puts( " -s, --sniffer enable network sniffer and display all IRC traffic" );
#endif #endif
puts( " -t, --configtest read, validate and display configuration; then exit" ); puts( " --configtest read, validate and display configuration; then exit" );
puts( " --version output version information and exit" ); puts( " --version output version information and exit" );
puts( " --help display this help and exit" ); puts( " --help display this help and exit" );
} /* Show_Help */ } /* Show_Help */

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: ngircd.h,v 1.19 2002/12/26 16:48:14 alex Exp $ * $Id: ngircd.h,v 1.14 2002/09/02 19:01:11 alex Exp $
* *
* Prototypes of the "main module". * ngircd.h: Prototypen aus dem "Haupt-Modul"
*/ */
@@ -37,22 +38,18 @@ GLOBAL BOOLEAN NGIRCd_NoDaemon; /* nicht im Hintergrund laufen */
GLOBAL BOOLEAN NGIRCd_Passive; /* nicht zu anderen Servern connecten */ GLOBAL BOOLEAN NGIRCd_Passive; /* nicht zu anderen Servern connecten */
GLOBAL BOOLEAN NGIRCd_SignalQuit; /* TRUE: quit server*/ GLOBAL BOOLEAN NGIRCd_Quit; /* TRUE: ngIRCd beenden */
GLOBAL BOOLEAN NGIRCd_SignalRestart; /* TRUE: restart server */ GLOBAL BOOLEAN NGIRCd_Restart; /* TRUE: neu starten */
GLOBAL BOOLEAN NGIRCd_SignalRehash; /* TRUE: reload configuration */
GLOBAL CHAR NGIRCd_DebugLevel[2]; /* Debug-Level fuer IRC_VERSION() */ GLOBAL CHAR NGIRCd_DebugLevel[2]; /* Debug-Level fuer IRC_VERSION() */
GLOBAL CHAR NGIRCd_ConfFile[FNAME_LEN]; /* Konfigurationsdatei */ GLOBAL CHAR NGIRCd_ConfFile[FNAME_LEN]; /* Konfigurationsdatei */
GLOBAL CHAR NGIRCd_ProtoID[COMMAND_LEN];/* Protokoll- und Server-Identifikation */ GLOBAL CHAR NGIRCd_ProtoID[1024]; /* Protokoll- und Server-Identifikation */
GLOBAL CHAR *NGIRCd_Version PARAMS((VOID )); GLOBAL CHAR *NGIRCd_Version PARAMS((VOID ));
GLOBAL CHAR *NGIRCd_VersionAddition PARAMS((VOID )); GLOBAL CHAR *NGIRCd_VersionAddition PARAMS((VOID ));
GLOBAL VOID NGIRCd_Rehash PARAMS(( VOID ));
#endif #endif

View File

@@ -2,30 +2,30 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* IRC command parser and validator * $Id: parse.c,v 1.41.2.2 2002/10/04 13:12:46 alex Exp $
*
* parse.c: Parsen der Client-Anfragen
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: parse.c,v 1.60 2004/01/17 03:17:49 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include "ngircd.h" #include "ngircd.h"
#include "defines.h" #include "defines.h"
#include "conn-func.h" #include "conn.h"
#include "client.h" #include "client.h"
#include "channel.h" #include "channel.h"
#include "log.h" #include "log.h"
@@ -38,7 +38,6 @@ static char UNUSED id[] = "$Id: parse.c,v 1.60 2004/01/17 03:17:49 alex Exp $";
#include "imp.h" #include "imp.h"
#include "irc.h" #include "irc.h"
#include "irc-channel.h" #include "irc-channel.h"
#include "irc-info.h"
#include "irc-login.h" #include "irc-login.h"
#include "irc-mode.h" #include "irc-mode.h"
#include "irc-op.h" #include "irc-op.h"
@@ -49,57 +48,6 @@ static char UNUSED id[] = "$Id: parse.c,v 1.60 2004/01/17 03:17:49 alex Exp $";
#include "exp.h" #include "exp.h"
COMMAND My_Commands[] =
{
{ "ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "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 },
{ "KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "NICK", IRC_NICK, 0xFFFF, 0, 0, 0 },
{ "NJOIN", IRC_NJOIN, CLIENT_SERVER, 0, 0, 0 },
{ "NOTICE", IRC_NOTICE, 0xFFFF, 0, 0, 0 },
{ "OPER", IRC_OPER, CLIENT_USER, 0, 0, 0 },
{ "PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "PASS", IRC_PASS, 0xFFFF, 0, 0, 0 },
{ "PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "PONG", IRC_PONG, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "QUIT", IRC_QUIT, 0xFFFF, 0, 0, 0 },
{ "REHASH", IRC_REHASH, CLIENT_USER, 0, 0, 0 },
{ "RESTART", IRC_RESTART, CLIENT_USER, 0, 0, 0 },
{ "SERVER", IRC_SERVER, 0xFFFF, 0, 0, 0 },
{ "SQUIT", IRC_SQUIT, CLIENT_SERVER, 0, 0, 0 },
{ "STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "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 },
{ "WHO", IRC_WHO, CLIENT_USER, 0, 0, 0 },
{ "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
#ifdef IRCPLUS
{ "CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, 0, 0 },
#endif
{ NULL, NULL, 0x0, 0, 0, 0 } /* Ende-Marke */
};
LOCAL VOID Init_Request PARAMS(( REQUEST *Req )); LOCAL VOID Init_Request PARAMS(( REQUEST *Req ));
LOCAL BOOLEAN Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed )); LOCAL BOOLEAN Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed ));
@@ -109,13 +57,6 @@ LOCAL BOOLEAN Validate_Args PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed
LOCAL BOOLEAN Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req )); LOCAL BOOLEAN Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req ));
GLOBAL COMMAND *
Parse_GetCommandStruct( VOID )
{
return My_Commands;
} /* Parse_GetCommandStruct */
GLOBAL BOOLEAN GLOBAL BOOLEAN
Parse_Request( CONN_ID Idx, CHAR *Request ) Parse_Request( CONN_ID Idx, CHAR *Request )
{ {
@@ -160,6 +101,8 @@ Parse_Request( CONN_ID Idx, CHAR *Request )
} }
else start = Request; else start = Request;
if( ! Validate_Prefix( Idx, &req, &closed )) return ! closed;
/* Befehl */ /* Befehl */
ptr = strchr( start, ' ' ); ptr = strchr( start, ' ' );
if( ptr ) if( ptr )
@@ -167,12 +110,14 @@ Parse_Request( CONN_ID Idx, CHAR *Request )
*ptr = '\0'; *ptr = '\0';
#ifndef STRICT_RFC #ifndef STRICT_RFC
/* multiple Leerzeichen als Trenner vor /* multiple Leerzeichen als Trenner vor
* Parametern ignorieren */ *Parametertrennern ignorieren */
while( *(ptr + 1) == ' ' ) ptr++; while( *(ptr + 1) == ' ' ) ptr++;
#endif #endif
} }
req.command = start; req.command = start;
if( ! Validate_Command( Idx, &req, &closed )) return ! closed;
/* Argumente, Parameter */ /* Argumente, Parameter */
if( ptr ) if( ptr )
{ {
@@ -211,9 +156,6 @@ Parse_Request( CONN_ID Idx, CHAR *Request )
} }
} }
/* Daten validieren */
if( ! Validate_Prefix( Idx, &req, &closed )) return ! closed;
if( ! Validate_Command( Idx, &req, &closed )) return ! closed;
if( ! Validate_Args( Idx, &req, &closed )) return ! closed; if( ! Validate_Args( Idx, &req, &closed )) return ! closed;
return Handle_Request( Idx, &req ); return Handle_Request( Idx, &req );
@@ -267,8 +209,8 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed )
if( ! c ) if( ! c )
{ {
/* im Prefix angegebener Client ist nicht bekannt */ /* im Prefix angegebener Client ist nicht bekannt */
Log( LOG_ERR, "Invalid prefix \"%s\", client not known (connection %d, command %s)!?", Req->prefix, Idx, Req->command ); Log( LOG_ERR, "Invalid prefix, client not known (connection %d)!?", Idx );
if( ! Conn_WriteStr( Idx, "ERROR :Invalid prefix \"%s\", client not known!?", Req->prefix )) *Closed = TRUE; if( ! Conn_WriteStr( Idx, "ERROR :Invalid prefix, client not known!?" )) *Closed = TRUE;
return FALSE; return FALSE;
} }
@@ -279,7 +221,7 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed )
{ {
/* das angegebene Prefix ist aus dieser Richtung, also /* das angegebene Prefix ist aus dieser Richtung, also
* aus der gegebenen Connection, ungueltig! */ * aus der gegebenen Connection, ungueltig! */
Log( LOG_ERR, "Spoofed prefix \"%s\" from \"%s\" (connection %d, command %s)!", Req->prefix, Client_Mask( Client_GetFromConn( Idx )), Idx, Req->command ); Log( LOG_ERR, "Spoofed prefix \"%s\" from \"%s\" (connection %d)!", Req->prefix, Client_Mask( Client_GetFromConn( Idx )), Idx );
Conn_Close( Idx, NULL, "Spoofed prefix", TRUE ); Conn_Close( Idx, NULL, "Spoofed prefix", TRUE );
*Closed = TRUE; *Closed = TRUE;
return FALSE; return FALSE;
@@ -319,8 +261,6 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
CLIENT *client, *target, *prefix; CLIENT *client, *target, *prefix;
CHAR str[LINE_LEN]; CHAR str[LINE_LEN];
BOOLEAN result;
COMMAND *cmd;
INT i; INT i;
assert( Idx >= 0 ); assert( Idx >= 0 );
@@ -330,87 +270,94 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
client = Client_GetFromConn( Idx ); client = Client_GetFromConn( Idx );
assert( client != NULL ); assert( client != NULL );
/* Statuscode? */ /* Statuscode, der geforwarded werden muss? */
if(( Client_Type( client ) == CLIENT_SERVER ) && ( strlen( Req->command ) == 3 ) && ( atoi( Req->command ) > 100 )) if(( strlen( Req->command ) == 3 ) && ( atoi( Req->command ) > 100 ))
{ {
/* Command is a status code from an other server */ /* Befehl ist ein Statuscode */
/* Determine target */ /* Zielserver ermitteln */
if( Req->argc > 0 ) target = Client_Search( Req->argv[0] ); if(( Client_Type( client ) == CLIENT_SERVER ) && ( Req->argc > 0 )) target = Client_Search( Req->argv[0] );
else target = NULL; else target = NULL;
if( ! target ) if( ! target )
{ {
/* Status code without target!? */ if( Req->argc > 0 ) Log( LOG_WARNING, "Unknown target for status code: \"%s\"", Req->argv[0] );
if( Req->argc > 0 ) Log( LOG_WARNING, "Unknown target for status code %s: \"%s\"", Req->command, Req->argv[0] ); else Log( LOG_WARNING, "Unknown target for status code!" );
else Log( LOG_WARNING, "Unknown target for status code %s!", Req->command );
return TRUE; return TRUE;
} }
if( target == Client_ThisServer( )) if( target == Client_ThisServer( ))
{ {
/* This server is the target, ignore it */
Log( LOG_DEBUG, "Ignored status code %s from \"%s\".", Req->command, Client_ID( client )); Log( LOG_DEBUG, "Ignored status code %s from \"%s\".", Req->command, Client_ID( client ));
return TRUE; return TRUE;
} }
/* Determine source */ /* Quell-Client ermitteln */
if( ! Req->prefix[0] ) if( ! Req->prefix[0] )
{ {
/* Oops, no prefix!? */ Log( LOG_WARNING, "Got status code without prefix!?" );
Log( LOG_WARNING, "Got status code %s from \"%s\" without prefix!?", Req->command, Client_ID( client ));
return TRUE; return TRUE;
} }
else prefix = Client_Search( Req->prefix ); else prefix = Client_Search( Req->prefix );
if( ! prefix ) if( ! prefix )
{ {
/* Oops, unknown prefix!? */ Log( LOG_WARNING, "Got status code from unknown source: \"%s\"", Req->prefix );
Log( LOG_WARNING, "Got status code %s from unknown source: \"%s\"", Req->command, Req->prefix );
return TRUE; return TRUE;
} }
/* Forward status code */ /* Statuscode weiterleiten */
strlcpy( str, Req->command, sizeof( str )); strcpy( str, Req->command );
for( i = 0; i < Req->argc; i++ ) for( i = 0; i < Req->argc; i++ )
{ {
if( i < Req->argc - 1 ) strlcat( str, " ", sizeof( str )); if( i < Req->argc - 1 ) strcat( str, " " );
else strlcat( str, " :", sizeof( str )); else strcat( str, " :" );
strlcat( str, Req->argv[i], sizeof( str )); strcat( str, Req->argv[i] );
} }
return IRC_WriteStrClientPrefix( target, prefix, "%s", str ); return IRC_WriteStrClientPrefix( target, prefix, "%s", str );
} }
cmd = My_Commands; if( strcasecmp( Req->command, "PASS" ) == 0 ) return IRC_PASS( client, Req );
while( cmd->name ) else if( strcasecmp( Req->command, "NICK" ) == 0 ) return IRC_NICK( client, Req );
{ else if( strcasecmp( Req->command, "USER" ) == 0 ) return IRC_USER( client, Req );
/* Befehl suchen */ else if( strcasecmp( Req->command, "SERVER" ) == 0 ) return IRC_SERVER( client, Req );
if( strcasecmp( Req->command, cmd->name ) != 0 ) else if( strcasecmp( Req->command, "NJOIN" ) == 0 ) return IRC_NJOIN( client, Req );
{ else if( strcasecmp( Req->command, "QUIT" ) == 0 ) return IRC_QUIT( client, Req );
cmd++; continue; else if( strcasecmp( Req->command, "SQUIT" ) == 0 ) return IRC_SQUIT( client, Req );
} else if( strcasecmp( Req->command, "PING" ) == 0 ) return IRC_PING( client, Req );
else if( strcasecmp( Req->command, "PONG" ) == 0 ) return IRC_PONG( client, Req );
if( Client_Type( client ) & cmd->type ) else if( strcasecmp( Req->command, "MOTD" ) == 0 ) return IRC_MOTD( client, Req );
{ else if( strcasecmp( Req->command, "PRIVMSG" ) == 0 ) return IRC_PRIVMSG( client, Req );
/* Command is allowed for this client: call it and count produced bytes */ else if( strcasecmp( Req->command, "NOTICE" ) == 0 ) return IRC_NOTICE( client, Req );
Conn_ResetWCounter( ); else if( strcasecmp( Req->command, "MODE" ) == 0 ) return IRC_MODE( client, Req );
result = (cmd->function)( client, Req ); else if( strcasecmp( Req->command, "NAMES" ) == 0 ) return IRC_NAMES( client, Req );
cmd->bytes += Conn_WCounter( ); else if( strcasecmp( Req->command, "ISON" ) == 0 ) return IRC_ISON( client, Req );
else if( strcasecmp( Req->command, "WHOIS" ) == 0 ) return IRC_WHOIS( client, Req );
/* Adjust counters */ else if( strcasecmp( Req->command, "USERHOST" ) == 0 ) return IRC_USERHOST( client, Req );
if( Client_Type( client ) != CLIENT_SERVER ) cmd->lcount++; else if( strcasecmp( Req->command, "OPER" ) == 0 ) return IRC_OPER( client, Req );
else cmd->rcount++; else if( strcasecmp( Req->command, "DIE" ) == 0 ) return IRC_DIE( client, Req );
else if( strcasecmp( Req->command, "RESTART" ) == 0 ) return IRC_RESTART( client, Req );
return result; else if( strcasecmp( Req->command, "ERROR" ) == 0 ) return IRC_ERROR( client, Req );
} else if( strcasecmp( Req->command, "LUSERS" ) == 0 ) return IRC_LUSERS( client, Req );
else else if( strcasecmp( Req->command, "LINKS" ) == 0 ) return IRC_LINKS( client, Req );
{ else if( strcasecmp( Req->command, "JOIN" ) == 0 ) return IRC_JOIN( client, Req );
/* Befehl ist fuer diesen Client-Typ nicht erlaubt! */ else if( strcasecmp( Req->command, "PART" ) == 0 ) return IRC_PART( client, Req );
return IRC_WriteStrClient( client, ERR_NOTREGISTERED_MSG, Client_ID( client )); else if( strcasecmp( Req->command, "VERSION" ) == 0 ) return IRC_VERSION( client, Req );
} else if( strcasecmp( Req->command, "KILL" ) == 0 ) return IRC_KILL( client, Req );
} else if( strcasecmp( Req->command, "AWAY" ) == 0 ) return IRC_AWAY( client, Req );
else if( strcasecmp( Req->command, "TOPIC" ) == 0 ) return IRC_TOPIC( client, Req );
else if( strcasecmp( Req->command, "WHO" ) == 0 ) return IRC_WHO( client, Req );
else if( strcasecmp( Req->command, "LIST" ) == 0 ) return IRC_LIST( client, Req );
else if( strcasecmp( Req->command, "INVITE" ) == 0 ) return IRC_INVITE( client, Req );
else if( strcasecmp( Req->command, "KICK" ) == 0 ) return IRC_KICK( client, Req );
else if( strcasecmp( Req->command, "CONNECT" ) == 0 ) return IRC_CONNECT( client, Req );
else if( strcasecmp( Req->command, "ADMIN" ) == 0 ) return IRC_ADMIN( client, Req );
#ifdef IRCPLUS
else if( strcasecmp( Req->command, "CHANINFO" ) == 0 ) return IRC_CHANINFO( client, Req );
#endif
/* Unbekannter Befehl */ /* Unbekannter Befehl */
if( Client_Type( client ) != CLIENT_SERVER ) IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );
Log( LOG_DEBUG, "Connection %d: Unknown command \"%s\", %d %s,%s prefix.", Client_Conn( client ), Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" ); Log( LOG_DEBUG, "Connection %d: Unknown command \"%s\", %d %s,%s prefix.", Client_Conn( client ), Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" );
if( Client_Type( client ) != CLIENT_SERVER ) return IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );
else return TRUE; return TRUE;
} /* Handle_Request */ } /* Handle_Request */

View File

@@ -2,15 +2,16 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: parse.h,v 1.10 2003/01/03 22:03:51 alex Exp $ * $Id: parse.h,v 1.7 2002/05/27 13:09:27 alex Exp $
* *
* IRC command parser and validator (header) * parse.h: Parsen der Client-Anfragen (Header)
*/ */
@@ -27,20 +28,8 @@ typedef struct _REQUEST /* vgl. RFC 2812, 2.3 */
} REQUEST; } REQUEST;
typedef struct _COMMAND
{
CHAR *name; /* command name */
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 */
} COMMAND;
GLOBAL BOOLEAN Parse_Request PARAMS((CONN_ID Idx, CHAR *Request )); GLOBAL BOOLEAN Parse_Request PARAMS((CONN_ID Idx, CHAR *Request ));
GLOBAL COMMAND *Parse_GetCommandStruct PARAMS(( VOID ));
#endif #endif

View File

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

View File

@@ -1,39 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: rendezvous.h,v 1.1 2003/02/23 12:02:26 alex Exp $
*
* "Rendezvous" functions (Header)
*/
#ifdef RENDEZVOUS
#ifndef __rdezvous_h__
#define __rdezvous_h__
GLOBAL VOID Rendezvous_Init( VOID );
GLOBAL VOID Rendezvous_Exit( VOID );
GLOBAL BOOLEAN Rendezvous_Register( CHAR *Name, CHAR *Type, UINT Port );
GLOBAL BOOLEAN Rendezvous_Unregister( CHAR *Name );
GLOBAL VOID Rendezvous_UnregisterListeners( VOID );
GLOBAL VOID Rendezvous_Handler( VOID );
#endif /* __rdezvous_h__ */
#endif /* RENDEZVOUS */
/* -eof- */

View File

@@ -1,21 +1,22 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Asynchronous resolver * $Id: resolve.c,v 1.3 2002/06/09 13:19:08 alex Exp $
*
* resolve.c: asyncroner Resolver
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: resolve.c,v 1.8.2.1 2004/05/15 23:52:17 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
@@ -27,12 +28,6 @@ static char UNUSED id[] = "$Id: resolve.c,v 1.8.2.1 2004/05/15 23:52:17 alex Exp
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#ifdef IDENTAUTH
#ifdef HAVE_IDENT_H
#include <ident.h>
#endif
#endif
#include "conn.h" #include "conn.h"
#include "defines.h" #include "defines.h"
#include "log.h" #include "log.h"
@@ -41,12 +36,7 @@ static char UNUSED id[] = "$Id: resolve.c,v 1.8.2.1 2004/05/15 23:52:17 alex Exp
#include "resolve.h" #include "resolve.h"
#ifdef IDENTAUTH
LOCAL VOID Do_ResolveAddr PARAMS(( struct sockaddr_in *Addr, INT Sock, INT w_fd ));
#else
LOCAL VOID Do_ResolveAddr PARAMS(( struct sockaddr_in *Addr, INT w_fd )); LOCAL VOID Do_ResolveAddr PARAMS(( struct sockaddr_in *Addr, INT w_fd ));
#endif
LOCAL VOID Do_ResolveName PARAMS(( CHAR *Host, INT w_fd )); LOCAL VOID Do_ResolveName PARAMS(( CHAR *Host, INT w_fd ));
#ifdef h_errno #ifdef h_errno
@@ -57,35 +47,31 @@ LOCAL CHAR *Get_Error PARAMS(( INT H_Error ));
GLOBAL VOID GLOBAL VOID
Resolve_Init( VOID ) Resolve_Init( VOID )
{ {
/* Initialize module */ /* Modul initialisieren */
FD_ZERO( &Resolver_FDs ); FD_ZERO( &Resolver_FDs );
} /* Resolve_Init */ } /* Resolve_Init */
#ifdef IDENTAUTH
GLOBAL RES_STAT *
Resolve_Addr( struct sockaddr_in *Addr, int Sock )
#else
GLOBAL RES_STAT * GLOBAL RES_STAT *
Resolve_Addr( struct sockaddr_in *Addr ) Resolve_Addr( struct sockaddr_in *Addr )
#endif
{ {
/* Resolve IP (asynchronous!). On errors, e.g. if the child process /* IP (asyncron!) aufloesen. Bei Fehler, z.B. wenn der
* can't be forked, this functions returns NULL. */ * Child-Prozess nicht erzeugt werden kann, wird NULL geliefert.
* Der Host kann dann nicht aufgeloest werden. */
RES_STAT *s; RES_STAT *s;
INT pid; INT pid;
/* Allocate memory */ /* Speicher anfordern */
s = (RES_STAT *)malloc( sizeof( RES_STAT )); s = malloc( sizeof( RES_STAT ));
if( ! s ) if( ! s )
{ {
Log( LOG_EMERG, "Resolver: Can't allocate memory! [Resolve_Addr]" ); Log( LOG_EMERG, "Resolver: Can't allocate memory! [Resolve_Addr]" );
return NULL; return NULL;
} }
/* Initialize pipe for result */ /* Pipe fuer Antwort initialisieren */
if( pipe( s->pipe ) != 0 ) if( pipe( s->pipe ) != 0 )
{ {
free( s ); free( s );
@@ -93,34 +79,28 @@ Resolve_Addr( struct sockaddr_in *Addr )
return NULL; return NULL;
} }
/* For sub-process */ /* Sub-Prozess erzeugen */
pid = fork( ); pid = fork( );
if( pid > 0 ) if( pid > 0 )
{ {
/* Main process */ /* Haupt-Prozess */
Log( LOG_DEBUG, "Resolver for %s created (PID %d).", inet_ntoa( Addr->sin_addr ), pid ); Log( LOG_DEBUG, "Resolver for %s created (PID %d).", inet_ntoa( Addr->sin_addr ), pid );
FD_SET( s->pipe[0], &Resolver_FDs ); FD_SET( s->pipe[0], &Resolver_FDs );
if( s->pipe[0] > Conn_MaxFD ) Conn_MaxFD = s->pipe[0]; if( s->pipe[0] > Conn_MaxFD ) Conn_MaxFD = s->pipe[0];
s->pid = pid; s->pid = pid;
s->stage = 0;
s->bufpos = 0;
return s; return s;
} }
else if( pid == 0 ) else if( pid == 0 )
{ {
/* Sub process */ /* Sub-Prozess */
Log_Init_Resolver( ); Log_Init_Resolver( );
#ifdef IDENTAUTH
Do_ResolveAddr( Addr, Sock, s->pipe[1] );
#else
Do_ResolveAddr( Addr, s->pipe[1] ); Do_ResolveAddr( Addr, s->pipe[1] );
#endif
Log_Exit_Resolver( ); Log_Exit_Resolver( );
exit( 0 ); exit( 0 );
} }
else else
{ {
/* Error! */ /* Fehler */
free( s ); free( s );
Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno )); Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
return NULL; return NULL;
@@ -131,21 +111,22 @@ Resolve_Addr( struct sockaddr_in *Addr )
GLOBAL RES_STAT * GLOBAL RES_STAT *
Resolve_Name( CHAR *Host ) Resolve_Name( CHAR *Host )
{ {
/* Resolve hostname (asynchronous!). On errors, e.g. if the child /* Hostnamen (asyncron!) aufloesen. Bei Fehler, z.B. wenn der
* process can't be forked, this functions returns NULL. */ * Child-Prozess nicht erzeugt werden kann, wird NULL geliefert.
* Der Host kann dann nicht aufgeloest werden. */
RES_STAT *s; RES_STAT *s;
INT pid; INT pid;
/* Allocate memory */ /* Speicher anfordern */
s = (RES_STAT *)malloc( sizeof( RES_STAT )); s = malloc( sizeof( RES_STAT ));
if( ! s ) if( ! s )
{ {
Log( LOG_EMERG, "Resolver: Can't allocate memory! [Resolve_Name]" ); Log( LOG_EMERG, "Resolver: Can't allocate memory! [Resolve_Name]" );
return NULL; return NULL;
} }
/* Initialize the pipe for the result */ /* Pipe fuer Antwort initialisieren */
if( pipe( s->pipe ) != 0 ) if( pipe( s->pipe ) != 0 )
{ {
free( s ); free( s );
@@ -153,22 +134,20 @@ Resolve_Name( CHAR *Host )
return NULL; return NULL;
} }
/* Fork sub-process */ /* Sub-Prozess erzeugen */
pid = fork( ); pid = fork( );
if( pid > 0 ) if( pid > 0 )
{ {
/* Main process */ /* Haupt-Prozess */
Log( LOG_DEBUG, "Resolver for \"%s\" created (PID %d).", Host, pid ); Log( LOG_DEBUG, "Resolver for \"%s\" created (PID %d).", Host, pid );
FD_SET( s->pipe[0], &Resolver_FDs ); FD_SET( s->pipe[0], &Resolver_FDs );
if( s->pipe[0] > Conn_MaxFD ) Conn_MaxFD = s->pipe[0]; if( s->pipe[0] > Conn_MaxFD ) Conn_MaxFD = s->pipe[0];
s->pid = pid; s->pid = pid;
s->stage = 0;
s->bufpos = 0;
return s; return s;
} }
else if( pid == 0 ) else if( pid == 0 )
{ {
/* Sub process */ /* Sub-Prozess */
Log_Init_Resolver( ); Log_Init_Resolver( );
Do_ResolveName( Host, s->pipe[1] ); Do_ResolveName( Host, s->pipe[1] );
Log_Exit_Resolver( ); Log_Exit_Resolver( );
@@ -176,7 +155,7 @@ Resolve_Name( CHAR *Host )
} }
else else
{ {
/* Error! */ /* Fehler */
free( s ); free( s );
Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno )); Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
return NULL; return NULL;
@@ -184,28 +163,19 @@ Resolve_Name( CHAR *Host )
} /* Resolve_Name */ } /* Resolve_Name */
#ifdef IDENTAUTH
LOCAL VOID
Do_ResolveAddr( struct sockaddr_in *Addr, int Sock, INT w_fd )
#else
LOCAL VOID LOCAL VOID
Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd ) Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd )
#endif
{ {
/* Resolver sub-process: resolve IP address and write result into /* Resolver Sub-Prozess: IP aufloesen und Ergebnis in Pipe schreiben. */
* pipe to parent. */
CHAR hostname[HOST_LEN]; CHAR hostname[HOST_LEN];
struct hostent *h; struct hostent *h;
INT len;
#ifdef IDENTAUTH
CHAR *res;
#endif
/* Resolve IP address */
Log_Resolver( LOG_DEBUG, "Now resolving %s ...", inet_ntoa( Addr->sin_addr )); Log_Resolver( LOG_DEBUG, "Now resolving %s ...", inet_ntoa( Addr->sin_addr ));
/* Namen aufloesen */
h = gethostbyaddr( (CHAR *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET ); h = gethostbyaddr( (CHAR *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET );
if( h ) strlcpy( hostname, h->h_name, sizeof( hostname )); if( h ) strcpy( hostname, h->h_name );
else else
{ {
#ifdef h_errno #ifdef h_errno
@@ -213,59 +183,38 @@ Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd )
#else #else
Log_Resolver( LOG_WARNING, "Can't resolve address \"%s\"!", inet_ntoa( Addr->sin_addr )); Log_Resolver( LOG_WARNING, "Can't resolve address \"%s\"!", inet_ntoa( Addr->sin_addr ));
#endif #endif
strlcpy( hostname, inet_ntoa( Addr->sin_addr ), sizeof( hostname )); strcpy( hostname, inet_ntoa( Addr->sin_addr ));
} }
Log_Resolver( LOG_DEBUG, "Ok, translated %s to \"%s\".", inet_ntoa( Addr->sin_addr ), hostname );
/* Write resolver result into pipe to parent */ /* Antwort an Parent schreiben */
len = strlen( hostname ); if( write( w_fd, hostname, strlen( hostname ) + 1 ) != ( strlen( hostname ) + 1 ))
hostname[len] = '\n'; len++;
if( (size_t)write( w_fd, hostname, len ) != (size_t)len )
{ {
Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno )); Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
close( w_fd ); close( w_fd );
return; return;
} }
#ifdef IDENTAUTH Log_Resolver( LOG_DEBUG, "Ok, translated %s to \"%s\".", inet_ntoa( Addr->sin_addr ), hostname );
/* Do "IDENT" (aka "AUTH") lookup and write result to parent */
Log_Resolver( LOG_DEBUG, "Doing IDENT lookup on socket %d ...", Sock );
res = ident_id( Sock, 10 );
Log_Resolver( LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"", Sock, res ? res : "" );
/* Write IDENT result into pipe to parent */
len = strlen( res ? res : "" );
if( res != NULL ) res[len] = '\n';
len++;
if( (size_t)write( w_fd, res ? res : "\n", len ) != (size_t)len )
{
Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent (IDENT): %s!", strerror( errno ));
close( w_fd );
}
free( res );
#endif
} /* Do_ResolveAddr */ } /* Do_ResolveAddr */
LOCAL VOID LOCAL VOID
Do_ResolveName( CHAR *Host, INT w_fd ) Do_ResolveName( CHAR *Host, INT w_fd )
{ {
/* Resolver sub-process: resolve name and write result into pipe /* Resolver Sub-Prozess: Name aufloesen und Ergebnis in Pipe schreiben. */
* to parent. */
CHAR ip[16]; CHAR ip[16];
struct hostent *h; struct hostent *h;
struct in_addr *addr; struct in_addr *addr;
INT len;
Log_Resolver( LOG_DEBUG, "Now resolving \"%s\" ...", Host ); Log_Resolver( LOG_DEBUG, "Now resolving \"%s\" ...", Host );
/* Resolve hostname */ /* Namen aufloesen */
h = gethostbyname( Host ); h = gethostbyname( Host );
if( h ) if( h )
{ {
addr = (struct in_addr *)h->h_addr; addr = (struct in_addr *)h->h_addr;
strlcpy( ip, inet_ntoa( *addr ), sizeof( ip )); strcpy( ip, inet_ntoa( *addr ));
} }
else else
{ {
@@ -276,16 +225,16 @@ Do_ResolveName( CHAR *Host, INT w_fd )
#endif #endif
strcpy( ip, "" ); strcpy( ip, "" );
} }
if( ip[0] ) Log_Resolver( LOG_DEBUG, "Ok, translated \"%s\" to %s.", Host, ip );
/* Write result into pipe to parent */ /* Antwort an Parent schreiben */
len = strlen( ip ); if( write( w_fd, ip, strlen( ip ) + 1 ) != ( strlen( ip ) + 1 ))
ip[len] = '\n'; len++;
if( (size_t)write( w_fd, ip, len ) != (size_t)len )
{ {
Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno )); Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
close( w_fd ); close( w_fd );
return;
} }
if( ip[0] ) Log_Resolver( LOG_DEBUG, "Ok, translated \"%s\" to %s.", Host, ip );
} /* Do_ResolveName */ } /* Do_ResolveName */
@@ -294,7 +243,7 @@ Do_ResolveName( CHAR *Host, INT w_fd )
LOCAL CHAR * LOCAL CHAR *
Get_Error( INT H_Error ) Get_Error( INT H_Error )
{ {
/* Get error message for H_Error */ /* Fehlerbeschreibung fuer H_Error liefern */
switch( H_Error ) switch( H_Error )
{ {

View File

@@ -1,16 +1,17 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* $Id: resolve.h,v 1.6.2.1 2004/05/15 23:52:17 alex Exp $ * $Id: resolve.h,v 1.2 2002/09/16 09:22:41 alex Exp $
* *
* Asynchronous resolver (header) * resolve.h: asyncroner Resolver (Header)
*/ */
@@ -18,20 +19,17 @@
#define __resolve_h__ #define __resolve_h__
#include <sys/types.h>
#include <netinet/in.h>
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
# include <sys/select.h> # include <sys/select.h>
#endif #endif
#include <sys/types.h>
#include <netinet/in.h>
typedef struct _Res_Stat typedef struct _Res_Stat
{ {
INT pid; /* PID des Child-Prozess */ INT pid; /* PID des Child-Prozess */
INT pipe[2]; /* Pipe fuer IPC */ INT pipe[2]; /* Pipe fuer IPC */
INT stage; /* Hostname/IP(0) or IDENT(1)? */
INT bufpos; /* Position in buffer */
CHAR buffer[HOST_LEN]; /* Buffer */
} RES_STAT; } RES_STAT;
@@ -40,12 +38,7 @@ GLOBAL fd_set Resolver_FDs;
GLOBAL VOID Resolve_Init PARAMS(( VOID )); GLOBAL VOID Resolve_Init PARAMS(( VOID ));
#ifdef IDENTAUTH
GLOBAL RES_STAT *Resolve_Addr PARAMS(( struct sockaddr_in *Addr, int Sock ));
#else
GLOBAL RES_STAT *Resolve_Addr PARAMS(( struct sockaddr_in *Addr )); GLOBAL RES_STAT *Resolve_Addr PARAMS(( struct sockaddr_in *Addr ));
#endif
GLOBAL RES_STAT *Resolve_Name PARAMS(( CHAR *Host )); GLOBAL RES_STAT *Resolve_Name PARAMS(( CHAR *Host ));

View File

@@ -2,20 +2,21 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* Tool functions * $Id: tool.c,v 1.9 2002/05/27 13:09:27 alex Exp $
*
* tool.c: Hilfsfunktionen, ggf. Platformabhaengig
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: tool.c,v 1.1 2003/01/13 12:20:16 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>

30
src/ngircd/tool.h Normal file
View File

@@ -0,0 +1,30 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: tool.h,v 1.8 2002/05/27 13:09:27 alex Exp $
*
* log.h: Hilfsfunktionen (Header)
*/
#ifndef __tool_h__
#define __tool_h__
GLOBAL VOID ngt_TrimStr PARAMS((CHAR *String ));
GLOBAL CHAR *ngt_LowerStr PARAMS((CHAR *String ));
#endif
/* -eof- */

View File

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

View File

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

View File

@@ -2,65 +2,43 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* test program for portab.h and friends ;-) * $Id: portabtest.c,v 1.8 2002/09/09 10:05:10 alex Exp $
*
* portabtest.c: Testprogramm fuer portab.h
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: portabtest.c,v 1.11 2003/01/04 10:40:01 alex Exp $";
#include "imp.h" #include "imp.h"
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "exp.h" #include "exp.h"
LOCAL VOID Panic PARAMS (( CHAR *Reason, INT Code ));
GLOBAL int GLOBAL int
main( VOID ) main( VOID )
{ {
/* validate datatypes */ /* Datentypen pruefen */
if( FALSE != 0 ) Panic( "FALSE", 1 ); if( FALSE != 0 ) return 1;
if( TRUE != 1 ) Panic( "TRUE", 1 ); if( TRUE != 1 ) return 1;
if( sizeof( INT8 ) != 1 ) Panic( "INT8", 1 ); if( sizeof( INT8 ) != 1 ) return 1;
if( sizeof( UINT8 ) != 1 ) Panic( "UINT8", 1 ); if( sizeof( UINT8 ) != 1 ) return 1;
if( sizeof( INT16 ) != 2 ) Panic( "INT16", 1 ); if( sizeof( INT16 ) != 2 ) return 1;
if( sizeof( UINT16 ) != 2 ) Panic( "UINT16", 1 ); if( sizeof( UINT16 ) != 2 ) return 1;
if( sizeof( INT32 ) != 4 ) Panic( "INT32", 1 ); if( sizeof( INT32 ) != 4 ) return 1;
if( sizeof( UINT32 ) != 4 ) Panic( "UINT32", 1 ); if( sizeof( UINT32 ) != 4 ) return 1;
#ifdef PROTOTYPES /* kein Fehler */
/* check functions */
if( ! snprintf ) Panic( "snprintf", 2 );
if( ! vsnprintf ) Panic( "vsnprintf", 2 );
if( ! strlcpy ) Panic( "strlcpy", 2 );
if( ! strlcat ) Panic( "strlcat", 2 );
#endif
/* ok, no error */
return 0; return 0;
} /* portab_check_types */ } /* portab_check_types */
LOCAL VOID
Panic( CHAR *Reason, INT Code )
{
/* Oops, something failed!? */
fprintf( stderr, "Oops, test for %s failed!?", Reason );
exit( Code );
} /* Panic */
/* -eof- */ /* -eof- */

View File

@@ -1,76 +0,0 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* strlcpy() and strlcat() replacement functions.
* See <http://www.openbsd.org/papers/strlcpy-paper.ps> for details.
*
* Code partially borrowed from compat.c of rsync, written by Andrew
* Tridgell (1998) and Martin Pool (2002):
* <http://samba.anu.edu.au/rsync/doxygen/head/lib_2compat_8c.html>
*/
#include "portab.h"
static char UNUSED id[] = "$Id: strlcpy.c,v 1.2.4.1 2005/01/18 09:09:05 alex Exp $";
#include "imp.h"
#include <string.h>
#include <sys/types.h>
#include "exp.h"
#ifndef HAVE_STRLCAT
GLOBAL size_t
strlcat( CHAR *dst, CONST CHAR *src, size_t size )
{
/* Like strncat() but does not 0 fill the buffer and
* always null terminates. */
size_t len1 = strlen( dst );
size_t len2 = strlen( src );
size_t ret = len1 + len2;
if( len1 + len2 >= size ) len2 = size - ( len1 + 1 );
if( len2 > 0 )
{
memcpy( dst + len1, src, len2 );
dst[len1 + len2] = 0;
}
return ret;
} /* strlcat */
#endif
#ifndef HAVE_STRLCPY
GLOBAL size_t
strlcpy( CHAR *dst, CONST CHAR *src, size_t size )
{
/* Like strncpy but does not 0 fill the buffer and
* always null terminates. */
size_t len = strlen( src );
size_t ret = len;
if( size <= 0 ) return 0;
if( len >= size ) len = size - 1;
memcpy( dst, src, len );
dst[len] = 0;
return ret;
} /* strlcpy */
#endif
/* -eof- */

View File

@@ -2,20 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* it under the terms of the GNU General Public License as published by * der GNU General Public License (GPL), wie von der Free Software Foundation
* the Free Software Foundation; either version 2 of the License, or * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* (at your option) any later version. * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Please read the file COPYING, README and AUTHORS for more information. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* *
* snprintf() and vsnprintf() replacement functions * $Id: vsnprintf.c,v 1.3 2002/05/27 13:01:04 alex Exp $
*
* vsnprintf.c: u.a. Ersatz fuer vsnprintf()
*/ */
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: vsnprintf.c,v 1.5 2003/04/21 10:53:38 alex Exp $";
#include "imp.h" #include "imp.h"
#include "exp.h" #include "exp.h"
@@ -98,7 +98,6 @@ static char UNUSED id[] = "$Id: vsnprintf.c,v 1.5 2003/04/21 10:53:38 alex Exp $
/* only include stdio.h if we are not re-defining snprintf or vsnprintf */ /* only include stdio.h if we are not re-defining snprintf or vsnprintf */
#include <stdio.h> #include <stdio.h>
/* make the compiler happy with an empty file */ /* make the compiler happy with an empty file */
void dummy_snprintf PARAMS(( void ));
void dummy_snprintf PARAMS(( void )) { } void dummy_snprintf PARAMS(( void )) { }
#else #else

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