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

Compare commits

...

173 Commits

Author SHA1 Message Date
Alexander Barton
a9823b2db1 ngIRCd 0.8.3 2005-02-03 10:16:25 +00:00
Alexander Barton
3563147514 Fixed a bug that could case a root exploit when the daemon is compiled
to do IDENT lookups and is logging to syslog. Bug discovered by CoKi,
<coki@nosystem.com.ar>, thanks a lot! [from HEAD.]
(http://www.nosystem.com.ar/advisories/advisory-11.txt)
2005-02-03 09:27:09 +00:00
Alexander Barton
81d21d4592 "ngIRCd" instead of "ngircd" ... 2005-02-03 09:20:58 +00:00
Alexander Barton
117cc7055d Updated config.guess and config.sub 2005-01-27 00:15:15 +00:00
Alexander Barton
7f1a44dd40 Fixed wrong maintainer name ... 2005-01-27 00:01:10 +00:00
Alexander Barton
51e5d9d74d Ooops, bad email address ... 2005-01-26 22:18:48 +00:00
Alexander Barton
93a0179a34 ngIRCd package 0.8.2-0ab1 2005-01-26 22:16:50 +00:00
Alexander Barton
314cf1238b ngIRCd 0.8.2 2005-01-26 22:05:26 +00:00
Alexander Barton
286b29ffcd We are in the year 2005 now! :-) 2005-01-26 22:02:36 +00:00
Alexander Barton
2283454917 Added doc/SSL.txt (from CVS HEAD) to 0.8.x branch. 2005-01-26 21:47:47 +00:00
Alexander Barton
f0b3a9cacd Fixed a buffer overflow that could cause the daemon to crash. Bug found
by Florian Westphal, <westphal@foo.fh-furtwangen.de>. [from HEAD]
2005-01-26 13:27:01 +00:00
Alexander Barton
9dc7666eed Updated list of contributors. 2005-01-26 13:26:41 +00:00
Alexander Barton
87ce4379e8 Fixed a possible buffer underrun when reading the MOTD file. Thanks to
Florian Westphal, <westphal@foo.fh-furtwangen.de>. [from HEAD].
2005-01-24 14:22:30 +00:00
Alexander Barton
0eb7ad58d0 Fixed detection of IRC lines which are too long to send. Detected by
Florian Westphal, <westphal@foo.fh-furtwangen.de>. [from HEAD]
2005-01-19 23:35:42 +00:00
Alexander Barton
883251ca05 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 :-/ [HEAD]
2005-01-18 09:09:05 +00:00
Alexander Barton
e04d74ad3b Version 0.8.1 2004-12-25 00:20:57 +00:00
Alexander Barton
002d9299a6 Updated config.guess and config.sub [from HEAD]. 2004-12-25 00:11:42 +00:00
Alexander Barton
33cec4efd9 Added some more debug code ... [from HEAD]. 2004-12-25 00:00:42 +00:00
Alexander Barton
0999dc7907 Updated list of supported/tested platforms. 2004-11-09 10:58:01 +00:00
Alexander Barton
35fe11fea4 Fixed wrong variable names in output of "ngircd --configtest". [From HEAD]. 2004-09-27 11:30:52 +00:00
Alexander Barton
180fdb542b Added functions.inc to EXTRA_DIST files. [From HEAD]. 2004-09-08 09:45:53 +00:00
Alexander Barton
9cb9cca536 Fixed echo without newline for systems not understanding "echo -n"; added
new file "functions.inc" for functions usable by all test scripts. [From HEAD].
2004-09-06 22:07:26 +00:00
Alexander Barton
593cc7b4e2 Reverted extension of the "make all" target in the test-suite. 2004-09-06 20:35:00 +00:00
Alexander Barton
0be284db30 Fixed wrong exit code check of "kill -0". [From HEAD]. 2004-09-06 20:30:43 +00:00
Alexander Barton
e2e89067ae Changed version number to reflect CVS branch-0-8-x. 2004-09-06 00:41:34 +00:00
Alexander Barton
f632ca2645 ed name of "default file" for ngircd-full package. And do the test if
the binary is executable after reading this file. [From HEAD].
2004-09-06 00:36:49 +00:00
Alexander Barton
12497e1dd2 Updated documentation. 2004-09-04 20:50:53 +00:00
Alexander Barton
cabd09d9ae Updated "test suite". From HEAD. 2004-09-04 20:49:36 +00:00
Alexander Barton
98b92e112a Information for configuring ngIRCd. From HEAD. 2004-09-03 20:02:02 +00:00
Alexander Barton
2d524b1958 Fixed wrong email address. 2004-07-28 16:03:42 +00:00
Alexander Barton
d989166d3f Added missing commas to debian control file, fixes bug #56.
Thanks to Kevin Otte (nivex@nivex.net) for the patch.
2004-07-15 08:59:09 +00:00
Alexander Barton
f7c63e9237 Debian package version 0.8.0-0ab1 2004-06-26 09:27:29 +00:00
Alexander Barton
0958133a0a ngIRCd 0.8.0 2004-06-26 09:19:58 +00:00
Alexander Barton
205fea28b3 Updated documentation. 2004-06-26 09:12:38 +00:00
Alexander Barton
8cd18eb6b4 Added cast to integer for Solaris. 2004-06-26 09:06:27 +00:00
Alexander Barton
7f66fd908e Fixed wrong buffer size calculation for resolver results. 2004-05-30 16:24:21 +00:00
Alexander Barton
3c33a41fe8 Version 0.8.0-pre2 2004-05-15 23:55:48 +00:00
Alexander Barton
0d0cdf4831 Fixed host name lookups when using IDENT user lookups. 2004-05-15 23:52:17 +00:00
Alexander Barton
030fef4a8a Enhanced logging to console when running in "no-detached mode": added PID
and log messages of resolver sub-processes. [from HEAD]
2004-05-15 23:51:13 +00:00
Alexander Barton
15d31d31db "make clean" and "make maintainer-clean" remove more files now. [from HEAD] 2004-05-11 00:38:17 +00:00
Alexander Barton
2a3ec21702 Version 0.8.0-pre1 2004-05-07 11:56:19 +00:00
Alexander Barton
9f9576ce31 New "chroot" feature (from Benjamin Pineau), introducing new configuration
variables "ChrootDir" and "MotdPhrase". [from HEAD]
2004-05-07 11:24:17 +00:00
Alexander Barton
7281b8dd4d New "chroot" feature (from Benjamin Pineau), introducing new configuration
variables "ChrootDir" and "MotdPhrase".
2004-05-07 11:19:20 +00:00
Alexander Barton
39fc76c4e4 Overview of "contributed" files. 2004-04-28 12:18:50 +00:00
Alexander Barton
a6d51c3a9e Added "README" and "systrace.policy" files. 2004-04-28 12:18:02 +00:00
Alexander Barton
18b2227a0a systrace policy for OpenBSD/NetBSD, thanks to Benjamin Pineau <ben@zouh.org> 2004-04-28 12:16:59 +00:00
Alexander Barton
47701feb08 New debian version including updates from CVS HEAD. 2004-04-25 23:57:19 +00:00
Alexander Barton
59b903f3bb Updated documentation. 2004-04-25 15:51:15 +00:00
Alexander Barton
d433eb3896 Add flag "L" to default IRC+ server flags: synchronize INVITE-
and BAN-lists.
2004-04-25 15:46:50 +00:00
Alexander Barton
c1e9841118 Document new server flag "L": synchronize INVITE- and
BAN-lists when establishing new server links.
2004-04-25 15:44:10 +00:00
Alexander Barton
dd59820051 Synchronize INVITE- and BAN-lists if the peer requests it:
server flag "L". And better debug logging.
2004-04-25 15:43:18 +00:00
Alexander Barton
967476799f Don't send MODE changes when origin is a server and
mask is already known.
2004-04-25 15:42:05 +00:00
Alexander Barton
6b1e322865 New functions: Lists_SendInvites(), Lists_IsInviteEntry(), 2004-04-25 15:40:19 +00:00
Alexander Barton
1d8da4b525 Fixed a wrong assert() which could cause the daemon to exit spuriously
when closing down connections.
2004-04-25 14:06:11 +00:00
Alexander Barton
292c7bd4c0 Better logging of decompression errors returned by zlib. 2004-04-25 13:55:34 +00:00
Alexander Barton
558fe6b453 Special handling for HP/UX: define _XOPEN_SOURCE_EXTENDED ... 2004-04-11 13:20:24 +00:00
Alexander Barton
bed119c9e5 New debian package. 2004-04-09 21:58:24 +00:00
Alexander Barton
64d330b726 Fixed handling of already existent entries in invite and ban lists:
the attempt to add an already existent entry is no error, it must
be propagated across servers (but not added to the list!).
2004-04-09 21:41:52 +00:00
Alexander Barton
cc25c52048 Updated XCode project for Mac OS X. 2004-04-09 20:48:27 +00:00
Alexander Barton
233210b906 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.
2004-04-09 20:46:46 +00:00
Alexander Barton
f68e92eb9a The command to test for the autoconf/automake tools is detected now as well. 2004-04-05 12:02:21 +00:00
Alexander Barton
b225081c2b Added DG/UX (m88k/dg/dgux5.4R3.10) to the list. 2004-04-05 11:11:05 +00:00
Alexander Barton
30bbc5e1e1 New debian package ;-) 2004-04-05 11:10:31 +00:00
Alexander Barton
0c07eb71a7 Updated manual page to reflect changes in daemon. 2004-04-05 10:59:10 +00:00
Alexander Barton
0b1202cd9e Use "which" when available; understand "GO=0"; made "VERBOSE=1" more verbose. 2004-03-19 11:47:51 +00:00
Alexander Barton
8212662d9d Enhanced autogen.sh script; added "inline" documentation. 2004-03-15 20:32:31 +00:00
Alexander Barton
f697923c48 Fixed detection of GNU C version and usability of __attribute__. 2004-03-15 19:26:39 +00:00
Alexander Barton
af77ce70b6 Added missing "return 0" ... oops. 2004-03-15 18:59:12 +00:00
Alexander Barton
507a9e9cb3 Reworked configure system: it should be more compatible to most systems
now, and it should even be more flexible and faster :-)
2004-03-11 22:21:20 +00:00
Alexander Barton
779446298c New upstream version. 2004-03-11 22:18:28 +00:00
Alexander Barton
cb76d96efb Fixed some warnings of non-gcc-compilers (e. g. original Apple compiler on
A/UX): "warning: illegal pointer combination, op =".
2004-03-11 22:16:31 +00:00
Alexander Barton
de1489b39b Updated tests to reflect last changes to MODE behaviour. 2004-03-10 20:40:06 +00:00
Alexander Barton
5155e1c67a Updated XCode project, added missing Makefile template for MacOXD directory. 2004-02-29 17:36:20 +00:00
Alexander Barton
1e9a958324 Added XCode project files (for Mac OS X) to "contrib" directory. 2004-02-29 17:19:43 +00:00
Alexander Barton
56227abc5e 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.
2004-02-29 16:28:44 +00:00
Alexander Barton
f9e651b333 New Debian version. 2004-02-28 02:25:21 +00:00
Alexander Barton
bdaf53e799 Fixed TRACE: don't output "Serv" lines for ourself; display more info. 2004-02-28 02:18:16 +00:00
Alexander Barton
33f4e6763b Better logging while establishing and shutting down connections.
Results of the resolver are now discarded after the client is registered.
2004-02-28 02:01:01 +00:00
Alexander Barton
eaa550d690 Updated list of supported operating systems. 2004-02-24 00:37:42 +00:00
Alexander Barton
f275c66e95 Updated statistics :-) 2004-02-23 13:42:46 +00:00
Alexander Barton
17fffea873 Updated documentation (-t switch). 2004-02-22 22:12:44 +00:00
Alexander Barton
1e3363d2a4 Included updates of ngIRCd 0.7.7 2004-02-05 14:27:16 +00:00
Alexander Barton
6667bb6b77 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.
2004-02-04 19:56:04 +00:00
Alexander Barton
b90bedbcb2 Fixed (optional) TCP Wrapper test which was broken and could result in
false results. Thanks to Fuminori Tanizaki <tany@mcnet.ad.jp>!
2004-02-03 20:28:30 +00:00
Alexander Barton
c2a154a33e New debian version. 2004-01-26 03:09:20 +00:00
Alexander Barton
6bbc086760 Updated some copyright notices to include the year 2004. 2004-01-26 02:23:54 +00:00
Alexander Barton
bb98fd8c85 The type of service (TOS) of all sockets is set to "interactive" now. 2004-01-25 16:06:34 +00:00
Alexander Barton
e9b0ec9148 Removed some debug code; translated some source code comments. 2004-01-19 21:54:59 +00:00
Alexander Barton
c53903eb3f Use "__attribute__" only if gcc is at least version 2.7 2004-01-17 03:22:46 +00:00
Alexander Barton
57c7e23622 Added #include for strings.h to fix compiler warnings. 2004-01-17 03:17:49 +00:00
Alexander Barton
cdb694aeb3 Added #include for strings.h and added some casts to remove compiler warnings. 2004-01-17 03:17:00 +00:00
Alexander Barton
6cafa16a56 Fixed order of #include's: time.h moves up! ;-) 2004-01-17 03:15:45 +00:00
Alexander Barton
5589ebd9c3 Clean up files for "ngircd-full" package, too ... 2004-01-13 01:10:11 +00:00
Alexander Barton
f645e5b62e Adjusted copyright notice to include 2004. 2004-01-02 19:23:30 +00:00
Alexander Barton
ad07c94c8d 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.
2004-01-01 22:24:48 +00:00
Alexander Barton
5a9c04619f Changes for new source code layout: contrib/Debian/. 2003-12-31 17:31:03 +00:00
Alexander Barton
ed94d5d5cd Removed outdated Mac OS X ProjectBuilder project files (will be re-added
and updated for XCode soon); moved the debian/ directory to contrib/Debian/.
2003-12-31 17:20:11 +00:00
Alexander Barton
ea076a28f2 Added some files to the maintainer-clean-local target which havn't beed
removed by "make maintainer-clean".
2003-12-31 17:09:40 +00:00
Alexander Barton
c9ccb66944 Added new short command line option "-t" as alternative to "--configtest". 2003-12-29 14:53:26 +00:00
Alexander Barton
cb6279f102 Added IDENT option to version string. 2003-12-27 13:09:24 +00:00
Alexander Barton
b79b315dd4 Added optional support for IDENT lookups (configure switch "--with-ident"). 2003-12-27 13:01:12 +00:00
Alexander Barton
c40592d2ce Removed "USE_" prefixes of configuration #defines. 2003-12-26 15:55:07 +00:00
Alexander Barton
05170bc94c Fixed error messages related to server name configuration; updated
sample configuration file. (from 0.7.x)
2003-12-19 14:32:59 +00:00
Alexander Barton
07ad774f0a Changes for version 0.7.6 2003-12-05 13:40:44 +00:00
Alexander Barton
a8da1afe05 Added missing postinst file to distribution list. (from branch-0-7-x) 2003-12-05 13:32:11 +00:00
Alexander Barton
ff2c1efae8 Fixed abort() when inviting users to nonexistent channels. 2003-12-05 11:57:28 +00:00
Alexander Barton
05e2c0f048 Extended version reporting of CVS builds. 2003-12-04 14:05:16 +00:00
Alexander Barton
d329a961bd Updated, corrected and extended (examples!) protocol documentation. 2003-11-30 20:30:56 +00:00
Alexander Barton
606cdb69bf Updated RPM and Debian package description and configuration. 2003-11-29 20:29:09 +00:00
Alexander Barton
a5695e7ef8 Updated config.guess and config.sub to new upstream versions. 2003-11-28 15:31:49 +00:00
Alexander Barton
2978b5edff Changes from branch-0-7-x for version 0.7.5. 2003-11-07 21:32:15 +00:00
Alexander Barton
be79fabcbf Fixed ban behavior: users which are banned from a channel can't no longer
send PRIVMSG's to this channel (fixes Bug #47).
2003-11-06 01:07:44 +00:00
Alexander Barton
ec2f16fa16 Fixed test suite: allow more connections ;-) 2003-11-05 23:31:43 +00:00
Alexander Barton
7b6e26628a Fixed and enhanced penalty handling; changed internal time resoluiton of
the server to one second. Code cleanup.
2003-11-05 23:24:48 +00:00
Alexander Barton
2981fe9eb7 New configuration option "MaxConnectionsIP". 2003-11-05 21:41:01 +00:00
Alexander Barton
20d002e155 Fixed build problems under Mac OS X 10.3 "Panther". 2003-11-04 00:41:06 +00:00
Alexander Barton
cfe6356531 Use "-pipe" when compiling with gcc, speeds things up a little :-) 2003-10-19 23:03:34 +00:00
Alexander Barton
e33ab90379 New configuration option "Listen" to bind the server to a specific ip. 2003-09-11 12:05:28 +00:00
Alexander Barton
d8f3c2b42b Suppress misleading error message of diff during make run. 2003-09-09 13:24:41 +00:00
Alexander Barton
3debe00581 Updated and fixed project file for Mac OS X ProjectBuilder.app 2003-09-03 11:54:21 +00:00
Alexander Barton
eb6113fc33 Updated documentation. 2003-09-02 16:09:29 +00:00
Alexander Barton
166c610957 Updated documentation. 2003-08-30 20:37:15 +00:00
Alexander Barton
b9f16c9635 Fixed typo in debug output. 2003-08-30 20:28:54 +00:00
Alexander Barton
1ed708ef39 Enhanced testsuite, should run under GNU/Hurd now. 2003-08-22 11:31:18 +00:00
Alexander Barton
5e4124d38d New Debian package for 0.7.1 2003-07-18 20:59:48 +00:00
Alexander Barton
0d00ce6e38 Updated documentation (for release 0.7.1). 2003-07-18 20:59:34 +00:00
Alexander Barton
057df41a9b Updated documentation. 2003-07-18 20:46:17 +00:00
Alexander Barton
5eb89619d6 Added debian packaging files from branch-0-7-x to HEAD. 2003-07-12 23:27:37 +00:00
Alexander Barton
6e03626eed Included debian/-subdirectory into build system. 2003-07-09 21:16:33 +00:00
Alexander Barton
d9efbe80e1 Updated debian changelog. 2003-07-09 20:41:32 +00:00
Alexander Barton
da9456dbca Included debian/-subdirectory with files required to build Debian packages. 2003-07-09 20:23:35 +00:00
Alexander Barton
ac9390f08c Updated config.guess and config.sub to newer upstream versions. 2003-07-09 20:13:17 +00:00
Alexander Barton
3f602e5a25 Updated ChangeLog. 2003-07-09 18:48:49 +00:00
Alexander Barton
6647da58fc NJOIN: Fixed propagation of user channel modes. 2003-07-09 18:45:56 +00:00
Alexander Barton
225a338139 Added SunOS 5.7 (Solaris 7). 2003-07-06 15:47:27 +00:00
Alexander Barton
bfdf17ff32 - Updated documentation. 2003-06-08 11:11:20 +00:00
Alexander Barton
260b8e5f36 VERSION shows the CVS date if apropriate now. 2003-06-06 20:46:11 +00:00
Alexander Barton
9a009b24da Fixed a compiler warning related to an unnecessary assert(). 2003-06-05 10:48:13 +00:00
Alexander Barton
83765a5a34 Updated documentation. 2003-05-15 21:47:57 +00:00
Alexander Barton
bdc08ae28e Updated documentation. 2003-05-15 21:33:47 +00:00
Alexander Barton
34ede2a91a Added support for GNU/Hurd. 2003-05-05 00:33:32 +00:00
Alexander Barton
0424747e95 Made Makefiles more compatible with "make -j<N>". 2003-05-03 16:29:57 +00:00
Alexander Barton
8d5e170091 Fixed typo: .IT instead of the correct.TP ... 2003-05-02 20:51:42 +00:00
Alexander Barton
68ee133f87 Changed version string to "CVSHEAD". 2003-05-01 10:17:50 +00:00
Alexander Barton
27cd1e0d05 Updated documentation (ngIRCd 0.7.0). 2003-05-01 10:17:24 +00:00
Goetz Hoffart
3dc4c92553 Added HP-UX 9.10/m68k. 2003-04-30 21:03:01 +00:00
Goetz Hoffart
188e95f680 Fixed small typo. 2003-04-29 13:37:36 +00:00
Goetz Hoffart
c5f4e9d095 Added "Why should I use ngIRCd?" 2003-04-29 13:36:55 +00:00
Alexander Barton
e541da2a8f "ServerName" is checked better now: a dot (".") is required. 2003-04-29 12:36:09 +00:00
Alexander Barton
e55399c667 The KILL comand verifies and logs more parameters. 2003-04-29 12:19:20 +00:00
Alexander Barton
e7102559b9 Updated documentation. 2003-04-28 00:14:48 +00:00
Alexander Barton
32f8eb46ee Updated documentation. 2003-04-27 11:48:06 +00:00
Alexander Barton
0e01a37a69 Fixed --configtest: there is no variable "ServerPwd", it's "Password". 2003-04-27 11:46:52 +00:00
Alexander Barton
927e626f03 Documented missing "Password" variable in section "[Global]". 2003-04-27 11:45:27 +00:00
Alexander Barton
277a048f4f Updated documentation. 2003-04-25 16:59:02 +00:00
Alexander Barton
dd0b37690b Updated documentation. 2003-04-25 16:49:11 +00:00
Alexander Barton
83194a23a3 The server tried to connect to other servers only once when DNS or socket
failures occured.
2003-04-25 16:47:52 +00:00
Alexander Barton
a1ff081b8a Updated documentation. 2003-04-25 15:05:40 +00:00
Alexander Barton
e1c70a3c93 Disabling "-ansi" on Cygwin: system headers are incompatible. 2003-04-25 15:04:43 +00:00
Alexander Barton
c43d47d69c Updated documentation: added i686/pc/cygwin platform. 2003-04-23 23:18:17 +00:00
Alexander Barton
bbf978dbcf Detecting broken gcc used by Mac OS X and disabling "-pedantic" in this case. 2003-04-23 01:07:59 +00:00
Alexander Barton
090756523e Updated documentation. 2003-04-23 01:07:16 +00:00
Alexander Barton
8497d28fba Updated documentation. 2003-04-22 23:55:06 +00:00
Alexander Barton
cef95681ff Added new documentation file "Platforms.txt". 2003-04-22 23:50:18 +00:00
Alexander Barton
52a24c4bbd New documentation file doc/Platforms.txt included. 2003-04-22 23:47:39 +00:00
Alexander Barton
e2968dd98d Updated documentation. 2003-04-22 20:42:28 +00:00
Alexander Barton
79b9592f27 Updated documentation. 2003-04-22 19:35:05 +00:00
Alexander Barton
0551f688f6 Made scripts mor portable (run on SunOS 5.6 now). 2003-04-22 19:27:50 +00:00
Alexander Barton
c74ac55832 Updated documentation. 2003-04-22 18:45:19 +00:00
Alexander Barton
b4dc216db3 Added defines for SunOS (5.6). 2003-04-22 18:44:03 +00:00
Alexander Barton
cbf87971a4 Made setting of WANT_AUTOMAKE more portable. 2003-04-22 10:15:46 +00:00
Alexander Barton
4d656d12e9 Updated documentation. 2003-04-21 23:31:39 +00:00
Alexander Barton
da78dc4785 Updated documentation. 2003-04-21 22:52:18 +00:00
82 changed files with 4944 additions and 2531 deletions

