Browse Source

Import upstream version 15

Alexander Barton 14 years ago
parent
commit
b9db8b1777
100 changed files with 10359 additions and 5566 deletions
  1. BIN
      ._INSTALL
  2. BIN
      ._README
  3. 13 7
      AUTHORS
  4. 107 12
      ChangeLog
  5. 36 3
      Makefile.am
  6. 107 54
      Makefile.in
  7. 55 4
      NEWS
  8. 99 86
      aclocal.m4
  9. 23 13
      config.guess
  10. 44 8
      config.sub
  11. 5057 4054
      configure
  12. 66 8
      configure.in
  13. BIN
      contrib/._ngindent
  14. BIN
      contrib/._ngircd-bsd.sh
  15. BIN
      contrib/._ngircd-redhat.init
  16. 6 5
      contrib/Debian/Makefile.am
  17. 55 36
      contrib/Debian/Makefile.in
  18. 64 0
      contrib/Debian/changelog
  19. 35 6
      contrib/Debian/control
  20. 12 0
      contrib/Debian/ngircd.default
  21. 127 38
      contrib/Debian/ngircd.init
  22. 71 18
      contrib/Debian/rules
  23. BIN
      contrib/MacOSX/._Makefile.am
  24. 6 5
      contrib/MacOSX/Makefile.am
  25. 74 53
      contrib/MacOSX/Makefile.in
  26. 18 4
      contrib/MacOSX/config.h
  27. 0 0
      contrib/MacOSX/cvs-version.h
  28. 4 0
      contrib/MacOSX/de.barton.ngircd.plist.tmpl
  29. 1 0
      contrib/MacOSX/ngIRCd.pmdoc/01ngircd-contents.xml
  30. 1 0
      contrib/MacOSX/ngIRCd.pmdoc/01ngircd.xml
  31. 1 0
      contrib/MacOSX/ngIRCd.pmdoc/02de-contents.xml
  32. 1 0
      contrib/MacOSX/ngIRCd.pmdoc/02de.xml
  33. 18 0
      contrib/MacOSX/ngIRCd.pmdoc/Makefile.am
  34. 328 0
      contrib/MacOSX/ngIRCd.pmdoc/Makefile.in
  35. 190 0
      contrib/MacOSX/ngIRCd.pmdoc/index.xml
  36. 49 31
      contrib/MacOSX/ngIRCd.xcodeproj/Makefile.in
  37. 109 9
      contrib/MacOSX/ngIRCd.xcodeproj/project.pbxproj
  38. 42 0
      contrib/MacOSX/postinstall.sh
  39. 25 0
      contrib/MacOSX/preinstall.sh
  40. 8 10
      contrib/Makefile.am
  41. 73 54
      contrib/Makefile.in
  42. 8 6
      contrib/README
  43. 16 0
      contrib/ngindent
  44. 51 0
      contrib/ngircd-bsd.sh
  45. 119 0
      contrib/ngircd-redhat.init
  46. 16 11
      contrib/ngircd.spec
  47. 143 0
      contrib/platformtest.sh
  48. 63 8
      depcomp
  49. 12 1
      doc/FAQ.txt
  50. 3 2
      doc/Makefile.am
  51. 68 48
      doc/Makefile.in
  52. 22 9
      doc/Platforms.txt
  53. 3 3
      doc/Protocol.txt
  54. 2 2
      doc/README-AUX.txt
  55. 1 1
      doc/README-BeOS.txt
  56. 65 12
      doc/SSL.txt
  57. 70 0
      doc/Services.txt
  58. 1 1
      doc/Zeroconf.txt
  59. 55 14
      doc/sample-ngircd.conf
  60. 153 0
      doc/src/Doxyfile
  61. 3 3
      doc/src/Makefile.am
  62. 51 35
      doc/src/Makefile.in
  63. 11 0
      doc/src/footer.inc.html
  64. 10 0
      doc/src/header.inc.html
  65. 77 0
      doc/src/ngircd-doc.css
  66. 266 82
      install-sh
  67. 53 35
      man/Makefile.in
  68. 5 4
      man/ngircd.8.tmpl
  69. 126 32
      man/ngircd.conf.5.tmpl
  70. 39 29
      missing
  71. BIN
      src/._Makefile.am
  72. 65 45
      src/Makefile.in
  73. 23 23
      src/config.h.in
  74. 55 39
      src/ipaddr/Makefile.in
  75. 9 2
      src/ipaddr/ng_ipaddr.c
  76. 2 2
      src/ipaddr/ng_ipaddr.h
  77. BIN
      src/ngircd/._client.h
  78. BIN
      src/ngircd/._conn-func.c
  79. BIN
      src/ngircd/._irc-channel.c
  80. BIN
      src/ngircd/._irc-op.c
  81. BIN
      src/ngircd/._irc-op.h
  82. BIN
      src/ngircd/._irc.c
  83. BIN
      src/ngircd/._irc.h
  84. BIN
      src/ngircd/._log.h
  85. BIN
      src/ngircd/._parse.h
  86. 7 7
      src/ngircd/Makefile.am
  87. 90 66
      src/ngircd/Makefile.in
  88. 8 0
      src/ngircd/array.c
  89. 306 153
      src/ngircd/channel.c
  90. 24 13
      src/ngircd/channel.h
  91. 152 130
      src/ngircd/client.c
  92. 16 19
      src/ngircd/client.h
  93. 47 0
      src/ngircd/conf-ssl.h
  94. 288 155
      src/ngircd/conf.c
  95. 45 18
      src/ngircd/conf.h
  96. 38 30
      src/ngircd/conn-func.c
  97. 7 8
      src/ngircd/conn-func.h
  98. 712 0
      src/ngircd/conn-ssl.c
  99. 28 0
      src/ngircd/conn-ssl.h
  100. 0 0
      src/ngircd/conn-zip.c

BIN
._INSTALL


BIN
._README


+ 13 - 7
AUTHORS

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                        (c)2001-2007 Alexander Barton,
+                        (c)2001-2009 Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -19,14 +19,23 @@ directly, if possible!
 Main Authors
 ~~~~~~~~~~~~
 Alexander Barton, <alex@barton.de> (alex)
-Florian Westphal, <westphal@foo.fh-furtwangen.de> (fw)
+Florian Westphal, <fw@strlen.de>
 
 
 Contributors
 ~~~~~~~~~~~~
-Goetz Hoffart, <goetz@hoffart.de> (goetz)
-Ilja Osthoff, <i.osthoff@gmx.net> (ilja)
+Ali Shemiran, <ashemira@ucsd.edu>
+Ask Bjørn Hansen, <ask@develooper.com>
 Benjamin Pineau, <ben@zouh.org>
+Brandon Beresini, <beresini@google.com>
+Bryan Caldwell, <bcaldwel@ucsd.edu>
+Dana Dahlstrom, <dana+ngIRCd@cs.ucsd.edu>
+Eric Grunow, <egrunow@ucsd.edu>
+Goetz Hoffart, <goetz@hoffart.de>
+Ilja Osthoff, <i.osthoff@gmx.net>
+Jari Aalto, <jari.aalto@cante.net>
+Rolf Eike Beer, <eike@sf-mail.de>
+Scott Perry, <scperry@ucsd.edu>
 Sean Reifschneider, <jafo-rpms@tummy.com>
 
 
@@ -35,7 +44,3 @@ 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.13 2007/10/04 15:18:48 alex Exp $

+ 107 - 12
ChangeLog

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                        (c)2001-2008 Alexander Barton,
+                        (c)2001-2009 Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -10,6 +10,100 @@
                                -- ChangeLog --
 
 
+ngIRCd Release 15 (2009-11-07)
+
+  - "ngircd --configtest": print SSL configuration options even when unset.
+
+  ngIRCd 15~rc1 (2009-10-15)
+  - Do not add default listening port (6667) if SSL ports were specified, so
+    ngIRCd can be configured to only accept SSL-encrypted connections now.
+  - Enable IRC operators to use the IRC command SQUIT (insted of the already
+    implemented but non-standard DISCONNECT command).
+  - New configuration option "AllowRemoteOper" (disabled by default) that
+    enables remote IRC operators to use the IRC commands SQUIT and CONNECT
+    on the local server.
+  - Mac OS X: fix test for packagemaker(1) tool in Makefile and use gcc 4.0
+    for Mac OS X 10.4 compatibility in the Xcode project file.
+  - Fix --with-{openssl|gnutls} to accept path names.
+  - Fix LSB header of Debian init script.
+  - Updated doc/Platforms.txt and include new script contrib/platformtest.sh
+    to ease generating platform reports.
+  - Fix connection information for already registered connections.
+  - Enforce upper limit on maximum number of handled commands. This implements
+    a throttling scheme: an IRC client can send up to 3 commands or 256 bytes
+    per second before a one second pause is enforced.
+  - Fix connection counter.
+  - Fix a few error handling glitches for SSL/TLS connections.
+  - Minor fixes to manual pages and documentation.
+
+ngIRCd Release 14.1 (2009-05-05)
+
+  - Security: fix remotely triggerable crash in SSL/TLS code.
+  - BSD start script contrib/ngircd.sh has been renamed to ngircd-bsd.sh.
+  - New start/stop script for RedHat-based distributions:
+    contrib/ngircd-redhat.init, thanks to Naoya Nakazawa <naoya@sanow.net>.
+  - Doxygen: update source code repository link to GIT.
+  - Debian: build ngircd-full-dbg package.
+  - Allow ping timeout quit messages to show the timeout value.
+  - Fix error handling on compressed links.
+  - Fix server list announcement.
+  - Do not remove hostnames from info text.
+
+ngIRCd Release 14 (2009-04-20)
+
+  - Display IPv6 addresses as "[<addr>]" when accepting connections.
+
+  ngIRCd 14~rc1 (2009-03-29)
+  - Updated Debian/Linux init script (see contrib/Debian/ngircd.init).
+  - Allow creation of persistent modeless channels.
+  - The INFO command reports the compile time now (if available).
+  - Spell check and enhance ngIRCd manual pages.
+  - Channel mode changes: break on syntax errors in MODE command.
+  - Support individual channel keys for pre-defined channels: introduce
+    new configuration variable "KeyFile" in [Channel] sections in ngircd.conf,
+    here a file can be configured for each pre-defined channel which contains
+    individual channel keys for different users.
+  - Remove limit on maximum number of predefined channels in ngircd.conf.
+  - Updated ngircd.spec file for building RPM packages.
+  - Add new and missing files to Mac OS X Xcode project, and update project.
+  - Reject masks with wildcard after last dot.
+  - TLS/SSL: remove useless error message when ssl connection is closed.
+  - Fix memory leak when a encrypted and compressed server link goes down.
+    (closes bug #95, reported by Christoph, fiesh@fiesh.homeip.net)
+  - Fix handling of channels containing dots.
+    (closes ug #93, reported by Gonosz Csiga)
+
+ngIRCd Release 13 (2008-12-25)
+
+  - Updated documentation, especially doc/Services.txt and doc/SSL.txt.
+  - Make the test suite work on OpenSolaris.
+
+  ngIRCd 13~rc1 (2008-11-21):
+  - New version number scheme :-)
+  - Initial support for IRC services, using a RFC1459 style interface,
+    tested with IRCServices (http://www.ircservices.za.net/) version 5.1.13.
+    For this to work, ngIRCd now supports server-server links conforming
+    to RFC 1459. New ngircd.conf(5) option: ServiceMask.
+  - Support for SSL-encrypted server-server and client-server links using
+    OpenSSL (configure: --with-openssl) or GNUTLS (configure: --with-gnutls).
+    New ngircd.conf(5) options: SSLPorts, SSLKeyFile, SSLKeyFilePassword,
+    SSLCertFile, SSLDHFile, and SSLConnect.
+  - Server local channels have been implemented, prefix "&", that are only
+    visible to users of the same server and are not visible in the network.
+    In addition ngIRCd creates a "special" channel &SERVER on startup and logs
+    all the messages to it that a user with mode +s receives.
+  - New make target "osxpkg" to build a Mac OS X installer package.
+  - Debug mode: enable support for GNU libc memory tracing (see mtrace(3)).
+  - SysV init script: use LSB logging functions, if available.
+  - Added some more FAQ entries (regarding logging and IRC operators).
+  - Allow IRC operators to overwrite channel limits.
+  - Support for enhanced PRIVMSG and NOTICE message targets.
+  - More tests have been added to the test-suite ("make check"), and two
+    servers are started for testing server-server linking.
+  - Added a timestamp to log messages to the console.
+  - New configuration option "NoIdent" to disable IDENT lookups even if the
+    daemon is compiled with IDENT support.
+
 ngIRCd 0.12.1 (2008-07-09)
 
   - Allow mixed line terminations (CR+LF/CR/LF) in non-RFC-compliant mode
@@ -18,7 +112,7 @@ ngIRCd 0.12.1 (2008-07-09)
   - Update ngIRCd manual pages
   - Add option aliases -V (for --version) and -h (for --help).
   - Fix 'no-ipv6' compile error.
-  - Make Listen parameter a comma-seperated list of addresses. This also
+  - Make Listen parameter a comma-separated list of addresses. This also
     obsoletes ListenIPv4 and ListenIPv6 options. If Listen is unset, it
     is treated as Listen="::,0.0.0.0".
     Note: ListenIPv4 and ListenIPv6 options are still recognized,
@@ -28,11 +122,11 @@ ngIRCd 0.12.0 (2008-05-13)
 
   - Fix Bug: 85: "WHO #SecretChannel" that user is not a member of now returns
     proper RPL_ENDOFWHO_MSG instead of nothing. (Ali Shemiran)
-  - Fix complie on FreeBSD 5.4 and AIX.
-  - If bind() fails, also print ip address and not just the port number.
+  - Fix compile on FreeBSD 5.4 and AIX.
+  - If bind() fails, also print IP address and not just the port number.
 
   ngIRCd 0.12.0-pre2 (2008-04-29)
-  - IPv6: Add config options to disabe ipv4/ipv6 support.
+  - IPv6: Add config options to disable ipv4/ipv6 support.
   - Don't include doc/CVS.txt in distribution archive, use doc/GIT.txt now!
   - Documentation: get rid of some more references to CVS, switch to GIT.
   - Get rid of cvs-version.* and CVSDATE definition.
@@ -69,17 +163,17 @@ ngIRCd 0.11.0 (2008-01-15)
 
   ngIRCd 0.11.0-pre2 (2008-01-07)
   - SECURITY: IRC_PART could reference invalid memory, causing
-    ngircd to crash [from HEAD].
+    ngircd to crash [from HEAD]. (CVE-2008-0285)
   
   ngIRCd 0.11.0-pre1 (2008-01-02)
   - Use dotted-decimal IP address if hostname is >= 64.
   - Add support for /STAT u (server uptime) command.
   - New [Server] configuration Option "Bind" allows to specify
-    the source ip adress to use when connecting to remote server.
+    the source IP address to use when connecting to remote server.
   - New configuration option "MaxNickLength" to specify the allowed maximum
     length of user nick names. Note: must be unique in an IRC network!
   - Enhanced the IRC+ protocol to support an enhanced "server handshake" and
-    enable server to recognice numeric 005 (ISUPPORT) and 376 (ENDOFMOTD).
+    enable server to recognize numeric 005 (ISUPPORT) and 376 (ENDOFMOTD).
     See doc/Protocol.txt for details.
   - Re-added doc/SSL.txt to distribution -- got lost somewhere!?
   - Fixes the wrong logging output when nested servers are introduced
@@ -103,12 +197,13 @@ ngIRCd 0.11.0 (2008-01-15)
 ngIRCd 0.10.4 (2008-01-07)
 
   - SECURITY: IRC_PART could reference invalid memory, causing
-    ngircd to crash [from HEAD].
+    ngircd to crash [from HEAD]. (CVE-2008-0285)
   
 ngIRCd 0.10.3 (2007-08-01)
 
   - SECURITY: Fixed a severe bug in handling JOIN commands, which could
     cause the server to crash. Thanks to Sebastian Vesper, <net@veoson.net>.
+    (CVE-2007-6062)
 
 ngIRCd 0.10.2 (2007-06-08)
 
@@ -243,13 +338,13 @@ 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)
+    (CVE-2005-0226; 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>.
+    by Florian Westphal, <westphal@foo.fh-furtwangen.de>. (CVE-2005-0199)
   - 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
@@ -407,7 +502,7 @@ ngIRCd 0.7.0 (2003-05-01)
   - Better error reporting to clients on connect.
   - Enhanced manual pages ngircd(8) and ngircd.conf(5).
   - Documentation is now installed in $(datadir)/doc/ngircd.
-  - Enhanced hanling of NJOIN in case of nick collisions.
+  - Enhanced handling of NJOIN in case of nick collisions.
 
 ngIRCd 0.6.1, 2003-01-21
 

+ 36 - 3
Makefile.am

@@ -15,6 +15,7 @@ SUBDIRS = doc src man contrib
 
 clean-local:
 	rm -f build-stamp*
+	rm -rf ngircd.dest
 
 maintainer-clean-local:
 	rm -rf autom4te.cache
@@ -31,18 +32,50 @@ lint:
 srcdoc:
 	make -C doc srcdoc
 
-xcode:
+have-xcodebuild:
 	@xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -list \
 	 >/dev/null 2>&1 \
 	 || ( echo; echo "Error: \"xcodebuild\" not found!"; echo; exit 1 )
+
+xcode: have-xcodebuild
+	rel=`grep AC_INIT configure.in | cut -d' ' -f2 | cut -d')' -f1`; \
+	 def="GCC_PREPROCESSOR_DEFINITIONS=\"VERSION=\\\"$$rel\\\"\""; \
+	 xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -alltargets \
+	 -configuration Default $$def build
+
+xcode-clean: have-xcodebuild
 	xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -alltargets \
-	 -buildstyle Development
+	 -configuration Default clean
+	rm -fr contrib/MacOSX/build
 
 rpm: distcheck
 	rpm -ta ngircd-*.tar.gz
 
 deb:
 	[ -f debian/rules ] || ln -s contrib/Debian debian
-	dpkg-buildpackage -rfakeroot
+	dpkg-buildpackage -rfakeroot -i
+
+osxpkg: have-xcodebuild
+	@packagemaker >/dev/null 2>&1; [ $$? -le 1 ] \
+	 || ( echo; echo "Error: \"packagemaker\" not found!"; echo; exit 2)
+	make clean
+	./configure --prefix=/opt/ngircd
+	make xcode
+	make -C contrib/MacOSX de.barton.ngircd.plist
+	mkdir -p ngircd.dest/opt/ngircd/sbin
+	DESTDIR="$$PWD/ngircd.dest" make -C doc install
+	DESTDIR="$$PWD/ngircd.dest" make -C contrib install
+	DESTDIR="$$PWD/ngircd.dest" make -C man install
+	cp contrib/MacOSX/build/Default/ngIRCd \
+	 ngircd.dest/opt/ngircd/sbin/ngircd
+	rm ngircd.dest/opt/ngircd/etc/ngircd.conf
+	echo "Have a nice day IRCing!" >ngircd.dest/opt/ngircd/etc/ngircd.motd
+	chmod -R a-s,og-w,a+rX ngircd.dest
+	cd contrib/MacOSX && packagemaker \
+	 --doc ngIRCd.pmdoc \
+	 --out ../../$(distdir).mpkg
+	rm -f $(distdir).mpkg.zip
+	zip -ro9 $(distdir).mpkg.zip $(distdir).mpkg
+	rm -rf ngircd.dest $(distdir).mpkg
 
 # -eof-

+ 107 - 54
Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -24,15 +24,11 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = .
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -47,17 +43,17 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
+subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
 	ChangeLog INSTALL NEWS config.guess config.sub depcomp \
 	install-sh missing
-subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
- configure.lineno configure.status.lineno
+ configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/src/config.h
 CONFIG_CLEAN_FILES =
@@ -65,10 +61,13 @@ SOURCES =
 DIST_SOURCES =
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
-	install-exec-recursive install-info-recursive \
-	install-recursive installcheck-recursive installdirs-recursive \
-	pdf-recursive ps-recursive uninstall-info-recursive \
-	uninstall-recursive
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
@@ -84,8 +83,6 @@ GZIP_ENV = --best
 distuninstallcheck_listfiles = find . -type f -print
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -104,6 +101,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -114,6 +113,7 @@ LIBS = @LIBS@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -128,11 +128,11 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 U = @U@
 VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -144,32 +144,43 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = gnu
 SUBDIRS = doc src man contrib
 all: all-recursive
@@ -208,7 +219,6 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(srcdir) && $(AUTOCONF)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-uninstall-info-am:
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -241,8 +251,7 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-mostlyclean-recursive clean-recursive distclean-recursive \
-maintainer-clean-recursive:
+$(RECURSIVE_CLEAN_TARGETS):
 	@failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
@@ -344,23 +353,22 @@ distclean-tags:
 
 distdir: $(DISTFILES)
 	$(am__remove_distdir)
-	mkdir $(distdir)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	test -d $(distdir) || mkdir $(distdir)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -374,7 +382,7 @@ distdir: $(DISTFILES)
 	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
-	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
 	    || exit 1; \
 	    distdir=`$(am__cd) $(distdir) && pwd`; \
 	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
@@ -382,6 +390,8 @@ distdir: $(DISTFILES)
 	      $(MAKE) $(AM_MAKEFLAGS) \
 	        top_distdir="$$top_distdir" \
 	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -389,7 +399,7 @@ distdir: $(DISTFILES)
 	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
 	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
-	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
 	|| chmod -R a+r $(distdir)
 dist-gzip: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
@@ -464,7 +474,7 @@ distcheck: dist
 	$(am__remove_distdir)
 	@(echo "$(distdir) archives ready for distribution: "; \
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
-	  sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
 distuninstallcheck:
 	@cd $(distuninstallcheck_dir) \
 	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
@@ -533,12 +543,20 @@ info-am:
 
 install-data-am:
 
+install-dvi: install-dvi-recursive
+
 install-exec-am:
 
+install-html: install-html-recursive
+
 install-info: install-info-recursive
 
 install-man:
 
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -560,27 +578,30 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am: uninstall-info-am
+uninstall-am:
 
-uninstall-info: uninstall-info-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
 
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
-	check-am clean clean-generic clean-local clean-recursive ctags \
-	ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
-	dist-tarZ dist-zip distcheck distclean distclean-generic \
-	distclean-recursive distclean-tags distcleancheck distdir \
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am am--refresh check check-am clean clean-generic \
+	clean-local ctags ctags-recursive dist dist-all dist-bzip2 \
+	dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
+	distclean-generic distclean-tags distcleancheck distdir \
 	distuninstallcheck dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-exec \
-	install-exec-am install-info install-info-am install-man \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
 	install-strip installcheck installcheck-am installdirs \
 	installdirs-am maintainer-clean maintainer-clean-generic \
-	maintainer-clean-local maintainer-clean-recursive mostlyclean \
-	mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
-	tags tags-recursive uninstall uninstall-am uninstall-info-am
+	maintainer-clean-local mostlyclean mostlyclean-generic pdf \
+	pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
 
 
 clean-local:
 	rm -f build-stamp*
+	rm -rf ngircd.dest
 
 maintainer-clean-local:
 	rm -rf autom4te.cache
@@ -597,19 +618,51 @@ lint:
 srcdoc:
 	make -C doc srcdoc
 
-xcode:
+have-xcodebuild:
 	@xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -list \
 	 >/dev/null 2>&1 \
 	 || ( echo; echo "Error: \"xcodebuild\" not found!"; echo; exit 1 )
+
+xcode: have-xcodebuild
+	rel=`grep AC_INIT configure.in | cut -d' ' -f2 | cut -d')' -f1`; \
+	 def="GCC_PREPROCESSOR_DEFINITIONS=\"VERSION=\\\"$$rel\\\"\""; \
+	 xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -alltargets \
+	 -configuration Default $$def build
+
+xcode-clean: have-xcodebuild
 	xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -alltargets \
-	 -buildstyle Development
+	 -configuration Default clean
+	rm -fr contrib/MacOSX/build
 
 rpm: distcheck
 	rpm -ta ngircd-*.tar.gz
 
 deb:
 	[ -f debian/rules ] || ln -s contrib/Debian debian
-	dpkg-buildpackage -rfakeroot
+	dpkg-buildpackage -rfakeroot -i
+
+osxpkg: have-xcodebuild
+	@packagemaker >/dev/null 2>&1; [ $$? -le 1 ] \
+	 || ( echo; echo "Error: \"packagemaker\" not found!"; echo; exit 2)
+	make clean
+	./configure --prefix=/opt/ngircd
+	make xcode
+	make -C contrib/MacOSX de.barton.ngircd.plist
+	mkdir -p ngircd.dest/opt/ngircd/sbin
+	DESTDIR="$$PWD/ngircd.dest" make -C doc install
+	DESTDIR="$$PWD/ngircd.dest" make -C contrib install
+	DESTDIR="$$PWD/ngircd.dest" make -C man install
+	cp contrib/MacOSX/build/Default/ngIRCd \
+	 ngircd.dest/opt/ngircd/sbin/ngircd
+	rm ngircd.dest/opt/ngircd/etc/ngircd.conf
+	echo "Have a nice day IRCing!" >ngircd.dest/opt/ngircd/etc/ngircd.motd
+	chmod -R a-s,og-w,a+rX ngircd.dest
+	cd contrib/MacOSX && packagemaker \
+	 --doc ngIRCd.pmdoc \
+	 --out ../../$(distdir).mpkg
+	rm -f $(distdir).mpkg.zip
+	zip -ro9 $(distdir).mpkg.zip $(distdir).mpkg
+	rm -rf ngircd.dest $(distdir).mpkg
 
 # -eof-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.

+ 55 - 4
NEWS

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                        (c)2001-2008 Alexander Barton,
+                        (c)2001-2009 Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -10,10 +10,61 @@
                                   -- NEWS --
 
 
+ngIRCd Release 15 (2009-11-07)
+
+  ngIRCd 15~rc1 (2009-10-15)
+  - Do not add default listening port (6667) if SSL ports were specified, so
+    ngIRCd can be configured to only accept SSL-encrypted connections now.
+  - Enable IRC operators to use the IRC command SQUIT (insted of the already
+    implemented but non-standard DISCONNECT command).
+  - New configuration option "AllowRemoteOper" (disabled by default) that
+    enables remote IRC operators to use the IRC commands SQUIT and CONNECT
+    on the local server.
+  - Enforce upper limit on maximum number of handled commands. This implements
+    a throttling scheme: an IRC client can send up to 3 commands or 256 bytes
+    per second before a one second pause is enforced.
+
+ngIRCd Release 14.1 (2009-05-05)
+
+  - Security: fix remotely triggerable crash in SSL/TLS code.
+  - Debian: build ngircd-full-dbg package.
+  - Allow ping timeout quit messages to show the timeout value.
+
+ngIRCd Release 14 (2009-04-20)
+
+  ngIRCd 14~rc1 (2009-03-29)
+  - Allow creation of persistent modeless channels.
+  - The INFO command reports the compile time now (if available).
+  - Support individual channel keys for pre-defined channels: introduce
+    new configuration variable "KeyFile" in [Channel] sections in ngircd.conf,
+    here a file can be configured for each pre-defined channel which contains
+    individual channel keys for different users.
+  - Remove limit on maximum number of predefined channels in ngircd.conf.
+
+ngIRCd Release 13 (2008-12-25)
+
+  ngIRCd 13~rc1 (2008-11-21):
+  - New version number scheme :-)
+  - Initial support for IRC services, using a RFC1459 style interface,
+    tested with IRCServices (http://www.ircservices.za.net/) version 5.1.13.
+    For this to work, ngIRCd now supports server-server links conforming
+    to RFC 1459. New ngircd.conf(5) option: ServiceMask.
+  - Support for SSL-encrypted server-server and client-server links using
+    OpenSSL (configure: --with-openssl) or GNUTLS (configure: --with-gnutls).
+    New ngircd.conf(5) options: SSLPorts, SSLKeyFile, SSLKeyFilePassword,
+    SSLCertFile, SSLDHFile, and SSLConnect.
+  - Server local channels have been implemented, prefix "&", that are only
+    visible to users of the same server and are not visible in the network.
+    In addition ngIRCd creates a "special" channel &SERVER on startup and logs
+    all the messages to it that a user with mode +s receives.
+  - New make target "osxpkg" to build a Mac OS X installer package.
+  - New configuration option "NoIdent" to disable IDENT lookups even if the
+    daemon is compiled with IDENT support.
+
 ngIRCd 0.12.1 (2008-07-09)
 
   - Add option aliases -V (for --version) and -h (for --help).
-  - Make Listen parameter a comma-seperated list of addresses. This also
+  - Make Listen parameter a comma-separated list of addresses. This also
     obsoletes ListenIPv4 and ListenIPv6 options. If Listen is unset, it
     is treated as Listen="::,0.0.0.0".
     Note: ListenIPv4 and ListenIPv6 options are still recognized,
@@ -22,7 +73,7 @@ ngIRCd 0.12.1 (2008-07-09)
 ngIRCd 0.12.0 (2008-05-13)
 
   ngIRCd 0.12.0-pre2 (2008-04-29)
-  - IPv6: Add config options to disabe ipv4/ipv6 support.
+  - IPv6: Add config options to disable ipv4/ipv6 support.
 
   ngIRCd 0.12.0-pre1 (2008-04-20)
   - Add IPv6 support.
@@ -41,7 +92,7 @@ ngIRCd 0.11.0 (2008-01-15)
 
   - Add support for /STAT u (server uptime) command.
   - New [Server] configuration Option "Bind" allows to specify
-    the source ip adress to use when connecting to remote server.
+    the source IP address to use when connecting to remote server.
   - New configuration option "MaxNickLength" to specify the allowed maximum
     length of user nick names. Note: must be unique in an IRC network!
   - Numeric 317: implemented "signon time" (displayed in WHOIS result).

+ 99 - 86
aclocal.m4

@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
+# generated automatically by aclocal 1.10 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005  Free Software Foundation, Inc.
+# 2005, 2006  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,12 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+m4_if(m4_PACKAGE_VERSION, [2.61],,
+[m4_fatal([this file was generated for autoconf 2.61.
+You have another version of autoconf.  If you want to use that,
+you should regenerate the build system entirely.], [63])])
+
+# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -21,14 +26,29 @@
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
 # generated from the m4 files accompanying Automake X.Y.
-AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.10'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.10], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
 
 # AM_SET_CURRENT_AUTOMAKE_VERSION
 # -------------------------------
-# Call AM_AUTOMAKE_VERSION so it can be traced.
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-	 [AM_AUTOMAKE_VERSION([1.9.5])])
+[AM_AUTOMAKE_VERSION([1.10])dnl
+_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
@@ -85,14 +105,14 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 7
+# serial 8
 
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
@@ -101,8 +121,10 @@ AC_DEFUN([AM_CONDITIONAL],
 [AC_PREREQ(2.52)dnl
  ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
 	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
-AC_SUBST([$1_TRUE])
-AC_SUBST([$1_FALSE])
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
 if $2; then
   $1_TRUE=
   $1_FALSE='#'
@@ -116,15 +138,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 8
+# serial 9
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -152,6 +173,7 @@ AC_REQUIRE([AM_DEP_TRACK])dnl
 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
                    [depcc="$$1"   am_compiler_list=])
 
@@ -217,6 +239,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
        $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
          >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
        grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
@@ -269,7 +292,8 @@ if test "x$enable_dependency_tracking" != xno; then
   AMDEPBACKSLASH='\'
 fi
 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
-AC_SUBST([AMDEPBACKSLASH])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
 ])
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
@@ -294,8 +318,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
   # some people rename them; so instead we look at the file content.
   # Grep'ing the first line is not enough: some people post-process
   # each Makefile.in and add a new line on top of each file to say so.
-  # So let's grep whole file.
-  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
     dirpart=`AS_DIRNAME("$mf")`
   else
     continue
@@ -354,8 +379,8 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -378,16 +403,20 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
 # arguments mandatory, and then we can depend on a new Autoconf
 # release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.58])dnl
+[AC_PREREQ([2.60])dnl
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
 dnl the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
 AC_REQUIRE([AC_PROG_INSTALL])dnl
-# test to see if srcdir already configured
-if test "`cd $srcdir && pwd`" != "`pwd`" &&
-   test -f $srcdir/config.status; then
-  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
 fi
 
 # test whether we have cygpath
@@ -407,6 +436,9 @@ m4_ifval([$2],
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([VERSION], [$2])],
 [_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
 
@@ -442,6 +474,10 @@ AC_PROVIDE_IFELSE([AC_PROG_CXX],
                   [_AM_DEPENDENCIES(CXX)],
                   [define([AC_PROG_CXX],
                           defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+                  [_AM_DEPENDENCIES(OBJC)],
+                  [define([AC_PROG_OBJC],
+                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
 ])
 ])
 
@@ -477,7 +513,7 @@ echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
 # Define $install_sh.
 AC_DEFUN([AM_PROG_INSTALL_SH],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-install_sh=${install_sh-"$am_aux_dir/install-sh"}
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
 AC_SUBST(install_sh)])
 
 # Copyright (C) 2003, 2005  Free Software Foundation, Inc.
@@ -555,14 +591,14 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 5
 
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
@@ -578,6 +614,7 @@ AC_SUBST($1)])
 # If it does, set am_missing_run to use it, otherwise, to nothing.
 AC_DEFUN([AM_MISSING_HAS_RUN],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
 # Use eval to expand $SHELL
 if eval "$MISSING --run true"; then
@@ -588,7 +625,7 @@ else
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -596,60 +633,23 @@ fi
 
 # AM_PROG_MKDIR_P
 # ---------------
-# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
-#
-# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
-# created by `make install' are always world readable, even if the
-# installer happens to have an overly restrictive umask (e.g. 077).
-# This was a mistake.  There are at least two reasons why we must not
-# use `-m 0755':
-#   - it causes special bits like SGID to be ignored,
-#   - it may be too restrictive (some setups expect 775 directories).
-#
-# Do not use -m 0755 and let people choose whatever they expect by
-# setting umask.
-#
-# We cannot accept any implementation of `mkdir' that recognizes `-p'.
-# Some implementations (such as Solaris 8's) are not thread-safe: if a
-# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
-# concurrently, both version can detect that a/ is missing, but only
-# one can create it and the other will error out.  Consequently we
-# restrict ourselves to GNU make (using the --version option ensures
-# this.)
+# Check for `mkdir -p'.
 AC_DEFUN([AM_PROG_MKDIR_P],
-[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
-  # We used to keeping the `.' as first argument, in order to
-  # allow $(mkdir_p) to be used without argument.  As in
-  #   $(mkdir_p) $(somedir)
-  # where $(somedir) is conditionally defined.  However this is wrong
-  # for two reasons:
-  #  1. if the package is installed by a user who cannot write `.'
-  #     make install will fail,
-  #  2. the above comment should most certainly read
-  #     $(mkdir_p) $(DESTDIR)$(somedir)
-  #     so it does not work when $(somedir) is undefined and
-  #     $(DESTDIR) is not.
-  #  To support the latter case, we have to write
-  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
-  #  so the `.' trick is pointless.
-  mkdir_p='mkdir -p --'
-else
-  # On NextStep and OpenStep, the `mkdir' command does not
-  # recognize any option.  It will interpret all options as
-  # directories to create, and then abort because `.' already
-  # exists.
-  for d in ./-p ./--version;
-  do
-    test -d $d && rmdir $d
-  done
-  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
-  if test -f "$ac_aux_dir/mkinstalldirs"; then
-    mkdir_p='$(mkinstalldirs)'
-  else
-    mkdir_p='$(install_sh) -d'
-  fi
-fi
-AC_SUBST([mkdir_p])])
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
@@ -684,14 +684,14 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005
+# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2006
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 5
 
 AC_DEFUN([AM_C_PROTOTYPES],
 [AC_REQUIRE([AC_C_PROTOTYPES])
@@ -702,9 +702,10 @@ else
 fi
 # Ensure some checks needed by ansi2knr itself.
 AC_REQUIRE([AC_HEADER_STDC])
-AC_CHECK_HEADERS(string.h)
-AC_SUBST(U)dnl
-AC_SUBST(ANSI2KNR)dnl
+AC_CHECK_HEADERS([string.h])
+AC_SUBST([U])dnl
+AC_SUBST([ANSI2KNR])dnl
+_AM_SUBST_NOTMAKE([ANSI2KNR])dnl
 ])
 
 AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
@@ -786,9 +787,21 @@ dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
 if test "$cross_compiling" != no; then
   AC_CHECK_TOOL([STRIP], [strip], :)
 fi
-INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
 # Check how to create a tarball.                            -*- Autoconf -*-
 
 # Copyright (C) 2004, 2005  Free Software Foundation, Inc.

+ 23 - 13
config.guess

@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
 
-timestamp='2007-03-06'
+timestamp='2008-01-23'
 
 # 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
@@ -56,8 +56,8 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -330,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
-    i86pc:SunOS:5.*:*)
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:6*:*)
@@ -532,7 +532,7 @@ EOF
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[45])
+    *:AIX:*:[456])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
@@ -793,12 +793,15 @@ EOF
 	exit ;;
     *:Interix*:[3456]*)
     	case ${UNAME_MACHINE} in
-	    x86) 
+	    x86)
 		echo i586-pc-interix${UNAME_RELEASE}
 		exit ;;
 	    EM64T | authenticamd)
 		echo x86_64-unknown-interix${UNAME_RELEASE}
 		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
 	esac ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
@@ -833,7 +836,14 @@ EOF
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
     arm*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	fi
 	exit ;;
     avr32*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -954,8 +964,8 @@ EOF
     x86_64:Linux:*:*)
 	echo x86_64-unknown-linux-gnu
 	exit ;;
-    xtensa:Linux:*:*)
-    	echo xtensa-unknown-linux-gnu
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     i*86:Linux:*:*)
 	# The BFD linker knows what the default object file format is, so
@@ -1474,9 +1484,9 @@ This script, last modified $timestamp, has failed to recognize
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be

+ 44 - 8
config.sub

@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
 
-timestamp='2007-01-18'
+timestamp='2008-01-16'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -72,8 +72,8 @@ 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, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -369,10 +369,14 @@ case $basic_machine in
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa-* \
+	| xstormy16-* | xtensa*-* \
 	| ymp-* \
 	| z8k-*)
 		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
+		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
@@ -443,6 +447,14 @@ case $basic_machine in
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
@@ -475,8 +487,8 @@ case $basic_machine in
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16c)
-		basic_machine=cr16c-unknown
+	cr16)
+		basic_machine=cr16-unknown
 		os=-elf
 		;;
 	crds | unos)
@@ -668,6 +680,14 @@ case $basic_machine in
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	m88k-omron*)
 		basic_machine=m88k-omron
 		;;
@@ -683,6 +703,10 @@ case $basic_machine in
 		basic_machine=i386-pc
 		os=-mingw32
 		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
@@ -809,6 +833,14 @@ case $basic_machine in
 		basic_machine=i860-intel
 		os=-osf
 		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	pbd)
 		basic_machine=sparc-tti
 		;;
@@ -1017,6 +1049,10 @@ case $basic_machine in
 		basic_machine=tic6x-unknown
 		os=-coff
 		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
+		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;

File diff suppressed because it is too large
+ 5057 - 4054
configure


+ 66 - 8
configure.in

@@ -1,6 +1,6 @@
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2008 Alexander Barton <alex@barton.de>
+# Copyright (c)2001-2009 Alexander Barton <alex@barton.de>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -12,12 +12,14 @@
 # -- Initialisation --
 
 AC_PREREQ(2.50)
-AC_INIT(ngircd, 0.12.1)
+AC_INIT(ngircd, 15)
 AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
 AC_CANONICAL_TARGET
 AM_INIT_AUTOMAKE(1.6)
 AM_CONFIG_HEADER(src/config.h)
 
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
 # -- Templates for config.h --
 
 AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
@@ -31,6 +33,7 @@ AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
 AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled])
 AH_TEMPLATE([ZEROCONF], [Define if support for Zeroconf should be included])
 AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
+AH_TEMPLATE([HAVE_sockaddr_in_len], [Define if sockaddr_in.sin_len exists])
 
 AH_TEMPLATE([TARGET_OS], [Target operating system name])
 AH_TEMPLATE([TARGET_VENDOR], [Target system vendor])
@@ -71,7 +74,6 @@ AC_DEFUN([GCC_STACK_PROTECT_CC],[
   fi
 ])
 
-
 if test "$GCC" = "yes"; then
 	# We are using the GNU C compiler. Good!
 	CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
@@ -123,6 +125,8 @@ AC_TRY_COMPILE([
 AC_TYPE_SIGNAL
 AC_TYPE_SIZE_T
 
+AC_CHECK_MEMBER([struct sockaddr_in.sin_len], AC_DEFINE(HAVE_sockaddr_in_len),,
+ [#include <arpa/inet.h>])
 
 # -- Libraries --
 
@@ -136,11 +140,11 @@ AC_FUNC_FORK
 AC_FUNC_STRFTIME
 
 AC_CHECK_FUNCS([ \
-	bind gethostbyaddr gethostbyname gethostname inet_ntoa malloc memmove \
-	memset realloc setsid setsockopt socket strcasecmp strchr strcspn strerror \
-	strstr waitpid],,AC_MSG_ERROR([required function missing!]))
+	bind gethostbyaddr gethostbyname gethostname inet_ntoa \
+	setsid setsockopt socket strcasecmp waitpid],,AC_MSG_ERROR([required function missing!]))
 
-AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strdup strlcpy strlcat)
+AC_CHECK_FUNCS(getaddrinfo getnameinfo inet_aton isdigit sigaction snprintf \
+ vsnprintf strdup strlcpy strlcat strtok_r)
 
 # -- Configuration options --
 
@@ -310,6 +314,52 @@ if test "$x_io_backend" = "none"; then
 	AC_MSG_ERROR([No useabe IO API activated/found!?])
 fi
 
+# use SSL?
+
+AC_ARG_WITH(openssl,
+	[  --with-openssl          enable SSL support using OpenSSL],
+	[	if test "$withval" != "no"; then
+			if test "$withval" != "yes"; then
+				CFLAGS="-I$withval/include $CFLAGS"
+				CPPFLAGS="-I$withval/include $CPPFLAGS"
+				LDFLAGS="-L$withval/lib $LDFLAGS"
+			fi
+			AC_CHECK_LIB(crypto, BIO_s_mem)
+			AC_CHECK_LIB(ssl, SSL_library_init)
+			AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes,
+				AC_MSG_ERROR([Can't enable openssl])
+			)
+		fi
+	]
+)
+
+AC_ARG_WITH(gnutls,
+	[  --with-gnutls           enable SSL support using gnutls],
+	[	if test "$withval" != "no"; then
+			if test "$withval" != "yes"; then
+				CFLAGS="-I$withval/include $CFLAGS"
+				CPPFLAGS="-I$withval/include $CPPFLAGS"
+				LDFLAGS="-L$withval/lib $LDFLAGS"
+			fi
+			AC_CHECK_LIB(gnutls, gnutls_global_init)
+			AC_CHECK_FUNCS(gnutls_global_init, x_ssl_gnutls=yes,
+				AC_MSG_ERROR([Can't enable gnutls])
+			)
+		fi
+	]
+)
+
+x_ssl_lib="no"
+if test "$x_ssl_gnutls" = "yes"; then
+	if test "$x_ssl_openssl" = "yes";then
+		AC_MSG_ERROR([Cannot enable both gnutls and openssl])
+	fi
+	x_ssl_lib=gnutls
+fi
+if test "$x_ssl_openssl" = "yes"; then
+	x_ssl_lib=openssl
+fi
+
 # use TCP wrappers?
 
 x_tcpwrap_on=no
@@ -432,6 +482,8 @@ AC_ARG_ENABLE(ipv6,
 	if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
 )
 if test "$x_ipv6_on" = "yes"; then
+	# getaddrinfo() and getnameinfo() are optional when not compiling
+	# with IPv6 support, but are required for IPv6 to work!
 	AC_CHECK_FUNCS([ \
 		getaddrinfo getnameinfo \
 		],,AC_MSG_ERROR([required function missing for IPv6 support!]))
@@ -458,6 +510,7 @@ AC_ARG_ENABLE(debug,
 if test "$x_debug_on" = "yes"; then
 	AC_DEFINE(DEBUG, 1)
 	test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
+	AC_CHECK_FUNCS(mtrace)
 fi
 
 # enable "strict RFC rules"?
@@ -498,6 +551,7 @@ AC_OUTPUT([ \
 	contrib/Debian/Makefile \
 	contrib/MacOSX/Makefile \
 	contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
+	contrib/MacOSX/ngIRCd.pmdoc/Makefile \
 ])
 
 type dpkg >/dev/null 2>&1
@@ -587,7 +641,11 @@ echo $ECHO_N "        I/O backend: $ECHO_C"
 	echo "\"$x_io_backend\""
 
 echo $ECHO_N "      IPv6 protocol: $ECHO_C"
-echo "$x_ipv6_on"
+echo $ECHO_N "$x_ipv6_on    $ECHO_C"
+
+echo $ECHO_N "        SSL support: $ECHO_C"
+echo "$x_ssl_lib"
+
 echo
 
 # -eof-

BIN
contrib/._ngindent


BIN
contrib/._ngircd-bsd.sh


BIN
contrib/._ngircd-redhat.init


+ 6 - 5
contrib/Debian/Makefile.am

@@ -1,6 +1,6 @@
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
+# Copyright (c)2001-2009 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,11 +8,9 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.4 2004/05/11 00:32:31 alex Exp $
-#
 
 EXTRA_DIST = rules changelog compat control copyright \
-	ngircd.init ngircd.postinst
+	ngircd.init ngircd.default ngircd.postinst
 
 maintainer-clean-local:
 	rm -f Makefile Makefile.in
@@ -22,7 +20,10 @@ clean-local:
 	 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 ngircd-full-dbg.postinst.debhelper \
+	 ngircd-full-dbg.postrm.debhelper ngircd-full-dbg.prerm.debhelper \
+	 ngircd-full-dbg.substvars
+	rm -rf ngircd ngircd-full ngircd-full-dbg
 	rm -f files
 
 # -eof-

+ 55 - 36
contrib/Debian/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,7 +16,7 @@
 
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
+# Copyright (c)2001-2009 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
@@ -24,17 +24,11 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.4 2004/05/11 00:32:31 alex Exp $
-#
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ../..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -62,8 +56,6 @@ SOURCES =
 DIST_SOURCES =
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -82,6 +74,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -92,6 +86,7 @@ LIBS = @LIBS@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -106,11 +101,11 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 U = @U@
 VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -122,34 +117,45 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 EXTRA_DIST = rules changelog compat control copyright \
-	ngircd.init ngircd.postinst
+	ngircd.init ngircd.default ngircd.postinst
 
 all: all-am
 
@@ -183,7 +189,6 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-uninstall-info-am:
 tags: TAGS
 TAGS:
 
@@ -192,22 +197,21 @@ CTAGS:
 
 
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -266,12 +270,20 @@ info-am:
 
 install-data-am:
 
+install-dvi: install-dvi-am
+
 install-exec-am:
 
+install-html: install-html-am
+
 install-info: install-info-am
 
 install-man:
 
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -291,16 +303,20 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-info-am
+uninstall-am:
+
+.MAKE: install-am install-strip
 
 .PHONY: all all-am check check-am clean clean-generic clean-local \
 	distclean distclean-generic distdir dvi dvi-am html html-am \
 	info info-am install install-am install-data install-data-am \
-	install-exec install-exec-am install-info install-info-am \
-	install-man install-strip installcheck installcheck-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
 	installdirs maintainer-clean maintainer-clean-generic \
 	maintainer-clean-local mostlyclean mostlyclean-generic pdf \
-	pdf-am ps ps-am uninstall uninstall-am uninstall-info-am
+	pdf-am ps ps-am uninstall uninstall-am
 
 
 maintainer-clean-local:
@@ -311,7 +327,10 @@ clean-local:
 	 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 ngircd-full-dbg.postinst.debhelper \
+	 ngircd-full-dbg.postrm.debhelper ngircd-full-dbg.prerm.debhelper \
+	 ngircd-full-dbg.substvars
+	rm -rf ngircd ngircd-full ngircd-full-dbg
 	rm -f files
 
 # -eof-

+ 64 - 0
contrib/Debian/changelog

@@ -1,3 +1,67 @@
+ngircd (15-0ab1) unstable; urgency=low
+
+  * New "upstream" release: ngIRCd 15.
+
+ -- Alexander Barton <alex@barton.de>  Thu,  7 Nov 2009 12:07:08 +0200
+
+ngircd (15~rc1-0ab1) unstable; urgency=low
+
+  * New "upstream" release candidate 1 for ngIRCd Release 15.
+
+ -- Alexander Barton <alex@barton.de>  Thu, 15 Oct 2009 10:01:08 +0200
+
+ngircd (14.1-0ab1) unstable; urgency=high
+
+  * New "upstream" release ngIRCd 14.1, fixing a security-related bug.
+
+ -- Alexander Barton <alex@barton.de>  Tue,  5 May 2009 13:13:38 +0200
+
+ngircd (14-0ab3) unstable; urgency=low
+
+  * Fixed "Conflicts:" line in debian/control: missing comma.
+
+ -- Alexander Barton <alex@barton.de>  Mon,  4 May 2009 11:21:55 +0200
+
+ngircd (14-0ab2) unstable; urgency=low
+
+  * Add new "ngircd-full-dbg" package including degug code and both
+    the --debug and --sniffer options, and containing debug symbols.
+
+ -- Alexander Barton <alex@barton.de>  Wed, 29 Apr 2009 01:13:03 +0200
+
+ngircd (14-0ab1) unstable; urgency=low
+
+  * New "upstream" release: ngIRCd 14.
+
+ -- Alexander Barton <alex@barton.de>  Mon, 20 Apr 2009 11:09:12 +0200
+
+ngircd (14~rc1-0ab1) unstable; urgency=low
+
+  * New "upstream" release candidate 1 for ngIRCd Release 14.
+
+ -- Alexander Barton <alex@barton.de>  Sun, 29 Mar 2009 17:09:17 +0200
+
+ngircd (13-0ab1) unstable; urgency=low
+
+  * New "upstream" release: ngIRCd 13.
+
+ -- Alexander Barton <alex@barton.de>  Thu, 25 Dec 2008 23:09:58 +0100
+
+ngircd (13~rc1-0ab1) unstable; urgency=low
+
+  * New "upstream" release candidate 1 for ngIRCd Release 13.
+
+ -- Alexander Barton <alex@barton.de>  Fri, 21 Nov 2008 22:04:41 +0100
+
+ngircd (0.12.1-0ab1+dev) unstable; urgency=low
+
+  * Update package for testing the new "upstream" features:
+     - Support for IRC services (see http://www.ircservices.za.net),
+     - Encrypted connections using GNU TLS (ngircd-full),
+     - Support for the IPv6 protocol (ngircd-full).
+
+ -- Alexander Barton <alex@barton.de>  Fri, 03 Oct 2008 16:22:55 +0200
+
 ngircd (0.12.1-0ab1) unstable; urgency=low
 
   * New "upstream" release ngIRCd 0.12.1.

+ 35 - 6
contrib/Debian/control

@@ -2,8 +2,8 @@ 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.7.2.1
+Build-Depends: debhelper (>> 4.0.0), libz-dev, libwrap0-dev, libident-dev, libgnutls-dev
+Standards-Version: 3.8.0
 
 Package: ngircd
 Architecture: any
@@ -15,7 +15,9 @@ Description: A lightweight daemon for the Internet Relay Chat (IRC)
  IRCd like many others.
  .
  This package contains the "standard distribution", including support for
- syslog logging and compressed server-links using zlib.
+ syslog logging and compressed server-links using zlib. Please have a look
+ at the "ngircd-full" package if you need advanced functionality like support
+ for IPv6 or SSL.
  .
  Advantages of ngIRCd:
   - no problems with servers using changing/non-static IP addresses.
@@ -30,14 +32,41 @@ Package: ngircd-full
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Provides: ircd
-Conflicts: ngircd
+Conflicts: ngircd, ngircd-dbg
 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".
+ In addition to the features of the "standard package", this package
+ includes support for TCP wrappers, IDENT requests, the IPv6 protocol and
+ SSL encrypted client and server links.
+ .
+ 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-dbg
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Provides: ircd
+Conflicts: ngircd, ngircd-full
+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.
+ .
+ In addition to the features of the "standard package", this package
+ includes support for TCP wrappers, IDENT requests, the IPv6 protocol and
+ SSL encrypted client and server links.
+ .
+ And in addition to the "full" variant, the binaries contained in this
+ package are build with debug code and contain debug symbols.
  .
  Advantages of ngIRCd:
   - no problems with servers using changing/non-static IP addresses.

+ 12 - 0
contrib/Debian/ngircd.default

@@ -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-

+ 127 - 38
contrib/Debian/ngircd.init

@@ -1,19 +1,19 @@
 #!/bin/sh
 #
 # ngIRCd start and stop script for Debian-based systems
-#
-# $Id: ngircd.init,v 1.7 2006/12/26 14:43:46 alex Exp $
+# Copyright 2008,2009 Alexander Barton <alex@barton.de>
 #
 
 ### BEGIN INIT INFO
-# Provides:		ircd
-# Required-Start:	$local_fs
-# Required-Stop:	$local_fs
-# Should-Start:		$syslog $network
-# Should-Stop:		$syslog $network
+# Provides:		ngircd
+# Required-Start:	$network $remote_fs
+# Required-Stop:
+# Should-Start:		$syslog $named
+# Should-Stop:		$syslog
 # Default-Start:	2 3 4 5
 # Default-Stop:		0 1 6
 # Short-Description:	Next Generation IRC Server
+# Description:		IRC daemon written from scratch
 ### END INIT INFO
 
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -21,66 +21,155 @@ DAEMON=/usr/sbin/ngircd
 NAME=ngIRCd
 DESC="IRC daemon"
 PARAMS=""
+STARTTIME=1
+DIETIME=10
+
+test -x $DAEMON || exit 5
 
 test -h "$0" && me=`readlink $0` || me="$0"
 BASENAME=`basename $me`
 
-test -f /etc/default/$BASENAME && . /etc/default/$BASENAME
+test -r /etc/default/$BASENAME && . /etc/default/$BASENAME
+
+# LSB compatibility functions that become used if there is no local
+# include file available.
+log_daemon_msg() {
+	echo -n "$*"
+}
+log_end_msg() {
+	[ "$1" == "0" ] && echo "." || echo " failed!"
+}
+log_failure_msg() {
+	echo "$*"
+}
+log_warning_msg() {
+	log_failure_msg "$*"
+}
+
+# Include LSB functions, if available:
+test -r /lib/lsb/init-functions && . /lib/lsb/init-functions
+
+PIDFILE=`$DAEMON $PARAMS -t | tr -d ' ' | grep "^PidFile=" | cut -d'=' -f2`
+[ -n "$PIDFILE" ] || PIDFILE="/var/run/ircd/ngircd.pid"
 
-test -x $DAEMON || exit 0
+r=3
 
 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
+	# Make sure that the configuration of ngIRCd is valid:
+	$DAEMON $PARAMS --configtest >/dev/null 2>&1
+	[ $? -eq 0 ] && return 0
+	log_end_msg 1
+	log_failure_msg "Configuration of $NAME is not valid, won't (re)start!"
+	log_failure_msg "Run \"$DAEMON --configtest\" and fix it up ..."
+	exit 6
+}
+
+Prepare() {
+	# Make sure the PID file directory exists and is writable:
+	user=`$DAEMON $PARAMS -t|tr -d ' '|grep "^ServerUID="|cut -d'=' -f2`
+	group=`$DAEMON $PARAMS -t|tr -d ' '|grep "^ServerGID="|cut -d'=' -f2`
+	piddir=`dirname "$PIDFILE"`
+	[ -d "$piddir" ] || mkdir -p "$piddir" 2>/dev/null
+	chown "$user:$group" "$piddir" 2>/dev/null
+	[ $? -eq 0 ] && return 0
+	log_end_msg 1
+	log_failure_msg "Failed to prepare '$piddir' for user '$user'!"
+	exit 1
+}
+
+Do_Start() {
+	if Do_Status; then
+		log_end_msg 0
+		log_warning_msg "$NAME seems to be already running, nothing to do."
+		exit 0
 	fi
+	start-stop-daemon --start \
+		--quiet --exec $DAEMON -- $PARAMS
+	sleep $STARTTIME
+	Do_Status || return 7
+	return 0
 }
 
-Try_Start()
-{
-	[ ! -d /var/run/ircd ] || chown irc:irc /var/run/ircd
-	start-stop-daemon --start --quiet --exec $DAEMON -- $PARAMS
-	if [ $? -ne 0 ]; then
-		echo "$NAME failed!"
-		exit 1
+Do_Stop() {
+	if ! Do_Status; then
+		log_end_msg 0
+		log_warning_msg "$NAME seems not to be running, nothing to do."
+		exit 0
 	fi
-	echo "$NAME."
+	Do_ForceStop
+	return $?
+}
+
+Do_ForceStop() {
+	[ -e $PIDFILE ] \
+		&& pidfile="--pidfile $PIDFILE" \
+		|| pidfile=""
+	start-stop-daemon --stop \
+		--quiet --oknodo --exec $DAEMON $pidfile
+	for i in `seq 1 $DIETIME`; do
+		Do_Status || return 0
+		sleep 1
+	done
+	return 1
+}
+
+Do_Reload() {
+	start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
+	return $?
+}
+
+Do_Status() {
+	[ -e $PIDFILE ] \
+		&& pidfile="--pidfile $PIDFILE" \
+		|| pidfile=""
+	start-stop-daemon --stop \
+		--quiet --signal 0 --exec $DAEMON $pidfile >/dev/null
+	return $?
 }
 
 case "$1" in
   start)
+	log_daemon_msg "Starting $DESC" "$NAME"
 	Check_Config
-	echo -n "Starting $DESC: "
-	Try_Start
+	Prepare
+	Do_Start; r=$?
+	log_end_msg $r
 	;;
   stop)
-	echo -n "Stopping $DESC: "
-	start-stop-daemon --stop --quiet --pidfile /var/run/ircd/ngircd.pid --exec $DAEMON \
-	  && echo "$NAME." \
-	  || echo "(none running)"
+	log_daemon_msg "Stopping $DESC" "$NAME"
+	Do_Stop; r=$?
+	log_end_msg $r
 	;;
   reload|force-reload)
+	log_daemon_msg "Reloading $DESC" "$NAME"
 	Check_Config
-	echo "Reloading $DESC configuration files."
-	start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
+	Do_Reload; r=$?
+	log_end_msg $r
 	;;
   restart)
+	log_daemon_msg "Restarting $DESC" "$NAME"
+	Check_Config
+	Prepare
+	Do_ForceStop
+	Do_Start; r=$?
+	log_end_msg $r
+	;;
+  status)
+	log_daemon_msg "Checking for $DESC" "$NAME"
+	Do_Status; r=$?
+	log_end_msg $r
+	;;
+  test)
 	Check_Config
-	echo -n "Restarting $DESC: "
-	start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
-	sleep 1
-	Try_Start
+	echo "Configuration of $DAEMON seems to be ok."; r=0
 	;;
   *)
-	N=/etc/init.d/$NAME
-	echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
-	exit 1
+	N=/etc/init.d/$NAME; r=2
+	echo "Usage: $N {start|stop|restart|reload|force-reload|status|test}" >&2
 	;;
 esac
 
-exit 0
+exit $r
 
 # -eof-

+ 71 - 18
contrib/Debian/rules

@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
+# Copyright (c)2001-2009 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
@@ -11,8 +11,6 @@
 #
 # debian/rules for ngIRCd
 #
-# $Id: rules,v 1.3 2005/02/07 23:09:31 alex Exp $
-#
 # Based on the sample debian/rules that uses debhelper,
 # GNU copyright 1997 to 1999 by Joey Hess.
 #
@@ -38,7 +36,7 @@ endif
 
 configure-ngircd: configure
 	dh_testdir
-	
+
 	# configure "standard" variant:
 	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
 	  --prefix=/usr \
@@ -48,13 +46,28 @@ configure-ngircd: configure
 
 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
+	  --with-syslog --with-zlib \
+	  --with-gnutls --with-ident --with-tcp-wrappers \
+	  --enable-ipv6
+
+configure-ngircd-full-dbg: configure
+	dh_testdir
+
+	# configure "full debug" variant:
+	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+	  --prefix=/usr \
+	  --sysconfdir=/etc/ngircd \
+	  --mandir=\$${prefix}/share/man \
+	  --enable-debug --enable-sniffer \
+	  --with-syslog --with-zlib \
+	  --with-gnutls --with-ident --with-tcp-wrappers \
+	  --enable-ipv6
 
 build:
 	dh_clean -k
@@ -63,20 +76,30 @@ 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
+
+build-ngircd-full-dbg: build-stamp-ngircd-full-dbg
+build-stamp-ngircd-full-dbg: configure-ngircd-full-dbg
+	dh_testdir
+	rm -f build-stamp-*
+
+	# Add here commands to compile the "full debug" package:
+	$(MAKE)
+
 	touch build-stamp-ngircd-full
 
 clean:
@@ -86,10 +109,13 @@ clean:
 	rm -f $(CURDIR)/debian/ngircd-full.default
 	rm -f $(CURDIR)/debian/ngircd-full.init
 	rm -f $(CURDIR)/debian/ngircd-full.postinst
-	
+	rm -f $(CURDIR)/debian/ngircd-full-dbg.default
+	rm -f $(CURDIR)/debian/ngircd-full-dbg.postinst
+	rm -f $(CURDIR)/debian/ngircd-full-dbg.init
+
 	# Add here commands to clean up after the build process:
-	-$(MAKE) clean
-	
+	[ ! -f Makefile ] || $(MAKE) distclean
+
 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
 	cp -f /usr/share/misc/config.sub config.sub
 endif
@@ -98,13 +124,13 @@ ifneq "$(wildcard /usr/share/misc/config.guess)" ""
 endif
 	dh_clean
 
-install: install-ngircd install-ngircd-full
+install: install-ngircd install-ngircd-full install-ngircd-full-dbg
 
 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*
@@ -122,7 +148,7 @@ 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*
@@ -138,6 +164,26 @@ install-ngircd-full: build-ngircd-full
 	 >$(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.conf
 	touch $(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.motd
 
+install-ngircd-full-dbg: build-ngircd-full-dbg
+	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-dbg
+	rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd/INSTALL*
+	rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd/COPYING*
+	mv $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd \
+	 $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg
+	mkdir -p $(CURDIR)/debian/ngircd-full-dbg/var/run/ircd
+	cat $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/sample-ngircd.conf | \
+	 sed -e "s/;ServerUID = 65534/ServerUID = irc/g" | \
+	 sed -e "s/;ServerGID = 65534/ServerGID = irc/g" | \
+	 sed -e "s/;MotdFile = \/usr\/local\/etc\/ngircd.motd/MotdFile = \/etc\/ngircd\/ngircd.motd/g" | \
+	 sed -e "s/;PidFile = \/var\/run\/ngircd\/ngircd.pid/PidFile = \/var\/run\/ircd\/ngircd.pid/g" \
+	 >$(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.conf
+	touch $(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.motd
+
 # Build architecture-independent files here.
 binary-indep:
 	# We have nothing to do by default.
@@ -150,13 +196,20 @@ binary-arch: build install
 	 $(CURDIR)/debian/ngircd-full.init
 	ln -s $(CURDIR)/debian/ngircd.postinst \
 	 $(CURDIR)/debian/ngircd-full.postinst
-	
+
+	ln -s $(CURDIR)/debian/ngircd.default \
+	 $(CURDIR)/debian/ngircd-full-dbg.default
+	ln -s $(CURDIR)/debian/ngircd.init \
+	 $(CURDIR)/debian/ngircd-full-dbg.init
+	ln -s $(CURDIR)/debian/ngircd.postinst \
+	 $(CURDIR)/debian/ngircd-full-dbg.postinst
+
 	dh_testdir
 	dh_testroot
 	dh_installchangelogs -a -A ChangeLog
 	dh_installdocs -a
 	dh_installinit -a
-	dh_strip -a
+	dh_strip -a --no-package=ngircd-full-dbg
 	dh_compress -a
 	dh_fixperms -a
 	dh_installdeb -a

BIN
contrib/MacOSX/._Makefile.am


+ 6 - 5
contrib/MacOSX/Makefile.am

@@ -8,12 +8,10 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.3 2008/02/17 15:31:15 alex Exp $
-#
 
-SUBDIRS = ngIRCd.xcodeproj
+SUBDIRS = ngIRCd.xcodeproj ngIRCd.pmdoc
 
-EXTRA_DIST = de.barton.ngircd.plist.tmpl config.h cvs-version.h
+EXTRA_DIST = de.barton.ngircd.plist.tmpl config.h preinstall.sh postinstall.sh
 
 SUFFIXES = .tmpl .
 
@@ -36,7 +34,9 @@ install-sys-darwin:
 	fi
 
 install-sys-darwin-root: de.barton.ngircd.plist
-	install -c -m 644 -b -o root -g wheel de.barton.ngircd.plist /Library/LaunchDaemons/de.barton.ngircd.plist
+	install -d -m 755 -o root -g wheel $(DESTDIR)/Library/LaunchDaemons
+	install -c -m 644 -b -o root -g wheel de.barton.ngircd.plist \
+	 $(DESTDIR)/Library/LaunchDaemons/de.barton.ngircd.plist
 	@echo
 	@echo " ** \"/Library/LaunchDaemons/de.barton.ngircd.plist\" has been installed,"
 	@echo " ** but is disabled. Use launchctl(8) to enable/run ngIRCd on Darwin/Mac OS X."
@@ -44,6 +44,7 @@ install-sys-darwin-root: de.barton.ngircd.plist
 
 clean-local:
 	rm -rf build
+	rm -f de.barton.ngircd.plist
 
 maintainer-clean-local:
 	rm -f Makefile Makefile.in

+ 74 - 53
contrib/MacOSX/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -24,17 +24,11 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.3 2008/02/17 15:31:15 alex Exp $
-#
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ../..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -62,17 +56,18 @@ SOURCES =
 DIST_SOURCES =
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
-	install-exec-recursive install-info-recursive \
-	install-recursive installcheck-recursive installdirs-recursive \
-	pdf-recursive ps-recursive uninstall-info-recursive \
-	uninstall-recursive
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -91,6 +86,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -101,6 +98,7 @@ LIBS = @LIBS@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -115,11 +113,11 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 U = @U@
 VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -131,34 +129,45 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-SUBDIRS = ngIRCd.xcodeproj
-EXTRA_DIST = de.barton.ngircd.plist.tmpl config.h cvs-version.h
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = ngIRCd.xcodeproj ngIRCd.pmdoc
+EXTRA_DIST = de.barton.ngircd.plist.tmpl config.h preinstall.sh postinstall.sh
 SUFFIXES = .tmpl .
 all: all-recursive
 
@@ -193,7 +202,6 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-uninstall-info-am:
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -226,8 +234,7 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-mostlyclean-recursive clean-recursive distclean-recursive \
-maintainer-clean-recursive:
+$(RECURSIVE_CLEAN_TARGETS):
 	@failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
@@ -328,22 +335,21 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -357,7 +363,7 @@ distdir: $(DISTFILES)
 	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
-	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
 	    || exit 1; \
 	    distdir=`$(am__cd) $(distdir) && pwd`; \
 	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
@@ -365,6 +371,8 @@ distdir: $(DISTFILES)
 	      $(MAKE) $(AM_MAKEFLAGS) \
 	        top_distdir="$$top_distdir" \
 	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -418,12 +426,20 @@ info-am:
 
 install-data-am: install-data-local
 
+install-dvi: install-dvi-recursive
+
 install-exec-am:
 
+install-html: install-html-recursive
+
 install-info: install-info-recursive
 
 install-man:
 
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -443,22 +459,24 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am: uninstall-info-am
+uninstall-am:
 
-uninstall-info: uninstall-info-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
 
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
-	clean clean-generic clean-local clean-recursive ctags \
-	ctags-recursive distclean distclean-generic \
-	distclean-recursive distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-data-local install-exec \
-	install-exec-am install-info install-info-am install-man \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	maintainer-clean-local maintainer-clean-recursive mostlyclean \
-	mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
-	tags tags-recursive uninstall uninstall-am uninstall-info-am
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-local \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am \
+	install-data-local install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic maintainer-clean-local mostlyclean \
+	mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
 
 
 .tmpl:
@@ -480,7 +498,9 @@ install-sys-darwin:
 	fi
 
 install-sys-darwin-root: de.barton.ngircd.plist
-	install -c -m 644 -b -o root -g wheel de.barton.ngircd.plist /Library/LaunchDaemons/de.barton.ngircd.plist
+	install -d -m 755 -o root -g wheel $(DESTDIR)/Library/LaunchDaemons
+	install -c -m 644 -b -o root -g wheel de.barton.ngircd.plist \
+	 $(DESTDIR)/Library/LaunchDaemons/de.barton.ngircd.plist
 	@echo
 	@echo " ** \"/Library/LaunchDaemons/de.barton.ngircd.plist\" has been installed,"
 	@echo " ** but is disabled. Use launchctl(8) to enable/run ngIRCd on Darwin/Mac OS X."
@@ -488,6 +508,7 @@ install-sys-darwin-root: de.barton.ngircd.plist
 
 clean-local:
 	rm -rf build
+	rm -f de.barton.ngircd.plist
 
 maintainer-clean-local:
 	rm -f Makefile Makefile.in

+ 18 - 4
contrib/MacOSX/config.h

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2007 Alexander Barton (alex@barton.de).
+ * Copyright (c)2001-2009 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,15 +8,20 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: config.h,v 1.1 2007/11/19 22:11:36 alex Exp $
- *
  * Static configuration file for Mac OS X Xcode project
  */
 
 #define PACKAGE_NAME "ngircd"
-#define VERSION "??"
+#ifndef VERSION
+#define VERSION "??("__DATE__")"
+#endif
 #define SYSCONFDIR "/etc/ngircd"
 
+#ifndef TARGET_VENDOR
+#define TARGET_VENDOR "apple"
+#define TARGET_OS "darwin"
+#endif
+
 /* -- Build options -- */
 
 /* Define if debug-mode should be enabled */
@@ -43,6 +48,9 @@
 /* Define if zlib compression should be enabled */
 #define ZLIB 1
 
+/* Define if IPV6 protocol should be enabled */
+#define WANT_IPV6 1
+
 /* -- Supported features -- */
 
 /* Define if SSP C support is enabled. */
@@ -78,6 +86,12 @@
 #define HAVE_STRDUP 1
 /* Define to 1 if you have the `vsnprintf' function. */
 #define HAVE_VSNPRINTF 1
+/* Define to 1 if you have the `inet_aton' function. */
+#define HAVE_INET_ATON 1
+/* Define to 1 if you have the `getaddrinfo' function. */
+#define HAVE_GETADDRINFO 1
+/* Define to 1 if you have the `getnameinfo' function. */
+#define HAVE_GETNAMEINFO 1
 
 /* Define if socklen_t exists */
 #define HAVE_socklen_t 1

+ 0 - 0
contrib/MacOSX/cvs-version.h


+ 4 - 0
contrib/MacOSX/de.barton.ngircd.plist.tmpl

@@ -15,5 +15,9 @@
 	</array>
 	<key>RunAtLoad</key>
 	<true/>
+	<key>StandardErrorPath</key>
+	<string>/Library/Logs/ngIRCd.log</string>
+	<key>StandardOutPath</key>
+	<string>/Library/Logs/ngIRCd.log</string>
 </dict>
 </plist>

+ 1 - 0
contrib/MacOSX/ngIRCd.pmdoc/01ngircd-contents.xml

@@ -0,0 +1 @@
+<pkg-contents spec="1.12"/>

File diff suppressed because it is too large
+ 1 - 0
contrib/MacOSX/ngIRCd.pmdoc/01ngircd.xml


+ 1 - 0
contrib/MacOSX/ngIRCd.pmdoc/02de-contents.xml

@@ -0,0 +1 @@
+<pkg-contents spec="1.12"/>

File diff suppressed because it is too large
+ 1 - 0
contrib/MacOSX/ngIRCd.pmdoc/02de.xml


+ 18 - 0
contrib/MacOSX/ngIRCd.pmdoc/Makefile.am

@@ -0,0 +1,18 @@
+#
+# ngIRCd -- The Next Generation IRC Daemon
+# Copyright (c)2001-2008 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.
+#
+
+EXTRA_DIST = index.xml \
+ 01ngircd-contents.xml 01ngircd.xml 02de-contents.xml 02de.xml
+
+maintainer-clean-local:
+	rm -f Makefile Makefile.in
+
+# -eof-

+ 328 - 0
contrib/MacOSX/ngIRCd.pmdoc/Makefile.in

@@ -0,0 +1,328 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#
+# ngIRCd -- The Next Generation IRC Daemon
+# Copyright (c)2001-2008 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.
+#
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/MacOSX/ngIRCd.pmdoc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = index.xml \
+ 01ngircd-contents.xml 01ngircd.xml 02de-contents.xml 02de.xml
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  contrib/MacOSX/ngIRCd.pmdoc/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  contrib/MacOSX/ngIRCd.pmdoc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic \
+	maintainer-clean-local
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+	distclean-generic distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic \
+	maintainer-clean-local mostlyclean mostlyclean-generic pdf \
+	pdf-am ps ps-am uninstall uninstall-am
+
+
+maintainer-clean-local:
+	rm -f Makefile Makefile.in
+
+# -eof-
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

File diff suppressed because it is too large
+ 190 - 0
contrib/MacOSX/ngIRCd.pmdoc/index.xml


+ 49 - 31
contrib/MacOSX/ngIRCd.xcodeproj/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -24,15 +24,11 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ../../..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -60,8 +56,6 @@ SOURCES =
 DIST_SOURCES =
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -80,6 +74,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -90,6 +86,7 @@ LIBS = @LIBS@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -104,11 +101,11 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 U = @U@
 VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -120,32 +117,43 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 EXTRA_DIST = project.pbxproj
 all: all-am
 
@@ -179,7 +187,6 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-uninstall-info-am:
 tags: TAGS
 TAGS:
 
@@ -188,22 +195,21 @@ CTAGS:
 
 
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -262,12 +268,20 @@ info-am:
 
 install-data-am:
 
+install-dvi: install-dvi-am
+
 install-exec-am:
 
+install-html: install-html-am
+
 install-info: install-info-am
 
 install-man:
 
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -287,16 +301,20 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-info-am
+uninstall-am:
+
+.MAKE: install-am install-strip
 
 .PHONY: all all-am check check-am clean clean-generic distclean \
 	distclean-generic distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-exec \
-	install-exec-am install-info install-info-am install-man \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
 	install-strip installcheck installcheck-am installdirs \
 	maintainer-clean maintainer-clean-generic \
 	maintainer-clean-local mostlyclean mostlyclean-generic pdf \
-	pdf-am ps ps-am uninstall uninstall-am uninstall-info-am
+	pdf-am ps ps-am uninstall uninstall-am
 
 
 maintainer-clean-local:

+ 109 - 9
contrib/MacOSX/ngIRCd.xcodeproj/project.pbxproj

@@ -35,6 +35,8 @@
 		FA322DBE0CEF7766001761B3 /* tool.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322D330CEF74B1001761B3 /* tool.c */; };
 		FA322DC10CEF77CB001761B3 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA322DC00CEF77CB001761B3 /* libz.dylib */; };
 		FA407F2E0DB159F400271AF1 /* ng_ipaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = FA407F2C0DB159F400271AF1 /* ng_ipaddr.c */; };
+		FA85178C0FA061EC006A1F5A /* op.c in Sources */ = {isa = PBXBuildFile; fileRef = FA85178B0FA061EC006A1F5A /* op.c */; };
+		FAA3D27B0F139CDC00B2447E /* conn-ssl.c in Sources */ = {isa = PBXBuildFile; fileRef = FAA3D2790F139CDC00B2447E /* conn-ssl.c */; };
 		FAE5CC2E0CF2308A007D69B6 /* numeric.c in Sources */ = {isa = PBXBuildFile; fileRef = FAE5CC2D0CF2308A007D69B6 /* numeric.c */; };
 /* End PBXBuildFile section */
 
@@ -126,7 +128,6 @@
 		FA322D210CEF74B1001761B3 /* getpid.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = getpid.sh; sourceTree = "<group>"; };
 		FA322D220CEF74B1001761B3 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = "<group>"; };
 		FA322D230CEF74B1001761B3 /* mode-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "mode-test.e"; sourceTree = "<group>"; };
-		FA322D240CEF74B1001761B3 /* ngircd-test.conf */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "ngircd-test.conf"; sourceTree = "<group>"; };
 		FA322D250CEF74B1001761B3 /* README */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
 		FA322D260CEF74B1001761B3 /* start-server.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = "start-server.sh"; sourceTree = "<group>"; };
 		FA322D270CEF74B1001761B3 /* stop-server.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = "stop-server.sh"; sourceTree = "<group>"; };
@@ -188,12 +189,35 @@
 		FA322DAE0CEF7538001761B3 /* ngircd.8.tmpl */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = ngircd.8.tmpl; sourceTree = "<group>"; };
 		FA322DAF0CEF7538001761B3 /* ngircd.conf.5.tmpl */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = ngircd.conf.5.tmpl; sourceTree = "<group>"; };
 		FA322DB10CEF7565001761B3 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
-		FA322DBB0CEF773C001761B3 /* cvs-version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "cvs-version.h"; sourceTree = "<group>"; };
 		FA322DC00CEF77CB001761B3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
 		FA407F2B0DB159F400271AF1 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = Makefile.am; path = ipaddr/Makefile.am; sourceTree = "<group>"; };
 		FA407F2C0DB159F400271AF1 /* ng_ipaddr.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = ng_ipaddr.c; path = ipaddr/ng_ipaddr.c; sourceTree = "<group>"; };
 		FA407F2D0DB159F400271AF1 /* ng_ipaddr.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = ng_ipaddr.h; path = ipaddr/ng_ipaddr.h; sourceTree = "<group>"; };
 		FA407F380DB15AC700271AF1 /* GIT.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = GIT.txt; sourceTree = "<group>"; };
+		FA85178A0FA061EC006A1F5A /* op.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = op.h; sourceTree = "<group>"; };
+		FA85178B0FA061EC006A1F5A /* op.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = op.c; sourceTree = "<group>"; };
+		FAA3D2700F139CB300B2447E /* invite-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "invite-test.e"; sourceTree = "<group>"; };
+		FAA3D2710F139CB300B2447E /* join-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "join-test.e"; sourceTree = "<group>"; };
+		FAA3D2720F139CB300B2447E /* kick-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "kick-test.e"; sourceTree = "<group>"; };
+		FAA3D2730F139CB300B2447E /* message-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "message-test.e"; sourceTree = "<group>"; };
+		FAA3D2740F139CB300B2447E /* ngircd-test1.conf */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "ngircd-test1.conf"; sourceTree = "<group>"; };
+		FAA3D2750F139CB300B2447E /* ngircd-test2.conf */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "ngircd-test2.conf"; sourceTree = "<group>"; };
+		FAA3D2760F139CB300B2447E /* opless-channel-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "opless-channel-test.e"; sourceTree = "<group>"; };
+		FAA3D2770F139CB300B2447E /* server-link-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "server-link-test.e"; sourceTree = "<group>"; };
+		FAA3D2780F139CDC00B2447E /* conf-ssl.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "conf-ssl.h"; sourceTree = "<group>"; };
+		FAA3D2790F139CDC00B2447E /* conn-ssl.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "conn-ssl.c"; sourceTree = "<group>"; };
+		FAA3D27A0F139CDC00B2447E /* conn-ssl.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "conn-ssl.h"; sourceTree = "<group>"; };
+		FAA3D27C0F139CF800B2447E /* strtok_r.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = strtok_r.c; sourceTree = "<group>"; };
+		FAA3D27D0F139CF800B2447E /* waitpid.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = waitpid.c; sourceTree = "<group>"; };
+		FAA3D2800F139D1500B2447E /* Services.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Services.txt; sourceTree = "<group>"; };
+		FAA3D2820F139D2E00B2447E /* 01ngircd-contents.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = "01ngircd-contents.xml"; sourceTree = "<group>"; };
+		FAA3D2830F139D2E00B2447E /* 01ngircd.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = 01ngircd.xml; sourceTree = "<group>"; };
+		FAA3D2840F139D2E00B2447E /* 02de-contents.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = "02de-contents.xml"; sourceTree = "<group>"; };
+		FAA3D2850F139D2E00B2447E /* 02de.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = 02de.xml; sourceTree = "<group>"; };
+		FAA3D2860F139D2E00B2447E /* index.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = index.xml; sourceTree = "<group>"; };
+		FAA3D2880F139D2E00B2447E /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = "<group>"; };
+		FAA3D28A0F139D2E00B2447E /* postinstall.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = postinstall.sh; sourceTree = "<group>"; };
+		FAA3D28B0F139D2E00B2447E /* preinstall.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = preinstall.sh; sourceTree = "<group>"; };
 		FAE5CC2C0CF2308A007D69B6 /* numeric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = numeric.h; sourceTree = "<group>"; };
 		FAE5CC2D0CF2308A007D69B6 /* numeric.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = numeric.c; sourceTree = "<group>"; };
 /* End PBXFileReference section */
@@ -259,6 +283,9 @@
 		FA322CD70CEF74B1001761B3 /* ngircd */ = {
 			isa = PBXGroup;
 			children = (
+				FAA3D2780F139CDC00B2447E /* conf-ssl.h */,
+				FAA3D2790F139CDC00B2447E /* conn-ssl.c */,
+				FAA3D27A0F139CDC00B2447E /* conn-ssl.h */,
 				FA322CD90CEF74B1001761B3 /* array.c */,
 				FA322CDA0CEF74B1001761B3 /* array.h */,
 				FA322CDB0CEF74B1001761B3 /* channel.c */,
@@ -308,6 +335,8 @@
 				FA322D070CEF74B1001761B3 /* ngircd.h */,
 				FAE5CC2D0CF2308A007D69B6 /* numeric.c */,
 				FAE5CC2C0CF2308A007D69B6 /* numeric.h */,
+				FA85178A0FA061EC006A1F5A /* op.h */,
+				FA85178B0FA061EC006A1F5A /* op.c */,
 				FA322D080CEF74B1001761B3 /* parse.c */,
 				FA322D090CEF74B1001761B3 /* parse.h */,
 				FA322D0A0CEF74B1001761B3 /* rendezvous.c */,
@@ -321,6 +350,8 @@
 		FA322D0E0CEF74B1001761B3 /* portab */ = {
 			isa = PBXGroup;
 			children = (
+				FAA3D27C0F139CF800B2447E /* strtok_r.c */,
+				FAA3D27D0F139CF800B2447E /* waitpid.c */,
 				FA322D100CEF74B1001761B3 /* ansi2knr.1 */,
 				FA322D110CEF74B1001761B3 /* ansi2knr.c */,
 				FA322D120CEF74B1001761B3 /* exp.h */,
@@ -339,6 +370,14 @@
 		FA322D1B0CEF74B1001761B3 /* testsuite */ = {
 			isa = PBXGroup;
 			children = (
+				FAA3D2700F139CB300B2447E /* invite-test.e */,
+				FAA3D2710F139CB300B2447E /* join-test.e */,
+				FAA3D2720F139CB300B2447E /* kick-test.e */,
+				FAA3D2730F139CB300B2447E /* message-test.e */,
+				FAA3D2740F139CB300B2447E /* ngircd-test1.conf */,
+				FAA3D2750F139CB300B2447E /* ngircd-test2.conf */,
+				FAA3D2760F139CB300B2447E /* opless-channel-test.e */,
+				FAA3D2770F139CB300B2447E /* server-link-test.e */,
 				FA322D1D0CEF74B1001761B3 /* channel-test.e */,
 				FA322D1E0CEF74B1001761B3 /* check-idle.e */,
 				FA322D1F0CEF74B1001761B3 /* connect-test.e */,
@@ -347,7 +386,6 @@
 				FA322D220CEF74B1001761B3 /* Makefile.am */,
 				FA1A6BBC0D6857BB00AA8F71 /* misc-test.e */,
 				FA322D230CEF74B1001761B3 /* mode-test.e */,
-				FA322D240CEF74B1001761B3 /* ngircd-test.conf */,
 				FA322D250CEF74B1001761B3 /* README */,
 				FA322D260CEF74B1001761B3 /* start-server.sh */,
 				FA322D270CEF74B1001761B3 /* stop-server.sh */,
@@ -409,11 +447,13 @@
 		FA322D730CEF7523001761B3 /* MacOSX */ = {
 			isa = PBXGroup;
 			children = (
+				FAA3D2810F139D2E00B2447E /* ngIRCd.pmdoc */,
+				FAA3D28A0F139D2E00B2447E /* postinstall.sh */,
+				FAA3D28B0F139D2E00B2447E /* preinstall.sh */,
 				FA322D750CEF7523001761B3 /* build */,
 				FA322D8D0CEF7523001761B3 /* Makefile.am */,
 				FA322D8E0CEF7523001761B3 /* ngIRCd.xcodeproj */,
 				FA322DB10CEF7565001761B3 /* config.h */,
-				FA322DBB0CEF773C001761B3 /* cvs-version.h */,
 			);
 			path = MacOSX;
 			sourceTree = "<group>";
@@ -499,6 +539,7 @@
 		FA322D970CEF752C001761B3 /* doc */ = {
 			isa = PBXGroup;
 			children = (
+				FAA3D2800F139D1500B2447E /* Services.txt */,
 				FA407F380DB15AC700271AF1 /* GIT.txt */,
 				FA322D9A0CEF752C001761B3 /* FAQ.txt */,
 				FA322D9B0CEF752C001761B3 /* Makefile.am */,
@@ -549,6 +590,19 @@
 			name = ipaddr;
 			sourceTree = "<group>";
 		};
+		FAA3D2810F139D2E00B2447E /* ngIRCd.pmdoc */ = {
+			isa = PBXGroup;
+			children = (
+				FAA3D2820F139D2E00B2447E /* 01ngircd-contents.xml */,
+				FAA3D2830F139D2E00B2447E /* 01ngircd.xml */,
+				FAA3D2840F139D2E00B2447E /* 02de-contents.xml */,
+				FAA3D2850F139D2E00B2447E /* 02de.xml */,
+				FAA3D2860F139D2E00B2447E /* index.xml */,
+				FAA3D2880F139D2E00B2447E /* Makefile.am */,
+			);
+			path = ngIRCd.pmdoc;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -626,6 +680,8 @@
 				FA322DBE0CEF7766001761B3 /* tool.c in Sources */,
 				FAE5CC2E0CF2308A007D69B6 /* numeric.c in Sources */,
 				FA407F2E0DB159F400271AF1 /* ng_ipaddr.c in Sources */,
+				FAA3D27B0F139CDC00B2447E /* conn-ssl.c in Sources */,
+				FA85178C0FA061EC006A1F5A /* op.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -655,23 +711,65 @@
 				GCC_WARN_UNUSED_VALUE = YES;
 				INSTALL_PATH = /usr/local/bin;
 				PRODUCT_NAME = ngIRCd;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
 			};
 			name = Default;
 		};
 		1DEB928B08733DD80010E9CD /* Default */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ARCHS = (
-					ppc,
-					i386,
-				);
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				GCC_VERSION = 4.0;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				PREBINDING = NO;
-				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
 			};
 			name = Default;
 		};
+		FAB0570C105D917F006AF9E2 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				GCC_DEBUGGING_SYMBOLS = full;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_VERSION = 4.0;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				PREBINDING = NO;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
+			};
+			name = Debug;
+		};
+		FAB0570D105D917F006AF9E2 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
+				GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+				GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+				GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
+				GCC_WARN_MISSING_PARENTHESES = YES;
+				GCC_WARN_PEDANTIC = YES;
+				GCC_WARN_SHADOW = YES;
+				GCC_WARN_SIGN_COMPARE = YES;
+				GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNKNOWN_PRAGMAS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_LABEL = YES;
+				GCC_WARN_UNUSED_PARAMETER = YES;
+				GCC_WARN_UNUSED_VALUE = YES;
+				INSTALL_PATH = /usr/local/bin;
+				PRODUCT_NAME = ngIRCd;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
+			};
+			name = Debug;
+		};
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
@@ -679,6 +777,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				1DEB928708733DD80010E9CD /* Default */,
+				FAB0570D105D917F006AF9E2 /* Debug */,
 			);
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Default;
@@ -687,6 +786,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				1DEB928B08733DD80010E9CD /* Default */,
+				FAB0570C105D917F006AF9E2 /* Debug */,
 			);
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Default;

+ 42 - 0
contrib/MacOSX/postinstall.sh

@@ -0,0 +1,42 @@
+#!/bin/sh
+# ngIRCd Mac OS X postinstall/postupgrade script
+
+LDPLIST="/Library/LaunchDaemons/de.barton.ngircd.plist"
+
+if [ ! -e /etc/ngircd ]; then
+	echo "Creating symlink: /opt/ngircd/etc -> /etc/ngircd"
+	ln -s /opt/ngircd/etc /etc/ngircd || exit 1
+else
+	echo "/etc/ngircd already exists. Don't create symlink."
+fi
+
+if [ ! -e /opt/ngircd/etc/ngircd.conf ]; then
+	echo "Creating default configuration: /opt/ngircd/etc/ngircd.conf"
+	cp /opt/ngircd/share/doc/ngircd/sample-ngircd.conf \
+	 /opt/ngircd/etc/ngircd.conf || exit 1
+else
+	echo "/opt/ngircd/etc/ngircd.conf exists. Don't copy sample file."
+fi
+chmod o-rwx /opt/ngircd/etc/ngircd.conf
+
+if [ -f "$LDPLIST" ]; then
+	echo "Fixing ownership and permissions of LaunchDaemon script ..."
+	chown root:wheel "$LDPLIST" || exit 1
+	chmod 644 "$LDPLIST" || exit 1
+fi
+
+if [ -f /tmp/ngircd_needs_restart ]; then
+	echo "ngIRCd should be (re-)started ..."
+	if [ -r "$LDPLIST" ]; then
+		echo "LaunchDaemon script found, starting daemon ..."
+		launchctl load -w "$LDPLIST" || exit 1
+		echo "OK, LaunchDaemon script loaded successfully."
+	else
+		echo "LaunchDaemon script not installed. Can't start daemon."
+	fi
+else
+	echo "Not loading LaunchDaemon script."
+fi
+rm -f /tmp/ngircd_needs_restart
+
+# -eof-

+ 25 - 0
contrib/MacOSX/preinstall.sh

@@ -0,0 +1,25 @@
+#!/bin/sh
+# ngIRCd Mac OS X preinstall/preupgrade script
+
+LDPLIST="/Library/LaunchDaemons/de.barton.ngircd.plist"
+
+rm -f /tmp/ngircd_needs_restart || exit 1
+if [ -r "$LDPLIST" ]; then
+	echo "LaunchDaemon script found, checking status ..."
+	launchctl list | fgrep "de.barton.ngIRCd" >/dev/null 2>&1
+	if [ $? -eq 0 ]; then
+		# ngIRCd is already running; stop it and touch a
+		# "stamp file" so that we know that we have to
+		# restart it after installation/upgrade.
+		echo "ngIRCd is already running; stop it ..."
+		launchctl unload "$LDPLIST" || exit 1
+		echo "Daemon has been stopped."
+		touch /tmp/ngircd_needs_restart || exit 1
+	else
+		echo "ngIRCd is not running."
+	fi
+else
+	echo "LaunchDaemon script not found."
+fi
+
+# -eof-

+ 8 - 10
contrib/Makefile.am

@@ -1,20 +1,18 @@
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2004 Alexander Barton <alex@barton.de>
+# Copyright (c)2001-2009 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 2004/04/28 12:18:02 alex Exp $
+# 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.
 #
 
 SUBDIRS = Debian MacOSX
 
-EXTRA_DIST = README ngircd.spec systrace.policy
+EXTRA_DIST = README ngircd.spec systrace.policy ngindent ngircd-bsd.sh \
+	ngircd-redhat.init platformtest.sh
 
 maintainer-clean-local:
 	rm -f Makefile Makefile.in

+ 73 - 54
contrib/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,26 +16,19 @@
 
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2004 Alexander Barton <alex@barton.de>
+# Copyright (c)2001-2009 Alexander Barton (alex@barton.de)
 #
-# Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
-# der GNU General Public License (GPL), wie von der Free Software Foundation
-# herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
-# der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
-# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
-# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.4 2004/04/28 12:18:02 alex Exp $
-#
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -63,17 +56,18 @@ SOURCES =
 DIST_SOURCES =
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
-	install-exec-recursive install-info-recursive \
-	install-recursive installcheck-recursive installdirs-recursive \
-	pdf-recursive ps-recursive uninstall-info-recursive \
-	uninstall-recursive
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -92,6 +86,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -102,6 +98,7 @@ LIBS = @LIBS@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -116,11 +113,11 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 U = @U@
 VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -132,34 +129,47 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 SUBDIRS = Debian MacOSX
-EXTRA_DIST = README ngircd.spec systrace.policy
+EXTRA_DIST = README ngircd.spec systrace.policy ngindent ngircd-bsd.sh \
+	ngircd-redhat.init platformtest.sh
+
 all: all-recursive
 
 .SUFFIXES:
@@ -192,7 +202,6 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-uninstall-info-am:
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -225,8 +234,7 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-mostlyclean-recursive clean-recursive distclean-recursive \
-maintainer-clean-recursive:
+$(RECURSIVE_CLEAN_TARGETS):
 	@failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
@@ -327,22 +335,21 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -356,7 +363,7 @@ distdir: $(DISTFILES)
 	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
-	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
 	    || exit 1; \
 	    distdir=`$(am__cd) $(distdir) && pwd`; \
 	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
@@ -364,6 +371,8 @@ distdir: $(DISTFILES)
 	      $(MAKE) $(AM_MAKEFLAGS) \
 	        top_distdir="$$top_distdir" \
 	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -417,12 +426,20 @@ info-am:
 
 install-data-am:
 
+install-dvi: install-dvi-recursive
+
 install-exec-am:
 
+install-html: install-html-recursive
+
 install-info: install-info-recursive
 
 install-man:
 
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -442,21 +459,23 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am: uninstall-info-am
+uninstall-am:
 
-uninstall-info: uninstall-info-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
 
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
-	clean clean-generic clean-recursive ctags ctags-recursive \
-	distclean distclean-generic distclean-recursive distclean-tags \
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic ctags \
+	ctags-recursive distclean distclean-generic distclean-tags \
 	distdir dvi dvi-am html html-am info info-am install \
-	install-am install-data install-data-am install-exec \
-	install-exec-am install-info install-info-am install-man \
+	install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
 	install-strip installcheck installcheck-am installdirs \
 	installdirs-am maintainer-clean maintainer-clean-generic \
-	maintainer-clean-local maintainer-clean-recursive mostlyclean \
-	mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
-	tags tags-recursive uninstall uninstall-am uninstall-info-am
+	maintainer-clean-local mostlyclean mostlyclean-generic pdf \
+	pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
 
 
 maintainer-clean-local:

+ 8 - 6
contrib/README

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                        (c)2001-2005 Alexander Barton,
+                        (c)2001-2009 Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -19,15 +19,17 @@ MacOSX/
 ngindent
  - Script to indent the code of ngIRCd in the "standard way".
 
-ngircd.sh
+ngircd-bsd.sh
  - Start script for FreeBSD.
 
+ngircd-redhat.init
+ - Start/stop script for RedHat-based distributions (like CentOS).
+
 ngircd.spec
  - RPM "spec" file.
 
+platformtest.sh
+ - Build ngIRCd and output a "result line" suitable for doc/Platforms.txt.
+
 systrace.policy
  - Systrace policy file for OpenBSD (and probably NetBSD).
-
-
---
-$Id: README,v 1.3 2006/07/23 11:34:32 alex Exp $

+ 16 - 0
contrib/ngindent

@@ -0,0 +1,16 @@
+#/bin/sh
+
+INDENTARGS="-kr -i8 -ts8 -l80 -c3 -cd41 -ss -ncs -psl"
+
+# check if indent(1) is available
+type indent >/dev/null 2>&1 && INDENT="indent"
+type gnuindent >/dev/null 2>&1 && INDENT="gnuindent"
+
+if [ -z "$INDENT" ]; then
+	echo "Error: GNU \"indent\" not found!"
+	exit 1
+fi
+
+$INDENT -v $INDENTARGS $*
+
+# -eof-

+ 51 - 0
contrib/ngircd-bsd.sh

@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# PROVIDE: ngircd
+# REQUIRE: NETWORKING SERVERS
+# BEFORE: DAEMON
+# KEYWORD: FreeBSD shutdown
+
+# Add the following line to /etc/rc.conf to enable `ngircd':
+#
+#ngircd_enable="YES"
+#
+
+. "/etc/rc.subr"
+
+name="ngircd"
+rcvar=`set_rcvar`
+
+command="/usr/local/sbin/ngircd"
+command_args=""
+
+load_rc_config "$name"
+: ${ngircd_enable="NO"}
+: ${ngircd_flags=""}
+
+required_files="/usr/local/etc/$name.conf"
+pidfile="${ngircd_pidfile:-/var/run/${name}/${name}.pid}"
+
+if [ ! x"${ngircd_chrootdir}" = x ];then
+	# Mount a devfs in the chroot directory if needed
+	if [ ! -c ${ngircd_chrootdir}/dev/random \
+	  -o ! -c ${ngircd_chrootdir}/dev/null ]; then
+		umount ${ngircd_chrootdir}/dev 2>/dev/null
+		mount_devfs devfs ${ngircd_chrootdir}/dev
+	fi
+
+	devfs -m ${ngircd_chrootdir}/dev rule apply hide
+	devfs -m ${ngircd_chrootdir}/dev rule apply path null unhide
+	devfs -m ${ngircd_chrootdir}/dev rule apply path random unhide
+
+	# Copy local timezone information if it is not up to date.
+	if [ -f /etc/localtime ]; then
+		cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \
+			cp -p /etc/localtime "${named_chrootdir}/etc/localtime"
+	fi
+
+	pidfile="${ngircd_chrootdir}${pidfile}"
+fi
+
+run_rc_command "$1"
+
+# -eof-

+ 119 - 0
contrib/ngircd-redhat.init

@@ -0,0 +1,119 @@
+#!/bin/sh
+#
+# ngIRCd start and stop script for RedHat based distributions.
+# Written by Naoya Nakazawa <naoya@sanow.net> for CentOS 5.2, 2009.
+#
+# chkconfig: 2345 01
+# description: ngIRCd is an Open Source server for \
+#              the Internet Relay Chat (IRC), which \
+#              is developed and published under \
+#              the terms of the GNU General Public
+#              Licence (URL: http://www.gnu.org/licenses/gpl.html). \
+#              ngIRCd means "next generation IRC daemon", \
+#              it's written from scratch and not deduced from the \
+#              "grandfather of IRC daemons", the daemon of the IRCNet.
+#
+# processname: /usr/sbin/ngircd
+# config: /etc/ngircd
+# pidfile: /var/run/ngircd.pid
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/ngircd
+NAME=ngIRCd
+BASENAME=ngircd
+CONF=/etc/$BASENAME.conf
+DESC="IRC daemon"
+PARAMS="-f $CONF"
+
+# Source function library.
+. /etc/init.d/functions
+
+# Get config.
+test -f /etc/sysconfig/network && . /etc/sysconfig/network
+test -f /etc/sysconfig/makuosan && . /etc/sysconfig/makuosan
+
+# Check that networking is up.
+[ "${NETWORKING}" = "yes" ] || exit 0
+
+[ -x $DAEMON ] || exit 1
+[ -f $CONF ] || exit 2
+
+RETVAL=0
+
+start(){
+    echo -n $"Starting $NAME: "
+    daemon $DAEMON $PARAMS
+    RETVAL=$?
+    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME
+    echo
+    return $RETVAL
+}
+
+stop(){
+    echo -n $"Stopping $NAME: "
+    killproc $DAEMON
+    RETVAL=$?
+    if [ $RETVAL -eq 0 ] ; then
+        rm -f /var/lock/subsys/$BASENAME
+    fi
+    echo
+    return $RETVAL
+}
+
+reload(){
+    echo -n $"Reloading configuration: "
+    killproc $DAEMON -HUP
+    RETVAL=$?
+    echo
+    return $RETVAL
+}
+
+restart(){
+    stop
+    start
+}
+
+condrestart(){
+    [ -e /var/lock/subsys/$BASENAME ] && restart
+    return 0
+}
+
+check_config(){
+     $DAEMON $PARAMS --configtest >/dev/null 2>&1
+     [ $? -eq 0 ] && return 0
+
+     echo -n $"Configuration of $NAME is not valid, won't (re)start!"
+     echo -n $"Run \"$DAEMON --configtest\" and fix it up ..."
+     exit 6
+}
+
+# See how we were called.
+case "$1" in
+    start)
+        check_config
+	start
+	;;
+    stop)
+	stop
+	;;
+    status)
+	status $NAME
+	;;
+    restart)
+	restart
+	;;
+    reload)
+	reload
+	;;
+    condrestart)
+	condrestart
+	;;
+    test)
+        check_config
+        ;;
+    *)
+	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|test}"
+	RETVAL=1
+esac
+
+exit $RETVAL

+ 16 - 11
contrib/ngircd.spec

@@ -1,5 +1,5 @@
 %define name    ngircd
-%define version 0.12.1
+%define version 15
 %define release 1
 %define prefix  %{_prefix}
 
@@ -7,12 +7,12 @@ Summary:      A lightweight daemon for the Internet Relay Chat (IRC)
 Name:         %{name}
 Version:      %{version}
 Release:      %{release}
-Copyright:    GPL
-Group:        Networking/Daemons
-URL:          http://arthur.ath.cx/~alex/ngircd/
+License:      GPLv2+
+Group:        System Environment/Daemons
+URL:          http://ngircd.barton.de/
 Source:       %{name}-%{version}.tar.gz
-Packager:     Sean Reifschneider <jafo-rpms@tummy.com>
-BuildRoot:    /var/tmp/%{name}-root
+BuildRoot:    %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires:  zlib-devel, openssl-devel
 
 %description
 ngIRCd is a free open source daemon for the Internet Relay Chat (IRC),
@@ -29,10 +29,13 @@ ngIRCd is compatible to the "original" ircd 2.10.3p3, so you can run
 mixed networks.
 
 %prep
-%setup
+%setup -q
 %build
-%configure
-make
+%configure \
+  --with-zlib \
+  --with-openssl
+
+make %{?_smp_mflags}
 
 %install
 [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
@@ -42,6 +45,7 @@ make
    ( cd usr/sbin; mv *-ngircd ngircd )
    ( cd usr/share/man/man5; mv *-ngircd.conf.5 ngircd.conf.5 )
    ( cd usr/share/man/man8; mv *-ngircd.8 ngircd.8 )
+   rm -fr usr/share/doc/ngircd
 )
 
 %clean
@@ -49,7 +53,8 @@ make
 
 %files
 %defattr(755,root,root)
-%doc AUTHORS  COPYING  ChangeLog  INSTALL NEWS  README
+%doc AUTHORS  COPYING  ChangeLog  INSTALL NEWS  README doc/*
 %config(noreplace) /etc
 %{_prefix}/sbin
-%{_prefix}/share/man/
+%{_mandir}/man5/ngircd.conf*
+%{_mandir}/man8/ngircd.8*

+ 143 - 0
contrib/platformtest.sh

@@ -0,0 +1,143 @@
+#!/bin/sh
+#
+# ngIRCd -- The Next Generation IRC Daemon
+# Copyright (c)2001-2009 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.
+#
+
+# This script analyzes the build process of ngIRCd and generates output
+# suitable for inclusion in doc/Platforms.txt -- please send reports
+# to the ngIRCd mailing list: <ngircd-ml@ngircd.barton.de>.
+
+NAME=`basename "$0"`
+VERBOSE=
+
+PLATFORM=
+COMPILER="unknown"
+VERSION="unknown"
+DATE=`date "+%y-%m-%d"`
+
+CONFIGURE=
+MAKE=
+CHECK=
+RUN=
+COMMENT=
+
+while [ $# -gt 0 ]; do
+	case "$1" in
+		"-v")
+			VERBOSE=1
+			;;
+		*)
+			echo "Usage: $NAME [-v]"
+			exit 2
+	esac
+	shift
+done
+
+echo "$NAME: Checking ngIRCd base source directory ..."
+grep "ngIRCd" ./ChangeLog >/dev/null 2>&1
+if [ $? -ne 0 ]; then
+	grep "ngIRCd" ../ChangeLog >/dev/null 2>&1
+	if [ $? -ne 0 ]; then
+		echo "$NAME: ngIRCd base source directory not found!?"
+		exit 1
+	fi
+	cd ..
+fi
+
+echo "$NAME: Checking for ./configure script ..."
+if [ ! -e ./configure ]; then
+	echo "$NAME: Not found. Running ./autogen.sh ..."
+	[ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null
+fi
+
+if [ -e ./configure ]; then
+	echo "$NAME: Running \"./configure\" script ..."
+	[ -n "$VERBOSE" ] && ./configure || ./configure >/dev/null
+	if [ $? -eq 0 -a -e ./Makefile ]; then
+		CONFIGURE=1
+		echo "$NAME: Running \"make\" ..."
+		[ -n "$VERBOSE" ] && make || make >/dev/null
+		if [ $? -eq 0 -a -x src/ngircd/ngircd ]; then
+			MAKE=1
+			echo "$NAME: Running \"make check\" ..."
+			[ -n "$VERBOSE" ] && make check || make check >/dev/null
+			if [ $? -eq 0 ]; then
+				CHECK=1
+				RUN=$CHECK
+			else
+				./src/ngircd/ngircd --help 2>/dev/null \
+				 | grep "^ngircd" >/dev/null
+				[ $? -eq 0 ] && RUN=1
+			fi
+		fi
+	fi
+fi
+
+# Get target platform information
+if [ -r "src/config.h" ]; then
+	CPU=`grep "TARGET_CPU" "src/config.h" | cut -d'"' -f2`
+	OS=`grep "TARGET_OS" "src/config.h" | cut -d'"' -f2`
+	VENDOR=`grep "TARGET_VENDOR" "src/config.h" | cut -d'"' -f2`
+	PLATFORM="$CPU/$VENDOR/$OS"
+fi
+if [ -z "$PLATFORM" ]; then
+	PLATFORM="`uname 2>/dev/null` `uname -r 2>/dev/null`, `uname -m 2>/dev/null`"
+fi
+
+# Get compiler information
+if [ -r "Makefile" ]; then
+	eval $(grep "^CC = " Makefile | sed -e 's/ //g')
+	$CC --version 2>&1 | grep -i "GCC" >/dev/null
+	if [ $? -eq 0 ]; then
+		COMPILER=$($CC --version | head -n 1 | awk "{ print \$3 }" \
+		 | cut -d'-' -f1)
+		COMPILER="gcc $COMPILER"
+	fi
+fi
+
+# Get ngIRCd version information
+if [ -d ".git" ]; then
+	VERSION=`git log --abbrev-commit --pretty=oneline HEAD~1.. \
+	 | cut -d' ' -f1 | tr -d '.'`
+elif [ -r "Makefile" ]; then
+	eval $(grep "^VERSION = " Makefile | sed -e 's/ //g')
+fi
+[ -n "$VERSION" ] || VERSION="unknown"
+
+# Get IO interface information
+if [ "$OS" = "linux-gnu" ]; then
+	COMMENT="(1)"
+else
+	grep "^#define HAVE_SYS_DEVPOLL_H 1" src/config.h >/dev/null 2>&1
+	[ $? -eq 0 ] && COMMENT="(4)"
+	grep "^#define HAVE_EPOLL_CREATE 1" src/config.h >/dev/null 2>&1
+	[ $? -eq 0 ] && COMMENT="(5)"
+	grep "^#define HAVE_KQUEUE 1" src/config.h >/dev/null 2>&1
+	[ $? -eq 0 ] && COMMENT="(3)"
+fi
+
+[ -n "$CONFIGURE" ] && C="Y" || C="N"
+[ -n "$MAKE" ] && M="Y" || M="N"
+[ -n "$CHECK" ] && T="Y" || T="N"
+[ -n "$RUN" ] && R="Y" || R="N"
+[ -n "$COMMENT" ] && COMMENT=" $COMMENT"
+
+echo
+echo "                              the executable works (\"runs\") as expected --+"
+echo "                                tests run successfully (\"make check\") --+ |"
+echo "                                           ngIRCd compiles (\"make\") --+ | |"
+echo "                                                ./configure works --+ | | |"
+echo "                                                                    | | | |"
+echo "Platform                    Compiler     ngIRCd     Date     Tester C M T R See"
+echo "--------------------------- ------------ ---------- -------- ------ - - - - ---"
+printf "%-27s %-12s %-10s %s %-6s %s %s %s %s%s" \
+ "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$USER" \
+ "$C" "$M" "$T" "$R" "$COMMENT"
+echo; echo

+ 63 - 8
depcomp

@@ -1,9 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2005-02-09.22
+scriptversion=2006-10-15.18
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
+# Foundation, Inc.
 
 # 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
@@ -17,8 +18,8 @@ scriptversion=2005-02-09.22
 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -91,7 +92,20 @@ gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
 ## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
 ## it if -MD -MP comes after the -MF stuff.  Hmm.
-  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am.  Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+  for arg
+  do
+    case $arg in
+    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+    *)  set fnord "$@" "$arg" ;;
+    esac
+    shift # fnord
+    shift # $arg
+  done
+  "$@"
   stat=$?
   if test $stat -eq 0; then :
   else
@@ -276,6 +290,46 @@ icc)
   rm -f "$tmpdepfile"
   ;;
 
+hp2)
+  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+  # compilers, which have integrated preprocessors.  The correct option
+  # to use with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  # Much of this is similar to the tru64 case; see comments there.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add `dependent.h:' lines.
+    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+  else
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
 tru64)
    # The Tru64 compiler uses -MD to generate dependencies as a side
    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
@@ -288,13 +342,13 @@ tru64)
 
    if test "$libtool" = yes; then
       # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mecanism is used in libtool 1.4 series to
+      # static library.  This mechanism is used in libtool 1.4 series to
       # handle both shared and static libraries in a single compilation.
       # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
       #
       # With libtool 1.5 this exception was removed, and libtool now
       # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # compilations output dependencies in $dir.libs/$base.o.d and
       # in $dir$base.o.d.  We have to check for both files, because
       # one of the two compilations can be disabled.  We should prefer
       # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
@@ -467,7 +521,8 @@ cpp)
   done
 
   "$@" -E |
-    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
     sed '$ s: \\$::' > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"

+ 12 - 1
doc/FAQ.txt

@@ -54,6 +54,10 @@ A: Most probably you are using version 1.5 of GNU automake which seems to be
 III. Runtime
 ~~~~~~~~~~~~
 
+Q: Where is the log file located?
+A: ngIRCd does not write its own log file. Instead, ngIRCd uses
+   syslog(3). Check the files in /var/log/ and/or consult the
+   documentation for your system logger daemon.
 Q: I cannot connect to remote peers when I use the chroot option, the
    following is logged: "Can't resolve example.com: unknown error!".
 A: On Linux/glibc with chroot enabled you need to put some libraries inside
@@ -61,7 +65,14 @@ A: On Linux/glibc with chroot enabled you need to put some libraries inside
    linking ngircd statically does not help this. The only known workaround
    is to either disable chroot support or to link against dietlibc instead
    of glibc. (tnx to Sebastian Siewior)
-
+Q: I have added an [Oper] section, how do i log on as IRC operator?
+A: You can use the /OPER command in your IRC client to become an IRC operator.
+   ngIRCd will also log all OPER requests (using syslog), if OPER fails you
+   can look there to determine why it did not work (bad password, unauthorized
+   host mask, etc.)
+Q: I am an IRC operator, but MODE doesn't work!
+A: You need to set 'OperCanUseMode = yes' in ngircd.conf to enable MODE for IRC
+   operators.
 
 IV. Bugs!?
 ~~~~~~~~~~

+ 3 - 2
doc/Makefile.am

@@ -1,6 +1,6 @@
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2008 by Alexander Barton (alex@barton.de)
+# Copyright (c)2001-2008 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
@@ -13,7 +13,8 @@
 SUBDIRS = src
 
 EXTRA_DIST = FAQ.txt GIT.txt Protocol.txt Platforms.txt README-AUX.txt \
-	README-BeOS.txt RFC.txt SSL.txt Zeroconf.txt sample-ngircd.conf
+	README-BeOS.txt RFC.txt Services.txt SSL.txt Zeroconf.txt \
+	sample-ngircd.conf
 
 maintainer-clean-local:
 	rm -f Makefile Makefile.in

+ 68 - 48
doc/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,7 +16,7 @@
 
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2008 by Alexander Barton (alex@barton.de)
+# Copyright (c)2001-2008 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
@@ -25,15 +25,11 @@
 # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
 # der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
 #
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -61,17 +57,18 @@ SOURCES =
 DIST_SOURCES =
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
-	install-exec-recursive install-info-recursive \
-	install-recursive installcheck-recursive installdirs-recursive \
-	pdf-recursive ps-recursive uninstall-info-recursive \
-	uninstall-recursive
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -90,6 +87,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -100,6 +99,7 @@ LIBS = @LIBS@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -114,11 +114,11 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 U = @U@
 VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -130,37 +130,48 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = $(datadir)/doc/$(PACKAGE)
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 SUBDIRS = src
 EXTRA_DIST = FAQ.txt GIT.txt Protocol.txt Platforms.txt README-AUX.txt \
-	README-BeOS.txt RFC.txt SSL.txt Zeroconf.txt sample-ngircd.conf
+	README-BeOS.txt RFC.txt Services.txt SSL.txt Zeroconf.txt \
+	sample-ngircd.conf
 
-docdir = $(datadir)/doc/$(PACKAGE)
 documents = $(EXTRA_DIST) ../AUTHORS ../COPYING ../ChangeLog ../INSTALL \
 	../NEWS ../README
 
@@ -196,7 +207,6 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-uninstall-info-am:
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -229,8 +239,7 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-mostlyclean-recursive clean-recursive distclean-recursive \
-maintainer-clean-recursive:
+$(RECURSIVE_CLEAN_TARGETS):
 	@failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
@@ -331,22 +340,21 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -360,7 +368,7 @@ distdir: $(DISTFILES)
 	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
-	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
 	    || exit 1; \
 	    distdir=`$(am__cd) $(distdir) && pwd`; \
 	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
@@ -368,6 +376,8 @@ distdir: $(DISTFILES)
 	      $(MAKE) $(AM_MAKEFLAGS) \
 	        top_distdir="$$top_distdir" \
 	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -423,12 +433,20 @@ install-data-am:
 	@$(NORMAL_INSTALL)
 	$(MAKE) $(AM_MAKEFLAGS) install-data-hook
 
+install-dvi: install-dvi-recursive
+
 install-exec-am:
 
+install-html: install-html-recursive
+
 install-info: install-info-recursive
 
 install-man:
 
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -448,24 +466,26 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am: uninstall-info-am
+uninstall-am:
 	@$(NORMAL_INSTALL)
 	$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
 
-uninstall-info: uninstall-info-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-data-am install-strip uninstall-am
 
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
-	clean clean-generic clean-recursive ctags ctags-recursive \
-	distclean distclean-generic distclean-recursive distclean-tags \
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic ctags \
+	ctags-recursive distclean distclean-generic distclean-tags \
 	distdir dvi dvi-am html html-am info info-am install \
 	install-am install-data install-data-am install-data-hook \
-	install-exec install-exec-am install-info install-info-am \
-	install-man install-strip installcheck installcheck-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
 	installdirs installdirs-am maintainer-clean \
-	maintainer-clean-generic maintainer-clean-local \
-	maintainer-clean-recursive mostlyclean mostlyclean-generic \
-	mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
-	uninstall uninstall-am uninstall-hook uninstall-info-am
+	maintainer-clean-generic maintainer-clean-local mostlyclean \
+	mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am uninstall-hook
 
 
 maintainer-clean-local:

+ 22 - 9
doc/Platforms.txt

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                        (c)2001-2006 Alexander Barton
+                        (c)2001-2009 Alexander Barton
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -29,20 +29,30 @@ Platform                    Compiler     ngIRCd     Date     Tester C M T R See
 alpha/unknown/netbsd3.0     gcc 3.3.3    CVSHEAD    06-05-07 fw     Y Y Y Y (3)
 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
-hppa2.0/unknown/linux-gnu   gcc 3.3.5    0.9.x-CVS  05-06-27 alex   Y Y Y Y
+hppa2.0/unknown/linux-gnu   gcc 3.3.5    13~rc1     08-12-02 alex   Y Y Y Y
+hppa2.0w-hp-hpux11.11       gcc 4.2.3    14.1       09-07-22 goetz  Y Y Y Y
+i386/apple/darwin9.7.0      gcc 4.0.1    14.1       09-08-04 alex   Y Y Y Y (3)
+i386/apple/darwin10.0.0b2   gcc 4.2.1    14.1       09-07-27 alex   Y Y Y Y (3)
 i386/pc/solaris2.9          gcc 3.2.2    CVSHEAD    04-02-24 alex   Y Y Y Y
-i386/pc/solaris2.11         gcc 3.4.3    CVSHEAD    06-08-04 alex   Y Y Y Y
+i386/pc/solaris2.11         gcc 3.4.3    14.1       09-08-03 alex   Y Y Y Y (4)
 i386/unknown/freebsd5.2.1   gcc 3.3.3    0.8.0      04-05-30 alex   Y Y Y Y
 i386/unknown/freebsd6.0     gcc 3.4.4    0.10.0-p1  06-08-04 alex   Y Y Y Y (3)
 i386/unknown/freebsd6.1     gcc 3.4.4    CVSHEAD    06-05-07 fw     Y Y Y Y (3)
+i386/unknown/freebsd6.2     gcc 3.4.6    14.1       09-07-27 alex   Y Y Y Y (3)
+i386/unknown/freebsd7.0     gcc 4.2.1    14.1       09-07-28 alex   Y Y Y Y (3)
+i386/unknown/freebsd7.2     gcc 4.2.1    14.1       09-08-03 alex   Y Y Y Y (3)
 i386/unknown/gnu0.3         gcc 3.3.3    0.8.0      04-05-30 alex   Y Y n Y
+i686/unknown/gnu0.3         gcc 4.3.1    14.1       09-07-28 alex   Y Y Y Y
 i386/unknown/netbsdelf1.6.1 gcc 2.95.3   CVSHEAD    04-02-24 alex   Y Y Y Y
 i386/unknown/netbsdelf3.0.1 gcc 3.3.3    0.10.0-p1  06-08-30 alex   Y Y Y Y (3)
+i386/unknown/netbsdelf4.0   gcc 4.1.2    14.1       09-07-28 alex   Y Y Y Y (3)
 i386/unknown/openbsd3.9     gcc 3.3.5    0.10.0-p1  06-08-30 alex   Y Y Y Y (3)
+i386/unknown/openbsd4.1     gcc 3.3.5    14.1       09-07-28 alex   Y Y Y Y (3)
 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)
-i386/pc/linux-gnu           gcc 4.1.2    0.10.0-p1  06-08-30 alex   Y Y Y Y (1)
+i686/pc/linux-gnu           gcc 3.3.5    14.1       09-08-04 alex   Y Y Y Y (1)
+i386/pc/linux-gnu           gcc 4.1.2    13~rc1     08-12-05 alex   Y Y Y Y (1)
+i686/pc/linux-gnu           gcc 4.3.2    14.1       09-08-04 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 ? ?
@@ -55,23 +65,25 @@ powerpc/unknown/openbsd3.6  gcc 2.95.3   0.10.0     06-10-08 alex   Y Y n 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
+x86_64/unknown/linux-gnu    gcc 4.3.2    14.1       09-08-04 alex   Y Y Y Y (1)
 
 
 Notes
 ~~~~~
 
-(1) i686/pc/linux-gnu:
+(1) i686/pc/linux-gnu & x86_64/unknown/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 (starting with 2.95.x and up to
-    version 4.1.x). The eldest glibc used was glibc-2.0.7. ngIRCd compiled
+    version 4.3.x). The eldest glibc used was glibc-2.0.7. ngIRCd compiled
     and run on all these systems without problems.
-    Actual Linux kernels (2.6.x) and glic's support the epoll() IO interface.
+    Actual Linux kernels (2.6.x) and glibc's support the epoll() IO interface.
 
 (2) This compiler is an pre-ANSI C compiler, therefore the source code is
     automatically converted using the included ansi2knr tool while building.
 
 (3) Using the kqueue() IO interface.
 
-$Id: Platforms.txt,v 1.18 2006/10/08 14:09:16 alex Exp $
+(4) Using the /dev/poll IO interface.
+
+(5) Using the epoll() IO interface.

+ 3 - 3
doc/Protocol.txt

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                        (c)2001-2007 Alexander Barton,
+                        (c)2001-2008 Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -85,6 +85,8 @@ The following <serverflags> are defined at the moment:
 - o: IRC operators are allowed to change channel- and channel-user-modes
      even if they aren't channel-operator of the affected channel.
 
+- S: The server supports the SERVICE command (on this link).
+
 - Z: Compressed server links are supported by the server.
 
 Example for a complete <flags> string: "ngircd|0.7.5:CZ".
@@ -159,6 +161,3 @@ and therefore can't be omitted. The parameter <limit> must be ignored when
 a channel has no user limit (the parameter <modes> doesn't list the "l"
 channel mode). In this case <limit> should be "0".
 
-
-$Id: Protocol.txt,v 1.14 2007/11/21 12:16:35 alex Exp $

+ 2 - 2
doc/README-AUX.txt

@@ -37,7 +37,7 @@ The following software packages are needed:
    ftp://arthur.barton.de/pub/unix/aux/libraries/libUTIL-2.1.tar.gz
 
    This library contains functions that are common on other UNIX
-   systems but not on A/UX e.g. memmove(), strerror() und strdup().
+   systems but not on A/UX e.g. memmove(), strerror() and strdup().
 
 
 After installation of these packages just do a "./configure" and "make" to
@@ -60,7 +60,7 @@ A few hints in case of errors:
    the 'config.status' script. Better rename /bin/sh to /bin/sh.AUX and
    replace it by a symbolic link to /bin/ksh (ln -s /bin/ksh /bin/sh as
    root).
-   These procedure should'nt cause you into problems and is recommended
+   These procedure shouldn't cause you into problems and is recommended
    even if you don't use ngIRCd.
 
 -- 

+ 1 - 1
doc/README-BeOS.txt

@@ -24,7 +24,7 @@ mit diesem Fehler ab:
    select(): Bad file descriptor!
 
 Es sieht leider so aus, als ob das select() von BeOS nicht mit File-Handles
-von Pipes verschiedener Prozesse umgehen kann: sobald der Resolver asyncron
+von Pipes verschiedener Prozesse umgehen kann: sobald der Resolver asynchron
 gestartet wird, also Pipe-Handles im select() vorhanden sind, fuehrt das zu
 obiger Meldung.
 

+ 65 - 12
doc/SSL.txt

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                      (c)2001-2004 by Alexander Barton,
+                        (c)2001-2008 Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -10,17 +10,73 @@
                                  -- 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.
+ngIRCd supports SSL/TLSv1 encrypted connections using the OpenSSL or GnuTLS
+libraries. Both encrypted server-server links as well as client-server links
+are supported.
+
+SSL is a compile-time option which is disabled by default. Use one of these
+options of the ./configure script to enable it:
+
+  --with-openssl     enable SSL support using OpenSSL
+  --with-gnutls      enable SSL support using GnuTLS
+
+You also need a key/certificate, see below for how to create a self-signed one.
+
+From a feature point of view, ngIRCds support for both libraries is
+comparable. The only major difference (at this time) is that ngircd with gnutls
+does not support password protected private keys.
+
+Configuration
+~~~~~~~~~~~~~
+
+To enable SSL connections a separate port must be configured: it is NOT
+possible to handle unencrypted and encrypted connections on the same port!
+This is a limitation of the IRC protocol ...
+
+You have to set (at least) the following configuration variables in the
+[GLOBAL] section of ngircd.conf(5): SSLPorts, SSLKeyFile, and SSLCertFile.
+
+Now IRC clients are able to connect using SSL on the configured port(s).
+(Using port 6697 for encrypted connections is common.)
+
+To enable encrypted server-server links, you have to additionally set
+SSLConnect to "yes" in the corresponding [SERVER] section.
+
+
+Creating a self-signed certificate
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+OpenSSL:
+
+Creating a self-signed certificate and key:
+ $ openssl req -newkey rsa:2048 -x509 -keyout server-key.pem \
+	-out server-cert.pem -days 1461
+Create DH parameters (optional):
+ $ openssl dhparam -2 -out dhparams.pem 2048
+
+GnuTLS:
+
+Creating a self-signed certificate and key:
+ $ certtool --generate-privkey --bits 2048 --outfile server-key.pem
+ $ certtool --generate-self-signed --load-privkey server-key.pem \
+	 --outfile server-cert.pem
+Create DH parameters (optional):
+ $ certtool  --generate-dh-params --bits 2048 --outfile dhparams.pem
+
+
+Alternate approach using stunnel(1)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Alternatively (or if you are using ngIRCd compiled without support
+for GnuTLS/OpenSSL), you can use external programs/tools like stunnel(1) to
+get SSL encrypted connections:
 
   <http://stunnel.mirt.net/>
   <http://www.stunnel.org/>
 
-Stefan Sperling (stefan at binarchy dot net) mailed me the following text as a
+Stefan Sperling (stefan at binarchy dot net) mailed the following text as a
 short "how-to", thanks Stefan!
 
-
 === snip ===
     ! This guide applies to stunnel 4.x !
 
@@ -48,11 +104,7 @@ short "how-to", thanks Stefan!
 
     That's it.
     Don't forget to activate ssl support in your irc client ;)
+    The main drawback of this approach compared to using builtin ssl
+    is that from ngIRCds point of view, all ssl-enabled client connections will
+    originate from the host running stunnel.
 === snip ===
-
-
-Probably ngIRCd will include support for SSL in the future ...
-
-
-$Id: SSL.txt,v 1.2 2004/12/27 01:11:40 alex Exp $

+ 70 - 0
doc/Services.txt

@@ -0,0 +1,70 @@
+
+                     ngIRCd - Next Generation IRC Server
+
+                        (c)2001-2008 Alexander Barton,
+                    alex@barton.de, http://www.barton.de/
+
+               ngIRCd is free software and published under the
+                   terms of the GNU General Public License.
+
+                              -- Services.txt --
+
+
+At the moment, ngIRCd doesn't implement a "special IRC services interface".
+But services acting as a "regular server" are supported, either using the IRC
+protocol defined in RFC 1459 or RFC 2812.
+
+Services have been tested using "IRC Services" version 5.x by Andrew Church,
+homepage: <http://www.ircservices.za.net/>. This document describes setting up
+ngIRCd and these services.
+
+
+Setting up ngIRCd
+~~~~~~~~~~~~~~~~~
+
+The "pseudo server" handling the IRC services is configured as a regular
+remote server in the ngircd.conf(5). In addition the variable "ServiceMask"
+should be set, enabling this ngIRCd to recognize the "pseudo users" as IRC
+services instead of regular IRC users.
+
+Example:
+
+  [SERVER]
+     Name = services.irc.net
+     MyPassword = 123abc
+     PeerPassword = 123abc
+     ServiceMask = *Serv
+
+
+Setting up IRC Services 5.1.x
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+IRC Services 5.1.3 and above can be used with ngIRCd using the "rfc1459"
+protocol module.
+
+Please note that versions up to and including 5.1.3 contain a bug that
+sometimes causes IRC Services to hang on startup. There are two workarounds:
+ a) send the services process a HUP signal ("killall -HUP ircservices")
+ b) apply this patch to the IRC Services source tree:
+    <ftp://ngircd.barton.de/ngircd/contrib/IRCServices513-FlushBuffer.patch>
+
+At least the following settings have to be tweaked, in addition to all the
+settings marked as required by IRC Services:
+
+In ircservices.conf:
+
+  Variable		Example value
+
+  RemoteServer		server.irc.net 6667 "123abc"
+  ServerName		"services.irc.net"
+  LoadModule		protocol/rfc1459
+
+In modules.conf:
+
+  Module		protocol/rfc1459
+
+The documentation of IRC Services can be found here:
+<http://www.ircservices.za.net/docs/>
+
+Please let us know if you are successfully using other IRC service packages or
+which problems you encounter, thanks!

+ 1 - 1
doc/Zeroconf.txt

@@ -20,7 +20,7 @@ To use this features you can use one of two APIs:
      of the newer Avahi[5] library.
 
 When calling the configure script using the "--with-zeroconf" switch the
-avalable API will be autodetected and the required additional libraries will
+available API will be autodetected and the required additional libraries will
 be linked to the ngircd binary as required.
 
 ngIRCd then registers a DNS-SD service for each port it is listening on using

+ 55 - 14
doc/sample-ngircd.conf

@@ -1,18 +1,19 @@
-# $Id: sample-ngircd.conf,v 1.44 2008/01/07 23:02:29 alex Exp $
-
 #
-# This is a sample configuration file for the ngIRCd, which must be adepted
-# to the local preferences and needs.
+# This is a sample configuration file for the ngIRCd IRC daemon, which must
+# be customized to the local preferences and needs.
 #
 # Comments are started with "#" or ";".
 #
 # A lot of configuration options in this file start with a ";". You have
 # to remove the ";" in front of each variable to actually set a value!
-# The disabled variables are shown with example values for completeness.
+# The disabled variables are shown with example values for completeness only
+# and the daemon is using compiled-in default settings.
 #
 # Use "ngircd --configtest" (see manual page ngircd(8)) to validate that the
 # server interprets the configuration file as expected!
 #
+# Please see ngircd.conf(5) for a complete list of configuration options.
+#
 
 [Global]
 	# The [Global] section of this file is used to define the main
@@ -40,7 +41,22 @@
 	# one port, separated with ",". (Default: 6667)
 	;Ports = 6667, 6668, 6669
 
-	# comma seperated list of IP addresses on which the server should
+	# Additional Listen Ports that expect SSL/TLS encrypted connections
+	;SSLPorts = 9999,6668
+
+	# SSL Server Key
+        ;SSLKeyFile = /usr/local/etc/ngircd/ssl/server-key.pem
+
+	# password to decrypt SSLKeyFile (OpenSSL only)
+	;SSLKeyFilePassword = secret
+
+	# SSL Server Key Certificate
+	;SSLCertFile = /usr/local/etc/ngircd/ssl/server-cert.pem
+
+	# Diffie-Hellman parameters
+	;SSLDHFile = /usr/local/etc/ngircd/ssl/dhparams.pem
+
+	# comma separated list of IP addresses on which the server should
 	# listen. Default values are:
 	# "0.0.0.0" or (if compiled with IPv6 support) "::,0.0.0.0"
 	# so the server listens on all IP addresses of the system by default.
@@ -99,18 +115,26 @@
 	# server? (This is a compatibility hack for ircd-irc2 servers)
 	;OperServerMode = no
 
+	# Are remote IRC operators allowed to control this server, e. g.
+	# use commands like CONNECT, SQUIT, DIE, ...?
+	;AllowRemoteOper = no
+
 	# Allow Pre-Defined Channels only (see Section [Channels])
 	;PredefChannelsOnly = no
 
 	# Don't do any DNS lookups when a client connects to the server.
 	;NoDNS = no
 
+	# Don't do any IDENT lookups, even if ngIRCd has been compiled
+	# with support for it.
+	;NoIdent = no
+
 	# try to connect to other irc servers using ipv4 and ipv6, if possible
 	;ConnectIPv6 = yes
 	;ConnectIPv4 = yes
 
-	# Maximum number of simultaneous connection the server is allowed
-	# to accept (0: unlimited):
+	# Maximum number of simultaneous in- and outbound connections the
+	# server is allowed to accept (0: unlimited):
 	;MaxConnections = 0
 
 	# Maximum number of simultaneous connections from a single IP address
@@ -158,13 +182,13 @@
 	# IRC name of the remote server, must match the "Name" variable in
 	# the [Global] section of the other server (when using ngIRCd).
 	;Name = irc2.the.net
-  
+
 	# Internet host name or IP address of the peer (only required when
 	# this server should establish the connection).
 	;Host = connect-to-host.the.net
 
-	# IP address to use as _source_ address for the connection. if unspecified,
-	# ngircd will let the operating system pick an address.
+	# IP address to use as _source_ address for the connection. if
+	# unspecified, ngircd will let the operating system pick an address.
 	;Bind = 10.0.0.1
 
 	# Port of the server to which the ngIRCd should connect. If you
@@ -184,11 +208,24 @@
 
 	# Set the "Passive" option to "yes" if you don't want this ngIRCd to
 	# connect to the configured peer (same as leaving the "Port" variable
-	# empty). The advantage of this option is that you can actually configure
-	# a port an use the IRC command CONNECT more easily to manually connect
-	# this specific server later.
+	# empty). The advantage of this option is that you can actually
+	# configure a port an use the IRC command CONNECT more easily to
+	# manually connect this specific server later.
 	;Passive = no
 
+	# Connect to the remote server using TLS/SSL (Default: false)
+	;SSLConnect = yes
+
+	# Define a (case insensitive) mask matching nick names that should be
+	# treated as IRC services when introduced via this remote server.
+	# REGULAR SERVERS DON'T NEED this parameter, so leave it empty
+	# (which is the default).
+	# When you are connecting IRC services which mask as a IRC server
+	# and which use "virtual users" to communicate with, for example
+	# "NickServ" and "ChanServ", you should set this parameter to
+	# something like "*Serv".
+	;ServiceMask = *Serv
+
 [Server]
 	# More [Server] sections, if you like ...
 
@@ -212,6 +249,10 @@
 	# initial channel password (mode k)
 	;Key = Secret
 
+	# Key file, syntax for each line: "<user>:<nick>:<key>".
+	# Default: none.
+	;KeyFile = /etc/ngircd/#chan.key
+
 	# maximum users per channel (mode l)
 	;MaxUsers = 23
 

+ 153 - 0
doc/src/Doxyfile

@@ -0,0 +1,153 @@
+#
+# ngIRCd -- The Next Generation IRC Daemon
+# 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
+# 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: Doxyfile,v 1.2 2005/07/23 00:48:38 alex Exp $
+#
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for ngIRCd.
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = ngIRCd
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = .
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = ../..
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like the Qt-style comments (thus requiring an 
+# explicit @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that
+# contain documented source files. You may enter file names like "myfile.cpp"
+# or directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = ../../src
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = YES
+
+#---------------------------------------------------------------------------
+# Output formats
+#---------------------------------------------------------------------------
+
+GENERATE_HTML          = YES
+
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = header.inc.html
+HTML_FOOTER            = footer.inc.html
+HTML_STYLESHEET        = ngircd-doc.css
+
+GENERATE_HTMLHELP      = NO
+GENERATE_LATEX         = NO
+GENERATE_RTF           = NO
+GENERATE_MAN           = NO
+GENERATE_XML           = NO
+GENERATE_AUTOGEN_DEF   = NO
+GENERATE_PERLMOD       = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = CONN_MODULE __client_c__
+
+# -eof-

+ 3 - 3
doc/src/Makefile.am

@@ -1,6 +1,6 @@
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2006 Alexander Barton (alex@barton.de)
+# Copyright (c)2001-2008 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,8 +8,8 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.3 2006/12/28 14:04:28 alex Exp $
-#
+
+EXTRA_DIST = Doxyfile header.inc.html footer.inc.html ngircd-doc.css
 
 maintainer-clean-local:
 	rm -f Makefile Makefile.in

+ 51 - 35
doc/src/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,7 +16,7 @@
 
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2006 Alexander Barton (alex@barton.de)
+# Copyright (c)2001-2008 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
@@ -24,17 +24,11 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.3 2006/12/28 14:04:28 alex Exp $
-#
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ../..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -62,8 +56,6 @@ SOURCES =
 DIST_SOURCES =
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -82,6 +74,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -92,6 +86,7 @@ LIBS = @LIBS@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -106,11 +101,11 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 U = @U@
 VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -122,32 +117,44 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = Doxyfile header.inc.html footer.inc.html ngircd-doc.css
 all: all-am
 
 .SUFFIXES:
@@ -180,7 +187,6 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-uninstall-info-am:
 tags: TAGS
 TAGS:
 
@@ -189,22 +195,21 @@ CTAGS:
 
 
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -263,12 +268,20 @@ info-am:
 
 install-data-am:
 
+install-dvi: install-dvi-am
+
 install-exec-am:
 
+install-html: install-html-am
+
 install-info: install-info-am
 
 install-man:
 
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -288,17 +301,20 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-info-am
+uninstall-am:
+
+.MAKE: install-am install-strip
 
 .PHONY: all all-am check check-am clean clean-generic distclean \
 	distclean-generic distclean-local distdir dvi dvi-am html \
 	html-am info info-am install install-am install-data \
-	install-data-am install-exec install-exec-am install-info \
-	install-info-am install-man install-strip installcheck \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
 	installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic maintainer-clean-local mostlyclean \
-	mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
-	uninstall-info-am
+	mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am
 
 
 maintainer-clean-local:

+ 11 - 0
doc/src/footer.inc.html

@@ -0,0 +1,11 @@
+
+<hr class="footer">
+<p>
+  ngIRCd
+  <a href="http://ngircd.barton.de/">Homepage</a>,
+  <a href="http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git">GIT-Repository</a>,
+  <a href="http://ngircd.barton.de/bugzilla/index.cgi">Bug-Tracker</a>.
+</p>
+
+</body>
+</html>

+ 10 - 0
doc/src/header.inc.html

@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+
+<head>
+  <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+  <title>ngIRCd Source Documentation</title>
+  <link href="ngircd-doc.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+

+ 77 - 0
doc/src/ngircd-doc.css

@@ -0,0 +1,77 @@
+/*
+ * Cascading Style Sheet for the ngIRCd source documentation
+ *
+ * $Id: ngircd-doc.css,v 1.2 2005/07/22 21:23:22 alex Exp $
+ */
+
+BODY {
+	background-color: white;
+	color: black;
+	margin: 30px;
+	font-family: Geneva, sans-serif;
+	font-size: 12px;
+}
+
+A:visited { color: purple; background: transparent; }
+A:link { color: navy; background: transparent; }
+A:active { color: red; background: transparent; }
+A:hover { background: #ffa; }
+
+H1, H2, H3 {
+	font-family: Verdana, sans-serif;
+	background-color: white;
+	color: #005555;
+}
+H1 { margin-bottom: 10px; }
+H2 {
+	margin-top: 20px;
+	margin-bottom: 10px;
+}
+
+P, LI, TD, TH, DT {
+	font-family: Geneva, sans-serif;
+	font-size: 12px;
+	line-height: 1.2
+}
+
+DD { margin-bottom: 1em; }
+
+UL { list-style-type: square; }
+
+HR { margin: 2em 0px; }
+
+BODY>TABLE { padding: 1em 0px; }
+
+TD.mdRow {
+	border: 1px dotted silver;
+	background-color: #fff9dd;
+}
+
+TD.md { font-weight: bold; }
+
+TD.memItemLeft { padding-top: 4px; }
+TD.memItemRight { padding-top: 4px; }
+TD.mdescRight { font-style: italic; }
+
+DIV.qindex {
+	background-color: #eee;
+	border: 1px dotted silver;
+	padding: 3px;
+	margin-bottom: 2px;
+}
+
+DIV.nav {
+	margin: 1em 0px;
+}
+
+HR.footer { margin-top: 50px; }
+
+.comment {
+	color: gray;
+	font-style: italic;
+}
+.preprocessor { color: #f90; }
+.keyword, .keywordflow, .keywordtype { color: red; }
+.stringliteral { color: green; }
+
+/* -eof- */

+ 266 - 82
install-sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2005-02-02.21
+scriptversion=2006-10-14.15
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -39,15 +39,24 @@ scriptversion=2005-02-02.21
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
+# from scratch.
+
+nl='
+'
+IFS=" ""	$nl"
 
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
 doit="${DOITPROG-}"
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
 
-# put in absolute paths if you don't have them in your path; or use env. vars.
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
 
 mvprog="${MVPROG-mv}"
 cpprog="${CPPROG-cp}"
@@ -58,7 +67,13 @@ stripprog="${STRIPPROG-strip}"
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
-chmodcmd="$chmodprog 0755"
+posix_glob=
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chmodcmd=$chmodprog
 chowncmd=
 chgrpcmd=
 stripcmd=
@@ -95,7 +110,7 @@ Environment variables override the default commands:
   CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
 "
 
-while test -n "$1"; do
+while test $# -ne 0; do
   case $1 in
     -c) shift
         continue;;
@@ -111,9 +126,15 @@ while test -n "$1"; do
 
     --help) echo "$usage"; exit $?;;
 
-    -m) chmodcmd="$chmodprog $2"
+    -m) mode=$2
         shift
         shift
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
         continue;;
 
     -o) chowncmd="$chownprog $2"
@@ -136,25 +157,33 @@ while test -n "$1"; do
 
     --version) echo "$0 $scriptversion"; exit $?;;
 
-    *)  # When -d is used, all remaining arguments are directories to create.
-	# When -t is used, the destination is already specified.
-	test -n "$dir_arg$dstarg" && break
-        # Otherwise, the last argument is the destination.  Remove it from $@.
-	for arg
-	do
-          if test -n "$dstarg"; then
-	    # $@ is not empty: it contains at least $arg.
-	    set fnord "$@" "$dstarg"
-	    shift # fnord
-	  fi
-	  shift # arg
-	  dstarg=$arg
-	done
+    --)	shift
 	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
+
+    *)  break;;
   esac
 done
 
-if test -z "$1"; then
+if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dstarg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dstarg"
+      shift # fnord
+    fi
+    shift # arg
+    dstarg=$arg
+  done
+fi
+
+if test $# -eq 0; then
   if test -z "$dir_arg"; then
     echo "$0: no input file specified." >&2
     exit 1
@@ -164,6 +193,33 @@ if test -z "$1"; then
   exit 0
 fi
 
+if test -z "$dir_arg"; then
+  trap '(exit $?); exit' 1 2 13 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
 for src
 do
   # Protect names starting with `-'.
@@ -173,15 +229,11 @@ do
 
   if test -n "$dir_arg"; then
     dst=$src
-    src=
-
-    if test -d "$dst"; then
-      mkdircmd=:
-      chmodcmd=
-    else
-      mkdircmd=$mkdirprog
-    fi
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
   else
+
     # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
     # might cause directories to be created, which would be especially bad
     # if $src (and thus $dsttmp) contains '*'.
@@ -208,53 +260,188 @@ do
 	echo "$0: $dstarg: Is a directory" >&2
 	exit 1
       fi
-      dst=$dst/`basename "$src"`
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+	(dirname "$dst") 2>/dev/null ||
+	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	     X"$dst" : 'X\(//\)[^/]' \| \
+	     X"$dst" : 'X\(//\)$' \| \
+	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+	echo X"$dst" |
+	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)[^/].*/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\).*/{
+		   s//\1/
+		   q
+		 }
+		 s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
     fi
   fi
 
-  # This sed command emulates the dirname command.
-  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
-
-  # Make sure that the destination directory exists.
-
-  # Skip lots of stat calls in the usual case.
-  if test ! -d "$dstdir"; then
-    defaultIFS='
-	 '
-    IFS="${IFS-$defaultIFS}"
-
-    oIFS=$IFS
-    # Some sh's can't handle IFS=/ for some reason.
-    IFS='%'
-    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-    shift
-    IFS=$oIFS
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+	# Create intermediate dirs using mode 755 as modified by the umask.
+	# This is like FreeBSD 'install' as of 1997-10-28.
+	umask=`umask`
+	case $stripcmd.$umask in
+	  # Optimize common cases.
+	  *[2367][2367]) mkdir_umask=$umask;;
+	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+	  *[0-7])
+	    mkdir_umask=`expr $umask + 22 \
+	      - $umask % 100 % 40 + $umask % 20 \
+	      - $umask % 10 % 4 + $umask % 2
+	    `;;
+	  *) mkdir_umask=$umask,go-w;;
+	esac
+
+	# With -d, create the new directory with the user-specified mode.
+	# Otherwise, rely on $mkdir_umask.
+	if test -n "$dir_arg"; then
+	  mkdir_mode=-m$mode
+	else
+	  mkdir_mode=
+	fi
+
+	posix_mkdir=false
+	case $umask in
+	  *[123567][0-7][0-7])
+	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
+	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+	    ;;
+	  *)
+	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+	    if (umask $mkdir_umask &&
+		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+	    then
+	      if test -z "$dir_arg" || {
+		   # Check for POSIX incompatibilities with -m.
+		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+		   # other-writeable bit of parent directory when it shouldn't.
+		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+		   case $ls_ld_tmpdir in
+		     d????-?r-*) different_mode=700;;
+		     d????-?--*) different_mode=755;;
+		     *) false;;
+		   esac &&
+		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+		   }
+		 }
+	      then posix_mkdir=:
+	      fi
+	      rmdir "$tmpdir/d" "$tmpdir"
+	    else
+	      # Remove any dirs left behind by ancient mkdir implementations.
+	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+	    fi
+	    trap '' 0;;
+	esac;;
+    esac
 
-    pathcomp=
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
 
-    while test $# -ne 0 ; do
-      pathcomp=$pathcomp$1
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+	/*) prefix=/ ;;
+	-*) prefix=./ ;;
+	*)  prefix= ;;
+      esac
+
+      case $posix_glob in
+        '')
+	  if (set -f) 2>/dev/null; then
+	    posix_glob=true
+	  else
+	    posix_glob=false
+	  fi ;;
+      esac
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob && set -f
+      set fnord $dstdir
       shift
-      if test ! -d "$pathcomp"; then
-        $mkdirprog "$pathcomp"
-	# mkdir can fail with a `File exist' error in case several
-	# install-sh are creating the directory concurrently.  This
-	# is OK.
-	test -d "$pathcomp" || exit
+      $posix_glob && set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test -z "$d" && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	else
+	  if $posix_mkdir; then
+	    (umask=$mkdir_umask &&
+	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+	    # Don't fail if two instances are running concurrently.
+	    test -d "$prefix" || exit 1
+	  else
+	    case $prefix in
+	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+	      *) qprefix=$prefix;;
+	    esac
+	    prefixes="$prefixes '$qprefix'"
+	  fi
+	fi
+	prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+	# Don't fail if two instances are running concurrently.
+	(umask $mkdir_umask &&
+	 eval "\$doit_exec \$mkdirprog $prefixes") ||
+	  test -d "$dstdir" || exit 1
+	obsolete_mkdir_used=true
       fi
-      pathcomp=$pathcomp/
-    done
+    fi
   fi
 
   if test -n "$dir_arg"; then
-    $doit $mkdircmd "$dst" \
-      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
-
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
   else
-    dstfile=`basename "$dst"`
 
     # Make a couple of temp file names in the proper directory.
     dsttmp=$dstdir/_inst.$$_
@@ -262,10 +449,9 @@ do
 
     # Trap to clean up those temp files at exit.
     trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-    trap '(exit $?); exit' 1 2 13 15
 
     # Copy the file name to the temp name.
-    $doit $cpprog "$src" "$dsttmp" &&
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
 
     # and set any options; do chmod last to preserve setuid bits.
     #
@@ -276,10 +462,10 @@ do
     { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
       && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
       && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
 
     # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
       || {
 	   # The rename failed, perhaps because mv can't rename something else
 	   # to itself, or perhaps because mv is so ancient that it does not
@@ -291,11 +477,12 @@ do
 	   # reasons.  In this case, the final cleanup might fail but the new
 	   # file should still install successfully.
 	   {
-	     if test -f "$dstdir/$dstfile"; then
-	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
-	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+	     if test -f "$dst"; then
+	       $doit $rmcmd -f "$dst" 2>/dev/null \
+	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
+		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
 	       || {
-		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		 echo "$0: cannot unlink or rename $dst" >&2
 		 (exit 1); exit 1
 	       }
 	     else
@@ -304,16 +491,13 @@ do
 	   } &&
 
 	   # Now rename the file to the real destination.
-	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+	   $doit $mvcmd "$dsttmp" "$dst"
 	 }
-    }
-  fi || { (exit 1); exit 1; }
-done
+    } || exit 1
 
-# The final little trick to "correctly" pass the exit status to the exit trap.
-{
-  (exit 0); exit 0
-}
+    trap '' 0
+  fi
+done
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)

+ 53 - 35
man/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -27,15 +27,11 @@
 #
 # $Id: Makefile.am,v 1.6 2006/12/25 16:13:26 alex Exp $
 #
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -68,8 +64,6 @@ NROFF = nroff
 MANS = $(man_MANS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -88,6 +82,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -98,6 +94,7 @@ LIBS = @LIBS@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -112,11 +109,11 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 U = @U@
 VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -128,32 +125,43 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 TEMPLATE_MANS = ngircd.conf.5.tmpl ngircd.8.tmpl
 SUFFIXES = .tmpl .
 man_MANS = ngircd.conf.5 ngircd.8
@@ -192,10 +200,9 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-uninstall-info-am:
 install-man5: $(man5_MANS) $(man_MANS)
 	@$(NORMAL_INSTALL)
-	test -z "$(man5dir)" || $(mkdir_p) "$(DESTDIR)$(man5dir)"
+	test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
 	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	for i in $$l2; do \
@@ -240,7 +247,7 @@ uninstall-man5:
 	done
 install-man8: $(man8_MANS) $(man_MANS)
 	@$(NORMAL_INSTALL)
-	test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)"
+	test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
 	@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	for i in $$l2; do \
@@ -291,22 +298,21 @@ CTAGS:
 
 
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -322,7 +328,7 @@ check: check-am
 all-am: Makefile $(MANS)
 installdirs:
 	for dir in "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
-	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
 install-exec: install-exec-am
@@ -369,12 +375,20 @@ info-am:
 
 install-data-am: install-man
 
+install-dvi: install-dvi-am
+
 install-exec-am:
 
+install-html: install-html-am
+
 install-info: install-info-am
 
 install-man: install-man5 install-man8
 
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -394,19 +408,23 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-info-am uninstall-man
+uninstall-am: uninstall-man
 
 uninstall-man: uninstall-man5 uninstall-man8
 
+.MAKE: install-am install-strip
+
 .PHONY: all all-am check check-am clean clean-generic distclean \
 	distclean-generic distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-exec \
-	install-exec-am install-info install-info-am install-man \
-	install-man5 install-man8 install-strip installcheck \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-man5 install-man8 install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
 	installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic maintainer-clean-local mostlyclean \
 	mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
-	uninstall-info-am uninstall-man uninstall-man5 uninstall-man8
+	uninstall-man uninstall-man5 uninstall-man8
 
 
 .tmpl:

+ 5 - 4
man/ngircd.8.tmpl

@@ -1,7 +1,7 @@
 .\"
-.\" $Id: ngircd.8.tmpl,v 1.2 2007/11/15 01:03:29 fw Exp $
+.\" ngircd(8) manual page template
 .\"
-.TH ngircd 8 "May 2008" ngircd "ngIRCd Manual"
+.TH ngircd 8 "Dec 2008" ngircd "ngIRCd Manual"
 .SH NAME
 ngIRCd \- the next generation IRC daemon
 .SH SYNOPSIS
@@ -64,15 +64,16 @@ The system wide default configuration file.
 .RS
 Default "message of the day" (MOTD).
 .RE
+.SH HINTS
+It's wise to use "ngircd \-\-configtest" to validate the configuration file
+after changing it.
 .SH AUTHOR
 Alexander Barton,
 .UR mailto:alex@barton.de
-alex@barton.de
 .UE
 .br
 Homepage:
 .UR http://ngircd.barton.de/
-http://ngircd.barton.de/
 .UE
 .SH "SEE ALSO"
 .BR ngircd.conf (5),

+ 126 - 32
man/ngircd.conf.5.tmpl

@@ -1,7 +1,7 @@
 .\"
-.\" $Id: ngircd.conf.5.tmpl,v 1.7 2007/11/23 16:26:03 fw Exp $
+.\" ngircd.conf(5) manual page template
 .\"
-.TH ngircd.conf 5 "May 2008" ngircd "ngIRCd Manual"
+.TH ngircd.conf 5 "Dec 2008" ngircd "ngIRCd Manual"
 .SH NAME
 ngircd.conf \- configuration file of ngIRCd
 .SH SYNOPSIS
@@ -12,6 +12,9 @@ is the configuration file of the
 .BR ngircd (8)
 Internet Relay Chat (IRC) daemon which you should adept to your local
 preferences and needs.
+.PP
+Most variables can be modified while the ngIRCd daemon is already running:
+It will reload its configuration when a HUP signal is received.
 .SH "FILE FORMAT"
 The file consists of sections and parameters. A section begins with the name
 of the section in square brackets and continues until the next section
@@ -58,7 +61,9 @@ section is used to define the server main configuration, like the server
 name and the ports on which the server should be listening.
 .TP
 \fBName\fR
-Server name in the IRC network, must contain at least one dot (".").
+Server name in the IRC network. This is an individual name of the IRC
+server, it is not related to the DNS host name. It must be unique in the
+IRC network and must contain at least one dot (".") character.
 .TP
 \fBInfo\fR
 Info text of the server. This will be shown by WHOIS and LINKS requests for
@@ -70,12 +75,36 @@ command.
 .TP
 \fBPorts\fR
 Ports on which the server should listen. There may be more than one port,
-separated with ','. Default: 6667.
+separated with commas (","). Default: 6667, unless \fBSSL_Ports\fR are also
+specified.
+.TP
+\fBSSLPorts\fR
+Same as \fBPorts\fR , except that ngIRCd will expect incoming connections
+to be SSL/TLS encrypted. Common port numbers for SSL-encrypted IRC are 6669
+and 6697. Default: none.
+.TP
+\fBSSLKeyFile\fR
+Filename of SSL Server Key to be used for SSL connections. This is required for
+SSL/TLS support.
+.TP
+\fBSSLKeyFilePassword\fR
+(OpenSSL only:) Password to decrypt private key.
+.TP
+\fBSSLCertFile\fR
+Certificate file of the private key.
+.TP
+\fBSSLDHFile\fR
+Name of the Diffie-Hellman Parameter file. Can be created with gnutls
+"certtool \-\-generate-dh-params" or "openssl dhparam".
+If this file is not present, it will be generated on startup when ngIRCd
+was compiled with gnutls support (this may take some time). If ngIRCd
+was compiled with OpenSSL, then (Ephemeral)-Diffie-Hellman Key Exchanges and several
+Cipher Suites will not be available.
 .TP
 \fBListen\fR
-A comma seperated list of IP address on which the server should listen.
-If unset, the defaults value is "0.0.0.0", or, if ngircd was compiled
-with IPv6 support, "::,0.0.0.0", so the server listens on all configured
+A comma separated list of IP address on which the server should listen.
+If unset, the defaults value is "0.0.0.0" or, if ngIRCd was compiled
+with IPv6 support, "::,0.0.0.0". So the server listens on all configured
 IP addresses and interfaces by default.
 .TP
 \fBMotdFile\fR
@@ -84,8 +113,8 @@ 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 which can be handy if the
-daemon should run inside a chroot directory.
+If this variable is set, no \fBMotdFile\fR will be read at all which can be
+handy if the daemon should run inside a chroot directory.
 .TP
 \fBServerUID\fR
 User ID under which the server should run; you can use the name of the user
@@ -146,34 +175,44 @@ Should IRC Operators be allowed to use the MODE command even if they are
 not(!) channel-operators? Default: no.
 .TP
 \fBOperServerMode\fR
-If OperCanUseMode is enabled, this may lead the compatibility problems with
+If \fBOperCanUseMode\fR is enabled, this may lead the compatibility problems with
 Servers that run the ircd-irc2 Software. This Option "masks" mode requests
 by non-chanops as if they were coming from the server. Default: no.
 .TP
+\fBAllowRemoteOper\fR
+Are IRC operators connected to remote servers allowed to control this server,
+e. g. are they allowed to use administrative commands like CONNECT, DIE,
+SQUIT, ... that affect this server? Default: no.
+.TP
 \fBPredefChannelsOnly\fR
 If enabled, no new channels can be created. Useful if
 you do not want to have channels other than those defined in
-the config file.
-Default: No.
+[Channel] sections in the configuration file.
+Default: no.
 .TP
 \fBNoDNS\fR
-If enabled, ngircd will not make DNS lookups when clients connect.
-If you configure ngircd to connect to other servers, ngircd may still
+If set to true, ngIRCd will not make DNS lookups when clients connect.
+If you configure the daemon to connect to other servers, ngIRCd may still
 perform a DNS lookup if required.
-Default: No.
+Default: no.
+.TP
+\fBNoIdent\fR
+If ngIRCd is compiled with IDENT support this can be used to disable IDENT
+lookups at run time.
+Default: no.
 .TP
 \fBConnectIPv4\fR
-Set this to no if you do not want ngircd to connect to other irc servers using ipv4.
-This allows use of ngircd in ipv6-only setups.
-Default: Yes.
+Set this to no if you do not want ngIRCd to connect to other IRC servers using
+IPv4. This allows usage of ngIRCd in IPv6-only setups.
+Default: yes.
 .TP
 \fBConnectIPv6\fR
-Set this to no if you do not want ngircd to connect to other irc servers using ipv6.
-Default: Yes.
+Set this to no if you do not want ngIRCd to connect to other irc servers using IPv6.
+Default: yes.
 .TP
 \fBMaxConnections\fR
-Maximum number of simultaneous connection the server is allowed to accept
-(0: unlimited). Default: 0.
+Maximum number of simultaneous in- and outbound connections the server is
+allowed to accept (0: unlimited). Default: 0.
 .TP
 \fBMaxConnectionsIP\fR
 Maximum number of simultaneous connections from a single IP address that
@@ -228,21 +267,21 @@ IRC name of the remote server.
 Internet host name (or IP address) of the peer.
 .TP
 \fBBind\fR
-IP address to use as source IP for the outgoing connection. Default ist
+IP address to use as source IP for the outgoing connection. Default is
 to let the operating system decide.
 .TP
 \fBPort\fR
 Port of the remote server to which ngIRCd should connect (active).
 If no port is assigned to a configured server, the daemon only waits for
-incoming connections (passive).
+incoming connections (passive, default).
 .TP
 \fBMyPassword\fR
 Own password for this connection. This password has to be configured as
-"PeerPassword" on the other server. Must not have ':' as first character.
+\fBPeerPassword\fR on the other server. Must not have ':' as first character.
 .TP
 \fBPeerPassword\fR
 Foreign password for this connection. This password has to be configured as
-"MyPassword" on the other server.
+\fBMyPassword\fR on the other server.
 .TP
 \fBGroup\fR
 Group of this server (optional).
@@ -250,6 +289,19 @@ Group of this server (optional).
 \fBPassive\fR
 Disable automatic connection even if port value is specified. Default: false.
 You can use the IRC Operator command CONNECT later on to create the link.
+.TP
+\fBSSLConnect\fR
+Connect to the remote server using TLS/SSL. Default: false.
+.TP
+\fBServiceMask\fR
+Define a (case insensitive) mask matching nick names that should be treated as
+IRC services when introduced via this remote server. REGULAR SERVERS DON'T NEED
+this parameter, so leave it empty (which is the default).
+.PP
+.RS
+When you are connecting IRC services which mask as a IRC server and which use
+"virtual users" to communicate with, for example "NickServ" and "ChanServ",
+you should set this parameter to something like "*Serv".
 .SH [CHANNEL]
 Pre-defined channels can be configured in
 .I [Channel]
@@ -264,7 +316,7 @@ There may be more than one
 block.
 .TP
 \fBName\fR
-Name of the channel, including channel prefix ("#").
+Name of the channel, including channel prefix ("#" or "&").
 .TP
 \fBTopic\fR
 Topic for this channel.
@@ -273,24 +325,66 @@ Topic for this channel.
 Initial channel modes.
 .TP
 \fBKey\fR
-Sets initial channel key (only relevant if mode k is set).
+Sets initial channel key (only relevant if channel mode "k" is set).
+.TP
+\fBKeyFile\fR
+Path and file name of a "key file" containing individual channel keys for
+different users. The file consists of plain text lines with the following
+syntax (without spaces!):
+.PP
+.RS
+.RS
+.I user
+:
+.I nick
+:
+.I key
+.RE
+.PP
+.I user
+and
+.I nick
+can contain the wildcard character "*".
+.br
+.I key
+is an arbitrary password.
+.PP
+Valid examples are:
+.PP
+.RS
+*:*:KeY
+.br
+*:nick:123
+.br
+~user:*:xyz
+.RE
+.PP
+The key file is read on each JOIN command when this channel has a key
+(channel mode +k). Access is granted, if a) the channel key set using the
+MODE +k command or b) one of the lines in the key file match.
+.PP
+.B Please note:
+.br
+The file is not reopened on each access, so you can modify and overwrite it
+without problems, but moving or deleting the file will have not effect until
+the daemon re-reads its configuration!
+.RE
 .TP
 \fBMaxUsers\fR
-Set maximum user limit for this channel (only relevant if mode l is set).
+Set maximum user limit for this channel (only relevant if channel mode "l"
+is set).
 .SH HINTS
-It's wise to use "ngircd --configtest" to validate the configuration file
+It's wise to use "ngircd \-\-configtest" to validate the configuration file
 after changing it. See
 .BR ngircd (8)
 for details.
 .SH AUTHOR
 Alexander Barton,
 .UR mailto:alex@barton.de
-alex@barton.de
 .UE
 .br
 Homepage:
 .UR http://ngircd.barton.de/
-http://ngircd.barton.de/
 .UE
 .SH "SEE ALSO"
 .BR ngircd (8)

+ 39 - 29
missing

@@ -1,9 +1,9 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2005-02-08.22
+scriptversion=2006-05-10.23
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
 #   Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
@@ -19,8 +19,8 @@ scriptversion=2005-02-08.22
 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -33,6 +33,8 @@ if test $# -eq 0; then
 fi
 
 run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
 
 # In the cases where this matters, `missing' is being run in the
 # srcdir already.
@@ -44,7 +46,7 @@ fi
 
 msg="missing on your system"
 
-case "$1" in
+case $1 in
 --run)
   # Try to run requested program, and just exit if it succeeds.
   run=
@@ -77,6 +79,7 @@ Supported PROGRAM values:
   aclocal      touch file \`aclocal.m4'
   autoconf     touch file \`configure'
   autoheader   touch file \`config.h.in'
+  autom4te     touch the output file, or create a stub one
   automake     touch all \`Makefile.in' files
   bison        create \`y.tab.[ch]', if possible, from existing .[ch]
   flex         create \`lex.yy.c', if possible, from existing .c
@@ -106,7 +109,7 @@ esac
 # Now exit if we have it, but it failed.  Also exit now if we
 # don't have it and --version was passed (most likely to detect
 # the program).
-case "$1" in
+case $1 in
   lex|yacc)
     # Not GNU programs, they don't have --version.
     ;;
@@ -135,7 +138,7 @@ esac
 
 # If it does not exist, or fails to run (possibly an outdated version),
 # try to emulate it.
-case "$1" in
+case $1 in
   aclocal*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
@@ -164,7 +167,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     test -z "$files" && files="config.h"
     touch_files=
     for f in $files; do
-      case "$f" in
+      case $f in
       *:*) touch_files="$touch_files "`echo "$f" |
 				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
       *) touch_files="$touch_files $f.in";;
@@ -192,8 +195,8 @@ WARNING: \`$1' is needed, but is $msg.
          You can get \`$1' as part of \`Autoconf' from any GNU
          archive site."
 
-    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
-    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
     if test -f "$file"; then
 	touch $file
     else
@@ -214,25 +217,25 @@ WARNING: \`$1' $msg.  You should only need it if
          in order for those modifications to take effect.  You can get
          \`Bison' from any GNU archive site."
     rm -f y.tab.c y.tab.h
-    if [ $# -ne 1 ]; then
+    if test $# -ne 1; then
         eval LASTARG="\${$#}"
-	case "$LASTARG" in
+	case $LASTARG in
 	*.y)
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if [ -f "$SRCFILE" ]; then
+	    if test -f "$SRCFILE"; then
 	         cp "$SRCFILE" y.tab.c
 	    fi
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if [ -f "$SRCFILE" ]; then
+	    if test -f "$SRCFILE"; then
 	         cp "$SRCFILE" y.tab.h
 	    fi
 	  ;;
 	esac
     fi
-    if [ ! -f y.tab.h ]; then
+    if test ! -f y.tab.h; then
 	echo >y.tab.h
     fi
-    if [ ! -f y.tab.c ]; then
+    if test ! -f y.tab.c; then
 	echo 'main() { return 0; }' >y.tab.c
     fi
     ;;
@@ -244,18 +247,18 @@ WARNING: \`$1' is $msg.  You should only need it if
          in order for those modifications to take effect.  You can get
          \`Flex' from any GNU archive site."
     rm -f lex.yy.c
-    if [ $# -ne 1 ]; then
+    if test $# -ne 1; then
         eval LASTARG="\${$#}"
-	case "$LASTARG" in
+	case $LASTARG in
 	*.l)
 	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if [ -f "$SRCFILE" ]; then
+	    if test -f "$SRCFILE"; then
 	         cp "$SRCFILE" lex.yy.c
 	    fi
 	  ;;
 	esac
     fi
-    if [ ! -f lex.yy.c ]; then
+    if test ! -f lex.yy.c; then
 	echo 'main() { return 0; }' >lex.yy.c
     fi
     ;;
@@ -267,11 +270,9 @@ WARNING: \`$1' is $msg.  You should only need it if
 	 \`Help2man' package in order for those modifications to take
 	 effect.  You can get \`Help2man' from any GNU archive site."
 
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
-    if test -z "$file"; then
-	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
-    fi
-    if [ -f "$file" ]; then
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
 	touch $file
     else
 	test -z "$file" || exec >$file
@@ -289,14 +290,23 @@ WARNING: \`$1' is $msg.  You should only need it if
          DU, IRIX).  You might want to install the \`Texinfo' package or
          the \`GNU make' package.  Grab either from any GNU archive site."
     # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
     if test -z "$file"; then
       # ... or it is the one specified with @setfilename ...
       infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      file=`sed -n '
+	/^@setfilename/{
+	  s/.* \([^ ]*\) *$/\1/
+	  p
+	  q
+	}' $infile`
       # ... or it is derived from the source name (dir/f.texi becomes f.info)
       test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
     fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
     touch $file
     ;;
 
@@ -314,13 +324,13 @@ WARNING: \`$1' is $msg.  You should only need it if
     fi
     firstarg="$1"
     if shift; then
-	case "$firstarg" in
+	case $firstarg in
 	*o*)
 	    firstarg=`echo "$firstarg" | sed s/o//`
 	    tar "$firstarg" "$@" && exit 0
 	    ;;
 	esac
-	case "$firstarg" in
+	case $firstarg in
 	*h*)
 	    firstarg=`echo "$firstarg" | sed s/h//`
 	    tar "$firstarg" "$@" && exit 0

BIN
src/._Makefile.am


+ 65 - 45
src/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -26,15 +26,11 @@
 #
 # $Id: Makefile.am,v 1.8 2008/02/26 22:04:15 fw Exp $
 #
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -63,17 +59,18 @@ SOURCES =
 DIST_SOURCES =
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
-	install-exec-recursive install-info-recursive \
-	install-recursive installcheck-recursive installdirs-recursive \
-	pdf-recursive ps-recursive uninstall-info-recursive \
-	uninstall-recursive
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -92,6 +89,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -102,6 +101,7 @@ LIBS = @LIBS@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -116,11 +116,11 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 U = @U@
 VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -132,32 +132,43 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 SUBDIRS = portab tool ipaddr ngircd testsuite
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -196,7 +207,7 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 config.h: stamp-h1
 	@if test ! -f $@; then \
 	  rm -f stamp-h1; \
-	  $(MAKE) stamp-h1; \
+	  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
 	else :; fi
 
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@@ -209,7 +220,6 @@ $(srcdir)/config.h.in:  $(am__configure_deps)
 
 distclean-hdr:
 	-rm -f config.h stamp-h1
-uninstall-info-am:
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -242,8 +252,7 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-mostlyclean-recursive clean-recursive distclean-recursive \
-maintainer-clean-recursive:
+$(RECURSIVE_CLEAN_TARGETS):
 	@failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
@@ -344,22 +353,21 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -373,7 +381,7 @@ distdir: $(DISTFILES)
 	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
-	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
 	    || exit 1; \
 	    distdir=`$(am__cd) $(distdir) && pwd`; \
 	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
@@ -381,6 +389,8 @@ distdir: $(DISTFILES)
 	      $(MAKE) $(AM_MAKEFLAGS) \
 	        top_distdir="$$top_distdir" \
 	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -434,12 +444,20 @@ info-am:
 
 install-data-am:
 
+install-dvi: install-dvi-recursive
+
 install-exec-am:
 
+install-html: install-html-recursive
+
 install-info: install-info-recursive
 
 install-man:
 
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -459,21 +477,23 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am: uninstall-info-am
+uninstall-am:
 
-uninstall-info: uninstall-info-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
 
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
-	clean clean-generic clean-recursive ctags ctags-recursive \
-	distclean distclean-generic distclean-hdr distclean-recursive \
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic ctags \
+	ctags-recursive distclean distclean-generic distclean-hdr \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-exec \
-	install-exec-am install-info install-info-am install-man \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
 	install-strip installcheck installcheck-am installdirs \
 	installdirs-am maintainer-clean maintainer-clean-generic \
-	maintainer-clean-local maintainer-clean-recursive mostlyclean \
-	mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
-	tags tags-recursive uninstall uninstall-am uninstall-info-am
+	maintainer-clean-local mostlyclean mostlyclean-generic pdf \
+	pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
 
 
 maintainer-clean-local:

+ 23 - 23
src/config.h.in

@@ -52,6 +52,9 @@
 /* Define to 1 if you have the `getnameinfo' function. */
 #undef HAVE_GETNAMEINFO
 
+/* Define to 1 if you have the `gnutls_global_init' function. */
+#undef HAVE_GNUTLS_GLOBAL_INIT
+
 /* Define to 1 if you have the <ident.h> header file. */
 #undef HAVE_IDENT_H
 
@@ -76,6 +79,12 @@
 /* Define to 1 if you have the `be' library (-lbe). */
 #undef HAVE_LIBBE
 
+/* Define to 1 if you have the `crypto' library (-lcrypto). */
+#undef HAVE_LIBCRYPTO
+
+/* Define to 1 if you have the `gnutls' library (-lgnutls). */
+#undef HAVE_LIBGNUTLS
+
 /* Define to 1 if you have the `howl' library (-lhowl). */
 #undef HAVE_LIBHOWL
 
@@ -91,6 +100,9 @@
 /* Define to 1 if you have the `socket' library (-lsocket). */
 #undef HAVE_LIBSOCKET
 
+/* Define to 1 if you have the `ssl' library (-lssl). */
+#undef HAVE_LIBSSL
+
 /* Define to 1 if you have the `UTIL' library (-lUTIL). */
 #undef HAVE_LIBUTIL
 
@@ -100,20 +112,14 @@
 /* Define to 1 if you have the <mach/port.h> header file. */
 #undef HAVE_MACH_PORT_H
 
-/* Define to 1 if you have the `malloc' function. */
-#undef HAVE_MALLOC
-
 /* Define to 1 if you have the <malloc.h> header file. */
 #undef HAVE_MALLOC_H
 
-/* Define to 1 if you have the `memmove' function. */
-#undef HAVE_MEMMOVE
-
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
-/* Define to 1 if you have the `memset' function. */
-#undef HAVE_MEMSET
+/* Define to 1 if you have the `mtrace' function. */
+#undef HAVE_MTRACE
 
 /* Define to 1 if you have the <netdb.h> header file. */
 #undef HAVE_NETDB_H
@@ -124,9 +130,6 @@
 /* Define to 1 if you have the `poll' function. */
 #undef HAVE_POLL
 
-/* Define to 1 if you have the `realloc' function. */
-#undef HAVE_REALLOC
-
 /* Define to 1 if you have the <rendezvous/rendezvous.h> header file. */
 #undef HAVE_RENDEZVOUS_RENDEZVOUS_H
 
@@ -148,6 +151,9 @@
 /* Define to 1 if you have the `socket' function. */
 #undef HAVE_SOCKET
 
+/* Define to 1 if you have the `SSL_library_init' function. */
+#undef HAVE_SSL_LIBRARY_INIT
+
 /* Define to 1 if you have the <stdbool.h> header file. */
 #undef HAVE_STDBOOL_H
 
@@ -163,18 +169,9 @@
 /* Define to 1 if you have the `strcasecmp' function. */
 #undef HAVE_STRCASECMP
 
-/* Define to 1 if you have the `strchr' function. */
-#undef HAVE_STRCHR
-
-/* Define to 1 if you have the `strcspn' function. */
-#undef HAVE_STRCSPN
-
 /* Define to 1 if you have the `strdup' function. */
 #undef HAVE_STRDUP
 
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
 /* Define to 1 if you have the `strftime' function. */
 #undef HAVE_STRFTIME
 
@@ -190,8 +187,8 @@
 /* Define to 1 if you have the `strlcpy' function. */
 #undef HAVE_STRLCPY
 
-/* Define to 1 if you have the `strstr' function. */
-#undef HAVE_STRSTR
+/* Define to 1 if you have the `strtok_r' function. */
+#undef HAVE_STRTOK_R
 
 /* Define to 1 if you have the `sw_discovery_init' function. */
 #undef HAVE_SW_DISCOVERY_INIT
@@ -247,6 +244,9 @@
 /* Define to 1 if you have the <zlib.h> header file. */
 #undef HAVE_ZLIB_H
 
+/* Define if sockaddr_in.sin_len exists */
+#undef HAVE_sockaddr_in_len
+
 /* Define if socklen_t exists */
 #undef HAVE_socklen_t
 
@@ -334,7 +334,7 @@
 /* Define to `int' if <sys/types.h> does not define. */
 #undef pid_t
 
-/* Define to `unsigned' if <sys/types.h> does not define. */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
 #undef size_t
 
 /* Define as `fork' if `vfork' does not work. */

+ 55 - 39
src/ipaddr/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,17 +15,11 @@
 @SET_MAKE@
 
 
-SOURCES = $(libngipaddr_a_SOURCES)
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ../..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -58,7 +52,7 @@ libngipaddr_a_AR = $(AR) $(ARFLAGS)
 libngipaddr_a_LIBADD =
 am_libngipaddr_a_OBJECTS = ng_ipaddr$U.$(OBJEXT)
 libngipaddr_a_OBJECTS = $(am_libngipaddr_a_OBJECTS)
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
+DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -72,8 +66,6 @@ ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -92,6 +84,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -102,6 +96,7 @@ LIBS = @LIBS@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -116,11 +111,11 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 U = @U@
 VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -132,32 +127,43 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = ansi2knr
 INCLUDES = -I$(srcdir)/../portab
 noinst_LIBRARIES = libngipaddr.a
@@ -209,7 +215,7 @@ mostlyclean-compile:
 
 distclean-compile:
 	-rm -f *.tab.c
-ansi2knr: ansi2knr.$(OBJEXT)
+./ansi2knr: ansi2knr.$(OBJEXT)
 	$(LINK) ansi2knr.$(OBJEXT) $(LIBS)
 ansi2knr.$(OBJEXT): $(CONFIG_HEADER)
 
@@ -222,22 +228,21 @@ mostlyclean-kr:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ng_ipaddr$U.Po@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 ng_ipaddr_.c: ng_ipaddr.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ng_ipaddr.c; then echo $(srcdir)/ng_ipaddr.c; else echo ng_ipaddr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 ng_ipaddr_.$(OBJEXT) : $(ANSI2KNR)
-uninstall-info-am:
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -288,22 +293,21 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -365,12 +369,20 @@ info-am:
 
 install-data-am:
 
+install-dvi: install-dvi-am
+
 install-exec-am:
 
+install-html: install-html-am
+
 install-info: install-info-am
 
 install-man:
 
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -391,18 +403,22 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-info-am
+uninstall-am:
+
+.MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
 	clean-krextra clean-noinstLIBRARIES ctags distclean \
 	distclean-compile distclean-generic distclean-tags distdir dvi \
 	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-exec install-exec-am \
-	install-info install-info-am install-man install-strip \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
 	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic maintainer-clean-local mostlyclean \
 	mostlyclean-compile mostlyclean-generic mostlyclean-kr pdf \
-	pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
+	pdf-am ps ps-am tags uninstall uninstall-am
 
 
 maintainer-clean-local:

+ 9 - 2
src/ipaddr/ng_ipaddr.c

@@ -30,6 +30,9 @@ ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port)
 
 	memset(&hints, 0, sizeof(hints));
 	hints.ai_flags = AI_NUMERICHOST;
+#ifndef WANT_IPV6	/* do not convert ipv6 addresses */
+	hints.ai_family = AF_INET;
+#endif
 
 	/* some getaddrinfo implementations require that ai_socktype is set. */
 	hints.ai_socktype = SOCK_STREAM;
@@ -38,7 +41,6 @@ ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port)
 	snprintf(portstr, sizeof(portstr), "%u", (unsigned int) port);
 
 	ret = getaddrinfo(ip_str, portstr, &hints, &res0);
-	assert(ret == 0);
 	if (ret != 0)
 		return false;
 
@@ -51,6 +53,10 @@ ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port)
 	return ret == 0;
 #else /* HAVE_GETADDRINFO */
 	assert(ip_str);
+	memset(addr, 0, sizeof *addr);
+#ifdef HAVE_sockaddr_in_len
+	addr->sin4.sin_len = sizeof(addr->sin4);
+#endif
 	addr->sin4.sin_family = AF_INET;
 # ifdef HAVE_INET_ATON
 	if (inet_aton(ip_str, &addr->sin4.sin_addr) == 0)
@@ -151,7 +157,8 @@ ng_ipaddr_tostr_r(const ng_ipaddr_t *addr, char *str)
 	if (*str == ':') {
 		char tmp[NG_INET_ADDRSTRLEN] = "0";
 		ret = getnameinfo(sa, ng_ipaddr_salen(addr),
-				tmp+1, sizeof(tmp) -1, NULL, 0, NI_NUMERICHOST);
+				  tmp + 1, (socklen_t)sizeof(tmp) - 1,
+				  NULL, 0, NI_NUMERICHOST);
 		if (ret == 0)
 			strlcpy(str, tmp, NG_INET_ADDRSTRLEN);
 	}

+ 2 - 2
src/ipaddr/ng_ipaddr.h

@@ -58,10 +58,10 @@ ng_ipaddr_salen(const ng_ipaddr_t *a)
 #ifdef WANT_IPV6
 	assert(a->sa.sa_family == AF_INET || a->sa.sa_family == AF_INET6);
 	if (a->sa.sa_family == AF_INET6)
-		return sizeof(a->sin6);
+		return (socklen_t)sizeof(a->sin6);
 #endif
 	assert(a->sin4.sin_family == AF_INET);
-	return sizeof(a->sin4);
+	return (socklen_t)sizeof(a->sin4);
 }
 
 

BIN
src/ngircd/._client.h


BIN
src/ngircd/._conn-func.c


BIN
src/ngircd/._irc-channel.c


BIN
src/ngircd/._irc-op.c


BIN
src/ngircd/._irc-op.h


BIN
src/ngircd/._irc.c


BIN
src/ngircd/._irc.h


BIN
src/ngircd/._log.h


BIN
src/ngircd/._parse.h


+ 7 - 7
src/ngircd/Makefile.am

@@ -21,19 +21,19 @@ LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN \
 sbin_PROGRAMS = ngircd
 
 ngircd_SOURCES = ngircd.c array.c channel.c client.c conf.c conn.c conn-func.c \
-	conn-zip.c hash.c io.c irc.c irc-channel.c irc-info.c irc-login.c \
+	conn-ssl.c conn-zip.c hash.c io.c irc.c irc-channel.c irc-info.c irc-login.c \
 	irc-mode.c irc-op.c irc-oper.c irc-server.c irc-write.c lists.c log.c \
-	match.c numeric.c parse.c rendezvous.c resolve.c
+	match.c op.c numeric.c parse.c rendezvous.c resolve.c
 
 ngircd_LDFLAGS = -L../portab -L../tool -L../ipaddr
 
 ngircd_LDADD = -lngportab -lngtool -lngipaddr
 
-noinst_HEADERS = ngircd.h array.h channel.h client.h conf.h conn.h conn-func.h \
-	conn-zip.h hash.h io.h irc.h irc-channel.h irc-info.h irc-login.h \
-	irc-mode.h irc-op.h irc-oper.h irc-server.h irc-write.h lists.h log.h \
-	match.h numeric.h parse.h rendezvous.h resolve.h \
-	defines.h messages.h
+noinst_HEADERS = ngircd.h array.h channel.h client.h conf.h conf-ssl.h conn.h \
+	conn-func.h conn-ssl.h conn-zip.h hash.h io.h irc.h irc-channel.h \
+	irc-info.h irc-login.h irc-mode.h irc-op.h irc-oper.h irc-server.h \
+	irc-write.h lists.h log.h match.h numeric.h op.h parse.h rendezvous.h \
+	resolve.h defines.h messages.h
 
 clean-local:
 	rm -f check-version check-help lint.out

+ 90 - 66
src/ngircd/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -28,17 +28,11 @@
 #
 
 
-SOURCES = $(ngircd_SOURCES)
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ../..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -70,17 +64,19 @@ sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(sbin_PROGRAMS)
 am_ngircd_OBJECTS = ngircd$U.$(OBJEXT) array$U.$(OBJEXT) \
 	channel$U.$(OBJEXT) client$U.$(OBJEXT) conf$U.$(OBJEXT) \
-	conn$U.$(OBJEXT) conn-func$U.$(OBJEXT) conn-zip$U.$(OBJEXT) \
-	hash$U.$(OBJEXT) io$U.$(OBJEXT) irc$U.$(OBJEXT) \
-	irc-channel$U.$(OBJEXT) irc-info$U.$(OBJEXT) \
+	conn$U.$(OBJEXT) conn-func$U.$(OBJEXT) conn-ssl$U.$(OBJEXT) \
+	conn-zip$U.$(OBJEXT) hash$U.$(OBJEXT) io$U.$(OBJEXT) \
+	irc$U.$(OBJEXT) irc-channel$U.$(OBJEXT) irc-info$U.$(OBJEXT) \
 	irc-login$U.$(OBJEXT) irc-mode$U.$(OBJEXT) irc-op$U.$(OBJEXT) \
 	irc-oper$U.$(OBJEXT) irc-server$U.$(OBJEXT) \
 	irc-write$U.$(OBJEXT) lists$U.$(OBJEXT) log$U.$(OBJEXT) \
-	match$U.$(OBJEXT) numeric$U.$(OBJEXT) parse$U.$(OBJEXT) \
-	rendezvous$U.$(OBJEXT) resolve$U.$(OBJEXT)
+	match$U.$(OBJEXT) op$U.$(OBJEXT) numeric$U.$(OBJEXT) \
+	parse$U.$(OBJEXT) rendezvous$U.$(OBJEXT) resolve$U.$(OBJEXT)
 ngircd_OBJECTS = $(am_ngircd_OBJECTS)
 ngircd_DEPENDENCIES =
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
+ngircd_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ngircd_LDFLAGS) \
+	$(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -94,8 +90,6 @@ ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -114,6 +108,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -124,6 +120,7 @@ LIBS = @LIBS@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -138,11 +135,11 @@ SHELL = @SHELL@
 STRIP = @STRIP@
 U = @U@
 VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -154,49 +151,60 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = ../portab/ansi2knr
 INCLUDES = -I$(srcdir)/../portab -I$(srcdir)/../tool -I$(srcdir)/../ipaddr
 LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN \
  -varuse -retvalother -emptyret -unrecog
 
 ngircd_SOURCES = ngircd.c array.c channel.c client.c conf.c conn.c conn-func.c \
-	conn-zip.c hash.c io.c irc.c irc-channel.c irc-info.c irc-login.c \
+	conn-ssl.c conn-zip.c hash.c io.c irc.c irc-channel.c irc-info.c irc-login.c \
 	irc-mode.c irc-op.c irc-oper.c irc-server.c irc-write.c lists.c log.c \
-	match.c numeric.c parse.c rendezvous.c resolve.c
+	match.c op.c numeric.c parse.c rendezvous.c resolve.c
 
 ngircd_LDFLAGS = -L../portab -L../tool -L../ipaddr
 ngircd_LDADD = -lngportab -lngtool -lngipaddr
-noinst_HEADERS = ngircd.h array.h channel.h client.h conf.h conn.h conn-func.h \
-	conn-zip.h hash.h io.h irc.h irc-channel.h irc-info.h irc-login.h \
-	irc-mode.h irc-op.h irc-oper.h irc-server.h irc-write.h lists.h log.h \
-	match.h numeric.h parse.h rendezvous.h resolve.h \
-	defines.h messages.h
+noinst_HEADERS = ngircd.h array.h channel.h client.h conf.h conf-ssl.h conn.h \
+	conn-func.h conn-ssl.h conn-zip.h hash.h io.h irc.h irc-channel.h \
+	irc-info.h irc-login.h irc-mode.h irc-op.h irc-oper.h irc-server.h \
+	irc-write.h lists.h log.h match.h numeric.h op.h parse.h rendezvous.h \
+	resolve.h defines.h messages.h
 
 TESTS = check-version check-help
 all: all-am
@@ -234,7 +242,7 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 install-sbinPROGRAMS: $(sbin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)"
+	test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
 	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
 	  if test -f $$p \
@@ -257,7 +265,7 @@ clean-sbinPROGRAMS:
 	-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
 ngircd$(EXEEXT): $(ngircd_OBJECTS) $(ngircd_DEPENDENCIES) 
 	@rm -f ngircd$(EXEEXT)
-	$(LINK) $(ngircd_LDFLAGS) $(ngircd_OBJECTS) $(ngircd_LDADD) $(LIBS)
+	$(ngircd_LINK) $(ngircd_OBJECTS) $(ngircd_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -265,7 +273,7 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 ../portab/ansi2knr:
-	cd ../portab && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+	cd ../portab && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr
 
 mostlyclean-kr:
 	-test "$U" = "" || rm -f *_.c
@@ -276,6 +284,7 @@ mostlyclean-kr:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conn$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conn-func$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conn-ssl$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conn-zip$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io$U.Po@am__quote@
@@ -293,20 +302,21 @@ mostlyclean-kr:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/match$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ngircd$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/numeric$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/op$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rendezvous$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resolve$U.Po@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
@@ -322,6 +332,8 @@ conn_.c: conn.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/conn.c; then echo $(srcdir)/conn.c; else echo conn.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 conn-func_.c: conn-func.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/conn-func.c; then echo $(srcdir)/conn-func.c; else echo conn-func.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+conn-ssl_.c: conn-ssl.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/conn-ssl.c; then echo $(srcdir)/conn-ssl.c; else echo conn-ssl.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 conn-zip_.c: conn-zip.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/conn-zip.c; then echo $(srcdir)/conn-zip.c; else echo conn-zip.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 hash_.c: hash.c $(ANSI2KNR)
@@ -356,6 +368,8 @@ ngircd_.c: ngircd.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ngircd.c; then echo $(srcdir)/ngircd.c; else echo ngircd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 numeric_.c: numeric.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/numeric.c; then echo $(srcdir)/numeric.c; else echo numeric.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+op_.c: op.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/op.c; then echo $(srcdir)/op.c; else echo op.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 parse_.c: parse.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/parse.c; then echo $(srcdir)/parse.c; else echo parse.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 rendezvous_.c: rendezvous.c $(ANSI2KNR)
@@ -363,14 +377,14 @@ rendezvous_.c: rendezvous.c $(ANSI2KNR)
 resolve_.c: resolve.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/resolve.c; then echo $(srcdir)/resolve.c; else echo resolve.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 array_.$(OBJEXT) channel_.$(OBJEXT) client_.$(OBJEXT) conf_.$(OBJEXT) \
-conn_.$(OBJEXT) conn-func_.$(OBJEXT) conn-zip_.$(OBJEXT) \
-hash_.$(OBJEXT) io_.$(OBJEXT) irc_.$(OBJEXT) irc-channel_.$(OBJEXT) \
-irc-info_.$(OBJEXT) irc-login_.$(OBJEXT) irc-mode_.$(OBJEXT) \
-irc-op_.$(OBJEXT) irc-oper_.$(OBJEXT) irc-server_.$(OBJEXT) \
-irc-write_.$(OBJEXT) lists_.$(OBJEXT) log_.$(OBJEXT) match_.$(OBJEXT) \
-ngircd_.$(OBJEXT) numeric_.$(OBJEXT) parse_.$(OBJEXT) \
-rendezvous_.$(OBJEXT) resolve_.$(OBJEXT) : $(ANSI2KNR)
-uninstall-info-am:
+conn_.$(OBJEXT) conn-func_.$(OBJEXT) conn-ssl_.$(OBJEXT) \
+conn-zip_.$(OBJEXT) hash_.$(OBJEXT) io_.$(OBJEXT) irc_.$(OBJEXT) \
+irc-channel_.$(OBJEXT) irc-info_.$(OBJEXT) irc-login_.$(OBJEXT) \
+irc-mode_.$(OBJEXT) irc-op_.$(OBJEXT) irc-oper_.$(OBJEXT) \
+irc-server_.$(OBJEXT) irc-write_.$(OBJEXT) lists_.$(OBJEXT) \
+log_.$(OBJEXT) match_.$(OBJEXT) ngircd_.$(OBJEXT) numeric_.$(OBJEXT) \
+op_.$(OBJEXT) parse_.$(OBJEXT) rendezvous_.$(OBJEXT) \
+resolve_.$(OBJEXT) : $(ANSI2KNR)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -421,9 +435,9 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 check-TESTS: $(TESTS)
-	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
+	@failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[	 ]'; \
 	srcdir=$(srcdir); export srcdir; \
-	list='$(TESTS)'; \
+	list=' $(TESTS) '; \
 	if test -n "$$list"; then \
 	  for tst in $$list; do \
 	    if test -f ./$$tst; then dir=./; \
@@ -432,7 +446,7 @@ check-TESTS: $(TESTS)
 	    if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
 	      all=`expr $$all + 1`; \
 	      case " $(XFAIL_TESTS) " in \
-	      *" $$tst "*) \
+	      *$$ws$$tst$$ws*) \
 		xpass=`expr $$xpass + 1`; \
 		failed=`expr $$failed + 1`; \
 		echo "XPASS: $$tst"; \
@@ -444,7 +458,7 @@ check-TESTS: $(TESTS)
 	    elif test $$? -ne 77; then \
 	      all=`expr $$all + 1`; \
 	      case " $(XFAIL_TESTS) " in \
-	      *" $$tst "*) \
+	      *$$ws$$tst$$ws*) \
 		xfail=`expr $$xfail + 1`; \
 		echo "XFAIL: $$tst"; \
 	      ;; \
@@ -494,22 +508,21 @@ check-TESTS: $(TESTS)
 	else :; fi
 
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -526,7 +539,7 @@ check: check-am
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 installdirs:
 	for dir in "$(DESTDIR)$(sbindir)"; do \
-	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
 install-exec: install-exec-am
@@ -574,12 +587,20 @@ info-am:
 
 install-data-am:
 
+install-dvi: install-dvi-am
+
 install-exec-am: install-sbinPROGRAMS
 
+install-html: install-html-am
+
 install-info: install-info-am
 
 install-man:
 
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -600,20 +621,23 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS
+uninstall-am: uninstall-sbinPROGRAMS
+
+.MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
 	clean-generic clean-local clean-sbinPROGRAMS ctags distclean \
 	distclean-compile distclean-generic distclean-tags distdir dvi \
 	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-exec install-exec-am \
-	install-info install-info-am install-man install-sbinPROGRAMS \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \
 	install-strip installcheck installcheck-am installdirs \
 	maintainer-clean maintainer-clean-generic \
 	maintainer-clean-local mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-kr pdf pdf-am ps ps-am tags \
-	uninstall uninstall-am uninstall-info-am \
-	uninstall-sbinPROGRAMS
+	uninstall uninstall-am uninstall-sbinPROGRAMS
 
 
 clean-local:

+ 8 - 0
src/ngircd/array.c

@@ -281,6 +281,14 @@ array_free(array * a)
 	a->used = 0;
 }
 
+void
+array_free_wipe(array *a)
+{
+	size_t bytes = a->allocated;
+	if (bytes)
+		memset(a->mem, 0, bytes);
+	array_free(a);
+}
 
 void *
 array_start(const array * const a)

+ 306 - 153
src/ngircd/channel.c

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2005 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2009 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
@@ -17,13 +17,12 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: channel.c,v 1.65 2008/02/05 16:31:35 fw Exp $";
-
 #include "imp.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <stdio.h>
 #include <strings.h>
 
 #include "defines.h"
@@ -41,6 +40,7 @@ static char UNUSED id[] = "$Id: channel.c,v 1.65 2008/02/05 16:31:35 fw Exp $";
 #include "lists.h"
 #include "log.h"
 #include "messages.h"
+#include "match.h"
 
 #include "exp.h"
 
@@ -59,14 +59,24 @@ static CL2CHAN *Add_Client PARAMS(( CHANNEL *Chan, CLIENT *Client ));
 static bool Remove_Client PARAMS(( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const char *Reason, bool InformServer ));
 static CL2CHAN *Get_First_Cl2Chan PARAMS(( CLIENT *Client, CHANNEL *Chan ));
 static CL2CHAN *Get_Next_Cl2Chan PARAMS(( CL2CHAN *Start, CLIENT *Client, CHANNEL *Chan ));
-static bool Delete_Channel PARAMS(( CHANNEL *Chan ));
+static void Delete_Channel PARAMS(( CHANNEL *Chan ));
+static void Free_Channel PARAMS(( CHANNEL *Chan ));
+static void Set_KeyFile PARAMS((CHANNEL *Chan, const char *KeyFile));
 
 
 GLOBAL void
 Channel_Init( void )
 {
+	CHANNEL *sc;
+
 	My_Channels = NULL;
 	My_Cl2Chan = NULL;
+
+	sc = Channel_Create("&SERVER");
+	if (sc) {
+		Channel_SetModes(sc, "mnPt");
+		Channel_SetTopic(sc, Client_ThisServer(), "Server Messages");
+	}
 } /* Channel_Init */
 
 
@@ -89,121 +99,143 @@ Channel_GetListInvites(CHANNEL *c)
 GLOBAL void
 Channel_InitPredefined( void )
 {
-	/* Vordefinierte persistente Channels erzeugen */
+	/* Generate predefined persistent channels */
 
-	CHANNEL *chan;
-	char *c;
-	unsigned int i;
-	
-	for( i = 0; i < Conf_Channel_Count; i++ )
-	{
-		/* Ist ein Name konfiguriert? */
-		if( ! Conf_Channel[i].name[0] ) continue;
+	CHANNEL *new_chan;
+	const struct Conf_Channel *conf_chan;
+	const char *c;
+	size_t i, channel_count = array_length(&Conf_Channels, sizeof(*conf_chan));
 
-		/* Gueltiger Channel-Name? */
-		if( ! Channel_IsValidName( Conf_Channel[i].name ))
-		{
-			Log( LOG_ERR, "Can't create pre-defined channel: invalid name: \"%s\"!", Conf_Channel[i].name );
-			array_free(&Conf_Channel[i].topic);
+	conf_chan = array_start(&Conf_Channels);
+
+	assert(channel_count == 0 || conf_chan != NULL);
+
+	for (i = 0; i < channel_count; i++, conf_chan++) {
+		if (!conf_chan->name[0] || !Channel_IsValidName(conf_chan->name)) {
+			Log(LOG_ERR, "Can't create pre-defined channel: invalid name: \"%s\"",
+									conf_chan->name);
 			continue;
 		}
 
-		/* Gibt es den Channel bereits? */
-		chan = Channel_Search( Conf_Channel[i].name );
-		if( chan )
-		{
-			Log( LOG_INFO, "Can't create pre-defined channel \"%s\": name already in use.", Conf_Channel[i].name );
-			array_free(&Conf_Channel[i].topic);
+		new_chan = Channel_Search(conf_chan->name);
+		if (new_chan) {
+			Log(LOG_INFO,
+			    "Can't create pre-defined channel \"%s\": name already in use.",
+			    conf_chan->name);
+			Set_KeyFile(new_chan, conf_chan->keyfile);
 			continue;
 		}
 
-		/* Create channel */
-		chan = Channel_Create(Conf_Channel[i].name);
-		if (chan) {
-			Channel_ModeAdd(chan, 'P');
+		new_chan = Channel_Create(conf_chan->name);
+		if (!new_chan) {
+			Log(LOG_ERR, "Can't create pre-defined channel \"%s\"",
+							conf_chan->name);
+			continue;
+		}
+		Log(LOG_INFO, "Created pre-defined channel \"%s\"",
+						conf_chan->name);
 
-			if (array_start(&Conf_Channel[i].topic) != NULL)
-				Channel_SetTopic(chan, NULL,
-					 array_start(&Conf_Channel[i].topic));
-			array_free(&Conf_Channel[i].topic);
+		Channel_ModeAdd(new_chan, 'P');
 
-			c = Conf_Channel[i].modes;
-			while (*c)
-				Channel_ModeAdd(chan, *c++);
+		if (conf_chan->topic[0])
+			Channel_SetTopic(new_chan, NULL, conf_chan->topic);
 
-			Channel_SetKey(chan, Conf_Channel[i].key);
-			Channel_SetMaxUsers(chan, Conf_Channel[i].maxusers);
+		c = conf_chan->modes;
+		while (*c)
+			Channel_ModeAdd(new_chan, *c++);
 
-			Log(LOG_INFO, "Created pre-defined channel \"%s\".",
-							Conf_Channel[i].name );
-		}
-		else Log(LOG_ERR, "Can't create pre-defined channel \"%s\"!",
-							Conf_Channel[i].name );
+		Channel_SetKey(new_chan, conf_chan->key);
+		Channel_SetMaxUsers(new_chan, conf_chan->maxusers);
+		Set_KeyFile(new_chan, conf_chan->keyfile);
 	}
+	if (channel_count)
+		array_free(&Conf_Channels);
 } /* Channel_InitPredefined */
 
 
+static void
+Free_Channel(CHANNEL *chan)
+{
+	array_free(&chan->topic);
+	array_free(&chan->keyfile);
+	Lists_Free(&chan->list_bans);
+	Lists_Free(&chan->list_invites);
+
+	free(chan);
+}
+
+
 GLOBAL void
 Channel_Exit( void )
 {
 	CHANNEL *c, *c_next;
 	CL2CHAN *cl2chan, *cl2chan_next;
 
-	/* Channel-Strukturen freigeben */
+	/* free struct Channel */
 	c = My_Channels;
-	while( c )
-	{
+	while (c) {
 		c_next = c->next;
-		array_free(&c->topic);
-		free( c );
+		Free_Channel(c);
 		c = c_next;
 	}
 
-	/* Channel-Zuordnungstabelle freigeben */
+	/* Free Channel allocation table */
 	cl2chan = My_Cl2Chan;
-	while( c )
-	{
+	while (cl2chan) {
 		cl2chan_next = cl2chan->next;
-		free( cl2chan );
+		free(cl2chan);
 		cl2chan = cl2chan_next;
 	}
 } /* Channel_Exit */
 
 
+/**
+ * Join Channel
+ * This function lets a client join a channel.  First, the function
+ * checks that the specified channel name is valid and that the client
+ * isn't already a member.  If the specified channel doesn't exist,
+ * a new channel is created.  Client is added to channel by function
+ * Add_Client().
+ */
 GLOBAL bool
-Channel_Join( CLIENT *Client, char *Name )
+Channel_Join( CLIENT *Client, const char *Name )
 {
 	CHANNEL *chan;
-	
-	assert( Client != NULL );
-	assert( Name != NULL );
 
-	if( ! Channel_IsValidName( Name )) {
-		IRC_WriteStrClient( Client, ERR_NOSUCHCHANNEL_MSG, Client_ID( Client ), Name );
+	assert(Client != NULL);
+	assert(Name != NULL);
+
+	/* Check that the channel name is valid */
+	if (! Channel_IsValidName(Name)) {
+		IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
+				   Client_ID(Client), Name);
 		return false;
 	}
 
-	chan = Channel_Search( Name );
-	if( chan ) {
-		/* Ist der Client bereits Mitglied? */
-		if( Get_Cl2Chan( chan, Client )) return false;
-	}
-	else
-	{
-		/* Gibt es noch nicht? Dann neu anlegen: */
-		chan = Channel_Create( Name );
-		if (!chan) return false;
+	chan = Channel_Search(Name);
+	if(chan) {
+		/* Check if the client is already in the channel */
+		if (Get_Cl2Chan(chan, Client))
+			return false;
+	} else {
+		/* If the specified channel does not exist, the channel
+		 * is now created */
+		chan = Channel_Create(Name);
+		if (!chan)
+			return false;
 	}
 
-	/* User dem Channel hinzufuegen */
-	if( ! Add_Client( chan, Client )) return false;
-	else return true;
+	/* Add user to Channel */
+	if (! Add_Client(chan, Client))
+		return false;
+
+	return true;
 } /* Channel_Join */
 
 
 /**
- * Remove client from channel.
- * This function lets a client lead a channel. First, the function checks
+ * Part client from channel.
+ * This function lets a client part from a channel. First, the function checks
  * if the channel exists and the client is a member of it and sends out
  * appropriate error messages if not. The real work is done by the function
  * Remove_Client().
@@ -217,18 +249,22 @@ Channel_Part(CLIENT * Client, CLIENT * Origin, const char *Name, const char *Rea
 	assert(Name != NULL);
 	assert(Reason != NULL);
 
+	/* Check that specified channel exists */
 	chan = Channel_Search(Name);
 	if (!chan) {
 		IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
 				   Client_ID(Client), Name);
 		return false;
 	}
+
+	/* Check that the client is in the channel */
 	if (!Get_Cl2Chan(chan, Client)) {
 		IRC_WriteStrClient(Client, ERR_NOTONCHANNEL_MSG,
 				   Client_ID(Client), Name);
 		return false;
 	}
 
+	/* Part client from channel */
 	if (!Remove_Client(REMOVE_PART, chan, Client, Origin, Reason, true))
 		return false;
 	else
@@ -236,16 +272,22 @@ Channel_Part(CLIENT * Client, CLIENT * Origin, const char *Name, const char *Rea
 } /* Channel_Part */
 
 
+/**
+ * Kick user from Channel
+ */
 GLOBAL void
-Channel_Kick( CLIENT *Client, CLIENT *Origin, char *Name, char *Reason )
+Channel_Kick(CLIENT *Peer, CLIENT *Target, CLIENT *Origin, const char *Name,
+	     const char *Reason )
 {
 	CHANNEL *chan;
 
-	assert( Client != NULL );
-	assert( Origin != NULL );
-	assert( Name != NULL );
-	assert( Reason != NULL );
+	assert(Peer != NULL);
+	assert(Target != NULL);
+	assert(Origin != NULL);
+	assert(Name != NULL);
+	assert(Reason != NULL);
 
+	/* Check that channel exists */
 	chan = Channel_Search( Name );
 	if( ! chan )
 	{
@@ -253,32 +295,37 @@ Channel_Kick( CLIENT *Client, CLIENT *Origin, char *Name, char *Reason )
 		return;
 	}
 
-	if( ! Channel_IsMemberOf( chan, Origin ))
-	{
-		IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG, Client_ID( Origin ), Name );
-		return;
-	}
+	if (Client_Type(Peer) != CLIENT_SERVER &&
+	    Client_Type(Origin) != CLIENT_SERVICE) {
+		/* Check that user is on the specified channel */
+		if (!Channel_IsMemberOf(chan, Origin)) {
+			IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG,
+					   Client_ID(Origin), Name);
+			return;
+		}
 
-	/* Is User Channel-Operator? */
-	if( ! strchr( Channel_UserModes( chan, Origin ), 'o' ))
-	{
-		IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Name);
-		return;
+		/* Check if user has operator status */
+		if (!strchr(Channel_UserModes(chan, Origin), 'o')) {
+			IRC_WriteStrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG,
+					   Client_ID(Origin), Name);
+			return;
+		}
 	}
 
-	/* Ist the kickED User member of channel? */
-	if( ! Channel_IsMemberOf( chan, Client ))
-	{
-		IRC_WriteStrClient( Origin, ERR_USERNOTINCHANNEL_MSG, Client_ID( Origin ), Client_ID( Client ), Name );
+	/* Check that the client to be kicked is on the specified channel */
+	if (!Channel_IsMemberOf(chan, Target)) {
+		IRC_WriteStrClient(Origin, ERR_USERNOTINCHANNEL_MSG,
+				   Client_ID(Origin), Client_ID(Target), Name );
 		return;
 	}
 
-	Remove_Client( REMOVE_KICK, chan, Client, Origin, Reason, true);
+	/* Kick Client from channel */
+	Remove_Client( REMOVE_KICK, chan, Target, Origin, Reason, true);
 } /* Channel_Kick */
 
 
 GLOBAL void
-Channel_Quit( CLIENT *Client, char *Reason )
+Channel_Quit( CLIENT *Client, const char *Reason )
 {
 	CHANNEL *c, *next_c;
 
@@ -302,7 +349,7 @@ Channel_Count( void )
 {
 	CHANNEL *c;
 	unsigned long count = 0;
-	
+
 	c = My_Channels;
 	while( c )
 	{
@@ -338,9 +385,9 @@ Channel_CountForUser( CLIENT *Client )
 
 	CL2CHAN *cl2chan;
 	int count = 0;
-	
+
 	assert( Client != NULL );
-	
+
 	cl2chan = My_Cl2Chan;
 	while( cl2chan )
 	{
@@ -352,7 +399,6 @@ Channel_CountForUser( CLIENT *Client )
 } /* Channel_CountForUser */
 
 
-
 GLOBAL const char *
 Channel_Name( const CHANNEL *Chan )
 {
@@ -403,8 +449,8 @@ Channel_Next( CHANNEL *Chan )
 GLOBAL CHANNEL *
 Channel_Search( const char *Name )
 {
-	/* Channel-Struktur suchen */
-	
+	/* Search channel structure */
+
 	CHANNEL *c;
 	UINT32 search_hash;
 
@@ -416,7 +462,7 @@ Channel_Search( const char *Name )
 	{
 		if( search_hash == c->hash )
 		{
-			/* lt. Hash-Wert: Treffer! */
+			/* hash hit */
 			if( strcasecmp( Name, c->name ) == 0 ) return c;
 		}
 		c = c->next;
@@ -480,7 +526,14 @@ Channel_IsValidName( const char *Name )
 {
 	assert( Name != NULL );
 
-	if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return false;
+#ifdef STRICT_RFC
+	if (strlen(Name) <= 1)
+		return false;
+#endif
+	if (strchr("#&+", Name[0]) == NULL)
+		return false;
+	if (strlen(Name) >= CHANNEL_NAME_LEN)
+		return false;
 
 	return Name[strcspn(Name, " ,:\007")] == 0;
 } /* Channel_IsValidName */
@@ -628,7 +681,7 @@ Channel_Topic( CHANNEL *Chan )
 	return ret ? ret : "";
 } /* Channel_Topic */
 
-	
+
 #ifndef STRICT_RFC
 
 GLOBAL unsigned int
@@ -650,7 +703,7 @@ Channel_TopicWho(CHANNEL *Chan)
 
 
 GLOBAL void
-Channel_SetTopic(CHANNEL *Chan, CLIENT *Client, char *Topic)
+Channel_SetTopic(CHANNEL *Chan, CLIENT *Client, const char *Topic)
 {
 	size_t len;
 	assert( Chan != NULL );
@@ -678,7 +731,7 @@ Channel_SetTopic(CHANNEL *Chan, CLIENT *Client, char *Topic)
 
 
 GLOBAL void
-Channel_SetModes( CHANNEL *Chan, char *Modes )
+Channel_SetModes( CHANNEL *Chan, const char *Modes )
 {
 	assert( Chan != NULL );
 	assert( Modes != NULL );
@@ -688,7 +741,7 @@ Channel_SetModes( CHANNEL *Chan, char *Modes )
 
 
 GLOBAL void
-Channel_SetKey( CHANNEL *Chan, char *Key )
+Channel_SetKey( CHANNEL *Chan, const char *Key )
 {
 	assert( Chan != NULL );
 	assert( Key != NULL );
@@ -715,6 +768,10 @@ Can_Send_To_Channel(CHANNEL *Chan, CLIENT *From)
 
 	is_member = has_voice = is_op = false;
 
+	/* The server itself always can send messages :-) */
+	if (Client_ThisServer() == From)
+		return true;
+
 	if (Channel_IsMemberOf(Chan, From)) {
 		is_member = true;
 		if (strchr(Channel_UserModes(Chan, From), 'v'))
@@ -743,35 +800,26 @@ Can_Send_To_Channel(CHANNEL *Chan, CLIENT *From)
 
 
 GLOBAL bool
-Channel_Write(CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Text)
-{
-	if (!Can_Send_To_Channel(Chan, From))
-		return IRC_WriteStrClient(From, ERR_CANNOTSENDTOCHAN_MSG, Client_ID(From), Channel_Name(Chan));
-
-	if (Client_Conn(From) > NONE)
-		Conn_UpdateIdle(Client_Conn(From));
-
-	return IRC_WriteStrChannelPrefix(Client, Chan, From, true,
-			"PRIVMSG %s :%s", Channel_Name(Chan), Text);
-}
-
-
-GLOBAL bool
-Channel_Notice(CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Text)
+Channel_Write(CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Command,
+	      bool SendErrors, const char *Text)
 {
-	if (!Can_Send_To_Channel(Chan, From))
-		return true; /* no error, see RFC 2812 */
+	if (!Can_Send_To_Channel(Chan, From)) {
+		if (! SendErrors)
+			return CONNECTED;	/* no error, see RFC 2812 */
+		return IRC_WriteStrClient(From, ERR_CANNOTSENDTOCHAN_MSG,
+					  Client_ID(From), Channel_Name(Chan));
+	}
 
 	if (Client_Conn(From) > NONE)
 		Conn_UpdateIdle(Client_Conn(From));
 
 	return IRC_WriteStrChannelPrefix(Client, Chan, From, true,
-			"NOTICE %s :%s", Channel_Name(Chan), Text);
+			"%s %s :%s", Command, Channel_Name(Chan), Text);
 }
 
 
 GLOBAL CHANNEL *
-Channel_Create( char *Name )
+Channel_Create( const char *Name )
 {
 	/* Create new CHANNEL structure and add it to linked list */
 	CHANNEL *c;
@@ -820,7 +868,7 @@ Add_Client( CHANNEL *Chan, CLIENT *Client )
 	assert( Chan != NULL );
 	assert( Client != NULL );
 
-	/* neue CL2CHAN-Struktur anlegen */
+	/* Create new CL2CHAN structure */
 	cl2chan = (CL2CHAN *)malloc( sizeof( CL2CHAN ));
 	if( ! cl2chan )
 	{
@@ -831,11 +879,11 @@ Add_Client( CHANNEL *Chan, CLIENT *Client )
 	cl2chan->client = Client;
 	strcpy( cl2chan->modes, "" );
 
-	/* Verketten */
+	/* concatenate */
 	cl2chan->next = My_Cl2Chan;
 	My_Cl2Chan = cl2chan;
 
-	Log( LOG_DEBUG, "User \"%s\" joined channel \"%s\".", Client_Mask( Client ), Chan->name );
+	LogDebug("User \"%s\" joined channel \"%s\".", Client_Mask(Client), Chan->name);
 
 	return cl2chan;
 } /* Add_Client */
@@ -846,12 +894,17 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const ch
 {
 	CL2CHAN *cl2chan, *last_cl2chan;
 	CHANNEL *c;
-	
+
 	assert( Chan != NULL );
 	assert( Client != NULL );
 	assert( Origin != NULL );
 	assert( Reason != NULL );
 
+	/* Do not inform other servers if the channel is local to this server,
+	 * regardless of what the caller requested! */
+	if(InformServer)
+		InformServer = !Channel_IsLocal(Chan);
+
 	last_cl2chan = NULL;
 	cl2chan = My_Cl2Chan;
 	while( cl2chan )
@@ -865,7 +918,7 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const ch
 	c = cl2chan->channel;
 	assert( c != NULL );
 
-	/* Aus Verkettung loesen und freigeben */
+	/* maintain cl2chan list */
 	if( last_cl2chan ) last_cl2chan->next = cl2chan->next;
 	else My_Cl2Chan = cl2chan->next;
 	free( cl2chan );
@@ -873,14 +926,16 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const ch
 	switch( Type )
 	{
 		case REMOVE_QUIT:
-			/* QUIT: other servers have already been notified, see Client_Destroy();
-			 * so only inform other clients in same channel. */
+			/* QUIT: other servers have already been notified, 
+			 * see Client_Destroy(); so only inform other clients
+			 * in same channel. */
 			assert( InformServer == false );
 			LogDebug("User \"%s\" left channel \"%s\" (%s).",
 					Client_Mask( Client ), c->name, Reason );
 			break;
 		case REMOVE_KICK:
-			/* User was KICKed: inform other servers and all users in channel */
+			/* User was KICKed: inform other servers (public
+			 * channels) and all users in the channel */
 			if( InformServer )
 				IRC_WriteStrServersPrefix( Client_NextHop( Origin ),
 					Origin, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason);
@@ -892,7 +947,7 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const ch
 				IRC_WriteStrClientPrefix(Client, Origin, "KICK %s %s :%s",
 								c->name, Client_ID( Client ), Reason);
 			}
-			LogDebug("User \"%s\" has been kicked of \"%s\" by \"%s\": %s.",
+			LogDebug("User \"%s\" has been kicked off \"%s\" by \"%s\": %s.",
 				Client_Mask( Client ), c->name, Client_ID(Origin), Reason);
 			break;
 		default: /* PART */
@@ -911,7 +966,7 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const ch
 			}
 	}
 
-	/* Wenn Channel nun leer und nicht pre-defined: loeschen */
+	/* When channel is empty and is not pre-defined, delete */
 	if( ! strchr( Channel_Modes( Chan ), 'P' ))
 	{
 		if( ! Get_First_Cl2Chan( NULL, Chan )) Delete_Channel( Chan );
@@ -983,6 +1038,76 @@ Channel_ShowInvites( CLIENT *Client, CHANNEL *Channel )
 }
 
 
+/**
+ * Log a message to the local &SERVER channel, if it exists.
+ */
+GLOBAL void
+Channel_LogServer(const char *msg)
+{
+	CHANNEL *sc;
+	CLIENT *c;
+
+	assert(msg != NULL);
+
+	sc = Channel_Search("&SERVER");
+	if (!sc)
+		return;
+
+	c = Client_ThisServer();
+	Channel_Write(sc, c, c, "PRIVMSG", false, msg);
+} /* Channel_LogServer */
+
+
+GLOBAL bool
+Channel_CheckKey(CHANNEL *Chan, CLIENT *Client, const char *Key)
+{
+	char *file_name, line[COMMAND_LEN], *nick, *pass;
+	FILE *fd;
+
+	assert(Chan != NULL);
+	assert(Client != NULL);
+	assert(Key != NULL);
+
+	if (!strchr(Chan->modes, 'k'))
+		return true;
+	if (strcmp(Chan->key, Key) == 0)
+		return true;
+	if (*Key == '\0')
+		return false;
+
+	file_name = array_start(&Chan->keyfile);
+	if (!file_name)
+		return false;
+	fd = fopen(file_name, "r");
+	if (!fd) {
+		Log(LOG_ERR, "Can't open channel key file \"%s\" for %s: %s",
+		    file_name, Chan->name, strerror(errno));
+		return false;
+	}
+
+	while (fgets(line, (int)sizeof(line), fd) != NULL) {
+		ngt_TrimStr(line);
+		if (! (nick = strchr(line, ':')))
+			continue;
+		*nick++ = '\0';
+		if (!Match(line, Client_User(Client)))
+			continue;
+		if (! (pass = strchr(nick, ':')))
+			continue;
+		*pass++ = '\0';
+		if (!Match(nick, Client_ID(Client)))
+			continue;
+		if (strcmp(Key, pass) != 0)
+			continue;
+
+		fclose(fd);
+		return true;
+	}
+	fclose(fd);
+	return false;
+} /* Channel_CheckKey */
+
+
 static CL2CHAN *
 Get_First_Cl2Chan( CLIENT *Client, CHANNEL *Chan )
 {
@@ -996,7 +1121,7 @@ Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHANNEL *Channel )
 	CL2CHAN *cl2chan;
 
 	assert( Client != NULL || Channel != NULL );
-	
+
 	cl2chan = Start;
 	while( cl2chan )
 	{
@@ -1008,36 +1133,64 @@ Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHANNEL *Channel )
 } /* Get_Next_Cl2Chan */
 
 
-static bool
-Delete_Channel( CHANNEL *Chan )
+/**
+ * Remove a channel and free all of its data structures.
+ */
+static void
+Delete_Channel(CHANNEL *Chan)
 {
-	/* Channel-Struktur loeschen */
-
 	CHANNEL *chan, *last_chan;
 
 	last_chan = NULL;
 	chan = My_Channels;
-	while( chan )
-	{
-		if( chan == Chan ) break;
+	while (chan) {
+		if (chan == Chan)
+			break;
 		last_chan = chan;
 		chan = chan->next;
 	}
-	if( ! chan ) return false;
-
-	Log( LOG_DEBUG, "Freed channel structure for \"%s\".", Chan->name );
 
-	/* Invite- und Ban-Lists aufraeumen */
-	Lists_Free( &chan->list_bans );
-	Lists_Free( &chan->list_invites );
+	assert(chan != NULL);
+	if (!chan)
+		return;
 
-	/* Neu verketten und freigeben */
-	if( last_chan ) last_chan->next = chan->next;
-	else My_Channels = chan->next;
-	free( chan );
+	/* maintain channel list */
+	if (last_chan)
+		last_chan->next = chan->next;
+	else
+		My_Channels = chan->next;
 
-	return true;
+	LogDebug("Freed channel structure for \"%s\".", Chan->name);
+	Free_Channel(Chan);
 } /* Delete_Channel */
 
 
+static void
+Set_KeyFile(CHANNEL *Chan, const char *KeyFile)
+{
+	size_t len;
+
+	assert(Chan != NULL);
+	assert(KeyFile != NULL);
+
+	len = strlen(KeyFile);
+	if (len < array_bytes(&Chan->keyfile)) {
+		Log(LOG_INFO, "Channel key file of %s removed.", Chan->name);
+		array_free(&Chan->keyfile);
+	}
+
+	if (len < 1)
+		return;
+
+	if (!array_copyb(&Chan->keyfile, KeyFile, len+1))
+		Log(LOG_WARNING,
+		    "Could not set new channel key file \"%s\" for %s: %s",
+		    KeyFile, Chan->name, strerror(errno));
+	else
+		Log(LOG_INFO|LOG_snotice,
+		    "New local channel key file \"%s\" for %s activated.",
+		    KeyFile, Chan->name);
+} /* Set_KeyFile */
+
+
 /* -eof- */

+ 24 - 13
src/ngircd/channel.h

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2008 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,8 +8,6 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: channel.h,v 1.35 2008/02/05 16:31:35 fw Exp $
- *
  * Channel management (header)
  */
 
@@ -39,6 +37,7 @@ typedef struct _CHANNEL
 	unsigned long maxusers;		/* Maximum number of members (mode "l") */
 	struct list_head list_bans;	/* list head of banned users */
 	struct list_head list_invites;	/* list head of invited users */
+	array keyfile;			/* Name of the channel key file */
 } CHANNEL;
 
 typedef struct _CLIENT2CHAN
@@ -46,7 +45,7 @@ typedef struct _CLIENT2CHAN
 	struct _CLIENT2CHAN *next;
 	CLIENT *client;
 	CHANNEL *channel;
-	char modes[CHANNEL_MODE_LEN];	/* User-Modes in dem Channel */
+	char modes[CHANNEL_MODE_LEN];	/* User-Modes in Channel */
 } CL2CHAN;
 
 #else
@@ -63,12 +62,13 @@ GLOBAL void Channel_Init PARAMS(( void ));
 GLOBAL void Channel_InitPredefined PARAMS((  void ));
 GLOBAL void Channel_Exit PARAMS(( void ));
 
-GLOBAL bool Channel_Join PARAMS(( CLIENT *Client, char *Name ));
+GLOBAL bool Channel_Join PARAMS(( CLIENT *Client, const char *Name ));
 GLOBAL bool Channel_Part PARAMS(( CLIENT *Client, CLIENT *Origin, const char *Name, const char *Reason ));
 
-GLOBAL void Channel_Quit PARAMS(( CLIENT *Client, char *Reason ));
+GLOBAL void Channel_Quit PARAMS(( CLIENT *Client, const char *Reason ));
 
-GLOBAL void Channel_Kick PARAMS((  CLIENT *Client, CLIENT *Origin, char *Name, char *Reason ));
+GLOBAL void Channel_Kick PARAMS((CLIENT *Peer, CLIENT *Target, CLIENT *Origin,
+				 const char *Name, const char *Reason));
 
 GLOBAL unsigned long Channel_Count PARAMS(( void ));
 GLOBAL unsigned long Channel_MemberCount PARAMS(( CHANNEL *Chan ));
@@ -80,9 +80,9 @@ GLOBAL char *Channel_Topic PARAMS(( CHANNEL *Chan ));
 GLOBAL char *Channel_Key PARAMS(( CHANNEL *Chan ));
 GLOBAL unsigned long Channel_MaxUsers PARAMS(( CHANNEL *Chan ));
 
-GLOBAL void Channel_SetTopic PARAMS(( CHANNEL *Chan, CLIENT *Client, char *Topic ));
-GLOBAL void Channel_SetModes PARAMS(( CHANNEL *Chan, char *Modes ));
-GLOBAL void Channel_SetKey PARAMS(( CHANNEL *Chan, char *Key ));
+GLOBAL void Channel_SetTopic PARAMS(( CHANNEL *Chan, CLIENT *Client, const char *Topic ));
+GLOBAL void Channel_SetModes PARAMS(( CHANNEL *Chan, const char *Modes ));
+GLOBAL void Channel_SetKey PARAMS(( CHANNEL *Chan, const char *Key ));
 GLOBAL void Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, unsigned long Count ));
 
 GLOBAL CHANNEL *Channel_Search PARAMS(( const char *Name ));
@@ -109,10 +109,11 @@ GLOBAL char *Channel_UserModes PARAMS(( CHANNEL *Chan, CLIENT *Client ));
 
 GLOBAL bool Channel_IsMemberOf PARAMS(( CHANNEL *Chan, CLIENT *Client ));
 
-GLOBAL bool Channel_Write PARAMS(( CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Text ));
-GLOBAL bool Channel_Notice PARAMS(( CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Text));
+GLOBAL bool Channel_Write PARAMS((CHANNEL *Chan, CLIENT *From, CLIENT *Client,
+				  const char *Command, bool SendErrors,
+				  const char *Text));
 
-GLOBAL CHANNEL *Channel_Create PARAMS(( char *Name ));
+GLOBAL CHANNEL *Channel_Create PARAMS(( const char *Name ));
 
 #ifndef STRICT_RFC
 GLOBAL unsigned int Channel_TopicTime PARAMS(( CHANNEL *Chan ));
@@ -124,5 +125,15 @@ GLOBAL bool Channel_AddBan PARAMS((CHANNEL *c, const char *Mask ));
 
 GLOBAL bool Channel_ShowBans PARAMS((CLIENT *client, CHANNEL *c));
 GLOBAL bool Channel_ShowInvites PARAMS((CLIENT *client, CHANNEL *c));
+
+GLOBAL void Channel_LogServer PARAMS((const char *msg));
+
+GLOBAL bool Channel_CheckKey PARAMS((CHANNEL *Chan, CLIENT *Client,
+				     const char *Key));
+
+#define Channel_IsLocal(c) (Channel_Name(c)[0] == '&')
+#define Channel_IsModeless(c) (Channel_Name(c)[0] == '+')
+
 #endif
+
 /* -eof- */

+ 152 - 130
src/ngircd/client.c

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2005 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2008 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
@@ -17,8 +17,6 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: client.c,v 1.98 2008/04/04 19:30:01 fw Exp $";
-
 #include "imp.h"
 #include <assert.h>
 #include <unistd.h>
@@ -51,7 +49,6 @@ static char UNUSED id[] = "$Id: client.c,v 1.98 2008/04/04 19:30:01 fw Exp $";
 
 
 static CLIENT *This_Server, *My_Clients;
-static char GetID_Buffer[GETID_LEN];
 
 static WHOWAS My_Whowas[MAX_WHOWAS];
 static int Last_Whowas = -1;
@@ -66,8 +63,13 @@ static void Generate_MyToken PARAMS(( CLIENT *Client ));
 static void Adjust_Counters PARAMS(( CLIENT *Client ));
 
 static CLIENT *Init_New_Client PARAMS((CONN_ID Idx, CLIENT *Introducer,
- CLIENT *TopServer, int Type, char *ID, char *User, char *Hostname,
- char *Info, int Hops, int Token, char *Modes, bool Idented));
+				       CLIENT *TopServer, int Type, const char *ID,
+				       const char *User, const char *Hostname, const char *Info,
+				       int Hops, int Token, const char *Modes,
+				       bool Idented));
+
+static void Destroy_UserOrService PARAMS((CLIENT *Client,const char *Txt, const char *FwdMsg,
+					bool SendQuit));
 
 
 GLOBAL void
@@ -139,7 +141,7 @@ Client_ThisServer( void )
  * @return New CLIENT structure.
  */
 GLOBAL CLIENT *
-Client_NewLocal(CONN_ID Idx, char *Hostname, int Type, bool Idented)
+Client_NewLocal(CONN_ID Idx, const char *Hostname, int Type, bool Idented)
 {
 	return Init_New_Client(Idx, This_Server, NULL, Type, NULL, NULL,
 		Hostname, NULL, 0, 0, NULL, Idented);
@@ -151,8 +153,8 @@ Client_NewLocal(CONN_ID Idx, char *Hostname, int Type, bool Idented)
  * @return New CLIENT structure.
  */
 GLOBAL CLIENT *
-Client_NewRemoteServer(CLIENT *Introducer, char *Hostname, CLIENT *TopServer,
- int Hops, int Token, char *Info, bool Idented)
+Client_NewRemoteServer(CLIENT *Introducer, const char *Hostname, CLIENT *TopServer,
+ int Hops, int Token, const char *Info, bool Idented)
 {
 	return Init_New_Client(NONE, Introducer, TopServer, CLIENT_SERVER,
 		Hostname, NULL, Hostname, Info, Hops, Token, NULL, Idented);
@@ -164,8 +166,8 @@ Client_NewRemoteServer(CLIENT *Introducer, char *Hostname, CLIENT *TopServer,
  * @return New CLIENT structure.
  */
 GLOBAL CLIENT *
-Client_NewRemoteUser(CLIENT *Introducer, char *Nick, int Hops, char *User,
- char *Hostname, int Token, char *Modes, char *Info, bool Idented)
+Client_NewRemoteUser(CLIENT *Introducer, const char *Nick, int Hops, const char *User,
+ const char *Hostname, int Token, const char *Modes, const char *Info, bool Idented)
 {
 	return Init_New_Client(NONE, Introducer, NULL, CLIENT_USER, Nick,
 		User, Hostname, Info, Hops, Token, Modes, Idented);
@@ -179,8 +181,8 @@ Client_NewRemoteUser(CLIENT *Introducer, char *Nick, int Hops, char *User,
  */
 static CLIENT *
 Init_New_Client(CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer,
- int Type, char *ID, char *User, char *Hostname, char *Info, int Hops,
- int Token, char *Modes, bool Idented)
+ int Type, const char *ID, const char *User, const char *Hostname, const char *Info, int Hops,
+ int Token, const char *Modes, bool Idented)
 {
 	CLIENT *client;
 
@@ -191,7 +193,6 @@ Init_New_Client(CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer,
 	client = New_Client_Struct( );
 	if( ! client ) return NULL;
 
-	/* Initialisieren */
 	client->starttime = time(NULL);
 	client->conn_id = Idx;
 	client->introducer = Introducer;
@@ -209,11 +210,9 @@ Init_New_Client(CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer,
 	if( strchr( client->modes, 'a' ))
 		strlcpy( client->away, DEFAULT_AWAY_MSG, sizeof( client->away ));
 
-	/* Verketten */
 	client->next = (POINTER *)My_Clients;
 	My_Clients = client;
 
-	/* Adjust counters */
 	Adjust_Counters( client );
 
 	return client;
@@ -221,12 +220,13 @@ Init_New_Client(CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer,
 
 
 GLOBAL void
-Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )
+Client_Destroy( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool SendQuit )
 {
-	/* Client entfernen. */
+	/* remove a client */
 	
 	CLIENT *last, *c;
-	char msg[LINE_LEN], *txt;
+	char msg[LINE_LEN];
+	const char *txt;
 
 	assert( Client != NULL );
 
@@ -234,7 +234,7 @@ Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )
 	else txt = FwdMsg;
 	if( ! txt ) txt = "Reason unknown.";
 
-	/* Netz-Split-Nachricht vorbereiten (noch nicht optimal) */
+	/* netsplit message */
 	if( Client->type == CLIENT_SERVER ) {
 		strlcpy(msg, This_Server->id, sizeof (msg));
 		strlcat(msg, " ", sizeof (msg));
@@ -247,8 +247,16 @@ Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )
 	{
 		if(( Client->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c != Client ))
 		{
-			/* der Client, der geloescht wird ist ein Server. Der Client, den wir gerade
-			 * pruefen, ist ein Child von diesem und muss daher auch entfernt werden */
+			/*
+			 * The client that is about to be removed is a server,
+			 * the client we are checking right now is a child of that
+			 * server and thus has to be removed, too.
+			 *
+			 * Call Client_Destroy() recursively with the server as the
+			 * new "object to be removed". This starts the cycle again, until
+			 * all servers that are linked via the original server have been
+			 * removed.
+			 */
 			Client_Destroy( c, NULL, msg, false );
 			last = NULL;
 			c = My_Clients;
@@ -256,45 +264,12 @@ Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )
 		}
 		if( c == Client )
 		{
-			/* Wir haben den Client gefunden: entfernen */
+			/* found  the client: remove it */
 			if( last ) last->next = c->next;
 			else My_Clients = (CLIENT *)c->next;
 
-			if( c->type == CLIENT_USER )
-			{
-				if( c->conn_id != NONE )
-				{
-					/* Ein lokaler User */
-					Log( LOG_NOTICE, "User \"%s\" unregistered (connection %d): %s", Client_Mask( c ), c->conn_id, txt );
-
-					if( SendQuit )
-					{
-						/* Alle andere Server informieren! */
-						if( FwdMsg ) IRC_WriteStrServersPrefix( NULL, c, "QUIT :%s", FwdMsg );
-						else IRC_WriteStrServersPrefix( NULL, c, "QUIT :" );
-					}
-				}
-				else
-				{
-					/* Remote User */
-					Log( LOG_DEBUG, "User \"%s\" unregistered: %s", Client_Mask( c ), txt );
-
-					if( SendQuit )
-					{
-						/* Andere Server informieren, ausser denen, die "in
-						 * Richtung dem liegen", auf dem der User registriert
-						 * ist. Von denen haben wir das QUIT ja wohl bekommen. */
-						if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "QUIT :%s", FwdMsg );
-						else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "QUIT :" );
-					}
-				}
-
-				/* Unregister client from channels */
-				Channel_Quit( c, FwdMsg ? FwdMsg : c->id );
-				
-				/* Register client in My_Whowas structure */
-				Client_RegisterWhowas( c );
-			}
+			if(c->type == CLIENT_USER || c->type == CLIENT_SERVICE)
+				Destroy_UserOrService(c, txt, FwdMsg, SendQuit);
 			else if( c->type == CLIENT_SERVER )
 			{
 				if( c != This_Server )
@@ -303,7 +278,7 @@ Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )
 					else Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered: %s", c->id, txt );
 				}
 
-				/* andere Server informieren */
+				/* inform other servers */
 				if( ! NGIRCd_SignalQuit )
 				{
 					if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :%s", c->id, FwdMsg );
@@ -332,10 +307,8 @@ Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )
 
 
 GLOBAL void
-Client_SetHostname( CLIENT *Client, char *Hostname )
+Client_SetHostname( CLIENT *Client, const char *Hostname )
 {
-	/* Hostname eines Clients setzen */
-
 	assert( Client != NULL );
 	assert( Hostname != NULL );
 
@@ -344,10 +317,8 @@ Client_SetHostname( CLIENT *Client, char *Hostname )
 
 
 GLOBAL void
-Client_SetID( CLIENT *Client, char *ID )
+Client_SetID( CLIENT *Client, const char *ID )
 {
-	/* Hostname eines Clients setzen, Hash-Wert berechnen */
-
 	assert( Client != NULL );
 	assert( ID != NULL );
 	
@@ -359,72 +330,68 @@ Client_SetID( CLIENT *Client, char *ID )
 
 
 GLOBAL void
-Client_SetUser( CLIENT *Client, char *User, bool Idented )
+Client_SetUser( CLIENT *Client, const char *User, bool Idented )
 {
-	/* Username eines Clients setzen */
+	/* set clients username */
 
 	assert( Client != NULL );
 	assert( User != NULL );
 
-	if( Idented ) strlcpy( Client->user, User, sizeof( Client->user ));
-	else
-	{
+	if (Idented) {
+		strlcpy(Client->user, User, sizeof(Client->user));
+	} else {
 		Client->user[0] = '~';
-		strlcpy( Client->user + 1, User, sizeof( Client->user ) - 1 );
+		strlcpy(Client->user + 1, User, sizeof(Client->user) - 1);
 	}
 } /* Client_SetUser */
 
 
 GLOBAL void
-Client_SetInfo( CLIENT *Client, char *Info )
+Client_SetInfo( CLIENT *Client, const char *Info )
 {
-	/* Hostname eines Clients setzen */
+	/* set client hostname */
 
 	assert( Client != NULL );
 	assert( Info != NULL );
 
-	strlcpy( Client->info, Info, sizeof( Client->info ));
+	strlcpy(Client->info, Info, sizeof(Client->info));
 } /* Client_SetInfo */
 
 
 GLOBAL void
-Client_SetModes( CLIENT *Client, char *Modes )
+Client_SetModes( CLIENT *Client, const char *Modes )
 {
-	/* Modes eines Clients setzen */
-
 	assert( Client != NULL );
 	assert( Modes != NULL );
 
-	strlcpy( Client->modes, Modes, sizeof( Client->modes ));
+	strlcpy(Client->modes, Modes, sizeof( Client->modes ));
 } /* Client_SetModes */
 
 
 GLOBAL void
-Client_SetFlags( CLIENT *Client, char *Flags )
+Client_SetFlags( CLIENT *Client, const char *Flags )
 {
-	/* Flags eines Clients setzen */
-
 	assert( Client != NULL );
 	assert( Flags != NULL );
 
-	strlcpy( Client->flags, Flags, sizeof( Client->flags ));
+	strlcpy(Client->flags, Flags, sizeof(Client->flags));
 } /* Client_SetFlags */
 
 
 GLOBAL void
-Client_SetPassword( CLIENT *Client, char *Pwd )
+Client_SetPassword( CLIENT *Client, const char *Pwd )
 {
-	/* Von einem Client geliefertes Passwort */
+	/* set password sent by client */
 
 	assert( Client != NULL );
 	assert( Pwd != NULL );
 
-	strlcpy( Client->pwd, Pwd, sizeof( Client->pwd ));
+	strlcpy(Client->pwd, Pwd, sizeof(Client->pwd));
 } /* Client_SetPassword */
 
 
 GLOBAL void
-Client_SetAway( CLIENT *Client, char *Txt )
+Client_SetAway( CLIENT *Client, const char *Txt )
 {
 	/* Set AWAY reason of client */
 
@@ -432,7 +399,8 @@ Client_SetAway( CLIENT *Client, char *Txt )
 	assert( Txt != NULL );
 
 	strlcpy( Client->away, Txt, sizeof( Client->away ));
-	Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
+	LogDebug("%s \"%s\" is away: %s", Client_TypeText(Client),
+		 Client_Mask(Client), Txt);
 } /* Client_SetAway */
 
 
@@ -492,9 +460,7 @@ Client_ModeAdd( CLIENT *Client, char Mode )
 	assert( Client != NULL );
 
 	x[0] = Mode; x[1] = '\0';
-	if( ! strchr( Client->modes, x[0] ))
-	{
-		/* Client hat den Mode noch nicht -> setzen */
+	if (!strchr( Client->modes, x[0])) {
 		strlcat( Client->modes, x, sizeof( Client->modes ));
 		return true;
 	}
@@ -530,7 +496,7 @@ Client_ModeDel( CLIENT *Client, char Mode )
 
 
 GLOBAL CLIENT *
-Client_Search( char *Nick )
+Client_Search( const char *Nick )
 {
 	/* return Client-Structure that has the corresponding Nick.
 	 * If none is found, return NULL.
@@ -547,16 +513,12 @@ Client_Search( char *Nick )
 	ptr = strchr( search_id, '!' );
 	if( ptr ) *ptr = '\0';
 
-	search_hash = Hash( search_id );
+	search_hash = Hash(search_id);
 
 	c = My_Clients;
-	while( c )
-	{
-		if( c->hash == search_hash )
-		{
-			/* lt. Hash-Wert: Treffer! */
-			if( strcasecmp( c->id, search_id ) == 0 ) return c;
-		}
+	while (c) {
+		if (c->hash == search_hash && strcasecmp(c->id, search_id) == 0)
+			return c;
 		c = (CLIENT *)c->next;
 	}
 	return NULL;
@@ -576,9 +538,10 @@ Client_GetFromToken( CLIENT *Client, int Token )
 	assert( Token > 0 );
 
 	c = My_Clients;
-	while( c )
-	{
-		if(( c->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c->token == Token )) return c;
+	while (c) {
+		if ((c->type == CLIENT_SERVER) && (c->introducer == Client) &&
+			(c->token == Token))
+				return c;
 		c = (CLIENT *)c->next;
 	}
 	return NULL;
@@ -711,17 +674,20 @@ Client_NextHop( CLIENT *Client )
 } /* Client_NextHop */
 
 
+/**
+ * return Client-ID ("client!user@host"), this ID is needed for e.g.
+ * prefixes.  Returnes pointer to static buffer.
+ */
 GLOBAL char *
 Client_Mask( CLIENT *Client )
 {
-	/* Client-"ID" liefern, wie sie z.B. fuer
-	 * Prefixe benoetigt wird. */
+	static char GetID_Buffer[GETID_LEN];
 
 	assert( Client != NULL );
 
 	if( Client->type == CLIENT_SERVER ) return Client->id;
 
-	snprintf( GetID_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client->host );
+	snprintf(GetID_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client->host);
 	return GetID_Buffer;
 } /* Client_Mask */
 
@@ -753,8 +719,6 @@ Client_HasMode( CLIENT *Client, char Mode )
 GLOBAL char *
 Client_Away( CLIENT *Client )
 {
-	/* AWAY-Text liefern */
-
 	assert( Client != NULL );
 	return Client->away;
 } /* Client_Away */
@@ -766,7 +730,7 @@ Client_CheckNick( CLIENT *Client, char *Nick )
 	assert( Client != NULL );
 	assert( Nick != NULL );
 
-	if( ! Client_IsValidNick( Nick ))
+	if (! Client_IsValidNick( Nick ))
 	{
 		IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), Nick );
 		return false;
@@ -787,8 +751,6 @@ Client_CheckNick( CLIENT *Client, char *Nick )
 GLOBAL bool
 Client_CheckID( CLIENT *Client, char *ID )
 {
-	/* Nick ueberpruefen */
-
 	char str[COMMAND_LEN];
 	CLIENT *c;
 
@@ -796,24 +758,22 @@ Client_CheckID( CLIENT *Client, char *ID )
 	assert( Client->conn_id > NONE );
 	assert( ID != NULL );
 
-	/* Nick zu lang? */
-	if( strlen( ID ) > CLIENT_ID_LEN )
-	{
-		IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), ID );
+	/* ID too long? */
+	if (strlen(ID) > CLIENT_ID_LEN) {
+		IRC_WriteStrClient(Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID(Client), ID);
 		return false;
 	}
 
-	/* ID bereits vergeben? */
+	/* ID already in use? */
 	c = My_Clients;
-	while( c )
-	{
-		if( strcasecmp( c->id, ID ) == 0 )
-		{
-			/* die Server-ID gibt es bereits */
-			snprintf( str, sizeof( str ), "ID \"%s\" already registered", ID );
-			if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id );
-			else Log( LOG_ERR, "%s (via network)!", str );
-			Conn_Close( Client->conn_id, str, str, true);
+	while (c) {
+		if (strcasecmp(c->id, ID) == 0) {
+			snprintf(str, sizeof(str), "ID \"%s\" already registered", ID);
+			if (c->conn_id != NONE)
+				Log(LOG_ERR, "%s (on connection %d)!", str, c->conn_id);
+			else
+				Log(LOG_ERR, "%s (via network)!", str);
+			Conn_Close(Client->conn_id, str, str, true);
 			return false;
 		}
 		c = (CLIENT *)c->next;
@@ -826,8 +786,6 @@ Client_CheckID( CLIENT *Client, char *ID )
 GLOBAL CLIENT *
 Client_First( void )
 {
-	/* Ersten Client liefern. */
-
 	return My_Clients;
 } /* Client_First */
 
@@ -835,9 +793,6 @@ Client_First( void )
 GLOBAL CLIENT *
 Client_Next( CLIENT *c )
 {
-	/* Naechsten Client liefern. Existiert keiner,
-	 * so wird NULL geliefert. */
-
 	assert( c != NULL );
 	return (CLIENT *)c->next;
 } /* Client_Next */
@@ -1076,7 +1031,7 @@ Generate_MyToken( CLIENT *Client )
 		else c = (CLIENT *)c->next;
 	}
 	Client->mytoken = token;
-	Log( LOG_DEBUG, "Assigned token %d to server \"%s\".", token, Client->id );
+	LogDebug("Assigned token %d to server \"%s\".", token, Client->id);
 } /* Generate_MyToken */
 
 
@@ -1142,4 +1097,71 @@ Client_RegisterWhowas( CLIENT *Client )
 } /* Client_RegisterWhowas */
 
 
+GLOBAL char *
+Client_TypeText(CLIENT *Client)
+{
+	assert(Client != NULL);
+	switch (Client_Type(Client)) {
+		case CLIENT_USER:
+			return "User";
+			break;
+		case CLIENT_SERVICE:
+			return "Service";
+			break;
+		case CLIENT_SERVER:
+			return "Server";
+			break;
+		default:
+			return "Client";
+	}
+} /* Client_TypeText */
+
+
+/**
+ * Destroy user or service client.
+ */
+static void
+Destroy_UserOrService(CLIENT *Client, const char *Txt, const char *FwdMsg, bool SendQuit)
+{
+	if(Client->conn_id != NONE) {
+		/* Local (directly connected) client */
+		Log(LOG_NOTICE,
+		    "%s \"%s\" unregistered (connection %d): %s",
+		    Client_TypeText(Client), Client_Mask(Client),
+		    Client->conn_id, Txt);
+
+		if (SendQuit) {
+			/* Inforam all the other servers */
+			if (FwdMsg)
+				IRC_WriteStrServersPrefix(NULL,
+						Client, "QUIT :%s", FwdMsg );
+			else
+				IRC_WriteStrServersPrefix(NULL,
+						Client, "QUIT :");
+		}
+	} else {
+		/* Remote client */
+		LogDebug("%s \"%s\" unregistered: %s",
+			 Client_TypeText(Client), Client_Mask(Client), Txt);
+
+		if(SendQuit) {
+			/* Inform all the other servers, but the ones in the
+			 * direction we got the QUIT from */
+			if(FwdMsg)
+				IRC_WriteStrServersPrefix(Client_NextHop(Client),
+						Client, "QUIT :%s", FwdMsg );
+			else
+				IRC_WriteStrServersPrefix(Client_NextHop(Client),
+						Client, "QUIT :" );
+		}
+	}
+
+	/* Unregister client from channels */
+	Channel_Quit(Client, FwdMsg ? FwdMsg : Client->id);
+
+	/* Register client in My_Whowas structure */
+	Client_RegisterWhowas(Client);
+} /* Destroy_UserOrService */
+
+
 /* -eof- */

+ 16 - 19
src/ngircd/client.h

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2008 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,16 +8,12 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: client.h,v 1.46 2007/01/23 16:07:19 alex Exp $
- *
  * Client management (header)
  */
 
-
 #ifndef __client_h__
 #define __client_h__
 
-
 #define CLIENT_UNKNOWN 1		/* connection of unknown type */
 #define CLIENT_GOTPASS 2		/* client did send PASS */
 #define CLIENT_GOTNICK 4		/* client did send NICK */
@@ -26,6 +22,7 @@
 #define CLIENT_SERVER 32		/* client is a server */
 #define CLIENT_SERVICE 64		/* client is a service */
 #define CLIENT_UNKNOWNSERVER 128	/* unregistered server connection */
+#define CLIENT_GOTPASS_2813 256		/* client did send PASS, RFC 2813 style */
 
 #define CLIENT_TYPE int
 
@@ -75,17 +72,17 @@ typedef struct _WHOWAS
 GLOBAL void Client_Init PARAMS(( void ));
 GLOBAL void Client_Exit PARAMS(( void ));
 
-GLOBAL CLIENT *Client_NewLocal PARAMS(( CONN_ID Idx, char *Hostname, int Type, bool Idented ));
-GLOBAL CLIENT *Client_NewRemoteServer PARAMS(( CLIENT *Introducer, char *Hostname, CLIENT *TopServer, int Hops, int Token, char *Info, bool Idented ));
-GLOBAL CLIENT *Client_NewRemoteUser PARAMS(( CLIENT *Introducer, char *Nick, int Hops, char *User, char *Hostname, int Token, char *Modes, char *Info, bool Idented ));
+GLOBAL CLIENT *Client_NewLocal PARAMS(( CONN_ID Idx, const char *Hostname, int Type, bool Idented ));
+GLOBAL CLIENT *Client_NewRemoteServer PARAMS(( CLIENT *Introducer, const char *Hostname, CLIENT *TopServer, int Hops, int Token, const char *Info, bool Idented ));
+GLOBAL CLIENT *Client_NewRemoteUser PARAMS(( CLIENT *Introducer, const char *Nick, int Hops, const char *User, const char *Hostname, int Token, const char *Modes, const char *Info, bool Idented ));
 
-GLOBAL void Client_Destroy PARAMS(( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit ));
+GLOBAL void Client_Destroy PARAMS(( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool SendQuit ));
 
 GLOBAL CLIENT *Client_ThisServer PARAMS(( void ));
 
 GLOBAL CLIENT *Client_GetFromToken PARAMS(( CLIENT *Client, int Token ));
 
-GLOBAL CLIENT *Client_Search PARAMS(( char *ID ));
+GLOBAL CLIENT *Client_Search PARAMS(( const char *ID ));
 GLOBAL CLIENT *Client_First PARAMS(( void ));
 GLOBAL CLIENT *Client_Next PARAMS(( CLIENT *c ));
 
@@ -111,19 +108,19 @@ GLOBAL time_t Client_StartTime PARAMS(( CLIENT *Client ));
 
 GLOBAL bool Client_HasMode PARAMS(( CLIENT *Client, char Mode ));
 
-GLOBAL void Client_SetHostname PARAMS(( CLIENT *Client, char *Hostname ));
-GLOBAL void Client_SetID PARAMS(( CLIENT *Client, char *Nick ));
-GLOBAL void Client_SetUser PARAMS(( CLIENT *Client, char *User, bool Idented ));
-GLOBAL void Client_SetInfo PARAMS(( CLIENT *Client, char *Info ));
-GLOBAL void Client_SetPassword PARAMS(( CLIENT *Client, char *Pwd ));
+GLOBAL void Client_SetHostname PARAMS(( CLIENT *Client, const char *Hostname ));
+GLOBAL void Client_SetID PARAMS(( CLIENT *Client, const char *Nick ));
+GLOBAL void Client_SetUser PARAMS(( CLIENT *Client, const char *User, bool Idented ));
+GLOBAL void Client_SetInfo PARAMS(( CLIENT *Client, const char *Info ));
+GLOBAL void Client_SetPassword PARAMS(( CLIENT *Client, const char *Pwd ));
 GLOBAL void Client_SetType PARAMS(( CLIENT *Client, int Type ));
 GLOBAL void Client_SetHops PARAMS(( CLIENT *Client, int Hops ));
 GLOBAL void Client_SetToken PARAMS(( CLIENT *Client, int Token ));
 GLOBAL void Client_SetOperByMe PARAMS(( CLIENT *Client, bool OperByMe ));
-GLOBAL void Client_SetModes PARAMS(( CLIENT *Client, char *Modes ));
-GLOBAL void Client_SetFlags PARAMS(( CLIENT *Client, char *Flags ));
+GLOBAL void Client_SetModes PARAMS(( CLIENT *Client, const char *Modes ));
+GLOBAL void Client_SetFlags PARAMS(( CLIENT *Client, const char *Flags ));
 GLOBAL void Client_SetIntroducer PARAMS(( CLIENT *Client, CLIENT *Introducer ));
-GLOBAL void Client_SetAway PARAMS(( CLIENT *Client, char *Txt ));
+GLOBAL void Client_SetAway PARAMS(( CLIENT *Client, const char *Txt ));
 
 GLOBAL bool Client_ModeAdd PARAMS(( CLIENT *Client, char Mode ));
 GLOBAL bool Client_ModeDel PARAMS(( CLIENT *Client, char Mode ));
@@ -149,8 +146,8 @@ GLOBAL int Client_GetLastWhowasIndex PARAMS(( void ));
 
 GLOBAL void Client_RegisterWhowas PARAMS(( CLIENT *Client ));
 
+GLOBAL char * Client_TypeText PARAMS((CLIENT *Client));
 
 #endif
 
-
 /* -eof- */

+ 47 - 0
src/ngircd/conf-ssl.h

@@ -0,0 +1,47 @@
+/*
+ * ngIRCd -- The Next Generation IRC Daemon
+ * SSL defines.
+ */
+
+#ifndef conf_ssl_h
+#define conf_ssl_h
+
+#ifdef HAVE_LIBSSL
+#define SSL_SUPPORT
+#include <openssl/ssl.h>
+#endif
+#ifdef HAVE_LIBGNUTLS
+#define SSL_SUPPORT
+#include <gnutls/gnutls.h>
+#ifndef LIBGNUTLS_VERSION_MAJOR
+#define gnutls_certificate_credentials_t gnutls_certificate_credentials
+#define gnutls_cipher_algorithm_t gnutls_cipher_algorithm
+#define gnutls_datum_t gnutls_datum
+#define gnutls_dh_params_t gnutls_dh_params
+#define gnutls_session_t gnutls_session
+#define gnutls_transport_ptr_t gnutls_transport_ptr
+#endif
+#endif
+
+#ifdef SSL_SUPPORT
+struct ConnSSL_State {
+#ifdef HAVE_LIBSSL
+	SSL *ssl;
+#endif
+#ifdef HAVE_LIBGNUTLS
+	gnutls_session gnutls_session;
+	void *cookie;		/* pointer to server configuration structure
+				   (for outgoing connections), or NULL. */
+#endif
+};
+
+bool
+ConnSSL_InitLibrary(void);
+#else
+static inline bool
+ConnSSL_InitLibrary(void) { return true; }
+#endif /* SSL_SUPPORT */
+
+#endif /* conf_ssl_h */
+
+/* -eof- */

+ 288 - 155
src/ngircd/conf.c

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2009 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,8 +14,6 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: conf.c,v 1.105 2008/03/18 20:12:47 fw Exp $";
-
 #include "imp.h"
 #include <assert.h>
 #include <errno.h>
@@ -42,8 +40,10 @@ static char UNUSED id[] = "$Id: conf.c,v 1.105 2008/03/18 20:12:47 fw Exp $";
 #include "ngircd.h"
 #include "conn.h"
 #include "client.h"
+#include "channel.h"
 #include "defines.h"
 #include "log.h"
+#include "match.h"
 #include "resolve.h"
 #include "tool.h"
 
@@ -55,19 +55,7 @@ static bool Use_Log = true;
 static CONF_SERVER New_Server;
 static int New_Server_Idx;
 
-
-#ifdef WANT_IPV6
-/*
- * these options appeared in ngircd 0.12; they are here
- * for backwards compatibility. They should be removed
- * in the future. Instead of setting these options,
- * the "Listen" option should be set accordingly.
- */
-static bool Conf_ListenIPv6;
-static bool Conf_ListenIPv4;
-#endif
-
-
+static size_t Conf_Channel_Count;
 static void Set_Defaults PARAMS(( bool InitServers ));
 static bool Read_Config PARAMS(( bool ngircd_starting ));
 static bool Validate_Config PARAMS(( bool TestOnly, bool Rehash ));
@@ -84,6 +72,71 @@ static void Config_Error_TooLong PARAMS(( const int LINE, const char *Value ));
 
 static void Init_Server_Struct PARAMS(( CONF_SERVER *Server ));
 
+#ifdef WANT_IPV6
+#define DEFAULT_LISTEN_ADDRSTR "::,0.0.0.0"
+#else
+#define DEFAULT_LISTEN_ADDRSTR "0.0.0.0"
+#endif
+
+#ifdef SSL_SUPPORT
+struct SSLOptions Conf_SSLOptions;
+
+static void
+ConfSSL_Init(void)
+{
+	free(Conf_SSLOptions.KeyFile);
+	Conf_SSLOptions.KeyFile = NULL;
+
+	free(Conf_SSLOptions.CertFile);
+	Conf_SSLOptions.CertFile = NULL;
+
+	free(Conf_SSLOptions.DHFile);
+	Conf_SSLOptions.DHFile = NULL;
+	array_free_wipe(&Conf_SSLOptions.KeyFilePassword);
+}
+
+static bool
+ssl_print_configvar(const char *name, const char *file)
+{
+	FILE *fp;
+
+	if (!file) {
+		printf("  %s =\n", name);
+		return true;
+	}
+
+	fp = fopen(file, "r");
+	if (fp)
+		fclose(fp);
+	else
+		fprintf(stderr, "ERROR: %s \"%s\": %s\n",
+			name, file, strerror(errno));
+
+	printf("  %s = %s\n", name, file);
+	return fp != NULL;
+}
+
+static bool
+ConfSSL_Puts(void)
+{
+	bool ret;
+
+	ret = ssl_print_configvar("SSLKeyFile", Conf_SSLOptions.KeyFile);
+
+	if (!ssl_print_configvar("SSLCertFile", Conf_SSLOptions.CertFile))
+		ret = false;
+
+	if (!ssl_print_configvar("SSLDHFile", Conf_SSLOptions.DHFile))
+		ret = false;
+
+	if (array_bytes(&Conf_SSLOptions.KeyFilePassword))
+		puts("  SSLKeyFilePassword = <secret>");
+
+	array_free_wipe(&Conf_SSLOptions.KeyFilePassword);
+
+	return ret;
+}
+#endif
 
 static char *
 strdup_warn(const char *str)
@@ -126,8 +179,8 @@ ports_parse(array *a, int Line, char *Arg)
 	 * must be separated by "," */
 	ptr = strtok( Arg, "," );
 	while (ptr) {
-		ngt_TrimStr( ptr );
-		port = atol( ptr );
+		ngt_TrimStr(ptr);
+		port = atoi(ptr);
 		if (port > 0 && port < 0xFFFF) {
 			port16 = (UINT16) port;
 			if (!array_catb(a, (char*)&port16, sizeof port16))
@@ -181,8 +234,9 @@ Conf_Test( void )
 	struct passwd *pwd;
 	struct group *grp;
 	unsigned int i;
-	char *topic;
 	bool config_valid;
+	size_t predef_channel_count;
+	struct Conf_Channel *predef_chan;
 
 	Use_Log = false;
 
@@ -211,37 +265,44 @@ Conf_Test( void )
 	printf( "  MotdPhrase = %s\n", Conf_MotdPhrase );
 	printf( "  ChrootDir = %s\n", Conf_Chroot );
 	printf( "  PidFile = %s\n", Conf_PidFile);
+	printf("  Listen = %s\n", Conf_ListenAddress);
 	fputs("  Ports = ", stdout);
-
 	ports_puts(&Conf_ListenPorts);
-	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 );
-	grp = getgrgid( Conf_GID );
-	if( grp ) printf( "  ServerGID = %s\n", grp->gr_name );
-	else printf( "  ServerGID = %ld\n", (long)Conf_GID );
-	printf( "  PingTimeout = %d\n", Conf_PingTimeout );
-	printf( "  PongTimeout = %d\n", Conf_PongTimeout );
-	printf( "  ConnectRetry = %d\n", Conf_ConnectRetry );
-	printf( "  OperCanUseMode = %s\n", yesno_to_str(Conf_OperCanMode));
-	printf( "  OperServerMode = %s\n", yesno_to_str(Conf_OperServerMode));
-	printf( "  PredefChannelsOnly = %s\n", yesno_to_str(Conf_PredefChannelsOnly));
-	printf( "  NoDNS = %s\n", yesno_to_str(Conf_NoDNS));
+#ifdef SSL_SUPPORT
+	fputs("  SSLPorts = ", stdout);
+	ports_puts(&Conf_SSLOptions.ListenPorts);
+	if (!ConfSSL_Puts())
+		config_valid = false;
+#endif
+
+	pwd = getpwuid(Conf_UID);
+	if (pwd)
+		printf("  ServerUID = %s\n", pwd->pw_name);
+	else
+		printf("  ServerUID = %ld\n", (long)Conf_UID);
+	grp = getgrgid(Conf_GID);
+	if (grp)
+		printf("  ServerGID = %s\n", grp->gr_name);
+	else
+		printf("  ServerGID = %ld\n", (long)Conf_GID);
+	printf("  PingTimeout = %d\n", Conf_PingTimeout);
+	printf("  PongTimeout = %d\n", Conf_PongTimeout);
+	printf("  ConnectRetry = %d\n", Conf_ConnectRetry);
+	printf("  OperCanUseMode = %s\n", yesno_to_str(Conf_OperCanMode));
+	printf("  OperServerMode = %s\n", yesno_to_str(Conf_OperServerMode));
+	printf("  AllowRemoteOper = %s\n", yesno_to_str(Conf_AllowRemoteOper));
+	printf("  PredefChannelsOnly = %s\n", yesno_to_str(Conf_PredefChannelsOnly));
+	printf("  NoDNS = %s\n", yesno_to_str(Conf_NoDNS));
+	printf("  NoIdent = %s\n", yesno_to_str(Conf_NoIdent));
 
 #ifdef WANT_IPV6
-	/* both are deprecated, only mention them if their default value changed. */
-	if (!Conf_ListenIPv6)
-		puts("  ListenIPv6 = no");
-	if (!Conf_ListenIPv4)
-		puts("  ListenIPv4 = no");
 	printf("  ConnectIPv4 = %s\n", yesno_to_str(Conf_ConnectIPv6));
 	printf("  ConnectIPv6 = %s\n", yesno_to_str(Conf_ConnectIPv4));
 #endif
-	printf( "  MaxConnections = %ld\n", Conf_MaxConnections);
-	printf( "  MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP);
-	printf( "  MaxJoins = %d\n", Conf_MaxJoins>0 ? Conf_MaxJoins : -1);
-	printf( "  MaxNickLength = %u\n\n", Conf_MaxNickLength - 1);
+	printf("  MaxConnections = %ld\n", Conf_MaxConnections);
+	printf("  MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP);
+	printf("  MaxJoins = %d\n", Conf_MaxJoins > 0 ? Conf_MaxJoins : -1);
+	printf("  MaxNickLength = %u\n\n", Conf_MaxNickLength - 1);
 
 	for( i = 0; i < Conf_Oper_Count; i++ ) {
 		if( ! Conf_Oper[i].name[0] ) continue;
@@ -262,24 +323,31 @@ Conf_Test( void )
 		printf( "  Name = %s\n", Conf_Server[i].name );
 		printf( "  Host = %s\n", Conf_Server[i].host );
 		printf( "  Port = %u\n", (unsigned int)Conf_Server[i].port );
+#ifdef SSL_SUPPORT
+		printf( "  SSLConnect = %s\n", Conf_Server[i].SSLConnect?"yes":"no");
+#endif
 		printf( "  MyPassword = %s\n", Conf_Server[i].pwd_in );
 		printf( "  PeerPassword = %s\n", Conf_Server[i].pwd_out );
+		printf( "  ServiceMask = %s\n", Conf_Server[i].svs_mask);
 		printf( "  Group = %d\n", Conf_Server[i].group );
 		printf( "  Passive = %s\n\n", Conf_Server[i].flags & CONF_SFLAG_DISABLED ? "yes" : "no");
 	}
 
-	for( i = 0; i < Conf_Channel_Count; i++ ) {
-		if( ! Conf_Channel[i].name[0] ) continue;
+	predef_channel_count = array_length(&Conf_Channels, sizeof(*predef_chan));
+	predef_chan = array_start(&Conf_Channels);
+
+	for (i = 0; i < predef_channel_count; i++, predef_chan++) {
+		if (!predef_chan->name[0])
+			continue;
 
 		/* Valid "Channel" section */
 		puts( "[CHANNEL]" );
-		printf( "  Name = %s\n", Conf_Channel[i].name );
-		printf( "  Modes = %s\n", Conf_Channel[i].modes );
-		printf( "  Key = %s\n", Conf_Channel[i].key );
-		printf( "  MaxUsers = %lu\n", Conf_Channel[i].maxusers );
-
-		topic = (char*)array_start(&Conf_Channel[i].topic);
-		printf( "  Topic = %s\n\n", topic ? topic : "");
+		printf("  Name = %s\n", predef_chan->name);
+		printf("  Modes = %s\n", predef_chan->modes);
+		printf("  Key = %s\n", predef_chan->key);
+		printf("  MaxUsers = %lu\n", predef_chan->maxusers);
+		printf("  Topic = %s\n", predef_chan->topic);
+		printf("  KeyFile = %s\n\n", predef_chan->keyfile);
 	}
 
 	return (config_valid ? 0 : 1);
@@ -351,7 +419,7 @@ Conf_GetServer( CONN_ID Idx )
 
 
 GLOBAL bool
-Conf_EnableServer( char *Name, UINT16 Port )
+Conf_EnableServer( const char *Name, UINT16 Port )
 {
 	/* Enable specified server and adjust port */
 
@@ -364,7 +432,7 @@ Conf_EnableServer( char *Name, UINT16 Port )
 			/* Gotcha! Set port and enable server: */
 			Conf_Server[i].port = Port;
 			Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED;
-			return true;
+			return (Conf_Server[i].port && Conf_Server[i].host[0]);
 		}
 	}
 	return false;
@@ -390,7 +458,7 @@ Conf_EnablePassiveServer(const char *Name)
 
 
 GLOBAL bool
-Conf_DisableServer( char *Name )
+Conf_DisableServer( const char *Name )
 {
 	/* Enable specified server and adjust port */
 
@@ -411,7 +479,7 @@ Conf_DisableServer( char *Name )
 
 
 GLOBAL bool
-Conf_AddServer( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd )
+Conf_AddServer( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd )
 {
 	/* Add new server to configuration */
 
@@ -441,64 +509,85 @@ Conf_AddServer( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd
 } /* Conf_AddServer */
 
 
-static void
-Set_Defaults( bool InitServers )
+/**
+ * Check if the given nick name is an service
+ */
+GLOBAL bool
+Conf_IsService(int ConfServer, const char *Nick)
 {
-	/* Initialize configuration variables with default values. */
-
-	int i;
+	return MatchCaseInsensitive(Conf_Server[ConfServer].svs_mask, Nick);
+} /* Conf_IsService */
 
-	strcpy( Conf_ServerName, "" );
-	snprintf( Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s", PACKAGE_NAME, PACKAGE_VERSION );
-	strcpy( Conf_ServerPwd, "" );
 
-	strcpy( Conf_ServerAdmin1, "" );
-	strcpy( Conf_ServerAdmin2, "" );
-	strcpy( Conf_ServerAdminMail, "" );
+/**
+ * Initialize configuration settings with their default values.
+ */
+static void
+Set_Defaults(bool InitServers)
+{
+	int i;
 
-	strlcpy( Conf_MotdFile, SYSCONFDIR, sizeof( Conf_MotdFile ));
-	strlcat( Conf_MotdFile, MOTD_FILE, sizeof( Conf_MotdFile ));
+	strcpy(Conf_ServerName, "");
+	snprintf(Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s",
+		 PACKAGE_NAME, PACKAGE_VERSION);
+	strcpy(Conf_ServerPwd, "");
 
-	strlcpy( Conf_MotdPhrase, MOTD_PHRASE, sizeof( Conf_MotdPhrase ));
+	strcpy(Conf_ServerAdmin1, "");
+	strcpy(Conf_ServerAdmin2, "");
+	strcpy(Conf_ServerAdminMail, "");
 
-	strlcpy( Conf_Chroot, CHROOT_DIR, sizeof( Conf_Chroot ));
+	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_PidFile, PID_FILE, sizeof( Conf_PidFile ));
+	Conf_UID = Conf_GID = 0;
+	strlcpy(Conf_Chroot, CHROOT_DIR, sizeof(Conf_Chroot));
+	strlcpy(Conf_PidFile, PID_FILE, sizeof(Conf_PidFile));
 
 	free(Conf_ListenAddress);
 	Conf_ListenAddress = NULL;
-	Conf_UID = Conf_GID = 0;
 
 	Conf_PingTimeout = 120;
 	Conf_PongTimeout = 20;
-
 	Conf_ConnectRetry = 60;
+	Conf_NoDNS = false;
+	Conf_NoIdent = false;
 
 	Conf_Oper_Count = 0;
 	Conf_Channel_Count = 0;
 
 	Conf_OperCanMode = false;
-	Conf_NoDNS = false;
-	Conf_PredefChannelsOnly = false;
 	Conf_OperServerMode = false;
+	Conf_AllowRemoteOper = false;
+	Conf_PredefChannelsOnly = false;
 
 	Conf_ConnectIPv4 = true;
 	Conf_ConnectIPv6 = true;
-#ifdef WANT_IPV6
-	Conf_ListenIPv4 = true;
-	Conf_ListenIPv6 = true;
-#endif
+
 	Conf_MaxConnections = 0;
 	Conf_MaxConnectionsIP = 5;
 	Conf_MaxJoins = 10;
 	Conf_MaxNickLength = CLIENT_NICK_LEN_DEFAULT;
 
 	/* Initialize server configuration structures */
-	if( InitServers ) for( i = 0; i < MAX_SERVERS; Init_Server_Struct( &Conf_Server[i++] ));
+	if (InitServers) {
+		for (i = 0; i < MAX_SERVERS;
+		     Init_Server_Struct(&Conf_Server[i++]));
+	}
 } /* Set_Defaults */
 
 
 static bool
+no_listenports(void)
+{
+	size_t cnt = array_bytes(&Conf_ListenPorts);
+#ifdef SSL_SUPPORT
+	cnt += array_bytes(&Conf_SSLOptions.ListenPorts);
+#endif
+	return cnt == 0;
+}
+
+static bool
 Read_Config( bool ngircd_starting )
 {
 	/* Read configuration file. */
@@ -560,7 +649,9 @@ Read_Config( bool ngircd_starting )
 	strcpy( section, "" );
 	Init_Server_Struct( &New_Server );
 	New_Server_Idx = NONE;
-
+#ifdef SSL_SUPPORT
+	ConfSSL_Init();
+#endif
 	/* Read configuration file */
 	while( true ) {
 		if( ! fgets( str, LINE_LEN, fd )) break;
@@ -615,20 +706,11 @@ Read_Config( bool ngircd_starting )
 				else New_Server_Idx = i;
 				continue;
 			}
-			if( strcasecmp( section, "[CHANNEL]" ) == 0 ) {
-				if( Conf_Channel_Count + 1 > MAX_DEFCHANNELS ) {
-					Config_Error( LOG_ERR, "Too many pre-defined channels configured." );
-				} else {
-					/* Initialize new channel structure */
-					strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
-					strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
-					strcpy( Conf_Channel[Conf_Channel_Count].key, "" );
-					Conf_Channel[Conf_Channel_Count].maxusers = 0;
-					array_free(&Conf_Channel[Conf_Channel_Count].topic);
-					Conf_Channel_Count++;
-				}
+			if (strcasecmp(section, "[CHANNEL]") == 0) {
+				Conf_Channel_Count++;
 				continue;
 			}
+
 			Config_Error( LOG_ERR, "%s, line %d: Unknown section \"%s\"!", NGIRCd_ConfFile, line, section );
 			section[0] = 0x1;
 		}
@@ -661,26 +743,19 @@ Read_Config( bool ngircd_starting )
 		Conf_Server[New_Server_Idx] = New_Server;
 	}
 
-	if (0 == array_length(&Conf_ListenPorts, sizeof(UINT16))) {
-		if (!array_copyb(&Conf_ListenPorts, (char*) &defaultport, sizeof defaultport)) {
-			Config_Error( LOG_ALERT, "Could not add default listening Port %u: %s",
-							(unsigned int) defaultport, strerror(errno));
-			exit( 1 );
-		}
-	}
+	/* not a single listening port? Add default. */
+	if (no_listenports() &&
+		!array_copyb(&Conf_ListenPorts, (char*) &defaultport, sizeof defaultport))
+	{
+		Config_Error(LOG_ALERT, "Could not add default listening Port %u: %s",
+					(unsigned int) defaultport, strerror(errno));
 
-	if (!Conf_ListenAddress) {
-		/* no Listen addresses configured, use default */
-#ifdef WANT_IPV6
-		/* Conf_ListenIPv6/4 should no longer be used */
-		if (Conf_ListenIPv6 && Conf_ListenIPv4)
-			Conf_ListenAddress = strdup_warn("::,0.0.0.0");
-		else if (Conf_ListenIPv6)
-			Conf_ListenAddress = strdup_warn("::");
-		else
-#endif
-		Conf_ListenAddress = strdup_warn("0.0.0.0");
+		exit(1);
 	}
+
+	if (!Conf_ListenAddress)
+		Conf_ListenAddress = strdup_warn(DEFAULT_LISTEN_ADDRSTR);
+
 	if (!Conf_ListenAddress) {
 		Config_Error(LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME);
 		exit(1);
@@ -873,29 +948,21 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
 		Conf_NoDNS = Check_ArgIsTrue( Arg );
 		return;
 	}
-#ifdef WANT_IPV6
-	/* the default setting for all the WANT_IPV6 special options is 'true' */
-	if (strcasecmp(Var, "ListenIPv6") == 0) { /* DEPRECATED, option appeared in 0.12.0 */
-		/*
-		 * listen on ipv6 sockets, if available?
-		 * Deprecated use "Listen = 0.0.0.0" (or, rather, do not list "::")
-		 */
-		Conf_ListenIPv6 = Check_ArgIsTrue( Arg );
-		Config_Error(LOG_WARNING, "%s, line %d: %s=%s is deprecated, %sinclude '::' in \"Listen =\" option instead",
-				NGIRCd_ConfFile, Line, Var, yesno_to_str(Conf_ListenIPv6), Conf_ListenIPv6 ? " ":"do not ");
-		return;
-	}
-	if (strcasecmp(Var, "ListenIPv4") == 0) { /* DEPRECATED, option appeared in 0.12.0 */
-		/*
-		 * listen on ipv4 sockets, if available?
-		 * this allows "ipv6-only" setups
-		 * Deprecated use "Listen = ::" (or, rather, do not list "0.0.0.0")
-		 */
-		Conf_ListenIPv4 = Check_ArgIsTrue( Arg );
-		Config_Error(LOG_WARNING, "%s, line %d: %s=%s is deprecated, %sinclude '0.0.0.0' in \"Listen =\" option instead",
-				NGIRCd_ConfFile, Line, Var, yesno_to_str(Conf_ListenIPv4), Conf_ListenIPv4 ? " ":"do not ");
+	if (strcasecmp(Var, "NoIdent") == 0) {
+		/* don't do IDENT lookups when clients connect? */
+		Conf_NoIdent = Check_ArgIsTrue(Arg);
+#ifndef IDENTAUTH
+		if (!Conf_NoIdent) {
+			/* user has enabled ident lookups explicitly, but ... */
+			Config_Error(LOG_WARNING,
+				"%s: line %d: NoIdent=False, but ngircd was built without IDENT support",
+				NGIRCd_ConfFile, Line);
+		}
+#endif
 		return;
 	}
+#ifdef WANT_IPV6
+	/* the default setting for all the WANT_IPV6 special options is 'true' */
 	if( strcasecmp( Var, "ConnectIPv6" ) == 0 ) {
 		/* connect to other hosts using ipv6, if they have an AAAA record? */
 		Conf_ConnectIPv6 = Check_ArgIsTrue( Arg );
@@ -918,6 +985,11 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
 		Conf_OperServerMode = Check_ArgIsTrue( Arg );
 		return;
 	}
+	if(strcasecmp(Var, "AllowRemoteOper") == 0) {
+		/* Are remote IRC operators allowed to control this server? */
+		Conf_AllowRemoteOper = Check_ArgIsTrue(Arg);
+		return;
+	}
 	if( strcasecmp( Var, "MaxConnections" ) == 0 ) {
 		/* Maximum number of connections. 0 -> "no limit". */
 #ifdef HAVE_ISDIGIT
@@ -970,6 +1042,37 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
 		}
 		return;
 	}
+
+#ifdef SSL_SUPPORT
+	if( strcasecmp( Var, "SSLPorts" ) == 0 ) {
+		ports_parse(&Conf_SSLOptions.ListenPorts, Line, Arg);
+		return;
+	}
+
+	if( strcasecmp( Var, "SSLKeyFile" ) == 0 ) {
+		assert(Conf_SSLOptions.KeyFile == NULL );
+		Conf_SSLOptions.KeyFile = strdup_warn(Arg);
+		return;
+	}
+	if( strcasecmp( Var, "SSLCertFile" ) == 0 ) {
+		assert(Conf_SSLOptions.CertFile == NULL );
+		Conf_SSLOptions.CertFile = strdup_warn(Arg);
+		return;
+	}
+
+	if( strcasecmp( Var, "SSLKeyFilePassword" ) == 0 ) {
+		assert(array_bytes(&Conf_SSLOptions.KeyFilePassword) == 0);
+		if (!array_copys(&Conf_SSLOptions.KeyFilePassword, Arg))
+			Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Could not copy %s: %s!",
+								NGIRCd_ConfFile, Line, Var, strerror(errno));
+		return;
+	}
+	if( strcasecmp( Var, "SSLDHFile" ) == 0 ) {
+		assert(Conf_SSLOptions.DHFile == NULL);
+		Conf_SSLOptions.DHFile = strdup_warn( Arg );
+                return;
+        }
+#endif
 	Config_Error(LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!",
 								NGIRCd_ConfFile, Line, Var);
 } /* Handle_GLOBAL */
@@ -1079,6 +1182,12 @@ Handle_SERVER( int Line, char *Var, char *Arg )
 										NGIRCd_ConfFile, Line, port );
 		return;
 	}
+#ifdef SSL_SUPPORT
+	if( strcasecmp( Var, "SSLConnect" ) == 0 ) {
+		New_Server.SSLConnect = Check_ArgIsTrue(Arg);
+		return;
+        }
+#endif
 	if( strcasecmp( Var, "Group" ) == 0 ) {
 		/* Server group */
 #ifdef HAVE_ISDIGIT
@@ -1094,19 +1203,30 @@ Handle_SERVER( int Line, char *Var, char *Arg )
 			New_Server.flags |= CONF_SFLAG_DISABLED;
 		return;
 	}
-	
+	if (strcasecmp(Var, "ServiceMask") == 0) {
+		len = strlcpy(New_Server.svs_mask, ngt_LowerStr(Arg),
+			      sizeof(New_Server.svs_mask));
+		if (len >= sizeof(New_Server.svs_mask))
+			Config_Error_TooLong(Line, Var);
+		return;
+	}
+
 	Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!",
 								NGIRCd_ConfFile, Line, Var );
 } /* Handle_SERVER */
 
 
 static bool
-Handle_Channelname(size_t chancount, const char *name)
+Handle_Channelname(struct Conf_Channel *new_chan, const char *name)
 {
-	size_t size = sizeof( Conf_Channel[chancount].name );
-	char *dest = Conf_Channel[chancount].name;
+	size_t size = sizeof(new_chan->name);
+	char *dest = new_chan->name;
 
-	if (*name && *name != '#') {
+	if (!Channel_IsValidName(name)) {
+		/*
+		 * maybe user forgot to add a '#'.
+		 * This is only here for user convenience.
+		 */
 		*dest = '#';
 		--size;
 		++dest;
@@ -1116,51 +1236,64 @@ Handle_Channelname(size_t chancount, const char *name)
 
 
 static void
-Handle_CHANNEL( int Line, char *Var, char *Arg )
+Handle_CHANNEL(int Line, char *Var, char *Arg)
 {
 	size_t len;
-	size_t chancount = 0;
+	size_t chancount;
+	struct Conf_Channel *chan;
 
 	assert( Line > 0 );
 	assert( Var != NULL );
 	assert( Arg != NULL );
-	if (Conf_Channel_Count > 0)
-		chancount = Conf_Channel_Count - 1;
+	assert(Conf_Channel_Count > 0);
 
-	if( strcasecmp( Var, "Name" ) == 0 ) {
-		if (!Handle_Channelname(chancount, Arg))
-			Config_Error_TooLong( Line, Var );
+	chancount = Conf_Channel_Count - 1;
+
+	chan = array_alloc(&Conf_Channels, sizeof(*chan), chancount);
+	if (!chan) {
+		Config_Error(LOG_ERR, "Could not allocate memory for predefined channel (%d:%s = %s)", Line, Var, Arg);
 		return;
 	}
-	if( strcasecmp( Var, "Modes" ) == 0 ) {
+	if (strcasecmp(Var, "Name") == 0) {
+		if (!Handle_Channelname(chan, Arg))
+			Config_Error_TooLong(Line, Var);
+		return;
+	}
+	if (strcasecmp(Var, "Modes") == 0) {
 		/* Initial modes */
-		len = strlcpy( Conf_Channel[chancount].modes, Arg, sizeof( Conf_Channel[chancount].modes ));
-		if (len >= sizeof( Conf_Channel[chancount].modes ))
+		len = strlcpy(chan->modes, Arg, sizeof(chan->modes));
+		if (len >= sizeof(chan->modes))
 			Config_Error_TooLong( Line, Var );
 		return;
 	}
 	if( strcasecmp( Var, "Topic" ) == 0 ) {
 		/* Initial topic */
-		if (!array_copys( &Conf_Channel[chancount].topic, Arg))
+		len = strlcpy(chan->topic, Arg, sizeof(chan->topic));
+		if (len >= sizeof(chan->topic))
 			Config_Error_TooLong( Line, Var );
 		return;
 	}
-
 	if( strcasecmp( Var, "Key" ) == 0 ) {
 		/* Initial Channel Key (mode k) */
-		len = strlcpy(Conf_Channel[chancount].key, Arg, sizeof(Conf_Channel[chancount].key));
-		if (len >= sizeof( Conf_Channel[chancount].key ))
+		len = strlcpy(chan->key, Arg, sizeof(chan->key));
+		if (len >= sizeof(chan->key))
 			Config_Error_TooLong(Line, Var);
 		return;
 	}
-
 	if( strcasecmp( Var, "MaxUsers" ) == 0 ) {
 		/* maximum user limit, mode l */
-		Conf_Channel[chancount].maxusers = (unsigned long) atol(Arg);
-		if (Conf_Channel[chancount].maxusers == 0)
+		chan->maxusers = (unsigned long) atol(Arg);
+		if (chan->maxusers == 0)
 			Config_Error_NaN(Line, Var);
 		return;
 	}
+	if (strcasecmp(Var, "KeyFile") == 0) {
+		/* channel keys */
+		len = strlcpy(chan->keyfile, Arg, sizeof(chan->keyfile));
+		if (len >= sizeof(chan->keyfile))
+			Config_Error_TooLong(Line, Var);
+		return;
+	}
 
 	Config_Error( LOG_ERR, "%s, line %d (section \"Channel\"): Unknown variable \"%s\"!",
 								NGIRCd_ConfFile, Line, Var );

+ 45 - 18
src/ngircd/conf.h

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2008 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,8 +8,6 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: conf.h,v 1.49 2008/03/18 20:12:47 fw Exp $
- *
  * Configuration management (header)
  */
 
@@ -24,6 +22,9 @@
 #include "portab.h"
 #include "tool.h"
 #include "ng_ipaddr.h"
+#include "resolve.h"
+#include "conf-ssl.h"
+
 
 typedef struct _Conf_Oper
 {
@@ -44,18 +45,36 @@ typedef struct _Conf_Server
 	RES_STAT res_stat;		/* Status of the resolver */
 	int flags;			/* Flags */
 	CONN_ID conn_id;		/* ID of server connection or NONE */
-	ng_ipaddr_t bind_addr;		/* source address to use for outgoing connections */
+	ng_ipaddr_t bind_addr;		/* source address to use for outgoing
+					   connections */
 	ng_ipaddr_t dst_addr[2];	/* list of addresses to connect to */
+#ifdef SSL_SUPPORT
+	bool SSLConnect;		/* connect() using SSL? */
+#endif
+	char svs_mask[CLIENT_ID_LEN];	/* Mask of nick names that are
+					   services */
 } CONF_SERVER;
 
-typedef struct _Conf_Channel
-{
+
+#ifdef SSL_SUPPORT
+struct SSLOptions {
+	char *KeyFile;
+	char *CertFile;
+	char *DHFile;
+	array ListenPorts;
+	array KeyFilePassword;
+};
+#endif
+
+
+struct Conf_Channel {
 	char name[CHANNEL_NAME_LEN];	/* Name of the channel */
 	char modes[CHANNEL_MODE_LEN];	/* Initial channel modes */
 	char key[CLIENT_PASS_LEN];      /* Channel key ("password", mode "k" ) */
+	char topic[COMMAND_LEN];	/* Initial topic */
+	char keyfile[512];		/* Path and name of channel key file */
 	unsigned long maxusers;		/* maximum usercount for this channel, mode "l" */
-	array topic;			/* Initial topic */
-} CONF_CHANNEL;
+};
 
 
 #define CONF_SFLAG_ONCE	1		/* Delete this entry after next disconnect */
@@ -113,17 +132,28 @@ GLOBAL unsigned int Conf_Oper_Count;
 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
 
 /* Pre-defined channels */
-GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
-GLOBAL unsigned int Conf_Channel_Count;
+GLOBAL array Conf_Channels;
+
 /* Pre-defined channels only */
 GLOBAL bool Conf_PredefChannelsOnly;
 
 /* Are IRC operators allowed to always use MODE? */
 GLOBAL bool Conf_OperCanMode;
 
+/* If an IRC op gives chanop privileges without being a chanop,
+ * ircd2 will ignore the command. This enables a workaround:
+ * It masks the command as coming from the server */
+GLOBAL bool Conf_OperServerMode;
+
+/* Are remote IRC operators allowed to manage this server? */
+GLOBAL bool Conf_AllowRemoteOper;
+
 /* Disable all DNS functions? */
 GLOBAL bool Conf_NoDNS;
 
+/* Disable IDENT lookups, even when compiled with support for it */
+GLOBAL bool Conf_NoIdent;
+
 /*
  * try to connect to remote systems using the ipv6 protocol,
  * if they have an ipv6 address? (default yes)
@@ -133,11 +163,6 @@ GLOBAL bool Conf_ConnectIPv6;
 /* same as above, but for ipv4 hosts, default: yes  */
 GLOBAL bool Conf_ConnectIPv4;
 
-/* If an IRC op gives chanop privileges without being a chanop,
- * ircd2 will ignore the command. This enables a workaround:
- * It masks the command as coming from the server */
-GLOBAL bool Conf_OperServerMode;
-
 /* Maximum number of connections to this server */
 GLOBAL long Conf_MaxConnections;
 
@@ -158,10 +183,12 @@ GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
 GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
 
-GLOBAL bool Conf_EnableServer PARAMS(( char *Name, UINT16 Port ));
+GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port ));
 GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
-GLOBAL bool Conf_DisableServer PARAMS(( char *Name ));
-GLOBAL bool Conf_AddServer PARAMS(( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd ));
+GLOBAL bool Conf_DisableServer PARAMS(( const char *Name ));
+GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd ));
+
+GLOBAL bool Conf_IsService PARAMS((int ConfServer, const char *Nick));
 
 
 #endif

+ 38 - 30
src/ngircd/conn-func.c

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2008 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,8 +16,6 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: conn-func.c,v 1.12 2008/03/11 14:05:27 alex Exp $";
-
 #include "imp.h"
 #include <assert.h>
 #include <string.h>
@@ -33,8 +31,6 @@ static char UNUSED id[] = "$Id: conn-func.c,v 1.12 2008/03/11 14:05:27 alex Exp
 GLOBAL void
 Conn_UpdateIdle( CONN_ID Idx )
 {
-	/* Idle-Timer zuruecksetzen */
-
 	assert( Idx > NONE );
 	My_Connections[Idx].lastprivmsg = time( NULL );
 }
@@ -53,8 +49,7 @@ Conn_GetSignon(CONN_ID Idx)
 GLOBAL time_t
 Conn_GetIdle( CONN_ID Idx )
 {
-	/* Idle-Time einer Verbindung liefern (in Sekunden) */
-
+	/* Return Idle-Timer of a connetion */
 	assert( Idx > NONE );
 	return time( NULL ) - My_Connections[Idx].lastprivmsg;
 } /* Conn_GetIdle */
@@ -63,8 +58,6 @@ Conn_GetIdle( CONN_ID Idx )
 GLOBAL time_t
 Conn_LastPing( CONN_ID Idx )
 {
-	/* Zeitpunkt des letzten PING liefern */
-
 	assert( Idx > NONE );
 	return My_Connections[Idx].lastping;
 } /* Conn_LastPing */
@@ -73,11 +66,11 @@ Conn_LastPing( CONN_ID Idx )
 GLOBAL void
 Conn_SetPenalty( CONN_ID Idx, time_t Seconds )
 {
-	/* Penalty-Delay fuer eine Verbindung (in Sekunden) setzen;
-	 * waehrend dieser Zeit wird der entsprechende Socket vom Server
-	 * bei Lese-Operationen komplett ignoriert. Der Delay kann mit
-	 * dieser Funktion nur erhoeht, nicht aber verringert werden. */
-	
+	/* set Penalty-Delay for a socket.
+	 * during the penalty, the socket is ignored completely, no new
+	 * data is read. This function only increases the penalty, it is
+	 * not possible to decrease the penalty time.
+	 */
 	time_t t;
 	
 	assert( Idx > NONE );
@@ -105,8 +98,6 @@ Conn_ResetPenalty( CONN_ID Idx )
 GLOBAL void
 Conn_ClearFlags( void )
 {
-	/* Alle Connection auf "nicht-markiert" setzen */
-
 	CONN_ID i;
 
 	for( i = 0; i < Pool_Size; i++ ) My_Connections[i].flag = 0;
@@ -116,8 +107,6 @@ Conn_ClearFlags( void )
 GLOBAL int
 Conn_Flag( CONN_ID Idx )
 {
-	/* Ist eine Connection markiert (true) oder nicht? */
-
 	assert( Idx > NONE );
 	return My_Connections[Idx].flag;
 } /* Conn_Flag */
@@ -176,6 +165,17 @@ Conn_Options( CONN_ID Idx )
 
 
 /**
+ * Set connection option.
+ */
+GLOBAL void
+Conn_SetOption(CONN_ID Idx, int Option)
+{
+	assert(Idx > NONE);
+	Conn_OPTION_ADD(&My_Connections[Idx], Option);
+} /* Conn_SetOption */
+
+
+/**
  * Get the start time of the connection.
  * The result is the start time in seconds since 1970-01-01, as reported
  * by the C function time(NULL).
@@ -195,12 +195,12 @@ Conn_StartTime( CONN_ID Idx )
 	return 0;
 } /* Conn_StartTime */
 
-
+/**
+ * return number of bytes queued for writing
+ */
 GLOBAL size_t
 Conn_SendQ( CONN_ID Idx )
 {
-	/* Laenge der Daten im Schreibbuffer liefern */
-
 	assert( Idx > NONE );
 #ifdef ZLIB
 	if( My_Connections[Idx].options & CONN_ZIP )
@@ -211,31 +211,36 @@ Conn_SendQ( CONN_ID Idx )
 } /* Conn_SendQ */
 
 
+/**
+ * return number of messages sent on this connection so far
+ */
 GLOBAL long
 Conn_SendMsg( CONN_ID Idx )
 {
-	/* Anzahl gesendeter Nachrichten liefern */
 
 	assert( Idx > NONE );
 	return My_Connections[Idx].msg_out;
 } /* Conn_SendMsg */
 
 
+/**
+ * return number of (uncompressed) bytes sent
+ * on this connection so far
+ */
 GLOBAL long
 Conn_SendBytes( CONN_ID Idx )
 {
-	/* Anzahl gesendeter Bytes (unkomprimiert) liefern */
-
 	assert( Idx > NONE );
 	return My_Connections[Idx].bytes_out;
 } /* Conn_SendBytes */
 
 
+/**
+ * return number of bytes pending in read buffer
+ */
 GLOBAL size_t
 Conn_RecvQ( CONN_ID Idx )
 {
-	/* Laenge der Daten im Lesebuffer liefern */
-
 	assert( Idx > NONE );
 #ifdef ZLIB
 	if( My_Connections[Idx].options & CONN_ZIP )
@@ -246,21 +251,24 @@ Conn_RecvQ( CONN_ID Idx )
 } /* Conn_RecvQ */
 
 
+/**
+ * return number of messages received on this connection so far
+ */
 GLOBAL long
 Conn_RecvMsg( CONN_ID Idx )
 {
-	/* Anzahl empfangener Nachrichten liefern */
-
 	assert( Idx > NONE );
 	return My_Connections[Idx].msg_in;
 } /* Conn_RecvMsg */
 
 
+/**
+ * return number of (uncompressed) bytes received on this
+ * connection so far
+ */
 GLOBAL long
 Conn_RecvBytes( CONN_ID Idx )
 {
-	/* Anzahl empfangener Bytes (unkomprimiert) liefern */
-
 	assert( Idx > NONE );
 	return My_Connections[Idx].bytes_in;
 } /* Conn_RecvBytes */

+ 7 - 8
src/ngircd/conn-func.h

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2008 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,8 +8,6 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: conn-func.h,v 1.7 2007/10/04 15:03:56 alex Exp $
- *
  * Connection management: Global functions (header)
  */
 
@@ -22,7 +20,11 @@
  * containing connection handling functions. So other modules must only
  * include this conn-func.h header. */
 #ifndef CONN_MODULE
-#	include "conn.h"
+#include "conn.h"
+#else
+#define Conn_OPTION_ADD( x, opt )   ( (x)->options |= (opt) )
+#define Conn_OPTION_DEL( x, opt )   ( (x)->options &= ~(opt) )
+#define Conn_OPTION_ISSET( x, opt ) ( ((x)->options & (opt)) != 0)
 #endif
 
 
@@ -49,14 +51,11 @@ GLOBAL CONN_ID Conn_First PARAMS(( void ));
 GLOBAL CONN_ID Conn_Next PARAMS(( CONN_ID Idx ));
 
 GLOBAL UINT16 Conn_Options PARAMS(( CONN_ID Idx ));
+GLOBAL void Conn_SetOption PARAMS(( CONN_ID Idx, int Option ));
 
 GLOBAL void Conn_ResetWCounter PARAMS(( void ));
 GLOBAL long Conn_WCounter PARAMS(( void ));
 
-#define Conn_OPTION_ADD( x, opt )   ( (x)->options |= (opt) )
-#define Conn_OPTION_DEL( x, opt )   ( (x)->options &= ~(opt) )
-#define Conn_OPTION_ISSET( x, opt ) ( ((x)->options & (opt)) != 0)
-
 #endif
 
 

+ 712 - 0
src/ngircd/conn-ssl.c

@@ -0,0 +1,712 @@
+/*
+ * ngIRCd -- The Next Generation IRC Daemon
+ *
+ * SSL wrapper functions.
+ * Copyright (c) 2005-2008 Florian Westphal <fw@strlen.de>
+ */
+
+#include "portab.h"
+#include "imp.h"
+#include "conf-ssl.h"
+
+#ifdef SSL_SUPPORT
+
+#include "io.h"
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#define CONN_MODULE
+#include "conn.h"
+#include "conf.h"
+#include "conn-func.h"
+#include "conn-ssl.h"
+#include "log.h"
+
+#include "exp.h"
+#include "defines.h"
+
+extern struct SSLOptions Conf_SSLOptions;
+
+#ifdef HAVE_LIBSSL
+#include <openssl/err.h>
+#include <openssl/rand.h>
+
+static SSL_CTX * ssl_ctx;
+static DH *dh_params;
+
+static bool ConnSSL_LoadServerKey_openssl PARAMS(( SSL_CTX *c ));
+#endif
+
+#ifdef HAVE_LIBGNUTLS
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <gnutls/x509.h>
+
+#define DH_BITS 1024
+static gnutls_certificate_credentials_t x509_cred;
+static gnutls_dh_params_t dh_params;
+
+static bool ConnSSL_LoadServerKey_gnutls PARAMS(( void ));
+#endif
+
+static bool ConnSSL_Init_SSL PARAMS(( CONNECTION *c ));
+static int ConnectAccept PARAMS(( CONNECTION *c, bool connect ));
+static int ConnSSL_HandleError PARAMS(( CONNECTION *c, const int code, const char *fname ));
+
+#ifdef HAVE_LIBGNUTLS
+static char * openreadclose(const char *name, size_t *len)
+{
+	char *buf = NULL;
+	struct stat s;
+	ssize_t br;
+	int fd = open(name, O_RDONLY);
+	if (fd < 0) {
+		Log(LOG_ERR, "Could not open %s: %s", name, strerror(errno));
+		return NULL;
+	}
+	if (fstat(fd, &s)) {
+		Log(LOG_ERR, "Could not fstat %s: %s", name, strerror(errno));
+		goto out;
+	}
+	if (!S_ISREG(s.st_mode)) {
+		Log(LOG_ERR, "%s: Not a regular file", name);
+		goto out;
+	}
+	if (s.st_size <= 0) {
+		Log(LOG_ERR, "%s: invalid file length (size %ld <= 0)", name, (long) s.st_size);
+		goto out;
+	}
+	buf = malloc(s.st_size);
+	if (!buf) {
+		Log(LOG_ERR, "Could not malloc %lu bytes for file %s: %s", s.st_size, name, strerror(errno));
+		goto out;
+	}
+	br = read(fd, buf, s.st_size);
+	if (br != (ssize_t)s.st_size) {
+		Log(LOG_ERR, "Could not read file %s: read returned %ld, expected %ld: %s",
+			name, (long) br, (long) s.st_size, br == -1 ? strerror(errno):"short read?!");
+		memset(buf, 0, s.st_size);
+		free(buf);
+		buf = NULL;
+	} else {
+		*len = br;
+	}
+out:
+	close(fd);
+	return buf;
+}
+#endif
+
+
+#ifdef HAVE_LIBSSL
+static void
+LogOpenSSLError( const char *msg, const char *msg2 )
+{
+	unsigned long err = ERR_get_error();
+	char * errmsg = err ? ERR_error_string(err, NULL) : "Unable to determine error";
+
+	if (!msg) msg = "SSL Error";
+	if (msg2)
+		Log( LOG_ERR, "%s: %s: %s", msg, msg2, errmsg);
+	else
+		Log( LOG_ERR, "%s: %s", msg, errmsg);
+}
+
+
+static int
+pem_passwd_cb(char *buf, int size, int rwflag, void *password)
+{
+	array *pass = password;
+	int passlen;
+
+	(void)rwflag;		/* rwflag is unused if DEBUG is not set. */
+	assert(rwflag == 0);	/* 0 -> callback used for decryption.
+				 * See SSL_CTX_set_default_passwd_cb(3) */
+
+	passlen = (int) array_bytes(pass);
+
+	LogDebug("pem_passwd_cb buf size %d, array size %d", size, passlen);
+	assert(passlen >= 0);
+	if (passlen <= 0) {
+		Log(LOG_ERR, "pem_passwd_cb: password required, but not set");
+		return 0;
+	}
+	size = passlen > size ? size : passlen;
+	memcpy(buf, (char *)(array_start(pass)), size);
+	return size;
+}
+#endif
+
+
+static bool
+Load_DH_params(void)
+{
+#ifdef HAVE_LIBSSL
+	FILE *fp;
+	bool ret = true;
+
+	if (!Conf_SSLOptions.DHFile) {
+		Log(LOG_NOTICE, "Configuration option \"SSLDHFile\" not set!");
+		return false;
+	}
+	fp = fopen(Conf_SSLOptions.DHFile, "r");
+	if (!fp) {
+		Log(LOG_ERR, "%s: %s", Conf_SSLOptions.DHFile, strerror(errno));
+		return false;
+	}
+	dh_params = PEM_read_DHparams(fp, NULL, NULL, NULL);
+	if (!dh_params) {
+		Log(LOG_ERR, "%s: PEM_read_DHparams failed!",
+		    Conf_SSLOptions.DHFile);
+		ret = false;
+	}
+	fclose(fp);
+	return ret;
+#endif
+#ifdef HAVE_LIBGNUTLS
+	bool need_dhgenerate = true;
+	int err;
+	gnutls_dh_params_t tmp_dh_params;
+
+	err = gnutls_dh_params_init(&tmp_dh_params);
+	if (err < 0) {
+		Log(LOG_ERR, "gnutls_dh_params_init: %s", gnutls_strerror(err));
+		return false;
+	}
+	if (Conf_SSLOptions.DHFile) {
+		gnutls_datum_t dhparms;
+		size_t size;
+		dhparms.data = (unsigned char *) openreadclose(Conf_SSLOptions.DHFile, &size);
+		if (dhparms.data) {
+			dhparms.size = size;
+			err = gnutls_dh_params_import_pkcs3(tmp_dh_params, &dhparms, GNUTLS_X509_FMT_PEM);
+			if (err == 0)
+				need_dhgenerate = false;
+			else
+				Log(LOG_ERR, "gnutls_dh_params_init: %s", gnutls_strerror(err));
+
+			memset(dhparms.data, 0, size);
+			free(dhparms.data);
+		}
+	}
+	if (need_dhgenerate) {
+		Log(LOG_WARNING,
+		    "SSLDHFile not set, generating %u bit DH parameters. This may take a while ...",
+		    DH_BITS);
+		err = gnutls_dh_params_generate2(tmp_dh_params, DH_BITS);
+		if (err < 0) {
+			Log(LOG_ERR, "gnutls_dh_params_generate2: %s", gnutls_strerror(err));
+			return false;
+		}
+        }
+	dh_params = tmp_dh_params;
+	return true;
+#endif
+}
+
+
+void ConnSSL_Free(CONNECTION *c)
+{
+#ifdef HAVE_LIBSSL
+	SSL *ssl = c->ssl_state.ssl;
+	if (ssl) {
+		SSL_shutdown(ssl);
+		SSL_free(ssl);
+		c->ssl_state.ssl = NULL;
+	}
+#endif
+#ifdef HAVE_LIBGNUTLS
+	gnutls_session_t sess = c->ssl_state.gnutls_session;
+	if (Conn_OPTION_ISSET(c, CONN_SSL)) {
+		gnutls_bye(sess, GNUTLS_SHUT_RDWR);
+		gnutls_deinit(sess);
+	}
+#endif
+	assert(Conn_OPTION_ISSET(c, CONN_SSL));
+	/* can't just set bitmask to 0 -- there are other, non-ssl related flags, e.g. CONN_ZIP. */
+	Conn_OPTION_DEL(c, CONN_SSL_FLAGS_ALL);
+}
+
+
+bool
+ConnSSL_InitLibrary( void )
+{
+#ifdef HAVE_LIBSSL
+	SSL_CTX *newctx;
+
+	if (!ssl_ctx) {
+		SSL_library_init();
+		SSL_load_error_strings();
+	}
+
+	if (!RAND_status()) {
+		Log(LOG_ERR, "OpenSSL PRNG not seeded: /dev/urandom missing?");
+		/*
+		 * it is probably best to fail and let the user install EGD or a similar program if no kernel random device is available.
+		 * According to OpenSSL RAND_egd(3): "The automatic query of /var/run/egd-pool et al was added in OpenSSL 0.9.7";
+		 * so it makes little sense to deal with PRNGD seeding ourselves.
+		 */
+		return false;
+	}
+
+	newctx = SSL_CTX_new(SSLv23_method());
+	if (!newctx) {
+		LogOpenSSLError("SSL_CTX_new()", NULL);
+		return false;
+	}
+
+	if (!ConnSSL_LoadServerKey_openssl(newctx))
+		goto out;
+
+	SSL_CTX_set_options(newctx, SSL_OP_SINGLE_DH_USE|SSL_OP_NO_SSLv2);
+	SSL_CTX_set_mode(newctx, SSL_MODE_ENABLE_PARTIAL_WRITE);
+	SSL_CTX_free(ssl_ctx);
+	ssl_ctx = newctx;
+	Log(LOG_INFO, "%s initialized.", SSLeay_version(SSLEAY_VERSION));
+	return true;
+out:
+	SSL_CTX_free(newctx);
+	return false;
+#endif
+#ifdef HAVE_LIBGNUTLS
+	int err;
+	static bool initialized;
+	if (initialized) /* TODO: cannot reload gnutls keys: can't simply free x509 context -- it may still be in use */
+		return false;
+
+	err = gnutls_global_init();
+	if (err) {
+		Log(LOG_ERR, "gnutls_global_init(): %s", gnutls_strerror(err));
+		return false;
+	}
+	if (!ConnSSL_LoadServerKey_gnutls())
+		return false;
+	Log(LOG_INFO, "gnutls %s initialized.", gnutls_check_version(NULL));
+	initialized = true;
+	return true;
+#endif
+}
+
+
+#ifdef HAVE_LIBGNUTLS
+static bool
+ConnSSL_LoadServerKey_gnutls(void)
+{
+	int err;
+	const char *cert_file;
+
+	err = gnutls_certificate_allocate_credentials(&x509_cred);
+	if (err < 0) {
+		Log(LOG_ERR, "gnutls_certificate_allocate_credentials: %s", gnutls_strerror(err));
+		return false;
+	}
+
+	cert_file = Conf_SSLOptions.CertFile ? Conf_SSLOptions.CertFile:Conf_SSLOptions.KeyFile;
+	if (!cert_file) {
+		Log(LOG_NOTICE, "No SSL server key configured, SSL disabled.");
+		return false;
+	}
+
+	if (array_bytes(&Conf_SSLOptions.KeyFilePassword))
+		Log(LOG_WARNING,
+		    "Ignoring KeyFilePassword: Not supported by GNUTLS.");
+
+	if (!Load_DH_params())
+		return false;
+
+	gnutls_certificate_set_dh_params(x509_cred, dh_params);
+	err = gnutls_certificate_set_x509_key_file(x509_cred, cert_file, Conf_SSLOptions.KeyFile, GNUTLS_X509_FMT_PEM);
+	if (err < 0) {
+		Log(LOG_ERR, "gnutls_certificate_set_x509_key_file (cert %s, key %s): %s",
+				cert_file, Conf_SSLOptions.KeyFile ? Conf_SSLOptions.KeyFile : "(NULL)", gnutls_strerror(err));
+		return false;
+	}
+	return true;
+}
+#endif
+
+
+#ifdef HAVE_LIBSSL
+static bool
+ConnSSL_LoadServerKey_openssl(SSL_CTX *ctx)
+{
+	char *cert_key;
+
+	assert(ctx);
+	if (!Conf_SSLOptions.KeyFile) {
+		Log(LOG_NOTICE, "No SSL server key configured, SSL disabled.");
+		return false;
+	}
+
+	SSL_CTX_set_default_passwd_cb(ctx, pem_passwd_cb);
+	SSL_CTX_set_default_passwd_cb_userdata(ctx, &Conf_SSLOptions.KeyFilePassword);
+
+	if (SSL_CTX_use_PrivateKey_file(ctx, Conf_SSLOptions.KeyFile, SSL_FILETYPE_PEM) != 1) {
+		array_free_wipe(&Conf_SSLOptions.KeyFilePassword);
+		LogOpenSSLError("SSL_CTX_use_PrivateKey_file",  Conf_SSLOptions.KeyFile);
+		return false;
+	}
+
+	cert_key = Conf_SSLOptions.CertFile ? Conf_SSLOptions.CertFile:Conf_SSLOptions.KeyFile;
+	if (SSL_CTX_use_certificate_chain_file(ctx, cert_key) != 1) {
+		array_free_wipe(&Conf_SSLOptions.KeyFilePassword);
+		LogOpenSSLError("SSL_CTX_use_certificate_file", cert_key);
+		return false;
+	}
+
+	array_free_wipe(&Conf_SSLOptions.KeyFilePassword);
+
+	if (!SSL_CTX_check_private_key(ctx)) {
+		LogOpenSSLError("Server Private Key does not match certificate", NULL);
+		return false;
+	}
+	if (Load_DH_params()) {
+		if (SSL_CTX_set_tmp_dh(ctx, dh_params) != 1)
+			LogOpenSSLError("Error setting DH Parameters", Conf_SSLOptions.DHFile);
+		/* don't return false here: the non-DH modes will still work */
+		DH_free(dh_params);
+		dh_params = NULL;
+	}
+	return true;
+}
+
+
+#endif
+static bool
+ConnSSL_Init_SSL(CONNECTION *c)
+{
+	int ret;
+	assert(c != NULL);
+#ifdef HAVE_LIBSSL
+	if (!ssl_ctx)	/* NULL when library initialization failed */
+		return false;
+
+	assert(c->ssl_state.ssl == NULL);
+
+	c->ssl_state.ssl = SSL_new(ssl_ctx);
+	if (!c->ssl_state.ssl) {
+		LogOpenSSLError("SSL_new()", NULL);
+		return false;
+	}
+
+	ret = SSL_set_fd(c->ssl_state.ssl, c->sock);
+	if (ret != 1) {
+		LogOpenSSLError("SSL_set_fd()", NULL);
+		ConnSSL_Free(c);
+		return false;
+	}
+#endif
+#ifdef HAVE_LIBGNUTLS
+	ret = gnutls_set_default_priority(c->ssl_state.gnutls_session);
+	if (ret < 0) {
+		Log(LOG_ERR, "gnutls_set_default_priority: %s", gnutls_strerror(ret));
+		ConnSSL_Free(c);
+		return false;
+	}
+	/*
+	 * The intermediate (long) cast is here to avoid a warning like:
+	 * "cast to pointer from integer of different size" on 64-bit platforms.
+	 * There doesn't seem to be an alternate GNUTLS API we could use instead, see e.g.
+	 * http://www.mail-archive.com/help-gnutls@gnu.org/msg00286.html
+	 */
+	gnutls_transport_set_ptr(c->ssl_state.gnutls_session, (gnutls_transport_ptr_t) (long) c->sock);
+	ret = gnutls_credentials_set(c->ssl_state.gnutls_session, GNUTLS_CRD_CERTIFICATE, x509_cred);
+	if (ret < 0) {
+		Log(LOG_ERR, "gnutls_credentials_set: %s", gnutls_strerror(ret));
+		ConnSSL_Free(c);
+		return false;
+	}
+	gnutls_dh_set_prime_bits(c->ssl_state.gnutls_session, DH_BITS);
+#endif
+	Conn_OPTION_ADD(c, CONN_SSL);
+	return true;
+}
+
+
+bool
+ConnSSL_PrepareConnect(CONNECTION *c, UNUSED CONF_SERVER *s)
+{
+	bool ret;
+#ifdef HAVE_LIBGNUTLS
+	int err;
+
+	err = gnutls_init(&c->ssl_state.gnutls_session, GNUTLS_CLIENT);
+	if (err) {
+		Log(LOG_ERR, "gnutls_init: %s", gnutls_strerror(err));
+		return false;
+        }
+#endif
+	ret = ConnSSL_Init_SSL(c);
+	if (!ret)
+		return false;
+	Conn_OPTION_ADD(c, CONN_SSL_CONNECT);
+#ifdef HAVE_LIBSSL
+	assert(c->ssl_state.ssl);
+	SSL_set_verify(c->ssl_state.ssl, SSL_VERIFY_NONE, NULL);
+#endif
+	return true;
+}
+
+
+/*
+  Check an Handle Error return code after failed calls to ssl/tls functions.
+  OpenSSL:
+  SSL_connect(), SSL_accept(), SSL_do_handshake(), SSL_read(), SSL_peek(), or SSL_write() on ssl.
+  GNUTLS:
+  gnutlsssl_read(), gnutls_write() or gnutls_handshake().
+  Return: -1 on fatal error, 0 if we can try again later.
+ */
+static int
+ConnSSL_HandleError( CONNECTION *c, const int code, const char *fname )
+{
+#ifdef HAVE_LIBSSL
+	int ret = SSL_ERROR_SYSCALL;
+	unsigned long sslerr;
+	int real_errno = errno;
+
+	ret = SSL_get_error(c->ssl_state.ssl, code);
+	switch (ret) {
+	case SSL_ERROR_WANT_READ:
+		io_event_del(c->sock, IO_WANTWRITE);
+		Conn_OPTION_ADD(c, CONN_SSL_WANT_READ);
+		return 0;	/* try again later */
+	case SSL_ERROR_WANT_WRITE:
+		io_event_del(c->sock, IO_WANTREAD);
+		Conn_OPTION_ADD(c, CONN_SSL_WANT_WRITE); /* fall through */
+	case SSL_ERROR_NONE:
+		return 0;	/* try again later */
+	case SSL_ERROR_ZERO_RETURN:
+		LogDebug("TLS/SSL connection shut down normally");
+		break;
+	/*
+	SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT, SSL_ERROR_WANT_X509_LOOKUP
+	*/
+	case SSL_ERROR_SYSCALL:
+		sslerr = ERR_get_error();
+		if (sslerr) {
+			Log( LOG_ERR, "%s: %s", fname, ERR_error_string(sslerr, NULL ));
+		} else {
+
+			switch (code) {	/* EOF that violated protocol */
+			case 0:
+				Log(LOG_ERR, "%s: Client Disconnected", fname );
+				break;
+			case -1: /* low level socket I/O error, check errno */
+				Log(LOG_ERR, "%s: %s", fname, strerror(real_errno));
+			}
+		}
+		break;
+	case SSL_ERROR_SSL:
+		LogOpenSSLError("TLS/SSL Protocol Error", fname);
+		break;
+	default:
+		Log( LOG_ERR, "%s: Unknown error %d!", fname, ret);
+	}
+	ConnSSL_Free(c);
+	return -1;
+#endif
+#ifdef HAVE_LIBGNUTLS
+	switch (code) {
+	case GNUTLS_E_AGAIN:
+	case GNUTLS_E_INTERRUPTED:
+		if (gnutls_record_get_direction(c->ssl_state.gnutls_session)) {
+			Conn_OPTION_ADD(c, CONN_SSL_WANT_WRITE);
+			io_event_del(c->sock, IO_WANTREAD);
+		} else {
+			Conn_OPTION_ADD(c, CONN_SSL_WANT_READ);
+			io_event_del(c->sock, IO_WANTWRITE);
+		}
+		break;
+	default:
+		assert(code < 0);
+		if (gnutls_error_is_fatal(code)) {
+			Log(LOG_ERR, "%s: %s", fname, gnutls_strerror(code));
+			ConnSSL_Free(c);
+			return -1;
+		}
+	}
+	return 0;
+#endif
+}
+
+
+static void
+ConnSSL_LogCertInfo( CONNECTION *c )
+{
+#ifdef HAVE_LIBSSL
+	SSL *ssl = c->ssl_state.ssl;
+
+	assert(ssl);
+
+	Log(LOG_INFO, "New %s connection using cipher %s on socket %d.",
+		SSL_get_version(ssl), SSL_get_cipher(ssl), c->sock);
+#endif
+#ifdef HAVE_LIBGNUTLS
+	gnutls_session_t sess = c->ssl_state.gnutls_session;
+	gnutls_cipher_algorithm_t cipher = gnutls_cipher_get(sess);
+
+	Log(LOG_INFO, "New %s connection using cipher %s-%s on socket %d.",
+	    gnutls_protocol_get_name(gnutls_protocol_get_version(sess)),
+	    gnutls_cipher_get_name(cipher),
+	    gnutls_mac_get_name(gnutls_mac_get(sess)), c->sock);
+#endif
+}
+
+
+/*
+ Accept incoming SSL connection.
+ Return Values:
+	 1: SSL Connection established
+	 0: try again
+	-1: SSL Connection not established due to fatal error.
+*/
+int
+ConnSSL_Accept( CONNECTION *c )
+{
+	assert(c != NULL);
+	if (!Conn_OPTION_ISSET(c, CONN_SSL)) {
+#ifdef HAVE_LIBGNUTLS
+		int err = gnutls_init(&c->ssl_state.gnutls_session, GNUTLS_SERVER);
+		if (err) {
+			Log(LOG_ERR, "gnutls_init: %s", gnutls_strerror(err));
+			return false;
+		}
+#endif
+		LogDebug("ConnSSL_Accept: Initializing SSL data");
+		if (!ConnSSL_Init_SSL(c))
+			return -1;
+	}
+	return ConnectAccept(c, false );
+}
+
+
+int
+ConnSSL_Connect( CONNECTION *c )
+{
+	assert(c != NULL);
+#ifdef HAVE_LIBSSL
+	assert(c->ssl_state.ssl);
+#endif
+	assert(Conn_OPTION_ISSET(c, CONN_SSL));
+	return ConnectAccept(c, true);
+}
+
+
+/* accept/connect wrapper. if connect is true, connect to peer, otherwise wait for incoming connection */
+static int
+ConnectAccept( CONNECTION *c, bool connect)
+{
+	int ret;
+#ifdef HAVE_LIBSSL
+	SSL *ssl = c->ssl_state.ssl;
+	assert(ssl != NULL);
+
+	ret = connect ? SSL_connect(ssl) : SSL_accept(ssl);
+	if (1 != ret)
+		return ConnSSL_HandleError(c, ret, connect ? "SSL_connect": "SSL_accept");
+#endif
+#ifdef HAVE_LIBGNUTLS
+	(void) connect;
+	ret = gnutls_handshake(c->ssl_state.gnutls_session);
+	if (ret)
+		return ConnSSL_HandleError(c, ret, "gnutls_handshake");
+#endif /* _GNUTLS */
+	Conn_OPTION_DEL(c, (CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ|CONN_SSL_CONNECT));
+	ConnSSL_LogCertInfo(c);
+	return 1;
+}
+
+
+ssize_t
+ConnSSL_Write(CONNECTION *c, const void *buf, size_t count)
+{
+	ssize_t bw;
+
+	Conn_OPTION_DEL(c, CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ);
+
+	assert(count > 0);
+#ifdef HAVE_LIBSSL
+	bw = (ssize_t) SSL_write(c->ssl_state.ssl, buf, count);
+#endif
+#ifdef HAVE_LIBGNUTLS
+	bw = gnutls_write(c->ssl_state.gnutls_session, buf, count);
+#endif
+	if (bw > 0)
+		return bw;
+	if (ConnSSL_HandleError( c, bw, "ConnSSL_Write") == 0)
+		errno = EAGAIN; /* try again */
+	return -1;
+}
+
+
+ssize_t
+ConnSSL_Read(CONNECTION *c, void * buf, size_t count)
+{
+	ssize_t br;
+
+	Conn_OPTION_DEL(c, CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ);
+#ifdef HAVE_LIBSSL
+        br = (ssize_t) SSL_read(c->ssl_state.ssl, buf, count);
+	if (br > 0)	/* on EOF we have to call ConnSSL_HandleError(), see SSL_read(3) */
+		return br;
+#endif
+#ifdef HAVE_LIBGNUTLS
+	br = gnutls_read(c->ssl_state.gnutls_session, buf, count);
+	if (br >= 0)	/* on EOF we must _not_ call ConnSSL_HandleError, see gnutls_record_recv(3) */
+		return br;
+#endif
+	/* error on read: switch ConnSSL_HandleError() return values -> 0 is "try again", so return -1 and set EAGAIN */
+	if (ConnSSL_HandleError(c, br, "ConnSSL_Read") == 0) {
+		errno = EAGAIN;
+		return -1;
+	}
+	return 0;
+}
+
+
+bool
+ConnSSL_GetCipherInfo(CONNECTION *c, char *buf, size_t len)
+{
+#ifdef HAVE_LIBSSL
+	char *nl;
+	SSL *ssl = c->ssl_state.ssl;
+
+	if (!ssl)
+		return false;
+	*buf = 0;
+	SSL_CIPHER_description(SSL_get_current_cipher(ssl), buf, len);
+	nl = strchr(buf, '\n');
+	if (nl)
+		*nl = 0;
+	return true;
+#endif
+#ifdef HAVE_LIBGNUTLS
+	if (Conn_OPTION_ISSET(c, CONN_SSL)) {
+		const char *name_cipher, *name_mac, *name_proto, *name_keyexchange;
+		unsigned keysize;
+
+		gnutls_session_t sess = c->ssl_state.gnutls_session;
+		gnutls_cipher_algorithm_t cipher = gnutls_cipher_get(sess);
+		name_cipher = gnutls_cipher_get_name(cipher);
+		name_mac = gnutls_mac_get_name(gnutls_mac_get(sess));
+		keysize = gnutls_cipher_get_key_size(cipher) * 8;
+		name_proto = gnutls_protocol_get_name(gnutls_protocol_get_version(sess));
+		name_keyexchange = gnutls_kx_get_name(gnutls_kx_get(sess));
+
+		return snprintf(buf, len, "%s-%s%15s Kx=%s      Enc=%s(%u) Mac=%s",
+			name_cipher, name_mac, name_proto, name_keyexchange, name_cipher, keysize, name_mac) > 0;
+	}
+	return false;
+#endif
+}
+
+
+#endif /* SSL_SUPPORT */
+/* -eof- */
+
+

+ 28 - 0
src/ngircd/conn-ssl.h

@@ -0,0 +1,28 @@
+/*
+ * ngIRCd -- The Next Generation IRC Daemon
+ * SSL wrapper functions. (header)
+ */
+
+#ifndef conn_ssl_h
+#define conn_ssl_h
+
+#include "conf-ssl.h"
+#include "conn.h"
+#include "conf.h"
+
+#ifdef SSL_SUPPORT
+GLOBAL void ConnSSL_Free PARAMS(( CONNECTION *c ));
+
+GLOBAL bool ConnSSL_PrepareConnect PARAMS(( CONNECTION *c, CONF_SERVER *s ));
+
+GLOBAL int ConnSSL_Accept PARAMS(( CONNECTION *c ));
+GLOBAL int ConnSSL_Connect PARAMS(( CONNECTION *c ));
+
+GLOBAL ssize_t ConnSSL_Write PARAMS(( CONNECTION *c, const void *buf, size_t count));
+GLOBAL ssize_t ConnSSL_Read PARAMS(( CONNECTION *c, void *buf, size_t count));
+
+GLOBAL bool ConnSSL_GetCipherInfo PARAMS(( CONNECTION *c, char *buf, size_t len ));
+#endif /* SSL_SUPPORT */
+#endif /* conn_ssl_h */
+
+/* -eof- */

+ 0 - 0
src/ngircd/conn-zip.c


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