19
AUTHORS
View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton,
(c)2001-2005 Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -12,15 +12,24 @@
Main Authors
~~~~~~~~~~~~
Alexander Barton, <alex@barton.de>, "alex"
Alexander Barton, <alex@barton.de> (alex)
Contributors
~~~~~~~~~~~~
Goetz Hoffart, <goetz@hoffart.de>
Ilja Osthoff, <i.osthoff@gmx.net>
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.5 2003/04/21 21:33:18 alex Exp $
$Id: AUTHORS,v 1.8.2.2 2005/01/26 13:26:41 alex Exp $

134
ChangeLog
View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton,
(c)2001-2005 Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -10,8 +10,136 @@
-- ChangeLog --
ngIRCd CVS-HEAD
ngIRCd 0.8.3 (2005-02-03)
- Fixed a bug that could case a root exploit when the daemon is compiled
to do IDENT lookups and is logging to syslog. Bug discovered by CoKi,
<coki@nosystem.com.ar>, thanks a lot!
(http://www.nosystem.com.ar/advisories/advisory-11.txt)
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>.
nIRCd 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
@@ -433,4 +561,4 @@ ngIRCd 0.0.1, 31.12.2001
--
$Id: ChangeLog,v 1.188 2003/04/20 23:12:57 alex Exp $
$Id: ChangeLog,v 1.233.2.20 2005/02/03 10:16:25 alex Exp $

26
INSTALL
View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton,
(c)2001-2004 by Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -46,6 +46,20 @@ files (using a distribution archive or CVS) is as following:
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"
@@ -75,6 +89,11 @@ 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"
@@ -93,6 +112,7 @@ 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
@@ -147,7 +167,7 @@ These parameters could be passed to the ngIRCd:
-p, --passive
Server-links won't be automatically established.
--configtest
-t, --configtest
Reads, validates and dumps the configuration file as interpreted
by the server. Then exits.
@@ -157,4 +177,4 @@ number. In both cases the server exits after the output.
--
$Id: INSTALL,v 1.15 2003/03/23 23:13:15 alex Exp $
$Id: INSTALL,v 1.18.2.2 2004/09/03 20:02:02 alex Exp $

View File

@@ -1,21 +0,0 @@
#
# 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

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

34
NEWS
View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton,
(c)2001-2004 by Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -10,7 +10,35 @@
-- NEWS --
ngIRCd CVS-HEAD
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
@@ -161,4 +189,4 @@ ngIRCd 0.0.1, 31.12.2001
--
$Id: NEWS,v 1.53 2003/04/20 23:14:28 alex Exp $
$Id: NEWS,v 1.64.2.3 2004/06/26 09:12:38 alex Exp $

7
README
View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton,
(c)2001-2004 by Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -45,7 +45,8 @@ III. Features (or: why use ngIRCd?)
- 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.
(1.5.2/i386, 1.5.3/m68k), Solaris (2.5.1, 2.6), Windows with Cygwin, and
OpenBSD (3.4/i386).
IV. Documentation
@@ -83,4 +84,4 @@ mail to: <alex@barton.de> or <alex@arthur.ath.cx>
--
$Id: README,v 1.17 2003/03/09 22:03:58 alex Exp $
$Id: README,v 1.18.2.1 2004/05/07 11:24:17 alex Exp $

View File

@@ -1,14 +1,183 @@
#!/bin/sh
#
# $Id: autogen.sh,v 1.6 2003/04/13 22:34:17 alex Exp $
# 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: autogen.sh,v 1.12 2004/04/05 12:02:21 alex Exp $
#
export WANT_AUTOMAKE=1.6
#
# Usage: [VAR=<value>] ./autogen.sh [<configure-args>]
#
# 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".
#
aclocal && \
autoheader && \
automake --add-missing && \
autoconf && \
echo "Okay, autogen.sh done."
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
[ "$VERBOSE" = "1" ] && echo "Using \"$EXIST\" to test for tools."
# We want to use GNU automake 1.7, if available (WANT_AUTOMAKE is used by
# the wrapper scripts of Gentoo Linux):
WANT_AUTOMAKE=1.7
export WANT_AUTOMAKE
# 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-

402
config.guess vendored
View File

@@ -1,9 +1,9 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
timestamp='2002-03-04'
timestamp='2004-11-12'
# 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
@@ -53,7 +53,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -88,30 +88,42 @@ if test $# != 0; then
exit 1
fi
trap 'exit 1' 1 2 15
dummy=dummy-$$
trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# 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
# use `HOST_CC' if defined, but it is deprecated.
set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int dummy(){}" > $dummy.c ;
for c in cc gcc c89 ; do
($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
if test $? = 0 ; then
# Portable tmp directory creation inspired by the Autoconf team.
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${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 ;
fi ;
done ;
rm -f $dummy.c $dummy.o $dummy.rel ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac'
esac ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
@@ -142,6 +154,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
@@ -167,21 +180,38 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
;;
esac
# The OS release
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
# Debian GNU/NetBSD machines have a different userland, and
# 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:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit 0 ;;
amd64:OpenBSD:*:*)
echo x86_64-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
cats:OpenBSD:*:*)
echo arm-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
luna88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
@@ -197,83 +227,76 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
mvmeppc:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*)
echo mipseb-unknown-openbsd${UNAME_RELEASE}
echo mips64-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sun3:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
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:*:*)
if test $UNAME_RELEASE = "V4.0"; then
case $UNAME_RELEASE in
*4.0)
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 Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
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'`
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
@@ -296,6 +319,12 @@ EOF
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
*:z/VM:*:*)
echo s390-ibm-zvmoe
exit 0 ;;
*:OS400:*:*)
echo powerpc-ibm-os400
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
@@ -313,6 +342,13 @@ EOF
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
exit 0 ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7 && exit 0 ;;
esac ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
@@ -381,6 +417,9 @@ EOF
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
@@ -419,15 +458,20 @@ EOF
exit (-1);
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy \
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
$CC_FOR_BUILD -o $dummy $dummy.c \
&& $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& exit 0
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
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:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
@@ -500,8 +544,7 @@ EOF
exit(0);
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
@@ -599,11 +642,21 @@ EOF
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
rm -f $dummy.c $dummy
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
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}
exit 0 ;;
ia64:HP-UX:*:*)
@@ -637,8 +690,7 @@ EOF
exit (0);
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@@ -696,21 +748,26 @@ EOF
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3D:*:*:*)
echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
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:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
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:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
@@ -732,14 +789,17 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;;
x86:Interix*:3*)
echo i386-pc-interix3
x86:Interix*:[34]*)
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
exit 0 ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# 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
# UNAME_MACHINE based on the output of uname instead of i386?
echo i386-pc-interix
echo i586-pc-interix
exit 0 ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
@@ -751,16 +811,33 @@ EOF
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
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:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit 0 ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
exit 0 ;;
crisv32:Linux:*:*)
echo crisv32-axis-linux-gnu
exit 0 ;;
frv:Linux:*:*)
echo frv-unknown-linux-gnu
exit 0 ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -771,19 +848,37 @@ EOF
#undef CPU
#undef mips
#undef mipsel
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mipsel
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mipsel
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips
#else
CPU=
#endif
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
rm -f $dummy.c
test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
test x"${CPU}" != x && echo "${CPU}-unknown-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:*:*)
echo powerpc-unknown-linux-gnu
@@ -819,6 +914,9 @@ EOF
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit 0 ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
@@ -845,7 +943,7 @@ EOF
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit 0 ;;
exit 0 ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit 0 ;;
@@ -876,9 +974,11 @@ EOF
LIBC=gnuaout
#endif
#endif
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
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"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
@@ -896,6 +996,26 @@ EOF
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
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.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
@@ -917,22 +1037,19 @@ EOF
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
@@ -956,9 +1073,15 @@ EOF
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M68*:*:R3V[567]*:*)
mc68k:UNIX:SYSTEM5:3.51m)
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 ;;
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)
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)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -975,9 +1098,6 @@ EOF
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
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.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
@@ -1049,6 +1169,9 @@ EOF
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit 0 ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit 0 ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
@@ -1056,20 +1179,25 @@ EOF
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Darwin:*:*)
echo `uname -p`-apple-darwin${UNAME_RELEASE}
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
*86) UNAME_PROCESSOR=i686 ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit 0 ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
if test "${UNAME_MACHINE}" = "x86pc"; then
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
echo i386-${UNAME_MACHINE}-nto-qnx
else
echo `uname -p`-${UNAME_MACHINE}-nto-qnx
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit 0 ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
*:NonStop-UX:*:*)
@@ -1092,11 +1220,6 @@ EOF
fi
echo ${UNAME_MACHINE}-unknown-plan9
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:*:*)
echo pdp10-unknown-tops10
exit 0 ;;
@@ -1115,11 +1238,21 @@ EOF
*:ITS:*:*)
echo pdp10-unknown-its
exit 0 ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
exit 0 ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
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 ;;
*:XENIX:*:SysV)
echo i386-pc-xenix
exit 0 ;;
esac
@@ -1241,8 +1374,7 @@ main ()
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
# Apollos put the system type in the environment.

277
config.sub vendored
View File

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

View File

@@ -1,6 +1,6 @@
#
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
# Copyright (c)2001-2005 Alexander Barton <alex@barton.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -8,29 +8,30 @@
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# $Id: configure.in,v 1.89 2003/04/21 10:51:44 alex Exp $
# $Id: configure.in,v 1.102.2.7 2005/02/03 10:16:25 alex Exp $
#
# -- Initialisierung --
# -- Initialisation --
AC_PREREQ(2.50)
AC_INIT(ngircd, CVSHEAD)
AC_INIT(ngircd, 0.8.3)
AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(1.6)
AM_CONFIG_HEADER(src/config.h)
# -- Templates fuer config.h --
# -- Templates for config.h --
AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
AH_TEMPLATE([USE_SYSLOG], [Define if syslog should be used for logging])
AH_TEMPLATE([USE_ZLIB], [Define if zlib compression should be enabled])
AH_TEMPLATE([USE_TCPWRAP], [Define if TCP wrappers should be used])
AH_TEMPLATE([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([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_VENDOR], [Target system vendor])
@@ -40,7 +41,7 @@ AH_TEMPLATE([TARGET_CPU], [Target CPU name])
AC_PROG_CC
# -- Hilfsprogramme --
# -- Helper programs --
AC_PROG_AWK
AC_PROG_INSTALL
@@ -50,38 +51,33 @@ AC_PROG_RANLIB
# -- Compiler Features --
AC_LANG_C
AM_C_PROTOTYPES
AC_C_CONST
# -- Defines --
# -- Hard coded system and compiler dependencies/features/options ... --
if test `uname` = "Linux"; then
# define _POSIX_SOURCE, _GNU_SOURCE and _BSD_SOURCE when compiling
# on Linux (glibc-based systems):
AC_MSG_RESULT([detected Linux, defining _POSIX_SOURCE, _GNU_SOURCE and _BSD_SOURCE])
add_DEFINES="-D_POSIX_SOURCE -D_GNU_SOURCE -D_BSD_SOURCE $add_DEFINES"
if test "$GCC" = "yes"; then
# We are using the GNU C compiler. Good!
CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
fi
if test `uname` = "A/UX"; then
# define _POSIX_SOURCE when compiling on A/UX:
AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE])
add_DEFINES="-D_POSIX_SOURCE $add_DEFINES"
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
if test `uname` = "HP-UX"; then
# define _XOPEN_SOURCE_EXTENDED when compiling on HP-UX (11.11):
AC_MSG_RESULT([detected HP-UX, defining _XOPEN_SOURCE_EXTENDED])
add_DEFINES="-D_XOPEN_SOURCE_EXTENDED $add_DEFINES"
fi
# Add additional CFLAGS, eventually specified on the command line:
test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
# -- Header --
CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
# -- Headers --
AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([ \
@@ -91,7 +87,7 @@ AC_CHECK_HEADERS([ \
AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdint.h varargs.h])
# -- Datentypen --
# -- Datatypes --
AC_MSG_CHECKING(whether socklen_t exists)
AC_TRY_COMPILE([
@@ -107,7 +103,6 @@ AC_TRY_COMPILE([
])
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
# -- Libraries --
@@ -116,18 +111,15 @@ AC_CHECK_LIB(UTIL,memmove)
AC_CHECK_LIB(socket,bind)
AC_CHECK_LIB(nsl,gethostent)
# -- Funktionen --
AC_FUNC_MALLOC
# -- Functions --
AC_FUNC_FORK
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([ \
bind gethostbyaddr gethostbyname gethostname inet_ntoa memmove \
memset setsockopt socket strcasecmp strchr strerror strstr waitpid \
],,AC_MSG_ERROR([required function missing!]))
bind gethostbyaddr gethostbyname gethostname inet_ntoa malloc memmove \
memset realloc setsid setsockopt socket strcasecmp strchr strerror \
strstr waitpid],,AC_MSG_ERROR([required function missing!]))
AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strlcpy strlcat)
@@ -135,7 +127,7 @@ AC_CHECK_FUNCS(select,[AC_CHECK_HEADERS(sys/select.h)],
AC_MSG_ERROR([required function select() is missing!])
)
# -- Konfigurationsoptionen --
# -- Configuration options --
x_syslog_on=no
AC_ARG_WITH(syslog,
@@ -153,7 +145,7 @@ AC_ARG_WITH(syslog,
]
)
if test "$x_syslog_on" = "yes"; then
AC_DEFINE(USE_SYSLOG, 1)
AC_DEFINE(SYSLOG, 1)
AC_CHECK_HEADERS(syslog.h)
fi
@@ -172,7 +164,7 @@ AC_ARG_WITH(zlib,
]
)
if test "$x_zlib_on" = "yes"; then
AC_DEFINE(USE_ZLIB, 1)
AC_DEFINE(ZLIB, 1)
AC_CHECK_HEADERS(zlib.h)
fi
@@ -189,7 +181,7 @@ AC_ARG_WITH(tcp-wrappers,
ptr = hosts_access;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(USE_TCPWRAP, 1)
AC_DEFINE(TCPWRAP, 1)
x_tcpwrap_on=yes
],[
AC_MSG_RESULT(no)
@@ -214,6 +206,22 @@ if test "$x_rendezvous_on" = "yes"; then
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
x_ircplus_on=yes
AC_ARG_ENABLE(ircplus,
[ --disable-ircplus disable IRC+ protocol],
@@ -238,6 +246,7 @@ AC_ARG_ENABLE(debug,
)
if test "$x_debug_on" = "yes"; then
AC_DEFINE(DEBUG, 1)
test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
fi
x_strict_rfc_on=no
@@ -249,31 +258,21 @@ AC_ARG_ENABLE(strict-rfc,
fi
)
# -- Definitionen --
# -- Definitions --
AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
# -- Variablen --
# Add additional CFLAGS, eventually specified on the command line, but after
# running this configure script. Useful for "-Werror" for example.
test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
if test "$GCC" = "yes"; then
the_CFLAGS="-Wmissing-declarations -Wpointer-arith -Wstrict-prototypes"
add_CFLAGS="-Wall -W -ansi -pedantic $CFLAGS $CFLAGS_ADD"
else
the_CFLAGS="$CFLAGS"
add_CFLAGS="$CFLAGS_ADD"
fi
CFLAGS="$the_CFLAGS $add_CFLAGS $add_DEFINES -DSYSCONFDIR='\"\$(sysconfdir)\"'"
# -- Ausgabe der Dateien --
# -- Generate files --
AC_OUTPUT([ \
Makefile \
doc/Makefile \
MacOSX/Makefile \
MacOSX/ngircd.pbproj/Makefile \
src/Makefile \
src/portab/Makefile \
src/tool/Makefile \
@@ -281,8 +280,18 @@ AC_OUTPUT([ \
src/testsuite/Makefile \
man/Makefile \
contrib/Makefile \
contrib/Debian/Makefile \
contrib/MacOSX/Makefile \
])
type dpkg >/dev/null 2>&1
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
@@ -296,11 +305,10 @@ C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
M=`eval echo ${mandir}` ; M=`eval echo ${M}`
D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}`
echo " Host: ${host}"
echo " Target: ${target}"
test "$target" != "$host" && echo " Host: ${host}"
echo " Compiler: ${CC}"
echo " Compiler flags: ${the_CFLAGS}"
test -n "$add_CFLAGS" && echo " ${add_CFLAGS}"
test -n "$add_DEFINES" && echo " ${add_DEFINES}"
test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
test -n "$LIBS" && echo " Libraries: ${LIBS}"
@@ -346,6 +354,12 @@ echo $ECHO_N " IRC+ protocol: $ECHO_C"
test "$x_ircplus_on" = "yes" \
&& echo "yes" \
|| echo "no"
echo
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
# -eof-

View File

@@ -0,0 +1,28 @@
#
# 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-

155
contrib/Debian/changelog Normal file
View File

@@ -0,0 +1,155 @@
ngircd (0.8.3-0ab1) unstable; urgency=high
* New "upstream release", including security fixes.
-- Alexander Barton <alex@Arthur.Ath.CX> Thu, 3 Feb 2005 10:41:55 +0100
ngircd (0.8.2-0ab1) unstable; urgency=high
* New "upstream release", including security fixes.
-- Alexander Barton <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

1
contrib/Debian/compat Normal file
View File

@@ -0,0 +1 @@
4

47
contrib/Debian/control Normal file
View File

@@ -0,0 +1,47 @@
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.

13
contrib/Debian/copyright Normal file
View File

@@ -0,0 +1,13 @@
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

@@ -0,0 +1,12 @@
#
# 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-

72
contrib/Debian/ngircd.init Executable file
View File

@@ -0,0 +1,72 @@
#!/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-

14
contrib/Debian/ngircd.postinst Executable file
View File

@@ -0,0 +1,14 @@
#!/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-

156
contrib/Debian/rules Executable file
View File

@@ -0,0 +1,156 @@
#!/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

@@ -0,0 +1,20 @@
#
# 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
# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
# Copyright (c)2001-2004 Alexander Barton <alex@barton.de>
#
# Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# der GNU General Public License (GPL), wie von der Free Software Foundation
@@ -9,10 +9,12 @@
# 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/10/01 09:57:08 alex Exp $
# $Id: Makefile.am,v 1.4 2004/04/28 12:18:02 alex Exp $
#
EXTRA_DIST = ngircd.spec
SUBDIRS = Debian MacOSX
EXTRA_DIST = README ngircd.spec systrace.policy
maintainer-clean-local:
rm -f Makefile Makefile.in

27
contrib/README Normal file
View File

@@ -0,0 +1,27 @@
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 version CurrentCVS
%define version 0.8.3
%define release 1
%define prefix %{_prefix}
Summary: Next Generation Internet Relay Chat Daemon
Summary: A lightweight daemon for the Internet Relay Chat (IRC)
Name: %{name}
Version: %{version}
Release: %{release}
@@ -15,17 +15,18 @@ Packager: Sean Reifschneider <jafo-rpms@tummy.com>
BuildRoot: /var/tmp/%{name}-root
%description
ngIRCd is a free open source daemon for Internet Relay Chat (IRC),
ngIRCd is a free open source daemon for the Internet Relay Chat (IRC),
developed under the GNU General Public License (GPL). It's written from
scratch and is not based upon the original IRCd like many others.
Why should you use ngIRCd? Because ...
Advantages:
- 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.
* ... there are no problems with servers on changing or non-static IP
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.
ngIRCd is compatible to the "original" ircd 2.10.3p3, so you can run
mixed networks.
%prep
%setup

77
contrib/systrace.policy Normal file
View File

@@ -0,0 +1,77 @@
#
# 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

@@ -19,6 +19,10 @@ A: Yes. ngIRCd is compatible to the original ircd used by IRCNet. Actually
Q: Is there a homepage with further information and downloads?
A: Yes. Please visit <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
~~~~~~~~~~~~~~~
@@ -60,4 +64,4 @@ A: Please file a bug report at <http://arthur.ath.cx/bugzilla/ngircd/>!
--
$Id: FAQ.txt,v 1.5 2003/04/05 11:37:17 alex Exp $
$Id: FAQ.txt,v 1.7 2003/11/07 21:32:15 alex Exp $

View File

@@ -9,11 +9,11 @@
# 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.16 2003/04/21 08:01:29 alex Exp $
# $Id: Makefile.am,v 1.17 2003/04/22 23:50:18 alex Exp $
#
EXTRA_DIST = CVS.txt FAQ.txt Protocol.txt README-AUX.txt \
README-BeOS.txt RFC.txt sample-ngircd.conf
EXTRA_DIST = CVS.txt FAQ.txt Protocol.txt Platforms.txt \
README-AUX.txt README-BeOS.txt RFC.txt sample-ngircd.conf
maintainer-clean-local:
rm -f Makefile Makefile.in

63
doc/Platforms.txt Normal file
View File

@@ -0,0 +1,63 @@
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

@@ -22,9 +22,10 @@ in all details. But because the ngIRCd should be a fully compatible
replacement for this server ("ircd") it tries to emulate these differences.
If you don't like this behavior please ./configure the ngIRCd using the
"--enable-strict-rfc" command line option. But please not: not all IRC
clients are compatible with such an server, some can't even connect at all!
Therefore this option isn't desired for "normal operation".
"--enable-strict-rfc" command line option. But keep in mind: not all IRC
clients are compatible with a server configured that way, some can't even
connect at all! Therefore this option usually isn't desired for "normal
server operation".
II. The IRC+ Protocol
@@ -35,8 +36,8 @@ as defined in RFC 2810-2813. This enhanced protocol is named "IRC+". It is
backwards compatible to the "plain" IRC protocol and will only be used by
the ngIRCd if it detects that the peer supports it as well.
The "PASSV" command is used to detect the protocol and peer versions (see
RFC 2813, section 4.1.1).
The "PASS" command is used to detect the protocol and peer versions see
RFC 2813 (section 4.1.1) and below.
II.1 Register new server link
@@ -57,9 +58,11 @@ The following optional(!) 10 bytes contain an implementation-dependent
version number. Servers supporting the IRC+ protocol as defined in this
document provide the string "-IRC+" here.
Example for <version>: "0210-IRC+".
<flags> consists of two parts separated with the character "|" and is at
most 100 bytes long. The first part contains the name of the implementation
(ngIRCd sets this to "ngIRCd", the original ircd to "IRC", e.g.). The second
(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>]".
@@ -68,15 +71,23 @@ used: "<serverversion>[:<serverflags>]".
number, <serverflags> indicates the supported IRC+ protocol extensions (and
may be empty!).
The optional parameter <options> is used to propagate server options as
defined in RFC 2813, section 4.1.1.
The following <serverflags> are defined at the moment:
- C: The server supports the CHANINFO command.
- 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.
- C: The server supports the CHANINFO command.
- 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
@@ -104,4 +115,4 @@ channel mode). In this case <limit> should be "0".
--
$Id: Protocol.txt,v 1.9 2003/04/21 12:48:40 alex Exp $
$Id: Protocol.txt,v 1.12 2004/04/25 15:44:10 alex Exp $

View File

@@ -10,10 +10,10 @@
-- README-BeOS.txt --
+--------------------------------------------------------------+
| This text is only available in german at the moment, sorry! |
| Contributors are welcome :-) |
+--------------------------------------------------------------+
+-------------------------------------------------------------+
| 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-
@@ -50,4 +50,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 ...
--
$Id: README-BeOS.txt,v 1.6 2003/04/21 12:55:39 alex Exp $
$Id: README-BeOS.txt,v 1.7 2003/05/15 21:47:57 alex Exp $

58
doc/SSL.txt Normal file
View File

@@ -0,0 +1,58 @@
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 $

View File

@@ -1,13 +1,13 @@
# $Id: sample-ngircd.conf,v 1.20 2003/03/10 00:23:34 alex Exp $
# $Id: sample-ngircd.conf,v 1.25.2.1 2004/05/07 11:24:17 alex Exp $
#
# This is a sample configuration file for the ngIRCd, which must adept to
# the local preferences and needs.
# This is a sample configuration file for the ngIRCd, which must be adepted
# to the local preferences and needs.
#
# Comments are started with "#" or ";".
#
# Author: Alexander Barton, <alex@barton.de>
# Initial translation by Ilja Osthoff, <ilja@glide.ath.cx>
# Use "ngircd --configtest" (see manual page ngircd(8)) to validate that the
# server interpreted the configuration file as expected!
#
[Global]
@@ -16,15 +16,19 @@
# configuration of the server, like the server name and the ports
# on which the server should be listening.
# Server name in the IRC-network
# Server name in the IRC network, must contain at least one dot
# (".") and be unique in the IRC network. Required!
Name = irc.the.net
# Info text of the server. This will be shown by WHOIS and
# LINKS requests for example.
Info = Server Info Text
# Global password for all users needed to connect to the server
;Password = abc
# Information about the server and the administrator, used by the
# ADMIN command.
# ADMIN command. Not required by server but by RFC!
;AdminInfo1 = Description
;AdminInfo2 = Location
;AdminEMail = admin@irc.server
@@ -32,11 +36,19 @@
# Ports on which the server should listen. There may be more than
# one port, separated with ";". (Default: 6667)
;Ports = 6667, 6668, 66694
# IP address on which the server should listen. (Default: empty,
# so the server listens on all IP addresses of the system)
;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
# 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.
;MotdPhrase = "Hello world!"
# 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,
@@ -49,6 +61,13 @@
# server must have been started with root privileges!
;ServerGID = 65534
# 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.
# 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
@@ -68,6 +87,10 @@
# 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

View File

@@ -1,5 +1,5 @@
.\"
.\" $Id: ngircd.8,v 1.8 2003/03/10 00:58:06 alex Exp $
.\" $Id: ngircd.8,v 1.9 2004/04/05 10:59:10 alex Exp $
.\"
.TH ngircd 8 "March 2003" ngircd "ngIRCd Manual"
.SH NAME
@@ -36,9 +36,6 @@ controlling terminal and to wait for clients.
.PP
You can use these options to modify this default:
.TP
\fB\-\-configtest\fR
Read, validate and display the configuration; then exit.
.TP
\fB\-f\fR \fIfile\fR, \fB\-\-config\fR \fIfile\fR
Use
.I file
@@ -52,6 +49,9 @@ All log messages go to the console.
Disable automatic connections to other servers. You can use the IRC command
CONNECT later on as IRC Operator to link this ngIRCd to other servers.
.TP
\fB\-t\fR, \fB\-\-configtest\fR
Read, validate and display the configuration; then exit.
.TP
\fB\-\-version\fR
Output version information and exit.
.TP

View File

@@ -1,7 +1,7 @@
.\"
.\" $Id: ngircd.conf.5,v 1.9 2003/03/10 00:58:06 alex Exp $
.\" $Id: ngircd.conf.5,v 1.12.2.1 2004/05/07 11:24:18 alex Exp $
.\"
.TH ngircd.conf 5 "March 2003" ngircd "ngIRCd Manual"
.TH ngircd.conf 5 "Mai 2003" ngircd "ngIRCd Manual"
.SH NAME
ngircd.conf \- configuration file of ngIRCd
.SH SYNOPSIS
@@ -67,10 +67,18 @@ command.
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.
@@ -94,6 +102,18 @@ 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.
@@ -101,7 +121,7 @@ the peer to test whether it is alive or not. Default: 120.
\fBPongTimeout\fR
If a client fails to answer a PING with a PONG within <PongTimeout>
seconds, it will be disconnected by the server. Default: 20.
.IT
.TP
\fBConnectRetry\fR
The server tries every <ConnectRetry> seconds to establish a link to not yet
(or no longer) connected servers. Default: 60.
@@ -114,6 +134,11 @@ not(!) channel-operators? Default: no.
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.

View File

@@ -8,7 +8,7 @@
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# $Id: Makefile.am,v 1.39 2003/03/31 19:01:02 alex Exp $
# $Id: Makefile.am,v 1.42 2003/12/04 14:05:16 alex Exp $
#
AUTOMAKE_OPTIONS = ../portab/ansi2knr
@@ -61,7 +61,13 @@ lint:
fi; \
done;
ngircd.c: cvs-date cvs-version.h
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" \
@@ -69,7 +75,8 @@ cvs-date:
| $(AWK) "{ print \$$9 }" | sort | tail -1 \
| sed -e "s/\//-/g" )\"" > cvs-version.new \
|| echo "" > cvs-version.new
diff cvs-version.h cvs-version.new || cp cvs-version.new cvs-version.h
diff cvs-version.h cvs-version.new 2>/dev/null \
|| cp cvs-version.new cvs-version.h
TESTS = check-version check-help

View File

@@ -17,12 +17,13 @@
#include "portab.h"
static char UNUSED id[] = "$Id: channel.c,v 1.42 2002/12/30 17:15:42 alex Exp $";
static char UNUSED id[] = "$Id: channel.c,v 1.45 2004/03/11 22:16:31 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "conn-func.h"
#include "client.h"
@@ -669,7 +670,7 @@ Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
{
BOOLEAN is_member, has_voice, is_op, ok;
/* Okay, Ziel ist ein Channel */
/* Okay, target is a channel */
is_member = has_voice = is_op = FALSE;
if( Channel_IsMemberOf( Chan, From ))
{
@@ -678,14 +679,21 @@ Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
if( strchr( Channel_UserModes( Chan, From ), 'o' )) is_op = TRUE;
}
/* pruefen, ob Client in Channel schreiben darf */
/* Check weather client is allowed to write to channel */
ok = TRUE;
if( strchr( Channel_Modes( Chan ), 'n' ) && ( ! is_member )) 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 ));
/* Text senden */
/* Send text */
if( Client_Conn( From ) > NONE ) Conn_UpdateIdle( Client_Conn( From ));
return IRC_WriteStrChannelPrefix( Client, Chan, From, TRUE, "PRIVMSG %s :%s", Channel_Name( Chan ), Text );
} /* Channel_Write */
@@ -700,7 +708,7 @@ Channel_Create( CHAR *Name )
assert( Name != NULL );
c = malloc( sizeof( CHANNEL ));
c = (CHANNEL *)malloc( sizeof( CHANNEL ));
if( ! c )
{
Log( LOG_EMERG, "Can't allocate memory! [New_Chan]" );
@@ -752,7 +760,7 @@ Add_Client( CHANNEL *Chan, CLIENT *Client )
assert( Client != NULL );
/* neue CL2CHAN-Struktur anlegen */
cl2chan = malloc( sizeof( CL2CHAN ));
cl2chan = (CL2CHAN *)malloc( sizeof( CL2CHAN ));
if( ! cl2chan )
{
Log( LOG_EMERG, "Can't allocate memory! [Add_Client]" );

View File

@@ -17,7 +17,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: client.c,v 1.74 2003/03/31 15:54:21 alex Exp $";
static char UNUSED id[] = "$Id: client.c,v 1.76 2004/03/11 22:16:31 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -25,6 +25,7 @@ static char UNUSED id[] = "$Id: client.c,v 1.74 2003/03/31 15:54:21 alex Exp $";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <netdb.h>
#include "conn.h"
@@ -1023,7 +1024,7 @@ New_Client_Struct( VOID )
CLIENT *c;
c = malloc( sizeof( CLIENT ));
c = (CLIENT *)malloc( sizeof( CLIENT ));
if( ! c )
{
Log( LOG_EMERG, "Can't allocate memory! [New_Client_Struct]" );

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: conf.c,v 1.57 2003/04/21 11:06:07 alex Exp $";
static char UNUSED id[] = "$Id: conf.c,v 1.63.2.2 2004/09/27 11:30:52 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -23,6 +23,7 @@ static char UNUSED id[] = "$Id: conf.c,v 1.57 2003/04/21 11:06:07 alex Exp $";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
@@ -106,13 +107,15 @@ Conf_Test( VOID )
else puts( "Ok, dump of your server configuration follows:\n" );
puts( "[GLOBAL]" );
printf( " ServerName = %s\n", Conf_ServerName );
printf( " ServerInfo = %s\n", Conf_ServerInfo );
printf( " ServerPwd = %s\n", Conf_ServerPwd );
printf( " Name = %s\n", Conf_ServerName );
printf( " Info = %s\n", Conf_ServerInfo );
printf( " Password = %s\n", Conf_ServerPwd );
printf( " AdminInfo1 = %s\n", Conf_ServerAdmin1 );
printf( " AdminInfo2 = %s\n", Conf_ServerAdmin2 );
printf( " AdminEMail = %s\n", Conf_ServerAdminMail );
printf( " MotdFile = %s\n", Conf_MotdFile );
printf( " MotdPhrase = %s\n", Conf_MotdPhrase );
printf( " ChrootDir= %s\n", Conf_Chroot );
printf( " Ports = " );
for( i = 0; i < Conf_ListenPorts_Count; i++ )
{
@@ -120,6 +123,7 @@ Conf_Test( VOID )
printf( "%u", Conf_ListenPorts[i] );
}
puts( "" );
printf( " Listen = %s\n", Conf_ListenAddress );
pwd = getpwuid( Conf_UID );
if( pwd ) printf( " ServerUID = %s\n", pwd->pw_name );
else printf( " ServerUID = %ld\n", (LONG)Conf_UID );
@@ -132,6 +136,8 @@ Conf_Test( VOID )
printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" );
if( Conf_MaxConnections > 0 ) printf( " MaxConnections = %ld\n", Conf_MaxConnections );
else printf( " MaxConnections = -1\n" );
if( Conf_MaxConnectionsIP > 0 ) printf( " MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP );
else printf( " MaxConnectionsIP = -1\n" );
if( Conf_MaxJoins > 0 ) printf( " MaxJoins = %d\n", Conf_MaxJoins );
else printf( " MaxJoins = -1\n" );
puts( "" );
@@ -339,7 +345,12 @@ Set_Defaults( BOOLEAN InitServers )
strlcpy( Conf_MotdFile, SYSCONFDIR, sizeof( Conf_MotdFile ));
strlcat( Conf_MotdFile, MOTD_FILE, sizeof( Conf_MotdFile ));
strlcpy( Conf_MotdPhrase, MOTD_PHRASE, sizeof( Conf_MotdPhrase ));
strlcpy( Conf_Chroot, CHROOT_DIR, sizeof( Conf_Chroot ));
Conf_ListenPorts_Count = 0;
strcpy( Conf_ListenAddress, "" );
Conf_UID = Conf_GID = 0;
@@ -354,6 +365,7 @@ Set_Defaults( BOOLEAN InitServers )
Conf_OperCanMode = FALSE;
Conf_MaxConnections = -1;
Conf_MaxConnectionsIP = 5;
Conf_MaxJoins = 10;
/* Initialize server configuration structures */
@@ -607,6 +619,18 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
if( strlcpy( Conf_MotdFile, Arg, sizeof( Conf_MotdFile )) >= sizeof( Conf_MotdFile )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MotdFile\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "MotdPhrase" ) == 0 )
{
/* "Message of the day" phrase (instead of file) */
if( strlcpy( Conf_MotdPhrase, Arg, sizeof( Conf_MotdPhrase )) >= sizeof( Conf_MotdPhrase )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MotdPhrase\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "ChrootDir" ) == 0 )
{
/* directory for chroot() */
if( strlcpy( Conf_Chroot, Arg, sizeof( Conf_Chroot )) >= sizeof( Conf_Chroot )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ChrootDir\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "ServerUID" ) == 0 )
{
/* UID the daemon should switch to */
@@ -615,7 +639,7 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
else
{
#ifdef HAVE_ISDIGIT
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerUID\" is not a number!", NGIRCd_ConfFile, Line );
if( ! isdigit( (INT)*Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerUID\" is not a number!", NGIRCd_ConfFile, Line );
else
#endif
Conf_UID = (UINT)atoi( Arg );
@@ -630,7 +654,7 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
else
{
#ifdef HAVE_ISDIGIT
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerGID\" is not a number!", NGIRCd_ConfFile, Line );
if( ! isdigit( (INT)*Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerGID\" is not a number!", NGIRCd_ConfFile, Line );
else
#endif
Conf_GID = (UINT)atoi( Arg );
@@ -683,22 +707,41 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
{
/* Maximum number of connections. Values <= 0 are equal to "no limit". */
#ifdef HAVE_ISDIGIT
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxConnections\" is not a number!", NGIRCd_ConfFile, Line );
if( ! isdigit( (INT)*Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxConnections\" is not a number!", NGIRCd_ConfFile, Line );
else
#endif
Conf_MaxConnections = atol( Arg );
return;
}
if( strcasecmp( Var, "MaxConnectionsIP" ) == 0 )
{
/* Maximum number of simoultanous connections from one IP. Values <= 0 are equal to "no limit". */
#ifdef HAVE_ISDIGIT
if( ! isdigit( (INT)*Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxConnectionsIP\" is not a number!", NGIRCd_ConfFile, Line );
else
#endif
Conf_MaxConnectionsIP = atoi( Arg );
return;
}
if( strcasecmp( Var, "MaxJoins" ) == 0 )
{
/* Maximum number of channels a user can join. Values <= 0 are equal to "no limit". */
#ifdef HAVE_ISDIGIT
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxJoins\" is not a number!", NGIRCd_ConfFile, Line );
if( ! isdigit( (INT)*Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxJoins\" is not a number!", NGIRCd_ConfFile, Line );
else
#endif
Conf_MaxJoins = atoi( Arg );
return;
}
if( strcasecmp( Var, "Listen" ) == 0 )
{
/* IP-Address to bind sockets */
if( strlcpy( Conf_ListenAddress, Arg, sizeof( Conf_ListenAddress )) >= sizeof( Conf_ListenAddress ))
{
Config_Error( LOG_WARNING, "%s, line %d: Value of \"Listen\" too long!", NGIRCd_ConfFile, Line );
}
return;
}
Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
} /* Handle_GLOBAL */
@@ -777,7 +820,7 @@ Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
{
/* Server group */
#ifdef HAVE_ISDIGIT
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Group\" is not a number!", NGIRCd_ConfFile, Line );
if( ! isdigit( (INT)*Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Group\" is not a number!", NGIRCd_ConfFile, Line );
else
#endif
New_Server.group = atoi( Arg );
@@ -830,7 +873,18 @@ Validate_Config( BOOLEAN Configtest )
if( ! Conf_ServerName[0] )
{
/* No server name configured! */
Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile );
Config_Error( LOG_ALERT, "No server name configured in \"%s\" (section 'Global': 'Name')!", NGIRCd_ConfFile );
if( ! Configtest )
{
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME );
exit( 1 );
}
}
if( Conf_ServerName[0] && ! strchr( Conf_ServerName, '.' ))
{
/* No dot in server name! */
Config_Error( LOG_ALERT, "Invalid server name configured in \"%s\" (section 'Global': 'Name'): Dot missing!", NGIRCd_ConfFile );
if( ! Configtest )
{
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME );

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conf.h,v 1.26 2002/12/31 16:12:50 alex Exp $
* $Id: conf.h,v 1.28.2.1 2004/05/07 11:24:18 alex Exp $
*
* Configuration management (header)
*/
@@ -72,14 +72,23 @@ GLOBAL CHAR Conf_ServerAdminMail[CLIENT_INFO_LEN];
/* File with MOTD text */
GLOBAL CHAR Conf_MotdFile[FNAME_LEN];
/* Phrase with MOTD text */
GLOBAL CHAR Conf_MotdPhrase[LINE_LEN];
/* Ports the server should listen on */
GLOBAL UINT Conf_ListenPorts[MAX_LISTEN_PORTS];
GLOBAL INT Conf_ListenPorts_Count;
/* Address to which the socket should be bound or empty (=all) */
GLOBAL CHAR Conf_ListenAddress[16];
/* User and group ID the server should run with */
GLOBAL UINT Conf_UID;
GLOBAL UINT Conf_GID;
/* A directory to chroot() in */
GLOBAL CHAR Conf_Chroot[FNAME_LEN];
/* Timeouts for PING and PONG */
GLOBAL INT Conf_PingTimeout;
GLOBAL INT Conf_PongTimeout;
@@ -107,6 +116,9 @@ 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_Rehash PARAMS((VOID ));

View File

@@ -16,10 +16,11 @@
#include "portab.h"
static char UNUSED id[] = "$Id: conn-func.c,v 1.1 2002/12/30 17:14:28 alex Exp $";
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"
@@ -69,7 +70,7 @@ Conn_SetPenalty( CONN_ID Idx, time_t Seconds )
assert( Idx > NONE );
assert( Seconds >= 0 );
t = time( NULL ) + Seconds;
if( t > My_Connections[Idx].delaytime ) My_Connections[Idx].delaytime = t;
} /* Conn_SetPenalty */
@@ -197,7 +198,7 @@ Conn_SendQ( CONN_ID Idx )
/* Laenge der Daten im Schreibbuffer liefern */
assert( Idx > NONE );
#ifdef USE_ZLIB
#ifdef ZLIB
if( My_Connections[Idx].options & CONN_ZIP ) return My_Connections[Idx].zip.wdatalen;
else
#endif
@@ -231,7 +232,7 @@ Conn_RecvQ( CONN_ID Idx )
/* Laenge der Daten im Lesebuffer liefern */
assert( Idx > NONE );
#ifdef USE_ZLIB
#ifdef ZLIB
if( My_Connections[Idx].options & CONN_ZIP ) return My_Connections[Idx].zip.rdatalen;
else
#endif

View File

@@ -17,9 +17,9 @@
#define CONN_MODULE
#ifdef USE_ZLIB
#ifdef ZLIB
static char UNUSED id[] = "$Id: conn-zip.c,v 1.3 2003/04/21 10:52:26 alex Exp $";
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>
@@ -161,7 +161,7 @@ Unzip_Buffer( CONN_ID Idx )
result = inflate( in, Z_SYNC_FLUSH );
if( result != Z_OK )
{
Log( LOG_ALERT, "Decompression error: code %d (ni=%d, ai=%d, no=%d, ao=%d)!?", result, in->next_in, in->avail_in, in->next_out, in->avail_out );
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;
}

View File

@@ -8,13 +8,13 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conn-zip.h,v 1.1 2002/12/30 16:07:23 alex Exp $
* $Id: conn-zip.h,v 1.2 2003/12/26 15:55:07 alex Exp $
*
* Connection compression using ZLIB (header)
*/
#ifdef USE_ZLIB
#ifdef ZLIB
#ifndef __conn_zip_h__
#define __conn_zip_h__
@@ -32,7 +32,7 @@ GLOBAL LONG Zip_RecvBytes PARAMS(( CONN_ID Idx ));
#endif /* __conn_zip_h__ */
#endif /* USE_ZLIB */
#endif /* ZLIB */
/* -eof- */

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
* 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
@@ -16,7 +16,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: conn.c,v 1.122 2003/04/21 10:52:26 alex Exp $";
static char UNUSED id[] = "$Id: conn.c,v 1.134.2.4 2005/01/19 23:35:42 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -33,18 +33,22 @@ static char UNUSED id[] = "$Id: conn.c,v 1.122 2003/04/21 10:52:26 alex Exp $";
#include <time.h>
#include <netinet/in.h>
#ifdef HAVE_NETINET_IP_H
# include <netinet/ip.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
# include <arpa/inet.h>
#else
#define PF_INET AF_INET
# define PF_INET AF_INET
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h> /* e.g. for Mac OS X */
# include <stdint.h> /* e.g. for Mac OS X */
#endif
#ifdef USE_TCPWRAP
#include <tcpd.h> /* for TCP Wrappers */
#ifdef TCPWRAP
# include <tcpd.h> /* for TCP Wrappers */
#endif
#include "defines.h"
@@ -64,7 +68,7 @@ static char UNUSED id[] = "$Id: conn.c,v 1.122 2003/04/21 10:52:26 alex Exp $";
#include "tool.h"
#ifdef RENDEZVOUS
#include "rendezvous.h"
# include "rendezvous.h"
#endif
#include "exp.h"
@@ -87,12 +91,13 @@ LOCAL BOOLEAN Init_Socket PARAMS(( INT Sock ));
LOCAL VOID New_Server PARAMS(( INT Server, CONN_ID Idx ));
LOCAL VOID Read_Resolver_Result PARAMS(( INT r_fd ));
LOCAL VOID Simple_Message PARAMS(( INT Sock, CHAR *Msg ));
LOCAL INT Count_Connections PARAMS(( struct sockaddr_in addr ));
LOCAL fd_set My_Listeners;
LOCAL fd_set My_Sockets;
LOCAL fd_set My_Connects;
#ifdef USE_TCPWRAP
#ifdef TCPWRAP
INT allow_severity = LOG_INFO;
INT deny_severity = LOG_ERR;
#endif
@@ -112,14 +117,16 @@ Conn_Init( VOID )
/* konfiguriertes Limit beachten */
if( Pool_Size > Conf_MaxConnections ) Pool_Size = Conf_MaxConnections;
}
My_Connections = malloc( sizeof( CONNECTION ) * Pool_Size );
My_Connections = (CONNECTION *)malloc( sizeof( CONNECTION ) * Pool_Size );
if( ! My_Connections )
{
/* Speicher konnte nicht alloziert werden! */
Log( LOG_EMERG, "Can't allocate memory! [Conn_Init]" );
exit( 1 );
}
Log( LOG_DEBUG, "Allocted connection pool for %d items (%ld bytes).", Pool_Size, sizeof( CONNECTION ) * Pool_Size );
#ifdef DEBUG
Log( LOG_DEBUG, "Allocated connection pool for %d items (%ld bytes).", Pool_Size, sizeof( CONNECTION ) * Pool_Size );
#endif
/* zu Beginn haben wir keine Verbindungen */
FD_ZERO( &My_Listeners );
@@ -146,12 +153,14 @@ Conn_Exit( VOID )
CONN_ID idx;
INT i;
#ifdef DEBUG
Log( LOG_DEBUG, "Shutting down all connections ..." );
#endif
#ifdef RENDEZVOUS
Rendezvous_UnregisterListeners( );
#endif
/* Sockets schliessen */
for( i = 0; i < Conn_MaxFD + 1; i++ )
{
@@ -164,12 +173,16 @@ Conn_Exit( VOID )
if( FD_ISSET( i, &My_Listeners ))
{
close( i );
#ifdef DEBUG
Log( LOG_DEBUG, "Listening socket %d closed.", i );
#endif
}
else if( FD_ISSET( i, &My_Connects ))
{
close( i );
#ifdef DEBUG
Log( LOG_DEBUG, "Connection %d closed during creation (socket %d).", idx, i );
#endif
}
else if( idx < Pool_Size )
{
@@ -183,7 +196,7 @@ Conn_Exit( VOID )
}
}
}
free( My_Connections );
My_Connections = NULL;
Pool_Size = 0;
@@ -217,14 +230,16 @@ Conn_ExitListeners( VOID )
#ifdef RENDEZVOUS
Rendezvous_UnregisterListeners( );
#endif
Log( LOG_INFO, "Shutting down all listening sockets ..." );
for( i = 0; i < Conn_MaxFD + 1; i++ )
{
if( FD_ISSET( i, &My_Sockets ) && FD_ISSET( i, &My_Listeners ))
{
close( i );
#ifdef DEBUG
Log( LOG_DEBUG, "Listening socket %d closed.", i );
#endif
}
}
} /* Conn_ExitListeners */
@@ -236,16 +251,32 @@ Conn_NewListener( CONST UINT Port )
/* Create new listening socket on specified port */
struct sockaddr_in addr;
struct in_addr inaddr;
INT sock;
#ifdef RENDEZVOUS
CHAR name[CLIENT_ID_LEN], *info;
#endif
/* Server-"Listen"-Socket initialisieren */
memset( &addr, 0, sizeof( addr ));
memset( &inaddr, 0, sizeof( inaddr ));
addr.sin_family = AF_INET;
addr.sin_port = htons( Port );
addr.sin_addr.s_addr = htonl( INADDR_ANY );
if( Conf_ListenAddress[0] )
{
#ifdef HAVE_INET_ATON
if( inet_aton( Conf_ListenAddress, &inaddr ) == 0 )
#else
inaddr.s_addr = inet_addr( Conf_ListenAddress );
if( inaddr.s_addr == (unsigned)-1 )
#endif
{
Log( LOG_CRIT, "Can't listen on %s:%u: can't convert ip address %s!", Conf_ListenAddress, Port, Conf_ListenAddress );
return FALSE;
}
}
else inaddr.s_addr = htonl( INADDR_ANY );
addr.sin_addr = inaddr;
/* Socket erzeugen */
sock = socket( PF_INET, SOCK_STREAM, 0);
@@ -279,7 +310,8 @@ Conn_NewListener( CONST UINT Port )
if( sock > Conn_MaxFD ) Conn_MaxFD = sock;
Log( LOG_INFO, "Now listening on port %d (socket %d).", Port, sock );
if( Conf_ListenAddress[0]) Log( LOG_INFO, "Now listening on %s:%d (socket %d).", Conf_ListenAddress, Port, sock );
else Log( LOG_INFO, "Now listening on 0.0.0.0:%d (socket %d).", Port, sock );
#ifdef RENDEZVOUS
/* Get best server description text */
@@ -350,10 +382,13 @@ Conn_Handler( VOID )
Check_Servers( );
Check_Connections( );
t = time( NULL );
/* noch volle Lese-Buffer suchen */
for( i = 0; i < Pool_Size; i++ )
{
if(( My_Connections[i].sock > NONE ) && ( My_Connections[i].rdatalen > 0 ))
if(( My_Connections[i].sock > NONE ) && ( My_Connections[i].rdatalen > 0 ) &&
( My_Connections[i].delaytime < t ))
{
/* Kann aus dem Buffer noch ein Befehl extrahiert werden? */
if( Handle_Buffer( i )) timeout = FALSE;
@@ -364,7 +399,7 @@ Conn_Handler( VOID )
FD_ZERO( &write_sockets );
for( i = 0; i < Pool_Size; i++ )
{
#ifdef USE_ZLIB
#ifdef ZLIB
if(( My_Connections[i].sock > NONE ) && (( My_Connections[i].wdatalen > 0 ) || ( My_Connections[i].zip.wdatalen > 0 )))
#else
if(( My_Connections[i].sock > NONE ) && ( My_Connections[i].wdatalen > 0 ))
@@ -382,7 +417,6 @@ Conn_Handler( VOID )
}
/* von welchen Sockets koennte gelesen werden? */
t = time( NULL );
read_sockets = My_Sockets;
for( i = 0; i < Pool_Size; i++ )
{
@@ -413,9 +447,9 @@ Conn_Handler( VOID )
/* Timeout initialisieren */
tv.tv_usec = 0;
if( timeout ) tv.tv_sec = TIME_RES;
if( timeout ) tv.tv_sec = 1;
else tv.tv_sec = 0;
/* Auf Aktivitaet warten */
i = select( Conn_MaxFD + 1, &read_sockets, &write_sockets, NULL, &tv );
if( i == 0 )
@@ -443,7 +477,7 @@ Conn_Handler( VOID )
/* Es kann geschrieben werden ... */
idx = Socket2Index( i );
if( idx == NONE ) continue;
if( ! Handle_Write( idx ))
{
/* Fehler beim Schreiben! Diesen Socket nun
@@ -491,7 +525,7 @@ va_dcl
#else
va_start( ap );
#endif
if( vsnprintf( buffer, COMMAND_LEN - 2, Format, ap ) == COMMAND_LEN - 2 )
if( vsnprintf( buffer, COMMAND_LEN - 2, Format, ap ) >= COMMAND_LEN - 2 )
{
Log( LOG_CRIT, "Text too long to send (connection %d)!", Idx );
Conn_Close( Idx, "Text too long to send!", NULL, FALSE );
@@ -527,7 +561,9 @@ Conn_Write( CONN_ID Idx, CHAR *Data, INT Len )
* In diesem Fall wird hier einfach ein Fehler geliefert. */
if( My_Connections[Idx].sock <= NONE )
{
#ifdef DEBUG
Log( LOG_DEBUG, "Skipped write on closed socket (connection %d).", Idx );
#endif
return FALSE;
}
@@ -549,7 +585,7 @@ Conn_Write( CONN_ID Idx, CHAR *Data, INT Len )
}
}
#ifdef USE_ZLIB
#ifdef ZLIB
if( My_Connections[Idx].options & CONN_ZIP )
{
/* Daten komprimieren und in Puffer kopieren */
@@ -578,25 +614,36 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )
* sub-processes are closed down. */
CLIENT *c;
CHAR *txt;
DOUBLE in_k, out_k;
#ifdef USE_ZLIB
#ifdef ZLIB
DOUBLE in_z_k, out_z_k;
INT in_p, out_p;
#endif
assert( Idx > NONE );
assert( My_Connections[Idx].sock > NONE );
/* Is this link already shutting down? */
if( My_Connections[Idx].options & CONN_ISCLOSING )
{
/* Conn_Close() has been called recursively for this link;
* probabe reason: Try_Write() failed -- see below. */
#ifdef DEBUG
Log( LOG_DEBUG, "Recursive request to close connection: %d", Idx );
#endif
return;
}
assert( My_Connections[Idx].sock > NONE );
/* Mark link as "closing" */
My_Connections[Idx].options |= CONN_ISCLOSING;
if( LogMsg ) txt = LogMsg;
else txt = FwdMsg;
if( ! txt ) txt = "Reason unknown";
Log( LOG_INFO, "Shutting down connection %d (%s) with %s:%d ...", Idx, LogMsg ? LogMsg : FwdMsg, My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port ));
/* Search client, if any */
c = Client_GetFromConn( Idx );
@@ -615,7 +662,6 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )
/* Send ERROR to client (see RFC!) */
if( FwdMsg ) Conn_WriteStr( Idx, "ERROR :%s", FwdMsg );
else Conn_WriteStr( Idx, "ERROR :Closing connection." );
if( My_Connections[Idx].sock == NONE ) return;
}
/* Try to write out the write buffer */
@@ -641,7 +687,7 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )
/* Calculate statistics and log information */
in_k = (DOUBLE)My_Connections[Idx].bytes_in / 1024;
out_k = (DOUBLE)My_Connections[Idx].bytes_out / 1024;
#ifdef USE_ZLIB
#ifdef ZLIB
if( My_Connections[Idx].options & CONN_ZIP )
{
in_z_k = (DOUBLE)My_Connections[Idx].zip.bytes_in / 1024;
@@ -669,7 +715,7 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )
/* Servers: Modify time of next connect attempt? */
Conf_UnsetServer( Idx );
#ifdef USE_ZLIB
#ifdef ZLIB
/* Clean up zlib, if link was compressed */
if( Conn_Options( Idx ) & CONN_ZIP )
{
@@ -680,6 +726,10 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )
/* Clean up connection structure (=free it) */
Init_Conn_Struct( Idx );
#ifdef DEBUG
Log( LOG_DEBUG, "Shutdown of connection %d completed.", Idx );
#endif
} /* Conn_Close */
@@ -730,7 +780,7 @@ Try_Write( CONN_ID Idx )
assert( My_Connections[Idx].sock > NONE );
/* sind ueberhaupt Daten vorhanden? */
#ifdef USE_ZLIB
#ifdef ZLIB
if(( ! My_Connections[Idx].wdatalen > 0 ) && ( ! My_Connections[Idx].zip.wdatalen )) return TRUE;
#else
if( ! My_Connections[Idx].wdatalen > 0 ) return TRUE;
@@ -836,14 +886,14 @@ Handle_Write( CONN_ID Idx )
return FALSE;
}
Log( LOG_DEBUG, "Connection %d with \"%s:%d\" established, now sendig PASS and SERVER ...", Idx, My_Connections[Idx].host, Conf_Server[Conf_GetServer( Idx )].port );
Log( LOG_INFO, "Connection %d with \"%s:%d\" established. Now logging in ...", Idx, My_Connections[Idx].host, Conf_Server[Conf_GetServer( Idx )].port );
/* PASS und SERVER verschicken */
/* Send PASS and SERVER command to peer */
Conn_WriteStr( Idx, "PASS %s %s", Conf_Server[Conf_GetServer( Idx )].pwd_out, NGIRCd_ProtoID );
return Conn_WriteStr( Idx, "SERVER %s :%s", Conf_ServerName, Conf_ServerInfo );
}
#ifdef USE_ZLIB
#ifdef ZLIB
/* Schreibpuffer leer, aber noch Daten im Kompressionsbuffer?
* Dann muss dieser nun geflushed werden! */
if( My_Connections[Idx].wdatalen == 0 ) Zip_Flush( Idx );
@@ -878,7 +928,7 @@ New_Connection( INT Sock )
/* Neue Client-Verbindung von Listen-Socket annehmen und
* CLIENT-Struktur anlegen. */
#ifdef USE_TCPWRAP
#ifdef TCPWRAP
struct request_info req;
#endif
struct sockaddr_in new_addr;
@@ -887,7 +937,7 @@ New_Connection( INT Sock )
CONN_ID idx;
CLIENT *c;
POINTER *ptr;
LONG new_size;
LONG new_size, cnt;
assert( Sock > NONE );
@@ -899,10 +949,11 @@ New_Connection( INT Sock )
Log( LOG_CRIT, "Can't accept connection: %s!", strerror( errno ));
return;
}
#ifdef USE_TCPWRAP
#ifdef TCPWRAP
/* Validate socket using TCP Wrappers */
request_init( &req, RQ_DAEMON, PACKAGE_NAME, RQ_FILE, new_sock, RQ_CLIENT_SIN, &new_addr, NULL );
fromhost(&req);
if( ! hosts_access( &req ))
{
/* Access denied! */
@@ -915,16 +966,27 @@ New_Connection( INT Sock )
/* Socket initialisieren */
Init_Socket( new_sock );
/* Check IP-based connection limit */
cnt = Count_Connections( new_addr );
if(( Conf_MaxConnectionsIP > 0 ) && ( cnt >= Conf_MaxConnectionsIP ))
{
/* Access denied, too many connections from this IP! */
Log( LOG_ERR, "Refused connection from %s: too may connections (%ld) from this IP!", inet_ntoa( new_addr.sin_addr ), cnt);
Simple_Message( new_sock, "ERROR :Connection refused, too many connections from your IP!" );
close( new_sock );
return;
}
/* Freie Connection-Struktur suchen */
for( idx = 0; idx < Pool_Size; idx++ ) if( My_Connections[idx].sock == NONE ) break;
if( idx >= Pool_Size )
{
new_size = Pool_Size + CONNECTION_POOL;
/* Im bisherigen Pool wurde keine freie Connection-Struktur mehr gefunden.
* Wenn erlaubt und moeglich muss nun der Pool vergroessert werden: */
if( Conf_MaxConnections > 0 )
{
/* Es ist ein Limit konfiguriert */
@@ -945,15 +1007,15 @@ New_Connection( INT Sock )
close( new_sock );
return;
}
/* zunaechst realloc() versuchen; wenn das scheitert, malloc() versuchen
* und Daten ggf. "haendisch" umkopieren. (Haesslich! Eine wirklich
* dynamische Verwaltung waere wohl _deutlich_ besser ...) */
ptr = realloc( My_Connections, sizeof( CONNECTION ) * new_size );
ptr = (POINTER *)realloc( My_Connections, sizeof( CONNECTION ) * new_size );
if( ! ptr )
{
/* realloc() ist fehlgeschlagen. Nun malloc() probieren: */
ptr = malloc( sizeof( CONNECTION ) * new_size );
ptr = (POINTER *)malloc( sizeof( CONNECTION ) * new_size );
if( ! ptr )
{
/* Offenbar steht kein weiterer Sepeicher zur Verfuegung :-( */
@@ -962,21 +1024,25 @@ New_Connection( INT Sock )
close( new_sock );
return;
}
/* Struktur umkopieren ... */
memcpy( ptr, My_Connections, sizeof( CONNECTION ) * Pool_Size );
#ifdef DEBUG
Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [malloc()/memcpy()]", new_size, sizeof( CONNECTION ) * new_size );
#endif
}
#ifdef DEBUG
else Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [realloc()]", new_size, sizeof( CONNECTION ) * new_size );
#endif
/* Adjust pointer to new block */
My_Connections = ptr;
My_Connections = (CONNECTION *)ptr;
/* Initialize new items */
for( idx = Pool_Size; idx < new_size; idx++ ) Init_Conn_Struct( idx );
idx = Pool_Size;
/* Adjust new pool size */
Pool_Size = new_size;
}
@@ -1005,13 +1071,17 @@ New_Connection( INT Sock )
/* Hostnamen ermitteln */
strlcpy( My_Connections[idx].host, inet_ntoa( new_addr.sin_addr ), sizeof( My_Connections[idx].host ));
Client_SetHostname( c, My_Connections[idx].host );
#ifdef IDENTAUTH
s = Resolve_Addr( &new_addr, My_Connections[idx].sock );
#else
s = Resolve_Addr( &new_addr );
#endif
if( s )
{
/* Sub-Prozess wurde asyncron gestartet */
My_Connections[idx].res_stat = s;
}
/* Penalty-Zeit setzen */
Conn_SetPenalty( idx, 4 );
} /* New_Connection */
@@ -1032,7 +1102,9 @@ Socket2Index( INT Sock )
{
/* die Connection wurde vermutlich (wegen eines
* Fehlers) bereits wieder abgebaut ... */
#ifdef DEBUG
Log( LOG_DEBUG, "Socket2Index: can't get connection for socket %d!", Sock );
#endif
return NONE;
}
else return idx;
@@ -1046,7 +1118,7 @@ Read_Request( CONN_ID Idx )
* Tritt ein Fehler auf, so wird der Socket geschlossen. */
INT len, bsize;
#ifdef USE_ZLIB
#ifdef ZLIB
CLIENT *c;
#endif
@@ -1056,12 +1128,12 @@ Read_Request( CONN_ID Idx )
/* wenn noch nicht registriert: maximal mit ZREADBUFFER_LEN arbeiten,
* ansonsten koennen Daten ggf. nicht umkopiert werden. */
bsize = READBUFFER_LEN;
#ifdef USE_ZLIB
#ifdef ZLIB
c = Client_GetFromConn( Idx );
if(( Client_Type( c ) != CLIENT_USER ) && ( Client_Type( c ) != CLIENT_SERVER ) && ( Client_Type( c ) != CLIENT_SERVICE ) && ( bsize > ZREADBUFFER_LEN )) bsize = ZREADBUFFER_LEN;
#endif
#ifdef USE_ZLIB
#ifdef ZLIB
if(( bsize - My_Connections[Idx].rdatalen - 1 < 1 ) || ( ZREADBUFFER_LEN - My_Connections[Idx].zip.rdatalen < 1 ))
#else
if( bsize - My_Connections[Idx].rdatalen - 1 < 1 )
@@ -1073,7 +1145,7 @@ Read_Request( CONN_ID Idx )
return;
}
#ifdef USE_ZLIB
#ifdef ZLIB
if( My_Connections[Idx].options & CONN_ZIP )
{
len = recv( My_Connections[Idx].sock, My_Connections[Idx].zip.rbuf + My_Connections[Idx].zip.rdatalen, ( ZREADBUFFER_LEN - My_Connections[Idx].zip.rdatalen ), 0 );
@@ -1128,28 +1200,31 @@ Handle_Buffer( CONN_ID Idx )
CHAR *ptr;
INT len, delta;
BOOLEAN action, result;
#ifdef USE_ZLIB
#ifdef ZLIB
BOOLEAN old_z;
#endif
result = FALSE;
do
{
#ifdef USE_ZLIB
/* Check penalty */
if( My_Connections[Idx].delaytime > time( NULL )) return result;
#ifdef ZLIB
/* ggf. noch unkomprimiete Daten weiter entpacken */
if( My_Connections[Idx].options & CONN_ZIP )
{
if( ! Unzip_Buffer( Idx )) return FALSE;
}
#endif
if( My_Connections[Idx].rdatalen < 1 ) break;
/* Eine komplette Anfrage muss mit CR+LF enden, vgl.
* RFC 2812. Haben wir eine? */
My_Connections[Idx].rbuf[My_Connections[Idx].rdatalen] = '\0';
ptr = strstr( My_Connections[Idx].rbuf, "\r\n" );
if( ptr ) delta = 2;
#ifndef STRICT_RFC
else
@@ -1164,7 +1239,7 @@ Handle_Buffer( CONN_ID Idx )
else if( ptr2 ) ptr = ptr2;
}
#endif
action = FALSE;
if( ptr )
{
@@ -1181,7 +1256,7 @@ Handle_Buffer( CONN_ID Idx )
return FALSE;
}
#ifdef USE_ZLIB
#ifdef ZLIB
/* merken, ob Stream bereits komprimiert wird */
old_z = My_Connections[Idx].options & CONN_ZIP;
#endif
@@ -1198,31 +1273,31 @@ Handle_Buffer( CONN_ID Idx )
My_Connections[Idx].rdatalen -= len;
memmove( My_Connections[Idx].rbuf, My_Connections[Idx].rbuf + len, My_Connections[Idx].rdatalen );
#ifdef USE_ZLIB
#ifdef ZLIB
if(( ! old_z ) && ( My_Connections[Idx].options & CONN_ZIP ) && ( My_Connections[Idx].rdatalen > 0 ))
{
/* Mit dem letzten Befehl wurde Socket-Kompression aktiviert.
* Evtl. schon vom Socket gelesene Daten in den Unzip-Puffer
* umkopieren, damit diese nun zunaechst entkomprimiert werden */
if( My_Connections[Idx].rdatalen > ZREADBUFFER_LEN )
{
if( My_Connections[Idx].rdatalen > ZREADBUFFER_LEN )
{
/* Hupsa! Soviel Platz haben wir aber gar nicht! */
Log( LOG_ALERT, "Can't move read buffer: No space left in unzip buffer (need %d bytes)!", My_Connections[Idx].rdatalen );
return FALSE;
}
memcpy( My_Connections[Idx].zip.rbuf, My_Connections[Idx].rbuf, My_Connections[Idx].rdatalen );
My_Connections[Idx].zip.rdatalen = My_Connections[Idx].rdatalen;
My_Connections[Idx].rdatalen = 0;
Log( LOG_DEBUG, "Moved already received data (%d bytes) to uncompression buffer.", My_Connections[Idx].zip.rdatalen );
/* Hupsa! Soviel Platz haben wir aber gar nicht! */
Log( LOG_ALERT, "Can't move read buffer: No space left in unzip buffer (need %d bytes)!", My_Connections[Idx].rdatalen );
return FALSE;
}
memcpy( My_Connections[Idx].zip.rbuf, My_Connections[Idx].rbuf, My_Connections[Idx].rdatalen );
My_Connections[Idx].zip.rdatalen = My_Connections[Idx].rdatalen;
My_Connections[Idx].rdatalen = 0;
#ifdef DEBUG
Log( LOG_DEBUG, "Moved already received data (%d bytes) to uncompression buffer.", My_Connections[Idx].zip.rdatalen );
#endif /* DEBUG */
}
#endif
#endif /* ZLIB */
}
if( action ) result = TRUE;
} while( action );
return result;
} /* Handle_Buffer */
@@ -1251,14 +1326,18 @@ Check_Connections( VOID )
if( My_Connections[i].lastping < time( NULL ) - Conf_PongTimeout )
{
/* Timeout */
#ifdef DEBUG
Log( LOG_DEBUG, "Connection %d: Ping timeout: %d seconds.", i, Conf_PongTimeout );
#endif
Conn_Close( i, NULL, "Ping timeout", TRUE );
}
}
else if( My_Connections[i].lastdata < time( NULL ) - Conf_PingTimeout )
{
/* es muss ein PING gesendet werden */
#ifdef DEBUG
Log( LOG_DEBUG, "Connection %d: sending PING ...", i );
#endif
My_Connections[i].lastping = time( NULL );
Conn_WriteStr( i, "PING :%s", Client_ID( Client_ThisServer( )));
}
@@ -1269,7 +1348,9 @@ Check_Connections( VOID )
if( My_Connections[i].lastdata < time( NULL ) - Conf_PingTimeout )
{
/* Timeout */
#ifdef DEBUG
Log( LOG_DEBUG, "Connection %d timed out ...", i );
#endif
Conn_Close( i, NULL, "Timeout", FALSE );
}
}
@@ -1325,7 +1406,9 @@ Check_Servers( VOID )
Log( LOG_ALERT, "Can't establist server connection: connection limit reached (%d)!", Pool_Size );
return;
}
#ifdef DEBUG
Log( LOG_DEBUG, "Preparing connection %d for \"%s\" ...", idx, Conf_Server[i].host );
#endif
/* Verbindungs-Struktur initialisieren */
Init_Conn_Struct( idx );
@@ -1348,7 +1431,7 @@ Check_Servers( VOID )
LOCAL VOID
New_Server( INT Server, CONN_ID Idx )
{
/* Neue Server-Verbindung aufbauen */
/* Establish new server link */
struct sockaddr_in new_addr;
struct in_addr inaddr;
@@ -1358,11 +1441,12 @@ New_Server( INT Server, CONN_ID Idx )
assert( Server > NONE );
assert( Idx > NONE );
/* Wurde eine gueltige IP-Adresse gefunden? */
/* Did we get a valid IP address? */
if( ! Conf_Server[Server].ip[0] )
{
/* Nein. Verbindung wieder freigeben: */
/* No. Free connection structure and abort: */
Init_Conn_Struct( Idx );
Conf_Server[Server].conn_id = NONE;
Log( LOG_ERR, "Can't connect to \"%s\" (connection %d): ip address unknown!", Conf_Server[Server].host, Idx );
return;
}
@@ -1377,8 +1461,9 @@ New_Server( INT Server, CONN_ID Idx )
if( inaddr.s_addr == (unsigned)-1 )
#endif
{
/* Konnte Adresse nicht konvertieren */
/* Can't convert IP address */
Init_Conn_Struct( Idx );
Conf_Server[Server].conn_id = NONE;
Log( LOG_ERR, "Can't connect to \"%s\" (connection %d): can't convert ip address %s!", Conf_Server[Server].host, Idx, Conf_Server[Server].ip );
return;
}
@@ -1391,7 +1476,9 @@ New_Server( INT Server, CONN_ID Idx )
new_sock = socket( PF_INET, SOCK_STREAM, 0 );
if ( new_sock < 0 )
{
/* Can't create socket */
Init_Conn_Struct( Idx );
Conf_Server[Server].conn_id = NONE;
Log( LOG_CRIT, "Can't create socket: %s!", strerror( errno ));
return;
}
@@ -1401,9 +1488,11 @@ New_Server( INT Server, CONN_ID Idx )
res = connect( new_sock, (struct sockaddr *)&new_addr, sizeof( new_addr ));
if(( res != 0 ) && ( errno != EINPROGRESS ))
{
/* Can't connect socket */
Log( LOG_CRIT, "Can't connect socket: %s!", strerror( errno ));
close( new_sock );
Init_Conn_Struct( Idx );
Conf_Server[Server].conn_id = NONE;
return;
}
@@ -1411,25 +1500,29 @@ New_Server( INT Server, CONN_ID Idx )
c = Client_NewLocal( Idx, inet_ntoa( new_addr.sin_addr ), CLIENT_UNKNOWNSERVER, FALSE );
if( ! c )
{
/* Can't create new client structure */
close( new_sock );
Init_Conn_Struct( Idx );
Conf_Server[Server].conn_id = NONE;
Log( LOG_ALERT, "Can't establish connection: can't create client structure!" );
return;
}
Client_SetIntroducer( c, c );
Client_SetToken( c, TOKEN_OUTBOUND );
/* Verbindung registrieren */
/* Register connection */
My_Connections[Idx].sock = new_sock;
My_Connections[Idx].addr = new_addr;
strlcpy( My_Connections[Idx].host, Conf_Server[Server].host, sizeof( My_Connections[Idx].host ));
/* Neuen Socket registrieren */
/* Register new socket */
FD_SET( new_sock, &My_Sockets );
FD_SET( new_sock, &My_Connects );
if( new_sock > Conn_MaxFD ) Conn_MaxFD = new_sock;
#ifdef DEBUG
Log( LOG_DEBUG, "Registered new connection %d on socket %d.", Idx, My_Connections[Idx].sock );
#endif
} /* New_Server */
@@ -1457,7 +1550,7 @@ Init_Conn_Struct( CONN_ID Idx )
My_Connections[Idx].flag = 0;
My_Connections[Idx].options = 0;
#ifdef USE_ZLIB
#ifdef ZLIB
My_Connections[Idx].zip.rbuf[0] = '\0';
My_Connections[Idx].zip.rdatalen = 0;
My_Connections[Idx].zip.wbuf[0] = '\0';
@@ -1471,24 +1564,40 @@ Init_Conn_Struct( CONN_ID Idx )
LOCAL BOOLEAN
Init_Socket( INT Sock )
{
/* Socket-Optionen setzen */
/* Initialize socket (set options) */
INT on = 1;
INT value;
#ifdef O_NONBLOCK /* A/UX kennt das nicht? */
#ifdef O_NONBLOCK /* unknown on A/UX */
if( fcntl( Sock, F_SETFL, O_NONBLOCK ) != 0 )
{
Log( LOG_CRIT, "Can't enable non-blocking mode: %s!", strerror( errno ));
Log( LOG_CRIT, "Can't enable non-blocking mode for socket: %s!", strerror( errno ));
close( Sock );
return FALSE;
}
#endif
if( setsockopt( Sock, SOL_SOCKET, SO_REUSEADDR, &on, (socklen_t)sizeof( on )) != 0)
/* Don't block this port after socket shutdown */
value = 1;
if( setsockopt( Sock, SOL_SOCKET, SO_REUSEADDR, &value, (socklen_t)sizeof( value )) != 0 )
{
Log( LOG_ERR, "Can't set socket options: %s!", strerror( errno ));
/* dieser Fehler kann ignoriert werden. */
Log( LOG_ERR, "Can't set socket option SO_REUSEADDR: %s!", strerror( errno ));
/* ignore this error */
}
/* Set type of service (TOS) */
#if defined(IP_TOS) && defined(IPTOS_LOWDELAY)
value = IPTOS_LOWDELAY;
#ifdef DEBUG
Log( LOG_DEBUG, "Setting option IP_TOS on socket %d to IPTOS_LOWDELAY (%d).", Sock, value );
#endif
if( setsockopt( Sock, SOL_IP, IP_TOS, &value, (socklen_t)sizeof( value )) != 0 )
{
Log( LOG_ERR, "Can't set socket option IP_TOS: %s!", strerror( errno ));
/* ignore this error */
}
#endif
return TRUE;
} /* Init_Socket */
@@ -1496,65 +1605,132 @@ Init_Socket( INT Sock )
LOCAL VOID
Read_Resolver_Result( INT r_fd )
{
/* Ergebnis von Resolver Sub-Prozess aus Pipe lesen
* und entsprechende Connection aktualisieren */
/* Read result of resolver sub-process from pipe and update the
* apropriate connection/client structure(s): hostname and/or
* IDENT user name.*/
CHAR result[HOST_LEN];
CLIENT *c;
INT len, i, n;
RES_STAT *s;
CHAR *ptr;
FD_CLR( r_fd, &Resolver_FDs );
/* Search associated connection ... */
for( i = 0; i < Pool_Size; i++ )
{
if(( My_Connections[i].sock != NONE )
&& ( My_Connections[i].res_stat != NULL )
&& ( My_Connections[i].res_stat->pipe[0] == r_fd ))
break;
}
if( i >= Pool_Size )
{
/* Ops, none found? Probably the connection has already
* been closed!? We'll ignore that ... */
FD_CLR( r_fd, &Resolver_FDs );
close( r_fd );
#ifdef DEBUG
Log( LOG_DEBUG, "Resolver: Got result for unknown connection!?" );
#endif
return;
}
/* Anfrage vom Parent lesen */
len = read( r_fd, result, HOST_LEN - 1 );
/* Get resolver structure */
s = My_Connections[i].res_stat;
assert( s != NULL );
/* Read result from pipe */
len = read( r_fd, s->buffer + s->bufpos, sizeof( s->buffer ) - s->bufpos - 1 );
if( len < 0 )
{
/* Fehler beim Lesen aus der Pipe */
/* Error! */
close( r_fd );
Log( LOG_CRIT, "Resolver: Can't read result: %s!", strerror( errno ));
return;
}
result[len] = '\0';
s->bufpos += len;
s->buffer[s->bufpos] = '\0';
/* zugehoerige Connection suchen */
for( i = 0; i < Pool_Size; i++ )
/* If the result string is incomplete, return to main loop and
* wait until we can read in more bytes. */
#ifdef IDENTAUTH
try_resolve:
#endif
ptr = strchr( s->buffer, '\n' );
if( ! ptr ) return;
*ptr = '\0';
#ifdef DEBUG
Log( LOG_DEBUG, "Got result from resolver: \"%s\" (%d bytes), stage %d.", s->buffer, len, s->stage );
#endif
/* Okay, we got a complete result: this is a host name for outgoing
* connections and a host name or IDENT user name (if enabled) for
* incoming conneciions.*/
if( My_Connections[i].sock > NONE )
{
if(( My_Connections[i].sock != NONE ) && ( My_Connections[i].res_stat ) && ( My_Connections[i].res_stat->pipe[0] == r_fd )) break;
/* Incoming connection */
/* Search client ... */
c = Client_GetFromConn( i );
assert( c != NULL );
/* Only update client information of unregistered clients */
if( Client_Type( c ) == CLIENT_UNKNOWN )
{
if( s->stage == 0 )
{
/* host name */
strlcpy( My_Connections[i].host, s->buffer, sizeof( My_Connections[i].host ));
Client_SetHostname( c, s->buffer );
#ifdef IDENTAUTH
/* clean up buffer for IDENT result */
len = strlen( s->buffer ) + 1;
memmove( s->buffer, s->buffer + len, sizeof( s->buffer ) - len );
s->bufpos -= len;
/* Don't close pipe and clean up, but
* instead wait for IDENT result */
s->stage = 1;
goto try_resolve;
}
else if( s->stage == 1 )
{
/* IDENT user name */
if( s->buffer[0] )
{
Log( LOG_INFO, "IDENT lookup for connection %ld: \"%s\".", i, s->buffer );
Client_SetUser( c, s->buffer, TRUE );
}
else Log( LOG_INFO, "IDENT lookup for connection %ld: no result.", i );
#endif
}
else Log( LOG_ERR, "Resolver: got result for unknown stage %d!?", s->stage );
}
#ifdef DEBUG
else Log( LOG_DEBUG, "Resolver: discarding result for already registered connection %d.", i );
#endif
}
if( i >= Pool_Size )
else
{
/* Opsa! Keine passende Connection gefunden!? Vermutlich
* wurde sie schon wieder geschlossen. */
close( r_fd );
Log( LOG_DEBUG, "Resolver: Got result for unknown connection!?" );
return;
/* Outgoing connection (server link): set the IP address
* so that we can connect to it in the main loop. */
/* Search server ... */
n = Conf_GetServer( i );
assert( n > NONE );
strlcpy( Conf_Server[n].ip, s->buffer, sizeof( Conf_Server[n].ip ));
}
Log( LOG_DEBUG, "Resolver: %s is \"%s\".", My_Connections[i].host, result );
/* Aufraeumen */
/* Clean up ... */
FD_CLR( r_fd, &Resolver_FDs );
close( My_Connections[i].res_stat->pipe[0] );
close( My_Connections[i].res_stat->pipe[1] );
free( My_Connections[i].res_stat );
My_Connections[i].res_stat = NULL;
if( My_Connections[i].sock > NONE )
{
/* Eingehende Verbindung: Hostnamen setzen */
c = Client_GetFromConn( i );
assert( c != NULL );
strlcpy( My_Connections[i].host, result, sizeof( My_Connections[i].host ));
Client_SetHostname( c, result );
}
else
{
/* Ausgehende Verbindung (=Server): IP setzen */
n = Conf_GetServer( i );
if( n > NONE ) strlcpy( Conf_Server[n].ip, result, sizeof( Conf_Server[n].ip ));
else Log( LOG_ERR, "Got resolver result for non-configured server!?" );
}
/* Penalty-Zeit zurueck setzen */
/* Reset penalty time */
Conn_ResetPenalty( i );
} /* Read_Resolver_Result */
@@ -1574,4 +1750,18 @@ Simple_Message( INT Sock, CHAR *Msg )
} /* Simple_Error */
LOCAL INT
Count_Connections( struct sockaddr_in addr_in )
{
INT i, cnt;
cnt = 0;
for( i = 0; i < Pool_Size; i++ )
{
if(( My_Connections[i].sock > NONE ) && ( My_Connections[i].addr.sin_addr.s_addr == addr_in.sin_addr.s_addr )) cnt++;
}
return cnt;
} /* Count_Connections */
/* -eof- */

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conn.h,v 1.31 2003/03/27 01:20:22 alex Exp $
* $Id: conn.h,v 1.32 2003/12/26 15:55:07 alex Exp $
*
* Connection management (header)
*/
@@ -23,7 +23,7 @@
#define CONN_ISCLOSING 1 /* Conn_Close() already called */
#ifdef USE_ZLIB
#ifdef ZLIB
#define CONN_ZIP 2 /* zlib compressed link */
#endif
@@ -36,7 +36,7 @@ typedef INT CONN_ID;
#include "defines.h"
#include "resolve.h"
#ifdef USE_ZLIB
#ifdef ZLIB
#include <zlib.h>
typedef struct _ZipData
{
@@ -48,7 +48,7 @@ typedef struct _ZipData
INT wdatalen; /* Length of data in write buffer (uncompressed) */
LONG bytes_in, bytes_out; /* Counter for statistics (uncompressed!) */
} ZIPDATA;
#endif /* USE_ZLIB */
#endif /* ZLIB */
typedef struct _Connection
{
@@ -69,9 +69,9 @@ typedef struct _Connection
LONG msg_in, msg_out; /* Received and sent IRC messages */
INT flag; /* Flag (see "irc-write" module) */
INT options; /* Link options */
#ifdef USE_ZLIB
#ifdef ZLIB
ZIPDATA zip; /* Compression information */
#endif /* USE_ZLIB */
#endif /* ZLIB */
} CONNECTION;
GLOBAL CONNECTION *My_Connections;

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: defines.h,v 1.42 2003/02/23 12:03:39 alex Exp $
* $Id: defines.h,v 1.45.2.1 2004/05/07 11:24:18 alex Exp $
*
* Global defines of ngIRCd.
*/
@@ -19,8 +19,6 @@
#define NONE -1
#define TIME_RES 2 /* Zeit-Aufloesung des Servers in Sekunden */
#define FNAME_LEN 256 /* max. Laenge eines Dateinamen */
#define LINE_LEN 256 /* max. Laenge einer Konfigurationszeile */
@@ -59,7 +57,7 @@
#define READBUFFER_LEN 2048 /* Laenge des Lesepuffers je Verbindung (Bytes) */
#define WRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers je Verbindung (Bytes) */
#ifdef USE_ZLIB
#ifdef ZLIB
#define ZREADBUFFER_LEN 1024 /* Laenge des Lesepuffers je Verbindung (Bytes) */
#define ZWRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers fuer Kompression (Bytes) */
#endif
@@ -69,7 +67,7 @@
#define PROTOIRCPLUS "-IRC+" /* Protokoll-Suffix f<>r IRC+-Protokoll */
#ifdef IRCPLUS
# define IRCPLUSFLAGS "C" /* IRC+-Flags, die immer zutreffen */
# define IRCPLUSFLAGS "CL" /* IRC+-Flags, die immer zutreffen */
#endif
#define STARTUP_DELAY 1 /* Erst n Sek. nach Start zu anderen Servern verbinden */
@@ -85,6 +83,8 @@
#define CONFIG_FILE "/ngircd.conf"
#define MOTD_FILE "/ngircd.motd"
#define MOTD_PHRASE ""
#define CHROOT_DIR ""
#define ERROR_DIR "/tmp"

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-channel.c,v 1.25 2003/01/08 22:04:05 alex Exp $";
static char UNUSED id[] = "$Id: irc-channel.c,v 1.27 2004/04/09 20:46:48 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -68,7 +68,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
channame = strtok( Req->argv[0], "," );
while( channame )
{
chan = flags = NULL;
chan = NULL; flags = NULL;
/* wird der Channel neu angelegt? */
if( Channel_Search( channame )) is_new_chan = FALSE;
@@ -86,7 +86,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
}
}
/* Lokaler Client? */
/* Local client? */
if( Client_Type( Client ) == CLIENT_USER )
{
/* Test if the user has reached his maximum channel count */
@@ -159,6 +159,16 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
}
}
}
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) */
if( ! Channel_Join( target, channame ))

View File

@@ -14,15 +14,17 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-info.c,v 1.16 2003/04/21 10:54:30 alex Exp $";
static char UNUSED id[] = "$Id: irc-info.c,v 1.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"
@@ -76,6 +78,7 @@ IRC_ADMIN(CLIENT *Client, REQUEST *Req )
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 */
@@ -160,7 +163,8 @@ IRC_LINKS( CLIENT *Client, REQUEST *Req )
}
c = Client_Next( c );
}
IRC_SetPenalty( target, 1 );
return IRC_WriteStrClient( target, RPL_ENDOFLINKS_MSG, Client_ID( target ), mask );
} /* IRC_LINKS */
@@ -196,6 +200,7 @@ IRC_LUSERS( CLIENT *Client, REQUEST *Req )
IRC_Send_LUSERS( target );
IRC_SetPenalty( target, 1 );
return CONNECTED;
} /* IRC_LUSERS */
@@ -229,6 +234,7 @@ IRC_MOTD( CLIENT *Client, REQUEST *Req )
}
}
IRC_SetPenalty( from, 3 );
return IRC_Show_MOTD( from );
} /* IRC_MOTD */
@@ -323,6 +329,7 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req )
if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED;
}
IRC_SetPenalty( from, 1 );
return IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), "*" );
} /* IRC_NAMES */
@@ -373,7 +380,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
if( cl && (( Client_Type( cl ) == CLIENT_SERVER ) || ( cl == Client )))
{
/* Server link or our own connection */
#ifdef USE_ZLIB
#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;
@@ -401,6 +408,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
break;
}
IRC_SetPenalty( from, 2 );
return IRC_WriteStrClient( from, RPL_ENDOFSTATS_MSG, Client_ID( from ), query );
} /* IRC_STATS */
@@ -486,6 +494,9 @@ 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 );
@@ -513,7 +524,16 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req )
}
/* 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 */
@@ -750,9 +770,17 @@ 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 )
{
@@ -760,11 +788,15 @@ IRC_Show_MOTD( CLIENT *Client )
return IRC_WriteStrClient( Client, ERR_NOMOTD_MSG, Client_ID( Client ) );
}
IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )));
if( ! IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )))) return DISCONNECTED;
while( TRUE )
{
if( ! fgets( line, 126, fd )) break;
if( line[strlen( line ) - 1] == '\n' ) line[strlen( line ) - 1] = '\0';
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 );

View File

@@ -14,13 +14,14 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-login.c,v 1.34 2003/03/31 15:54:21 alex Exp $";
static char UNUSED id[] = "$Id: irc-login.c,v 1.40 2004/03/11 22:16:31 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "ngircd.h"
#include "resolve.h"
@@ -34,6 +35,7 @@ static char UNUSED id[] = "$Id: irc-login.c,v 1.34 2003/03/31 15:54:21 alex Exp
#include "irc.h"
#include "irc-info.h"
#include "irc-write.h"
#include "cvs-version.h"
#include "exp.h"
#include "irc-login.h"
@@ -223,6 +225,7 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
/* neuen Client-Nick speichern */
Client_SetID( target, Req->argv[0] );
IRC_SetPenalty( target, 2 );
}
return CONNECTED;
@@ -283,6 +286,10 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_USER( CLIENT *Client, REQUEST *Req )
{
#ifdef IDENTAUTH
CHAR *ptr;
#endif
assert( Client != NULL );
assert( Req != NULL );
@@ -292,11 +299,21 @@ IRC_USER( CLIENT *Client, REQUEST *Req )
if( Client_Type( Client ) == CLIENT_GOTNICK || Client_Type( Client ) == CLIENT_GOTPASS )
#endif
{
/* Falsche Anzahl Parameter? */
/* Wrong number of parameters? */
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_SetInfo( Client, Req->argv[3] );
#endif
/* "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 ));
if( Client_Type( Client ) == CLIENT_GOTNICK ) return Hello_User( Client );
@@ -428,12 +445,16 @@ IRC_PONG( CLIENT *Client, REQUEST *Req )
LOCAL BOOLEAN
Hello_User( CLIENT *Client )
{
#ifdef CVSDATE
CHAR ver[12], vertxt[30];
#endif
assert( Client != NULL );
/* Passwort ueberpruefen */
/* Check password ... */
if( strcmp( Client_Password( Client ), Conf_ServerPwd ) != 0 )
{
/* Falsches Passwort */
/* Bad password! */
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 );
return DISCONNECTED;
@@ -441,13 +462,29 @@ Hello_User( CLIENT *Client )
Log( LOG_NOTICE, "User \"%s\" registered (connection %d).", Client_Mask( Client ), Client_Conn( Client ));
/* Andere Server informieren */
/* Inform other servers */
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;
/* 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;
#ifdef CVSDATE
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;
@@ -457,6 +494,9 @@ Hello_User( CLIENT *Client )
if( ! IRC_Send_LUSERS( Client )) return DISCONNECTED;
if( ! IRC_Show_MOTD( Client )) return DISCONNECTED;
/* Suspend the client for a second ... */
IRC_SetPenalty( Client, 1 );
return CONNECTED;
} /* Hello_User */
@@ -469,7 +509,7 @@ Kill_Nick( CHAR *Nick, CHAR *Reason )
assert( Nick != NULL );
assert( Reason != NULL );
r.prefix = Client_ThisServer( );
r.prefix = (CHAR *)Client_ThisServer( );
r.argv[0] = Nick;
r.argv[1] = Reason;
r.argc = 2;

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-mode.c,v 1.31 2003/01/21 21:04:16 alex Exp $";
static char UNUSED id[] = "$Id: irc-mode.c,v 1.35 2004/04/25 15:42:05 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -225,12 +225,13 @@ client_exit:
else
{
/* Send reply to client and inform other servers */
ok = IRC_WriteStrClientPrefix( Client, Origin, "MODE %s %s", Client_ID( Target ), the_modes );
ok = IRC_WriteStrClientPrefix( Client, Origin, "MODE %s :%s", Client_ID( Target ), the_modes );
IRC_WriteStrServersPrefix( Client, Origin, "MODE %s :%s", Client_ID( Target ), the_modes );
}
Log( LOG_DEBUG, "User \"%s\": Mode change, now \"%s\".", Client_Mask( Target ), Client_Modes( Target ));
}
IRC_SetPenalty( Client, 1 );
return ok;
} /* Client_Mode */
@@ -598,6 +599,7 @@ chan_exit:
}
}
IRC_SetPenalty( Client, 1 );
return CONNECTED;
} /* Channel_Mode */
@@ -633,6 +635,7 @@ LOCAL BOOLEAN
Add_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern )
{
CHAR *mask;
BOOLEAN already;
assert( Client != NULL );
assert( Channel != NULL );
@@ -640,7 +643,12 @@ Add_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern )
mask = Lists_MakeMask( Pattern );
if( ! Lists_AddInvited( Prefix, mask, Channel, FALSE )) return CONNECTED;
already = Lists_IsInviteEntry( mask, Channel );
if( ! Lists_AddInvited( mask, Channel, FALSE )) return CONNECTED;
if(( Client_Type( Prefix ) == CLIENT_SERVER ) && ( already == TRUE )) return CONNECTED;
return Send_ListChange( "+I", Prefix, Client, Channel, mask );
} /* Add_Invite */
@@ -649,6 +657,7 @@ LOCAL BOOLEAN
Add_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern )
{
CHAR *mask;
BOOLEAN already;
assert( Client != NULL );
assert( Channel != NULL );
@@ -656,7 +665,12 @@ Add_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern )
mask = Lists_MakeMask( Pattern );
if( ! Lists_AddBanned( Prefix, mask, Channel )) return CONNECTED;
already = Lists_IsBanEntry( mask, Channel );
if( ! Lists_AddBanned( mask, Channel )) return CONNECTED;
if(( Client_Type( Prefix ) == CLIENT_SERVER ) && ( already == TRUE )) return CONNECTED;
return Send_ListChange( "+b", Prefix, Client, Channel, mask );
} /* Add_Ban */

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-op.c,v 1.11 2002/12/12 12:24:18 alex Exp $";
static char UNUSED id[] = "$Id: irc-op.c,v 1.13 2004/04/09 21:41:52 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -69,14 +69,14 @@ IRC_INVITE( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
/* Wrong number of parameters? */
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 );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* User suchen */
/* Search user */
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] );
@@ -84,36 +84,38 @@ IRC_INVITE( CLIENT *Client, REQUEST *Req )
if( chan )
{
/* Der Channel existiert bereits; ist der User Mitglied? */
/* Channel exists. Is the user a valid member of the channel? */
if( ! Channel_IsMemberOf( chan, from )) return IRC_WriteStrClient( from, ERR_NOTONCHANNEL_MSG, Client_ID( Client ), Req->argv[1] );
/* Ist der Channel "invite-only"? */
/* Is the channel "invite-only"? */
if( strchr( Channel_Modes( chan ), 'i' ))
{
/* Ja. Der User muss Channel-Operator sein! */
/* Yes. The user must be channel operator! */
if( ! strchr( Channel_UserModes( chan, from ), 'o' )) return IRC_WriteStrClient( from, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( from ), Channel_Name( chan ));
remember = TRUE;
}
/* Ist der Ziel-User bereits Mitglied? */
/* Is the target user already member of the channel? */
if( Channel_IsMemberOf( chan, target )) return IRC_WriteStrClient( from, ERR_USERONCHANNEL_MSG, Client_ID( 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;
/* 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] );
if( remember )
{
if( ! Lists_AddInvited( from, Client_Mask( target ), chan, TRUE )) return CONNECTED;
}
/* an Ziel-Client forwarden ... */
/* Inform target client */
IRC_WriteStrClientPrefix( target, from, "INVITE %s %s", Req->argv[0], Req->argv[1] );
if( Client_Conn( target ) > NONE )
{
/* lokaler Ziel-Client, Status-Code melden */
/* The target user is local, so we have to send the status code */
if( ! IRC_WriteStrClientPrefix( from, target, RPL_INVITING_MSG, Client_ID( from ), Req->argv[0], Req->argv[1] )) return DISCONNECTED;
}

View File

@@ -14,14 +14,16 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-server.c,v 1.32 2003/04/20 23:09:26 alex Exp $";
static char UNUSED id[] = "$Id: irc-server.c,v 1.36.2.1 2004/05/15 23:52:17 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "defines.h"
#include "resolve.h"
#include "conn.h"
#include "conn-zip.h"
@@ -29,6 +31,7 @@ static char UNUSED id[] = "$Id: irc-server.c,v 1.32 2003/04/20 23:09:26 alex Exp
#include "client.h"
#include "channel.h"
#include "irc-write.h"
#include "lists.h"
#include "log.h"
#include "messages.h"
#include "parse.h"
@@ -117,7 +120,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
Client_SetType( Client, CLIENT_SERVER );
Conf_SetServer( i, con );
#ifdef USE_ZLIB
#ifdef ZLIB
/* Kompression initialisieren, wenn erforderlich */
if( strchr( Client_Flags( Client ), 'Z' ))
{
@@ -182,6 +185,9 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
/* Send CHANINFO if the peer supports it */
if( strchr( Client_Flags( Client ), 'C' ))
{
#ifdef DEBUG
Log( LOG_DEBUG, "Sending CHANINFO commands ..." );
#endif
modes = Channel_Modes( chan );
topic = Channel_Topic( chan );
@@ -238,6 +244,18 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
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 */
chan = Channel_Next( chan );
}
@@ -344,6 +362,8 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
}
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 );

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-write.c,v 1.14 2002/12/30 17:15:42 alex Exp $";
static char UNUSED id[] = "$Id: irc-write.c,v 1.15 2003/11/05 23:24:48 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -395,6 +395,21 @@ va_dcl
} /* 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 *
Get_Prefix( CLIENT *Target, CLIENT *Client )
{

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-write.h,v 1.5 2002/12/12 12:23:43 alex Exp $
* $Id: irc-write.h,v 1.6 2003/11/05 23:24:48 alex Exp $
*
* Sending IRC commands over the network (header)
*/
@@ -18,17 +18,19 @@
#define __irc_write_h__
GLOBAL BOOLEAN IRC_WriteStrClient PARAMS((CLIENT *Client, CHAR *Format, ... ));
GLOBAL BOOLEAN IRC_WriteStrClientPrefix PARAMS((CLIENT *Client, CLIENT *Prefix, 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_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_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 VOID IRC_WriteStrServers PARAMS((CLIENT *ExceptOf, 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_WriteStrServers PARAMS(( CLIENT *ExceptOf, 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 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

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
* 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
@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc.c,v 1.120 2003/03/31 15:54:21 alex Exp $";
static char UNUSED id[] = "$Id: irc.c,v 1.124 2004/02/28 02:18:16 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -95,8 +95,30 @@ IRC_KILL( CLIENT *Client, REQUEST *Req )
if( c )
{
/* Yes, there is such a client -- but is it a valid user? */
if( Client_Type( c ) == CLIENT_SERVER ) IRC_WriteStrClient( Client, ERR_CANTKILLSERVER_MSG, Client_ID( Client ));
else if( Client_Type( c ) != CLIENT_USER )IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
if( Client_Type( c ) == CLIENT_SERVER )
{
if( Client != Client_ThisServer( )) IRC_WriteStrClient( Client, ERR_CANTKILLSERVER_MSG, Client_ID( Client ));
else
{
/* Oops, I should kill another server!? */
Log( LOG_ERR, "Can't KILL server \"%s\"!", Req->argv[0] );
conn = Client_Conn( Client_NextHop( c ));
assert( conn > NONE );
Conn_Close( conn, NULL, "Nick collision for server!?", TRUE );
}
}
else if( Client_Type( c ) != CLIENT_USER )
{
if( Client != Client_ThisServer( )) IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
else
{
/* Oops, what sould I close?? */
Log( LOG_ERR, "Can't KILL \"%s\": invalid client type!", Req->argv[0] );
conn = Client_Conn( Client_NextHop( c ));
assert( conn > NONE );
Conn_Close( conn, NULL, "Collision for invalid client type!?", TRUE );
}
}
else
{
/* Kill user NOW! */
@@ -188,6 +210,7 @@ IRC_TRACE( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target, *c;
CONN_ID idx, idx2;
CHAR user[CLIENT_USER_LEN];
assert( Client != NULL );
assert( Req != NULL );
@@ -229,7 +252,9 @@ IRC_TRACE( CLIENT *Client, REQUEST *Req )
if( Client_Type( c ) == CLIENT_SERVER )
{
/* Server link */
if( ! IRC_WriteStrClient( from, RPL_TRACESERVER_MSG, Client_ID( from ), Client_ID( c ), Client_Mask( c ), Option_String( Client_Conn( c )))) return DISCONNECTED;
strlcpy( user, Client_User( c ), sizeof( user ));
if( user[0] == '~' ) strlcpy( user, "unknown", sizeof( user ));
if( ! IRC_WriteStrClient( from, RPL_TRACESERVER_MSG, Client_ID( from ), Client_ID( c ), user, Client_Hostname( c ), Client_Mask( Client_ThisServer( )), Option_String( Client_Conn( c )))) return DISCONNECTED;
}
if(( Client_Type( c ) == CLIENT_USER ) && ( strchr( Client_Modes( c ), 'o' )))
{
@@ -240,9 +265,7 @@ IRC_TRACE( CLIENT *Client, REQUEST *Req )
c = Client_Next( c );
}
/* Some information about us */
if( ! IRC_WriteStrClient( from, RPL_TRACESERVER_MSG, Client_ID( from ), Conf_ServerName, Client_Mask( Client_ThisServer( )), Option_String( Client_Conn( Client )))) return DISCONNECTED;
IRC_SetPenalty( Client, 3 );
return IRC_WriteStrClient( from, RPL_TRACEEND_MSG, Client_ID( from ), Conf_ServerName, PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel );
} /* IRC_TRACE */
@@ -264,6 +287,8 @@ IRC_HELP( CLIENT *Client, REQUEST *Req )
if( ! IRC_WriteStrClient( Client, "NOTICE %s :%s", Client_ID( Client ), cmd->name )) return DISCONNECTED;
cmd++;
}
IRC_SetPenalty( Client, 2 );
return CONNECTED;
} /* IRC_HELP */
@@ -277,7 +302,7 @@ Option_String( CONN_ID Idx )
options = Conn_Options( Idx );
strcpy( option_txt, "F" ); /* No idea what this means but the original ircd sends it ... */
#ifdef USE_ZLIB
#ifdef ZLIB
if( options & CONN_ZIP ) strcat( option_txt, "z" );
#endif

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* Copyright (c)2001-2005 Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: lists.c,v 1.11 2002/12/26 16:25:43 alex Exp $";
static char UNUSED id[] = "$Id: lists.c,v 1.15.2.1 2005/01/26 13:27:01 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -30,6 +30,7 @@ static char UNUSED id[] = "$Id: lists.c,v 1.11 2002/12/26 16:25:43 alex Exp $";
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "exp.h"
#include "lists.h"
@@ -101,19 +102,24 @@ Lists_CheckInvited( CLIENT *Client, CHANNEL *Chan )
GLOBAL BOOLEAN
Lists_AddInvited( CLIENT *From, CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )
Lists_IsInviteEntry( CHAR *Mask, CHANNEL *Chan )
{
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;
assert( Mask != NULL );
assert( Chan != NULL );
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;
}
if( Already_Registered( My_Invites, Mask, Chan )) return TRUE;
c2c = New_C2C( Mask, Chan, OnlyOnce );
if( ! c2c )
@@ -180,6 +186,40 @@ Lists_ShowInvites( CLIENT *Client, CHANNEL *Channel )
} /* 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
Lists_CheckBanned( CLIENT *Client, CHANNEL *Chan )
{
@@ -188,19 +228,24 @@ Lists_CheckBanned( CLIENT *Client, CHANNEL *Chan )
GLOBAL BOOLEAN
Lists_AddBanned( CLIENT *From, CHAR *Mask, CHANNEL *Chan )
Lists_IsBanEntry( 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;
assert( Mask != NULL );
assert( Chan != NULL );
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;
}
if( Already_Registered( My_Bans, Mask, Chan )) return TRUE;
c2c = New_C2C( Mask, Chan, FALSE );
if( ! c2c )
@@ -315,9 +360,10 @@ Lists_DeleteChannel( CHANNEL *Chan )
GLOBAL CHAR *
Lists_MakeMask( CHAR *Pattern )
{
/* Hier wird aus einem "beliebigen" Pattern eine gueltige IRC-Mask erzeugt.
* Diese ist aber nur bis zum naechsten Aufruf von Lists_MakeMask() gueltig,
* da ein einziger globaler Puffer verwendet wird. ->Umkopieren!*/
/* This function generats a valid IRC mask of "any" string. This
* mask is only valid until the next call to Lists_MakeMask(),
* because a single global buffer is used. You have to copy the
* generated mask to some sane location yourself! */
STATIC CHAR TheMask[MASK_LEN];
CHAR *excl, *at;
@@ -331,7 +377,7 @@ Lists_MakeMask( CHAR *Pattern )
if(( ! at ) && ( ! excl ))
{
/* weder ! noch @ vorhanden: als Nick annehmen */
/* Neither "!" nor "@" found: use string as nick name */
strlcpy( TheMask, Pattern, sizeof( TheMask ) - 5 );
strlcat( TheMask, "!*@*", sizeof( TheMask ));
return TheMask;
@@ -339,7 +385,7 @@ Lists_MakeMask( CHAR *Pattern )
if(( ! at ) && ( excl ))
{
/* Domain fehlt */
/* Domain part is missing */
strlcpy( TheMask, Pattern, sizeof( TheMask ) - 3 );
strlcat( TheMask, "@*", sizeof( TheMask ));
return TheMask;
@@ -347,15 +393,15 @@ Lists_MakeMask( CHAR *Pattern )
if(( at ) && ( ! excl ))
{
/* User fehlt */
/* User name is missing */
*at = '\0'; at++;
strlcpy( TheMask, Pattern, sizeof( TheMask ) - strlen( at ) - 4 );
strlcpy( TheMask, Pattern, sizeof( TheMask ) - 5 );
strlcat( TheMask, "!*@", sizeof( TheMask ));
strlcat( TheMask, at, sizeof( TheMask ));
return TheMask;
}
/* alle Teile vorhanden */
/* All parts (nick, user and domain name) are given */
strlcpy( TheMask, Pattern, sizeof( TheMask ));
return TheMask;
} /* Lists_MakeMask */
@@ -370,7 +416,7 @@ New_C2C( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )
assert( Chan != NULL );
/* Speicher fuer Eintrag anfordern */
c2c = malloc( sizeof( C2C ));
c2c = (C2C *)malloc( sizeof( C2C ));
if( ! c2c )
{
Log( LOG_EMERG, "Can't allocate memory! [New_C2C]" );

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: lists.h,v 1.9 2002/12/12 12:23:43 alex Exp $
* $Id: lists.h,v 1.11 2004/04/25 15:40:19 alex Exp $
*
* Management of IRC lists: ban, invite, ... (header)
*/
@@ -22,14 +22,18 @@ GLOBAL VOID Lists_Init PARAMS(( VOID ));
GLOBAL VOID Lists_Exit PARAMS(( VOID ));
GLOBAL BOOLEAN Lists_CheckInvited PARAMS(( CLIENT *Client, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_AddInvited PARAMS(( CLIENT *From, CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce ));
GLOBAL BOOLEAN Lists_AddInvited PARAMS(( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce ));
GLOBAL VOID Lists_DelInvited PARAMS(( CHAR *Mask, CHANNEL *Chan ));
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_AddBanned PARAMS(( CLIENT *From, CHAR *Mask, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_AddBanned 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_SendBans PARAMS(( CLIENT *Client ));
GLOBAL BOOLEAN Lists_IsBanEntry PARAMS(( CHAR *Mask, CHANNEL *Chan ));
GLOBAL VOID Lists_DeleteChannel PARAMS(( CHANNEL *Chan ));

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: log.c,v 1.43 2003/03/31 15:54:21 alex Exp $";
static char UNUSED id[] = "$Id: log.c,v 1.44.2.4 2005/02/03 09:27:09 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -25,7 +25,7 @@ static char UNUSED id[] = "$Id: log.c,v 1.43 2003/03/31 15:54:21 alex Exp $";
#include <sys/types.h>
#include <unistd.h>
#ifdef USE_SYSLOG
#ifdef SYSLOG
#include <syslog.h>
#endif
@@ -50,7 +50,7 @@ LOCAL VOID Wall_ServerNotice PARAMS(( CHAR *Msg ));
GLOBAL VOID
Log_Init( VOID )
{
#ifdef USE_SYSLOG
#ifdef SYSLOG
/* Syslog initialisieren */
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
#endif
@@ -85,6 +85,8 @@ Log_Init( VOID )
}
#endif
if( Init_Txt[0] ) Log( LOG_INFO, "Activating: %s.", Init_Txt );
Error_File[0] = '\0';
} /* Log_Init */
@@ -122,10 +124,13 @@ Log_Exit( VOID )
if( NGIRCd_SignalRestart ) Log( LOG_NOTICE, "%s done (restarting).", PACKAGE_NAME );
else Log( LOG_NOTICE, "%s done.", PACKAGE_NAME );
/* Error-File (stderr) loeschen */
if( unlink( Error_File ) != 0 ) Log( LOG_ERR, "Can't delete \"%s\": %s", Error_File, strerror( errno ));
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 ));
}
#ifdef USE_SYSLOG
#ifdef SYSLOG
/* syslog abmelden */
closelog( );
#endif
@@ -177,10 +182,10 @@ va_dcl
if( NGIRCd_NoDaemon )
{
/* auf Konsole ausgeben */
fprintf( stdout, "[%d] %s\n", Level, msg );
fprintf( stdout, "[%d:%d] %s\n", (INT)getpid( ), Level, msg );
fflush( stdout );
}
#ifdef USE_SYSLOG
#ifdef SYSLOG
else
{
/* Syslog */
@@ -206,16 +211,18 @@ va_dcl
GLOBAL VOID
Log_Init_Resolver( VOID )
{
#ifdef USE_SYSLOG
#ifdef SYSLOG
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
#endif
Log_Resolver( LOG_DEBUG, "Resolver sub-process starting, PID %d.", getpid( ));
} /* Log_Init_Resolver */
GLOBAL VOID
Log_Exit_Resolver( VOID )
{
#ifdef USE_SYSLOG
Log_Resolver( LOG_DEBUG, "Resolver sub-process %d done.", getpid( ));
#ifdef SYSLOG
closelog( );
#endif
} /* Log_Exit_Resolver */
@@ -234,17 +241,11 @@ va_dcl
{
/* Eintrag des Resolver in Logfile(s) schreiben */
#ifndef USE_SYSLOG
return;
#else
CHAR msg[MAX_LOG_MSG_LEN];
va_list ap;
assert( Format != NULL );
if( NGIRCd_NoDaemon ) return;
#ifdef DEBUG
if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
#else
@@ -260,9 +261,15 @@ va_dcl
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
va_end( ap );
/* ... und ausgeben */
syslog( Level, msg );
/* Output */
if( NGIRCd_NoDaemon )
{
/* Output to console */
fprintf( stdout, "[%d:%d] %s\n", (INT)getpid( ), Level, msg );
fflush( stdout );
}
#ifdef SYSLOG
else syslog( Level, "%s", msg );
#endif
} /* Log_Resolver */

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: log.h,v 1.13 2002/12/12 12:23:43 alex Exp $
* $Id: log.h,v 1.14 2003/12/26 15:55:07 alex Exp $
*
* Logging functions (header)
*/
@@ -18,7 +18,7 @@
#define __log_h__
#ifdef USE_SYSLOG
#ifdef SYSLOG
# include <syslog.h>
#else
# define LOG_EMERG 0

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
* 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
@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: messages.h,v 1.64 2003/03/19 21:16:16 alex Exp $
* $Id: messages.h,v 1.66 2004/02/28 02:18:16 alex Exp $
*
* IRC numerics (Header)
*/
@@ -26,7 +26,7 @@
#define RPL_TRACELINK_MSG "200 %s Link %s-%s %s %s V%s %ld %d %d"
#define RPL_TRACEOPERATOR_MSG "204 %s Oper 2 :%s"
#define RPL_TRACESERVER_MSG "206 %s Serv 1 0S 0C %s *!*@%s :V%s"
#define RPL_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"
@@ -117,7 +117,7 @@
#define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\""
#define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users"
#ifdef USE_ZLIB
#ifdef ZLIB
#define RPL_STATSLINKINFOZIP_MSG "211 %s %s %d %ld %ld/%ld %ld %ld/%ld :%ld"
#endif

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
* Copyright (c)2001-2005 by Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: ngircd.c,v 1.76 2003/03/31 15:54:21 alex Exp $";
static char UNUSED id[] = "$Id: ngircd.c,v 1.83.2.3 2005/01/26 22:02:36 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -24,20 +24,20 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.76 2003/03/31 15:54:21 alex Exp $";
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <time.h>
#include <pwd.h>
#include <grp.h>
#include "defines.h"
#include "resolve.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "conf.h"
#include "cvs-version.h"
#include "defines.h"
#include "lists.h"
#include "log.h"
#include "parse.h"
@@ -183,6 +183,11 @@ main( int argc, const char *argv[] )
ok = TRUE;
}
#endif
if( argv[i][n] == 't' )
{
configtest = TRUE;
ok = TRUE;
}
if( ! ok )
{
@@ -223,6 +228,38 @@ main( int argc, const char *argv[] )
while( ! NGIRCd_SignalQuit )
{
/* 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
* nicht mehr mit dem Terminal verbunden ist. Mit der
* Option "--nodaemon" kann dies (z.B. zum Debuggen)
@@ -247,18 +284,10 @@ main( int argc, const char *argv[] )
(VOID)setsid( );
chdir( "/" );
}
/* Globale Variablen initialisieren */
NGIRCd_Start = time( NULL );
(VOID)strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start ));
NGIRCd_SignalRehash = FALSE;
NGIRCd_SignalRestart = FALSE;
NGIRCd_SignalQuit = FALSE;
/* Module initialisieren */
Log_Init( );
/* Initialize modules, part II: these functions are eventually
* called with already dropped privileges ... */
Resolve_Init( );
Conf_Init( );
Lists_Init( );
Channel_Init( );
Client_Init( );
@@ -267,28 +296,15 @@ main( int argc, const char *argv[] )
#endif
Conn_Init( );
/* Wenn als root ausgefuehrt und eine andere UID
* konfiguriert ist, jetzt zu dieser wechseln */
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 ));
}
}
/* User, Gruppe und Prozess-ID des Daemon ausgeben */
/* Show user, group, and PID of the running daemon */
pwd = getpwuid( getuid( )); grp = getgrgid( getgid( ));
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( ));
/* stderr in "Error-File" umlenken */
Log_InitErrorfile( );
/* Redirect stderr handle to "error file" for debugging.
* 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 */
Initialize_Signal_Handler( );
@@ -298,7 +314,7 @@ main( int argc, const char *argv[] )
* sind in doc/Protocol.txt beschrieben. */
#ifdef IRCPLUS
sprintf( NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE_NAME, PACKAGE_VERSION, IRCPLUSFLAGS );
#ifdef USE_ZLIB
#ifdef ZLIB
strcat( NGIRCd_ProtoID, "Z" );
#endif
if( Conf_OperCanMode ) strcat( NGIRCd_ProtoID, "o" );
@@ -306,7 +322,7 @@ main( int argc, const char *argv[] )
sprintf( NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE_NAME, PACKAGE_VERSION );
#endif
strcat( NGIRCd_ProtoID, " P" );
#ifdef USE_ZLIB
#ifdef ZLIB
strcat( NGIRCd_ProtoID, "Z" );
#endif
Log( LOG_DEBUG, "Protocol and server ID is \"%s\".", NGIRCd_ProtoID );
@@ -361,15 +377,15 @@ NGIRCd_VersionAddition( VOID )
strcpy( txt, "" );
#ifdef USE_SYSLOG
#ifdef SYSLOG
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "SYSLOG" );
#endif
#ifdef USE_ZLIB
#ifdef ZLIB
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "ZLIB" );
#endif
#ifdef USE_TCPWRAP
#ifdef TCPWRAP
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "TCPWRAP" );
#endif
@@ -377,6 +393,10 @@ NGIRCd_VersionAddition( VOID )
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "RENDEZVOUS" );
#endif
#ifdef IDENTAUTH
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "IDENT" );
#endif
#ifdef DEBUG
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "DEBUG" );
@@ -413,28 +433,26 @@ NGIRCd_Rehash( VOID )
Log( LOG_NOTICE|LOG_snotice, "Re-reading configuration NOW!" );
NGIRCd_SignalRehash = FALSE;
/* Alle Listen-Sockets schliessen */
/* Close down all listening sockets */
Conn_ExitListeners( );
/* Alten Server-Namen merken */
assert( sizeof( old_name ) == sizeof( Conf_ServerName ));
/* Remember old server name */
strcpy( old_name, Conf_ServerName );
/* Konfiguration neu lesen ... */
/* Re-read configuration ... */
Conf_Rehash( );
/* Alten Server-Namen wiederherstellen: dieser
* kann nicht zur Laufzeit geaendert werden ... */
/* 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." );
}
/* neue pre-defined Channel anlegen: */
/* Create new pre-defined channels */
Channel_InitPredefined( );
/* Listen-Sockets neu anlegen: */
/* Start listening on sockets */
Conn_InitListeners( );
/* Sync configuration with established connections */
@@ -527,7 +545,7 @@ LOCAL VOID
Show_Version( VOID )
{
puts( NGIRCd_Version( ));
puts( "Copyright (c)2001-2003 by Alexander Barton (<alex@barton.de>)." );
puts( "Copyright (c)2001-2005 by Alexander Barton (<alex@barton.de>)." );
puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
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." );
@@ -546,7 +564,7 @@ Show_Help( VOID )
#ifdef SNIFFER
puts( " -s, --sniffer enable network sniffer and display all IRC traffic" );
#endif
puts( " --configtest read, validate and display configuration; then exit" );
puts( " -t, --configtest read, validate and display configuration; then exit" );
puts( " --version output version information and exit" );
puts( " --help display this help and exit" );
} /* Show_Help */

View File

@@ -14,13 +14,14 @@
#include "portab.h"
static char UNUSED id[] = "$Id: parse.c,v 1.59 2003/01/15 13:49:20 alex Exp $";
static char UNUSED id[] = "$Id: parse.c,v 1.60 2004/01/17 03:17:49 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include "ngircd.h"
#include "defines.h"

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: resolve.c,v 1.6 2003/04/21 10:52:51 alex Exp $";
static char UNUSED id[] = "$Id: resolve.c,v 1.8.2.1 2004/05/15 23:52:17 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -27,6 +27,12 @@ static char UNUSED id[] = "$Id: resolve.c,v 1.6 2003/04/21 10:52:51 alex Exp $";
#include <arpa/inet.h>
#include <netdb.h>
#ifdef IDENTAUTH
#ifdef HAVE_IDENT_H
#include <ident.h>
#endif
#endif
#include "conn.h"
#include "defines.h"
#include "log.h"
@@ -35,7 +41,12 @@ static char UNUSED id[] = "$Id: resolve.c,v 1.6 2003/04/21 10:52:51 alex Exp $";
#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 ));
#endif
LOCAL VOID Do_ResolveName PARAMS(( CHAR *Host, INT w_fd ));
#ifdef h_errno
@@ -46,31 +57,35 @@ LOCAL CHAR *Get_Error PARAMS(( INT H_Error ));
GLOBAL VOID
Resolve_Init( VOID )
{
/* Modul initialisieren */
/* Initialize module */
FD_ZERO( &Resolver_FDs );
} /* Resolve_Init */
#ifdef IDENTAUTH
GLOBAL RES_STAT *
Resolve_Addr( struct sockaddr_in *Addr, int Sock )
#else
GLOBAL RES_STAT *
Resolve_Addr( struct sockaddr_in *Addr )
#endif
{
/* IP (asyncron!) aufloesen. Bei Fehler, z.B. wenn der
* Child-Prozess nicht erzeugt werden kann, wird NULL geliefert.
* Der Host kann dann nicht aufgeloest werden. */
/* Resolve IP (asynchronous!). On errors, e.g. if the child process
* can't be forked, this functions returns NULL. */
RES_STAT *s;
INT pid;
/* Speicher anfordern */
s = malloc( sizeof( RES_STAT ));
/* Allocate memory */
s = (RES_STAT *)malloc( sizeof( RES_STAT ));
if( ! s )
{
Log( LOG_EMERG, "Resolver: Can't allocate memory! [Resolve_Addr]" );
return NULL;
}
/* Pipe fuer Antwort initialisieren */
/* Initialize pipe for result */
if( pipe( s->pipe ) != 0 )
{
free( s );
@@ -78,28 +93,34 @@ Resolve_Addr( struct sockaddr_in *Addr )
return NULL;
}
/* Sub-Prozess erzeugen */
/* For sub-process */
pid = fork( );
if( pid > 0 )
{
/* Haupt-Prozess */
/* Main process */
Log( LOG_DEBUG, "Resolver for %s created (PID %d).", inet_ntoa( Addr->sin_addr ), pid );
FD_SET( s->pipe[0], &Resolver_FDs );
if( s->pipe[0] > Conn_MaxFD ) Conn_MaxFD = s->pipe[0];
s->pid = pid;
s->stage = 0;
s->bufpos = 0;
return s;
}
else if( pid == 0 )
{
/* Sub-Prozess */
/* Sub process */
Log_Init_Resolver( );
#ifdef IDENTAUTH
Do_ResolveAddr( Addr, Sock, s->pipe[1] );
#else
Do_ResolveAddr( Addr, s->pipe[1] );
#endif
Log_Exit_Resolver( );
exit( 0 );
}
else
{
/* Fehler */
/* Error! */
free( s );
Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
return NULL;
@@ -110,22 +131,21 @@ Resolve_Addr( struct sockaddr_in *Addr )
GLOBAL RES_STAT *
Resolve_Name( CHAR *Host )
{
/* Hostnamen (asyncron!) aufloesen. Bei Fehler, z.B. wenn der
* Child-Prozess nicht erzeugt werden kann, wird NULL geliefert.
* Der Host kann dann nicht aufgeloest werden. */
/* Resolve hostname (asynchronous!). On errors, e.g. if the child
* process can't be forked, this functions returns NULL. */
RES_STAT *s;
INT pid;
/* Speicher anfordern */
s = malloc( sizeof( RES_STAT ));
/* Allocate memory */
s = (RES_STAT *)malloc( sizeof( RES_STAT ));
if( ! s )
{
Log( LOG_EMERG, "Resolver: Can't allocate memory! [Resolve_Name]" );
return NULL;
}
/* Pipe fuer Antwort initialisieren */
/* Initialize the pipe for the result */
if( pipe( s->pipe ) != 0 )
{
free( s );
@@ -133,20 +153,22 @@ Resolve_Name( CHAR *Host )
return NULL;
}
/* Sub-Prozess erzeugen */
/* Fork sub-process */
pid = fork( );
if( pid > 0 )
{
/* Haupt-Prozess */
/* Main process */
Log( LOG_DEBUG, "Resolver for \"%s\" created (PID %d).", Host, pid );
FD_SET( s->pipe[0], &Resolver_FDs );
if( s->pipe[0] > Conn_MaxFD ) Conn_MaxFD = s->pipe[0];
s->pid = pid;
s->stage = 0;
s->bufpos = 0;
return s;
}
else if( pid == 0 )
{
/* Sub-Prozess */
/* Sub process */
Log_Init_Resolver( );
Do_ResolveName( Host, s->pipe[1] );
Log_Exit_Resolver( );
@@ -154,7 +176,7 @@ Resolve_Name( CHAR *Host )
}
else
{
/* Fehler */
/* Error! */
free( s );
Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
return NULL;
@@ -162,17 +184,26 @@ Resolve_Name( CHAR *Host )
} /* Resolve_Name */
#ifdef IDENTAUTH
LOCAL VOID
Do_ResolveAddr( struct sockaddr_in *Addr, int Sock, INT w_fd )
#else
LOCAL VOID
Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd )
#endif
{
/* Resolver Sub-Prozess: IP aufloesen und Ergebnis in Pipe schreiben. */
/* Resolver sub-process: resolve IP address and write result into
* pipe to parent. */
CHAR hostname[HOST_LEN];
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 ));
/* Namen aufloesen */
h = gethostbyaddr( (CHAR *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET );
if( h ) strlcpy( hostname, h->h_name, sizeof( hostname ));
else
@@ -184,31 +215,52 @@ Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd )
#endif
strlcpy( hostname, inet_ntoa( Addr->sin_addr ), sizeof( hostname ));
}
Log_Resolver( LOG_DEBUG, "Ok, translated %s to \"%s\".", inet_ntoa( Addr->sin_addr ), hostname );
/* Antwort an Parent schreiben */
if( (size_t)write( w_fd, hostname, strlen( hostname ) + 1 ) != (size_t)( strlen( hostname ) + 1 ))
/* Write resolver result into pipe to parent */
len = strlen( hostname );
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 ));
close( w_fd );
return;
}
Log_Resolver( LOG_DEBUG, "Ok, translated %s to \"%s\".", inet_ntoa( Addr->sin_addr ), hostname );
#ifdef IDENTAUTH
/* 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 */
LOCAL VOID
Do_ResolveName( CHAR *Host, INT w_fd )
{
/* Resolver Sub-Prozess: Name aufloesen und Ergebnis in Pipe schreiben. */
/* Resolver sub-process: resolve name and write result into pipe
* to parent. */
CHAR ip[16];
struct hostent *h;
struct in_addr *addr;
INT len;
Log_Resolver( LOG_DEBUG, "Now resolving \"%s\" ...", Host );
/* Namen aufloesen */
/* Resolve hostname */
h = gethostbyname( Host );
if( h )
{
@@ -224,16 +276,16 @@ Do_ResolveName( CHAR *Host, INT w_fd )
#endif
strcpy( ip, "" );
}
if( ip[0] ) Log_Resolver( LOG_DEBUG, "Ok, translated \"%s\" to %s.", Host, ip );
/* Antwort an Parent schreiben */
if( (size_t)write( w_fd, ip, strlen( ip ) + 1 ) != (size_t)( strlen( ip ) + 1 ))
/* Write result into pipe to parent */
len = strlen( ip );
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 ));
close( w_fd );
return;
}
if( ip[0] ) Log_Resolver( LOG_DEBUG, "Ok, translated \"%s\" to %s.", Host, ip );
} /* Do_ResolveName */
@@ -242,7 +294,7 @@ Do_ResolveName( CHAR *Host, INT w_fd )
LOCAL CHAR *
Get_Error( INT H_Error )
{
/* Fehlerbeschreibung fuer H_Error liefern */
/* Get error message for H_Error */
switch( H_Error )
{

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: resolve.h,v 1.5 2003/04/21 10:53:10 alex Exp $
* $Id: resolve.h,v 1.6.2.1 2004/05/15 23:52:17 alex Exp $
*
* Asynchronous resolver (header)
*/
@@ -29,6 +29,9 @@ typedef struct _Res_Stat
{
INT pid; /* PID des Child-Prozess */
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;
@@ -37,7 +40,12 @@ GLOBAL fd_set Resolver_FDs;
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 ));
#endif
GLOBAL RES_STAT *Resolve_Name PARAMS(( CHAR *Host ));

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: portab.h,v 1.15 2003/03/31 19:01:02 alex Exp $
* $Id: portab.h,v 1.17 2004/03/15 19:26:39 alex Exp $
*
* Portability functions and declarations (header for libngbportab).
*/
@@ -21,13 +21,13 @@
#include "config.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
# include <sys/types.h>
#endif
/* compiler features */
#ifdef __GNUC__
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
# define PUNUSED(x) __attribute__ ((unused)) x
# define UNUSED __attribute__ ((unused))
#else

View File

@@ -19,7 +19,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: strlcpy.c,v 1.2 2002/12/26 14:34:11 alex Exp $";
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>
@@ -61,12 +61,13 @@ strlcpy( CHAR *dst, CONST CHAR *src, size_t size )
* always null terminates. */
size_t len = strlen( src );
size_t ret = len;
if( size <= 0 ) return len;
if( size <= 0 ) return 0;
if( len >= size ) len = size - 1;
memcpy( dst, src, len );
dst[len] = 0;
return len;
return ret;
} /* strlcpy */
#endif

View File

@@ -9,7 +9,7 @@
# 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.9 2002/11/10 14:28:06 alex Exp $
# $Id: Makefile.am,v 1.9.6.3 2004/09/08 09:45:53 alex Exp $
#
AUTOMAKE_OPTIONS = ../portab/ansi2knr
@@ -17,12 +17,15 @@ AUTOMAKE_OPTIONS = ../portab/ansi2knr
INCLUDES = -I$(srcdir)/../portab
EXTRA_DIST = \
getpid.sh \
README functions.inc getpid.sh \
start-server.sh stop-server.sh tests.sh stress-server.sh \
test-loop.sh wait-tests.sh \
connect-test.e channel-test.e mode-test.e \
stress-A.e stress-B.e check-idle.e \
ngircd-test.conf
all:
clean-local:
rm -rf logs tests *-test ngircd-test.log ngircd-test.motd \
T-ngircd procs.tmp

72
src/testsuite/README Normal file
View File

@@ -0,0 +1,72 @@
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.
-- README for the Test Suite --
I. Overview
~~~~~~~~~~~
The purpose of the "test suite" contained in this directory is to detect
bugs and incompatibilities in ngIRCd introduced during coding and after
building ngIRCd on a specific platform.
To run the "standard" tests call "make check". It will build ngIRCd (if
required) and run some tests on it. These tests should be portable and run
on all supported platforms without errors.
Please note: most tests of this suite depend on the external tools expect(1)
and telnet(1), so make sure you have them installed. If not, the tests will
not fail but simply be skipped.
II. Shell Scripts
~~~~~~~~~~~~~~~~
getpid.sh <name>
This script is used to detect the PID of the running process with
the given name in a portable manner. The result is echoed on the
console. It is a helper script for some other scripts of this suite.
start-server.sh
start-server.sh starts up the test binary, "T-ngircd". It makes sure
that getpid.sh is available and working, and that no other instance
of the test binary is already running.
The exit code is 0 if the test binary could be started.
stop-server.sh
This script uses getpid.sh to detect a running test binary "T-ngircd"
and then shuts it down using the TERM signal.
The exit code is 0 if the test binary could be stopped.
stress-server.sh
...
tests.sh
...
III. Scripts for expect(1)
~~~~~~~~~~~~~~~~~~~~~~~~~~
channel-test.e
check-idle.e
connect-test.e
mode-test.e
stress-A.e
stress-B.e
--
$Id: README,v 1.1.2.1 2004/09/04 20:49:36 alex Exp $

View File

@@ -1,4 +1,4 @@
# $Id: channel-test.e,v 1.2 2002/09/09 21:26:00 alex Exp $
# $Id: channel-test.e,v 1.3 2003/12/27 13:01:12 alex Exp $
spawn telnet localhost 6789
expect {
@@ -16,7 +16,7 @@ expect {
send "join #channel\r"
expect {
timeout { exit 1 }
":nick!~user@* JOIN :#channel"
"@* JOIN :#channel"
}
expect {
timeout { exit 1 }
@@ -26,13 +26,17 @@ expect {
send "topic #channel :Test-Topic\r"
expect {
timeout { exit 1 }
":nick!~user@* TOPIC #channel :Test-Topic"
"@* TOPIC #channel :Test-Topic"
}
send "who #channel\r"
expect {
timeout { exit 1 }
"352 nick #channel ~user * nick H@ :0 User"
"352 nick #channel"
}
expect {
timeout { exit 1 }
"* nick H@ :0 User"
}
expect {
timeout { exit 1 }
@@ -62,7 +66,7 @@ expect {
send "part #channel\r"
expect {
timeout { exit 1 }
":nick!~user@* PART #channel :nick"
"@* PART #channel :nick"
}
send "quit\r"

View File

@@ -1,4 +1,4 @@
# $Id: check-idle.e,v 1.1 2002/09/09 22:56:07 alex Exp $
# $Id: check-idle.e,v 1.1.8.1 2004/09/04 20:49:36 alex Exp $
spawn telnet localhost 6789
expect {
@@ -10,6 +10,7 @@ send "nick IdleTest\r"
send "user idle . . :Idle-Test\r"
expect {
timeout { exit 1 }
"433 * IdleTest :Nickname already in use" { exit 99 }
"376"
}

View File

@@ -0,0 +1,28 @@
#!/bin/sh
#
# ngIRCd Test Suite
# Copyright (c)2002-2004 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: functions.inc,v 1.1.2.1 2004/09/06 22:07:26 alex Exp $
#
# test how to call echo to get output without newline
echo -n | grep -- -n >/dev/null 2>&1
if [ $? -eq 0 ]; then
ECHO_N=""; ECHO_C="\c"
else
ECHO_N="-n"; ECHO_C=""
fi
echo_n()
{
echo $ECHO_N "$*$ECHO_C"
}
# -eof-

View File

@@ -1,26 +1,35 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: getpid.sh,v 1.2 2002/11/10 14:28:06 alex Exp $
# $Id: getpid.sh,v 1.4 2003/08/22 11:31:18 alex Exp $
# wurde ein Name uebergeben?
# did we get a name?
[ $# -ne 1 ] && exit 1
# Flags fuer "ps" ermitteln
# detect flags for "ps" and "head"
if [ `uname` = "FreeBSD" ]; then
PS_FLAGS="-a"; PS_PIDCOL="1"; HEAD_FLAGS="-n 1"
elif [ `uname` = "A/UX" ]; then
PS_FLAGS="-ae"; PS_PIDCOL="1"; HEAD_FLAGS="-1"
elif [ `uname` = "GNU" ]; then
PS_FLAGS="-ax"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1"
else
PS_FLAGS="-f"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1"
ps $PS_FLAGS > /dev/null 2>&1
if [ $? -ne 0 ]; then PS_FLAGS="a"; PS_PIDCOL="1"; fi
fi
# PID ermitteln
ps $PS_FLAGS > procs.tmp
pid=$( cat procs.tmp | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n | head $HEAD_FLAGS )
# debug output
#echo "$0: PS_FLAGS=$PS_FLAGS"
#echo "$0: PS_PIDCOL=$PS_PIDCOL"
#echo "$0: HEAD_FLAGS=$HEAD_FLAGS"
# ermittelte PID validieren
# search PID
ps $PS_FLAGS > procs.tmp
cat procs.tmp | grep -v "$0" | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n > pids.tmp
pid=`head $HEAD_FLAGS pids.tmp`
rm -rf procs.tmp pids.tmp
# validate PID
[ "$pid" -gt 1 ] > /dev/null 2>&1
[ $? -ne 0 ] && exit 1

View File

@@ -1,4 +1,4 @@
# $Id: mode-test.e,v 1.4 2002/12/15 15:52:34 alex Exp $
# $Id: mode-test.e,v 1.6 2004/03/10 20:40:06 alex Exp $
spawn telnet localhost 6789
expect {
@@ -16,7 +16,7 @@ expect {
send "mode nick +i\r"
expect {
timeout { exit 1 }
":nick!~user@* MODE nick +i"
"@* MODE nick :+i"
}
send "mode nick\r"
@@ -28,7 +28,7 @@ expect {
send "mode nick -i\r"
expect {
timeout { exit 1 }
":nick!~user@* MODE nick -i"
"@* MODE nick :-i"
}
send "oper TestOp 123\r"
@@ -50,7 +50,7 @@ expect {
send "join #channel\r"
expect {
timeout { exit 1 }
":nick!~user@* JOIN :#channel"
"@* JOIN :#channel"
}
expect {
timeout { exit 1 }
@@ -60,7 +60,7 @@ expect {
send "mode #channel +tn\r"
expect {
timeout { exit 1 }
":nick!~user@* MODE #channel +tn"
"@* MODE #channel +tn"
}
send "mode #channel\r"
@@ -72,31 +72,31 @@ expect {
send "mode #channel +v nick\r"
expect {
timeout { exit 1 }
":nick!~user@* MODE #channel +v nick"
"@* MODE #channel +v nick"
}
send "mode #channel +I nick1\r"
expect {
timeout { exit 1 }
":nick!~user@* MODE #channel +I nick1!*@*"
"@* MODE #channel +I nick1!*@*"
}
send "mode #channel +b nick2@domain\r"
expect {
timeout { exit 1 }
":nick!~user@* MODE #channel +b nick2!*@domain"
"@* MODE #channel +b nick2!*@domain"
}
send "mode #channel +I nick3!user\r"
expect {
timeout { exit 1 }
":nick!~user@* MODE #channel +I nick3!user@*"
"@* MODE #channel +I nick3!user@*"
}
send "mode #channel -vo nick nick\r"
expect {
timeout { exit 1 }
":nick!~user@* MODE #channel -vo nick nick"
"@* MODE #channel -vo nick nick"
}
send "quit\r"

View File

@@ -1,4 +1,4 @@
# $Id: ngircd-test.conf,v 1.3 2002/10/21 13:45:23 alex Exp $
# $Id: ngircd-test.conf,v 1.4 2003/11/05 23:31:43 alex Exp $
[Global]
Name = ngircd.test.server
@@ -6,6 +6,7 @@
Ports = 6789
MotdFile = ngircd-test.motd
AdminEMail = admin@irc.server
MaxConnectionsIP = 0
[Operator]
Name = TestOp

View File

@@ -1,32 +1,44 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: start-server.sh,v 1.10 2002/11/10 14:28:06 alex Exp $
# $Id: start-server.sh,v 1.11.2.2 2004/09/06 22:07:26 alex Exp $
[ -z "$srcdir" ] && srcdir=`dirname $0`
echo " starting server ..."
# read in functions
. ${srcdir}/functions.inc
# alte Logfiles loeschen
echo_n " starting server ..."
# remove old logfiles
rm -rf logs *.log
# pruefen, ob getpid.sh gueltige PID's liefert. Wenn dem nicht so ist,
# wird kein ngIRCd gestartet, da dieser ansonsten nicht mehr am Ende
# des Testlaufs beendet werden koennte!
# check weather getpid.sh returns valid PIDs. If not, don't start up the
# test-server, because we won't be able to kill it at the end of the test.
./getpid.sh sh > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo " error: getpid.sh FAILED!"
echo " getpid.sh failed!"
exit 1
fi
# MOTD fuer Test-Server erzeugen
# check if there is a test-server already running
./getpid.sh T-ngircd > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo " failure: test-server already running!"
exit 1
fi
# generate MOTD for test-server
echo "This is an ngIRCd Test Server" > ngircd-test.motd
# Test-Server starten ...
./T-ngircd -np -f ${srcdir}/ngircd-test.conf > ngircd-test.log 2>&1 &
# starting up test-server ...
./T-ngircd -np -f ${srcdir}/ngircd-test.conf $* > ngircd-test.log 2>&1 &
sleep 1
# validieren, dass Server laeuft
# validate running test-server
pid=`./getpid.sh T-ngircd`
[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1 || exit 1
[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1; r=$?
[ $r -eq 0 ] && echo " ok." || echo " failure!"
exit
# -eof-

View File

@@ -1,17 +1,32 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: stop-server.sh,v 1.9 2002/11/10 14:28:06 alex Exp $
# $Id: stop-server.sh,v 1.10.2.3 2004/09/06 22:07:26 alex Exp $
[ -z "$srcdir" ] && srcdir=`dirname $0`
echo " stopping server ..."
# read in functions
. ${srcdir}/functions.inc
# Test-Server stoppen ...
echo_n " stopping server ..."
# stop test-server ...
pid=`./getpid.sh T-ngircd`
[ -n "$pid" ] && kill $pid > /dev/null 2>&1 || exit 1
sleep 1
if [ -z "$pid" ]; then
echo " failure: no running server found!?"
exit 1
fi
kill $pid > /dev/null 2>&1 || exit 1
# jetzt duerfte der Prozess nicht mehr laufen
kill -0 $pid > /dev/null 2>&1 && exit 1 || exit 0
# waiting ...
for i in 1 2 3 4 5; do
kill -0 $pid > /dev/null 2>&1; r=$?
if [ $r -ne 0 ]; then
echo " ok".
exit 0
fi
sleep 1
done
echo " failure: server still running!?"
exit 1
# -eof-

View File

@@ -1,25 +1,47 @@
#!/bin/sh
#
# ngIRCd Test Suite
# $Id: stress-server.sh,v 1.6 2002/09/23 22:07:43 alex Exp $
# Copyright (c)2002-2004 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: stress-server.sh,v 1.8.2.2 2004/09/06 22:07:26 alex Exp $
#
# detect source directory
[ -z "$srcdir" ] && srcdir=`dirname $0`
[ $1 -gt 0 ] 2> /dev/null && CLIENTS=$1 || CLIENTS=5
# parse command line
[ "$1" -gt 0 ] 2> /dev/null && CLIENTS="$1" || CLIENTS=5
[ "$2" -gt 0 ] 2> /dev/null && MAX="$2" || MAX=-1
# get our name
name=`basename $0`
test=`echo ${name} | cut -d '.' -f 1`
# create directories
mkdir -p logs tests
# test for required external tools
type expect > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "SKIP: ${name} -- \"expect\" not found."; exit 77
echo " ${name}: \"expect\" not found."; exit 77
fi
type telnet > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "SKIP: ${name} -- \"telnet\" not found."; exit 77
echo " ${name}: \"telnet\" not found."; exit 77
fi
echo " stressing server with $CLIENTS clients (be patient!) ..."
# hello world! :-)
echo " stressing server with $CLIENTS clients (be patient!):"
# read in functions
. ${srcdir}/functions.inc
# create scripts for expect(1)
no=0
while [ ${no} -lt $CLIENTS ]; do
cat ${srcdir}/stress-A.e > tests/${no}.e
@@ -27,20 +49,31 @@ while [ ${no} -lt $CLIENTS ]; do
cat ${srcdir}/stress-B.e >> tests/${no}.e
no=`expr ${no} + 1`
done
no=0
while [ ${no} -lt $CLIENTS ]; do
expect tests/${no}.e > logs/stress-${no}.log 2> /dev/null &
no=`expr ${no} + 1`
echo " started client $no/$CLIENTS."
[ $MAX -gt 0 ] && $srcdir/wait-tests.sh $MAX
done
echo_n " waiting for clients to complete: ."
touch logs/check-idle.log
while true; do
expect ${srcdir}/check-idle.e >> logs/check-idle.log
res=$?
[ $res -eq 0 ] && exit 0
[ $res -eq 1 ] && exit 1
sleep 1
expect ${srcdir}/check-idle.e >> logs/check-idle.log; res=$?
echo "====================" >> logs/check-idle.log
[ $res -ne 99 ] && break
# there are still clients connected. Wait ...
sleep 3
echo_n "."
done
[ $res -eq 0 ] && echo " ok." || echo " failure!"
exit $res
# -eof-

37
src/testsuite/test-loop.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
#
# ngIRCd Test Suite
# Copyright (c)2002-2004 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: test-loop.sh,v 1.2.2.1 2004/09/04 20:49:36 alex Exp $
#
# detect source directory
[ -z "$srcdir" ] && srcdir=`dirname $0`
# parse command line
[ "$1" -gt 0 ] 2> /dev/null && LOOPS="$1" || LOOPS=5
[ "$2" -gt 0 ] 2> /dev/null && WAIT="$2" || WAIT=5
loop=0
while [ ${loop} -lt $LOOPS ]; do
loop=`expr ${loop} + 1`
echo " loop $loop/$LOOPS starting:"
for s in $srcdir/*-test; do
sh $s; r=$?
[ $r -ne 0 ] && exit $r
sleep 1
done
if [ ${loop} -lt $LOOPS ]; then
echo " waiting $WAIT seconds ..."
sleep $WAIT
fi
done
# -eof-

View File

@@ -1,21 +1,35 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: tests.sh,v 1.3 2002/09/12 02:29:03 alex Exp $
# $Id: tests.sh,v 1.4.2.2 2004/09/06 22:07:26 alex Exp $
# detect source directory
[ -z "$srcdir" ] && srcdir=`dirname $0`
name=`basename $0`
test=`echo ${name} | cut -d '.' -f 1`
mkdir -p logs
if [ ! -r "$test" ]; then
echo " ${name}: test \"$test\" not found!"; exit 77
exit 1
fi
# read in functions
. ${srcdir}/functions.inc
type expect > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "SKIP: ${name} -- \"expect\" not found."; exit 77
echo " ${name}: \"expect\" not found."; exit 77
fi
type telnet > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "SKIP: ${name} -- \"telnet\" not found."; exit 77
echo " ${name}: \"telnet\" not found."; exit 77
fi
echo " doing ${test} ..."
expect ${srcdir}/${test}.e > logs/${test}.log
echo_n " running ${test} ..."
expect ${srcdir}/${test}.e > logs/${test}.log 2>&1; r=$?
[ $r -eq 0 ] && echo " ok." || echo " failure!"
exit $r
# -eof-

44
src/testsuite/wait-tests.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/sh
#
# ngIRCd Test Suite
# Copyright (c)2002-2004 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: wait-tests.sh,v 1.3.2.2 2004/09/06 22:07:26 alex Exp $
#
[ "$1" -gt 0 ] 2> /dev/null && MAX="$1" || MAX=5
PS_FLAGS="-f"
ps $PS_FLAGS >/dev/null 2>&1
[ $? -ne 0 ] && PS_FLAGS="a"
# read in functions
. ${srcdir}/functions.inc
msg=0
while true; do
count=`ps $PS_FLAGS | grep "expect " | wc -l`
count=`expr $count - 1`
[ $count -le $MAX ] && break
if [ $msg -lt 1 ]; then
echo_n " waiting for processes to settle: "
msg=1
fi
# there are still clients connected. Wait ...
echo_n "$count>$MAX "
sleep 1
done
[ $msg -gt 0 ] && echo "done: $count"
exit 0
# -eof-