ngircd-21/0000755000175000116100000000000012234274323007543 500000000000000ngircd-21/AUTHORS0000644000175000116100000000340312216663075010541 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2013 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- AUTHORS and CONTRIBUTORS -- Note: If you have critics, patches or something else, please feel free to post a mail to the ngIRCd mailing list: (please see for details). Don't mail the people listed here directly, if possible! Main Authors ~~~~~~~~~~~~ Alexander Barton Florian Westphal Contributors ~~~~~~~~~~~~ Ali Shemiran Ask Bjørn Hansen Benjamin Pineau Brandon Beresini Brett Smith Brian Collins Bryan Caldwell Christoph Biedl DNS Dana Dahlstrom David Kingston Eric Grunow Federico G. Schwindt Gabor Adam Toth Goetz Hoffart Ilja Osthoff Jari Aalto Neale Pickett Rolf Eike Beer Scott Perry Sean Reifschneider Sebastian Köhler Tassilo Schweyer William Pitcock xor Code snippets ~~~~~~~~~~~~~ J. Kercheval: pattern matching functions Patrick Powell : snprintf()-function Andrew Tridgell & Martin Pool: strl{cpy|cat}()-functions ngircd-21/install-sh0000755000175000000000000003253712005170750011463 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # 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 file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; 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 "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. 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 `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src 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 '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi 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 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 if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # 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 eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $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 fi fi if test -n "$dir_arg"; then { 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 # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $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 # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $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 $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: ngircd-21/Makefile.in0000644000175000116100000005736512234274154011552 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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-2013 Alexander Barton (alex@barton.de) and Contributors # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ 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 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-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 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu SUBDIRS = doc src man contrib EXTRA_DIST = autogen.sh configure.ng .mailmap all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) 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; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -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 $(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 $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .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-lzma dist-shar dist-tarZ dist-xz 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-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 clean-local: osxpkg-clean rm -f build-stamp* maintainer-clean-local: rm -rf autom4te.cache rm -f Makefile.in Makefile aclocal.m4 configure configure.ac rm -f ar-lib mkinstalldirs missing depcomp install-sh rm -f config.log debian testsuite: cd src/testsuite && make check lint: cd src/ngircd && make lint srcdoc: cd doc && make srcdoc have-xcodebuild: @xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -list \ >/dev/null 2>&1 \ || ( echo; echo "Error: \"xcodebuild\" not found!"; echo; exit 1 ) have-packagemaker: @packagemaker >/dev/null 2>&1; [ $$? -le 1 ] \ || ( echo; echo "Error: \"packagemaker\" not found!"; echo; exit 2) xcode: have-xcodebuild rel=`git describe|sed -e 's/rel-//g'|sed -e 's/-/~/'`; \ 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 \ -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 -i osxpkg: have-packagemaker osxpkg-dest cd contrib/MacOSX && packagemaker --no-recommend \ --doc ngIRCd.pmdoc \ --out ../../$(distdir).mpkg rm -f $(distdir).mpkg.zip zip -ro9 $(distdir).mpkg.zip $(distdir).mpkg make osxpkg-clean osxpkg-clean: [ ! -e ngircd.dest ] || sudo -n rm -rf ngircd.dest rm -rf ngircd.dest $(distdir).mpkg osxpkg-dest: have-xcodebuild osxpkg-clean 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 sudo chown -R root:wheel ngircd.dest .PHONY: deb have-packagemaker have-xcodebuild lint osxpkg osxpkg-clean \ osxpkg-dest rpm srcdoc testsuite xcode xcode-clean # -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: ngircd-21/ChangeLog0000644000175000116100000027522012234273205011243 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2013 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- ChangeLog -- ngIRCd 21 (2013-10-30) - ./contrib/Debian/ngircd.init: Make sure no stale PID file is left over when (re-)starting ngIRCd. - Change ./contrib/platformtest.sh and update ./doc/Platforms.txt to allow usernames up to 8 characters. - Call arc4random_stir() in forked subprocesses, when available. This is required by FreeBSD <10 and current NetBSD at least to correctly initialize the "arc4" random number generator on these platforms. - Update our own Debian package configuration and fix the default path of the "HelpFile" of the "full" package variants. ngIRCd 21~rc2 (2013-10-20) - Report the correct configuration file name on configuration errors, support longer configuration lines, and warn when lines are truncated. - Use arc4random() function to generate "random" numbers, when available. - platformtest.sh: Detect clang compiler, and clean up GIT source tree before building (when possible). - Update (date of) manual pages. - Update "Upgrade Information" in INSTALL file, add more systems to doc/Platforms.txt, and fix spelling in NEWS and ChangeLog files =:) - Fix remaining compiler warnings on OpenBSD. ngIRCd 21~rc1 (2013-10-05) - Actually KILL clients on GLINE/KLINE. (Closes bug #156) - Adjust log messages for invalid and spoofed prefixes, which cleans up logging of commands related to already KILL'ed clients. And don't forward KILL commands for (already) unknown clients any more to prevent unnecessary duplicates. - Add support to show all user links using the "STATS L" (uppercase) command (restricted to IRC Operators). - Fixed blocking of server reconnects in some error configurations. - Don't ignore SSL-related errors during startup any more: abort startup when SSL is requested by the configuration but can't be initialized and don't continue only listening on plain text communication ports. (Closes bug #163) - Implement configurable SSL cipher list selection for GnuTLS and OpenSSL using the new configuration option "CipherList". In addition, this changes the defaults to more secure values: "HIGH:!aNULL:@STRENGTH" for OpenSSL, and "SECURE128" for GnuTLS. - Fix "TRACE": Correctly return ERR_NEEDMOREPARAMS(461) (which basically is "syntax error") when there are too many parameters. - Clean up lots of permission and parameter checks in functions handling IRC commands; and more consistently add penalty times on errors. - Fix error numeric of WHOIS when no nick name has been provided: as per RFC it should be ERR_NONICKNAMEGIVEN(431). - Only log "IDENT ... no result" messages when an IDENT looked took place and didn't return any data, not when IDENT has been disabled. - Show connection flag "s" (SSL) in RPL_TRACE{LINK|SERVER} messages: now you can check if a server-to-server link is SSL-encrypted or not using the IRC "TRACE" command. - Correctly discard supplementary groups on server startup. - Save client IP address text for "WebIRC" users and correctly display it on WHOIS, for example. (Closes bug #159) - Implement the new configuration option "DefaultUserModes" which lists user modes that become automatically set on new local clients right after login. Please note that only modes can be set that the client could set on itself, so you can't set "a" (away) or "o" (IRC Op), for example! User modes "i" (invisible) or "x" (cloaked) etc. are "interesting", though. (Closes bug #160) - Add support for the new METADATA "account" property, which allows services to automatically identify users after netsplits and across service restarts. - Enforce "penalty times" on error conditions more consistently and in more places. Now most error codes sent back from the IRC server to the client should result in a 2 second "penalty". - Implement a new configuration option "AllowedChannelTypes" that lists all allowed channel types (channel prefixes) for newly created channels on the local server. By default, all supported channel types are allowed. If set to the empty string, local clients can't create new channels at all, which equals the old "PredefChannelsOnly = yes" setting. This change deprecates the "PredefChannelsOnly" variable, too, but it is still supported and translated to the appropriate "AllowedChannelTypes" setting. When the old "PredefChannelsOnly" variable is processed, a warning message is logged. (Closes bug #152) - Add support for "client certificate fingerprinting". When a client passes an SSL certificate to the server, the "fingerprint" will be forwarded in the network which enables IRC services to identify the user using this certificate and not using passwords. - IRC Operator names, as defined in ngircd.conf, are logged now when handling successful OPER commands. - Some error conditions while handling IRC commands, like "permission denied" or "need more parameters", result in more penalty times. - The numeric replies of some commands became split too early which resulted in more numeric reply lines than necessary. - Implement a new configuration option "IncludeDir" in the "[Options]" section that can be used to specify a directory which can contain further configuration files and configuration file snippets matching the pattern "*.conf". These files are read in after the main server configuration file ("ngircd.conf" by default) has been read in and parsed. The default is "$SYSCONFDIR/ngircd.conf.d", so that it is possible to adjust the configuration only by placing additional files into this directory. (Closes bug #157) - Fix use-after-free in the Lists_CheckReason() function, which is used to check if a client is a member of a particular ban/invite/... list. - Xcode: fix detection of host OS, vendor, and CPU type, and update project settings for Xcode 5. - OS X PackageMaker: use relative path names in project files and package with correct file permissions (requires root privileges on "make"). - Add Travis-CI configuration file (".travis.yml") to project. - Look for possible cloaked Masks in Lists. Users with +x user mode can be banned with their cloaked hostname now. - Don't read SSL client data before DNS resolver is finished which could have resulted in discarding the resolved client hostname and IDENT reply afterwards, because in some situations (timing dependent) the NICK and USER commands could have already been read in from the client, stored in the buffer, and been processed. Thanks to Julian Brost for reporting the issue and testing, and to Federico G. Schwindt for helping to debug it! - Increase password length limit to 64 characters. (Closes bug #154) - doc/Services.txt: Update Anope status and URL. - Clean up Xcode project file, remove outdated files, add missing ones. - Update Doxygen configuration file. - configure: search for iconv_open as well as libiconv_open, because on some installations iconv_open() is actually libiconv_open(). iconv_open() is the glibc version while libiconv_open() is the libiconv version, now both variants are supported. (Closes bug #151) - ngIRCd now accepts user names including "@" characters, saves the unmodified name for authentication but stores only the part in front of the "@" character as "IRC user name". And the latter is how ircd2.11, Bahamut, and irc-seven behave as well. (Closes bug #155) - Lots of IRC "information functions" like ADMIN, INFO, ... now accept server masks and names of connected users (in addition to server names) for specifying the target server of the command. (Closes bug #153) - Implement a new configuration option "IdleTimeout" in the "[Limits]" section of the configuration file which can be used to set a timeout in seconds after which the whole daemon will shutdown when no more connections are left active after handling at least one client. The default is 0, "never". This can be useful for testing or when ngIRCd is started using "socket activation" with systemd(8), for example. - Implement support for systemd(8) "socket activation". - contrib/README: add description for more files. - Enable WHOIS to display information about IRC Services using the new numeric 310(RPL_WHOISSERVICE) This numeric is used for this purpose by InspIRCd, for example -- but as usual, other numerics are in use, too, like 613 in UltimateIRCd ... Please note that neither the Operator (+o) not the "bot status" (+B) of an IRC service is displayed in the output. - Exit message: use singular & plural :-) - autogen.sh: Check for autoconf/automake wrapper scripts - Add missing punctuation marks in log messages, adjust some severity levels, and make SSL-related messages more readable. - AUTHORS file: Update list of contributors. - Update systemd(8) example configuration files in ./contrib/ directory: the "ngircd.service" file now uses the "forking" service type which enhances the log messages shown by "systemctl status ngircd.service", and the new "ngircd.socket" file configures a systemd socket that configures a socket for ngIRCd and launches the daemon on demand. - Enhance help system and the HELP command: now a "help text file" can be set using the new configuration option "HelpFile" ("global" section), which is read in and parsed on server startup and configuration reload, and then is used to output individual help texts to specific topics. Please see the file ./doc/Commands.txt for details. ngIRCd 20.3 (2013-08-23) - Security: Fix a denial of service bug (server crash) which could happen when the configuration option "NoticeAuth" is enabled (which is NOT the default) and ngIRCd failed to send the "notice auth" messages to new clients connecting to the server (CVE-2013-5580). ngIRCd 20.2 (2013-02-15) - Security: Fix a denial of service bug in the function handling KICK commands that could be used by arbitrary users to to crash the daemon (CVE-2013-1747). - WHO command: Use the currently "displayed hostname" (which can be cloaked!) for hostname matching, not the real one. In other words: don't display all the cloaked users on a specific real hostname! - configure: The header file "netinet/in_systm.h" already is optional in ngIRCd, so don't require it in the configure script. Now ngIRCd can be built on Minix 3 again :-) - Return better "Connection not registered as server link" errors: Now ngIRCd returns a more specific error message for numeric ERR_NOTREGISTERED(451) when a regular user tries to use a command that isn't allowed for users but for servers. - Don't report ERR_NEEDMOREPARAMS(461) when a MDOE command with more modes than nicknames is handled, as well as for channel limit and key changes without specifying the limit or key parameters. This is how a lot (all?) other IRC servers behave, including ircd2.11, InspIRCd, and ircd-seven. And because of clients (tested with Textual and mIRC) sending bogus MODE commands like "MODE -ooo nick", end-users got the expected result as well as correct but misleading error messages ... - Correctly detect when SSL subsystem must be initialized and take outgoing connections (server links!) into account, too. - autogen.sh: Enforce serial test harness on GNU automake >=1.13. The new parallel test harness which is enabled by default starting with automake 1.13 isn't compatible with our test suite. And don't use "egrep -o", instead use "sed", because it isn't portable and not available on OpenBSD, for example. ngIRCd 20.1 (2013-01-02) - Allow ERROR command on server and service links only, ignore them and add a penalty time on all other link types. - Enforced mode setting by IRC Operators: Only check the channel user modes of the initiator if he is joined to the channel and not an IRC operator enforcing modes (which requires the configuration option "OperCanUseMode" to be enabled), because trying to check channel user modes of a non-member results in an assertion when running with debug code or could crash the daemon otherwise. This closes bug #147, thanks to James Kirwill for tracking this down! - Fix build system to cope with spaces in path names. - Code cleanups, mostly to fix build warnings on Cygwin. ngIRCd 20 (2012-12-17) - Allow user names ("INDENT") up to 20 characters when ngIRCd has not been configured for "strict RFC mode". This is useful if you are using external (PAM) authentication mechanisms that require longer user names. Patch suggested by Brett Smith , see . ngIRCd 20~rc2 (2012-12-02) - Rework cloaked hostname handling and implement the "METADATA cloakhost" subcommand: Now ngIRCd uses two fields internally, one to store the "real" hostname and one to save the "cloaked" hostname. This allows "foreign servers" (aka "IRC services") to alter the real and cloaked hostnames of clients without problems, even when the user itself issues additional "MODE +x" and "MODE -x" commands. - RPL_UMODEIS: send correct target name, even on server links. - Update platformtest.sh to follow autoconf changes and only generate the "configure" script when it is missing. - Fix the test suite to correctly execute test scripts even when stdout is redirected. - Fix some compiler warnings on NetBSD and OpenBSD. ngIRCd 20~rc1 (2012-11-11) - Update doc/Services.txt: describe the upcoming version of Anope 1.9.8, then including a protocol module for ngIRCd. And remove our own patches in ./contrib/Anope because they aren't supported any more ... - Implement new "METADATA" command which can be used by remote servers and IRC services to update client metadata like the client info text ("real name"), user name, and hostname, and use this command to configure an cloaked hostname (user mode "+x") on remote servers: This prevents "double cloaking" of hostnames and even cloaked hostnames are in sync on all servers supporting "METADATA" now. - Fix error message when trying to join non-predefined channels and the "PredefChannelsOnly" configuration option is set. - Implement new IRC "SVSNICK" command to allow remote servers (and IRC services) to change nicknames of already registered users. The SVSNICK command itself doesn't change the nickname, but it becomes forwarded to the server to which the user is connected to. And then this server initiates the real nickname changing using regular NICK commands. This allows to run mixed networks with old servers not supporting the SVSNICK command, because SVSNICK commands for nicknames on such servers are silently ignored and don't cause a desynchronization of the network. - Make server reconnect time a little bit more random, so that two servers trying to connect to each other asynchronously don't try this in exactly the same time periods and kick each other off ... - Don't accept connections for servers already being linked: there was a time frame that could result in one connection overwriting the other, e. g. the incoming connection overwriting the status of the outgoing one. And this could lead to all kind of weirdness (even crashes!) later on: now such incoming connections are dropped. - New configuration option "MaxListSize" to configure the maximum number of channels returned by a LIST command. The default is 100, as before. - Implement user mode "b", "block messages": when a user has set mode "b", all private messages and notices to this user are blocked if they don't originate from a registered user, an IRC Op, server or service. The originator gets an error numeric sent back in this case, ERR_NONONREG_MSG (486), which is used by UnrealIRCd, too. (Closes #144) - WHOIS: Not only show RPL_WHOISHOST_MSG to local IRC operators, but show it to all IRC operators in the network. And don't show it to anybody if the "more privacy" configuration option is enabled. (Closes #134) - Test suite: make expect scripts more verbose displaying dots for each reply of the server that it is waiting for. - WHOIS: Implement numeric RPL_WHOISMODES_MSG (379) and show user modes in the reply of the WHOIS command for the user himself or, if MorePrivacy isn't set, for request initiated by an IRC operator. (Closes #129) - Implement channel mode "V" (invite disallow): If the new channel mode "V" is set, the INVITE command becomes invalid and all clients get the new ERR_NOINVITE_MSG (518) reply. (Closes #143) - KICK-protect IRC services. - Implement channel mode "Q" and user mode "q": Both modes protect users from channel kicks: only IRC operators and servers can kick users having mode "q" or in channels with mode "Q". (Closes #141) - Debian: require "telnet" or "telnet-ssl" for building and enable CHARCONV in ngircd-full[-dbg] variants. - Send RPL_REHASHING (382) numeric if a REHASH command was accepted. - Fix spelling and variable names in some log messages. - Allow users to "cloak" their hostname only when the configuration variable "CloakHostModeX" (introduced in 19.2) is set. Otherwise, only IRC operators, other servers, and services are allowed to set the user mode "+x": this prevents regular users from changing their hostmask to the name of the IRC server itself, which confused quite a few people ;-) (Closes #133) - New configuration option "OperChanPAutoOp": If disabled, IRC operators don't become channel operators in persistent channels when joining. Enabled by default, which has been the behavior of ngIRCd up to this patch. (Closes #135) - Allow IRC operators to see secret (+s) channels in LIST command as long as the "MorePrivacy" configuration option isn't enabled in the configuration file. (Closes #136) - Enhance build system: Support new (>=1.12) and old (<=1.11) GNU automake versions, update checks for required and optional features, enable colored test output of automake (if available), rename configure.in to more modern configure.ac, include .mailmap and all build-system files in distribution archives and no longer require a GIT tree to detect the correct version string. - Update documentation: add doc/Contributing.txt and include version numbers in doc/Modes.txt. - Free all listen ports on initialization: now listen ports can be reconfigured on runtime using a configuration reload. - Initialize SSL when needed only, and disable SSL on errors. - Implement new (optional) IRC+ "CHARCONV" command to set a client character set that the server translates all messages to/from UTF-8. This feature requires the "libiconv" library and must be enabled using the new "--with-iconv" option of the ./configure script. See doc/Protocol.txt for details. (Closes #109) - Allow limited punctuation in usernames, for better PAM integration. - Correctly re-initialize signal handlers on RESTART commands. - Show a warning on startup if the configuration file is not a full path: ngIRCd is a long-running process and changes its working directory to "/" to not block mounted filesystems and the like when running as daemon ("not in the foreground"); therefore the path to the configuration file must be relative to "/" (or the chroot() directory), which basically is "not relative", to ensure that "kill -HUP" and the "REHASH" command work as expected later on. (Closes #127) - Make the "&SERVER" channel definable in a [Channel] configuration block, which enables server operators to overwrite the built-in topic and channel modes. (Closes #131) - Don't limit list size of "WHO #channel" commands, because it makes no sense to not return all the users in that channel, so I removed the check. But if there are more than MAX_RPL_WHO(25) replies, the client requesting the list will be "penalized" one second more, then 2 in total. (Closes #125) - Make ngIRCd buildable using the kqueue() IO interface on FreeBSD 4.x. - Fix the "NoticeAuth" configuration option when using SSL connections and enhance the message to show the hostname and IDENT reply of the client. - Introduce numeric RPL_HOSTHIDDEN_MSG (396): This numeric is sent to the client each time it changes its displayed hostname using "MODE +/-x", and if "CloakHost" is set right after the MOTD has been sent. - Fix USERHOST not displaying the correctly cloaked hostname. - Implement user mode "B" ("Bot flag"): it is settable and unsettable by every (non-restricted) client. This is how Unreal and InspIRCd do behave, and so do we :-) - Dynamically allocate memory for connection passwords: This a) saves memory for clients not using passwords at all and b) allows for "arbitrarily" long passwords. - Implement channel mode "M": Only the server, identified users and IRC operators are able to talk in such a channel. - Block nicknames that are reserved for services and are defined using the configuration variable "ServiceMask" in "Server" blocks; And this variable now can handle more than one mask separated by commas. - Now "make uninstall" removes the installed "ngircd.conf" file, if it is still equal to our "sample-ngircd.conf" file and therefore hasn't been modified by the user. If it has been modified, it isn't removed and a notice is displayed to the user. And "make install" now displays a message when no ngircd.conf file exists and the "sample-ngircd.conf" file will be installed as a starting point. - Add contrib/ngircd.service, a systemd service file for ngircd. - Implemented XOP channel user modes: "Half Op" ("+h", prefix "%") can set the channel modes +imntvIbek and kick all +v and normal users; "Admin" ("+a", prefix "&") can set channel modes +imntvIbekoRsz and kick all +o, +h, +v and normal users; and "Owner" ("+q", prefix "~") can set channel modes +imntvIbekoRsz and kick all +a, +o, +h, +v and normal users. - Implement hashed cloaked hostnames for both the "CloakHost" and "CloakHostModeX" configuration options: now the admin can use the new '%x' placeholder to insert a hashed version of the clients hostname, and the new configuration option "CloakHostSalt" defines the salt for the hash function. When "CloakHostSalt" is not set (the default), a random salt will be generated after each server restart. (Closes #133) ngIRCd Release 19.2 (2012-06-19) - doc/Capabilities.txt: document "multi-prefix" capability ngIRCd 19.2~rc1 (2012-06-13) - New configuration option "CloakHostModeX" to configure the hostname that gets used for IRC clients which have user mode "+x" enabled. Up to now, the name of the IRC server itself has been used for this, which still is the default when "CloakHostModeX" isn't set. - Correctly handle asynchronously re-established server links: a race condition could let the daemon loose track of an already re-established incoming server link while preparing its own outgoing connection. Peers that both try to connect each other could have been affected. - Log a debug message when SIGUSR2 is handled in debug mode. - Only allow alphanumeric characters in user-supplied user names of USER command and IDENT replies. - Change wording of "TLS initialized" message to make it more consistent. - Don't leak file descriptors on error path when creating "PID files". - Add missing mode "r" to CHANMODES in 005 "ISUPPORT" numeric. - Update doc/Modes.txt and doc/Platforms.txt documents. - contrib/platformtest.sh: correctly detect Open64 C compiler and handle "CC=xxx MAKE=yyy ./platformtest.sh" calling convention. - Add instructions for setting up Atheme IRC services. - Implement support for IRC capability handling, the new "CAP" command, and capablity "multi-prefix" which allows both the NAME and WHO command handlers to return more than one "class prefix" to the client. - Update Xcode project files: reference missing documentation files. - Fix: Don't ignore "permission denied" errors when enabling chroot. - FAQ: enhance description of chroot setup. ngIRCd Release 19.1 (2012-03-19) - Fix gcc warning (v4.6.3), initialize "list" variable to NULL. - Fix typos: "recieved" -> "received", "Please not" -> "Please note", and fix lintian(1) warning ""hyphen-used-as-minus-sign", too. - Really include _all_ patches to build the Anope module into the distribution archive ... ooops! - getpid.sh: Fix test case error for Debian using sbuild(1). - Don't log "ngIRCd hello message" two times when starting up. ngIRCd Release 19 (2012-02-29) - Update build system: bump config.guess and config.sub files used by GNU autoconf/automake to recent versions. - Fix configuration file parser: don't accept "[SSL]" blocks in the configuration file when no SSL support is built in ngIRCd. - Fix building ngIRCd with old gcc versions (e. g. 2.7.2). - Correctly re-open syslog logging after reading of configuration file: Syslog logging has been initialized before reading the configuration, so ngIRCd always used the default facility and ignored the "SyslogFacility" configuration option ... Thanks to Patrik Schindler for reporting this issue! ngIRCd 19~rc1 (2012-02-12) - Enhance command limits for server links: the limit now is dependent on the number of users connected in the network and higher while servers are joining the network to make the login of servers faster. - Log more information about server synchronization. - Update preliminary ngIRCd protocol module for Anope 1.9.6, which now is the only supported version. - New numeric RPL_WHOISHOST_MSG(378), which returns the DNS host name (if available) and the IP address of a client in the WHOIS reply. Only the user itself and local IRC operators get this numeric. - Implement channel exception list (mode 'e'). This allows a channel operator to define exception masks that allow users to join the channel even when a "ban" would match and prevent them from joining: the exception list (e) overrides the ban list (b). - PRIVMSG and NOTICE: Handle nick!user@host masks case-insensitive. - Implement user mode 'C': If the target user of a PRIVMSG or NOTICE command has the user mode 'C' set, it is required that both sender and receiver are on the same channel. This prevents private flooding by completely unknown clients. - New RPL_WHOISREGNICK_MSG(307) numeric in WHOIS command replies: it indicates if a nickname is registered (if user mode 'R' set). - Limit channel invite, ban, and exception lists to 50 entries and fix duplicate check and error messages when adding already listed entries or deleting no (longer) existing ones. - Fix both ERR_SUMMONDISABLED(445) and ERR_USERSDISABLED(446) replies. - MODE command: correctly return ERR_UNKNOWNMODE(472) numeric for unknown channel modes, instead of ERR_UMODEUNKNOWNFLAG(501). - ISUPPORT(005) numeric: add "O", "R", and "z" modes to "CHANMODES", add "EXCEPTS=e" and "INVEX=I", add "MAXLIST=beI:50". - Limit the number of list items in the reply of LIST (100), WHO (25), WHOIS (10), and WHOWAS (25) commands. - LIST command: compare pattern case insensitive. - Limit the MODE command to handle a maximum number of 5 channel modes that require an argument (+Ibkl) per call and report this number in the ISUPPORT(005) numeric: "MODES=5". - Fix handling of channel mode sequence with/without arguments. For example, don't generate wrong error messages when handling "MODE #chan +IIIIItn *!aa@b *!bb@c *!cc@d *!dd@e *!ee@f". - When sending data on a connection, only try to get the type of the client if there still is one assigned. This could trigger an assertion and end the daemon in some error paths. - Don't try to close already closed/invalid sockets to forked child processes. This could potentially crash the daemon in some cases with IDENT lookups enabled. - WHOIS command: make sure that the reply ends with RPL_ENDOFWHOIS, don't answer queries for IRC servers, make sure mask matching is case-insensitive, and that RPL_ENDOFWHOIS numeric is sent with the unmodified mask (like it has been received from the client). - LINKS command: support parameter to limit the reply. - Add 1 second penalty for every further target on PRIVMSG/NOTICE commands: this reduces the possibility of flooding channels with commands like "PRIVMSG/NOTICE #a,#n,#c,... :message" a little bit. Problem noticed by Cahata, thanks! - Display correct error message when "Server{UID|GID}" variable in the configuration file is invalid (not a number and no existing user). - Update Copyright notices for 2012 :-) - JOIN command: don't stop handling of channel lists when a single channel cannot be joined (because of bad name, wrong key or channel limit reached), but report an error and continue. And don't check the channel limit and don't report with "too many channels" when trying to join a channel that the client already is a member of. - ISON command: reply with the correct upper-/lowercase nicknames. - New configuration option "PAMIsOptional": when set, clients not sending a password are still allowed to connect: they won't become "identified" and keep the "~" character prepended to their supplied user name. See "man 5 ngircd.conf" for details. - Fixed handling of WHO commands. This fixes two bugs: "WHO " returned nothing at all if the user was "+i" (reported by Cahata, thanks) and "WHO " returned channel names instead of "*" when the user was member of a (visible) channel. - Fixed some spelling errors in documentation and code comments (Thanks to Christoph Biedl). - contrib/Debian/control: Update and complete "Build-Depends" and update our Debian package descriptions with "official" ones. - Fixed typo in two error messages. - LUSERS reply: only count channels that are visible to the requesting client, so the existence of secret channels is no longer revealed by using LUSERS. Reported by Cahata, thanks! - Unknown user and channel modes no longer stop the mode parser, but are simply ignored. Therefore modes after the unknown one are now handled. This is how ircd2.10/ircd2.11/ircd-seven behave, at least. Reported by Cahata, thanks! - README: Update list of implemented commands. - Log better error messages when rejecting clients. - Implement IRC commands "GLINE" and "KLINE" to ban users. G-Lines are synchronized between server on peering, K-Lines are local only. If you use "*!@" or "*!*@" masks, these connections are blocked even before the user is fully logged in (before PASS, NICK, and USER commands have been processed) and before the child processes for authentication are forked, so resource usage is smaller. - Xcode: update project file for Xcode 4.2 and define HAVE_GAI_STRERROR for Mac OS X Xcode builds. - ./configure: Fix logic and quoting of poll() detection code: only use poll() when poll.h exists as well. - Suppress 'Can't create pre-defined channel: invalid name: ""' message. - whois-test: handle local host name = "localhost.localdomain" using the pattern "localhost*" for valid local host names. - sample-ngircd.conf: show correct default for "PAM" variable: The default of "PAM" is "yes" when ngIRCd has been configured to use it, so show the correct default value in the sample configuration file. (Closes #119) - Update GPL 2 license text to current version. - Only close "unrelated" sockets in forked child processes: This fixes the problem that ngIRCd can't do any IDENT lookups because of the socket has already been closed in the child process. The bug has been introduced starting with ngIRCd 17 ... :-( (commit ID 6ebb31ab35e) - Added doc/Modes.txt: document modes supported by ngIRCd. - Implement user mode "R": indicates that the nickname of this user is "registered". This mode isn't handled by ngIRCd itself, but must be set and unset by IRC services like Anope. - Implement channel mode "R": only registered users (having the user mode "R" set) are allowed to join this channel. - Test suite: bind to loopback (127.0.0.1) interface only. - New 2nd message "Nickname too long" for error code 432. - Xcode: Mac OS X config.h: support 10.5 as well as 10.6/10.7 SDK. - Xcode: exclude more Xcode 4 specific directories in ".gitignore". - Disconnect directly linked servers sending QUIT. Without this, the server becomes removed from the network and the client list, but the connection isn't shut down at all ... - contrib/ngindent: detect "gindent" as GNU indent. - Handle unknown user and channel modes: these modes are saved and forwarded to other servers, but ignored otherwise. - Handle channel user modes 'a', 'h', and 'q' from remote servers. These channel user modes aren't used for anything at the moment, but ngIRCd knows that these three modes are "channel user modes" and not "channel modes", that is that these modes take an "nickname" argument. Like unknown user and channel modes, these modes are saved and forwarded to other servers, but ignored otherwise. - Correctly inform clients when other servers change their user modes. This is required for some services to work correctly. - Test suite: make getpid.sh work even when run as root. - Spoofed prefixes: close connection on non-server links only. On server-links, spoofed prefixes can happen because of the asynchronous nature of the IRC protocol. So don't break server- links, only log a message and ignore the command. (Closes #113) ngIRCd Release 18 (2011-07-10) - Update timestamp of ngircd(8) manual page. - Add preliminary ngIRCd protocol module for Anope 1.9 to contrib/Anope/. - Don't register WHOWAS information when "MorePrivacy" option is in effect. ngIRCd 18~rc2 (2011-06-29) - Update documentation, fix some wording, and use a spellchecker :-) - ngircd.conf.5: strip "SSL" prefix from variables in [SSL] section. - ngircd.8: document debugging options. - GnuTLS: use 1024 bits as minimum size of the DH prime. This enables ngIRCd to accept incoming connections from other servers and clients that "only" use at least 1024 bits again, like ngIRCd 17 did (and no longer requires 2048 bits for incoming connections). ngIRCd 18~rc1 (2011-06-27) - PAM warning message: make clear which "Password" config option is ignored. - New configuration option "MorePrivacy" to "censor" some user information. When enabled, signon time and idle time is left out. Part and quit messages are made to look the same. WHOWAS requests are silently dropped. All of this is useful if one wish to conceal users that access the ngircd servers from TOR or I2P. - New configuration option "ScrubCTCP" to scrub incoming CTCP commands. If activated, the server silently drops incoming CTCP requests from both other servers and from users. The server that scrubs CTCP will not forward the CTCP requests to other servers in the network either, which can spell trouble if not every oper knows about the CTCP-scrubbing. Scrubbing CTCP commands also means that it is not possible to send files between users. There is one exception to the CTCP scrubbing performed: ACTION ("/me commands") requests are not scrubbed. - Display configuration errors more prominent on "--configtest". - Restructure ngIRCd configuration file: introduce new [Limits], [Options], and [SSL] sections. The intention of this restructuring is to make the [Global] section much cleaner, so that it only contains variables that most installations must adjust to the local requirements. All the optional variables are moved to [Limits], for configurable limits and timers of ngIRCd, and [Options], for optional features. All SSL-related variables are moved to [SSL] and the "SSL"-prefix is stripped. The old variables in the [Global] section are deprecated now, but are still recognized. => Don't forget to check your configuration, use "ngircd --configtest"! - New documentation "how to contribute": doc/Contributing.txt. - Slightly fix error handling when connecting to remote servers. - GnuTLS: bump DH-bitsize to 2048: this solves the problem that some clients refuse to connect to severs that only offer 1024. For interoperability it would be best to just use 4096 bits, but that takes minutes, even on current hardware ... - contrib/platformtest.sh: fix gcc version detection. - Avoid needlessly scary 'buffer overflow' messages: When the write buffer space grows too large, ngIRCd has to disconnect the client to avoid wasting too much memory, which is logged with a scary 'write buffer overflow' message. Change this to a more descriptive wording. - Require server prefixes for most commands on RFC2812 links. RFC1459 links (often used by services, for example) are not affected. - Mac OS X: update installer functionality, texts, and add our logo :-) - New configuration option "RequireAuthPing": PING-PONG on login. When enabled, this configuration option lets ngIRCd send a PING with an numeric "token" to clients logging in; and it will not become registered in the network until the client responds with the correct PONG. - New configuration option "NoticeAuth": send NOTICE AUTH on connect. When active, ngircd will send "NOTICE AUTH" messages on client connect time like e.g. snircd (QuakeNet) does. - Generate WALLOPS message on SQUIT from IRC operators; so SQUIT now behaves like CONNECT and DISCONNECT commands, when called by an IRC operator. - Allow servers to send more commands in the first 10 seconds ("burst"). This helps to speed up server login and network synchronization. - Add support for up to 3 targets in WHOIS queries, also allow up to one wildcard query from local hosts. Follows ircd 2.10 implementation rather than RFC 2812. At most 10 entries are returned per wildcard expansion. - ngircd.conf(5) manual page: describe types of configuration variables (booleans, text strings, integer numbers) and add type information to each variable description. - Don't use "the.net" in sample-ngircd.conf, use "example.net". - Terminate incoming connections on HTTP commands "GET" and "POST". - New configuration option "CloakHost": when set, this host name is used for every client instead of the real DNS host name (or IP address). - New configuration option "CloakUserToNick": when enabled, ngIRCd sets every clients' user name to their nickname and hides the user name supplied by the IRC client. - doc/Protocol.txt: Update description of the CHANINFO and WEBIRC commands. - Doxygen'ify (document) much more source files; code cleanup ... - Make write buffers bigger, but flush early. Before this change, a client got disconnected if the buffer flushing at 4k failed, now regular clients can store up to 32k and servers up 64k even if flushing is not possible at the moment. This enhances reliability on slow links. - Don't access possibly free'd CLIENT structure. Ooops. - Allow "Port = 0" in [Server] blocks. Port number 0 marks remote servers that try to connect to this daemon, but where this daemon never tries to establish a connection on its own: only incoming connections are allowed. - Configuration: fix 'Value of "..." is not a number!' for negative values. - Enable WHOIS command to return information about services. - Implement channel mode 'O': "IRC operators only". This channel mode is used on DALnet (bahamut), for example. - Remove support for ZeroConf/Bonjour/Rendezvous service registration including the "[No]ZeroConf" configuration option. - TOPIC command: test for channel admin rights correctly: this enables other servers, services and IRC operators to change channel topics, even when the client is not joined to this channel. - Deprecate NoXX-Options in ngircd.conf and move new variants into our new [Options] section: 'NoDNS=no' => 'DNS=yes', 'NoIdent=no' => 'Ident=yes', 'NoPAM=no' => 'PAM=yes', and 'NoZeroConf=no' => 'ZeroConf=yes' (and vice-versa). The defaults are adjusted accordingly and the old variables in [Global] are still accepted, so there is no functional change. - Fix confusing "adding to invite list" debug messages: adding entries to ban list produced 'invite list' debug output ... - Don't throttle services and servers being registered. - Xcode: correctly sort files :-) - Don't assert() when searching a client for an invalid server token (this is only relevant when a trusted server on a server-server link sends invalid commands). ngIRCd Release 17.1 (2010-12-19) - --configtest: remember if MOTD is configured by file or phrase - Enhance log messages when establishing server links a little bit - Reset ID of outgoing server link on DNS error correctly - Don't log critical (or worse) messages to stderr - Manual page ngircd(8): add SIGNALS section - Manual pages: update and simplify AUTHORS section - Remove "error file" when compiled with debug code enabled - README: Updated list of implemented commands - add doc/README-Interix.txt and doc/Bopm.txt to distribution tarball - Merge branch 'numeric-329' - add doc/PAM.txt to distribution tarball - New numeric 329: get channel creation time on "MODE #chan" commands - Save channel creation time; new function Channel_CreationTime() ngIRCd Release 17 (2010-11-07) - doc: change path names in sample-ngircd.conf depending on sysconfdir - Fix up generation and distribution of sample-ngircd.conf - contrib/ngircd-redhat.init: updated email address of Naoya Nakazawa - contrib/platformtest.sh: make command name quoting consistent ngIRCd 17~rc3 (2010-10-27) - Xcode builds: detect version number correctly, updateed project file to use the Mac OS X 10.5.x SDK, disable pam_fail_delay() because it is only available starting with Mac OS X 10.6, and generate a default PAM configuration for the Mac OS X Installer.app package of ngIRCd. - Debian: updated standards version to 3.9.1, added libpam0g-dev to the dependencies, and install a default /etc/pam.d/ngircd allowing all logins. - Make contrib/platformtest.sh more portable. - Fix connect attempts to further IP addresses of outgoing server links. ngIRCd 17~rc2 (2010-10-25) - ZeroConf: include header files missing since commit a988bbc86a. - Generate ngIRCd version number from GIT tag. - Make sourcecode compatible with ansi2knr again. This allows to compile ngIRCd using a pre-ANSI K&R C compiler again. - ./configure: check if C compiler can compile ISO Standard C. - ./configure: check support for C prototypes again. - Don't use PARAMS() macro for function implementations. - Added m68k/apple/aux3.0.1 (gcc 2.7.2) to doc/Platforms.txt. - Only try to set FD_CLOEXEC if this flag is defined. - Only use "__attribute__ ((unused))" if GCC >=2.8 is used. - doc/Makefile.am: don't set docdir, automake handles it already. ngIRCd 17~rc1 (2010-10-11) - New configuration option "NoZeroConf" to disable service registration at runtime even if ngIRCd is compiled with support for ZeroConf (e.g. using Howl, Avahi or on Mac OS X). - New configuration option "SyslogFacility" to define the syslog "facility" (the "target"), to which ngIRCd should send its log messages. Possible values are system dependant, but most probably "auth", "daemon", "user" and "local1" through "local7" are possible values; see syslog(3). Default is "local5" for historical reasons. - Dump the "internal server state" (configured servers, established connections and known clients) to the console or syslog when receiving the SIGUSR2 signal and debug mode is enabled. - Enable the daemon to disable and enable "debug mode" on runtime using signal SIGUSR1, when debug code is compiled in, not only on startup using the command line parameters. - Signal handler: added new 'delayed' signal handlers, including fallback to deprecated sysv API. And removed global NGIRCd_SignalRehash variable. - IO: add io_cloexec() to set close-on-exec flag. - ng_ipaddr.h: include required assert.h header. - Conn_SyncServerStruct(): test all connections; and work case insensitive - configure script: correctly indent IPv6 yes/no summary output. - Don't reset My_Connections[Idx].lastping when reading data, so the client lag debug-output is working again. - Implement user mode "x": host name cloaking (closes: #102). - Make configure switch "--docdir" work (closes: #108). - Reformat and update FAQ.txt a little bit. - INSTALL: mention SSL, IPv6, and changed handling of MotdFile. - Change MOTD file handling: ngIRCd now caches the contens of the MOTD file, so the daemon now requires a HUP signal or REHASH command to re-read the MOTD file when its content changed. - Startup: open /dev/null before chroot'ing the daemon. - Allow IRC ops to change channel modes even without OperServerMode set. - Allow IRC operators to use MODE command on any channel (closes: #100). - Added mailmap file for git-[short]log and git-blame. - Authenticated users should be registered without the "~" mark. - Set NoPAM=yes in configuration files used for the testsuite. - New configuration option "NoPAM" to disable PAM. - Implement asynchronous user authentication using PAM, please see the file doc/PAM.txt for details. - Resolver: Implement signal handler and catch TERM signals. - Don't set a penalty time when doing DNS lookups. - Add some documentation for using BOPM with ngIRCd, see doc/Bopm.txt. - Implement user mode "c": receive connect/disconnect NOTICEs. Note that this new mode requires the user to be an IRC operator. - ngircd.init: require "$network" and "$remote_fs" when stopping ngircd. - Show SSL status in WHOIS output, numeric 275. - Include correct header files when testing for arpa/inet.h (Closes: #105). - Don't access already freed memory in IRC_KILL(). - Fix "beeing" typo ... - SSL/TLS: fix bogus "socket closed" error message. ngIRCd Release 16 (2010-05-02) - doc/SSL: remove line continuation marker ngIRCd 16~rc2 (2010-04-25) - Updated some more copyright notices, it's 2010 already :-) - Only compile in Get_Error() if really needed - Fix gcc warning "ignoring return value of ..." - Include netinet/in_systm.h alongside netinet/ip.h - Include netinet/{in.h, in_systm.h} when checking for netinet/ip.h - Only include if it exists - Updated doc/Platforms.txt - Enhace connection statistics counters: display total number of served connections on daemon shutdown and when a new client connects using the new numeric RPL_STATSCONN (250). ngIRCd 16~rc1 (2010-03-25) - Various fixes to the build system and code cleanups. - contrib/platformtest.sh: Only show latest commit. - Updatet doc/Platforms.txt, added new README-Interix.txt documenting how to tun ngIRCd on Microsoft Services for UNIX (MS SFU, MS SUA). - Updated links to the ngIRCd homepage (bug tracker, mailing list). - Added missing modes to USERMODES #define - Show our name (IRCD=ngIRCd) in ISUPPORT (005) numeric - Quote received messages of ERROR commands in log output. - ngircd.conf manual page: document missing "Password" variable. - Implement WEBIRC command used by some Web-IRC frontends. The password required to secure this command must be configured using the new "WebircPassword" variable in the ngircd.conf file. - Don't use port 6668 as example for both "Ports" and "SSLPorts". - Remove limit on max number of configured irc operators. - Only link "nsl" library when really needed. - A new channel mode "secure connections only" (+z) has been implemented: Only clients using a SSL encrypted connection to the server are allowed to join such a channel. But please note three things: a) already joined clients are not checked when setting this mode, b) IRC operators are always allowed to join every channel, and c) remote clients using a server not supporting this mode are not checked either and therefore always allowed to join. 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 . - 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 host names from info text. ngIRCd Release 14 (2009-04-20) - Display IPv6 addresses as "[]" 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 - Don't allow stray \r or \n in command parameters - --configtest: return non-zero exit code if there are errors - Update ngIRCd manual pages - Add option aliases -V (for --version) and -h (for --help). - Fix 'no-ipv6' compile error. - 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, but ngircd will print a warning if they are used in the config file. 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 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 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. - Report ERR_NOTONCHANNEL when trying to part a channel one is not member of. - Testsuite: remove erroneous ConfUID setting in config file. ngIRCd 0.12.0-pre1 (2008-04-20) - Include Mac OS X Xcode project in distribution archives. - Do not exit on SIGHUP or /REHASH if the config file cannot opened. - Add IPv6 support. - Install a LaunchDaemon script to start/stop ngIRCd on Mac OS X. - Implemented IRC commands INFO, SUMMON (dummy), and USERS (dummy) and enhanced test suite to check these commands. (Dana Dahlstrom) - RPL_WHOREPLY messages generated by IRC_WHO didn't include flags (*,@,+). (Dana Dahlstrom) - IRC_WHO now supports search patterns and will test this against user nickname/server name/host name, etc. as required by RFC 2812, Section 3.6.1. (reported by Dana Dahlstrom) - Add test cases for "WHO" command. (Dana Dahlstrom) - Implement RFC 2812 handling of "0" argument to 'JOIN': must be treated as if the user had sent PART commands for all channels the user is a member of. (Dana Dahlstrom) - Allow NOTICEs to be sent to a channel. (Fabian Schlager) ngIRCd 0.11.1 (2008-02-26) - Fix sending of JOIN commands between servers when remote server appended mode flags. (Rolf Eike Beer) [from HEAD] - Send "G" instead of "H" flag in WHO replies. (reported by Dana Dahlstrom) - Under some circumstances ngIRCd issued channel MODE message with a trailing space. (Dana Dahlstrom) [from HEAD] 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]. (CVE-2008-0285) ngIRCd 0.11.0-pre1 (2008-01-02) - Use dotted-decimal IP address if host name is >= 64. - Add support for /STAT u (server uptime) command. - New [Server] configuration Option "Bind" allows to specify the source IP address to use when connecting to remote server. - New configuration option "MaxNickLength" to specify the allowed maximum length of user nicknames. Note: must be unique in an IRC network! - Enhanced the IRC+ protocol to support an enhanced "server handshake" and 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 to the network as well as the wrong output of the LINKS command. - Update Mac OS X Xcode project file for Xcode 3. - Adjust test suite to be usable on HP/UX 11.11 :-) - Fix code to compile using K&R C compiler and ansi2kr again. - New config option NoDNS: Disables DNS lookups when clients connect. - Fixed propagation of channel mode 'P' on server links. - Numeric 317: implemented "signon time" (displayed in WHOIS result). - Fixed code that prevented GCC 2.95 to compile ngIRCd. - Adjust path names in manual pages according to "./configure" settings. - Added new server configuration option "Passive" for "Server" blocks to disable automatic outgoing connections (similar to -p option to ngircd, but only for the specified server). (Tassilo Schweyer) - Don't connect to a server if a connection to another server within the same group is already in progress. - Added support for the WALLOPS command. Usage is restricted to IRC operators. ngIRCd 0.10.4 (2008-01-07) - SECURITY: IRC_PART could reference invalid memory, causing 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, . (CVE-2007-6062) ngIRCd 0.10.2 (2007-06-08) ngIRCd 0.10.2-pre2 (2007-05-19) - Server links are allowed to use larger write buffers now (up to 50 KB). ngIRCd 0.10.2-pre1 (2007-05-05) - Fix compressed server links (broken since 0.10.0). - Predefined Channel configuration now allows specification of channel key (mode k) and maximum user count (mode l). - When using epoll() IO interface, compile in the select() interface as well and fall back to it when epoll() isn't available on runtime. - New configure option "--without-select" to disable select() IO API (even when using epoll(), see above). - Added support for IO APIs "poll()" and "/dev/poll". - Reorganized internal handling of invite and ban lists. ngIRCd 0.10.1 (2006-12-17) - Fixed validation of server names containing digits. - Update the "info text" of the local server after re-reading configuration. - Changed Numerics 265 and 266 to follow ircd 2.11.x "standards". - Allow PASS syntax defined in RFC 1459 for server links, too. - Enhanced ISUPPORT message (005 numeric). - New configuration option "PredefChannelsOnly": if set, clients can only join predefined channels. - Code cleanups: use "LogDebug(...)" instead of "Log(LOG_DEBUG, ...)", use "strcspn()", unsigned vs. signed, use "const", fix whitespaces, ... ngIRCd 0.10.0 (2006-10-01) - Fixed file handle leak when daemon is not able to send MOTD to a client. ngIRCd 0.10.0-pre2 (2006-09-09) - Fixed build problems with GCC option -fstack-protector. - Minor documentation updates. ngIRCd 0.10.0-pre1 (2006-08-02) - Validate "ServerName" (see RFC 2812, section 2.3.1). - Enhanced DIE to accept a single parameter ("comment text") which is sent to all locally connected clients before the server goes down. - The ngIRCd handles time shifts backwards more gracefully now (the timeout handling doesn't disconnect clients by mistake any more). - Internal: Restructured connection handling (the connection ID is equal to the file descriptor of the connection). - Internal: Simplified resolver code. - JOIN now supports more than one channel key at a time. - Implemented numeric "333": Time and user name who set a channel topic. - Enhanced the handler for PING and PONG commands: fix forwarding and enable back-passing of a client supplied additional argument of PING. - Changed handling of timeouts for unregistered connections: don't reset the counter if data is received and disconnect clients earlier. - Removed unnecessary #define of "LOCAL", now use plain C "static" instead. - Channel topics are no longer limited to 127 characters: now the only limit is the maximum length of an IRC command, i. e. 512 bytes (in practice, this limits the topic to about 490 characters due to protocol overhead). - Reverse DNS lookup code now checks the result by doing an additional lookup to prevent spoofing. - Added new IO layer which (optionally) supports epoll() and kqueue() in addition to the select() interface. ngIRCd 0.9.2 (2005-10-15) - Fixed a bug that could cause the daemon to crash when outgoing server connections can't be established. - Fixed a bug that caused the daemon to leak file descriptors when no resolver subprocesses could be created. - Fixed server NOTICEs to users with "s" mode ("server messages"). - Fixed a format string bug in "connection statistics" messages to clients. ngIRCd 0.9.1 (2005-08-03) - The KILL command killed much more than desired (including server links!) when the target user is connected to a remote server. Bug introduced in ngIRCd 0.9.0 ... Reported by , Thanks! - Changed some constants to be "signed" (instead of unsigned) to solve problems with old (pre-ANSI) compilers. ngIRCd 0.9.0 (2005-07-24) ngIRCd 0.9.0-pre1 (2005-07-09) - Fixed maximum length of user names, now allow up to 9 characters. - Cut off oversized IRC messages that should be sent to the network instead of shutting down the (wrong) connection. - Don't generate error messages for unknown commands received before the client is registered with the server (like the original ircd). - Never run with root privileges but always switch the user ID. - Make "netsplit" messages RFC compliant. - Fix handling of QUIT Messages: send only one message, even if the client is member of multiple channels. - Don't exit server if closing of a socket fails; instead ignore it and pray that this will be "the right thing" ... - Implemented the IRC function "WHOWAS". - Don't enable assert() calls when not ./configure'd with --enable-debug. - Fixed ./configure test for TCP Wrappers: now it runs on Mac OS X as well. - Enhanced configure script: now you can pass an (optional) search path to all --with-XXX parameters, e. g. "--with-ident=/opt/ident". - Removed typedefs for the native C datatypes. Use stdbool.h / inttypes.h if available. - New configuration option "OperServerMode" to enable a workaround needed when running an network with ircd2 servers and "OperCanUseMode" enabled to prevent the ircd2 daemon to drop mode changes of IRC operators. Patch by Florian Westphal, . - Implemented support for "secret channels" (channel mode "s"). - New configuration option "Mask" for [Operator] sections to limit OPER commands to users with a specific IRC mask. Patch from Florian Westphal. - Write "error file" (/tmp/ngircd-XXX.err) only if compiled with debug code ("--enable-debug") and running as daemon process. - Don't create version information string each time a client connects but instead on server startup. By Florian Westphal. - New configuration variable "PidFile", section "[Global]": if defined, the server writes its process ID (PID) to this file. Default: off. Idea of Florian Westphal, . - Code cleanups from Florian Westphal, . - Raised the maximum length of passwords to 20 characters. - Fixed a memory leak when resizing the connection pool and realloc() failed. Now we don't fall back to malloc(), which should be sane anyway. Patch from Florian Westphal, . - Added support for the Howl (http://www.porchdogsoft.com/products/howl/) Rendezvous API, in addition to the API of Apple (Mac OS X). The available API will be autodetected when you call "./configure --with-rendezvous". - Made ngIRCd compile on HP/UX 10.20 with native HP pre-ANSI C compiler and most probably other older C compilers on other systems. - When the daemon should switch to another user ID (ServerID is defined in the configuration file) and is not running in a chroot environment, it changes its working directory to the home directory of this user. This should enable the system to write proper core files when not running with root privileges ... 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, , thanks a lot! (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, . (CVE-2005-0199) - Fixed a possible buffer underrun when reading the MOTD file. Thanks to Florian Westphal, . - Fixed detection of IRC lines which are too long to send. Detected by Florian Westphal, . - Fixed return values of our own implementation of strlcpy(). The code has been taken from rsync and they fixed it, but we didn't until today :-/ It has only been used when the system didn't implement strlcpy by itself, not on "modern" systems. Florian Westphal, . ngIRCd 0.8.1 (2004-12-25) - Autoconf: Updated config.guess and config.sub - Added some more debug code ... - Fixed wrong variable names in output of "ngircd --configtest". - Debian: Fixed the name of the "default file" in the init script for ngircd-full packages. And do the test if the binary is executable after reading this file. - Enhanced the "test suite": please have a look at src/testsuite/README! ngIRCd 0.8.0 (2004-06-26) - Fixed wrong buffer size calculation for results of the resolver. ngircd 0.8.0-pre2 (2004-05-16) - Enhanced logging to console when running in "no-detached mode": added PID and log messages of resolver sub-processes. - Fixed host name lookups when using IDENT user lookups. - "make clean" and "make maintainer-clean" remove more files now. ngIRCd 0.8.0-pre1 (2004-05-07) - Two new configuration options: "ChrootDir" and "MotdPhrase", thanks to Benjamin Pineau . Now you can force the daemon to change its root and working directory to something "safe". MotdPhrase is used to define an "MOTD string" instead of a whole file, useful if the "real" MOTD file would be outside the "jail". - INVITE- and BAN-lists become synchronized between IRC+ servers when establishing new connections, if the peer supports this as well. - Reorganized autogen.sh and configure scripts. - Fixed a wrong assert() which could cause the daemon to exit spuriously when closing down connections. - Better logging of decompression errors returned by zlib. - Servers other than the destination server didn't clean up the invite list of an "invite-only" channel properly when an INVITE'd user joined. - Changed the reply of the MODE command to match the syntax of the original ircd exactly: the unnecessary but missing ":" before the last parameter has been added. - Fixed TRACE: don't output "Serv" lines for ourself; display more info. - Results of the resolver (host names and IDENT names) are discarded after the client is successfully registered with the server. - Better logging while establishing and shutting down connections. - The type of service (TOS) of all sockets is set to "interactive" now. - Added short command line option "-t" as alternative to "--configtest". - Added optional support for "IDENT" lookups on incoming connections. You have to enable this function with the ./configure switch "--with-ident". The default is not to do IDENT lookups. ngIRCd 0.7.7 (2004-02-05) - The info text ("real name") of users is set to "-" if none has been specified using the USER command (e. g. "USER user * * :"). Reason: the original ircd doesn't like empty ones and would KILL such users. - Fixed (optional) TCP Wrapper test which was broken and could result in false results. Thanks to Fuminori Tanizaki ! - Removed "USE_" prefixes of configuration #defines. ngIRCd 0.7.6 (2003-12-05) - Fixed abort() ("server crash") when INVITE'ing users to nonexistent channels. Bug found by . - Extended version numbering of CVS versions (added date). - Enhanced/fixed doc/Protocol.txt; ngIRCd 0.7.5 (2003-11-07) - Fixed ban behavior: users which are banned from a channel can't no longer send PRIVMSG's to this channel (fixes Bug #47). - Fixed and enhanced the "penalty handling" of the server: commands that require more resources block the client for a short time. - Changed the internal time resolution to one second. - New configuration variable "MaxConnectionsIP" to limit the number of simultaneous connections from a single IP that the server will accept. This configuration options lowers the risk of denial of service attacks (DoS), the default is 5 connections per client IP. - Fixed build problems under Mac OS X 10.3. - Use "-pipe" when compiling with gcc, speeds things up a little :-) - Added new configuration variable "Listen" to bind all listening sockets of the server to a single IP address. - Suppress misleading error message of diff during make run. - Enhanced test-suite and made it work on GNU/Hurd. - Fixed minor typo in debug output :-) ngIRCd 0.7.1 (2003-07-18) - Included files to build Debian packages (located in "debian/"). - Updated config.guess and config.sub to newer upstream versions. - NJOIN propagates user channel modes correctly again ... Upsa. - Made Makefile more compatible with "make -j". - Added support for GNU/Hurd. - Fixed a compiler warning related to an unnecessary assert(). - Enhanced VERSION command when using debug versions. ngIRCd 0.7.0 (2003-05-01) - "ServerName" is checked better now: a dot (".") is required. - The KILL command verifies and logs more parameters. ngIRCd 0.7.0-pre2 (2003-04-27) - CVS build system fixes (made autogen.sh more portable). - Fixed compilation and test-suite on Solaris (tested with 2.6). - New documentation file "doc/Platforms.txt" describing the status of ngIRCd on the various tested platforms. - Test for broken GCC on Mac OS X and disable "-pedantic" in this case. - Disable "-ansi" on Cygwin: system headers are incompatible. - The server tried to connect to other servers only once when DNS or socket failures occurred. - Fixed --configtest: There is no variable "ServerPwd", it's "Password". ngIRCd 0.7.0-pre1 (2003-04-22) - New signal handler (more secure, actions are executed outside). - GCC: the compiler is now called with more warning options enabled. - Replaced a lot of str[n]cpy(), str[n]cat() and sprintf() calls with the more secure functions strlcpy(), strlcat() and snprintf(). On systems that don't support strlcpy() and strlcat(), these functions are included in the libngportab now (with prototypes in portab.h). - If the server can't close a socket, it panics now. This is an error that can't occur during normal operation so there is something broken. - The order of log messages during disconnects is more "natural" now ;-) - Cleaned up handling of server configuration structures: modifying and removing servers during runtime works more reliable now. - Compression code from "conn.[ch]" is now found in new "conn-zip.[ch]" - Moved some connection functions from "conn.[ch]" to "conn-func.[ch]". - New command CONNECT to enable and add server links. The syntax is not RFC-compatible: use "CONNECT " to enable and connect an configured server and "CONNECT " to add a new server (ngIRCd tries to connect new servers only once!). - Added DISCONNECT command ("DISCONNECT ") to disable servers. - Restructured the documentation: Now the main language is English. The german documentation has been removed (until there is a maintainer). - Enhanced killing of users caused by a nickname collision. - Better error detection for status code ("numerics") forwarding. - Moved tool functions to own library: "libngtool". - New command TRACE (you can trace only servers at the moment). - New command HELP that lists all understood commands. - There should no longer remain "unknown connections" (see e.g. LUSERS) if an outgoing server link can't be established. - Added AC_PREREQ(2.50) to configure.in for better autoconf compatibility. - Conn_Close() now handles recursive calls for the same link correctly. - ngIRCd can register itself with Rendezvous: to enable support pass the new switch "--with-rendezvous" to configure. - Added support for TCP Wrappers library: pass "--with-tcp-wrappers" to configure to enable it. - Changed some configure options to use "--with"/"--without" as prefix instead of "--enable"/"--disable": "--without-syslog", "--without-zlib", "--with-tcp-wrappers", and "--with-rendezvous". - Better error reporting to clients on connect. - Enhanced manual pages ngircd(8) and ngircd.conf(5). - Documentation is now installed in $(datadir)/doc/ngircd. - Enhanced handling of NJOIN in case of nick collisions. ngIRCd 0.6.1, 2003-01-21 - Fixed KILL: you can't crash the server by killing yourself any more, ngIRCd no longer sends a QUIT to other servers after the KILL, and you can kill only valid users now. - The server no longer forwards commands to ordinary users, instead it answers with the correct error message ("no such server") now. - WHOIS commands weren't always forwarded as requested. - The server sets a correct default AWAY message now when propagating between servers (bug introduced in 0.6.0). - Fixed up and enhanced CHANINFO command: channel keys and user limits are synchronized between servers now, too. - MODE returns the key and user limit for channel members correctly now. - Non-members of a channel could crash the server when trying to change its modes or modes of its members. - The server didn't validate weather a target user is a valid channel member when changing his channel user modes which could crash ngIRCd. Older changes (sorry, only available in german language): ngIRCd 0.6.0, 2002-12-24 ngIRCd 0.6.0-pre2, 2002-12-23 - neuer Numeric 005 ("Features") beim Connect. - LUSERS erweitert: nun wird die maximale Anzahl der lokalen und globalen Clients, die dem Server bzw. im Netzwerk seit dem letzten (Re-)Start dem Server gleichzeitig bekannt waren, angezeigt. ngIRCd 0.6.0-pre1, 2002-12-18 - beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR noch eine Statistik ueber die empfangene und gesendete Datenmenge an. - der Server wartet bei einer eingehenden Verbindung nun laenger auf den Resolver (4 Sekunden), wenn das Ergebnis eintrifft setzt er aber den Login sofort fort (bisher wurde immer mind. 1 Sekunde gewartet). - Connection-Strukturen werden nun "pool-weise" verwaltet; der Pool wird bei Bedarf bis zu einem konfigurierten Limit vergroessert. - Mit der neuen Konfigurationsvariable "MaxConnections" (Sektion "Global") kann die maximale Anzahl gleichzeitiger Verbindungen begrenzt werden. Der Default ist -1, "unlimitiert". - der Server erkennt nun, ob bereits eine eingehende Verbindung von einem Peer-Server besteht und versucht dann nicht mehr, selber eine eigene ausgehende Verbindung zu diesem auufzubauen. Dadurch kann nun auf beiden Servern in der Konfiguration ein Port fuer den Connect konfiguriert werden (beide Server versuchen sich dann gegenseitig zu connectieren). - Test-Suite und Dokumentation an A/UX angepasst. - unter HP-UX definiert das configure-Script nun _XOPEN_SOURCE_EXTENDED. - Server identifizieren sich nun mit asynchronen Passwoertern, d.h. das Passwort, welches A an B schickt, kann ein anderes sein als das, welches B als Antwort an A sendet. In der Konfig.-Datei, Abschnitt "Server", wurde "Password" dazu durch "MyPassword" und "PeerPassword" ersetzt. - Der Server kann nun zur Laufzeit die Konfiguration neu einlesen: dies macht er nach dem Befehl REHASH oder wenn ein HUP-Signal empfangen wird. - Channel-Mode "P" ("persistent") kann nur noch von IRC-Operatoren gesetzt werden. Grund: User koennen den Server sonst leicht "Channel-Flooden". - MOTD kann nun an andere Server geforwarded werden. - IRC-Befehl "TIME" implementiert. - Server-Server-Links koennen nun komprimiert werden, dazu wird die zlib (www.zlib.org) benoetigt. Unterstuetzt die Gegenseite die Komprimierung nicht, wird automatisch unkomprimiert kommuniziert. Das Verfahren ist kompatibel mit dem Original-ircd 2.10.3, d.h. beide Server koennen miteinander ueber komprimiert Links kommunizieren. - Handling der Schreibpuffer umgestellt: Server sollte schneller arbeiten. - Prefix-Fehler werden besser protokolliert (mit verursachendem Befehl). - SQUIT wird nicht mehr doppelt an andere Server weitergeleitet. - Der Server versucht nun vor dem Schliessen einer Verbindung Daten, die noch im Schreibpuffer stehen, zu senden. - Source in weiteres Modul "irc-info" aufgespalten. - Konfigurationsvariablen werden besser validiert: Laengen, Zahlen, ... - neuen Befehl STATS begonnen: bisher unterstuetzt wird "l" und "m". - bei ISON und USERHOST fehlte im Ergebnis-String der korrekte Absender. - IRC Operatoren koennen nun mit KILL User toeten. Achtung: ein Grund muss zwingend als zweiter Parameter angegeben werden! - neue Konfigurations-Variable "MaxJoins": Hiermit kann die maximale Zahl der Channels, in denen ein User Mitglied sein kann, begrent werden. - neuer, deutlich flexiblerer Parser fuer den MODE Befehl. - neue Channel-Modes l (User-Limit) und k (Channel-Key) implementiert. ngIRCd 0.5.4, 24.11.2002 - Fehler-Handling von connect() gefixed: der Server kann sich nun auch unter A/UX wieder zu anderen verbinden. - in den Konfigurationsvariablen ServerUID und ServerGID kann nun nicht nur die numerische ID, sondern auch der Name des Users bzw. der Gruppe verwendet werden. Beim Start des Daemons wird nun beides angezeigt. - Besseres Logging von Prefix-Fehlern. - angenommene Sockets werden nun korrekt auf "non-blocking" konfiguriert, beim Senden und Empfangen werden Blockierungen besser abgefangen. - RPL_UMODEIS hat Code 221, nicht 211 ... *argl* - select() in Try_Write() hat falschen (keinen!) Timeout verwendet; die "Zeit-Aufloesung" des Servers sind zudem nun 2 Sekunden (TIME_RES). Insgesamt sollte die Reaktionszeit des Server nun besser sein. ngIRCd 0.5.3, 08.11.2002 - NOTICE liefert nun wirklich nie mehr einen Fehler, auch dann nicht, wenn der sendende Client noch gar nicht registriert ist. - ein "schneller Server-Reconnect" wird nur noch dann versucht, wenn die Verbindung zuvor ordentlich (="lange genug") in Ordnung war; somit also nicht meht, wenn der Peer-Server gleich beim Connect ein ERROR liefert. Das vermeidet "Connect-Orgien". - einige Datentypen aufgeraumt: z.B. sind viele INT32s nun LONGs. Das ist auf Platformen mit 8-Byte-Integern kompatibler. - RPL_YOURHOST_MSG ist nun ircII- und RFC-kompatibel ;-) - Segfault unter hoher Netzaktivitaet behoben: in Conn_Close() wird die Connection-Struktur nun frueher als "ungueltig" markiert. ngIRCd 0.5.2, 04.10.2002 - Buffer Overflow in Read_Resolver_Result() behoben. - Format-String-Bugs, die zum Abbruch des Servers fuehrten, behoben. - Maximale Laenge eines IRC-Prefix wurde falsch berechnet. ngIRCd 0.5.1, 03.10.2002 - in RPL_YOURHOST_MSG wurde ein fehlerhafter Versionsstring geliefert. - Test-Suite: start-server.sh, stop-server.sh und stress-server.sh koennen nun "manuell" von der Kommandozeile gestartet werden, stress-server.sh startet per Default nur noch 5 Sessions, eine andere Zahl kann auf der Kommandozeile uebergeben werden (Syntax: "stress-server.sh "). - In bestimmten Faellen hat der Server versucht auf einen bereits wieder geschlossenen Socket Daten zu schreiben; das fuehrte zu einem Abbruch des Servers durch ein assert(). Nun wird geprueft, ob der Socket noch ok ist. - im "contrib"-Verzeichnis befindet sich nun eine RPM-Spec-Datei, aus den .tar.gz's koennen nun mit "rpm -ta " RPM's erzeugt werden. Danke an Sean Reifschneider ! - Syntax von RPL_MYINFO_MSG korrigiert: liefert nun vier Parameter. ngIRCd 0.5.0, 20.09.2002 - Dokumentation aktualisiert. - Fehler bei Validierung von "AdminInfo2" behoben. - Test der Flags fuer "ps" in der Testsuite verbessert, ist nun zu mehr Plattformen kompatibler. ngIRCd 0.5.0-pre2, 17.09.2002 - Fix in IRC_WriteStrServersPrefix() war "badly broken" -- behoben. ngIRCd 0.5.0-pre1, 16.09.2002 - Manual-Pages ngircd.8 und ngircd.conf.5 begonnen. - Wird der Netzwerk-Sniffer aktiviert (--sniffer), so schaltet der ngIRCd nun automatisch in den Debug-Modus. - auf Systemen, die inet_aton() nicht kennen (wie z.B. A/UX), kann der ngIRCd nun dennoch auch aktiv Server-Links aufbauen. - h_errno wird auf Systemen, die das nicht kennen (wie z.B. HP-UX 10.20) nicht mehr verwendet. Somit compiliert der ngIRCd nun auch dort :-) - um auf dem Ziel-System nicht vorhandene Funktionen nachzubilden wird nun die "libngportab" erzeugt; genutzt wird dies bisher fuer vsnprintf(). Nun compiliert der ngIRCd auch unter Solaris 2.5.1. - "persistente Channels" (Mode 'P') implementiert: diese koennen in der Konfigurationsdatei definiert werden (Sektion "Channel", vgl. Beispiel- Konfiguration "sample-ngircd.conf") und bleiben auch dann bestehen, wenn kein User mehr im Channel ist. Zu Channel-Operatoren werden bisher nur IRC-Operatoren, die den Channel betreten. Die persistenten Channels werden durch das Flag "P" gelennzeichnet, welches normal durch Channel- Op's gesetzt und geloescht werden kann. - bei "--configtest" werden keine leere Abschnitte mehr ausgegeben. - Source in weitere Module aufgespalten: lists, irc-op und resolve. - #include's aufgeraeumt: Header includieren keine anderen mehr. - KICK implementiert (bisher kann nur ein User aus einem Channel geckicked werden, Listen, wir im RFC vorgesehen, werden bisher nicht unterstuetzt). - INVITE, den Channel-Mode "i" sowie Invite-Lists ueber den MODE-Befehl (setzen, erfragen und loeschen) implementiert. - Source an ansi2knr fuer pre-ANSI-Compiler angepasst; ansi2knr in Source- Tree aufgenommen und in Build-System integriert; der ngIRCd compiliert nun z.B. unter A/UX mit dem nativen Compiler von Apple. - TOPIC lieferte bei unbekanntem Channel einen falschen Fehlercode. - LIST versteht nun Wildcards und kann an andere Server geforwarded werden. - wurde ein KILL fuer nicht-lokale Clients empfangen, so wurden die Verwaltungs-Strukturen nicht korrekt freigegeben. - empfangene NJOIN's wurden "zerhackt" an andere Server weitergegeben. - neue Konfigurationsoption "OperCanUseMode" (Sektion "Global"): ist sie aktiv, koennen IRC-Operatoren immer Channel-Modes setzen. - Dokumentation des neuen IRC+-Protokolls begonnen: doc/Protocol.txt - Protokoll- und Server-ID bei PASS-Befehlen auf neues Format umgestellt; bei empfangenen PASS-Befehlen werden diese zudem nun auch ausgewertet. Die unterstuetzten Flags sind in doc/Protocol.txt beschrieben. - mit dem neuen Befehl CHANINFO synchronisieren Server, die das IRC+- Protokoll unterstuetzen, Channel-Modes und Topics. - neue Option "--disable-ircplus" fuer das configure-Script, um das IRC+-Protokoll abzuschalten (per Default ist es aktiviert). - Ban-Lists (setzen, erfragen und loeschen) implementiert. - wird der Server mit "-n"/"--nodaemon" gestartet, so werden keine Mel- dungen mehr ueber Syslog ausgegeben, sondern nur noch auf der Konsole. - "Test-Suite" begonnen (in "make check" integriert): Dabei wird ein speziell konfigurierter Server auf Port 6789 gestartet, mit dem dann einige Tests durchgefuehrt werden (u.a. "Stress-Test" mit 50 Clients). - zu lange Operator-Namen in der Konfiguration wurden falsch gekuerzt. - kleine Anpassung an AIX 3.2.5: nun laeuft der ngIRCd auch dort :-) - ADMIN-Befehl implementiert. Die Daten hierzu werden in der Konfig-Datei im [Global]-Abschnitt mit den Variablen "AdminInfo1", "AdminInfo2" und "AdminEMail" konfiguriert. ngIRCd 0.4.3, 11.06.2002 - Bei PRIVMSG und NOTICE hat der ngIRCd nicht ueberpruft, ob das Ziel ueberhaupt ein User ist. War es keiner, so fuehrte dies zu einem Abbruch des Servers [es wurde assert() aufgerufen]. ngIRCd 0.4.2, 29.04.2002 - LUSERS verzaehlt sich bei eigenen Server-Links nicht mehr. - QUIT wird nun auch von noch nicht registrierten Clients akzeptiert. - IRC-Funktion LIST implementiert; bisher werden allerdings noch keine Wildcards (bis auf "*") unterstuetzt. ngIRCd 0.4.1, 08.04.2002 - Bei Server-Links wird nicht mehr an Hand der Anzahl der Parameter eines empfangenen SERVER-Befehls, sondern "intern" erkannt, ob es sich um eine ein- oder ausgehende Verbindung handelt und somit das eigene PASS-SERVER-Paar gesendet werden muss oder nicht. Da sich verschiedene Versionen des Original-ircd's anders verhalten, schlug die Anmeldung je nach Gehenseite evtl. fehl. - Bei einem NICK-Befehl eines lokalen Client konnte der Server ab- stuerzen, da ein Format-String einer Log-Meldung fehlerhaft war. ngIRCd 0.4.0, 01.04.2002 - IRC-Befehle nochmal auf weitere Source-Dateien aufgespalten. - WHO implementiert (bisher ohne komplette Unterstuetzung von Masks). - Der AWAY-Mode wurde nicht ueber mehrere Server-Links weitergegeben. - stderr wird nun in eine Datei umgelenkt (/tmp/ngircd-.err). Laeuft der Server nicht im Debug-Modus, so wird diese bei Programm- ende geloescht. Sollte der Server abstuerzen, finden sich hier evtl. zusaetzliche Informationen. - In Nicknames wird das Zeichen "-" nun als zulaessig erkannt. - die Beispiel-Konfigurationsdatei (doc/sample-ngircd.conf) wird als ngircd.conf installiert, wenn noch keine "echte" Konfigurationsdatei vorhanden ist. - bei WHO, WHOIS und NAMES wird nun nur noch der Status "Operator" oder "voiced" geliefert -- nicht mehr beides. - Server-Gruppen implementiert: es wird immer nur zu einem Server in einer Gruppe eine Verbindung aufgebaut, klappt es beim ersten Server nicht, so wird der naechste probiert (Variable "Group" in der Kon- figurationsdatei, Sektion [Server]). - IRC_PING() ist, wenn nicht im "strict RFC"-Mode, toleranter und ak- zeptiert beliebig viele Parameter (z.B. BitchX sendet soetwas). - die "Portab-Header" werden nicht mehr benoetigt, die System-Erkennung wird nun ausschliesslich vom configure-Script durchgefuehrt. System- abhaengige Definitionen finden sich nun unter src/portrab/. - Clients und Channels werden nicht mehr ueber ihren Namen, sondern einen Hash-Wert gesucht: sollte deutlich schneller sein. - neuer Kommandozeilen-Parameter "--configtest": die Konfiguration wird gelesen und dann die verwendeten Werte angezeigt. - Client-Mode "s" (Server Notices) implementiert. - mit dem neuen Kommandozeilen-Parameter "--config"/"-f" kann eine alternative Konfigurationsdatei angegeben werden. - nach dem Start kann der ngIRCd, wenn er mit root-Rechten laeuft, zu einer anderen User-ID und Group-ID wechseln. - URL der Homepage wird u.a. bei "--version" mit angezeigt. ngIRCd 0.3.0, 02.03.2002 - bekommt der Server ein HUP-Signal, so startet er neu -- genau so, wie er auf den IRC-Befehl RESTART reagiert. - FAQ um Hinweise auf den Bugtracker erweitert. - neuer Kommandozeilen-Schalter "--passive" (-p): wird er angegeben, so verbindet sich der ngIRCd nicht mehr automatisch zu anderen Servern. Zum Debuggen manchmal ganz praktisch :-) - direkt nach dem Start schreibt der ngIRCd nun die aktiven Kommando- zeilenschalter in's Logfile (Passive, Debug, Sniffer ...). - das Signal-Flag SA_RESTART wird nur noch gesetzt, wenn es auf dem jeweiligen System auch definiert ist. - bei ausgehenden Verbindungen wird nun der Ziel-Port protokolliert. - neue Befehle VERSION und KILL implementiert. - make-Target "check" (und "distcheck") mit Sinn erfuellt :-) (die Tests sind aber bisher nicht all zu tiefgehend ...) - Durch einen Ueberlauf konnte die Idle-Time bei WHOIS negativ werden ... - Anpassungen an A/UX: gehoert nun auch zu den unterstuetzten Platformen. - WHOIS wird nicht mehr automatisch an den "Original-Server" weiterge- leitet: war eh nicht RFC-konform und machte mit Clients Probleme. - an User wird nun immer ein "komplettes" Prefix (mit Host-Mask) ver- schickt, Server bekommen nach wie vor kurze: das "Original" hat bei bestimmten Befehlen (PRIVMSG) ansonsten evtl. Probleme ... - NAMES korrigiert und vollstaendig implementiert. - SQUIT wird auf jeden Fall geforwarded, zudem besseres Logging. - Ist ein Nick bei der User-Registrierung bereits belegt, nimmt der Server nun korrekt weitere NICK-Befehle an und verwendet diese. - PRIVMSG beachtet nun die Channel-Modes "n" und "m". - AWAY implementiert. PRIVMSG, MODE, USERHOST und WHOIS angepasst. - der ngIRCd unterstuetzt nun Channel-Topics (TOPIC-Befehl). - ausgehende Server-Verbindungen werden nun asynchron connectiert und blockieren nicht mehr den ganzen Server, wenn die Gegenseite nicht erreicht werden kann (bis zum Timeout konnten Minuten vergehen!). - Wert der Konfigurations-Variable "ConnectRetry" wird besser beachtet. - Channel- und Nicknames werden nun ordentlich validiert. ngIRCd 0.2.1, 17.02.2002 - NICK korrigiert: es werden nun auch alle "betroffenen" User informiert. - configure-Script erweitert, u.a. bessere Anpassung an BeOS: dort wird nun die "libbe" zum ngIRCd gelinkt, somit funktioniert auch syslog. - Fehlerhafte bzw. noch nicht verstandene Modes werden nun ausfuehrlicher an den Client geliefert. ngIRCd 0.2.0, 15.02.2002 - Nicknames und Channel-Namen werden etwas besser auf Gueltigkeit ueber- prueft; ist aber nach wie vor noch nicht ausreichend. - NJOINS von Servern wurden nicht an andere Server weitergeleitet. - Begonnen Channel-Modes und User-Channel-Modes zu implementieren: der Server versteht an User-Modes o und v, beachtet letzteres allerdings noch nirgends. Bekannte (aber nicht beachtete!) Channel-Modes sind bisher a, m, n, p, q, s und t. Diese Modes werden von Usern ange- nommen, von anderen Servern werden auch unbekannte Modes uebernommen. - Benutzer von connectierenden Servern wurden nicht in den Channels ange- kuendigt, es wurden nur die internen Strukturen angepasst. - Nach dem Connect eines Users werden LUSERS-Informationen angezeigt. ngIRCd 0.1.0, 29.01.2002 - User-Modes bei User-Registrierungen von andere Servern (NICK-Befehl) wurden falsch uebernommen. Zudem wurden die Modes falsch gekuerzt. - Server-Verbindungen werden nun nach dem Start erst nach einer kurzen Pause aufgebaut (zur Zeit drei Sekunden). - Hilfetext korrigiert: --help und --version waren vertauscht, die Option --sniffer wurde gar nicht erwaehnt. - FAQ.txt in doc/ begonnen. - der IRC-Sniffer wird nur noch aktiviert, wenn die Option auf der Kommandozeile angegeben wurde (bei entsprechend compiliertem Server). - Channels implementiert, bisher jedoch noch ohne Channel-Modes, d.h. es gibt keine Channel-Ops, kein Topic, kein "topic lock" etc. pp. Chatten in Channels ist aber natuerlich moeglich ;-) - neue Befehle fuer Channles: JOIN, PART und NJOIN. - durch die Channels einige Aenderungen an PRIVMSG, WHOIS, MODE etc. - neu connectierenden Servern werden nun Channels mit NJOIN angekuendigt. - Signal-Hander geaendert: die Fehlermeldung "interrupted system call" sollte so nicht mehr auftreten. - "spaeter" neu connectierende Server werden nun im Netz angekuendigt. - SERVER-Meldungen an andere Server sind nun korrekt sortiert. - Clients werden nun korrekt sowohl nur ueber den Nickname als auch die komplette "Host Mask" erkannt. ngIRCd 0.0.3, 16.01.2002 - Server-Links vollstaendig implementiert: der ngIRCd kann nun auch "Sub-Server" haben, also sowohl als Leaf-Node als auch Hub in einem IRC-Netzwerk arbeiten. - MODE und NICK melden nun die Aenderungen an andere Server, ebenso die Befehle QUIT und SQUIT. - WHOIS wird nun immer an den "Original-Server" weitergeleitet. - Parses handhabt Leerzeichen zw. Parametern nun etwas "lockerer". - Status-Codes an den Server selber werden ignorier. - Log-Meldungen und Log-Level ueberarbeitet und korrigiert. - Kommandozeilen-Parser: Debug- und No-Daemon-Modus, Hilfe. - ngIRCd wandelt sich nun in einen Daemon (Hintergrundprozess) um. - WHOIS korrigiert: Anfrage wurde u.U. an User geforwarded anstatt vom Server beantwortet zu werden. - neue Befehle: LUSERS, LINKS - Client-Modes von Remote-Servern wurden nicht korrekt uerbernommen. ngIRCd 0.0.2, 06.01.2002 - Struktur der Konfigurationsdatei geaendert: sie ist nun "Samba like", d.h. sie besteht aus Abschnitten (siehe "doc/sample-ngircd.conf"). - Es koennen mehrere IRC-Server-Opertatoren konfiguriert werden. - Zombies der Resolver-Prozesse werden nun ordentlich "getoetet". - NICK kann nun die Gross- und Kleinschreibung eines Nicks aendern. - ein Server-Passwort ist nun konfigurierbar. - neue Befehle: ERROR, SERVER, NJOIN (nur als "Fake"), SQUIT. - Asynchroner Resolver Hostname->IP implementiert. - Server-Links teilweise implementiert: bisher kann der ngIRCd jedoch nur "leafed server" sein, d.h. keine "Client-Server" haben. Einige Befehle sind auch noch nicht (optimal) angepasst: PRIVMSG funktioniert aber bereits, ebenso wie WHOIS (letzterer wird immer an den Server, auf dem der User registriert ist, weitergegeben). - "arpa/inet.h" wird nur noch includiert, wenn vorhanden. - Fehler bei select() fuerhen nun zum Abbruch von ngIRCd, bisher landete der Server zumeist in einer Endlosschleife. - Logmeldungen und Level an vielen Stellen verbessert. - lokalen Usernamen wird nun ein "~" vorangestellt, da bisher noch keine Ident-Anfragen gemacht werden. ngIRCd 0.0.1, 31.12.2001 - erste oeffentliche Version von ngIRCd als "public preview" :-) ngircd-21/.mailmap0000644000175000116100000000015711423760211011102 00000000000000# mailmap file for git-[short]log and git-blame Alexander Barton Ali Shemiran ngircd-21/depcomp0000755000175000000000000004426712005170750011037 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2009-04-28.21; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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 # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u="sed s,\\\\\\\\,/,g" depmode=msvisualcpp fi case "$depmode" in 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. ## 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 rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. 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.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" 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'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. 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 # With Tru64 cc, shared objects can also be used to make a # 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 $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 # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | 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" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: ngircd-21/Makefile.am0000644000175000116100000000540212206130744011515 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # # 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. # AUTOMAKE_OPTIONS = gnu SUBDIRS = doc src man contrib EXTRA_DIST = autogen.sh configure.ng .mailmap clean-local: osxpkg-clean rm -f build-stamp* maintainer-clean-local: rm -rf autom4te.cache rm -f Makefile.in Makefile aclocal.m4 configure configure.ac rm -f ar-lib mkinstalldirs missing depcomp install-sh rm -f config.log debian testsuite: cd src/testsuite && make check lint: cd src/ngircd && make lint srcdoc: cd doc && make srcdoc have-xcodebuild: @xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -list \ >/dev/null 2>&1 \ || ( echo; echo "Error: \"xcodebuild\" not found!"; echo; exit 1 ) have-packagemaker: @packagemaker >/dev/null 2>&1; [ $$? -le 1 ] \ || ( echo; echo "Error: \"packagemaker\" not found!"; echo; exit 2) xcode: have-xcodebuild rel=`git describe|sed -e 's/rel-//g'|sed -e 's/-/~/'`; \ 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 \ -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 -i osxpkg: have-packagemaker osxpkg-dest cd contrib/MacOSX && packagemaker --no-recommend \ --doc ngIRCd.pmdoc \ --out ../../$(distdir).mpkg rm -f $(distdir).mpkg.zip zip -ro9 $(distdir).mpkg.zip $(distdir).mpkg make osxpkg-clean osxpkg-clean: [ ! -e ngircd.dest ] || sudo -n rm -rf ngircd.dest rm -rf ngircd.dest $(distdir).mpkg osxpkg-dest: have-xcodebuild osxpkg-clean 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 sudo chown -R root:wheel ngircd.dest .PHONY: deb have-packagemaker have-xcodebuild lint osxpkg osxpkg-clean \ osxpkg-dest rpm srcdoc testsuite xcode xcode-clean # -eof- ngircd-21/config.sub0000644000175000116100000010550212206130744011443 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-08-18' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # 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 # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # 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) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) 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 ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) 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 ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ngircd-21/NEWS0000644000175000116100000012013312234273212010156 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2013 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- NEWS -- ngIRCd 21 (2013-10-30) - Call arc4random_stir() in forked subprocesses, when available. This is required by FreeBSD <10 and current NetBSD at least to correctly initialize the "arc4" random number generator on these platforms. ngIRCd 21~rc2 (2013-10-20) - Report the correct configuration file name on configuration errors, support longer configuration lines, and warn when lines are truncated. ngIRCd 21~rc1 (2013-10-05) - Actually KILL clients on GLINE/KLINE. (Closes bug #156) - Add support to show all user links using the "STATS L" (uppercase) command (restricted to IRC Operators). - Implement configurable SSL cipher list selection for GnuTLS and OpenSSL using the new configuration option "CipherList". In addition, this changes the defaults to more secure values: "HIGH:!aNULL:@STRENGTH" for OpenSSL, and "SECURE128" for GnuTLS. - Show connection flag "s" (SSL) in RPL_TRACE{LINK|SERVER} messages: now you can check if a server-to-server link is SSL-encrypted or not using the IRC "TRACE" command. - Implement the new configuration option "DefaultUserModes" which lists user modes that become automatically set on new local clients right after login. Please note that only modes can be set that the client could set on itself, so you can't set "a" (away) or "o" (IRC Op), for example! User modes "i" (invisible) or "x" (cloaked) etc. are "interesting", though. (Closes bug #160) - Add support for the new METADATA "account" property, which allows services to automatically identify users after netsplits and across service restarts. - Implement a new configuration option "AllowedChannelTypes" that lists all allowed channel types (channel prefixes) for newly created channels on the local server. By default, all supported channel types are allowed. If set to the empty string, local clients can't create new channels at all, which equals the old "PredefChannelsOnly = yes" setting. This change deprecates the "PredefChannelsOnly" variable, too, but it is still supported and translated to the appropriate "AllowedChannelTypes" setting. When the old "PredefChannelsOnly" variable is processed, a warning message is logged. (Closes bug #152) - Add support for "client certificate fingerprinting". When a client passes an SSL certificate to the server, the "fingerprint" will be forwarded in the network which enables IRC services to identify the user using this certificate and not using passwords. - Implement a new configuration option "IncludeDir" in the "[Options]" section that can be used to specify a directory which can contain further configuration files and configuration file snippets matching the pattern "*.conf". These files are read in after the main server configuration file ("ngircd.conf" by default) has been read in and parsed. The default is "$SYSCONFDIR/ngircd.conf.d", so that it is possible to adjust the configuration only by placing additional files into this directory. (Closes bug #157) - Add Travis-CI configuration file (".travis.yml") to project. - ngIRCd now accepts user names including "@" characters, saves the unmodified name for authentication but stores only the part in front of the "@" character as "IRC user name". And the latter is how ircd2.11, Bahamut, and irc-seven behave as well. (Closes bug #155) - Lots of IRC "information functions" like ADMIN, INFO, ... now accept server masks and names of connected users (in addition to server names) for specifying the target server of the command. (Closes bug #153) - Implement a new configuration option "IdleTimeout" in the "[Limits]" section of the configuration file which can be used to set a timeout in seconds after which the whole daemon will shutdown when no more connections are left active after handling at least one client. The default is 0, "never". This can be useful for testing or when ngIRCd is started using "socket activation" with systemd(8), for example. - Implement support for systemd(8) "socket activation". - Enable WHOIS to display information about IRC Services using the new numeric 310(RPL_WHOISSERVICE) This numeric is used for this purpose by InspIRCd, for example -- but as usual, other numerics are in use, too, like 613 in UltimateIRCd ... Please note that neither the Operator (+o) not the "bot status" (+B) of an IRC service is displayed in the output. - Update systemd(8) example configuration files in ./contrib/ directory: the "ngircd.service" file now uses the "forking" service type which enhances the log messages shown by "systemctl status ngircd.service", and the new "ngircd.socket" file configures a systemd socket that configures a socket for ngIRCd and launches the daemon on demand. - Enhance help system and the HELP command: now a "help text file" can be set using the new configuration option "HelpFile" ("global" section), which is read in and parsed on server startup and configuration reload, and then is used to output individual help texts to specific topics. Please see the file ./doc/Commands.txt for details. ngIRCd 20.3 (2013-08-23) - This release is a bugfix release only, without new features. - Security: Fix a denial of service bug (server crash) which could happen when the configuration option "NoticeAuth" is enabled (which is NOT the default) and ngIRCd failed to send the "notice auth" messages to new clients connecting to the server (CVE-2013-5580). ngIRCd 20.2 (2013-02-15) - This release is a bugfix release only, without new features. - Security: Fix a denial of service bug in the function handling KICK commands that could be used by arbitrary users to to crash the daemon (CVE-2013-1747). ngIRCd 20.1 (2013-01-02) - This release is a bugfix release only, without new features. ngIRCd 20 (2012-12-17) - Allow user names ("INDENT") up to 20 characters when ngIRCd has not been configured for "strict RFC mode". This is useful if you are using external (PAM) authentication mechanisms that require longer user names. Patch suggested by Brett Smith , see . ngIRCd 20~rc2 (2012-12-02) - Rework cloaked hostname handling and implement the "METADATA cloakhost" subcommand: Now ngIRCd uses two fields internally, one to store the "real" hostname and one to save the "cloaked" hostname. This allows "foreign servers" (aka "IRC services") to alter the real and cloaked hostnames of clients without problems, even when the user itself issues additional "MODE +x" and "MODE -x" commands. ngIRCd 20~rc1 (2012-11-11) - Update doc/Services.txt: describe the upcoming version of Anope 1.9.8, then including a protocol module for ngIRCd. And remove our own patches in ./contrib/Anope because they aren't supported any more ... - Implement new "METADATA" command which can be used by remote servers and IRC services to update client metadata like the client info text ("real name"), user name, and hostname, and use this command to configure an cloaked hostname (user mode "+x") on remote servers: This prevents "double cloaking" of hostnames and even cloaked hostnames are in sync on all servers supporting "METADATA" now. - Implement new IRC "SVSNICK" command to allow remote servers (and IRC services) to change nicknames of already registered users. The SVSNICK command itself doesn't change the nickname, but it becomes forwarded to the server to which the user is connected to. And then this server initiates the real nickname changing using regular NICK commands. This allows to run mixed networks with old servers not supporting the SVSNICK command, because SVSNICK commands for nicknames on such servers are silently ignored and don't cause a desynchronization of the network. - New configuration option "MaxListSize" to configure the maximum number of channels returned by a LIST command. The default is 100, as before. - Implement user mode "b", "block messages": when a user has set mode "b", all private messages and notices to this user are blocked if they don't originate from a registered user, an IRC Op, server or service. The originator gets an error numeric sent back in this case, ERR_NONONREG_MSG (486), which is used by UnrealIRCd, too. (Closes #144) - Implement channel mode "V" (invite disallow): If the new channel mode "V" is set, the INVITE command becomes invalid and all clients get the new ERR_NOINVITE_MSG (518) reply. (Closes #143) - Implement channel mode "Q" and user mode "q": Both modes protect users from channel kicks: only IRC operators and servers can kick users having mode "q" or in channels with mode "Q". (Closes #141) - Allow users to "cloak" their hostname only when the configuration variable "CloakHostModeX" (introduced in 19.2) is set. Otherwise, only IRC operators, other servers, and services are allowed to set the user mode "+x": this prevents regular users from changing their hostmask to the name of the IRC server itself, which confused quite a few people ;-) (Closes #133) - New configuration option "OperChanPAutoOp": If disabled, IRC operators don't become channel operators in persistent channels when joining. Enabled by default, which has been the behavior of ngIRCd up to this patch. (Closes #135) - Allow IRC operators to see secret (+s) channels in LIST command as long as the "MorePrivacy" configuration option isn't enabled in the configuration file. (Closes #136) - Implement new (optional) IRC+ "CHARCONV" command to set a client character set that the server translates all messages to/from UTF-8. This feature requires the "libiconv" library and must be enabled using the new "--with-iconv" option of the ./configure script. See doc/Protocol.txt for details. (Closes #109) - Implement user mode "B" ("Bot flag"): it is settable and unsettable by every (non-restricted) client. This is how Unreal and InspIRCd do behave, and so do we :-) - Implement channel mode "M": Only the server, identified users and IRC operators are able to talk in such a channel. - Block nicknames that are reserved for services and are defined using the configuration variable "ServiceMask" in "Server" blocks; And this variable now can handle more than one mask separated by commas. - Implemented XOP channel user modes: "Half Op" ("+h", prefix "%") can set the channel modes +imntvIbek and kick all +v and normal users; "Admin" ("+a", prefix "&") can set channel modes +imntvIbekoRsz and kick all +o, +h, +v and normal users; and "Owner" ("+q", prefix "~") can set channel modes +imntvIbekoRsz and kick all +a, +o, +h, +v and normal users. - Implement hashed cloaked hostnames for both the "CloakHost" and "CloakHostModeX" configuration options: now the admin can use the new '%x' placeholder to insert a hashed version of the clients hostname, and the new configuration option "CloakHostSalt" defines the salt for the hash function. When "CloakHostSalt" is not set (the default), a random salt will be generated after each server restart. ngIRCd Release 19.2 (2012-06-19) ngIRCd 19.2~rc1 (2012-06-13) - New configuration option "CloakHostModeX" to configure the hostname that gets used for IRC clients which have user mode "+x" enabled. Up to now, the name of the IRC server itself has been used for this, which still is the default when "CloakHostModeX" isn't set. - Add instructions for setting up Atheme IRC services. - Implement support for IRC capability handling, the new "CAP" command, and capablity "multi-prefix" which allows both the NAME and WHO command handlers to return more than one "class prefix" to the client. ngIRCd Release 19.1 (2012-03-19) - Really include _all_ patches to build the Anope module into the distribution archive ... ooops! ngIRCd Release 19 (2012-02-29) ngIRCd 19~rc1 (2012-02-12) - Update preliminary ngIRCd protocol module for Anope 1.9.6, which now is the only supported version. - New numeric RPL_WHOISHOST_MSG(378), which returns the DNS host name (if available) and the IP address of a client in the WHOIS reply. Only the user itself and local IRC operators get this numeric. - Implement channel exception list (mode 'e'). This allows a channel operator to define exception masks that allow users to join the channel even when a "ban" would match and prevent them from joining: the exception list (e) overrides the ban list (b). - Implement user mode 'C': If the target user of a PRIVMSG or NOTICE command has the user mode 'C' set, it is required that both sender and receiver are on the same channel. This prevents private flooding by completely unknown clients. - New RPL_WHOISREGNICK_MSG(307) numeric in WHOIS command replies: it indicates if a nickname is registered (if user mode 'R' set). - Limit channel invite, ban, and exception lists to 50 entries and fix duplicate check and error messages when adding already listed entries or deleting no (longer) existing ones. - Limit the number of list items in the reply of LIST (100), WHO (25), WHOIS (10), and WHOWAS (25) commands. - Limit the MODE command to handle a maximum number of 5 channel modes that require an argument (+Ibkl) per call and report this number in the ISUPPORT(005) numeric: "MODES=5". - LINKS command: support parameter to limit the reply. - Add 1 second penalty for every further target on PRIVMSG/NOTICE commands: this reduces the possibility of flooding channels with commands like "PRIVMSG/NOTICE #a,#n,#c,... :message" a little bit. Problem noticed by Cahata, thanks! - New configuration option "PAMIsOptional": when set, clients not sending a password are still allowed to connect: they won't become "identified" and keep the "~" character prepended to their supplied user name. See "man 5 ngircd.conf" for details. - Fixed handling of WHO commands. This fixes two bugs: "WHO " returned nothing at all if the user was "+i" (reported by Cahata, thanks) and "WHO " returned channel names instead of "*" when the user was member of a (visible) channel. - LUSERS reply: only count channels that are visible to the requesting client, so the existence of secret channels is no longer revealed by using LUSERS. Reported by Cahata, thanks! - Unknown user and channel modes no longer stop the mode parser, but are simply ignored. Therefore modes after the unknown one are now handled. This is how ircd2.10/ircd2.11/ircd-seven behave, at least. Reported by Cahata, thanks! - Implement IRC commands "GLINE" and "KLINE" to ban users. G-Lines are synchronized between server on peering, K-Lines are local only. If you use "*!@" or "*!*@" masks, these connections are blocked even before the user is fully logged in (before PASS, NICK, and USER commands have been processed) and before the child processes for authentication are forked, so resource usage is smaller. - Added doc/Modes.txt: document modes supported by ngIRCd. - Implement user mode "R": indicates that the nickname of this user is "registered". This mode isn't handled by ngIRCd itself, but must be set and unset by IRC services like Anope. - Implement channel mode "R": only registered users (having the user mode "R" set) are allowed to join this channel. - Test suite: bind to loopback (127.0.0.1) interface only. - Handle unknown user and channel modes: these modes are saved and forwarded to other servers, but ignored otherwise. - Handle channel user modes 'a', 'h', and 'q' from remote servers. These channel user modes aren't used for anything at the moment, but ngIRCd knows that these three modes are "channel user modes" and not "channel modes", that is that these modes take an "nickname" argument. Like unknown user and channel modes, these modes are saved and forwarded to other servers, but ignored otherwise. ngIRCd Release 18 (2011-07-10) - Add preliminary ngIRCd protocol module for Anope 1.9 to contrib/Anope/. ngIRCd 18~rc2 (2011-06-29) - GnuTLS: use 1024 bits as minimum size of the DH prime. This enables ngIRCd to accept incoming connections from other servers and clients that "only" use at least 1024 bits again, like ngIRCd 17 did (and no longer requires 2048 bits for incoming connections). ngIRCd 18~rc1 (2011-06-27) - New configuration option "MorePrivacy" to "censor" some user information. When enabled, signon time and idle time is left out. Part and quit messages are made to look the same. WHOWAS requests are silently dropped. All of this is useful if one wish to conceal users that access the ngircd servers from TOR or I2P. - New configuration option "ScrubCTCP" to scrub incoming CTCP commands. If activated, the server silently drops incoming CTCP requests from both other servers and from users. The server that scrubs CTCP will not forward the CTCP requests to other servers in the network either, which can spell trouble if not every oper knows about the CTCP-scrubbing. Scrubbing CTCP commands also means that it is not possible to send files between users. There is one exception to the CTCP scrubbing performed: ACTION ("/me commands") requests are not scrubbed. - Restructure ngIRCd configuration file: introduce new [Limits], [Options], and [SSL] sections. The intention of this restructuring is to make the [Global] section much cleaner, so that it only contains variables that most installations must adjust to the local requirements. All the optional variables are moved to [Limits], for configurable limits and timers of ngIRCd, and [Options], for optional features. All SSL-related variables are moved to [SSL] and the "SSL"-prefix is stripped. The old variables in the [Global] section are deprecated now, but are still recognized. => Don't forget to check your configuration, use "ngircd --configtest"! - New documentation "how to contribute": doc/Contributing.txt. - Avoid needlessly scary 'buffer overflow' messages: When the write buffer space grows too large, ngIRCd has to disconnect the client to avoid wasting too much memory, which is logged with a scary 'write buffer overflow' message. Change this to a more descriptive wording. - New configuration option "RequireAuthPing": PING-PONG on login. When enabled, this configuration option lets ngIRCd send a PING with an numeric "token" to clients logging in; and it will not become registered in the network until the client responds with the correct PONG. - New configuration option "NoticeAuth": send NOTICE AUTH on connect. When active, ngircd will send "NOTICE AUTH" messages on client connect time like e.g. snircd (QuakeNet) does. - Add support for up to 3 targets in WHOIS queries, also allow up to one wildcard query from local hosts. Follows ircd 2.10 implementation rather than RFC 2812. At most 10 entries are returned per wildcard expansion. - ngircd.conf(5) manual page: describe types of configuration variables (booleans, text strings, integer numbers) and add type information to each variable description. - Terminate incoming connections on HTTP commands "GET" and "POST". - New configuration option "CloakHost": when set, this host name is used for every client instead of the real DNS host name (or IP address). - New configuration option "CloakUserToNick": when enabled, ngIRCd sets every clients' user name to their nickname and hides the user name supplied by the IRC client. - Make write buffers bigger, but flush early. Before this change, a client got disconnected if the buffer flushing at 4k failed, now regular clients can store up to 32k and servers up 64k even if flushing is not possible at the moment. This enhances reliability on slow links. - Allow "Port = 0" in [Server] blocks. Port number 0 marks remote servers that try to connect to this daemon, but where this daemon never tries to establish a connection on its own: only incoming connections are allowed. - Enable WHOIS command to return information about services. - Implement channel mode 'O': "IRC operators only". This channel mode is used on DALnet (bahamut), for example. - Remove support for ZeroConf/Bonjour/Rendezvous service registration including the "[No]ZeroConf" configuration option. - Deprecate NoXX-Options in ngircd.conf and move new variants into our new [Options] section: 'NoDNS=no' => 'DNS=yes', 'NoIdent=no' => 'Ident=yes', 'NoPAM=no' => 'PAM=yes', and 'NoZeroConf=no' => 'ZeroConf=yes' (and vice-versa). The defaults are adjusted accordingly and the old variables in [Global] are still accepted, so there is no functional change. ngIRCd Release 17.1 (2010-12-19) - Don't log critical (or worse) messages to stderr - Remove "error file" when compiled with debug code enabled - New numeric 329: get channel creation time on "MODE #chan" commands ngIRCd Release 17 (2010-11-07) - doc: change path names in sample-ngircd.conf depending on sysconfdir ngIRCd 17~rc2 (2010-10-25) - Generate ngIRCd version number from GIT tag. - Make sourcecode compatible with ansi2knr again. This allows to compile ngIRCd using a pre-ANSI K&R C compiler again. ngIRCd 17~rc1 (2010-10-11) - New configuration option "NoZeroConf" to disable service registration at runtime even if ngIRCd is compiled with support for ZeroConf (e.g. using Howl, Avahi or on Mac OS X). - New configuration option "SyslogFacility" to define the syslog "facility" (the "target"), to which ngIRCd should send its log messages. Possible values are system dependant, but most probably "auth", "daemon", "user" and "local1" through "local7" are possible values; see syslog(3). Default is "local5" for historical reasons. - Dump the "internal server state" (configured servers, established connections and known clients) to the console or syslog when receiving the SIGUSR2 signal and debug mode is enabled. - Enable the daemon to disable and enable "debug mode" on runtime using signal SIGUSR1, when debug code is compiled in, not only on startup using the command line parameters. - Implement user mode "x": host name cloaking (closes: #102). - Change MOTD file handling: ngIRCd now caches the contens of the MOTD file, so the daemon now requires a HUP signal or REHASH command to re-read the MOTD file when its content changed. - Allow IRC ops to change channel modes even without OperServerMode set. - Allow IRC operators to use MODE command on any channel (closes: #100). - New configuration option "NoPAM" to disable PAM. - Implement asynchronous user authentication using PAM, please see the file doc/PAM.txt for details. - Add some documentation for using BOPM with ngIRCd, see doc/Bopm.txt. - Implement user mode "c": receive connect/disconnect NOTICEs. Note that this new mode requires the user to be an IRC operator. - Show SSL status in WHOIS output, numeric 275. ngIRCd Release 16 (2010-05-02) ngIRCd 16~rc2 (2010-04-25) - Enhace connection statistics counters: display total number of served connections on daemon shutdown and when a new client connects using the new numeric RPL_STATSCONN (250). ngIRCd 16~rc1 (2010-03-25) - Implement WEBIRC command used by some Web-IRC frontends. The password required to secure this command must be configured using the new "WebircPassword" variable in the ngircd.conf file. - Remove limit on max number of configured irc operators. - A new channel mode "secure connections only" (+z) has been implemented: Only clients using a SSL encrypted connection to the server are allowed to join such a channel. But please note three things: a) already joined clients are not checked when setting this mode, b) IRC operators are always allowed to join every channel, and c) remote clients using a server not supporting this mode are not checked either and therefore always allowed to join. 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-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, but ngircd will print a warning if they are used in the config file. ngIRCd 0.12.0 (2008-05-13) ngIRCd 0.12.0-pre2 (2008-04-29) - IPv6: Add config options to disable ipv4/ipv6 support. ngIRCd 0.12.0-pre1 (2008-04-20) - Add IPv6 support. - Install a LaunchDaemon script to start/stop ngIRCd on Mac OS X. - Implemented IRC commands INFO, SUMMON (dummy), and USERS (dummy) and enhanced test suite to check these commands. (Dana Dahlstrom) - IRC_WHO now supports search patterns and will test this against user nickname/server name/host name, etc. as required by RFC 2812, Section 3.6.1. (reported by Dana Dahlstrom) - Implement RFC 2812 handling of "0" argument to 'JOIN': must be treated as if the user had sent PART commands for all channels the user is a member of. (Dana Dahlstrom) - Allow NOTICEs to be sent to a channel. (Fabian Schlager) 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 address to use when connecting to remote server. - New configuration option "MaxNickLength" to specify the allowed maximum length of user nicknames. Note: must be unique in an IRC network! - Numeric 317: implemented "signon time" (displayed in WHOIS result). - Added new server configuration option "Passive" for "Server" blocks to disable automatic outgoing connections (similar to -p option to ngircd, but only for the specified server). (Tassilo Schweyer) - Added support for the WALLOPS command. Usage is restricted to IRC operators. ngIRCd 0.10.2 (2007-06-08) - Predefined channel configuration now allows specification of channel key (mode k) and maximum user count (mode l): variables "Key" and "MaxUsers". - When using the epoll() IO interface, compile in the select() interface as well and fall back to it when epoll() isn't available on runtime. - Added support for IO APIs "poll()" and "/dev/poll". ngIRCd 0.10.1 (2006-12-17) - Allow PASS syntax defined in RFC 1459 for server links, too. - New configuration option "PredefChannelsOnly": if set, clients can only join predefined channels. ngIRCd 0.10.0 (2006-10-01) ngIRCd 0.10.0-pre1 (2006-08-02) - Enhanced DIE to accept a single parameter ("comment text") which is sent to all locally connected clients before the server goes down. - JOIN now supports more than one channel key at a time. - Implemented numeric "333": Time and user name who set a channel topic. - Channel topics are no longer limited to 127 characters: now the only limit is the maximum length of an IRC command, i. e. 512 bytes (in practice, this limits the topic to about 490 characters due to protocol overhead). - Reverse DNS lookup code now checks the result by doing an additional lookup to prevent spoofing. - Added new IO layer which (optionally) supports epoll() and kqueue() in addition to the select() interface. ngIRCd 0.9.0 (2005-07-24) - Never run with root privileges but always switch the user ID. - Make "netsplit" messages RFC compliant. - Implemented the IRC function "WHOWAS". - New configuration option "OperServerMode" to enable a workaround needed when running an network with ircd2 servers and "OperCanUseMode" enabled to prevent the ircd2 daemon to drop mode changes of IRC operators. Patch by Florian Westphal, . - Implemented support for "secret channels" (channel mode "s"). - New configuration option "Mask" for [Operator] sections to limit OPER commands to users with a specific IRC mask. Patch from Florian Westphal. - New configuration variable "PidFile", section "[Global]": if defined, the server writes its process ID (PID) to this file. Default: off. Idea of Florian Westphal, . - Added support for the Howl (http://www.porchdogsoft.com/products/howl/) Rendezvous API, in addition to the API of Apple (Mac OS X). The available API will be autodetected when you call "./configure --with-rendezvous". ngIRCd 0.8.0 (2004-06-26) - Two new configuration options: "ChrootDir" and "MotdPhrase", thanks to Benjamin Pineau . Now you can force the daemon to change its root and working directory to something "safe". MotdPhrase is used to define an "MOTD string" instead of a whole file, useful if the "real" MOTD file would be outside the "jail". - INVITE- and BAN-lists become synchronized between IRC+ servers when establishing new connections, if the peer supports this as well. - The type of service (TOS) of all sockets is set to "interactive" now. - Added short command line option "-t" as alternative to "--configtest". - Added optional support for "IDENT" lookups on incoming connections. You have to enable this function with the ./configure switch "--with-ident". The default is not to do IDENT lookups. ngIRCd 0.7.5 (2003-07-11) - New configuration variable "MaxConnectionsIP" to limit the number of simultaneous connections from a single IP that the server will accept. This configuration options lowers the risk of denial of service attacks (DoS), the default is 5 connections per client IP. - Added new configuration variable "Listen" to bind all listening sockets of the server to a single IP address. ngIRCd 0.7.1 (2003-07-18) - Added support for GNU/Hurd. ngIRCd 0.7.0 (2003-05-01) - New command CONNECT to enable and add server links. The syntax is not RFC-compatible: use "CONNECT " to enable and connect an configured server and "CONNECT " to add a new server (ngIRCd tries to connect new servers only once!). - Added DISCONNECT command ("DISCONNECT ") to disable servers. - New command TRACE (you can trace only servers at the moment). - New command HELP that lists all understood commands. - ngIRCd can register itself with Rendezvous: to enable support pass the new switch "--with-rendezvous" to configure. - Added support for TCP Wrappers library: pass "--with-tcp-wrappers" to configure to enable it. - Changed some configure options to use "--with"/"--without" as prefix instead of "--enable"/"--disable": "--without-syslog", "--without-zlib", "--with-tcp-wrappers", and "--with-rendezvous". - Enhanced manual pages ngircd(8) and ngircd.conf(5). - Documentation is now installed in $(datadir)/doc/ngircd. Older news (sorry, only available in german language): ngIRCd 0.6.0, 2002-12-24 - beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR noch eine Statistik ueber die empfangene und gesendete Datenmenge an. - Connection-Strukturen werden nun "pool-weise" verwaltet; der Pool wird bei Bedarf bis zu einem konfigurierten Limit vergroessert. - Mit der neuen Konfigurationsvariable "MaxConnections" (Sekion "Global") kann die maximale Anzahl gleichzeitiger Verbindungen begrenzt werden. Der Default ist -1, "unlimitiert". - der Server erkennt nun, ob bereits eine eingehende Verbindung von einem Peer-Server besteht und versucht dann nicht mehr, selber eine eigene ausgehende Verbindung zu diesem auufzubauen. Dadurch kann nun auf beiden Servern in der Konfiguration ein Port fuer den Connect konfiguriert werden (beide Server versuchen sich dann gegenseitig zu connectieren). - Server identifizieren sich nun mit asynchronen Passwoertern, d.h. das Passwort, welches A an B schickt, kann ein anderes sein als das, welches B als Antwort an A sendet. In der Konfig.-Datei, Abschnitt "Server", wurde "Password" dazu durch "MyPassword" und "PeerPassword" ersetzt. - Der Server kann nun zur Laufzeit die Konfiguration neu einlesen: dies macht er nach dem Befehl REHASH oder wenn ein HUP-Signal empfangen wird. - Server-Server-Links koennen nun komprimiert werden, dazu wird die zlib (www.zlib.org) benoetigt. Unterstuetzt die Gegenseite die Komprimierung nicht, wird automatisch unkomprimiert kommuniziert. Das Verfahren ist kompatibel mit dem Original-ircd 2.10.3, d.h. beide Server koennen miteinander ueber komprimiert Links kommunizieren. - neue Konfigurations-Variable "MaxJoins": Hiermit kann die maximale Zahl der Channels, in denen ein User Mitglied sein kann, begrent werden. - neue Channel-Modes l (User-Limit) und k (Channel-Key) implementiert. ngIRCd 0.5.0, 20.09.2002 - AIX (3.2.5), HP-UX (10.20), IRIX (6.5), NetBSD (1.5.3/m68k) und Solaris (2.5.1, 2.6) gehoeren nun auch zu den unterstuetzten Platformen. - Unter A/UX (und evtl. weiteren Systemen) kompiliert der ngIRCd nun mit dem "nativen" (ggf. pre-ANSI) Compiler. - "persistente Channels" (Mode 'P') implementiert: diese koennen in der Konfigurationsdatei definiert werden (Sektion "Channel", vgl. Beispiel- Konfiguration "sample-ngircd.conf") und bleiben auch dann bestehen, wenn kein User mehr im Channel ist. - neue IRC-Befehle: KICK, INVITE, ADMIN, CHANINFO; LIST wurde erweitert. Mit dem neuen Befehl CHANINFO synchronisieren Server, die das IRC+- Protokoll unterstuetzen, Channel-Modes und Topics. Fuer den ADMIN-Befehl gibt es neue Konfigurationsoptionen (Sektion "Global"): "AdminInfo1", "AdminInfo2" und "AdminEMail". - Invite- und Ban-Lists implementiert. - neue Konfigurationsoption "OperCanUseMode" (Sektion "Global"): ist sie aktiv, koennen IRC-Operatoren immer Channel-Modes setzen. - "Test-Suite" begonnen: mit "make check" wird sie durchlaufen. ngIRCd 0.4.2, 29.04.2002 - IRC-Funktion LIST implementiert; bisher werden allerdings noch keine Regular Expressions (bis auf "*") unterstuetzt. ngIRCd 0.4.0, 01.04.2002 - WHO implementiert (bisher ohne komplette Unterstuetzung von Masks). - stderr wird nun in eine Datei umgelenkt (/ngircd-.err). Laeuft der Server nicht im Debug-Modus, so wird diese bei Programm- ende geloescht. Sollte der Server abstuerzen, finden sich hier evtl. zusaetzliche Informationen. - Server-Gruppen implementiert: es wird immer nur zu einem Server in einer Gruppe eine Verbindung aufgebaut, klappt es beim ersten Server nicht, so wird der naechste probiert. - Clients und Channels werden nicht mehr ueber ihren Namen, sondern einen Hash-Wert gesucht: sollte deutlich schneller sein. - neuer Kommandozeilen-Parameter "--configtest": die Konfiguration wird gelesen und die dann verwendeten Werte angezeigt. - Client-Mode "s" (Server Notices) implementiert. - mit dem neuen Kommandozeilen-Parameter "--config"/"-f" kann eine alternative Konfigurationsdatei angegeben werden. - nach dem Start kann der ngIRCd, wenn er mit root-Rechten laeuft, zu einer anderen User-ID und Group-ID wechseln. ngIRCd 0.3.0, 02.03.2002 - bekommt der Server ein HUP-Signal, so startet er neu -- genau so, wie er auf den IRC-Befehl RESTART reagiert. - neuer Kommandozeilen-Schalter "--passive" (-p): wird er angegeben, so verbindet sich der ngIRCd nicht mehr automatisch zu anderen Servern. Zum Debuggen manchmal ganz praktisch :-) - neue Befehle VERSION und KILL implementiert. NAMES korrigiert. - Anpassungen an A/UX: gehoert nun auch zu den unterstuetzten Platformen. - AWAY (und der User-Mode 'a') ist nun implementiert. - der ngIRCd unterstuetzt nun Channel-Topics (TOPIC-Befehl). - Channel- und Nicknames werden nun ordentlich validiert. ngIRCd 0.2.0, 15.02.2002 - Begonnen Channel-Modes und User-Channel-Modes zu implementieren: der Server versteht an User-Modes o und v, beachtet letzteres allerdings noch nirgends. Bekannte (aber nicht beachtete!) Channel-Modes sind bisher a, m, n, p, q, s und t. Diese Modes werden von Usern ange- nommen, von anderen Servern werden auch unbekannte Modes uebernommen. - Nach dem Connect eines Users werden LUSERS-Informationen angezeigt. ngIRCd 0.1.0, 29.01.2002 - Channels implementiert, bisher jedoch noch ohne Channel-Modes, d.h. es gibt keine Channel-Ops, kein Topic, kein "topic lock" etc. pp. Chatten in Channels ist aber natuerlich moeglich ;-) Dadurch zum Teil groessere Aenderungen an bisherigen Funktionen. - neue Befehle fuer Channles: JOIN, PART und NJOIN. - FAQ.txt in doc/ begonnen. ngIRCd 0.0.3, 16.01.2002 - Server-Links vollstaendig implementiert: der ngIRCd kann nun auch "Sub-Server" haben, also sowohl als Leaf-Node als auch Hub in einem IRC-Netzwerk arbeiten. - WHOIS wird nun immer an den "Original-Server" weitergeleitet. - Parser handhabt Leerzeichen zw. Parametern nun etwas "lockerer". - Kommandozeilen-Parser: Debug- und No-Daemon-Modus, Hilfe. - ngIRCd wandelt sich nun in einen Daemon (Hintergrundprozess) um. - neue Befehle: LUSERS, LINKS. ngIRCd 0.0.2, 06.01.2002 - neuer Aufbau der Konfigurationsdatei, - mehrere IRC-Operatoren koennen konfiguriert werden, - Server-Links teilweise implementiert. Bisher kann der ngIRCd jedoch nur "leafed server" sein, d.h. keine "Client-Server" haben. ngIRCd 0.0.1, 31.12.2001 - erste oeffentliche Version von ngIRCd als "public preview" :-) ngircd-21/configure0000754000175000116100000073700612234274151011405 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.67 for ngIRCd 21. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: ngircd-ml@ngircd.barton.de about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script $0: under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='ngIRCd' PACKAGE_TARNAME='ngircd' PACKAGE_VERSION='21' PACKAGE_STRING='ngIRCd 21' PACKAGE_BUGREPORT='ngircd-ml@ngircd.barton.de' PACKAGE_URL='http://ngircd.barton.de/' ac_unique_file="src/ngircd/ngircd.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_list= ac_func_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS ANSI2KNR U EGREP GREP CPP RANLIB LN_S am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking with_syslog with_zlib with_select with_poll with_devpoll with_epoll with_kqueue with_openssl with_gnutls with_tcp_wrappers with_ident with_pam enable_ircplus with_iconv enable_ipv6 enable_sniffer enable_debug enable_strict_rfc ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures ngIRCd 21 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/ngircd] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of ngIRCd 21:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0') --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-ircplus disable IRC+ protocol --enable-ipv6 enable IPv6 protocol support --enable-sniffer enable IRC traffic sniffer (enables debug mode) --enable-debug show additional debug output --enable-strict-rfc strict RFC conformance -- may break clients! Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-syslog disable syslog (autodetected by default) --without-zlib disable zlib compression (autodetected by default) --without-select disable select IO support (autodetected by default) --without-poll disable poll support (autodetected by default) --without-devpoll disable /dev/poll IO support (autodetected by default) --without-epoll disable epoll IO support (autodetected by default) --without-kqueue disable kqueue IO support (autodetected by default) --with-openssl enable SSL support using OpenSSL --with-gnutls enable SSL support using gnutls --with-tcp-wrappers enable TCP wrappers support --with-ident enable "IDENT" ("AUTH") protocol support --with-pam enable user authentication using PAM --with-iconv enable character conversion using libiconv Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . ngIRCd home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF ngIRCd configure 21 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ----------------------------------------- ## ## Report this to ngircd-ml@ngircd.barton.de ## ## ----------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_find_uintX_t # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval "test \"\${$4+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_member # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by ngIRCd $as_me 21, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5 ; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " arpa/inet.h" as_fn_append ac_header_list " inttypes.h" as_fn_append ac_header_list " malloc.h" as_fn_append ac_header_list " netinet/in_systm.h" as_fn_append ac_header_list " netinet/ip.h" as_fn_append ac_header_list " stdbool.h" as_fn_append ac_header_list " stddef.h" as_fn_append ac_header_list " stdint.h" as_fn_append ac_header_list " varargs.h" as_fn_append ac_func_list " arc4random" as_fn_append ac_func_list " arc4random_stir" as_fn_append ac_func_list " gai_strerror" as_fn_append ac_func_list " getaddrinfo" as_fn_append ac_func_list " getnameinfo" as_fn_append ac_func_list " inet_aton" as_fn_append ac_func_list " sigaction" as_fn_append ac_func_list " sigprocmask" as_fn_append ac_func_list " snprintf" as_fn_append ac_func_list " vsnprintf" as_fn_append ac_func_list " strdup" as_fn_append ac_func_list " strndup" as_fn_append ac_func_list " strlcpy" as_fn_append ac_func_list " strlcat" as_fn_append ac_func_list " strtok_r" as_fn_append ac_func_list " waitpid" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers src/config.h" ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if test "${ac_cv_build+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if test "${ac_cv_host+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='ngircd' VERSION='21' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac AM_BACKSLASH='\' # -- Templates for config.h -- # -- C Compiler -- ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5 ; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi case $ac_cv_prog_cc_stdc in #( no) : ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( *) : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } if test "${ac_cv_prog_cc_c99+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c99" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 else ac_cv_prog_cc_stdc=no fi fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 $as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } if test "${ac_cv_prog_cc_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 fi case $ac_cv_prog_cc_stdc in #( no) : { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; #( '') : { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; #( *) : { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 $as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; esac # -- Helper programs -- for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi # -- Compiler Features -- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if test "${ac_cv_c_const+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if test "${ac_cv_c_inline+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function prototypes" >&5 $as_echo_n "checking for function prototypes... " >&6; } if test "$ac_cv_prog_cc_c89" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define PROTOTYPES 1" >>confdefs.h $as_echo "#define __PROTOTYPES 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_prog_cc_stdc" != no; then U= ANSI2KNR= else U=_ ANSI2KNR=./ansi2knr fi # Ensure some checks needed by ansi2knr itself. for ac_header in string.h do : ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" if test "x$ac_cv_header_string_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRING_H 1 _ACEOF fi done # -- Hard coded system and compiler dependencies/features/options ... -- if test "$GCC" = "yes"; then # We are using the GNU C compiler. Good! CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes" ssp_cc=yes # we use -fstack-protector-all for the test to enfoce the use of the guard variable { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} accepts -fstack-protector" >&5 $as_echo_n "checking whether ${CC} accepts -fstack-protector... " >&6; } ssp_old_cflags="$CFLAGS" CFLAGS="$CFLAGS -fstack-protector-all" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : else ssp_cc=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext echo $ssp_cc CFLAGS="$ssp_old_cflags" if test "X$ssp_cc" = "Xyes"; then CFLAGS="$CFLAGS -fstack-protector" $as_echo "#define ENABLE_SSP_CC 1" >>confdefs.h fi fi case "$host_os" in hpux*) # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED # (tested with HP/UX 11.11) CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" ;; esac # Add additional CFLAGS, eventually specified on the command line: test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD" CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"' -DDOCDIR='\"\$(docdir)\"'" # -- Headers -- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if test "${ac_cv_header_sys_wait_h+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if test "${ac_cv_header_time+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi # Required header files for ac_header in \ fcntl.h netdb.h netinet/in.h stdlib.h string.h \ strings.h sys/socket.h sys/time.h unistd.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else as_fn_error $? "required C header missing!" "$LINENO" 5 fi done # Optional header files for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # -- Datatypes -- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether socklen_t exists" >&5 $as_echo_n "checking whether socklen_t exists... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { socklen_t a, b; a = 2; b = 4; a += b; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_socklen_t 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if test "${ac_cv_type_signal+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if test "${ac_cv_type_uid_t+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then $as_echo "#define uid_t int" >>confdefs.h $as_echo "#define gid_t int" >>confdefs.h fi ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define uint16_t $ac_cv_c_uint16_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) $as_echo "#define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac ac_fn_c_check_member "$LINENO" "struct sockaddr_in" "sin_len" "ac_cv_member_struct_sockaddr_in_sin_len" "#include " if test "x$ac_cv_member_struct_sockaddr_in_sin_len" = x""yes; then : $as_echo "#define HAVE_sockaddr_in_len 1" >>confdefs.h fi # -- Libraries -- # memmove: A/UX libUTIL { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing memmove" >&5 $as_echo_n "checking for library containing memmove... " >&6; } if test "${ac_cv_search_memmove+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char memmove (); int main () { return memmove (); ; return 0; } _ACEOF for ac_lib in '' UTIL; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_memmove=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_memmove+set}" = set; then : break fi done if test "${ac_cv_search_memmove+set}" = set; then : else ac_cv_search_memmove=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_memmove" >&5 $as_echo "$ac_cv_search_memmove" >&6; } ac_res=$ac_cv_search_memmove if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else as_fn_error $? "unable to find the memmove() function" "$LINENO" 5 fi # gethostbyname: Solaris libnsl { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 $as_echo_n "checking for library containing gethostbyname... " >&6; } if test "${ac_cv_search_gethostbyname+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF for ac_lib in '' bind nsl network; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_gethostbyname=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_gethostbyname+set}" = set; then : break fi done if test "${ac_cv_search_gethostbyname+set}" = set; then : else ac_cv_search_gethostbyname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 $as_echo "$ac_cv_search_gethostbyname" >&6; } ac_res=$ac_cv_search_gethostbyname if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else as_fn_error $? "unable to find the gethostbyname() function" "$LINENO" 5 fi # bind: SVR4 libsocket { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing bind" >&5 $as_echo_n "checking for library containing bind... " >&6; } if test "${ac_cv_search_bind+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char bind (); int main () { return bind (); ; return 0; } _ACEOF for ac_lib in '' socket network; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_bind=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_bind+set}" = set; then : break fi done if test "${ac_cv_search_bind+set}" = set; then : else ac_cv_search_bind=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_bind" >&5 $as_echo "$ac_cv_search_bind" >&6; } ac_res=$ac_cv_search_bind if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else as_fn_error $? "unable to find the bind() function" "$LINENO" 5 fi # -- Functions -- for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if test "${ac_cv_func_fork_works+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if test "${ac_cv_func_vfork_works+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi for ac_func in strftime do : ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" if test "x$ac_cv_func_strftime" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRFTIME 1 _ACEOF else # strftime is in -lintl on SCO UNIX. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 $as_echo_n "checking for strftime in -lintl... " >&6; } if test "${ac_cv_lib_intl_strftime+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strftime (); int main () { return strftime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_strftime=yes else ac_cv_lib_intl_strftime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 $as_echo "$ac_cv_lib_intl_strftime" >&6; } if test "x$ac_cv_lib_intl_strftime" = x""yes; then : $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h LIBS="-lintl $LIBS" fi fi done # Required functions for ac_func in \ alarm dup2 endpwent gethostbyaddr gethostbyname gethostname \ gettimeofday inet_ntoa memmove memset setsid socket strcasecmp \ strchr strcspn strerror strncasecmp strrchr strspn strstr \ do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else as_fn_error $? "required function missing!" "$LINENO" 5 fi done # Optional functions for ac_func in $ac_func_list do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # -- Configuration options -- # use syslog? x_syslog_on=no # Check whether --with-syslog was given. if test "${with_syslog+set}" = set; then : withval=$with_syslog; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing syslog" >&5 $as_echo_n "checking for library containing syslog... " >&6; } if test "${ac_cv_search_syslog+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char syslog (); int main () { return syslog (); ; return 0; } _ACEOF for ac_lib in '' be; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_syslog=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_syslog+set}" = set; then : break fi done if test "${ac_cv_search_syslog+set}" = set; then : else ac_cv_search_syslog=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_syslog" >&5 $as_echo "$ac_cv_search_syslog" >&6; } ac_res=$ac_cv_search_syslog if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" x_syslog_on=yes else as_fn_error $? "Can't enable syslog!" "$LINENO" 5 fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing syslog" >&5 $as_echo_n "checking for library containing syslog... " >&6; } if test "${ac_cv_search_syslog+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char syslog (); int main () { return syslog (); ; return 0; } _ACEOF for ac_lib in '' be; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_syslog=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_syslog+set}" = set; then : break fi done if test "${ac_cv_search_syslog+set}" = set; then : else ac_cv_search_syslog=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_syslog" >&5 $as_echo "$ac_cv_search_syslog" >&6; } ac_res=$ac_cv_search_syslog if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" x_syslog_on=yes fi fi if test "$x_syslog_on" = "yes"; then $as_echo "#define SYSLOG 1" >>confdefs.h for ac_header in syslog.h do : ac_fn_c_check_header_mongrel "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default" if test "x$ac_cv_header_syslog_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYSLOG_H 1 _ACEOF else as_fn_error $? "required C header missing!" "$LINENO" 5 fi done fi # use zlib compression? x_zlib_on=no # Check whether --with-zlib was given. if test "${with_zlib+set}" = set; then : withval=$with_zlib; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5 $as_echo_n "checking for deflate in -lz... " >&6; } if test "${ac_cv_lib_z_deflate+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char deflate (); int main () { return deflate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_deflate=yes else ac_cv_lib_z_deflate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflate" >&5 $as_echo "$ac_cv_lib_z_deflate" >&6; } if test "x$ac_cv_lib_z_deflate" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF LIBS="-lz $LIBS" fi for ac_func in deflate do : ac_fn_c_check_func "$LINENO" "deflate" "ac_cv_func_deflate" if test "x$ac_cv_func_deflate" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DEFLATE 1 _ACEOF x_zlib_on=yes else as_fn_error $? "Can't enable zlib!" "$LINENO" 5 fi done fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5 $as_echo_n "checking for deflate in -lz... " >&6; } if test "${ac_cv_lib_z_deflate+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char deflate (); int main () { return deflate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_deflate=yes else ac_cv_lib_z_deflate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflate" >&5 $as_echo "$ac_cv_lib_z_deflate" >&6; } if test "x$ac_cv_lib_z_deflate" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF LIBS="-lz $LIBS" fi for ac_func in deflate do : ac_fn_c_check_func "$LINENO" "deflate" "ac_cv_func_deflate" if test "x$ac_cv_func_deflate" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DEFLATE 1 _ACEOF x_zlib_on=yes fi done fi if test "$x_zlib_on" = "yes"; then $as_echo "#define ZLIB 1" >>confdefs.h for ac_header in zlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ZLIB_H 1 _ACEOF else as_fn_error $? "required C header missing!" "$LINENO" 5 fi done fi # detect which IO API to use: x_io_backend=none # Check whether --with-select was given. if test "${with_select+set}" = set; then : withval=$with_select; 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 for ac_func in select do : ac_fn_c_check_func "$LINENO" "select" "ac_cv_func_select" if test "x$ac_cv_func_select" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SELECT 1 _ACEOF x_io_select=yes else as_fn_error $? "Can't enable select IO support!" "$LINENO" 5 fi done fi else for ac_func in select do : ac_fn_c_check_func "$LINENO" "select" "ac_cv_func_select" if test "x$ac_cv_func_select" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SELECT 1 _ACEOF x_io_select=yes fi done fi # Check whether --with-poll was given. if test "${with_poll+set}" = set; then : withval=$with_poll; 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 for ac_func in poll do : ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" if test "x$ac_cv_func_poll" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_POLL 1 _ACEOF for ac_header in poll.h do : ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default" if test "x$ac_cv_header_poll_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_POLL_H 1 _ACEOF x_io_backend=poll\(\) else as_fn_error $? "Can't enable poll IO support!" "$LINENO" 5 fi done else as_fn_error $? "Can't enable poll IO support!" "$LINENO" 5 fi done fi else for ac_func in poll do : ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" if test "x$ac_cv_func_poll" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_POLL 1 _ACEOF for ac_header in poll.h do : ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default" if test "x$ac_cv_header_poll_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_POLL_H 1 _ACEOF x_io_backend=poll\(\) fi done fi done fi # Check whether --with-devpoll was given. if test "${with_devpoll+set}" = set; then : withval=$with_devpoll; 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 for ac_header in sys/devpoll.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/devpoll.h" "ac_cv_header_sys_devpoll_h" "$ac_includes_default" if test "x$ac_cv_header_sys_devpoll_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_DEVPOLL_H 1 _ACEOF else as_fn_error $? "required C header missing!" "$LINENO" 5 fi done fi else for ac_header in sys/devpoll.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/devpoll.h" "ac_cv_header_sys_devpoll_h" "$ac_includes_default" if test "x$ac_cv_header_sys_devpoll_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_DEVPOLL_H 1 _ACEOF x_io_backend=/dev/poll fi done fi # Check whether --with-epoll was given. if test "${with_epoll+set}" = set; then : withval=$with_epoll; 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 for ac_func in epoll_create do : ac_fn_c_check_func "$LINENO" "epoll_create" "ac_cv_func_epoll_create" if test "x$ac_cv_func_epoll_create" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_EPOLL_CREATE 1 _ACEOF x_io_epoll=yes else as_fn_error $? "Can't enable epoll IO support!" "$LINENO" 5 fi done fi else for ac_func in epoll_create do : ac_fn_c_check_func "$LINENO" "epoll_create" "ac_cv_func_epoll_create" if test "x$ac_cv_func_epoll_create" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_EPOLL_CREATE 1 _ACEOF x_io_epoll=yes fi done fi # Check whether --with-kqueue was given. if test "${with_kqueue+set}" = set; then : withval=$with_kqueue; 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 for ac_func in kqueue do : ac_fn_c_check_func "$LINENO" "kqueue" "ac_cv_func_kqueue" if test "x$ac_cv_func_kqueue" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_KQUEUE 1 _ACEOF x_io_backend=kqueue\(\) else as_fn_error $? "Can't enable kqueue IO support!" "$LINENO" 5 fi done fi else for ac_func in kqueue do : ac_fn_c_check_func "$LINENO" "kqueue" "ac_cv_func_kqueue" if test "x$ac_cv_func_kqueue" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_KQUEUE 1 _ACEOF x_io_backend=kqueue\(\) fi done fi if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then # when epoll() and select() are available, we'll use both! x_io_backend="epoll(), select()" else if test "$x_io_epoll" = "yes"; then # we prefere epoll() if it is available x_io_backend="epoll()" else if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then # we'll use select, when available and no "better" # interface has been detected ... x_io_backend="select()" fi fi fi if test "$x_io_backend" = "none"; then as_fn_error $? "No useable IO API activated/found!?" "$LINENO" 5 fi # use SSL? # Check whether --with-openssl was given. if test "${with_openssl+set}" = set; then : withval=$with_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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BIO_s_mem in -lcrypto" >&5 $as_echo_n "checking for BIO_s_mem in -lcrypto... " >&6; } if test "${ac_cv_lib_crypto_BIO_s_mem+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char BIO_s_mem (); int main () { return BIO_s_mem (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_crypto_BIO_s_mem=yes else ac_cv_lib_crypto_BIO_s_mem=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_BIO_s_mem" >&5 $as_echo "$ac_cv_lib_crypto_BIO_s_mem" >&6; } if test "x$ac_cv_lib_crypto_BIO_s_mem" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBCRYPTO 1 _ACEOF LIBS="-lcrypto $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5 $as_echo_n "checking for SSL_library_init in -lssl... " >&6; } if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lssl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SSL_library_init (); int main () { return SSL_library_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ssl_SSL_library_init=yes else ac_cv_lib_ssl_SSL_library_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5 $as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; } if test "x$ac_cv_lib_ssl_SSL_library_init" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSSL 1 _ACEOF LIBS="-lssl $LIBS" fi for ac_func in SSL_library_init do : ac_fn_c_check_func "$LINENO" "SSL_library_init" "ac_cv_func_SSL_library_init" if test "x$ac_cv_func_SSL_library_init" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SSL_LIBRARY_INIT 1 _ACEOF x_ssl_openssl=yes else as_fn_error $? "Can't enable openssl" "$LINENO" 5 fi done fi fi # Check whether --with-gnutls was given. if test "${with_gnutls+set}" = set; then : withval=$with_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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_global_init in -lgnutls" >&5 $as_echo_n "checking for gnutls_global_init in -lgnutls... " >&6; } if test "${ac_cv_lib_gnutls_gnutls_global_init+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgnutls $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gnutls_global_init (); int main () { return gnutls_global_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gnutls_gnutls_global_init=yes else ac_cv_lib_gnutls_gnutls_global_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_global_init" >&5 $as_echo "$ac_cv_lib_gnutls_gnutls_global_init" >&6; } if test "x$ac_cv_lib_gnutls_gnutls_global_init" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBGNUTLS 1 _ACEOF LIBS="-lgnutls $LIBS" fi for ac_func in gnutls_global_init do : ac_fn_c_check_func "$LINENO" "gnutls_global_init" "ac_cv_func_gnutls_global_init" if test "x$ac_cv_func_gnutls_global_init" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GNUTLS_GLOBAL_INIT 1 _ACEOF x_ssl_gnutls=yes else as_fn_error $? "Can't enable gnutls" "$LINENO" 5 fi done fi fi x_ssl_lib="no" if test "$x_ssl_gnutls" = "yes"; then if test "$x_ssl_openssl" = "yes";then as_fn_error $? "Cannot enable both gnutls and openssl" "$LINENO" 5 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 # Check whether --with-tcp-wrappers was given. if test "${with_tcp_wrappers+set}" = set; then : withval=$with_tcp_wrappers; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hosts_access" >&5 $as_echo_n "checking for hosts_access... " >&6; } LIBS="-lwrap $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int allow_severity = 0; int deny_severity = 0; int main () { tcpd_warn("link test"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define TCPWRAP 1" >>confdefs.h x_tcpwrap_on=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "Can't enable TCP wrappers!" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi fi # do IDENT requests using libident? x_identauth_on=no # Check whether --with-ident was given. if test "${with_ident+set}" = set; then : withval=$with_ident; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ident_id in -lident" >&5 $as_echo_n "checking for ident_id in -lident... " >&6; } if test "${ac_cv_lib_ident_ident_id+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lident $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ident_id (); int main () { return ident_id (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ident_ident_id=yes else ac_cv_lib_ident_ident_id=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ident_ident_id" >&5 $as_echo "$ac_cv_lib_ident_ident_id" >&6; } if test "x$ac_cv_lib_ident_ident_id" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBIDENT 1 _ACEOF LIBS="-lident $LIBS" fi for ac_func in ident_id do : ac_fn_c_check_func "$LINENO" "ident_id" "ac_cv_func_ident_id" if test "x$ac_cv_func_ident_id" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_IDENT_ID 1 _ACEOF x_identauth_on=yes else as_fn_error $? "Can't enable IDENT support!" "$LINENO" 5 fi done fi fi if test "$x_identauth_on" = "yes"; then $as_echo "#define IDENTAUTH 1" >>confdefs.h for ac_header in ident.h do : ac_fn_c_check_header_mongrel "$LINENO" "ident.h" "ac_cv_header_ident_h" "$ac_includes_default" if test "x$ac_cv_header_ident_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_IDENT_H 1 _ACEOF else as_fn_error $? "required C header missing!" "$LINENO" 5 fi done fi # compile in PAM support? x_pam_on=no # Check whether --with-pam was given. if test "${with_pam+set}" = set; then : withval=$with_pam; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_authenticate in -lpam" >&5 $as_echo_n "checking for pam_authenticate in -lpam... " >&6; } if test "${ac_cv_lib_pam_pam_authenticate+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpam $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pam_authenticate (); int main () { return pam_authenticate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pam_pam_authenticate=yes else ac_cv_lib_pam_pam_authenticate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_pam_authenticate" >&5 $as_echo "$ac_cv_lib_pam_pam_authenticate" >&6; } if test "x$ac_cv_lib_pam_pam_authenticate" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPAM 1 _ACEOF LIBS="-lpam $LIBS" fi for ac_func in pam_authenticate do : ac_fn_c_check_func "$LINENO" "pam_authenticate" "ac_cv_func_pam_authenticate" if test "x$ac_cv_func_pam_authenticate" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PAM_AUTHENTICATE 1 _ACEOF x_pam_on=yes else as_fn_error $? "Can't enable PAM support!" "$LINENO" 5 fi done fi fi if test "$x_pam_on" = "yes"; then $as_echo "#define PAM 1" >>confdefs.h for ac_header in security/pam_appl.h do : ac_fn_c_check_header_mongrel "$LINENO" "security/pam_appl.h" "ac_cv_header_security_pam_appl_h" "$ac_includes_default" if test "x$ac_cv_header_security_pam_appl_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SECURITY_PAM_APPL_H 1 _ACEOF pam_ok=yes fi done if test "$pam_ok" != "yes"; then for ac_header in pam/pam_appl.h do : ac_fn_c_check_header_mongrel "$LINENO" "pam/pam_appl.h" "ac_cv_header_pam_pam_appl_h" "$ac_includes_default" if test "x$ac_cv_header_pam_pam_appl_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PAM_PAM_APPL_H 1 _ACEOF pam_ok=yes else as_fn_error $? "required C header missing!" "$LINENO" 5 fi done fi fi # compile in IRC+ protocol support? x_ircplus_on=yes # Check whether --enable-ircplus was given. if test "${enable_ircplus+set}" = set; then : enableval=$enable_ircplus; if test "$enableval" = "no"; then x_ircplus_on=no; fi fi if test "$x_ircplus_on" = "yes"; then $as_echo "#define IRCPLUS 1" >>confdefs.h # Compile in iconv support? # We only check for it when IRC+ is enabled, because the IRC+ command # CHARCONV is the only function depending on it. x_iconv_on=no # Check whether --with-iconv was given. if test "${with_iconv+set}" = set; then : withval=$with_iconv; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 $as_echo_n "checking for iconv_open in -liconv... " >&6; } if test "${ac_cv_lib_iconv_iconv_open+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-liconv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char iconv_open (); int main () { return iconv_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_iconv_iconv_open=yes else ac_cv_lib_iconv_iconv_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_iconv_open" >&5 $as_echo "$ac_cv_lib_iconv_iconv_open" >&6; } if test "x$ac_cv_lib_iconv_iconv_open" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBICONV 1 _ACEOF LIBS="-liconv $LIBS" fi for ac_func in iconv_open do : ac_fn_c_check_func "$LINENO" "iconv_open" "ac_cv_func_iconv_open" if test "x$ac_cv_func_iconv_open" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ICONV_OPEN 1 _ACEOF x_iconv_on=yes fi done if test "$x_iconv_on" != "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libiconv_open in -liconv" >&5 $as_echo_n "checking for libiconv_open in -liconv... " >&6; } if test "${ac_cv_lib_iconv_libiconv_open+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-liconv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char libiconv_open (); int main () { return libiconv_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_iconv_libiconv_open=yes else ac_cv_lib_iconv_libiconv_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_libiconv_open" >&5 $as_echo "$ac_cv_lib_iconv_libiconv_open" >&6; } if test "x$ac_cv_lib_iconv_libiconv_open" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBICONV 1 _ACEOF LIBS="-liconv $LIBS" fi for ac_func in libiconv_open do : ac_fn_c_check_func "$LINENO" "libiconv_open" "ac_cv_func_libiconv_open" if test "x$ac_cv_func_libiconv_open" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBICONV_OPEN 1 _ACEOF x_iconv_on=yes fi done fi if test "$x_iconv_on" != "yes"; then as_fn_error $? "Can't enable libiconv support!" "$LINENO" 5 fi fi fi if test "$x_iconv_on" = "yes"; then $as_echo "#define ICONV 1" >>confdefs.h fi fi # enable support for IPv6? x_ipv6_on=no # Check whether --enable-ipv6 was given. if test "${enable_ipv6+set}" = set; then : enableval=$enable_ipv6; if test "$enableval" = "yes"; then x_ipv6_on=yes; fi 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! for ac_func in \ getaddrinfo getnameinfo \ do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else as_fn_error $? "required function missing for IPv6 support!" "$LINENO" 5 fi done $as_echo "#define WANT_IPV6 1" >>confdefs.h fi # compile in IRC "sniffer"? x_sniffer_on=no; x_debug_on=no # Check whether --enable-sniffer was given. if test "${enable_sniffer+set}" = set; then : enableval=$enable_sniffer; if test "$enableval" = "yes"; then $as_echo "#define SNIFFER 1" >>confdefs.h x_sniffer_on=yes; x_debug_on=yes fi fi # enable additional debugging code? # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; if test "$enableval" = "yes"; then x_debug_on=yes; fi fi if test "$x_debug_on" = "yes"; then $as_echo "#define DEBUG 1" >>confdefs.h test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS" for ac_func in mtrace do : ac_fn_c_check_func "$LINENO" "mtrace" "ac_cv_func_mtrace" if test "x$ac_cv_func_mtrace" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MTRACE 1 _ACEOF fi done fi # enable "strict RFC rules"? x_strict_rfc_on=no # Check whether --enable-strict-rfc was given. if test "${enable_strict_rfc+set}" = set; then : enableval=$enable_strict_rfc; if test "$enableval" = "yes"; then $as_echo "#define STRICT_RFC 1" >>confdefs.h x_strict_rfc_on=yes fi fi # -- Definitions -- cat >>confdefs.h <<_ACEOF #define HOST_CPU "$host_cpu" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_VENDOR "$host_vendor" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_OS "$host_os" _ACEOF # Add additional CFLAGS, eventually specified on the command line, but after # running this configure script. Useful for "-Werror" for example. test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END" # -- Generate files -- ac_config_files="$ac_config_files Makefile contrib/Debian/Makefile contrib/MacOSX/Makefile contrib/MacOSX/ngIRCd.pmdoc/Makefile contrib/MacOSX/ngIRCd.xcodeproj/Makefile contrib/Makefile doc/Makefile doc/src/Makefile man/Makefile src/ipaddr/Makefile src/Makefile src/ngircd/Makefile src/portab/Makefile src/testsuite/Makefile src/tool/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by ngIRCd $as_me 21, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to . ngIRCd home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ ngIRCd config.status 21 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "contrib/Debian/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/Debian/Makefile" ;; "contrib/MacOSX/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/MacOSX/Makefile" ;; "contrib/MacOSX/ngIRCd.pmdoc/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/MacOSX/ngIRCd.pmdoc/Makefile" ;; "contrib/MacOSX/ngIRCd.xcodeproj/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/MacOSX/ngIRCd.xcodeproj/Makefile" ;; "contrib/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "doc/src/Makefile") CONFIG_FILES="$CONFIG_FILES doc/src/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "src/ipaddr/Makefile") CONFIG_FILES="$CONFIG_FILES src/ipaddr/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/ngircd/Makefile") CONFIG_FILES="$CONFIG_FILES src/ngircd/Makefile" ;; "src/portab/Makefile") CONFIG_FILES="$CONFIG_FILES src/portab/Makefile" ;; "src/testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES src/testsuite/Makefile" ;; "src/tool/Makefile") CONFIG_FILES="$CONFIG_FILES src/tool/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # 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. # 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 -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi type dpkg >/dev/null 2>&1 if test $? -eq 0; then # Generate debian/ link if the dpkg command exists # (read: if we are running on a debian compatible system) echo "creating Debian-specific links ..." test -f debian/rules || ln -s contrib/Debian debian fi # -- Result -- echo echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:" echo # Someone please show me a better way :) [borrowed by OpenSSH] B=`eval echo ${bindir}` ; B=`eval echo ${B}` S=`eval echo ${sbindir}` ; S=`eval echo ${S}` C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}` M=`eval echo ${mandir}` ; M=`eval echo ${M}` D=`eval echo ${docdir}` ; D=`eval echo ${D}` echo " Host: ${host}" echo " Compiler: ${CC}" test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}" test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}" test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}" test -n "$LIBS" && echo " Libraries: ${LIBS}" echo echo " 'ngircd' binary: $S" echo " Configuration file: $C" echo " Manual pages: $M" echo " Documentation: $D" echo echo $ECHO_N " Syslog support: $ECHO_C" test "$x_syslog_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " Enable debug code: $ECHO_C" test "$x_debug_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " zlib compression: $ECHO_C" test "$x_zlib_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " IRC sniffer: $ECHO_C" test "$x_sniffer_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " Use TCP Wrappers: $ECHO_C" test "$x_tcpwrap_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " Strict RFC mode: $ECHO_C" test "$x_strict_rfc_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " IDENT support: $ECHO_C" test "$x_identauth_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " IRC+ protocol: $ECHO_C" test "$x_ircplus_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " IPv6 protocol: $ECHO_C" test "$x_ipv6_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " I/O backend: $ECHO_C" echo "$x_io_backend" echo $ECHO_N " PAM support: $ECHO_C" test "$x_pam_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " SSL support: $ECHO_C" echo "$x_ssl_lib" echo $ECHO_N " libiconv support: $ECHO_C" echo "$x_iconv_on" echo if ! grep "^AUTOMAKE_OPTIONS = [a-z .\-]*/portab/ansi2knr" src/ngircd/Makefile.am >/dev/null 2>&1; then echo "WARNING:" echo "This GNU automake generated build system does not support \"de-ANSI-fication\"," echo "therefore don't use it to generate \"official\" distribution archives!" echo "(Most probably you want to use GNU automake 1.11.x for this purpose ...)" echo fi # -eof- ngircd-21/INSTALL0000644000175000116100000003123112224613077010516 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2013 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- INSTALL -- I. Upgrade Information ~~~~~~~~~~~~~~~~~~~~~~ Differences to version 20.x - Starting with ngIRCd 21, the ciphers used by SSL are configurable and default to HIGH:!aNULL:@STRENGTH (OpenSSL) or SECURE128 (GnuTLS). Previous version were using the OpenSSL or GnuTLS defaults, DEFAULT and NORMAL respectively. - When adding GLINE's or KLINE's to ngIRCd 21 (or newer), all clients matching the new mask will be KILL'ed. This was not the case with earlier versions that only added the mask but didn't kill already connected users. Differences to version 19.x - Starting with ngIRCd 20, users can "cloak" their hostname only when the configuration variable "CloakHostModeX" (introduced in 19.2) is set. Otherwise, only IRC operators, other servers, and services are allowed to set mode +x. This prevents regular users from changing their hostmask to the name of the IRC server itself, which confused quite a few people ;-) Differences to version 17 - Support for ZeroConf/Bonjour/Rendezvous service registration has been removed. The configuration option "NoZeroconf" is no longer available. - The structure of ngircd.conf has been cleaned up and three new configuration sections have been introduced: [Limits], [Options], and [SSL]. Lots of configuration variables stored in the [Global] section are now deprecated there and should be stored in one of these new sections (but still work in [Global]): "AllowRemoteOper" -> [Options] "ChrootDir" -> [Options] "ConnectIPv4" -> [Options] "ConnectIPv6" -> [Options] "ConnectRetry" -> [Limits] "MaxConnections" -> [Limits] "MaxConnectionsIP" -> [Limits] "MaxJoins" -> [Limits] "MaxNickLength" -> [Limits] "NoDNS" -> [Options], and renamed to "DNS" "NoIdent" -> [Options], and renamed to "Ident" "NoPAM" -> [Options], and renamed to "PAM" "OperCanUseMode" -> [Options] "OperServerMode" -> [Options] "PingTimeout" -> [Limits] "PongTimeout" -> [Limits] "PredefChannelsOnly" -> [Options] "SSLCertFile" -> [SSL], and renamed to "CertFile" "SSLDHFile" -> [SSL], and renamed to "DHFile" "SSLKeyFile" -> [SSL], and renamed to "KeyFile" "SSLKeyFilePassword" -> [SSL], and renamed to "KeyFilePassword" "SSLPorts" -> [SSL], and renamed to "Ports" "SyslogFacility" -> [Options] "WebircPassword" -> [Options] You should adjust your ngircd.conf and run "ngircd --configtest" to make sure that your settings are correct and up to date! Differences to version 16 - Changes to the "MotdFile" specified in ngircd.conf now require a ngircd configuration reload to take effect (HUP signal, REHASH command). Differences to version 0.9.x - The option of the configure script to enable support for Zeroconf/Bonjour/ Rendezvous/WhateverItIsNamedToday has been renamed: --with-rendezvous -> --with-zeroconf Differences to version 0.8.x - The maximum length of passwords has been raised to 20 characters (instead of 8 characters). If your passwords are longer than 8 characters then they are cut at an other position now. Differences to version 0.6.x - Some options of the configure script have been renamed: --disable-syslog -> --without-syslog --disable-zlib -> --without-zlib Please call "./configure --help" to review the full list of options! Differences to version 0.5.x - Starting with version 0.6.0, other servers are identified using asynchronous passwords: therefore the variable "Password" in [Server]-sections has been replaced by "MyPassword" and "PeerPassword". - New configuration variables, section [Global]: MaxConnections, MaxJoins (see example configuration file "doc/sample-ngircd.conf"!). II. Standard Installation ~~~~~~~~~~~~~~~~~~~~~~~~~ ngIRCd is developed for UNIX-based systems, which means that the installation on modern UNIX-like systems that are supported by GNU autoconf and GNU automake ("configure") should be no problem. The normal installation procedure after getting (and expanding) the source files (using a distribution archive or GIT) is as following: 0) Satisfy prerequisites 1) ./autogen.sh [only necessary when using GIT] 2) ./configure 3) make 4) make install (Please see details below!) Now the newly compiled executable "ngircd" is installed in its standard location, /usr/local/sbin/. The next step is to configure and afterwards starting the daemon. Please have a look at the ngircd(8) and ngircd.conf(5) manual pages for details and all possible options -- and don't forget to run "ngircd --configtest" to validate your configuration file! If no previous version of the configuration file exists (the standard name is /usr/local/etc/ngircd.conf), a sample configuration file containing all possible options will be installed there. You'll find its template in the doc/ directory: sample-ngircd.conf. 0): Satisfy prerequisites When building from source, you'll need some other software to build ngIRCd: for example a working C compiler, make tool, GNU automake and autoconf (only when not using a distribution archive), and a few libraries depending on the features you want to compile in (like IDENT support, SSL, and PAM). If you are using one of the "big" operating systems or Linux distributions, you can use the following commands to install all the required packages to build the sources including all optional features and to run the test suite: * RedHat / Fedora based distributions: yum install \ autoconf automake expect gcc glibc-devel gnutls-devel \ libident-devel make pam-devel tcp_wrappers-devel telnet zlib-devel * Debian / Ubuntu based distributions: apt-get install \ autoconf automake build-essential expect libgnutls-dev \ libident-dev libpam-dev libwrap0-dev libz-dev telnet 1): "autogen.sh" The first step, autogen.sh, is only necessary if the configure-script isn't already generated. This never happens in official ("stable") releases in tar.gz-archives, but when using GIT. This step is therefore only interesting for developers. autogen.sh produces the Makefile.in's, which are necessary for the configure script itself, and some more files for make. To run autogen.sh you'll need GNU autoconf and GNU automake: at least autoconf 2.61 and automake 1.10 are requird, newer is better. But don't use automake 1.12 or newer for creating distribution archives: it will work but lack "de-ANSI-fucation" support in the generated Makefile's! Stick with automake 1.11.x for this purpose ... So automake 1.11.x and autoconf 2.67+ is recommended. Again: "end users" do not need this step and neither need GNU autoconf nor GNU automake at all! 2): "./configure" The configure-script is used to detect local system dependencies. In the perfect case, configure should recognize all needed libraries, header files and so on. If this shouldn't work, "./configure --help" shows all possible options. In addition, you can pass some command line options to "configure" to enable and/or disable some features of ngIRCd. All these options are shown using "./configure --help", too. Compiling a static binary will avoid you the hassle of feeding a chroot dir (if you want use the chroot feature). Just do something like: CFLAGS=-static ./configure [--your-options ...] Then you can use a void directory as ChrootDir (like OpenSSH's /var/empty). 3): "make" The make command uses the Makefiles produced by configure and compiles the ngIRCd daemon. 4): "make install" Use "make install" to install the server and a sample configuration file on the local system. Normally, root privileges are necessary to complete this step. If there is already an older configuration file present, it won't be overwritten. These files and folders will be installed by default: - /usr/local/sbin/ngircd: executable server - /usr/local/etc/ngircd.conf: sample configuration (if not already present) - /usr/local/share/doc/ngircd/: documentation - /usr/local/share/man/: manual pages III. Additional features ~~~~~~~~~~~~~~~~~~~~~~~~ The following optional features can be compiled into the daemon by passing options to the "configure" script. Most options can handle a argument which will be used to search for the required libraries and header files in the given paths ("/lib/...", "/include/...") in addition to the standard locations. * Syslog Logging (autodetected by default): --with-syslog[=] / --without-syslog Enable (disable) support for logging to "syslog", which should be available on most modern UNIX-like operating systems by default. * ZLib Compression (autodetected by default): --with-zlib[=] / --without-zlib Enable (disable) support for compressed server-server links. The Z compression library ("libz") is required for this option. * IO Backend (autodetected by default): --with-select[=] / --without-select --with-poll[=] / --without-poll --with-devpoll[=] / --without-devpoll --with-epoll[=] / --without-epoll --with-kqueue[=] / --without-kqueue ngIRCd can use different IO "backends": the "old school" select() and poll() API which should be supported by most UNIX-like operating systems, or the more efficient and flexible epoll() (Linux >=2.6), kqueue() (BSD) and /dev/poll APIs. By default the IO backend is autodetected, but you can use "--without-xxx" to disable a more enhanced API. When using the epoll() API, support for select() is compiled in as well by default to enable the binary to run on older Linux kernels (<2.6), too. * IDENT-Support: --with-ident[=] Include support for IDENT ("AUTH") lookups. The "ident" library is required for this option. * TCP-Wrappers: --with-tcp-wrappers[=] Include support for Wietse Venemas "TCP Wrappers" to limit client access to the daemon, for example by using "/etc/hosts.{allow|deny}". The "libwrap" is required for this option. * PAM: --with-pam[=] Enable support for PAM, the Pluggable Authentication Modules library. See doc/PAM.txt for details. * SSL: --with-openssl[=] --with-gnutls[=] Enable support for SSL/TLS using OpenSSL or gnutls libraries. See doc/SSL.txt for details. * IPv6: --enable-ipv6 Adds support for version 6 of the Internet Protocol. IV. Useful make-targets ~~~~~~~~~~~~~~~~~~~~~~~ The Makefile produced by the configure-script contains always these useful targets: - clean: delete every product from the compiler/linker next step: -> make - distclean: the above plus erase all generated Makefiles next step: -> ./configure - maintainer-clean: erase all automatic generated files next step: -> ./autogen.sh V. Sample configuration file ngircd.conf ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In the sample configuration file, there are comments beginning with "#" OR ";" -- this is only for the better understanding of the file. The file is separated in five blocks: [Global], [Features], [Operator], [Server], and [Channel]. In the [Global] section, there is the main configuration like the server name and the ports, on which the server should be listening. Options in the [Features] section enable or disable functionality in the daemon. IRC operators of this server are defined in [Operator] blocks, remote servers are configured in [Server] sections, and [Channel] blocks are used to configure pre-defined ("persistent") IRC channels. The meaning of the variables in the configuration file is explained in the "doc/sample-ngircd.conf", which is used as sample configuration file in /usr/local/etc after running "make install" (if you don't already have one) and in the ngircd.conf(5) manual page. VI. Command line options ~~~~~~~~~~~~~~~~~~~~~~~~ These parameters could be passed to the ngIRCd: -f, --config The daemon uses the file as configuration file rather than the standard configuration /usr/local/etc/ngircd.conf. -n, --nodaemon ngIRCd should be running as a foreground process. -p, --passive Server-links won't be automatically established. -t, --configtest Reads, validates and dumps the configuration file as interpreted by the server. Then exits. Use "--help" to see a short help text describing all available parameters the server understands, with "--version" the ngIRCd shows its version number. In both cases the server exits after the output. Please see the ngircd(8) manual page for complete details! ngircd-21/configure.ng0000644000175000116100000004613212232014660011772 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # # 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. # define(VERSION_ID,esyscmd([ V=`git describe 2>/dev/null | sed -e 's/rel-//g' | sed -e 's/-/~/'`; [ -z "$V" -a -r configure ] \ && V=`grep "PACKAGE_STRING=" configure | cut -d"'" -f2 | cut -d' ' -f2` ( [ -n "$V" ] && echo "$V" || echo "??" ) | tr -d '\n'; ])) m4_ifdef([AM_SILENT_RULES], [m4_define([ng_color_tests], [color-tests])], [m4_define([ng_color_tests], [])]) # -- Initialisation -- AC_PREREQ([2.61]) AC_INIT([ngIRCd], VERSION_ID, [ngircd-ml@ngircd.barton.de], [ngircd], [http://ngircd.barton.de/]) AC_CONFIG_SRCDIR([src/ngircd/ngircd.c]) AC_CONFIG_HEADER([src/config.h]) AC_CANONICAL_HOST AM_INIT_AUTOMAKE([-Wall 1.10 ]ng_color_tests) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # -- Templates for config.h -- AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled]) AH_TEMPLATE([HAVE_sockaddr_in_len], [Define if sockaddr_in.sin_len exists]) AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists]) AH_TEMPLATE([ICONV], [Define if libiconv can be used, e.g. for CHARCONV]) AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests]) AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used]) AH_TEMPLATE([PAM], [Define if PAM should be used]) AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled]) AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant]) AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging]) AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used]) AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled]) AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled]) AH_TEMPLATE([HOST_OS], [Target operating system name]) AH_TEMPLATE([HOST_VENDOR], [Target system vendor]) AH_TEMPLATE([HOST_CPU], [Target CPU name]) # -- C Compiler -- AC_PROG_CC AC_PROG_CC_STDC # -- Helper programs -- m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) AC_PROG_AWK AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_RANLIB # -- Compiler Features -- AC_C_CONST AC_C_INLINE __ng_PROTOTYPES__ # -- Hard coded system and compiler dependencies/features/options ... -- AC_DEFUN([GCC_STACK_PROTECT_CC],[ ssp_cc=yes # we use -fstack-protector-all for the test to enfoce the use of the guard variable AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector]) ssp_old_cflags="$CFLAGS" CFLAGS="$CFLAGS -fstack-protector-all" AC_TRY_LINK(,,, ssp_cc=no) echo $ssp_cc CFLAGS="$ssp_old_cflags" if test "X$ssp_cc" = "Xyes"; then CFLAGS="$CFLAGS -fstack-protector" AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.]) fi ]) if test "$GCC" = "yes"; then # We are using the GNU C compiler. Good! CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes" GCC_STACK_PROTECT_CC fi case "$host_os" in hpux*) # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED # (tested with HP/UX 11.11) CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" ;; esac # Add additional CFLAGS, eventually specified on the command line: test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD" CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"' -DDOCDIR='\"\$(docdir)\"'" # -- Headers -- AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_TIME # Required header files AC_CHECK_HEADERS([ \ fcntl.h netdb.h netinet/in.h stdlib.h string.h \ strings.h sys/socket.h sys/time.h unistd.h \ ],,AC_MSG_ERROR([required C header missing!])) # Optional header files AC_CHECK_HEADERS_ONCE([ \ arpa/inet.h inttypes.h malloc.h netinet/in_systm.h netinet/ip.h \ stdbool.h stddef.h stdint.h varargs.h \ ]) # -- Datatypes -- AC_MSG_CHECKING(whether socklen_t exists) AC_TRY_COMPILE([ #include #include ],[ socklen_t a, b; a = 2; b = 4; a += b; ],[ AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) ]) AC_TYPE_PID_T AC_TYPE_SIGNAL AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UID_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T AC_CHECK_MEMBER([struct sockaddr_in.sin_len], AC_DEFINE(HAVE_sockaddr_in_len),, [#include ]) # -- Libraries -- # memmove: A/UX libUTIL AC_SEARCH_LIBS([memmove], [UTIL], [], [ AC_MSG_ERROR([unable to find the memmove() function]) ]) # gethostbyname: Solaris libnsl AC_SEARCH_LIBS([gethostbyname], [bind nsl network], [], [ AC_MSG_ERROR([unable to find the gethostbyname() function]) ]) # bind: SVR4 libsocket AC_SEARCH_LIBS([bind], [socket network], [], [ AC_MSG_ERROR([unable to find the bind() function]) ]) # -- Functions -- AC_FUNC_FORK AC_FUNC_STRFTIME # Required functions AC_CHECK_FUNCS([ \ alarm dup2 endpwent gethostbyaddr gethostbyname gethostname \ gettimeofday inet_ntoa memmove memset setsid socket strcasecmp \ strchr strcspn strerror strncasecmp strrchr strspn strstr \ ],, AC_MSG_ERROR([required function missing!])) # Optional functions AC_CHECK_FUNCS_ONCE([ \ arc4random arc4random_stir gai_strerror getaddrinfo getnameinfo inet_aton sigaction sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat \ strtok_r waitpid]) # -- Configuration options -- # use syslog? x_syslog_on=no AC_ARG_WITH(syslog, AS_HELP_STRING([--without-syslog], [disable syslog (autodetected by default)]), [ 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_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes], [ AC_MSG_ERROR([Can't enable syslog!]) ]) fi ], [ AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes]) ] ) if test "$x_syslog_on" = "yes"; then AC_DEFINE(SYSLOG, 1) AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!])) fi # use zlib compression? x_zlib_on=no AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib], [disable zlib compression (autodetected by default)]), [ 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(z, deflate) AC_CHECK_FUNCS(deflate, x_zlib_on=yes, AC_MSG_ERROR([Can't enable zlib!]) ) fi ], [ AC_CHECK_LIB(z, deflate) AC_CHECK_FUNCS(deflate, x_zlib_on=yes) ] ) if test "$x_zlib_on" = "yes"; then AC_DEFINE(ZLIB, 1) AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!])) fi # detect which IO API to use: x_io_backend=none AC_ARG_WITH(select, AS_HELP_STRING([--without-select], [disable select IO support (autodetected by default)]), [ 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_FUNCS(select, x_io_select=yes, AC_MSG_ERROR([Can't enable select IO support!]) ) fi ], [ AC_CHECK_FUNCS(select, x_io_select=yes) ] ) AC_ARG_WITH(poll, AS_HELP_STRING([--without-poll], [disable poll support (autodetected by default)]), [ 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_FUNCS(poll, [ AC_CHECK_HEADERS(poll.h, x_io_backend=poll\(\), AC_MSG_ERROR( [Can't enable poll IO support!]) ) ], [ AC_MSG_ERROR([Can't enable poll IO support!]) ]) fi ], [ AC_CHECK_FUNCS(poll, [ AC_CHECK_HEADERS(poll.h, x_io_backend=poll\(\)) ]) ] ) AC_ARG_WITH(devpoll, AS_HELP_STRING([--without-devpoll], [disable /dev/poll IO support (autodetected by default)]), [ 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_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!])) fi ], [ AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll) ] ) AC_ARG_WITH(epoll, AS_HELP_STRING([--without-epoll], [disable epoll IO support (autodetected by default)]), [ 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_FUNCS(epoll_create, x_io_epoll=yes, AC_MSG_ERROR([Can't enable epoll IO support!]) ) fi ], [ AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes) ] ) AC_ARG_WITH(kqueue, AS_HELP_STRING([--without-kqueue], [disable kqueue IO support (autodetected by default)]), [ 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_FUNCS(kqueue, x_io_backend=kqueue\(\), AC_MSG_ERROR([Can't enable kqueue IO support!]) ) fi ], [ AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\)) ] ) if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then # when epoll() and select() are available, we'll use both! x_io_backend="epoll(), select()" else if test "$x_io_epoll" = "yes"; then # we prefere epoll() if it is available x_io_backend="epoll()" else if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then # we'll use select, when available and no "better" # interface has been detected ... x_io_backend="select()" fi fi fi if test "$x_io_backend" = "none"; then AC_MSG_ERROR([No useable IO API activated/found!?]) fi # use SSL? AC_ARG_WITH(openssl, AS_HELP_STRING([--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, AS_HELP_STRING([--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 AC_ARG_WITH(tcp-wrappers, AS_HELP_STRING([--with-tcp-wrappers], [enable TCP wrappers support]), [ 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_MSG_CHECKING(for hosts_access) LIBS="-lwrap $LIBS" AC_TRY_LINK([ #include int allow_severity = 0; int deny_severity = 0; ],[ tcpd_warn("link test"); ],[ AC_MSG_RESULT(yes) AC_DEFINE(TCPWRAP, 1) x_tcpwrap_on=yes ],[ AC_MSG_RESULT(no) AC_MSG_ERROR([Can't enable TCP wrappers!]) ]) fi ] ) # do IDENT requests using libident? x_identauth_on=no AC_ARG_WITH(ident, AS_HELP_STRING([--with-ident], [enable "IDENT" ("AUTH") protocol support]), [ 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(ident, ident_id) AC_CHECK_FUNCS(ident_id, x_identauth_on=yes, AC_MSG_ERROR([Can't enable IDENT support!]) ) fi ] ) if test "$x_identauth_on" = "yes"; then AC_DEFINE(IDENTAUTH, 1) AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!])) fi # compile in PAM support? x_pam_on=no AC_ARG_WITH(pam, AS_HELP_STRING([--with-pam], [enable user authentication using PAM]), [ 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(pam, pam_authenticate) AC_CHECK_FUNCS(pam_authenticate, x_pam_on=yes, AC_MSG_ERROR([Can't enable PAM support!]) ) fi ] ) if test "$x_pam_on" = "yes"; then AC_DEFINE(PAM, 1) AC_CHECK_HEADERS(security/pam_appl.h,pam_ok=yes) if test "$pam_ok" != "yes"; then AC_CHECK_HEADERS(pam/pam_appl.h,pam_ok=yes, AC_MSG_ERROR([required C header missing!])) fi fi # compile in IRC+ protocol support? x_ircplus_on=yes AC_ARG_ENABLE(ircplus, AS_HELP_STRING([--disable-ircplus], [disable IRC+ protocol]), if test "$enableval" = "no"; then x_ircplus_on=no; fi ) if test "$x_ircplus_on" = "yes"; then AC_DEFINE(IRCPLUS, 1) # Compile in iconv support? # We only check for it when IRC+ is enabled, because the IRC+ command # CHARCONV is the only function depending on it. x_iconv_on=no AC_ARG_WITH(iconv, AS_HELP_STRING([--with-iconv], [enable character conversion using libiconv]), [ 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(iconv, iconv_open) AC_CHECK_FUNCS(iconv_open, x_iconv_on=yes) if test "$x_iconv_on" != "yes"; then AC_CHECK_LIB(iconv, libiconv_open) AC_CHECK_FUNCS(libiconv_open, x_iconv_on=yes) fi if test "$x_iconv_on" != "yes"; then AC_MSG_ERROR([Can't enable libiconv support!]) fi fi ] ) if test "$x_iconv_on" = "yes"; then AC_DEFINE(ICONV, 1) fi fi # enable support for IPv6? x_ipv6_on=no AC_ARG_ENABLE(ipv6, AS_HELP_STRING([--enable-ipv6], [enable IPv6 protocol support]), 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!])) AC_DEFINE(WANT_IPV6, 1) fi # compile in IRC "sniffer"? x_sniffer_on=no; x_debug_on=no AC_ARG_ENABLE(sniffer, AS_HELP_STRING([--enable-sniffer], [enable IRC traffic sniffer (enables debug mode)]), if test "$enableval" = "yes"; then AC_DEFINE(SNIFFER, 1) x_sniffer_on=yes; x_debug_on=yes fi ) # enable additional debugging code? AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [show additional debug output]), if test "$enableval" = "yes"; then x_debug_on=yes; fi ) 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"? x_strict_rfc_on=no AC_ARG_ENABLE(strict-rfc, AS_HELP_STRING([--enable-strict-rfc], [strict RFC conformance -- may break clients!]), if test "$enableval" = "yes"; then AC_DEFINE(STRICT_RFC, 1) x_strict_rfc_on=yes fi ) # -- Definitions -- AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" ) AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" ) AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" ) # Add additional CFLAGS, eventually specified on the command line, but after # running this configure script. Useful for "-Werror" for example. test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END" # -- Generate files -- AC_CONFIG_FILES([ \ Makefile \ contrib/Debian/Makefile \ contrib/MacOSX/Makefile \ contrib/MacOSX/ngIRCd.pmdoc/Makefile \ contrib/MacOSX/ngIRCd.xcodeproj/Makefile \ contrib/Makefile \ doc/Makefile \ doc/src/Makefile \ man/Makefile \ src/ipaddr/Makefile \ src/Makefile \ src/ngircd/Makefile \ src/portab/Makefile \ src/testsuite/Makefile \ src/tool/Makefile \ ]) AC_OUTPUT type dpkg >/dev/null 2>&1 if test $? -eq 0; then # Generate debian/ link if the dpkg command exists # (read: if we are running on a debian compatible system) echo "creating Debian-specific links ..." test -f debian/rules || ln -s contrib/Debian debian fi # -- Result -- echo echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:" echo # Someone please show me a better way :) [borrowed by OpenSSH] B=`eval echo ${bindir}` ; B=`eval echo ${B}` S=`eval echo ${sbindir}` ; S=`eval echo ${S}` C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}` M=`eval echo ${mandir}` ; M=`eval echo ${M}` D=`eval echo ${docdir}` ; D=`eval echo ${D}` echo " Host: ${host}" echo " Compiler: ${CC}" test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}" test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}" test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}" test -n "$LIBS" && echo " Libraries: ${LIBS}" echo echo " 'ngircd' binary: $S" echo " Configuration file: $C" echo " Manual pages: $M" echo " Documentation: $D" echo echo $ECHO_N " Syslog support: $ECHO_C" test "$x_syslog_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " Enable debug code: $ECHO_C" test "$x_debug_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " zlib compression: $ECHO_C" test "$x_zlib_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " IRC sniffer: $ECHO_C" test "$x_sniffer_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " Use TCP Wrappers: $ECHO_C" test "$x_tcpwrap_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " Strict RFC mode: $ECHO_C" test "$x_strict_rfc_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " IDENT support: $ECHO_C" test "$x_identauth_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " IRC+ protocol: $ECHO_C" test "$x_ircplus_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " IPv6 protocol: $ECHO_C" test "$x_ipv6_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " I/O backend: $ECHO_C" echo "$x_io_backend" echo $ECHO_N " PAM support: $ECHO_C" test "$x_pam_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " SSL support: $ECHO_C" echo "$x_ssl_lib" echo $ECHO_N " libiconv support: $ECHO_C" echo "$x_iconv_on" echo define(_automake_regex_,[[^AUTOMAKE_OPTIONS = [a-z .\-]*/portab/ansi2knr]]) if ! grep "_automake_regex_" src/ngircd/Makefile.am >/dev/null 2>&1; then echo "WARNING:" echo "This GNU automake generated build system does not support \"de-ANSI-fication\"," echo "therefore don't use it to generate \"official\" distribution archives!" echo "(Most probably you want to use GNU automake 1.11.x for this purpose ...)" echo fi # -eof- ngircd-21/contrib/0000755000175000116100000000000012234274326011206 500000000000000ngircd-21/contrib/ngircd.spec0000644000175000116100000000343012233475766013262 00000000000000%define name ngircd %define version 21 %define release 1 %define prefix %{_prefix} Summary: A lightweight daemon for the Internet Relay Chat (IRC) Name: %{name} Version: %{version} Release: %{release} License: GPLv2+ Group: System Environment/Daemons URL: http://ngircd.barton.de/ Source: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: zlib-devel, openssl-devel %description This package provides ngIRCd, a portable and lightweight Internet Relay Chat server for small or private networks, developed under the GNU General Public License (GPL). It is simple to configure, can cope with dynamic IP addresses, and supports IPv6 as well as SSL. It is written from scratch and not based on the original IRCd. Advantages: - well arranged (lean) configuration file - simple to build/install, configure and maintain - supports IPv6 and SSL - no problems with servers that have dynamic IP addresses - freely available, modern, portable and tidy C-source - ngIRCd is being actively developed since 11 years. %prep %setup -q %build %configure \ --with-zlib \ --with-openssl make %{?_smp_mflags} %install [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" %makeinstall ( cd "$RPM_BUILD_ROOT" ( 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 [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" %files %defattr(755,root,root) %doc AUTHORS COPYING ChangeLog INSTALL NEWS README doc/* %config(noreplace) /etc %{_prefix}/sbin %{_mandir}/man5/ngircd.conf* %{_mandir}/man8/ngircd.8* ngircd-21/contrib/platformtest.sh0000754000175000116100000001261012232014733014200 00000000000000#!/bin/sh # # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # # 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: . NAME=`basename "$0"` VERBOSE= PLATFORM= COMPILER="unknown" VERSION="unknown" DATE=`date "+%y-%m-%d"` COMMENT= R_CONFIGURE= R_MAKE= R_CHECK= R_RUN= [ -n "$MAKE" ] || MAKE="make" export MAKE CC 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 GIT tree ..." if [ -d .git ]; then echo "$NAME: Checking for \"git\" command ..." git version >/dev/null 2>&1 if [ $? -eq 0 ]; then echo "$NAME: Running \"git clean\" ..." [ -n "$VERBOSE" ] && git clean -dxf || git clean -dxf >/dev/null fi fi echo "$NAME: Checking for \"./configure\" script ..." if [ ! -e ./configure ]; then echo "$NAME: Running \"./autogen.sh\" ..." [ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null fi if [ -r ./configure ]; then echo "$NAME: Running \"./configure\" script ..." [ -n "$VERBOSE" ] && ./configure || ./configure >/dev/null if [ $? -eq 0 -a -r ./Makefile ]; then R_CONFIGURE=1 echo "$NAME: Running \"$MAKE\" ..." [ -n "$VERBOSE" ] && "$MAKE" || "$MAKE" >/dev/null if [ $? -eq 0 -a -x src/ngircd/ngircd ]; then R_MAKE=1 echo "$NAME: Running \"$MAKE check\" ..." [ -n "$VERBOSE" ] && "$MAKE" check || "$MAKE" check >/dev/null if [ $? -eq 0 ]; then R_CHECK=1 R_RUN=$R_CHECK else ./src/ngircd/ngircd --help 2>/dev/null \ | grep "^ngIRCd" >/dev/null [ $? -eq 0 ] && R_RUN=1 fi fi fi fi # Get target platform information if [ -r "src/config.h" ]; then CPU=`grep "HOST_CPU" "src/config.h" | cut -d'"' -f2` OS=`grep "HOST_OS" "src/config.h" | cut -d'"' -f2` VENDOR=`grep "HOST_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 CC=$(grep "^CC = " Makefile | cut -d' ' -f3) $CC --version 2>&1 | grep -i "GCC" >/dev/null if [ $? -eq 0 ]; then # GCC, or compiler that mimics GCC $CC --version 2>&1 | grep -i "Open64" >/dev/null if [ $? -eq 0 ]; then COMPILER="Open64" else COMPILER=$($CC --version | head -1 \ | cut -d')' -f2 | cut -d' ' -f2) COMPILER="gcc $COMPILER" fi else # Non-GCC compiler $CC --version 2>&1 | grep -i "clang" >/dev/null if [ $? -eq 0 ]; then COMPILER=$($CC --version 2>/dev/null | head -1 \ | cut -d'(' -f1 | cut -d'-' -f1 \ | sed -e 's/version //g' | sed -e 's/Apple /A-/g' \ | sed -e 's/Debian //g' | sed -e 's/LLVM /clang /g') fi $CC -version 2>&1 | grep -i "tcc" >/dev/null if [ $? -eq 0 ]; then COMPILER=$($CC -version 2>/dev/null | head -1 \ | cut -d'(' -f1 | sed -e 's/version //g') fi if [ "$COMPILER" = "unknown" ]; then v="`$CC --version 2>/dev/null | head -1`" [ -z "$v" ] && v="`$CC -version 2>/dev/null | head -1`" [ -n "$v" ] && COMPILER="$v" fi fi fi # Get ngIRCd version information eval $(grep "^VERSION = " Makefile | sed -e 's/ //g') case "$VERSION" in *-*-*) VERSION=`echo "$VERSION" | cut -d'-' -f3 | cut -b2-` ;; esac [ -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 "$R_CONFIGURE" ] && C="Y" || C="N" [ -n "$R_MAKE" ] && M="Y" || M="N" [ -n "$R_CHECK" ] && T="Y" || T="N" [ -n "$R_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 *" echo "--------------------------- ------------ ---------- -------- -------- - - - - -" type printf >/dev/null 2>&1 if [ $? -eq 0 ]; then printf "%-27s %-12s %-10s %s %-8s %s %s %s %s%s" \ "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$USER" \ "$C" "$M" "$T" "$R" "$COMMENT" else echo "$PLATFORM $COMPILER $VERSION $DATE $USER" \ "$C" "$M" "$T" "$R" "$COMMENT" fi echo; echo ngircd-21/contrib/Makefile.in0000644000175000116100000004134012234274153013173 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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-2013 Alexander Barton (alex@barton.de) and Contributors # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ subdir = contrib DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-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 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = Debian MacOSX EXTRA_DIST = README \ ngindent \ ngircd-bsd.sh \ ngIRCd-Logo.gif \ ngircd-redhat.init \ ngircd.service \ ngircd.socket \ ngircd.spec \ platformtest.sh \ systrace.policy all: all-recursive .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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu contrib/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 $(am__aclocal_m4_deps): # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" 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)'; \ 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-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-tags \ 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 \ 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 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: ngircd-21/contrib/ngircd.socket0000644000175000116100000000027512206130744013604 00000000000000[Unit] Description=Next Generation IRC Daemon (Socket) [Socket] BindIPv6Only=ipv6-only ListenStream=0.0.0.0:6667 #ListenStream=[::]:6667 IPTOS=low-delay [Install] WantedBy=sockets.target ngircd-21/contrib/ngindent0000754000175000116100000000055411615627660012672 00000000000000#/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 gindent >/dev/null 2>&1 && INDENT="gindent" 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- ngircd-21/contrib/Makefile.am0000644000175000116100000000131012206130744013147 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # # 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 \ ngindent \ ngircd-bsd.sh \ ngIRCd-Logo.gif \ ngircd-redhat.init \ ngircd.service \ ngircd.socket \ ngircd.spec \ platformtest.sh \ systrace.policy maintainer-clean-local: rm -f Makefile Makefile.in # -eof- ngircd-21/contrib/Debian/0000755000175000116100000000000012234274327012371 500000000000000ngircd-21/contrib/Debian/ngircd.default0000644000175000116100000000026212206130744015116 00000000000000# # Defaults for ngIRCd start and stop script # # Parameters to pass to the ngircd daemon on startup, see ngircd(8) for # possible options (default: empty). PARAMS="" # -eof- ngircd-21/contrib/Debian/Makefile.in0000644000175000116100000002400012234274153014347 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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-2010 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ subdir = contrib/Debian DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = rules changelog compat control copyright \ ngircd.init ngircd.default ngircd.pam ngircd.postinst 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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/Debian/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu contrib/Debian/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 $(am__aclocal_m4_deps): 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am 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 clean-local \ 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 clean-local: rm -f ngircd.postinst.debhelper ngircd.postrm.debhelper \ ngircd.prerm.debhelper ngircd.substvars rm -f ngircd-full.postinst.debhelper ngircd-full.postrm.debhelper \ ngircd-full.prerm.debhelper ngircd-full.substvars rm -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- # 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: ngircd-21/contrib/Debian/ngircd.postinst0000754000175000116100000000053711000116207015351 00000000000000#!/bin/sh # # Debian post-installation script # $Id: ngircd.postinst,v 1.2 2006/12/26 14:44:40 alex Exp $ # set -e case "$1" in configure) if [ -f /etc/ngircd/ngircd.conf ]; then # make sure that the configuration file is not # world-readable, it contains passwords! chmod o= /etc/ngircd/ngircd.conf fi ;; esac #DEBHELPER# # -eof- ngircd-21/contrib/Debian/compat0000644000175000116100000000000211461640110013473 000000000000004 ngircd-21/contrib/Debian/Makefile.am0000644000175000116100000000201411461644546014347 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2010 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 = rules changelog compat control copyright \ ngircd.init ngircd.default ngircd.pam ngircd.postinst maintainer-clean-local: rm -f Makefile Makefile.in clean-local: rm -f ngircd.postinst.debhelper ngircd.postrm.debhelper \ ngircd.prerm.debhelper ngircd.substvars rm -f ngircd-full.postinst.debhelper ngircd-full.postrm.debhelper \ ngircd-full.prerm.debhelper ngircd-full.substvars rm -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- ngircd-21/contrib/Debian/rules0000754000175000116100000001740712231002517013364 00000000000000#!/usr/bin/make -f # # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # Please read the file COPYING, README and AUTHORS for more information. # # debian/rules for ngIRCd # # Based on the sample debian/rules that uses debhelper, # GNU copyright 1997 to 1999 by Joey Hess. # # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) CFLAGS = -Wall -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif configure-ngircd: configure dh_testdir # configure "standard" variant: ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr \ --sysconfdir=/etc/ngircd \ --mandir=\$${prefix}/share/man \ --with-syslog --with-zlib configure-ngircd-full: configure dh_testdir # configure "full" variant: ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr \ --sysconfdir=/etc/ngircd \ --mandir=\$${prefix}/share/man \ --with-syslog --with-zlib \ --with-gnutls --with-iconv --with-ident --with-tcp-wrappers \ --with-pam \ --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-iconv --with-ident --with-tcp-wrappers \ --with-pam \ --enable-ipv6 build: dh_clean -k build-ngircd: build-stamp-ngircd build-stamp-ngircd: configure-ngircd dh_testdir rm -f build-stamp-* # Add here commands to compile the "standard" package: $(MAKE) touch build-stamp-ngircd build-ngircd-full: build-stamp-ngircd-full build-stamp-ngircd-full: configure-ngircd-full dh_testdir rm -f build-stamp-* # Add here commands to compile the "full" package: $(MAKE) touch build-stamp-ngircd-full 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: dh_testdir dh_testroot rm -f build-stamp* rm -f $(CURDIR)/debian/ngircd-full.default rm -f $(CURDIR)/debian/ngircd-full.init rm -f $(CURDIR)/debian/ngircd-full.postinst 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: [ ! -f Makefile ] || $(MAKE) distclean ifneq "$(wildcard /usr/share/misc/config.sub)" "" cp -f /usr/share/misc/config.sub config.sub endif ifneq "$(wildcard /usr/share/misc/config.guess)" "" cp -f /usr/share/misc/config.guess config.guess endif dh_clean install: install-ngircd install-ngircd-full install-ngircd-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* rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/COPYING* mkdir -p $(CURDIR)/debian/ngircd/var/run/ircd cat $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/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/etc/ngircd/ngircd.conf touch $(CURDIR)/debian/ngircd/etc/ngircd/ngircd.motd install-ngircd-full: build-ngircd-full dh_testdir dh_testroot dh_installdirs # Add here commands to install the "full" package into debian/ngircd-full: $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/INSTALL* rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/COPYING* mv $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd \ $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full mkdir -p $(CURDIR)/debian/ngircd-full/var/run/ircd cat $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/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|;HelpFile = /usr/share/doc/ngircd/Commands.txt|HelpFile = /usr/share/doc/ngircd-full/Commands.txt|g" | \ sed -e "s|;PidFile = /var/run/ngircd/ngircd.pid|PidFile = /var/run/ircd/ngircd.pid|g" \ >$(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.conf touch $(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.motd mkdir -p $(CURDIR)/debian/ngircd-full/etc/pam.d cp $(CURDIR)/debian/ngircd.pam $(CURDIR)/debian/ngircd-full/etc/pam.d/ngircd 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|;HelpFile = /usr/share/doc/ngircd/Commands.txt|HelpFile = /usr/share/doc/ngircd-full-dbg/Commands.txt|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 mkdir -p $(CURDIR)/debian/ngircd-full-dbg/etc/pam.d cp $(CURDIR)/debian/ngircd.pam $(CURDIR)/debian/ngircd-full-dbg/etc/pam.d/ngircd # Build architecture-independent files here. binary-indep: # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install ln -s $(CURDIR)/debian/ngircd.default \ $(CURDIR)/debian/ngircd-full.default ln -s $(CURDIR)/debian/ngircd.init \ $(CURDIR)/debian/ngircd-full.init ln -s $(CURDIR)/debian/ngircd.postinst \ $(CURDIR)/debian/ngircd-full.postinst 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 --no-package=ngircd-full-dbg dh_compress -a -XCommands.txt dh_fixperms -a dh_installdeb -a dh_shlibdeps -a dh_gencontrol -a dh_md5sums -a dh_builddeb -a binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install # -eof- ngircd-21/contrib/Debian/copyright0000644000175000116100000000076411000116207014231 00000000000000This package was debianized by Alexander Barton on Tue, 20 May 2003 15:47:40 +0200. It was downloaded from ftp://Arthur.Ath.CX/pub/Users/alex/ngircd/ Upstream Author: Alexander Barton This software is copyright (c) 1999-2003 by Alexander Barton. You are free to distribute this software under the terms of the GNU General Public License. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL file. ngircd-21/contrib/Debian/control0000644000175000116100000000501112206130744013702 00000000000000Source: ngircd Section: net Priority: optional Maintainer: Alexander Barton Build-Depends: debhelper (>> 4.0.0), autotools-dev, expect, libz-dev, libwrap0-dev, libident-dev, libgnutls-dev, libpam0g-dev, telnet | telnet-ssl, Standards-Version: 3.9.1 Package: ngircd Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Provides: ircd Description: lightweight Internet Relay Chat server This package provides ngIRCd, a portable and lightweight Internet Relay Chat server for small or private networks, developed under the GNU General Public License (GPL). It is simple to configure, can cope with dynamic IP addresses, and supports IPv6 as well as SSL. It is written from scratch and not based on the original IRCd. . This package contains the "standard distribution", including support for 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. Package: ngircd-full Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Provides: ircd Conflicts: ngircd, ngircd-dbg Description: lightweight Internet Relay Chat server This package provides ngIRCd, a portable and lightweight Internet Relay Chat server for small or private networks, developed under the GNU General Public License (GPL). It is simple to configure, can cope with dynamic IP addresses, and supports IPv6 as well as SSL. It is written from scratch and not based on the original IRCd. . 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. Package: ngircd-full-dbg Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Provides: ircd Conflicts: ngircd, ngircd-full Description: lightweight Internet Relay Chat server This package provides ngIRCd, a portable and lightweight Internet Relay Chat server for small or private networks, developed under the GNU General Public License (GPL). It is simple to configure, can cope with dynamic IP addresses, and supports IPv6 as well as SSL. It is written from scratch and not based on the original IRCd. . 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. ngircd-21/contrib/Debian/ngircd.pam0000644000175000116100000000012311461644514014252 00000000000000# /etc/pam.d/ngircd # allow all connections to ngIRCd auth required pam_permit.so ngircd-21/contrib/Debian/ngircd.init0000754000175000116100000000723612233001630014436 00000000000000#!/bin/sh # # ngIRCd start and stop script for Debian-based systems # Copyright 2008-2013 Alexander Barton # ### BEGIN INIT INFO # Provides: ngircd # Required-Start: $network $remote_fs # Required-Stop: $network $remote_fs # 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 DAEMON=/usr/sbin/ngircd NAME=ngIRCd DESC="IRC daemon" PARAMS="" STARTTIME=1 DIETIME=10 test -h "$0" && me=`readlink $0` || me="$0" BASENAME=`basename $me` test -r /etc/default/$BASENAME && . /etc/default/$BASENAME test -x $DAEMON || exit 5 # 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" r=3 Check_Config() { # 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 rm -f "$PIDFILE" start-stop-daemon --start \ --quiet --exec $DAEMON -- $PARAMS sleep $STARTTIME Do_Status || return 7 return 0 } 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 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 Prepare Do_Start; r=$? log_end_msg $r ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" Do_Stop; r=$? log_end_msg $r ;; reload|force-reload) log_daemon_msg "Reloading $DESC" "$NAME" Check_Config 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 "Configuration of $DAEMON seems to be ok."; r=0 ;; *) N=/etc/init.d/$NAME; r=2 echo "Usage: $N {start|stop|restart|reload|force-reload|status|test}" >&2 ;; esac exit $r # -eof- ngircd-21/contrib/Debian/changelog0000644000175000116100000003463212234273242014166 00000000000000ngircd (21-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 21. -- Alexander Barton Wed, 30 Oct 2013 22:13:55 +0100 ngircd (21~rc2-0ab3) unstable; urgency=low * Fix sed(1) rules adjusting "ngircd-full" package, error introduced by last commit :-/ -- Alexander Barton Sun, 20 Oct 2013 18:31:16 +0200 ngircd (21~rc2-0ab2) unstable; urgency=low * Fix default "HelpFile" file name in ngircd.conf for "full" packages. -- Alexander Barton Sun, 20 Oct 2013 17:18:28 +0200 ngircd (21~rc2-0ab1) unstable; urgency=low * New "upstream" release candidate 2 for ngIRCd Release 21. -- Alexander Barton Sun, 20 Oct 2013 15:50:03 +0200 ngircd (21~rc1-0ab1) unstable; urgency=low * New "upstream" release candidate 1 for ngIRCd Release 21. -- Alexander Barton Sat, 05 Oct 2013 23:24:09 +0200 ngircd (20.3-0ab1) unstable; urgency=high * New "upstream" release, fixing a security related bug: ngIRCd 20.3. -- Alexander Barton Fri, 23 Aug 2013 21:53:21 +0200 ngircd (20.2-0ab1) unstable; urgency=high * New "upstream" release, fixing a security related bug: ngIRCd 20.2. -- Alexander Barton Fri, 15 Feb 2013 12:17:00 +0100 ngircd (20.1-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 20.1. -- Alexander Barton Wed, 02 Jan 2013 22:37:26 +0100 ngircd (20-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 20. -- Alexander Barton Mon, 17 Dec 2012 13:04:15 +0100 ngircd (20~rc2-0ab1) unstable; urgency=low * New "upstream" release candidate 2 for ngIRCd Release 20. -- Alexander Barton Sun, 02 Dec 2012 18:51:06 +0100 ngircd (20~rc1-0ab1) unstable; urgency=low * New "upstream" release candidate 1 for ngIRCd Release 20. -- Alexander Barton Sun, 11 Nov 2012 16:03:32 +0100 ngircd (19.2-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 19.2. -- Alexander Barton Tue, 19 Jun 2012 11:03:12 +0200 ngircd (19.2~rc1-0ab1) unstable; urgency=low * New "upstream" release candidate 1 for ngIRC Release 19.2. -- Alexander Barton Wed, 13 Jun 2012 10:59:34 +0200 ngircd (19.1-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 19.1. -- Alexander Barton Mon, 19 Mar 2012 19:18:28 +0100 ngircd (19-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 19. -- Alexander Barton Wed, 29 Feb 2012 17:34:08 +0100 ngircd (19~rc1-0ab1) unstable; urgency=low * New "upstream" release candidate 1 for ngIRCd Release 19. -- Alexander Barton Sun, 12 Feb 2012 17:47:51 +0100 ngircd (18-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 18. -- Alexander Barton Sun, 10 Jul 2011 20:03:20 +0200 ngircd (18~rc2-0ab1) unstable; urgency=low * New "upstream" release candidate 2 for ngIRCd Release 18. -- Alexander Barton Wed, 29 Jun 2011 10:20:51 +0200 ngircd (18~rc1-0ab1) unstable; urgency=low * New "upstream" release candidate 1 for ngIRCd Release 18. -- Alexander Barton Mon, 27 Jun 2011 22:58:36 +0200 ngircd (17.1-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 17.1. -- Alexander Barton Sun, 19 Dec 2010 15:56:42 +0100 ngircd (17-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 17. -- Alexander Barton Sun, 07 Nov 2010 17:23:07 +0100 ngircd (17~rc3-0ab1) unstable; urgency=low * New "upstream" release candidate 3 for ngIRCd Release 17. -- Alexander Barton Wed, 27 Oct 2010 22:30:08 +0200 ngircd (17~rc2-0ab2) unstable; urgency=low * Install /etc/pam.d/ngircd including "auth required pam_permit.so" when installing -full or -full-dbg variant to keep backwards compatibility. -- Alexander Barton Tue, 26 Oct 2010 23:34:56 +0200 ngircd (17~rc2-0ab1) unstable; urgency=low * New "upstream" release candidate 2 for ngIRCd Release 17. -- Alexander Barton Mon, 25 Oct 2010 18:51:15 +0200 ngircd (17~rc1-0ab1) unstable; urgency=low * New "upstream" release candidate 1 for ngIRCd Release 17. -- Alexander Barton Mon, 11 Oct 2010 16:57:47 +0200 ngircd (16-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 16. -- Alexander Barton Sun, 02 May 2010 13:32:41 +0200 ngircd (16~rc2-0ab1) unstable; urgency=low * New "upstream" release candidate 2 for ngIRCd Release 16. -- Alexander Barton Sun, 25 Apr 2010 13:12:42 +0200 ngircd (16~rc1-0ab1) unstable; urgency=low * New "upstream" release candidate 1 for ngIRCd Release 16. -- Alexander Barton Thu, 25 Mar 2010 15:56:03 +0200 ngircd (15-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 15. -- Alexander Barton 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 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 Tue, 5 May 2009 13:13:38 +0200 ngircd (14-0ab3) unstable; urgency=low * Fixed "Conflicts:" line in debian/control: missing comma. -- Alexander Barton 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 Wed, 29 Apr 2009 01:13:03 +0200 ngircd (14-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 14. -- Alexander Barton 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 Sun, 29 Mar 2009 17:09:17 +0200 ngircd (13-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 13. -- Alexander Barton 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 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 Fri, 03 Oct 2008 16:22:55 +0200 ngircd (0.12.1-0ab1) unstable; urgency=low * New "upstream" release ngIRCd 0.12.1. -- Alexander Barton Wed, 9 Jul 2008 11:27:00 +0200 ngircd (0.12.0-0ab1) unstable; urgency=low * New "upstream" release ngIRCd 0.12.0. -- Alexander Barton Tue, 13 May 2008 12:30:31 +0200 ngircd (0.12.0-0ab0-pre2) unstable; urgency=low * Second prerelease of upcoming new "upstrem" release 0.12.0-pre1. -- Alexander Barton Tue, 29 Apr 2008 23:06:14 +0200 ngircd (0.12.0-0ab0-pre1) unstable; urgency=low * Prereloease of upcoming new "upstrem" release 0.12.0-pre1. -- Alexander Barton Sun, 20 Apr 2008 15:43:34 +0200 ngircd (0.11.0-0ab0-pre2) unstable; urgency=low * Second prerelease of upcoming new "upstream release". -- Alexander Barton Mon, 7 Jan 2008 15:32:42 +0100 ngircd (0.11.0-0ab0-pre1) unstable; urgency=low * Prerelease of upcoming new "upstream release". -- Alexander Barton Wed, 2 Jan 2008 21:33:15 +0100 ngircd (0.10.4-0ab1) unstable; urgency=high * New "upstream" release: 0.10.4 - fixing a security bug. -- Alexander Barton Mon, 7 Jan 2008 22:04:44 +0100 ngircd (0.10.0-0ab1) unstable; urgency=low * New "upstream" release: 0.10.0 -- Alexander Barton Sun, 1 Oct 2006 18:14:21 +0200 ngircd (0.10.0-0ab0-pre2-1) unstable; urgency=low * Bumped standards version to 3.7.2.1. * Added "Provides: ircd" to Debian control file. -- Alexander Barton Sun, 1 Oct 2006 16:25:33 +0200 ngircd (0.10.0-0ab0-pre2) unstable; urgency=low * Second "upstream" prerelease of upcoming 0.10.0 release. -- Alexander Barton Sat, 9 Sep 2006 20:57:52 +0200 ngircd (0.10.0-0ab0-pre1) unstable; urgency=low * Prerelease of upcoming new "upstream release". -- Alexander Barton Wed, 2 Aug 2006 12:01:07 +0200 ngircd (0.9.2-0ab1) unstable; urgency=low * New "upstream release" fixing a few bugs in 0.9.1. -- Alexander Barton Sat, 15 Oct 2005 14:10:34 +0200 ngircd (0.9.1-0ab1) unstable; urgency=medium * New "upstream release" addressing two problems in ngIRCd 0.9.0. -- Alexander Barton Wed, 3 Aug 2005 15:10:41 +0200 ngircd (0.9.0-0ab2) unstable; urgency=medium * Init script: fixed a problem with symbolic links in runlevel directories that could prevent the init script from working correctly. -- Alexander Barton Tue, 26 Jul 2005 21:31:18 +0200 ngircd (0.9.0-0ab1) unstable; urgency=low * New "upstream release". -- Alexander Barton Sat, 24 Jul 2005 23:30:00 +0200 ngircd (0.8.3-0ab1) unstable; urgency=high * New "upstream release", including security fixes. -- Alexander Barton Thu, 3 Feb 2005 10:41:55 +0100 ngircd (0.8.2-0ab1) unstable; urgency=high * New "upstream release", including security fixes. -- Alexander Barton Wed, 26 Jan 2005 23:14:12 +0100 ngircd (0.8.1-0ab1) unstable; urgency=low * New "upstream release". -- Alexander Barton Sat, 25 Dec 2004 01:18:32 +0100 ngircd (0.8.0-0ab2) unstable; urgency=low * Added missing commas to debian control file, fixes bug #56. Thanks to Kevin Otte. -- Alexander Barton Thu, 15 Jul 2004 10:53:39 +0200 ngircd (0.8.0-0ab1) unstable; urgency=low * New upstream version. -- Alexander Barton Sat, 26 Jun 2004 11:25:59 +0200 ngircd (0.7.7+HEAD-0ab6) unstable; urgency=low * Incorporated actual CVS HEAD version which includes all features of version 0.8.0-pre1 and patches for the resolver and logger. -- Alexander Barton Tue, 11 May 2004 02:18:50 +0200 ngircd (0.7.7+HEAD-0ab5) unstable; urgency=low * Updates from CVS HEAD branch, most notably: "INVITE- and BAN-lists become synchronized between IRC+ servers when establishing new connections, if the peer supports this as well." -- Alexander Barton Mon, 26 Apr 2004 01:53:15 +0200 ngircd (0.7.7+HEAD-0ab4) unstable; urgency=low * This version includes fixes for INVITE command and the handling of the invite and ban lists from CVS-HEAD. -- Alexander Barton Fri, 9 Apr 2004 23:55:13 +0200 ngircd (0.7.7+HEAD-0ab3) unstable; urgency=low * Included MODE fix from CVS-HEAD branch. -- Alexander Barton Mon, 5 Apr 2004 13:09:24 +0200 ngircd (0.7.7+HEAD-0ab2) unstable; urgency=low * Incorporated more fixes and enhancements of CVS-HEAD version, e. g. better connection logging and fixed TRACE command. -- Alexander Barton Sat, 28 Feb 2004 03:20:32 +0100 ngircd (0.7.7+HEAD-0ab1) unstable; urgency=low * New upstream version. This debian package includes all features of ngIRCd 0.7.7 and changes of the CVS-HEAD development tree. -- Alexander Barton Thu, 5 Feb 2004 15:23:22 +0100 ngircd (0.7.6+HEAD-0ab2) unstable; urgency=low * Included new fixes and additions from the CVS-HEAD upstream branch, e. g. the setting of type of service (TOS) on sockets. -- Alexander Barton Mon, 26 Jan 2004 04:05:41 +0100 ngircd (0.7.6+HEAD-0ab1) unstable; urgency=low * Included all changes from the CVS-HEAD upstream version. * Restructured debian packaging system: now there are two packages, a "standard" version that includes all the default options and a "full" version that additionally includes support for TCP wrappers and IDENT lookups. -- Alexander Barton Thu, 1 Jan 2004 23:12:11 +0100 ngircd (0.7.6-0ab1) unstable; urgency=medium * New upstream version. * Changed version numvering scheme of debian package. -- Alexander Barton Fri, 5 Dec 2003 14:26:41 +0100 ngircd (0.7.5-0.2ab) unstable; urgency=low * Updated RPM and Debian package description and configuration. -- Alexander Barton Sat, 29 Nov 2003 21:24:32 +0100 ngircd (0.7.5-0.1ab) unstable; urgency=low * New upstream version. -- Alexander Barton Fri, 7 Nov 2003 21:59:58 +0100 ngircd (0.7.1-0.1ab) unstable; urgency=low * New upstream version :-) -- Alexander Barton Fri, 18 Jul 2003 22:53:02 +0200 ngircd (0.7.0-0.7ab) unstable; urgency=low * Fixed up post installation script (added interpreter, fixed chmod call). -- Alexander Barton Sun, 13 Jul 2003 00:52:38 +0200 ngircd (0.7.0-0.6ab) unstable; urgency=low * Added /etc/default/ngircd. * Included own post installation script. -- Alexander Barton Sat, 12 Jul 2003 20:31:09 +0200 ngircd (0.7.0-0.5ab) unstable; urgency=low * Enhanced init script. * Included NJOIN fix from actual CVS "HEAD" branch. -- Alexander Barton Wed, 9 Jul 2003 22:40:49 +0200 ngircd (0.7.0-0.4ab) unstable; urgency=low * Reverted use of dh_installexamples. -- Alexander Barton Thu, 22 May 2003 00:15:03 +0200 ngircd (0.7.0-0.3ab) unstable; urgency=low * Removed "debian/docs" and "debian/conffiles"; debhelper takes care of this for us automagically. * Excluded "etc/ngircd.conf" from dh_fixperms. -- Alexander Barton Wed, 21 May 2003 23:25:05 +0200 ngircd (0.7.0-0.2ab) unstable; urgency=low * Fixed wrong variable substitution in init script. * Added some CVS "Id-Tags" (but not checked in, yet). * Removed own "Provides:" from control file. -- Alexander Barton Wed, 21 May 2003 12:32:34 +0200 ngircd (0.7.0-0.1ab) unstable; urgency=low * Initial Release. -- Alexander Barton Wed, 21 May 2003 02:36:52 +0200 ngircd-21/contrib/MacOSX/0000755000175000116100000000000012234274327012301 500000000000000ngircd-21/contrib/MacOSX/Makefile.in0000644000175000116100000004321412234274153014267 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ subdir = contrib/MacOSX DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-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 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ 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 .SUFFIXES: .SUFFIXES: .tmpl . $(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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/MacOSX/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu contrib/MacOSX/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 $(am__aclocal_m4_deps): # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" 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)'; \ 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .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: sed \ -e s@:SBINDIR:@${sbindir}@ \ <$< >$@ install-data-local: [ `uname -s` != "Darwin" ] || make install-sys-darwin install-sys-darwin: @if [ `id -u` -eq 0 ]; then \ make install-sys-darwin-root; \ else \ echo; \ echo " ** NOTE: Not installing with root privileges, so the LaunchDaemon script"; \ echo " ** \"/Library/LaunchDaemons/de.barton.ngircd.plist\" can't be installed/updated!"; \ echo; \ fi install-sys-darwin-root: 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." @echo clean-local: rm -rf build rm -f de.barton.ngircd.plist 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: ngircd-21/contrib/MacOSX/preinstall.sh0000754000175000116100000000133011130147557014727 00000000000000#!/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- ngircd-21/contrib/MacOSX/ngIRCd.pmdoc/0000755000175000116100000000000012234274327014510 500000000000000ngircd-21/contrib/MacOSX/ngIRCd.pmdoc/Makefile.in0000644000175000116100000002310712234274153016475 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ 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.ac 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 = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ 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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/MacOSX/ngIRCd.pmdoc/Makefile'; \ $(am__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 $(am__aclocal_m4_deps): 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am 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: ngircd-21/contrib/MacOSX/ngIRCd.pmdoc/Makefile.am0000644000175000116100000000110411130147557016456 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2008 Alexander Barton # # 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- ngircd-21/contrib/MacOSX/ngIRCd.pmdoc/01ngircd.xml0000644000175000116100000000154712206130744016561 00000000000000de.barton.ngircd.daemon.pkg17.1../../ngircd.dest/extraFilesinstallToinstallTo.isAbsoluteTypescripts.preinstall.pathidentifierparentversioninstallTo.pathscripts.preupgrade.pathrequireAuthorization02ngircd-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ngircd-21/contrib/MacOSX/ngIRCd.pmdoc/02de.xml0000644000175000116100000000256511555514455015720 00000000000000de.barton.ngircd.launchscript.pkg17.1de.barton.ngircd.plist/Library/LaunchDaemonsscripts.preinstall.pathinstallToscripts.postinstall.pathscripts.postinstall.isRelativeTypeinstallFrom.isRelativeTypeinstallTo.isAbsoluteTypeversionparentscripts.preupgrade.pathidentifierscripts.postupgrade.pathrequireAuthorizationextraFilesscripts.postupgrade.isRelativeTypeinstallTo.pathpreinstall.shpostinstall.shpreinstall.shpostinstall.sh01de-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ngircd-21/contrib/MacOSX/ngIRCd.pmdoc/01ngircd-contents.xml0000644000175000116100000000556112206130744020414 00000000000000groupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownergroupownerngircd-21/contrib/MacOSX/ngIRCd.pmdoc/index.xml0000644000175000116100000005734512206130744016270 00000000000000ngIRCd../../ngIRCd.mpkgde.barton.ngircdngIRCd – next generation Internet Relay Chat (IRC) server daemon../ngIRCd-Logo.gif02de.xml01ngircd.xmlextraFilesproperties.titleproperties.customizeOptiondescriptionproperties.anywhereDomainproperties.systemDomain ngircd-21/contrib/MacOSX/ngIRCd.pmdoc/02de-contents.xml0000644000175000116100000000035211555514455017543 00000000000000groupownerngircd-21/contrib/MacOSX/Makefile.am0000644000175000116100000000302411130147557014252 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2008 Alexander Barton # # 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 = ngIRCd.xcodeproj ngIRCd.pmdoc EXTRA_DIST = de.barton.ngircd.plist.tmpl config.h preinstall.sh postinstall.sh SUFFIXES = .tmpl . .tmpl: sed \ -e s@:SBINDIR:@${sbindir}@ \ <$< >$@ install-data-local: [ `uname -s` != "Darwin" ] || make install-sys-darwin install-sys-darwin: @if [ `id -u` -eq 0 ]; then \ make install-sys-darwin-root; \ else \ echo; \ echo " ** NOTE: Not installing with root privileges, so the LaunchDaemon script"; \ echo " ** \"/Library/LaunchDaemons/de.barton.ngircd.plist\" can't be installed/updated!"; \ echo; \ fi install-sys-darwin-root: 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." @echo clean-local: rm -rf build rm -f de.barton.ngircd.plist maintainer-clean-local: rm -f Makefile Makefile.in # -eof- ngircd-21/contrib/MacOSX/ngIRCd.xcodeproj/0000755000175000116100000000000012234274327015403 500000000000000ngircd-21/contrib/MacOSX/ngIRCd.xcodeproj/Makefile.in0000644000175000116100000002302712234274153017371 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ subdir = contrib/MacOSX/ngIRCd.xcodeproj DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = project.pbxproj 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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/MacOSX/ngIRCd.xcodeproj/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu contrib/MacOSX/ngIRCd.xcodeproj/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 $(am__aclocal_m4_deps): 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am 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: ngircd-21/contrib/MacOSX/ngIRCd.xcodeproj/Makefile.am0000644000175000116100000000101111000116207017326 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2008 Alexander Barton # # 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 = project.pbxproj maintainer-clean-local: rm -f Makefile Makefile.in # -eof- ngircd-21/contrib/MacOSX/ngIRCd.xcodeproj/project.pbxproj0000644000175000116100000016530012206745354020406 00000000000000// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ FA2D564A11EA158B00D37A35 /* pam.c in Sources */ = {isa = PBXBuildFile; fileRef = FA2D564911EA158B00D37A35 /* pam.c */; }; FA2D567B11EA1AB300D37A35 /* libpam.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA2D567A11EA1AB300D37A35 /* libpam.dylib */; }; FA322D350CEF74B1001761B3 /* array.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CD90CEF74B1001761B3 /* array.c */; }; FA322D360CEF74B1001761B3 /* channel.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CDB0CEF74B1001761B3 /* channel.c */; }; FA322D370CEF74B1001761B3 /* client.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CDD0CEF74B1001761B3 /* client.c */; }; FA322D380CEF74B1001761B3 /* conf.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CDF0CEF74B1001761B3 /* conf.c */; }; FA322D390CEF74B1001761B3 /* conn-func.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CE10CEF74B1001761B3 /* conn-func.c */; }; FA322D3A0CEF74B1001761B3 /* conn-zip.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CE30CEF74B1001761B3 /* conn-zip.c */; }; FA322D3B0CEF74B1001761B3 /* conn.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CE50CEF74B1001761B3 /* conn.c */; }; FA322D3C0CEF74B1001761B3 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CE80CEF74B1001761B3 /* hash.c */; }; FA322D3D0CEF74B1001761B3 /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CEA0CEF74B1001761B3 /* io.c */; }; FA322D3E0CEF74B1001761B3 /* irc-channel.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CEC0CEF74B1001761B3 /* irc-channel.c */; }; FA322D3F0CEF74B1001761B3 /* irc-info.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CEE0CEF74B1001761B3 /* irc-info.c */; }; FA322D400CEF74B1001761B3 /* irc-login.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CF00CEF74B1001761B3 /* irc-login.c */; }; FA322D410CEF74B1001761B3 /* irc-mode.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CF20CEF74B1001761B3 /* irc-mode.c */; }; FA322D420CEF74B1001761B3 /* irc-op.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CF40CEF74B1001761B3 /* irc-op.c */; }; FA322D430CEF74B1001761B3 /* irc-oper.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CF60CEF74B1001761B3 /* irc-oper.c */; }; FA322D440CEF74B1001761B3 /* irc-server.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CF80CEF74B1001761B3 /* irc-server.c */; }; FA322D450CEF74B1001761B3 /* irc-write.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CFA0CEF74B1001761B3 /* irc-write.c */; }; FA322D460CEF74B1001761B3 /* irc.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CFC0CEF74B1001761B3 /* irc.c */; }; FA322D470CEF74B1001761B3 /* lists.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322CFE0CEF74B1001761B3 /* lists.c */; }; FA322D480CEF74B1001761B3 /* log.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322D000CEF74B1001761B3 /* log.c */; }; FA322D490CEF74B1001761B3 /* match.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322D030CEF74B1001761B3 /* match.c */; }; FA322D4A0CEF74B1001761B3 /* ngircd.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322D060CEF74B1001761B3 /* ngircd.c */; }; FA322D4B0CEF74B1001761B3 /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322D080CEF74B1001761B3 /* parse.c */; }; FA322D4D0CEF74B1001761B3 /* resolve.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322D0C0CEF74B1001761B3 /* resolve.c */; }; 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 */; }; FA4F165A164836B100DBD011 /* irc-metadata.c in Sources */ = {isa = PBXBuildFile; fileRef = FA4F1659164836B100DBD011 /* irc-metadata.c */; }; FA6BBC631605F0AC0004247A /* conn-encoding.c in Sources */ = {isa = PBXBuildFile; fileRef = FA6BBC5F1605F0AB0004247A /* conn-encoding.c */; }; FA6BBC641605F0AC0004247A /* irc-encoding.c in Sources */ = {isa = PBXBuildFile; fileRef = FA6BBC611605F0AC0004247A /* irc-encoding.c */; }; FA6BBC661605F6D60004247A /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA6BBC651605F6D60004247A /* libiconv.dylib */; }; FA85178C0FA061EC006A1F5A /* op.c in Sources */ = {isa = PBXBuildFile; fileRef = FA85178B0FA061EC006A1F5A /* op.c */; }; FA99428C10E82A27007F27ED /* proc.c in Sources */ = {isa = PBXBuildFile; fileRef = FA99428B10E82A27007F27ED /* proc.c */; }; FAA3D27B0F139CDC00B2447E /* conn-ssl.c in Sources */ = {isa = PBXBuildFile; fileRef = FAA3D2790F139CDC00B2447E /* conn-ssl.c */; }; FAA97C57124A271400D5BBA9 /* sighandlers.c in Sources */ = {isa = PBXBuildFile; fileRef = FAA97C55124A271400D5BBA9 /* sighandlers.c */; }; FAACD5F514A6099C006ED74F /* class.c in Sources */ = {isa = PBXBuildFile; fileRef = FAACD5F314A6099C006ED74F /* class.c */; }; FAD5853215271AAB00328741 /* client-cap.c in Sources */ = {isa = PBXBuildFile; fileRef = FAD5853015271AAB00328741 /* client-cap.c */; }; FAD5853515271AB800328741 /* irc-cap.c in Sources */ = {isa = PBXBuildFile; fileRef = FAD5853315271AB800328741 /* irc-cap.c */; }; FAD5853815272C2600328741 /* login.c in Sources */ = {isa = PBXBuildFile; fileRef = FAD5853615272C2500328741 /* login.c */; }; FAE5CC2E0CF2308A007D69B6 /* numeric.c in Sources */ = {isa = PBXBuildFile; fileRef = FAE5CC2D0CF2308A007D69B6 /* numeric.c */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ 8DD76FAF0486AB0100D96B5E /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 8; dstPath = /usr/share/man/man1/; dstSubfolderSpec = 0; files = ( ); runOnlyForDeploymentPostprocessing = 1; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ FA18A63E16CEDDCE00132F66 /* configure.ng */ = {isa = PBXFileReference; lastKnownFileType = text; name = configure.ng; path = ../../configure.ng; sourceTree = ""; }; FA18A63F16CEDE2300132F66 /* ngircd.service */ = {isa = PBXFileReference; lastKnownFileType = text; path = ngircd.service; sourceTree = ""; }; FA18A64016CEDE2300132F66 /* ngircd.socket */ = {isa = PBXFileReference; lastKnownFileType = text; path = ngircd.socket; sourceTree = ""; }; FA18A64116CEDE3500132F66 /* ngircd.pam */ = {isa = PBXFileReference; lastKnownFileType = text; path = ngircd.pam; sourceTree = ""; }; FA18A64216CEDE5700132F66 /* de.barton.ngircd.plist.tmpl */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = de.barton.ngircd.plist.tmpl; sourceTree = ""; }; FA18A64316CEDE8100132F66 /* Makefile.am */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; FA18A64416CEDFCE00132F66 /* Commands.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = Commands.txt; sourceTree = ""; }; FA18A64516CEE0C700132F66 /* Makefile.ng */ = {isa = PBXFileReference; lastKnownFileType = text; name = Makefile.ng; path = ipaddr/Makefile.ng; sourceTree = ""; }; FA18A64616CEE0DD00132F66 /* Makefile.ng */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile.ng; sourceTree = ""; }; FA18A64716CEE14900132F66 /* Makefile.ng */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile.ng; sourceTree = ""; }; FA18A64A16CEE18100132F66 /* Makefile.ng */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile.ng; sourceTree = ""; }; FA18A64C16CEE1AC00132F66 /* mode-test.e */ = {isa = PBXFileReference; lastKnownFileType = text; path = "mode-test.e"; sourceTree = ""; }; FA18A64D16CEE1D900132F66 /* whois-test.e */ = {isa = PBXFileReference; lastKnownFileType = text; path = "whois-test.e"; sourceTree = ""; }; FA18A64E16CEE24B00132F66 /* misc-test.e */ = {isa = PBXFileReference; lastKnownFileType = text; path = "misc-test.e"; sourceTree = ""; }; FA18A64F16CEE27700132F66 /* Makefile.ng */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile.ng; sourceTree = ""; }; FA1A6BBD0D6857D900AA8F71 /* who-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "who-test.e"; sourceTree = ""; }; FA1DBB6716C707D200D4F838 /* irc-macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "irc-macros.h"; sourceTree = ""; }; FA2D564811EA158B00D37A35 /* pam.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pam.h; sourceTree = ""; }; FA2D564911EA158B00D37A35 /* pam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pam.c; sourceTree = ""; }; FA2D567A11EA1AB300D37A35 /* libpam.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpam.dylib; path = usr/lib/libpam.dylib; sourceTree = SDKROOT; }; FA322BBA0CEF72E4001761B3 /* ngIRCd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = ngIRCd; path = ngircd; sourceTree = BUILT_PRODUCTS_DIR; }; FA322CD60CEF74B1001761B3 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; FA322CD90CEF74B1001761B3 /* array.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = array.c; sourceTree = ""; }; FA322CDA0CEF74B1001761B3 /* array.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = array.h; sourceTree = ""; }; FA322CDB0CEF74B1001761B3 /* channel.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = channel.c; sourceTree = ""; }; FA322CDC0CEF74B1001761B3 /* channel.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = channel.h; sourceTree = ""; }; FA322CDD0CEF74B1001761B3 /* client.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = client.c; sourceTree = ""; }; FA322CDE0CEF74B1001761B3 /* client.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = client.h; sourceTree = ""; }; FA322CDF0CEF74B1001761B3 /* conf.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = conf.c; sourceTree = ""; }; FA322CE00CEF74B1001761B3 /* conf.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = conf.h; sourceTree = ""; }; FA322CE10CEF74B1001761B3 /* conn-func.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "conn-func.c"; sourceTree = ""; }; FA322CE20CEF74B1001761B3 /* conn-func.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "conn-func.h"; sourceTree = ""; }; FA322CE30CEF74B1001761B3 /* conn-zip.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "conn-zip.c"; sourceTree = ""; }; FA322CE40CEF74B1001761B3 /* conn-zip.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "conn-zip.h"; sourceTree = ""; }; FA322CE50CEF74B1001761B3 /* conn.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = conn.c; sourceTree = ""; }; FA322CE60CEF74B1001761B3 /* conn.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = conn.h; sourceTree = ""; }; FA322CE70CEF74B1001761B3 /* defines.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = defines.h; sourceTree = ""; }; FA322CE80CEF74B1001761B3 /* hash.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = hash.c; sourceTree = ""; }; FA322CE90CEF74B1001761B3 /* hash.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = hash.h; sourceTree = ""; }; FA322CEA0CEF74B1001761B3 /* io.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = io.c; sourceTree = ""; }; FA322CEB0CEF74B1001761B3 /* io.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = io.h; sourceTree = ""; }; FA322CEC0CEF74B1001761B3 /* irc-channel.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "irc-channel.c"; sourceTree = ""; }; FA322CED0CEF74B1001761B3 /* irc-channel.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "irc-channel.h"; sourceTree = ""; }; FA322CEE0CEF74B1001761B3 /* irc-info.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "irc-info.c"; sourceTree = ""; }; FA322CEF0CEF74B1001761B3 /* irc-info.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "irc-info.h"; sourceTree = ""; }; FA322CF00CEF74B1001761B3 /* irc-login.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "irc-login.c"; sourceTree = ""; }; FA322CF10CEF74B1001761B3 /* irc-login.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "irc-login.h"; sourceTree = ""; }; FA322CF20CEF74B1001761B3 /* irc-mode.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "irc-mode.c"; sourceTree = ""; }; FA322CF30CEF74B1001761B3 /* irc-mode.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "irc-mode.h"; sourceTree = ""; }; FA322CF40CEF74B1001761B3 /* irc-op.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "irc-op.c"; sourceTree = ""; }; FA322CF50CEF74B1001761B3 /* irc-op.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "irc-op.h"; sourceTree = ""; }; FA322CF60CEF74B1001761B3 /* irc-oper.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "irc-oper.c"; sourceTree = ""; }; FA322CF70CEF74B1001761B3 /* irc-oper.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "irc-oper.h"; sourceTree = ""; }; FA322CF80CEF74B1001761B3 /* irc-server.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "irc-server.c"; sourceTree = ""; }; FA322CF90CEF74B1001761B3 /* irc-server.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "irc-server.h"; sourceTree = ""; }; FA322CFA0CEF74B1001761B3 /* irc-write.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "irc-write.c"; sourceTree = ""; }; FA322CFB0CEF74B1001761B3 /* irc-write.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "irc-write.h"; sourceTree = ""; }; FA322CFC0CEF74B1001761B3 /* irc.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = irc.c; sourceTree = ""; }; FA322CFD0CEF74B1001761B3 /* irc.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = irc.h; sourceTree = ""; }; FA322CFE0CEF74B1001761B3 /* lists.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = lists.c; sourceTree = ""; }; FA322CFF0CEF74B1001761B3 /* lists.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = lists.h; sourceTree = ""; }; FA322D000CEF74B1001761B3 /* log.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = log.c; sourceTree = ""; }; FA322D010CEF74B1001761B3 /* log.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = ""; }; FA322D030CEF74B1001761B3 /* match.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = match.c; sourceTree = ""; }; FA322D040CEF74B1001761B3 /* match.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = match.h; sourceTree = ""; }; FA322D050CEF74B1001761B3 /* messages.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = messages.h; sourceTree = ""; }; FA322D060CEF74B1001761B3 /* ngircd.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = ngircd.c; sourceTree = ""; }; FA322D070CEF74B1001761B3 /* ngircd.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = ngircd.h; sourceTree = ""; }; FA322D080CEF74B1001761B3 /* parse.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = parse.c; sourceTree = ""; }; FA322D090CEF74B1001761B3 /* parse.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = parse.h; sourceTree = ""; }; FA322D0C0CEF74B1001761B3 /* resolve.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = resolve.c; sourceTree = ""; }; FA322D0D0CEF74B1001761B3 /* resolve.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = resolve.h; sourceTree = ""; }; FA322D100CEF74B1001761B3 /* ansi2knr.1 */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.man; path = ansi2knr.1; sourceTree = ""; }; FA322D110CEF74B1001761B3 /* ansi2knr.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = ansi2knr.c; sourceTree = ""; }; FA322D120CEF74B1001761B3 /* exp.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = exp.h; sourceTree = ""; }; FA322D130CEF74B1001761B3 /* imp.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = imp.h; sourceTree = ""; }; FA322D150CEF74B1001761B3 /* portab.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = portab.h; sourceTree = ""; }; FA322D160CEF74B1001761B3 /* portabtest.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = portabtest.c; sourceTree = ""; }; FA322D170CEF74B1001761B3 /* splint.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = splint.h; sourceTree = ""; }; FA322D180CEF74B1001761B3 /* strdup.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = strdup.c; sourceTree = ""; }; FA322D190CEF74B1001761B3 /* strlcpy.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = strlcpy.c; sourceTree = ""; }; FA322D1A0CEF74B1001761B3 /* vsnprintf.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = vsnprintf.c; sourceTree = ""; }; FA322D1D0CEF74B1001761B3 /* channel-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "channel-test.e"; sourceTree = ""; }; FA322D1E0CEF74B1001761B3 /* check-idle.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "check-idle.e"; sourceTree = ""; }; FA322D1F0CEF74B1001761B3 /* connect-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "connect-test.e"; sourceTree = ""; }; FA322D200CEF74B1001761B3 /* functions.inc */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; path = functions.inc; sourceTree = ""; }; FA322D210CEF74B1001761B3 /* getpid.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = getpid.sh; sourceTree = ""; }; FA322D250CEF74B1001761B3 /* README */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = README; sourceTree = ""; }; FA322D260CEF74B1001761B3 /* start-server.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = "start-server.sh"; sourceTree = ""; }; FA322D270CEF74B1001761B3 /* stop-server.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = "stop-server.sh"; sourceTree = ""; }; FA322D280CEF74B1001761B3 /* stress-A.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "stress-A.e"; sourceTree = ""; }; FA322D290CEF74B1001761B3 /* stress-B.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "stress-B.e"; sourceTree = ""; }; FA322D2A0CEF74B1001761B3 /* stress-server.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = "stress-server.sh"; sourceTree = ""; }; FA322D2B0CEF74B1001761B3 /* test-loop.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = "test-loop.sh"; sourceTree = ""; }; FA322D2C0CEF74B1001761B3 /* tests.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = tests.sh; sourceTree = ""; }; FA322D2D0CEF74B1001761B3 /* wait-tests.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = "wait-tests.sh"; sourceTree = ""; }; FA322D330CEF74B1001761B3 /* tool.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = tool.c; sourceTree = ""; }; FA322D340CEF74B1001761B3 /* tool.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = tool.h; sourceTree = ""; }; FA322D5A0CEF750F001761B3 /* AUTHORS */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = AUTHORS; path = ../../AUTHORS; sourceTree = SOURCE_ROOT; }; FA322D5B0CEF750F001761B3 /* autogen.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; name = autogen.sh; path = ../../autogen.sh; sourceTree = SOURCE_ROOT; }; FA322D5C0CEF750F001761B3 /* ChangeLog */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = ChangeLog; path = ../../ChangeLog; sourceTree = SOURCE_ROOT; }; FA322D5E0CEF750F001761B3 /* config.guess */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; name = config.guess; path = ../../config.guess; sourceTree = SOURCE_ROOT; }; FA322D5F0CEF750F001761B3 /* config.sub */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; name = config.sub; path = ../../config.sub; sourceTree = SOURCE_ROOT; }; FA322D610CEF750F001761B3 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = COPYING; path = ../../COPYING; sourceTree = SOURCE_ROOT; }; FA322D620CEF750F001761B3 /* INSTALL */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = INSTALL; path = ../../INSTALL; sourceTree = SOURCE_ROOT; }; FA322D630CEF750F001761B3 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = Makefile.am; path = ../../Makefile.am; sourceTree = SOURCE_ROOT; }; FA322D640CEF750F001761B3 /* NEWS */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = NEWS; path = ../../NEWS; sourceTree = SOURCE_ROOT; }; FA322D650CEF750F001761B3 /* README */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = README; path = ../../README; sourceTree = SOURCE_ROOT; }; FA322D6A0CEF7523001761B3 /* changelog */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = changelog; sourceTree = ""; }; FA322D6B0CEF7523001761B3 /* compat */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = compat; sourceTree = ""; }; FA322D6C0CEF7523001761B3 /* control */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = control; sourceTree = ""; }; FA322D6D0CEF7523001761B3 /* copyright */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = copyright; sourceTree = ""; }; FA322D6E0CEF7523001761B3 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; FA322D6F0CEF7523001761B3 /* ngircd.default */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = ngircd.default; sourceTree = ""; }; FA322D700CEF7523001761B3 /* ngircd.init */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = ngircd.init; sourceTree = ""; }; FA322D710CEF7523001761B3 /* ngircd.postinst */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = ngircd.postinst; sourceTree = ""; }; FA322D720CEF7523001761B3 /* rules */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = rules; sourceTree = ""; }; FA322D8D0CEF7523001761B3 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = Makefile.am; path = MacOSX/Makefile.am; sourceTree = ""; }; FA322D8E0CEF7523001761B3 /* ngIRCd.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = ngIRCd.xcodeproj; sourceTree = ""; }; FA322D920CEF7523001761B3 /* ngindent */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = ngindent; sourceTree = ""; }; FA322D940CEF7523001761B3 /* ngircd.spec */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = ngircd.spec; sourceTree = ""; }; FA322D950CEF7523001761B3 /* README */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = README; sourceTree = ""; }; FA322D960CEF7523001761B3 /* systrace.policy */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = systrace.policy; sourceTree = ""; }; FA322D9A0CEF752C001761B3 /* FAQ.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = FAQ.txt; sourceTree = ""; }; FA322D9B0CEF752C001761B3 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; FA322D9C0CEF752C001761B3 /* Platforms.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Platforms.txt; sourceTree = ""; }; FA322D9D0CEF752C001761B3 /* Protocol.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Protocol.txt; sourceTree = ""; }; FA322D9E0CEF752C001761B3 /* README-AUX.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "README-AUX.txt"; sourceTree = ""; }; FA322D9F0CEF752C001761B3 /* README-BeOS.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "README-BeOS.txt"; sourceTree = ""; }; FA322DA00CEF752C001761B3 /* RFC.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = RFC.txt; sourceTree = ""; }; FA322DA40CEF752C001761B3 /* Doxyfile */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Doxyfile; sourceTree = ""; }; FA322DA50CEF752C001761B3 /* footer.inc.html */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.html; path = footer.inc.html; sourceTree = ""; }; FA322DA70CEF752C001761B3 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; FA322DA90CEF752C001761B3 /* SSL.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = SSL.txt; sourceTree = ""; }; FA322DAD0CEF7538001761B3 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; FA322DAE0CEF7538001761B3 /* ngircd.8.tmpl */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = ngircd.8.tmpl; sourceTree = ""; }; FA322DAF0CEF7538001761B3 /* ngircd.conf.5.tmpl */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = ngircd.conf.5.tmpl; sourceTree = ""; }; FA322DB10CEF7565001761B3 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; FA322DC00CEF77CB001761B3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = ""; }; FA407F2C0DB159F400271AF1 /* ng_ipaddr.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = ng_ipaddr.c; path = ipaddr/ng_ipaddr.c; sourceTree = ""; }; FA407F2D0DB159F400271AF1 /* ng_ipaddr.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = ng_ipaddr.h; path = ipaddr/ng_ipaddr.h; sourceTree = ""; }; FA407F380DB15AC700271AF1 /* GIT.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = GIT.txt; sourceTree = ""; }; FA4B08E513E7F8FB00765BA3 /* ngircd-bsd.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "ngircd-bsd.sh"; sourceTree = ""; }; FA4B08E613E7F91700765BA3 /* ngIRCd-Logo.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "ngIRCd-Logo.gif"; sourceTree = ""; }; FA4B08E713E7F91700765BA3 /* ngircd-redhat.init */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "ngircd-redhat.init"; sourceTree = ""; }; FA4B08E813E7F91C00765BA3 /* platformtest.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = platformtest.sh; sourceTree = ""; }; FA4F1659164836B100DBD011 /* irc-metadata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "irc-metadata.c"; sourceTree = ""; }; FA4F165C164836BF00DBD011 /* irc-metadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "irc-metadata.h"; sourceTree = ""; }; FA6BBC5F1605F0AB0004247A /* conn-encoding.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "conn-encoding.c"; sourceTree = ""; }; FA6BBC601605F0AC0004247A /* conn-encoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "conn-encoding.h"; sourceTree = ""; }; FA6BBC611605F0AC0004247A /* irc-encoding.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "irc-encoding.c"; sourceTree = ""; }; FA6BBC621605F0AC0004247A /* irc-encoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "irc-encoding.h"; sourceTree = ""; }; FA6BBC651605F6D60004247A /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = ../../../../../../../usr/lib/libiconv.dylib; sourceTree = ""; }; FA77849A133FB9FF00740057 /* sample-ngircd.conf.tmpl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "sample-ngircd.conf.tmpl"; sourceTree = ""; }; FA85178A0FA061EC006A1F5A /* op.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = op.h; sourceTree = ""; }; FA85178B0FA061EC006A1F5A /* op.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = op.c; sourceTree = ""; }; FA99428A10E82A27007F27ED /* proc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = proc.h; sourceTree = ""; }; FA99428B10E82A27007F27ED /* proc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = proc.c; sourceTree = ""; }; FAA3D2700F139CB300B2447E /* invite-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "invite-test.e"; sourceTree = ""; }; FAA3D2710F139CB300B2447E /* join-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "join-test.e"; sourceTree = ""; }; FAA3D2720F139CB300B2447E /* kick-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "kick-test.e"; sourceTree = ""; }; FAA3D2730F139CB300B2447E /* message-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "message-test.e"; sourceTree = ""; }; FAA3D2740F139CB300B2447E /* ngircd-test1.conf */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "ngircd-test1.conf"; sourceTree = ""; }; FAA3D2750F139CB300B2447E /* ngircd-test2.conf */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "ngircd-test2.conf"; sourceTree = ""; }; FAA3D2760F139CB300B2447E /* opless-channel-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "opless-channel-test.e"; sourceTree = ""; }; FAA3D2770F139CB300B2447E /* server-link-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "server-link-test.e"; sourceTree = ""; }; FAA3D2780F139CDC00B2447E /* conf-ssl.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "conf-ssl.h"; sourceTree = ""; }; FAA3D2790F139CDC00B2447E /* conn-ssl.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "conn-ssl.c"; sourceTree = ""; }; FAA3D27A0F139CDC00B2447E /* conn-ssl.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "conn-ssl.h"; sourceTree = ""; }; FAA3D27C0F139CF800B2447E /* strtok_r.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = strtok_r.c; sourceTree = ""; }; FAA3D27D0F139CF800B2447E /* waitpid.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = waitpid.c; sourceTree = ""; }; FAA3D2800F139D1500B2447E /* Services.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Services.txt; sourceTree = ""; }; FAA3D2820F139D2E00B2447E /* 01ngircd-contents.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = "01ngircd-contents.xml"; sourceTree = ""; }; FAA3D2830F139D2E00B2447E /* 01ngircd.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = 01ngircd.xml; sourceTree = ""; }; FAA3D2840F139D2E00B2447E /* 02de-contents.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = "02de-contents.xml"; sourceTree = ""; }; FAA3D2850F139D2E00B2447E /* 02de.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = 02de.xml; sourceTree = ""; }; FAA3D2860F139D2E00B2447E /* index.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = index.xml; sourceTree = ""; }; FAA3D2880F139D2E00B2447E /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; FAA3D28A0F139D2E00B2447E /* postinstall.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = postinstall.sh; sourceTree = ""; }; FAA3D28B0F139D2E00B2447E /* preinstall.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = preinstall.sh; sourceTree = ""; }; FAA97C55124A271400D5BBA9 /* sighandlers.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = sighandlers.c; sourceTree = ""; }; FAA97C56124A271400D5BBA9 /* sighandlers.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = sighandlers.h; sourceTree = ""; }; FAACD5F314A6099C006ED74F /* class.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = class.c; sourceTree = ""; }; FAACD5F414A6099C006ED74F /* class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = class.h; sourceTree = ""; }; FAD5852F15271A7800328741 /* Capabilities.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = Capabilities.txt; sourceTree = ""; }; FAD5853015271AAB00328741 /* client-cap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "client-cap.c"; sourceTree = ""; }; FAD5853115271AAB00328741 /* client-cap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "client-cap.h"; sourceTree = ""; }; FAD5853315271AB800328741 /* irc-cap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "irc-cap.c"; sourceTree = ""; }; FAD5853415271AB800328741 /* irc-cap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "irc-cap.h"; sourceTree = ""; }; FAD5853615272C2500328741 /* login.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = login.c; sourceTree = ""; }; FAD5853715272C2500328741 /* login.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = login.h; sourceTree = ""; }; FAE22BD215270EA300F1A5AB /* Bopm.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = Bopm.txt; sourceTree = ""; }; FAE22BD415270EA300F1A5AB /* Contributing.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = Contributing.txt; sourceTree = ""; }; FAE22BD515270EB500F1A5AB /* HowToRelease.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = HowToRelease.txt; sourceTree = ""; }; FAE22BD615270EB500F1A5AB /* Modes.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = Modes.txt; sourceTree = ""; }; FAE22BD715270EB500F1A5AB /* PAM.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = PAM.txt; sourceTree = ""; }; FAE22BD815270EC400F1A5AB /* README-Interix.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = "README-Interix.txt"; sourceTree = ""; }; FAE5CC2C0CF2308A007D69B6 /* numeric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = numeric.h; sourceTree = ""; }; FAE5CC2D0CF2308A007D69B6 /* numeric.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = numeric.c; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8DD76FAD0486AB0100D96B5E /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( FA322DC10CEF77CB001761B3 /* libz.dylib in Frameworks */, FA2D567B11EA1AB300D37A35 /* libpam.dylib in Frameworks */, FA6BBC661605F6D60004247A /* libiconv.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 08FB7794FE84155DC02AAC07 /* ngIRCd */ = { isa = PBXGroup; children = ( FA322D630CEF750F001761B3 /* Makefile.am */, FA322D660CEF7523001761B3 /* contrib */, FA322D970CEF752C001761B3 /* doc */, FA322DAB0CEF7538001761B3 /* man */, FA322CD40CEF74B0001761B3 /* src */, FA322D5A0CEF750F001761B3 /* AUTHORS */, FA322D5C0CEF750F001761B3 /* ChangeLog */, FA322D610CEF750F001761B3 /* COPYING */, FA322D620CEF750F001761B3 /* INSTALL */, FA322D640CEF750F001761B3 /* NEWS */, FA322D650CEF750F001761B3 /* README */, FA322D5B0CEF750F001761B3 /* autogen.sh */, FA322D5E0CEF750F001761B3 /* config.guess */, FA322D5F0CEF750F001761B3 /* config.sub */, FA18A63E16CEDDCE00132F66 /* configure.ng */, 1AB674ADFE9D54B511CA2CBB /* Products */, FA6BBC651605F6D60004247A /* libiconv.dylib */, FA2D567A11EA1AB300D37A35 /* libpam.dylib */, FA322DC00CEF77CB001761B3 /* libz.dylib */, ); indentWidth = 8; name = ngIRCd; sourceTree = ""; tabWidth = 8; usesTabs = 1; wrapsLines = 0; }; 1AB674ADFE9D54B511CA2CBB /* Products */ = { isa = PBXGroup; children = ( FA322BBA0CEF72E4001761B3 /* ngIRCd */, ); name = Products; sourceTree = ""; }; FA322CD40CEF74B0001761B3 /* src */ = { isa = PBXGroup; children = ( FA322CD60CEF74B1001761B3 /* Makefile.am */, FA407F270DB1598D00271AF1 /* ipaddr */, FA322CD70CEF74B1001761B3 /* ngircd */, FA322D0E0CEF74B1001761B3 /* portab */, FA322D1B0CEF74B1001761B3 /* testsuite */, FA322D2E0CEF74B1001761B3 /* tool */, ); name = src; path = ../../src; sourceTree = SOURCE_ROOT; }; FA322CD70CEF74B1001761B3 /* ngircd */ = { isa = PBXGroup; children = ( FA18A64616CEE0DD00132F66 /* Makefile.ng */, FA322CD90CEF74B1001761B3 /* array.c */, FA322CDA0CEF74B1001761B3 /* array.h */, FA322CDB0CEF74B1001761B3 /* channel.c */, FA322CDC0CEF74B1001761B3 /* channel.h */, FAACD5F314A6099C006ED74F /* class.c */, FAACD5F414A6099C006ED74F /* class.h */, FA322CDD0CEF74B1001761B3 /* client.c */, FA322CDE0CEF74B1001761B3 /* client.h */, FAD5853015271AAB00328741 /* client-cap.c */, FAD5853115271AAB00328741 /* client-cap.h */, FA322CDF0CEF74B1001761B3 /* conf.c */, FA322CE00CEF74B1001761B3 /* conf.h */, FAA3D2780F139CDC00B2447E /* conf-ssl.h */, FA322CE50CEF74B1001761B3 /* conn.c */, FA322CE60CEF74B1001761B3 /* conn.h */, FA6BBC5F1605F0AB0004247A /* conn-encoding.c */, FA6BBC601605F0AC0004247A /* conn-encoding.h */, FA322CE10CEF74B1001761B3 /* conn-func.c */, FA322CE20CEF74B1001761B3 /* conn-func.h */, FAA3D2790F139CDC00B2447E /* conn-ssl.c */, FAA3D27A0F139CDC00B2447E /* conn-ssl.h */, FA322CE30CEF74B1001761B3 /* conn-zip.c */, FA322CE40CEF74B1001761B3 /* conn-zip.h */, FA322CE70CEF74B1001761B3 /* defines.h */, FA322CE80CEF74B1001761B3 /* hash.c */, FA322CE90CEF74B1001761B3 /* hash.h */, FA322CEA0CEF74B1001761B3 /* io.c */, FA322CEB0CEF74B1001761B3 /* io.h */, FA322CFC0CEF74B1001761B3 /* irc.c */, FA322CFD0CEF74B1001761B3 /* irc.h */, FAD5853315271AB800328741 /* irc-cap.c */, FAD5853415271AB800328741 /* irc-cap.h */, FA322CEC0CEF74B1001761B3 /* irc-channel.c */, FA322CED0CEF74B1001761B3 /* irc-channel.h */, FA6BBC611605F0AC0004247A /* irc-encoding.c */, FA6BBC621605F0AC0004247A /* irc-encoding.h */, FA322CEE0CEF74B1001761B3 /* irc-info.c */, FA322CEF0CEF74B1001761B3 /* irc-info.h */, FA322CF00CEF74B1001761B3 /* irc-login.c */, FA322CF10CEF74B1001761B3 /* irc-login.h */, FA1DBB6716C707D200D4F838 /* irc-macros.h */, FA4F1659164836B100DBD011 /* irc-metadata.c */, FA4F165C164836BF00DBD011 /* irc-metadata.h */, FA322CF20CEF74B1001761B3 /* irc-mode.c */, FA322CF30CEF74B1001761B3 /* irc-mode.h */, FA322CF40CEF74B1001761B3 /* irc-op.c */, FA322CF50CEF74B1001761B3 /* irc-op.h */, FA322CF60CEF74B1001761B3 /* irc-oper.c */, FA322CF70CEF74B1001761B3 /* irc-oper.h */, FA322CF80CEF74B1001761B3 /* irc-server.c */, FA322CF90CEF74B1001761B3 /* irc-server.h */, FA322CFA0CEF74B1001761B3 /* irc-write.c */, FA322CFB0CEF74B1001761B3 /* irc-write.h */, FA322CFE0CEF74B1001761B3 /* lists.c */, FA322CFF0CEF74B1001761B3 /* lists.h */, FA322D000CEF74B1001761B3 /* log.c */, FA322D010CEF74B1001761B3 /* log.h */, FAD5853615272C2500328741 /* login.c */, FAD5853715272C2500328741 /* login.h */, FA322D030CEF74B1001761B3 /* match.c */, FA322D040CEF74B1001761B3 /* match.h */, FA322D050CEF74B1001761B3 /* messages.h */, FA322D060CEF74B1001761B3 /* ngircd.c */, FA322D070CEF74B1001761B3 /* ngircd.h */, FAE5CC2D0CF2308A007D69B6 /* numeric.c */, FAE5CC2C0CF2308A007D69B6 /* numeric.h */, FA85178B0FA061EC006A1F5A /* op.c */, FA85178A0FA061EC006A1F5A /* op.h */, FA2D564911EA158B00D37A35 /* pam.c */, FA2D564811EA158B00D37A35 /* pam.h */, FA322D080CEF74B1001761B3 /* parse.c */, FA322D090CEF74B1001761B3 /* parse.h */, FA99428B10E82A27007F27ED /* proc.c */, FA99428A10E82A27007F27ED /* proc.h */, FA322D0C0CEF74B1001761B3 /* resolve.c */, FA322D0D0CEF74B1001761B3 /* resolve.h */, FAA97C55124A271400D5BBA9 /* sighandlers.c */, FAA97C56124A271400D5BBA9 /* sighandlers.h */, ); path = ngircd; sourceTree = ""; }; FA322D0E0CEF74B1001761B3 /* portab */ = { isa = PBXGroup; children = ( FA18A64716CEE14900132F66 /* Makefile.ng */, FA322D100CEF74B1001761B3 /* ansi2knr.1 */, FA322D110CEF74B1001761B3 /* ansi2knr.c */, FA322D120CEF74B1001761B3 /* exp.h */, FA322D130CEF74B1001761B3 /* imp.h */, FA322D150CEF74B1001761B3 /* portab.h */, FA322D160CEF74B1001761B3 /* portabtest.c */, FA322D170CEF74B1001761B3 /* splint.h */, FA322D180CEF74B1001761B3 /* strdup.c */, FA322D190CEF74B1001761B3 /* strlcpy.c */, FAA3D27C0F139CF800B2447E /* strtok_r.c */, FA322D1A0CEF74B1001761B3 /* vsnprintf.c */, FAA3D27D0F139CF800B2447E /* waitpid.c */, ); path = portab; sourceTree = ""; }; FA322D1B0CEF74B1001761B3 /* testsuite */ = { isa = PBXGroup; children = ( FA18A64A16CEE18100132F66 /* Makefile.ng */, FA322D250CEF74B1001761B3 /* README */, FA322D1D0CEF74B1001761B3 /* channel-test.e */, FA322D1E0CEF74B1001761B3 /* check-idle.e */, FA322D1F0CEF74B1001761B3 /* connect-test.e */, FAA3D2700F139CB300B2447E /* invite-test.e */, FAA3D2710F139CB300B2447E /* join-test.e */, FAA3D2720F139CB300B2447E /* kick-test.e */, FAA3D2730F139CB300B2447E /* message-test.e */, FA18A64E16CEE24B00132F66 /* misc-test.e */, FA18A64C16CEE1AC00132F66 /* mode-test.e */, FAA3D2760F139CB300B2447E /* opless-channel-test.e */, FAA3D2770F139CB300B2447E /* server-link-test.e */, FA322D280CEF74B1001761B3 /* stress-A.e */, FA322D290CEF74B1001761B3 /* stress-B.e */, FA1A6BBD0D6857D900AA8F71 /* who-test.e */, FA18A64D16CEE1D900132F66 /* whois-test.e */, FA322D200CEF74B1001761B3 /* functions.inc */, FAA3D2740F139CB300B2447E /* ngircd-test1.conf */, FAA3D2750F139CB300B2447E /* ngircd-test2.conf */, FA322D210CEF74B1001761B3 /* getpid.sh */, FA322D260CEF74B1001761B3 /* start-server.sh */, FA322D270CEF74B1001761B3 /* stop-server.sh */, FA322D2A0CEF74B1001761B3 /* stress-server.sh */, FA322D2B0CEF74B1001761B3 /* test-loop.sh */, FA322D2C0CEF74B1001761B3 /* tests.sh */, FA322D2D0CEF74B1001761B3 /* wait-tests.sh */, ); path = testsuite; sourceTree = ""; }; FA322D2E0CEF74B1001761B3 /* tool */ = { isa = PBXGroup; children = ( FA18A64F16CEE27700132F66 /* Makefile.ng */, FA322D330CEF74B1001761B3 /* tool.c */, FA322D340CEF74B1001761B3 /* tool.h */, ); path = tool; sourceTree = ""; }; FA322D660CEF7523001761B3 /* contrib */ = { isa = PBXGroup; children = ( FA322D8D0CEF7523001761B3 /* Makefile.am */, FA322D680CEF7523001761B3 /* Debian */, FA322D730CEF7523001761B3 /* MacOSX */, FA322D950CEF7523001761B3 /* README */, FA322D920CEF7523001761B3 /* ngindent */, FA4B08E513E7F8FB00765BA3 /* ngircd-bsd.sh */, FA4B08E613E7F91700765BA3 /* ngIRCd-Logo.gif */, FA4B08E713E7F91700765BA3 /* ngircd-redhat.init */, FA18A63F16CEDE2300132F66 /* ngircd.service */, FA18A64016CEDE2300132F66 /* ngircd.socket */, FA322D940CEF7523001761B3 /* ngircd.spec */, FA4B08E813E7F91C00765BA3 /* platformtest.sh */, FA322D960CEF7523001761B3 /* systrace.policy */, ); name = contrib; path = ..; sourceTree = SOURCE_ROOT; }; FA322D680CEF7523001761B3 /* Debian */ = { isa = PBXGroup; children = ( FA322D6E0CEF7523001761B3 /* Makefile.am */, FA322D6A0CEF7523001761B3 /* changelog */, FA322D6B0CEF7523001761B3 /* compat */, FA322D6C0CEF7523001761B3 /* control */, FA322D6D0CEF7523001761B3 /* copyright */, FA322D6F0CEF7523001761B3 /* ngircd.default */, FA322D700CEF7523001761B3 /* ngircd.init */, FA18A64116CEDE3500132F66 /* ngircd.pam */, FA322D710CEF7523001761B3 /* ngircd.postinst */, FA322D720CEF7523001761B3 /* rules */, ); path = Debian; sourceTree = ""; }; FA322D730CEF7523001761B3 /* MacOSX */ = { isa = PBXGroup; children = ( FA18A64316CEDE8100132F66 /* Makefile.am */, FAA3D2810F139D2E00B2447E /* ngIRCd.pmdoc */, FA322DB10CEF7565001761B3 /* config.h */, FA18A64216CEDE5700132F66 /* de.barton.ngircd.plist.tmpl */, FA322D8E0CEF7523001761B3 /* ngIRCd.xcodeproj */, FAA3D28A0F139D2E00B2447E /* postinstall.sh */, FAA3D28B0F139D2E00B2447E /* preinstall.sh */, ); path = MacOSX; sourceTree = ""; }; FA322D8F0CEF7523001761B3 /* Products */ = { isa = PBXGroup; children = ( ); name = Products; sourceTree = ""; }; FA322D970CEF752C001761B3 /* doc */ = { isa = PBXGroup; children = ( FA322D9B0CEF752C001761B3 /* Makefile.am */, FA322DA20CEF752C001761B3 /* src */, FAE22BD215270EA300F1A5AB /* Bopm.txt */, FAD5852F15271A7800328741 /* Capabilities.txt */, FA18A64416CEDFCE00132F66 /* Commands.txt */, FAE22BD415270EA300F1A5AB /* Contributing.txt */, FA322D9A0CEF752C001761B3 /* FAQ.txt */, FA407F380DB15AC700271AF1 /* GIT.txt */, FAE22BD515270EB500F1A5AB /* HowToRelease.txt */, FAE22BD615270EB500F1A5AB /* Modes.txt */, FAE22BD715270EB500F1A5AB /* PAM.txt */, FA322D9C0CEF752C001761B3 /* Platforms.txt */, FA322D9D0CEF752C001761B3 /* Protocol.txt */, FA322D9E0CEF752C001761B3 /* README-AUX.txt */, FA322D9F0CEF752C001761B3 /* README-BeOS.txt */, FAE22BD815270EC400F1A5AB /* README-Interix.txt */, FA322DA00CEF752C001761B3 /* RFC.txt */, FAA3D2800F139D1500B2447E /* Services.txt */, FA322DA90CEF752C001761B3 /* SSL.txt */, FA77849A133FB9FF00740057 /* sample-ngircd.conf.tmpl */, ); name = doc; path = ../../doc; sourceTree = SOURCE_ROOT; }; FA322DA20CEF752C001761B3 /* src */ = { isa = PBXGroup; children = ( FA322DA70CEF752C001761B3 /* Makefile.am */, FA322DA40CEF752C001761B3 /* Doxyfile */, FA322DA50CEF752C001761B3 /* footer.inc.html */, ); path = src; sourceTree = ""; }; FA322DAB0CEF7538001761B3 /* man */ = { isa = PBXGroup; children = ( FA322DAD0CEF7538001761B3 /* Makefile.am */, FA322DAE0CEF7538001761B3 /* ngircd.8.tmpl */, FA322DAF0CEF7538001761B3 /* ngircd.conf.5.tmpl */, ); name = man; path = ../../man; sourceTree = SOURCE_ROOT; }; FA407F270DB1598D00271AF1 /* ipaddr */ = { isa = PBXGroup; children = ( FA18A64516CEE0C700132F66 /* Makefile.ng */, FA407F2C0DB159F400271AF1 /* ng_ipaddr.c */, FA407F2D0DB159F400271AF1 /* ng_ipaddr.h */, ); name = ipaddr; sourceTree = ""; }; FAA3D2810F139D2E00B2447E /* ngIRCd.pmdoc */ = { isa = PBXGroup; children = ( FAA3D2880F139D2E00B2447E /* Makefile.am */, FAA3D2860F139D2E00B2447E /* index.xml */, FAA3D2830F139D2E00B2447E /* 01ngircd.xml */, FAA3D2820F139D2E00B2447E /* 01ngircd-contents.xml */, FAA3D2850F139D2E00B2447E /* 02de.xml */, FAA3D2840F139D2E00B2447E /* 02de-contents.xml */, ); path = ngIRCd.pmdoc; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 8DD76FA90486AB0100D96B5E /* ngIRCd */ = { isa = PBXNativeTarget; buildConfigurationList = 1DEB928508733DD80010E9CD /* Build configuration list for PBXNativeTarget "ngIRCd" */; buildPhases = ( 8DD76FAB0486AB0100D96B5E /* Sources */, 8DD76FAD0486AB0100D96B5E /* Frameworks */, 8DD76FAF0486AB0100D96B5E /* CopyFiles */, ); buildRules = ( ); dependencies = ( ); name = ngIRCd; productInstallPath = "$(HOME)/bin"; productName = ngIRCd; productReference = FA322BBA0CEF72E4001761B3 /* ngIRCd */; productType = "com.apple.product-type.tool"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0430; }; buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "ngIRCd" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, Japanese, French, German, ); mainGroup = 08FB7794FE84155DC02AAC07 /* ngIRCd */; projectDirPath = ""; projectReferences = ( { ProductGroup = FA322D8F0CEF7523001761B3 /* Products */; ProjectRef = FA322D8E0CEF7523001761B3 /* ngIRCd.xcodeproj */; }, ); projectRoot = ""; targets = ( 8DD76FA90486AB0100D96B5E /* ngIRCd */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ 8DD76FAB0486AB0100D96B5E /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( FA322D350CEF74B1001761B3 /* array.c in Sources */, FA322D360CEF74B1001761B3 /* channel.c in Sources */, FA322D370CEF74B1001761B3 /* client.c in Sources */, FA322D380CEF74B1001761B3 /* conf.c in Sources */, FA322D390CEF74B1001761B3 /* conn-func.c in Sources */, FA322D3A0CEF74B1001761B3 /* conn-zip.c in Sources */, FA322D3B0CEF74B1001761B3 /* conn.c in Sources */, FA322D3C0CEF74B1001761B3 /* hash.c in Sources */, FA322D3D0CEF74B1001761B3 /* io.c in Sources */, FA322D3E0CEF74B1001761B3 /* irc-channel.c in Sources */, FA322D3F0CEF74B1001761B3 /* irc-info.c in Sources */, FA322D400CEF74B1001761B3 /* irc-login.c in Sources */, FA322D410CEF74B1001761B3 /* irc-mode.c in Sources */, FA322D420CEF74B1001761B3 /* irc-op.c in Sources */, FA322D430CEF74B1001761B3 /* irc-oper.c in Sources */, FA322D440CEF74B1001761B3 /* irc-server.c in Sources */, FA322D450CEF74B1001761B3 /* irc-write.c in Sources */, FA322D460CEF74B1001761B3 /* irc.c in Sources */, FA322D470CEF74B1001761B3 /* lists.c in Sources */, FA322D480CEF74B1001761B3 /* log.c in Sources */, FA322D490CEF74B1001761B3 /* match.c in Sources */, FA322D4A0CEF74B1001761B3 /* ngircd.c in Sources */, FA322D4B0CEF74B1001761B3 /* parse.c in Sources */, FA322D4D0CEF74B1001761B3 /* resolve.c in Sources */, 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 */, FA99428C10E82A27007F27ED /* proc.c in Sources */, FA2D564A11EA158B00D37A35 /* pam.c in Sources */, FAA97C57124A271400D5BBA9 /* sighandlers.c in Sources */, FAACD5F514A6099C006ED74F /* class.c in Sources */, FAD5853215271AAB00328741 /* client-cap.c in Sources */, FAD5853515271AB800328741 /* irc-cap.c in Sources */, FAD5853815272C2600328741 /* login.c in Sources */, FA6BBC631605F0AC0004247A /* conn-encoding.c in Sources */, FA6BBC641605F0AC0004247A /* irc-encoding.c in Sources */, FA4F165A164836B100DBD011 /* irc-metadata.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 1DEB928708733DD80010E9CD /* Default */ = { isa = XCBuildConfiguration; buildSettings = { GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 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; }; name = Default; }; 1DEB928B08733DD80010E9CD /* Default */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; CODE_SIGN_IDENTITY = ""; GCC_VERSION = ""; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; SDKROOT = ""; }; name = Default; }; FAB0570C105D917F006AF9E2 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(NATIVE_ARCH_ACTUAL)"; GCC_DEBUGGING_SYMBOLS = full; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = ""; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; SDKROOT = ""; }; name = Debug; }; FAB0570D105D917F006AF9E2 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 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 = NO; 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; }; name = Debug; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 1DEB928508733DD80010E9CD /* Build configuration list for PBXNativeTarget "ngIRCd" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB928708733DD80010E9CD /* Default */, FAB0570D105D917F006AF9E2 /* Debug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Default; }; 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "ngIRCd" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB928B08733DD80010E9CD /* Default */, FAB0570C105D917F006AF9E2 /* Debug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Default; }; /* End XCConfigurationList section */ }; rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; } ngircd-21/contrib/MacOSX/de.barton.ngircd.plist.tmpl0000644000175000116100000000111711130147557017370 00000000000000 Disabled KeepAlive Label de.barton.ngIRCd ProgramArguments :SBINDIR:/ngircd --nodaemon RunAtLoad StandardErrorPath /Library/Logs/ngIRCd.log StandardOutPath /Library/Logs/ngIRCd.log ngircd-21/contrib/MacOSX/config.h0000644000175000116100000000762212206130744013637 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. * * Static configuration file for Mac OS X Xcode project */ #define PACKAGE_NAME "ngIRCd" # define PACKAGE "ngircd" #ifndef VERSION # define VERSION "??("__DATE__")" #endif #ifndef HOST_VENDOR # define HOST_VENDOR "apple" # define HOST_OS "darwin" # ifdef __x86_64 # define HOST_CPU "x86_64" # endif #endif #define SYSCONFDIR "/etc/ngircd" #define DOCDIR "/usr/share/doc/ngircd" /* -- Build options -- */ /* Define if debug-mode should be enabled */ #define DEBUG 1 /* Define if the server should do IDENT requests */ /*#define IDENTAUTH 1*/ /* Define if IRC+ protocol should be used */ #define IRCPLUS 1 /* Define if IRC sniffer should be enabled */ /*#define SNIFFER 1*/ /* Define if syslog should be used for logging */ #define SYSLOG 1 /* Define if TCP wrappers should be used */ /*#define TCPWRAP 1*/ /* Define if zlib compression should be enabled */ #define ZLIB 1 /* Define if IPV6 protocol should be enabled */ #define WANT_IPV6 1 /* Define if PAM should be used */ #define PAM 1 /* Define if libiconv can be used, e.g. for CHARCONV */ #define ICONV 1 /* -- Supported features -- */ /* Define if SSP C support is enabled. */ #define ENABLE_SSP_CC 1 /* Define to 1 if the C compiler supports function prototypes. */ #define PROTOTYPES 1 /* Define like PROTOTYPES; this can be used by system headers. */ #define __PROTOTYPES 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDDEF_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDBOOL_H 1 /* Define to 1 if you have the header file. */ #define HAVE_ARPA_INET_H 1 /* Define to 1 if you have the header file. */ #define HAVE_NETINET_IP_H 1 /* Define to 1 if you have the `gai_strerror' function. */ #define HAVE_GAI_STRERROR 1 /* Define to 1 if you have the `iconv_open' function. */ #define HAVE_ICONV_OPEN 1 /* Define to 1 if you have the `kqueue' function. */ #define HAVE_KQUEUE 1 /* Define to 1 if you have the `inet_ntoa' function. */ #define HAVE_INET_NTOA 1 /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 /* Define to 1 if you have the `strlcat' function. */ #define HAVE_STRLCAT 1 /* Define to 1 if you have the `strlcpy' function. */ #define HAVE_STRLCPY 1 /* Define to 1 if you have the `strdup' function. */ #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 to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the `setsid' function. */ #define HAVE_SETSID 1 /* Define if socklen_t exists */ #define HAVE_socklen_t 1 #ifdef PAM /* Define to 1 if you have the `pam_authenticate' function. */ #define HAVE_PAM_AUTHENTICATE 1 #if (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060) /* Define to 1 if you have the header file. */ #define HAVE_PAM_PAM_APPL_H 1 /* Mac OS X <10.6 doesn't have pam_fail_delay() */ #define NO_PAM_FAIL_DELAY 1 #else /* Define to 1 if you have the header file. */ #define HAVE_SECURITY_PAM_APPL_H 1 #endif #endif /* -eof- */ ngircd-21/contrib/MacOSX/postinstall.sh0000754000175000116100000000341411461552771015140 00000000000000#!/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 [ ! -e /opt/ngircd/etc/ngircd.pam ]; then echo "Creating default PAM configuration: /opt/ngircd/etc/ngircd.pam" echo "# PAM configuration for ngIRCd" >/opt/ngircd/etc/ngircd.pam echo "" >>/opt/ngircd/etc/ngircd.pam echo "auth required pam_permit.so" >>/opt/ngircd/etc/ngircd.pam echo "#auth required pam_opendirectory.so" >>/opt/ngircd/etc/ngircd.pam fi chmod 644 /opt/ngircd/etc/ngircd.pam if [ ! -e /etc/pam.d/ngircd ]; then echo "Linkint /opt/ngircd/etc/ngircd.pam to /etc/pam.d/ngircd" ln -s /opt/ngircd/etc/ngircd.pam /etc/pam.d/ngircd || exit 1 fi 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- ngircd-21/contrib/ngircd.service0000644000175000116100000000027712206130744013756 00000000000000[Unit] Description=Next Generation IRC Daemon After=network.target [Service] Type=forking ExecStart=/usr/sbin/ngircd ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target ngircd-21/contrib/ngIRCd-Logo.gif0000644000175000116100000000366711551543066013636 00000000000000GIF89a}1ظذبРȘаȨȘȘȨภȸȰظظظиааȸȨȠȘhиxذذааȰhhXȨШXPؠؠؠؘؘИȘxPpPpPАȐؐАȐh舠耸ЀppxxxpPxXPxPPxPPppXpPP``hP`PP`PPXXXXXPPHHHPP@@@PP((((x(x(x(PP(PPxhhPPPPPPxPpPhPXPPPP!,} H*\ȰÇ#JHŋ3jȱǏ CIɓ(S\ɲ˗0cʜI͛8sɳϟ@ JѣH*]ʴӧPJJիXjʵׯ`ÊKٳhӪ]˶۷pʝKݻx˷߿ L)СC.2á!EB+t!4X[ ܾ}\N۷ӕIn0!^@߿$5#'wl,:P-OWuZsk-xoD2 <6 Wwm%?1@ǜw1Gәd͈}A2aŀ"hTwʅ1GqFqs>Ai(ЀB7昌"@Udeq@&%+d6N6&l+ xے 1㙬f)?zf$g4(h*%˰]V &Td*1<5W>qZ9|s1m4YaEj9jUɴ@Ҫ@Br<#.+z A d%#Y-b@:O @B}VޒxJ.@Lr_9isϵmu>*I|Y=ڑ:ޞ־φ[}a/Cs@\ULipsc9_{sK6b&B(mA>nqT0%y{bF %P,BSե( TC|)(*a޼OfN9!mZ["|#v%&^!l?RNd(9S du׬iX rIV"?32x8e%9x  d#ܞZ4߆ƌSeS.L[gZ()Oi@ fOoFGtKt:NA@p#NAj̤Ul-(d"?wAOX 0P۰ ZF< GXE(J1".Al@d(3H@%Vx M> IBL"F:򑐌$'IJZ̤&7Nz (GIRL*WI;ngircd-21/contrib/systrace.policy0000644000175000116100000000544111000116207014167 00000000000000# # Sample systrace policy for ngIRCd on OpenBSD # Author: Benjamin Pineau # # $Id: systrace.policy,v 1.1 2004/04/28 12:16:59 alex Exp $ # # Tune me, put me in /etc/systrace/usr_local_bin_ngircd and start ngIRCd # (with root privileges) as: # # systrace -a /usr/local/bin/ngircd # # I didn't tried this on NetBSD, but it should work as is. # # On systems with pf, it can be supplemented by strict firewall rules: # for a ngircd running as '$ircuser', binding on '$ircport' and accepting # 30 connections: # # block out log quick proto tcp from any port $ircport to any \ # user != $ircuser # pass in inet proto tcp from any to any port $ircport user $ircuser \ # keep state (max 30) flags S/SA # Policy: /usr/local/bin/ngircd, Emulation: native native-__sysctl: permit native-fsread: filename eq "/etc/malloc.conf" then permit native-fsread: filename sub "/usr/share/zoneinfo/" then permit native-fsread: filename eq "/usr/local/etc/ngircd.conf" then permit native-fsread: filename eq "/usr/local/etc/ngircd.motd" then permit native-fsread: filename eq "/etc/ngircd.conf" then permit native-fsread: filename eq "/etc/ngircd.motd" then permit native-fsread: filename eq "/etc/spwd.db" then deny[eperm] native-fsread: filename eq "/etc/group" then permit native-fsread: filename eq "/etc/resolv.conf" then permit native-fsread: filename eq "/etc/localtime" then permit native-fsread: filename eq "/etc/hosts" then permit native-fsread: filename sub "" then deny[enoent] native-socket: sockdom eq "AF_UNIX" and socktype eq "SOCK_DGRAM" then permit native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit native-bind: sockaddr match "inet-*:6667" then permit, if user != root native-connect: sockaddr eq "/dev/log" then permit, if user != root native-connect: sockaddr match "inet-*:53" then permit, if user != root native-setsockopt: permit, if user != root native-listen: permit, if user != root native-accept: permit, if user != root native-sendto: true then permit, if user != root native-recvfrom: permit, if user != root native-read: permit native-pread: permit native-write: permit, if user != root native-mmap: permit native-munmap: permit native-mprotect: permit native-break: permit native-umask: permit native-fork: permit native-setsid: permit native-chdir: permit native-chroot: permit native-setgid: gid neq "0" then permit native-setuid: uid neq "0" and uname neq "root" then permit native-getuid: permit native-getgid: permit native-gettimeofday: permit native-getpid: permit native-select: permit native-fcntl: permit native-fstat: permit native-issetugid: permit native-sigaction: permit native-pipe: permit native-sigreturn: permit native-close: permit native-exit: permit native-fswrite: deny[eperm] # -eof- ngircd-21/contrib/ngircd-bsd.sh0000644000175000116100000000227511200004141013456 00000000000000#!/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- ngircd-21/contrib/ngircd-redhat.init0000644000175000116100000000457711465534227014547 00000000000000#!/bin/sh # # ngIRCd start and stop script for RedHat based distributions. # Written by Naoya Nakazawa 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 ngircd-21/contrib/README0000644000175000116100000000231212206130744011776 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2013 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- Contributions -- Debian/ - Various files for building Debian GNU/Linux packages (".deb's"). - ngircd.init; ngircd.default: init script for Debian-based systems. - ngircd.pam: example PAM configuraton. MacOSX/ - Project files for XCode, the "project builder" of Apple Mac OS X. - de.barton.ngircd.plist[.tmpl]: launchd(8) property list. ngindent - Script to indent the code of ngIRCd in the "standard way". ngircd-bsd.sh - Start script for FreeBSD. ngircd-redhat.init - Start/stop script for RedHat-based distributions (like CentOS). ngircd.service - systemd(8) service unit configuration file. ngircd.socket - systemd(8) socket unit configuration file for "socket activation". 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). ngircd-21/man/0000755000175000116100000000000012234274326010321 500000000000000ngircd-21/man/Makefile.in0000644000175000116100000003560412234274153012314 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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-2012 Alexander Barton (alex@barton.de) and Contributors # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man5dir = $(mandir)/man5 am__installdirs = "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)" man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ 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 CLEANFILES = $(man_MANS) EXTRA_DIST = $(TEMPLATE_MANS) all: all-am .SUFFIXES: .SUFFIXES: .tmpl . $(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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu man/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 $(am__aclocal_m4_deps): install-man5: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)" @list=''; test -n "$(man5dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.5[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ done; } uninstall-man5: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man5dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.5[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man5dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man5dir)" && rm -f $$files; } install-man8: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" @list=''; test -n "$(man8dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man8dir)" && rm -f $$files; } tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 $(MANS) installdirs: for dir in "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man5 install-man8 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am 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: 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-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-man uninstall-man5 uninstall-man8 .tmpl: $(AM_V_GEN)sed \ -e "s@:SBINDIR:@${sbindir}@" \ -e "s@:BINDIR:@${bindir}@" \ -e "s@:ETCDIR:@${sysconfdir}@" \ <$< >$@ 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: ngircd-21/man/Makefile.am0000644000175000116100000000146112206130744012271 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors # # 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. # TEMPLATE_MANS = ngircd.conf.5.tmpl ngircd.8.tmpl SUFFIXES = .tmpl . .tmpl: $(AM_V_GEN)sed \ -e "s@:SBINDIR:@${sbindir}@" \ -e "s@:BINDIR:@${bindir}@" \ -e "s@:ETCDIR:@${sysconfdir}@" \ <$< >$@ man_MANS = ngircd.conf.5 ngircd.8 CLEANFILES = $(man_MANS) EXTRA_DIST = $(TEMPLATE_MANS) maintainer-clean-local: rm -f Makefile Makefile.in # -eof- ngircd-21/man/ngircd.conf.5.tmpl0000644000175000116100000004777112224620443013506 00000000000000.\" .\" ngircd.conf(5) manual page template .\" .TH ngircd.conf 5 "Oct 2013" ngIRCd "ngIRCd Manual" .SH NAME ngircd.conf \- configuration file of ngIRCd .SH SYNOPSIS .B :ETCDIR:/ngircd.conf .SH DESCRIPTION .BR ngircd.conf is the configuration file of the .BR ngircd (8) Internet Relay Chat (IRC) daemon, which must be customized to the local preferences and needs. .PP Most variables can be modified while the ngIRCd daemon is already running: It will reload its configuration file when a HUP signal or REHASH command 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 begins. .PP Sections contain parameters of the form .PP .RS .I name = .I value .RE .PP Empty lines and any line beginning with a semicolon (';') or a hash ('#') character are treated as a comment and will be ignored. Leading and trailing whitespaces are trimmed before any processing takes place. .PP The file format is line-based - that means, each non-empty newline-terminated line represents either a comment, a section name, or a parameter. .PP Section and parameter names are not case sensitive. .PP There are three types of variables: .I booleans, .I text strings, and .I numbers. Boolean values are .I true if they are "yes", "true", or any non-null integer. Text strings are used 1:1 without leading and following spaces; there is no way to quote strings. And for numbers all decimal integer values are valid. .PP In addition, some string or numerical variables accept lists of values, separated by commas (","). .SH "SECTION OVERVIEW" The file can contain blocks of seven types: [Global], [Limits], [Options], [SSL], [Operator], [Server], and [Channel]. .PP The main configuration of the server is stored in the .I [Global] section, like the server name, administrative information and the ports on which the server should be listening. The variables in this section have to be adjusted to the local requirements most of the time, whereas all the variables in the other sections can be left on there defaults very often. .PP Options in the .I [Limits] block are used to tweak different limits and timeouts of the daemon, like the maximum number of clients allowed to connect to this server. Variables in the .I [Options] section can be used to enable or disable specific features of ngIRCd, like support for IDENT, PAM, IPv6, and protocol and cloaking features. The .I [SSL] block contains all SSL-related configuration variables. These three sections are all optional. .PP IRC operators of this server are defined in .I [Operator] blocks. Links to remote servers are configured in .I [Server] sections. And .I [Channel] blocks are used to configure pre-defined ("persistent") IRC channels. .PP There can be more than one [Operator], [Server] and [Channel] section per configuration file (one for each operator, server, and channel), but only exactly one [Global], one [Limits], one [Options], and one [SSL] section. .SH [GLOBAL] The .I [Global] section of this file is used to define the main configuration of the server, like the server name and the ports on which the server should be listening. These settings depend on your personal preferences, so you should make sure that they correspond to your installation and setup! .TP \fBName\fR (string; required) 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 \fBAdminInfo1\fR, \fBAdminInfo2\fR, \fBAdminEMail\fR (string) Information about the server and the administrator, used by the ADMIN command. This information is not required by the server but by RFC! .TP \fBHelpFile\fR (string) Text file which contains the ngIRCd help text. This file is required to display help texts when using the "HELP " command. Please note: Changes made to this file take effect when ngircd starts up or is instructed to re-read its configuration file. .TP \fBInfo\fR (string) Info text of the server. This will be shown by WHOIS and LINKS requests for example. .TP \fBListen\fR (list of strings) 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 (string) Text file with the "message of the day" (MOTD). This message will be shown to all users connecting to the server. Please note: Changes made to this file take effect when ngircd starts up or is instructed to re-read its configuration file. .TP \fBMotdPhrase\fR (string) A simple Phrase (<256 chars) if you don't want to use a MOTD file. .TP \fBPassword\fR (string) Global password for all users needed to connect to the server. The default is empty, so no password is required. Please note: This feature is not available if ngIRCd is using PAM! .TP \fBPidFile\fR (string) This tells ngIRCd to write its current process ID to a file. Note that the "PID file" is written AFTER chroot and switching the user ID, e.g. the directory the file resides in must be writable by the ngIRCd user and exist in the chroot directory (if configured, see above). .TP \fBPorts\fR (list of numbers) Ports on which the server should listen for unencrypted connections. There may be more than one port, separated with commas (","). Default: 6667. .TP \fBServerGID\fR (string or number) Group ID under which the ngIRCd should run; you can use the name of the group or the numerical ID. .PP .RS .B Attention: .br For this to work the server must have been started with root privileges! .RE .TP \fBServerUID\fR (string or number) User ID under which the server should run; you can use the name of the user or the numerical ID. .PP .RS .B Attention: .br For this to work the server must have been started with root privileges! In addition, the configuration and MOTD files must be readable by this user, otherwise RESTART and REHASH won't work! .RE .SH [LIMITS] Define some limits and timeouts for this ngIRCd instance. Default values should be safe, but it is wise to double-check :-) .TP \fBConnectRetry\fR (number) The server tries every seconds to establish a link to not yet (or no longer) connected servers. Default: 60. .TP \fBIdleTimeout\fR (number) Number of seconds after which the whole daemon should shutdown when no connections are left active after handling at least one client (0: never). This can be useful for testing or when ngIRCd is started using "socket activation" with systemd(8), for example. Default: 0. .TP \fBMaxConnections\fR (number) Maximum number of simultaneous in- and outbound connections the server is allowed to accept (0: unlimited). Default: 0. .TP \fBMaxConnectionsIP\fR (number) Maximum number of simultaneous connections from a single IP address that the server will accept (0: unlimited). This configuration options lowers the risk of denial of service attacks (DoS). Default: 5. .TP \fBMaxJoins\fR (number) Maximum number of channels a user can be member of (0: no limit). Default: 10. .TP \fBMaxNickLength\fR (number) Maximum length of an user nickname (Default: 9, as in RFC 2812). Please note that all servers in an IRC network MUST use the same maximum nickname length! .TP \fBMaxListSize\fR (number) Maximum number of channels returned in response to a LIST command. Default: 100. .TP \fBPingTimeout\fR (number) After seconds of inactivity the server will send a PING to the peer to test whether it is alive or not. Default: 120. .TP \fBPongTimeout\fR (number) If a client fails to answer a PING with a PONG within seconds, it will be disconnected by the server. Default: 20. .SH [OPTIONS] Optional features and configuration options to further tweak the behavior of ngIRCd. If you want to get started quickly, you most probably don't have to make changes here -- they are all optional. .TP \fBAllowedChannelTypes\fR (string) List of allowed channel types (channel prefixes) for newly created channels on the local server. By default, all supported channel types are allowed. Set this variable to the empty string to disallow creation of new channels by local clients at all. Default: #&+ .TP \fBAllowRemoteOper\fR (boolean) 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 \fBChrootDir\fR (string) A directory to chroot in when everything is initialized. It doesn't need to be populated if ngIRCd is compiled as a static binary. By default ngIRCd won't use the chroot() feature. .PP .RS .B Attention: .br For this to work the server must have been started with root privileges! .RE .TP \fBCloakHost\fR (string) Set this hostname for every client instead of the real one. Default: empty, don't change. Use %x to add the hashed value of the original hostname. .TP \fBCloakHostModeX\fR (string) Use this hostname for hostname cloaking on clients that have the user mode "+x" set, instead of the name of the server. Default: empty, use the name of the server. Use %x to add the hashed value of the original hostname .TP \fBCloakHostSalt\fR (string) The Salt for cloaked hostname hashing. When undefined a random hash is generated after each server start. .TP \fBCloakUserToNick\fR (boolean) Set every clients' user name to their nickname and hide the one supplied by the IRC client. Default: no. .TP \fBConnectIPv4\fR (boolean) Set this to no if you do not want ngIRCd to connect to other IRC servers using the IPv4 protocol. This allows the usage of ngIRCd in IPv6-only setups. Default: yes. .TP \fBConnectIPv6\fR (boolean) Set this to no if you do not want ngIRCd to connect to other IRC servers using the IPv6 protocol. Default: yes. .TP \fBDefaultUserModes\fR (string) Default user mode(s) to set on new local clients. Please note that only modes can be set that the client could set on itself, you can't set "a" (away) or "o" (IRC Op), for example! Default: none. .TP \fBDNS\fR (boolean) If set to false, ngIRCd will not make any 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: yes. .TP \fBIdent\fR (boolean) If ngIRCd is compiled with IDENT support this can be used to disable IDENT lookups at run time. Users identified using IDENT are registered without the "~" character prepended to their user name. Default: yes. .TP .TP \fBIncludeDir\fR (string) Directory containing configuration snippets (*.conf), that should be read in after parsing the current configuration file. Default: none. \fBMorePrivacy\fR (boolean) This will cause ngIRCd to censor user idle time, logon time as well as the part/quit messages (that are sometimes used to inform everyone about which client software is being used). WHOWAS requests are also silently ignored. This option is most useful when ngIRCd is being used together with anonymizing software such as TOR or I2P and one does not wish to make it too easy to collect statistics on the users. Default: no. .TP \fBNoticeAuth\fR (boolean) Normally ngIRCd doesn't send any messages to a client until it is registered. Enable this option to let the daemon send "NOTICE AUTH" messages to clients while connecting. Default: no. .TP \fBOperCanUseMode\fR (boolean) Should IRC Operators be allowed to use the MODE command even if they are not(!) channel-operators? Default: no. .TP \fBOperChanPAutoOp\fR (boolean) Should IRC Operators get AutoOp (+o) in persistent (+P) channels? Default: yes. .TP \fBOperServerMode\fR (boolean) 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; only enable it if you have ircd-irc2 servers in your IRC network. .TP \fBPAM\fR (boolean) If ngIRCd is compiled with PAM support this can be used to disable all calls to the PAM library at runtime; all users connecting without password are allowed to connect, all passwords given will fail. Users identified using PAM are registered without the "~" character prepended to their user name. Default: yes. .TP \fBPAMIsOptional\fR (boolean) When PAM is enabled, all clients are required to be authenticated using PAM; connecting to the server without successful PAM authentication isn't possible. If this option is set, clients not sending a password are still allowed to connect: they won't become "identified" and keep the "~" character prepended to their supplied user name. Please note: To make some use of this behavior, it most probably isn't useful to enable "Ident", "PAM" and "PAMIsOptional" at the same time, because you wouldn't be able to distinguish between Ident'ified and PAM-authenticated users: both don't have a "~" character prepended to their respective user names! Default: no. .TP \fBRequireAuthPing\fR (boolean) Let ngIRCd send an "authentication PING" when a new client connects, and register this client only after receiving the corresponding "PONG" reply. Default: no. .TP \fBScrubCTCP\fR (boolean) If set to true, ngIRCd will silently drop all CTCP requests sent to it from both clients and servers. It will also not forward CTCP requests to any other servers. CTCP requests can be used to query user clients about which software they are using and which versions said software is. CTCP can also be used to reveal clients IP numbers. ACTION CTCP requests are not blocked, this means that /me commands will not be dropped, but please note that blocking CTCP will disable file sharing between users! Default: no. .TP \fBSyslogFacility\fR (string) Syslog "facility" to which ngIRCd should send log messages. Possible values are system dependent, but most probably "auth", "daemon", "user" and "local1" through "local7" are possible values; see syslog(3). Default is "local5" for historical reasons, you probably want to change this to "daemon", for example. .TP \fBWebircPassword\fR (string) Password required for using the WEBIRC command used by some Web-to-IRC gateways. If not set or empty, the WEBIRC command can't be used. Default: not set. .SH [SSL] All SSL-related configuration variables are located in the .I [SSL] section. Please note that this whole section is only recognized by ngIRCd when it is compiled with support for SSL using OpenSSL or GnuTLS! .TP \fBCertFile\fR (string) SSL Certificate file of the private server key. .TP \fBCipherList\fR (string) Select cipher suites allowed for SSL/TLS connections. This defaults to "HIGH:!aNULL:@STRENGTH" (OpenSSL) or "SECURE128" (GnuTLS). Please see 'man 1ssl ciphers' (OpenSSL) and 'man 3 gnutls_priority_init' (GnuTLS) for details. .TP \fBDHFile\fR (string) 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 \fBKeyFile\fR (string) Filename of SSL Server Key to be used for SSL connections. This is required for SSL/TLS support. .TP \fBKeyFilePassword\fR (string) OpenSSL only: Password to decrypt the private key file. .TP \fBPorts\fR (list of numbers) 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. .SH [OPERATOR] .I [Operator] sections are used to define IRC Operators. There may be more than one .I [Operator] block, one for each local operator. .TP \fBName\fR (string) ID of the operator (may be different of the nickname). .TP \fBPassword\fR (string) Password of the IRC operator. .TP \fBMask\fR (string) Mask that is to be checked before an /OPER for this account is accepted. Example: nick!ident@*.example.com .SH [SERVER] Other servers are configured in .I [Server] sections. If you configure a port for the connection, then this ngIRCd tries to connect to to the other server on the given port (active); if not, it waits for the other server to connect (passive). .PP ngIRCd supports "server groups": You can assign an "ID" to every server with which you want this ngIRCd to link, and the daemon ensures that at any given time only one direct link exists to servers with the same ID. So if a server of a group won't answer, ngIRCd tries to connect to the next server in the given group (="with the same ID"), but never tries to connect to more than one server of this group simultaneously. .PP There may be more than one .I [Server] block. .TP \fBName\fR (string) IRC name of the remote server. .TP \fBHost\fR (string) Internet host name (or IP address) of the peer. .TP \fBBind\fR (string) IP address to use as source IP for the outgoing connection. Default is to let the operating system decide. .TP \fBPort\fR (number) 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, default). .TP \fBMyPassword\fR (string) Own password for this connection. This password has to be configured as \fBPeerPassword\fR on the other server. Must not have ':' as first character. .TP \fBPeerPassword\fR (string) Foreign password for this connection. This password has to be configured as \fBMyPassword\fR on the other server. .TP \fBGroup\fR (number) Group of this server (optional). .TP \fBPassive\fR (boolean) 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 (boolean) Connect to the remote server using TLS/SSL. Default: false. .TP \fBServiceMask\fR (string) Define a (case insensitive) list of masks matching nicknames that should be treated as IRC services when introduced via this remote server, separated by commas (","). 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", "*Serv,OtherNick", or "NickServ,ChanServ,XyzServ". .SH [CHANNEL] Pre-defined channels can be configured in .I [Channel] sections. Such channels are created by the server when starting up and even persist when there are no more members left. .PP Persistent channels are marked with the mode 'P', which can be set and unset by IRC operators like other modes on the fly. .PP There may be more than one .I [Channel] block. .TP \fBName\fR (string) Name of the channel, including channel prefix ("#" or "&"). .TP \fBTopic\fR (string) Topic for this channel. .TP \fBModes\fR (string) Initial channel modes. .TP \fBKey\fR (string) Sets initial channel key (only relevant if channel mode "k" is set). .TP \fBKeyFile\fR (string) 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 (number) 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 after changing it. See .BR ngircd (8) for details. .SH AUTHOR Alexander Barton, .br Florian Westphal, .PP Homepage: http://ngircd.barton.de/ .SH "SEE ALSO" .BR ngircd (8) .\" .\" -eof- ngircd-21/man/ngircd.8.tmpl0000644000175000116100000000717512224617575012573 00000000000000.\" .\" ngircd(8) manual page template .\" .TH ngircd 8 "Oct 2013" ngIRCd "ngIRCd Manual" .SH NAME ngIRCd \- the "next generation" IRC daemon .SH SYNOPSIS .B ngircd [ .I Options ] .SH DESCRIPTION .BR ngIRCd is a free, portable and lightweight Internet Relay Chat server for small or private networks, developed under the GNU General Public License (GPL). It is easy to configure, can cope with dynamic IP addresses, and supports IPv6, SSL-protected connections as well as PAM for authentication. It is written from scratch and not based on the original IRCd. .PP The name ngIRCd means .IR "next generation IRC daemon", which is a little bit exaggerated: .IR "lightweight Internet Relay Chat server" most probably would have been a better name :-) .PP Currently supported platforms include AIX, A/UX, FreeBSD, HP-UX, Hurd, IRIX, Linux, Mac OS X, Minix, NetBSD, OpenBSD, Solaris, and Windows with Cygwin. As ngIRCd relies on UNIX standards and uses GNU automake and GNU autoconf there are good chances that it also supports other UNIX-based operating systems as well. .PP By default ngIRCd logs diagnostic and informational messages using the syslog mechanism, or writes directly to the console when running in the foreground (see below). .SH OPTIONS The default behavior of .BR ngircd is to read its standard configuration file (see below), to detach from the controlling terminal and to wait for clients. .PP You can use these options to modify this default: .TP \fB\-f\fR \fIfile\fR, \fB\-\-config\fR \fIfile\fR Use .I file as configuration file. .TP \fB\-n\fR, \fB\-\-nodaemon\fR Don't fork a child and don't detach from controlling terminal. All log messages go to the console and you can use CTRL-C to terminate the server. .TP \fB\-p\fR, \fB\-\-passive\fR Disable automatic connections to other servers. You can use the IRC command CONNECT later on as IRC Operator to link this ngIRCd to other servers. .TP \fB\-t\fR, \fB\-\-configtest\fR Read, validate and display the configuration; then exit. .TP \fB\-V\fR, \fB\-\-version\fR Output version information and exit. .TP \fB\-h\fR, \fB\-\-help\fR Display a brief help text and exit. .SH FILES .I :ETCDIR:/ngircd.conf .RS The system wide default configuration file. .RE .I :ETCDIR:/ngircd.motd .RS Default "message of the day" (MOTD). .RE .SH SIGNALS The daemon understands the following signals: .TP \fBTERM\fR Shut down all connections and terminate the daemon. .TP \fBHUP\fR Shut down all listening sockets, re-read the configuration file and re-initialize the daemon. .SH HINTS It's wise to use "ngircd \-\-configtest" to validate the configuration file after changing it. .SH DEBUGGING When ngIRCd is compiled with debug code, that is, its source code has been ./configure'd with "\-\-enable\-debug" and/or "\-\-enable\-sniffer" (witch enables debug mode automatically as well), you can use two more command line options and two more signals to debug problems with the daemon itself or IRC clients: .PP \fBOptions:\fR .TP \fB\-d\fR, \fB\-\-debug\fR Enable debug mode and log extra messages. .TP \fB\-s\fR, \fB\-\-sniffer\fR Enable IRC protocol sniffer, which logs all sent and received IRC commands to the console/syslog. This option requires that ngIRCd has been ./configure'd with "\-\-enable\-sniffer" and enables debug mode automatically, too. .PP \fBSignals:\fR .TP \fBUSR1\fR Toggle debug mode on and off during runtime. .TP \fBUSR2\fR Dump internal server state to the console/syslog when debug mode is on (use command line option \-\-debug or signal USR1). .SH AUTHORS Alexander Barton, .br Florian Westphal, .PP Homepage: http://ngircd.barton.de/ .SH "SEE ALSO" .BR ngircd.conf (5), .BR ircd (8) .\" .\" -eof- ngircd-21/config.guess0000644000175000116100000012760512206130744012010 00000000000000#! /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, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-08-14' # 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 # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." 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, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) 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 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) 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 exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) 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 if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ngircd-21/src/0000755000175000116100000000000012234274324010333 500000000000000ngircd-21/src/portab/0000755000175000116100000000000012234274324011622 500000000000000ngircd-21/src/portab/ansi2knr.c0000644000175000116100000004736312202004071013433 00000000000000/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved. */ /* Convert ANSI C function definitions to K&R ("traditional C") syntax */ /* ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Refer to the GNU General Public License (the "GPL") for full details. Everyone is granted permission to copy, modify and redistribute ansi2knr, but only under the conditions described in the GPL. A copy of this license is supposed to have been given to you along with ansi2knr so you can know your rights and responsibilities. It should be in a file named COPYLEFT, or, if there is no file named COPYLEFT, a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. We explicitly state here what we believe is already implied by the GPL: if the ansi2knr program is distributed as a separate set of sources and a separate executable file which are aggregated on a storage medium together with another program, this in itself does not bring the other program under the GPL, nor does the mere fact that such a program or the procedures for constructing it invoke the ansi2knr executable bring any other part of the program under the GPL. */ /* * Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]] * --filename provides the file name for the #line directive in the output, * overriding input_file (if present). * If no input_file is supplied, input is read from stdin. * If no output_file is supplied, output goes to stdout. * There are no error messages. * * ansi2knr recognizes function definitions by seeing a non-keyword * identifier at the left margin, followed by a left parenthesis, with a * right parenthesis as the last character on the line, and with a left * brace as the first token on the following line (ignoring possible * intervening comments and/or preprocessor directives), except that a line * consisting of only * identifier1(identifier2) * will not be considered a function definition unless identifier2 is * the word "void", and a line consisting of * identifier1(identifier2, <>) * will not be considered a function definition. * ansi2knr will recognize a multi-line header provided that no intervening * line ends with a left or right brace or a semicolon. These algorithms * ignore whitespace, comments, and preprocessor directives, except that * the function name must be the first thing on the line. The following * constructs will confuse it: * - Any other construct that starts at the left margin and * follows the above syntax (such as a macro or function call). * - Some macros that tinker with the syntax of function headers. */ /* * The original and principal author of ansi2knr is L. Peter Deutsch * . Other authors are noted in the change history * that follows (in reverse chronological order): lpd 2000-04-12 backs out Eggert's changes because of bugs: - concatlits didn't declare the type of its bufend argument; - concatlits didn't't recognize when it was inside a comment; - scanstring could scan backward past the beginning of the string; when - the check for \ + newline in scanstring was unnecessary. 2000-03-05 Paul Eggert Add support for concatenated string literals. * ansi2knr.c (concatlits): New decl. (main): Invoke concatlits to concatenate string literals. (scanstring): Handle backslash-newline correctly. Work with character constants. Fix bug when scanning backwards through backslash-quote. Check for unterminated strings. (convert1): Parse character constants, too. (appendline, concatlits): New functions. * ansi2knr.1: Document this. lpd 1999-08-17 added code to allow preprocessor directives wherever comments are allowed lpd 1999-04-12 added minor fixes from Pavel Roskin for clean compilation with gcc -W -Wall lpd 1999-03-22 added hack to recognize lines consisting of identifier1(identifier2, xxx) as *not* being procedures lpd 1999-02-03 made indentation of preprocessor commands consistent lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an endless loop; quoted strings within an argument list confused the parser lpd 1999-01-24 added a check for write errors on the output, suggested by Jim Meyering lpd 1998-11-09 added further hack to recognize identifier(void) as being a procedure lpd 1998-10-23 added hack to recognize lines consisting of identifier1(identifier2) as *not* being procedures lpd 1997-12-08 made input_file optional; only closes input and/or output file if not stdin or stdout respectively; prints usage message on stderr rather than stdout; adds --filename switch (changes suggested by ) lpd 1996-01-21 added code to cope with not HAVE_CONFIG_H and with compilers that don't understand void, as suggested by Tom Lane lpd 1996-01-15 changed to require that the first non-comment token on the line following a function header be a left brace, to reduce sensitivity to macros, as suggested by Tom Lane lpd 1995-06-22 removed #ifndefs whose sole purpose was to define undefined preprocessor symbols as 0; changed all #ifdefs for configuration symbols to #ifs lpd 1995-04-05 changed copyright notice to make it clear that including ansi2knr in a program does not bring the entire program under the GPL lpd 1994-12-18 added conditionals for systems where ctype macros don't handle 8-bit characters properly, suggested by Francois Pinard ; removed --varargs switch (this is now the default) lpd 1994-10-10 removed CONFIG_BROKETS conditional lpd 1994-07-16 added some conditionals to help GNU `configure', suggested by Francois Pinard ; properly erase prototype args in function parameters, contributed by Jim Avera ; correct error in writeblanks (it shouldn't erase EOLs) lpd 1989-xx-xx original version */ /* Most of the conditionals here are to make ansi2knr work with */ /* or without the GNU configure machinery. */ #if HAVE_CONFIG_H # include #endif #include #include #if HAVE_CONFIG_H /* For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h). This will define HAVE_CONFIG_H and so, activate the following lines. */ # if STDC_HEADERS || HAVE_STRING_H # include # else # include # endif #else /* not HAVE_CONFIG_H */ /* Otherwise do it the hard way */ # ifdef BSD # include # else # ifdef VMS extern int strlen(), strncmp(); # else # include # endif # endif #endif /* not HAVE_CONFIG_H */ #if STDC_HEADERS # include #else /* malloc and free should be declared in stdlib.h, but if you've got a K&R compiler, they probably aren't. */ # ifdef MSDOS # include # else # ifdef VMS extern char *malloc(); extern void free(); # else extern char *malloc(); extern int free(); # endif # endif #endif /* Define NULL (for *very* old compilers). */ #ifndef NULL # define NULL (0) #endif /* * The ctype macros don't always handle 8-bit characters correctly. * Compensate for this here. */ #ifdef isascii # undef HAVE_ISASCII /* just in case */ # define HAVE_ISASCII 1 #else #endif #if STDC_HEADERS || !HAVE_ISASCII # define is_ascii(c) 1 #else # define is_ascii(c) isascii(c) #endif #define is_space(c) (is_ascii(c) && isspace(c)) #define is_alpha(c) (is_ascii(c) && isalpha(c)) #define is_alnum(c) (is_ascii(c) && isalnum(c)) /* Scanning macros */ #define isidchar(ch) (is_alnum(ch) || (ch) == '_') #define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_') /* Forward references */ char *ppdirforward(); char *ppdirbackward(); char *skipspace(); char *scanstring(); int writeblanks(); int test1(); int convert1(); /* The main program */ int main(argc, argv) int argc; char *argv[]; { FILE *in = stdin; FILE *out = stdout; char *filename = 0; char *program_name = argv[0]; char *output_name = 0; #define bufsize 5000 /* arbitrary size */ char *buf; char *line; char *more; char *usage = "Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n"; /* * In previous versions, ansi2knr recognized a --varargs switch. * If this switch was supplied, ansi2knr would attempt to convert * a ... argument to va_alist and va_dcl; if this switch was not * supplied, ansi2knr would simply drop any such arguments. * Now, ansi2knr always does this conversion, and we only * check for this switch for backward compatibility. */ int convert_varargs = 1; int output_error; while ( argc > 1 && argv[1][0] == '-' ) { if ( !strcmp(argv[1], "--varargs") ) { convert_varargs = 1; argc--; argv++; continue; } if ( !strcmp(argv[1], "--filename") && argc > 2 ) { filename = argv[2]; argc -= 2; argv += 2; continue; } fprintf(stderr, "%s: Unrecognized switch: %s\n", program_name, argv[1]); fprintf(stderr, usage); exit(1); } switch ( argc ) { default: fprintf(stderr, usage); exit(0); case 3: output_name = argv[2]; out = fopen(output_name, "w"); if ( out == NULL ) { fprintf(stderr, "%s: Cannot open output file %s\n", program_name, output_name); exit(1); } /* falls through */ case 2: in = fopen(argv[1], "r"); if ( in == NULL ) { fprintf(stderr, "%s: Cannot open input file %s\n", program_name, argv[1]); exit(1); } if ( filename == 0 ) filename = argv[1]; /* falls through */ case 1: break; } if ( filename ) fprintf(out, "#line 1 \"%s\"\n", filename); buf = malloc(bufsize); if ( buf == NULL ) { fprintf(stderr, "Unable to allocate read buffer!\n"); exit(1); } line = buf; while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL ) { test: line += strlen(line); switch ( test1(buf) ) { case 2: /* a function header */ convert1(buf, out, 1, convert_varargs); break; case 1: /* a function */ /* Check for a { at the start of the next line. */ more = ++line; f: if ( line >= buf + (bufsize - 1) ) /* overflow check */ goto wl; if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL ) goto wl; switch ( *skipspace(ppdirforward(more), 1) ) { case '{': /* Definitely a function header. */ convert1(buf, out, 0, convert_varargs); fputs(more, out); break; case 0: /* The next line was blank or a comment: */ /* keep scanning for a non-comment. */ line += strlen(line); goto f; default: /* buf isn't a function header, but */ /* more might be. */ fputs(buf, out); strcpy(buf, more); line = buf; goto test; } break; case -1: /* maybe the start of a function */ if ( line != buf + (bufsize - 1) ) /* overflow check */ continue; /* falls through */ default: /* not a function */ wl: fputs(buf, out); break; } line = buf; } if ( line != buf ) fputs(buf, out); free(buf); if ( output_name ) { output_error = ferror(out); output_error |= fclose(out); } else { /* out == stdout */ fflush(out); output_error = ferror(out); } if ( output_error ) { fprintf(stderr, "%s: error writing to %s\n", program_name, (output_name ? output_name : "stdout")); exit(1); } if ( in != stdin ) fclose(in); return 0; } /* * Skip forward or backward over one or more preprocessor directives. */ char * ppdirforward(p) char *p; { for (; *p == '#'; ++p) { for (; *p != '\r' && *p != '\n'; ++p) if (*p == 0) return p; if (*p == '\r' && p[1] == '\n') ++p; } return p; } char * ppdirbackward(p, limit) char *p; char *limit; { char *np = p; for (;; p = --np) { if (*np == '\n' && np[-1] == '\r') --np; for (; np > limit && np[-1] != '\r' && np[-1] != '\n'; --np) if (np[-1] == 0) return np; if (*np != '#') return p; } } /* * Skip over whitespace, comments, and preprocessor directives, * in either direction. */ char * skipspace(p, dir) char *p; int dir; /* 1 for forward, -1 for backward */ { for ( ; ; ) { while ( is_space(*p) ) p += dir; if ( !(*p == '/' && p[dir] == '*') ) break; p += dir; p += dir; while ( !(*p == '*' && p[dir] == '/') ) { if ( *p == 0 ) return p; /* multi-line comment?? */ p += dir; } p += dir; p += dir; } return p; } /* Scan over a quoted string, in either direction. */ char * scanstring(p, dir) char *p; int dir; { for (p += dir; ; p += dir) if (*p == '"' && p[-dir] != '\\') return p + dir; } /* * Write blanks over part of a string. * Don't overwrite end-of-line characters. */ int writeblanks(start, end) char *start; char *end; { char *p; for ( p = start; p < end; p++ ) if ( *p != '\r' && *p != '\n' ) *p = ' '; return 0; } /* * Test whether the string in buf is a function definition. * The string may contain and/or end with a newline. * Return as follows: * 0 - definitely not a function definition; * 1 - definitely a function definition; * 2 - definitely a function prototype (NOT USED); * -1 - may be the beginning of a function definition, * append another line and look again. * The reason we don't attempt to convert function prototypes is that * Ghostscript's declaration-generating macros look too much like * prototypes, and confuse the algorithms. */ int test1(buf) char *buf; { char *p = buf; char *bend; char *endfn; int contin; if ( !isidfirstchar(*p) ) return 0; /* no name at left margin */ bend = skipspace(ppdirbackward(buf + strlen(buf) - 1, buf), -1); switch ( *bend ) { case ';': contin = 0 /*2*/; break; case ')': contin = 1; break; case '{': return 0; /* not a function */ case '}': return 0; /* not a function */ default: contin = -1; } while ( isidchar(*p) ) p++; endfn = p; p = skipspace(p, 1); if ( *p++ != '(' ) return 0; /* not a function */ p = skipspace(p, 1); if ( *p == ')' ) return 0; /* no parameters */ /* Check that the apparent function name isn't a keyword. */ /* We only need to check for keywords that could be followed */ /* by a left parenthesis (which, unfortunately, is most of them). */ { static char *words[] = { "asm", "auto", "case", "char", "const", "double", "extern", "float", "for", "if", "int", "long", "register", "return", "short", "signed", "sizeof", "static", "switch", "typedef", "unsigned", "void", "volatile", "while", 0 }; char **key = words; char *kp; unsigned len = endfn - buf; while ( (kp = *key) != 0 ) { if ( strlen(kp) == len && !strncmp(kp, buf, len) ) return 0; /* name is a keyword */ key++; } } { char *id = p; int len; /* * Check for identifier1(identifier2) and not * identifier1(void), or identifier1(identifier2, xxxx). */ while ( isidchar(*p) ) p++; len = p - id; p = skipspace(p, 1); if (*p == ',' || (*p == ')' && (len != 4 || strncmp(id, "void", 4))) ) return 0; /* not a function */ } /* * If the last significant character was a ), we need to count * parentheses, because it might be part of a formal parameter * that is a procedure. */ if (contin > 0) { int level = 0; for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1)) level += (*p == '(' ? 1 : *p == ')' ? -1 : 0); if (level > 0) contin = -1; } return contin; } /* Convert a recognized function definition or header to K&R syntax. */ int convert1(buf, out, header, convert_varargs) char *buf; FILE *out; int header; /* Boolean */ int convert_varargs; /* Boolean */ { char *endfn; char *p; /* * The breaks table contains pointers to the beginning and end * of each argument. */ char **breaks; unsigned num_breaks = 2; /* for testing */ char **btop; char **bp; char **ap; char *vararg = 0; /* Pre-ANSI implementations don't agree on whether strchr */ /* is called strchr or index, so we open-code it here. */ for ( endfn = buf; *(endfn++) != '('; ) ; top: p = endfn; breaks = (char **)malloc(sizeof(char *) * num_breaks * 2); if ( breaks == NULL ) { /* Couldn't allocate break table, give up */ fprintf(stderr, "Unable to allocate break table!\n"); fputs(buf, out); return -1; } btop = breaks + num_breaks * 2 - 2; bp = breaks; /* Parse the argument list */ do { int level = 0; char *lp = NULL; char *rp = NULL; char *end = NULL; if ( bp >= btop ) { /* Filled up break table. */ /* Allocate a bigger one and start over. */ free((char *)breaks); num_breaks <<= 1; goto top; } *bp++ = p; /* Find the end of the argument */ for ( ; end == NULL; p++ ) { switch(*p) { case ',': if ( !level ) end = p; break; case '(': if ( !level ) lp = p; level++; break; case ')': if ( --level < 0 ) end = p; else rp = p; break; case '/': if (p[1] == '*') p = skipspace(p, 1) - 1; break; case '"': p = scanstring(p, 1) - 1; break; default: ; } } /* Erase any embedded prototype parameters. */ if ( lp && rp ) writeblanks(lp + 1, rp); p--; /* back up over terminator */ /* Find the name being declared. */ /* This is complicated because of procedure and */ /* array modifiers. */ for ( ; ; ) { p = skipspace(p - 1, -1); switch ( *p ) { case ']': /* skip array dimension(s) */ case ')': /* skip procedure args OR name */ { int level = 1; while ( level ) switch ( *--p ) { case ']': case ')': level++; break; case '[': case '(': level--; break; case '/': if (p > buf && p[-1] == '*') p = skipspace(p, -1) + 1; break; case '"': p = scanstring(p, -1) + 1; break; default: ; } } if ( *p == '(' && *skipspace(p + 1, 1) == '*' ) { /* We found the name being declared */ while ( !isidfirstchar(*p) ) p = skipspace(p, 1) + 1; goto found; } break; default: goto found; } } found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' ) { if ( convert_varargs ) { *bp++ = "va_alist"; vararg = p-2; } else { p++; if ( bp == breaks + 1 ) /* sole argument */ writeblanks(breaks[0], p); else writeblanks(bp[-1] - 1, p); bp--; } } else { while ( isidchar(*p) ) p--; *bp++ = p+1; } p = end; } while ( *p++ == ',' ); *bp = p; /* Make a special check for 'void' arglist */ if ( bp == breaks+2 ) { p = skipspace(breaks[0], 1); if ( !strncmp(p, "void", 4) ) { p = skipspace(p+4, 1); if ( p == breaks[2] - 1 ) { bp = breaks; /* yup, pretend arglist is empty */ writeblanks(breaks[0], p + 1); } } } /* Put out the function name and left parenthesis. */ p = buf; while ( p != endfn ) putc(*p, out), p++; /* Put out the declaration. */ if ( header ) { fputs(");", out); for ( p = breaks[0]; *p; p++ ) if ( *p == '\r' || *p == '\n' ) putc(*p, out); } else { for ( ap = breaks+1; ap < bp; ap += 2 ) { p = *ap; while ( isidchar(*p) ) putc(*p, out), p++; if ( ap < bp - 1 ) fputs(", ", out); } fputs(") ", out); /* Put out the argument declarations */ for ( ap = breaks+2; ap <= bp; ap += 2 ) (*ap)[-1] = ';'; if ( vararg != 0 ) { *vararg = 0; fputs(breaks[0], out); /* any prior args */ fputs("va_dcl", out); /* the final arg */ fputs(bp[0], out); } else fputs(breaks[0], out); } free((char *)breaks); return 0; } ngircd-21/src/portab/Makefile.in0000644000175000116100000005122512234274154013615 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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-2012 Alexander Barton (alex@barton.de) and Contributors # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ ANSI2KNR = @ANSI2KNR@ check_PROGRAMS = portabtest$(EXEEXT) TESTS = portabtest$(EXEEXT) subdir = src/portab DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ansi2knr.1 ansi2knr.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_$(V)) am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY)) am__v_AR_0 = @echo " AR " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ libngportab_a_AR = $(AR) $(ARFLAGS) libngportab_a_LIBADD = am_libngportab_a_OBJECTS = strdup$U.$(OBJEXT) strndup$U.$(OBJEXT) \ strlcpy$U.$(OBJEXT) strtok_r$U.$(OBJEXT) vsnprintf$U.$(OBJEXT) \ waitpid$U.$(OBJEXT) libngportab_a_OBJECTS = $(am_libngportab_a_OBJECTS) am_portabtest_OBJECTS = portabtest$U.$(OBJEXT) portabtest_OBJECTS = $(am_portabtest_OBJECTS) portabtest_DEPENDENCIES = portabtest_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(portabtest_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libngportab_a_SOURCES) $(portabtest_SOURCES) DIST_SOURCES = $(libngportab_a_SOURCES) $(portabtest_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags # If stdout is a non-dumb tty, use colors. If test -t is not supported, # then this fails; a conservative approach. Of course do not redirect # stdout here, just stderr. am__tty_colors = \ red=; grn=; lgn=; blu=; std=; \ test "X$(AM_COLOR_TESTS)" != Xno \ && test "X$$TERM" != Xdumb \ && { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \ && { \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ std=''; \ } DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = ansi2knr EXTRA_DIST = Makefile.ng noinst_LIBRARIES = libngportab.a libngportab_a_SOURCES = strdup.c strndup.c strlcpy.c strtok_r.c vsnprintf.c waitpid.c portabtest_SOURCES = portabtest.c portabtest_LDFLAGS = -L. portabtest_LDADD = -lngportab noinst_HEADERS = imp.h exp.h portab.h splint.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/portab/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/portab/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 $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libngportab.a: $(libngportab_a_OBJECTS) $(libngportab_a_DEPENDENCIES) $(AM_V_at)-rm -f libngportab.a $(AM_V_AR)$(libngportab_a_AR) libngportab.a $(libngportab_a_OBJECTS) $(libngportab_a_LIBADD) $(AM_V_at)$(RANLIB) libngportab.a clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) portabtest$(EXEEXT): $(portabtest_OBJECTS) $(portabtest_DEPENDENCIES) @rm -f portabtest$(EXEEXT) $(AM_V_CCLD)$(portabtest_LINK) $(portabtest_OBJECTS) $(portabtest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c ./ansi2knr: ansi2knr.$(OBJEXT) $(LINK) ansi2knr.$(OBJEXT) $(LIBS) ansi2knr.$(OBJEXT): $(CONFIG_HEADER) clean-krextra: -rm -f ansi2knr mostlyclean-kr: -test "$U" = "" || rm -f *_.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portabtest$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strdup$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strlcpy$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strndup$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtok_r$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsnprintf$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/waitpid$U.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @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@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @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) '$<'` portabtest_.c: portabtest.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/portabtest.c; then echo $(srcdir)/portabtest.c; else echo portabtest.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ strdup_.c: strdup.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strdup.c; then echo $(srcdir)/strdup.c; else echo strdup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ strlcpy_.c: strlcpy.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strlcpy.c; then echo $(srcdir)/strlcpy.c; else echo strlcpy.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ strndup_.c: strndup.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strndup.c; then echo $(srcdir)/strndup.c; else echo strndup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ strtok_r_.c: strtok_r.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strtok_r.c; then echo $(srcdir)/strtok_r.c; else echo strtok_r.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ vsnprintf_.c: vsnprintf.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vsnprintf.c; then echo $(srcdir)/vsnprintf.c; else echo vsnprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ waitpid_.c: waitpid.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/waitpid.c; then echo $(srcdir)/waitpid.c; else echo waitpid.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ portabtest_.$(OBJEXT) strdup_.$(OBJEXT) strlcpy_.$(OBJEXT) \ strndup_.$(OBJEXT) strtok_r_.$(OBJEXT) vsnprintf_.$(OBJEXT) \ waitpid_.$(OBJEXT) : $(ANSI2KNR) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(ANSI2KNR) $(LIBRARIES) $(HEADERS) 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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-checkPROGRAMS clean-generic clean-krextra \ clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS 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-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 maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am # -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: ngircd-21/src/portab/imp.h0000644000175000116100000000130711526006312012472 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen * der GNU General Public License (GPL), wie von der Free Software Foundation * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2 * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. */ /** * @file * "Import Header" which makes sure that global functions are defined "extern". */ #undef GLOBAL #define GLOBAL extern /* -eof- */ ngircd-21/src/portab/strtok_r.c0000644000175000116100000000075312202004071013543 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon */ #include "portab.h" /** * @file * Implementation of strtok_r() */ #ifndef HAVE_STRTOK_R #include char * strtok_r(char *str, const char *delim, char **saveptr) { char *tmp; if (!str) str = *saveptr; str += strspn(str, delim); if (*str == 0) return NULL; tmp = str + strcspn(str, delim); /* get end of token */ if (*tmp) { /* another delimiter */ *tmp = 0; tmp++; } *saveptr = tmp; return str; } #endif ngircd-21/src/portab/strlcpy.c0000644000175000116100000000322512202004071013371 00000000000000/* * 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. */ #include "portab.h" /** * @file * strlcpy() and strlcat() replacement functions. * * See for details. * * Code partially borrowed from compat.c of rsync, written by Andrew * Tridgell (1998) and Martin Pool (2002): * */ #include "imp.h" #include #include #include "exp.h" #ifndef HAVE_STRLCAT GLOBAL size_t strlcat( char *dst, const char *src, size_t size ) { /* Like strncat() but does not 0 fill the buffer and * always null terminates. */ size_t len1 = strlen( dst ); size_t len2 = strlen( src ); size_t ret = len1 + len2; if( size && ( len1 < size - 1 )) { if( len2 >= size - len1 ) len2 = size - len1 - 1; memcpy( dst + len1, src, len2 ); dst[len1 + len2] = 0; } return ret; } /* strlcat */ #endif #ifndef HAVE_STRLCPY GLOBAL size_t strlcpy( char *dst, const char *src, size_t size ) { /* Like strncpy but does not 0 fill the buffer and * always null terminates. */ size_t len = strlen( src ); size_t ret = len; if( size > 0 ) { if( len >= size ) len = size - 1; memcpy( dst, src, len ); dst[len] = 0; } return ret; } /* strlcpy */ #endif /* -eof- */ ngircd-21/src/portab/vsnprintf.c0000644000175000116100000005165512202004071013734 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #include "portab.h" /** * @file * snprintf() and vsnprintf() replacement functions */ /* * snprintf.c: Copyright Patrick Powell 1995 * This code is based on code written by Patrick Powell (papowell@astart.com) * It may be used for any purpose as long as this notice remains intact * on all source code distributions * * Original: Patrick Powell Tue Apr 11 09:48:21 PDT 1995 * A bombproof version of doprnt (dopr) included. * Sigh. This sort of thing is always nasty do deal with. Note that * the version here does not include floating point... * * snprintf() is used instead of sprintf() as it does limit checks * for string length. This covers a nasty loophole. * * The other functions are there to prevent NULL pointers from * causing nast effects. * * More Recently: * Brandon Long 9/15/96 for mutt 0.43 * This was ugly. It is still ugly. I opted out of floating point * numbers, but the formatter understands just about everything * from the normal C string format, at least as far as I can tell from * the Solaris 2.5 printf(3S) man page. * * Brandon Long 10/22/97 for mutt 0.87.1 * Ok, added some minimal floating point support, which means this * probably requires libm on most operating systems. Don't yet * support the exponent (e,E) and sigfig (g,G). Also, fmtint() * was pretty badly broken, it just wasn't being exercised in ways * which showed it, so that's been fixed. Also, formated the code * to mutt conventions, and removed dead code left over from the * original. Also, there is now a builtin-test, just compile with: * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm * and run snprintf for results. * * Thomas Roessler 01/27/98 for mutt 0.89i * The PGP code was using unsigned hexadecimal formats. * Unfortunately, unsigned formats simply didn't work. * * Michael Elkins 03/05/98 for mutt 0.90.8 * The original code assumed that both snprintf() and vsnprintf() were * missing. Some systems only have snprintf() but not vsnprintf(), so * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF. * * Andrew Tridgell , October 1998 * fixed handling of %.0f * added test for HAVE_LONG_DOUBLE * * tridge@samba.org, idra@samba.org, April 2001 * got rid of fcvt code (twas buggy and made testing harder) * added C99 semantics * * Alexander Barton, , 2002-05-19 * removed [v]asprintf() and C99 tests: not needed by ngIRCd. */ #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) /* only include stdio.h if we are not re-defining snprintf or vsnprintf */ #include /* make the compiler happy with an empty file */ void dummy_snprintf PARAMS(( void )); void dummy_snprintf PARAMS(( void )) { } #else #ifdef HAVE_LONG_DOUBLE #define LDOUBLE long double #else #define LDOUBLE double #endif #ifdef HAVE_LONG_LONG #define LLONG long long #else #define LLONG long #endif static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args); static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value, int flags, int min, int max); static void fmtint(char *buffer, size_t *currlen, size_t maxlen, long value, int base, int min, int max, int flags); static void fmtfp(char *buffer, size_t *currlen, size_t maxlen, LDOUBLE fvalue, int min, int max, int flags); static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c); /* * dopr(): poor man's version of doprintf */ /* format read states */ #define DP_S_DEFAULT 0 #define DP_S_FLAGS 1 #define DP_S_MIN 2 #define DP_S_DOT 3 #define DP_S_MAX 4 #define DP_S_MOD 5 #define DP_S_CONV 6 #define DP_S_DONE 7 /* format flags - Bits */ #define DP_F_MINUS (1 << 0) #define DP_F_PLUS (1 << 1) #define DP_F_SPACE (1 << 2) #define DP_F_NUM (1 << 3) #define DP_F_ZERO (1 << 4) #define DP_F_UP (1 << 5) #define DP_F_UNSIGNED (1 << 6) /* Conversion Flags */ #define DP_C_SHORT 1 #define DP_C_LONG 2 #define DP_C_LDOUBLE 3 #define DP_C_LLONG 4 #define char_to_int(p) ((p)- '0') #ifndef MAX #define MAX(p,q) (((p) >= (q)) ? (p) : (q)) #endif static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args) { char ch; LLONG value; LDOUBLE fvalue; char *strvalue; int min; int max; int state; int flags; int cflags; size_t currlen; state = DP_S_DEFAULT; currlen = flags = cflags = min = 0; max = -1; ch = *format++; while (state != DP_S_DONE) { if (ch == '\0') state = DP_S_DONE; switch(state) { case DP_S_DEFAULT: if (ch == '%') state = DP_S_FLAGS; else dopr_outch (buffer, &currlen, maxlen, ch); ch = *format++; break; case DP_S_FLAGS: switch (ch) { case '-': flags |= DP_F_MINUS; ch = *format++; break; case '+': flags |= DP_F_PLUS; ch = *format++; break; case ' ': flags |= DP_F_SPACE; ch = *format++; break; case '#': flags |= DP_F_NUM; ch = *format++; break; case '0': flags |= DP_F_ZERO; ch = *format++; break; default: state = DP_S_MIN; break; } break; case DP_S_MIN: if (isdigit((unsigned char)ch)) { min = 10*min + char_to_int (ch); ch = *format++; } else if (ch == '*') { min = va_arg (args, int); ch = *format++; state = DP_S_DOT; } else { state = DP_S_DOT; } break; case DP_S_DOT: if (ch == '.') { state = DP_S_MAX; ch = *format++; } else { state = DP_S_MOD; } break; case DP_S_MAX: if (isdigit((unsigned char)ch)) { if (max < 0) max = 0; max = 10*max + char_to_int (ch); ch = *format++; } else if (ch == '*') { max = va_arg (args, int); ch = *format++; state = DP_S_MOD; } else { state = DP_S_MOD; } break; case DP_S_MOD: switch (ch) { case 'h': cflags = DP_C_SHORT; ch = *format++; break; case 'l': cflags = DP_C_LONG; ch = *format++; if (ch == 'l') { /* It's a long long */ cflags = DP_C_LLONG; ch = *format++; } break; case 'L': cflags = DP_C_LDOUBLE; ch = *format++; break; default: break; } state = DP_S_CONV; break; case DP_S_CONV: switch (ch) { case 'd': case 'i': if (cflags == DP_C_SHORT) value = va_arg (args, int); else if (cflags == DP_C_LONG) value = va_arg (args, long int); else if (cflags == DP_C_LLONG) value = va_arg (args, LLONG); else value = va_arg (args, int); fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); break; case 'o': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) value = va_arg (args, unsigned int); else if (cflags == DP_C_LONG) value = (long)va_arg (args, unsigned long int); else if (cflags == DP_C_LLONG) value = (long)va_arg (args, unsigned LLONG); else value = (long)va_arg (args, unsigned int); fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags); break; case 'u': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) value = va_arg (args, unsigned int); else if (cflags == DP_C_LONG) value = (long)va_arg (args, unsigned long int); else if (cflags == DP_C_LLONG) value = (LLONG)va_arg (args, unsigned LLONG); else value = (long)va_arg (args, unsigned int); fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); break; case 'X': flags |= DP_F_UP; case 'x': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) value = va_arg (args, unsigned int); else if (cflags == DP_C_LONG) value = (long)va_arg (args, unsigned long int); else if (cflags == DP_C_LLONG) value = (LLONG)va_arg (args, unsigned LLONG); else value = (long)va_arg (args, unsigned int); fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags); break; case 'f': if (cflags == DP_C_LDOUBLE) fvalue = va_arg (args, LDOUBLE); else fvalue = va_arg (args, double); /* um, floating point? */ fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); break; case 'E': flags |= DP_F_UP; case 'e': if (cflags == DP_C_LDOUBLE) fvalue = va_arg (args, LDOUBLE); else fvalue = va_arg (args, double); break; case 'G': flags |= DP_F_UP; case 'g': if (cflags == DP_C_LDOUBLE) fvalue = va_arg (args, LDOUBLE); else fvalue = va_arg (args, double); break; case 'c': dopr_outch (buffer, &currlen, maxlen, va_arg (args, int)); break; case 's': strvalue = va_arg (args, char *); if (max == -1) { max = strlen(strvalue); } if (min > 0 && max >= 0 && min > max) max = min; fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max); break; case 'p': strvalue = va_arg (args, void *); fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); break; case 'n': if (cflags == DP_C_SHORT) { short int *num; num = va_arg (args, short int *); *num = currlen; } else if (cflags == DP_C_LONG) { long int *num; num = va_arg (args, long int *); *num = (long int)currlen; } else if (cflags == DP_C_LLONG) { LLONG *num; num = va_arg (args, LLONG *); *num = (LLONG)currlen; } else { int *num; num = va_arg (args, int *); *num = currlen; } break; case '%': dopr_outch (buffer, &currlen, maxlen, ch); break; case 'w': /* not supported yet, treat as next char */ ch = *format++; break; default: /* Unknown, skip */ break; } ch = *format++; state = DP_S_DEFAULT; flags = cflags = min = 0; max = -1; break; case DP_S_DONE: break; default: /* hmm? */ break; /* some picky compilers need this */ } } if (maxlen != 0) { if (currlen < maxlen - 1) buffer[currlen] = '\0'; else if (maxlen > 0) buffer[maxlen - 1] = '\0'; } return currlen; } static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value, int flags, int min, int max) { int padlen, strln; /* amount to pad */ int cnt = 0; #ifdef DEBUG_SNPRINTF printf("fmtstr min=%d max=%d s=[%s]\n", min, max, value); #endif if (value == 0) { value = ""; } for (strln = 0; value[strln]; ++strln); /* strlen */ padlen = min - strln; if (padlen < 0) padlen = 0; if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justify */ while ((padlen > 0) && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, ' '); --padlen; ++cnt; } while (*value && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, *value++); ++cnt; } while ((padlen < 0) && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, ' '); ++padlen; ++cnt; } } /* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ static void fmtint(char *buffer, size_t *currlen, size_t maxlen, long value, int base, int min, int max, int flags) { int signvalue = 0; unsigned long uvalue; char convert[20]; int place = 0; int spadlen = 0; /* amount to space pad */ int zpadlen = 0; /* amount to zero pad */ int caps = 0; if (max < 0) max = 0; uvalue = value; if(!(flags & DP_F_UNSIGNED)) { if( value < 0 ) { signvalue = '-'; uvalue = -value; } else { if (flags & DP_F_PLUS) /* Do a sign (+/i) */ signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; } } if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ do { convert[place++] = (caps? "0123456789ABCDEF":"0123456789abcdef") [uvalue % (unsigned)base ]; uvalue = (uvalue / (unsigned)base ); } while(uvalue && (place < 20)); if (place == 20) place--; convert[place] = 0; zpadlen = max - place; spadlen = min - MAX (max, place) - (signvalue ? 1 : 0); if (zpadlen < 0) zpadlen = 0; if (spadlen < 0) spadlen = 0; if (flags & DP_F_ZERO) { zpadlen = MAX(zpadlen, spadlen); spadlen = 0; } if (flags & DP_F_MINUS) spadlen = -spadlen; /* Left Justifty */ #ifdef DEBUG_SNPRINTF printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n", zpadlen, spadlen, min, max, place); #endif /* Spaces */ while (spadlen > 0) { dopr_outch (buffer, currlen, maxlen, ' '); --spadlen; } /* Sign */ if (signvalue) dopr_outch (buffer, currlen, maxlen, signvalue); /* Zeros */ if (zpadlen > 0) { while (zpadlen > 0) { dopr_outch (buffer, currlen, maxlen, '0'); --zpadlen; } } /* Digits */ while (place > 0) dopr_outch (buffer, currlen, maxlen, convert[--place]); /* Left Justified spaces */ while (spadlen < 0) { dopr_outch (buffer, currlen, maxlen, ' '); ++spadlen; } } static LDOUBLE abs_val(LDOUBLE value) { LDOUBLE result = value; if (value < 0) result = -value; return result; } static LDOUBLE POW10(int exp) { LDOUBLE result = 1; while (exp) { result *= 10; exp--; } return result; } static LLONG ROUND(LDOUBLE value) { LLONG intpart; intpart = (LLONG)value; value = value - intpart; if (value >= 0.5) intpart++; return intpart; } /* a replacement for modf that doesn't need the math library. Should be portable, but slow */ static double my_modf(double x0, double *iptr) { int i; long l; double x = x0; double f = 1.0; for (i=0;i<100;i++) { l = (long)x; if (l <= (x+1) && l >= (x-1)) break; x *= 0.1; f *= 10.0; } if (i == 100) { /* yikes! the number is beyond what we can handle. What do we do? */ (*iptr) = 0; return 0; } if (i != 0) { double i2; double ret; ret = my_modf(x0-l*f, &i2); (*iptr) = l*f + i2; return ret; } (*iptr) = l; return x - (*iptr); } static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, LDOUBLE fvalue, int min, int max, int flags) { int signvalue = 0; double ufvalue; char iconvert[311]; char fconvert[311]; int iplace = 0; int fplace = 0; int padlen = 0; /* amount to pad */ int zpadlen = 0; int caps = 0; int index; double intpart; double fracpart; double temp; /* * AIX manpage says the default is 0, but Solaris says the default * is 6, and sprintf on AIX defaults to 6 */ if (max < 0) max = 6; ufvalue = abs_val (fvalue); if (fvalue < 0) { signvalue = '-'; } else { if (flags & DP_F_PLUS) { /* Do a sign (+/i) */ signvalue = '+'; } else { if (flags & DP_F_SPACE) signvalue = ' '; } } #if 0 if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ #endif #if 0 if (max == 0) ufvalue += 0.5; /* if max = 0 we must round */ #endif /* * Sorry, we only support 16 digits past the decimal because of our * conversion method */ if (max > 16) max = 16; /* We "cheat" by converting the fractional part to integer by * multiplying by a factor of 10 */ temp = ufvalue; my_modf(temp, &intpart); fracpart = ROUND((POW10(max)) * (ufvalue - intpart)); if (fracpart >= POW10(max)) { intpart++; fracpart -= POW10(max); } /* Convert integer part */ do { temp = intpart; my_modf(intpart*0.1, &intpart); temp = temp*0.1; index = (int) ((temp -intpart +0.05)* 10.0); /* index = (int) (((double)(temp*0.1) -intpart +0.05) *10.0); */ /* printf ("%llf, %f, %x\n", temp, intpart, index); */ iconvert[iplace++] = (caps? "0123456789ABCDEF":"0123456789abcdef")[index]; } while (intpart && (iplace < 311)); if (iplace == 311) iplace--; iconvert[iplace] = 0; /* Convert fractional part */ if (fracpart) { do { temp = fracpart; my_modf(fracpart*0.1, &fracpart); temp = temp*0.1; index = (int) ((temp -fracpart +0.05)* 10.0); /* index = (int) ((((temp/10) -fracpart) +0.05) *10); */ /* printf ("%lf, %lf, %ld\n", temp, fracpart, index); */ fconvert[fplace++] = (caps? "0123456789ABCDEF":"0123456789abcdef")[index]; } while(fracpart && (fplace < 311)); if (fplace == 311) fplace--; } fconvert[fplace] = 0; /* -1 for decimal point, another -1 if we are printing a sign */ padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); zpadlen = max - fplace; if (zpadlen < 0) zpadlen = 0; if (padlen < 0) padlen = 0; if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justifty */ if ((flags & DP_F_ZERO) && (padlen > 0)) { if (signvalue) { dopr_outch (buffer, currlen, maxlen, signvalue); --padlen; signvalue = 0; } while (padlen > 0) { dopr_outch (buffer, currlen, maxlen, '0'); --padlen; } } while (padlen > 0) { dopr_outch (buffer, currlen, maxlen, ' '); --padlen; } if (signvalue) dopr_outch (buffer, currlen, maxlen, signvalue); while (iplace > 0) dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); #ifdef DEBUG_SNPRINTF printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen); #endif /* * Decimal point. This should probably use locale to find the correct * char to print out. */ if (max > 0) { dopr_outch (buffer, currlen, maxlen, '.'); while (fplace > 0) dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); } while (zpadlen > 0) { dopr_outch (buffer, currlen, maxlen, '0'); --zpadlen; } while (padlen < 0) { dopr_outch (buffer, currlen, maxlen, ' '); ++padlen; } } static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) { if (*currlen < maxlen) { buffer[(*currlen)] = c; } (*currlen)++; } #if !defined(HAVE_VSNPRINTF) int vsnprintf (char *str, size_t count, const char *fmt, va_list args) { return dopr(str, count, fmt, args); } #endif #if !defined(HAVE_SNPRINTF) int snprintf(char *str,size_t count,const char *fmt,...) { size_t ret; va_list ap; va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap); return ret; } #endif #endif #ifdef TEST_SNPRINTF int sprintf(char *str,const char *fmt,...); int main (void) { char buf1[1024]; char buf2[1024]; char *fp_fmt[] = { "%1.1f", "%-1.5f", "%1.5f", "%123.9f", "%10.5f", "% 10.5f", "%+22.9f", "%+4.9f", "%01.3f", "%4f", "%3.1f", "%3.2f", "%.0f", "%f", "-16.16f", NULL }; double fp_nums[] = { 6442452944.1234, -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, 0.9996, 1.996, 4.136, 0}; char *int_fmt[] = { "%-1.5d", "%1.5d", "%123.9d", "%5.5d", "%10.5d", "% 10.5d", "%+22.33d", "%01.3d", "%4d", "%d", NULL }; long int_nums[] = { -1, 134, 91340, 341, 0203, 0}; char *str_fmt[] = { "10.5s", "5.10s", "10.1s", "0.10s", "10.0s", "1.10s", "%s", "%.1s", "%.10s", "%10s", NULL }; char *str_vals[] = {"hello", "a", "", "a longer string", NULL}; int x, y; int fail = 0; int num = 0; printf ("Testing snprintf format codes against system sprintf...\n"); for (x = 0; fp_fmt[x] ; x++) { for (y = 0; fp_nums[y] != 0 ; y++) { int l1 = snprintf(NULL, 0, fp_fmt[x], fp_nums[y]); int l2 = snprintf(buf1, sizeof(buf1), fp_fmt[x], fp_nums[y]); sprintf (buf2, fp_fmt[x], fp_nums[y]); if (strcmp (buf1, buf2)) { printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", fp_fmt[x], buf1, buf2); fail++; } if (l1 != l2) { printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, fp_fmt[x]); fail++; } num++; } } for (x = 0; int_fmt[x] ; x++) { for (y = 0; int_nums[y] != 0 ; y++) { int l1 = snprintf(NULL, 0, int_fmt[x], int_nums[y]); int l2 = snprintf(buf1, sizeof(buf1), int_fmt[x], int_nums[y]); sprintf (buf2, int_fmt[x], int_nums[y]); if (strcmp (buf1, buf2)) { printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", int_fmt[x], buf1, buf2); fail++; } if (l1 != l2) { printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, int_fmt[x]); fail++; } num++; } } for (x = 0; str_fmt[x] ; x++) { for (y = 0; str_vals[y] != 0 ; y++) { int l1 = snprintf(NULL, 0, str_fmt[x], str_vals[y]); int l2 = snprintf(buf1, sizeof(buf1), str_fmt[x], str_vals[y]); sprintf (buf2, str_fmt[x], str_vals[y]); if (strcmp (buf1, buf2)) { printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", str_fmt[x], buf1, buf2); fail++; } if (l1 != l2) { printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, str_fmt[x]); fail++; } num++; } } printf ("%d tests failed out of %d.\n", fail, num); printf("seeing how many digits we support\n"); { double v0 = 0.12345678901234567890123456789012345678901; for (x=0; x<100; x++) { snprintf(buf1, sizeof(buf1), "%1.1f", v0*pow(10, x)); sprintf(buf2, "%1.1f", v0*pow(10, x)); if (strcmp(buf1, buf2)) { printf("we seem to support %d digits\n", x-1); break; } } } return 0; } #endif /* SNPRINTF_TEST */ /* -eof- */ ngircd-21/src/portab/Makefile.ng0000644000175000116100000000156512206745354013621 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors # # 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. # __ng_Makefile_am_template__ EXTRA_DIST = Makefile.ng noinst_LIBRARIES = libngportab.a libngportab_a_SOURCES = strdup.c strndup.c strlcpy.c strtok_r.c vsnprintf.c waitpid.c check_PROGRAMS = portabtest portabtest_SOURCES = portabtest.c portabtest_LDFLAGS = -L. portabtest_LDADD = -lngportab noinst_HEADERS = imp.h exp.h portab.h splint.h maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am TESTS = portabtest # -eof- ngircd-21/src/portab/portabtest.c0000644000175000116100000000263412202004071014063 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #include "portab.h" /** * @file * Test program for portab.h and friends ;-) */ #include "imp.h" #include #include #include #include #include "exp.h" static void Panic PARAMS (( char *Reason, int Code )); GLOBAL int main( void ) { /* validate datatypes */ if( false != 0 ) Panic( "false", 1 ); if( true != 1 ) Panic( "true", 1 ); if( sizeof( UINT8 ) != 1 ) Panic( "UINT8", 1 ); if( sizeof( UINT16 ) != 2 ) Panic( "UINT16", 1 ); if( sizeof( UINT32 ) != 4 ) Panic( "UINT32", 1 ); #ifdef PROTOTYPES /* check functions */ if( ! snprintf ) Panic( "snprintf", 2 ); if( ! vsnprintf ) Panic( "vsnprintf", 2 ); if( ! strlcpy ) Panic( "strlcpy", 2 ); if( ! strlcat ) Panic( "strlcat", 2 ); #endif /* ok, no error */ return 0; } /* portab_check_types */ static void Panic( char *Reason, int Code ) { /* Oops, something failed!? */ fprintf( stderr, "Oops, test for %s failed!?", Reason ); exit( Code ); } /* Panic */ /* -eof- */ ngircd-21/src/portab/Makefile.am0000644000175000116100000000156612234274146013610 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors # # 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. # AUTOMAKE_OPTIONS = ansi2knr EXTRA_DIST = Makefile.ng noinst_LIBRARIES = libngportab.a libngportab_a_SOURCES = strdup.c strndup.c strlcpy.c strtok_r.c vsnprintf.c waitpid.c check_PROGRAMS = portabtest portabtest_SOURCES = portabtest.c portabtest_LDFLAGS = -L. portabtest_LDADD = -lngportab noinst_HEADERS = imp.h exp.h portab.h splint.h maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am TESTS = portabtest # -eof- ngircd-21/src/portab/strdup.c0000644000175000116100000000073312202004071013213 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon */ #include "portab.h" /** * @file * strdup() implementation. Public domain. */ #ifndef HAVE_STRDUP #include "imp.h" #include #include #include #include "exp.h" GLOBAL char * strdup( const char *s ) { char *dup; size_t len = strlen( s ); size_t alloc = len + 1; if (len >= alloc ) return NULL; dup = malloc( alloc ); if (dup) strlcpy(dup, s, alloc ); return dup; } #endif ngircd-21/src/portab/waitpid.c0000644000175000116100000000075012201662664013353 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon */ #include "portab.h" /** * @file * waitpid() implementation. Public domain. * Written by Steven D. Blackford for the NeXT system. */ #ifndef HAVE_WAITPID #include "imp.h" #include #include #include #include "exp.h" GLOBAL int waitpid(pid, stat_loc, options) int pid, *stat_loc, options; { for (;;) { int wpid = wait(stat_loc); if (wpid == pid || wpid == -1) return wpid; } } #endif ngircd-21/src/portab/splint.h0000644000175000116100000000213411526006312013215 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen * der GNU General Public License (GPL), wie von der Free Software Foundation * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2 * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. */ #ifndef __splint__ #define __splint__ /** * @file * Header file which is included for SPLint code checks * * This header is only included by portab.h if a SPLint code check is * running (when S_SPLINT_S is defined). It makes some definitions to * prevent SPLint from issuing false warnings. */ #define SYSCONFDIR "/" #define LOCALSTATEDIR "/" #define LOG_EMERG 0 #define LOG_ALERT 1 #define LOG_CRIT 2 #define LOG_ERR 3 #define LOG_WARNING 4 #define LOG_NOTICE 5 #define LOG_INFO 6 #define LOG_DEBUG 7 #define WNOHANG 0 #endif /* -eof- */ ngircd-21/src/portab/strndup.c0000644000175000116100000000072512206745354013416 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon */ #include "portab.h" /** * @file * strndup() implementation. Public domain. */ #ifndef HAVE_STRNDUP #include "imp.h" #include #include #include #include "exp.h" GLOBAL char * strndup(const char *s, size_t maxlen) { char *dup; size_t len = strlen(s); if (len > maxlen) len = maxlen; len++; dup = malloc(len); if (dup) strlcpy(dup, s, len); return dup; } #endif ngircd-21/src/portab/portab.h0000644000175000116100000000656512206745354013223 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __PORTAB__ #define __PORTAB__ /** * @file * Portability functions and declarations (header) */ #include "config.h" #ifndef DEBUG # define NDEBUG #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_INTTYPES_H # include # define NGIRC_GOT_INTTYPES #else # ifdef HAVE_STDINT_H # include # define NGIRC_GOT_INTTYPES # endif #endif #ifdef HAVE_STDDEF_H # include #endif #ifdef HAVE_STDBOOL_H # include #endif /* compiler features */ #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7)) # define PUNUSED(x) __attribute__ ((unused)) x # define UNUSED __attribute__ ((unused)) #else # define PUNUSED(x) x # define UNUSED #endif #ifndef PARAMS # if PROTOTYPES # define PARAMS(args) args # else # define PARAMS(args) () # endif #endif /* datatypes */ #ifndef PROTOTYPES # ifndef signed # define signed # endif #endif typedef void POINTER; #ifdef NGIRC_GOT_INTTYPES typedef uint8_t UINT8; typedef uint16_t UINT16; typedef uint32_t UINT32; #else typedef unsigned char UINT8; typedef unsigned short UINT16; typedef unsigned int UINT32; #endif #ifndef HAVE_STDBOOL_H typedef unsigned char bool; #define true (bool)1 #define false (bool)0 #endif #ifndef NULL #ifdef PROTOTYPES # define NULL (void *)0 #else # define NULL 0L #endif #endif #ifdef NeXT #define S_IRUSR 0000400 /* read permission, owner */ #define S_IWUSR 0000200 /* write permission, owner */ #define S_IRGRP 0000040 /* read permission, group */ #define S_IROTH 0000004 /* read permission, other */ #define ssize_t int #endif #undef GLOBAL #define GLOBAL /* SPLint */ #ifdef S_SPLINT_S #include "splint.h" #endif /* target constants */ #ifndef HOST_OS #define HOST_OS "unknown" #endif #ifndef HOST_CPU #define HOST_CPU "unknown" #endif #ifndef HOST_VENDOR #define HOST_VENDOR "unknown" #endif #ifdef __HAIKU__ #define SINGLE_USER_OS #endif /* configure options */ #ifndef HAVE_socklen_t typedef int socklen_t; /* for Mac OS X, amongst others */ #endif #ifndef HAVE_SNPRINTF extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... )); #endif #ifndef HAVE_STRLCAT extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size )); #endif #ifndef HAVE_STRLCPY extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size )); #endif #ifndef HAVE_STRDUP extern char * strdup PARAMS(( const char *s )); #endif #ifndef HAVE_STRNDUP extern char * strndup PARAMS((const char *s, size_t maxlen)); #endif #ifndef HAVE_STRTOK_R extern char * strtok_r PARAMS((char *str, const char *delim, char **saveptr)); #endif #ifndef HAVE_VSNPRINTF #include extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args )); #endif #ifndef HAVE_GAI_STRERROR #define gai_strerror(r) "unknown error" #endif #ifndef PACKAGE_NAME #define PACKAGE_NAME PACKAGE #endif #ifndef PACKAGE_VERSION #define PACKAGE_VERSION VERSION #endif #endif /* -eof- */ ngircd-21/src/portab/ansi2knr.10000644000175000116100000000277112024404537013360 00000000000000.TH ANSI2KNR 1 "19 Jan 1996" .SH NAME ansi2knr \- convert ANSI C to Kernighan & Ritchie C .SH SYNOPSIS .I ansi2knr [--varargs] input_file [output_file] .SH DESCRIPTION If no output_file is supplied, output goes to stdout. .br There are no error messages. .sp .I ansi2knr recognizes function definitions by seeing a non-keyword identifier at the left margin, followed by a left parenthesis, with a right parenthesis as the last character on the line, and with a left brace as the first token on the following line (ignoring possible intervening comments). It will recognize a multi-line header provided that no intervening line ends with a left or right brace or a semicolon. These algorithms ignore whitespace and comments, except that the function name must be the first thing on the line. .sp The following constructs will confuse it: .br - Any other construct that starts at the left margin and follows the above syntax (such as a macro or function call). .br - Some macros that tinker with the syntax of the function header. .sp The --varargs switch is obsolete, and is recognized only for backwards compatibility. The present version of .I ansi2knr will always attempt to convert a ... argument to va_alist and va_dcl. .SH AUTHOR L. Peter Deutsch wrote the original ansi2knr and continues to maintain the current version; most of the code in the current version is his work. ansi2knr also includes contributions by Francois Pinard and Jim Avera . ngircd-21/src/portab/exp.h0000644000175000116100000000127511526006312012505 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen * der GNU General Public License (GPL), wie von der Free Software Foundation * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2 * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version. * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. */ /** * @file * "Export Header" which makes sure, that global functions are not "extern". */ #undef GLOBAL #define GLOBAL /* -eof- */ ngircd-21/src/Makefile.in0000644000175000116100000004223012234274153012321 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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,2002 by Alexander Barton (alex@barton.de) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # Please read the file COPYING, README and AUTHORS for more information. # # $Id: Makefile.am,v 1.8 2008/02/26 22:04:15 fw Exp $ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-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 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = portab tool ipaddr ngircd testsuite all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/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 $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" 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)'; \ 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-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-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 maintainer-clean-local: rm -f Makefile Makefile.in config.h config.h.in stamp-h.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: ngircd-21/src/Makefile.am0000644000175000116100000000116511457664213012320 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # Please read the file COPYING, README and AUTHORS for more information. # # $Id: Makefile.am,v 1.8 2008/02/26 22:04:15 fw Exp $ # SUBDIRS = portab tool ipaddr ngircd testsuite maintainer-clean-local: rm -f Makefile Makefile.in config.h config.h.in stamp-h.in # -eof- ngircd-21/src/config.h.in0000644000175000116100000002524412234274324012305 00000000000000/* src/config.h.in. Generated from configure.ac by autoheader. */ /* Define if debug-mode should be enabled */ #undef DEBUG /* Define if SSP C support is enabled. */ #undef ENABLE_SSP_CC /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM /* Define to 1 if you have the `arc4random' function. */ #undef HAVE_ARC4RANDOM /* Define to 1 if you have the `arc4random_stir' function. */ #undef HAVE_ARC4RANDOM_STIR /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the `deflate' function. */ #undef HAVE_DEFLATE /* Define to 1 if you have the `dup2' function. */ #undef HAVE_DUP2 /* Define to 1 if you have the `endpwent' function. */ #undef HAVE_ENDPWENT /* Define to 1 if you have the `epoll_create' function. */ #undef HAVE_EPOLL_CREATE /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the `gai_strerror' function. */ #undef HAVE_GAI_STRERROR /* Define to 1 if you have the `getaddrinfo' function. */ #undef HAVE_GETADDRINFO /* Define to 1 if you have the `gethostbyaddr' function. */ #undef HAVE_GETHOSTBYADDR /* Define to 1 if you have the `gethostbyname' function. */ #undef HAVE_GETHOSTBYNAME /* Define to 1 if you have the `gethostname' function. */ #undef HAVE_GETHOSTNAME /* Define to 1 if you have the `getnameinfo' function. */ #undef HAVE_GETNAMEINFO /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the `gnutls_global_init' function. */ #undef HAVE_GNUTLS_GLOBAL_INIT /* Define to 1 if you have the `iconv_open' function. */ #undef HAVE_ICONV_OPEN /* Define to 1 if you have the header file. */ #undef HAVE_IDENT_H /* Define to 1 if you have the `ident_id' function. */ #undef HAVE_IDENT_ID /* Define to 1 if you have the `inet_aton' function. */ #undef HAVE_INET_ATON /* Define to 1 if you have the `inet_ntoa' function. */ #undef HAVE_INET_NTOA /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `kqueue' function. */ #undef HAVE_KQUEUE /* 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 `iconv' library (-liconv). */ #undef HAVE_LIBICONV /* Define to 1 if you have the `libiconv_open' function. */ #undef HAVE_LIBICONV_OPEN /* Define to 1 if you have the `ident' library (-lident). */ #undef HAVE_LIBIDENT /* Define to 1 if you have the `pam' library (-lpam). */ #undef HAVE_LIBPAM /* Define to 1 if you have the `ssl' library (-lssl). */ #undef HAVE_LIBSSL /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ /* Define to 1 if you have the 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 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 header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_SYSTM_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IP_H /* Define to 1 if you have the `pam_authenticate' function. */ #undef HAVE_PAM_AUTHENTICATE /* Define to 1 if you have the header file. */ #undef HAVE_PAM_PAM_APPL_H /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL /* Define to 1 if you have the header file. */ #undef HAVE_POLL_H /* Define to 1 if you have the header file. */ #undef HAVE_SECURITY_PAM_APPL_H /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `setsid' function. */ #undef HAVE_SETSID /* Define to 1 if you have the `sigaction' function. */ #undef HAVE_SIGACTION /* Define to 1 if you have the `sigprocmask' function. */ #undef HAVE_SIGPROCMASK /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* 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 header file. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* 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 /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strlcat' function. */ #undef HAVE_STRLCAT /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the `strndup' function. */ #undef HAVE_STRNDUP /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strspn' function. */ #undef HAVE_STRSPN /* 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 header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_DEVPOLL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_VARARGS_H /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to 1 if you have the `waitpid' function. */ #undef HAVE_WAITPID /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if you have the 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 /* Target CPU name */ #undef HOST_CPU /* Target operating system name */ #undef HOST_OS /* Target system vendor */ #undef HOST_VENDOR /* Define if libiconv can be used, e.g. for CHARCONV */ #undef ICONV /* Define if the server should do IDENT requests */ #undef IDENTAUTH /* Define if IRC+ protocol should be used */ #undef IRCPLUS /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define if PAM should be used */ #undef PAM /* Define to 1 if the C compiler supports function prototypes. */ #undef PROTOTYPES /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define if IRC sniffer should be enabled */ #undef SNIFFER /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if ngIRCd should behave strict RFC compliant */ #undef STRICT_RFC /* Define if syslog should be used for logging */ #undef SYSLOG /* Define if TCP wrappers should be used */ #undef TCPWRAP /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Version number of package */ #undef VERSION /* Define if IPV6 protocol should be enabled */ #undef WANT_IPV6 /* Define if zlib compression should be enabled */ #undef ZLIB /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT32_T /* Define for Solaris 2.5.1 so the uint8_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT8_T /* Define like PROTOTYPES; this can be used by system headers. */ #undef __PROTOTYPES /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if does not define. */ #undef ssize_t /* Define to `int' if doesn't define. */ #undef uid_t /* Define to the type of an unsigned integer type of width exactly 16 bits if such a type exists and the standard includes do not define it. */ #undef uint16_t /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef uint32_t /* Define to the type of an unsigned integer type of width exactly 8 bits if such a type exists and the standard includes do not define it. */ #undef uint8_t /* Define as `fork' if `vfork' does not work. */ #undef vfork ngircd-21/src/tool/0000755000175000116100000000000012234274325011311 500000000000000ngircd-21/src/tool/Makefile.in0000644000175000116100000003451312234274154013304 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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-2012 Alexander Barton (alex@barton.de) and Contributors # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ ANSI2KNR = ../portab/ansi2knr subdir = src/tool DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_$(V)) am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY)) am__v_AR_0 = @echo " AR " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ libngtool_a_AR = $(AR) $(ARFLAGS) libngtool_a_LIBADD = am_libngtool_a_OBJECTS = tool$U.$(OBJEXT) libngtool_a_OBJECTS = $(am_libngtool_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libngtool_a_SOURCES) DIST_SOURCES = $(libngtool_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = ../portab/ansi2knr EXTRA_DIST = Makefile.ng AM_CPPFLAGS = -I$(srcdir)/../portab noinst_LIBRARIES = libngtool.a libngtool_a_SOURCES = tool.c noinst_HEADERS = tool.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/tool/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/tool/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 $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libngtool.a: $(libngtool_a_OBJECTS) $(libngtool_a_DEPENDENCIES) $(AM_V_at)-rm -f libngtool.a $(AM_V_AR)$(libngtool_a_AR) libngtool.a $(libngtool_a_OBJECTS) $(libngtool_a_LIBADD) $(AM_V_at)$(RANLIB) libngtool.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c ../portab/ansi2knr: $(am__cd) ../portab && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr mostlyclean-kr: -test "$U" = "" || rm -f *_.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tool$U.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @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@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @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) '$<'` tool_.c: tool.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tool.c; then echo $(srcdir)/tool.c; else echo tool.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ tool_.$(OBJEXT) : $(ANSI2KNR) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" 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)'; \ 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 $(LIBRARIES) $(HEADERS) 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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: ../portab/ansi2knr install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ 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-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 maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am # -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: ngircd-21/src/tool/Makefile.ng0000644000175000116100000000127312206130744013272 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors # # 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. # __ng_Makefile_am_template__ EXTRA_DIST = Makefile.ng AM_CPPFLAGS = -I$(srcdir)/../portab noinst_LIBRARIES = libngtool.a libngtool_a_SOURCES = tool.c noinst_HEADERS = tool.h maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am # -eof- ngircd-21/src/tool/Makefile.am0000644000175000116100000000130612234274146013266 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors # # 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. # AUTOMAKE_OPTIONS = ../portab/ansi2knr EXTRA_DIST = Makefile.ng AM_CPPFLAGS = -I$(srcdir)/../portab noinst_LIBRARIES = libngtool.a libngtool_a_SOURCES = tool.c noinst_HEADERS = tool.h maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am # -eof- ngircd-21/src/tool/tool.h0000644000175000116100000000177612206130744012365 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2010 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. */ #ifndef __tool_h__ #define __tool_h__ /** * @file * Tool functions (Header) */ #include "portab.h" GLOBAL void ngt_TrimLastChr PARAMS((char *String, const char Chr )); GLOBAL void ngt_TrimStr PARAMS((char *String )); GLOBAL char *ngt_UpperStr PARAMS((char *String )); GLOBAL char *ngt_LowerStr PARAMS((char *String )); GLOBAL char *ngt_RandomStr PARAMS((char *String, const size_t len)); #ifdef SYSLOG GLOBAL const char *ngt_SyslogFacilityName PARAMS((int Facility)); GLOBAL int ngt_SyslogFacilityID PARAMS((char *Name, int DefaultFacility)); #endif #endif /* -eof- */ ngircd-21/src/tool/tool.c0000644000175000116100000001032212227561010012340 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2010 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. */ #include "portab.h" /** * @file * Tool functions */ #include "imp.h" #include #include #include #include #include #include #include #ifdef SYSLOG #define SYSLOG_NAMES 1 #include #endif #include "exp.h" #include "tool.h" /** * Removes all leading and trailing whitespaces of a string. * @param String The string to remove whitespaces from. */ GLOBAL void ngt_TrimStr(char *String) { char *start, *end; assert(String != NULL); start = String; /* Remove whitespaces at the beginning of the string ... */ while (*start == ' ' || *start == '\t' || *start == '\n' || *start == '\r') start++; if (!*start) { *String = '\0'; return; } /* ... and at the end: */ end = strchr(start, '\0'); end--; while ((*end == ' ' || *end == '\t' || *end == '\n' || *end == '\r') && end >= start) end--; /* New trailing NULL byte */ *(++end) = '\0'; memmove(String, start, (size_t)(end - start)+1); } /* ngt_TrimStr */ /** * Convert a string to uppercase letters. */ GLOBAL char * ngt_UpperStr(char *String) { char *ptr; assert(String != NULL); ptr = String; while(*ptr) { *ptr = toupper((int)*ptr); ptr++; } return String; } /* ngt_UpperStr */ /** * Convert a string to lowercase letters. */ GLOBAL char * ngt_LowerStr(char *String) { char *ptr; assert(String != NULL); ptr = String; while(*ptr) { *ptr = tolower((int)*ptr); ptr++; } return String; } /* ngt_LowerStr */ GLOBAL void ngt_TrimLastChr( char *String, const char Chr) { /* If last character in the string matches Chr, remove it. * Empty strings are handled correctly. */ size_t len; assert(String != NULL); len = strlen(String); if(len == 0) return; len--; if(String[len] == Chr) String[len] = '\0'; } /* ngt_TrimLastChr */ /** * Fill a String with random chars */ GLOBAL char * ngt_RandomStr(char *String, const size_t len) { static const char chars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!\"#$&'()*+,-./:;<=>?@[\\]^_`"; struct timeval t; size_t i; assert(String != NULL); gettimeofday(&t, NULL); #ifndef HAVE_ARC4RANDOM srand((unsigned)(t.tv_usec * t.tv_sec)); for (i = 0; i < len; ++i) { String[i] = chars[rand() % (sizeof(chars) - 1)]; } #else for (i = 0; i < len; ++i) String[i] = chars[arc4random() % (sizeof(chars) - 1)]; #endif String[len] = '\0'; return String; } /* ngt_RandomStr */ #ifdef SYSLOG #ifndef INTERNAL_MARK #ifndef _code typedef struct _code { char *c_name; int c_val; } CODE; #endif CODE facilitynames[] = { #ifdef LOG_AUTH { "auth", LOG_AUTH }, #endif #ifdef LOG_AUTHPRIV { "authpriv", LOG_AUTHPRIV }, #endif #ifdef LOG_CRON { "cron", LOG_CRON }, #endif #ifdef LOG_DAEMON { "daemon", LOG_DAEMON }, #endif #ifdef LOG_FTP { "ftp", LOG_FTP }, #endif #ifdef LOG_LPR { "lpr", LOG_LPR }, #endif #ifdef LOG_MAIL { "mail", LOG_MAIL }, #endif #ifdef LOG_NEWS { "news", LOG_NEWS }, #endif #ifdef LOG_UUCP { "uucp", LOG_UUCP }, #endif #ifdef LOG_USER { "user", LOG_USER }, #endif #ifdef LOG_LOCAL7 { "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, { "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, { "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, { "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, #endif { 0, -1 } }; #endif GLOBAL const char* ngt_SyslogFacilityName(int Facility) { int i = 0; while(facilitynames[i].c_name) { if (facilitynames[i].c_val == Facility) return facilitynames[i].c_name; i++; } return "unknown"; } GLOBAL int ngt_SyslogFacilityID(char *Name, int DefaultFacility) { int i = 0; while(facilitynames[i].c_name) { if (strcasecmp(facilitynames[i].c_name, Name) == 0) return facilitynames[i].c_val; i++; } return DefaultFacility; } #endif /* -eof- */ ngircd-21/src/ipaddr/0000755000175000116100000000000012234274325011577 500000000000000ngircd-21/src/ipaddr/ng_ipaddr.c0000644000175000116100000000737512206130744013621 00000000000000/* * (c) 2008 Florian Westphal , public domain. */ #include "portab.h" /** * @file * Functions for AF_ agnostic ipv4/ipv6 handling. */ #include #include #include #ifdef HAVE_GETADDRINFO #include #include #endif #include "ng_ipaddr.h" GLOBAL bool ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port) { #ifdef HAVE_GETADDRINFO int ret; char portstr[64]; struct addrinfo *res0; struct addrinfo hints; assert(ip_str); memset(&hints, 0, sizeof(hints)); #ifdef AI_NUMERICHOST hints.ai_flags = AI_NUMERICHOST; #endif #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; /* silly, but ngircd stores UINT16 in server config, not string */ snprintf(portstr, sizeof(portstr), "%u", (unsigned int) port); ret = getaddrinfo(ip_str, portstr, &hints, &res0); if (ret != 0) return false; assert(sizeof(*addr) >= (size_t)res0->ai_addrlen); if (sizeof(*addr) >= (size_t)res0->ai_addrlen) memcpy(addr, res0->ai_addr, res0->ai_addrlen); else ret = -1; freeaddrinfo(res0); 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) return false; # else addr->sin4.sin_addr.s_addr = inet_addr(ip_str); if (addr->sin4.sin_addr.s_addr == (unsigned) -1) return false; # endif ng_ipaddr_setport(addr, port); return true; #endif /* HAVE_GETADDRINFO */ } GLOBAL void ng_ipaddr_setport(ng_ipaddr_t *a, UINT16 port) { #ifdef WANT_IPV6 int af; assert(a != NULL); af = a->sa.sa_family; assert(af == AF_INET || af == AF_INET6); switch (af) { case AF_INET: a->sin4.sin_port = htons(port); break; case AF_INET6: a->sin6.sin6_port = htons(port); break; } #else /* WANT_IPV6 */ assert(a != NULL); assert(a->sin4.sin_family == AF_INET); a->sin4.sin_port = htons(port); #endif /* WANT_IPV6 */ } GLOBAL bool ng_ipaddr_ipequal(const ng_ipaddr_t *a, const ng_ipaddr_t *b) { assert(a != NULL); assert(b != NULL); #ifdef WANT_IPV6 if (a->sa.sa_family != b->sa.sa_family) return false; assert(ng_ipaddr_salen(a) == ng_ipaddr_salen(b)); switch (a->sa.sa_family) { case AF_INET6: return IN6_ARE_ADDR_EQUAL(&a->sin6.sin6_addr, &b->sin6.sin6_addr); case AF_INET: return memcmp(&a->sin4.sin_addr, &b->sin4.sin_addr, sizeof(a->sin4.sin_addr)) == 0; } return false; #else assert(a->sin4.sin_family == AF_INET); assert(b->sin4.sin_family == AF_INET); return memcmp(&a->sin4.sin_addr, &b->sin4.sin_addr, sizeof(a->sin4.sin_addr)) == 0; #endif } #ifdef WANT_IPV6 GLOBAL const char * ng_ipaddr_tostr(const ng_ipaddr_t *addr) { static char strbuf[NG_INET_ADDRSTRLEN]; strbuf[0] = 0; ng_ipaddr_tostr_r(addr, strbuf); return strbuf; } /* str must be at least NG_INET_ADDRSTRLEN bytes long */ GLOBAL bool ng_ipaddr_tostr_r(const ng_ipaddr_t *addr, char *str) { #ifdef HAVE_GETNAMEINFO const struct sockaddr *sa = (const struct sockaddr *) addr; int ret; *str = 0; ret = getnameinfo(sa, ng_ipaddr_salen(addr), str, NG_INET_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST); /* * avoid leading ':'. * causes mis-interpretation of client host in e.g. /WHOIS */ if (*str == ':') { char tmp[NG_INET_ADDRSTRLEN] = "0"; ret = getnameinfo(sa, ng_ipaddr_salen(addr), tmp + 1, (socklen_t)sizeof(tmp) - 1, NULL, 0, NI_NUMERICHOST); if (ret == 0) strlcpy(str, tmp, NG_INET_ADDRSTRLEN); } assert (ret == 0); return ret == 0; #else abort(); /* WANT_IPV6 depends on HAVE_GETNAMEINFO */ #endif } #endif /* WANT_IPV6 */ /* -eof- */ ngircd-21/src/ipaddr/Makefile.in0000644000175000116100000003407512234274153013574 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ # # ipaddr/Makefile.am # (c) 2008 Florian Westphal , public domain. # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ ANSI2KNR = ../portab/ansi2knr subdir = src/ipaddr DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_$(V)) am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY)) am__v_AR_0 = @echo " AR " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ 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.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libngipaddr_a_SOURCES) DIST_SOURCES = $(libngipaddr_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = ../portab/ansi2knr EXTRA_DIST = Makefile.ng AM_CPPFLAGS = -I$(srcdir)/../portab noinst_LIBRARIES = libngipaddr.a libngipaddr_a_SOURCES = ng_ipaddr.c noinst_HEADERS = ng_ipaddr.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/ipaddr/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/ipaddr/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 $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libngipaddr.a: $(libngipaddr_a_OBJECTS) $(libngipaddr_a_DEPENDENCIES) $(AM_V_at)-rm -f libngipaddr.a $(AM_V_AR)$(libngipaddr_a_AR) libngipaddr.a $(libngipaddr_a_OBJECTS) $(libngipaddr_a_LIBADD) $(AM_V_at)$(RANLIB) libngipaddr.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c ../portab/ansi2knr: $(am__cd) ../portab && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr mostlyclean-kr: -test "$U" = "" || rm -f *_.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ng_ipaddr$U.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @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@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @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) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" 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)'; \ 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 $(LIBRARIES) $(HEADERS) 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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: ../portab/ansi2knr install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ 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-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 maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am # -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: ngircd-21/src/ipaddr/ng_ipaddr.h0000644000175000116100000000565412206130744013624 00000000000000/* * (c) 2008 Florian Westphal , public domain. */ #ifndef NG_IPADDR_HDR #define NG_IPADDR_HDR #include "portab.h" /** * @file * Functions for AF_ agnostic ipv4/ipv6 handling (header). */ #include #include #include #ifdef HAVE_ARPA_INET_H # include #else # define PF_INET AF_INET #endif #ifdef WANT_IPV6 #define NG_INET_ADDRSTRLEN INET6_ADDRSTRLEN #else #define NG_INET_ADDRSTRLEN 16 #endif #ifdef WANT_IPV6 typedef union { struct sockaddr sa; struct sockaddr_in sin4; struct sockaddr_in6 sin6; } ng_ipaddr_t; #else /* assume compiler can't deal with typedef struct {... */ struct NG_IP_ADDR_DONTUSE { struct sockaddr_in sin4; }; typedef struct NG_IP_ADDR_DONTUSE ng_ipaddr_t; #endif static inline int ng_ipaddr_af(const ng_ipaddr_t *a) { assert(a != NULL); #ifdef WANT_IPV6 return a->sa.sa_family; #else assert(a->sin4.sin_family == 0 || a->sin4.sin_family == AF_INET); return a->sin4.sin_family; #endif } static inline socklen_t ng_ipaddr_salen(const ng_ipaddr_t *a) { assert(a != NULL); #ifdef WANT_IPV6 assert(a->sa.sa_family == AF_INET || a->sa.sa_family == AF_INET6); if (a->sa.sa_family == AF_INET6) return (socklen_t)sizeof(a->sin6); #endif assert(a->sin4.sin_family == AF_INET); return (socklen_t)sizeof(a->sin4); } static inline UINT16 ng_ipaddr_getport(const ng_ipaddr_t *a) { #ifdef WANT_IPV6 int af = a->sa.sa_family; assert(a != NULL); assert(af == AF_INET || af == AF_INET6); if (af == AF_INET6) return ntohs(a->sin6.sin6_port); #endif /* WANT_IPV6 */ assert(a != NULL); assert(a->sin4.sin_family == AF_INET); return ntohs(a->sin4.sin_port); } /* * init a ng_ipaddr_t object. * @param addr: pointer to ng_ipaddr_t to initialize. * @param ip_str: ip address in dotted-decimal (ipv4) or hexadecimal (ipv6) notation * @param port: transport layer port number to use. */ GLOBAL bool ng_ipaddr_init PARAMS((ng_ipaddr_t *addr, const char *ip_str, UINT16 port)); /* set sin4/sin6_port, depending on a->sa_family */ GLOBAL void ng_ipaddr_setport PARAMS((ng_ipaddr_t *a, UINT16 port)); /* return true if a and b have the same IP address. If a and b have different AF, return false. */ GLOBAL bool ng_ipaddr_ipequal PARAMS((const ng_ipaddr_t *a, const ng_ipaddr_t *b)); #ifdef WANT_IPV6 /* convert struct sockaddr to string, returns pointer to static buffer */ GLOBAL const char *ng_ipaddr_tostr PARAMS((const ng_ipaddr_t *addr)); /* convert struct sockaddr to string. dest must be NG_INET_ADDRSTRLEN bytes long */ GLOBAL bool ng_ipaddr_tostr_r PARAMS((const ng_ipaddr_t *addr, char *dest)); #else static inline const char* ng_ipaddr_tostr(const ng_ipaddr_t *addr) { assert(addr != NULL); return inet_ntoa(addr->sin4.sin_addr); } static inline bool ng_ipaddr_tostr_r(const ng_ipaddr_t *addr, char *d) { assert(addr != NULL); assert(d != NULL); strlcpy(d, inet_ntoa(addr->sin4.sin_addr), NG_INET_ADDRSTRLEN); return true; } #endif #endif /* -eof- */ ngircd-21/src/ipaddr/Makefile.ng0000644000175000116100000000053712206130744013562 00000000000000# # ipaddr/Makefile.am # (c) 2008 Florian Westphal , public domain. # __ng_Makefile_am_template__ EXTRA_DIST = Makefile.ng AM_CPPFLAGS = -I$(srcdir)/../portab noinst_LIBRARIES = libngipaddr.a libngipaddr_a_SOURCES = ng_ipaddr.c noinst_HEADERS = ng_ipaddr.h maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am # -eof- ngircd-21/src/ipaddr/Makefile.am0000644000175000116100000000055212234274146013556 00000000000000# # ipaddr/Makefile.am # (c) 2008 Florian Westphal , public domain. # AUTOMAKE_OPTIONS = ../portab/ansi2knr EXTRA_DIST = Makefile.ng AM_CPPFLAGS = -I$(srcdir)/../portab noinst_LIBRARIES = libngipaddr.a libngipaddr_a_SOURCES = ng_ipaddr.c noinst_HEADERS = ng_ipaddr.h maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am # -eof- ngircd-21/src/testsuite/0000755000175000116100000000000012234274326012366 500000000000000ngircd-21/src/testsuite/kick-test.e0000644000175000116100000000314111130147557014350 00000000000000spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "nick nick\r" send "user user . . :User\r" expect { timeout { exit 1 } "376" } send "kick #Channel nick\r" expect { timeout { exit 1 } "403" } send "join #Channel\r" send "kick #Channel nick\r" expect { timeout { exit 1 } "@* KICK #Channel nick :nick" } send "join #Channel\r" send "kick #Channel nick :reason\r" expect { timeout { exit 1 } "@* KICK #Channel nick :reason" } send "join #Channel,#Channel2\r" send "kick #Channel,#Channel2 nick\r" expect { timeout { exit 1 } "461" } send "kick #Channel,#Channel2,#NoExists,#NoExists nick1,nick,nick3,nick :reason\r" expect { timeout { exit 1 } "401" } expect { timeout { exit 1 } "@* KICK #Channel2 nick :reason" } expect { timeout { exit 1 } "401" } expect { timeout { exit 1 } "403" } send "kick #Channel nick2,nick,nick3\r" expect { timeout { exit 1 } "401" } expect { timeout { exit 1 } "@* KICK #Channel nick :nick" } expect { timeout { exit 1 } "401" } send "kick #Channel ,,\r" expect { timeout { exit 1 } "401" } expect { timeout { exit 1 } "401" } send "kick ,, ,,,\r" expect { timeout { exit 1 } "461" } send "kick ,, ,,\r" expect { timeout { exit 1 } "401" } expect { timeout { exit 1 } "401" } expect { timeout { exit 1 } "401" } send "quit\r" expect { timeout { exit 1 } "Connection closed" } # -eof- ngircd-21/src/testsuite/start-server20000754000175000116100000000015411130147557014755 00000000000000#!/bin/sh # ngIRCd Test Suite [ -z "$srcdir" ] && srcdir=`dirname $0` ${srcdir}/start-server.sh 2 # -eof- ngircd-21/src/testsuite/ngircd-test1.conf0000644000175000116100000000151712206130744015457 00000000000000# ngIRCd test suite # configuration file for test server #1 [Global] Name = ngircd.test.server Info = ngIRCd Test-Server 1 Listen = 127.0.0.1 Ports = 6789 MotdFile = ngircd-test1.motd AdminEMail = admin@irc.server [Limits] MaxConnectionsIP = 0 MaxJoins = 4 [Options] OperCanUseMode = yes Ident = no IncludeDir = /var/empty PAM = no [Operator] Name = TestOp Password = 123 [Server] Name = ngircd.test.server2 MyPassword = pwd1 PeerPassword = pwd2 [Channel] Name = InviteChannel Modes = i [Channel] Name = #FullKeyed Modes = lk MaxUsers = 0 Key = Secret [Channel] Name = #TopicChannel Modes = t Topic = the topic [Channel] Name = #SecretChannel Modes = s Topic = A secret Channel [Channel] Name = &LocalChannel Topic = A local Channel [Channel] Name = +ModelessChannel Topic = A modeless Channel # -eof- ngircd-21/src/testsuite/start-server10000754000175000116100000000015411130147557014754 00000000000000#!/bin/sh # ngIRCd Test Suite [ -z "$srcdir" ] && srcdir=`dirname $0` ${srcdir}/start-server.sh 1 # -eof- ngircd-21/src/testsuite/Makefile.in0000644000175000116100000003542112234274154014357 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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-2012 Alexander Barton (alex@barton.de) and Contributors # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ subdir = src/testsuite DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = # If stdout is a non-dumb tty, use colors. If test -t is not supported, # then this fails; a conservative approach. Of course do not redirect # stdout here, just stderr. am__tty_colors = \ red=; grn=; lgn=; blu=; std=; \ test "X$(AM_COLOR_TESTS)" != Xno \ && test "X$$TERM" != Xdumb \ && { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \ && { \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ std=''; \ } DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = ../portab/ansi2knr AM_CPPFLAGS = -I$(srcdir)/../portab EXTRA_DIST = \ Makefile.ng README functions.inc getpid.sh \ start-server.sh stop-server.sh tests.sh stress-server.sh \ test-loop.sh wait-tests.sh \ channel-test.e connect-test.e check-idle.e invite-test.e \ join-test.e kick-test.e message-test.e misc-test.e mode-test.e \ opless-channel-test.e server-link-test.e who-test.e whois-test.e \ stress-A.e stress-B.e \ start-server1 stop-server1 ngircd-test1.conf \ start-server2 stop-server2 ngircd-test2.conf check_SCRIPTS = ngircd-TEST-Binary tests.sh TESTS = start-server1 \ connect-test \ start-server2 \ channel-test \ invite-test \ join-test \ kick-test \ message-test \ misc-test \ mode-test \ opless-channel-test \ who-test \ whois-test \ server-link-test \ stop-server2 \ stress-server.sh \ stop-server1 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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/testsuite/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/testsuite/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 $(am__aclocal_m4_deps): tags: TAGS TAGS: ctags: CTAGS CTAGS: check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS 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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am 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: check-am install-am install-strip .PHONY: all all-am check check-TESTS 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-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 all: clean-local: rm -rf logs tests *-test ngircd-test*.log procs.tmp \ T-ngircd1 ngircd-test1.motd T-ngircd2 ngircd-test2.motd maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am ngircd-TEST-Binary: cp ../ngircd/ngircd T-ngircd1 cp ../ngircd/ngircd T-ngircd2 [ -f getpid.sh ] || ln -s $(srcdir)/getpid.sh . connect-test: tests.sh rm -f connect-test ln -s $(srcdir)/tests.sh connect-test channel-test: tests.sh rm -f channel-test ln -s $(srcdir)/tests.sh channel-test invite-test: tests.sh rm -f invite-test ln -s $(srcdir)/tests.sh invite-test join-test: tests.sh rm -f join-test ln -s $(srcdir)/tests.sh join-test kick-test: tests.sh rm -f kick-test ln -s $(srcdir)/tests.sh kick-test message-test: tests.sh rm -f message-test ln -s $(srcdir)/tests.sh message-test misc-test: tests.sh rm -f misc-test ln -s $(srcdir)/tests.sh misc-test mode-test: tests.sh rm -f mode-test ln -s $(srcdir)/tests.sh mode-test opless-channel-test: tests.sh rm -f opless-channel-test ln -s $(srcdir)/tests.sh opless-channel-test server-link-test: tests.sh rm -f server-link-test ln -s $(srcdir)/tests.sh server-link-test who-test: tests.sh rm -f who-test ln -s $(srcdir)/tests.sh who-test whois-test: tests.sh rm -f whois-test ln -s $(srcdir)/tests.sh whois-test # -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: ngircd-21/src/testsuite/start-server.sh0000754000175000116100000000215512206130744015302 00000000000000#!/bin/sh # ngIRCd Test Suite [ -z "$srcdir" ] && srcdir=`dirname $0` # read in functions . ${srcdir}/functions.inc if [ -n "$1" ]; then id="$1"; shift else id="1" fi echo_n "starting server ${id} ..." # remove old logfiles, if this is the first server (ID 1) [ "$id" = "1" ] && rm -rf logs *.log # check weather getpid.sh returns valid PIDs. If not, don't start up the # test-server, because we won't be able to kill it at the end of the test. ./getpid.sh sh > /dev/null 2>&1 if [ $? -ne 0 ]; then echo " getpid.sh failed!" exit 1 fi # check if there is a test-server already running ./getpid.sh T-ngircd${id} >/dev/null 2>&1 if [ $? -eq 0 ]; then echo " failure: test-server ${id} already running!" exit 1 fi # generate MOTD for test-server echo "This is an ngIRCd Test Server" > ngircd-test${id}.motd # starting up test-server ... ./T-ngircd${id} -n -f ${srcdir}/ngircd-test${id}.conf $* \ >ngircd-test${id}.log 2>&1 & sleep 1 # validate running test-server pid=`./getpid.sh T-ngircd${id}` [ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1; r=$? [ $r -eq 0 ] && echo " ok." || echo " failure!" exit $r # -eof- ngircd-21/src/testsuite/Makefile.ng0000644000175000116100000000506112206130744014345 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors # # 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. # __ng_Makefile_am_template__ AM_CPPFLAGS = -I$(srcdir)/../portab EXTRA_DIST = \ Makefile.ng README functions.inc getpid.sh \ start-server.sh stop-server.sh tests.sh stress-server.sh \ test-loop.sh wait-tests.sh \ channel-test.e connect-test.e check-idle.e invite-test.e \ join-test.e kick-test.e message-test.e misc-test.e mode-test.e \ opless-channel-test.e server-link-test.e who-test.e whois-test.e \ stress-A.e stress-B.e \ start-server1 stop-server1 ngircd-test1.conf \ start-server2 stop-server2 ngircd-test2.conf all: clean-local: rm -rf logs tests *-test ngircd-test*.log procs.tmp \ T-ngircd1 ngircd-test1.motd T-ngircd2 ngircd-test2.motd maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am check_SCRIPTS = ngircd-TEST-Binary tests.sh ngircd-TEST-Binary: cp ../ngircd/ngircd T-ngircd1 cp ../ngircd/ngircd T-ngircd2 [ -f getpid.sh ] || ln -s $(srcdir)/getpid.sh . connect-test: tests.sh rm -f connect-test ln -s $(srcdir)/tests.sh connect-test channel-test: tests.sh rm -f channel-test ln -s $(srcdir)/tests.sh channel-test invite-test: tests.sh rm -f invite-test ln -s $(srcdir)/tests.sh invite-test join-test: tests.sh rm -f join-test ln -s $(srcdir)/tests.sh join-test kick-test: tests.sh rm -f kick-test ln -s $(srcdir)/tests.sh kick-test message-test: tests.sh rm -f message-test ln -s $(srcdir)/tests.sh message-test misc-test: tests.sh rm -f misc-test ln -s $(srcdir)/tests.sh misc-test mode-test: tests.sh rm -f mode-test ln -s $(srcdir)/tests.sh mode-test opless-channel-test: tests.sh rm -f opless-channel-test ln -s $(srcdir)/tests.sh opless-channel-test server-link-test: tests.sh rm -f server-link-test ln -s $(srcdir)/tests.sh server-link-test who-test: tests.sh rm -f who-test ln -s $(srcdir)/tests.sh who-test whois-test: tests.sh rm -f whois-test ln -s $(srcdir)/tests.sh whois-test TESTS = start-server1 \ connect-test \ start-server2 \ channel-test \ invite-test \ join-test \ kick-test \ message-test \ misc-test \ mode-test \ opless-channel-test \ who-test \ whois-test \ server-link-test \ stop-server2 \ stress-server.sh \ stop-server1 # -eof- ngircd-21/src/testsuite/misc-test.e0000644000175000116100000000433611130147557014371 00000000000000# $Id: misc-test.e,v 1.2 2008/02/17 13:51:00 alex Exp $ spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "nick nick\r" send "user user . . :User\r" expect { timeout { exit 1 } "376" } # RFC 2812 Section 3.4.1 send "motd\r" expect { timeout { exit 1 } "375" } expect { timeout { exit 1 } "372" } expect { timeout { exit 1 } "376" } send "motd ngircd.test.server\r" expect { timeout { exit 1 } "375" } expect { timeout { exit 1 } "372" } expect { timeout { exit 1 } "376" } send "motd doesnotexist\r" expect { timeout { exit 1 } "402" # note this is not specified in RFC 2812, but probably should be } # RFC 2812 Section 3.4.3 send "version\r" expect { timeout { exit 1 } "351" } send "version ngircd.test.server\r" expect { timeout { exit 1 } "351" } send "version doesnotexist\r" expect { timeout { exit 1 } "402" } # RFC 2812 Section 3.4.6 send "time\r" expect { timeout { exit 1 } "391" } send "time ngircd.test.server\r" expect { timeout { exit 1 } "391" } send "time doesnotexist\r" expect { timeout { exit 1 } "402" } # RFC 2812 Section 3.4.10 send "info\r" expect { timeout { exit 1 } "371" } expect { timeout { exit 1 } "374" } # RFC 2812 Section 4.5 send "summon\r" expect { timeout { exit 1 } "445" } # RFC 2812 Section 4.6 send "users\r" expect { timeout { exit 1 } "446" } # RFC 2812 Section 4.8 send "userhost\r" expect { timeout { exit 1 } "461" } send "userhost nick\r" expect { timeout { exit 1 } -re ":ngircd.test.server 302 nick :?nick=+.*@(localhos.*|127.0.0.1)" } send "userhost doesnotexist\r" expect { timeout { exit 1 } ":ngircd.test.server 302 nick :\r" } send "userhost nick doesnotexist nick doesnotexist\r" expect { timeout { exit 1 } -re ":ngircd.test.server 302 nick :nick=+.*@(localhos.*|127.0.0.1) nick=+.*@(localhos.*|127.0.0.1)" } send "away :testing\r" expect { timeout { exit 1 } "306 nick" } send "userhost nick nick nick nick nick nick\r" expect { timeout { exit 1 } -re ":ngircd.test.server 302 nick :nick=-.*@(localhos.*|127.0.0.1) nick=-.*@(localhos.*|127.0.0.1) nick=-.*@(localhos.*|127.0.0.1) nick=-.*@(localhos.*|127.0.0.1) nick=-.*@(localhos.*|127.0.0.1)\r" } send "quit\r" expect { timeout { exit 1 } "ERROR" } # -eof- ngircd-21/src/testsuite/functions.inc0000644000175000116100000000127211000116207014772 00000000000000#!/bin/sh # # ngIRCd Test Suite # Copyright (c)2002-2004 by Alexander Barton (alex@barton.de) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # Please read the file COPYING, README and AUTHORS for more information. # # $Id: functions.inc,v 1.1 2004/09/06 22:04:06 alex Exp $ # # test how to call echo to get output without newline echo -n | grep -- -n >/dev/null 2>&1 if [ $? -eq 0 ]; then ECHO_N=""; ECHO_C="\c" else ECHO_N="-n"; ECHO_C="" fi echo_n() { echo $ECHO_N "$*$ECHO_C" } # -eof- ngircd-21/src/testsuite/Makefile.am0000644000175000116100000000507412234274146014350 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors # # 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. # AUTOMAKE_OPTIONS = ../portab/ansi2knr AM_CPPFLAGS = -I$(srcdir)/../portab EXTRA_DIST = \ Makefile.ng README functions.inc getpid.sh \ start-server.sh stop-server.sh tests.sh stress-server.sh \ test-loop.sh wait-tests.sh \ channel-test.e connect-test.e check-idle.e invite-test.e \ join-test.e kick-test.e message-test.e misc-test.e mode-test.e \ opless-channel-test.e server-link-test.e who-test.e whois-test.e \ stress-A.e stress-B.e \ start-server1 stop-server1 ngircd-test1.conf \ start-server2 stop-server2 ngircd-test2.conf all: clean-local: rm -rf logs tests *-test ngircd-test*.log procs.tmp \ T-ngircd1 ngircd-test1.motd T-ngircd2 ngircd-test2.motd maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am check_SCRIPTS = ngircd-TEST-Binary tests.sh ngircd-TEST-Binary: cp ../ngircd/ngircd T-ngircd1 cp ../ngircd/ngircd T-ngircd2 [ -f getpid.sh ] || ln -s $(srcdir)/getpid.sh . connect-test: tests.sh rm -f connect-test ln -s $(srcdir)/tests.sh connect-test channel-test: tests.sh rm -f channel-test ln -s $(srcdir)/tests.sh channel-test invite-test: tests.sh rm -f invite-test ln -s $(srcdir)/tests.sh invite-test join-test: tests.sh rm -f join-test ln -s $(srcdir)/tests.sh join-test kick-test: tests.sh rm -f kick-test ln -s $(srcdir)/tests.sh kick-test message-test: tests.sh rm -f message-test ln -s $(srcdir)/tests.sh message-test misc-test: tests.sh rm -f misc-test ln -s $(srcdir)/tests.sh misc-test mode-test: tests.sh rm -f mode-test ln -s $(srcdir)/tests.sh mode-test opless-channel-test: tests.sh rm -f opless-channel-test ln -s $(srcdir)/tests.sh opless-channel-test server-link-test: tests.sh rm -f server-link-test ln -s $(srcdir)/tests.sh server-link-test who-test: tests.sh rm -f who-test ln -s $(srcdir)/tests.sh who-test whois-test: tests.sh rm -f whois-test ln -s $(srcdir)/tests.sh whois-test TESTS = start-server1 \ connect-test \ start-server2 \ channel-test \ invite-test \ join-test \ kick-test \ message-test \ misc-test \ mode-test \ opless-channel-test \ who-test \ whois-test \ server-link-test \ stop-server2 \ stress-server.sh \ stop-server1 # -eof- ngircd-21/src/testsuite/stress-A.e0000644000175000116100000000023111000116207014130 00000000000000# $Id: stress-A.e,v 1.2 2005/08/12 21:35:12 alex Exp $ set timeout 30 spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } # -eof- ngircd-21/src/testsuite/wait-tests.sh0000754000175000116100000000207211000116207014730 00000000000000#!/bin/sh # # ngIRCd Test Suite # Copyright (c)2002-2004 by Alexander Barton (alex@barton.de) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # Please read the file COPYING, README and AUTHORS for more information. # # $Id: wait-tests.sh,v 1.5 2005/08/12 21:34:19 alex Exp $ # [ "$1" -gt 0 ] 2> /dev/null && MAX="$1" || MAX=5 # detect source directory [ -z "$srcdir" ] && srcdir=`dirname $0` PS_FLAGS="-f" ps $PS_FLAGS >/dev/null 2>&1 [ $? -ne 0 ] && PS_FLAGS="a" # read in functions . ${srcdir}/functions.inc msg=0 while true; do count=`ps $PS_FLAGS | grep "expect " | wc -l` count=`expr $count - 1` [ $count -le $MAX ] && break if [ $msg -lt 1 ]; then echo_n " waiting for processes to settle: " msg=1 fi # there are still clients connected. Wait ... echo_n "$count>$MAX " sleep 1 done [ $msg -gt 0 ] && echo "done: $count" exit 0 # -eof- ngircd-21/src/testsuite/message-test.e0000644000175000116100000000430512206130744015051 00000000000000spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "nick nick\r" send "user user . . :User\r" expect { timeout { exit 1 } "376" } send "privmsg nick :test\r" expect { timeout { exit 1 } "@* PRIVMSG nick :test" } send "privmsg nick\r" expect { timeout { exit 1 } "412" } send "privmsg\r" expect { timeout { exit 1 } "411" } send "privmsg nick,nick :test\r" expect { timeout { exit 1 } "@* PRIVMSG nick :test\r*@* PRIVMSG nick :test" } send "privmsg Nick,#testChannel,nick :test\r" expect { timeout { exit 1 } "@* PRIVMSG nick :test\r*401*@* PRIVMSG nick :test" } send "privmsg doesnotexist :test\r" expect { timeout { exit 1 } "401" } send "privmsg ~UsEr@ngIRCd.Test.Server :test\r" expect { timeout { exit 1 } "@* PRIVMSG nick :test" } send "mode nick +b\r" expect { timeout { exit 1 } "MODE nick :+b" } send "privmsg nick :test\r" expect { timeout { exit 1 } "486" } send "mode nick -b\r" expect { timeout { exit 1 } "MODE nick :-b" } # The following two tests using "localhost" as host name # had to be disabled, because there are operating systems # out there, that use "localhost." as host name # for 127.0.0.1 instead of just "localhost". # (for example OpenBSD 4, OpenSolaris, ...) # #send "privmsg ~user\%localhost :test\r" #expect { # timeout { exit 1 } # "@* PRIVMSG nick :test" #} # #send "privmsg Nick!~User@LocalHost :test\r" #expect { # timeout { exit 1 } # "@* PRIVMSG nick :test" # "401" #} send "away :away\r" expect { timeout { exit 1 } "306" } send "privmsg nick :test\r" expect { timeout { exit 1 } "301" } send "away\r" expect { timeout { exit 1 } "305" } send "privmsg \$ngircd.test.server :test\r" expect { timeout { exit 1 } "481" } send "privmsg #*.de :test\r" expect { timeout { exit 1 } "481" } send "oper TestOp 123\r" send "privmsg \$ngircd.test.server :test\r" expect { timeout { exit 1 } "@* PRIVMSG nick :test" } send "privmsg \$*.test*.server :test\r" expect { timeout { exit 1 } "@* PRIVMSG nick :test" } send "privmsg \$noDotServer :test\r" expect { timeout { exit 1 } "401" } #cannot test host mask since localhost has no '.' as RFC requires send "quit\r" expect { timeout { exit 1 } "Connection closed" } # -eof- ngircd-21/src/testsuite/ngircd-test2.conf0000644000175000116100000000077512206130744015465 00000000000000# ngIRCd test suite # configuration file for test server #2 [Global] Name = ngircd.test.server2 Info = ngIRCd Test-Server 2 Listen = 127.0.0.1 Ports = 6790 MotdFile = ngircd-test2.motd AdminEMail = admin@irc.server2 [Limits] MaxConnectionsIP = 0 MaxJoins = 4 [Options] OperCanUseMode = yes Ident = no IncludeDir = /var/empty PAM = no [Operator] Name = TestOp Password = 123 [Server] Name = ngircd.test.server Host = 127.0.0.1 Port = 6789 MyPassword = pwd2 PeerPassword = pwd1 # -eof- ngircd-21/src/testsuite/stop-server.sh0000754000175000116100000000111612206130744015126 00000000000000#!/bin/sh # ngIRCd Test Suite [ -z "$srcdir" ] && srcdir=`dirname $0` # read in functions . ${srcdir}/functions.inc if [ -n "$1" ]; then id="$1"; shift else id="1" fi echo_n "stopping server ${id} ..." # stop test-server ... pid=`./getpid.sh T-ngircd${id}` if [ -z "$pid" ]; then echo " failure: no running server found!?" exit 1 fi kill $pid > /dev/null 2>&1 || exit 1 # waiting ... for i in 1 2 3 4 5; do kill -0 $pid > /dev/null 2>&1; r=$? if [ $r -ne 0 ]; then echo " ok". exit 0 fi sleep 1 done echo " failure: server ${id} still running!?" exit 1 # -eof- ngircd-21/src/testsuite/stop-server20000754000175000116100000000015311130147557014604 00000000000000#!/bin/sh # ngIRCd Test Suite [ -z "$srcdir" ] && srcdir=`dirname $0` ${srcdir}/stop-server.sh 2 # -eof- ngircd-21/src/testsuite/opless-channel-test.e0000644000175000116100000000066411130147557016351 00000000000000spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "nick nick\r" send "user user . . :User\r" expect { timeout { exit 1 } "376" } send "JOIN +Channel\r" expect { timeout { exit 1 } "@* JOIN :+Channel" } send "mode +Channel +t\r" expect { timeout { exit 1 } "477" } send "quit\r" expect { timeout { exit 1 } "Connection closed" } # -eof- ngircd-21/src/testsuite/join-test.e0000644000175000116100000000162511130147557014373 00000000000000spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "nick nick\r" send "user user . . :User\r" expect { timeout { exit 1 } "376" } send "JOIN\r" expect { timeout { exit 1} "461" } send "JOIN #InviteChannel\r" expect { timeout { exit 1 } "473" } send "JOIN #FullKeyed\r" expect { timeout { exit 1 } "475" } send "JOIN #FullKeyed WrongKey\r" expect { timeout { exit 1 } "475" } send "JOIN #FullKeyed Secret\r" expect { timeout { exit 1 } "471" } send "JOIN #TopicChannel\r" expect { timeout { exit 1 } "@* JOIN :#TopicChannel" } expect { timeout { exit 1 } "332" } send "JOIN 0\r" send "JOIN #1,#2,#3,#4\r" send "JOIN #5\r" expect { timeout { exit 1 } "405" } send "quit\r" expect { timeout { exit 1 } "Connection closed" } # -eof- ngircd-21/src/testsuite/test-loop.sh0000754000175000116100000000173211000116207014554 00000000000000#!/bin/sh # # ngIRCd Test Suite # Copyright (c)2002-2004 by Alexander Barton (alex@barton.de) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # Please read the file COPYING, README and AUTHORS for more information. # # $Id: test-loop.sh,v 1.2 2004/09/04 19:14:46 alex Exp $ # # detect source directory [ -z "$srcdir" ] && srcdir=`dirname $0` # parse command line [ "$1" -gt 0 ] 2> /dev/null && LOOPS="$1" || LOOPS=5 [ "$2" -gt 0 ] 2> /dev/null && WAIT="$2" || WAIT=5 loop=0 while [ ${loop} -lt $LOOPS ]; do loop=`expr ${loop} + 1` echo " loop $loop/$LOOPS starting:" for s in $srcdir/*-test; do sh $s; r=$? [ $r -ne 0 ] && exit $r sleep 1 done if [ ${loop} -lt $LOOPS ]; then echo " waiting $WAIT seconds ..." sleep $WAIT fi done # -eof- ngircd-21/src/testsuite/server-link-test.e0000644000175000116100000000141011130147557015665 00000000000000# ngIRCd test suite # server-server link test spawn telnet localhost 6790 expect { timeout { exit 1 } "Connected" } send "nick nick\r" send "user user . . :User\r" expect { timeout { exit 1 } "376" } send "version ngircd.test.server2\r" expect { timeout { exit 1 } ":ngircd.test.server2 351" } send "version ngircd.test.server\r" expect { timeout { exit 1 } ":ngircd.test.server 351" } send "whois ngircd.test.server nick\r" expect { timeout { exit 1 } ":ngircd.test.server 318" } send "admin ngircd.test.server\r" expect { timeout { exit 1 } ":ngircd.test.server 259 nick :admin@irc.server" } send "links\r" expect { timeout { exit 1 } "364 nick ngircd.test.server ngircd.test.server2 :1" } send "quit\r" expect { timeout { exit 1 } "ERROR" } # -eof- ngircd-21/src/testsuite/stop-server10000754000175000116100000000015311130147557014603 00000000000000#!/bin/sh # ngIRCd Test Suite [ -z "$srcdir" ] && srcdir=`dirname $0` ${srcdir}/stop-server.sh 1 # -eof- ngircd-21/src/testsuite/stress-server.sh0000754000175000116100000000414112206130744015465 00000000000000#!/bin/sh # # ngIRCd Test Suite # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. # # 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. # # detect source directory [ -z "$srcdir" ] && srcdir=`dirname $0` # parse command line [ "$1" -gt 0 ] 2> /dev/null && CLIENTS="$1" || CLIENTS=5 [ "$2" -gt 0 ] 2> /dev/null && MAX="$2" || MAX=-1 # get our name name=`basename $0` # create directories [ -d logs ] || mkdir logs [ -d tests ] || mkdir tests # test for required external tools type expect > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "${name}: \"expect\" not found."; exit 77 fi type telnet > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "${name}: \"telnet\" not found."; exit 77 fi # hello world! :-) echo "stressing server with $CLIENTS clients (be patient!):" # read in functions . ${srcdir}/functions.inc # create scripts for expect(1) no=0 while [ ${no} -lt $CLIENTS ]; do cat ${srcdir}/stress-A.e > tests/${no}.e echo "send \"nick test${no}\\r\"" >> tests/${no}.e cat ${srcdir}/stress-B.e >> tests/${no}.e no=`expr ${no} + 1` done # run first script and check if it succeeds echo_n "checking stress script ..." expect tests/0.e > logs/stress-0.log 2> /dev/null if [ $? -ne 0 ]; then echo " failure!" exit 1 else echo " ok." fi no=0 while [ ${no} -lt $CLIENTS ]; do expect tests/${no}.e > logs/stress-${no}.log 2> /dev/null & no=`expr ${no} + 1` echo "started client $no/$CLIENTS." [ $MAX -gt 0 ] && $srcdir/wait-tests.sh $MAX done echo_n "waiting for clients to complete: ." touch logs/check-idle.log while true; do expect ${srcdir}/check-idle.e >> logs/check-idle.log; res=$? echo "====================" >> logs/check-idle.log [ $res -ne 99 ] && break # there are still clients connected. Wait ... sleep 3 echo_n "." done [ $res -eq 0 ] && echo " ok." || echo " failure!" exit $res # -eof- ngircd-21/src/testsuite/who-test.e0000644000175000116100000000667411677604467014260 00000000000000spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "nick nick\r" send "user user . . :Real Name\r" expect { timeout { exit 1 } "376" } send "who\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick \* * * ngircd.test.server nick H :0 Real Name" } send "who 0\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick \* * * ngircd.test.server nick H :0 Real Name" } send "away :testing\r" expect { timeout { exit 1 } "306 nick" } send "who *\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick \* * * ngircd.test.server nick G :0 Real Name" } send "join #channel\r" expect { timeout { exit 1 } "@* JOIN :#channel" } send "who #channel\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick #channel * * ngircd.test.server nick G@ :0 Real Name" } send "mode #channel +v nick\r" expect { timeout { exit 1 } "@* MODE #channel +v nick\r" } send "who #channel\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick #channel * * ngircd.test.server nick G@ :0 Real Name" } send "who localhos*\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick \* * * ngircd.test.server nick G :0 Real Name" } send "mode #channel -o nick\r" expect { timeout { exit 1 } "@* MODE #channel -o nick\r" } send "who #channel\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick #channel * * ngircd.test.server nick G+ :0 Real Name" } send "who ngircd.test.server\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick \* * * ngircd.test.server nick G :0 Real Name" } send "part #channel\r" expect { timeout { exit 1 } "@* PART #channel :nick" } send "who Real?Name\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick \* * * ngircd.test.server nick G :0 Real Name" } send "oper TestOp 123\r" expect { timeout { exit 1 } "MODE nick :+o" } expect { timeout { exit 1 } "381 nick" } send "who 0 o\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick \* * * ngircd.test.server nick G* :0 Real Name" } send "away\r" expect { timeout { exit 1 } "305 nick" } send "who ??cal*ho*\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick \* * * ngircd.test.server nick H* :0 Real Name" } send "join #opers\r" expect { timeout { exit 1 } "@* JOIN :#opers" } send "who #opers\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick #opers * * ngircd.test.server nick H*@ :0 Real Name" } send "who Re*me\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick \* * * ngircd.test.server nick H* :0 Real Name" } send "mode #opers -o nick\r" expect { timeout { exit 1 } "@* MODE #opers -o nick\r" } send "who #opers\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick #opers * * ngircd.test.server nick H* :0 Real Name" } send "who *.server\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick \* * * ngircd.test.server nick H* :0 Real Name" } send "mode #opers +v nick\r" expect { timeout { exit 1 } "@* MODE #opers +v nick\r" } send "who #opers\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick #opers * * ngircd.test.server nick H*+ :0 Real Name" } send "mode #opers +s\r" expect { timeout { exit 1 } "@* MODE #opers +s\r" } send "who n?c?\r" expect { timeout { exit 1 } ":ngircd.test.server 352 nick \* * ngircd.test.server nick H* :0 Real Name" } expect { timeout { exit 1 } "315" } send "who #SecretChannel\r" expect { timeout { exit 1 } "315" } send "quit\r" expect { timeout { exit 1 } "Connection closed" } # -eof- ngircd-21/src/testsuite/stress-B.e0000644000175000116100000000160411000116207014136 00000000000000# $Id: stress-B.e,v 1.3 2005/12/30 22:12:28 alex Exp $ send "user user . . :User\r" expect { timeout { exit 1 } " 376" } sleep 2 send "oper TestOp 123\r" expect { timeout { exit 1 } "MODE test* :+o" } expect { timeout { exit 1 } " 381 test" } sleep 2 send "join #channel\r" expect { timeout { exit 1 } " 353 * = #channel " } expect { timeout { exit 1 } " 366 * #channel :" } send "mode #channel\r" expect { timeout { exit 1 } " 324 test* #channel" } send "join #channel2\r" expect { timeout { exit 1 } " 353 * = #channel2 " } expect { timeout { exit 1 } " 366 * #channel2 :" } send "names\r" expect { timeout { exit 1 } " 366 " } sleep 3 send "part #channel2\r" expect { timeout { exit 1 } " PART #channel2 " } send "part #channel\r" expect { timeout { exit 1 } " PART #channel " } sleep 1 send "quit\r" expect { timeout { exit 1 } "Connection closed" } # -eof- ngircd-21/src/testsuite/getpid.sh0000754000175000116100000000221212211434662014111 00000000000000#!/bin/sh # ngIRCd Test Suite # did we get a name? [ $# -ne 1 ] && exit 1 [ -x /bin/pidof ] && exec /bin/pidof -s $@ # detect flags for "ps" and "head" UNAME=`uname` if [ $UNAME = "FreeBSD" ]; then PS_FLAGS="-a"; PS_PIDCOL="1"; HEAD_FLAGS="-n 1" elif [ $UNAME = "A/UX" ]; then PS_FLAGS="-af"; PS_PIDCOL="2"; HEAD_FLAGS="-1" elif [ $UNAME = "GNU" ]; then PS_FLAGS="-ax"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1" elif [ $UNAME = "Linux" ]; then PS_FLAGS="ax"; PS_PIDCOL="1"; HEAD_FLAGS="-n 1" elif [ $UNAME = "SunOS" ]; then PS_FLAGS="-af"; PS_PIDCOL=2; HEAD_FLAGS="-n 1" else PS_FLAGS="-af"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1" ps $PS_FLAGS > /dev/null 2>&1 if [ $? -ne 0 ]; then PS_FLAGS="a"; PS_PIDCOL="1"; fi fi # debug output #echo "$0: UNAME=$UNAME" #echo "$0: PS_FLAGS=$PS_FLAGS" #echo "$0: PS_PIDCOL=$PS_PIDCOL" #echo "$0: HEAD_FLAGS=$HEAD_FLAGS" # search PID ps $PS_FLAGS > procs.tmp cat procs.tmp | \ grep -v "$0" | grep "$1" | \ awk "{print \$$PS_PIDCOL}" | \ sort -n > pids.tmp pid=`head $HEAD_FLAGS pids.tmp` rm -rf procs.tmp pids.tmp # validate PID [ "$pid" -gt 1 ] > /dev/null 2>&1 [ $? -ne 0 ] && exit 1 echo $pid exit 0 # -eof- ngircd-21/src/testsuite/whois-test.e0000644000175000116100000000224612206130744014560 00000000000000# ngIRCd test suite # WHOIS test spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "nick nick\r" send "user user . . :Real Name\r" expect { timeout { exit 1 } "376" } send "whois nick\r" expect { timeout { exit 1 } "311 nick nick ~user localhost* \* :Real Name\r" } expect { timeout { exit 1 } "318 nick nick :" } send "whois *\r" expect { timeout { exit 1 } "311 nick nick ~user localhost* \* :Real Name\r" } send "whois n*\r" expect { timeout { exit 1 } "311 nick nick ~user localhost* \* :Real Name\r" } send "whois ?ick\r" expect { timeout { exit 1 } "311 nick nick ~user localhost* \* :Real Name\r" } send "whois ????,n?*k\r" expect { timeout { exit 1 } "311 nick nick ~user localhost* \* :Real Name\r" } send "whois unknown\r" expect { timeout { exit 1 } "401 nick unknown :" } expect { timeout { exit 1 } "318 nick unknown :" } send "whois ngircd.test.server2 nick\r" expect { timeout { exit 1 } ":ngircd.test.server2 311 nick nick ~user localhost* \* :Real Name\r" } send "whois nosuchserver unknown\r" expect { timeout { exit 1 } "402 nick nosuchserver :" } send "quit\r" expect { timeout { exit 1 } "ERROR" } # -eof- ngircd-21/src/testsuite/invite-test.e0000644000175000116100000000330511130147557014727 00000000000000spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "nick nick\r" send "user user . . :User\r" expect { timeout { exit 1 } "376" } send "invite\r" expect { timeout { exit 1 } "461" } send "invite nick\r" expect { timeout { exit 1 } "461" } send "invite nick #channel\r" expect { timeout { exit 1 } -re "INVITE nick :?#channel" } expect { timeout { exit 1 } -re "341 nick nick :?#channel" } send "invite nosuchnic #TopicChannel\r" expect { timeout { exit 1 } "401 nick nosuchnic :No such nick or channel name" } send "invite nick #TopicChannel\r" expect { timeout { exit 1 } "442 nick #TopicChannel :You are not on that channel" } send "join #channel\r" expect { timeout { exit 1 } -re "JOIN :?#channel" } send "invite nick #channel\r" expect { timeout { exit 1 } "443 nick nick #channel :is already on channel" } send "mode #channel +i\r" expect { timeout { exit 1 } "MODE #channel +i" } send "mode #channel -o nick\r" expect { timeout { exit 1 } "MODE #channel -o nick" } send "invite nick #channel\r" expect { timeout { exit 1 } "482 nick #channel :You are not channel operator" #it would be reasonable to expect 443 here instead } send "part #channel\r" expect { timeout { exit 1} -re "PART #channel :?nick" } send "invite nick :parameter with spaces\r" expect { timeout { exit 1 } "INVITE nick :parameter with spaces" } expect { timeout { exit 1 } "341 nick nick :parameter with spaces" } send "away message\r" expect { timeout { exit 1 } "306 nick :You have been marked as being away" } send "INVITE nick #channel\r" expect { timeout { exit 1 } -re "301 nick nick :?message" } send "quit\r" expect { timeout { exit 1 } "Connection closed" } # -eof- ngircd-21/src/testsuite/channel-test.e0000644000175000116100000000257511000116207015031 00000000000000# $Id: channel-test.e,v 1.4 2008/02/05 13:31:51 fw Exp $ spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "nick nick\r" send "user user . . :User\r" expect { timeout { exit 1 } "376" } send "join #channel\r" expect { timeout { exit 1 } "@* JOIN :#channel" } expect { timeout { exit 1 } "366" } send "topic #channel :Test-Topic\r" expect { timeout { exit 1 } "@* TOPIC #channel :Test-Topic" } send "who #channel\r" expect { timeout { exit 1 } "352 nick #channel" } expect { timeout { exit 1 } "* nick H@ :0 User" } expect { timeout { exit 1 } "315 nick #channel" } send "names #channel\r" expect { timeout { exit 1 } "353 nick = #channel :@nick" } expect { timeout { exit 1 } "366 nick #channel" } send "list\r" expect { timeout { exit 1 } "322 nick #channel 1 :Test-Topic" } expect { timeout { exit 1 } "323 nick :End of LIST" } send "part #channel\r" expect { timeout { exit 1 } "@* PART #channel :nick" } send "join #channel\r" expect { timeout { exit 1 } "@* JOIN :#channel" } expect { timeout { exit 1 } "366" } send "join #channel2\r" expect { timeout { exit 1 } "@* JOIN :#channel2" } expect { timeout { exit 1 } "366" } send "join 0\r" expect { timeout { exit 1 } "@* PART #channel2 :nick" } expect { timeout { exit 1 } "@* PART #channel :nick" } send "quit\r" expect { timeout { exit 1 } "Connection closed" } # -eof- ngircd-21/src/testsuite/connect-test.e0000644000175000116100000000040511000116207015040 00000000000000# $Id: connect-test.e,v 1.1 2002/09/09 10:16:24 alex Exp $ spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "oper\r" expect { timeout { exit 1 } "451" } send "quit\r" expect { timeout { exit 1 } "Connection closed" } # -eof- ngircd-21/src/testsuite/tests.sh0000754000175000116100000000245112206130744014002 00000000000000#!/bin/sh # # ngIRCd Test Suite # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. # # 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. # # detect source directory [ -z "$srcdir" ] && srcdir=`dirname $0` name=`basename $0` test=`echo ${name} | cut -d '.' -f 1` [ -d logs ] || mkdir logs if [ ! -r "$test" ]; then echo "${name}: test \"$test\" not found!"; exit 77 exit 1 fi # read in functions . ${srcdir}/functions.inc type expect > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "${name}: \"expect\" not found."; exit 77 fi type telnet > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "${name}: \"telnet\" not found."; exit 77 fi # prepare expect script e_in="${srcdir}/${test}.e" e_tmp="${test}.e_" e_exec="$e_in" if test -t 1 2>/dev/null; then sed -e 's|^expect |puts -nonewline stderr "."; expect |g' \ "$e_in" >"$e_tmp" [ $? -eq 0 ] && e_exec="$e_tmp" fi echo_n "running ${test} ..." expect "$e_exec" > logs/${test}.log; r=$? [ $r -eq 0 ] && echo " ok." || echo " failure!" rm -f "$e_tmp" exit $r # -eof- ngircd-21/src/testsuite/README0000644000175000116100000000611612206130744013164 00000000000000 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. -- README for the Test Suite -- I. Overview ~~~~~~~~~~~ The purpose of the "test suite" contained in this directory is to detect bugs and incompatibilities in ngIRCd introduced during coding and after building ngIRCd on a specific platform. To run the "standard" tests call "make check" (which runs "make check" in all the source directories, testing the "portab" library as well for example) or "make testsuite" (which only runs the tests in this directory). Both will build ngIRCd (if required) and run some tests on it. These tests should be portable and run on all supported platforms without errors. NOTE #1: most tests of this suite depend on the external tools expect(1) and telnet(1), so make sure you have them installed. If not, the tests will not fail but simply be skipped. NOTE #2: the two test servers started by this test suite are configured to run on port 6789 and 6790; so it will fail if one or both of these ports are already used by some other daemons! II. Shell Scripts ~~~~~~~~~~~~~~~~ getpid.sh This script is used to detect the PID of the running process with the given name in a portable manner. The result is echoed on the console. It is a helper script for some other scripts of this suite. start-server.sh [] start-server.sh starts up the test binary, "T-ngircd" (the default for is 1) with configuration file "ngircd-test.conf" and the console output redirected to "ngircd-test.log". The script first makes sure that getpid.sh is available and working, and that no other instance of the test binary is already running. The exit code is 0 if the test binary could be started. stop-server.sha [] This script uses getpid.sh to detect a running test binary "T-ngircd" and then shuts it down using the TERM signal. The exit code is 0 if the test binary could be stopped. stress-server.sh [ []] stress-server.sh starts clients that "stress" the running test server (id 1); but no more than clients are started at the same moment. tests.sh Most of the tests scripts are symlinked to tests.sh, which in turn uses expect(1) to run the respective script .e and checks its exit code. test-loop.sh [ []] This script runs all the tests times (default: 5) and pauses seconds (default: 5) betweed runs. It isn't used by "make check" or "make testsuite". wait-tests.sh [] stress-server.sh uses this script to ensure that no more than clients are connected to the test server (id 1). III. Scripts for expect(1) ~~~~~~~~~~~~~~~~~~~~~~~~~~ channel-test.e check-idle.e connect-test.e invite-test.e join-test.e kick-test.e message-test.e misc-test.e mode-test.e opless-channel-test.e server-link-test.e stress-A.e stress-B.e who-test.e whois-test.e ngircd-21/src/testsuite/check-idle.e0000644000175000116100000000102111000116207014415 00000000000000# $Id: check-idle.e,v 1.2 2004/09/04 14:22:13 alex Exp $ spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "nick IdleTest\r" send "user idle . . :Idle-Test\r" expect { timeout { exit 1 } "433 * IdleTest :Nickname already in use" { exit 99 } "376" } send "lusers\r" expect { timeout { exit 1 } "251 IdleTest :There are 1 users and 0 services on 1 servers" { set r 0 } "251 IdleTest :There are" { set r 99 } } send "quit\r" expect { timeout { exit 1 } "Connection closed" } exit $r # -eof- ngircd-21/src/testsuite/mode-test.e0000644000175000116100000000462412206130744014355 00000000000000# $Id: mode-test.e,v 1.7 2008/02/16 11:27:49 fw Exp $ spawn telnet localhost 6789 expect { timeout { exit 1 } "Connected" } send "nick nick\r" send "user user . . :User\r" expect { timeout { exit 1 } "376" } send "mode nick +i\r" expect { timeout { exit 1 } "@* MODE nick :+i" } send "mode nick\r" expect { timeout { exit 1 } "221 nick +i" } send "mode nick -i\r" expect { timeout { exit 1 } "@* MODE nick :-i" } send "join #usermode\r" expect { timeout { exit 1 } "@* JOIN :#usermode" } expect { timeout { exit 1 } "366" } send "mode #usermode +v nick\r" expect { timeout { exit 1 } "@* MODE #usermode +v nick\r" } send "mode #usermode +h nick\r" expect { timeout { exit 1 } "@* MODE #usermode +h nick\r" } send "mode #usermode +a nick\r" expect { timeout { exit 1 } "482 nick" } send "mode #usermode +q nick\r" expect { timeout { exit 1 } "482 nick" } send "mode #usermode -vho nick nick nick\r" expect { timeout { exit 1 } "@* MODE #usermode -vho nick nick nick" } send "oper TestOp 123\r" expect { timeout { exit 1 } "MODE nick :+o" } expect { timeout { exit 1 } "381 nick" } send "mode nick\r" expect { timeout { exit 1 } "221 nick +o" } send "mode #usermode +a nick\r" expect { timeout { exit 1 } "@* MODE #usermode +a nick" } send "mode #usermode +q nick\r" expect { timeout { exit 1 } "@* MODE #usermode +q nick" } send "names #usermode\r" expect { timeout { exit 1 } "353 nick = #usermode :~nick" } expect { timeout { exit 1 } "366 nick #usermode" } send "part #usermode\r" expect { timeout { exit 1 } "@* PART #usermode" } send "join #channel\r" expect { timeout { exit 1 } "@* JOIN :#channel" } expect { timeout { exit 1 } "366" } send "mode #channel +tn\r" expect { timeout { exit 1 } "@* MODE #channel +tn" } send "mode #channel\r" expect { timeout { exit 1 } "324 nick #channel +tn" } send "mode #channel +v nick\r" expect { timeout { exit 1 } "@* MODE #channel +v nick\r" } send "mode #channel +I nick1\r" expect { timeout { exit 1 } "@* MODE #channel +I nick1!*@*" } send "mode #channel +b nick2@domain\r" expect { timeout { exit 1 } "@* MODE #channel +b nick2!*@domain" } send "mode #channel +I nick3!user\r" expect { timeout { exit 1 } "@* MODE #channel +I nick3!user@*" } send "mode #channel -vo nick nick\r" expect { timeout { exit 1 } "@* MODE #channel -vo nick nick\r" } send "quit\r" expect { timeout { exit 1 } "Connection closed" } # -eof- ngircd-21/src/ngircd/0000755000175000116100000000000012234274326011603 500000000000000ngircd-21/src/ngircd/hash.c0000644000175000116100000000675012230312353012607 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2010 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. */ #include "portab.h" /** * @file * Hash calculation */ #include "imp.h" #include #include #include "defines.h" #include "tool.h" #include "exp.h" #include "hash.h" static UINT32 jenkins_hash PARAMS((UINT8 *k, UINT32 length, UINT32 initval)); /** * Calculate hash value for a given string. * * @param String Input string * @return 32 bit hash value */ GLOBAL UINT32 Hash( const char *String ) { char buffer[COMMAND_LEN]; strlcpy(buffer, String, sizeof(buffer)); return jenkins_hash((UINT8 *)ngt_LowerStr(buffer), (UINT32)strlen(buffer), 42); } /* Hash */ /* * This hash function originates from lookup3.c of Bob Jenkins * (URL: ): * -------------------------------------------------------------------- * lookup3.c, by Bob Jenkins, May 2006, Public Domain. * These are functions for producing 32-bit hashes for hash table lookup. * hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final() * are externally useful functions. Routines to test the hash are included * if SELF_TEST is defined. You can use this free for any purpose. It's in * the public domain. It has no warranty. * -------------------------------------------------------------------- * Not all of his functions are used here. */ #define hashsize(n) ((UINT32)1<<(n)) #define hashmask(n) (hashsize(n)-1) #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) #define mix(a,b,c) \ { \ a -= c; a ^= rot(c, 4); c += b; \ b -= a; b ^= rot(a, 6); a += c; \ c -= b; c ^= rot(b, 8); b += a; \ a -= c; a ^= rot(c,16); c += b; \ b -= a; b ^= rot(a,19); a += c; \ c -= b; c ^= rot(b, 4); b += a; \ } /* mix */ #define final(a,b,c) \ { \ c ^= b; c -= rot(b,14); \ a ^= c; a -= rot(c,11); \ b ^= a; b -= rot(a,25); \ c ^= b; c -= rot(b,16); \ a ^= c; a -= rot(c,4); \ b ^= a; b -= rot(a,14); \ c ^= b; c -= rot(b,24); \ } static UINT32 jenkins_hash(UINT8 *k, UINT32 length, UINT32 initval) { /* k: the key * length: length of the key * initval: the previous hash, or an arbitrary value */ UINT32 a,b,c; /* Set up the internal state */ a = b = c = 0xdeadbeef + length + initval; /* handle most of the key */ while (length > 12) { a += (k[0] +((UINT32)k[1]<<8) +((UINT32)k[2]<<16) +((UINT32)k[3]<<24)); b += (k[4] +((UINT32)k[5]<<8) +((UINT32)k[6]<<16) +((UINT32)k[7]<<24)); c += (k[8] +((UINT32)k[9]<<8) +((UINT32)k[10]<<16)+((UINT32)k[11]<<24)); mix(a,b,c); length -= 12; k += 12; } /*-------------------------------- last block: affect all 32 bits of (c) */ switch(length) /* all the case statements fall through */ { case 12: c+=((UINT32)k[11])<<24; case 11: c+=((UINT32)k[10]<<16); case 10: c+=((UINT32)k[9]<<8); case 9 : c+=k[8]; case 8 : b+=((UINT32)k[7]<<24); case 7 : b+=((UINT32)k[6]<<16); case 6 : b+=((UINT32)k[5]<<8); case 5 : b+=k[4]; case 4 : a+=((UINT32)k[3]<<24); case 3 : a+=((UINT32)k[2]<<16); case 2 : a+=((UINT32)k[1]<<8); case 1 : a+=k[0]; break; case 0 : return c; } final(a,b,c); return c; } /* jenkins_hash */ /* -eof- */ ngircd-21/src/ngircd/irc-mode.c0000644000175000116100000007352612221142771013375 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * IRC commands for mode changes (like MODE, AWAY, etc.) */ #include "imp.h" #include #include #include #include #include "defines.h" #include "conn.h" #include "channel.h" #include "irc-macros.h" #include "irc-write.h" #include "lists.h" #include "log.h" #include "parse.h" #include "messages.h" #include "conf.h" #include "exp.h" #include "irc-mode.h" static bool Client_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target)); static bool Channel_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)); static bool Add_To_List PARAMS((char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, const char *Pattern)); static bool Del_From_List PARAMS((char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, const char *Pattern)); static bool Send_ListChange PARAMS((const bool IsAdd, const char ModeChar, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, const char *Mask)); /** * Handler for the IRC "MODE" command. * * This function detects whether user or channel modes should be modified * and calls the appropriate sub-functions. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_MODE( CLIENT *Client, REQUEST *Req ) { CLIENT *cl, *origin; CHANNEL *chan; assert(Client != NULL); assert(Req != NULL); _IRC_GET_SENDER_OR_RETURN_(origin, Req, Client) /* Channel or user mode? */ cl = NULL; chan = NULL; if (Client_IsValidNick(Req->argv[0])) cl = Client_Search(Req->argv[0]); if (Channel_IsValidName(Req->argv[0])) chan = Channel_Search(Req->argv[0]); if (cl) return Client_Mode(Client, Req, origin, cl); if (chan) return Channel_Mode(Client, Req, origin, chan); /* No target found! */ return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->argv[0]); } /* IRC_MODE */ /** * Check if the "mode limit" for a client has been reached. * * This limit doesn't apply for servers or services! * * @param Client The client to check. * @param Count The number of modes already handled. * @return true if the limit has been reached. */ static bool Mode_Limit_Reached(CLIENT *Client, int Count) { if (Client_Type(Client) == CLIENT_SERVER || Client_Type(Client) == CLIENT_SERVICE) return false; if (Count < MAX_HNDL_MODES_ARG) return false; return true; } /** * Handle client mode requests * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @param Origin The originator of the MODE command (prefix). * @param Target The target (client) of this MODE command. * @return CONNECTED or DISCONNECTED. */ static bool Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target ) { char the_modes[COMMAND_LEN], x[2], *mode_ptr; bool ok, set; bool send_RPL_HOSTHIDDEN_MSG = false; int mode_arg; size_t len; /* Is the client allowed to request or change the modes? */ if (Client_Type(Client) == CLIENT_USER) { /* Users are only allowed to manipulate their own modes! */ if (Target != Client) return IRC_WriteErrClient(Client, ERR_USERSDONTMATCH_MSG, Client_ID(Client)); } /* Mode request: let's answer it :-) */ if (Req->argc == 1) return IRC_WriteStrClient(Origin, RPL_UMODEIS_MSG, Client_ID(Target), Client_Modes(Target)); mode_arg = 1; mode_ptr = Req->argv[mode_arg]; /* Initial state: set or unset modes? */ if (*mode_ptr == '+') { set = true; strcpy(the_modes, "+"); } else if (*mode_ptr == '-') { set = false; strcpy(the_modes, "-"); } else return IRC_WriteErrClient(Origin, ERR_UMODEUNKNOWNFLAG_MSG, Client_ID(Origin)); x[1] = '\0'; ok = CONNECTED; while (mode_ptr) { mode_ptr++; if (!*mode_ptr) { /* Try next argument if there's any */ mode_arg++; if (mode_arg < Req->argc) mode_ptr = Req->argv[mode_arg]; else break; } switch(*mode_ptr) { case '+': case '-': if ((*mode_ptr == '+' && !set) || (*mode_ptr == '-' && set)) { /* Action modifier ("+"/"-") must be changed */ len = strlen(the_modes) - 1; if (the_modes[len] == '+' || the_modes[len] == '-') { /* Last character in the "result * string" was an "action", so just * overwrite it with the new action */ the_modes[len] = *mode_ptr; } else { /* Append new modifier character to * the resulting mode string */ x[0] = *mode_ptr; strlcat(the_modes, x, sizeof(the_modes)); } if (*mode_ptr == '+') set = true; else set = false; } continue; } /* Validate modes */ x[0] = '\0'; switch (*mode_ptr) { case 'b': /* Block private msgs */ case 'C': /* Only messages from clients sharing a channel */ case 'i': /* Invisible */ case 's': /* Server messages */ case 'w': /* Wallops messages */ x[0] = *mode_ptr; break; case 'a': /* Away */ if (Client_Type(Client) == CLIENT_SERVER) { x[0] = 'a'; Client_SetAway(Origin, DEFAULT_AWAY_MSG); } else ok = IRC_WriteErrClient(Origin, ERR_NOPRIVILEGES_MSG, Client_ID(Origin)); break; case 'B': /* Bot */ if (Client_HasMode(Client, 'r')) ok = IRC_WriteErrClient(Origin, ERR_RESTRICTED_MSG, Client_ID(Origin)); else x[0] = 'B'; break; case 'c': /* Receive connect notices */ case 'q': /* KICK-protected user */ /* (only settable by IRC operators!) */ if (!set || Client_Type(Client) == CLIENT_SERVER || Client_HasMode(Origin, 'o')) x[0] = *mode_ptr; else ok = IRC_WriteErrClient(Origin, ERR_NOPRIVILEGES_MSG, Client_ID(Origin)); break; case 'o': /* IRC operator (only unsettable!) */ if (!set || Client_Type(Client) == CLIENT_SERVER) { x[0] = 'o'; } else ok = IRC_WriteErrClient(Origin, ERR_NOPRIVILEGES_MSG, Client_ID(Origin)); break; case 'r': /* Restricted (only settable) */ if (set || Client_Type(Client) == CLIENT_SERVER) x[0] = 'r'; else ok = IRC_WriteErrClient(Origin, ERR_RESTRICTED_MSG, Client_ID(Origin)); break; case 'R': /* Registered (not [un]settable by clients) */ if (Client_Type(Client) == CLIENT_SERVER) x[0] = 'R'; else ok = IRC_WriteErrClient(Origin, ERR_NICKREGISTER_MSG, Client_ID(Origin)); break; case 'x': /* Cloak hostname */ if (Client_HasMode(Client, 'r')) ok = IRC_WriteErrClient(Origin, ERR_RESTRICTED_MSG, Client_ID(Origin)); else if (!set || Conf_CloakHostModeX[0] || Client_Type(Client) == CLIENT_SERVER || Client_HasMode(Origin, 'o')) { x[0] = 'x'; send_RPL_HOSTHIDDEN_MSG = true; } else ok = IRC_WriteErrClient(Origin, ERR_NOPRIVILEGES_MSG, Client_ID(Origin)); break; default: if (Client_Type(Client) != CLIENT_SERVER) { Log(LOG_DEBUG, "Unknown mode \"%c%c\" from \"%s\"!?", set ? '+' : '-', *mode_ptr, Client_ID(Origin)); ok = IRC_WriteErrClient(Origin, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID(Origin), set ? '+' : '-', *mode_ptr); x[0] = '\0'; } else { Log(LOG_DEBUG, "Handling unknown mode \"%c%c\" from \"%s\" for \"%s\" ...", set ? '+' : '-', *mode_ptr, Client_ID(Origin), Client_ID(Target)); x[0] = *mode_ptr; } } if (!ok) break; /* Is there a valid mode change? */ if (!x[0]) continue; if (set) { if (Client_ModeAdd(Target, x[0])) strlcat(the_modes, x, sizeof(the_modes)); } else { if (Client_ModeDel(Target, x[0])) strlcat(the_modes, x, sizeof(the_modes)); } } /* Are there changed modes? */ if (the_modes[1]) { /* Remove needless action modifier characters */ len = strlen(the_modes) - 1; if (the_modes[len] == '+' || the_modes[len] == '-') the_modes[len] = '\0'; if (Client_Type(Client) == CLIENT_SERVER) { /* Forward modes to other servers */ if (Client_Conn(Target) != NONE) { /* Remote server (service?) changed modes * for one of our clients. Inform it! */ IRC_WriteStrClientPrefix(Target, Origin, "MODE %s :%s", Client_ID(Target), the_modes); } IRC_WriteStrServersPrefix(Client, Origin, "MODE %s :%s", Client_ID(Target), the_modes); } else { /* Send reply to client and inform other servers */ ok = IRC_WriteStrClientPrefix(Client, Origin, "MODE %s :%s", Client_ID(Target), the_modes); IRC_WriteStrServersPrefix(Client, Origin, "MODE %s :%s", Client_ID(Target), the_modes); } if (send_RPL_HOSTHIDDEN_MSG && Client_Conn(Target) > NONE) { /* A new (cloaked) hostname must be announced */ IRC_WriteStrClientPrefix(Target, Origin, RPL_HOSTHIDDEN_MSG, Client_ID(Target), Client_HostnameDisplayed(Target)); } LogDebug("%s \"%s\": Mode change, now \"%s\".", Client_TypeText(Target), Client_Mask(Target), Client_Modes(Target)); } IRC_SetPenalty(Client, 1); return ok; } /* Client_Mode */ /* * Reply to a channel mode request. * * @param Origin The originator of the MODE command (prefix). * @param Channel The channel of which the modes should be sent. * @return CONNECTED or DISCONNECTED. */ static bool Channel_Mode_Answer_Request(CLIENT *Origin, CHANNEL *Channel) { char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], argadd[CLIENT_PASS_LEN]; const char *mode_ptr; /* Member or not? -- That's the question! */ if (!Channel_IsMemberOf(Channel, Origin)) return IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG, Client_ID(Origin), Channel_Name(Channel), Channel_Modes(Channel)); /* The sender is a member: generate extended reply */ strlcpy(the_modes, Channel_Modes(Channel), sizeof(the_modes)); mode_ptr = the_modes; the_args[0] = '\0'; while(*mode_ptr) { switch(*mode_ptr) { case 'l': snprintf(argadd, sizeof(argadd), " %lu", Channel_MaxUsers(Channel)); strlcat(the_args, argadd, sizeof(the_args)); break; case 'k': strlcat(the_args, " ", sizeof(the_args)); strlcat(the_args, Channel_Key(Channel), sizeof(the_args)); break; } mode_ptr++; } if (the_args[0]) strlcat(the_modes, the_args, sizeof(the_modes)); if (!IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG, Client_ID(Origin), Channel_Name(Channel), the_modes)) return DISCONNECTED; #ifndef STRICT_RFC if (!IRC_WriteStrClient(Origin, RPL_CREATIONTIME_MSG, Client_ID(Origin), Channel_Name(Channel), Channel_CreationTime(Channel))) return DISCONNECTED; #endif return CONNECTED; } /** * Handle channel mode and channel-user mode changes * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @param Origin The originator of the MODE command (prefix). * @param Channel The target channel of this MODE command. * @return CONNECTED or DISCONNECTED. */ static bool Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) { char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2], argadd[CLIENT_PASS_LEN], *mode_ptr; bool connected, set, skiponce, retval, use_servermode, is_halfop, is_op, is_admin, is_owner, is_machine, is_oper; int mode_arg, arg_arg, mode_arg_count = 0; CLIENT *client; long l; size_t len; is_halfop = is_op = is_admin = is_owner = is_machine = is_oper = false; if (Channel_IsModeless(Channel)) return IRC_WriteErrClient(Client, ERR_NOCHANMODES_MSG, Client_ID(Client), Channel_Name(Channel)); /* Mode request: let's answer it :-) */ if (Req->argc <= 1) return Channel_Mode_Answer_Request(Origin, Channel); /* Check if origin is oper and opers can use mode */ use_servermode = Conf_OperServerMode; if(Client_HasMode(Client, 'o') && Conf_OperCanMode) { is_oper = true; } /* Check if client is a server/service */ if(Client_Type(Client) == CLIENT_SERVER || Client_Type(Client) == CLIENT_SERVICE) { is_machine = true; } /* Check if client is member of channel or an oper or an server/service */ if(!Channel_IsMemberOf(Channel, Client) && !is_oper && !is_machine) return IRC_WriteErrClient(Origin, ERR_NOTONCHANNEL_MSG, Client_ID(Origin), Channel_Name(Channel)); mode_arg = 1; mode_ptr = Req->argv[mode_arg]; if (Req->argc > mode_arg + 1) arg_arg = mode_arg + 1; else arg_arg = -1; /* Initial state: set or unset modes? */ skiponce = false; switch (*mode_ptr) { case '-': set = false; break; case '+': set = true; break; default: set = true; skiponce = true; } /* Prepare reply string */ strcpy(the_modes, set ? "+" : "-"); the_args[0] = '\0'; x[1] = '\0'; connected = CONNECTED; while (mode_ptr) { if (!skiponce) mode_ptr++; if (!*mode_ptr) { /* Try next argument if there's any */ if (arg_arg < 0) break; if (arg_arg > mode_arg) mode_arg = arg_arg; else mode_arg++; if (mode_arg >= Req->argc) break; mode_ptr = Req->argv[mode_arg]; if (Req->argc > mode_arg + 1) arg_arg = mode_arg + 1; else arg_arg = -1; } skiponce = false; switch (*mode_ptr) { case '+': case '-': if (((*mode_ptr == '+') && !set) || ((*mode_ptr == '-') && set)) { /* Action modifier ("+"/"-") must be changed ... */ len = strlen(the_modes) - 1; if (the_modes[len] == '+' || the_modes[len] == '-') { /* Adjust last action modifier in result */ the_modes[len] = *mode_ptr; } else { /* Append modifier character to result string */ x[0] = *mode_ptr; strlcat(the_modes, x, sizeof(the_modes)); } set = *mode_ptr == '+'; } continue; } /* Are there arguments left? */ if (arg_arg >= Req->argc) arg_arg = -1; if(!is_machine && !is_oper) { if (Channel_UserHasMode(Channel, Client, 'q')) is_owner = true; if (Channel_UserHasMode(Channel, Client, 'a')) is_admin = true; if (Channel_UserHasMode(Channel, Client, 'o')) is_op = true; if (Channel_UserHasMode(Channel, Client, 'h')) is_halfop = true; } /* Validate modes */ x[0] = '\0'; argadd[0] = '\0'; client = NULL; switch (*mode_ptr) { /* --- Channel modes --- */ case 'R': /* Registered users only */ case 's': /* Secret channel */ case 'z': /* Secure connections only */ if(!is_oper && !is_machine && !is_owner && !is_admin && !is_op) { connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); goto chan_exit; } case 'i': /* Invite only */ case 'V': /* Invite disallow */ case 'M': /* Only identified nicks can write */ case 'm': /* Moderated */ case 'n': /* Only members can write */ case 'Q': /* No kicks */ case 't': /* Topic locked */ if(is_oper || is_machine || is_owner || is_admin || is_op || is_halfop) x[0] = *mode_ptr; else connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); break; case 'k': /* Channel key */ if (Mode_Limit_Reached(Client, mode_arg_count++)) goto chan_exit; if (!set) { if (is_oper || is_machine || is_owner || is_admin || is_op || is_halfop) x[0] = *mode_ptr; else connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); break; } if (arg_arg > mode_arg) { if (is_oper || is_machine || is_owner || is_admin || is_op || is_halfop) { Channel_ModeDel(Channel, 'k'); Channel_SetKey(Channel, Req->argv[arg_arg]); strlcpy(argadd, Channel_Key(Channel), sizeof(argadd)); x[0] = *mode_ptr; } else { connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); } Req->argv[arg_arg][0] = '\0'; arg_arg++; } else { #ifdef STRICT_RFC /* Only send error message in "strict" mode, * this is how ircd2.11 and others behave ... */ IRC_SetPenalty(Origin, 2); connected = IRC_WriteErrClient(Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID(Origin), Req->command); #endif goto chan_exit; } break; case 'l': /* Member limit */ if (Mode_Limit_Reached(Client, mode_arg_count++)) goto chan_exit; if (!set) { if (is_oper || is_machine || is_owner || is_admin || is_op || is_halfop) x[0] = *mode_ptr; else connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); break; } if (arg_arg > mode_arg) { if (is_oper || is_machine || is_owner || is_admin || is_op || is_halfop) { l = atol(Req->argv[arg_arg]); if (l > 0 && l < 0xFFFF) { Channel_ModeDel(Channel, 'l'); Channel_SetMaxUsers(Channel, l); snprintf(argadd, sizeof(argadd), "%ld", l); x[0] = *mode_ptr; } } else { connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); } Req->argv[arg_arg][0] = '\0'; arg_arg++; } else { #ifdef STRICT_RFC /* Only send error message in "strict" mode, * this is how ircd2.11 and others behave ... */ IRC_SetPenalty(Origin, 2); connected = IRC_WriteErrClient(Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID(Origin), Req->command); #endif goto chan_exit; } break; case 'O': /* IRC operators only */ if (set) { /* Only IRC operators are allowed to * set the 'O' channel mode! */ if(is_oper || is_machine) x[0] = 'O'; else connected = IRC_WriteErrClient(Origin, ERR_NOPRIVILEGES_MSG, Client_ID(Origin)); } else if(is_oper || is_machine || is_owner || is_admin || is_op) x[0] = 'O'; else connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); break; case 'P': /* Persistent channel */ if (set) { /* Only IRC operators are allowed to * set the 'P' channel mode! */ if(is_oper || is_machine) x[0] = 'P'; else connected = IRC_WriteErrClient(Origin, ERR_NOPRIVILEGES_MSG, Client_ID(Origin)); } else if(is_oper || is_machine || is_owner || is_admin || is_op) x[0] = 'P'; else connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); break; /* --- Channel user modes --- */ case 'q': /* Owner */ case 'a': /* Channel admin */ if(!is_oper && !is_machine && !is_owner && !is_admin) { connected = IRC_WriteErrClient(Origin, ERR_CHANOPPRIVTOOLOW_MSG, Client_ID(Origin), Channel_Name(Channel)); goto chan_exit; } case 'o': /* Channel operator */ if(!is_oper && !is_machine && !is_owner && !is_admin && !is_op) { connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); goto chan_exit; } case 'h': /* Half Op */ if(!is_oper && !is_machine && !is_owner && !is_admin && !is_op) { connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); goto chan_exit; } case 'v': /* Voice */ if (arg_arg > mode_arg) { if (is_oper || is_machine || is_owner || is_admin || is_op || is_halfop) { client = Client_Search(Req->argv[arg_arg]); if (client) x[0] = *mode_ptr; else connected = IRC_WriteErrClient(Origin, ERR_NOSUCHNICK_MSG, Client_ID(Origin), Req->argv[arg_arg]); } else { connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); } Req->argv[arg_arg][0] = '\0'; arg_arg++; } else { #ifdef STRICT_RFC /* Report an error to the client, when a user * mode should be changed but no nickname is * given. But don't do it when not in "strict" * mode, because most other servers don't do * it as well and some clients send "wired" * MODE commands like "MODE #chan -ooo nick". */ IRC_SetPenalty(Origin, 2); connected = IRC_WriteErrClient(Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID(Origin), Req->command); #endif goto chan_exit; } break; /* --- Channel lists --- */ case 'I': /* Invite lists */ case 'b': /* Ban lists */ case 'e': /* Channel exception lists */ if (Mode_Limit_Reached(Client, mode_arg_count++)) goto chan_exit; if (arg_arg > mode_arg) { /* modify list */ if (is_oper || is_machine || is_owner || is_admin || is_op || is_halfop) { connected = set ? Add_To_List(*mode_ptr, Origin, Client, Channel, Req->argv[arg_arg]) : Del_From_List(*mode_ptr, Origin, Client, Channel, Req->argv[arg_arg]); } else { connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel)); } Req->argv[arg_arg][0] = '\0'; arg_arg++; } else { switch (*mode_ptr) { case 'I': Channel_ShowInvites(Origin, Channel); break; case 'b': Channel_ShowBans(Origin, Channel); break; case 'e': Channel_ShowExcepts(Origin, Channel); break; } } break; default: if (Client_Type(Client) != CLIENT_SERVER) { Log(LOG_DEBUG, "Unknown mode \"%c%c\" from \"%s\" on %s!?", set ? '+' : '-', *mode_ptr, Client_ID(Origin), Channel_Name(Channel)); connected = IRC_WriteErrClient(Origin, ERR_UNKNOWNMODE_MSG, Client_ID(Origin), *mode_ptr, Channel_Name(Channel)); x[0] = '\0'; } else { Log(LOG_DEBUG, "Handling unknown mode \"%c%c\" from \"%s\" on %s ...", set ? '+' : '-', *mode_ptr, Client_ID(Origin), Channel_Name(Channel)); x[0] = *mode_ptr; } } if (!connected) break; /* Is there a valid mode change? */ if (!x[0]) continue; /* Validate target client */ if (client && (!Channel_IsMemberOf(Channel, client))) { if (!IRC_WriteErrClient(Origin, ERR_USERNOTINCHANNEL_MSG, Client_ID(Origin), Client_ID(client), Channel_Name(Channel))) break; continue; } if (client) { /* Channel-User-Mode */ retval = set ? Channel_UserModeAdd(Channel, client, x[0]) : Channel_UserModeDel(Channel, client, x[0]); if (retval) { strlcat(the_args, " ", sizeof(the_args)); strlcat(the_args, Client_ID(client), sizeof(the_args)); strlcat(the_modes, x, sizeof(the_modes)); LogDebug ("User \"%s\": Mode change on %s, now \"%s\"", Client_Mask(client), Channel_Name(Channel), Channel_UserModes(Channel, client)); } } else { /* Channel-Mode */ retval = set ? Channel_ModeAdd(Channel, x[0]) : Channel_ModeDel(Channel, x[0]); if (retval) { strlcat(the_modes, x, sizeof(the_modes)); LogDebug("Channel %s: Mode change, now \"%s\".", Channel_Name(Channel), Channel_Modes(Channel)); } } /* Are there additional arguments to add? */ if (argadd[0]) { strlcat(the_args, " ", sizeof(the_args)); strlcat(the_args, argadd, sizeof(the_args)); } } chan_exit: /* Are there changed modes? */ if (the_modes[1]) { /* Clean up mode string */ len = strlen(the_modes) - 1; if ((the_modes[len] == '+') || (the_modes[len] == '-')) the_modes[len] = '\0'; if (Client_Type(Client) == CLIENT_SERVER) { /* MODE requests for local channels from other servers * are definitely invalid! */ if (Channel_IsLocal(Channel)) { Log(LOG_ALERT, "Got remote MODE command for local channel!? Ignored."); return CONNECTED; } /* Forward mode changes to channel users and all the * other remote servers: */ IRC_WriteStrServersPrefix(Client, Origin, "MODE %s %s%s", Channel_Name(Channel), the_modes, the_args); IRC_WriteStrChannelPrefix(Client, Channel, Origin, false, "MODE %s %s%s", Channel_Name(Channel), the_modes, the_args); } else { if (use_servermode) Origin = Client_ThisServer(); /* Send reply to client and inform other servers and channel users */ connected = IRC_WriteStrClientPrefix(Client, Origin, "MODE %s %s%s", Channel_Name(Channel), the_modes, the_args); /* Only forward requests for non-local channels */ if (!Channel_IsLocal(Channel)) IRC_WriteStrServersPrefix(Client, Origin, "MODE %s %s%s", Channel_Name(Channel), the_modes, the_args); IRC_WriteStrChannelPrefix(Client, Channel, Origin, false, "MODE %s %s%s", Channel_Name(Channel), the_modes, the_args); } } IRC_SetPenalty(Client, 1); return connected; } /* Channel_Mode */ /** * Handler for the IRC "AWAY" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_AWAY( CLIENT *Client, REQUEST *Req ) { assert (Client != NULL); assert (Req != NULL); if (Req->argc == 1 && Req->argv[0][0]) { Client_SetAway(Client, Req->argv[0]); Client_ModeAdd(Client, 'a'); IRC_WriteStrServersPrefix(Client, Client, "MODE %s :+a", Client_ID( Client)); return IRC_WriteStrClient(Client, RPL_NOWAWAY_MSG, Client_ID( Client)); } else { Client_ModeDel(Client, 'a'); IRC_WriteStrServersPrefix(Client, Client, "MODE %s :-a", Client_ID( Client)); return IRC_WriteStrClient(Client, RPL_UNAWAY_MSG, Client_ID( Client)); } } /* IRC_AWAY */ /** * Add entries to channel invite, ban and exception lists. * * @param what Can be 'I' for invite, 'b' for ban, and 'e' for exception list. * @param Prefix The originator of the command. * @param Client The sender of the command. * @param Channel The channel of which the list should be modified. * @param Pattern The pattern to add to the list. * @return CONNECTED or DISCONNECTED. */ static bool Add_To_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, const char *Pattern) { char mask[MASK_LEN]; struct list_head *list = NULL; long int current_count; assert(Client != NULL); assert(Channel != NULL); assert(Pattern != NULL); assert(what == 'I' || what == 'b' || what == 'e'); Lists_MakeMask(Pattern, mask, sizeof(mask)); current_count = Lists_Count(Channel_GetListInvites(Channel)) + Lists_Count(Channel_GetListExcepts(Channel)) + Lists_Count(Channel_GetListBans(Channel)); switch(what) { case 'I': list = Channel_GetListInvites(Channel); break; case 'b': list = Channel_GetListBans(Channel); break; case 'e': list = Channel_GetListExcepts(Channel); break; } if (Lists_CheckDupeMask(list, mask)) return CONNECTED; if (Client_Type(Client) == CLIENT_USER && current_count >= MAX_HNDL_CHANNEL_LISTS) return IRC_WriteErrClient(Client, ERR_LISTFULL_MSG, Client_ID(Client), Channel_Name(Channel), mask, MAX_HNDL_CHANNEL_LISTS); switch (what) { case 'I': if (!Channel_AddInvite(Channel, mask, false)) return CONNECTED; break; case 'b': if (!Channel_AddBan(Channel, mask)) return CONNECTED; break; case 'e': if (!Channel_AddExcept(Channel, mask)) return CONNECTED; break; } return Send_ListChange(true, what, Prefix, Client, Channel, mask); } /** * Delete entries from channel invite, ban and exception lists. * * @param what Can be 'I' for invite, 'b' for ban, and 'e' for exception list. * @param Prefix The originator of the command. * @param Client The sender of the command. * @param Channel The channel of which the list should be modified. * @param Pattern The pattern to add to the list. * @return CONNECTED or DISCONNECTED. */ static bool Del_From_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, const char *Pattern) { char mask[MASK_LEN]; struct list_head *list = NULL; assert(Client != NULL); assert(Channel != NULL); assert(Pattern != NULL); assert(what == 'I' || what == 'b' || what == 'e'); Lists_MakeMask(Pattern, mask, sizeof(mask)); switch (what) { case 'I': list = Channel_GetListInvites(Channel); break; case 'b': list = Channel_GetListBans(Channel); break; case 'e': list = Channel_GetListExcepts(Channel); break; } if (!Lists_CheckDupeMask(list, mask)) return CONNECTED; Lists_Del(list, mask); return Send_ListChange(false, what, Prefix, Client, Channel, mask); } /** * Send information about changed channel invite/ban/exception lists to clients. * * @param IsAdd true if the list item has been added, false otherwise. * @param ModeChar The mode to use (e. g. 'b' or 'I') * @param Prefix The originator of the mode list change. * @param Client The sender of the command. * @param Channel The channel of which the list has been modified. * @param Mask The mask which has been added or removed. * @return CONNECTED or DISCONNECTED. */ static bool Send_ListChange(const bool IsAdd, const char ModeChar, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, const char *Mask) { bool ok = true; /* Send confirmation to the client */ if (Client_Type(Client) == CLIENT_USER) ok = IRC_WriteStrClientPrefix(Client, Prefix, "MODE %s %c%c %s", Channel_Name(Channel), IsAdd ? '+' : '-', ModeChar, Mask); /* to other servers */ IRC_WriteStrServersPrefix(Client, Prefix, "MODE %s %c%c %s", Channel_Name(Channel), IsAdd ? '+' : '-', ModeChar, Mask); /* and local users in channel */ IRC_WriteStrChannelPrefix(Client, Channel, Prefix, false, "MODE %s %c%c %s", Channel_Name(Channel), IsAdd ? '+' : '-', ModeChar, Mask ); return ok; } /* Send_ListChange */ /* -eof- */ ngircd-21/src/ngircd/pam.h0000644000175000116100000000121712206130744012444 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2010 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. */ #ifdef PAM #ifndef __pam_h__ #define __pam_h__ /** * @file * PAM User Authentication (header) */ GLOBAL bool PAM_Authenticate PARAMS((CLIENT *Client)); #endif /* __pam_h__ */ #endif /* PAM */ /* -eof- */ ngircd-21/src/ngircd/conn.h0000644000175000116100000001162712206130744012632 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __conn_h__ #define __conn_h__ /** * @file * Connection management (header) */ #include /* for time_t, see below */ /* * connection state flags. this is a bitmask -- all values must * be unique and a power of two. * * If you introduce new ones in between, make sure to adjust all * remaining ones. */ #define CONN_ISCLOSING 1 /* Conn_Close() already called */ #define CONN_ISCONNECTING 2 /* connect() in progress */ #define CONN_RFC1459 4 /* RFC 1459 compatibility mode */ #ifdef ZLIB #define CONN_ZIP 8 /* zlib compressed link */ #endif #include "conf-ssl.h" #ifdef SSL_SUPPORT #define CONN_SSL_CONNECT 16 /* wait for ssl connect to finish */ #define CONN_SSL 32 /* this connection is SSL encrypted */ #define CONN_SSL_WANT_WRITE 64 /* SSL/TLS library needs to write protocol data */ #define CONN_SSL_WANT_READ 128 /* SSL/TLS library needs to read protocol data */ #define CONN_SSL_FLAGS_ALL (CONN_SSL_CONNECT|CONN_SSL|CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ) #endif typedef int CONN_ID; #include "client.h" #include "proc.h" #ifdef CONN_MODULE #include "defines.h" #include "array.h" #include "tool.h" #include "ng_ipaddr.h" #ifdef ICONV # include #endif #ifdef ZLIB #include typedef struct _ZipData { z_stream in; /* "Handle" for input stream */ z_stream out; /* "Handle" for output stream */ array rbuf; /* Read buffer (compressed) */ array wbuf; /* Write buffer (uncompressed) */ long bytes_in, bytes_out; /* Counter for statistics (uncompressed!) */ } ZIPDATA; #endif /* ZLIB */ typedef struct _Connection { int sock; /* Socket handle */ ng_ipaddr_t addr; /* Client address */ PROC_STAT proc_stat; /* Status of resolver process */ char host[HOST_LEN]; /* Hostname */ char *pwd; /* password received of the client */ array rbuf; /* Read buffer */ array wbuf; /* Write buffer */ time_t signon; /* Signon ("connect") time */ time_t lastdata; /* Last activity */ time_t lastping; /* Last PING */ time_t lastprivmsg; /* Last PRIVMSG */ time_t delaytime; /* Ignore link ("penalty") */ long bytes_in, bytes_out; /* Received and sent bytes */ long msg_in, msg_out; /* Received and sent IRC messages */ int flag; /* Flag (see "irc-write" module) */ UINT16 options; /* Link options / connection state */ UINT16 bps; /* bytes processed within last second */ CLIENT *client; /* pointer to client structure */ #ifdef ZLIB ZIPDATA zip; /* Compression information */ #endif /* ZLIB */ #ifdef SSL_SUPPORT struct ConnSSL_State ssl_state; /* SSL/GNUTLS state information */ #endif #ifndef STRICT_RFC long auth_ping; /** PING response expected on login */ #endif #ifdef ICONV iconv_t iconv_from; /** iconv: convert from client to server */ iconv_t iconv_to; /** iconv: convert from server to client */ #endif } CONNECTION; GLOBAL CONNECTION *My_Connections; GLOBAL CONN_ID Pool_Size; GLOBAL long WCounter; #define CONNECTION2ID(x) (long)(x - My_Connections) #endif /* CONN_MODULE */ GLOBAL void Conn_Init PARAMS((void )); GLOBAL void Conn_Exit PARAMS(( void )); GLOBAL void Conn_CloseAllSockets PARAMS((int ExceptOf)); GLOBAL unsigned int Conn_InitListeners PARAMS(( void )); GLOBAL void Conn_ExitListeners PARAMS(( void )); GLOBAL void Conn_StartLogin PARAMS((CONN_ID Idx)); GLOBAL void Conn_Handler PARAMS(( void )); GLOBAL bool Conn_WriteStr PARAMS(( CONN_ID Idx, const char *Format, ... )); GLOBAL char* Conn_Password PARAMS(( CONN_ID Idx )); GLOBAL void Conn_SetPassword PARAMS(( CONN_ID Idx, const char *Pwd )); GLOBAL void Conn_Close PARAMS(( CONN_ID Idx, const char *LogMsg, const char *FwdMsg, bool InformClient )); GLOBAL void Conn_SyncServerStruct PARAMS(( void )); GLOBAL CONN_ID Conn_GetFromProc PARAMS((int fd)); GLOBAL CLIENT* Conn_GetClient PARAMS((CONN_ID i)); GLOBAL PROC_STAT* Conn_GetProcStat PARAMS((CONN_ID i)); GLOBAL char *Conn_GetCertFp PARAMS((CONN_ID Idx)); GLOBAL bool Conn_SetCertFp PARAMS((CONN_ID Idx, const char *fingerprint)); GLOBAL bool Conn_UsesSSL PARAMS((CONN_ID Idx)); #ifdef SSL_SUPPORT GLOBAL bool Conn_GetCipherInfo PARAMS((CONN_ID Idx, char *buf, size_t len)); #endif GLOBAL const char *Conn_GetIPAInfo PARAMS((CONN_ID Idx)); GLOBAL long Conn_Count PARAMS((void)); GLOBAL long Conn_CountMax PARAMS((void)); GLOBAL long Conn_CountAccepted PARAMS((void)); #ifndef STRICT_RFC GLOBAL long Conn_GetAuthPing PARAMS((CONN_ID Idx)); GLOBAL void Conn_SetAuthPing PARAMS((CONN_ID Idx, long ID)); #endif #ifdef DEBUG GLOBAL void Conn_DebugDump PARAMS((void)); #endif #endif /* -eof- */ ngircd-21/src/ngircd/array.h0000644000175000116100000000662511677176022013027 00000000000000/* * 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. * * libarray - dynamically allocate arrays. * Copyright (c) 2005 Florian Westphal (westphal@foo.fh-furtwangen.de) */ #ifndef array_h_included #define array_h_included /** * @file * Functions to dynamically allocate arrays (header). */ #include "portab.h" typedef struct { char * mem; size_t allocated; size_t used; } array; /* allocated: mem != NULL, used >= 0 && used <= allocated, allocated > 0 unallocated: mem == NULL, allocated == 0, used == 0 */ #define array_unallocated(x) (array_bytes(x)==0) #define INIT_ARRAY { NULL, 0, 0 } /* set all variables in a to 0 */ extern void array_init PARAMS((array *a)); /* allocates space for at least nmemb+1 elements of size bytes each. return pointer to elem at pos, or NULL if realloc() fails */ extern void * array_alloc PARAMS((array *a, size_t size, size_t pos)); /* returns the number of initialized BYTES in a. */ #define array_bytes(array) ( (array)->used ) /* returns the number of initialized ELEMS in a. */ extern size_t array_length PARAMS((const array* const a, size_t elemsize)); /* _copy functions: copy src to dest. return true if OK, else false (e. g. realloc failure, invalid src/dest array, ...). In that case dest is left unchanged. */ /* copy array src to dest */ extern bool array_copy PARAMS((array* dest, const array* const src)); /* copy len bytes from src to array dest. */ extern bool array_copyb PARAMS((array* dest, const char* src, size_t len)); /* copy string to dest */ extern bool array_copys PARAMS((array* dest, const char* src)); /* _cat functions: append src to dest. return true if OK, else false (e. g. realloc failure, invalid src/dest array, ...). In that case dest is left unchanged. */ /* append len bytes from src to array dest. */ extern bool array_catb PARAMS((array* dest, const char* src, size_t len)); /* append string to dest */ extern bool array_cats PARAMS((array* dest, const char* src)); /* append NUL byte to dest */ extern bool array_cat0 PARAMS((array* dest)); /* append NUL byte to dest, but do not count null byte */ extern bool array_cat0_temporary PARAMS((array* dest)); /* append contents of array src to array dest. */ extern bool array_cat PARAMS((array* dest, const array* const src)); /* return pointer to element at pos. return NULL if the array is unallocated or if pos is larger than the number of elements stored int the array. */ extern void* array_get PARAMS((array* a, size_t membersize, size_t pos)); /* free the contents of this array. */ extern void array_free PARAMS((array* a)); /* overwrite array with zeros before free */ extern void array_free_wipe PARAMS((array* a)); /* return pointer to first element in this array */ extern void* array_start PARAMS((const array* const a)); /* reset this array (the memory is not free'd */ extern void array_trunc PARAMS((array* a)); /* set number of used elements in this array to len */ extern void array_truncate PARAMS((array* a, size_t membersize, size_t len)); /* move elements starting at pos to beginning of array */ extern void array_moveleft PARAMS((array* a, size_t membersize, size_t pos)); #endif /* -eof- */ ngircd-21/src/ngircd/conf.h0000644000175000116100000002056312215622211012614 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __conf_h__ #define __conf_h__ /** * @file * Configuration management (header) */ #include #include "defines.h" #include "array.h" #include "portab.h" #include "tool.h" #include "ng_ipaddr.h" #include "proc.h" #include "conf-ssl.h" /** * Configured IRC operator. * Please note the the name of the IRC operaor and his nick have nothing to * do with each other! The IRC operator is only identified by the name and * password configured in this structure. */ struct Conf_Oper { char name[CLIENT_PASS_LEN]; /**< Name (ID) */ char pwd[CLIENT_PASS_LEN]; /**< Password */ char *mask; /**< Allowed host mask */ }; /** * Configured server. * Peers to which this daemon should establish an outgoing server link must * have set a port number; all other servers are allowed to connect to this one. */ typedef struct _Conf_Server { char host[HOST_LEN]; /**< Hostname */ char name[CLIENT_ID_LEN]; /**< IRC client ID */ char pwd_in[CLIENT_PASS_LEN]; /**< Password which must be received */ char pwd_out[CLIENT_PASS_LEN]; /**< Password to send to the peer */ UINT16 port; /**< Server port to connect to */ int group; /**< Group ID of this server */ time_t lasttry; /**< Time of last connection attempt */ PROC_STAT res_stat; /**< Status of the resolver */ int flags; /**< Server 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 dst_addr[2]; /**< List of addresses to connect to */ #ifdef SSL_SUPPORT bool SSLConnect; /**< Establish connection using SSL? */ #endif char svs_mask[CLIENT_ID_LEN]; /**< Mask of nicknames that should be treated and counted as services */ } CONF_SERVER; #ifdef SSL_SUPPORT /** Configuration options required for SSL support */ struct SSLOptions { char *KeyFile; /**< SSL key file */ char *CertFile; /**< SSL certificate file */ char *DHFile; /**< File containing DH parameters */ array ListenPorts; /**< Array of listening SSL ports */ array KeyFilePassword; /**< Key file password */ char *CipherList; /**< Set SSL cipher list to use */ }; #endif /** Pre-defined channels */ 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; /**< User limit for this channel, mode "l" */ }; #define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */ #define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */ /** Name (ID, "nick") of this server */ GLOBAL char Conf_ServerName[CLIENT_ID_LEN]; /** Server info text */ GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN]; /** Global server passwort */ GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN]; /** Administrative information */ GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN]; GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN]; GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN]; /** Message of the day (MOTD) of this server */ GLOBAL array Conf_Motd; /** Help text of this server */ GLOBAL array Conf_Helptext; /** Array of ports this server should listen on */ GLOBAL array Conf_ListenPorts; /** Address to which sockets should be bound to or empty (=all) */ GLOBAL char *Conf_ListenAddress; /** User and group ID this daemon should run with */ GLOBAL uid_t Conf_UID; GLOBAL gid_t Conf_GID; /** The directory to chroot() into */ GLOBAL char Conf_Chroot[FNAME_LEN]; /** Full path and name of a file to which the PID of daemon should be written */ GLOBAL char Conf_PidFile[FNAME_LEN]; /** Timeout (in seconds) for PING commands */ GLOBAL int Conf_PingTimeout; /** Timeout (in seconds) for PONG replies */ GLOBAL int Conf_PongTimeout; /** Seconds between connection attempts to other servers */ GLOBAL int Conf_ConnectRetry; /** Array of configured IRC operators */ GLOBAL array Conf_Opers; /** Array of configured IRC servers */ GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS]; /** Array of pre-defined channels */ GLOBAL array Conf_Channels; /** String containing all locally allowed channel prefixes for new channels */ GLOBAL char Conf_AllowedChannelTypes[8]; /** Flag indicating if IRC operators are allowed to always use MODE (true) */ GLOBAL bool Conf_OperCanMode; /** Flag indicating if IRC operators get AutoOp in persistent (+P) channels */ GLOBAL bool Conf_OperChanPAutoOp; /** * If true, mask channel MODE commands of IRC operators to the server. * Background: ircd2 will ignore channel MODE commands if an IRC operator * gives channel operator privileges to someone without being a channel operator * himself. This enables a workaround: it masks the MODE command as coming * from the IRC server and not the IRC operator. */ GLOBAL bool Conf_OperServerMode; /** Flag indicating if remote IRC operators are allowed to manage this server */ GLOBAL bool Conf_AllowRemoteOper; /** Cloaked hostname of the clients */ GLOBAL char Conf_CloakHost[CLIENT_ID_LEN]; /** Cloaked hostname for clients that did +x */ GLOBAL char Conf_CloakHostModeX[CLIENT_ID_LEN]; /** Salt for hostname hash for cloaked hostnames */ GLOBAL char Conf_CloakHostSalt[CLIENT_ID_LEN]; /** Use nickname as user name? */ GLOBAL bool Conf_CloakUserToNick; /** Enable all DNS functions? */ GLOBAL bool Conf_DNS; /** Enable IDENT lookups, even when compiled with support for it */ GLOBAL bool Conf_Ident; /** Enable "more privacy" mode and "censor" some user-related information */ GLOBAL bool Conf_MorePrivacy; /** Enable NOTICE AUTH messages on connect */ GLOBAL bool Conf_NoticeAuth; /** Enable all usage of PAM, even when compiled with support for it */ GLOBAL bool Conf_PAM; /** Don't require all clients to send a password an to be PAM authenticated */ GLOBAL bool Conf_PAMIsOptional; /** Disable all CTCP commands except for /me ? */ GLOBAL bool Conf_ScrubCTCP; /** Default user modes for new local clients */ GLOBAL char Conf_DefaultUserModes[CLIENT_MODE_LEN]; /* * try to connect to remote systems using the ipv6 protocol, * if they have an ipv6 address? (default yes) */ GLOBAL bool Conf_ConnectIPv6; /** Try to connect to remote systems using the IPv4 protocol (true) */ GLOBAL bool Conf_ConnectIPv4; /** Idle timout (seconds), after which the daemon should exit */ GLOBAL int Conf_IdleTimeout; /** Maximum number of simultaneous connections to this server */ GLOBAL int Conf_MaxConnections; /** Maximum number of channels a user can join */ GLOBAL int Conf_MaxJoins; /** Maximum number of connections per IP address */ GLOBAL int Conf_MaxConnectionsIP; /** Maximum length of a nickname */ GLOBAL unsigned int Conf_MaxNickLength; /** Maximum number of channels returned to /list */ GLOBAL int Conf_MaxListSize; #ifndef STRICT_RFC /** Require "AUTH PING-PONG" on login */ GLOBAL bool Conf_AuthPing; #endif #ifdef SYSLOG /* Syslog "facility" */ GLOBAL int Conf_SyslogFacility; #endif GLOBAL void Conf_Init PARAMS((void)); GLOBAL bool Conf_Rehash PARAMS((void)); GLOBAL int Conf_Test PARAMS((void)); GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx )); GLOBAL bool Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx )); GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx )); GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port )); GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name)); 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_NickIsService PARAMS((int ConfServer, const char *Nick)); GLOBAL bool Conf_NickIsBlocked PARAMS((const char *Nick)); #ifdef SSL_SUPPORT GLOBAL bool Conf_SSLInUse PARAMS((void)); #endif /* Password required by WEBIRC command */ GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN]; #ifdef DEBUG GLOBAL void Conf_DebugDump PARAMS((void)); #endif #endif /* -eof- */ ngircd-21/src/ngircd/numeric.c0000644000175000116100000002254112230312353013322 00000000000000/* * 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. */ #include "portab.h" /** * @file * Handlers for IRC numerics sent to the server */ #include "imp.h" #include #include #include #include #include "defines.h" #include "conn.h" #include "conf.h" #include "conn.h" #include "conn-func.h" #include "channel.h" #include "class.h" #include "irc-write.h" #include "lists.h" #include "log.h" #include "messages.h" #include "parse.h" #include "exp.h" #include "numeric.h" /** * Announce a channel and its users in the network. */ static bool Announce_Channel(CLIENT *Client, CHANNEL *Chan) { CL2CHAN *cl2chan; CLIENT *cl; char str[COMMAND_LEN], *ptr; bool njoin, xop; /* Check features of remote server */ njoin = Conn_Options(Client_Conn(Client)) & CONN_RFC1459 ? false : true; xop = Client_HasFlag(Client, 'X') ? true : false; /* Get all the members of this channel */ cl2chan = Channel_FirstMember(Chan); snprintf(str, sizeof(str), "NJOIN %s :", Channel_Name(Chan)); while (cl2chan) { cl = Channel_GetClient(cl2chan); assert(cl != NULL); if (njoin) { /* RFC 2813: send NJOIN with nicknames and modes * (if user is channel operator or has voice) */ if (str[strlen(str) - 1] != ':') strlcat(str, ",", sizeof(str)); /* Prepare user prefix (ChanOp, voiced, ...) */ if (xop && Channel_UserHasMode(Chan, cl, 'q')) strlcat(str, "~", sizeof(str)); if (xop && Channel_UserHasMode(Chan, cl, 'a')) strlcat(str, "&", sizeof(str)); if (Channel_UserHasMode(Chan, cl, 'o')) strlcat(str, "@", sizeof(str)); if (xop && Channel_UserHasMode(Chan, cl, 'h')) strlcat(str, "%", sizeof(str)); if (Channel_UserHasMode(Chan, cl, 'v')) strlcat(str, "+", sizeof(str)); strlcat(str, Client_ID(cl), sizeof(str)); /* Send the data if the buffer is "full" */ if (strlen(str) > (sizeof(str) - CLIENT_NICK_LEN - 8)) { if (!IRC_WriteStrClient(Client, "%s", str)) return DISCONNECTED; snprintf(str, sizeof(str), "NJOIN %s :", Channel_Name(Chan)); } } else { /* RFC 1459: no NJOIN, send JOIN and MODE */ if (!IRC_WriteStrClientPrefix(Client, cl, "JOIN %s", Channel_Name(Chan))) return DISCONNECTED; ptr = Channel_UserModes(Chan, cl); while (*ptr) { if (!IRC_WriteStrClientPrefix(Client, cl, "MODE %s +%c %s", Channel_Name(Chan), ptr[0], Client_ID(cl))) return DISCONNECTED; ptr++; } } cl2chan = Channel_NextMember(Chan, cl2chan); } /* Data left in the buffer? */ if (str[strlen(str) - 1] != ':') { /* Yes, send it ... */ if (!IRC_WriteStrClient(Client, "%s", str)) return DISCONNECTED; } return CONNECTED; } /* Announce_Channel */ /** * Announce new server in the network * @param Client New server * @param Server Existing server in the network */ static bool Announce_Server(CLIENT * Client, CLIENT * Server) { CLIENT *c; if (Client_Conn(Server) > NONE) { /* Announce the new server to the one already registered * which is directly connected to the local server */ if (!IRC_WriteStrClient (Server, "SERVER %s %d %d :%s", Client_ID(Client), Client_Hops(Client) + 1, Client_MyToken(Client), Client_Info(Client))) return DISCONNECTED; } if (Client_Hops(Server) == 1) c = Client_ThisServer(); else c = Client_TopServer(Server); /* Inform new server about the one already registered in the network */ return IRC_WriteStrClientPrefix(Client, c, "SERVER %s %d %d :%s", Client_ID(Server), Client_Hops(Server) + 1, Client_MyToken(Server), Client_Info(Server)); } /* Announce_Server */ #ifdef IRCPLUS /** * Synchronize invite, ban, G- and K-Line lists between servers. * * @param Client New server. * @return CONNECTED or DISCONNECTED. */ static bool Synchronize_Lists(CLIENT * Client) { CHANNEL *c; struct list_head *head; struct list_elem *elem; assert(Client != NULL); /* g-lines */ head = Class_GetList(CLASS_GLINE); elem = Lists_GetFirst(head); while (elem) { if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s", Lists_GetMask(elem), Lists_GetValidity(elem) - time(NULL), Lists_GetReason(elem))) return DISCONNECTED; elem = Lists_GetNext(elem); } c = Channel_First(); while (c) { /* ban list */ head = Channel_GetListBans(c); elem = Lists_GetFirst(head); while (elem) { if (!IRC_WriteStrClient(Client, "MODE %s +b %s", Channel_Name(c), Lists_GetMask(elem))) { return DISCONNECTED; } elem = Lists_GetNext(elem); } /* invite list */ head = Channel_GetListInvites(c); elem = Lists_GetFirst(head); while (elem) { if (!IRC_WriteStrClient(Client, "MODE %s +I %s", Channel_Name(c), Lists_GetMask(elem))) { return DISCONNECTED; } elem = Lists_GetNext(elem); } c = Channel_Next(c); } return CONNECTED; } /** * Send CHANINFO commands to a new server (inform it about existing channels). * @param Client New server * @param Chan Channel */ static bool Send_CHANINFO(CLIENT * Client, CHANNEL * Chan) { char *modes, *topic; bool has_k, has_l; #ifdef DEBUG Log(LOG_DEBUG, "Sending CHANINFO commands ..."); #endif modes = Channel_Modes(Chan); topic = Channel_Topic(Chan); if (!*modes && !*topic) return CONNECTED; has_k = Channel_HasMode(Chan, 'k'); has_l = Channel_HasMode(Chan, 'l'); /* send CHANINFO */ if (!has_k && !has_l) { if (!*topic) { /* "CHANINFO +" */ return IRC_WriteStrClient(Client, "CHANINFO %s +%s", Channel_Name(Chan), modes); } /* "CHANINFO + :" */ return IRC_WriteStrClient(Client, "CHANINFO %s +%s :%s", Channel_Name(Chan), modes, topic); } /* "CHANINFO + :" */ return IRC_WriteStrClient(Client, "CHANINFO %s +%s %s %lu :%s", Channel_Name(Chan), modes, has_k ? Channel_Key(Chan) : "*", has_l ? Channel_MaxUsers(Chan) : 0, topic); } /* Send_CHANINFO */ #endif /* IRCPLUS */ /** * Handle ENDOFMOTD (376) numeric and login remote server. * The peer is either an IRC server (no IRC+ protocol), or we got the * ENDOFMOTD numeric from an IRC+ server. We have to register the new server. */ GLOBAL bool IRC_Num_ENDOFMOTD(CLIENT * Client, UNUSED REQUEST * Req) { int max_hops, i; CLIENT *c; CHANNEL *chan; Client_SetType(Client, CLIENT_SERVER); Log(LOG_NOTICE | LOG_snotice, "Server \"%s\" registered (connection %d, 1 hop - direct link).", Client_ID(Client), Client_Conn(Client)); /* Get highest hop count */ max_hops = 0; c = Client_First(); while (c) { if (Client_Hops(c) > max_hops) max_hops = Client_Hops(c); c = Client_Next(c); } /* Inform the new server about all other servers, and announce the * new server to all the already registered ones. Important: we have * to do this "in order" and can't introduce servers of which the * "toplevel server" isn't known already. */ for (i = 0; i < (max_hops + 1); i++) { for (c = Client_First(); c != NULL; c = Client_Next(c)) { if (Client_Type(c) != CLIENT_SERVER) continue; /* not a server */ if (Client_Hops(c) != i) continue; /* not actual "nesting level" */ if (c == Client || c == Client_ThisServer()) continue; /* that's us or the peer! */ if (!Announce_Server(Client, c)) return DISCONNECTED; } } /* Announce all the users to the new server */ c = Client_First(); while (c) { if (Client_Type(c) == CLIENT_USER || Client_Type(c) == CLIENT_SERVICE) { if (!Client_Announce(Client, Client_ThisServer(), c)) return DISCONNECTED; } c = Client_Next(c); } /* Announce all channels to the new server */ chan = Channel_First(); while (chan) { if (Channel_IsLocal(chan)) { chan = Channel_Next(chan); continue; } #ifdef IRCPLUS /* Send CHANINFO if the peer supports it */ if (Client_HasFlag(Client, 'C')) { if (!Send_CHANINFO(Client, chan)) return DISCONNECTED; } #endif if (!Announce_Channel(Client, chan)) return DISCONNECTED; /* Get next channel ... */ chan = Channel_Next(chan); } #ifdef IRCPLUS if (Client_HasFlag(Client, 'L')) { LogDebug("Synchronizing INVITE- and BAN-lists ..."); if (!Synchronize_Lists(Client)) return DISCONNECTED; } #endif if (!IRC_WriteStrClient(Client, "PING :%s", Client_ID(Client_ThisServer()))) return DISCONNECTED; return CONNECTED; } /* IRC_Num_ENDOFMOTD */ /** * Handle ISUPPORT (005) numeric. */ GLOBAL bool IRC_Num_ISUPPORT(CLIENT * Client, REQUEST * Req) { int i; char *key, *value; for (i = 1; i < Req->argc - 1; i++) { key = Req->argv[i]; value = strchr(key, '='); if (value) *value++ = '\0'; else value = ""; if (strcmp("NICKLEN", key) == 0) { if ((unsigned int)atol(value) == Conf_MaxNickLength - 1) continue; /* Nickname length settings are different! */ Log(LOG_ERR, "Peer uses incompatible nickname length (%d/%d)! Disconnecting ...", Conf_MaxNickLength - 1, atoi(value)); Conn_Close(Client_Conn(Client), "Incompatible nickname length", NULL, false); return DISCONNECTED; } } return CONNECTED; } /* IRC_Num_ISUPPORT */ /* -eof- */ ngircd-21/src/ngircd/irc-write.c0000644000175000116100000003246412212712537013602 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * Sending IRC commands over the network */ #include "imp.h" #include #ifdef PROTOTYPES # include #else # include #endif #include #include #include "defines.h" #include "conn-func.h" #include "channel.h" #include "exp.h" #include "irc-write.h" #define SEND_TO_USER 1 #define SEND_TO_SERVER 2 static const char *Get_Prefix PARAMS((CLIENT *Target, CLIENT *Client)); static void cb_writeStrServersPrefixFlag PARAMS((CLIENT *Client, CLIENT *Prefix, void *Buffer)); static void Send_Marked_Connections PARAMS((CLIENT *Prefix, const char *Buffer)); /** * Send an error message to a client and enforce a penalty time. * * @param Client The target client. * @param Format Format string. * @return CONNECTED or DISCONNECTED. */ #ifdef PROTOTYPES GLOBAL bool IRC_WriteErrClient( CLIENT *Client, const char *Format, ... ) #else GLOBAL bool IRC_WriteErrClient( Client, Format, va_alist ) CLIENT *Client; const char *Format; va_dcl #endif { char buffer[1000]; va_list ap; assert(Client != NULL); assert(Format != NULL); #ifdef PROTOTYPES va_start(ap, Format); #else va_start(ap); #endif vsnprintf(buffer, 1000, Format, ap); va_end(ap); IRC_SetPenalty(Client, 2); return IRC_WriteStrClientPrefix(Client, Client_ThisServer(), "%s", buffer); } /** * Send a message to a client. * * @param Client The target client. * @param Format Format string. * @return CONNECTED or DISCONNECTED. */ #ifdef PROTOTYPES GLOBAL bool IRC_WriteStrClient( CLIENT *Client, const char *Format, ... ) #else GLOBAL bool IRC_WriteStrClient( Client, Format, va_alist ) CLIENT *Client; const char *Format; va_dcl #endif { char buffer[1000]; va_list ap; assert(Client != NULL); assert(Format != NULL); #ifdef PROTOTYPES va_start(ap, Format); #else va_start(ap); #endif vsnprintf(buffer, 1000, Format, ap); va_end(ap); return IRC_WriteStrClientPrefix(Client, Client_ThisServer(), "%s", buffer); } /** * Send a message to a client using a specific prefix. * * @param Client The target client. * @param Prefix The prefix to use. * @param Format Format string. * @return CONNECTED or DISCONNECTED. */ #ifdef PROTOTYPES GLOBAL bool IRC_WriteStrClientPrefix(CLIENT *Client, CLIENT *Prefix, const char *Format, ...) #else GLOBAL bool IRC_WriteStrClientPrefix(Client, Prefix, Format, va_alist) CLIENT *Client; CLIENT *Prefix; const char *Format; va_dcl #endif { /* send text to local and remote clients */ char buffer[1000]; va_list ap; assert( Client != NULL ); assert( Format != NULL ); assert( Prefix != NULL ); #ifdef PROTOTYPES va_start( ap, Format ); #else va_start( ap ); #endif vsnprintf( buffer, 1000, Format, ap ); va_end( ap ); return Conn_WriteStr(Client_Conn(Client_NextHop(Client)), ":%s %s", Get_Prefix(Client_NextHop(Client), Prefix), buffer); } /** * Send a message to all client in a channel. * * The message is only sent once per remote server. * * @param Client The sending client, excluded while forwarding the message. * @param Channel The target channel. * @param Remote If not set, the message is sent to local clients only. * @param Format Format string. */ #ifdef PROTOTYPES GLOBAL void IRC_WriteStrChannel(CLIENT *Client, CHANNEL *Chan, bool Remote, const char *Format, ...) #else GLOBAL void IRC_WriteStrChannel(Client, Chan, Remote, Format, va_alist) CLIENT *Client; CHANNEL *Chan; bool Remote; const char *Format; va_dcl #endif { char buffer[1000]; va_list ap; assert( Client != NULL ); assert( Format != NULL ); #ifdef PROTOTYPES va_start( ap, Format ); #else va_start( ap ); #endif vsnprintf( buffer, 1000, Format, ap ); va_end( ap ); IRC_WriteStrChannelPrefix(Client, Chan, Client_ThisServer(), Remote, "%s", buffer); } /** * Send a message to all client in a channel using a specific prefix. * * The message is only sent once per remote server. * * @param Client The sending client, excluded while forwarding the message. * @param Channel The target channel. * @param Prefix The prefix to use. * @param Remote If not set, the message is sent to local clients only. * @param Format Format string. */ #ifdef PROTOTYPES GLOBAL void IRC_WriteStrChannelPrefix(CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, bool Remote, const char *Format, ...) #else GLOBAL void IRC_WriteStrChannelPrefix(Client, Chan, Prefix, Remote, Format, va_alist) CLIENT *Client; CHANNEL *Chan; CLIENT *Prefix; bool Remote; const char *Format; va_dcl #endif { char buffer[1000]; CL2CHAN *cl2chan; CONN_ID conn; CLIENT *c; va_list ap; assert( Client != NULL ); assert( Chan != NULL ); assert( Prefix != NULL ); assert( Format != NULL ); #ifdef PROTOTYPES va_start( ap, Format ); #else va_start( ap ); #endif vsnprintf( buffer, 1000, Format, ap ); va_end( ap ); Conn_ClearFlags( ); cl2chan = Channel_FirstMember( Chan ); while(cl2chan) { c = Channel_GetClient( cl2chan ); if (!Remote) { if (Client_Conn(c) <= NONE) c = NULL; else if(Client_Type(c) == CLIENT_SERVER) c = NULL; } if(c) c = Client_NextHop(c); if(c && c != Client) { /* Ok, another Client */ conn = Client_Conn(c); if (Client_Type(c) == CLIENT_SERVER) Conn_SetFlag(conn, SEND_TO_SERVER); else Conn_SetFlag(conn, SEND_TO_USER); } cl2chan = Channel_NextMember(Chan, cl2chan); } Send_Marked_Connections(Prefix, buffer); } /** * Send a message to all the servers in the network. * * @param Client The sending client, excluded while forwarding the message. * @param Format Format string. */ #ifdef PROTOTYPES GLOBAL void IRC_WriteStrServers(CLIENT *ExceptOf, const char *Format, ...) #else GLOBAL void IRC_WriteStrServers(ExceptOf, Format, va_alist) CLIENT *ExceptOf; const char *Format; va_dcl #endif { char buffer[1000]; va_list ap; assert( Format != NULL ); #ifdef PROTOTYPES va_start( ap, Format ); #else va_start( ap ); #endif vsnprintf( buffer, 1000, Format, ap ); va_end( ap ); IRC_WriteStrServersPrefix(ExceptOf, Client_ThisServer(), "%s", buffer); } /** * Send a message to all the servers in the network using a specific prefix. * * @param Client The sending client, excluded while forwarding the message. * @param Prefix The prefix to use. * @param Format Format string. */ #ifdef PROTOTYPES GLOBAL void IRC_WriteStrServersPrefix(CLIENT *ExceptOf, CLIENT *Prefix, const char *Format, ...) #else GLOBAL void IRC_WriteStrServersPrefix(ExceptOf, Prefix, Format, va_alist) CLIENT *ExceptOf; CLIENT *Prefix; const char *Format; va_dcl #endif { char buffer[1000]; va_list ap; assert( Format != NULL ); assert( Prefix != NULL ); #ifdef PROTOTYPES va_start( ap, Format ); #else va_start( ap ); #endif vsnprintf( buffer, 1000, Format, ap ); va_end( ap ); IRC_WriteStrServersPrefixFlag( ExceptOf, Prefix, '\0', "%s", buffer ); } /** * Send a message to all the servers in the network using a specific prefix * and matching a "client flag". * * @param Client The sending client, excluded while forwarding the message. * @param Prefix The prefix to use. * @param Flag Client flag that must be set on the target. * @param Format Format string. */ #ifdef PROTOTYPES GLOBAL void IRC_WriteStrServersPrefixFlag(CLIENT *ExceptOf, CLIENT *Prefix, char Flag, const char *Format, ...) #else GLOBAL void IRC_WriteStrServersPrefixFlag(ExceptOf, Prefix, Flag, Format, va_alist) CLIENT *ExceptOf; CLIENT *Prefix; char Flag; const char *Format; va_dcl #endif { char buffer[1000]; va_list ap; assert( Format != NULL ); assert( Prefix != NULL ); #ifdef PROTOTYPES va_start( ap, Format ); #else va_start( ap ); #endif vsnprintf( buffer, 1000, Format, ap ); va_end( ap ); IRC_WriteStrServersPrefixFlag_CB(ExceptOf, Prefix, Flag, cb_writeStrServersPrefixFlag, buffer); } /** * Send a message to all the servers in the network using a specific prefix * and matching a "client flag" using a callback function. * * @param Client The sending client, excluded while forwarding the message. * @param Prefix The prefix to use. * @param Flag Client flag that must be set on the target. * @param callback Callback function. * @param Format Format string. */ GLOBAL void IRC_WriteStrServersPrefixFlag_CB(CLIENT *ExceptOf, CLIENT *Prefix, char Flag, void (*callback)(CLIENT *, CLIENT *, void *), void *cb_data) { CLIENT *c; c = Client_First(); while(c) { if (Client_Type(c) == CLIENT_SERVER && Client_Conn(c) > NONE && c != Client_ThisServer() && c != ExceptOf) { /* Found a target server, do the flags match? */ if (Flag == '\0' || Client_HasFlag(c, Flag)) callback(c, Prefix, cb_data); } c = Client_Next(c); } } /** * Send a message to all "related" clients. * * Related clients are the one that share one ore more channels with the client * sending this message. * * The message is only sent once per remote server. * * @param Client The sending client, excluded while forwarding the message. * @param Prefix The prefix to use. * @param Remote If not set, the message is sent to local clients only. * @param Format Format string. */ #ifdef PROTOTYPES GLOBAL void IRC_WriteStrRelatedPrefix(CLIENT *Client, CLIENT *Prefix, bool Remote, const char *Format, ...) #else GLOBAL void IRC_WriteStrRelatedPrefix(Client, Prefix, Remote, Format, va_alist) CLIENT *Client; CLIENT *Prefix; bool Remote; const char *Format; va_dcl #endif { CL2CHAN *chan_cl2chan, *cl2chan; char buffer[1000]; CHANNEL *chan; CONN_ID conn; va_list ap; CLIENT *c; assert( Client != NULL ); assert( Prefix != NULL ); assert( Format != NULL ); #ifdef PROTOTYPES va_start( ap, Format ); #else va_start( ap ); #endif vsnprintf( buffer, 1000, Format, ap ); va_end( ap ); Conn_ClearFlags( ); chan_cl2chan = Channel_FirstChannelOf( Client ); while( chan_cl2chan ) { chan = Channel_GetChannel( chan_cl2chan ); cl2chan = Channel_FirstMember( chan ); while( cl2chan ) { c = Channel_GetClient( cl2chan ); if( ! Remote ) { if( Client_Conn( c ) <= NONE ) c = NULL; else if( Client_Type( c ) == CLIENT_SERVER ) c = NULL; } if( c ) c = Client_NextHop( c ); if( c && ( c != Client )) { conn = Client_Conn( c ); if( Client_Type( c ) == CLIENT_SERVER ) Conn_SetFlag( conn, SEND_TO_SERVER ); else Conn_SetFlag( conn, SEND_TO_USER ); } cl2chan = Channel_NextMember( chan, cl2chan ); } chan_cl2chan = Channel_NextChannelOf( Client, chan_cl2chan ); } Send_Marked_Connections(Prefix, buffer); } /* IRC_WriteStrRelatedPrefix */ /** * Send WALLOPS message. * * @param Client The sending client, excluded while forwarding the message. * @param From The (remote) sender of the message. * @param Format Format string. */ #ifdef PROTOTYPES GLOBAL void IRC_SendWallops(CLIENT *Client, CLIENT *From, const char *Format, ...) #else GLOBAL void IRC_SendWallops(Client, From, Format, va_alist ) CLIENT *Client; CLIENT *From; const char *Format; va_dcl #endif { va_list ap; char msg[1000]; CLIENT *to; #ifdef PROTOTYPES va_start(ap, Format); #else va_start(ap); #endif vsnprintf(msg, 1000, Format, ap); va_end(ap); for (to=Client_First(); to != NULL; to=Client_Next(to)) { if (Client_Conn(to) == NONE) /* no local connection */ continue; switch (Client_Type(to)) { case CLIENT_USER: if (Client_HasMode(to, 'w')) IRC_WriteStrClientPrefix(to, From, "WALLOPS :%s", msg); break; case CLIENT_SERVER: if (to != Client) IRC_WriteStrClientPrefix(to, From, "WALLOPS :%s", msg); break; } } } /* IRC_SendWallops */ /** * Set a "penalty time" for an IRC client. * * Note: penalty times are never set for server links or remote clients! * * @param Client The client. * @param Seconds The additional "penalty time" to enforce. */ GLOBAL void IRC_SetPenalty(CLIENT *Client, time_t Seconds) { CONN_ID c; assert(Client != NULL); assert(Seconds > 0); if (Client_Type(Client) == CLIENT_SERVER) return; c = Client_Conn(Client); if (c <= NONE) return; Conn_SetPenalty(c, Seconds); } /* IRC_SetPenalty */ static const char * Get_Prefix(CLIENT *Target, CLIENT *Client) { assert (Target != NULL); assert (Client != NULL); if (Client_Type(Target) == CLIENT_SERVER) return Client_ID(Client); else return Client_MaskCloaked(Client); } /* Get_Prefix */ static void cb_writeStrServersPrefixFlag(CLIENT *Client, CLIENT *Prefix, void *Buffer) { IRC_WriteStrClientPrefix(Client, Prefix, "%s", Buffer); } /* cb_writeStrServersPrefixFlag */ /** * Send a message to all marked connections using a specific prefix. * * @param Prefix The prefix to use. * @param Buffer The message to send. */ static void Send_Marked_Connections(CLIENT *Prefix, const char *Buffer) { CONN_ID conn; assert(Prefix != NULL); assert(Buffer != NULL); conn = Conn_First(); while (conn != NONE) { if (Conn_Flag(conn) == SEND_TO_SERVER) Conn_WriteStr(conn, ":%s %s", Client_ID(Prefix), Buffer); else if (Conn_Flag(conn) == SEND_TO_USER) Conn_WriteStr(conn, ":%s %s", Client_MaskCloaked(Prefix), Buffer); conn = Conn_Next(conn); } } /* -eof- */ ngircd-21/src/ngircd/resolve.c0000644000175000116100000002536512206130744013353 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #define RESOLVER_TIMEOUT (Conf_PongTimeout*3)/4 #include "portab.h" /** * @file * Asynchronous resolver */ #include "imp.h" #include #include #include #include #include #include #include #include #include #ifdef IDENTAUTH #ifdef HAVE_IDENT_H #include #endif #endif #include "array.h" #include "conn.h" #include "conf.h" #include "defines.h" #include "log.h" #include "ng_ipaddr.h" #include "exp.h" #include "resolve.h" #include "io.h" static void Do_ResolveAddr PARAMS(( const ng_ipaddr_t *Addr, int Sock, int w_fd )); static void Do_ResolveName PARAMS(( const char *Host, int w_fd )); #ifdef WANT_IPV6 extern bool Conf_ConnectIPv4; extern bool Conf_ConnectIPv6; #endif /** * Resolve IP (asynchronous!). */ GLOBAL bool Resolve_Addr(PROC_STAT * s, const ng_ipaddr_t *Addr, int identsock, void (*cbfunc) (int, short)) { int pipefd[2]; pid_t pid; assert(s != NULL); pid = Proc_Fork(s, pipefd, cbfunc, RESOLVER_TIMEOUT); if (pid > 0) { LogDebug("Resolver for %s created (PID %d).", ng_ipaddr_tostr(Addr), pid); return true; } else if( pid == 0 ) { /* Sub process */ Log_Init_Subprocess("Resolver"); Conn_CloseAllSockets(identsock); Do_ResolveAddr(Addr, identsock, pipefd[1]); Log_Exit_Subprocess("Resolver"); exit(0); } return false; } /* Resolve_Addr */ /** * Resolve hostname (asynchronous!). */ GLOBAL bool Resolve_Name( PROC_STAT *s, const char *Host, void (*cbfunc)(int, short)) { int pipefd[2]; pid_t pid; assert(s != NULL); pid = Proc_Fork(s, pipefd, cbfunc, RESOLVER_TIMEOUT); if (pid > 0) { /* Main process */ #ifdef DEBUG Log( LOG_DEBUG, "Resolver for \"%s\" created (PID %d).", Host, pid ); #endif return true; } else if( pid == 0 ) { /* Sub process */ Log_Init_Subprocess("Resolver"); Conn_CloseAllSockets(NONE); Do_ResolveName(Host, pipefd[1]); Log_Exit_Subprocess("Resolver"); exit(0); } return false; } /* Resolve_Name */ #if !defined(HAVE_GETADDRINFO) || !defined(HAVE_GETNAMEINFO) #if !defined(WANT_IPV6) && defined(h_errno) static char * Get_Error( int H_Error ) { /* Get error message for H_Error */ switch( H_Error ) { case HOST_NOT_FOUND: return "host not found"; case NO_DATA: return "name valid but no IP address defined"; case NO_RECOVERY: return "name server error"; case TRY_AGAIN: return "name server temporary not available"; } return "unknown error"; } #endif #endif /* Do "IDENT" (aka "AUTH") lookup and append result to resolved_addr array */ static void Do_IdentQuery(int identsock, array *resolved_addr) { #ifdef IDENTAUTH char *res; if (identsock < 0) return; #ifdef DEBUG Log_Subprocess(LOG_DEBUG, "Doing IDENT lookup on socket %d ...", identsock); #endif res = ident_id( identsock, 10 ); #ifdef DEBUG Log_Subprocess(LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"", identsock, res ? res : "(NULL)"); #endif if (!res) /* no result */ return; if (!array_cats(resolved_addr, res)) Log_Subprocess(LOG_WARNING, "Resolver: Cannot copy IDENT result: %s!", strerror(errno)); free(res); #else (void) identsock; (void) resolved_addr; #endif } /** * perform reverse DNS lookup and put result string into resbuf. * If no hostname could be obtained, this function stores the string representation of * the IP address in resbuf and returns false. * @param IpAddr ip address to resolve * @param resbuf result buffer to store DNS name/string representation of ip address * @param reslen size of result buffer (must be >= NGT_INET_ADDRSTRLEN) * @return true if reverse lookup successful, false otherwise */ static bool ReverseLookup(const ng_ipaddr_t *IpAddr, char *resbuf, size_t reslen) { char tmp_ip_str[NG_INET_ADDRSTRLEN]; const char *errmsg; #ifdef HAVE_GETNAMEINFO static const char funcname[]="getnameinfo"; int res; *resbuf = 0; res = getnameinfo((struct sockaddr *) IpAddr, ng_ipaddr_salen(IpAddr), resbuf, (socklen_t)reslen, NULL, 0, NI_NAMEREQD); if (res == 0) return true; if (res == EAI_SYSTEM) errmsg = strerror(errno); else errmsg = gai_strerror(res); #else const struct sockaddr_in *Addr = (const struct sockaddr_in *) IpAddr; struct hostent *h; static const char funcname[]="gethostbyaddr"; h = gethostbyaddr((char *)&Addr->sin_addr, sizeof(Addr->sin_addr), AF_INET); if (h) { if (strlcpy(resbuf, h->h_name, reslen) < reslen) return true; errmsg = "hostname too long"; } else { # ifdef h_errno errmsg = Get_Error(h_errno); # else errmsg = "unknown error"; # endif /* h_errno */ } #endif /* HAVE_GETNAMEINFO */ assert(errmsg); assert(reslen >= NG_INET_ADDRSTRLEN); ng_ipaddr_tostr_r(IpAddr, tmp_ip_str); Log_Subprocess(LOG_WARNING, "%s: Can't resolve address \"%s\": %s", funcname, tmp_ip_str, errmsg); strlcpy(resbuf, tmp_ip_str, reslen); return false; } /** * perform DNS lookup of given host name and fill IpAddr with a list of * ip addresses associated with that name. * ip addresses found are stored in the "array *IpAddr" argument (type ng_ipaddr_t) * @param hostname The domain name to look up. * @param IpAddr pointer to empty and initialized array to store results * @return true if lookup successful, false if domain name not found */ static bool ForwardLookup(const char *hostname, array *IpAddr, int af) { ng_ipaddr_t addr; #ifdef HAVE_GETADDRINFO int res; struct addrinfo *a, *ai_results; static struct addrinfo hints; #ifdef AI_ADDRCONFIG /* glibc has this, but not e.g. netbsd 4.0 */ hints.ai_flags = AI_ADDRCONFIG; #endif hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; hints.ai_family = af; memset(&addr, 0, sizeof(addr)); res = getaddrinfo(hostname, NULL, &hints, &ai_results); switch (res) { case 0: break; case EAI_SYSTEM: Log_Subprocess(LOG_WARNING, "Can't resolve \"%s\": %s", hostname, strerror(errno)); return false; default: Log_Subprocess(LOG_WARNING, "Can't resolve \"%s\": %s", hostname, gai_strerror(res)); return false; } for (a = ai_results; a != NULL; a = a->ai_next) { assert((size_t)a->ai_addrlen <= sizeof(addr)); if ((size_t)a->ai_addrlen > sizeof(addr)) continue; memcpy(&addr, a->ai_addr, a->ai_addrlen); if (!array_catb(IpAddr, (char *)&addr, sizeof(addr))) break; } freeaddrinfo(ai_results); return a == NULL; #else struct hostent *h = gethostbyname(hostname); if (!h) { #ifdef h_errno Log_Subprocess(LOG_WARNING, "Can't resolve \"%s\": %s", hostname, Get_Error(h_errno)); #else Log_Subprocess(LOG_WARNING, "Can't resolve \"%s\"", hostname); #endif return false; } memset(&addr, 0, sizeof(addr)); addr.sin4.sin_family = AF_INET; memcpy(&addr.sin4.sin_addr, h->h_addr, sizeof(struct in_addr)); return array_copyb(IpAddr, (char *)&addr, sizeof(addr)); #endif /* HAVE_GETADDRINFO */ } static bool Addr_in_list(const array *resolved_addr, const ng_ipaddr_t *Addr) { char tmp_ip_str[NG_INET_ADDRSTRLEN]; const ng_ipaddr_t *tmpAddrs = array_start(resolved_addr); size_t len = array_length(resolved_addr, sizeof(*tmpAddrs)); assert(len > 0); assert(tmpAddrs); while (len > 0) { if (ng_ipaddr_ipequal(Addr, tmpAddrs)) return true; tmpAddrs++; len--; } /* failed; print list of addresses */ ng_ipaddr_tostr_r(Addr, tmp_ip_str); len = array_length(resolved_addr, sizeof(*tmpAddrs)); tmpAddrs = array_start(resolved_addr); while (len > 0) { Log_Subprocess(LOG_WARNING, "Address mismatch: %s != %s", tmp_ip_str, ng_ipaddr_tostr(tmpAddrs)); tmpAddrs++; len--; } return false; } static void Log_Forgery_NoIP(const char *ip, const char *host) { Log_Subprocess(LOG_WARNING, "Possible forgery: %s resolved to %s (which has no ip address)", ip, host); } static void Log_Forgery_WrongIP(const char *ip, const char *host) { Log_Subprocess(LOG_WARNING, "Possible forgery: %s resolved to %s (which points to different address)", ip, host); } static void ArrayWrite(int fd, const array *a) { size_t len = array_bytes(a); const char *data = array_start(a); assert(data); if( (size_t)write(fd, data, len) != len ) Log_Subprocess( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror(errno)); } static void Do_ResolveAddr(const ng_ipaddr_t *Addr, int identsock, int w_fd) { /* Resolver sub-process: resolve IP address and write result into * pipe to parent. */ char hostname[CLIENT_HOST_LEN]; char tmp_ip_str[NG_INET_ADDRSTRLEN]; size_t len; array resolved_addr; array_init(&resolved_addr); ng_ipaddr_tostr_r(Addr, tmp_ip_str); #ifdef DEBUG Log_Subprocess(LOG_DEBUG, "Now resolving %s ...", tmp_ip_str); #endif if (!ReverseLookup(Addr, hostname, sizeof(hostname))) goto dns_done; if (ForwardLookup(hostname, &resolved_addr, ng_ipaddr_af(Addr))) { if (!Addr_in_list(&resolved_addr, Addr)) { Log_Forgery_WrongIP(tmp_ip_str, hostname); strlcpy(hostname, tmp_ip_str, sizeof(hostname)); } } else { Log_Forgery_NoIP(tmp_ip_str, hostname); strlcpy(hostname, tmp_ip_str, sizeof(hostname)); } #ifdef DEBUG Log_Subprocess(LOG_DEBUG, "Ok, translated %s to \"%s\".", tmp_ip_str, hostname); #endif dns_done: len = strlen(hostname); hostname[len] = '\n'; if (!array_copyb(&resolved_addr, hostname, ++len)) { Log_Subprocess(LOG_CRIT, "Resolver: Can't copy resolved name: %s!", strerror(errno)); array_free(&resolved_addr); return; } Do_IdentQuery(identsock, &resolved_addr); ArrayWrite(w_fd, &resolved_addr); array_free(&resolved_addr); } /* Do_ResolveAddr */ static void Do_ResolveName( const char *Host, int w_fd ) { /* Resolver sub-process: resolve name and write result into pipe * to parent. */ array IpAddrs; int af; #ifdef DEBUG ng_ipaddr_t *addr; size_t len; #endif Log_Subprocess(LOG_DEBUG, "Now resolving \"%s\" ...", Host); array_init(&IpAddrs); #ifdef WANT_IPV6 af = AF_UNSPEC; assert(Conf_ConnectIPv6 || Conf_ConnectIPv4); if (!Conf_ConnectIPv6) af = AF_INET; if (!Conf_ConnectIPv4) af = AF_INET6; #else af = AF_INET; #endif if (!ForwardLookup(Host, &IpAddrs, af)) { close(w_fd); return; } #ifdef DEBUG len = array_length(&IpAddrs, sizeof(*addr)); assert(len > 0); addr = array_start(&IpAddrs); assert(addr); for (; len > 0; --len,addr++) { Log_Subprocess(LOG_DEBUG, "translated \"%s\" to %s.", Host, ng_ipaddr_tostr(addr)); } #endif /* Write result into pipe to parent */ ArrayWrite(w_fd, &IpAddrs); array_free(&IpAddrs); } /* Do_ResolveName */ /* -eof- */ ngircd-21/src/ngircd/irc-server.c0000644000175000116100000003106512230312353013742 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * IRC commands for server links */ #include "imp.h" #include #include #include #include #include #include "defines.h" #include "conn.h" #include "conn-func.h" #include "conn-zip.h" #include "conf.h" #include "channel.h" #include "lists.h" #include "log.h" #include "messages.h" #include "parse.h" #include "numeric.h" #include "ngircd.h" #include "irc-info.h" #include "irc-macros.h" #include "irc-write.h" #include "op.h" #include "exp.h" #include "irc-server.h" /** * Handler for the IRC "SERVER" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_SERVER( CLIENT *Client, REQUEST *Req ) { char str[100]; CLIENT *from, *c; int i; assert( Client != NULL ); assert( Req != NULL ); /* Return an error if this is not a local client */ if (Client_Conn(Client) <= NONE) return IRC_WriteErrClient(Client, ERR_UNKNOWNCOMMAND_MSG, Client_ID(Client), Req->command); if (Client_Type(Client) == CLIENT_GOTPASS || Client_Type(Client) == CLIENT_GOTPASS_2813) { /* We got a PASS command from the peer, and now a SERVER * command: the peer tries to register itself as a server. */ LogDebug("Connection %d: got SERVER command (new server link) ...", Client_Conn(Client)); if (Req->argc != 2 && Req->argc != 3) { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } /* Get configuration index of new remote server ... */ for (i = 0; i < MAX_SERVERS; i++) if (strcasecmp(Req->argv[0], Conf_Server[i].name) == 0) break; /* Make sure the remote server is configured here */ if (i >= MAX_SERVERS) { Log(LOG_ERR, "Connection %d: Server \"%s\" not configured here!", Client_Conn(Client), Req->argv[0]); Conn_Close(Client_Conn(Client), NULL, "Server not configured here", true); return DISCONNECTED; } /* Check server password */ if (strcmp(Conn_Password(Client_Conn(Client)), Conf_Server[i].pwd_in) != 0) { Log(LOG_ERR, "Connection %d: Got bad password from server \"%s\"!", Client_Conn(Client), Req->argv[0]); Conn_Close(Client_Conn(Client), NULL, "Bad password", true); return DISCONNECTED; } /* Is there a registered server with this ID? */ if (!Client_CheckID(Client, Req->argv[0])) return DISCONNECTED; /* Mark this connection as belonging to an configured server */ if (!Conf_SetServer(i, Client_Conn(Client))) return DISCONNECTED; Client_SetID( Client, Req->argv[0] ); Client_SetHops( Client, 1 ); Client_SetInfo( Client, Req->argv[Req->argc - 1] ); /* Is this server registering on our side, or are we connecting to * a remote server? */ if (Client_Token(Client) != TOKEN_OUTBOUND) { /* Incoming connection, send user/pass */ if (!IRC_WriteStrClient(Client, "PASS %s %s", Conf_Server[i].pwd_out, NGIRCd_ProtoID) || !IRC_WriteStrClient(Client, "SERVER %s 1 :%s", Conf_ServerName, Conf_ServerInfo)) { Conn_Close(Client_Conn(Client), "Unexpected server behavior!", NULL, false); return DISCONNECTED; } Client_SetIntroducer(Client, Client); Client_SetToken(Client, 1); } else { /* outgoing connect, we already sent a SERVER and PASS * command to the peer */ Client_SetToken(Client, atoi(Req->argv[1])); } /* Check protocol level */ if (Client_Type(Client) == CLIENT_GOTPASS) { /* We got a "simple" PASS command, so the peer is * using the protocol as defined in RFC 1459. */ if (! (Conn_Options(Client_Conn(Client)) & CONN_RFC1459)) Log(LOG_INFO, "Switching connection %d (\"%s\") to RFC 1459 compatibility mode.", Client_Conn(Client), Client_ID(Client)); Conn_SetOption(Client_Conn(Client), CONN_RFC1459); } Client_SetType(Client, CLIENT_UNKNOWNSERVER); #ifdef ZLIB if (Client_HasFlag(Client, 'Z') && !Zip_InitConn(Client_Conn(Client))) { Conn_Close(Client_Conn(Client), "Can't initialize compression (zlib)!", NULL, false ); return DISCONNECTED; } #endif #ifdef IRCPLUS if (Client_HasFlag(Client, 'H')) { LogDebug("Peer supports IRC+ extended server handshake ..."); if (!IRC_Send_ISUPPORT(Client)) return DISCONNECTED; return IRC_WriteStrClient(Client, RPL_ENDOFMOTD_MSG, Client_ID(Client)); } else { #endif if (Conf_MaxNickLength != CLIENT_NICK_LEN_DEFAULT) Log(LOG_CRIT, "Attention: this server uses a non-standard nick length, but the peer doesn't support the IRC+ extended server handshake!"); #ifdef IRCPLUS } #endif return IRC_Num_ENDOFMOTD(Client, Req); } else if( Client_Type( Client ) == CLIENT_SERVER ) { /* New server is being introduced to the network */ if (Req->argc != 4) { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } /* check for existing server with same ID */ if (!Client_CheckID(Client, Req->argv[0])) return DISCONNECTED; from = Client_Search( Req->prefix ); if (! from) { /* Uh, Server, that introduced the new server is unknown?! */ Log(LOG_ALERT, "Unknown ID in prefix of SERVER: \"%s\"! (on connection %d)", Req->prefix, Client_Conn(Client)); Conn_Close(Client_Conn(Client), NULL, "Unknown ID in prefix of SERVER", true); return DISCONNECTED; } c = Client_NewRemoteServer(Client, Req->argv[0], from, atoi(Req->argv[1]), atoi(Req->argv[2]), Req->argv[3], true); if (!c) { Log(LOG_ALERT, "Can't create client structure for server! (on connection %d)", Client_Conn(Client)); Conn_Close(Client_Conn(Client), NULL, "Can't allocate client structure for remote server", true); return DISCONNECTED; } if (Client_Hops(c) > 1 && Req->prefix[0]) snprintf(str, sizeof(str), "connected to %s, ", Client_ID(from)); else strcpy(str, ""); Log(LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (via %s, %s%d hop%s).", Client_ID(c), Client_ID(Client), str, Client_Hops(c), Client_Hops(c) > 1 ? "s": "" ); /* notify other servers */ IRC_WriteStrServersPrefix(Client, from, "SERVER %s %d %d :%s", Client_ID(c), Client_Hops(c) + 1, Client_MyToken(c), Client_Info(c)); return CONNECTED; } else { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } } /* IRC_SERVER */ /* * Handler for the IRC "NJOIN" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_NJOIN( CLIENT *Client, REQUEST *Req ) { char nick_in[COMMAND_LEN], nick_out[COMMAND_LEN], *channame, *ptr, modes[8]; bool is_owner, is_chanadmin, is_op, is_halfop, is_voiced; CHANNEL *chan; CLIENT *c; assert( Client != NULL ); assert( Req != NULL ); strlcpy( nick_in, Req->argv[1], sizeof( nick_in )); strcpy( nick_out, "" ); channame = Req->argv[0]; ptr = strtok( nick_in, "," ); while( ptr ) { is_owner = is_chanadmin = is_op = is_halfop = is_voiced = false; /* cut off prefixes */ while(( *ptr == '~') || ( *ptr == '&' ) || ( *ptr == '@' ) || ( *ptr == '%') || ( *ptr == '+' )) { if( *ptr == '~' ) is_owner = true; if( *ptr == '&' ) is_chanadmin = true; if( *ptr == '@' ) is_op = true; if( *ptr == 'h' ) is_halfop = true; if( *ptr == '+' ) is_voiced = true; ptr++; } c = Client_Search( ptr ); if( c ) { Channel_Join( c, channame ); chan = Channel_Search( channame ); assert( chan != NULL ); if( is_owner ) Channel_UserModeAdd( chan, c, 'q' ); if( is_chanadmin ) Channel_UserModeAdd( chan, c, 'a' ); if( is_op ) Channel_UserModeAdd( chan, c, 'o' ); if( is_halfop ) Channel_UserModeAdd( chan, c, 'h' ); if( is_voiced ) Channel_UserModeAdd( chan, c, 'v' ); /* announce to channel... */ IRC_WriteStrChannelPrefix( Client, chan, c, false, "JOIN :%s", channame ); /* set Channel-User-Modes */ strlcpy( modes, Channel_UserModes( chan, c ), sizeof( modes )); if( modes[0] ) { /* send modes to channel */ IRC_WriteStrChannelPrefix( Client, chan, Client, false, "MODE %s +%s %s", channame, modes, Client_ID( c )); } if( nick_out[0] != '\0' ) strlcat( nick_out, ",", sizeof( nick_out )); if( is_owner ) strlcat( nick_out, "~", sizeof( nick_out )); if( is_chanadmin ) strlcat( nick_out, "&", sizeof( nick_out )); if( is_op ) strlcat( nick_out, "@", sizeof( nick_out )); if( is_halfop ) strlcat( nick_out, "%", sizeof( nick_out )); if( is_voiced ) strlcat( nick_out, "+", sizeof( nick_out )); strlcat( nick_out, ptr, sizeof( nick_out )); } else Log( LOG_ERR, "Got NJOIN for unknown nick \"%s\" for channel \"%s\"!", ptr, channame ); /* search for next Nick */ ptr = strtok( NULL, "," ); } /* forward to other servers */ if (nick_out[0] != '\0') IRC_WriteStrServersPrefix(Client, Client_ThisServer(), "NJOIN %s :%s", Req->argv[0], nick_out); return CONNECTED; } /* IRC_NJOIN */ /** * Handler for the IRC "SQUIT" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_SQUIT(CLIENT * Client, REQUEST * Req) { char msg[COMMAND_LEN], logmsg[COMMAND_LEN]; CLIENT *from, *target; CONN_ID con; int loglevel; assert(Client != NULL); assert(Req != NULL); if (Client_Type(Client) != CLIENT_SERVER && !Client_HasMode(Client, 'o')) return Op_NoPrivileges(Client, Req); if (Client_Type(Client) == CLIENT_SERVER && Req->prefix) { from = Client_Search(Req->prefix); if (Client_Type(from) != CLIENT_SERVER && !Op_Check(Client, Req)) return Op_NoPrivileges(Client, Req); } else from = Client; if (!from) return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->prefix); if (Client_Type(Client) == CLIENT_USER) loglevel = LOG_NOTICE | LOG_snotice; else loglevel = LOG_DEBUG; Log(loglevel, "Got SQUIT from %s for \"%s\": \"%s\" ...", Client_ID(from), Req->argv[0], Req->argv[1]); target = Client_Search(Req->argv[0]); if (Client_Type(Client) != CLIENT_SERVER && target == Client_ThisServer()) return Op_NoPrivileges(Client, Req); if (!target) { /* The server is (already) unknown */ Log(LOG_WARNING, "Got SQUIT from %s for unknown server \"%s\"!?", Client_ID(Client), Req->argv[0]); return CONNECTED; } con = Client_Conn(target); if (Req->argv[1][0]) if (Client_NextHop(from) != Client || con > NONE) snprintf(msg, sizeof(msg), "\"%s\" (SQUIT from %s)", Req->argv[1], Client_ID(from)); else strlcpy(msg, Req->argv[1], sizeof(msg)); else snprintf(msg, sizeof(msg), "Got SQUIT from %s", Client_ID(from)); if (con > NONE) { /* We are directly connected to the target server, so we * have to tear down the connection and to inform all the * other remaining servers in the network */ IRC_SendWallops(Client_ThisServer(), Client_ThisServer(), "Received SQUIT %s from %s: %s", Req->argv[0], Client_ID(from), Req->argv[1][0] ? Req->argv[1] : "-"); Conn_Close(con, NULL, msg, true); if (con == Client_Conn(Client)) return DISCONNECTED; } else { /* This server is not directly connected, so the SQUIT must * be forwarded ... */ if (Client_Type(from) != CLIENT_SERVER) { /* The origin is not an IRC server, so don't evaluate * this SQUIT but simply forward it */ IRC_WriteStrClientPrefix(Client_NextHop(target), from, "SQUIT %s :%s", Req->argv[0], Req->argv[1]); } else { /* SQUIT has been generated by another server, so * remove the target server from the network! */ logmsg[0] = '\0'; if (!strchr(msg, '(')) snprintf(logmsg, sizeof(logmsg), "\"%s\" (SQUIT from %s)", Req->argv[1], Client_ID(from)); Client_Destroy(target, logmsg[0] ? logmsg : msg, msg, false); } } return CONNECTED; } /* IRC_SQUIT */ /* -eof- */ ngircd-21/src/ngircd/io.c0000644000175000116100000004504012206130744012273 00000000000000/* * 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. * * Copyright (c) 2005 Florian Westphal (westphal@foo.fh-furtwangen.de) */ #include "portab.h" /** * @file * I/O abstraction interface. */ #include #include #include #include #include #include #include #include "array.h" #include "io.h" #include "log.h" /* Enables extra debug messages in event add/delete/callback code. */ /* #define DEBUG_IO */ typedef struct { #ifdef PROTOTYPES void (*callback)(int, short); #else void (*callback)(); #endif short what; } io_event; #define INIT_IOEVENT { NULL, -1, 0, NULL } #define IO_ERROR 4 #define MAX_EVENTS 100 #ifdef HAVE_EPOLL_CREATE # define IO_USE_EPOLL 1 # ifdef HAVE_SELECT # define IO_USE_SELECT 1 # endif #else # ifdef HAVE_KQUEUE # define IO_USE_KQUEUE 1 # else # ifdef HAVE_SYS_DEVPOLL_H # define IO_USE_DEVPOLL 1 # else # if defined(HAVE_POLL) && defined(HAVE_POLL_H) # define IO_USE_POLL 1 # else # ifdef HAVE_SELECT # define IO_USE_SELECT 1 # else # error "no IO API available!?" # endif /* HAVE_SELECT */ # endif /* HAVE_POLL */ # endif /* HAVE_SYS_DEVPOLL_H */ # endif /* HAVE_KQUEUE */ #endif /* HAVE_EPOLL_CREATE */ static bool library_initialized = false; #ifdef IO_USE_EPOLL #include static int io_masterfd = -1; static bool io_event_change_epoll(int fd, short what, const int action); static int io_dispatch_epoll(struct timeval *tv); #endif #ifdef IO_USE_KQUEUE #include #include static array io_evcache; static int io_masterfd; static int io_dispatch_kqueue(struct timeval *tv); static bool io_event_change_kqueue(int, short, const int action); #ifndef EV_SET /* Taken from /usr/include/sys/event.h of FreeBSD 8.1 and required by all * platforms that have kqueue but lack EV_SET() -- for example FreeBSD 4. */ #define EV_SET(kevp, a, b, c, d, e, f) do { \ struct kevent *__kevp__ = (kevp); \ __kevp__->ident = (a); \ __kevp__->filter = (b); \ __kevp__->flags = (c); \ __kevp__->fflags = (d); \ __kevp__->data = (e); \ __kevp__->udata = (f); \ } while(0) #endif #endif #ifdef IO_USE_POLL #include static array pollfds; static int poll_maxfd; static bool io_event_change_poll PARAMS((int fd, short what)); #endif #ifdef IO_USE_DEVPOLL #include static int io_masterfd; static bool io_event_change_devpoll(int fd, short what); #endif #ifdef IO_USE_SELECT #include "defines.h" /* for conn.h */ #include "proc.h" /* for PROC_STAT (needed by conf.h) */ #include "conn.h" /* for CONN_ID (needed by conf.h) */ #include "conf.h" /* for Conf_MaxConnections */ static fd_set readers; static fd_set writers; /* * this is the first argument for select(), i.e. * the largest fd registered, plus one. */ static int select_maxfd; static int io_dispatch_select PARAMS((struct timeval *tv)); #ifndef IO_USE_EPOLL #define io_masterfd -1 #endif #endif /* IO_USE_SELECT */ static array io_events; static void io_docallback PARAMS((int fd, short what)); #ifdef DEBUG_IO static void io_debug(const char *s, int fd, int what) { Log(LOG_DEBUG, "%s: %d, %d\n", s, fd, what); } #else static inline void io_debug(const char UNUSED *s,int UNUSED a, int UNUSED b) { /* NOTHING */ } #endif static io_event * io_event_get(int fd) { io_event *i; assert(fd >= 0); i = (io_event *) array_get(&io_events, sizeof(io_event), (size_t) fd); assert(i != NULL); return i; } #ifdef IO_USE_DEVPOLL static int io_dispatch_devpoll(struct timeval *tv) { struct dvpoll dvp; time_t sec = tv->tv_sec * 1000; int i, ret, timeout = tv->tv_usec + sec; short what; struct pollfd p[MAX_EVENTS]; if (timeout < 0) timeout = 1000; dvp.dp_timeout = timeout; dvp.dp_nfds = MAX_EVENTS; dvp.dp_fds = p; ret = ioctl(io_masterfd, DP_POLL, &dvp); for (i=0; i < ret ; i++) { what = 0; if (p[i].revents & (POLLIN|POLLPRI)) what = IO_WANTREAD; if (p[i].revents & POLLOUT) what |= IO_WANTWRITE; if (p[i].revents && !what) { /* other flag is set, probably POLLERR */ what = IO_ERROR; } io_docallback(p[i].fd, what); } return ret; } static bool io_event_change_devpoll(int fd, short what) { struct pollfd p; p.events = 0; if (what & IO_WANTREAD) p.events = POLLIN | POLLPRI; if (what & IO_WANTWRITE) p.events |= POLLOUT; p.fd = fd; return write(io_masterfd, &p, sizeof p) == (ssize_t)sizeof p; } static void io_close_devpoll(int fd) { struct pollfd p; p.events = POLLREMOVE; p.fd = fd; write(io_masterfd, &p, sizeof p); } static void io_library_init_devpoll(unsigned int eventsize) { io_masterfd = open("/dev/poll", O_RDWR); if (io_masterfd >= 0) library_initialized = true; Log(LOG_INFO, "IO subsystem: /dev/poll (initial maxfd %u, masterfd %d).", eventsize, io_masterfd); } #else static inline void io_close_devpoll(int UNUSED x) { /* NOTHING */ } static inline void io_library_init_devpoll(unsigned int UNUSED ev) { /* NOTHING */ } #endif #ifdef IO_USE_POLL static int io_dispatch_poll(struct timeval *tv) { time_t sec = tv->tv_sec * 1000; int i, ret, timeout = tv->tv_usec + sec; int fds_ready; short what; struct pollfd *p = array_start(&pollfds); if (timeout < 0) timeout = 1000; ret = poll(p, poll_maxfd + 1, timeout); if (ret <= 0) return ret; fds_ready = ret; for (i=0; i <= poll_maxfd; i++) { what = 0; if (p[i].revents & (POLLIN|POLLPRI)) what = IO_WANTREAD; if (p[i].revents & POLLOUT) what |= IO_WANTWRITE; if (p[i].revents && !what) { /* other flag is set, probably POLLERR */ what = IO_ERROR; } if (what) { fds_ready--; io_docallback(i, what); } if (fds_ready <= 0) break; } return ret; } static bool io_event_change_poll(int fd, short what) { struct pollfd *p; short events = 0; if (what & IO_WANTREAD) events = POLLIN | POLLPRI; if (what & IO_WANTWRITE) events |= POLLOUT; p = array_alloc(&pollfds, sizeof *p, fd); if (p) { p->events = events; p->fd = fd; if (fd > poll_maxfd) poll_maxfd = fd; } return p != NULL; } static void io_close_poll(int fd) { struct pollfd *p; p = array_get(&pollfds, sizeof *p, fd); if (!p) return; p->fd = -1; if (fd == poll_maxfd) { while (poll_maxfd > 0) { --poll_maxfd; p = array_get(&pollfds, sizeof *p, poll_maxfd); if (p && p->fd >= 0) break; } } } static void io_library_init_poll(unsigned int eventsize) { struct pollfd *p; array_init(&pollfds); poll_maxfd = 0; Log(LOG_INFO, "IO subsystem: poll (initial maxfd %u).", eventsize); p = array_alloc(&pollfds, sizeof(struct pollfd), eventsize); if (p) { unsigned i; p = array_start(&pollfds); for (i = 0; i < eventsize; i++) p[i].fd = -1; library_initialized = true; } } #else static inline void io_close_poll(int UNUSED x) { /* NOTHING */ } static inline void io_library_init_poll(unsigned int UNUSED ev) { /* NOTHING */ } #endif #ifdef IO_USE_SELECT static int io_dispatch_select(struct timeval *tv) { fd_set readers_tmp; fd_set writers_tmp; short what; int ret, i; int fds_ready; readers_tmp = readers; writers_tmp = writers; ret = select(select_maxfd + 1, &readers_tmp, &writers_tmp, NULL, tv); if (ret <= 0) return ret; fds_ready = ret; for (i = 0; i <= select_maxfd; i++) { what = 0; if (FD_ISSET(i, &readers_tmp)) { what = IO_WANTREAD; fds_ready--; } if (FD_ISSET(i, &writers_tmp)) { what |= IO_WANTWRITE; fds_ready--; } if (what) io_docallback(i, what); if (fds_ready <= 0) break; } return ret; } static void io_library_init_select(unsigned int eventsize) { if (library_initialized) return; Log(LOG_INFO, "IO subsystem: select (initial maxfd %u).", eventsize); FD_ZERO(&readers); FD_ZERO(&writers); #ifdef FD_SETSIZE if (Conf_MaxConnections >= (int)FD_SETSIZE) { Log(LOG_WARNING, "MaxConnections (%d) exceeds limit (%u), changed MaxConnections to %u.", Conf_MaxConnections, FD_SETSIZE, FD_SETSIZE - 1); Conf_MaxConnections = FD_SETSIZE - 1; } #else Log(LOG_WARNING, "FD_SETSIZE undefined, don't know how many descriptors select() can handle on your platform ..."); #endif /* FD_SETSIZE */ library_initialized = true; } static void io_close_select(int fd) { io_event *i; if (io_masterfd >= 0) /* Are we using epoll()? */ return; FD_CLR(fd, &writers); FD_CLR(fd, &readers); i = io_event_get(fd); if (!i) return; if (fd == select_maxfd) { while (select_maxfd>0) { --select_maxfd; /* find largest fd */ i = io_event_get(select_maxfd); if (i && i->callback) break; } } } #else static inline void io_library_init_select(int UNUSED x) { /* NOTHING */ } static inline void io_close_select(int UNUSED x) { /* NOTHING */ } #endif /* SELECT */ #ifdef IO_USE_EPOLL static bool io_event_change_epoll(int fd, short what, const int action) { struct epoll_event ev = { 0, {0} }; ev.data.fd = fd; if (what & IO_WANTREAD) ev.events = EPOLLIN | EPOLLPRI; if (what & IO_WANTWRITE) ev.events |= EPOLLOUT; return epoll_ctl(io_masterfd, action, fd, &ev) == 0; } static int io_dispatch_epoll(struct timeval *tv) { time_t sec = tv->tv_sec * 1000; int i, ret, timeout = tv->tv_usec + sec; struct epoll_event epoll_ev[MAX_EVENTS]; short type; if (timeout < 0) timeout = 1000; ret = epoll_wait(io_masterfd, epoll_ev, MAX_EVENTS, timeout); for (i = 0; i < ret; i++) { type = 0; if (epoll_ev[i].events & (EPOLLERR | EPOLLHUP)) type = IO_ERROR; if (epoll_ev[i].events & (EPOLLIN | EPOLLPRI)) type |= IO_WANTREAD; if (epoll_ev[i].events & EPOLLOUT) type |= IO_WANTWRITE; io_docallback(epoll_ev[i].data.fd, type); } return ret; } static void io_library_init_epoll(unsigned int eventsize) { int ecreate_hint = (int)eventsize; if (ecreate_hint <= 0) ecreate_hint = 128; io_masterfd = epoll_create(ecreate_hint); if (io_masterfd >= 0) { library_initialized = true; Log(LOG_INFO, "IO subsystem: epoll (hint size %d, initial maxfd %u, masterfd %d).", ecreate_hint, eventsize, io_masterfd); return; } #ifdef IO_USE_SELECT Log(LOG_INFO, "Can't initialize epoll() IO interface, falling back to select() ..."); #endif } #else static inline void io_library_init_epoll(unsigned int UNUSED ev) { /* NOTHING */ } #endif /* IO_USE_EPOLL */ #ifdef IO_USE_KQUEUE static bool io_event_kqueue_commit_cache(void) { struct kevent *events; bool ret; int len = (int) array_length(&io_evcache, sizeof (struct kevent)); if (!len) /* nothing to do */ return true; assert(len>0); if (len < 0) { array_free(&io_evcache); return false; } events = array_start(&io_evcache); assert(events != NULL); ret = kevent(io_masterfd, events, len, NULL, 0, NULL) == 0; if (ret) array_trunc(&io_evcache); return ret; } static bool io_event_change_kqueue(int fd, short what, const int action) { struct kevent kev; bool ret = true; if (what & IO_WANTREAD) { EV_SET(&kev, fd, EVFILT_READ, action, 0, 0, 0); ret = array_catb(&io_evcache, (char*) &kev, sizeof (kev)); if (!ret) ret = kevent(io_masterfd, &kev,1, NULL, 0, NULL) == 0; } if (ret && (what & IO_WANTWRITE)) { EV_SET(&kev, fd, EVFILT_WRITE, action, 0, 0, 0); ret = array_catb(&io_evcache, (char*) &kev, sizeof (kev)); if (!ret) ret = kevent(io_masterfd, &kev, 1, NULL, 0, NULL) == 0; } if (array_length(&io_evcache, sizeof kev) >= 100) io_event_kqueue_commit_cache(); return ret; } static int io_dispatch_kqueue(struct timeval *tv) { int i, ret; struct kevent kev[MAX_EVENTS]; struct kevent *newevents; struct timespec ts; int newevents_len; ts.tv_sec = tv->tv_sec; ts.tv_nsec = tv->tv_usec * 1000; newevents_len = (int) array_length(&io_evcache, sizeof (struct kevent)); newevents = (newevents_len > 0) ? array_start(&io_evcache) : NULL; assert(newevents_len >= 0); ret = kevent(io_masterfd, newevents, newevents_len, kev, MAX_EVENTS, &ts); if (newevents && ret != -1) array_trunc(&io_evcache); for (i = 0; i < ret; i++) { io_debug("dispatch_kqueue: fd, kev.flags", (int)kev[i].ident, kev[i].flags); if (kev[i].flags & (EV_EOF|EV_ERROR)) { if (kev[i].flags & EV_ERROR) Log(LOG_ERR, "kevent fd %d: EV_ERROR (%s)", (int)kev[i].ident, strerror((int)kev[i].data)); io_docallback((int)kev[i].ident, IO_ERROR); continue; } switch (kev[i].filter) { case EVFILT_READ: io_docallback((int)kev[i].ident, IO_WANTREAD); break; case EVFILT_WRITE: io_docallback((int)kev[i].ident, IO_WANTWRITE); break; default: LogDebug("Unknown kev.filter number %d for fd %d", kev[i].filter, kev[i].ident); /* Fall through */ case EV_ERROR: io_docallback((int)kev[i].ident, IO_ERROR); break; } } return ret; } static void io_library_init_kqueue(unsigned int eventsize) { io_masterfd = kqueue(); Log(LOG_INFO, "IO subsystem: kqueue (initial maxfd %u, masterfd %d).", eventsize, io_masterfd); if (io_masterfd >= 0) library_initialized = true; } #else static inline void io_library_init_kqueue(unsigned int UNUSED ev) { /* NOTHING */ } #endif bool io_library_init(unsigned int eventsize) { if (library_initialized) return true; if ((eventsize > 0) && !array_alloc(&io_events, sizeof(io_event), (size_t)eventsize)) eventsize = 0; io_library_init_epoll(eventsize); io_library_init_kqueue(eventsize); io_library_init_devpoll(eventsize); io_library_init_poll(eventsize); io_library_init_select(eventsize); return library_initialized; } void io_library_shutdown(void) { #ifdef IO_USE_SELECT FD_ZERO(&readers); FD_ZERO(&writers); #endif #if defined(IO_USE_EPOLL) || defined(IO_USE_KQUEUE) || defined(IO_USE_DEVPOLL) if (io_masterfd >= 0) close(io_masterfd); io_masterfd = -1; #endif #ifdef IO_USE_KQUEUE array_free(&io_evcache); #endif library_initialized = false; } bool io_event_setcb(int fd, void (*cbfunc) (int, short)) { io_event *i = io_event_get(fd); if (!i) return false; i->callback = cbfunc; return true; } static bool backend_create_ev(int fd, short what) { bool ret; #ifdef IO_USE_DEVPOLL ret = io_event_change_devpoll(fd, what); #endif #ifdef IO_USE_POLL ret = io_event_change_poll(fd, what); #endif #ifdef IO_USE_EPOLL ret = io_event_change_epoll(fd, what, EPOLL_CTL_ADD); #endif #ifdef IO_USE_KQUEUE ret = io_event_change_kqueue(fd, what, EV_ADD|EV_ENABLE); #endif #ifdef IO_USE_SELECT if (io_masterfd < 0) ret = io_event_add(fd, what); #endif return ret; } bool io_event_create(int fd, short what, void (*cbfunc) (int, short)) { bool ret; io_event *i; assert(fd >= 0); #if defined(IO_USE_SELECT) && defined(FD_SETSIZE) if (io_masterfd < 0 && fd >= FD_SETSIZE) { Log(LOG_ERR, "fd %d exceeds FD_SETSIZE (%u) (select can't handle more file descriptors)", fd, FD_SETSIZE); return false; } #endif i = (io_event *) array_alloc(&io_events, sizeof(io_event), (size_t) fd); if (!i) { Log(LOG_WARNING, "array_alloc failed: could not allocate space for %d io_event structures", fd); return false; } i->callback = cbfunc; i->what = 0; ret = backend_create_ev(fd, what); if (ret) i->what = what; return ret; } bool io_event_add(int fd, short what) { io_event *i = io_event_get(fd); if (!i) return false; if ((i->what & what) == what) /* event type is already registered */ return true; io_debug("io_event_add: fd, what", fd, what); i->what |= what; #ifdef IO_USE_EPOLL if (io_masterfd >= 0) return io_event_change_epoll(fd, i->what, EPOLL_CTL_MOD); #endif #ifdef IO_USE_KQUEUE return io_event_change_kqueue(fd, what, EV_ADD | EV_ENABLE); #endif #ifdef IO_USE_DEVPOLL return io_event_change_devpoll(fd, i->what); #endif #ifdef IO_USE_POLL return io_event_change_poll(fd, i->what); #endif #ifdef IO_USE_SELECT if (fd > select_maxfd) select_maxfd = fd; if (what & IO_WANTREAD) FD_SET(fd, &readers); if (what & IO_WANTWRITE) FD_SET(fd, &writers); return true; #endif return false; } bool io_setnonblock(int fd) { int flags = fcntl(fd, F_GETFL); if (flags == -1) return false; #ifndef O_NONBLOCK #define O_NONBLOCK O_NDELAY #endif flags |= O_NONBLOCK; return fcntl(fd, F_SETFL, flags) == 0; } bool io_setcloexec(int fd) { int flags = fcntl(fd, F_GETFD); if (flags == -1) return false; #ifdef FD_CLOEXEC flags |= FD_CLOEXEC; #endif return fcntl(fd, F_SETFD, flags) == 0; } bool io_close(int fd) { io_event *i; i = io_event_get(fd); #ifdef IO_USE_KQUEUE if (array_length(&io_evcache, sizeof (struct kevent))) /* pending data in cache? */ io_event_kqueue_commit_cache(); /* both kqueue and epoll remove fd from all sets automatically on the last close * of the descriptor. since we don't know if this is the last close we'll have * to remove the set explicitly. */ if (i) { io_event_change_kqueue(fd, i->what, EV_DELETE); io_event_kqueue_commit_cache(); } #endif io_close_devpoll(fd); io_close_poll(fd); io_close_select(fd); #ifdef IO_USE_EPOLL io_event_change_epoll(fd, 0, EPOLL_CTL_DEL); #endif if (i) { i->callback = NULL; i->what = 0; } return close(fd) == 0; } bool io_event_del(int fd, short what) { io_event *i = io_event_get(fd); io_debug("io_event_del: trying to delete eventtype; fd, what", fd, what); if (!i) return false; if (!(i->what & what)) /* event is already disabled */ return true; i->what &= ~what; #ifdef IO_USE_DEVPOLL return io_event_change_devpoll(fd, i->what); #endif #ifdef IO_USE_POLL return io_event_change_poll(fd, i->what); #endif #ifdef IO_USE_EPOLL if (io_masterfd >= 0) return io_event_change_epoll(fd, i->what, EPOLL_CTL_MOD); #endif #ifdef IO_USE_KQUEUE return io_event_change_kqueue(fd, what, EV_DISABLE); #endif #ifdef IO_USE_SELECT if (what & IO_WANTWRITE) FD_CLR(fd, &writers); if (what & IO_WANTREAD) FD_CLR(fd, &readers); return true; #endif return false; } int io_dispatch(struct timeval *tv) { #ifdef IO_USE_EPOLL if (io_masterfd >= 0) return io_dispatch_epoll(tv); #endif #ifdef IO_USE_SELECT return io_dispatch_select(tv); #endif #ifdef IO_USE_KQUEUE return io_dispatch_kqueue(tv); #endif #ifdef IO_USE_DEVPOLL return io_dispatch_devpoll(tv); #endif #ifdef IO_USE_POLL return io_dispatch_poll(tv); #endif return -1; } /* call the callback function inside the struct matching fd */ static void io_docallback(int fd, short what) { io_event *i = io_event_get(fd); io_debug("io_docallback; fd, what", fd, what); if (i->callback) { /* callback might be NULL if a previous callback function called io_close on this fd */ i->callback(fd, (what & IO_ERROR) ? i->what : what); } /* if error indicator is set, we return the event(s) that were registered */ } ngircd-21/src/ngircd/log.c0000644000175000116100000001443112206365167012456 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 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. */ #include "portab.h" /** * @file * Logging functions */ #include "imp.h" #include #include #ifdef PROTOTYPES # include #else # include #endif #include #include #include #include #ifdef SYSLOG #include #endif #include "ngircd.h" #include "defines.h" #include "conn.h" #include "channel.h" #include "irc-write.h" #include "conf.h" #include "exp.h" #include "log.h" static bool Is_Daemon; static void Log_Message(int Level, const char *msg) { if (!Is_Daemon) { /* log to console */ fprintf(stdout, "[%ld:%d %4ld] %s\n", (long)getpid(), Level, (long)(time(NULL) - NGIRCd_Start), msg); fflush(stdout); } #ifdef SYSLOG else { syslog(Level, "%s", msg); } #endif } /** * Initialitze logging. * This function is called before the configuration file is read in. * * @param Daemon_Mode Set to true if ngIRCd is running as daemon. */ GLOBAL void Log_Init(bool Daemon_Mode) { Is_Daemon = Daemon_Mode; #ifdef SYSLOG #ifndef LOG_CONS /* Kludge: mips-dec-ultrix4.5 has no LOG_CONS */ #define LOG_CONS 0 #endif #ifdef LOG_DAEMON openlog(PACKAGE, LOG_CONS|LOG_PID, LOG_DAEMON); #else openlog(PACKAGE, LOG_CONS|LOG_PID, 0); #endif #endif } /* Log_Init */ /** * Re-init logging after reading the configuration file. */ GLOBAL void Log_ReInit(void) { #ifdef SYSLOG #ifndef LOG_CONS /* Kludge: mips-dec-ultrix4.5 has no LOG_CONS */ #define LOG_CONS 0 #endif closelog(); openlog(PACKAGE, LOG_CONS|LOG_PID, Conf_SyslogFacility); #endif Log(LOG_NOTICE, "%s started.", NGIRCd_Version); Log(LOG_INFO, "Using configuration file \"%s\" ...", NGIRCd_ConfFile); } GLOBAL void Log_Exit( void ) { Log(LOG_INFO, "%s done%s, served %lu connection%s.", PACKAGE_NAME, NGIRCd_SignalRestart ? " (restarting)" : "", Conn_CountAccepted(), Conn_CountAccepted() == 1 ? "" : "s"); #ifdef SYSLOG closelog(); #endif } /* Log_Exit */ /** * Log function for debug messages. * This function is only functional when the program is compiled with debug * code enabled; otherwise it is an empty function which the compiler will * hopefully mangle down to "nothing" (see log.h). Therefore you should use * LogDebug(...) in favor to Log(LOG_DEBUG, ...). * @param Format Format string like printf(). * @param ... Further arguments. */ #ifdef DEBUG # ifdef PROTOTYPES GLOBAL void LogDebug( const char *Format, ... ) # else GLOBAL void LogDebug( Format, va_alist ) const char *Format; va_dcl # endif /* PROTOTYPES */ { char msg[MAX_LOG_MSG_LEN]; va_list ap; if (!NGIRCd_Debug) return; #ifdef PROTOTYPES va_start( ap, Format ); #else va_start( ap ); #endif vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap ); va_end( ap ); Log(LOG_DEBUG, "%s", msg); } #endif /* DEBUG */ /** * Logging function of ngIRCd. * This function logs messages to the console and/or syslog, whichever is * suitable for the mode ngIRCd is running in (daemon vs. non-daemon). * If LOG_snotice is set, the log messages goes to all user with the mode +s * set and the local &SERVER channel, too. * Please note: you should use LogDebug(...) for debug messages! * @param Level syslog level (LOG_xxx) * @param Format Format string like printf(). * @param ... Further arguments. */ #ifdef PROTOTYPES GLOBAL void Log( int Level, const char *Format, ... ) #else GLOBAL void Log( Level, Format, va_alist ) int Level; const char *Format; va_dcl #endif { char msg[MAX_LOG_MSG_LEN]; bool snotice; va_list ap; assert( Format != NULL ); if( Level & LOG_snotice ) { /* Notice an User mit "s" Mode */ snotice = true; Level &= ~LOG_snotice; } else snotice = false; #ifdef DEBUG if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return; #else if( Level == LOG_DEBUG ) return; #endif #ifdef PROTOTYPES va_start( ap, Format ); #else va_start( ap ); #endif vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap ); va_end( ap ); Log_Message(Level, msg); if (snotice) { /* Send NOTICE to all local users with mode +s and to the * local &SERVER channel */ Log_ServerNotice('s', "%s", msg); Channel_LogServer(msg); } } /* Log */ GLOBAL void Log_Init_Subprocess(char UNUSED *Name) { #ifdef SYSLOG openlog(PACKAGE, LOG_CONS|LOG_PID, Conf_SyslogFacility); #endif #ifdef DEBUG Log_Subprocess(LOG_DEBUG, "%s sub-process starting, PID %ld.", Name, (long)getpid()); #endif } GLOBAL void Log_Exit_Subprocess(char UNUSED *Name) { #ifdef DEBUG Log_Subprocess(LOG_DEBUG, "%s sub-process %ld done.", Name, (long)getpid()); #endif #ifdef SYSLOG closelog( ); #endif } #ifdef PROTOTYPES GLOBAL void Log_Subprocess(const int Level, const char *Format, ...) #else GLOBAL void Log_Subprocess(Level, Format, va_alist) const int Level; const char *Format; va_dcl #endif { char msg[MAX_LOG_MSG_LEN]; va_list ap; assert(Format != NULL); #ifdef DEBUG if ((Level == LOG_DEBUG) && (!NGIRCd_Debug)) return; #else if (Level == LOG_DEBUG) return; #endif #ifdef PROTOTYPES va_start(ap, Format); #else va_start(ap); #endif vsnprintf(msg, MAX_LOG_MSG_LEN, Format, ap); va_end(ap); Log_Message(Level, msg); } /** * Send a log message to all local users flagged with the given user mode. * @param UserMode User mode which the target user must have set, * @param Format The format string. */ #ifdef PROTOTYPES GLOBAL void Log_ServerNotice(const char UserMode, const char *Format, ... ) #else GLOBAL void Log_ServerNotice(UserMode, Format, va_alist) const char UserMode; const char *Format; va_dcl #endif { CLIENT *c; char msg[MAX_LOG_MSG_LEN]; va_list ap; assert(Format != NULL); #ifdef PROTOTYPES va_start(ap, Format); #else va_start(ap); #endif vsnprintf(msg, MAX_LOG_MSG_LEN, Format, ap); va_end(ap); for(c=Client_First(); c != NULL; c=Client_Next(c)) { if (Client_Conn(c) > NONE && Client_HasMode(c, UserMode)) IRC_WriteStrClient(c, "NOTICE %s :%s%s", Client_ID(c), NOTICE_TXTPREFIX, msg); } } /* Log_ServerNotice */ /* -eof- */ ngircd-21/src/ngircd/irc-write.h0000644000175000116100000000354212206130744013577 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __irc_write_h__ #define __irc_write_h__ /** * @file * Sending IRC commands over the network (header) */ GLOBAL bool IRC_WriteErrClient PARAMS((CLIENT *Client, const char *Format, ...)); GLOBAL bool IRC_WriteStrClient PARAMS((CLIENT *Client, const char *Format, ...)); GLOBAL bool IRC_WriteStrClientPrefix PARAMS((CLIENT *Client, CLIENT *Prefix, const char *Format, ...)); GLOBAL void IRC_WriteStrChannel PARAMS((CLIENT *Client, CHANNEL *Chan, bool Remote, const char *Format, ...)); GLOBAL void IRC_WriteStrChannelPrefix PARAMS((CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, bool Remote, const char *Format, ...)); GLOBAL void IRC_WriteStrServers PARAMS((CLIENT *ExceptOf, const char *Format, ...)); GLOBAL void IRC_WriteStrServersPrefix PARAMS((CLIENT *ExceptOf, CLIENT *Prefix, const char *Format, ...)); GLOBAL void IRC_WriteStrServersPrefixFlag PARAMS((CLIENT *ExceptOf, CLIENT *Prefix, char Flag, const char *Format, ...)); GLOBAL void IRC_WriteStrServersPrefixFlag_CB PARAMS((CLIENT *ExceptOf, CLIENT *Prefix, char Flag, void (*callback)(CLIENT *, CLIENT *, void *), void *cb_data)); GLOBAL void IRC_WriteStrRelatedPrefix PARAMS((CLIENT *Client, CLIENT *Prefix, bool Remote, const char *Format, ...)); GLOBAL void IRC_SendWallops PARAMS((CLIENT *Client, CLIENT *From, const char *Format, ...)); GLOBAL void IRC_SetPenalty PARAMS((CLIENT *Client, time_t Seconds)); #endif /* -eof- */ ngircd-21/src/ngircd/Makefile.in0000644000175000116100000010513212234274154013571 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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-2012 Alexander Barton (alex@barton.de) and Contributors # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ ANSI2KNR = ../portab/ansi2knr sbin_PROGRAMS = ngircd$(EXEEXT) subdir = src/ngircd DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" PROGRAMS = $(sbin_PROGRAMS) am_ngircd_OBJECTS = ngircd$U.$(OBJEXT) array$U.$(OBJEXT) \ channel$U.$(OBJEXT) class$U.$(OBJEXT) client$U.$(OBJEXT) \ client-cap$U.$(OBJEXT) conf$U.$(OBJEXT) conn$U.$(OBJEXT) \ conn-encoding$U.$(OBJEXT) conn-func$U.$(OBJEXT) \ conn-ssl$U.$(OBJEXT) conn-zip$U.$(OBJEXT) hash$U.$(OBJEXT) \ io$U.$(OBJEXT) irc$U.$(OBJEXT) irc-cap$U.$(OBJEXT) \ irc-channel$U.$(OBJEXT) irc-encoding$U.$(OBJEXT) \ irc-info$U.$(OBJEXT) irc-login$U.$(OBJEXT) \ irc-metadata$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) \ login$U.$(OBJEXT) match$U.$(OBJEXT) numeric$U.$(OBJEXT) \ op$U.$(OBJEXT) pam$U.$(OBJEXT) parse$U.$(OBJEXT) \ proc$U.$(OBJEXT) resolve$U.$(OBJEXT) sighandlers$U.$(OBJEXT) ngircd_OBJECTS = $(am_ngircd_OBJECTS) ngircd_DEPENDENCIES = ngircd_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ngircd_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(ngircd_SOURCES) DIST_SOURCES = $(ngircd_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags # If stdout is a non-dumb tty, use colors. If test -t is not supported, # then this fails; a conservative approach. Of course do not redirect # stdout here, just stderr. am__tty_colors = \ red=; grn=; lgn=; blu=; std=; \ test "X$(AM_COLOR_TESTS)" != Xno \ && test "X$$TERM" != Xdumb \ && { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \ && { \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ std=''; \ } DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = ../portab/ansi2knr EXTRA_DIST = Makefile.ng AM_CPPFLAGS = -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 \ class.c \ client.c \ client-cap.c \ conf.c \ conn.c \ conn-encoding.c \ conn-func.c \ conn-ssl.c \ conn-zip.c \ hash.c \ io.c \ irc.c \ irc-cap.c \ irc-channel.c \ irc-encoding.c \ irc-info.c \ irc-login.c \ irc-metadata.c \ irc-mode.c \ irc-op.c \ irc-oper.c \ irc-server.c \ irc-write.c \ lists.c \ log.c \ login.c \ match.c \ numeric.c \ op.c \ pam.c \ parse.c \ proc.c \ resolve.c \ sighandlers.c ngircd_LDFLAGS = -L../portab -L../tool -L../ipaddr ngircd_LDADD = -lngportab -lngtool -lngipaddr noinst_HEADERS = \ ngircd.h \ array.h \ channel.h \ class.h \ client.h \ client-cap.h \ conf.h \ conf-ssl.h \ conn.h \ conn-encoding.h \ conn-func.h \ conn-ssl.h \ conn-zip.h \ defines.h \ hash.h \ io.h \ irc.h \ irc-cap.h \ irc-channel.h \ irc-encoding.h \ irc-info.h \ irc-login.h \ irc-macros.h \ irc-metadata.h \ irc-mode.h \ irc-op.h \ irc-oper.h \ irc-server.h \ irc-write.h \ lists.h \ log.h \ login.h \ match.h \ messages.h \ numeric.h \ op.h \ pam.h \ parse.h \ proc.h \ resolve.h \ sighandlers.h TESTS = check-version check-help all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/ngircd/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/ngircd/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 $(am__aclocal_m4_deps): install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) ngircd$(EXEEXT): $(ngircd_OBJECTS) $(ngircd_DEPENDENCIES) @rm -f ngircd$(EXEEXT) $(AM_V_CCLD)$(ngircd_LINK) $(ngircd_OBJECTS) $(ngircd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c ../portab/ansi2knr: $(am__cd) ../portab && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr mostlyclean-kr: -test "$U" = "" || rm -f *_.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/channel$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/class$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client-cap$U.Po@am__quote@ @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-encoding$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@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-cap$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-channel$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-encoding$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-info$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-login$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-metadata$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-mode$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-op$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-oper$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-server$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-write$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lists$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/login$U.Po@am__quote@ @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)/pam$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resolve$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sighandlers$U.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @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@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @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) '$<'` array_.c: array.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/array.c; then echo $(srcdir)/array.c; else echo array.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ channel_.c: channel.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/channel.c; then echo $(srcdir)/channel.c; else echo channel.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ class_.c: class.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/class.c; then echo $(srcdir)/class.c; else echo class.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ client_.c: client.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/client.c; then echo $(srcdir)/client.c; else echo client.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ client-cap_.c: client-cap.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/client-cap.c; then echo $(srcdir)/client-cap.c; else echo client-cap.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ conf_.c: conf.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/conf.c; then echo $(srcdir)/conf.c; else echo conf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ 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-encoding_.c: conn-encoding.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/conn-encoding.c; then echo $(srcdir)/conn-encoding.c; else echo conn-encoding.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) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hash.c; then echo $(srcdir)/hash.c; else echo hash.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ io_.c: io.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/io.c; then echo $(srcdir)/io.c; else echo io.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc_.c: irc.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc.c; then echo $(srcdir)/irc.c; else echo irc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc-cap_.c: irc-cap.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc-cap.c; then echo $(srcdir)/irc-cap.c; else echo irc-cap.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc-channel_.c: irc-channel.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc-channel.c; then echo $(srcdir)/irc-channel.c; else echo irc-channel.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc-encoding_.c: irc-encoding.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc-encoding.c; then echo $(srcdir)/irc-encoding.c; else echo irc-encoding.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc-info_.c: irc-info.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc-info.c; then echo $(srcdir)/irc-info.c; else echo irc-info.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc-login_.c: irc-login.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc-login.c; then echo $(srcdir)/irc-login.c; else echo irc-login.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc-metadata_.c: irc-metadata.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc-metadata.c; then echo $(srcdir)/irc-metadata.c; else echo irc-metadata.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc-mode_.c: irc-mode.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc-mode.c; then echo $(srcdir)/irc-mode.c; else echo irc-mode.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc-op_.c: irc-op.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc-op.c; then echo $(srcdir)/irc-op.c; else echo irc-op.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc-oper_.c: irc-oper.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc-oper.c; then echo $(srcdir)/irc-oper.c; else echo irc-oper.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc-server_.c: irc-server.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc-server.c; then echo $(srcdir)/irc-server.c; else echo irc-server.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ irc-write_.c: irc-write.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc-write.c; then echo $(srcdir)/irc-write.c; else echo irc-write.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ lists_.c: lists.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lists.c; then echo $(srcdir)/lists.c; else echo lists.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ log_.c: log.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/log.c; then echo $(srcdir)/log.c; else echo log.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ login_.c: login.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/login.c; then echo $(srcdir)/login.c; else echo login.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ match_.c: match.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/match.c; then echo $(srcdir)/match.c; else echo match.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ 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 $@ pam_.c: pam.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pam.c; then echo $(srcdir)/pam.c; else echo pam.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 $@ proc_.c: proc.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/proc.c; then echo $(srcdir)/proc.c; else echo proc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ 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 $@ sighandlers_.c: sighandlers.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sighandlers.c; then echo $(srcdir)/sighandlers.c; else echo sighandlers.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ array_.$(OBJEXT) channel_.$(OBJEXT) class_.$(OBJEXT) client_.$(OBJEXT) \ client-cap_.$(OBJEXT) conf_.$(OBJEXT) conn_.$(OBJEXT) \ conn-encoding_.$(OBJEXT) conn-func_.$(OBJEXT) conn-ssl_.$(OBJEXT) \ conn-zip_.$(OBJEXT) hash_.$(OBJEXT) io_.$(OBJEXT) irc_.$(OBJEXT) \ irc-cap_.$(OBJEXT) irc-channel_.$(OBJEXT) irc-encoding_.$(OBJEXT) \ irc-info_.$(OBJEXT) irc-login_.$(OBJEXT) irc-metadata_.$(OBJEXT) \ irc-mode_.$(OBJEXT) irc-op_.$(OBJEXT) irc-oper_.$(OBJEXT) \ irc-server_.$(OBJEXT) irc-write_.$(OBJEXT) lists_.$(OBJEXT) \ log_.$(OBJEXT) login_.$(OBJEXT) match_.$(OBJEXT) ngircd_.$(OBJEXT) \ numeric_.$(OBJEXT) op_.$(OBJEXT) pam_.$(OBJEXT) parse_.$(OBJEXT) \ proc_.$(OBJEXT) resolve_.$(OBJEXT) sighandlers_.$(OBJEXT) : \ $(ANSI2KNR) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sbindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 clean-local clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-sbinPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sbinPROGRAMS .MAKE: ../portab/ansi2knr check-am 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-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-sbinPROGRAMS clean-local: rm -f check-version check-help lint.out maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am check-version: Makefile echo "#!/bin/sh" > check-version echo "./ngircd --version | grep ngircd >/dev/null 2>&1" >>check-version chmod 755 check-version check-help: Makefile echo "#!/bin/sh" > check-help echo "./ngircd --help | grep help >/dev/null 2>&1" >>check-help chmod 755 check-help lint: @splint --version >/dev/null 2>&1 \ || ( echo; echo "Error: \"splint\" not found!"; echo; exit 1 ) @echo; warnings=0; files=0; \ for f in *.c; do \ echo "checking $$f ..."; \ splint $$f $(LINTARGS) -I$(srcdir) -I$(srcdir)/.. \ $(AM_CPPFLAGS) $(AM_CFLAGS) >lint.out 2>&1; \ grep "no warnings" lint.out > /dev/null 2>&1; \ if [ $$? -ne 0 ]; then \ waswarning=1; \ echo; grep -v "^Command Line: " lint.out; echo; \ w=$$( grep "code warning" lint.out | $(AWK) "{ print \$$4 }" ); \ [ "$$w" -gt 0 ] && warnings=`expr $$warnings + $$w`; \ files=`expr $$files + 1`; \ else \ waswarning=0; \ fi; \ rm -f lint.out; \ done; \ [ $$waswarning -eq 0 ] && echo; \ [ $$warnings -gt 0 ] \ && echo "Result: $$warnings warning(s) in $$files file(s)!" \ || echo "Result: no warnings found."; \ echo; [ $$warnings -gt 0 ] && exit 1 # -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: ngircd-21/src/ngircd/login.c0000644000175000116100000001561412206745354013011 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * Functions to deal with client logins */ #include "imp.h" #include #include #include #include #include #include #include "defines.h" #include "conn.h" #include "class.h" #include "client.h" #include "client-cap.h" #include "channel.h" #include "conf.h" #include "io.h" #include "parse.h" #include "log.h" #include "messages.h" #include "ngircd.h" #include "pam.h" #include "irc-info.h" #include "irc-mode.h" #include "irc-write.h" #include "exp.h" #include "login.h" #ifdef PAM static void cb_Read_Auth_Result PARAMS((int r_fd, UNUSED short events)); #endif /** * Initiate client login. * * This function is called after the daemon received the required NICK and * USER commands of a new client. If the daemon is compiled with support for * PAM, the authentication sub-processs is forked; otherwise the global server * password is checked. * * @param Client The client logging in. * @returns CONNECTED or DISCONNECTED. */ GLOBAL bool Login_User(CLIENT * Client) { #ifdef PAM int pipefd[2], result; pid_t pid; #endif CONN_ID conn; assert(Client != NULL); conn = Client_Conn(Client); #ifndef STRICT_RFC if (Conf_AuthPing) { /* Did we receive the "auth PONG" already? */ if (Conn_GetAuthPing(conn)) { Client_SetType(Client, CLIENT_WAITAUTHPING); LogDebug("Connection %d: Waiting for AUTH PONG ...", conn); return CONNECTED; } } #endif /* Still waiting for "CAP END" command? */ if (Client_Cap(Client) & CLIENT_CAP_PENDING) { Client_SetType(Client, CLIENT_WAITCAPEND); LogDebug("Connection %d: Waiting for CAP END ...", conn); return CONNECTED; } #ifdef PAM if (!Conf_PAM) { /* Don't do any PAM authentication at all, instead emulate * the behavior of the daemon compiled without PAM support: * because there can't be any "server password", all * passwords supplied are classified as "wrong". */ if(Conn_Password(conn)[0] == '\0') return Login_User_PostAuth(Client); Client_Reject(Client, "Non-empty password", false); return DISCONNECTED; } if (Conf_PAMIsOptional && strcmp(Conn_Password(conn), "") == 0) { /* Clients are not required to send a password and to be PAM- * authenticated at all. If not, they won't become "identified" * and keep the "~" in their supplied user name. * Therefore it is sensible to either set Conf_PAMisOptional or * to enable IDENT lookups -- not both. */ return Login_User_PostAuth(Client); } /* Fork child process for PAM authentication; and make sure that the * process timeout is set higher than the login timeout! */ pid = Proc_Fork(Conn_GetProcStat(conn), pipefd, cb_Read_Auth_Result, Conf_PongTimeout + 1); if (pid > 0) { LogDebug("Authenticator for connection %d created (PID %d).", conn, pid); return CONNECTED; } else { /* Sub process */ Log_Init_Subprocess("Auth"); Conn_CloseAllSockets(NONE); result = PAM_Authenticate(Client); if (write(pipefd[1], &result, sizeof(result)) != sizeof(result)) Log_Subprocess(LOG_ERR, "Failed to pipe result to parent!"); Log_Exit_Subprocess("Auth"); exit(0); } #else /* Check global server password ... */ if (strcmp(Conn_Password(conn), Conf_ServerPwd) != 0) { /* Bad password! */ Client_Reject(Client, "Bad server password", false); return DISCONNECTED; } return Login_User_PostAuth(Client); #endif } /** * Finish client registration. * * Introduce the new client to the network and send all "hello messages" * to it after authentication has been succeeded. * * @param Client The client logging in. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool Login_User_PostAuth(CLIENT *Client) { REQUEST Req; char modes[CLIENT_MODE_LEN + 1]; assert(Client != NULL); if (Class_HandleServerBans(Client) != CONNECTED) return DISCONNECTED; Client_Introduce(NULL, Client, CLIENT_USER); if (!IRC_WriteStrClient (Client, RPL_WELCOME_MSG, Client_ID(Client), Client_Mask(Client))) return false; if (!IRC_WriteStrClient (Client, RPL_YOURHOST_MSG, Client_ID(Client), Client_ID(Client_ThisServer()), PACKAGE_VERSION, HOST_CPU, HOST_VENDOR, HOST_OS)) return false; if (!IRC_WriteStrClient (Client, RPL_CREATED_MSG, Client_ID(Client), NGIRCd_StartStr)) return false; if (!IRC_WriteStrClient (Client, RPL_MYINFO_MSG, Client_ID(Client), Client_ID(Client_ThisServer()), PACKAGE_VERSION, USERMODES, CHANMODES)) return false; /* Features supported by this server (005 numeric, ISUPPORT), * see for details. */ if (!IRC_Send_ISUPPORT(Client)) return DISCONNECTED; if (!IRC_Send_LUSERS(Client)) return DISCONNECTED; if (!IRC_Show_MOTD(Client)) return DISCONNECTED; /* Set default user modes */ if (Conf_DefaultUserModes[0]) { snprintf(modes, sizeof(modes), "+%s", Conf_DefaultUserModes); Req.prefix = Client_ThisServer(); Req.command = "MODE"; Req.argc = 2; Req.argv[0] = Client_ID(Client); Req.argv[1] = modes; IRC_MODE(Client, &Req); } else IRC_SetPenalty(Client, 1); return CONNECTED; } #ifdef PAM /** * Read result of the authenticator sub-process from pipe * * @param r_fd File descriptor of the pipe. * @param events (ignored IO specification) */ static void cb_Read_Auth_Result(int r_fd, UNUSED short events) { char user[CLIENT_USER_LEN], *ptr; CONN_ID conn; CLIENT *client; int result; size_t len; PROC_STAT *proc; LogDebug("Auth: Got callback on fd %d, events %d", r_fd, events); conn = Conn_GetFromProc(r_fd); if (conn == NONE) { /* Ops, none found? Probably the connection has already * been closed!? We'll ignore that ... */ io_close(r_fd); LogDebug("Auth: Got callback for unknown connection!?"); return; } proc = Conn_GetProcStat(conn); client = Conn_GetClient(conn); /* Read result from pipe */ len = Proc_Read(proc, &result, sizeof(result)); Proc_Close(proc); if (len == 0) return; if (len != sizeof(result)) { Log(LOG_CRIT, "Auth: Got malformed result!"); Client_Reject(client, "Internal error", false); return; } if (result == true) { /* Authentication succeeded, now set the correct user name * supplied by the client (without prepended '~' for exmaple), * but cut it at the first '@' character: */ strlcpy(user, Client_OrigUser(client), sizeof(user)); ptr = strchr(user, '@'); if (ptr) *ptr = '\0'; Client_SetUser(client, user, true); (void)Login_User_PostAuth(client); } else Client_Reject(client, "Bad password", false); } #endif /* -eof- */ ngircd-21/src/ngircd/match.h0000644000175000116100000000154512206130744012767 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __match_h__ #define __match_h__ /** * @file * Wildcard pattern matching (header) */ GLOBAL bool Match PARAMS((const char *Pattern, const char *String)); GLOBAL bool MatchCaseInsensitive PARAMS((const char *Pattern, const char *String)); GLOBAL bool MatchCaseInsensitiveList PARAMS((const char *Pattern, const char *String, const char *Separator)); #endif /* -eof- */ ngircd-21/src/ngircd/channel.h0000644000175000116100000001335412206130744013304 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __channel_h__ #define __channel_h__ /** * @file * Channel management (header) */ #if defined(__channel_c__) | defined(S_SPLINT_S) #include "lists.h" #include "defines.h" #include "array.h" typedef struct _CHANNEL { struct _CHANNEL *next; char name[CHANNEL_NAME_LEN]; /* Name of the channel */ UINT32 hash; /* Hash of the (lowecase!) name */ char modes[CHANNEL_MODE_LEN]; /* Channel modes */ array topic; /* Topic of the channel */ #ifndef STRICT_RFC time_t creation_time; /* Channel creation time */ time_t topic_time; /* Time when topic was set */ char topic_who[CLIENT_NICK_LEN];/* Nickname of user that set topic */ #endif char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */ unsigned long maxusers; /* Maximum number of members (mode "l") */ struct list_head list_bans; /* list head of banned users */ struct list_head list_excepts; /* list head of (ban) exception list */ struct list_head list_invites; /* list head of invited users */ array keyfile; /* Name of the channel key file */ } CHANNEL; typedef struct _CLIENT2CHAN { struct _CLIENT2CHAN *next; CLIENT *client; CHANNEL *channel; char modes[CHANNEL_MODE_LEN]; /* User-Modes in Channel */ } CL2CHAN; #else typedef POINTER CHANNEL; typedef POINTER CL2CHAN; #endif GLOBAL struct list_head *Channel_GetListBans PARAMS((CHANNEL *c)); GLOBAL struct list_head *Channel_GetListExcepts PARAMS((CHANNEL *c)); GLOBAL struct list_head *Channel_GetListInvites PARAMS((CHANNEL *c)); 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, 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, const char *Reason )); GLOBAL void Channel_Kick PARAMS((CLIENT *Peer, CLIENT *Target, CLIENT *Origin, const char *Name, const char *Reason)); GLOBAL unsigned long Channel_CountVisible PARAMS((CLIENT *Client)); GLOBAL unsigned long Channel_MemberCount PARAMS(( CHANNEL *Chan )); GLOBAL int Channel_CountForUser PARAMS(( CLIENT *Client )); GLOBAL const char *Channel_Name PARAMS(( const CHANNEL *Chan )); 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, 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 )); GLOBAL CHANNEL *Channel_First PARAMS(( void )); GLOBAL CHANNEL *Channel_Next PARAMS(( CHANNEL *Chan )); GLOBAL CL2CHAN *Channel_FirstMember PARAMS(( CHANNEL *Chan )); GLOBAL CL2CHAN *Channel_NextMember PARAMS(( CHANNEL *Chan, CL2CHAN *Cl2Chan )); GLOBAL CL2CHAN *Channel_FirstChannelOf PARAMS(( CLIENT *Client )); GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS(( CLIENT *Client, CL2CHAN *Cl2Chan )); GLOBAL CLIENT *Channel_GetClient PARAMS(( CL2CHAN *Cl2Chan )); GLOBAL CHANNEL *Channel_GetChannel PARAMS(( CL2CHAN *Cl2Chan )); GLOBAL bool Channel_IsValidName PARAMS(( const char *Name )); GLOBAL bool Channel_ModeAdd PARAMS(( CHANNEL *Chan, char Mode )); GLOBAL bool Channel_ModeDel PARAMS(( CHANNEL *Chan, char Mode )); GLOBAL bool Channel_HasMode PARAMS(( CHANNEL *Chan, char Mode )); GLOBAL char *Channel_Modes PARAMS(( CHANNEL *Chan )); GLOBAL bool Channel_UserModeAdd PARAMS(( CHANNEL *Chan, CLIENT *Client, char Mode )); GLOBAL bool Channel_UserModeDel PARAMS(( CHANNEL *Chan, CLIENT *Client, char Mode )); GLOBAL bool Channel_UserHasMode PARAMS(( CHANNEL *Chan, CLIENT *Client, char Mode )); 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 *Command, bool SendErrors, const char *Text)); GLOBAL CHANNEL *Channel_Create PARAMS(( const char *Name )); #ifndef STRICT_RFC GLOBAL unsigned int Channel_TopicTime PARAMS(( CHANNEL *Chan )); GLOBAL char *Channel_TopicWho PARAMS(( CHANNEL *Chan )); GLOBAL unsigned int Channel_CreationTime PARAMS(( CHANNEL *Chan )); #endif GLOBAL bool Channel_AddBan PARAMS((CHANNEL *c, const char *Mask)); GLOBAL bool Channel_AddExcept PARAMS((CHANNEL *c, const char *Mask)); GLOBAL bool Channel_AddInvite PARAMS((CHANNEL *c, const char *Mask, bool OnlyOnce)); GLOBAL bool Channel_ShowBans PARAMS((CLIENT *client, CHANNEL *c)); GLOBAL bool Channel_ShowExcepts 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)); GLOBAL void Channel_CheckAdminRights PARAMS((CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, bool *OnChannel, bool *AdminOk, bool *UseServerMode)); #define Channel_IsLocal(c) (Channel_Name(c)[0] == '&') #define Channel_IsModeless(c) (Channel_Name(c)[0] == '+') #endif /* -eof- */ ngircd-21/src/ngircd/irc-mode.h0000644000175000116100000000127011526006312013362 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #ifndef __irc_mode_h__ #define __irc_mode_h__ /** * @file * IRC commands for mode changes (header) */ GLOBAL bool IRC_MODE PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_AWAY PARAMS((CLIENT *Client, REQUEST *Req )); #endif /* -eof- */ ngircd-21/src/ngircd/conn-ssl.h0000644000175000116100000000162212206130744013423 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon */ #ifndef conn_ssl_h #define conn_ssl_h /** * @file * SSL wrapper functions (header) */ #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 )); GLOBAL char *ConnSSL_GetCertFp PARAMS(( CONNECTION *c )); GLOBAL bool ConnSSL_SetCertFp PARAMS(( CONNECTION *c, const char *fingerprint )); #endif /* SSL_SUPPORT */ #endif /* conn_ssl_h */ /* -eof- */ ngircd-21/src/ngircd/Makefile.ng0000644000175000116100000000614212206130744013563 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors # # 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. # __ng_Makefile_am_template__ EXTRA_DIST = Makefile.ng AM_CPPFLAGS = -I$(srcdir)/../portab -I$(srcdir)/../tool -I$(srcdir)/../ipaddr LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN \ -varuse -retvalother -emptyret -unrecog sbin_PROGRAMS = ngircd ngircd_SOURCES = \ ngircd.c \ array.c \ channel.c \ class.c \ client.c \ client-cap.c \ conf.c \ conn.c \ conn-encoding.c \ conn-func.c \ conn-ssl.c \ conn-zip.c \ hash.c \ io.c \ irc.c \ irc-cap.c \ irc-channel.c \ irc-encoding.c \ irc-info.c \ irc-login.c \ irc-metadata.c \ irc-mode.c \ irc-op.c \ irc-oper.c \ irc-server.c \ irc-write.c \ lists.c \ log.c \ login.c \ match.c \ numeric.c \ op.c \ pam.c \ parse.c \ proc.c \ resolve.c \ sighandlers.c ngircd_LDFLAGS = -L../portab -L../tool -L../ipaddr ngircd_LDADD = -lngportab -lngtool -lngipaddr noinst_HEADERS = \ ngircd.h \ array.h \ channel.h \ class.h \ client.h \ client-cap.h \ conf.h \ conf-ssl.h \ conn.h \ conn-encoding.h \ conn-func.h \ conn-ssl.h \ conn-zip.h \ defines.h \ hash.h \ io.h \ irc.h \ irc-cap.h \ irc-channel.h \ irc-encoding.h \ irc-info.h \ irc-login.h \ irc-macros.h \ irc-metadata.h \ irc-mode.h \ irc-op.h \ irc-oper.h \ irc-server.h \ irc-write.h \ lists.h \ log.h \ login.h \ match.h \ messages.h \ numeric.h \ op.h \ pam.h \ parse.h \ proc.h \ resolve.h \ sighandlers.h clean-local: rm -f check-version check-help lint.out maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am check-version: Makefile echo "#!/bin/sh" > check-version echo "./ngircd --version | grep ngircd >/dev/null 2>&1" >>check-version chmod 755 check-version check-help: Makefile echo "#!/bin/sh" > check-help echo "./ngircd --help | grep help >/dev/null 2>&1" >>check-help chmod 755 check-help lint: @splint --version >/dev/null 2>&1 \ || ( echo; echo "Error: \"splint\" not found!"; echo; exit 1 ) @echo; warnings=0; files=0; \ for f in *.c; do \ echo "checking $$f ..."; \ splint $$f $(LINTARGS) -I$(srcdir) -I$(srcdir)/.. \ $(AM_CPPFLAGS) $(AM_CFLAGS) >lint.out 2>&1; \ grep "no warnings" lint.out > /dev/null 2>&1; \ if [ $$? -ne 0 ]; then \ waswarning=1; \ echo; grep -v "^Command Line: " lint.out; echo; \ w=$$( grep "code warning" lint.out | $(AWK) "{ print \$$4 }" ); \ [ "$$w" -gt 0 ] && warnings=`expr $$warnings + $$w`; \ files=`expr $$files + 1`; \ else \ waswarning=0; \ fi; \ rm -f lint.out; \ done; \ [ $$waswarning -eq 0 ] && echo; \ [ $$warnings -gt 0 ] \ && echo "Result: $$warnings warning(s) in $$files file(s)!" \ || echo "Result: no warnings found."; \ echo; [ $$warnings -gt 0 ] && exit 1 TESTS = check-version check-help # -eof- ngircd-21/src/ngircd/lists.h0000644000175000116100000000343712206130744013033 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __lists_h__ #define __lists_h__ /** * @file * Management of IRC lists (header) */ #include "portab.h" #include "client.h" struct list_elem; struct list_head { struct list_elem *first; }; GLOBAL struct list_elem *Lists_GetFirst PARAMS((const struct list_head *)); GLOBAL struct list_elem *Lists_GetNext PARAMS((const struct list_elem *)); GLOBAL bool Lists_Check PARAMS((struct list_head *head, CLIENT *client)); GLOBAL bool Lists_CheckReason PARAMS((struct list_head *head, CLIENT *client, char *reason, size_t len)); GLOBAL struct list_elem *Lists_CheckDupeMask PARAMS((const struct list_head *head, const char *mask)); GLOBAL bool Lists_Add PARAMS((struct list_head *h, const char *Mask, time_t ValidUntil, const char *Reason)); GLOBAL void Lists_Del PARAMS((struct list_head *head, const char *Mask)); GLOBAL unsigned long Lists_Count PARAMS((struct list_head *h)); GLOBAL void Lists_Free PARAMS((struct list_head *head)); GLOBAL void Lists_MakeMask PARAMS((const char *Pattern, char *mask, size_t len)); GLOBAL const char *Lists_GetMask PARAMS((const struct list_elem *e)); GLOBAL const char *Lists_GetReason PARAMS((const struct list_elem *e)); GLOBAL time_t Lists_GetValidity PARAMS((const struct list_elem *e)); GLOBAL void Lists_Expire PARAMS((struct list_head *h, const char *ListName)); #endif /* -eof- */ ngircd-21/src/ngircd/conn-ssl.c0000644000175000116100000005317412216413514013427 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c) 2005-2008 Florian Westphal */ #include "portab.h" /** * @file * SSL wrapper functions */ #include "imp.h" #include "conf-ssl.h" #ifdef SSL_SUPPORT #include "io.h" #include #include #include #include #include #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 #include static SSL_CTX * ssl_ctx; static DH *dh_params; static bool ConnSSL_LoadServerKey_openssl PARAMS(( SSL_CTX *c )); #endif #ifdef HAVE_LIBGNUTLS #include #include #include #include #include #define DH_BITS 2048 #define DH_BITS_MIN 1024 #define MAX_HASH_SIZE 64 /* from gnutls-int.h */ static gnutls_certificate_credentials_t x509_cred; static gnutls_dh_params_t dh_params; static gnutls_priority_t priorities_cache; static bool ConnSSL_LoadServerKey_gnutls PARAMS(( void )); #endif #define SHA256_STRING_LEN (32 * 2 + 1) 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 /** * Log OpenSSL error message. * * @param msg The error message. * @param info Additional information text or NULL. */ static void LogOpenSSLError(const char *error, const char *info) { unsigned long err = ERR_get_error(); char * errmsg = err ? ERR_error_string(err, NULL) : "Unable to determine error"; assert(error != NULL); if (info) Log(LOG_ERR, "%s: %s (%s)", error, info, errmsg); else Log(LOG_ERR, "%s: %s", error, 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 password required but not set [in pem_passwd_cb()]!"); return 0; } size = passlen > size ? size : passlen; memcpy(buf, (char *)(array_start(pass)), size); return size; } static int Verify_openssl(UNUSED int preverify_ok, UNUSED X509_STORE_CTX *x509_ctx) { return 1; } #endif static bool Load_DH_params(void) { #ifdef HAVE_LIBSSL FILE *fp; bool ret = true; if (!Conf_SSLOptions.DHFile) { Log(LOG_NOTICE, "Configuration option \"DHFile\" 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: Failed to read SSL DH parameters!", 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, "Failed to initialize SSL DH parameters: %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, "Failed to initialize SSL DH parameters: %s", gnutls_strerror(err)); memset(dhparms.data, 0, size); free(dhparms.data); } } if (need_dhgenerate) { Log(LOG_WARNING, "DHFile 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, "Failed to generate SSL DH parameters: %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; if (c->ssl_state.fingerprint) { free(c->ssl_state.fingerprint); c->ssl_state.fingerprint = 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 ) { if (!Conf_SSLInUse()) { LogDebug("SSL not in use, skipping initialization."); return true; } #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. */ array_free(&Conf_SSLOptions.ListenPorts); return false; } newctx = SSL_CTX_new(SSLv23_method()); if (!newctx) { LogOpenSSLError("Failed to create SSL context", NULL); array_free(&Conf_SSLOptions.ListenPorts); return false; } if (!ConnSSL_LoadServerKey_openssl(newctx)) goto out; if (SSL_CTX_set_cipher_list(newctx, Conf_SSLOptions.CipherList) == 0) { Log(LOG_ERR, "Failed to apply OpenSSL cipher list \"%s\"!", Conf_SSLOptions.CipherList); 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_set_verify(newctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, Verify_openssl); SSL_CTX_free(ssl_ctx); ssl_ctx = newctx; Log(LOG_INFO, "%s initialized.", SSLeay_version(SSLEAY_VERSION)); return true; out: SSL_CTX_free(newctx); array_free(&Conf_SSLOptions.ListenPorts); 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, "Failed to initialize GnuTLS: %s", gnutls_strerror(err)); goto out; } if (!ConnSSL_LoadServerKey_gnutls()) goto out; if (gnutls_priority_init(&priorities_cache, Conf_SSLOptions.CipherList, NULL) != GNUTLS_E_SUCCESS) { Log(LOG_ERR, "Failed to apply GnuTLS cipher list \"%s\"!", Conf_SSLOptions.CipherList); goto out; } Log(LOG_INFO, "GnuTLS %s initialized.", gnutls_check_version(NULL)); initialized = true; return true; out: array_free(&Conf_SSLOptions.ListenPorts); return false; #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, "Failed to allocate certificate credentials: %s", gnutls_strerror(err)); return false; } cert_file = Conf_SSLOptions.CertFile ? Conf_SSLOptions.CertFile:Conf_SSLOptions.KeyFile; if (!cert_file) { Log(LOG_ERR, "No SSL server key configured!"); return false; } if (array_bytes(&Conf_SSLOptions.KeyFilePassword)) Log(LOG_WARNING, "Ignoring SSL \"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, "Failed to set certificate 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_ERR, "No SSL server key configured!"); 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("Failed to add private key", 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("Failed to load certificate chain", 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; LogDebug("Initializing SSL ..."); assert(c != NULL); #ifdef HAVE_LIBSSL if (!ssl_ctx) { Log(LOG_ERR, "Can't initialize SSL context, OpenSSL initialization failed at startup!"); return false; } assert(c->ssl_state.ssl == NULL); assert(c->ssl_state.fingerprint == NULL); c->ssl_state.ssl = SSL_new(ssl_ctx); if (!c->ssl_state.ssl) { LogOpenSSLError("Failed to create SSL structure", NULL); return false; } Conn_OPTION_ADD(c, CONN_SSL); ret = SSL_set_fd(c->ssl_state.ssl, c->sock); if (ret != 1) { LogOpenSSLError("Failed to set SSL file descriptor", NULL); ConnSSL_Free(c); return false; } #endif #ifdef HAVE_LIBGNUTLS Conn_OPTION_ADD(c, CONN_SSL); ret = gnutls_priority_set(c->ssl_state.gnutls_session, priorities_cache); if (ret != GNUTLS_E_SUCCESS) { Log(LOG_ERR, "Failed to set GnuTLS session priorities: %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); gnutls_certificate_server_set_request(c->ssl_state.gnutls_session, GNUTLS_CERT_REQUEST); ret = gnutls_credentials_set(c->ssl_state.gnutls_session, GNUTLS_CRD_CERTIFICATE, x509_cred); if (ret != 0) { Log(LOG_ERR, "Failed to set SSL credentials: %s", gnutls_strerror(ret)); ConnSSL_Free(c); return false; } gnutls_dh_set_prime_bits(c->ssl_state.gnutls_session, DH_BITS_MIN); #endif 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, "Failed to initialize new SSL session: %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 and handle error return codes after failed calls to SSL 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(). * * @param c The connection handle. * @prarm code The return code. * @param fname The name of the function in which the error occurred. * @return -1 on fatal errors, 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("SSL connection shut down normally."); break; case SSL_ERROR_SYSCALL: /* SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT, * and SSL_ERROR_WANT_X509_LOOKUP */ sslerr = ERR_get_error(); if (sslerr) { Log(LOG_ERR, "SSL error: %s [in %s()]!", ERR_error_string(sslerr, NULL), fname); } else { switch (code) { /* EOF that violated protocol */ case 0: Log(LOG_ERR, "SSL error, client disconnected [in %s()]!", fname); break; case -1: /* low level socket I/O error, check errno */ Log(LOG_ERR, "SSL error: %s [in %s()]!", strerror(real_errno), fname); } } break; case SSL_ERROR_SSL: LogOpenSSLError("SSL protocol error", fname); break; default: Log(LOG_ERR, "Unknown SSL error %d [in %s()]!", ret, fname); } 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, "SSL error: %s [%s].", gnutls_strerror(code), fname); 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, "Connection %d: initialized %s using cipher %s.", c->sock, SSL_get_version(ssl), SSL_get_cipher(ssl)); #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, "Connection %d: initialized %s using cipher %s-%s.", c->sock, gnutls_protocol_get_name(gnutls_protocol_get_version(sess)), gnutls_cipher_get_name(cipher), gnutls_mac_get_name(gnutls_mac_get(sess))); #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, "Failed to initialize new SSL session: %s", gnutls_strerror(err)); return false; } #endif 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); } static int ConnSSL_InitCertFp( CONNECTION *c ) { const char hex[] = "0123456789abcdef"; int i; #ifdef HAVE_LIBSSL unsigned char digest[EVP_MAX_MD_SIZE]; unsigned int digest_size; X509 *cert; cert = SSL_get_peer_certificate(c->ssl_state.ssl); if (!cert) return 0; if (!X509_digest(cert, EVP_sha256(), digest, &digest_size)) { X509_free(cert); return 0; } X509_free(cert); #endif /* HAVE_LIBSSL */ #ifdef HAVE_LIBGNUTLS gnutls_x509_crt_t cert; unsigned int cert_list_size; const gnutls_datum_t *cert_list; unsigned char digest[MAX_HASH_SIZE]; size_t digest_size; if (gnutls_certificate_type_get(c->ssl_state.gnutls_session) != GNUTLS_CRT_X509) return 0; if (gnutls_x509_crt_init(&cert) != GNUTLS_E_SUCCESS) return 0; cert_list_size = 0; cert_list = gnutls_certificate_get_peers(c->ssl_state.gnutls_session, &cert_list_size); if (!cert_list) { gnutls_x509_crt_deinit(cert); return 0; } if (gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER) != GNUTLS_E_SUCCESS) { gnutls_x509_crt_deinit(cert); return 0; } digest_size = sizeof(digest); if (gnutls_x509_crt_get_fingerprint(cert, GNUTLS_DIG_SHA256, digest, &digest_size)) { gnutls_x509_crt_deinit(cert); return 0; } gnutls_x509_crt_deinit(cert); #endif /* HAVE_LIBGNUTLS */ assert(c->ssl_state.fingerprint == NULL); c->ssl_state.fingerprint = malloc(SHA256_STRING_LEN); if (!c->ssl_state.fingerprint) return 0; for (i = 0; i < (int)digest_size; i++) { c->ssl_state.fingerprint[i * 2] = hex[digest[i] / 16]; c->ssl_state.fingerprint[i * 2 + 1] = hex[digest[i] % 16]; } c->ssl_state.fingerprint[i * 2] = '\0'; return 1; } /* 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 */ (void)ConnSSL_InitCertFp(c); Conn_OPTION_DEL(c, (CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ|CONN_SSL_CONNECT)); ConnSSL_LogCertInfo(c); Conn_StartLogin(CONNECTION2ID(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 } char * ConnSSL_GetCertFp(CONNECTION *c) { return c->ssl_state.fingerprint; } bool ConnSSL_SetCertFp(CONNECTION *c, const char *fingerprint) { assert (c != NULL); c->ssl_state.fingerprint = strndup(fingerprint, SHA256_STRING_LEN - 1); return c->ssl_state.fingerprint != NULL; } #else bool ConnSSL_InitLibrary(void) { return true; } #endif /* SSL_SUPPORT */ /* -eof- */ ngircd-21/src/ngircd/Makefile.am0000644000175000116100000000615512234274146013566 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors # # 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. # AUTOMAKE_OPTIONS = ../portab/ansi2knr EXTRA_DIST = Makefile.ng AM_CPPFLAGS = -I$(srcdir)/../portab -I$(srcdir)/../tool -I$(srcdir)/../ipaddr LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN \ -varuse -retvalother -emptyret -unrecog sbin_PROGRAMS = ngircd ngircd_SOURCES = \ ngircd.c \ array.c \ channel.c \ class.c \ client.c \ client-cap.c \ conf.c \ conn.c \ conn-encoding.c \ conn-func.c \ conn-ssl.c \ conn-zip.c \ hash.c \ io.c \ irc.c \ irc-cap.c \ irc-channel.c \ irc-encoding.c \ irc-info.c \ irc-login.c \ irc-metadata.c \ irc-mode.c \ irc-op.c \ irc-oper.c \ irc-server.c \ irc-write.c \ lists.c \ log.c \ login.c \ match.c \ numeric.c \ op.c \ pam.c \ parse.c \ proc.c \ resolve.c \ sighandlers.c ngircd_LDFLAGS = -L../portab -L../tool -L../ipaddr ngircd_LDADD = -lngportab -lngtool -lngipaddr noinst_HEADERS = \ ngircd.h \ array.h \ channel.h \ class.h \ client.h \ client-cap.h \ conf.h \ conf-ssl.h \ conn.h \ conn-encoding.h \ conn-func.h \ conn-ssl.h \ conn-zip.h \ defines.h \ hash.h \ io.h \ irc.h \ irc-cap.h \ irc-channel.h \ irc-encoding.h \ irc-info.h \ irc-login.h \ irc-macros.h \ irc-metadata.h \ irc-mode.h \ irc-op.h \ irc-oper.h \ irc-server.h \ irc-write.h \ lists.h \ log.h \ login.h \ match.h \ messages.h \ numeric.h \ op.h \ pam.h \ parse.h \ proc.h \ resolve.h \ sighandlers.h clean-local: rm -f check-version check-help lint.out maintainer-clean-local: rm -f Makefile Makefile.in Makefile.am check-version: Makefile echo "#!/bin/sh" > check-version echo "./ngircd --version | grep ngircd >/dev/null 2>&1" >>check-version chmod 755 check-version check-help: Makefile echo "#!/bin/sh" > check-help echo "./ngircd --help | grep help >/dev/null 2>&1" >>check-help chmod 755 check-help lint: @splint --version >/dev/null 2>&1 \ || ( echo; echo "Error: \"splint\" not found!"; echo; exit 1 ) @echo; warnings=0; files=0; \ for f in *.c; do \ echo "checking $$f ..."; \ splint $$f $(LINTARGS) -I$(srcdir) -I$(srcdir)/.. \ $(AM_CPPFLAGS) $(AM_CFLAGS) >lint.out 2>&1; \ grep "no warnings" lint.out > /dev/null 2>&1; \ if [ $$? -ne 0 ]; then \ waswarning=1; \ echo; grep -v "^Command Line: " lint.out; echo; \ w=$$( grep "code warning" lint.out | $(AWK) "{ print \$$4 }" ); \ [ "$$w" -gt 0 ] && warnings=`expr $$warnings + $$w`; \ files=`expr $$files + 1`; \ else \ waswarning=0; \ fi; \ rm -f lint.out; \ done; \ [ $$waswarning -eq 0 ] && echo; \ [ $$warnings -gt 0 ] \ && echo "Result: $$warnings warning(s) in $$files file(s)!" \ || echo "Result: no warnings found."; \ echo; [ $$warnings -gt 0 ] && exit 1 TESTS = check-version check-help # -eof- ngircd-21/src/ngircd/conn-encoding.c0000644000175000116100000001146712206130744014413 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #define __conn_encoding_c__ #define CONN_MODULE #include "portab.h" /** * @file * Functions to deal with character encodings and conversions */ #include "imp.h" #include #include #include #include "defines.h" #include "conn.h" #include "log.h" #include "exp.h" #include "conn-encoding.h" #ifdef ICONV char Encoding_Buffer[COMMAND_LEN]; char *Convert_Message PARAMS((iconv_t Handle, char *Message)); /** * Set client character encoding on a connection. * * @param Conn Connection identifier. * @param ClientEnc Client encoding (for example "ASCII", "MacRoman", ...). * @return true on success, false otherwise. */ GLOBAL bool Conn_SetEncoding(CONN_ID Conn, const char *ClientEnc) { char client_enc[25], server_enc[25]; assert(Conn > NONE); assert(ClientEnc != NULL); Conn_UnsetEncoding(Conn); /* Is the client character set identical to server character set? */ if (strcasecmp(ClientEnc, "UTF-8") == 0) return true; snprintf(client_enc, sizeof(client_enc), "%s//TRANSLIT", ClientEnc); snprintf(server_enc, sizeof(server_enc), "%s//TRANSLIT", "UTF-8"); My_Connections[Conn].iconv_from = iconv_open(server_enc, client_enc); if (My_Connections[Conn].iconv_from == (iconv_t)(-1)) { Conn_UnsetEncoding(Conn); return false; } My_Connections[Conn].iconv_to = iconv_open(client_enc, server_enc); if (My_Connections[Conn].iconv_to == (iconv_t)(-1)) { Conn_UnsetEncoding(Conn); return false; } LogDebug("Set client character set of connection \"%d\" to \"%s\".", Conn, client_enc); return true; } /** * Remove client character encoding conversion on a connection. * * @param Conn Connection identifier. */ GLOBAL void Conn_UnsetEncoding(CONN_ID Conn) { assert(Conn > NONE); if (My_Connections[Conn].iconv_from != (iconv_t)(-1)) iconv_close(My_Connections[Conn].iconv_from); if (My_Connections[Conn].iconv_to != (iconv_t)(-1)) iconv_close(My_Connections[Conn].iconv_to); My_Connections[Conn].iconv_from = (iconv_t)(-1); My_Connections[Conn].iconv_to = (iconv_t)(-1); LogDebug("Unset character conversion of connection %d.", Conn); } /** * Convert the encoding of a given message. * * This function uses a static buffer for the result of the encoding * conversion which is overwritten by subsequent calls to this function! * * @param Handle libiconv handle. * @param Message The message to convert. * @return Pointer to the result. */ char * Convert_Message(iconv_t Handle, char *Message) { size_t in_left, out_left; char *out = Encoding_Buffer; assert (Handle != (iconv_t)(-1)); assert (Message != NULL); in_left = strlen(Message); out_left = sizeof(Encoding_Buffer) - 1; if (iconv(Handle, &Message, &in_left, &out, &out_left) == (size_t)(-1)) { /* An error occurred! */ LogDebug("Error converting message encoding!"); strlcpy(Encoding_Buffer, Message, sizeof(Encoding_Buffer)); iconv(Handle, NULL, NULL, NULL, NULL); } else *out = '\0'; return Encoding_Buffer; } #endif /** * Convert encoding of a message received from a connection. * * Note 1: If no conversion is required, this function returns the original * pointer to the message. * * Note 2: This function uses Convert_Message(), so subsequent calls to this * function will overwrite the earlier results. * * @param Conn Connection identifier. * @param Message The message to convert. * @return Pointer to the result. * @see Convert_Message */ GLOBAL char * Conn_EncodingFrom(UNUSED CONN_ID Conn, char *Message) { assert(Conn > NONE); assert (Message != NULL); #ifdef ICONV if (My_Connections[Conn].iconv_from != (iconv_t)(-1)) return Convert_Message(My_Connections[Conn].iconv_from, Message); #endif return Message; } /** * Convert encoding of a message for sending on a connection. * * Note 1: If no conversion is required, this function returns the original * pointer to the message. * * Note 2: This function uses Convert_Message(), so subsequent calls to this * function will overwrite the earlier results. * * @param Conn Connection identifier. * @param Message The message to convert. * @return Pointer to the result. * @see Convert_Message */ GLOBAL char * Conn_EncodingTo(UNUSED CONN_ID Conn, char *Message) { assert(Conn > NONE); assert (Message != NULL); #ifdef ICONV if (My_Connections[Conn].iconv_to != (iconv_t)(-1)) return Convert_Message(My_Connections[Conn].iconv_to, Message); #endif return Message; } /* -eof- */ ngircd-21/src/ngircd/channel.c0000644000175000116100000007164312206130744013304 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #define __channel_c__ #include "portab.h" /** * @file * Channel management */ #include "imp.h" #include #include #include #include #include #include #include "defines.h" #include "conn-func.h" #include "exp.h" #include "channel.h" #include "imp.h" #include "irc-write.h" #include "conf.h" #include "hash.h" #include "lists.h" #include "log.h" #include "messages.h" #include "match.h" #include "exp.h" #define REMOVE_PART 0 #define REMOVE_QUIT 1 #define REMOVE_KICK 2 static CHANNEL *My_Channels; static CL2CHAN *My_Cl2Chan; static CL2CHAN *Get_Cl2Chan PARAMS(( CHANNEL *Chan, CLIENT *Client )); 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 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 ) { My_Channels = NULL; My_Cl2Chan = NULL; } /* Channel_Init */ GLOBAL struct list_head * Channel_GetListBans(CHANNEL *c) { assert(c != NULL); return &c->list_bans; } GLOBAL struct list_head * Channel_GetListExcepts(CHANNEL *c) { assert(c != NULL); return &c->list_excepts; } GLOBAL struct list_head * Channel_GetListInvites(CHANNEL *c) { assert(c != NULL); return &c->list_invites; } /** * Generate predefined persistent channels and &SERVER */ GLOBAL void Channel_InitPredefined( void ) { CHANNEL *new_chan; const struct Conf_Channel *conf_chan; const char *c; size_t i, channel_count = array_length(&Conf_Channels, sizeof(*conf_chan)); 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]) continue; if (!Channel_IsValidName(conf_chan->name)) { Log(LOG_ERR, "Can't create pre-defined channel: invalid name: \"%s\"", conf_chan->name); continue; } 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; } 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); Channel_ModeAdd(new_chan, 'P'); if (conf_chan->topic[0]) Channel_SetTopic(new_chan, NULL, conf_chan->topic); c = conf_chan->modes; while (*c) Channel_ModeAdd(new_chan, *c++); 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); /* Make sure the local &SERVER channel exists */ if (!Channel_Search("&SERVER")) { new_chan = Channel_Create("&SERVER"); if (new_chan) { Channel_SetModes(new_chan, "mnPt"); Channel_SetTopic(new_chan, Client_ThisServer(), "Server Messages"); } else Log(LOG_ERR, "Failed to create \"&SERVER\" channel!"); } else LogDebug("Required channel \"&SERVER\" already exists, ok."); } /* 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_excepts); Lists_Free(&chan->list_invites); free(chan); } GLOBAL void Channel_Exit( void ) { CHANNEL *c, *c_next; CL2CHAN *cl2chan, *cl2chan_next; /* free struct Channel */ c = My_Channels; while (c) { c_next = c->next; Free_Channel(c); c = c_next; } /* Free Channel allocation table */ cl2chan = My_Cl2Chan; while (cl2chan) { cl2chan_next = cl2chan->next; 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, const char *Name ) { CHANNEL *chan; assert(Client != NULL); assert(Name != NULL); /* Check that the channel name is valid */ if (! Channel_IsValidName(Name)) { IRC_WriteErrClient(Client, ERR_NOSUCHCHANNEL_MSG, Client_ID(Client), Name); 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; } /* Add user to Channel */ if (! Add_Client(chan, Client)) return false; return true; } /* Channel_Join */ /** * 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(). */ GLOBAL bool Channel_Part(CLIENT * Client, CLIENT * Origin, const char *Name, const char *Reason) { CHANNEL *chan; assert(Client != NULL); assert(Name != NULL); assert(Reason != NULL); /* Check that specified channel exists */ chan = Channel_Search(Name); if (!chan) { IRC_WriteErrClient(Client, ERR_NOSUCHCHANNEL_MSG, Client_ID(Client), Name); return false; } /* Check that the client is in the channel */ if (!Get_Cl2Chan(chan, Client)) { IRC_WriteErrClient(Client, ERR_NOTONCHANNEL_MSG, Client_ID(Client), Name); return false; } if (Conf_MorePrivacy) Reason = ""; /* Part client from channel */ if (!Remove_Client(REMOVE_PART, chan, Client, Origin, Reason, true)) return false; else return true; } /* Channel_Part */ /** * Kick user from Channel */ GLOBAL void Channel_Kick(CLIENT *Peer, CLIENT *Target, CLIENT *Origin, const char *Name, const char *Reason ) { CHANNEL *chan; bool can_kick = false; 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) { IRC_WriteErrClient(Origin, ERR_NOSUCHCHANNEL_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_WriteErrClient(Origin, ERR_NOTONCHANNEL_MSG, Client_ID(Origin), Name); return; } } /* Check that the client to be kicked is on the specified channel */ if (!Channel_IsMemberOf(chan, Target)) { IRC_WriteErrClient(Origin, ERR_USERNOTINCHANNEL_MSG, Client_ID(Origin), Client_ID(Target), Name ); return; } if(Client_Type(Peer) == CLIENT_USER) { /* Channel mode 'Q' and user mode 'q' on target: nobody but * IRC Operators and servers can kick the target user */ if ((Channel_HasMode(chan, 'Q') || Client_HasMode(Target, 'q') || Client_Type(Target) == CLIENT_SERVICE) && !Client_HasMode(Origin, 'o')) { IRC_WriteErrClient(Origin, ERR_KICKDENY_MSG, Client_ID(Origin), Name, Client_ID(Target)); return; } /* Check if client has the rights to kick target */ /* Owner can kick everyone */ if (Channel_UserHasMode(chan, Peer, 'q')) can_kick = true; /* Admin can't kick owner */ else if (Channel_UserHasMode(chan, Peer, 'a') && !Channel_UserHasMode(chan, Target, 'q')) can_kick = true; /* Op can't kick owner | admin */ else if (Channel_UserHasMode(chan, Peer, 'o') && !Channel_UserHasMode(chan, Target, 'q') && !Channel_UserHasMode(chan, Target, 'a')) can_kick = true; /* Half Op can't kick owner | admin | op */ else if (Channel_UserHasMode(chan, Peer, 'h') && !Channel_UserHasMode(chan, Target, 'q') && !Channel_UserHasMode(chan, Target, 'a') && !Channel_UserHasMode(chan, Target, 'o')) can_kick = true; if(!can_kick) { IRC_WriteErrClient(Origin, ERR_CHANOPPRIVTOOLOW_MSG, Client_ID(Origin), Name); return; } } /* Kick Client from channel */ Remove_Client( REMOVE_KICK, chan, Target, Origin, Reason, true); } /* Channel_Kick */ GLOBAL void Channel_Quit( CLIENT *Client, const char *Reason ) { CHANNEL *c, *next_c; assert( Client != NULL ); assert( Reason != NULL ); if (Conf_MorePrivacy) Reason = ""; IRC_WriteStrRelatedPrefix( Client, Client, false, "QUIT :%s", Reason ); c = My_Channels; while( c ) { next_c = c->next; Remove_Client( REMOVE_QUIT, c, Client, Client, Reason, false ); c = next_c; } } /* Channel_Quit */ /** * Get number of channels this server knows and that are "visible" to * the given client. If no client is given, all channels will be counted. * * @param Client The client to check or NULL. * @return Number of channels visible to the client. */ GLOBAL unsigned long Channel_CountVisible (CLIENT *Client) { CHANNEL *c; unsigned long count = 0; c = My_Channels; while(c) { if (Client) { if (!Channel_HasMode(c, 's') || Channel_IsMemberOf(c, Client)) count++; } else count++; c = c->next; } return count; } GLOBAL unsigned long Channel_MemberCount( CHANNEL *Chan ) { CL2CHAN *cl2chan; unsigned long count = 0; assert( Chan != NULL ); cl2chan = My_Cl2Chan; while( cl2chan ) { if( cl2chan->channel == Chan ) count++; cl2chan = cl2chan->next; } return count; } /* Channel_MemberCount */ GLOBAL int Channel_CountForUser( CLIENT *Client ) { /* Count number of channels a user is member of. */ CL2CHAN *cl2chan; int count = 0; assert( Client != NULL ); cl2chan = My_Cl2Chan; while( cl2chan ) { if( cl2chan->client == Client ) count++; cl2chan = cl2chan->next; } return count; } /* Channel_CountForUser */ GLOBAL const char * Channel_Name( const CHANNEL *Chan ) { assert( Chan != NULL ); return Chan->name; } /* Channel_Name */ GLOBAL char * Channel_Modes( CHANNEL *Chan ) { assert( Chan != NULL ); return Chan->modes; } /* Channel_Modes */ GLOBAL bool Channel_HasMode( CHANNEL *Chan, char Mode ) { assert( Chan != NULL ); return strchr( Chan->modes, Mode ) != NULL; } /* Channel_HasMode */ GLOBAL char * Channel_Key( CHANNEL *Chan ) { assert( Chan != NULL ); return Chan->key; } /* Channel_Key */ GLOBAL unsigned long Channel_MaxUsers( CHANNEL *Chan ) { assert( Chan != NULL ); return Chan->maxusers; } /* Channel_MaxUsers */ GLOBAL CHANNEL * Channel_First( void ) { return My_Channels; } /* Channel_First */ GLOBAL CHANNEL * Channel_Next( CHANNEL *Chan ) { assert( Chan != NULL ); return Chan->next; } /* Channel_Next */ GLOBAL CHANNEL * Channel_Search( const char *Name ) { /* Search channel structure */ CHANNEL *c; UINT32 search_hash; assert( Name != NULL ); search_hash = Hash( Name ); c = My_Channels; while( c ) { if( search_hash == c->hash ) { /* hash hit */ if( strcasecmp( Name, c->name ) == 0 ) return c; } c = c->next; } return NULL; } /* Channel_Search */ GLOBAL CL2CHAN * Channel_FirstMember( CHANNEL *Chan ) { assert( Chan != NULL ); return Get_First_Cl2Chan( NULL, Chan ); } /* Channel_FirstMember */ GLOBAL CL2CHAN * Channel_NextMember( CHANNEL *Chan, CL2CHAN *Cl2Chan ) { assert( Chan != NULL ); assert( Cl2Chan != NULL ); return Get_Next_Cl2Chan( Cl2Chan->next, NULL, Chan ); } /* Channel_NextMember */ GLOBAL CL2CHAN * Channel_FirstChannelOf( CLIENT *Client ) { assert( Client != NULL ); return Get_First_Cl2Chan( Client, NULL ); } /* Channel_FirstChannelOf */ GLOBAL CL2CHAN * Channel_NextChannelOf( CLIENT *Client, CL2CHAN *Cl2Chan ) { assert( Client != NULL ); assert( Cl2Chan != NULL ); return Get_Next_Cl2Chan( Cl2Chan->next, Client, NULL ); } /* Channel_NextChannelOf */ GLOBAL CLIENT * Channel_GetClient( CL2CHAN *Cl2Chan ) { assert( Cl2Chan != NULL ); return Cl2Chan->client; } /* Channel_GetClient */ GLOBAL CHANNEL * Channel_GetChannel( CL2CHAN *Cl2Chan ) { assert( Cl2Chan != NULL ); return Cl2Chan->channel; } /* Channel_GetChannel */ GLOBAL bool Channel_IsValidName( const char *Name ) { assert( Name != NULL ); #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 */ GLOBAL bool Channel_ModeAdd( CHANNEL *Chan, char Mode ) { /* set Mode. * If the channel already had this mode, return false. * If the channel mode was newly set return true. */ char x[2]; assert( Chan != NULL ); x[0] = Mode; x[1] = '\0'; if( ! Channel_HasMode( Chan, x[0] )) { /* Channel does not have this mode yet, set it */ strlcat( Chan->modes, x, sizeof( Chan->modes )); return true; } else return false; } /* Channel_ModeAdd */ GLOBAL bool Channel_ModeDel( CHANNEL *Chan, char Mode ) { /* Delete mode. * if the mode was removed return true. * if the channel did not have the mode, return false. */ char *p; assert( Chan != NULL ); p = strchr( Chan->modes, Mode ); if( ! p ) return false; /* Channel has mode -> delete */ while( *p ) { *p = *(p + 1); p++; } return true; } /* Channel_ModeDel */ GLOBAL bool Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, char Mode ) { /* Set Channel-User-Mode. * if mode was newly set, return true. * if the User already had this channel-mode, return false. */ CL2CHAN *cl2chan; char x[2]; assert( Chan != NULL ); assert( Client != NULL ); cl2chan = Get_Cl2Chan( Chan, Client ); assert( cl2chan != NULL ); x[0] = Mode; x[1] = '\0'; if( ! strchr( cl2chan->modes, x[0] )) { /* mode not set, -> set it */ strlcat( cl2chan->modes, x, sizeof( cl2chan->modes )); return true; } else return false; } /* Channel_UserModeAdd */ GLOBAL bool Channel_UserModeDel( CHANNEL *Chan, CLIENT *Client, char Mode ) { /* Delete Channel-User-Mode. * If Mode was removed, return true. * If User did not have the Channel-Mode, return false. */ CL2CHAN *cl2chan; char *p; assert( Chan != NULL ); assert( Client != NULL ); cl2chan = Get_Cl2Chan( Chan, Client ); assert( cl2chan != NULL ); p = strchr( cl2chan->modes, Mode ); if( ! p ) return false; /* Client has Mode -> delete */ while( *p ) { *p = *(p + 1); p++; } return true; } /* Channel_UserModeDel */ GLOBAL char * Channel_UserModes( CHANNEL *Chan, CLIENT *Client ) { /* return Users' Channel-Modes */ CL2CHAN *cl2chan; assert( Chan != NULL ); assert( Client != NULL ); cl2chan = Get_Cl2Chan( Chan, Client ); assert( cl2chan != NULL ); return cl2chan->modes; } /* Channel_UserModes */ GLOBAL bool Channel_UserHasMode( CHANNEL *Chan, CLIENT *Client, char Mode ) { return strchr(Channel_UserModes(Chan, Client), Mode) != NULL; } /* Channel_UserHasMode */ GLOBAL bool Channel_IsMemberOf( CHANNEL *Chan, CLIENT *Client ) { /* Test if Client is on Channel Chan */ assert( Chan != NULL ); assert( Client != NULL ); return Get_Cl2Chan(Chan, Client) != NULL; } /* Channel_IsMemberOf */ GLOBAL char * Channel_Topic( CHANNEL *Chan ) { char *ret; assert( Chan != NULL ); ret = array_start(&Chan->topic); return ret ? ret : ""; } /* Channel_Topic */ #ifndef STRICT_RFC GLOBAL unsigned int Channel_TopicTime(CHANNEL *Chan) { assert(Chan != NULL); return (unsigned int) Chan->topic_time; } /* Channel_TopicTime */ GLOBAL char * Channel_TopicWho(CHANNEL *Chan) { assert(Chan != NULL); return Chan->topic_who; } /* Channel_TopicWho */ GLOBAL unsigned int Channel_CreationTime(CHANNEL *Chan) { assert(Chan != NULL); return (unsigned int) Chan->creation_time; } /* Channel_CreationTime */ #endif GLOBAL void Channel_SetTopic(CHANNEL *Chan, CLIENT *Client, const char *Topic) { size_t len; assert( Chan != NULL ); assert( Topic != NULL ); len = strlen(Topic); if (len < array_bytes(&Chan->topic)) array_free(&Chan->topic); if (len >= COMMAND_LEN || !array_copyb(&Chan->topic, Topic, len+1)) Log(LOG_WARNING, "could not set new Topic \"%s\" on %s: %s", Topic, Chan->name, strerror(errno)); #ifndef STRICT_RFC Chan->topic_time = time(NULL); if (Client != NULL && Client_Type(Client) != CLIENT_SERVER) strlcpy(Chan->topic_who, Client_ID(Client), sizeof Chan->topic_who); else strlcpy(Chan->topic_who, DEFAULT_TOPIC_ID, sizeof Chan->topic_who); #else (void) Client; #endif } /* Channel_SetTopic */ GLOBAL void Channel_SetModes( CHANNEL *Chan, const char *Modes ) { assert( Chan != NULL ); assert( Modes != NULL ); strlcpy( Chan->modes, Modes, sizeof( Chan->modes )); } /* Channel_SetModes */ GLOBAL void Channel_SetKey( CHANNEL *Chan, const char *Key ) { assert( Chan != NULL ); assert( Key != NULL ); strlcpy( Chan->key, Key, sizeof( Chan->key )); LogDebug("Channel %s: Key is now \"%s\".", Chan->name, Chan->key ); } /* Channel_SetKey */ GLOBAL void Channel_SetMaxUsers(CHANNEL *Chan, unsigned long Count) { assert( Chan != NULL ); Chan->maxusers = Count; LogDebug("Channel %s: Member limit is now %lu.", Chan->name, Chan->maxusers ); } /* Channel_SetMaxUsers */ /** * Check if a client is allowed to send to a specific channel. * * @param Chan The channel to check. * @param From The client that wants to send. * @return true if the client is allowed to send, false otherwise. */ static bool Can_Send_To_Channel(CHANNEL *Chan, CLIENT *From) { bool is_member, has_voice, is_halfop, is_op, is_chanadmin, is_owner; is_member = has_voice = is_halfop = is_op = is_chanadmin = is_owner = false; /* The server itself always can send messages :-) */ if (Client_ThisServer() == From) return true; if (Channel_IsMemberOf(Chan, From)) { is_member = true; if (Channel_UserHasMode(Chan, From, 'v')) has_voice = true; if (Channel_UserHasMode(Chan, From, 'h')) is_halfop = true; if (Channel_UserHasMode(Chan, From, 'o')) is_op = true; if (Channel_UserHasMode(Chan, From, 'a')) is_chanadmin = true; if (Channel_UserHasMode(Chan, From, 'q')) is_owner = true; } /* * Is the client allowed to write to channel? * * If channel mode n set: non-members cannot send to channel. * If channel mode m set: need voice. */ if (Channel_HasMode(Chan, 'n') && !is_member) return false; if (Channel_HasMode(Chan, 'M') && !Client_HasMode(From, 'R') && !Client_HasMode(From, 'o')) return false; if (has_voice || is_halfop || is_op || is_chanadmin || is_owner) return true; if (Channel_HasMode(Chan, 'm')) return false; if (Lists_Check(&Chan->list_excepts, From)) return true; return !Lists_Check(&Chan->list_bans, From); } GLOBAL bool Channel_Write(CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Command, bool SendErrors, const char *Text) { if (!Can_Send_To_Channel(Chan, From)) { if (! SendErrors) return CONNECTED; /* no error, see RFC 2812 */ if (Channel_HasMode(Chan, 'M')) return IRC_WriteErrClient(From, ERR_NEEDREGGEDNICK_MSG, Client_ID(From), Channel_Name(Chan)); else return IRC_WriteErrClient(From, ERR_CANNOTSENDTOCHAN_MSG, Client_ID(From), Channel_Name(Chan)); } if (Client_Conn(From) > NONE) Conn_UpdateIdle(Client_Conn(From)); IRC_WriteStrChannelPrefix(Client, Chan, From, true, "%s %s :%s", Command, Channel_Name(Chan), Text); return CONNECTED; } GLOBAL CHANNEL * Channel_Create( const char *Name ) { /* Create new CHANNEL structure and add it to linked list */ CHANNEL *c; assert( Name != NULL ); c = (CHANNEL *)malloc( sizeof( CHANNEL )); if( ! c ) { Log( LOG_EMERG, "Can't allocate memory! [New_Chan]" ); return NULL; } memset( c, 0, sizeof( CHANNEL )); strlcpy( c->name, Name, sizeof( c->name )); c->hash = Hash( c->name ); c->next = My_Channels; #ifndef STRICT_RFC c->creation_time = time(NULL); #endif My_Channels = c; LogDebug("Created new channel structure for \"%s\".", Name); return c; } /* Channel_Create */ static CL2CHAN * Get_Cl2Chan( CHANNEL *Chan, CLIENT *Client ) { CL2CHAN *cl2chan; assert( Chan != NULL ); assert( Client != NULL ); cl2chan = My_Cl2Chan; while( cl2chan ) { if(( cl2chan->channel == Chan ) && ( cl2chan->client == Client )) return cl2chan; cl2chan = cl2chan->next; } return NULL; } /* Get_Cl2Chan */ static CL2CHAN * Add_Client( CHANNEL *Chan, CLIENT *Client ) { CL2CHAN *cl2chan; assert( Chan != NULL ); assert( Client != NULL ); /* Create new CL2CHAN structure */ cl2chan = (CL2CHAN *)malloc( sizeof( CL2CHAN )); if( ! cl2chan ) { Log( LOG_EMERG, "Can't allocate memory! [Add_Client]" ); return NULL; } cl2chan->channel = Chan; cl2chan->client = Client; strcpy( cl2chan->modes, "" ); /* concatenate */ cl2chan->next = My_Cl2Chan; My_Cl2Chan = cl2chan; LogDebug("User \"%s\" joined channel \"%s\".", Client_Mask(Client), Chan->name); return cl2chan; } /* Add_Client */ static bool Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const char *Reason, bool InformServer ) { 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 ) { if(( cl2chan->channel == Chan ) && ( cl2chan->client == Client )) break; last_cl2chan = cl2chan; cl2chan = cl2chan->next; } if( ! cl2chan ) return false; c = cl2chan->channel; assert( c != NULL ); /* maintain cl2chan list */ if( last_cl2chan ) last_cl2chan->next = cl2chan->next; else My_Cl2Chan = cl2chan->next; free( cl2chan ); switch( Type ) { case REMOVE_QUIT: /* 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 (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); IRC_WriteStrChannelPrefix(Client, c, Origin, false, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason ); if ((Client_Conn(Client) > NONE) && (Client_Type(Client) == CLIENT_USER)) { IRC_WriteStrClientPrefix(Client, Origin, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason); } LogDebug("User \"%s\" has been kicked off \"%s\" by \"%s\": %s.", Client_Mask( Client ), c->name, Client_ID(Origin), Reason); break; default: /* PART */ if (Conf_MorePrivacy) Reason = ""; if (InformServer) IRC_WriteStrServersPrefix(Origin, Client, "PART %s :%s", c->name, Reason); IRC_WriteStrChannelPrefix(Origin, c, Client, false, "PART %s :%s", c->name, Reason); if ((Client_Conn(Origin) > NONE) && (Client_Type(Origin) == CLIENT_USER)) { IRC_WriteStrClientPrefix( Origin, Client, "PART %s :%s", c->name, Reason); LogDebug("User \"%s\" left channel \"%s\" (%s).", Client_Mask(Client), c->name, Reason); } } /* When channel is empty and is not pre-defined, delete */ if( ! Channel_HasMode( Chan, 'P' )) { if( ! Get_First_Cl2Chan( NULL, Chan )) Delete_Channel( Chan ); } return true; } /* Remove_Client */ GLOBAL bool Channel_AddBan(CHANNEL *c, const char *mask ) { struct list_head *h = Channel_GetListBans(c); LogDebug("Adding \"%s\" to \"%s\" ban list", mask, Channel_Name(c)); return Lists_Add(h, mask, false, NULL); } GLOBAL bool Channel_AddExcept(CHANNEL *c, const char *mask ) { struct list_head *h = Channel_GetListExcepts(c); LogDebug("Adding \"%s\" to \"%s\" exception list", mask, Channel_Name(c)); return Lists_Add(h, mask, false, NULL); } GLOBAL bool Channel_AddInvite(CHANNEL *c, const char *mask, bool onlyonce) { struct list_head *h = Channel_GetListInvites(c); LogDebug("Adding \"%s\" to \"%s\" invite list", mask, Channel_Name(c)); return Lists_Add(h, mask, onlyonce, NULL); } static bool ShowChannelList(struct list_head *head, CLIENT *Client, CHANNEL *Channel, char *msg, char *msg_end) { struct list_elem *e; assert (Client != NULL); assert (Channel != NULL); e = Lists_GetFirst(head); while (e) { if (!IRC_WriteStrClient(Client, msg, Client_ID(Client), Channel_Name(Channel), Lists_GetMask(e))) return DISCONNECTED; e = Lists_GetNext(e); } return IRC_WriteStrClient(Client, msg_end, Client_ID(Client), Channel_Name(Channel)); } GLOBAL bool Channel_ShowBans( CLIENT *Client, CHANNEL *Channel ) { struct list_head *h; assert( Channel != NULL ); h = Channel_GetListBans(Channel); return ShowChannelList(h, Client, Channel, RPL_BANLIST_MSG, RPL_ENDOFBANLIST_MSG); } GLOBAL bool Channel_ShowExcepts( CLIENT *Client, CHANNEL *Channel ) { struct list_head *h; assert( Channel != NULL ); h = Channel_GetListExcepts(Channel); return ShowChannelList(h, Client, Channel, RPL_EXCEPTLIST_MSG, RPL_ENDOFEXCEPTLIST_MSG); } GLOBAL bool Channel_ShowInvites( CLIENT *Client, CHANNEL *Channel ) { struct list_head *h; assert( Channel != NULL ); h = Channel_GetListInvites(Channel); return ShowChannelList(h, Client, Channel, RPL_INVITELIST_MSG, RPL_ENDOFINVITELIST_MSG); } /** * 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 (!Channel_HasMode(Chan, 'k')) return true; if (*Key == '\0') return false; if (strcmp(Chan->key, Key) == 0) return true; 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 ) { return Get_Next_Cl2Chan( My_Cl2Chan, Client, Chan ); } /* Get_First_Cl2Chan */ static CL2CHAN * Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHANNEL *Channel ) { CL2CHAN *cl2chan; assert( Client != NULL || Channel != NULL ); cl2chan = Start; while( cl2chan ) { if(( Client ) && ( cl2chan->client == Client )) return cl2chan; if(( Channel ) && ( cl2chan->channel == Channel )) return cl2chan; cl2chan = cl2chan->next; } return NULL; } /* Get_Next_Cl2Chan */ /** * Remove a channel and free all of its data structures. */ static void Delete_Channel(CHANNEL *Chan) { CHANNEL *chan, *last_chan; last_chan = NULL; chan = My_Channels; while (chan) { if (chan == Chan) break; last_chan = chan; chan = chan->next; } assert(chan != NULL); if (!chan) return; /* maintain channel list */ if (last_chan) last_chan->next = chan->next; else My_Channels = chan->next; 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- */ ngircd-21/src/ngircd/proc.c0000644000175000116100000000700712232014660012625 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * Process management */ #include "imp.h" #include #include #include #include #include #include #include "log.h" #include "io.h" #include "conn.h" #include "exp.h" #include "sighandlers.h" #include "proc.h" /** * Initialize process structure. */ GLOBAL void Proc_InitStruct (PROC_STAT *proc) { assert(proc != NULL); proc->pid = 0; proc->pipe_fd = -1; } /** * Fork a child process. */ GLOBAL pid_t Proc_Fork(PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout) { pid_t pid; #ifndef HAVE_ARC4RANDOM unsigned int seed; #endif assert(proc != NULL); assert(pipefds != NULL); assert(cbfunc != NULL); if (pipe(pipefds) != 0) { Log(LOG_ALERT, "Can't create output pipe for child process: %s!", strerror(errno)); return -1; } #ifndef HAVE_ARC4RANDOM seed = (unsigned int)rand(); #endif pid = fork(); switch (pid) { case -1: /* Error on fork: */ Log(LOG_CRIT, "Can't fork child process: %s!", strerror(errno)); close(pipefds[0]); close(pipefds[1]); return -1; case 0: /* New child process: */ #ifdef HAVE_ARC4RANDOM_STIR arc4random_stir(); #endif #ifndef HAVE_ARC4RANDOM srand(seed ^ (unsigned int)time(NULL) ^ getpid()); #endif Signals_Exit(); signal(SIGTERM, Proc_GenericSignalHandler); signal(SIGALRM, Proc_GenericSignalHandler); close(pipefds[0]); alarm(timeout); return 0; } /* Old parent process: */ close(pipefds[1]); if (!io_setnonblock(pipefds[0]) || !io_event_create(pipefds[0], IO_WANTREAD, cbfunc)) { Log(LOG_CRIT, "Can't register callback for child process: %s!", strerror(errno)); close(pipefds[0]); return -1; } proc->pid = pid; proc->pipe_fd = pipefds[0]; return pid; } /** * Generic signal handler for forked child processes. */ GLOBAL void Proc_GenericSignalHandler(int Signal) { switch(Signal) { case SIGTERM: #ifdef DEBUG Log_Subprocess(LOG_DEBUG, "Child got TERM signal, exiting."); #endif exit(1); case SIGALRM: #ifdef DEBUG Log_Subprocess(LOG_DEBUG, "Child got ALARM signal, exiting."); #endif exit(1); } } /** * Read bytes from a pipe of a forked child process. * In addition, this function makes sure that the child process is ignored * after all data has been read or a fatal error occurred. */ GLOBAL size_t Proc_Read(PROC_STAT *proc, void *buffer, size_t buflen) { ssize_t bytes_read = 0; assert(buffer != NULL); assert(buflen > 0); bytes_read = read(proc->pipe_fd, buffer, buflen); if (bytes_read < 0) { if (errno == EAGAIN) return 0; Log(LOG_CRIT, "Can't read from child process %ld: %s", proc->pid, strerror(errno)); Proc_Close(proc); bytes_read = 0; } else if (bytes_read == 0) { /* EOF: clean up */ LogDebug("Child process %ld: EOF reached, closing pipe.", proc->pid); Proc_Close(proc); } return (size_t)bytes_read; } /** * Close pipe to a forked child process. */ GLOBAL void Proc_Close(PROC_STAT *proc) { /* Close socket, if it exists */ if (proc->pipe_fd >= 0) io_close(proc->pipe_fd); Proc_InitStruct(proc); } /* -eof- */ ngircd-21/src/ngircd/ngircd.h0000644000175000116100000000404011526006312013127 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2010 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. */ #ifndef __ngircd_h__ #define __ngircd_h__ /** * @file * Global variables of ngIRCd. */ #include #include "defines.h" #define C_ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) /** UNIX timestamp of ngIRCd start */ GLOBAL time_t NGIRCd_Start; /** ngIRCd start time as string, used for RPL_CREATED_MSG (003) */ GLOBAL char NGIRCd_StartStr[64]; /** ngIRCd version number containing release number and compile-time options */ GLOBAL char NGIRCd_Version[126]; /** String specifying the compile-time options and target platform */ GLOBAL char NGIRCd_VersionAddition[126]; #ifdef DEBUG /** Flag indicating if debug mode is active (true) or not (false) */ GLOBAL bool NGIRCd_Debug; #endif #ifdef SNIFFER /** Flag indication if sniffer is active (true) or not (false) */ GLOBAL bool NGIRCd_Sniffer; #endif /** * Flag indicating if NO outgoing connections should be established (true) * or not (false, the default) */ GLOBAL bool NGIRCd_Passive; /** Flag indicating that ngIRCd has been requested to quit (true) */ GLOBAL bool NGIRCd_SignalQuit; /** Flag indicating that ngIRCd has been requested to restart (true) */ GLOBAL bool NGIRCd_SignalRestart; /** * Debug level for "VERSION" command, see description of numeric RPL_VERSION * (351) in RFC 2812. ngIRCd sets debuglevel to 1 when the debug mode is * active, and to 2 if the sniffer is running. */ GLOBAL char NGIRCd_DebugLevel[2]; /** Full path and file name of current configuration file */ GLOBAL char NGIRCd_ConfFile[FNAME_LEN]; /** Protocol and server identification string; see doc/Protocol.txt */ GLOBAL char NGIRCd_ProtoID[COMMAND_LEN]; #endif /* -eof- */ ngircd-21/src/ngircd/irc-metadata.c0000644000175000116100000000663112212712537014225 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #define __irc_metadata_c__ #include "portab.h" /** * @file * IRC metadata commands */ #include "imp.h" #include #include #include #include "conn-func.h" #include "channel.h" #include "conn-encoding.h" #include "irc-write.h" #include "log.h" #include "messages.h" #include "parse.h" #include "tool.h" #include "exp.h" #include "irc-metadata.h" /** * Handler for the IRC+ "METADATA" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @returns CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_METADATA(CLIENT *Client, REQUEST *Req) { CLIENT *prefix, *target; char new_flags[COMMAND_LEN]; assert(Client != NULL); assert(Req != NULL); prefix = Client_Search(Req->prefix); if (!prefix) return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->prefix); target = Client_Search(Req->argv[0]); if (!target) return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->argv[0]); LogDebug("Got \"METADATA\" command from \"%s\" for client \"%s\": \"%s=%s\".", Client_ID(prefix), Client_ID(target), Req->argv[1], Req->argv[2]); /* Mark client: it has received a METADATA command */ if (!Client_HasFlag(target, 'M')) { snprintf(new_flags, sizeof new_flags, "%sM", Client_Flags(target)); Client_SetFlags(target, new_flags); } if (strcasecmp(Req->argv[1], "cloakhost") == 0) { Client_UpdateCloakedHostname(target, prefix, Req->argv[2]); if (Client_Conn(target) > NONE && Client_HasMode(target, 'x')) IRC_WriteStrClientPrefix(target, prefix, RPL_HOSTHIDDEN_MSG, Client_ID(target), Client_HostnameDisplayed(target)); /* The Client_UpdateCloakedHostname() function already * forwarded the METADATA command, don't do it twice: */ return CONNECTED; } else if (*Req->argv[2] && strcasecmp(Req->argv[1], "host") == 0) { Client_SetHostname(target, Req->argv[2]); if (Client_Conn(target) > NONE && !Client_HasMode(target, 'x')) IRC_WriteStrClientPrefix(target, prefix, RPL_HOSTHIDDEN_MSG, Client_ID(target), Client_HostnameDisplayed(target)); } else if (strcasecmp(Req->argv[1], "info") == 0) Client_SetInfo(target, Req->argv[2]); else if (*Req->argv[2] && strcasecmp(Req->argv[1], "user") == 0) Client_SetUser(target, Req->argv[2], true); else if (strcasecmp(Req->argv[1], "accountname") == 0) Client_SetAccountName(target, Req->argv[2]); else if (*Req->argv[2] && strcasecmp(Req->argv[1], "certfp") == 0) Conn_SetCertFp(Client_Conn(target), Req->argv[2]); else Log(LOG_WARNING, "Ignored metadata update from \"%s\" for client \"%s\": \"%s=%s\" - unknown key!", Client_ID(Client), Client_ID(target), Req->argv[1], Req->argv[2]); /* Forward the METADATA command to peers that support it: */ IRC_WriteStrServersPrefixFlag(Client, prefix, 'M', "METADATA %s %s :%s", Client_ID(target), Req->argv[1], Req->argv[2]); return CONNECTED; } ngircd-21/src/ngircd/array.c0000644000175000116100000001337412202004071012774 00000000000000/* * 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. * * libarray - dynamically allocate arrays. * Copyright (c) 2005 Florian Westphal (westphal@foo.fh-furtwangen.de) */ /** * @file * Functions to dynamically allocate arrays. */ #include "array.h" #include #include #include #include "log.h" /* Enable more Debug messages in alloc / append / memmove code. */ /* #define DEBUG_ARRAY */ #define array_UNUSABLE(x) ( !(x)->mem ) static bool safemult_sizet(size_t a, size_t b, size_t *res) { size_t tmp = a * b; if (b && (tmp / b != a)) return false; *res = tmp; return true; } void array_init(array *a) { assert(a != NULL); a->mem = NULL; a->allocated = 0; a->used = 0; } /* if realloc() fails, array_alloc return NULL. otherwise return pointer to elem pos in array */ void * array_alloc(array * a, size_t size, size_t pos) { size_t alloc, pos_plus1 = pos + 1; char *tmp; assert(size > 0); if (pos_plus1 == 0 || !safemult_sizet(size, pos_plus1, &alloc)) return NULL; if (a->allocated < alloc) { #ifdef DEBUG_ARRAY Log(LOG_DEBUG, "array_alloc(): changing size from %u to %u bytes.", a->allocated, alloc); #endif tmp = realloc(a->mem, alloc); if (!tmp) return NULL; a->mem = tmp; a->allocated = alloc; memset(a->mem + a->used, 0, a->allocated - a->used); a->used = alloc; } assert(a->allocated >= a->used); return a->mem + (pos * size); } /*return number of initialized ELEMS in a. */ size_t array_length(const array * const a, size_t membersize) { assert(a != NULL); assert(membersize > 0); if (array_UNUSABLE(a)) return 0; assert(a->allocated); return membersize ? a->used / membersize : 0; } /* copy array src to array dest */ bool array_copy(array * dest, const array * const src) { if (array_UNUSABLE(src)) return false; assert(src->allocated); return array_copyb(dest, src->mem, src->used); } /* return false on failure (realloc failure, invalid src/dest array) */ bool array_copyb(array * dest, const char *src, size_t len) { assert(dest != NULL); assert(src != NULL ); if (!src || !dest) return false; array_trunc(dest); return array_catb(dest, src, len); } /* copy string to dest */ bool array_copys(array * dest, const char *src) { return array_copyb(dest, src, strlen(src)); } /* append len bytes from src to the array dest. return false if we could not append all bytes (realloc failure, invalid src/dest array) */ bool array_catb(array * dest, const char *src, size_t len) { size_t tmp; size_t used; char *ptr; assert(dest != NULL); assert(src != NULL); if (!len) return true; if (!src || !dest) return false; used = dest->used; tmp = used + len; if (tmp < used || tmp < len) /* integer overflow */ return false; if (!array_alloc(dest, 1, tmp)) return false; ptr = dest->mem; assert(ptr != NULL); #ifdef DEBUG_ARRAY Log(LOG_DEBUG, "array_catb(): appending %u bytes to array (now %u bytes in array).", len, tmp); #endif memcpy(ptr + used, src, len); dest->used = tmp; return true; } /* append string to dest */ bool array_cats(array * dest, const char *src) { return array_catb(dest, src, strlen(src)); } /* append trailing NUL byte to array */ bool array_cat0(array * a) { return array_catb(a, "", 1); } /* append trailing NUL byte to array, but do not count it. */ bool array_cat0_temporary(array * a) { char *endpos = array_alloc(a, 1, array_bytes(a)); if (!endpos) return false; *endpos = '\0'; return true; } /* add contents of array src to array dest. */ bool array_cat(array * dest, const array * const src) { if (array_UNUSABLE(src)) return false; return array_catb(dest, src->mem, src->used); } /* return pointer to the element at pos. return NULL if the array is unallocated, or if pos is larger than the number of elements stored int the array. */ void * array_get(array * a, size_t membersize, size_t pos) { size_t totalsize; size_t posplus1 = pos + 1; assert(membersize > 0); assert(a != NULL); if (!posplus1 || array_UNUSABLE(a)) return NULL; if (!safemult_sizet(posplus1, membersize, &totalsize)) return NULL; if (a->allocated < totalsize) return NULL; totalsize = pos * membersize; return a->mem + totalsize; } void array_free(array * a) { assert(a != NULL); #ifdef DEBUG_ARRAY Log(LOG_DEBUG, "array_free(): %u bytes free'd (%u bytes still used at time of free()).", a->allocated, a->used); #endif free(a->mem); a->mem = NULL; a->allocated = 0; 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) { assert(a != NULL); return a->mem; } void array_trunc(array * a) { assert(a != NULL); a->used = 0; } void array_truncate(array * a, size_t membersize, size_t len) { size_t newlen; assert(a != NULL); if (!safemult_sizet(membersize, len, &newlen)) return; if (newlen <= a->allocated) a->used = newlen; } /* move elements starting at pos to beginning of array */ void array_moveleft(array * a, size_t membersize, size_t pos) { size_t bytepos; assert(a != NULL); assert(membersize > 0); if (!safemult_sizet(membersize, pos, &bytepos)) { a->used = 0; return; } if (!bytepos) return; /* nothing to do */ #ifdef DEBUG_ARRAY Log(LOG_DEBUG, "array_moveleft(): %u bytes used in array, starting at position %u.", a->used, bytepos); #endif if (a->used <= bytepos) { a->used = 0; return; } a->used -= bytepos; memmove(a->mem, a->mem + bytepos, a->used); } /* -eof- */ ngircd-21/src/ngircd/irc-op.c0000644000175000116100000001362512212712537013064 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * Channel operator commands */ #include "imp.h" #include #include #include #include "defines.h" #include "conn.h" #include "channel.h" #include "irc-macros.h" #include "irc-write.h" #include "lists.h" #include "log.h" #include "messages.h" #include "parse.h" #include "exp.h" #include "irc-op.h" /* Local functions */ static bool try_kick(CLIENT *peer, CLIENT* from, const char *nick, const char *channel, const char *reason) { CLIENT *target = Client_Search(nick); if (!target) return IRC_WriteErrClient(from, ERR_NOSUCHNICK_MSG, Client_ID(from), nick); Channel_Kick(peer, target, from, channel, reason); return true; } /* Global functions */ /** * Handler for the IRC command "KICK". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_KICK(CLIENT *Client, REQUEST *Req) { CLIENT *from; char *itemList = Req->argv[0]; const char* currentNick, *currentChannel, *reason; unsigned int channelCount = 1; unsigned int nickCount = 1; assert( Client != NULL ); assert( Req != NULL ); _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) while (*itemList) { if (*itemList == ',') { *itemList = '\0'; channelCount++; } itemList++; } itemList = Req->argv[1]; while (*itemList) { if (*itemList == ',') { *itemList = '\0'; nickCount++; } itemList++; } reason = Req->argc == 3 ? Req->argv[2] : Client_ID(from); currentNick = Req->argv[1]; currentChannel = Req->argv[0]; if (channelCount == 1) { while (nickCount > 0) { if (!try_kick(Client, from, currentNick, currentChannel, reason)) return false; while (*currentNick) currentNick++; currentNick++; nickCount--; } } else if (channelCount == nickCount) { while (nickCount > 0) { if (!try_kick(Client, from, currentNick, currentChannel, reason)) return false; while (*currentNick) currentNick++; while (*currentChannel) currentChannel++; currentNick++; currentChannel++; nickCount--; } } else { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } return true; } /* IRC_KICK */ /** * Handler for the IRC command "INVITE". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_INVITE(CLIENT *Client, REQUEST *Req) { CHANNEL *chan; CLIENT *target, *from; const char *colon_if_necessary; bool remember = false; assert( Client != NULL ); assert( Req != NULL ); _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) /* Search user */ target = Client_Search(Req->argv[0]); if (!target || (Client_Type(target) != CLIENT_USER)) return IRC_WriteErrClient(from, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->argv[0]); chan = Channel_Search(Req->argv[1]); if (chan) { /* Channel exists. Is the user a valid member of the channel? */ if (!Channel_IsMemberOf(chan, from)) return IRC_WriteErrClient(from, ERR_NOTONCHANNEL_MSG, Client_ID(Client), Req->argv[1]); /* Is the channel "invite-disallow"? */ if (Channel_HasMode(chan, 'V')) return IRC_WriteErrClient(from, ERR_NOINVITE_MSG, Client_ID(from), Channel_Name(chan)); /* Is the channel "invite-only"? */ if (Channel_HasMode(chan, 'i')) { /* Yes. The user must be channel owner/admin/operator/halfop! */ if (!Channel_UserHasMode(chan, from, 'q') && !Channel_UserHasMode(chan, from, 'a') && !Channel_UserHasMode(chan, from, 'o') && !Channel_UserHasMode(chan, from, 'h')) return IRC_WriteErrClient(from, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(from), Channel_Name(chan)); remember = true; } /* Is the target user already member of the channel? */ if (Channel_IsMemberOf(chan, target)) return IRC_WriteErrClient(from, ERR_USERONCHANNEL_MSG, Client_ID(from), Req->argv[0], Req->argv[1]); /* If the target user is banned on that channel: remember invite */ if (Lists_Check(Channel_GetListBans(chan), target)) remember = true; if (remember) { /* We must remember this invite */ if (!Channel_AddInvite(chan, Client_Mask(target), true)) return CONNECTED; } } LogDebug("User \"%s\" invites \"%s\" to \"%s\" ...", Client_Mask(from), Req->argv[0], Req->argv[1]); /* * RFC 2812 says: * 'There is no requirement that the channel [..] must exist or be a valid channel' * The problem with this is that this allows the "channel" to contain spaces, * in which case we must prefix its name with a colon to make it clear that * it is only a single argument. */ colon_if_necessary = strchr(Req->argv[1], ' ') ? ":":""; /* Inform target client */ IRC_WriteStrClientPrefix(target, from, "INVITE %s %s%s", Req->argv[0], colon_if_necessary, Req->argv[1]); if (Client_Conn(target) > NONE) { /* The target user is local, so we have to send the status code */ if (!IRC_WriteStrClientPrefix(from, target, RPL_INVITING_MSG, Client_ID(from), Req->argv[0], colon_if_necessary, Req->argv[1])) return DISCONNECTED; if (Client_HasMode(target, 'a') && !IRC_WriteStrClient(from, RPL_AWAY_MSG, Client_ID(from), Client_ID(target), Client_Away(target))) return DISCONNECTED; } return CONNECTED; } /* IRC_INVITE */ /* -eof- */ ngircd-21/src/ngircd/irc-cap.c0000644000175000116100000001445512212712537013213 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * Handler for IRC capability ("CAP") commands */ #include "imp.h" #include #include #include "defines.h" #include "conn.h" #include "channel.h" #include "client-cap.h" #include "irc-macros.h" #include "irc-write.h" #include "log.h" #include "login.h" #include "messages.h" #include "parse.h" #include "exp.h" #include "irc-cap.h" /* Local functions */ /** * Set CAP negotiation status and mark client as "supports capabilities". * * @param Client The client to handle. */ static void Set_CAP_Negotiation(CLIENT *Client) { assert(Client != NULL); if (Client_Type(Client) != CLIENT_USER) Client_CapAdd(Client, CLIENT_CAP_PENDING); Client_CapAdd(Client, CLIENT_CAP_SUPPORTED); } /** * Parse capability string and return numeric flag value. * * @param Args The string containing space-separated capability names. * @return Changed capability flags or 0 on error. */ static int Parse_CAP(int Capabilities, char *Args) { static char tmp[COMMAND_LEN]; char *ptr; assert(Args != NULL); strlcpy(tmp, Args, sizeof(tmp)); ptr = strtok(tmp, " "); while (ptr) { if (*ptr == '-') { /* drop capabilities */ ptr++; if (strcmp(ptr, "multi-prefix") == 0) Capabilities &= ~CLIENT_CAP_MULTI_PREFIX; else return -1; } else { /* request capabilities */ if (strcmp(ptr, "multi-prefix") == 0) Capabilities |= CLIENT_CAP_MULTI_PREFIX; else return -1; } ptr = strtok(NULL, " "); } return Capabilities; } /** * Return textual representation of capability flags. * * Please note: this function returns a pointer to a global buffer and * therefore isn't thread safe! * * @param Capabilities Capability flags (bitmask). * @return Pointer to textual representation. */ static char * Get_CAP_String(int Capabilities) { static char txt[COMMAND_LEN]; txt[0] = '\0'; if (Capabilities & CLIENT_CAP_MULTI_PREFIX) strlcat(txt, "multi-prefix ", sizeof(txt)); return txt; } /** * Handler for the IRCv3 sub-command "CAP LS". * * @param Client The client from which this command has been received. * @param Arg Command argument or NULL. * @return CONNECTED or DISCONNECTED. */ static bool Handle_CAP_LS(CLIENT *Client, UNUSED char *Arg) { assert(Client != NULL); Set_CAP_Negotiation(Client); return IRC_WriteStrClient(Client, "CAP %s LS :multi-prefix", Client_ID(Client)); } /** * Handler for the IRCv3 sub-command "CAP LIST". * * @param Client The client from which this command has been received. * @param Arg Command argument or NULL. * @return CONNECTED or DISCONNECTED. */ static bool Handle_CAP_LIST(CLIENT *Client, UNUSED char *Arg) { assert(Client != NULL); return IRC_WriteStrClient(Client, "CAP %s LIST :%s", Client_ID(Client), Get_CAP_String(Client_Cap(Client))); } /** * Handler for the IRCv3 sub-command "CAP REQ". * * @param Client The client from which this command has been received. * @param Arg Command argument. * @return CONNECTED or DISCONNECTED. */ static bool Handle_CAP_REQ(CLIENT *Client, char *Arg) { int new_cap; assert(Client != NULL); assert(Arg != NULL); Set_CAP_Negotiation(Client); new_cap = Parse_CAP(Client_Cap(Client), Arg); if (new_cap < 0) return IRC_WriteStrClient(Client, "CAP %s NAK :%s", Client_ID(Client), Arg); Client_CapSet(Client, new_cap); return IRC_WriteStrClient(Client, "CAP %s ACK :%s", Client_ID(Client), Arg); } /** * Handler for the IRCv3 sub-command "CAP ACK". * * @param Client The client from which this command has been received. * @param Arg Command argument. * @return CONNECTED or DISCONNECTED. */ static bool Handle_CAP_ACK(UNUSED CLIENT *Client, UNUSED char *Arg) { assert(Client != NULL); assert(Arg != NULL); return CONNECTED; } /** * Handler for the IRCv3 sub-command "CAP CLEAR". * * @param Client The client from which this command has been received. * @return CONNECTED or DISCONNECTED. */ static bool Handle_CAP_CLEAR(CLIENT *Client) { int cap_old; assert(Client != NULL); cap_old = Client_Cap(Client); if (cap_old & CLIENT_CAP_MULTI_PREFIX) Client_CapDel(Client, CLIENT_CAP_MULTI_PREFIX); return IRC_WriteStrClient(Client, "CAP %s ACK :%s", Client_ID(Client), Get_CAP_String(cap_old)); } /** * Handler for the IRCv3 sub-command "CAP END". * * @param Client The client from which this command has been received. * @return CONNECTED or DISCONNECTED. */ static bool Handle_CAP_END(CLIENT *Client) { assert(Client != NULL); if (Client_Type(Client) != CLIENT_USER) { /* User is still logging in ... */ Client_CapDel(Client, CLIENT_CAP_PENDING); if (Client_Type(Client) == CLIENT_WAITCAPEND) { /* Only "CAP END" was missing: log in! */ return Login_User(Client); } } return CONNECTED; } /* Global functions */ /** * Handler for the IRCv3 command "CAP". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_CAP(CLIENT *Client, REQUEST *Req) { assert(Client != NULL); assert(Req != NULL); LogDebug("Got \"%s %s\" command from \"%s\" ...", Req->command, Req->argv[0], Client_ID(Client)); if (Req->argc == 1) { if (strcasecmp(Req->argv[0], "CLEAR") == 0) return Handle_CAP_CLEAR(Client); if (strcasecmp(Req->argv[0], "END") == 0) return Handle_CAP_END(Client); } if (Req->argc >= 1 && Req->argc <= 2) { if (strcasecmp(Req->argv[0], "LS") == 0) return Handle_CAP_LS(Client, Req->argv[1]); if (strcasecmp(Req->argv[0], "LIST") == 0) return Handle_CAP_LIST(Client, Req->argv[1]); } if (Req->argc == 2) { if (strcasecmp(Req->argv[0], "REQ") == 0) return Handle_CAP_REQ(Client, Req->argv[1]); if (strcasecmp(Req->argv[0], "ACK") == 0) return Handle_CAP_ACK(Client, Req->argv[1]); } return IRC_WriteErrClient(Client, ERR_INVALIDCAP_MSG, Client_ID(Client), Req->argv[0]); } /* -eof- */ ngircd-21/src/ngircd/log.h0000644000175000116100000000301211720743364012453 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 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. */ #ifndef __log_h__ #define __log_h__ /** * @file * Logging functions (header) */ #ifdef SYSLOG # include #else # define LOG_EMERG 0 # define LOG_ALERT 1 # define LOG_CRIT 2 # define LOG_ERR 3 # define LOG_WARNING 4 # define LOG_NOTICE 5 # define LOG_INFO 6 # define LOG_DEBUG 7 #endif #define LOG_snotice 1024 GLOBAL void Log_Init PARAMS(( bool Daemon_Mode )); GLOBAL void Log_Exit PARAMS(( void )); GLOBAL void Log PARAMS(( int Level, const char *Format, ... )); GLOBAL void Log_ReInit PARAMS((void)); GLOBAL void Log_ServerNotice PARAMS((char UserMode, const char *Format, ...)); #ifdef DEBUG GLOBAL void LogDebug PARAMS(( const char *Format, ... )); #else static inline void LogDebug PARAMS(( UNUSED const char *Format, ... )){/* Do nothing. The compiler should optimize this out, please ;-) */} #endif GLOBAL void Log_Init_Subprocess PARAMS((char *Name)); GLOBAL void Log_Exit_Subprocess PARAMS((char *Name)); GLOBAL void Log_Subprocess PARAMS((const int Level, const char *Format, ...)); #ifdef DEBUG GLOBAL void Log_InitErrorfile PARAMS(( void )); #endif #endif /* -eof- */ ngircd-21/src/ngircd/client.h0000644000175000116100000002002112221142771013137 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __client_h__ #define __client_h__ /** * @file * Client management (header) */ #define CLIENT_UNKNOWN 0x0001 /* connection of unknown type */ #define CLIENT_GOTPASS 0x0002 /* client did send PASS */ #define CLIENT_GOTNICK 0x0004 /* client did send NICK */ #define CLIENT_GOTUSER 0x0008 /* client did send USER */ #define CLIENT_USER 0x0010 /* client is an IRC user */ #define CLIENT_SERVER 0x0020 /* client is a server */ #define CLIENT_SERVICE 0x0040 /* client is a service */ #define CLIENT_UNKNOWNSERVER 0x0080 /* unregistered server connection */ #define CLIENT_GOTPASS_2813 0x0100 /* client did send PASS, RFC 2813 style */ #ifndef STRICT_RFC # define CLIENT_WAITAUTHPING 0x0200 /* waiting for AUTH PONG from client */ #endif #define CLIENT_WAITCAPEND 0x0400 /* waiting for "CAP END" command */ #define CLIENT_ANY 0xFFFF #define CLIENT_TYPE int #include "defines.h" #if defined(__client_c__) | defined(__client_cap_c__) | defined(S_SPLINT_S) typedef struct _CLIENT { time_t starttime; /* Start time of link */ char id[CLIENT_ID_LEN]; /* nick (user) / ID (server) */ UINT32 hash; /* hash of lower-case ID */ POINTER *next; /* pointer to next client structure */ CLIENT_TYPE type; /* type of client, see CLIENT_xxx */ CONN_ID conn_id; /* ID of the connection (if local) or NONE (remote) */ struct _CLIENT *introducer; /* ID of the servers which the client is connected to */ struct _CLIENT *topserver; /* toplevel servers (only valid if client is a server) */ char host[CLIENT_HOST_LEN]; /* hostname of the client */ char *cloaked; /* cloaked hostname of the client */ char *ipa_text; /* textual representaton of IP address */ char user[CLIENT_USER_LEN]; /* user name ("login") */ #if defined(PAM) && defined(IDENTAUTH) char orig_user[CLIENT_USER_LEN];/* user name supplied by USER command */ #endif char info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */ char modes[CLIENT_MODE_LEN]; /* client modes */ int hops, token, mytoken; /* "hops" and "Token" (see SERVER command) */ char *away; /* AWAY text (valid if mode 'a' is set) */ char flags[CLIENT_FLAGS_LEN]; /* flags of the client */ char *account_name; /* login account (for services) */ int capabilities; /* enabled IRC capabilities */ } CLIENT; #else typedef POINTER CLIENT; #endif typedef struct _WHOWAS { time_t time; /* time stamp of entry or 0 if unused */ char id[CLIENT_NICK_LEN]; /* client nickname */ char host[CLIENT_HOST_LEN]; /* hostname of the client */ char user[CLIENT_USER_LEN]; /* user name ("login") */ char info[CLIENT_INFO_LEN]; /* long user name */ char server[CLIENT_HOST_LEN]; /* server name */ } WHOWAS; GLOBAL void Client_Init PARAMS(( void )); GLOBAL void Client_Exit PARAMS(( void )); 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, const char *LogMsg, const char *FwdMsg, bool SendQuit )); GLOBAL CLIENT *Client_ThisServer PARAMS(( void )); GLOBAL CLIENT *Client_GetFromToken PARAMS(( CLIENT *Client, int Token )); GLOBAL bool Client_Announce PARAMS(( CLIENT *Client, CLIENT *Prefix, CLIENT *User )); GLOBAL CLIENT *Client_Search PARAMS(( const char *ID )); GLOBAL CLIENT *Client_SearchServer PARAMS(( const char *ID )); GLOBAL CLIENT *Client_First PARAMS(( void )); GLOBAL CLIENT *Client_Next PARAMS(( CLIENT *c )); GLOBAL int Client_Type PARAMS(( CLIENT *Client )); GLOBAL CONN_ID Client_Conn PARAMS(( CLIENT *Client )); GLOBAL char *Client_ID PARAMS(( CLIENT *Client )); GLOBAL char *Client_Mask PARAMS(( CLIENT *Client )); GLOBAL char *Client_MaskCloaked PARAMS(( CLIENT *Client )); GLOBAL char *Client_Info PARAMS(( CLIENT *Client )); GLOBAL char *Client_User PARAMS(( CLIENT *Client )); #ifdef PAM GLOBAL char *Client_OrigUser PARAMS(( CLIENT *Client )); #endif GLOBAL char *Client_Hostname PARAMS(( CLIENT *Client )); GLOBAL char *Client_HostnameCloaked PARAMS((CLIENT *Client)); GLOBAL char *Client_HostnameDisplayed PARAMS(( CLIENT *Client )); GLOBAL const char *Client_IPAText PARAMS(( CLIENT *Client )); GLOBAL char *Client_Modes PARAMS(( CLIENT *Client )); GLOBAL char *Client_Flags PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client )); GLOBAL int Client_Hops PARAMS(( CLIENT *Client )); GLOBAL int Client_Token PARAMS(( CLIENT *Client )); GLOBAL int Client_MyToken PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_TopServer PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_NextHop PARAMS(( CLIENT *Client )); GLOBAL char *Client_Away PARAMS(( CLIENT *Client )); GLOBAL char *Client_AccountName PARAMS((CLIENT *Client)); GLOBAL time_t Client_StartTime PARAMS(( CLIENT *Client )); GLOBAL bool Client_HasMode PARAMS(( CLIENT *Client, char Mode )); GLOBAL bool Client_HasFlag PARAMS(( CLIENT *Client, char Flag )); GLOBAL void Client_SetHostname PARAMS(( CLIENT *Client, const char *Hostname )); GLOBAL void Client_SetIPAText PARAMS(( CLIENT *Client, const char *IPAText )); 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_SetOrigUser PARAMS(( CLIENT *Client, const char *User )); GLOBAL void Client_SetInfo PARAMS(( CLIENT *Client, const char *Info )); 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_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, const char *Txt )); GLOBAL void Client_SetAccountName PARAMS((CLIENT *Client, const char *AccountName)); GLOBAL bool Client_ModeAdd PARAMS(( CLIENT *Client, char Mode )); GLOBAL bool Client_ModeDel PARAMS(( CLIENT *Client, char Mode )); GLOBAL bool Client_CheckNick PARAMS(( CLIENT *Client, char *Nick )); GLOBAL bool Client_CheckID PARAMS(( CLIENT *Client, char *ID )); GLOBAL long Client_UserCount PARAMS(( void )); GLOBAL long Client_ServiceCount PARAMS(( void )); GLOBAL long Client_ServerCount PARAMS(( void )); GLOBAL unsigned long Client_OperCount PARAMS(( void )); GLOBAL unsigned long Client_UnknownCount PARAMS(( void )); GLOBAL long Client_MyUserCount PARAMS(( void )); GLOBAL long Client_MyServiceCount PARAMS(( void )); GLOBAL unsigned long Client_MyServerCount PARAMS(( void )); GLOBAL long Client_MaxUserCount PARAMS(( void )); GLOBAL long Client_MyMaxUserCount PARAMS(( void )); GLOBAL bool Client_IsValidNick PARAMS(( const char *Nick )); GLOBAL WHOWAS *Client_GetWhowas PARAMS(( void )); GLOBAL int Client_GetLastWhowasIndex PARAMS(( void )); GLOBAL void Client_RegisterWhowas PARAMS(( CLIENT *Client )); GLOBAL const char *Client_TypeText PARAMS((CLIENT *Client)); GLOBAL void Client_Reject PARAMS((CLIENT *Client, const char *Reason, bool InformClient)); GLOBAL void Client_Introduce PARAMS((CLIENT *From, CLIENT *Client, int Type)); GLOBAL void Client_UpdateCloakedHostname PARAMS((CLIENT *Client, CLIENT *Originator, const char *hostname)); #ifdef DEBUG GLOBAL void Client_DebugDump PARAMS((void)); #endif #endif /* -eof- */ ngircd-21/src/ngircd/defines.h0000644000175000116100000001264412230312353013305 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __defines_h__ #define __defines_h__ /** * @file * Global constants ("#defines") used by the ngIRCd. */ /* Internal flags */ /** Flag: there is no connection. */ #define NONE -1 /** Flag: connection is (still) established. */ #define CONNECTED true /** Flag: connection isn't established (any more). */ #define DISCONNECTED false /** Tag for outbound server links. */ #define TOKEN_OUTBOUND -2 /* Generic buffer sizes */ /** Max. length of a line in the configuration file. */ #define LINE_LEN 1024 /** Max. length of a log message. */ #define MAX_LOG_MSG_LEN 256 /** Max. length of file name. */ #define FNAME_LEN 256 /** Max. length of fully qualified host names (e. g. "abc.domain.tld"). */ #define HOST_LEN 256 /** Max. length of random salt */ #define RANDOM_SALT_LEN 32 /* Size of structures */ /** Max. count of configurable servers. */ #define MAX_SERVERS 16 /** Max. number of WHOWAS list items that can be stored. */ #define MAX_WHOWAS 64 /** Size of default connection pool. */ #define CONNECTION_POOL 100 /* Hard-coded (default) options */ /** Delay after startup before outgoing connections are initiated in seconds. */ #define STARTUP_DELAY 1 /** Time to delay re-connect attempts in seconds. */ #define RECONNECT_DELAY 3 /** Configuration file name. */ #define CONFIG_FILE "/ngircd.conf" /** Directory containing optional configuration snippets. */ #define CONFIG_DIR "/ngircd.conf.d" /** Name of the MOTD file. */ #define MOTD_FILE "/ngircd.motd" /** Name of the help file. */ #define HELP_FILE "/Commands.txt" /** Default chroot() directory. */ #define CHROOT_DIR "" /** Default file for the process ID. */ #define PID_FILE "" /* Sizes of "IRC elements": nicks, users, ... */ /** Max. length of an IRC ID (incl. NULL); see RFC 2812 section 1.1 and 1.2.1. */ #define CLIENT_ID_LEN 64 /** Default nick length (including NULL), see. RFC 2812 section 1.2.1. */ #define CLIENT_NICK_LEN_DEFAULT 10 /** Maximum nickname length (including NULL). */ #define CLIENT_NICK_LEN 32 /** Max. password length (including NULL). */ #define CLIENT_PASS_LEN 65 /** Max. length of user name ("login"; incl. NULL), RFC 2812, section 1.2.1. */ #ifndef STRICT_RFC # define CLIENT_USER_LEN 20 #else # define CLIENT_USER_LEN 10 #endif /** Max. length of "real names" (including NULL). */ #define CLIENT_NAME_LEN 32 /** Max. host name length (including NULL). */ #define CLIENT_HOST_LEN 64 /** Max. mask lenght (including NULL). */ #define MASK_LEN (2 * CLIENT_HOST_LEN) /** Max. length of all client modes (including NULL). */ #define CLIENT_MODE_LEN 21 /** Max. length of server info texts (including NULL). */ #define CLIENT_INFO_LEN 64 /** Max. length of away messages (including NULL). */ #define CLIENT_AWAY_LEN 128 /** Max. length of client flags (including NULL). */ #define CLIENT_FLAGS_LEN 16 /** Max. length of a channel name (including NULL), see RFC 2812 section 1.3. */ #define CHANNEL_NAME_LEN 51 /** Max. length of channel modes (including NULL). */ #define CHANNEL_MODE_LEN 21 /** Max. IRC command length (including NULL), see. RFC 2812 section 3.2. */ #define COMMAND_LEN 513 /* Read and write buffer sizes */ /** Size of the read buffer of a connection in bytes. */ #define READBUFFER_LEN 2048 /** Size that triggers write buffer flushing if more space is needed. */ #define WRITEBUFFER_FLUSH_LEN 4096 /** Maximum size of the write buffer of a connection in bytes. */ #define WRITEBUFFER_MAX_LEN 32768 /** Maximum size of the write buffer of a server link connection in bytes. */ #define WRITEBUFFER_SLINK_LEN 65536 /* IRC/IRC+ protocol */ /** Implemented IRC protocol version, see RFC 2813 section 4.1.1. */ #define PROTOVER "0210" /** Protocol suffix, see RFC 2813 section 4.1.1. */ #define PROTOIRC "-IRC" /** Protocol suffix used by the IRC+ protocol, see . */ #define PROTOIRCPLUS "-IRC+" #ifdef IRCPLUS /** Standard IRC+ flags. */ # define IRCPLUSFLAGS "CHLMSX" #endif /** Supported user modes. */ #define USERMODES "abBcCioqrRswx" /** Supported channel modes. */ #define CHANMODES "abehiIklmMnoOPqQrRstvVz" /** Supported channel types. */ #define CHANTYPES "#&+" /** Away message for users connected to linked servers. */ #define DEFAULT_AWAY_MSG "Away" /** Default ID for "topic owner". */ #define DEFAULT_TOPIC_ID "-Server-" /** Prefix for NOTICEs from the server to users. Some servers use '*'. */ #define NOTICE_TXTPREFIX "" /** Suffix for oversized messages that have been shortened and cut off. */ #define CUT_TXTSUFFIX "[CUT]" /* Defaults and limits for IRC commands */ /** Max. number of elemets allowed in channel invite and ban lists. */ #define MAX_HNDL_CHANNEL_LISTS 50 /** Max. number of channel modes with arguments per MODE command. */ #define MAX_HNDL_MODES_ARG 5 /** Max. number of WHO replies. */ #define MAX_RPL_WHO 25 /** Max. number of WHOIS replies. */ #define MAX_RPL_WHOIS 10 /** Default count of WHOWAS command replies. */ #define DEF_RPL_WHOWAS 5 /** Max count of WHOWAS command replies. */ #define MAX_RPL_WHOWAS 25 #endif /* -eof- */ ngircd-21/src/ngircd/irc-login.h0000644000175000116100000000226112206130744013552 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __irc_login_h__ #define __irc_login_h__ /** * @file * Login and logout (header) */ GLOBAL bool IRC_PASS PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_NICK PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_USER PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_SERVICE PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_WEBIRC PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_PING PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_PONG PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_QUIT PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_QUIT_HTTP PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_SVSNICK PARAMS(( CLIENT *Client, REQUEST *Req )); #endif /* -eof- */ ngircd-21/src/ngircd/conn-zip.c0000644000175000116100000001707412202004071013414 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2007 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. */ #include "portab.h" /** * @file * Connection compression using ZLIB */ #define CONN_MODULE #ifdef ZLIB /* enable more zlib related debug messages: */ /* #define DEBUG_ZLIB */ #include "imp.h" #include #include #include #include "conn.h" #include "conn-func.h" #include "log.h" #include "array.h" #include "exp.h" #include "conn-zip.h" GLOBAL bool Zip_InitConn( CONN_ID Idx ) { /* initialize zlib compression on this link */ assert( Idx > NONE ); My_Connections[Idx].zip.in.avail_in = 0; My_Connections[Idx].zip.in.total_in = 0; My_Connections[Idx].zip.in.total_out = 0; My_Connections[Idx].zip.in.zalloc = NULL; My_Connections[Idx].zip.in.zfree = NULL; My_Connections[Idx].zip.in.data_type = Z_ASCII; if (inflateInit( &My_Connections[Idx].zip.in ) != Z_OK) { Log(LOG_ALERT, "Can't initialize compression on connection %d (zlib inflate)!", Idx); return false; } My_Connections[Idx].zip.out.total_in = 0; My_Connections[Idx].zip.out.total_in = 0; My_Connections[Idx].zip.out.zalloc = NULL; My_Connections[Idx].zip.out.zfree = NULL; My_Connections[Idx].zip.out.data_type = Z_ASCII; if (deflateInit( &My_Connections[Idx].zip.out, Z_DEFAULT_COMPRESSION ) != Z_OK) { Log(LOG_ALERT, "Can't initialize compression on connection %d (zlib deflate)!", Idx); return false; } My_Connections[Idx].zip.bytes_in = My_Connections[Idx].bytes_in; My_Connections[Idx].zip.bytes_out = My_Connections[Idx].bytes_out; Log(LOG_INFO, "Enabled link compression (zlib) on connection %d.", Idx); Conn_OPTION_ADD( &My_Connections[Idx], CONN_ZIP ); return true; } /* Zip_InitConn */ /** * Copy data to the compression buffer of a connection. We do collect * some data there until it's full so that we can achieve better * compression ratios. * If the (pre-)compression buffer is full, we try to flush it ("actually * compress some data") and to add the new (uncompressed) data afterwards. * This function closes the connection on error. * @param Idx Connection handle. * @param Data Pointer to the data. * @param Len Length of the data to add. * @return true on success, false otherwise. */ GLOBAL bool Zip_Buffer( CONN_ID Idx, const char *Data, size_t Len ) { size_t buflen; assert( Idx > NONE ); assert( Data != NULL ); assert( Len > 0 ); buflen = array_bytes(&My_Connections[Idx].zip.wbuf); if (buflen + Len >= WRITEBUFFER_SLINK_LEN) { /* compression buffer is full, flush */ if( ! Zip_Flush( Idx )) return false; } /* check again; if zip buf is still too large do not append data: * otherwise the zip wbuf would grow too large */ buflen = array_bytes(&My_Connections[Idx].zip.wbuf); if (buflen + Len >= WRITEBUFFER_SLINK_LEN) { Log(LOG_ALERT, "Zip Write buffer space exhausted: %lu bytes", buflen + Len); Conn_Close(Idx, "Zip Write buffer space exhausted", NULL, false); return false; } return array_catb(&My_Connections[Idx].zip.wbuf, Data, Len); } /* Zip_Buffer */ /** * Compress data in ZIP buffer and move result to the write buffer of * the connection. * This function closes the connection on error. * @param Idx Connection handle. * @return true on success, false otherwise. */ GLOBAL bool Zip_Flush( CONN_ID Idx ) { int result; unsigned char zipbuf[WRITEBUFFER_SLINK_LEN]; int zipbuf_used = 0; z_stream *out; out = &My_Connections[Idx].zip.out; out->avail_in = (uInt)array_bytes(&My_Connections[Idx].zip.wbuf); if (!out->avail_in) return true; /* nothing to do. */ out->next_in = array_start(&My_Connections[Idx].zip.wbuf); assert(out->next_in != NULL); out->next_out = zipbuf; out->avail_out = (uInt)sizeof zipbuf; #ifdef DEBUG_ZIP Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d", out->avail_in, out->avail_out); #endif result = deflate( out, Z_SYNC_FLUSH ); if(( result != Z_OK ) || ( out->avail_in > 0 )) { Log( LOG_ALERT, "Compression error: code %d!?", result ); Conn_Close( Idx, "Compression error!", NULL, false ); return false; } if (out->avail_out <= 0) { /* Not all data was compressed, because data became * bigger while compressing it. */ Log(LOG_ALERT, "Compression error: buffer overflow!?"); Conn_Close(Idx, "Compression error!", NULL, false); return false; } assert(out->avail_out <= WRITEBUFFER_SLINK_LEN); zipbuf_used = WRITEBUFFER_SLINK_LEN - out->avail_out; #ifdef DEBUG_ZIP Log(LOG_DEBUG, "zipbuf_used: %d", zipbuf_used); #endif if (!array_catb(&My_Connections[Idx].wbuf, (char *)zipbuf, (size_t) zipbuf_used)) { Log (LOG_ALERT, "Compression error: can't copy data!?"); Conn_Close(Idx, "Compression error!", NULL, false); return false; } My_Connections[Idx].bytes_out += zipbuf_used; My_Connections[Idx].zip.bytes_out += array_bytes(&My_Connections[Idx].zip.wbuf); array_trunc(&My_Connections[Idx].zip.wbuf); return true; } /* Zip_Flush */ /** * uncompress data and copy it to read buffer. * Returns true if data has been unpacked or no * compressed data is currently pending in the zread buffer. * This function closes the connection on error. * @param Idx Connection handle. * @return true on success, false otherwise. */ GLOBAL bool Unzip_Buffer( CONN_ID Idx ) { int result; unsigned char unzipbuf[READBUFFER_LEN]; int unzipbuf_used = 0; unsigned int z_rdatalen; unsigned int in_len; z_stream *in; assert( Idx > NONE ); z_rdatalen = (unsigned int)array_bytes(&My_Connections[Idx].zip.rbuf); if (z_rdatalen == 0) return true; in = &My_Connections[Idx].zip.in; in->next_in = array_start(&My_Connections[Idx].zip.rbuf); assert(in->next_in != NULL); in->avail_in = z_rdatalen; in->next_out = unzipbuf; in->avail_out = (uInt)sizeof unzipbuf; #ifdef DEBUG_ZIP Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d", in->avail_in, in->avail_out); #endif result = inflate( in, Z_SYNC_FLUSH ); if( result != Z_OK ) { Log(LOG_ALERT, "Decompression error: %s (code=%d, ni=%d, ai=%d, no=%d, ao=%d)!?", in->msg, result, in->next_in, in->avail_in, in->next_out, in->avail_out); Conn_Close(Idx, "Decompression error!", NULL, false); return false; } assert(z_rdatalen >= in->avail_in); in_len = z_rdatalen - in->avail_in; unzipbuf_used = READBUFFER_LEN - in->avail_out; #ifdef DEBUG_ZIP Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN, in->avail_out, unzipbuf_used); #endif assert(unzipbuf_used <= READBUFFER_LEN); if (!array_catb(&My_Connections[Idx].rbuf, (char*) unzipbuf, (size_t)unzipbuf_used)) { Log (LOG_ALERT, "Decompression error: can't copy data!?"); Conn_Close(Idx, "Decompression error!", NULL, false); return false; } if( in->avail_in > 0 ) { array_moveleft(&My_Connections[Idx].zip.rbuf, 1, in_len ); } else { array_trunc( &My_Connections[Idx].zip.rbuf ); My_Connections[Idx].zip.bytes_in += unzipbuf_used; } return true; } /* Unzip_Buffer */ /** * @param Idx Connection handle. * @return amount of sent (compressed) bytes */ GLOBAL long Zip_SendBytes( CONN_ID Idx ) { assert( Idx > NONE ); return My_Connections[Idx].zip.bytes_out; } /* Zip_SendBytes */ /** * @param Idx Connection handle. * @return amount of received (compressed) bytes */ GLOBAL long Zip_RecvBytes( CONN_ID Idx ) { assert( Idx > NONE ); return My_Connections[Idx].zip.bytes_in; } /* Zip_RecvBytes */ #endif /* -eof- */ ngircd-21/src/ngircd/irc-oper.c0000644000175000116100000002777512222633257013430 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * IRC operator commands */ #include "imp.h" #include #include #include #include #include #include "ngircd.h" #include "conn-func.h" #include "conf.h" #include "channel.h" #include "class.h" #include "parse.h" #include "irc.h" #include "irc-macros.h" #include "irc-write.h" #include "lists.h" #include "log.h" #include "match.h" #include "messages.h" #include "op.h" #include #include "irc-oper.h" /** * Handle invalid received OPER command. * Log OPER attempt and send error message to client. */ static bool Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg) { Log(LOG_WARNING, "Got invalid OPER from \"%s\": \"%s\" -- %s", Client_Mask(Client), errtoken, errmsg); return IRC_WriteErrClient(Client, ERR_PASSWDMISMATCH_MSG, Client_ID(Client)); } /* Bad_OperPass */ /** * Handler for the IRC "OPER" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_OPER( CLIENT *Client, REQUEST *Req ) { struct Conf_Oper *op; size_t len, i; assert( Client != NULL ); assert( Req != NULL ); len = array_length(&Conf_Opers, sizeof(*op)); op = array_start(&Conf_Opers); for (i = 0; i < len && strcmp(op[i].name, Req->argv[0]); i++) ; if (i >= len) return Bad_OperPass(Client, Req->argv[0], "not configured"); if (strcmp(op[i].pwd, Req->argv[1]) != 0) return Bad_OperPass(Client, op[i].name, "bad password"); if (op[i].mask && (!Match(op[i].mask, Client_Mask(Client)))) return Bad_OperPass(Client, op[i].mask, "hostmask check failed"); if (!Client_HasMode(Client, 'o')) { Client_ModeAdd(Client, 'o'); if (!IRC_WriteStrClient(Client, "MODE %s :+o", Client_ID(Client))) return DISCONNECTED; IRC_WriteStrServersPrefix(NULL, Client, "MODE %s :+o", Client_ID(Client)); } Log(LOG_NOTICE|LOG_snotice, "Got valid OPER for \"%s\" from \"%s\", user is an IRC operator now.", Req->argv[0], Client_Mask(Client)); return IRC_WriteStrClient(Client, RPL_YOUREOPER_MSG, Client_ID(Client)); } /* IRC_OPER */ /** * Handler for the IRC "DIE" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_DIE(CLIENT * Client, REQUEST * Req) { /* Shut down server */ CONN_ID c; CLIENT *cl; assert(Client != NULL); assert(Req != NULL); if (!Op_Check(Client, Req)) return Op_NoPrivileges(Client, Req); /* Is a message given? */ if (Req->argc > 0) { c = Conn_First(); while (c != NONE) { cl = Conn_GetClient(c); if (Client_Type(cl) == CLIENT_USER) IRC_WriteStrClient(cl, "NOTICE %s :%s", Client_ID(cl), Req->argv[0]); c = Conn_Next(c); } } Log(LOG_NOTICE | LOG_snotice, "Got DIE command from \"%s\" ...", Client_Mask(Client)); NGIRCd_SignalQuit = true; return CONNECTED; } /* IRC_DIE */ /** * Handler for the IRC "REHASH" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_REHASH( CLIENT *Client, REQUEST *Req ) { /* Reload configuration file */ assert( Client != NULL ); assert( Req != NULL ); if (!Op_Check(Client, Req)) return Op_NoPrivileges(Client, Req); Log(LOG_NOTICE|LOG_snotice, "Got REHASH command from \"%s\" ...", Client_Mask(Client)); IRC_WriteStrClient(Client, RPL_REHASHING_MSG, Client_ID(Client)); raise(SIGHUP); return CONNECTED; } /* IRC_REHASH */ /** * Handler for the IRC "RESTART" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_RESTART( CLIENT *Client, REQUEST *Req ) { /* Restart IRC server (fork a new process) */ assert( Client != NULL ); assert( Req != NULL ); if (!Op_Check(Client, Req)) return Op_NoPrivileges(Client, Req); Log(LOG_NOTICE|LOG_snotice, "Got RESTART command from \"%s\" ...", Client_Mask(Client)); NGIRCd_SignalRestart = true; return CONNECTED; } /* IRC_RESTART */ /** * Handler for the IRC "CONNECT" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_CONNECT(CLIENT * Client, REQUEST * Req) { CLIENT *from, *target; assert(Client != NULL); assert(Req != NULL); /* Bad number of parameters? */ if (Req->argc != 1 && Req->argc != 2 && Req->argc != 3 && Req->argc != 5 && Req->argc != 6) { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } /* Invalid port number? */ if ((Req->argc > 1) && atoi(Req->argv[1]) < 1) { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } if (Client_Type(Client) != CLIENT_SERVER && !Client_HasMode(Client, 'o')) return Op_NoPrivileges(Client, Req); from = Client; target = Client_ThisServer(); if (Req->argc == 3 || Req->argc == 6) { /* This CONNECT has a target parameter */ if (Client_Type(Client) == CLIENT_SERVER && Req->prefix) from = Client_Search(Req->prefix); if (! from) return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->prefix); target = (Req->argc == 3) ? Client_Search(Req->argv[2]) : Client_Search(Req->argv[5]); if (! target || Client_Type(target) != CLIENT_SERVER) return IRC_WriteErrClient(from, ERR_NOSUCHSERVER_MSG, Client_ID(from), Req->argv[0]); } if (target != Client_ThisServer()) { /* Forward CONNECT command ... */ if (Req->argc == 3) IRC_WriteStrClientPrefix(target, from, "CONNECT %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2]); else IRC_WriteStrClientPrefix(target, from, "CONNECT %s %s %s %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2], Req->argv[3], Req->argv[4], Req->argv[5]); return CONNECTED; } if (!Op_Check(from, Req)) return Op_NoPrivileges(Client, Req); switch (Req->argc) { case 1: if (!Conf_EnablePassiveServer(Req->argv[0])) return IRC_WriteErrClient(from, ERR_NOSUCHSERVER_MSG, Client_ID(from), Req->argv[0]); break; case 2: case 3: /* Connect configured server */ if (!Conf_EnableServer (Req->argv[0], (UINT16) atoi(Req->argv[1]))) return IRC_WriteErrClient(from, ERR_NOSUCHSERVER_MSG, Client_ID(from), Req->argv[0]); break; default: /* Add server */ if (!Conf_AddServer (Req->argv[0], (UINT16) atoi(Req->argv[1]), Req->argv[2], Req->argv[3], Req->argv[4])) return IRC_WriteErrClient(from, ERR_NOSUCHSERVER_MSG, Client_ID(from), Req->argv[0]); } Log(LOG_NOTICE | LOG_snotice, "Got CONNECT command from \"%s\" for \"%s\".", Client_Mask(from), Req->argv[0]); IRC_SendWallops(Client_ThisServer(), Client_ThisServer(), "Received CONNECT %s from %s", Req->argv[0], Client_ID(from)); return CONNECTED; } /* IRC_CONNECT */ /** * Handler for the IRC "DISCONNECT" command. * * This command is not specified in the IRC RFCs, it is an extension * of ngIRCd: it shuts down and disables a configured server connection. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_DISCONNECT(CLIENT * Client, REQUEST * Req) { CONN_ID my_conn; assert(Client != NULL); assert(Req != NULL); if (!Op_Check(Client, Req)) return Op_NoPrivileges(Client, Req); IRC_SendWallops(Client_ThisServer(), Client_ThisServer(), "Received DISCONNECT %s from %s", Req->argv[0], Client_ID(Client)); Log(LOG_NOTICE | LOG_snotice, "Got DISCONNECT command from \"%s\" for \"%s\".", Client_Mask(Client), Req->argv[0]); /* Save ID of this connection */ my_conn = Client_Conn(Client); /* Disconnect configured server */ if (!Conf_DisableServer(Req->argv[0])) return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG, Client_ID(Client), Req->argv[0]); /* Are we still connected or were we killed, too? */ if (Conn_GetClient(my_conn)) return CONNECTED; else return DISCONNECTED; } /* IRC_DISCONNECT */ /** * Handler for the IRC "WALLOPS" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_WALLOPS( CLIENT *Client, REQUEST *Req ) { CLIENT *from; assert( Client != NULL ); assert( Req != NULL ); switch (Client_Type(Client)) { case CLIENT_USER: if (!Op_Check(Client, Req)) return Op_NoPrivileges(Client, Req); from = Client; break; case CLIENT_SERVER: from = Client_Search(Req->prefix); break; default: return CONNECTED; } if (!from) return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->prefix); IRC_SendWallops(Client, from, "%s", Req->argv[0]); return CONNECTED; } /* IRC_WALLOPS */ /** * Handle LINE commands (GLINE, KLINE). * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_xLINE(CLIENT *Client, REQUEST *Req) { CLIENT *from, *c, *c_next; char reason[COMMAND_LEN], class_c; struct list_head *list; int class; assert(Client != NULL); assert(Req != NULL); /* Bad number of parameters? */ if (Req->argc != 1 && Req->argc != 3) { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } from = Op_Check(Client, Req); if (!from) return Op_NoPrivileges(Client, Req); switch(Req->command[0]) { case 'g': case 'G': class = CLASS_GLINE; class_c = 'G'; break; case 'k': case 'K': class = CLASS_KLINE; class_c = 'K'; break; default: Log(LOG_CRIT, "IRC_xLINE() called for unknown line: %c!? Ignored.", Req->command[0]); return CONNECTED; } if (Req->argc == 1) { /* Delete mask from list */ Class_DeleteMask(class, Req->argv[0]); Log(LOG_NOTICE|LOG_snotice, "\"%s\" deleted \"%s\" from %c-Line list.", Client_Mask(from), Req->argv[0], class_c); if (class == CLASS_GLINE) { /* Inform other servers */ IRC_WriteStrServersPrefix(Client, from, "%s %s", Req->command, Req->argv[0]); } } else { /* Add new mask to list */ if (Class_AddMask(class, Req->argv[0], time(NULL) + atol(Req->argv[1]), Req->argv[2])) { Log(LOG_NOTICE|LOG_snotice, "\"%s\" added \"%s\" to %c-Line list: \"%s\" (%ld seconds).", Client_Mask(from), Req->argv[0], class_c, Req->argv[2], atol(Req->argv[1])); if (class == CLASS_GLINE) { /* Inform other servers */ IRC_WriteStrServersPrefix(Client, from, "%s %s %s :%s", Req->command, Req->argv[0], Req->argv[1], Req->argv[2]); } /* Check currently connected clients */ snprintf(reason, sizeof(reason), "%c-Line by \"%s\": \"%s\"", class_c, Client_ID(from), Req->argv[2]); list = Class_GetList(class); c = Client_First(); while (c) { c_next = Client_Next(c); if ((class == CLASS_GLINE || Client_Conn(c) > NONE) && Lists_Check(list, c)) IRC_KillClient(Client, NULL, Client_ID(c), reason); c = c_next; } } } return CONNECTED; } /* -eof- */ ngircd-21/src/ngircd/proc.h0000644000175000116100000000252711624676660012656 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __proc_h__ #define __proc_h__ /** * @file * Process management (header) */ /** Process status. This struct must not be accessed directly! */ typedef struct _Proc_Stat { pid_t pid; /**< PID of the child process or 0 if none */ int pipe_fd; /**< Pipe file descriptor or -1 if none */ } PROC_STAT; /** Return true if sub-process is still running */ #define Proc_InProgress(x) ((x)->pid != 0) /** Return file descriptor of pipe to sub-process (or -1 if none open) */ #define Proc_GetPipeFd(x) ((x)->pipe_fd) GLOBAL void Proc_InitStruct PARAMS((PROC_STAT *proc)); GLOBAL pid_t Proc_Fork PARAMS((PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout)); GLOBAL void Proc_GenericSignalHandler PARAMS((int Signal)); GLOBAL size_t Proc_Read PARAMS((PROC_STAT *proc, void *buffer, size_t buflen)); GLOBAL void Proc_Close PARAMS((PROC_STAT *proc)); #endif /* -eof- */ ngircd-21/src/ngircd/client-cap.h0000644000175000116100000000176511746622422013725 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __client_cap_h__ #define __client_cap_h__ /** * @file * Functions to deal with IRC Capabilities (header) */ #define CLIENT_CAP_PENDING 1 /* Capability negotiation pending */ #define CLIENT_CAP_SUPPORTED 2 /* Client supports IRC capabilities */ #define CLIENT_CAP_MULTI_PREFIX 4 /* multi-prefix */ GLOBAL int Client_Cap PARAMS((CLIENT *Client)); GLOBAL void Client_CapSet PARAMS((CLIENT *Client, int Cap)); GLOBAL void Client_CapAdd PARAMS((CLIENT *Client, int Cap)); GLOBAL void Client_CapDel PARAMS((CLIENT *Client, int Cap)); #endif ngircd-21/src/ngircd/pam.c0000644000175000116100000000673312206130744012447 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2010 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. */ #include "portab.h" #ifdef PAM /** * @file * PAM User Authentication */ #include "imp.h" #include #include "defines.h" #include "log.h" #include "conn.h" #include "client.h" #include #include #ifdef HAVE_SECURITY_PAM_APPL_H #include #endif #ifdef HAVE_PAM_PAM_APPL_H #include #endif #include "exp.h" #include "pam.h" static char *password; /** * PAM "conversation function". * This is a callback function used by the PAM library to get the password. * Please see the PAM documentation for details :-) */ static int password_conversation(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { LogDebug("PAM: conv(%d, %d, '%s', '%s')", num_msg, msg[0]->msg_style, msg[0]->msg, appdata_ptr); /* Can we deal with this request? */ if (num_msg != 1 || msg[0]->msg_style != PAM_PROMPT_ECHO_OFF) { Log(LOG_ERR, "PAM: Unexpected PAM conversation '%d:%s'!", msg[0]->msg_style, msg[0]->msg); return PAM_CONV_ERR; } if (!appdata_ptr) { /* Sometimes appdata_ptr gets lost!? */ appdata_ptr = password; } /* Duplicate password ("application data") for the PAM library */ *resp = calloc(num_msg, sizeof(struct pam_response)); if (!*resp) { Log(LOG_ERR, "PAM: Out of memory!"); return PAM_CONV_ERR; } (*resp)[0].resp = strdup((char *)appdata_ptr); (*resp)[0].resp_retcode = 0; return ((*resp)[0].resp ? PAM_SUCCESS : PAM_CONV_ERR); } /** * PAM "conversation" structure. */ static struct pam_conv conv = { &password_conversation, NULL }; /** * Authenticate a connectiong client using PAM. * @param Client The client to authenticate. * @return true when authentication succeeded, false otherwise. */ GLOBAL bool PAM_Authenticate(CLIENT *Client) { pam_handle_t *pam; int retval = PAM_SUCCESS; LogDebug("PAM: Authenticate \"%s\" (%s) ...", Client_OrigUser(Client), Client_Mask(Client)); /* Set supplied client password */ if (password) free(password); password = strdup(Conn_Password(Client_Conn(Client))); conv.appdata_ptr = Conn_Password(Client_Conn(Client)); /* Initialize PAM */ retval = pam_start("ngircd", Client_OrigUser(Client), &conv, &pam); if (retval != PAM_SUCCESS) { Log(LOG_ERR, "PAM: Failed to create authenticator! (%d)", retval); return false; } pam_set_item(pam, PAM_RUSER, Client_User(Client)); pam_set_item(pam, PAM_RHOST, Client_Hostname(Client)); #if defined(HAVE_PAM_FAIL_DELAY) && !defined(NO_PAM_FAIL_DELAY) pam_fail_delay(pam, 0); #endif /* PAM authentication ... */ retval = pam_authenticate(pam, 0); /* Success? */ if (retval == PAM_SUCCESS) Log(LOG_INFO, "PAM: Authenticated \"%s\" (%s).", Client_OrigUser(Client), Client_Mask(Client)); else Log(LOG_ERR, "PAM: Error on \"%s\" (%s): %s", Client_OrigUser(Client), Client_Mask(Client), pam_strerror(pam, retval)); /* Free PAM structures */ if (pam_end(pam, retval) != PAM_SUCCESS) Log(LOG_ERR, "PAM: Failed to release authenticator!"); return (retval == PAM_SUCCESS); } #endif /* PAM */ /* -eof- */ ngircd-21/src/ngircd/irc-encoding.c0000644000175000116100000000275012212712537014231 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * IRC encoding commands */ #include "imp.h" #include #include #include "conn-func.h" #include "channel.h" #include "conn-encoding.h" #include "irc-write.h" #include "messages.h" #include "parse.h" #include "tool.h" #include "exp.h" #include "irc-encoding.h" #ifdef ICONV /** * Handler for the IRC+ "CHARCONV" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @returns CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_CHARCONV(CLIENT *Client, REQUEST *Req) { char encoding[20]; assert (Client != NULL); assert (Req != NULL); strlcpy(encoding, Req->argv[0], sizeof(encoding)); ngt_UpperStr(encoding); if (!Conn_SetEncoding(Client_Conn(Client), encoding)) return IRC_WriteErrClient(Client, ERR_IP_CHARCONV_MSG, Client_ID(Client), encoding); return IRC_WriteStrClient(Client, RPL_IP_CHARCONV_MSG, Client_ID(Client), encoding); } /* IRC_CHARCONV */ #endif /* -eof- */ ngircd-21/src/ngircd/irc-server.h0000644000175000116100000000147211526006312013750 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #ifndef __irc_server_h__ #define __irc_server_h__ /** * @file * IRC commands for server links (header) */ GLOBAL bool IRC_SERVER PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_NJOIN PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_SQUIT PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_ENDOFMOTD_Server PARAMS((CLIENT *Client)); #endif /* -eof- */ ngircd-21/src/ngircd/irc-login.c0000644000175000116100000006252012230312353013544 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * Login and logout */ #include "imp.h" #include #include #include #include #include #include "conn-func.h" #include "class.h" #include "conf.h" #include "channel.h" #include "log.h" #include "login.h" #include "messages.h" #include "parse.h" #include "irc.h" #include "irc-info.h" #include "irc-macros.h" #include "irc-write.h" #include "exp.h" #include "irc-login.h" static void Change_Nick PARAMS((CLIENT * Origin, CLIENT * Target, char *NewNick, bool InformClient)); /** * Handler for the IRC "PASS" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_PASS( CLIENT *Client, REQUEST *Req ) { char *type, *orig_flags; int protohigh, protolow; assert( Client != NULL ); assert( Req != NULL ); /* Return an error if this is not a local client */ if (Client_Conn(Client) <= NONE) return IRC_WriteErrClient(Client, ERR_UNKNOWNCOMMAND_MSG, Client_ID(Client), Req->command); if (Client_Type(Client) == CLIENT_UNKNOWN && Req->argc == 1) { /* Not yet registered "unknown" connection, PASS with one * argument: either a regular client, service, or server * using the old RFC 1459 section 4.1.1 syntax. */ LogDebug("Connection %d: got PASS command (RFC 1459) ...", Client_Conn(Client)); } else if ((Client_Type(Client) == CLIENT_UNKNOWN || Client_Type(Client) == CLIENT_UNKNOWNSERVER) && (Req->argc == 3 || Req->argc == 4)) { /* Not yet registered "unknown" connection or outgoing server * link, PASS with three or four argument: server using the * RFC 2813 section 4.1.1 syntax. */ LogDebug("Connection %d: got PASS command (RFC 2813, new server link) ...", Client_Conn(Client)); } else if (Client_Type(Client) == CLIENT_UNKNOWN || Client_Type(Client) == CLIENT_UNKNOWNSERVER) { /* Unregistered connection, but wrong number of arguments: */ IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } else { /* Registered connection, PASS command is not allowed! */ return IRC_WriteErrClient(Client, ERR_ALREADYREGISTRED_MSG, Client_ID(Client)); } Conn_SetPassword(Client_Conn(Client), Req->argv[0]); /* Protocol version */ if (Req->argc >= 2 && strlen(Req->argv[1]) >= 4) { int c2, c4; c2 = Req->argv[1][2]; c4 = Req->argv[1][4]; Req->argv[1][4] = '\0'; protolow = atoi(&Req->argv[1][2]); Req->argv[1][2] = '\0'; protohigh = atoi(Req->argv[1]); Req->argv[1][2] = c2; Req->argv[1][4] = c4; Client_SetType(Client, CLIENT_GOTPASS_2813); } else { protohigh = protolow = 0; Client_SetType(Client, CLIENT_GOTPASS); } /* Protocol type, see doc/Protocol.txt */ if (Req->argc >= 2 && strlen(Req->argv[1]) > 4) type = &Req->argv[1][4]; else type = NULL; /* Protocol flags/options */ if (Req->argc >= 4) orig_flags = Req->argv[3]; else orig_flags = ""; /* Implementation, version and IRC+ flags */ if (Req->argc >= 3) { char *impl, *ptr, *serverver, *flags; impl = Req->argv[2]; ptr = strchr(impl, '|'); if (ptr) *ptr = '\0'; if (type && strcmp(type, PROTOIRCPLUS) == 0) { /* The peer seems to be a server which supports the * IRC+ protocol (see doc/Protocol.txt). */ serverver = ptr ? ptr + 1 : "?"; flags = strchr(ptr ? serverver : impl, ':'); if (flags) { *flags = '\0'; flags++; } else flags = ""; Log(LOG_INFO, "Peer on connection %d announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").", Client_Conn(Client), impl, serverver, protohigh, protolow, flags); } else { /* The peer seems to be a server supporting the * "original" IRC protocol (RFC 2813). */ if (strchr(orig_flags, 'Z')) flags = "Z"; else flags = ""; Log(LOG_INFO, "Peer on connection %d announces itself as \"%s\" using protocol %d.%d (flags: \"%s\").", Client_Conn(Client), impl, protohigh, protolow, flags); } Client_SetFlags(Client, flags); } return CONNECTED; } /* IRC_PASS */ /** * Handler for the IRC "NICK" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_NICK( CLIENT *Client, REQUEST *Req ) { CLIENT *intr_c, *target, *c; char *nick, *user, *hostname, *modes, *info; int token, hops; assert( Client != NULL ); assert( Req != NULL ); /* Some IRC clients, for example BitchX, send the NICK and USER * commands in the wrong order ... */ if(Client_Type(Client) == CLIENT_UNKNOWN || Client_Type(Client) == CLIENT_GOTPASS || Client_Type(Client) == CLIENT_GOTNICK #ifndef STRICT_RFC || Client_Type(Client) == CLIENT_GOTUSER #endif || Client_Type(Client) == CLIENT_USER || Client_Type(Client) == CLIENT_SERVICE || (Client_Type(Client) == CLIENT_SERVER && Req->argc == 1)) { /* User registration or change of nickname */ _IRC_ARGC_EQ_OR_RETURN_(Client, Req, 1) /* Search "target" client */ if (Client_Type(Client) == CLIENT_SERVER) { target = Client_Search(Req->prefix); if (!target) return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->argv[0]); } else { /* Is this a restricted client? */ if (Client_HasMode(Client, 'r')) return IRC_WriteErrClient(Client, ERR_RESTRICTED_MSG, Client_ID(Client)); target = Client; } #ifndef STRICT_RFC /* If the clients tries to change to its own nickname we won't * do anything. This is how the original ircd behaves and some * clients (for example Snak) expect it to be like this. * But I doubt that this is "really the right thing" ... */ if (strcmp(Client_ID(target), Req->argv[0]) == 0) return CONNECTED; #endif /* Check that the new nickname is available. Special case: * the client only changes from/to upper to lower case. */ if (strcasecmp(Client_ID(target), Req->argv[0]) != 0) { if (!Client_CheckNick(target, Req->argv[0])) return CONNECTED; } if (Client_Type(target) != CLIENT_USER && Client_Type(target) != CLIENT_SERVICE && Client_Type(target) != CLIENT_SERVER) { /* New client */ LogDebug("Connection %d: got valid NICK command ...", Client_Conn( Client )); /* Register new nickname of this client */ Client_SetID( target, Req->argv[0] ); #ifndef STRICT_RFC if (Conf_AuthPing) { #ifdef HAVE_ARC4RANDOM Conn_SetAuthPing(Client_Conn(Client), arc4random()); #else Conn_SetAuthPing(Client_Conn(Client), rand()); #endif IRC_WriteStrClient(Client, "PING :%ld", Conn_GetAuthPing(Client_Conn(Client))); LogDebug("Connection %d: sent AUTH PING %ld ...", Client_Conn(Client), Conn_GetAuthPing(Client_Conn(Client))); } #endif /* If we received a valid USER command already then * register the new client! */ if( Client_Type( Client ) == CLIENT_GOTUSER ) return Login_User( Client ); else Client_SetType( Client, CLIENT_GOTNICK ); } else { /* Nickname change */ Change_Nick(Client, target, Req->argv[0], Client_Type(Client) == CLIENT_USER ? true : false); IRC_SetPenalty(target, 2); } return CONNECTED; } else if(Client_Type(Client) == CLIENT_SERVER || Client_Type(Client) == CLIENT_SERVICE) { /* Server or service introduces new client */ /* Bad number of parameters? */ if (Req->argc != 2 && Req->argc != 7) { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } if (Req->argc >= 7) { /* RFC 2813 compatible syntax */ nick = Req->argv[0]; hops = atoi(Req->argv[1]); user = Req->argv[2]; hostname = Req->argv[3]; token = atoi(Req->argv[4]); modes = Req->argv[5] + 1; info = Req->argv[6]; } else { /* RFC 1459 compatible syntax */ nick = Req->argv[0]; hops = 1; user = Req->argv[0]; hostname = Client_ID(Client); token = atoi(Req->argv[1]); modes = ""; info = Req->argv[0]; } c = Client_Search(nick); if(c) { /* * the new nick is already present on this server: * the new and the old one have to be disconnected now. */ Log(LOG_ERR, "Server %s introduces already registered nick \"%s\"!", Client_ID(Client), Req->argv[0]); return IRC_KillClient(Client, NULL, Req->argv[0], "Nick collision"); } /* Find the Server this client is connected to */ intr_c = Client_GetFromToken(Client, token); if (!intr_c) { Log(LOG_ERR, "Server %s introduces nick \"%s\" on unknown server!?", Client_ID(Client), Req->argv[0]); return IRC_KillClient(Client, NULL, Req->argv[0], "Unknown server"); } c = Client_NewRemoteUser(intr_c, nick, hops, user, hostname, token, modes, info, true); if (!c) { /* Out of memory, we need to disconnect client to keep * network state consistent! */ Log(LOG_ALERT, "Can't create client structure! (on connection %d)", Client_Conn(Client)); return IRC_KillClient(Client, NULL, Req->argv[0], "Server error"); } /* RFC 2813: client is now fully registered, inform all the * other servers about the new user. * RFC 1459: announce the new client only after receiving the * USER command, first we need more information! */ if (Req->argc < 7) { LogDebug("Client \"%s\" is being registered (RFC 1459) ...", Client_Mask(c)); Client_SetType(c, CLIENT_GOTNICK); } else Client_Introduce(Client, c, CLIENT_USER); return CONNECTED; } else return IRC_WriteErrClient(Client, ERR_ALREADYREGISTRED_MSG, Client_ID(Client)); } /* IRC_NICK */ /** * Handler for the IRC "SVSNICK" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_SVSNICK(CLIENT *Client, REQUEST *Req) { CLIENT *from, *target; assert(Client != NULL); assert(Req != NULL); /* Search the originator */ from = Client_Search(Req->prefix); if (!from) from = Client; /* Search the target */ target = Client_Search(Req->argv[0]); if (!target || Client_Type(target) != CLIENT_USER) { return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->argv[0]); } if (Client_Conn(target) <= NONE) { /* We have to forward the message to the server handling * this user; this is required to make sure all servers * in the network do follow the nick name change! */ return IRC_WriteStrClientPrefix(Client_NextHop(target), from, "SVSNICK %s %s", Req->argv[0], Req->argv[1]); } /* Make sure that the new nickname is valid */ if (!Client_CheckNick(from, Req->argv[1])) return CONNECTED; Change_Nick(from, target, Req->argv[1], true); return CONNECTED; } /** * Handler for the IRC "USER" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_USER(CLIENT * Client, REQUEST * Req) { CLIENT *c; char *ptr; assert(Client != NULL); assert(Req != NULL); if (Client_Type(Client) == CLIENT_GOTNICK || #ifndef STRICT_RFC Client_Type(Client) == CLIENT_UNKNOWN || #endif Client_Type(Client) == CLIENT_GOTPASS) { /* New connection */ _IRC_ARGC_EQ_OR_RETURN_(Client, Req, 4) /* User name: only alphanumeric characters and limited punctuation is allowed.*/ ptr = Req->argv[0]; while (*ptr) { if (!isalnum((int)*ptr) && *ptr != '+' && *ptr != '-' && *ptr != '@' && *ptr != '.' && *ptr != '_') { Conn_Close(Client_Conn(Client), NULL, "Invalid user name", true); return DISCONNECTED; } ptr++; } /* Save the received username for authentication, and use * it up to the first '@' as default user name (like ircd2.11, * bahamut, ircd-seven, ...), prefixed with '~', if needed: */ Client_SetOrigUser(Client, Req->argv[0]); ptr = strchr(Req->argv[0], '@'); if (ptr) *ptr = '\0'; #ifdef IDENTAUTH ptr = Client_User(Client); if (!ptr || !*ptr || *ptr == '~') Client_SetUser(Client, Req->argv[0], false); #else Client_SetUser(Client, Req->argv[0], false); #endif /* "Real name" or user info text: Don't set it to the empty * string, the original ircd can't deal with such "real names" * (e. g. "USER user * * :") ... */ if (*Req->argv[3]) Client_SetInfo(Client, Req->argv[3]); else Client_SetInfo(Client, "-"); LogDebug("Connection %d: got valid USER command ...", Client_Conn(Client)); if (Client_Type(Client) == CLIENT_GOTNICK) return Login_User(Client); else Client_SetType(Client, CLIENT_GOTUSER); return CONNECTED; } else if (Client_Type(Client) == CLIENT_SERVER || Client_Type(Client) == CLIENT_SERVICE) { /* Server/service updating an user */ _IRC_ARGC_EQ_OR_RETURN_(Client, Req, 4) c = Client_Search(Req->prefix); if (!c) return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->prefix); Client_SetUser(c, Req->argv[0], true); Client_SetOrigUser(c, Req->argv[0]); Client_SetHostname(c, Req->argv[1]); Client_SetInfo(c, Req->argv[3]); LogDebug("Connection %d: got valid USER command for \"%s\".", Client_Conn(Client), Client_Mask(c)); /* RFC 1459 style user registration? * Introduce client to network: */ if (Client_Type(c) == CLIENT_GOTNICK) Client_Introduce(Client, c, CLIENT_USER); return CONNECTED; } else if (Client_Type(Client) == CLIENT_USER) { /* Already registered connection */ return IRC_WriteErrClient(Client, ERR_ALREADYREGISTRED_MSG, Client_ID(Client)); } else { /* Unexpected/invalid connection state? */ return IRC_WriteErrClient(Client, ERR_NOTREGISTERED_MSG, Client_ID(Client)); } } /* IRC_USER */ /** * Handler for the IRC "SERVICE" command. * * At the moment ngIRCd doesn't support directly linked services, so this * function returns ERR_ERRONEUSNICKNAME when the SERVICE command has not been * received from a peer server. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_SERVICE(CLIENT *Client, REQUEST *Req) { CLIENT *c, *intr_c; char *nick, *user, *host, *info, *modes, *ptr; int token, hops; assert(Client != NULL); assert(Req != NULL); if (Client_Type(Client) != CLIENT_GOTPASS && Client_Type(Client) != CLIENT_SERVER) return IRC_WriteErrClient(Client, ERR_ALREADYREGISTRED_MSG, Client_ID(Client)); if (Client_Type(Client) != CLIENT_SERVER) return IRC_WriteErrClient(Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID(Client), Req->argv[0]); nick = Req->argv[0]; user = NULL; host = NULL; token = atoi(Req->argv[1]); hops = atoi(Req->argv[4]); info = Req->argv[5]; /* Validate service name ("nickname") */ c = Client_Search(nick); if(c) { /* Nickname collision: disconnect (KILL) both clients! */ Log(LOG_ERR, "Server %s introduces already registered service \"%s\"!", Client_ID(Client), nick); return IRC_KillClient(Client, NULL, nick, "Nick collision"); } /* Get the server to which the service is connected */ intr_c = Client_GetFromToken(Client, token); if (! intr_c) { Log(LOG_ERR, "Server %s introduces service \"%s\" on unknown server!?", Client_ID(Client), nick); return IRC_KillClient(Client, NULL, nick, "Unknown server"); } /* Get user and host name */ ptr = strchr(nick, '@'); if (ptr) { *ptr = '\0'; host = ++ptr; } if (!host) host = Client_Hostname(intr_c); ptr = strchr(nick, '!'); if (ptr) { *ptr = '\0'; user = ++ptr; } if (!user) user = nick; /* According to RFC 2812/2813 parameter 4 "is currently reserved * for future usage"; but we use it to transfer the modes and check * that the first character is a '+' sign and ignore it otherwise. */ modes = (Req->argv[3][0] == '+') ? ++Req->argv[3] : ""; c = Client_NewRemoteUser(intr_c, nick, hops, user, host, token, modes, info, true); if (! c) { /* Couldn't create client structure, so KILL the service to * keep network status consistent ... */ Log(LOG_ALERT, "Can't create client structure! (on connection %d)", Client_Conn(Client)); return IRC_KillClient(Client, NULL, nick, "Server error"); } Client_Introduce(Client, c, CLIENT_SERVICE); return CONNECTED; } /* IRC_SERVICE */ /** * Handler for the IRC "WEBIRC" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_WEBIRC(CLIENT *Client, REQUEST *Req) { if (!Conf_WebircPwd[0] || strcmp(Req->argv[0], Conf_WebircPwd) != 0) return IRC_WriteErrClient(Client, ERR_PASSWDMISMATCH_MSG, Client_ID(Client)); LogDebug("Connection %d: got valid WEBIRC command: user=%s, host=%s, ip=%s", Client_Conn(Client), Req->argv[1], Req->argv[2], Req->argv[3]); Client_SetUser(Client, Req->argv[1], true); Client_SetOrigUser(Client, Req->argv[1]); Client_SetHostname(Client, Req->argv[2]); Client_SetIPAText(Client, Req->argv[3]); return CONNECTED; } /* IRC_WEBIRC */ /** * Handler for the IRC "QUIT" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_QUIT( CLIENT *Client, REQUEST *Req ) { CLIENT *target; char quitmsg[COMMAND_LEN]; assert(Client != NULL); assert(Req != NULL); if (Req->argc == 1) strlcpy(quitmsg, Req->argv[0], sizeof quitmsg); if (Client_Type(Client) == CLIENT_SERVER) { /* Server */ target = Client_Search(Req->prefix); if (!target) { Log(LOG_WARNING, "Got QUIT from %s for unknown client!?", Client_ID(Client)); return CONNECTED; } if (target != Client) { Client_Destroy(target, "Got QUIT command", Req->argc == 1 ? quitmsg : NULL, true); return CONNECTED; } else { Conn_Close(Client_Conn(Client), "Got QUIT command", Req->argc == 1 ? quitmsg : NULL, true); return DISCONNECTED; } } else { if (Req->argc == 1 && quitmsg[0] != '\"') { /* " " to avoid confusion */ strlcpy(quitmsg, "\"", sizeof quitmsg); strlcat(quitmsg, Req->argv[0], sizeof quitmsg-1); strlcat(quitmsg, "\"", sizeof quitmsg ); } /* User, Service, or not yet registered */ Conn_Close(Client_Conn(Client), "Got QUIT command", Req->argc == 1 ? quitmsg : NULL, true); return DISCONNECTED; } } /* IRC_QUIT */ #ifndef STRICT_RFC /** * Handler for HTTP command, e.g. GET and POST * * We handle these commands here to avoid the quite long timeout when * some user tries to access this IRC daemon using an web browser ... * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_QUIT_HTTP( CLIENT *Client, REQUEST *Req ) { Req->argc = 1; Req->argv[0] = "Oops, HTTP request received? This is IRC!"; return IRC_QUIT(Client, Req); } /* IRC_QUIT_HTTP */ #endif /** * Handler for the IRC "PING" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_PING(CLIENT *Client, REQUEST *Req) { CLIENT *target, *from; assert(Client != NULL); assert(Req != NULL); if (Req->argc < 1) return IRC_WriteErrClient(Client, ERR_NOORIGIN_MSG, Client_ID(Client)); #ifdef STRICT_RFC /* Don't ignore additional arguments when in "strict" mode */ _IRC_ARGC_LE_OR_RETURN_(Client, Req, 2) #endif if (Req->argc > 1) { /* A target has been specified ... */ target = Client_Search(Req->argv[1]); if (!target || Client_Type(target) != CLIENT_SERVER) return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG, Client_ID(Client), Req->argv[1]); if (target != Client_ThisServer()) { /* Ok, we have to forward the PING */ if (Client_Type(Client) == CLIENT_SERVER) from = Client_Search(Req->prefix); else from = Client; if (!from) return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG, Client_ID(Client), Req->prefix); return IRC_WriteStrClientPrefix(target, from, "PING %s :%s", Req->argv[0], Req->argv[1] ); } } if (Client_Type(Client) == CLIENT_SERVER) { if (Req->prefix) from = Client_Search(Req->prefix); else from = Client; } else from = Client_ThisServer(); if (!from) return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG, Client_ID(Client), Req->prefix); Log(LOG_DEBUG, "Connection %d: got PING, sending PONG ...", Client_Conn(Client)); #ifdef STRICT_RFC return IRC_WriteStrClient(Client, "PONG %s :%s", Client_ID(from), Client_ID(Client)); #else /* Some clients depend on the argument being returned in the PONG * reply (not mentioned in any RFC, though) */ return IRC_WriteStrClient(Client, "PONG %s :%s", Client_ID(from), Req->argv[0]); #endif } /* IRC_PING */ /** * Handler for the IRC "PONG" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_PONG(CLIENT *Client, REQUEST *Req) { CLIENT *target, *from; CONN_ID conn; #ifndef STRICT_RFC long auth_ping; #endif char *s; assert(Client != NULL); assert(Req != NULL); /* Wrong number of arguments? */ if (Req->argc < 1) { if (Client_Type(Client) == CLIENT_USER) return IRC_WriteErrClient(Client, ERR_NOORIGIN_MSG, Client_ID(Client)); else return CONNECTED; } if (Client_Type(Client) == CLIENT_USER) { _IRC_ARGC_LE_OR_RETURN_(Client, Req, 2) } /* Forward? */ if (Req->argc == 2 && Client_Type(Client) == CLIENT_SERVER) { target = Client_Search(Req->argv[0]); if (!target) return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG, Client_ID(Client), Req->argv[0]); from = Client_Search(Req->prefix); if (target != Client_ThisServer() && target != from) { /* Ok, we have to forward the message. */ if (!from) return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG, Client_ID(Client), Req->prefix); if (Client_Type(Client_NextHop(target)) != CLIENT_SERVER) s = Client_ID(from); else s = Req->argv[0]; return IRC_WriteStrClientPrefix(target, from, "PONG %s :%s", s, Req->argv[1]); } } /* The connection timestamp has already been updated when the data has * been read from so socket, so we don't need to update it here. */ conn = Client_Conn(Client); #ifndef STRICT_RFC /* Check authentication PING-PONG ... */ auth_ping = Conn_GetAuthPing(conn); if (auth_ping) { LogDebug("AUTH PONG: waiting for token \"%ld\", got \"%s\" ...", auth_ping, Req->argv[0]); if (auth_ping == atoi(Req->argv[0])) { Conn_SetAuthPing(conn, 0); if (Client_Type(Client) == CLIENT_WAITAUTHPING) Login_User(Client); } else if (!IRC_WriteStrClient(Client, "To connect, type /QUOTE PONG %ld", auth_ping)) return DISCONNECTED; } #endif if (Client_Type(Client) == CLIENT_SERVER && Conn_LastPing(conn) == 0) { Log(LOG_INFO, "Synchronization with \"%s\" done (connection %d): %ld second%s [%ld users, %ld channels].", Client_ID(Client), conn, time(NULL) - Conn_GetSignon(conn), time(NULL) - Conn_GetSignon(conn) == 1 ? "" : "s", Client_UserCount(), Channel_CountVisible(NULL)); Conn_UpdatePing(conn); } else LogDebug("Connection %d: received PONG. Lag: %ld seconds.", conn, time(NULL) - Conn_LastPing(conn)); return CONNECTED; } /* IRC_PONG */ /** * Change the nickname of a client. * * @param Origin The client which caused the nickname change. * @param Target The client of which the nickname should be changed. * @param NewNick The new nickname. */ static void Change_Nick(CLIENT *Origin, CLIENT *Target, char *NewNick, bool InformClient) { if (Client_Conn(Target) > NONE) { /* Local client */ Log(LOG_INFO, "%s \"%s\" changed nick (connection %d): \"%s\" -> \"%s\".", Client_TypeText(Target), Client_Mask(Target), Client_Conn(Target), Client_ID(Target), NewNick); Conn_UpdateIdle(Client_Conn(Target)); } else { /* Remote client */ LogDebug("%s \"%s\" changed nick: \"%s\" -> \"%s\".", Client_TypeText(Target), Client_Mask(Target), Client_ID(Target), NewNick); } /* Inform all servers and users (which have to know) of the new name */ if (InformClient) { IRC_WriteStrClientPrefix(Target, Target, "NICK :%s", NewNick); IRC_WriteStrServersPrefix(NULL, Target, "NICK :%s", NewNick); } else IRC_WriteStrServersPrefix(Origin, Target, "NICK :%s", NewNick); IRC_WriteStrRelatedPrefix(Target, Target, false, "NICK :%s", NewNick); /* Register old nickname for WHOWAS queries */ Client_RegisterWhowas(Target); /* Save new nickname */ Client_SetID(Target, NewNick); } /* -eof- */ ngircd-21/src/ngircd/irc-channel.c0000644000175000116100000005127212221142771014053 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * IRC channel commands */ #include "imp.h" #include #include #include #include #include "defines.h" #include "conn.h" #include "channel.h" #include "conn-func.h" #include "lists.h" #include "log.h" #include "match.h" #include "messages.h" #include "parse.h" #include "irc.h" #include "irc-info.h" #include "irc-macros.h" #include "irc-write.h" #include "conf.h" #include "exp.h" #include "irc-channel.h" /** * Part from all channels. * * RFC 2812, (3.2.1 Join message Command): * Note that this message accepts a special argument ("0"), which is a * special request to leave all channels the user is currently a member of. * The server will process this message as if the user had sent a PART * command (See Section 3.2.2) for each channel he is a member of. * * @param client Client that initiated the part request * @param target Client that should part all joined channels * @returns CONNECTED or DISCONNECTED */ static bool part_from_all_channels(CLIENT* client, CLIENT *target) { CL2CHAN *cl2chan; CHANNEL *chan; while ((cl2chan = Channel_FirstChannelOf(target))) { chan = Channel_GetChannel(cl2chan); assert( chan != NULL ); Channel_Part(target, client, Channel_Name(chan), Client_ID(target)); } return CONNECTED; } /* part_from_all_channels */ /** * Check weather a local client is allowed to join an already existing * channel or not. * * @param Client Client that sent the JOIN command * @param chan Channel to check * @param channame Name of the channel * @param key Provided channel key (or NULL) * @returns true if client is allowed to join, false otherwise */ static bool join_allowed(CLIENT *Client, CHANNEL *chan, const char *channame, const char *key) { bool is_invited, is_banned, is_exception; /* Allow IRC operators to overwrite channel limits */ if (Client_HasMode(Client, 'o')) return true; is_banned = Lists_Check(Channel_GetListBans(chan), Client); is_exception = Lists_Check(Channel_GetListExcepts(chan), Client); is_invited = Lists_Check(Channel_GetListInvites(chan), Client); if (is_banned && !is_invited && !is_exception) { /* Client is banned from channel (and not on invite list) */ IRC_WriteErrClient(Client, ERR_BANNEDFROMCHAN_MSG, Client_ID(Client), channame); return false; } if (Channel_HasMode(chan, 'i') && !is_invited) { /* Channel is "invite-only" and client is not on invite list */ IRC_WriteErrClient(Client, ERR_INVITEONLYCHAN_MSG, Client_ID(Client), channame); return false; } if (!Channel_CheckKey(chan, Client, key ? key : "")) { /* Channel is protected by a channel key and the client * didn't specify the correct one */ IRC_WriteErrClient(Client, ERR_BADCHANNELKEY_MSG, Client_ID(Client), channame); return false; } if (Channel_HasMode(chan, 'l') && (Channel_MaxUsers(chan) <= Channel_MemberCount(chan))) { /* There are more clints joined to this channel than allowed */ IRC_WriteErrClient(Client, ERR_CHANNELISFULL_MSG, Client_ID(Client), channame); return false; } if (Channel_HasMode(chan, 'z') && !Conn_UsesSSL(Client_Conn(Client))) { /* Only "secure" clients are allowed, but clients doesn't * use SSL encryption */ IRC_WriteErrClient(Client, ERR_SECURECHANNEL_MSG, Client_ID(Client), channame); return false; } if (Channel_HasMode(chan, 'O') && !Client_HasMode(Client, 'o')) { /* Only IRC operators are allowed! */ IRC_WriteErrClient(Client, ERR_OPONLYCHANNEL_MSG, Client_ID(Client), channame); return false; } if (Channel_HasMode(chan, 'R') && !Client_HasMode(Client, 'R')) { /* Only registered users are allowed! */ IRC_WriteErrClient(Client, ERR_REGONLYCHANNEL_MSG, Client_ID(Client), channame); return false; } return true; } /* join_allowed */ /** * Set user channel modes. * * @param chan Channel * @param target User to set modes for * @param flags Channel modes to add */ static void join_set_channelmodes(CHANNEL *chan, CLIENT *target, const char *flags) { if (flags) { while (*flags) { Channel_UserModeAdd(chan, target, *flags); flags++; } } /* If the channel is persistent (+P) and client is an IRC op: * make client chanop, if not disabled in configuration. */ if (Channel_HasMode(chan, 'P') && Conf_OperChanPAutoOp && Client_HasMode(target, 'o')) Channel_UserModeAdd(chan, target, 'o'); } /* join_set_channelmodes */ /** * Forward JOIN command to a specific server * * This function differentiates between servers using RFC 2813 mode that * support the JOIN command with appended ASCII 7 character and channel * modes, and servers using RFC 1459 protocol which require separate JOIN * and MODE commands. * * @param To Forward JOIN (and MODE) command to this peer server * @param Prefix Client used to prefix the genrated commands * @param Data Parameters of JOIN command to forward, probably * containing channel modes separated by ASCII 7. */ static void cb_join_forward(CLIENT *To, CLIENT *Prefix, void *Data) { CONN_ID conn; char str[COMMAND_LEN], *ptr = NULL; strlcpy(str, (char *)Data, sizeof(str)); conn = Client_Conn(To); if (Conn_Options(conn) & CONN_RFC1459) { /* RFC 1459 compatibility mode, appended modes are NOT * supported, so strip them off! */ ptr = strchr(str, 0x7); if (ptr) *ptr++ = '\0'; } IRC_WriteStrClientPrefix(To, Prefix, "JOIN %s", str); if (ptr && *ptr) IRC_WriteStrClientPrefix(To, Prefix, "MODE %s +%s %s", str, ptr, Client_ID(Prefix)); } /* cb_join_forward */ /** * Forward JOIN command to all servers * * This function calls cb_join_forward(), which differentiates between * protocol implementations (e.g. RFC 2812, RFC 1459). * * @param Client Client used to prefix the genrated commands * @param target Forward JOIN (and MODE) command to this peer server * @param chan Channel structure * @param channame Channel name */ static void join_forward(CLIENT *Client, CLIENT *target, CHANNEL *chan, const char *channame) { char modes[CHANNEL_MODE_LEN], str[COMMAND_LEN]; /* RFC 2813, 4.2.1: channel modes are separated from the channel * name with ASCII 7, if any, and not spaces: */ strlcpy(&modes[1], Channel_UserModes(chan, target), sizeof(modes) - 1); if (modes[1]) modes[0] = 0x7; else modes[0] = '\0'; /* forward to other servers (if it is not a local channel) */ if (!Channel_IsLocal(chan)) { snprintf(str, sizeof(str), "%s%s", channame, modes); IRC_WriteStrServersPrefixFlag_CB(Client, target, '\0', cb_join_forward, str); } /* tell users in this channel about the new client */ IRC_WriteStrChannelPrefix(Client, chan, target, false, "JOIN :%s", channame); /* synchronize channel modes */ if (modes[1]) { IRC_WriteStrChannelPrefix(Client, chan, target, false, "MODE %s +%s %s", channame, &modes[1], Client_ID(target)); } } /* join_forward */ /** * Acknowledge user JOIN request and send "channel info" numerics. * * @param Client Client used to prefix the genrated commands * @param target Forward commands/numerics to this user * @param chan Channel structure * @param channame Channel name */ static bool join_send_topic(CLIENT *Client, CLIENT *target, CHANNEL *chan, const char *channame) { const char *topic; if (Client_Type(Client) != CLIENT_USER) return true; /* acknowledge join */ if (!IRC_WriteStrClientPrefix(Client, target, "JOIN :%s", channame)) return false; /* Send topic to client, if any */ topic = Channel_Topic(chan); assert(topic != NULL); if (*topic) { if (!IRC_WriteStrClient(Client, RPL_TOPIC_MSG, Client_ID(Client), channame, topic)) return false; #ifndef STRICT_RFC if (!IRC_WriteStrClient(Client, RPL_TOPICSETBY_MSG, Client_ID(Client), channame, Channel_TopicWho(chan), Channel_TopicTime(chan))) return false; #endif } /* send list of channel members to client */ if (!IRC_Send_NAMES(Client, chan)) return false; return IRC_WriteStrClient(Client, RPL_ENDOFNAMES_MSG, Client_ID(Client), Channel_Name(chan)); } /* join_send_topic */ /** * Handler for the IRC "JOIN" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_JOIN( CLIENT *Client, REQUEST *Req ) { char *channame, *key = NULL, *flags, *lastkey = NULL, *lastchan = NULL; CLIENT *target; CHANNEL *chan; assert (Client != NULL); assert (Req != NULL); _IRC_GET_SENDER_OR_RETURN_(target, Req, Client) /* Is argument "0"? */ if (Req->argc == 1 && !strncmp("0", Req->argv[0], 2)) return part_from_all_channels(Client, target); /* Are channel keys given? */ if (Req->argc > 1) key = strtok_r(Req->argv[1], ",", &lastkey); channame = Req->argv[0]; channame = strtok_r(channame, ",", &lastchan); /* Make sure that "channame" is not the empty string ("JOIN :") */ if (!channame) { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } while (channame) { flags = NULL; /* Did the server include channel-user-modes? */ if (Client_Type(Client) == CLIENT_SERVER) { flags = strchr(channame, 0x7); if (flags) { *flags = '\0'; flags++; } } chan = Channel_Search(channame); /* Local client? */ if (Client_Type(Client) == CLIENT_USER) { if (chan) { /* Already existing channel: already member? */ if (Channel_IsMemberOf(chan, Client)) goto join_next; } else { /* Channel must be created */ if (!strchr(Conf_AllowedChannelTypes, channame[0])) { /* ... but channel type is not allowed! */ IRC_WriteErrClient(Client, ERR_NOSUCHCHANNEL_MSG, Client_ID(Client), channame); goto join_next; } } /* Test if the user has reached the channel limit */ if ((Conf_MaxJoins > 0) && (Channel_CountForUser(Client) >= Conf_MaxJoins)) { if (!IRC_WriteErrClient(Client, ERR_TOOMANYCHANNELS_MSG, Client_ID(Client), channame)) return DISCONNECTED; goto join_next; } if (chan) { /* Already existing channel: check if the * client is allowed to join */ if (!join_allowed(Client, chan, channame, key)) goto join_next; } else { /* New channel: first user will become channel * operator unless this is a modeless channel */ if (*channame != '+') flags = "o"; } /* Local client: update idle time */ Conn_UpdateIdle(Client_Conn(Client)); } else { /* Remote server: we don't need to know whether the * client is invited or not, but we have to make sure * that the "one shot" entries (generated by INVITE * commands) in this list become deleted when a user * joins a channel this way. */ if (chan) (void)Lists_Check(Channel_GetListInvites(chan), target); } /* Join channel (and create channel if it doesn't exist) */ if (!Channel_Join(target, channame)) goto join_next; if (!chan) { /* channel is new; it has been created above */ chan = Channel_Search(channame); assert(chan != NULL); if (Channel_IsModeless(chan)) { Channel_ModeAdd(chan, 't'); /* /TOPIC not allowed */ Channel_ModeAdd(chan, 'n'); /* no external msgs */ } } assert(chan != NULL); join_set_channelmodes(chan, target, flags); join_forward(Client, target, chan, channame); if (!join_send_topic(Client, target, chan, channame)) break; /* write error */ join_next: /* next channel? */ channame = strtok_r(NULL, ",", &lastchan); if (channame && key) key = strtok_r(NULL, ",", &lastkey); } return CONNECTED; } /* IRC_JOIN */ /** * Handler for the IRC "PART" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_PART(CLIENT * Client, REQUEST * Req) { CLIENT *target; char *chan; assert(Client != NULL); assert(Req != NULL); _IRC_GET_SENDER_OR_RETURN_(target, Req, Client) /* Loop over all the given channel names */ chan = strtok(Req->argv[0], ","); /* Make sure that "chan" is not the empty string ("PART :") */ if (!chan) { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } while (chan) { Channel_Part(target, Client, chan, Req->argc > 1 ? Req->argv[1] : Client_ID(target)); chan = strtok(NULL, ","); } /* Update idle time, if local client */ if (Client_Conn(Client) > NONE) Conn_UpdateIdle(Client_Conn(Client)); return CONNECTED; } /* IRC_PART */ /** * Handler for the IRC "TOPIC" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_TOPIC( CLIENT *Client, REQUEST *Req ) { CHANNEL *chan; CLIENT *from; char *topic; bool r, topic_power; assert( Client != NULL ); assert( Req != NULL ); IRC_SetPenalty(Client, 1); _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) chan = Channel_Search(Req->argv[0]); if (!chan) return IRC_WriteErrClient(from, ERR_NOSUCHCHANNEL_MSG, Client_ID(from), Req->argv[0]); /* Only remote servers and channel members are allowed to change the * channel topic, and IRC operators when the Conf_OperCanMode option * is set in the server configuration. */ if (Client_Type(Client) != CLIENT_SERVER) { topic_power = Client_HasMode(from, 'o'); if (!Channel_IsMemberOf(chan, from) && !(Conf_OperCanMode && topic_power)) return IRC_WriteErrClient(from, ERR_NOTONCHANNEL_MSG, Client_ID(from), Req->argv[0]); } else topic_power = true; if (Req->argc == 1) { /* Request actual topic */ topic = Channel_Topic(chan); if (*topic) { r = IRC_WriteStrClient(from, RPL_TOPIC_MSG, Client_ID(Client), Channel_Name(chan), topic); #ifndef STRICT_RFC if (!r) return r; r = IRC_WriteStrClient(from, RPL_TOPICSETBY_MSG, Client_ID(Client), Channel_Name(chan), Channel_TopicWho(chan), Channel_TopicTime(chan)); #endif return r; } else return IRC_WriteStrClient(from, RPL_NOTOPIC_MSG, Client_ID(from), Channel_Name(chan)); } if (Channel_HasMode(chan, 't')) { /* Topic Lock. Is the user a channel op or IRC operator? */ if(!topic_power && !Channel_UserHasMode(chan, from, 'h') && !Channel_UserHasMode(chan, from, 'o') && !Channel_UserHasMode(chan, from, 'a') && !Channel_UserHasMode(chan, from, 'q')) return IRC_WriteErrClient(from, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(from), Channel_Name(chan)); } /* Set new topic */ Channel_SetTopic(chan, from, Req->argv[1]); LogDebug("%s \"%s\" set topic on \"%s\": %s", Client_TypeText(from), Client_Mask(from), Channel_Name(chan), Req->argv[1][0] ? Req->argv[1] : ""); if (Conf_OperServerMode) from = Client_ThisServer(); /* Update channel and forward new topic to other servers */ if (!Channel_IsLocal(chan)) IRC_WriteStrServersPrefix(Client, from, "TOPIC %s :%s", Req->argv[0], Req->argv[1]); IRC_WriteStrChannelPrefix(Client, chan, from, false, "TOPIC %s :%s", Req->argv[0], Req->argv[1]); if (Client_Type(Client) == CLIENT_USER) return IRC_WriteStrClientPrefix(Client, Client, "TOPIC %s :%s", Req->argv[0], Req->argv[1]); else return CONNECTED; } /* IRC_TOPIC */ /** * Handler for the IRC "LIST" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_LIST( CLIENT *Client, REQUEST *Req ) { char *pattern; CHANNEL *chan; CLIENT *from, *target; int count = 0; assert(Client != NULL); assert(Req != NULL); IRC_SetPenalty(Client, 2); _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) if (Req->argc > 0) pattern = strtok(Req->argv[0], ","); else pattern = "*"; if (Req->argc == 2) { /* Forward to other server? */ target = Client_Search(Req->argv[1]); if (! target || Client_Type(target) != CLIENT_SERVER) return IRC_WriteErrClient(from, ERR_NOSUCHSERVER_MSG, Client_ID(Client), Req->argv[1]); if (target != Client_ThisServer()) { /* Target is indeed an other server, forward it! */ return IRC_WriteStrClientPrefix(target, from, "LIST %s :%s", Req->argv[0], Req->argv[1]); } } while (pattern) { /* Loop through all the channels */ if (Req->argc > 0) ngt_LowerStr(pattern); chan = Channel_First(); while (chan) { /* Check search pattern */ if (MatchCaseInsensitive(pattern, Channel_Name(chan))) { /* Gotcha! */ if (!Channel_HasMode(chan, 's') || Channel_IsMemberOf(chan, from) || (!Conf_MorePrivacy && Client_HasMode(Client, 'o') && Client_Conn(Client) > NONE)) { if ((Conf_MaxListSize > 0) && IRC_CheckListTooBig(from, count, Conf_MaxListSize, "LIST")) break; if (!IRC_WriteStrClient(from, RPL_LIST_MSG, Client_ID(from), Channel_Name(chan), Channel_MemberCount(chan), Channel_Topic( chan ))) return DISCONNECTED; count++; } } chan = Channel_Next(chan); } /* Get next name ... */ if(Req->argc > 0) pattern = strtok(NULL, ","); else pattern = NULL; } return IRC_WriteStrClient(from, RPL_LISTEND_MSG, Client_ID(from)); } /* IRC_LIST */ /** * Handler for the IRC+ "CHANINFO" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_CHANINFO( CLIENT *Client, REQUEST *Req ) { char modes_add[COMMAND_LEN], l[16]; CLIENT *from; CHANNEL *chan; int arg_topic; assert( Client != NULL ); assert( Req != NULL ); /* Bad number of parameters? */ if (Req->argc < 2 || Req->argc == 4 || Req->argc > 5) { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } /* Compatibility kludge */ if (Req->argc == 5) arg_topic = 4; else if(Req->argc == 3) arg_topic = 2; else arg_topic = -1; _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) /* Search or create channel */ chan = Channel_Search( Req->argv[0] ); if (!chan) chan = Channel_Create( Req->argv[0] ); if (!chan) return CONNECTED; if (Req->argv[1][0] == '+') { if (!*Channel_Modes(chan)) { /* OK, this channel doesn't have modes yet, * set the received ones: */ Channel_SetModes(chan, &Req->argv[1][1]); if(Req->argc == 5) { if(Channel_HasMode(chan, 'k')) Channel_SetKey(chan, Req->argv[2]); if(Channel_HasMode(chan, 'l')) Channel_SetMaxUsers(chan, atol(Req->argv[3])); } else { /* Delete modes which we never want to inherit */ Channel_ModeDel(chan, 'l'); Channel_ModeDel(chan, 'k'); } strcpy(modes_add, ""); if (Channel_HasMode(chan, 'l')) { snprintf(l, sizeof(l), " %lu", Channel_MaxUsers(chan)); strlcat(modes_add, l, sizeof(modes_add)); } if (Channel_HasMode(chan, 'k')) { strlcat(modes_add, " ", sizeof(modes_add)); strlcat(modes_add, Channel_Key(chan), sizeof(modes_add)); } /* Inform members of this channel */ IRC_WriteStrChannelPrefix(Client, chan, from, false, "MODE %s +%s%s", Req->argv[0], Channel_Modes(chan), modes_add); } } else Log(LOG_WARNING, "CHANINFO: invalid MODE format ignored!"); if (arg_topic > 0) { /* We got a topic */ if (!*Channel_Topic(chan) && Req->argv[arg_topic][0]) { /* OK, there is no topic jet */ Channel_SetTopic(chan, Client, Req->argv[arg_topic]); IRC_WriteStrChannelPrefix(Client, chan, from, false, "TOPIC %s :%s", Req->argv[0], Channel_Topic(chan)); } } /* Forward CHANINFO to other servers */ if (Req->argc == 5) IRC_WriteStrServersPrefixFlag(Client, from, 'C', "CHANINFO %s %s %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2], Req->argv[3], Req->argv[4]); else if (Req->argc == 3) IRC_WriteStrServersPrefixFlag(Client, from, 'C', "CHANINFO %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2]); else IRC_WriteStrServersPrefixFlag(Client, from, 'C', "CHANINFO %s %s", Req->argv[0], Req->argv[1]); return CONNECTED; } /* IRC_CHANINFO */ /* -eof- */ ngircd-21/src/ngircd/class.c0000644000175000116100000000561512206130744012775 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * User class management. */ #include "imp.h" #include #include #include "defines.h" #include "array.h" #include "conn.h" #include "client.h" #include "lists.h" #include "match.h" #include "stdio.h" #include "exp.h" #include "class.h" struct list_head My_Classes[CLASS_COUNT]; GLOBAL void Class_Init(void) { memset(My_Classes, 0, sizeof(My_Classes)); } GLOBAL void Class_Exit(void) { int i; for (i = 0; i < CLASS_COUNT; Lists_Free(&My_Classes[i++])); } GLOBAL bool Class_GetMemberReason(const int Class, CLIENT *Client, char *reason, size_t len) { char str[COMMAND_LEN] = "listed"; assert(Class < CLASS_COUNT); assert(Client != NULL); if (!Lists_CheckReason(&My_Classes[Class], Client, str, sizeof(str))) return false; switch(Class) { case CLASS_GLINE: snprintf(reason, len, "\"%s\" (G-Line)", str); break; case CLASS_KLINE: snprintf(reason, len, "\"%s\" (K-Line)", str); break; default: snprintf(reason, len, "%s", str); break; } return true; } /** * Check if a client is banned from this server: GLINE, KLINE. * * If a client isn't allowed to connect, it will be disconnected again. * * @param Client The client to check. * @return CONNECTED if client is allowed to join, DISCONNECTED if not. */ GLOBAL bool Class_HandleServerBans(CLIENT *Client) { char reject[COMMAND_LEN]; assert(Client != NULL); if (Class_GetMemberReason(CLASS_GLINE, Client, reject, sizeof(reject)) || Class_GetMemberReason(CLASS_KLINE, Client, reject, sizeof(reject))) { Client_Reject(Client, reject, true); return DISCONNECTED; } return CONNECTED; } GLOBAL bool Class_AddMask(const int Class, const char *Pattern, time_t ValidUntil, const char *Reason) { char mask[MASK_LEN]; assert(Class < CLASS_COUNT); assert(Pattern != NULL); assert(Reason != NULL); Lists_MakeMask(Pattern, mask, sizeof(mask)); return Lists_Add(&My_Classes[Class], mask, ValidUntil, Reason); } GLOBAL void Class_DeleteMask(const int Class, const char *Pattern) { char mask[MASK_LEN]; assert(Class < CLASS_COUNT); assert(Pattern != NULL); Lists_MakeMask(Pattern, mask, sizeof(mask)); Lists_Del(&My_Classes[Class], mask); } GLOBAL struct list_head * Class_GetList(const int Class) { assert(Class < CLASS_COUNT); return &My_Classes[Class]; } GLOBAL void Class_Expire(void) { Lists_Expire(&My_Classes[CLASS_GLINE], "G-Line"); Lists_Expire(&My_Classes[CLASS_KLINE], "K-Line"); } /* -eof- */ ngircd-21/src/ngircd/irc-info.c0000644000175000116100000011737512221142771013405 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * IRC info commands */ #include "imp.h" #include #include #include #include #include #include #include "ngircd.h" #include "conn-func.h" #include "conn-zip.h" #include "channel.h" #include "class.h" #include "conf.h" #include "defines.h" #include "lists.h" #include "log.h" #include "messages.h" #include "match.h" #include "tool.h" #include "parse.h" #include "irc.h" #include "irc-macros.h" #include "irc-write.h" #include "client-cap.h" #include "op.h" #include "exp.h" #include "irc-info.h" /* Local functions */ static unsigned int t_diff(time_t *t, const time_t d) { time_t diff, remain; diff = *t / d; remain = diff * d; *t -= remain; return (unsigned int)diff; } static unsigned int uptime_days(time_t *now) { return t_diff(now, 60 * 60 * 24); } static unsigned int uptime_hrs(time_t *now) { return t_diff(now, 60 * 60); } static unsigned int uptime_mins(time_t *now) { return t_diff(now, 60); } static bool write_whoreply(CLIENT *Client, CLIENT *c, const char *channelname, const char *flags) { return IRC_WriteStrClient(Client, RPL_WHOREPLY_MSG, Client_ID(Client), channelname, Client_User(c), Client_HostnameDisplayed(c), Client_ID(Client_Introducer(c)), Client_ID(c), flags, Client_Hops(c), Client_Info(c)); } /** * Return channel user mode prefix(es). * * @param Client The client requesting the mode prefixes. * @param chan_user_modes String with channel user modes. * @param str String buffer to which the prefix(es) will be appended. * @param len Size of "str" buffer. * @return Pointer to "str". */ static char * who_flags_qualifier(CLIENT *Client, const char *chan_user_modes, char *str, size_t len) { assert(Client != NULL); if (Client_Cap(Client) & CLIENT_CAP_MULTI_PREFIX) { if (strchr(chan_user_modes, 'q')) strlcat(str, "~", len); if (strchr(chan_user_modes, 'a')) strlcat(str, "&", len); if (strchr(chan_user_modes, 'o')) strlcat(str, "@", len); if (strchr(chan_user_modes, 'h')) strlcat(str, "%", len); if (strchr(chan_user_modes, 'v')) strlcat(str, "+", len); return str; } if (strchr(chan_user_modes, 'q')) strlcat(str, "~", len); else if (strchr(chan_user_modes, 'a')) strlcat(str, "&", len); else if (strchr(chan_user_modes, 'o')) strlcat(str, "@", len); else if (strchr(chan_user_modes, 'h')) strlcat(str, "%", len); else if (strchr(chan_user_modes, 'v')) strlcat(str, "+", len); return str; } /** * Send WHO reply for a "channel target" ("WHO #channel"). * * @param Client Client requesting the information. * @param Chan Channel being requested. * @param OnlyOps Only display IRC operators. * @return CONNECTED or DISCONNECTED. */ static bool IRC_WHO_Channel(CLIENT *Client, CHANNEL *Chan, bool OnlyOps) { bool is_visible, is_member, is_ircop; CL2CHAN *cl2chan; char flags[10]; CLIENT *c; int count = 0; assert( Client != NULL ); assert( Chan != NULL ); IRC_SetPenalty(Client, 1); is_member = Channel_IsMemberOf(Chan, Client); /* Secret channel? */ if (!is_member && Channel_HasMode(Chan, 's')) return IRC_WriteStrClient(Client, RPL_ENDOFWHO_MSG, Client_ID(Client), Channel_Name(Chan)); cl2chan = Channel_FirstMember(Chan); for (; cl2chan ; cl2chan = Channel_NextMember(Chan, cl2chan)) { c = Channel_GetClient(cl2chan); is_ircop = Client_HasMode(c, 'o'); if (OnlyOps && !is_ircop) continue; is_visible = Client_HasMode(c, 'i'); if (is_member || is_visible) { memset(flags, 0, sizeof(flags)); if (Client_HasMode(c, 'a')) flags[0] = 'G'; /* away */ else flags[0] = 'H'; if (is_ircop) flags[1] = '*'; who_flags_qualifier(Client, Channel_UserModes(Chan, c), flags, sizeof(flags)); if (!write_whoreply(Client, c, Channel_Name(Chan), flags)) return DISCONNECTED; count++; } } /* If there are a lot of clients, augment penalty a bit */ if (count > MAX_RPL_WHO) IRC_SetPenalty(Client, 1); return IRC_WriteStrClient(Client, RPL_ENDOFWHO_MSG, Client_ID(Client), Channel_Name(Chan)); } /** * Send WHO reply for a "mask target" ("WHO m*sk"). * * @param Client Client requesting the information. * @param Mask Mask being requested or NULL for "all" clients. * @param OnlyOps Only display IRC operators. * @return CONNECTED or DISCONNECTED. */ static bool IRC_WHO_Mask(CLIENT *Client, char *Mask, bool OnlyOps) { CLIENT *c; CL2CHAN *cl2chan; CHANNEL *chan; bool client_match, is_visible; char flags[3]; int count = 0; assert (Client != NULL); if (Mask) ngt_LowerStr(Mask); IRC_SetPenalty(Client, 3); for (c = Client_First(); c != NULL; c = Client_Next(c)) { if (Client_Type(c) != CLIENT_USER) continue; if (OnlyOps && !Client_HasMode(c, 'o')) continue; if (Mask) { /* Match pattern against user host/server/name/nick */ client_match = MatchCaseInsensitive(Mask, Client_Hostname(c)); if (!client_match) client_match = MatchCaseInsensitive(Mask, Client_ID(Client_Introducer(c))); if (!client_match) client_match = MatchCaseInsensitive(Mask, Client_Info(c)); if (!client_match) client_match = MatchCaseInsensitive(Mask, Client_ID(c)); if (!client_match) continue; /* no match: skip this client */ } is_visible = !Client_HasMode(c, 'i'); /* Target client is invisible, but mask matches exactly? */ if (!is_visible && Mask && strcasecmp(Client_ID(c), Mask) == 0) is_visible = true; /* Target still invisible, but are both on the same channel? */ if (!is_visible) { cl2chan = Channel_FirstChannelOf(Client); while (cl2chan && !is_visible) { chan = Channel_GetChannel(cl2chan); if (Channel_IsMemberOf(chan, c)) is_visible = true; cl2chan = Channel_NextChannelOf(Client, cl2chan); } } if (!is_visible) /* target user is not visible */ continue; if (IRC_CheckListTooBig(Client, count, MAX_RPL_WHO, "WHO")) break; memset(flags, 0, sizeof(flags)); if (Client_HasMode(c, 'a')) flags[0] = 'G'; /* away */ else flags[0] = 'H'; if (Client_HasMode(c, 'o')) flags[1] = '*'; if (!write_whoreply(Client, c, "*", flags)) return DISCONNECTED; count++; } return IRC_WriteStrClient(Client, RPL_ENDOFWHO_MSG, Client_ID(Client), Mask ? Mask : "*"); } /** * Generate WHOIS reply of one actual client. * * @param Client The client from which this command has been received. * @param from The client requesting the information ("originator"). * @param c The client of which information should be returned. * @return CONNECTED or DISCONNECTED. */ static bool IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c) { char str[COMMAND_LEN]; CL2CHAN *cl2chan; CHANNEL *chan; assert(Client != NULL); assert(from != NULL); assert(c != NULL); /* Nick, user, hostname and client info */ if (!IRC_WriteStrClient(from, RPL_WHOISUSER_MSG, Client_ID(from), Client_ID(c), Client_User(c), Client_HostnameDisplayed(c), Client_Info(c))) return DISCONNECTED; /* Server */ if (!IRC_WriteStrClient(from, RPL_WHOISSERVER_MSG, Client_ID(from), Client_ID(c), Client_ID(Client_Introducer(c)), Client_Info(Client_Introducer(c)))) return DISCONNECTED; /* Channels */ snprintf(str, sizeof(str), RPL_WHOISCHANNELS_MSG, Client_ID(from), Client_ID(c)); cl2chan = Channel_FirstChannelOf(c); while (cl2chan) { chan = Channel_GetChannel(cl2chan); assert(chan != NULL); /* next */ cl2chan = Channel_NextChannelOf(c, cl2chan); /* Secret channel? */ if (Channel_HasMode(chan, 's') && !Channel_IsMemberOf(chan, Client)) continue; /* Local channel and request is not from a user? */ if (Client_Type(Client) == CLIENT_SERVER && Channel_IsLocal(chan)) continue; /* Concatenate channel names */ if (str[strlen(str) - 1] != ':') strlcat(str, " ", sizeof(str)); who_flags_qualifier(Client, Channel_UserModes(chan, c), str, sizeof(str)); strlcat(str, Channel_Name(chan), sizeof(str)); if (strlen(str) > (COMMAND_LEN - CHANNEL_NAME_LEN - 4)) { /* Line becomes too long: send it! */ if (!IRC_WriteStrClient(Client, "%s", str)) return DISCONNECTED; snprintf(str, sizeof(str), RPL_WHOISCHANNELS_MSG, Client_ID(from), Client_ID(c)); } } if(str[strlen(str) - 1] != ':') { /* There is data left to send: */ if (!IRC_WriteStrClient(Client, "%s", str)) return DISCONNECTED; } /* IRC-Services? */ if (Client_Type(c) == CLIENT_SERVICE && !IRC_WriteStrClient(from, RPL_WHOISSERVICE_MSG, Client_ID(from), Client_ID(c))) return DISCONNECTED; /* IRC-Operator? */ if (Client_Type(c) != CLIENT_SERVICE && Client_HasMode(c, 'o') && !IRC_WriteStrClient(from, RPL_WHOISOPERATOR_MSG, Client_ID(from), Client_ID(c))) return DISCONNECTED; /* IRC-Bot? */ if (Client_HasMode(c, 'B') && !IRC_WriteStrClient(from, RPL_WHOISBOT_MSG, Client_ID(from), Client_ID(c))) return DISCONNECTED; /* Connected using SSL? */ if (Conn_UsesSSL(Client_Conn(c))) { if (!IRC_WriteStrClient(from, RPL_WHOISSSL_MSG, Client_ID(from), Client_ID(c))) return DISCONNECTED; /* Certificate fingerprint? */ if (Conn_GetCertFp(Client_Conn(c)) && from == c && !IRC_WriteStrClient(from, RPL_WHOISCERTFP_MSG, Client_ID(from), Client_ID(c), Conn_GetCertFp(Client_Conn(c)))) return DISCONNECTED; } /* Registered nickname? */ if (Client_HasMode(c, 'R') && !IRC_WriteStrClient(from, RPL_WHOISREGNICK_MSG, Client_ID(from), Client_ID(c))) return DISCONNECTED; /* Local client and requester is the user itself or an IRC Op? */ if (Client_Conn(c) > NONE && (from == c || (!Conf_MorePrivacy && Client_HasMode(from, 'o')))) { /* Client hostname */ if (!IRC_WriteStrClient(from, RPL_WHOISHOST_MSG, Client_ID(from), Client_ID(c), Client_Hostname(c), Client_IPAText(c))) return DISCONNECTED; /* Client modes */ if (!IRC_WriteStrClient(from, RPL_WHOISMODES_MSG, Client_ID(from), Client_ID(c), Client_Modes(c))) return DISCONNECTED; } /* Idle and signon time (local clients only!) */ if (!Conf_MorePrivacy && Client_Conn(c) > NONE && !IRC_WriteStrClient(from, RPL_WHOISIDLE_MSG, Client_ID(from), Client_ID(c), (unsigned long)Conn_GetIdle(Client_Conn(c)), (unsigned long)Conn_GetSignon(Client_Conn(c)))) return DISCONNECTED; /* Away? */ if (Client_HasMode(c, 'a') && !IRC_WriteStrClient(from, RPL_AWAY_MSG, Client_ID(from), Client_ID(c), Client_Away(c))) return DISCONNECTED; return CONNECTED; } static bool WHOWAS_EntryWrite(CLIENT *prefix, WHOWAS *entry) { char t_str[60]; (void)strftime(t_str, sizeof(t_str), "%a %b %d %H:%M:%S %Y", localtime(&entry->time)); if (!IRC_WriteStrClient(prefix, RPL_WHOWASUSER_MSG, Client_ID(prefix), entry->id, entry->user, entry->host, entry->info)) return DISCONNECTED; return IRC_WriteStrClient(prefix, RPL_WHOISSERVER_MSG, Client_ID(prefix), entry->id, entry->server, t_str); } #ifdef SSL_SUPPORT static bool Show_MOTD_SSLInfo(CLIENT *Client) { char buf[COMMAND_LEN]; char c_str[128]; if (Conn_GetCipherInfo(Client_Conn(Client), c_str, sizeof(c_str))) { snprintf(buf, sizeof(buf), "Connected using Cipher %s", c_str); if (!IRC_WriteStrClient(Client, RPL_MOTD_MSG, Client_ID(Client), buf)) return false; } if (Conn_GetCertFp(Client_Conn(Client))) { snprintf(buf, sizeof(buf), "Your client certificate fingerprint is: %s", Conn_GetCertFp(Client_Conn(Client))); if (!IRC_WriteStrClient(Client, RPL_MOTD_MSG, Client_ID(Client), buf)) return false; } return true; } #else static bool Show_MOTD_SSLInfo(UNUSED CLIENT *c) { return true; } #endif /* Global functions */ /** * Handler for the IRC command "ADMIN". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_ADMIN(CLIENT *Client, REQUEST *Req ) { CLIENT *target, *prefix; assert( Client != NULL ); assert( Req != NULL ); IRC_SetPenalty(Client, 1); _IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix) /* Forward? */ if(target != Client_ThisServer()) { IRC_WriteStrClientPrefix(target, prefix, "ADMIN %s", Client_ID(target)); return CONNECTED; } if (!IRC_WriteStrClient(Client, RPL_ADMINME_MSG, Client_ID(prefix), Conf_ServerName)) return DISCONNECTED; if (!IRC_WriteStrClient(Client, RPL_ADMINLOC1_MSG, Client_ID(prefix), Conf_ServerAdmin1)) return DISCONNECTED; if (!IRC_WriteStrClient(Client, RPL_ADMINLOC2_MSG, Client_ID(prefix), Conf_ServerAdmin2)) return DISCONNECTED; if (!IRC_WriteStrClient(Client, RPL_ADMINEMAIL_MSG, Client_ID(prefix), Conf_ServerAdminMail)) return DISCONNECTED; return CONNECTED; } /* IRC_ADMIN */ /** * Handler for the IRC command "INFO". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_INFO(CLIENT * Client, REQUEST * Req) { CLIENT *target, *prefix; char msg[510]; assert(Client != NULL); assert(Req != NULL); IRC_SetPenalty(Client, 2); _IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix) /* Forward? */ if (target != Client_ThisServer()) { IRC_WriteStrClientPrefix(target, prefix, "INFO %s", Client_ID(target)); return CONNECTED; } if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), NGIRCd_Version)) return DISCONNECTED; #if defined(__DATE__) && defined(__TIME__) snprintf(msg, sizeof(msg), "Birth Date: %s at %s", __DATE__, __TIME__); if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg)) return DISCONNECTED; #endif strlcpy(msg, "On-line since ", sizeof(msg)); strlcat(msg, NGIRCd_StartStr, sizeof(msg)); if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg)) return DISCONNECTED; if (!IRC_WriteStrClient(Client, RPL_ENDOFINFO_MSG, Client_ID(prefix))) return DISCONNECTED; return CONNECTED; } /* IRC_INFO */ /** * Handler for the IRC "ISON" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_ISON( CLIENT *Client, REQUEST *Req ) { char rpl[COMMAND_LEN]; CLIENT *c; char *ptr; int i; assert(Client != NULL); assert(Req != NULL); strlcpy(rpl, RPL_ISON_MSG, sizeof rpl); for (i = 0; i < Req->argc; i++) { /* "All" ircd even parse ": ..." arguments and split * them up; so we do the same ... */ ptr = strtok(Req->argv[i], " "); while (ptr) { ngt_TrimStr(ptr); c = Client_Search(ptr); if (c && Client_Type(c) == CLIENT_USER) { strlcat(rpl, Client_ID(c), sizeof(rpl)); strlcat(rpl, " ", sizeof(rpl)); } ptr = strtok(NULL, " "); } } ngt_TrimLastChr(rpl, ' '); return IRC_WriteStrClient(Client, rpl, Client_ID(Client)); } /* IRC_ISON */ /** * Handler for the IRC "LINKS" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_LINKS(CLIENT *Client, REQUEST *Req) { CLIENT *target, *from, *c; char *mask; assert(Client != NULL); assert(Req != NULL); IRC_SetPenalty(Client, 1); _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) /* Get pointer to server mask or "*", if none given */ if (Req->argc > 0) mask = Req->argv[Req->argc - 1]; else mask = "*"; /* Forward? */ if (Req->argc == 2) { _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from) if (target != Client_ThisServer()) { IRC_WriteStrClientPrefix(target, from, "LINKS %s %s", Client_ID(target), Req->argv[1]); return CONNECTED; } } c = Client_First(); while (c) { if (Client_Type(c) == CLIENT_SERVER && MatchCaseInsensitive(mask, Client_ID(c))) { if (!IRC_WriteStrClient(from, RPL_LINKS_MSG, Client_ID(from), Client_ID(c), Client_ID(Client_TopServer(c) ? Client_TopServer(c) : Client_ThisServer()), Client_Hops(c), Client_Info(c))) return DISCONNECTED; } c = Client_Next(c); } return IRC_WriteStrClient(from, RPL_ENDOFLINKS_MSG, Client_ID(from), mask); } /* IRC_LINKS */ /** * Handler for the IRC "LUSERS" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_LUSERS( CLIENT *Client, REQUEST *Req ) { CLIENT *target, *from; assert( Client != NULL ); assert( Req != NULL ); IRC_SetPenalty(Client, 1); _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from) /* Forward? */ if (target != Client_ThisServer()) { IRC_WriteStrClientPrefix(target, from, "LUSERS %s %s", Req->argv[0], Client_ID(target)); return CONNECTED; } return IRC_Send_LUSERS(from); } /* IRC_LUSERS */ /** * Handler for the IRC command "SERVLIST". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_SERVLIST(CLIENT *Client, REQUEST *Req) { CLIENT *c; assert(Client != NULL); assert(Req != NULL); IRC_SetPenalty(Client, 1); if (Req->argc < 2 || strcmp(Req->argv[1], "0") == 0) { for (c = Client_First(); c!= NULL; c = Client_Next(c)) { if (Client_Type(c) != CLIENT_SERVICE) continue; if (Req->argc > 0 && !MatchCaseInsensitive(Req->argv[0], Client_ID(c))) continue; if (!IRC_WriteStrClient(Client, RPL_SERVLIST_MSG, Client_ID(Client), Client_Mask(c), Client_Mask(Client_Introducer(c)), "*", 0, Client_Hops(c), Client_Info(c))) return DISCONNECTED; } } return IRC_WriteStrClient(Client, RPL_SERVLISTEND_MSG, Client_ID(Client), Req->argc > 0 ? Req->argv[0] : "*", Req->argc > 1 ? Req->argv[1] : "0"); } /* IRC_SERVLIST */ /** * Handler for the IRC command "MOTD". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_MOTD( CLIENT *Client, REQUEST *Req ) { CLIENT *from, *target; assert( Client != NULL ); assert( Req != NULL ); IRC_SetPenalty(Client, 3); _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from) /* Forward? */ if (target != Client_ThisServer()) { IRC_WriteStrClientPrefix(target, from, "MOTD %s", Client_ID(target)); return CONNECTED; } return IRC_Show_MOTD(from); } /* IRC_MOTD */ /** * Handler for the IRC command "NAMES". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_NAMES( CLIENT *Client, REQUEST *Req ) { char rpl[COMMAND_LEN], *ptr; CLIENT *target, *from, *c; CHANNEL *chan; assert( Client != NULL ); assert( Req != NULL ); IRC_SetPenalty(Client, 1); _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from) /* Forward? */ if (target != Client_ThisServer()) { IRC_WriteStrClientPrefix(target, from, "NAMES %s :%s", Req->argv[0], Client_ID(target)); return CONNECTED; } if (Req->argc > 0) { /* Return NAMES list for specific channels */ ptr = strtok(Req->argv[0], ","); while(ptr) { chan = Channel_Search(ptr); if (chan && !IRC_Send_NAMES(from, chan)) return DISCONNECTED; if (!IRC_WriteStrClient(from, RPL_ENDOFNAMES_MSG, Client_ID(from), ptr)) return DISCONNECTED; ptr = strtok( NULL, "," ); } return CONNECTED; } chan = Channel_First(); while (chan) { if (!IRC_Send_NAMES(from, chan)) return DISCONNECTED; chan = Channel_Next(chan); } /* Now print all clients which are not in any channel */ c = Client_First(); snprintf(rpl, sizeof(rpl), RPL_NAMREPLY_MSG, Client_ID(from), "*", "*"); while (c) { if (Client_Type(c) == CLIENT_USER && Channel_FirstChannelOf(c) == NULL && !Client_HasMode(c, 'i')) { /* its a user, concatenate ... */ if (rpl[strlen(rpl) - 1] != ':') strlcat(rpl, " ", sizeof(rpl)); strlcat(rpl, Client_ID(c), sizeof(rpl)); if (strlen(rpl) > COMMAND_LEN - CLIENT_NICK_LEN - 4) { /* Line is gwoing too long, send now */ if (!IRC_WriteStrClient(from, "%s", rpl)) return DISCONNECTED; snprintf(rpl, sizeof(rpl), RPL_NAMREPLY_MSG, Client_ID(from), "*", "*"); } } c = Client_Next(c); } if (rpl[strlen(rpl) - 1] != ':' && !IRC_WriteStrClient(from, "%s", rpl)) return DISCONNECTED; return IRC_WriteStrClient(from, RPL_ENDOFNAMES_MSG, Client_ID(from), "*"); } /* IRC_NAMES */ /** * Handler for the IRC command "STATS". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_STATS( CLIENT *Client, REQUEST *Req ) { CLIENT *from, *target, *cl; CONN_ID con; char query; COMMAND *cmd; time_t time_now; unsigned int days, hrs, mins; struct list_head *list; struct list_elem *list_item; bool more_links = false; assert(Client != NULL); assert(Req != NULL); IRC_SetPenalty(Client, 2); _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from) /* Forward? */ if (target != Client_ThisServer()) { IRC_WriteStrClientPrefix(target, from, "STATS %s %s", Req->argv[0], Client_ID(target)); return CONNECTED; } if (Req->argc > 0) query = Req->argv[0][0] ? Req->argv[0][0] : '*'; else query = '*'; switch (query) { case 'g': /* Network-wide bans ("G-Lines") */ case 'G': case 'k': /* Server-local bans ("K-Lines") */ case 'K': if (!Client_HasMode(from, 'o')) return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG, Client_ID(from)); if (query == 'g' || query == 'G') list = Class_GetList(CLASS_GLINE); else list = Class_GetList(CLASS_KLINE); list_item = Lists_GetFirst(list); while (list_item) { if (!IRC_WriteStrClient(from, RPL_STATSXLINE_MSG, Client_ID(from), query, Lists_GetMask(list_item), Lists_GetValidity(list_item), Lists_GetReason(list_item))) return DISCONNECTED; list_item = Lists_GetNext(list_item); } break; case 'L': /* Link status (servers and user links) */ if (!Op_Check(from, Req)) return Op_NoPrivileges(from, Req); more_links = true; case 'l': /* Link status (servers and own link) */ time_now = time(NULL); for (con = Conn_First(); con != NONE; con = Conn_Next(con)) { cl = Conn_GetClient(con); if (!cl) continue; if (Client_Type(cl) == CLIENT_SERVER || cl == Client || (more_links && Client_Type(cl) == CLIENT_USER)) { #ifdef ZLIB if (Conn_Options(con) & CONN_ZIP) { if (!IRC_WriteStrClient (from, RPL_STATSLINKINFOZIP_MSG, Client_ID(from), Client_Mask(cl), Conn_SendQ(con), Conn_SendMsg(con), Zip_SendBytes(con), Conn_SendBytes(con), Conn_RecvMsg(con), Zip_RecvBytes(con), Conn_RecvBytes(con), (long)(time_now - Conn_StartTime(con)))) return DISCONNECTED; continue; } #endif if (!IRC_WriteStrClient (from, RPL_STATSLINKINFO_MSG, Client_ID(from), Client_Mask(cl), Conn_SendQ(con), Conn_SendMsg(con), Conn_SendBytes(con), Conn_RecvMsg(con), Conn_RecvBytes(con), (long)(time_now - Conn_StartTime(con)))) return DISCONNECTED; } } break; case 'm': /* IRC command status (usage count) */ case 'M': cmd = Parse_GetCommandStruct(); for (; cmd->name; cmd++) { if (cmd->lcount == 0 && cmd->rcount == 0) continue; if (!IRC_WriteStrClient (from, RPL_STATSCOMMANDS_MSG, Client_ID(from), cmd->name, cmd->lcount, cmd->bytes, cmd->rcount)) return DISCONNECTED; } break; case 'u': /* Server uptime */ case 'U': time_now = time(NULL) - NGIRCd_Start; days = uptime_days(&time_now); hrs = uptime_hrs(&time_now); mins = uptime_mins(&time_now); if (!IRC_WriteStrClient(from, RPL_STATSUPTIME, Client_ID(from), days, hrs, mins, (unsigned int)time_now)) return DISCONNECTED; break; } return IRC_WriteStrClient(from, RPL_ENDOFSTATS_MSG, Client_ID(from), query); } /* IRC_STATS */ /** * Handler for the IRC command "SUMMON". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_SUMMON(CLIENT * Client, UNUSED REQUEST * Req) { assert(Client != NULL); return IRC_WriteErrClient(Client, ERR_SUMMONDISABLED_MSG, Client_ID(Client)); } /* IRC_SUMMON */ /** * Handler for the IRC command "TIME". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_TIME( CLIENT *Client, REQUEST *Req ) { CLIENT *from, *target; char t_str[64]; time_t t; assert(Client != NULL); assert(Req != NULL); IRC_SetPenalty(Client, 1); _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from) /* Forward? */ if (target != Client_ThisServer()) { IRC_WriteStrClientPrefix(target, from, "TIME %s", Client_ID(target)); return CONNECTED; } t = time( NULL ); (void)strftime(t_str, 60, "%A %B %d %Y -- %H:%M %Z", localtime(&t)); return IRC_WriteStrClient(from, RPL_TIME_MSG, Client_ID(from), Client_ID(Client_ThisServer()), t_str); } /* IRC_TIME */ /** * Handler for the IRC command "USERHOST". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_USERHOST(CLIENT *Client, REQUEST *Req) { char rpl[COMMAND_LEN]; CLIENT *c; int max, i; assert(Client != NULL); assert(Req != NULL); IRC_SetPenalty(Client, 1); if (Req->argc > 5) max = 5; else max = Req->argc; strlcpy(rpl, RPL_USERHOST_MSG, sizeof rpl); for (i = 0; i < max; i++) { c = Client_Search(Req->argv[i]); if (c && (Client_Type(c) == CLIENT_USER)) { /* This Nick is "online" */ strlcat(rpl, Client_ID(c), sizeof(rpl)); if (Client_HasMode(c, 'o')) strlcat(rpl, "*", sizeof(rpl)); strlcat(rpl, "=", sizeof(rpl)); if (Client_HasMode(c, 'a')) strlcat(rpl, "-", sizeof(rpl)); else strlcat(rpl, "+", sizeof(rpl)); strlcat(rpl, Client_User(c), sizeof(rpl)); strlcat(rpl, "@", sizeof(rpl)); strlcat(rpl, Client_HostnameDisplayed(c), sizeof(rpl)); strlcat(rpl, " ", sizeof(rpl)); } } ngt_TrimLastChr(rpl, ' '); return IRC_WriteStrClient(Client, rpl, Client_ID(Client)); } /* IRC_USERHOST */ /** * Handler for the IRC command "USERS". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_USERS(CLIENT * Client, UNUSED REQUEST * Req) { assert(Client != NULL); return IRC_WriteErrClient(Client, ERR_USERSDISABLED_MSG, Client_ID(Client)); } /* IRC_USERS */ /** * Handler for the IRC command "VERSION". * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_VERSION( CLIENT *Client, REQUEST *Req ) { CLIENT *target, *prefix; assert( Client != NULL ); assert( Req != NULL ); IRC_SetPenalty(Client, 1); _IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix) /* Forward? */ if (target != Client_ThisServer()) { IRC_WriteStrClientPrefix(target, prefix, "VERSION %s", Client_ID(target)); return CONNECTED; } /* send version information */ return IRC_WriteStrClient(Client, RPL_VERSION_MSG, Client_ID(prefix), PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition); } /* IRC_VERSION */ /** * Handler for the IRC "WHO" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_WHO(CLIENT *Client, REQUEST *Req) { bool only_ops; CHANNEL *chan; assert (Client != NULL); assert (Req != NULL); IRC_SetPenalty(Client, 1); only_ops = false; if (Req->argc == 2) { if (strcmp(Req->argv[1], "o") == 0) only_ops = true; #ifdef STRICT_RFC else { IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } #endif } if (Req->argc >= 1) { /* Channel or mask given */ chan = Channel_Search(Req->argv[0]); if (chan) { /* Members of a channel have been requested */ return IRC_WHO_Channel(Client, chan, only_ops); } if (strcmp(Req->argv[0], "0") != 0) { /* A mask has been given. But please note this RFC * stupidity: "0" is same as no arguments ... */ return IRC_WHO_Mask(Client, Req->argv[0], only_ops); } } /* No channel or (valid) mask given */ IRC_SetPenalty(Client, 2); return IRC_WHO_Mask(Client, NULL, only_ops); } /* IRC_WHO */ /** * Handler for the IRC "WHOIS" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_WHOIS( CLIENT *Client, REQUEST *Req ) { CLIENT *from, *target, *c; unsigned int match_count = 0, found = 0; bool has_wildcards, is_remote; bool got_wildcard = false; char mask[COMMAND_LEN], *query; assert( Client != NULL ); assert( Req != NULL ); IRC_SetPenalty(Client, 1); /* Wrong number of parameters? */ if (Req->argc < 1) return IRC_WriteErrClient(Client, ERR_NONICKNAMEGIVEN_MSG, Client_ID(Client)); _IRC_ARGC_LE_OR_RETURN_(Client, Req, 2) _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) /* Get target server for this command */ if (Req->argc > 1) { _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, Client) } else target = Client_ThisServer(); assert(target != NULL); /* Forward? */ if (target != Client_ThisServer()) { IRC_WriteStrClientPrefix(target, from, "WHOIS %s :%s", Req->argv[0], Req->argv[1]); return CONNECTED; } is_remote = Client_Conn(from) < 0; strlcpy(mask, Req->argv[Req->argc - 1], sizeof(mask)); for (query = strtok(ngt_LowerStr(mask), ","); query && found < 3; query = strtok(NULL, ","), found++) { has_wildcards = query[strcspn(query, "*?")] != 0; /* * follows ircd 2.10 implementation: * - handle up to 3 targets * - no wildcards for remote clients * - only one wildcard target per local client * * Also, at most MAX_RPL_WHOIS matches are returned. */ if (!has_wildcards || is_remote) { c = Client_Search(query); if (c && (Client_Type(c) == CLIENT_USER || Client_Type(c) == CLIENT_SERVICE)) { if (!IRC_WHOIS_SendReply(Client, from, c)) return DISCONNECTED; } else { if (!IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), query)) return DISCONNECTED; } continue; } if (got_wildcard) { /* we already handled one wildcard query */ if (!IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), query)) return DISCONNECTED; continue; } got_wildcard = true; IRC_SetPenalty(Client, 3); for (c = Client_First(); c; c = Client_Next(c)) { if (IRC_CheckListTooBig(Client, match_count, MAX_RPL_WHOIS, "WHOIS")) break; if (Client_Type(c) != CLIENT_USER) continue; if (!MatchCaseInsensitive(query, Client_ID(c))) continue; if (!IRC_WHOIS_SendReply(Client, from, c)) return DISCONNECTED; match_count++; } if (match_count == 0) IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->argv[Req->argc - 1]); } return IRC_WriteStrClient(from, RPL_ENDOFWHOIS_MSG, Client_ID(from), Req->argv[Req->argc - 1]); } /* IRC_WHOIS */ /** * Handler for the IRC "WHOWAS" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_WHOWAS( CLIENT *Client, REQUEST *Req ) { CLIENT *target, *prefix; WHOWAS *whowas; char tok_buf[COMMAND_LEN]; int max, last, count, i, nc; const char *nick; assert( Client != NULL ); assert( Req != NULL ); /* Wrong number of parameters? */ if (Req->argc < 1) return IRC_WriteErrClient(Client, ERR_NONICKNAMEGIVEN_MSG, Client_ID(Client)); _IRC_ARGC_LE_OR_RETURN_(Client, Req, 3) _IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 2, prefix) /* Do not reveal any info on disconnected users? */ if (Conf_MorePrivacy) return CONNECTED; /* Forward? */ if (target != Client_ThisServer()) { IRC_WriteStrClientPrefix(target, prefix, "WHOWAS %s %s %s", Req->argv[0], Req->argv[1], Client_ID(target)); return CONNECTED; } whowas = Client_GetWhowas( ); last = Client_GetLastWhowasIndex( ); if (last < 0) last = 0; max = DEF_RPL_WHOWAS; if (Req->argc > 1) { max = atoi(Req->argv[1]); if (max < 1) max = MAX_RPL_WHOWAS; } /* * Break up the nick argument into a list of nicks, if applicable * Can't modify Req->argv[0] because we need it for RPL_ENDOFWHOWAS_MSG. */ strlcpy(tok_buf, Req->argv[0], sizeof(tok_buf)); nick = strtok(tok_buf, ","); for (i=last, count=0; nick != NULL ; nick = strtok(NULL, ",")) { nc = 0; do { /* Used entry? */ if (whowas[i].time > 0 && strcasecmp(nick, whowas[i].id) == 0) { if (!WHOWAS_EntryWrite(prefix, &whowas[i])) return DISCONNECTED; nc++; count++; } /* previous entry */ i--; /* "underflow", wrap around */ if (i < 0) i = MAX_WHOWAS - 1; if (nc && count >= max) break; } while (i != last); if (nc == 0 && !IRC_WriteErrClient(prefix, ERR_WASNOSUCHNICK_MSG, Client_ID(prefix), nick)) return DISCONNECTED; } return IRC_WriteStrClient(prefix, RPL_ENDOFWHOWAS_MSG, Client_ID(prefix), Req->argv[0]); } /* IRC_WHOWAS */ /** * Send LUSERS reply to a client. * * @param Client The receipient of the information. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_Send_LUSERS(CLIENT *Client) { unsigned long cnt; #ifndef STRICT_RFC unsigned long max; #endif assert(Client != NULL); /* Users, services and servers in the network */ if (!IRC_WriteStrClient(Client, RPL_LUSERCLIENT_MSG, Client_ID(Client), Client_UserCount(), Client_ServiceCount(), Client_ServerCount())) return DISCONNECTED; /* Number of IRC operators */ cnt = Client_OperCount( ); if (cnt > 0) { if (!IRC_WriteStrClient(Client, RPL_LUSEROP_MSG, Client_ID(Client), cnt)) return DISCONNECTED; } /* Unknown connections */ cnt = Client_UnknownCount( ); if (cnt > 0) { if (!IRC_WriteStrClient(Client, RPL_LUSERUNKNOWN_MSG, Client_ID(Client), cnt)) return DISCONNECTED; } /* Number of created channels */ if (!IRC_WriteStrClient(Client, RPL_LUSERCHANNELS_MSG, Client_ID(Client), Channel_CountVisible(Client))) return DISCONNECTED; /* Number of local users, services and servers */ if (!IRC_WriteStrClient(Client, RPL_LUSERME_MSG, Client_ID(Client), Client_MyUserCount(), Client_MyServiceCount(), Client_MyServerCount())) return DISCONNECTED; #ifndef STRICT_RFC /* Maximum number of local users */ cnt = Client_MyUserCount(); max = Client_MyMaxUserCount(); if (! IRC_WriteStrClient(Client, RPL_LOCALUSERS_MSG, Client_ID(Client), cnt, max, cnt, max)) return DISCONNECTED; /* Maximum number of users in the network */ cnt = Client_UserCount(); max = Client_MaxUserCount(); if(! IRC_WriteStrClient(Client, RPL_NETUSERS_MSG, Client_ID(Client), cnt, max, cnt, max)) return DISCONNECTED; /* Connection counters */ if (! IRC_WriteStrClient(Client, RPL_STATSCONN_MSG, Client_ID(Client), Conn_CountMax(), Conn_CountAccepted())) return DISCONNECTED; #endif return CONNECTED; } /* IRC_Send_LUSERS */ GLOBAL bool IRC_Show_MOTD( CLIENT *Client ) { const char *line; size_t len_tot, len_str; assert( Client != NULL ); len_tot = array_bytes(&Conf_Motd); if (len_tot == 0 && !Conn_UsesSSL(Client_Conn(Client))) return IRC_WriteErrClient(Client, ERR_NOMOTD_MSG, Client_ID(Client)); if (!IRC_WriteStrClient(Client, RPL_MOTDSTART_MSG, Client_ID(Client), Client_ID(Client_ThisServer()))) return DISCONNECTED; line = array_start(&Conf_Motd); while (len_tot > 0) { len_str = strlen(line) + 1; assert(len_tot >= len_str); len_tot -= len_str; if (!IRC_WriteStrClient(Client, RPL_MOTD_MSG, Client_ID(Client), line)) return DISCONNECTED; line += len_str; } if (!Show_MOTD_SSLInfo(Client)) return DISCONNECTED; if (!IRC_WriteStrClient(Client, RPL_ENDOFMOTD_MSG, Client_ID(Client))) return DISCONNECTED; if (*Conf_CloakHost) return IRC_WriteStrClient(Client, RPL_HOSTHIDDEN_MSG, Client_ID(Client), Client_Hostname(Client)); return CONNECTED; } /* IRC_Show_MOTD */ /** * Send NAMES reply for a specific client and channel. * * @param Client The client requesting the NAMES information. * @param Chan The channel * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan) { bool is_visible, is_member; char str[COMMAND_LEN]; CL2CHAN *cl2chan; CLIENT *cl; assert(Client != NULL); assert(Chan != NULL); if (Channel_IsMemberOf(Chan, Client)) is_member = true; else is_member = false; /* Do not print info on channel memberships to anyone that is not member? */ if (Conf_MorePrivacy && !is_member) return CONNECTED; /* Secret channel? */ if (!is_member && Channel_HasMode(Chan, 's')) return CONNECTED; snprintf(str, sizeof(str), RPL_NAMREPLY_MSG, Client_ID(Client), "=", Channel_Name(Chan)); cl2chan = Channel_FirstMember(Chan); while (cl2chan) { cl = Channel_GetClient(cl2chan); if (Client_HasMode(cl, 'i')) is_visible = false; else is_visible = true; if (is_member || is_visible) { if (str[strlen(str) - 1] != ':') strlcat(str, " ", sizeof(str)); who_flags_qualifier(Client, Channel_UserModes(Chan, cl), str, sizeof(str)); strlcat(str, Client_ID(cl), sizeof(str)); if (strlen(str) > (COMMAND_LEN - CLIENT_NICK_LEN - 4)) { if (!IRC_WriteStrClient(Client, "%s", str)) return DISCONNECTED; snprintf(str, sizeof(str), RPL_NAMREPLY_MSG, Client_ID(Client), "=", Channel_Name(Chan)); } } cl2chan = Channel_NextMember(Chan, cl2chan); } if (str[strlen(str) - 1] != ':') { if (!IRC_WriteStrClient(Client, "%s", str)) return DISCONNECTED; } return CONNECTED; } /* IRC_Send_NAMES */ /** * Send the ISUPPORT numeric (005). * This numeric indicates the features that are supported by this server. * See for details. */ GLOBAL bool IRC_Send_ISUPPORT(CLIENT * Client) { if (!IRC_WriteStrClient(Client, RPL_ISUPPORT1_MSG, Client_ID(Client), CHANTYPES, CHANTYPES, Conf_MaxJoins)) return DISCONNECTED; return IRC_WriteStrClient(Client, RPL_ISUPPORT2_MSG, Client_ID(Client), CHANNEL_NAME_LEN - 1, Conf_MaxNickLength - 1, COMMAND_LEN - 23, CLIENT_AWAY_LEN - 1, COMMAND_LEN - 113, MAX_HNDL_MODES_ARG, MAX_HNDL_CHANNEL_LISTS); } /* IRC_Send_ISUPPORT */ /* -eof- */ ngircd-21/src/ngircd/numeric.h0000644000175000116100000000133311526006312013325 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2007 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #ifndef __numeric_h__ #define __numeric_h__ /** * @file * Handlers for IRC numerics sent to the server (header) */ GLOBAL bool IRC_Num_ENDOFMOTD PARAMS((CLIENT *Client, UNUSED REQUEST *Req)); GLOBAL bool IRC_Num_ISUPPORT PARAMS((CLIENT *Client, REQUEST *Req)); #endif /* -eof- */ ngircd-21/src/ngircd/conf-ssl.h0000644000175000116100000000172112206130744013413 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon */ #ifndef conf_ssl_h #define conf_ssl_h /** * @file * SSL related definitions */ #ifdef HAVE_LIBSSL #define SSL_SUPPORT #include #endif #ifdef HAVE_LIBGNUTLS #define SSL_SUPPORT #include #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_t gnutls_session; void *cookie; /* pointer to server configuration structure (for outgoing connections), or NULL. */ #endif char *fingerprint; }; #endif bool ConnSSL_InitLibrary(void); #endif /* conf_ssl_h */ /* -eof- */ ngircd-21/src/ngircd/lists.c0000644000175000116100000002025712206130744013025 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * Management of IRC lists: ban, invite, etc. */ #include "imp.h" #include #include "defines.h" #include "conn.h" #include "channel.h" #include "log.h" #include "match.h" #include "messages.h" #include "irc-write.h" #include #include #include #include "exp.h" #include "lists.h" struct list_elem { struct list_elem *next; /** pointer to next list element */ char mask[MASK_LEN]; /** IRC mask */ char *reason; /** Optional "reason" text */ time_t valid_until; /** 0: unlimited; 1: once; t(>1): until t */ }; /** * Get IRC mask stored in list element. * * @param list_elem List element. * @return Pointer to IRC mask */ GLOBAL const char * Lists_GetMask(const struct list_elem *e) { assert(e != NULL); return e->mask; } /** * Get optional "reason" text stored in list element. * * @param list_elem List element. * @return Pointer to "reason" text or empty string (""). */ GLOBAL const char * Lists_GetReason(const struct list_elem *e) { assert(e != NULL); return e->reason ? e->reason : ""; } /** * Get "validity" value stored in list element. * * @param list_elem List element. * @return Validity: 0=unlimited, 1=once, >1 until this time stamp. */ GLOBAL time_t Lists_GetValidity(const struct list_elem *e) { assert(e != NULL); return e->valid_until; } /** * Get first list element of a list. * * @param h List head. * @return Pointer to first list element. */ GLOBAL struct list_elem* Lists_GetFirst(const struct list_head *h) { assert(h != NULL); return h->first; } /** * Get next list element of a list. * * @param e Current list element. * @return Pointer to next list element. */ GLOBAL struct list_elem* Lists_GetNext(const struct list_elem *e) { assert(e != NULL); return e->next; } /** * Add a new mask to a list. * * @param h List head. * @param Mask The IRC mask to add to the list. * @param ValidUntil 0: unlimited, 1: only once, t>1: until given time_t. * @param Reason Reason string or NULL, if no reason should be saved. * @return true on success, false otherwise. */ bool Lists_Add(struct list_head *h, const char *Mask, time_t ValidUntil, const char *Reason) { struct list_elem *e, *newelem; assert(h != NULL); assert(Mask != NULL); e = Lists_CheckDupeMask(h, Mask); if (e) { e->valid_until = ValidUntil; if (Reason) { if (e->reason) free(e->reason); e->reason = strdup(Reason); } return true; } e = Lists_GetFirst(h); newelem = malloc(sizeof(struct list_elem)); if (!newelem) { Log(LOG_EMERG, "Can't allocate memory for new list entry!"); return false; } strlcpy(newelem->mask, Mask, sizeof(newelem->mask)); if (Reason) { newelem->reason = strdup(Reason); if (!newelem->reason) Log(LOG_EMERG, "Can't allocate memory for new list reason text!"); } else newelem->reason = NULL; newelem->valid_until = ValidUntil; newelem->next = e; h->first = newelem; return true; } /** * Delete a list element from a list. * * @param h List head. * @param p Pointer to previous list element or NULL, if there is none. * @param victim List element to delete. */ static void Lists_Unlink(struct list_head *h, struct list_elem *p, struct list_elem *victim) { assert(victim != NULL); assert(h != NULL); if (p) p->next = victim->next; else h->first = victim->next; if (victim->reason) free(victim->reason); free(victim); } /** * Delete a given IRC mask from a list. * * @param h List head. * @param Mask IRC mask to delete from the list. */ GLOBAL void Lists_Del(struct list_head *h, const char *Mask) { struct list_elem *e, *last, *victim; assert(h != NULL); assert(Mask != NULL); last = NULL; e = Lists_GetFirst(h); while (e) { if (strcasecmp(e->mask, Mask) == 0) { LogDebug("Deleted \"%s\" from list", e->mask); victim = e; e = victim->next; Lists_Unlink(h, last, victim); continue; } last = e; e = e->next; } } /** * Free a complete list. * * @param head List head. */ GLOBAL void Lists_Free(struct list_head *head) { struct list_elem *e, *victim; assert(head != NULL); e = head->first; head->first = NULL; while (e) { LogDebug("Deleted \"%s\" from list" , e->mask); victim = e; e = e->next; if (victim->reason) free(victim->reason); free(victim); } } /** * Check if an IRC mask is already contained in a list. * * @param h List head. * @param Mask IRC mask to test. * @return true if mask is already stored in the list, false otherwise. */ GLOBAL struct list_elem * Lists_CheckDupeMask(const struct list_head *h, const char *Mask ) { struct list_elem *e; e = h->first; while (e) { if (strcasecmp(e->mask, Mask) == 0) return e; e = e->next; } return NULL; } /** * Generate a valid IRC mask from "any" string given. * * @param Pattern Source string to generate an IRC mask for. * @param mask Buffer to store the mask. * @param len Size of the buffer. */ GLOBAL void Lists_MakeMask(const char *Pattern, char *mask, size_t len) { char *excl, *at; assert(Pattern != NULL); excl = strchr(Pattern, '!'); at = strchr(Pattern, '@'); if (at && at < excl) excl = NULL; if (!at && !excl) { /* Neither "!" nor "@" found: use string as nickname */ strlcpy(mask, Pattern, len - 5); strlcat(mask, "!*@*", len); } else if (!at && excl) { /* Domain part is missing */ strlcpy(mask, Pattern, len - 3); strlcat(mask, "@*", len); } else if (at && !excl) { /* User name is missing */ *at = '\0'; at++; strlcpy(mask, Pattern, len - 5); strlcat(mask, "!*@", len); strlcat(mask, at, len); } else { /* All parts (nick, user and domain name) are given */ strlcpy(mask, Pattern, len); } } /* Lists_MakeMask */ /** * Check if a client is listed in a list. * * @param h List head. * @param Client Client to check. * @return true if client is listed, false if not. */ bool Lists_Check(struct list_head *h, CLIENT *Client) { return Lists_CheckReason(h, Client, NULL, 0); } /** * Check if a client is listed in a list and store the reason. * * @param h List head. * @param Client Client to check. * @param reason Buffer to store the reason. * @param len Size of the buffer if reason should be saved. * @return true if client is listed, false if not. */ bool Lists_CheckReason(struct list_head *h, CLIENT *Client, char *reason, size_t len) { struct list_elem *e, *last, *next; assert(h != NULL); e = h->first; last = NULL; while (e) { next = e->next; if (Match(e->mask, Client_MaskCloaked(Client))) { if (len && e->reason) strlcpy(reason, e->reason, len); if (e->valid_until == 1) { /* Entry is valid only once, delete it */ LogDebug("Deleted \"%s\" from list (used).", e->mask); Lists_Unlink(h, last, e); } return true; } last = e; e = next; } return false; } /** * Check list and purge expired entries. * * @param h List head. */ GLOBAL void Lists_Expire(struct list_head *h, const char *ListName) { struct list_elem *e, *last, *next; time_t now; assert(h != NULL); e = h->first; last = NULL; now = time(NULL); while (e) { next = e->next; if (e->valid_until > 1 && e->valid_until < now) { /* Entry is expired, delete it */ if (e->reason) Log(LOG_INFO, "Deleted \"%s\" (\"%s\") from %s list (expired).", e->mask, e->reason, ListName); else Log(LOG_INFO, "Deleted \"%s\" from %s list (expired).", e->mask, ListName); Lists_Unlink(h, last, e); e = next; continue; } last = e; e = next; } } /** * Return the number of entries of a list. * * @param h List head. * @return Number of items. */ GLOBAL unsigned long Lists_Count(struct list_head *h) { struct list_elem *e; unsigned long count = 0; assert(h != NULL); e = h->first; while (e) { count++; e = e->next; } return count; } /* -eof- */ ngircd-21/src/ngircd/irc-cap.h0000644000175000116100000000120211746622422013206 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2010 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. */ #ifndef __irc_cap_h__ #define __irc_cap_h__ /** * @file * Handler for IRC capability ("CAP") commands (header) */ GLOBAL bool IRC_CAP PARAMS((CLIENT *Client, REQUEST *Req)); #endif /* -eof- */ ngircd-21/src/ngircd/irc-channel.h0000644000175000116100000000156611526006312014056 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #ifndef __irc_channel_h__ #define __irc_channel_h__ /** * @file * IRC channel commands (header) */ GLOBAL bool IRC_JOIN PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_PART PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_TOPIC PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_LIST PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_CHANINFO PARAMS((CLIENT *Client, REQUEST *Req )); #endif /* -eof- */ ngircd-21/src/ngircd/ngircd.c0000644000175000116100000004717412227561010013141 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * The main program, including the C function main() which is called * by the loader of the operating system. */ #include "imp.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined(DEBUG) && defined(HAVE_MTRACE) #include #endif #include "defines.h" #include "conn.h" #include "class.h" #include "conf-ssl.h" #include "channel.h" #include "conf.h" #include "lists.h" #include "log.h" #include "parse.h" #include "sighandlers.h" #include "io.h" #include "irc.h" #include "exp.h" #include "ngircd.h" static void Show_Version PARAMS(( void )); static void Show_Help PARAMS(( void )); static void Pidfile_Create PARAMS(( pid_t pid )); static void Pidfile_Delete PARAMS(( void )); static void Fill_Version PARAMS(( void )); static void Random_Init PARAMS(( void )); static void Setup_FDStreams PARAMS(( int fd )); static bool NGIRCd_Init PARAMS(( bool )); /** * The main() function of ngIRCd. * * Here all starts: this function is called by the operating system loader, * it is the first portion of code executed of ngIRCd. * * @param argc The number of arguments passed to ngIRCd on the command line. * @param argv An array containing all the arguments passed to ngIRCd. * @return Global exit code of ngIRCd, zero on success. */ GLOBAL int main(int argc, const char *argv[]) { bool ok, configtest = false; bool NGIRCd_NoDaemon = false; int i; size_t n; #if defined(DEBUG) && defined(HAVE_MTRACE) /* enable GNU libc memory tracing when running in debug mode * and functionality available */ mtrace(); #endif umask(0077); NGIRCd_SignalQuit = NGIRCd_SignalRestart = false; NGIRCd_Passive = false; #ifdef DEBUG NGIRCd_Debug = false; #endif #ifdef SNIFFER NGIRCd_Sniffer = false; #endif strlcpy(NGIRCd_ConfFile, SYSCONFDIR, sizeof(NGIRCd_ConfFile)); strlcat(NGIRCd_ConfFile, CONFIG_FILE, sizeof(NGIRCd_ConfFile)); Fill_Version(); /* parse conmmand line */ for (i = 1; i < argc; i++) { ok = false; if (argv[i][0] == '-' && argv[i][1] == '-') { /* long option */ if (strcmp(argv[i], "--config") == 0) { if (i + 1 < argc) { /* Ok, there's an parameter left */ strlcpy(NGIRCd_ConfFile, argv[i+1], sizeof(NGIRCd_ConfFile)); /* next parameter */ i++; ok = true; } } if (strcmp(argv[i], "--configtest") == 0) { configtest = true; ok = true; } #ifdef DEBUG if (strcmp(argv[i], "--debug") == 0) { NGIRCd_Debug = true; ok = true; } #endif if (strcmp(argv[i], "--help") == 0) { Show_Version(); puts(""); Show_Help( ); puts( "" ); exit(1); } if (strcmp(argv[i], "--nodaemon") == 0) { NGIRCd_NoDaemon = true; ok = true; } if (strcmp(argv[i], "--passive") == 0) { NGIRCd_Passive = true; ok = true; } #ifdef SNIFFER if (strcmp(argv[i], "--sniffer") == 0) { NGIRCd_Sniffer = true; ok = true; } #endif if (strcmp(argv[i], "--version") == 0) { Show_Version(); exit(1); } } else if(argv[i][0] == '-' && argv[i][1] != '-') { /* short option */ for (n = 1; n < strlen(argv[i]); n++) { ok = false; #ifdef DEBUG if (argv[i][n] == 'd') { NGIRCd_Debug = true; ok = true; } #endif if (argv[i][n] == 'f') { if (!argv[i][n+1] && i+1 < argc) { /* Ok, next character is a blank */ strlcpy(NGIRCd_ConfFile, argv[i+1], sizeof(NGIRCd_ConfFile)); /* go to the following parameter */ i++; n = strlen(argv[i]); ok = true; } } if (argv[i][n] == 'h') { Show_Version(); puts(""); Show_Help(); puts(""); exit(1); } if (argv[i][n] == 'n') { NGIRCd_NoDaemon = true; ok = true; } if (argv[i][n] == 'p') { NGIRCd_Passive = true; ok = true; } #ifdef SNIFFER if (argv[i][n] == 's') { NGIRCd_Sniffer = true; ok = true; } #endif if (argv[i][n] == 't') { configtest = true; ok = true; } if (argv[i][n] == 'V') { Show_Version(); exit(1); } if (!ok) { printf("%s: invalid option \"-%c\"!\n", PACKAGE_NAME, argv[i][n]); printf("Try \"%s --help\" for more information.\n", PACKAGE_NAME); exit(1); } } } if (!ok) { printf("%s: invalid option \"%s\"!\n", PACKAGE_NAME, argv[i]); printf("Try \"%s --help\" for more information.\n", PACKAGE_NAME); exit(1); } } /* Debug level for "VERSION" command */ NGIRCd_DebugLevel[0] = '\0'; #ifdef DEBUG if (NGIRCd_Debug) strcpy(NGIRCd_DebugLevel, "1"); #endif #ifdef SNIFFER if (NGIRCd_Sniffer) { NGIRCd_Debug = true; strcpy(NGIRCd_DebugLevel, "2"); } #endif if (configtest) { Show_Version(); puts(""); exit(Conf_Test()); } while (!NGIRCd_SignalQuit) { /* Initialize global variables */ NGIRCd_Start = time(NULL); (void)strftime(NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime(&NGIRCd_Start)); NGIRCd_SignalRestart = false; NGIRCd_SignalQuit = false; /* Initialize modules, part I */ Log_Init(!NGIRCd_NoDaemon); Random_Init(); Conf_Init(); Log_ReInit(); /* Initialize the "main program": chroot environment, user and * group ID, ... */ if (!NGIRCd_Init(NGIRCd_NoDaemon)) { Log(LOG_ALERT, "Fatal: Initialization failed, exiting!"); exit(1); } /* Initialize modules, part II: these functions are eventually * called with already dropped privileges ... */ Channel_Init(); Client_Init(); Conn_Init(); Class_Init(); if (!io_library_init(CONNECTION_POOL)) { Log(LOG_ALERT, "Fatal: Could not initialize IO routines: %s", strerror(errno)); exit(1); } if (!Signals_Init()) { Log(LOG_ALERT, "Fatal: Could not set up signal handlers: %s", strerror(errno)); exit(1); } /* Create protocol and server identification. The syntax * used by ngIRCd in PASS commands and the known "extended * flags" are described in doc/Protocol.txt. */ #ifdef IRCPLUS snprintf(NGIRCd_ProtoID, sizeof NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE_NAME, PACKAGE_VERSION, IRCPLUSFLAGS); #ifdef ZLIB strlcat(NGIRCd_ProtoID, "Z", sizeof NGIRCd_ProtoID); #endif if (Conf_OperCanMode) strlcat(NGIRCd_ProtoID, "o", sizeof NGIRCd_ProtoID); #else /* IRCPLUS */ snprintf(NGIRCd_ProtoID, sizeof NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE_NAME, PACKAGE_VERSION); #endif /* IRCPLUS */ strlcat(NGIRCd_ProtoID, " P", sizeof NGIRCd_ProtoID); #ifdef ZLIB strlcat(NGIRCd_ProtoID, "Z", sizeof NGIRCd_ProtoID); #endif LogDebug("Protocol and server ID is \"%s\".", NGIRCd_ProtoID); Channel_InitPredefined(); if (Conn_InitListeners() < 1) { Log(LOG_ALERT, "Server isn't listening on a single port!" ); Log(LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME); Pidfile_Delete(); exit(1); } /* Main Run Loop */ Conn_Handler(); Conn_Exit(); Client_Exit(); Channel_Exit(); Class_Exit(); Log_Exit(); Signals_Exit(); } Pidfile_Delete(); return 0; } /* main */ /** * Generate ngIRCd "version strings". * * The ngIRCd version information is generated once and then stored in the * NGIRCd_Version and NGIRCd_VersionAddition string variables for further * usage, for example by the IRC command "VERSION" and the --version command * line switch. */ static void Fill_Version(void) { NGIRCd_VersionAddition[0] = '\0'; #ifdef ICONV if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition); strlcat(NGIRCd_VersionAddition, "CHARCONV", sizeof NGIRCd_VersionAddition); #endif #ifdef DEBUG if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition); strlcat(NGIRCd_VersionAddition, "DEBUG", sizeof NGIRCd_VersionAddition); #endif #ifdef IDENTAUTH if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition); strlcat(NGIRCd_VersionAddition, "IDENT", sizeof NGIRCd_VersionAddition); #endif #ifdef WANT_IPV6 if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof(NGIRCd_VersionAddition)); strlcat(NGIRCd_VersionAddition, "IPv6", sizeof(NGIRCd_VersionAddition)); #endif #ifdef IRCPLUS if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition); strlcat(NGIRCd_VersionAddition, "IRCPLUS", sizeof NGIRCd_VersionAddition); #endif #ifdef PAM if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition); strlcat(NGIRCd_VersionAddition, "PAM", sizeof NGIRCd_VersionAddition); #endif #ifdef STRICT_RFC if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition); strlcat(NGIRCd_VersionAddition, "RFC", sizeof NGIRCd_VersionAddition); #endif #ifdef SNIFFER if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition); strlcat(NGIRCd_VersionAddition, "SNIFFER", sizeof NGIRCd_VersionAddition); #endif #ifdef SSL_SUPPORT if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition); strlcat(NGIRCd_VersionAddition, "SSL", sizeof NGIRCd_VersionAddition); #endif #ifdef SYSLOG if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition); strlcat(NGIRCd_VersionAddition, "SYSLOG", sizeof NGIRCd_VersionAddition); #endif #ifdef TCPWRAP if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition); strlcat(NGIRCd_VersionAddition, "TCPWRAP", sizeof NGIRCd_VersionAddition); #endif #ifdef ZLIB if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition); strlcat(NGIRCd_VersionAddition, "ZLIB", sizeof NGIRCd_VersionAddition); #endif if (NGIRCd_VersionAddition[0]) strlcat(NGIRCd_VersionAddition, "-", sizeof(NGIRCd_VersionAddition)); strlcat(NGIRCd_VersionAddition, HOST_CPU, sizeof(NGIRCd_VersionAddition)); strlcat(NGIRCd_VersionAddition, "/", sizeof(NGIRCd_VersionAddition)); strlcat(NGIRCd_VersionAddition, HOST_VENDOR, sizeof(NGIRCd_VersionAddition)); strlcat(NGIRCd_VersionAddition, "/", sizeof(NGIRCd_VersionAddition)); strlcat(NGIRCd_VersionAddition, HOST_OS, sizeof(NGIRCd_VersionAddition)); snprintf(NGIRCd_Version, sizeof NGIRCd_Version, "%s %s-%s", PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_VersionAddition); } /* Fill_Version */ /** * Display copyright and version information of ngIRCd on the console. */ static void Show_Version( void ) { puts( NGIRCd_Version ); puts( "Copyright (c)2001-2013 Alexander Barton () and Contributors." ); puts( "Homepage: \n" ); puts( "This is free software; see the source for copying conditions. There is NO" ); puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." ); } /* Show_Version */ /** * Display a short help text on the console. * This help depends on the configuration of the executable and only shows * options that are actually enabled. */ static void Show_Help( void ) { #ifdef DEBUG puts( " -d, --debug log extra debug messages" ); #endif puts( " -f, --config use file as configuration file" ); puts( " -n, --nodaemon don't fork and don't detach from controlling terminal" ); puts( " -p, --passive disable automatic connections to other servers" ); #ifdef SNIFFER puts( " -s, --sniffer enable network sniffer and display all IRC traffic" ); #endif puts( " -t, --configtest read, validate and display configuration; then exit" ); puts( " -V, --version output version information and exit" ); puts( " -h, --help display this help and exit" ); } /* Show_Help */ /** * Delete the file containing the process ID (PID). */ static void Pidfile_Delete( void ) { /* Pidfile configured? */ if( ! Conf_PidFile[0] ) return; #ifdef DEBUG Log( LOG_DEBUG, "Removing PID file (%s) ...", Conf_PidFile ); #endif if( unlink( Conf_PidFile )) Log( LOG_ERR, "Error unlinking PID file (%s): %s", Conf_PidFile, strerror( errno )); } /* Pidfile_Delete */ /** * Create the file containing the process ID of ngIRCd ("PID file"). * * @param pid The process ID to be stored in this file. */ static void Pidfile_Create(pid_t pid) { int pidfd; char pidbuf[64]; int len; /* Pidfile configured? */ if( ! Conf_PidFile[0] ) return; #ifdef DEBUG Log( LOG_DEBUG, "Creating PID file (%s) ...", Conf_PidFile ); #endif pidfd = open( Conf_PidFile, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); if ( pidfd < 0 ) { Log( LOG_ERR, "Error writing PID file (%s): %s", Conf_PidFile, strerror( errno )); return; } len = snprintf(pidbuf, sizeof pidbuf, "%ld\n", (long)pid); if (len < 0 || len >= (int)sizeof pidbuf) { Log(LOG_ERR, "Error converting process ID!"); close(pidfd); return; } if (write(pidfd, pidbuf, (size_t)len) != (ssize_t)len) Log(LOG_ERR, "Can't write PID file (%s): %s!", Conf_PidFile, strerror(errno)); if (close(pidfd) != 0) Log(LOG_ERR, "Error closing PID file (%s): %s!", Conf_PidFile, strerror(errno)); } /* Pidfile_Create */ /** * Redirect stdin, stdout and stderr to appropriate file handles. * * @param fd The file handle stdin, stdout and stderr should be redirected to. */ static void Setup_FDStreams(int fd) { if (fd < 0) return; fflush(stdout); fflush(stderr); /* Create new stdin(0), stdout(1) and stderr(2) descriptors */ dup2( fd, 0 ); dup2( fd, 1 ); dup2( fd, 2 ); } /* Setup_FDStreams */ #if !defined(SINGLE_USER_OS) /** * Get user and group ID of unprivileged "nobody" user. * * @param uid User ID * @param gid Group ID * @return true on success. */ static bool NGIRCd_getNobodyID(uid_t *uid, gid_t *gid ) { struct passwd *pwd; #ifdef __CYGWIN__ /* Cygwin kludge. * It can return EINVAL instead of EPERM * so, if we are already unprivileged, * use id of current user. */ if (geteuid() && getuid()) { *uid = getuid(); *gid = getgid(); return true; } #endif pwd = getpwnam("nobody"); if (!pwd) return false; if (!pwd->pw_uid || !pwd->pw_gid) return false; *uid = pwd->pw_uid; *gid = pwd->pw_gid; endpwent(); return true; } /* NGIRCd_getNobodyID */ #endif #ifdef HAVE_ARC4RANDOM static void Random_Init(void) { } #else static bool Random_Init_Kern(const char *file) { unsigned int seed; bool ret = false; int fd = open(file, O_RDONLY); if (fd >= 0) { if (read(fd, &seed, sizeof(seed)) == sizeof(seed)) ret = true; close(fd); srand(seed); } return ret; } /** * Initialize libc rand(3) number generator */ static void Random_Init(void) { if (Random_Init_Kern("/dev/urandom")) return; if (Random_Init_Kern("/dev/random")) return; if (Random_Init_Kern("/dev/arandom")) return; srand(rand() ^ (unsigned)getpid() ^ (unsigned)time(NULL)); } #endif /** * Initialize ngIRCd daemon. * * @param NGIRCd_NoDaemon Set to true if ngIRCd should run in the * foreground (and not as a daemon). * @return true on success. */ static bool NGIRCd_Init(bool NGIRCd_NoDaemon) { static bool initialized; bool chrooted = false; struct passwd *pwd; struct group *grp; int real_errno, fd = -1; pid_t pid; if (initialized) return true; if (!NGIRCd_NoDaemon) { /* open /dev/null before chroot() */ fd = open( "/dev/null", O_RDWR); if (fd < 0) Log(LOG_WARNING, "Could not open /dev/null: %s", strerror(errno)); } /* SSL initialization */ if (!ConnSSL_InitLibrary()) { Log(LOG_ERR, "Error during SSL initialization!"); goto out; } /* Change root */ if (Conf_Chroot[0]) { if (chdir(Conf_Chroot) != 0) { Log(LOG_ERR, "Can't chdir() in ChrootDir (%s): %s!", Conf_Chroot, strerror(errno)); goto out; } if (chroot(Conf_Chroot) != 0) { Log(LOG_ERR, "Can't change root directory to \"%s\": %s!", Conf_Chroot, strerror(errno)); goto out; } else { chrooted = true; Log(LOG_INFO, "Changed root and working directory to \"%s\".", Conf_Chroot); } } #if !defined(SINGLE_USER_OS) /* Check user ID */ if (Conf_UID == 0) { pwd = getpwuid(0); Log(LOG_INFO, "ServerUID must not be %s(0), using \"nobody\" instead.", pwd ? pwd->pw_name : "?"); if (!NGIRCd_getNobodyID(&Conf_UID, &Conf_GID)) { Log(LOG_WARNING, "Could not get user/group ID of user \"nobody\": %s", errno ? strerror(errno) : "not found" ); goto out; } } /* Change group ID */ if (getgid() != Conf_GID) { if (setgid(Conf_GID) != 0) { real_errno = errno; grp = getgrgid(Conf_GID); Log(LOG_ERR, "Can't change group ID to %s(%u): %s!", grp ? grp->gr_name : "?", Conf_GID, strerror(real_errno)); if (real_errno != EPERM) goto out; } if (setgroups(0, NULL) != 0) { real_errno = errno; Log(LOG_ERR, "Can't drop supplementary group IDs: %s!", strerror(errno)); if (real_errno != EPERM) goto out; } } #endif /* Change user ID */ if (getuid() != Conf_UID) { if (setuid(Conf_UID) != 0) { real_errno = errno; pwd = getpwuid(Conf_UID); Log(LOG_ERR, "Can't change user ID to %s(%u): %s!", pwd ? pwd->pw_name : "?", Conf_UID, strerror(real_errno)); if (real_errno != EPERM) goto out; } } initialized = true; /* Normally a child process is forked which isn't any longer * connected to ther controlling terminal. Use "--nodaemon" * to disable this "daemon mode" (useful for debugging). */ if (!NGIRCd_NoDaemon) { pid = fork(); if (pid > 0) { /* "Old" process: exit. */ exit(0); } if (pid < 0) { /* Error!? */ fprintf(stderr, "%s: Can't fork: %s!\nFatal error, exiting now ...\n", PACKAGE_NAME, strerror(errno)); exit(1); } /* New child process */ #ifdef HAVE_SETSID (void)setsid(); #else setpgrp(0, getpid()); #endif if (chdir("/") != 0) Log(LOG_ERR, "Can't change directory to '/': %s!", strerror(errno)); /* Detach stdin, stdout and stderr */ Setup_FDStreams(fd); if (fd > 2) close(fd); } pid = getpid(); Pidfile_Create(pid); /* Check UID/GID we are running as, can be different from values * configured (e. g. if we were already started with a UID>0. */ Conf_UID = getuid(); Conf_GID = getgid(); pwd = getpwuid(Conf_UID); grp = getgrgid(Conf_GID); Log(LOG_INFO, "Running as user %s(%ld), group %s(%ld), with PID %ld.", pwd ? pwd->pw_name : "unknown", (long)Conf_UID, grp ? grp->gr_name : "unknown", (long)Conf_GID, (long)pid); if (chrooted) { Log(LOG_INFO, "Running with root directory \"%s\".", Conf_Chroot ); return true; } else Log(LOG_INFO, "Not running with changed root directory."); /* Change working directory to home directory of the user we are * running as (only when running in daemon mode and not in chroot) */ if (NGIRCd_NoDaemon) return true; if (pwd) { if (chdir(pwd->pw_dir) == 0) Log(LOG_DEBUG, "Changed working directory to \"%s\" ...", pwd->pw_dir); else Log(LOG_ERR, "Can't change working directory to \"%s\": %s!", pwd->pw_dir, strerror(errno)); } else Log(LOG_ERR, "Can't get user informaton for UID %d!?", Conf_UID); return true; out: if (fd > 2) close(fd); return false; } /* NGIRCd_Init */ /* -eof- */ ngircd-21/src/ngircd/class.h0000644000175000116100000000227512206130744013001 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __class_h__ #define __class_h__ /** * @file * User class management. */ #define CLASS_KLINE 0 #define CLASS_GLINE 1 #define CLASS_COUNT 2 GLOBAL void Class_Init PARAMS((void)); GLOBAL void Class_Exit PARAMS((void)); GLOBAL bool Class_AddMask PARAMS((const int Class, const char *Pattern, const time_t ValidUntil, const char *Reason)); GLOBAL void Class_DeleteMask PARAMS((const int Class, const char *Pattern)); GLOBAL bool Class_GetMemberReason PARAMS((const int Class, CLIENT *Client, char *reason, size_t len)); GLOBAL bool Class_HandleServerBans PARAMS((CLIENT *Client)); GLOBAL struct list_head *Class_GetList PARAMS((const int Class)); GLOBAL void Class_Expire PARAMS((void)); #endif /* __class_h__ */ /* -eof- */ ngircd-21/src/ngircd/login.h0000644000175000116100000000127011746622422013005 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __login_h__ #define __login_h__ /** * @file * Functions to deal with client logins (header) */ GLOBAL bool Login_User PARAMS((CLIENT * Client)); GLOBAL bool Login_User_PostAuth PARAMS((CLIENT *Client)); #endif /* -eof- */ ngircd-21/src/ngircd/op.h0000644000175000116100000000130411675671776012332 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __oper_h__ #define __oper_h__ /** * @file * IRC operator functions (header) */ GLOBAL bool Op_NoPrivileges PARAMS((CLIENT * Client, REQUEST * Req)); GLOBAL CLIENT *Op_Check PARAMS((CLIENT * Client, REQUEST * Req)); #endif /* -eof- */ ngircd-21/src/ngircd/match.c0000644000175000116100000001703612206130744012764 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * Wildcard pattern matching */ #include "imp.h" #include #include #include "exp.h" #include "match.h" #include "defines.h" #include "tool.h" /* * The pattern matching functions [Matche(), Matche_After_Star()] are based * on code of J. Kercheval. Version 1.1 has been released on 1991-03-12 as * "public domain": */ static int Matche PARAMS(( const char *p, const char *t )); static int Matche_After_Star PARAMS(( const char *p, const char *t )); #define MATCH_PATTERN 6 /**< bad pattern */ #define MATCH_LITERAL 5 /**< match failure on literal match */ #define MATCH_RANGE 4 /**< match failure on [..] construct */ #define MATCH_ABORT 3 /**< premature end of text string */ #define MATCH_END 2 /**< premature end of pattern string */ #define MATCH_VALID 1 /**< valid match */ /** * Match string with pattern. * * @param Pattern Pattern to match with * @param String Input string * @return true if pattern matches */ GLOBAL bool Match( const char *Pattern, const char *String ) { if( Matche( Pattern, String ) == MATCH_VALID ) return true; else return false; } /* Match */ /** * Match string with pattern case-insensitive. * * @param Pattern Pattern to match with * @param String Input string, at most COMMAND_LEN-1 characters long * @return true if pattern matches */ GLOBAL bool MatchCaseInsensitive(const char *Pattern, const char *String) { char haystack[COMMAND_LEN]; strlcpy(haystack, String, sizeof(haystack)); return Match(Pattern, ngt_LowerStr(haystack)); } /* MatchCaseInsensitive */ /** * Match string with pattern case-insensitive. * * @param pattern Pattern to match with * @param String Input string, at most COMMAND_LEN-1 characters long * @param Separator Character separating the individual patterns in the list * @return true if pattern matches */ GLOBAL bool MatchCaseInsensitiveList(const char *Pattern, const char *String, const char *Separator) { char tmp_pattern[COMMAND_LEN], haystack[COMMAND_LEN], *ptr; strlcpy(tmp_pattern, Pattern, sizeof(tmp_pattern)); strlcpy(haystack, String, sizeof(haystack)); ngt_LowerStr(haystack); ptr = strtok(tmp_pattern, Separator); while (ptr) { ngt_TrimStr(ptr); if (Match(ptr, haystack)) return true; ptr = strtok(NULL, Separator); } return false; } /* MatchCaseInsensitive */ static int Matche( const char *p, const char *t ) { register char range_start, range_end; bool invert; bool member_match; bool loop; for( ; *p; p++, t++ ) { /* if this is the end of the text then this is the end of the match */ if( ! *t ) { return ( *p == '*' && *++p == '\0' ) ? MATCH_VALID : MATCH_ABORT; } /* determine and react to pattern type */ switch( *p ) { case '?': /* single any character match */ break; case '*': /* multiple any character match */ return Matche_After_Star( p, t ); case '[': /* [..] construct, single member/exclusion character match */ /* move to beginning of range */ p++; /* check if this is a member match or exclusion match */ invert = false; if( *p == '!' || *p == '^' ) { invert = true; p++; } /* if closing bracket here or at range start then we have a malformed pattern */ if ( *p == ']' ) return MATCH_PATTERN; member_match = false; loop = true; while( loop ) { /* if end of construct then loop is done */ if( *p == ']' ) { loop = false; continue; } /* matching a '!', '^', '-', '\' or a ']' */ if( *p == '\\' ) range_start = range_end = *++p; else range_start = range_end = *p; /* if end of pattern then bad pattern (Missing ']') */ if( ! *p ) return MATCH_PATTERN; /* check for range bar */ if( *++p == '-' ) { /* get the range end */ range_end = *++p; /* if end of pattern or construct then bad pattern */ if( range_end == '\0' || range_end == ']' ) return MATCH_PATTERN; /* special character range end */ if( range_end == '\\' ) { range_end = *++p; /* if end of text then we have a bad pattern */ if ( ! range_end ) return MATCH_PATTERN; } /* move just beyond this range */ p++; } /* if the text character is in range then match found. make sure the range * letters have the proper relationship to one another before comparison */ if( range_start < range_end ) { if( *t >= range_start && *t <= range_end ) { member_match = true; loop = false; } } else { if( *t >= range_end && *t <= range_start ) { member_match = true; loop = false; } } } /* if there was a match in an exclusion set then no match */ /* if there was no match in a member set then no match */ if(( invert && member_match ) || ! ( invert || member_match )) return MATCH_RANGE; /* if this is not an exclusion then skip the rest of the [...] * construct that already matched. */ if( member_match ) { while( *p != ']' ) { /* bad pattern (Missing ']') */ if( ! *p ) return MATCH_PATTERN; /* skip exact match */ if( *p == '\\' ) { p++; /* if end of text then we have a bad pattern */ if( ! *p ) return MATCH_PATTERN; } /* move to next pattern char */ p++; } } break; case '\\': /* next character is quoted and must match exactly */ /* move pattern pointer to quoted char and fall through */ p++; /* if end of text then we have a bad pattern */ if( ! *p ) return MATCH_PATTERN; /* must match this character exactly */ default: if( *p != *t ) return MATCH_LITERAL; } } /* if end of text not reached then the pattern fails */ if( *t ) return MATCH_END; else return MATCH_VALID; } /* Matche */ static int Matche_After_Star( const char *p, const char *t ) { register int nextp, match = 0; /* pass over existing ? and * in pattern */ while( *p == '?' || *p == '*' ) { /* take one char for each ? and + */ if (*p == '?') { /* if end of text then no match */ if( ! *t++ ) return MATCH_ABORT; } /* move to next char in pattern */ p++; } /* if end of pattern we have matched regardless of text left */ if( ! *p ) return MATCH_VALID; /* get the next character to match which must be a literal or '[' */ nextp = *p; if( nextp == '\\' ) { nextp = p[1]; /* if end of text then we have a bad pattern */ if( ! nextp ) return MATCH_PATTERN; } /* Continue until we run out of text or definite result seen */ do { /* a precondition for matching is that the next character * in the pattern match the next character in the text or that * the next pattern char is the beginning of a range. Increment * text pointer as we go here */ if( nextp == *t || nextp == '[' ) match = Matche( p, t ); /* if the end of text is reached then no match */ if( ! *t++ ) match = MATCH_ABORT; } while( match != MATCH_VALID && match != MATCH_ABORT && match != MATCH_PATTERN ); /* return result */ return match; } /* Matche_After_Star */ /* -eof- */ ngircd-21/src/ngircd/irc-oper.h0000644000175000116100000000210511675671776013434 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __irc_oper_h__ #define __irc_oper_h__ /** * @file * IRC operator commands (header) */ GLOBAL bool IRC_OPER PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_DIE PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_REHASH PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_DISCONNECT PARAMS((CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_WALLOPS PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_xLINE PARAMS((CLIENT *Client, REQUEST *Req)); #endif /* -eof- */ ngircd-21/src/ngircd/client-cap.c0000644000175000116100000000302012202004071013660 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #define __client_cap_c__ #include "portab.h" /** * @file * Functions to deal with IRC Capabilities */ #include "imp.h" #include #include "defines.h" #include "conn.h" #include "client.h" #include "log.h" #include "exp.h" #include "client-cap.h" GLOBAL int Client_Cap(CLIENT *Client) { assert (Client != NULL); return Client->capabilities; } GLOBAL void Client_CapSet(CLIENT *Client, int Cap) { assert(Client != NULL); assert(Cap >= 0); Client->capabilities = Cap; LogDebug("Set new capability of \"%s\" to %d.", Client_ID(Client), Client->capabilities); } GLOBAL void Client_CapAdd(CLIENT *Client, int Cap) { assert(Client != NULL); assert(Cap > 0); Client->capabilities |= Cap; LogDebug("Add capability %d, new capability of \"%s\" is %d.", Cap, Client_ID(Client), Client->capabilities); } GLOBAL void Client_CapDel(CLIENT *Client, int Cap) { assert(Client != NULL); assert(Cap > 0); Client->capabilities &= ~Cap; LogDebug("Delete capability %d, new capability of \"%s\" is %d.", Cap, Client_ID(Client), Client->capabilities); } /* -eof- */ ngircd-21/src/ngircd/op.c0000644000175000116100000000447612221142771012312 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * IRC operator functions */ #include "imp.h" #include #include #include "conn.h" #include "channel.h" #include "conf.h" #include "log.h" #include "parse.h" #include "messages.h" #include "irc-write.h" #include #include "op.h" /** * Return and log a "no privileges" message. */ GLOBAL bool Op_NoPrivileges(CLIENT * Client, REQUEST * Req) { CLIENT *from = NULL; if (Req->prefix) from = Client_Search(Req->prefix); if (from) { Log(LOG_NOTICE, "No privileges: client \"%s\" (%s), command \"%s\"", Req->prefix, Client_Mask(Client), Req->command); return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG, Client_ID(from)); } else { Log(LOG_NOTICE, "No privileges: client \"%s\", command \"%s\"", Client_Mask(Client), Req->command); return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG, Client_ID(Client)); } } /* Op_NoPrivileges */ /** * Check that the originator of a request is an IRC operator and allowed * to administer this server. * * @param CLient Client from which the command has been received. * @param Req Request structure. * @return CLIENT structure of the client that initiated the command or * NULL if client is not allowed to execute operator commands. */ GLOBAL CLIENT * Op_Check(CLIENT * Client, REQUEST * Req) { CLIENT *c; assert(Client != NULL); assert(Req != NULL); if (Client_Type(Client) == CLIENT_SERVER && Req->prefix) c = Client_Search(Req->prefix); else c = Client; if (!c) return NULL; if (Client_Type(Client) == CLIENT_SERVER && Client_Type(c) == CLIENT_SERVER) return c; if (!Client_HasMode(c, 'o')) return NULL; if (Client_Conn(c) <= NONE && !Conf_AllowRemoteOper) return NULL; /* The client is an local IRC operator, or this server is configured * to trust remote operators. */ return c; } /* Op_Check */ /* -eof- */ ngircd-21/src/ngircd/conn-encoding.h0000644000175000116100000000162112206130744014407 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __conn_encoding_h__ #define __conn_encoding_h__ /** * @file * Functions to deal with character encodings and conversions (header) */ #ifdef ICONV GLOBAL bool Conn_SetEncoding PARAMS((CONN_ID Idx, const char *ClientEnc)); GLOBAL void Conn_UnsetEncoding PARAMS((CONN_ID Idx)); #endif /* ICONV */ GLOBAL char* Conn_EncodingFrom PARAMS((CONN_ID Idx, char *Message)); GLOBAL char* Conn_EncodingTo PARAMS((CONN_ID Idx, char *Message)); #endif ngircd-21/src/ngircd/sighandlers.h0000644000175000116100000000111711526006312014166 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * * 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. */ #ifndef signals_included_ #define signals_included_ /** * @file * Signal Handlers (header). */ #include "portab.h" bool Signals_Init PARAMS((void)); void Signals_Exit PARAMS((void)); #endif /* -eof- */ ngircd-21/src/ngircd/conn.c0000644000175000116100000021530312215617461012630 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #undef DEBUG_BUFFER #define CONN_MODULE #include "portab.h" #include "conf-ssl.h" #include "io.h" /** * @file * Connection management */ #include "imp.h" #include #ifdef PROTOTYPES # include #else # include #endif #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_NETINET_IP_H # ifdef HAVE_NETINET_IN_SYSTM_H # include # endif # include #endif #ifdef TCPWRAP # include /* for TCP Wrappers */ #endif #include "array.h" #include "defines.h" #include "exp.h" #include "conn.h" #include "imp.h" #include "ngircd.h" #include "array.h" #include "client.h" #include "class.h" #include "conf.h" #include "conn-encoding.h" #include "conn-ssl.h" #include "conn-zip.h" #include "conn-func.h" #include "log.h" #include "ng_ipaddr.h" #include "parse.h" #include "resolve.h" #include "tool.h" #include "exp.h" #define SERVER_WAIT (NONE - 1) #define MAX_COMMANDS 3 #define MAX_COMMANDS_SERVER_MIN 10 #define MAX_COMMANDS_SERVICE 10 #define SD_LISTEN_FDS_START 3 static bool Handle_Write PARAMS(( CONN_ID Idx )); static bool Conn_Write PARAMS(( CONN_ID Idx, char *Data, size_t Len )); static int New_Connection PARAMS(( int Sock, bool IsSSL )); static CONN_ID Socket2Index PARAMS(( int Sock )); static void Read_Request PARAMS(( CONN_ID Idx )); static unsigned int Handle_Buffer PARAMS(( CONN_ID Idx )); static void Check_Connections PARAMS(( void )); static void Check_Servers PARAMS(( void )); static void Init_Conn_Struct PARAMS(( CONN_ID Idx )); static bool Init_Socket PARAMS(( int Sock )); static void New_Server PARAMS(( int Server, ng_ipaddr_t *dest )); static void Simple_Message PARAMS(( int Sock, const char *Msg )); static int NewListener PARAMS(( const char *listen_addr, UINT16 Port )); static void Account_Connection PARAMS((void)); static array My_Listeners; static array My_ConnArray; static size_t NumConnections, NumConnectionsMax, NumConnectionsAccepted; #ifdef TCPWRAP int allow_severity = LOG_INFO; int deny_severity = LOG_ERR; #endif static void server_login PARAMS((CONN_ID idx)); #ifdef SSL_SUPPORT extern struct SSLOptions Conf_SSLOptions; static void cb_connserver_login_ssl PARAMS((int sock, short what)); static void cb_clientserver_ssl PARAMS((int sock, short what)); #endif static void cb_Read_Resolver_Result PARAMS((int sock, UNUSED short what)); static void cb_Connect_to_Server PARAMS((int sock, UNUSED short what)); static void cb_clientserver PARAMS((int sock, short what)); time_t idle_t = 0; /** * Get number of sockets available from systemd(8). * * ngIRCd needs to implement its own sd_listen_fds(3) function and can't * use the one provided by systemd itself, because the sockets will be * used in a forked child process with a new PID, and this would trigger * an error in the standard implementation. * * @return Number of sockets available, -1 if sockets have already been * initialized, or 0 when no sockets have been passed. */ static int my_sd_listen_fds(void) { const char *e; int count; /* Check if LISTEN_PID exists; but we ignore the result, because * normally ngircd forks a child before checking this, and therefore * the PID set in the environment is always wrong ... */ e = getenv("LISTEN_PID"); if (!e || !*e) return 0; e = getenv("LISTEN_FDS"); if (!e || !*e) return -1; count = atoi(e); unsetenv("LISTEN_FDS"); return count; } /** * IO callback for listening sockets: handle new connections. This callback * gets called when a new non-SSL connection should be accepted. * * @param sock Socket descriptor. * @param irrelevant (ignored IO specification) */ static void cb_listen(int sock, short irrelevant) { (void) irrelevant; (void) New_Connection(sock, false); } #ifdef SSL_SUPPORT /** * IO callback for listening SSL sockets: handle new connections. This callback * gets called when a new SSL-enabled connection should be accepted. * * @param sock Socket descriptor. * @param irrelevant (ignored IO specification) */ static void cb_listen_ssl(int sock, short irrelevant) { int fd; (void) irrelevant; fd = New_Connection(sock, true); if (fd < 0) return; io_event_setcb(My_Connections[fd].sock, cb_clientserver_ssl); } #endif /** * IO callback for new outgoing non-SSL server connections. * * @param sock Socket descriptor. * @param what IO specification (IO_WANTREAD/IO_WANTWRITE/...). */ static void cb_connserver(int sock, UNUSED short what) { int res, err, server; socklen_t sock_len; CONN_ID idx = Socket2Index( sock ); if (idx <= NONE) { LogDebug("cb_connserver wants to write on unknown socket?!"); io_close(sock); return; } assert(what & IO_WANTWRITE); /* Make sure that the server is still configured; it could have been * removed in the meantime! */ server = Conf_GetServer(idx); if (server < 0) { Log(LOG_ERR, "Connection on socket %d to \"%s\" aborted!", sock, My_Connections[idx].host); Conn_Close(idx, "Connection aborted", NULL, false); return; } /* connect() finished, get result. */ sock_len = (socklen_t)sizeof(err); res = getsockopt(My_Connections[idx].sock, SOL_SOCKET, SO_ERROR, &err, &sock_len ); assert(sock_len == sizeof(err)); /* Error while connecting? */ if ((res != 0) || (err != 0)) { if (res != 0) Log(LOG_CRIT, "getsockopt (connection %d): %s!", idx, strerror(errno)); else Log(LOG_CRIT, "Can't connect socket to \"%s:%d\" (connection %d): %s!", My_Connections[idx].host, Conf_Server[server].port, idx, strerror(err)); Conn_Close(idx, "Can't connect", NULL, false); if (ng_ipaddr_af(&Conf_Server[server].dst_addr[0])) { /* more addresses to try... */ New_Server(server, &Conf_Server[server].dst_addr[0]); /* connection to dst_addr[0] is now in progress, so * remove this address... */ Conf_Server[server].dst_addr[0] = Conf_Server[server].dst_addr[1]; memset(&Conf_Server[server].dst_addr[1], 0, sizeof(Conf_Server[server].dst_addr[1])); } return; } /* connect() succeeded, remove all additional addresses */ memset(&Conf_Server[server].dst_addr, 0, sizeof(Conf_Server[server].dst_addr)); Conn_OPTION_DEL( &My_Connections[idx], CONN_ISCONNECTING ); #ifdef SSL_SUPPORT if ( Conn_OPTION_ISSET( &My_Connections[idx], CONN_SSL_CONNECT )) { io_event_setcb( sock, cb_connserver_login_ssl ); io_event_add( sock, IO_WANTWRITE|IO_WANTREAD ); return; } #endif server_login(idx); } /** * Login to a remote server. * * @param idx Connection index. */ static void server_login(CONN_ID idx) { Log(LOG_INFO, "Connection %d (socket %d) with \"%s:%d\" established. Now logging in ...", idx, My_Connections[idx].sock, My_Connections[idx].host, Conf_Server[Conf_GetServer(idx)].port); io_event_setcb( My_Connections[idx].sock, cb_clientserver); io_event_add( My_Connections[idx].sock, IO_WANTREAD|IO_WANTWRITE); /* Send PASS and SERVER command to peer */ Conn_WriteStr( idx, "PASS %s %s", Conf_Server[Conf_GetServer( idx )].pwd_out, NGIRCd_ProtoID ); Conn_WriteStr( idx, "SERVER %s :%s", Conf_ServerName, Conf_ServerInfo ); } #ifdef SSL_SUPPORT /** * IO callback for new outgoing SSL-enabled server connections. * * @param sock Socket descriptor. * @param unused (ignored IO specification) */ static void cb_connserver_login_ssl(int sock, short unused) { CONN_ID idx = Socket2Index(sock); assert(idx >= 0); if (idx < 0) { io_close(sock); return; } (void) unused; switch (ConnSSL_Connect( &My_Connections[idx])) { case 1: break; case 0: LogDebug("ConnSSL_Connect: not ready"); return; case -1: Log(LOG_ERR, "SSL connection on socket %d failed!", sock); Conn_Close(idx, "Can't connect", NULL, false); return; } Log( LOG_INFO, "SSL connection %d with \"%s:%d\" established.", idx, My_Connections[idx].host, Conf_Server[Conf_GetServer( idx )].port ); server_login(idx); } #endif /** * IO callback for established non-SSL client and server connections. * * @param sock Socket descriptor. * @param what IO specification (IO_WANTREAD/IO_WANTWRITE/...). */ static void cb_clientserver(int sock, short what) { CONN_ID idx = Socket2Index(sock); assert(idx >= 0); if (idx < 0) { io_close(sock); return; } #ifdef SSL_SUPPORT if (what & IO_WANTREAD || (Conn_OPTION_ISSET(&My_Connections[idx], CONN_SSL_WANT_WRITE))) { /* if TLS layer needs to write additional data, call * Read_Request() instead so that SSL/TLS can continue */ Read_Request(idx); } #else if (what & IO_WANTREAD) Read_Request(idx); #endif if (what & IO_WANTWRITE) Handle_Write(idx); } #ifdef SSL_SUPPORT /** * IO callback for new SSL-enabled client and server connections. * * @param sock Socket descriptor. * @param what IO specification (IO_WANTREAD/IO_WANTWRITE/...). */ static void cb_clientserver_ssl(int sock, UNUSED short what) { CONN_ID idx = Socket2Index(sock); assert(idx >= 0); if (idx < 0) { io_close(sock); return; } switch (ConnSSL_Accept(&My_Connections[idx])) { case 1: break; /* OK */ case 0: return; /* EAGAIN: callback will be invoked again by IO layer */ default: Conn_Close(idx, "SSL accept error, closing socket", "SSL accept error", false); return; } io_event_setcb(sock, cb_clientserver); /* SSL handshake completed */ } #endif /** * Initialize connection module. */ GLOBAL void Conn_Init( void ) { CONN_ID i; Pool_Size = CONNECTION_POOL; if ((Conf_MaxConnections > 0) && (Pool_Size > Conf_MaxConnections)) Pool_Size = Conf_MaxConnections; if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), (size_t)Pool_Size)) { Log(LOG_EMERG, "Can't allocate memory! [Conn_Init]"); exit(1); } /* FIXME: My_Connetions/Pool_Size is needed by other parts of the * code; remove them! */ My_Connections = (CONNECTION*) array_start(&My_ConnArray); LogDebug("Allocated connection pool for %d items (%ld bytes).", array_length(&My_ConnArray, sizeof(CONNECTION)), array_bytes(&My_ConnArray)); assert(array_length(&My_ConnArray, sizeof(CONNECTION)) >= (size_t)Pool_Size); array_free( &My_Listeners ); for (i = 0; i < Pool_Size; i++) Init_Conn_Struct(i); } /* Conn_Init */ /** * Clean up connection module. */ GLOBAL void Conn_Exit( void ) { CONN_ID idx; Conn_ExitListeners(); LogDebug("Shutting down all connections ..." ); for( idx = 0; idx < Pool_Size; idx++ ) { if( My_Connections[idx].sock > NONE ) { Conn_Close( idx, NULL, NGIRCd_SignalRestart ? "Server going down (restarting)":"Server going down", true ); } } array_free(&My_ConnArray); My_Connections = NULL; Pool_Size = 0; io_library_shutdown(); } /* Conn_Exit */ /** * Close all sockets (file descriptors) of open connections. * This is useful in forked child processes, for example, to make sure that * they don't hold connections open that the main process wants to close. */ GLOBAL void Conn_CloseAllSockets(int ExceptOf) { CONN_ID idx; for(idx = 0; idx < Pool_Size; idx++) { if(My_Connections[idx].sock > NONE && My_Connections[idx].sock != ExceptOf) close(My_Connections[idx].sock); } } /** * Initialize listening ports. * * @param a Array containing the ports the daemon should listen on. * @param listen_addr Address the socket should listen on (can be "0.0.0.0"). * @param func IO callback function to register. * @returns Number of listening sockets created. */ static unsigned int Init_Listeners(array *a, const char *listen_addr, void (*func)(int,short)) { unsigned int created = 0; size_t len; int fd; UINT16 *port; len = array_length(a, sizeof (UINT16)); port = array_start(a); while (len--) { fd = NewListener(listen_addr, *port); if (fd < 0) { port++; continue; } if (!io_event_create( fd, IO_WANTREAD, func )) { Log(LOG_ERR, "io_event_create(): Can't add fd %d (port %u): %s!", fd, (unsigned int) *port, strerror(errno)); close(fd); port++; continue; } created++; port++; } return created; } /** * Initialize all listening sockets. * * @returns Number of created listening sockets */ GLOBAL unsigned int Conn_InitListeners( void ) { /* Initialize ports on which the server should accept connections */ unsigned int created = 0; char *af_str, *copy, *listen_addr; int count, fd, i, addr_len; ng_ipaddr_t addr; assert(Conf_ListenAddress); count = my_sd_listen_fds(); if (count < 0) { Log(LOG_INFO, "Not re-initializing listening sockets of systemd(8) ..."); return 0; } if (count > 0) { /* systemd(8) passed sockets to us, so don't try to initialize * listening sockets on our own but use the passed ones */ LogDebug("Initializing %d systemd sockets ...", count); for (i = 0; i < count; i++) { fd = SD_LISTEN_FDS_START + i; addr_len = (int)sizeof(addr); getsockname(fd, (struct sockaddr *)&addr, (socklen_t*)&addr_len); #ifdef WANT_IPV6 if (addr.sin4.sin_family != AF_INET && addr.sin4.sin_family != AF_INET6) #else if (addr.sin4.sin_family != AF_INET) #endif { /* Socket is of unsupported type! For example, systemd passed in * an IPv6 socket but ngIRCd isn't compiled with IPv6 support. */ switch (addr.sin4.sin_family) { case AF_UNSPEC: af_str = "AF_UNSPEC"; break; case AF_UNIX: af_str = "AF_UNIX"; break; case AF_INET: af_str = "AF_INET"; break; #ifdef AF_INET6 case AF_INET6: af_str = "AF_INET6"; break; #endif #ifdef AF_NETLINK case AF_NETLINK: af_str = "AF_NETLINK"; break; #endif default: af_str = "unknown"; break; } Log(LOG_CRIT, "Socket %d is of unsupported type \"%s\" (%d), have to ignore it!", fd, af_str, addr.sin4.sin_family); close(fd); continue; } Init_Socket(fd); if (!io_event_create(fd, IO_WANTREAD, cb_listen)) { Log(LOG_ERR, "io_event_create(): Can't add fd %d: %s!", fd, strerror(errno)); continue; } Log(LOG_INFO, "Initialized socket %d from systemd(8): %s:%d.", fd, ng_ipaddr_tostr(&addr), ng_ipaddr_getport(&addr)); created++; } return created; } /* not using systemd socket activation, initialize listening sockets: */ /* can't use Conf_ListenAddress directly, see below */ copy = strdup(Conf_ListenAddress); if (!copy) { Log(LOG_CRIT, "Cannot copy %s: %s", Conf_ListenAddress, strerror(errno)); return 0; } listen_addr = strtok(copy, ","); while (listen_addr) { ngt_TrimStr(listen_addr); if (*listen_addr) { created += Init_Listeners(&Conf_ListenPorts, listen_addr, cb_listen); #ifdef SSL_SUPPORT created += Init_Listeners(&Conf_SSLOptions.ListenPorts, listen_addr, cb_listen_ssl); #endif } listen_addr = strtok(NULL, ","); } /* Can't free() Conf_ListenAddress here: on REHASH, if the config file * cannot be re-loaded, we'd end up with a NULL Conf_ListenAddress. * Instead, free() takes place in conf.c, before the config file * is being parsed. */ free(copy); return created; } /* Conn_InitListeners */ /** * Shut down all listening sockets. */ GLOBAL void Conn_ExitListeners( void ) { /* Close down all listening sockets */ int *fd; size_t arraylen; /* Get number of listening sockets to shut down. There can be none * if ngIRCd has been "socket activated" by systemd. */ arraylen = array_length(&My_Listeners, sizeof (int)); if (arraylen < 1) return; Log(LOG_INFO, "Shutting down all listening sockets (%d total) ...", arraylen); fd = array_start(&My_Listeners); while(arraylen--) { assert(fd != NULL); assert(*fd >= 0); io_close(*fd); LogDebug("Listening socket %d closed.", *fd ); fd++; } array_free(&My_Listeners); } /* Conn_ExitListeners */ /** * Bind a socket to a specific (source) address. * * @param addr Address structure. * @param listen_addrstr Source address as string. * @param Port Port number. * @returns true on success, false otherwise. */ static bool InitSinaddrListenAddr(ng_ipaddr_t *addr, const char *listen_addrstr, UINT16 Port) { bool ret; ret = ng_ipaddr_init(addr, listen_addrstr, Port); if (!ret) { assert(listen_addrstr); Log(LOG_CRIT, "Can't bind to [%s]:%u: can't convert ip address \"%s\"!", listen_addrstr, Port, listen_addrstr); } return ret; } /** * Set a socket to "IPv6 only". If the given socket doesn't belong to the * AF_INET6 family, or the operating system doesn't support this functionality, * this function retruns silently. * * @param af Address family of the socket. * @param sock Socket handle. */ static void set_v6_only(int af, int sock) { #if defined(IPV6_V6ONLY) && defined(WANT_IPV6) int on = 1; if (af != AF_INET6) return; if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, (socklen_t)sizeof(on))) Log(LOG_ERR, "Could not set IPV6_V6ONLY: %s", strerror(errno)); #else (void)af; (void)sock; #endif } /** * Initialize new listening port. * * @param listen_addr Local address to bind the socet to (can be 0.0.0.0). * @param Port Port number on which the new socket should be listening. * @returns file descriptor of the socket or -1 on failure. */ static int NewListener(const char *listen_addr, UINT16 Port) { /* Create new listening socket on specified port */ ng_ipaddr_t addr; int sock, af; if (!InitSinaddrListenAddr(&addr, listen_addr, Port)) return -1; af = ng_ipaddr_af(&addr); sock = socket(af, SOCK_STREAM, 0); if (sock < 0) { Log(LOG_CRIT, "Can't create socket (af %d) : %s!", af, strerror(errno)); return -1; } set_v6_only(af, sock); if (!Init_Socket(sock)) return -1; if (bind(sock, (struct sockaddr *)&addr, ng_ipaddr_salen(&addr)) != 0) { Log(LOG_CRIT, "Can't bind socket to address %s:%d - %s!", ng_ipaddr_tostr(&addr), Port, strerror(errno)); close(sock); return -1; } if (listen(sock, 10) != 0) { Log(LOG_CRIT, "Can't listen on socket: %s!", strerror(errno)); close(sock); return -1; } /* keep fd in list so we can close it when ngircd restarts/shuts down */ if (!array_catb(&My_Listeners, (char *)&sock, sizeof(int))) { Log(LOG_CRIT, "Can't add socket to My_Listeners array: %s!", strerror(errno)); close(sock); return -1; } Log(LOG_INFO, "Now listening on [%s]:%d (socket %d).", ng_ipaddr_tostr(&addr), Port, sock); return sock; } /* NewListener */ #ifdef SSL_SUPPORT /** * Check if SSL library needs to read SSL-protocol related data. * * SSL/TLS connections require extra treatment: * When either CONN_SSL_WANT_WRITE or CONN_SSL_WANT_READ is set, we * need to take care of that first, before checking read/write buffers. * For instance, while we might have data in our write buffer, the * TLS/SSL protocol might need to read internal data first for TLS/SSL * writes to succeed. * * If this function returns true, such a condition is met and we have * to reverse the condition (check for read even if we've data to write, * do not check for read but writeability even if write-buffer is empty). * * @param c Connection to check. * @returns true if SSL-library has to read protocol data. */ static bool SSL_WantRead(const CONNECTION *c) { if (Conn_OPTION_ISSET(c, CONN_SSL_WANT_READ)) { io_event_add(c->sock, IO_WANTREAD); return true; } return false; } /** * Check if SSL library needs to write SSL-protocol related data. * * Please see description of SSL_WantRead() for full description! * * @param c Connection to check. * @returns true if SSL-library has to write protocol data. */ static bool SSL_WantWrite(const CONNECTION *c) { if (Conn_OPTION_ISSET(c, CONN_SSL_WANT_WRITE)) { io_event_add(c->sock, IO_WANTWRITE); return true; } return false; } #else static inline bool SSL_WantRead(UNUSED const CONNECTION *c) { return false; } static inline bool SSL_WantWrite(UNUSED const CONNECTION *c) { return false; } #endif /** * "Main Loop": Loop until shutdown or restart is signalled. * * This function loops until a shutdown or restart of ngIRCd is signalled and * calls io_dispatch() to check for readable and writable sockets every second. * It checks for status changes on pending connections (e. g. when a hostname * has been resolved), checks for "penalties" and timeouts, and handles the * input buffers. */ GLOBAL void Conn_Handler(void) { int i; unsigned int wdatalen, bytes_processed; struct timeval tv; time_t t; while (!NGIRCd_SignalQuit && !NGIRCd_SignalRestart) { t = time(NULL); /* Check configured servers and established links */ Check_Servers(); Check_Connections(); /* Expire outdated class/list items */ Class_Expire(); /* Look for non-empty read buffers ... */ for (i = 0; i < Pool_Size; i++) { if ((My_Connections[i].sock > NONE) && (array_bytes(&My_Connections[i].rbuf) > 0)) { /* ... and try to handle the received data */ bytes_processed = Handle_Buffer(i); /* if we processed data, and there might be * more commands in the input buffer, do not * try to read any more data now */ if (bytes_processed && array_bytes(&My_Connections[i].rbuf) > 2) { LogDebug ("Throttling connection %d: command limit reached!", i); Conn_SetPenalty(i, 1); } } } /* Look for non-empty write buffers ... */ for (i = 0; i < Pool_Size; i++) { if (My_Connections[i].sock <= NONE) continue; wdatalen = (unsigned int)array_bytes(&My_Connections[i].wbuf); #ifdef ZLIB if (wdatalen > 0 || array_bytes(&My_Connections[i].zip.wbuf) > 0) #else if (wdatalen > 0) #endif { if (SSL_WantRead(&My_Connections[i])) continue; io_event_add(My_Connections[i].sock, IO_WANTWRITE); } } /* Check from which sockets we possibly could read ... */ for (i = 0; i < Pool_Size; i++) { if (My_Connections[i].sock <= NONE) continue; #ifdef SSL_SUPPORT if (SSL_WantWrite(&My_Connections[i])) continue; /* TLS/SSL layer needs to write data; deal with this first */ #endif if (Proc_InProgress(&My_Connections[i].proc_stat)) { /* Wait for completion of forked subprocess * and ignore the socket in the meantime ... */ io_event_del(My_Connections[i].sock, IO_WANTREAD); continue; } if (Conn_OPTION_ISSET(&My_Connections[i], CONN_ISCONNECTING)) /* Wait for completion of connect() ... */ continue; if (My_Connections[i].delaytime > t) { /* There is a "penalty time" set: ignore socket! */ io_event_del(My_Connections[i].sock, IO_WANTREAD); continue; } io_event_add(My_Connections[i].sock, IO_WANTREAD); } /* Set the timeout for reading from the network to 1 second, * which is the granularity with witch we handle "penalty * times" for example. * Note: tv_sec/usec are undefined(!) after io_dispatch() * returns, so we have to set it before each call to it! */ tv.tv_usec = 0; tv.tv_sec = 1; /* Wait for activity ... */ i = io_dispatch(&tv); if (i == -1 && errno != EINTR) { Log(LOG_EMERG, "Conn_Handler(): io_dispatch(): %s!", strerror(errno)); Log(LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME); exit(1); } /* Should ngIRCd timeout when idle? */ if (Conf_IdleTimeout > 0 && NumConnectionsAccepted > 0 && idle_t > 0 && time(NULL) - idle_t >= Conf_IdleTimeout) { LogDebug("Server idle timeout reached: %d second%s. Initiating shutdown ...", Conf_IdleTimeout, Conf_IdleTimeout == 1 ? "" : "s"); NGIRCd_SignalQuit = true; } } if (NGIRCd_SignalQuit) Log(LOG_NOTICE | LOG_snotice, "Server going down NOW!"); else if (NGIRCd_SignalRestart) Log(LOG_NOTICE | LOG_snotice, "Server restarting NOW!"); } /* Conn_Handler */ /** * Write a text string into the socket of a connection. * * This function automatically appends CR+LF to the string and validates that * the result is a valid IRC message (oversized messages are shortened, for * example). Then it calls the Conn_Write() function to do the actual sending. * * @param Idx Index fo the connection. * @param Format Format string, see printf(). * @returns true on success, false otherwise. */ #ifdef PROTOTYPES GLOBAL bool Conn_WriteStr(CONN_ID Idx, const char *Format, ...) #else GLOBAL bool Conn_WriteStr(Idx, Format, va_alist) CONN_ID Idx; const char *Format; va_dcl #endif { char buffer[COMMAND_LEN]; #ifdef ICONV char *ptr, *message; #endif size_t len; bool ok; va_list ap; assert( Idx > NONE ); assert( Format != NULL ); #ifdef PROTOTYPES va_start( ap, Format ); #else va_start( ap ); #endif if (vsnprintf( buffer, COMMAND_LEN - 2, Format, ap ) >= COMMAND_LEN - 2 ) { /* * The string that should be written to the socket is longer * than the allowed size of COMMAND_LEN bytes (including both * the CR and LF characters). This can be caused by the * IRC_WriteXXX() functions when the prefix of this server had * to be added to an already "quite long" command line which * has been received from a regular IRC client, for example. * * We are not allowed to send such "oversized" messages to * other servers and clients, see RFC 2812 2.3 and 2813 3.3 * ("these messages SHALL NOT exceed 512 characters in length, * counting all characters including the trailing CR-LF"). * * So we have a big problem here: we should send more bytes * to the network than we are allowed to and we don't know * the originator (any more). The "old" behavior of blaming * the receiver ("next hop") is a bad idea (it could be just * an other server only routing the message!), so the only * option left is to shorten the string and to hope that the * result is still somewhat useful ... * -alex- */ strcpy (buffer + sizeof(buffer) - strlen(CUT_TXTSUFFIX) - 2 - 1, CUT_TXTSUFFIX); } #ifdef ICONV ptr = strchr(buffer + 1, ':'); if (ptr) { ptr++; message = Conn_EncodingTo(Idx, ptr); if (message != ptr) strlcpy(ptr, message, sizeof(buffer) - (ptr - buffer)); } #endif #ifdef SNIFFER if (NGIRCd_Sniffer) Log(LOG_DEBUG, " -> connection %d: '%s'.", Idx, buffer); #endif len = strlcat( buffer, "\r\n", sizeof( buffer )); ok = Conn_Write(Idx, buffer, len); My_Connections[Idx].msg_out++; va_end( ap ); return ok; } /* Conn_WriteStr */ GLOBAL char* Conn_Password( CONN_ID Idx ) { assert( Idx > NONE ); if (My_Connections[Idx].pwd == NULL) return (char*)"\0"; else return My_Connections[Idx].pwd; } /* Conn_Password */ GLOBAL void Conn_SetPassword( CONN_ID Idx, const char *Pwd ) { assert( Idx > NONE ); if (My_Connections[Idx].pwd) free(My_Connections[Idx].pwd); My_Connections[Idx].pwd = strdup(Pwd); if (My_Connections[Idx].pwd == NULL) { Log(LOG_EMERG, "Can't allocate memory! [Conn_SetPassword]"); exit(1); } } /* Conn_SetPassword */ /** * Append Data to the outbound write buffer of a connection. * * @param Idx Index of the connection. * @param Data pointer to the data. * @param Len length of Data. * @returns true on success, false otherwise. */ static bool Conn_Write( CONN_ID Idx, char *Data, size_t Len ) { CLIENT *c; size_t writebuf_limit = WRITEBUFFER_MAX_LEN; assert( Idx > NONE ); assert( Data != NULL ); assert( Len > 0 ); /* Is the socket still open? A previous call to Conn_Write() * may have closed the connection due to a fatal error. * In this case it is sufficient to return an error, as well. */ if (My_Connections[Idx].sock <= NONE) { LogDebug("Skipped write on closed socket (connection %d).", Idx); return false; } /* Make sure that there still exists a CLIENT structure associated * with this connection and check if this is a server or not: */ c = Conn_GetClient(Idx); if (c) { /* Servers do get special write buffer limits, so they can * generate all the messages that are required while peering. */ if (Client_Type(c) == CLIENT_SERVER) writebuf_limit = WRITEBUFFER_SLINK_LEN; } else LogDebug("Write on socket without client (connection %d)!?", Idx); #ifdef ZLIB if ( Conn_OPTION_ISSET( &My_Connections[Idx], CONN_ZIP )) { /* Compressed link: * Zip_Buffer() does all the dirty work for us: it flushes * the (pre-)compression buffers if required and handles * all error conditions. */ if (!Zip_Buffer(Idx, Data, Len)) return false; } else #endif { /* Uncompressed link: * Check if outbound buffer has enough space for the data. */ if (array_bytes(&My_Connections[Idx].wbuf) + Len >= WRITEBUFFER_FLUSH_LEN) { /* Buffer is full, flush it. Handle_Write deals with * low-level errors, if any. */ if (!Handle_Write(Idx)) return false; } /* When the write buffer is still too big after flushing it, * the connection will be killed. */ if (array_bytes(&My_Connections[Idx].wbuf) + Len >= writebuf_limit) { Log(LOG_NOTICE, "Write buffer space exhausted (connection %d, limit is %lu bytes, %lu bytes new, %lu bytes pending)", Idx, writebuf_limit, Len, (unsigned long)array_bytes(&My_Connections[Idx].wbuf)); Conn_Close(Idx, "Write buffer space exhausted", NULL, false); return false; } /* Copy data to write buffer */ if (!array_catb(&My_Connections[Idx].wbuf, Data, Len)) return false; My_Connections[Idx].bytes_out += Len; } /* Adjust global write counter */ WCounter += Len; return true; } /* Conn_Write */ /** * Shut down a connection. * * @param Idx Connection index. * @param LogMsg Message to write to the log or NULL. If no LogMsg * is given, the FwdMsg is logged. * @param FwdMsg Message to forward to remote servers. * @param InformClient If true, inform the client on the connection which is * to be shut down of the reason (FwdMsg) and send * connection statistics before disconnecting it. */ GLOBAL void Conn_Close( CONN_ID Idx, const char *LogMsg, const char *FwdMsg, bool InformClient ) { /* Close connection. Open pipes of asynchronous resolver * sub-processes are closed down. */ CLIENT *c; double in_k, out_k; UINT16 port; #ifdef ZLIB double in_z_k, out_z_k; int in_p, out_p; #endif assert( Idx > NONE ); /* Is this link already shutting down? */ if( Conn_OPTION_ISSET( &My_Connections[Idx], CONN_ISCLOSING )) { /* Conn_Close() has been called recursively for this link; * probable reason: Handle_Write() failed -- see below. */ LogDebug("Recursive request to close connection %d!", Idx ); return; } assert( My_Connections[Idx].sock > NONE ); /* Mark link as "closing" */ Conn_OPTION_ADD( &My_Connections[Idx], CONN_ISCLOSING ); port = ng_ipaddr_getport(&My_Connections[Idx].addr); Log(LOG_INFO, "Shutting down connection %d (%s) with \"%s:%d\" ...", Idx, LogMsg ? LogMsg : FwdMsg, My_Connections[Idx].host, port); /* Search client, if any */ c = Conn_GetClient( Idx ); /* Should the client be informed? */ if (InformClient) { #ifndef STRICT_RFC /* Send statistics to client if registered as user: */ if ((c != NULL) && (Client_Type(c) == CLIENT_USER)) { Conn_WriteStr( Idx, ":%s NOTICE %s :%sConnection statistics: client %.1f kb, server %.1f kb.", Client_ID(Client_ThisServer()), Client_ID(c), NOTICE_TXTPREFIX, (double)My_Connections[Idx].bytes_in / 1024, (double)My_Connections[Idx].bytes_out / 1024); } #endif /* Send ERROR to client (see RFC 2812, section 3.1.7) */ if (FwdMsg) Conn_WriteStr(Idx, "ERROR :%s", FwdMsg); else Conn_WriteStr(Idx, "ERROR :Closing connection"); } /* Try to write out the write buffer. Note: Handle_Write() eventually * removes the CLIENT structure associated with this connection if an * error occurs! So we have to re-check if there is still an valid * CLIENT structure after calling Handle_Write() ...*/ (void)Handle_Write( Idx ); /* Search client, if any (re-check!) */ c = Conn_GetClient( Idx ); #ifdef SSL_SUPPORT if ( Conn_OPTION_ISSET( &My_Connections[Idx], CONN_SSL )) { LogDebug("SSL connection %d shutting down ...", Idx); ConnSSL_Free(&My_Connections[Idx]); } #endif /* Shut down socket */ if (! io_close(My_Connections[Idx].sock)) { /* Oops, we can't close the socket!? This is ... ugly! */ Log(LOG_CRIT, "Error closing connection %d (socket %d) with %s:%d - %s! (ignored)", Idx, My_Connections[Idx].sock, My_Connections[Idx].host, port, strerror(errno)); } /* Mark socket as invalid: */ My_Connections[Idx].sock = NONE; /* If there is still a client, unregister it now */ if (c) Client_Destroy(c, LogMsg, FwdMsg, true); /* Calculate statistics and log information */ in_k = (double)My_Connections[Idx].bytes_in / 1024; out_k = (double)My_Connections[Idx].bytes_out / 1024; #ifdef ZLIB if (Conn_OPTION_ISSET( &My_Connections[Idx], CONN_ZIP)) { in_z_k = (double)My_Connections[Idx].zip.bytes_in / 1024; out_z_k = (double)My_Connections[Idx].zip.bytes_out / 1024; /* Make sure that no division by zero can occur during * the calculation of in_p and out_p: in_z_k and out_z_k * are non-zero, that's guaranteed by the protocol until * compression can be enabled. */ if (! in_z_k) in_z_k = in_k; if (! out_z_k) out_z_k = out_k; in_p = (int)(( in_k * 100 ) / in_z_k ); out_p = (int)(( out_k * 100 ) / out_z_k ); Log(LOG_INFO, "Connection %d with \"%s:%d\" closed (in: %.1fk/%.1fk/%d%%, out: %.1fk/%.1fk/%d%%).", Idx, My_Connections[Idx].host, port, in_k, in_z_k, in_p, out_k, out_z_k, out_p); } else #endif { Log(LOG_INFO, "Connection %d with \"%s:%d\" closed (in: %.1fk, out: %.1fk).", Idx, My_Connections[Idx].host, port, in_k, out_k); } /* Servers: Modify time of next connect attempt? */ Conf_UnsetServer( Idx ); #ifdef ZLIB /* Clean up zlib, if link was compressed */ if ( Conn_OPTION_ISSET( &My_Connections[Idx], CONN_ZIP )) { inflateEnd( &My_Connections[Idx].zip.in ); deflateEnd( &My_Connections[Idx].zip.out ); array_free(&My_Connections[Idx].zip.rbuf); array_free(&My_Connections[Idx].zip.wbuf); } #endif array_free(&My_Connections[Idx].rbuf); array_free(&My_Connections[Idx].wbuf); if (My_Connections[Idx].pwd != NULL) free(My_Connections[Idx].pwd); /* Clean up connection structure (=free it) */ Init_Conn_Struct( Idx ); assert(NumConnections > 0); if (NumConnections) NumConnections--; LogDebug("Shutdown of connection %d completed, %ld connection%s left.", Idx, NumConnections, NumConnections != 1 ? "s" : ""); idle_t = NumConnections > 0 ? 0 : time(NULL); } /* Conn_Close */ /** * Get current number of connections. * * @returns Number of current connections. */ GLOBAL long Conn_Count(void) { return NumConnections; } /* Conn_Count */ /** * Get number of maximum simultaneous connections. * * @returns Number of maximum simultaneous connections. */ GLOBAL long Conn_CountMax(void) { return NumConnectionsMax; } /* Conn_CountMax */ /** * Get number of connections accepted since the daemon startet. * * @returns Number of connections accepted. */ GLOBAL long Conn_CountAccepted(void) { return NumConnectionsAccepted; } /* Conn_CountAccepted */ /** * Synchronize established connections and configured server structures * after a configuration update and store the correct connection IDs, if any. */ GLOBAL void Conn_SyncServerStruct(void) { CLIENT *client; CONN_ID i; int c; for (i = 0; i < Pool_Size; i++) { if (My_Connections[i].sock == NONE) continue; /* Server link? */ client = Conn_GetClient(i); if (!client || Client_Type(client) != CLIENT_SERVER) continue; for (c = 0; c < MAX_SERVERS; c++) { /* Configured server? */ if (!Conf_Server[c].host[0]) continue; if (strcasecmp(Conf_Server[c].name, Client_ID(client)) == 0) Conf_Server[c].conn_id = i; } } } /* SyncServerStruct */ /** * Get IP address string of a connection. * * @param Idx Connection index. * @return Pointer to a global buffer containing the IP address as string. */ GLOBAL const char * Conn_GetIPAInfo(CONN_ID Idx) { assert(Idx > NONE); return ng_ipaddr_tostr(&My_Connections[Idx].addr); } /** * Send out data of write buffer; connect new sockets. * * @param Idx Connection index. * @returns true on success, false otherwise. */ static bool Handle_Write( CONN_ID Idx ) { ssize_t len; size_t wdatalen; assert( Idx > NONE ); if ( My_Connections[Idx].sock < 0 ) { LogDebug("Handle_Write() on closed socket, connection %d", Idx); return false; } assert( My_Connections[Idx].sock > NONE ); wdatalen = array_bytes(&My_Connections[Idx].wbuf ); #ifdef ZLIB if (wdatalen == 0) { /* Write buffer is empty, so we try to flush the compression * buffer and get some data to work with from there :-) */ if (!Zip_Flush(Idx)) return false; /* Now the write buffer most probably has changed: */ wdatalen = array_bytes(&My_Connections[Idx].wbuf); } #endif if (wdatalen == 0) { /* Still no data, fine. */ io_event_del(My_Connections[Idx].sock, IO_WANTWRITE ); return true; } #ifdef DEBUG_BUFFER LogDebug ("Handle_Write() called for connection %d, %ld bytes pending ...", Idx, wdatalen); #endif #ifdef SSL_SUPPORT if ( Conn_OPTION_ISSET( &My_Connections[Idx], CONN_SSL )) { len = ConnSSL_Write(&My_Connections[Idx], array_start(&My_Connections[Idx].wbuf), wdatalen); } else #endif { len = write(My_Connections[Idx].sock, array_start(&My_Connections[Idx].wbuf), wdatalen ); } if( len < 0 ) { if (errno == EAGAIN || errno == EINTR) return true; if (!Conn_OPTION_ISSET(&My_Connections[Idx], CONN_ISCLOSING)) Log(LOG_ERR, "Write error on connection %d (socket %d): %s!", Idx, My_Connections[Idx].sock, strerror(errno)); else LogDebug("Recursive write error on connection %d (socket %d): %s!", Idx, My_Connections[Idx].sock, strerror(errno)); Conn_Close(Idx, "Write error", NULL, false); return false; } /* move any data not yet written to beginning */ array_moveleft(&My_Connections[Idx].wbuf, 1, (size_t)len); return true; } /* Handle_Write */ /** * Count established connections to a specific IP address. * * @returns Number of established connections. */ static int Count_Connections(ng_ipaddr_t *a) { int i, cnt; cnt = 0; for (i = 0; i < Pool_Size; i++) { if (My_Connections[i].sock <= NONE) continue; if (ng_ipaddr_ipequal(&My_Connections[i].addr, a)) cnt++; } return cnt; } /* Count_Connections */ /** * Initialize new client connection on a listening socket. * * @param Sock Listening socket descriptor. * @param IsSSL true if this socket expects SSL-encrypted data. * @returns Accepted socket descriptor or -1 on error. */ static int New_Connection(int Sock, UNUSED bool IsSSL) { #ifdef TCPWRAP struct request_info req; #endif ng_ipaddr_t new_addr; char ip_str[NG_INET_ADDRSTRLEN]; int new_sock, new_sock_len; CLIENT *c; long cnt; assert(Sock > NONE); LogDebug("Accepting new connection on socket %d ...", Sock); new_sock_len = (int)sizeof(new_addr); new_sock = accept(Sock, (struct sockaddr *)&new_addr, (socklen_t *)&new_sock_len); if (new_sock < 0) { Log(LOG_CRIT, "Can't accept connection: %s!", strerror(errno)); return -1; } NumConnectionsAccepted++; if (!ng_ipaddr_tostr_r(&new_addr, ip_str)) { Log(LOG_CRIT, "fd %d: Can't convert IP address!", new_sock); Simple_Message(new_sock, "ERROR :Internal Server Error"); close(new_sock); return -1; } #ifdef TCPWRAP /* Validate socket using TCP Wrappers */ request_init(&req, RQ_DAEMON, PACKAGE_NAME, RQ_FILE, new_sock, RQ_CLIENT_SIN, &new_addr, NULL); fromhost(&req); if (!hosts_access(&req)) { Log(deny_severity, "Refused connection from %s (by TCP Wrappers)!", ip_str); Simple_Message(new_sock, "ERROR :Connection refused"); close(new_sock); return -1; } #endif if (!Init_Socket(new_sock)) return -1; /* Check global connection limit */ if ((Conf_MaxConnections > 0) && (NumConnections >= (size_t) Conf_MaxConnections)) { Log(LOG_ALERT, "Can't accept connection: limit (%d) reached!", Conf_MaxConnections); Simple_Message(new_sock, "ERROR :Connection limit reached"); close(new_sock); return -1; } /* Check IP-based connection limit */ cnt = Count_Connections(&new_addr); if ((Conf_MaxConnectionsIP > 0) && (cnt >= Conf_MaxConnectionsIP)) { /* Access denied, too many connections from this IP address! */ Log(LOG_ERR, "Refused connection from %s: too may connections (%ld) from this IP address!", ip_str, cnt); Simple_Message(new_sock, "ERROR :Connection refused, too many connections from your IP address"); close(new_sock); return -1; } if (new_sock >= Pool_Size) { if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), (size_t) new_sock)) { Log(LOG_EMERG, "Can't allocate memory! [New_Connection]"); Simple_Message(new_sock, "ERROR: Internal error"); close(new_sock); return -1; } LogDebug("Bumped connection pool to %ld items (internal: %ld items, %ld bytes)", new_sock, array_length(&My_ConnArray, sizeof(CONNECTION)), array_bytes(&My_ConnArray)); /* Adjust pointer to new block */ My_Connections = array_start(&My_ConnArray); while (Pool_Size <= new_sock) Init_Conn_Struct(Pool_Size++); } /* register callback */ if (!io_event_create(new_sock, IO_WANTREAD, cb_clientserver)) { Log(LOG_ALERT, "Can't accept connection: io_event_create failed!"); Simple_Message(new_sock, "ERROR :Internal error"); close(new_sock); return -1; } c = Client_NewLocal(new_sock, NULL, CLIENT_UNKNOWN, false); if (!c) { Log(LOG_ALERT, "Can't accept connection: can't create client structure!"); Simple_Message(new_sock, "ERROR :Internal error"); io_close(new_sock); return -1; } Init_Conn_Struct(new_sock); My_Connections[new_sock].sock = new_sock; My_Connections[new_sock].addr = new_addr; My_Connections[new_sock].client = c; /* Set initial hostname to IP address. This becomes overwritten when * the DNS lookup is enabled and succeeds, but is used otherwise. */ if (ng_ipaddr_af(&new_addr) != AF_INET) snprintf(My_Connections[new_sock].host, sizeof(My_Connections[new_sock].host), "[%s]", ip_str); else strlcpy(My_Connections[new_sock].host, ip_str, sizeof(My_Connections[new_sock].host)); Client_SetHostname(c, My_Connections[new_sock].host); Log(LOG_INFO, "Accepted connection %d from \"%s:%d\" on socket %d.", new_sock, My_Connections[new_sock].host, ng_ipaddr_getport(&new_addr), Sock); Account_Connection(); #ifdef SSL_SUPPORT /* Delay connection initalization until SSL handshake is finished */ if (!IsSSL) #endif Conn_StartLogin(new_sock); return new_sock; } /* New_Connection */ /** * Finish connection initialization, start resolver subprocess. * * @param Idx Connection index. */ GLOBAL void Conn_StartLogin(CONN_ID Idx) { int ident_sock = -1; assert(Idx >= 0); /* Nothing to do if DNS (and resolver subprocess) is disabled */ if (!Conf_DNS) return; #ifdef IDENTAUTH /* Should we make an IDENT request? */ if (Conf_Ident) ident_sock = My_Connections[Idx].sock; #endif if (Conf_NoticeAuth) { /* Send "NOTICE AUTH" messages to the client */ #ifdef IDENTAUTH if (Conf_Ident) (void)Conn_WriteStr(Idx, "NOTICE AUTH :*** Looking up your hostname and checking ident"); else #endif (void)Conn_WriteStr(Idx, "NOTICE AUTH :*** Looking up your hostname"); /* Send buffered data to the client, but break on errors * because Handle_Write() would have closed the connection * again in this case! */ if (!Handle_Write(Idx)) return; } Resolve_Addr(&My_Connections[Idx].proc_stat, &My_Connections[Idx].addr, ident_sock, cb_Read_Resolver_Result); } /** * Update global connection counters. */ static void Account_Connection(void) { NumConnections++; idle_t = 0; if (NumConnections > NumConnectionsMax) NumConnectionsMax = NumConnections; LogDebug("Total number of connections now %lu (max %lu).", NumConnections, NumConnectionsMax); } /* Account_Connection */ /** * Translate socket handle into connection index. * * @param Sock Socket handle. * @returns Connecion index or NONE, if no connection could be found. */ static CONN_ID Socket2Index( int Sock ) { assert( Sock >= 0 ); if( Sock >= Pool_Size || My_Connections[Sock].sock != Sock ) { /* the Connection was already closed again, likely due to * an error. */ LogDebug("Socket2Index: can't get connection for socket %d!", Sock); return NONE; } return Sock; } /* Socket2Index */ /** * Read data from the network to the read buffer. If an error occurs, * the socket of this connection will be shut down. * * @param Idx Connection index. */ static void Read_Request( CONN_ID Idx ) { ssize_t len; static const unsigned int maxbps = COMMAND_LEN / 2; char readbuf[READBUFFER_LEN]; time_t t; CLIENT *c; assert( Idx > NONE ); assert( My_Connections[Idx].sock > NONE ); #ifdef ZLIB if ((array_bytes(&My_Connections[Idx].rbuf) >= READBUFFER_LEN) || (array_bytes(&My_Connections[Idx].zip.rbuf) >= READBUFFER_LEN)) #else if (array_bytes(&My_Connections[Idx].rbuf) >= READBUFFER_LEN) #endif { /* Read buffer is full */ Log(LOG_ERR, "Receive buffer space exhausted (connection %d): %d bytes", Idx, array_bytes(&My_Connections[Idx].rbuf)); Conn_Close(Idx, "Receive buffer space exhausted", NULL, false); return; } #ifdef SSL_SUPPORT if (Conn_OPTION_ISSET(&My_Connections[Idx], CONN_SSL)) len = ConnSSL_Read( &My_Connections[Idx], readbuf, sizeof(readbuf)); else #endif len = read(My_Connections[Idx].sock, readbuf, sizeof(readbuf)); if (len == 0) { LogDebug("Client \"%s:%u\" is closing connection %d ...", My_Connections[Idx].host, ng_ipaddr_tostr(&My_Connections[Idx].addr), Idx); Conn_Close(Idx, NULL, "Client closed connection", false); return; } if (len < 0) { if( errno == EAGAIN ) return; Log(LOG_ERR, "Read error on connection %d (socket %d): %s!", Idx, My_Connections[Idx].sock, strerror(errno)); Conn_Close(Idx, "Read error", "Client closed connection", false); return; } #ifdef ZLIB if (Conn_OPTION_ISSET(&My_Connections[Idx], CONN_ZIP)) { if (!array_catb(&My_Connections[Idx].zip.rbuf, readbuf, (size_t) len)) { Log(LOG_ERR, "Could not append received data to zip input buffer (connection %d): %d bytes!", Idx, len); Conn_Close(Idx, "Receive buffer space exhausted", NULL, false); return; } } else #endif { if (!array_catb( &My_Connections[Idx].rbuf, readbuf, len)) { Log(LOG_ERR, "Could not append received data to input buffer (connection %d): %d bytes!", Idx, len); Conn_Close(Idx, "Receive buffer space exhausted", NULL, false ); } } /* Update connection statistics */ My_Connections[Idx].bytes_in += len; My_Connections[Idx].bps += Handle_Buffer(Idx); /* Make sure that there is still a valid client registered */ c = Conn_GetClient(Idx); if (!c) return; /* Update timestamp of last data received if this connection is * registered as a user, server or service connection. Don't update * otherwise, so users have at least Conf_PongTimeout seconds time to * register with the IRC server -- see Check_Connections(). * Update "lastping", too, if time shifted backwards ... */ if (Client_Type(c) == CLIENT_USER || Client_Type(c) == CLIENT_SERVER || Client_Type(c) == CLIENT_SERVICE) { t = time(NULL); if (My_Connections[Idx].lastdata != t) My_Connections[Idx].bps = 0; My_Connections[Idx].lastdata = t; if (My_Connections[Idx].lastping > t) My_Connections[Idx].lastping = t; } /* Look at the data in the (read-) buffer of this connection */ if (Client_Type(c) != CLIENT_SERVER && Client_Type(c) != CLIENT_UNKNOWNSERVER && Client_Type(c) != CLIENT_SERVICE && My_Connections[Idx].bps >= maxbps) { LogDebug("Throttling connection %d: BPS exceeded! (%u >= %u)", Idx, My_Connections[Idx].bps, maxbps); Conn_SetPenalty(Idx, 1); } } /* Read_Request */ /** * Handle all data in the connection read-buffer. * * Data is processed until no complete command is left in the read buffer, * or MAX_COMMANDS[_SERVER|_SERVICE] commands were processed. * When a fatal error occurs, the connection is shut down. * * @param Idx Index of the connection. * @returns Number of bytes processed. */ static unsigned int Handle_Buffer(CONN_ID Idx) { #ifndef STRICT_RFC char *ptr1, *ptr2, *first_eol; #endif char *ptr; size_t len, delta; time_t starttime; #ifdef ZLIB bool old_z; #endif unsigned int i, maxcmd = MAX_COMMANDS, len_processed = 0; CLIENT *c; c = Conn_GetClient(Idx); starttime = time(NULL); assert(c != NULL); /* Servers get special command limits that depend on the user count */ switch (Client_Type(c)) { case CLIENT_SERVER: maxcmd = (int)(Client_UserCount() / 5) + MAX_COMMANDS_SERVER_MIN; /* Allow servers to handle even more commands while peering * to speed up server login and network synchronization. */ if (Conn_LastPing(Idx) == 0) maxcmd *= 5; break; case CLIENT_SERVICE: maxcmd = MAX_COMMANDS_SERVICE; break; } for (i=0; i < maxcmd; i++) { /* Check penalty */ if (My_Connections[Idx].delaytime > starttime) return 0; #ifdef ZLIB /* Unpack compressed data, if compression is in use */ if (Conn_OPTION_ISSET(&My_Connections[Idx], CONN_ZIP)) { /* When unzipping fails, Unzip_Buffer() shuts * down the connection itself */ if (!Unzip_Buffer(Idx)) return 0; } #endif if (0 == array_bytes(&My_Connections[Idx].rbuf)) break; /* Make sure that the buffer is NULL terminated */ if (!array_cat0_temporary(&My_Connections[Idx].rbuf)) { Conn_Close(Idx, NULL, "Can't allocate memory [Handle_Buffer]", true); return 0; } /* RFC 2812, section "2.3 Messages", 5th paragraph: * "IRC messages are always lines of characters terminated * with a CR-LF (Carriage Return - Line Feed) pair [...]". */ delta = 2; ptr = strstr(array_start(&My_Connections[Idx].rbuf), "\r\n"); #ifndef STRICT_RFC /* Check for non-RFC-compliant request (only CR or LF)? * Unfortunately, there are quite a few clients out there * that do this -- e. g. mIRC, BitchX, and Trillian :-( */ ptr1 = strchr(array_start(&My_Connections[Idx].rbuf), '\r'); ptr2 = strchr(array_start(&My_Connections[Idx].rbuf), '\n'); if (ptr) { /* Check if there is a single CR or LF _before_ the * corerct CR+LF line terminator: */ first_eol = ptr1 < ptr2 ? ptr1 : ptr2; if (first_eol < ptr) { /* Single CR or LF before CR+LF found */ ptr = first_eol; delta = 1; } } else if (ptr1 || ptr2) { /* No CR+LF terminated command found, but single * CR or LF found ... */ if (ptr1 && ptr2) ptr = ptr1 < ptr2 ? ptr1 : ptr2; else ptr = ptr1 ? ptr1 : ptr2; delta = 1; } #endif if (!ptr) break; /* Complete (=line terminated) request found, handle it! */ *ptr = '\0'; len = ptr - (char *)array_start(&My_Connections[Idx].rbuf) + delta; if (len > (COMMAND_LEN - 1)) { /* Request must not exceed 512 chars (incl. CR+LF!), * see RFC 2812. Disconnect Client if this happens. */ Log(LOG_ERR, "Request too long (connection %d): %d bytes (max. %d expected)!", Idx, array_bytes(&My_Connections[Idx].rbuf), COMMAND_LEN - 1); Conn_Close(Idx, NULL, "Request too long", true); return 0; } len_processed += (unsigned int)len; if (len <= delta) { /* Request is empty (only '\r\n', '\r' or '\n'); * delta is 2 ('\r\n') or 1 ('\r' or '\n'), see above */ array_moveleft(&My_Connections[Idx].rbuf, 1, len); continue; } #ifdef ZLIB /* remember if stream is already compressed */ old_z = My_Connections[Idx].options & CONN_ZIP; #endif My_Connections[Idx].msg_in++; if (!Parse_Request (Idx, (char *)array_start(&My_Connections[Idx].rbuf))) return 0; /* error -> connection has been closed */ array_moveleft(&My_Connections[Idx].rbuf, 1, len); #ifdef DEBUG_BUFFER LogDebug("Connection %d: %d bytes left in read buffer.", Idx, array_bytes(&My_Connections[Idx].rbuf)); #endif #ifdef ZLIB if ((!old_z) && (My_Connections[Idx].options & CONN_ZIP) && (array_bytes(&My_Connections[Idx].rbuf) > 0)) { /* The last command activated socket compression. * Data that was read after that needs to be copied * to the unzip buffer for decompression: */ if (!array_copy (&My_Connections[Idx].zip.rbuf, &My_Connections[Idx].rbuf)) { Conn_Close(Idx, NULL, "Can't allocate memory [Handle_Buffer]", true); return 0; } array_trunc(&My_Connections[Idx].rbuf); LogDebug ("Moved already received data (%u bytes) to uncompression buffer.", array_bytes(&My_Connections[Idx].zip.rbuf)); } #endif } return len_processed; } /* Handle_Buffer */ /** * Check whether established connections are still alive or not. * If not, play PING-PONG first; and if that doesn't help either, * disconnect the respective peer. */ static void Check_Connections(void) { CLIENT *c; CONN_ID i; char msg[64]; for (i = 0; i < Pool_Size; i++) { if (My_Connections[i].sock < 0) continue; c = Conn_GetClient(i); if (c && ((Client_Type(c) == CLIENT_USER) || (Client_Type(c) == CLIENT_SERVER) || (Client_Type(c) == CLIENT_SERVICE))) { /* connected User, Server or Service */ if (My_Connections[i].lastping > My_Connections[i].lastdata) { /* We already sent a ping */ if (My_Connections[i].lastping < time(NULL) - Conf_PongTimeout) { /* Timeout */ snprintf(msg, sizeof(msg), "Ping timeout: %d seconds", Conf_PongTimeout); LogDebug("Connection %d: %s.", i, msg); Conn_Close(i, NULL, msg, true); } } else if (My_Connections[i].lastdata < time(NULL) - Conf_PingTimeout) { /* We need to send a PING ... */ LogDebug("Connection %d: sending PING ...", i); Conn_UpdatePing(i); Conn_WriteStr(i, "PING :%s", Client_ID(Client_ThisServer())); } } else { /* The connection is not fully established yet, so * we don't do the PING-PONG game here but instead * disconnect the client after "a short time" if it's * still not registered. */ if (My_Connections[i].lastdata < time(NULL) - Conf_PongTimeout) { LogDebug ("Unregistered connection %d timed out ...", i); Conn_Close(i, NULL, "Timeout", false); } } } } /* Check_Connections */ /** * Check if further server links should be established. */ static void Check_Servers(void) { int i, n; time_t time_now; time_now = time(NULL); /* Check all configured servers */ for (i = 0; i < MAX_SERVERS; i++) { if (Conf_Server[i].conn_id != NONE) continue; /* Already establishing or connected */ if (!Conf_Server[i].host[0] || !Conf_Server[i].port > 0) continue; /* No host and/or port configured */ if (Conf_Server[i].flags & CONF_SFLAG_DISABLED) continue; /* Disabled configuration entry */ if (Conf_Server[i].lasttry > (time_now - Conf_ConnectRetry)) continue; /* We have to wait a little bit ... */ /* Is there already a connection in this group? */ if (Conf_Server[i].group > NONE) { for (n = 0; n < MAX_SERVERS; n++) { if (n == i) continue; if ((Conf_Server[n].conn_id != NONE) && (Conf_Server[n].group == Conf_Server[i].group)) break; } if (n < MAX_SERVERS) continue; } /* Okay, try to connect now */ Log(LOG_NOTICE, "Preparing to establish a new server link for \"%s\" ...", Conf_Server[i].name); Conf_Server[i].lasttry = time_now; Conf_Server[i].conn_id = SERVER_WAIT; assert(Proc_GetPipeFd(&Conf_Server[i].res_stat) < 0); Resolve_Name(&Conf_Server[i].res_stat, Conf_Server[i].host, cb_Connect_to_Server); } } /* Check_Servers */ /** * Establish a new outgoing server connection. * * @param Server Configuration index of the server. * @param dest Destination IP address to connect to. */ static void New_Server( int Server , ng_ipaddr_t *dest) { /* Establish new server link */ char ip_str[NG_INET_ADDRSTRLEN]; int af_dest, res, new_sock; CLIENT *c; assert( Server > NONE ); /* Make sure that the remote server hasn't re-linked to this server * asynchronously on its own */ if (Conf_Server[Server].conn_id > NONE) { Log(LOG_INFO, "Connection to \"%s\" meanwhile re-established, aborting preparation."); return; } if (!ng_ipaddr_tostr_r(dest, ip_str)) { Log(LOG_WARNING, "New_Server: Could not convert IP to string"); Conf_Server[Server].conn_id = NONE; return; } af_dest = ng_ipaddr_af(dest); new_sock = socket(af_dest, SOCK_STREAM, 0); Log(LOG_INFO, "Establishing connection for \"%s\" to \"%s:%d\" (%s), socket %d ...", Conf_Server[Server].name, Conf_Server[Server].host, Conf_Server[Server].port, ip_str, new_sock); if (new_sock < 0) { Log(LOG_CRIT, "Can't create socket (af %d): %s!", af_dest, strerror(errno)); Conf_Server[Server].conn_id = NONE; return; } if (!Init_Socket(new_sock)) { Conf_Server[Server].conn_id = NONE; return; } /* is a bind address configured? */ res = ng_ipaddr_af(&Conf_Server[Server].bind_addr); /* if yes, bind now. If it fails, warn and let connect() pick a source address */ if (res && bind(new_sock, (struct sockaddr *) &Conf_Server[Server].bind_addr, ng_ipaddr_salen(&Conf_Server[Server].bind_addr))) { ng_ipaddr_tostr_r(&Conf_Server[Server].bind_addr, ip_str); Log(LOG_WARNING, "Can't bind socket to %s: %s!", ip_str, strerror(errno)); } ng_ipaddr_setport(dest, Conf_Server[Server].port); res = connect(new_sock, (struct sockaddr *) dest, ng_ipaddr_salen(dest)); if(( res != 0 ) && ( errno != EINPROGRESS )) { Log( LOG_CRIT, "Can't connect socket: %s!", strerror( errno )); close( new_sock ); Conf_Server[Server].conn_id = NONE; return; } if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), (size_t)new_sock)) { Log(LOG_ALERT, "Cannot allocate memory for server connection (socket %d)", new_sock); close( new_sock ); Conf_Server[Server].conn_id = NONE; return; } if (!io_event_create( new_sock, IO_WANTWRITE, cb_connserver)) { Log(LOG_ALERT, "io_event_create(): could not add fd %d", strerror(errno)); close(new_sock); Conf_Server[Server].conn_id = NONE; return; } My_Connections = array_start(&My_ConnArray); assert(My_Connections[new_sock].sock <= 0); Init_Conn_Struct(new_sock); ng_ipaddr_tostr_r(dest, ip_str); c = Client_NewLocal(new_sock, ip_str, CLIENT_UNKNOWNSERVER, false); if (!c) { Log( LOG_ALERT, "Can't establish connection: can't create client structure!" ); io_close(new_sock); Conf_Server[Server].conn_id = NONE; return; } /* Conn_Close() decrements this counter again */ Account_Connection(); Client_SetIntroducer( c, c ); Client_SetToken( c, TOKEN_OUTBOUND ); /* Register connection */ if (!Conf_SetServer(Server, new_sock)) return; My_Connections[new_sock].sock = new_sock; My_Connections[new_sock].addr = *dest; My_Connections[new_sock].client = c; strlcpy( My_Connections[new_sock].host, Conf_Server[Server].host, sizeof(My_Connections[new_sock].host )); #ifdef SSL_SUPPORT if (Conf_Server[Server].SSLConnect && !ConnSSL_PrepareConnect( &My_Connections[new_sock], &Conf_Server[Server] )) { Log(LOG_ALERT, "Could not initialize SSL for outgoing connection"); Conn_Close( new_sock, "Could not initialize SSL for outgoing connection", NULL, false ); Init_Conn_Struct( new_sock ); Conf_Server[Server].conn_id = NONE; return; } #endif LogDebug("Registered new connection %d on socket %d (%ld in total).", new_sock, My_Connections[new_sock].sock, NumConnections); Conn_OPTION_ADD( &My_Connections[new_sock], CONN_ISCONNECTING ); } /* New_Server */ /** * Initialize connection structure. * * @param Idx Connection index. */ static void Init_Conn_Struct(CONN_ID Idx) { time_t now = time(NULL); memset(&My_Connections[Idx], 0, sizeof(CONNECTION)); My_Connections[Idx].sock = -1; My_Connections[Idx].signon = now; My_Connections[Idx].lastdata = now; My_Connections[Idx].lastprivmsg = now; Proc_InitStruct(&My_Connections[Idx].proc_stat); #ifdef ICONV My_Connections[Idx].iconv_from = (iconv_t)(-1); My_Connections[Idx].iconv_to = (iconv_t)(-1); #endif } /* Init_Conn_Struct */ /** * Initialize options of a new socket. * * For example, we try to set socket options SO_REUSEADDR and IPTOS_LOWDELAY. * The socket is automatically closed if a fatal error is encountered. * * @param Sock Socket handle. * @returns false if socket was closed due to fatal error. */ static bool Init_Socket( int Sock ) { int value; if (!io_setnonblock(Sock)) { Log( LOG_CRIT, "Can't enable non-blocking mode for socket: %s!", strerror( errno )); close( Sock ); return false; } /* Don't block this port after socket shutdown */ value = 1; if( setsockopt( Sock, SOL_SOCKET, SO_REUSEADDR, &value, (socklen_t)sizeof( value )) != 0 ) { Log( LOG_ERR, "Can't set socket option SO_REUSEADDR: %s!", strerror( errno )); /* ignore this error */ } /* Set type of service (TOS) */ #if defined(IPPROTO_IP) && defined(IPTOS_LOWDELAY) value = IPTOS_LOWDELAY; if (setsockopt(Sock, IPPROTO_IP, IP_TOS, &value, (socklen_t) sizeof(value))) { LogDebug("Can't set socket option IP_TOS: %s!", strerror(errno)); /* ignore this error */ } else LogDebug("IP_TOS on socket %d has been set to IPTOS_LOWDELAY.", Sock); #endif return true; } /* Init_Socket */ /** * Read results of a resolver sub-process and try to initiate a new server * connection. * * @param fd File descriptor of the pipe to the sub-process. * @param events (ignored IO specification) */ static void cb_Connect_to_Server(int fd, UNUSED short events) { /* Read result of resolver sub-process from pipe and start connection */ int i; size_t len; ng_ipaddr_t dest_addrs[4]; /* we can handle at most 3; but we read up to four so we can log the 'more than we can handle' condition. First result is tried immediately, rest is saved for later if needed. */ LogDebug("Resolver: Got forward lookup callback on fd %d, events %d", fd, events); for (i=0; i < MAX_SERVERS; i++) { if (Proc_GetPipeFd(&Conf_Server[i].res_stat) == fd ) break; } if( i >= MAX_SERVERS) { /* Ops, no matching server found?! */ io_close( fd ); LogDebug("Resolver: Got Forward Lookup callback for unknown server!?"); return; } /* Read result from pipe */ len = Proc_Read(&Conf_Server[i].res_stat, dest_addrs, sizeof(dest_addrs)); Proc_Close(&Conf_Server[i].res_stat); if (len == 0) { /* Error resolving hostname: reset server structure */ Conf_Server[i].conn_id = NONE; return; } assert((len % sizeof(ng_ipaddr_t)) == 0); LogDebug("Got result from resolver: %u structs (%u bytes).", len/sizeof(ng_ipaddr_t), len); memset(&Conf_Server[i].dst_addr, 0, sizeof(Conf_Server[i].dst_addr)); if (len > sizeof(ng_ipaddr_t)) { /* more than one address for this hostname, remember them * in case first address is unreachable/not available */ len -= sizeof(ng_ipaddr_t); if (len > sizeof(Conf_Server[i].dst_addr)) { len = sizeof(Conf_Server[i].dst_addr); Log(LOG_NOTICE, "Notice: Resolver returned more IP Addresses for host than we can handle, additional addresses dropped."); } memcpy(&Conf_Server[i].dst_addr, &dest_addrs[1], len); } /* connect() */ New_Server(i, dest_addrs); } /* cb_Read_Forward_Lookup */ /** * Read results of a resolver sub-process from the pipe and update the * appropriate connection/client structure(s): hostname and/or IDENT user name. * * @param r_fd File descriptor of the pipe to the sub-process. * @param events (ignored IO specification) */ static void cb_Read_Resolver_Result( int r_fd, UNUSED short events ) { CLIENT *c; CONN_ID i; size_t len; char *identptr; #ifdef IDENTAUTH char readbuf[HOST_LEN + 2 + CLIENT_USER_LEN]; char *ptr; #else char readbuf[HOST_LEN + 1]; #endif LogDebug("Resolver: Got callback on fd %d, events %d", r_fd, events ); i = Conn_GetFromProc(r_fd); if (i == NONE) { /* Ops, none found? Probably the connection has already * been closed!? We'll ignore that ... */ io_close( r_fd ); LogDebug("Resolver: Got callback for unknown connection!?"); return; } /* Read result from pipe */ len = Proc_Read(&My_Connections[i].proc_stat, readbuf, sizeof readbuf -1); Proc_Close(&My_Connections[i].proc_stat); if (len == 0) return; readbuf[len] = '\0'; identptr = strchr(readbuf, '\n'); assert(identptr != NULL); if (!identptr) { Log( LOG_CRIT, "Resolver: Got malformed result!"); return; } *identptr = '\0'; LogDebug("Got result from resolver: \"%s\" (%u bytes read).", readbuf, len); /* Okay, we got a complete result: this is a host name for outgoing * connections and a host name and IDENT user name (if enabled) for * incoming connections.*/ assert ( My_Connections[i].sock >= 0 ); /* Incoming connection. Search client ... */ c = Conn_GetClient( i ); assert( c != NULL ); /* Only update client information of unregistered clients. * Note: user commands (e. g. WEBIRC) are always read _after_ reading * the resolver results, so we don't have to worry to override settings * from these commands here. */ if(Client_Type(c) == CLIENT_UNKNOWN) { strlcpy(My_Connections[i].host, readbuf, sizeof(My_Connections[i].host)); Client_SetHostname(c, readbuf); if (Conf_NoticeAuth) (void)Conn_WriteStr(i, "NOTICE AUTH :*** Found your hostname: %s", My_Connections[i].host); #ifdef IDENTAUTH ++identptr; if (*identptr) { ptr = identptr; while (*ptr) { if ((*ptr < '0' || *ptr > '9') && (*ptr < 'A' || *ptr > 'Z') && (*ptr < 'a' || *ptr > 'z')) break; ptr++; } if (*ptr) { /* Erroneous IDENT reply */ Log(LOG_NOTICE, "Got invalid IDENT reply for connection %d! Ignored.", i); } else { Log(LOG_INFO, "IDENT lookup for connection %d: \"%s\".", i, identptr); Client_SetUser(c, identptr, true); } if (Conf_NoticeAuth) { (void)Conn_WriteStr(i, "NOTICE AUTH :*** Got %sident response%s%s", *ptr ? "invalid " : "", *ptr ? "" : ": ", *ptr ? "" : identptr); } } else if(Conf_Ident) { Log(LOG_INFO, "IDENT lookup for connection %d: no result.", i); if (Conf_NoticeAuth) (void)Conn_WriteStr(i, "NOTICE AUTH :*** No ident response"); } #endif if (Conf_NoticeAuth) { /* Send buffered data to the client, but break on * errors because Handle_Write() would have closed * the connection again in this case! */ if (!Handle_Write(i)) return; } Class_HandleServerBans(c); } #ifdef DEBUG else LogDebug("Resolver: discarding result for already registered connection %d.", i); #endif } /* cb_Read_Resolver_Result */ /** * Write a "simple" (error) message to a socket. * * The message is sent without using the connection write buffers, without * compression/encryption, and even without any error reporting. It is * designed for error messages of e.g. New_Connection(). * * @param Sock Socket handle. * @param Msg Message string to send. */ static void Simple_Message(int Sock, const char *Msg) { char buf[COMMAND_LEN]; size_t len; assert(Sock > NONE); assert(Msg != NULL); strlcpy(buf, Msg, sizeof buf - 2); len = strlcat(buf, "\r\n", sizeof buf); if (write(Sock, buf, len) < 0) { /* Because this function most probably got called to log * an error message, any write error is ignored here to * avoid an endless loop. But casting the result of write() * to "void" doesn't satisfy the GNU C code attribute * "warn_unused_result" which is used by some versions of * glibc (e.g. 2.11.1), therefore this silly error * "handling" code here :-( */ return; } } /* Simple_Error */ /** * Get CLIENT structure that belongs to a local connection identified by its * index number. Each connection belongs to a client by definition, so it is * not required that the caller checks for NULL return values. * * @param Idx Connection index number. * @returns Pointer to CLIENT structure. */ GLOBAL CLIENT * Conn_GetClient( CONN_ID Idx ) { CONNECTION *c; assert(Idx >= 0); c = array_get(&My_ConnArray, sizeof (CONNECTION), (size_t)Idx); assert(c != NULL); return c ? c->client : NULL; } /** * Get PROC_STAT sub-process structure of a connection. * * @param Idx Connection index number. * @returns PROC_STAT structure. */ GLOBAL PROC_STAT * Conn_GetProcStat(CONN_ID Idx) { CONNECTION *c; assert(Idx >= 0); c = array_get(&My_ConnArray, sizeof (CONNECTION), (size_t)Idx); assert(c != NULL); return &c->proc_stat; } /* Conn_GetProcStat */ /** * Get CONN_ID from file descriptor associated to a subprocess structure. * * @param fd File descriptor. * @returns CONN_ID or NONE (-1). */ GLOBAL CONN_ID Conn_GetFromProc(int fd) { int i; assert(fd > 0); for (i = 0; i < Pool_Size; i++) { if ((My_Connections[i].sock != NONE) && (Proc_GetPipeFd(&My_Connections[i].proc_stat) == fd)) return i; } return NONE; } /* Conn_GetFromProc */ #ifndef STRICT_RFC GLOBAL long Conn_GetAuthPing(CONN_ID Idx) { assert (Idx != NONE); return My_Connections[Idx].auth_ping; } /* Conn_GetAuthPing */ GLOBAL void Conn_SetAuthPing(CONN_ID Idx, long ID) { assert (Idx != NONE); My_Connections[Idx].auth_ping = ID; } /* Conn_SetAuthPing */ #endif #ifdef SSL_SUPPORT /** * Get information about used SSL cipher. * * @param Idx Connection index number. * @param buf Buffer for returned information text. * @param len Size of return buffer "buf". * @returns true on success, false otherwise. */ GLOBAL bool Conn_GetCipherInfo(CONN_ID Idx, char *buf, size_t len) { if (Idx < 0) return false; assert(Idx < (int) array_length(&My_ConnArray, sizeof(CONNECTION))); return ConnSSL_GetCipherInfo(&My_Connections[Idx], buf, len); } /** * Check if a connection is SSL-enabled or not. * * @param Idx Connection index number. * @return true if connection is SSL-enabled, false otherwise. */ GLOBAL bool Conn_UsesSSL(CONN_ID Idx) { if (Idx < 0) return false; assert(Idx < (int) array_length(&My_ConnArray, sizeof(CONNECTION))); return Conn_OPTION_ISSET(&My_Connections[Idx], CONN_SSL); } GLOBAL char * Conn_GetCertFp(CONN_ID Idx) { if (Idx < 0) return NULL; assert(Idx < (int) array_length(&My_ConnArray, sizeof(CONNECTION))); return ConnSSL_GetCertFp(&My_Connections[Idx]); } GLOBAL bool Conn_SetCertFp(CONN_ID Idx, const char *fingerprint) { if (Idx < 0) return false; assert(Idx < (int) array_length(&My_ConnArray, sizeof(CONNECTION))); return ConnSSL_SetCertFp(&My_Connections[Idx], fingerprint); } #else GLOBAL bool Conn_UsesSSL(UNUSED CONN_ID Idx) { return false; } GLOBAL char * Conn_GetCertFp(UNUSED CONN_ID Idx) { return NULL; } GLOBAL bool Conn_SetCertFp(UNUSED CONN_ID Idx, UNUSED const char *fingerprint) { return true; } #endif #ifdef DEBUG /** * Dump internal state of the "connection module". */ GLOBAL void Conn_DebugDump(void) { int i; Log(LOG_DEBUG, "Connection status:"); for (i = 0; i < Pool_Size; i++) { if (My_Connections[i].sock == NONE) continue; Log(LOG_DEBUG, " - %d: host=%s, lastdata=%ld, lastping=%ld, delaytime=%ld, flag=%d, options=%d, bps=%d, client=%s", My_Connections[i].sock, My_Connections[i].host, My_Connections[i].lastdata, My_Connections[i].lastping, My_Connections[i].delaytime, My_Connections[i].flag, My_Connections[i].options, My_Connections[i].bps, My_Connections[i].client ? Client_ID(My_Connections[i].client) : "-"); } } /* Conn_DumpClients */ #endif /* -eof- */ ngircd-21/src/ngircd/irc-op.h0000644000175000116100000000126411526006312013057 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #ifndef __irc_op_h__ #define __irc_op_h__ /** * @file * Channel operator commands (header) */ GLOBAL bool IRC_KICK PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_INVITE PARAMS(( CLIENT *Client, REQUEST *Req )); #endif /* -eof- */ ngircd-21/src/ngircd/io.h0000644000175000116100000000306111526006312012272 00000000000000/* * 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. */ #ifndef io_H_included #define io_H_included /** * @file * I/O abstraction interface (header) */ #include "portab.h" #include #define IO_WANTREAD 1 #define IO_WANTWRITE 2 /* init library. sets up epoll/kqueue descriptors and tries to allocate space for ioevlen file descriptors. ioevlen is just the _initial_ size, not a limit. */ bool io_library_init PARAMS((unsigned int ioevlen)); /* shutdown and free all internal data structures */ void io_library_shutdown PARAMS((void)); /* add fd to internal set, enable readability check, set callback */ bool io_event_create PARAMS((int fd, short what, void (*cbfunc)(int, short))); /* change callback function associated with fd */ bool io_event_setcb PARAMS((int fd, void (*cbfunc)(int, short))); /* watch fd for event of type what */ bool io_event_add PARAMS((int fd, short what)); /* do not watch fd for event of type what */ bool io_event_del PARAMS((int fd, short what)); /* remove fd from watchlist, close() fd. */ bool io_close PARAMS((int fd)); /* set O_NONBLOCK */ bool io_setnonblock PARAMS((int fd)); /* set O_CLOEXEC */ bool io_setcloexec PARAMS((int fd)); /* watch fds for activity */ int io_dispatch PARAMS((struct timeval *tv)); #endif /* io_H_included */ ngircd-21/src/ngircd/sighandlers.c0000644000175000116100000001674312206130744014177 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * Signal Handlers: Actions to be performed when the program * receives a signal. */ #include #include #include #include #include #include #include #include "imp.h" #include "conn.h" #include "conf-ssl.h" #include "channel.h" #include "conf.h" #include "io.h" #include "log.h" #include "ngircd.h" #include "sighandlers.h" static int signalpipe[2]; static const int signals_catch[] = { SIGINT, SIGQUIT, SIGTERM, SIGHUP, SIGCHLD, SIGUSR1, SIGUSR2 }; #ifdef DEBUG static void Dump_State(void) { Log(LOG_DEBUG, "--- Internal server state: %s ---", Client_ID(Client_ThisServer())); Log(LOG_DEBUG, "time()=%ld", time(NULL)); Conf_DebugDump(); Conn_DebugDump(); Client_DebugDump(); Log(LOG_DEBUG, "--- End of state dump ---"); } /* Dump_State */ #endif static void Signal_Block(int sig) { #ifdef HAVE_SIGPROCMASK sigset_t set; sigemptyset(&set); sigaddset(&set, sig); sigprocmask(SIG_BLOCK, &set, NULL); #else sigblock(sig); #endif } static void Signal_Unblock(int sig) { #ifdef HAVE_SIGPROCMASK sigset_t set; sigemptyset(&set); sigaddset(&set, sig); sigprocmask(SIG_UNBLOCK, &set, NULL); #else int old = sigblock(0) & ~sig; sigsetmask(old); #endif } /** * Reload the server configuration file. */ static void Rehash(void) { char old_name[CLIENT_ID_LEN]; unsigned old_nicklen; Log( LOG_NOTICE|LOG_snotice, "Re-reading configuration NOW!" ); /* Remember old server name and nickname length */ strlcpy( old_name, Conf_ServerName, sizeof old_name ); old_nicklen = Conf_MaxNickLength; /* Re-read configuration ... */ if (!Conf_Rehash( )) return; /* Close down all listening sockets */ Conn_ExitListeners( ); /* Recover old server name and nickname length: these values can't * be changed during run-time */ if (strcmp(old_name, Conf_ServerName) != 0 ) { strlcpy(Conf_ServerName, old_name, sizeof Conf_ServerName); Log(LOG_ERR, "Can't change \"ServerName\" on runtime! Ignored new name."); } if (old_nicklen != Conf_MaxNickLength) { Conf_MaxNickLength = old_nicklen; Log(LOG_ERR, "Can't change \"MaxNickLength\" on runtime! Ignored new value."); } /* Create new pre-defined channels */ Channel_InitPredefined( ); if (!ConnSSL_InitLibrary()) Log(LOG_WARNING, "Re-Initializing of SSL failed, using old keys!"); /* Start listening on sockets */ Conn_InitListeners( ); /* Sync configuration with established connections */ Conn_SyncServerStruct( ); Log( LOG_NOTICE|LOG_snotice, "Re-reading of configuration done." ); } /* Rehash */ /** * Signal handler of ngIRCd. * This function is called whenever ngIRCd catches a signal sent by the * user and/or the system to it. For example SIGTERM and SIGHUP. * * It blocks the signal and queues it for later execution by Signal_Handler_BH. * @param Signal Number of the signal to handle. */ static void Signal_Handler(int Signal) { switch (Signal) { case SIGTERM: case SIGINT: case SIGQUIT: /* shut down sever */ NGIRCd_SignalQuit = true; return; case SIGCHLD: /* child-process exited, avoid zombies */ while (waitpid( -1, NULL, WNOHANG) > 0) ; return; #ifdef DEBUG case SIGUSR1: if (! NGIRCd_Debug) { Log(LOG_INFO|LOG_snotice, "Got SIGUSR1, debug mode activated."); #ifdef SNIFFER strcpy(NGIRCd_DebugLevel, "2"); NGIRCd_Debug = true; NGIRCd_Sniffer = true; #else strcpy(NGIRCd_DebugLevel, "1"); NGIRCd_Debug = true; #endif /* SNIFFER */ } else { Log(LOG_INFO|LOG_snotice, "Got SIGUSR1, debug mode deactivated."); strcpy(NGIRCd_DebugLevel, ""); NGIRCd_Debug = false; #ifdef SNIFFER NGIRCd_Sniffer = false; #endif /* SNIFFER */ } return; #endif } /* * other signal: queue for later execution. * This has the advantage that we are not restricted * to functions that can be called safely from signal handlers. */ if (write(signalpipe[1], &Signal, sizeof(Signal)) != -1) Signal_Block(Signal); } /* Signal_Handler */ /** * Signal processing handler of ngIRCd. * This function is called from the main conn event loop in (io_dispatch) * whenever ngIRCd has queued a signal. * * This function runs in normal context, not from the real signal handler, * thus its not necessary to only use functions that are signal safe. * @param Signal Number of the signal that was queued. */ static void Signal_Handler_BH(int Signal) { switch (Signal) { case SIGHUP: /* re-read configuration */ Rehash(); break; #ifdef DEBUG case SIGUSR2: if (NGIRCd_Debug) { Log(LOG_INFO|LOG_snotice, "Got SIGUSR2, dumping internal state ..."); Dump_State(); } break; default: Log(LOG_DEBUG, "Got signal %d! Ignored.", Signal); #endif } Signal_Unblock(Signal); } static void Signal_Callback(int fd, short UNUSED what) { int sig, ret; (void) what; do { ret = (int)read(fd, &sig, sizeof(sig)); if (ret == sizeof(int)) Signal_Handler_BH(sig); } while (ret == sizeof(int)); if (ret == -1) { if (errno == EAGAIN || errno == EINTR) return; Log(LOG_EMERG, "Read from signal pipe: %s - Exiting!", strerror(errno)); exit(1); } Log(LOG_EMERG, "EOF on signal pipe!? - Exiting!"); exit(1); } /** * Initialize the signal handlers, catch * those signals we are interested in and sets SIGPIPE to be ignored. * @return true if initialization was successful. */ bool Signals_Init(void) { size_t i; #ifdef HAVE_SIGACTION struct sigaction saction; #endif if (signalpipe[0] > 0 || signalpipe[1] > 0) return true; if (pipe(signalpipe)) return false; if (!io_setnonblock(signalpipe[0]) || !io_setnonblock(signalpipe[1])) return false; if (!io_setcloexec(signalpipe[0]) || !io_setcloexec(signalpipe[1])) return false; #ifdef HAVE_SIGACTION memset( &saction, 0, sizeof( saction )); saction.sa_handler = Signal_Handler; #ifdef SA_RESTART saction.sa_flags |= SA_RESTART; #endif #ifdef SA_NOCLDWAIT saction.sa_flags |= SA_NOCLDWAIT; #endif for (i=0; i < C_ARRAY_SIZE(signals_catch) ; i++) sigaction(signals_catch[i], &saction, NULL); /* we handle write errors properly; ignore SIGPIPE */ saction.sa_handler = SIG_IGN; sigaction(SIGPIPE, &saction, NULL); #else for (i=0; i < C_ARRAY_SIZE(signals_catch) ; i++) signal(signals_catch[i], Signal_Handler); signal(SIGPIPE, SIG_IGN); #endif return io_event_create(signalpipe[0], IO_WANTREAD, Signal_Callback); } /* Signals_Init */ /** * Restores signals to their default behavior. * * This should be called after a fork() in the new * child prodcess, especially when we are about to call * 3rd party code (e.g. PAM). */ void Signals_Exit(void) { size_t i; #ifdef HAVE_SIGACTION struct sigaction saction; memset(&saction, 0, sizeof(saction)); saction.sa_handler = SIG_DFL; for (i=0; i < C_ARRAY_SIZE(signals_catch) ; i++) sigaction(signals_catch[i], &saction, NULL); sigaction(SIGPIPE, &saction, NULL); #else for (i=0; i < C_ARRAY_SIZE(signals_catch) ; i++) signal(signals_catch[i], SIG_DFL); signal(SIGPIPE, SIG_DFL); #endif close(signalpipe[1]); close(signalpipe[0]); signalpipe[0] = signalpipe[1] = 0; } /* -eof- */ ngircd-21/src/ngircd/irc-macros.h0000644000175000116100000000730512206130744013732 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __irc_macros_h__ #define __irc_macros_h__ /** * @file * Macros for functions that handle IRC commands. */ /** * Make sure that number of passed parameters is equal to Count. * * If there are not exactly Count parameters, send an error to the client and * return from the function. */ #define _IRC_ARGC_EQ_OR_RETURN_(Client, Req, Count) \ if (Req->argc != Count) { \ IRC_SetPenalty(Client, 2); \ return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \ Client_ID(Client), Req->command); \ } /** * Make sure that number of passed parameters is less or equal than Max. * * If there are more than Max parameters, send an error to the client and * return from the function. */ #define _IRC_ARGC_LE_OR_RETURN_(Client, Req, Max) \ if (Req->argc > Max) { \ IRC_SetPenalty(Client, 2); \ return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \ Client_ID(Client), Req->command); \ } /** * Make sure that number of passed parameters is greater or equal than Min. * * If there aren't at least Min parameters, send an error to the client and * return from the function. */ #define _IRC_ARGC_GE_OR_RETURN_(Client, Req, Min) \ if (Req->argc < Min) { \ IRC_SetPenalty(Client, 2); \ return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \ Client_ID(Client), Req->command); \ } /** * Make sure that number of passed parameters is in between Min and Max. * * If there aren't at least Min parameters or if there are more than Max * parameters, send an error to the client and return from the function. */ #define _IRC_ARGC_BETWEEN_OR_RETURN_(Client, Req, Min, Max) \ if (Req->argc < Min || Req->argc > Max) { \ IRC_SetPenalty(Client, 2); \ return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \ Client_ID(Client), Req->command); \ } /** * Get sender of an IRC command. * * The sender is either stored in the prefix if the command has been * received from a server or set to the client. If the sender is invalid, * send an error to the client and return from the function. */ #define _IRC_GET_SENDER_OR_RETURN_(Sender, Req, Client) \ if (Client_Type(Client) == CLIENT_SERVER) \ Sender = Client_Search(Req->prefix); \ else \ Sender = Client; \ if (!Sender) \ return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG, \ Client_ID(Client), Req->prefix); /** * Get target of an IRC command and make sure that it is a server. * * Set the target to the local server if no target parameter is given in the * received command, and send an error to the client and return from the * function if the given target isn't resolvable to a server: the target * parameter can be a server name, a nick name (then the target is set to * the server to which this nick is connected), or a mask matching at least * one server name in the network. */ #define _IRC_GET_TARGET_SERVER_OR_RETURN_(Target, Req, Argc, From) \ if (Req->argc > Argc) { \ Target = Client_Search(Req->argv[Argc]); \ if (!Target) \ Target = Client_SearchServer(Req->argv[Argc]); \ if (!Target) \ return IRC_WriteStrClient(From, ERR_NOSUCHSERVER_MSG, \ Client_ID(From), Req->argv[Argc]); \ if (Client_Type(Target) != CLIENT_SERVER) \ Target = Client_Introducer(Target); \ } else \ Target = Client_ThisServer(); #endif /* __irc_macros_h__ */ /* -eof- */ ngircd-21/src/ngircd/irc.c0000644000175000116100000005202112222633257012443 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * IRC commands */ #include "imp.h" #include #include #include #include "ngircd.h" #include "conn-func.h" #include "conf.h" #include "channel.h" #include "conn-encoding.h" #include "defines.h" #include "irc-macros.h" #include "irc-write.h" #include "log.h" #include "match.h" #include "messages.h" #include "parse.h" #include "op.h" #include "tool.h" #include "exp.h" #include "irc.h" static char *Option_String PARAMS((CONN_ID Idx)); static bool Send_Message PARAMS((CLIENT *Client, REQUEST *Req, int ForceType, bool SendErrors)); static bool Send_Message_Mask PARAMS((CLIENT *from, char *command, char *targetMask, char *message, bool SendErrors)); static bool Help PARAMS((CLIENT *Client, const char *Topic)); /** * Check if a list limit is reached and inform client accordingly. * * @param From The client. * @param Count Reply item count. * @param Limit Reply limit. * @param Name Name of the list. * @return true if list limit has been reached; false otherwise. */ GLOBAL bool IRC_CheckListTooBig(CLIENT *From, const int Count, const int Limit, const char *Name) { assert(From != NULL); assert(Count >= 0); assert(Limit > 0); assert(Name != NULL); if (Count < Limit) return false; (void)IRC_WriteStrClient(From, "NOTICE %s :%s list limit (%d) reached!", Client_ID(From), Name, Limit); IRC_SetPenalty(From, 2); return true; } /** * Handler for the IRC "ERROR" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_ERROR(CLIENT *Client, REQUEST *Req) { assert( Client != NULL ); assert( Req != NULL ); if (Client_Type(Client) != CLIENT_GOTPASS && Client_Type(Client) != CLIENT_GOTPASS_2813 && Client_Type(Client) != CLIENT_UNKNOWNSERVER && Client_Type(Client) != CLIENT_SERVER && Client_Type(Client) != CLIENT_SERVICE) { LogDebug("Ignored ERROR command from \"%s\" ...", Client_Mask(Client)); IRC_SetPenalty(Client, 2); return CONNECTED; } if (Req->argc < 1) Log(LOG_NOTICE, "Got ERROR from \"%s\"!", Client_Mask(Client)); else Log(LOG_NOTICE, "Got ERROR from \"%s\": \"%s\"!", Client_Mask(Client), Req->argv[0]); return CONNECTED; } /* IRC_ERROR */ /** * Handler for the IRC "KILL" command. * * This function implements the IRC command "KILL" which is used to selectively * disconnect clients. It can be used by IRC operators and servers, for example * to "solve" nick collisions after netsplits. See RFC 2812 section 3.7.1. * * Please note that this function is also called internally, without a real * KILL command being received over the network! Client is Client_ThisServer() * in this case, and the prefix in Req is NULL. * * @param Client The client from which this command has been received or * Client_ThisServer() when generated interanlly. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_KILL(CLIENT *Client, REQUEST *Req) { CLIENT *prefix; char reason[COMMAND_LEN]; assert (Client != NULL); assert (Req != NULL); if (Client_Type(Client) != CLIENT_SERVER && !Op_Check(Client, Req)) return Op_NoPrivileges(Client, Req); /* Get prefix (origin); use the client if no prefix is given. */ if (Req->prefix) prefix = Client_Search(Req->prefix); else prefix = Client; /* Log a warning message and use this server as origin when the * prefix (origin) is invalid. And this is the reason why we don't * use the _IRC_GET_SENDER_OR_RETURN_ macro above! */ if (!prefix) { Log(LOG_WARNING, "Got KILL with invalid prefix: \"%s\"!", Req->prefix ); prefix = Client_ThisServer(); } if (Client != Client_ThisServer()) Log(LOG_NOTICE|LOG_snotice, "Got KILL command from \"%s\" for \"%s\": \"%s\".", Client_Mask(prefix), Req->argv[0], Req->argv[1]); /* Build reason string: Prefix the "reason" if the originator is a * regular user, so users can't spoof KILLs of servers. */ if (Client_Type(Client) == CLIENT_USER) snprintf(reason, sizeof(reason), "KILLed by %s: %s", Client_ID(Client), Req->argv[1]); else strlcpy(reason, Req->argv[1], sizeof(reason)); return IRC_KillClient(Client, prefix, Req->argv[0], reason); } /** * Handler for the IRC "NOTICE" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_NOTICE(CLIENT *Client, REQUEST *Req) { return Send_Message(Client, Req, CLIENT_USER, false); } /* IRC_NOTICE */ /** * Handler for the IRC "PRIVMSG" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_PRIVMSG(CLIENT *Client, REQUEST *Req) { return Send_Message(Client, Req, CLIENT_USER, true); } /* IRC_PRIVMSG */ /** * Handler for the IRC "SQUERY" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_SQUERY(CLIENT *Client, REQUEST *Req) { return Send_Message(Client, Req, CLIENT_SERVICE, true); } /* IRC_SQUERY */ /* * Handler for the IRC "TRACE" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_TRACE(CLIENT *Client, REQUEST *Req) { CLIENT *from, *target, *c; CONN_ID idx, idx2; char user[CLIENT_USER_LEN]; assert(Client != NULL); assert(Req != NULL); IRC_SetPenalty(Client, 3); _IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from) /* Forward command to other server? */ if (target != Client_ThisServer()) { /* Send RPL_TRACELINK back to initiator */ idx = Client_Conn(Client); assert(idx > NONE); idx2 = Client_Conn(Client_NextHop(target)); assert(idx2 > NONE); if (!IRC_WriteStrClient(from, RPL_TRACELINK_MSG, Client_ID(from), PACKAGE_NAME, PACKAGE_VERSION, Client_ID(target), Client_ID(Client_NextHop(target)), Option_String(idx2), time(NULL) - Conn_StartTime(idx2), Conn_SendQ(idx), Conn_SendQ(idx2))) return DISCONNECTED; /* Forward command */ IRC_WriteStrClientPrefix(target, from, "TRACE %s", Req->argv[0]); return CONNECTED; } /* Infos about all connected servers */ c = Client_First(); while (c) { if (Client_Conn(c) > NONE) { /* Local client */ if (Client_Type(c) == CLIENT_SERVER) { /* Server link */ strlcpy(user, Client_User(c), sizeof(user)); if (user[0] == '~') strlcpy(user, "unknown", sizeof(user)); if (!IRC_WriteStrClient(from, RPL_TRACESERVER_MSG, Client_ID(from), Client_ID(c), user, Client_Hostname(c), Client_Mask(Client_ThisServer()), Option_String(Client_Conn(c)))) return DISCONNECTED; } if (Client_Type(c) == CLIENT_USER && Client_HasMode(c, 'o')) { /* IRC Operator */ if (!IRC_WriteStrClient(from, RPL_TRACEOPERATOR_MSG, Client_ID(from), Client_ID(c))) return DISCONNECTED; } } c = Client_Next( c ); } return IRC_WriteStrClient(from, RPL_TRACEEND_MSG, Client_ID(from), Conf_ServerName, PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel); } /* IRC_TRACE */ /** * Handler for the IRC "HELP" command. * * @param Client The client from which this command has been received. * @param Req Request structure with prefix and all parameters. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool IRC_HELP(CLIENT *Client, REQUEST *Req) { COMMAND *cmd; assert(Client != NULL); assert(Req != NULL); IRC_SetPenalty(Client, 2); if ((Req->argc == 0 && array_bytes(&Conf_Helptext) > 0) || (Req->argc >= 1 && strcasecmp(Req->argv[0], "Commands") != 0)) { /* Help text available and requested */ if (Req->argc >= 1) return Help(Client, Req->argv[0]); if (!Help(Client, "Intro")) return DISCONNECTED; return CONNECTED; } cmd = Parse_GetCommandStruct(); while(cmd->name) { if (!IRC_WriteStrClient(Client, "NOTICE %s :%s", Client_ID(Client), cmd->name)) return DISCONNECTED; cmd++; } return CONNECTED; } /* IRC_HELP */ /** * Kill an client identified by its nick name. * * Please note that after killig a client, its CLIENT cond CONNECTION * structures are invalid. So the caller must make sure on its own not to * access data of probably killed clients after calling this function! * * @param Client The client from which the command leading to the KILL has * been received, or NULL. The KILL will no be forwarded in this * direction. Only relevant when From is set, too. * @param From The client from which the command originated, or NULL for the local server. * @param Nick The nick name to kill. * @param Reason Text to send as reason to the client and other servers. */ GLOBAL bool IRC_KillClient(CLIENT *Client, CLIENT *From, const char *Nick, const char *Reason) { const char *msg; CONN_ID my_conn, conn; CLIENT *c; /* Do we know such a client in the network? */ c = Client_Search(Nick); if (!c) { LogDebug("Client with nick \"%s\" is unknown, not forwaring.", Nick); return CONNECTED; } /* Inform other servers */ IRC_WriteStrServersPrefix(From ? Client : NULL, From ? From : Client_ThisServer(), "KILL %s :%s", Nick, Reason); if (Client_Type(c) != CLIENT_USER && Client_Type(c) != CLIENT_GOTNICK) { /* Target of this KILL is not a regular user, this is * invalid! So we ignore this case if we received a * regular KILL from the network and try to kill the * client/connection anyway (but log an error!) if the * origin is the local server. */ if (Client != Client_ThisServer()) { /* Invalid KILL received from remote */ if (Client_Type(c) == CLIENT_SERVER) msg = ERR_CANTKILLSERVER_MSG; else msg = ERR_NOPRIVILEGES_MSG; return IRC_WriteErrClient(Client, msg, Client_ID(Client)); } Log(LOG_ERR, "Got KILL for invalid client type: %d, \"%s\"!", Client_Type(c), Nick); } /* Save ID of this connection */ my_conn = Client_Conn(Client); /* Kill the client NOW: * - Close the local connection (if there is one), * - Destroy the CLIENT structure for remote clients. * Note: Conn_Close() removes the CLIENT structure as well. */ conn = Client_Conn(c); if(conn > NONE) Conn_Close(conn, NULL, Reason, true); else Client_Destroy(c, NULL, Reason, false); /* Are we still connected or were we killed, too? */ if (my_conn > NONE && Conn_GetClient(my_conn)) return CONNECTED; else return DISCONNECTED; } /** * Send help for a given topic to the client. * * @param Client The client requesting help. * @param Topoc The help topic requested. * @return CONNECTED or DISCONNECTED. */ static bool Help(CLIENT *Client, const char *Topic) { char *line; size_t helptext_len, len_str, idx_start, lines = 0; bool in_article = false; assert(Client != NULL); assert(Topic != NULL); helptext_len = array_bytes(&Conf_Helptext); line = array_start(&Conf_Helptext); while (helptext_len > 0) { len_str = strlen(line) + 1; assert(helptext_len >= len_str); helptext_len -= len_str; if (in_article) { /* The first character in each article text line must * be a TAB (ASCII 9) character which will be stripped * in the output. If it is not a TAB, the end of the * article has been reached. */ if (line[0] != '\t') { if (lines > 0) return CONNECTED; else break; } /* A single '.' character indicates an empty line */ if (line[1] == '.' && line[2] == '\0') idx_start = 2; else idx_start = 1; if (!IRC_WriteStrClient(Client, "NOTICE %s :%s", Client_ID(Client), &line[idx_start])) return DISCONNECTED; lines++; } else { if (line[0] == '-' && line[1] == ' ' && strcasecmp(&line[2], Topic) == 0) in_article = true; } line += len_str; } /* Help topic not found (or empty)! */ if (!IRC_WriteStrClient(Client, "NOTICE %s :No help for \"%s\" found!", Client_ID(Client), Topic)) return DISCONNECTED; return CONNECTED; } /** * Get pointer to a static string representing the connection "options". * * @param Idx Connection index. * @return Pointer to static (global) string buffer. */ static char * #ifdef ZLIB Option_String(CONN_ID Idx) #else Option_String(UNUSED CONN_ID Idx) #endif { static char option_txt[8]; #ifdef ZLIB UINT16 options; #endif assert(Idx != NONE); options = Conn_Options(Idx); strcpy(option_txt, "F"); /* No idea what this means, but the * original ircd sends it ... */ #ifdef SSL_SUPPORT if(options & CONN_SSL) /* SSL encrypted link */ strlcat(option_txt, "s", sizeof(option_txt)); #endif #ifdef ZLIB if(options & CONN_ZIP) /* zlib compression enabled */ strlcat(option_txt, "z", sizeof(option_txt)); #endif LogDebug(" *** %d: %d = %s", Idx, options, option_txt); return option_txt; } /* Option_String */ static bool Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors) { CLIENT *cl, *from; CL2CHAN *cl2chan; CHANNEL *chan; char *currentTarget = Req->argv[0]; char *lastCurrentTarget = NULL; char *message = NULL; assert(Client != NULL); assert(Req != NULL); if (Req->argc == 0) { if (!SendErrors) return CONNECTED; return IRC_WriteErrClient(Client, ERR_NORECIPIENT_MSG, Client_ID(Client), Req->command); } if (Req->argc == 1) { if (!SendErrors) return CONNECTED; return IRC_WriteErrClient(Client, ERR_NOTEXTTOSEND_MSG, Client_ID(Client)); } if (Req->argc > 2) { if (!SendErrors) return CONNECTED; IRC_SetPenalty(Client, 2); return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); } if (Client_Type(Client) == CLIENT_SERVER) from = Client_Search(Req->prefix); else from = Client; if (!from) return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->prefix); #ifdef ICONV if (Client_Conn(Client) > NONE) message = Conn_EncodingFrom(Client_Conn(Client), Req->argv[1]); else #endif message = Req->argv[1]; /* handle msgtarget = msgto *("," msgto) */ currentTarget = strtok_r(currentTarget, ",", &lastCurrentTarget); ngt_UpperStr(Req->command); while (currentTarget) { /* Check for and handle valid of form: * RFC 2812 2.3.1: * msgto = channel / ( user [ "%" host ] "@" servername ) * msgto =/ ( user "%" host ) / targetmask * msgto =/ nickname / ( nickname "!" user "@" host ) */ if (strchr(currentTarget, '!') == NULL) /* nickname */ cl = Client_Search(currentTarget); else cl = NULL; if (cl == NULL) { /* If currentTarget isn't a nickname check for: * user ["%" host] "@" servername * user "%" host * nickname "!" user "@" host */ char target[COMMAND_LEN]; char * nick = NULL; char * user = NULL; char * host = NULL; char * server = NULL; strlcpy(target, currentTarget, COMMAND_LEN); server = strchr(target, '@'); if (server) { *server = '\0'; server++; } host = strchr(target, '%'); if (host) { *host = '\0'; host++; } user = strchr(target, '!'); if (user) { /* msgto form: nick!user@host */ *user = '\0'; user++; nick = target; host = server; /* not "@server" but "@host" */ } else { user = target; } for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) { if (Client_Type(cl) != CLIENT_USER && Client_Type(cl) != CLIENT_SERVICE) continue; if (nick != NULL && host != NULL) { if (strcasecmp(nick, Client_ID(cl)) == 0 && strcasecmp(user, Client_User(cl)) == 0 && strcasecmp(host, Client_HostnameDisplayed(cl)) == 0) break; else continue; } if (strcasecmp(user, Client_User(cl)) != 0) continue; if (host != NULL && strcasecmp(host, Client_HostnameDisplayed(cl)) != 0) continue; if (server != NULL && strcasecmp(server, Client_ID(Client_Introducer(cl))) != 0) continue; break; } } if (cl) { /* Target is a user, enforce type */ #ifndef STRICT_RFC if (Client_Type(cl) != ForceType && !(ForceType == CLIENT_USER && (Client_Type(cl) == CLIENT_USER || Client_Type(cl) == CLIENT_SERVICE))) { #else if (Client_Type(cl) != ForceType) { #endif if (SendErrors && !IRC_WriteErrClient( from, ERR_NOSUCHNICK_MSG,Client_ID(from), currentTarget)) return DISCONNECTED; goto send_next_target; } #ifndef STRICT_RFC if (ForceType == CLIENT_SERVICE && (Conn_Options(Client_Conn(Client_NextHop(cl))) & CONN_RFC1459)) { /* SQUERY command but RFC 1459 link: convert * request to PRIVMSG command */ Req->command = "PRIVMSG"; } #endif if (Client_HasMode(cl, 'b') && !Client_HasMode(from, 'R') && !Client_HasMode(from, 'o') && !(Client_Type(from) == CLIENT_SERVER) && !(Client_Type(from) == CLIENT_SERVICE)) { if (SendErrors && !IRC_WriteErrClient(from, ERR_NONONREG_MSG, Client_ID(from), Client_ID(cl))) return DISCONNECTED; goto send_next_target; } if (Client_HasMode(cl, 'C')) { cl2chan = Channel_FirstChannelOf(cl); while (cl2chan) { chan = Channel_GetChannel(cl2chan); if (Channel_IsMemberOf(chan, from)) break; cl2chan = Channel_NextChannelOf(cl, cl2chan); } if (!cl2chan) { if (SendErrors && !IRC_WriteErrClient( from, ERR_NOTONSAMECHANNEL_MSG, Client_ID(from), Client_ID(cl))) return DISCONNECTED; goto send_next_target; } } if (SendErrors && (Client_Type(Client) != CLIENT_SERVER) && Client_HasMode(cl, 'a')) { /* Target is away */ if (!IRC_WriteStrClient(from, RPL_AWAY_MSG, Client_ID(from), Client_ID(cl), Client_Away(cl))) return DISCONNECTED; } if (Client_Conn(from) > NONE) { Conn_UpdateIdle(Client_Conn(from)); } if (!IRC_WriteStrClientPrefix(cl, from, "%s %s :%s", Req->command, Client_ID(cl), message)) return DISCONNECTED; } else if (ForceType != CLIENT_SERVICE && (chan = Channel_Search(currentTarget))) { if (!Channel_Write(chan, from, Client, Req->command, SendErrors, message)) return DISCONNECTED; } else if (ForceType != CLIENT_SERVICE /* $#: server/target mask, RFC 2812, sec. 3.3.1 */ && strchr("$#", currentTarget[0]) && strchr(currentTarget, '.')) { /* targetmask */ if (!Send_Message_Mask(from, Req->command, currentTarget, message, SendErrors)) return DISCONNECTED; } else { if (!SendErrors) return CONNECTED; if (!IRC_WriteErrClient(from, ERR_NOSUCHNICK_MSG, Client_ID(from), currentTarget)) return DISCONNECTED; } send_next_target: currentTarget = strtok_r(NULL, ",", &lastCurrentTarget); if (currentTarget) Conn_SetPenalty(Client_Conn(Client), 1); } return CONNECTED; } /* Send_Message */ static bool Send_Message_Mask(CLIENT * from, char * command, char * targetMask, char * message, bool SendErrors) { CLIENT *cl; bool client_match; char *mask = targetMask + 1; const char *check_wildcards; cl = NULL; if (!Client_HasMode(from, 'o')) { if (!SendErrors) return true; return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG, Client_ID(from)); } /* * RFC 2812, sec. 3.3.1 requires that targetMask have at least one * dot (".") and no wildcards ("*", "?") following the last one. */ check_wildcards = strrchr(targetMask, '.'); assert(check_wildcards != NULL); if (check_wildcards && check_wildcards[strcspn(check_wildcards, "*?")]) { if (!SendErrors) return true; return IRC_WriteErrClient(from, ERR_WILDTOPLEVEL, targetMask); } /* #: hostmask, see RFC 2812, sec. 3.3.1 */ if (targetMask[0] == '#') { for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) { if (Client_Type(cl) != CLIENT_USER) continue; client_match = MatchCaseInsensitive(mask, Client_Hostname(cl)); if (client_match) if (!IRC_WriteStrClientPrefix(cl, from, "%s %s :%s", command, Client_ID(cl), message)) return false; } } else { assert(targetMask[0] == '$'); /* $: server mask, see RFC 2812, sec. 3.3.1 */ for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) { if (Client_Type(cl) != CLIENT_USER) continue; client_match = MatchCaseInsensitive(mask, Client_ID(Client_Introducer(cl))); if (client_match) if (!IRC_WriteStrClientPrefix(cl, from, "%s %s :%s", command, Client_ID(cl), message)) return false; } } return CONNECTED; } /* Send_Message_Mask */ /* -eof- */ ngircd-21/src/ngircd/messages.h0000644000175000116100000002276612206130744013512 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __messages_h__ #define __messages_h__ /** * @file * IRC numerics (Header) */ #define RPL_WELCOME_MSG "001 %s :Welcome to the Internet Relay Network %s" #define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)" #define RPL_CREATED_MSG "003 %s :This server has been started %s" #define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s" #define RPL_ISUPPORT1_MSG "005 %s RFC2812 IRCD=ngIRCd CHARSET=UTF-8 CASEMAPPING=ascii PREFIX=(qaohv)~&@%%+ CHANTYPES=%s CHANMODES=beI,k,l,imMnOPQRstVz CHANLIMIT=%s:%d :are supported on this server" #define RPL_ISUPPORT2_MSG "005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d MODES=%d MAXLIST=beI:%d EXCEPTS=e INVEX=I PENALTY :are supported on this server" #define RPL_TRACELINK_MSG "200 %s Link %s-%s %s %s V%s %ld %d %d" #define RPL_TRACEOPERATOR_MSG "204 %s Oper 2 :%s" #define RPL_TRACESERVER_MSG "206 %s Serv 1 0S 0C %s[%s@%s] *!*@%s :V%s" #define RPL_STATSLINKINFO_MSG "211 %s %s %d %ld %ld %ld %ld :%ld" #define RPL_STATSCOMMANDS_MSG "212 %s %s %ld %ld %ld" #define RPL_STATSXLINE_MSG "216 %s %c %s %ld :%s" #define RPL_ENDOFSTATS_MSG "219 %s %c :End of STATS report" #define RPL_UMODEIS_MSG "221 %s +%s" #define RPL_SERVLIST_MSG "234 %s %s %s %s %d %d :%s" #define RPL_SERVLISTEND_MSG "235 %s %s %s :End of service listing" #define RPL_STATSUPTIME "242 %s :Server Up %u days %u:%02u:%02u" #define RPL_LUSERCLIENT_MSG "251 %s :There are %ld users and %ld services on %ld servers" #define RPL_LUSEROP_MSG "252 %s %lu :operator(s) online" #define RPL_LUSERUNKNOWN_MSG "253 %s %lu :unknown connection(s)" #define RPL_LUSERCHANNELS_MSG "254 %s %lu :channels formed" #define RPL_LUSERME_MSG "255 %s :I have %lu users, %lu services and %lu servers" #define RPL_ADMINME_MSG "256 %s %s :Administrative info" #define RPL_ADMINLOC1_MSG "257 %s :%s" #define RPL_ADMINLOC2_MSG "258 %s :%s" #define RPL_ADMINEMAIL_MSG "259 %s :%s" #define RPL_TRACEEND_MSG "262 %s %s %s-%s.%s :End of TRACE" #define RPL_LOCALUSERS_MSG "265 %s %lu %lu :Current local users: %lu, Max: %lu" #define RPL_NETUSERS_MSG "266 %s %lu %lu :Current global users: %lu, Max: %lu" #define RPL_STATSCONN_MSG "250 %s :Highest connection count: %lu (%lu connections received)" #define RPL_WHOISSSL_MSG "275 %s %s :is connected via SSL (secure link)" #define RPL_WHOISCERTFP_MSG "276 %s %s :has client certificate fingerprint %s" #define RPL_AWAY_MSG "301 %s %s :%s" #define RPL_USERHOST_MSG "302 %s :" #define RPL_ISON_MSG "303 %s :" #define RPL_UNAWAY_MSG "305 %s :You are no longer marked as being away" #define RPL_NOWAWAY_MSG "306 %s :You have been marked as being away" #define RPL_WHOISREGNICK_MSG "307 %s %s :is a registered nick" #define RPL_WHOISSERVICE_MSG "310 %s %s :is an IRC service" #define RPL_WHOISUSER_MSG "311 %s %s %s %s * :%s" #define RPL_WHOISSERVER_MSG "312 %s %s %s :%s" #define RPL_WHOISOPERATOR_MSG "313 %s %s :is an IRC operator" #define RPL_WHOWASUSER_MSG "314 %s %s %s %s * :%s" #define RPL_ENDOFWHO_MSG "315 %s %s :End of WHO list" #define RPL_WHOISIDLE_MSG "317 %s %s %lu %lu :seconds idle, signon time" #define RPL_ENDOFWHOIS_MSG "318 %s %s :End of WHOIS list" #define RPL_WHOISCHANNELS_MSG "319 %s %s :" #define RPL_LIST_MSG "322 %s %s %ld :%s" #define RPL_LISTEND_MSG "323 %s :End of LIST" #define RPL_CHANNELMODEIS_MSG "324 %s %s +%s" #define RPL_CREATIONTIME_MSG "329 %s %s %ld" #define RPL_NOTOPIC_MSG "331 %s %s :No topic is set" #define RPL_TOPIC_MSG "332 %s %s :%s" #define RPL_TOPICSETBY_MSG "333 %s %s %s %u" #define RPL_WHOISBOT_MSG "335 %s %s :is a IRC Bot" #define RPL_INVITING_MSG "341 %s %s %s%s" #define RPL_INVITELIST_MSG "346 %s %s %s" #define RPL_ENDOFINVITELIST_MSG "347 %s %s :End of channel invite list" #define RPL_EXCEPTLIST_MSG "348 %s %s %s" #define RPL_ENDOFEXCEPTLIST_MSG "349 %s %s :End of channel exception list" #define RPL_VERSION_MSG "351 %s %s-%s.%s %s :%s" #define RPL_WHOREPLY_MSG "352 %s %s %s %s %s %s %s :%d %s" #define RPL_NAMREPLY_MSG "353 %s %s %s :" #define RPL_LINKS_MSG "364 %s %s %s :%d %s" #define RPL_ENDOFLINKS_MSG "365 %s %s :End of LINKS list" #define RPL_ENDOFNAMES_MSG "366 %s %s :End of NAMES list" #define RPL_BANLIST_MSG "367 %s %s %s" #define RPL_ENDOFBANLIST_MSG "368 %s %s :End of channel ban list" #define RPL_ENDOFWHOWAS_MSG "369 %s %s :End of WHOWAS list" #define RPL_INFO_MSG "371 %s :%s" #define RPL_ENDOFINFO_MSG "374 %s :End of INFO list" #define RPL_MOTD_MSG "372 %s :- %s" #define RPL_MOTDSTART_MSG "375 %s :- %s message of the day" #define RPL_ENDOFMOTD_MSG "376 %s :End of MOTD command" #define RPL_WHOISHOST_MSG "378 %s %s :is connecting from *@%s %s" #define RPL_WHOISMODES_MSG "379 %s %s :is using modes +%s" #define RPL_YOUREOPER_MSG "381 %s :You are now an IRC Operator" #define RPL_REHASHING_MSG "382 %s :Rehashing" #define RPL_YOURESERVICE_MSG "383 %s :You are service %s" #define RPL_TIME_MSG "391 %s %s :%s" #define RPL_HOSTHIDDEN_MSG "396 %s %s :is your displayed hostname now" #define ERR_NOSUCHNICK_MSG "401 %s %s :No such nick or channel name" #define ERR_NOSUCHSERVER_MSG "402 %s %s :No such server" #define ERR_NOSUCHCHANNEL_MSG "403 %s %s :No such channel" #define ERR_CANNOTSENDTOCHAN_MSG "404 %s %s :Cannot send to channel" #define ERR_TOOMANYCHANNELS_MSG "405 %s %s :You have joined too many channels" #define ERR_WASNOSUCHNICK_MSG "406 %s %s :There was no such nickname" #define ERR_NOORIGIN_MSG "409 %s :No origin specified" #define ERR_INVALIDCAP_MSG "410 %s %s :Invalid CAP subcommand" #define ERR_NORECIPIENT_MSG "411 %s :No recipient given (%s)" #define ERR_NOTEXTTOSEND_MSG "412 %s :No text to send" #define ERR_WILDTOPLEVEL "414 %s :Wildcard in toplevel domain" #define ERR_UNKNOWNCOMMAND_MSG "421 %s %s :Unknown command" #define ERR_NOMOTD_MSG "422 %s :MOTD file is missing" #define ERR_NONICKNAMEGIVEN_MSG "431 %s :No nickname given" #define ERR_ERRONEUSNICKNAME_MSG "432 %s %s :Erroneous nickname" #define ERR_NICKNAMETOOLONG_MSG "432 %s %s :Nickname too long, max. %u characters" #define ERR_FORBIDDENNICKNAME_MSG "432 %s %s :Nickname is forbidden/blocked" #define ERR_NICKNAMEINUSE_MSG "433 %s %s :Nickname already in use" #define ERR_USERNOTINCHANNEL_MSG "441 %s %s %s :They aren't on that channel" #define ERR_NOTONCHANNEL_MSG "442 %s %s :You are not on that channel" #define ERR_USERONCHANNEL_MSG "443 %s %s %s :is already on channel" #define ERR_SUMMONDISABLED_MSG "445 %s :SUMMON has been disabled" #define ERR_USERSDISABLED_MSG "446 %s :USERS has been disabled" #define ERR_NOTREGISTERED_MSG "451 %s :Connection not registered" #define ERR_NOTREGISTEREDSERVER_MSG "451 %s :Connection not registered as server link" #define ERR_NEEDMOREPARAMS_MSG "461 %s %s :Syntax error" #define ERR_ALREADYREGISTRED_MSG "462 %s :Connection already registered" #define ERR_PASSWDMISMATCH_MSG "464 %s :Invalid password" #define ERR_CHANNELISFULL_MSG "471 %s %s :Cannot join channel (+l) -- Channel is full, try later" #define ERR_SECURECHANNEL_MSG "471 %s %s :Cannot join channel (+z) -- SSL connections only" #define ERR_OPONLYCHANNEL_MSG "471 %s %s :Cannot join channel (+O) -- IRC opers only" #define ERR_REGONLYCHANNEL_MSG "471 %s %s :Cannot join channel (+R) -- Registered users only" #define ERR_UNKNOWNMODE_MSG "472 %s %c :is unknown mode char for %s" #define ERR_INVITEONLYCHAN_MSG "473 %s %s :Cannot join channel (+i) -- Invited users only" #define ERR_BANNEDFROMCHAN_MSG "474 %s %s :Cannot join channel (+b) -- You are banned" #define ERR_BADCHANNELKEY_MSG "475 %s %s :Cannot join channel (+k) -- Wrong channel key" #define ERR_NOCHANMODES_MSG "477 %s %s :Channel doesn't support modes" #define ERR_NEEDREGGEDNICK_MSG "477 %s %s :Cannot send to channel (+M) -- You need to be identified to a registered account to message this channel" #define ERR_LISTFULL_MSG "478 %s %s %s: Channel list is full (%d)" #define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied" #define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator" #define ERR_CHANOPPRIVTOOLOW_MSG "482 %s %s :Your privileges are too low" #define ERR_KICKDENY_MSG "482 %s %s :Cannot kick, %s is protected" #define ERR_CANTKILLSERVER_MSG "483 %s :You can't kill a server!" #define ERR_RESTRICTED_MSG "484 %s :Your connection is restricted" #define ERR_NICKREGISTER_MSG "484 %s :Cannot modify user mode (+R) -- Use IRC services" #define ERR_NONONREG_MSG "486 %s :Cannot send to user (+b) -- You must identify to a registered nick to private message %s" #define ERR_NOOPERHOST_MSG "491 %s :Not configured for your host" #define ERR_NOTONSAMECHANNEL_MSG "493 %s :You must share a common channel with %s" #define ERR_UMODEUNKNOWNFLAG_MSG "501 %s :Unknown mode" #define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\"" #define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users" #define ERR_NOINVITE_MSG "518 %s :Cannot invite to %s (+V)" #ifdef ZLIB # define RPL_STATSLINKINFOZIP_MSG "211 %s %s %d %ld %ld/%ld %ld %ld/%ld :%ld" #endif #ifdef IRCPLUS # define RPL_IP_CHARCONV_MSG "801 %s %s :Client encoding set" # define ERR_IP_CHARCONV_MSG "851 %s :Can't initialize client encoding" #endif /* IRCPLUS */ #endif /* -eof- */ ngircd-21/src/ngircd/conn-zip.h0000644000175000116100000000167611526006312013432 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #ifdef ZLIB #ifndef __conn_zip_h__ #define __conn_zip_h__ /** * @file * Connection compression using ZLIB (header) */ GLOBAL bool Zip_InitConn PARAMS(( CONN_ID Idx )); GLOBAL bool Zip_Buffer PARAMS(( CONN_ID Idx, const char *Data, size_t Len )); GLOBAL bool Zip_Flush PARAMS(( CONN_ID Idx )); GLOBAL bool Unzip_Buffer PARAMS(( CONN_ID Idx )); GLOBAL long Zip_SendBytes PARAMS(( CONN_ID Idx )); GLOBAL long Zip_RecvBytes PARAMS(( CONN_ID Idx )); #endif /* __conn_zip_h__ */ #endif /* ZLIB */ /* -eof- */ ngircd-21/src/ngircd/irc.h0000644000175000116100000000230712222633257012452 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __irc_h__ #define __irc_h__ /** * @file * IRC commands (header) */ GLOBAL bool IRC_CheckListTooBig PARAMS((CLIENT *From, const int Count, const int Limit, const char *Name)); GLOBAL bool IRC_ERROR PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_KILL PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_NOTICE PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_PRIVMSG PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_SQUERY PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_TRACE PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_HELP PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_KillClient PARAMS((CLIENT *Client, CLIENT *From, const char *Nick, const char *Reason)); #endif /* -eof- */ ngircd-21/src/ngircd/irc-info.h0000644000175000116100000000354411526006312013377 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #ifndef __irc_info_h__ #define __irc_info_h__ /** * @file * IRC info commands (header) */ GLOBAL bool IRC_ADMIN PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_INFO PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_ISON PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_LINKS PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_LUSERS PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_MOTD PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_NAMES PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_STATS PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_SUMMON PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_TIME PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_USERHOST PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_USERS PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_SERVLIST PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_VERSION PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_WHO PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_WHOIS PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_WHOWAS PARAMS(( CLIENT *Client, REQUEST *Req )); GLOBAL bool IRC_Send_LUSERS PARAMS(( CLIENT *Client )); GLOBAL bool IRC_Send_NAMES PARAMS(( CLIENT *Client, CHANNEL *Chan )); GLOBAL bool IRC_Show_MOTD PARAMS(( CLIENT *Client )); GLOBAL bool IRC_Send_ISUPPORT PARAMS(( CLIENT *Client )); #endif /* -eof- */ ngircd-21/src/ngircd/client.c0000644000175000116100000011442512230312353013141 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #define __client_c__ #include "portab.h" /** * @file * Client management. */ #include "imp.h" #include #include #include #include #include #include #include #include "defines.h" #include "conn.h" #include "exp.h" #include "client.h" #include #include "ngircd.h" #include "channel.h" #include "conf.h" #include "conn-func.h" #include "hash.h" #include "irc-write.h" #include "log.h" #include "match.h" #include "messages.h" #include #define GETID_LEN (CLIENT_NICK_LEN-1) + 1 + (CLIENT_USER_LEN-1) + 1 + (CLIENT_HOST_LEN-1) + 1 static CLIENT *This_Server, *My_Clients; static WHOWAS My_Whowas[MAX_WHOWAS]; static int Last_Whowas = -1; static long Max_Users, My_Max_Users; static unsigned long Count PARAMS(( CLIENT_TYPE Type )); static unsigned long MyCount PARAMS(( CLIENT_TYPE Type )); static CLIENT *New_Client_Struct PARAMS(( void )); static void Generate_MyToken PARAMS(( CLIENT *Client )); static void Adjust_Counters PARAMS(( CLIENT *Client )); static void Free_Client PARAMS(( CLIENT **Client )); static CLIENT *Init_New_Client PARAMS((CONN_ID Idx, CLIENT *Introducer, 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)); static void cb_introduceClient PARAMS((CLIENT *Client, CLIENT *Prefix, void *i)); GLOBAL void Client_Init( void ) { struct hostent *h; This_Server = New_Client_Struct( ); if( ! This_Server ) { Log( LOG_EMERG, "Can't allocate client structure for server! Going down." ); Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); exit( 1 ); } /* Client structure for this server */ This_Server->next = NULL; This_Server->type = CLIENT_SERVER; This_Server->conn_id = NONE; This_Server->introducer = This_Server; This_Server->mytoken = 1; This_Server->hops = 0; gethostname( This_Server->host, CLIENT_HOST_LEN ); if (Conf_DNS) { h = gethostbyname( This_Server->host ); if (h) strlcpy(This_Server->host, h->h_name, sizeof(This_Server->host)); } Client_SetID( This_Server, Conf_ServerName ); Client_SetInfo( This_Server, Conf_ServerInfo ); My_Clients = This_Server; memset( &My_Whowas, 0, sizeof( My_Whowas )); } /* Client_Init */ GLOBAL void Client_Exit( void ) { CLIENT *c, *next; int cnt; if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, false ); else Client_Destroy( This_Server, "Server going down.", NULL, false ); cnt = 0; c = My_Clients; while(c) { cnt++; next = (CLIENT *)c->next; Free_Client(&c); c = next; } if (cnt) Log(LOG_INFO, "Freed %d client structure%s.", cnt, cnt == 1 ? "" : "s"); } /* Client_Exit */ GLOBAL CLIENT * Client_ThisServer( void ) { return This_Server; } /* Client_ThisServer */ /** * Initialize new local client; wrapper function for Init_New_Client(). * @return New CLIENT structure. */ GLOBAL CLIENT * 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); } /* Client_NewLocal */ /** * Initialize new remote server; wrapper function for Init_New_Client(). * @return New CLIENT structure. */ GLOBAL CLIENT * 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); } /* Client_NewRemoteServer */ /** * Initialize new remote client; wrapper function for Init_New_Client(). * @return New CLIENT structure. */ GLOBAL CLIENT * 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); } /* Client_NewRemoteUser */ /** * Initialize new client and set up the given parameters like client type, * user name, host name, introducing server etc. ... * @return New CLIENT structure. */ static CLIENT * Init_New_Client(CONN_ID Idx, CLIENT *Introducer, 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) { CLIENT *client; assert(Idx >= NONE); assert(Introducer != NULL); client = New_Client_Struct(); if (!client) return NULL; client->starttime = time(NULL); client->conn_id = Idx; client->introducer = Introducer; client->topserver = TopServer; client->type = Type; if (ID) Client_SetID(client, ID); if (User) { Client_SetUser(client, User, Idented); Client_SetOrigUser(client, User); } if (Hostname) Client_SetHostname(client, Hostname); if (Info) Client_SetInfo(client, Info); client->hops = Hops; client->token = Token; if (Modes) Client_SetModes(client, Modes); if (Type == CLIENT_SERVER) Generate_MyToken(client); if (Client_HasMode(client, 'a')) client->away = strndup(DEFAULT_AWAY_MSG, CLIENT_AWAY_LEN - 1); client->next = (POINTER *)My_Clients; My_Clients = client; Adjust_Counters(client); return client; } /* Init_New_Client */ GLOBAL void Client_Destroy( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool SendQuit ) { /* remove a client */ CLIENT *last, *c; char msg[COMMAND_LEN]; const char *txt; assert( Client != NULL ); txt = LogMsg ? LogMsg : FwdMsg; if (!txt) txt = "Reason unknown"; /* netsplit message */ if( Client->type == CLIENT_SERVER ) { strlcpy(msg, This_Server->id, sizeof (msg)); strlcat(msg, " ", sizeof (msg)); strlcat(msg, Client->id, sizeof (msg)); } last = NULL; c = My_Clients; while( c ) { if(( Client->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c != Client )) { /* * 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; continue; } if( c == Client ) { /* found the client: remove it */ if( last ) last->next = c->next; else My_Clients = (CLIENT *)c->next; 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) { if (c->conn_id != NONE) Log(LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered (connection %d): %s.", c->id, c->conn_id, txt); else Log(LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered: %s.", c->id, txt); } /* inform other servers */ if( ! NGIRCd_SignalQuit ) { if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :%s", c->id, FwdMsg ); else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :", c->id ); } } else { if (c->conn_id != NONE) { if (c->id[0]) Log(LOG_NOTICE, "Client \"%s\" unregistered (connection %d): %s.", c->id, c->conn_id, txt); else Log(LOG_NOTICE, "Client unregistered (connection %d): %s.", c->conn_id, txt); } else { Log(LOG_WARNING, "Unregistered unknown client \"%s\": %s", c->id[0] ? c->id : "(No Nick)", txt); } } Free_Client(&c); break; } last = c; c = (CLIENT *)c->next; } } /* Client_Destroy */ /** * Set client hostname. * * If global hostname cloaking is in effect, don't set the real hostname * but the configured one. * * @param Client The client of which the hostname should be set. * @param Hostname The new hostname. */ GLOBAL void Client_SetHostname( CLIENT *Client, const char *Hostname ) { assert(Client != NULL); assert(Hostname != NULL); if (strlen(Conf_CloakHost)) { char cloak[GETID_LEN]; strlcpy(cloak, Hostname, GETID_LEN); strlcat(cloak, Conf_CloakHostSalt, GETID_LEN); snprintf(cloak, GETID_LEN, Conf_CloakHost, Hash(cloak)); LogDebug("Updating hostname of \"%s\": \"%s\" -> \"%s\"", Client_ID(Client), Client->host, cloak); strlcpy(Client->host, cloak, sizeof(Client->host)); } else { LogDebug("Updating hostname of \"%s\": \"%s\" -> \"%s\"", Client_ID(Client), Client->host, Hostname); strlcpy(Client->host, Hostname, sizeof(Client->host)); } } /* Client_SetHostname */ /** * Set IP address to display for a client. * * @param Client The client. * @param IPAText Textual representation of the IP address or NULL to unset. */ GLOBAL void Client_SetIPAText(CLIENT *Client, const char *IPAText) { assert(Client != NULL); if (Client->ipa_text) free(Client->ipa_text); if (*IPAText) Client->ipa_text = strndup(IPAText, CLIENT_HOST_LEN - 1); else Client->ipa_text = NULL; } GLOBAL void Client_SetID( CLIENT *Client, const char *ID ) { assert( Client != NULL ); assert( ID != NULL ); strlcpy( Client->id, ID, sizeof( Client->id )); if (Conf_CloakUserToNick) { strlcpy( Client->user, ID, sizeof( Client->user )); strlcpy( Client->info, ID, sizeof( Client->info )); } /* Hash */ Client->hash = Hash( Client->id ); } /* Client_SetID */ GLOBAL void Client_SetUser( CLIENT *Client, const char *User, bool Idented ) { /* set clients username */ assert( Client != NULL ); assert( User != NULL ); if (Conf_CloakUserToNick) { strlcpy(Client->user, Client->id, 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); } } /* Client_SetUser */ /** * Set "original" user name of a client. * This function saves the "original" user name, the user name specified by * the peer using the USER command, into the CLIENT structure. This user * name may be used for authentication, for example. * @param Client The client. * @param User User name to set. */ GLOBAL void Client_SetOrigUser(CLIENT UNUSED *Client, const char UNUSED *User) { assert(Client != NULL); assert(User != NULL); #if defined(PAM) && defined(IDENTAUTH) strlcpy(Client->orig_user, User, sizeof(Client->orig_user)); #endif } /* Client_SetOrigUser */ GLOBAL void Client_SetInfo( CLIENT *Client, const char *Info ) { /* set client hostname */ assert( Client != NULL ); assert( Info != NULL ); if (Conf_CloakUserToNick) strlcpy(Client->info, Client->id, sizeof(Client->info)); else strlcpy(Client->info, Info, sizeof(Client->info)); } /* Client_SetInfo */ GLOBAL void Client_SetModes( CLIENT *Client, const char *Modes ) { assert( Client != NULL ); assert( Modes != NULL ); strlcpy(Client->modes, Modes, sizeof( Client->modes )); } /* Client_SetModes */ GLOBAL void Client_SetFlags( CLIENT *Client, const char *Flags ) { assert( Client != NULL ); assert( Flags != NULL ); strlcpy(Client->flags, Flags, sizeof(Client->flags)); } /* Client_SetFlags */ GLOBAL void Client_SetAccountName(CLIENT *Client, const char *AccountName) { assert(Client != NULL); if (Client->account_name) free(Client->account_name); if (*AccountName) Client->account_name = strndup(AccountName, CLIENT_NICK_LEN - 1); else Client->account_name = NULL; } GLOBAL void Client_SetAway( CLIENT *Client, const char *Txt ) { /* Set AWAY reason of client */ assert( Client != NULL ); assert( Txt != NULL ); if (Client->away) free(Client->away); Client->away = strndup(Txt, CLIENT_AWAY_LEN - 1); LogDebug("%s \"%s\" is away: %s", Client_TypeText(Client), Client_Mask(Client), Txt); } /* Client_SetAway */ GLOBAL void Client_SetType( CLIENT *Client, int Type ) { assert( Client != NULL ); Client->type = Type; if( Type == CLIENT_SERVER ) Generate_MyToken( Client ); Adjust_Counters( Client ); } /* Client_SetType */ GLOBAL void Client_SetHops( CLIENT *Client, int Hops ) { assert( Client != NULL ); Client->hops = Hops; } /* Client_SetHops */ GLOBAL void Client_SetToken( CLIENT *Client, int Token ) { assert( Client != NULL ); Client->token = Token; } /* Client_SetToken */ GLOBAL void Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer ) { assert( Client != NULL ); assert( Introducer != NULL ); Client->introducer = Introducer; } /* Client_SetIntroducer */ GLOBAL bool Client_ModeAdd( CLIENT *Client, char Mode ) { /* Set Mode. * If Client already had Mode, return false. * If the Mode was newly set, return true. */ char x[2]; assert( Client != NULL ); x[0] = Mode; x[1] = '\0'; if (!Client_HasMode(Client, x[0])) { strlcat( Client->modes, x, sizeof( Client->modes )); return true; } else return false; } /* Client_ModeAdd */ GLOBAL bool Client_ModeDel( CLIENT *Client, char Mode ) { /* Delete Mode. * If Mode was removed, return true. * If Client did not have Mode, return false. */ char x[2], *p; assert( Client != NULL ); x[0] = Mode; x[1] = '\0'; p = strchr( Client->modes, x[0] ); if( ! p ) return false; /* Client has Mode -> delete */ while( *p ) { *p = *(p + 1); p++; } return true; } /* Client_ModeDel */ /** * Search CLIENT structure of a given nick name. * * @return Pointer to CLIENT structure or NULL if not found. */ GLOBAL CLIENT * Client_Search( const char *Nick ) { char search_id[CLIENT_ID_LEN], *ptr; CLIENT *c = NULL; UINT32 search_hash; assert( Nick != NULL ); /* copy Nick and truncate hostmask if necessary */ strlcpy( search_id, Nick, sizeof( search_id )); ptr = strchr( search_id, '!' ); if( ptr ) *ptr = '\0'; search_hash = Hash(search_id); c = My_Clients; while (c) { if (c->hash == search_hash && strcasecmp(c->id, search_id) == 0) return c; c = (CLIENT *)c->next; } return NULL; } /** * Search first CLIENT structure matching a given mask of a server. * * The order of servers is arbitrary, but this function makes sure that the * local server is always returned if the mask matches it. * * @return Pointer to CLIENT structure or NULL if no server could be found. */ GLOBAL CLIENT * Client_SearchServer(const char *Mask) { CLIENT *c; assert(Mask != NULL); /* First check if mask matches the local server */ if (MatchCaseInsensitive(Mask, Client_ID(Client_ThisServer()))) return Client_ThisServer(); c = My_Clients; while (c) { if (Client_Type(c) == CLIENT_SERVER) { /* This is a server: check if Mask matches */ if (MatchCaseInsensitive(Mask, c->id)) return c; } c = (CLIENT *)c->next; } return NULL; } /** * Get client structure ("introducer") identfied by a server token. * @return CLIENT structure or NULL if none could be found. */ GLOBAL CLIENT * Client_GetFromToken( CLIENT *Client, int Token ) { CLIENT *c; assert( Client != NULL ); if (!Token) return NULL; c = My_Clients; while (c) { if ((c->type == CLIENT_SERVER) && (c->introducer == Client) && (c->token == Token)) return c; c = (CLIENT *)c->next; } return NULL; } /* Client_GetFromToken */ GLOBAL int Client_Type( CLIENT *Client ) { assert( Client != NULL ); return Client->type; } /* Client_Type */ GLOBAL CONN_ID Client_Conn( CLIENT *Client ) { assert( Client != NULL ); return Client->conn_id; } /* Client_Conn */ GLOBAL char * Client_ID( CLIENT *Client ) { assert( Client != NULL ); #ifdef DEBUG if(Client->type == CLIENT_USER) assert(strlen(Client->id) < Conf_MaxNickLength); #endif if( Client->id[0] ) return Client->id; else return "*"; } /* Client_ID */ GLOBAL char * Client_Info( CLIENT *Client ) { assert( Client != NULL ); return Client->info; } /* Client_Info */ GLOBAL char * Client_User( CLIENT *Client ) { assert( Client != NULL ); return Client->user[0] ? Client->user : "~"; } /* Client_User */ #ifdef PAM /** * Get the "original" user name as supplied by the USER command. * The user name as given by the client is used for authentication instead * of the one detected using IDENT requests. * @param Client The client. * @return Original user name. */ GLOBAL char * Client_OrigUser(CLIENT *Client) { #ifndef IDENTAUTH char *user = Client->user; if (user[0] == '~') user++; return user; #else return Client->orig_user; #endif } /* Client_OrigUser */ #endif /** * Return the hostname of a client. * @param Client Pointer to client structure * @return Pointer to client hostname */ GLOBAL char * Client_Hostname(CLIENT *Client) { assert (Client != NULL); return Client->host; } /** * Return the cloaked hostname of a client, if set. * @param Client Pointer to the client structure. * @return Pointer to the cloaked hostname or NULL if not set. */ GLOBAL char * Client_HostnameCloaked(CLIENT *Client) { assert(Client != NULL); return Client->cloaked; } /** * Get (potentially cloaked) hostname of a client to display it to other users. * * If the client has not enabled cloaking, the real hostname is used. * * @param Client Pointer to client structure * @return Pointer to client hostname */ GLOBAL char * Client_HostnameDisplayed(CLIENT *Client) { assert(Client != NULL); /* Client isn't cloaked at all, return real hostname: */ if (!Client_HasMode(Client, 'x')) return Client_Hostname(Client); /* Use an already saved cloaked hostname, if there is one */ if (Client->cloaked) return Client->cloaked; Client_UpdateCloakedHostname(Client, NULL, NULL); return Client->cloaked; } GLOBAL const char * Client_IPAText(CLIENT *Client) { assert(Client != NULL); /* Not a local client? */ if (Client_Conn(Client) <= NONE) return "0.0.0.0"; if (!Client->ipa_text) return Conn_GetIPAInfo(Client_Conn(Client)); else return Client->ipa_text; } /** * Update (and generate, if necessary) the cloaked hostname of a client. * * The newly set cloaked hostname is announced in the network using METADATA * commands to peers that support this feature. * * @param Client The client of which the cloaked hostname should be updated. * @param Origin The originator of the hostname change, or NULL if this server. * @param Hostname The new cloaked hostname, or NULL if it should be generated. */ GLOBAL void Client_UpdateCloakedHostname(CLIENT *Client, CLIENT *Origin, const char *Hostname) { char Cloak_Buffer[CLIENT_HOST_LEN]; assert(Client != NULL); if (!Origin) Origin = Client_ThisServer(); if (!Client->cloaked) { Client->cloaked = malloc(CLIENT_HOST_LEN); if (!Client->cloaked) return; } if (!Hostname) { /* Generate new cloaked hostname */ if (*Conf_CloakHostModeX) { strlcpy(Cloak_Buffer, Client->host, sizeof(Cloak_Buffer)); strlcat(Cloak_Buffer, Conf_CloakHostSalt, sizeof(Cloak_Buffer)); snprintf(Client->cloaked, CLIENT_HOST_LEN, Conf_CloakHostModeX, Hash(Cloak_Buffer)); } else strlcpy(Client->cloaked, Client_ID(Client->introducer), CLIENT_HOST_LEN); } else strlcpy(Client->cloaked, Hostname, CLIENT_HOST_LEN); LogDebug("Cloaked hostname of \"%s\" updated to \"%s\"", Client_ID(Client), Client->cloaked); /* Inform other servers in the network */ IRC_WriteStrServersPrefixFlag(Client_NextHop(Origin), Origin, 'M', "METADATA %s cloakhost :%s", Client_ID(Client), Client->cloaked); } GLOBAL char * Client_Modes( CLIENT *Client ) { assert( Client != NULL ); return Client->modes; } /* Client_Modes */ GLOBAL char * Client_Flags( CLIENT *Client ) { assert( Client != NULL ); return Client->flags; } /* Client_Flags */ GLOBAL int Client_Hops( CLIENT *Client ) { assert( Client != NULL ); return Client->hops; } /* Client_Hops */ GLOBAL int Client_Token( CLIENT *Client ) { assert( Client != NULL ); return Client->token; } /* Client_Token */ GLOBAL int Client_MyToken( CLIENT *Client ) { assert( Client != NULL ); return Client->mytoken; } /* Client_MyToken */ GLOBAL CLIENT * Client_NextHop( CLIENT *Client ) { CLIENT *c; assert( Client != NULL ); c = Client; while( c->introducer && ( c->introducer != c ) && ( c->introducer != This_Server )) c = c->introducer; return c; } /* Client_NextHop */ /** * Return ID of a client: "client!user@host" * This client ID is used for IRC prefixes, for example. * Please note that this function uses a global static buffer, so you can't * nest invocations without overwriting earlier results! * @param Client Pointer to client structure * @return Pointer to global buffer containing the client ID */ GLOBAL char * Client_Mask( CLIENT *Client ) { static char Mask_Buffer[GETID_LEN]; assert (Client != NULL); /* Servers: return name only, there is no "mask" */ if (Client->type == CLIENT_SERVER) return Client->id; snprintf(Mask_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client->host); return Mask_Buffer; } /* Client_Mask */ /** * Return ID of a client with cloaked hostname: "client!user@server-name" * * This client ID is used for IRC prefixes, for example. * Please note that this function uses a global static buffer, so you can't * nest invocations without overwriting earlier results! * If the client has not enabled cloaking, the real hostname is used. * * @param Client Pointer to client structure * @return Pointer to global buffer containing the client ID */ GLOBAL char * Client_MaskCloaked(CLIENT *Client) { static char Mask_Buffer[GETID_LEN]; assert (Client != NULL); /* Is the client using cloaking at all? */ if (!Client_HasMode(Client, 'x')) return Client_Mask(Client); snprintf(Mask_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client_HostnameDisplayed(Client)); return Mask_Buffer; } /* Client_MaskCloaked */ GLOBAL CLIENT * Client_Introducer( CLIENT *Client ) { assert( Client != NULL ); return Client->introducer; } /* Client_Introducer */ GLOBAL CLIENT * Client_TopServer( CLIENT *Client ) { assert( Client != NULL ); return Client->topserver; } /* Client_TopServer */ GLOBAL bool Client_HasMode( CLIENT *Client, char Mode ) { assert( Client != NULL ); return strchr( Client->modes, Mode ) != NULL; } /* Client_HasMode */ GLOBAL bool Client_HasFlag( CLIENT *Client, char Flag ) { assert( Client != NULL ); return strchr( Client->flags, Flag ) != NULL; } /* Client_HasFlag */ GLOBAL char * Client_Away( CLIENT *Client ) { assert( Client != NULL ); return Client->away; } /* Client_Away */ GLOBAL char * Client_AccountName(CLIENT *Client) { assert(Client != NULL); return Client->account_name; } /** * Make sure that a given nickname is valid. * * If the nickname is not valid for the given client, this function sends back * the appropriate error messages. * * @param Client Client that wants to change the nickname. * @param Nick New nickname. * @returns true if nickname is valid, false otherwise. */ GLOBAL bool Client_CheckNick(CLIENT *Client, char *Nick) { assert(Client != NULL); assert(Nick != NULL); if (!Client_IsValidNick(Nick)) { if (strlen(Nick ) >= Conf_MaxNickLength) IRC_WriteErrClient(Client, ERR_NICKNAMETOOLONG_MSG, Client_ID(Client), Nick, Conf_MaxNickLength - 1); else IRC_WriteErrClient(Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID(Client), Nick); return false; } if (Client_Type(Client) != CLIENT_SERVER && Client_Type(Client) != CLIENT_SERVICE) { /* Make sure that this isn't a restricted/forbidden nickname */ if (Conf_NickIsBlocked(Nick)) { IRC_WriteErrClient(Client, ERR_FORBIDDENNICKNAME_MSG, Client_ID(Client), Nick); return false; } } /* Nickname already registered? */ if (Client_Search(Nick)) { IRC_WriteErrClient(Client, ERR_NICKNAMEINUSE_MSG, Client_ID(Client), Nick); return false; } return true; } /* Client_CheckNick */ GLOBAL bool Client_CheckID( CLIENT *Client, char *ID ) { char str[COMMAND_LEN]; CLIENT *c; assert( Client != NULL ); assert( Client->conn_id > NONE ); assert( ID != NULL ); /* ID too long? */ if (strlen(ID) > CLIENT_ID_LEN) { IRC_WriteErrClient(Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID(Client), ID); return false; } /* ID already in use? */ c = My_Clients; 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; } return true; } /* Client_CheckID */ GLOBAL CLIENT * Client_First( void ) { return My_Clients; } /* Client_First */ GLOBAL CLIENT * Client_Next( CLIENT *c ) { assert( c != NULL ); return (CLIENT *)c->next; } /* Client_Next */ GLOBAL long Client_UserCount( void ) { return Count( CLIENT_USER ); } /* Client_UserCount */ GLOBAL long Client_ServiceCount( void ) { return Count( CLIENT_SERVICE );; } /* Client_ServiceCount */ GLOBAL long Client_ServerCount( void ) { return Count( CLIENT_SERVER ); } /* Client_ServerCount */ GLOBAL long Client_MyUserCount( void ) { return MyCount( CLIENT_USER ); } /* Client_MyUserCount */ GLOBAL long Client_MyServiceCount( void ) { return MyCount( CLIENT_SERVICE ); } /* Client_MyServiceCount */ GLOBAL unsigned long Client_MyServerCount( void ) { CLIENT *c; unsigned long cnt = 0; c = My_Clients; while( c ) { if(( c->type == CLIENT_SERVER ) && ( c->hops == 1 )) cnt++; c = (CLIENT *)c->next; } return cnt; } /* Client_MyServerCount */ GLOBAL unsigned long Client_OperCount( void ) { CLIENT *c; unsigned long cnt = 0; c = My_Clients; while( c ) { if (c && c->type == CLIENT_USER && Client_HasMode(c, 'o' )) cnt++; c = (CLIENT *)c->next; } return cnt; } /* Client_OperCount */ GLOBAL unsigned long Client_UnknownCount( void ) { CLIENT *c; unsigned long cnt = 0; c = My_Clients; while( c ) { if( c && ( c->type != CLIENT_USER ) && ( c->type != CLIENT_SERVICE ) && ( c->type != CLIENT_SERVER )) cnt++; c = (CLIENT *)c->next; } return cnt; } /* Client_UnknownCount */ GLOBAL long Client_MaxUserCount( void ) { return Max_Users; } /* Client_MaxUserCount */ GLOBAL long Client_MyMaxUserCount( void ) { return My_Max_Users; } /* Client_MyMaxUserCount */ /** * Check that a given nickname is valid. * * @param Nick the nickname to check. * @returns true if nickname is valid, false otherwise. */ GLOBAL bool Client_IsValidNick(const char *Nick) { const char *ptr; static const char goodchars[] = ";0123456789-"; assert (Nick != NULL); if (strchr(goodchars, Nick[0])) return false; if (strlen(Nick ) >= Conf_MaxNickLength) return false; ptr = Nick; while (*ptr) { if (*ptr < 'A' && !strchr(goodchars, *ptr )) return false; if (*ptr > '}') return false; ptr++; } return true; } /* Client_IsValidNick */ /** * Return pointer to "My_Whowas" structure. */ GLOBAL WHOWAS * Client_GetWhowas( void ) { return My_Whowas; } /* Client_GetWhowas */ /** * Return the index of the last used WHOWAS entry. */ GLOBAL int Client_GetLastWhowasIndex( void ) { return Last_Whowas; } /* Client_GetLastWhowasIndex */ /** * Get the start time of this client. * The result is the start time in seconds since 1970-01-01, as reported * by the C function time(NULL). */ GLOBAL time_t Client_StartTime(CLIENT *Client) { assert( Client != NULL ); return Client->starttime; } /* Client_Uptime */ /** * Reject a client when logging in. * * This function is called when a client isn't allowed to connect to this * server. Possible reasons are bad server password, bad PAM password, * or that the client is G/K-Line'd. * * After calling this function, the client isn't connected any more. * * @param Client The client to reject. * @param Reason The reason why the client has been rejected. * @param InformClient If true, send the exact reason to the client. */ GLOBAL void Client_Reject(CLIENT *Client, const char *Reason, bool InformClient) { char info[COMMAND_LEN]; assert(Client != NULL); assert(Reason != NULL); if (InformClient) snprintf(info, sizeof(info), "Access denied: %s", Reason); else strcpy(info, "Access denied: Bad password?"); Log(LOG_ERR, "User \"%s\" rejected (connection %d): %s!", Client_Mask(Client), Client_Conn(Client), Reason); Conn_Close(Client_Conn(Client), Reason, info, true); } /** * Introduce a new user or service client in the network. * * @param From Remote server introducing the client or NULL (local). * @param Client New client. * @param Type Type of the client (CLIENT_USER or CLIENT_SERVICE). */ GLOBAL void Client_Introduce(CLIENT *From, CLIENT *Client, int Type) { /* Set client type (user or service) */ Client_SetType(Client, Type); if (From) { if (Conf_NickIsService(Conf_GetServer(Client_Conn(From)), Client_ID(Client))) Client_SetType(Client, CLIENT_SERVICE); LogDebug("%s \"%s\" (+%s) registered (via %s, on %s, %d hop%s).", Client_TypeText(Client), Client_Mask(Client), Client_Modes(Client), Client_ID(From), Client_ID(Client_Introducer(Client)), Client_Hops(Client), Client_Hops(Client) > 1 ? "s": ""); } else { Log(LOG_NOTICE, "%s \"%s\" registered (connection %d).", Client_TypeText(Client), Client_Mask(Client), Client_Conn(Client)); Log_ServerNotice('c', "Client connecting: %s (%s@%s) [%s] - %s", Client_ID(Client), Client_User(Client), Client_Hostname(Client), Conn_IPA(Client_Conn(Client)), Client_TypeText(Client)); } /* Inform other servers */ IRC_WriteStrServersPrefixFlag_CB(From, From != NULL ? From : Client_ThisServer(), '\0', cb_introduceClient, (void *)Client); } /* Client_Introduce */ static unsigned long Count( CLIENT_TYPE Type ) { CLIENT *c; unsigned long cnt = 0; c = My_Clients; while( c ) { if( c->type == Type ) cnt++; c = (CLIENT *)c->next; } return cnt; } /* Count */ static unsigned long MyCount( CLIENT_TYPE Type ) { CLIENT *c; unsigned long cnt = 0; c = My_Clients; while( c ) { if(( c->introducer == This_Server ) && ( c->type == Type )) cnt++; c = (CLIENT *)c->next; } return cnt; } /* MyCount */ /** * Allocate and initialize new CLIENT strcuture. * * @return Pointer to CLIENT structure or NULL on error. */ static CLIENT * New_Client_Struct( void ) { CLIENT *c; c = (CLIENT *)malloc( sizeof( CLIENT )); if( ! c ) { Log( LOG_EMERG, "Can't allocate memory! [New_Client_Struct]" ); return NULL; } memset( c, 0, sizeof ( CLIENT )); c->type = CLIENT_UNKNOWN; c->conn_id = NONE; c->hops = -1; c->token = -1; c->mytoken = -1; return c; } /** * Free a CLIENT structure and its member variables. */ static void Free_Client(CLIENT **Client) { assert(Client != NULL); assert(*Client != NULL); if ((*Client)->account_name) free((*Client)->account_name); if ((*Client)->away) free((*Client)->away); if ((*Client)->cloaked) free((*Client)->cloaked); if ((*Client)->ipa_text) free((*Client)->ipa_text); free(*Client); *Client = NULL; } static void Generate_MyToken( CLIENT *Client ) { CLIENT *c; int token; c = My_Clients; token = 2; while( c ) { if( c->mytoken == token ) { /* The token is already in use */ token++; c = My_Clients; continue; } else c = (CLIENT *)c->next; } Client->mytoken = token; LogDebug("Assigned token %d to server \"%s\".", token, Client->id); } /* Generate_MyToken */ static void Adjust_Counters( CLIENT *Client ) { long count; assert( Client != NULL ); if( Client->type != CLIENT_USER ) return; if( Client->conn_id != NONE ) { /* Local connection */ count = Client_MyUserCount( ); if( count > My_Max_Users ) My_Max_Users = count; } count = Client_UserCount( ); if( count > Max_Users ) Max_Users = count; } /* Adjust_Counters */ /** * Register client in My_Whowas structure for further recall by WHOWAS. * Note: Only clients that have been connected at least 30 seconds will be * registered to prevent automated IRC bots to "destroy" a nice server * history database. */ GLOBAL void Client_RegisterWhowas( CLIENT *Client ) { int slot; time_t now; assert( Client != NULL ); /* Don't register WHOWAS information when "MorePrivacy" is enabled. */ if (Conf_MorePrivacy) return; now = time(NULL); /* Don't register clients that were connected less than 30 seconds. */ if( now - Client->starttime < 30 ) return; slot = Last_Whowas + 1; if( slot >= MAX_WHOWAS || slot < 0 ) slot = 0; #ifdef DEBUG Log( LOG_DEBUG, "Saving WHOWAS information to slot %d ...", slot ); #endif My_Whowas[slot].time = now; strlcpy( My_Whowas[slot].id, Client_ID( Client ), sizeof( My_Whowas[slot].id )); strlcpy( My_Whowas[slot].user, Client_User( Client ), sizeof( My_Whowas[slot].user )); strlcpy( My_Whowas[slot].host, Client_HostnameDisplayed( Client ), sizeof( My_Whowas[slot].host )); strlcpy( My_Whowas[slot].info, Client_Info( Client ), sizeof( My_Whowas[slot].info )); strlcpy( My_Whowas[slot].server, Client_ID( Client_Introducer( Client )), sizeof( My_Whowas[slot].server )); Last_Whowas = slot; } /* Client_RegisterWhowas */ GLOBAL const 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); Log_ServerNotice('c', "Client exiting: %s (%s@%s) [%s]", Client_ID(Client), Client_User(Client), Client_Hostname(Client), 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 */ /** * Introduce a new user or service client to a remote server. * * @param To The remote server to inform. * @param Prefix Prefix for the generated commands. * @param data CLIENT structure of the new client. */ static void cb_introduceClient(CLIENT *To, CLIENT *Prefix, void *data) { CLIENT *c = (CLIENT *)data; (void)Client_Announce(To, Prefix, c); } /* cb_introduceClient */ /** * Announce an user or service to a server. * * This function differentiates between RFC1459 and RFC2813 server links and * generates the appropriate commands to register the user or service. * * @param Client Server * @param Prefix Prefix for the generated commands * @param User User to announce */ GLOBAL bool Client_Announce(CLIENT * Client, CLIENT * Prefix, CLIENT * User) { CONN_ID conn; char *modes, *user, *host; modes = Client_Modes(User); user = Client_User(User) ? Client_User(User) : "-"; host = Client_Hostname(User) ? Client_Hostname(User) : "-"; conn = Client_Conn(Client); if (Conn_Options(conn) & CONN_RFC1459) { /* RFC 1459 mode: separate NICK and USER commands */ if (! Conn_WriteStr(conn, "NICK %s :%d", Client_ID(User), Client_Hops(User) + 1)) return DISCONNECTED; if (! Conn_WriteStr(conn, ":%s USER %s %s %s :%s", Client_ID(User), user, host, Client_ID(Client_Introducer(User)), Client_Info(User))) return DISCONNECTED; if (modes[0]) { if (! Conn_WriteStr(conn, ":%s MODE %s +%s", Client_ID(User), Client_ID(User), modes)) return DISCONNECTED; } } else { /* RFC 2813 mode: one combined NICK or SERVICE command */ if (Client_Type(User) == CLIENT_SERVICE && Client_HasFlag(Client, 'S')) { if (!IRC_WriteStrClientPrefix(Client, Prefix, "SERVICE %s %d * +%s %d :%s", Client_Mask(User), Client_MyToken(Client_Introducer(User)), modes, Client_Hops(User) + 1, Client_Info(User))) return DISCONNECTED; } else { if (!IRC_WriteStrClientPrefix(Client, Prefix, "NICK %s %d %s %s %d +%s :%s", Client_ID(User), Client_Hops(User) + 1, user, host, Client_MyToken(Client_Introducer(User)), modes, Client_Info(User))) return DISCONNECTED; } } if (Client_HasFlag(Client, 'M')) { /* Synchronize metadata */ if (Client_HostnameCloaked(User)) { if (!IRC_WriteStrClientPrefix(Client, Prefix, "METADATA %s cloakhost :%s", Client_ID(User), Client_HostnameCloaked(User))) return DISCONNECTED; } if (Client_AccountName(User)) { if (!IRC_WriteStrClientPrefix(Client, Prefix, "METADATA %s accountname :%s", Client_ID(User), Client_AccountName(User))) return DISCONNECTED; } if (Conn_GetCertFp(Client_Conn(User))) { if (!IRC_WriteStrClientPrefix(Client, Prefix, "METADATA %s certfp :%s", Client_ID(User), Conn_GetCertFp(Client_Conn(User)))) return DISCONNECTED; } } return CONNECTED; } /* Client_Announce */ #ifdef DEBUG GLOBAL void Client_DebugDump(void) { CLIENT *c; Log(LOG_DEBUG, "Client status:"); c = My_Clients; while (c) { Log(LOG_DEBUG, " - %s: type=%d, host=%s, user=%s, conn=%d, start=%ld, flags=%s", Client_ID(c), Client_Type(c), Client_Hostname(c), Client_User(c), Client_Conn(c), Client_StartTime(c), Client_Flags(c)); c = (CLIENT *)c->next; } } /* Client_DumpClients */ #endif /* -eof- */ ngircd-21/src/ngircd/irc-metadata.h0000644000175000116100000000121412206130744014217 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __irc_metadata_h__ #define __irc_metadata_h__ /** * @file * IRC metadata commands (header) */ GLOBAL bool IRC_METADATA PARAMS((CLIENT *Client, REQUEST *Req)); #endif /* -eof- */ ngircd-21/src/ngircd/hash.h0000644000175000116100000000113111526006312012602 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #ifndef __hash_h__ #define __hash_h__ /** * @file * Hash calculation (header) */ GLOBAL UINT32 Hash PARAMS((const char *String )); #endif /* -eof- */ ngircd-21/src/ngircd/irc-encoding.h0000644000175000116100000000121412206130744014225 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #ifndef __irc_encoding_h__ #define __irc_encoding_h__ /** * @file * IRC encoding commands (header) */ GLOBAL bool IRC_CHARCONV PARAMS((CLIENT *Client, REQUEST *Req)); #endif /* -eof- */ ngircd-21/src/ngircd/parse.h0000644000175000116100000000271112212712537013004 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #ifndef __parse_h__ #define __parse_h__ /** * @file * IRC command parser and validator (header) */ #include "portab.h" /** A single IRC request ("command"). See RFC 2812 section 2.3 for details. */ typedef struct _REQUEST { char *prefix; /**< Prefix */ char *command; /**< IRC command */ char *argv[15]; /**< Parameters, at most 15 (0..14) */ int argc; /**< Number of given paramaters */ } REQUEST; /** IRC command handling structure */ typedef struct _COMMAND { const char *name; /**< Command name */ bool (*function) PARAMS(( CLIENT *Client, REQUEST *Request )); /**< Function to handle this command */ CLIENT_TYPE type; /**< Valid client types (bit mask) */ int min_argc; /**< Min parameters */ int max_argc; /**< Max parameters */ long lcount, rcount; /**< Number of local and remote calls */ long bytes; /**< Number of bytes created */ } COMMAND; GLOBAL bool Parse_Request PARAMS((CONN_ID Idx, char *Request )); GLOBAL COMMAND *Parse_GetCommandStruct PARAMS(( void )); #endif /* -eof- */ ngircd-21/src/ngircd/conn-func.c0000644000175000116100000001331512206130744013552 00000000000000/* * 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. */ #define CONN_MODULE #include "portab.h" /** * @file * Connection management: Global functions */ #include "imp.h" #include #include #include "log.h" #include "conn.h" #include "client.h" #include "exp.h" #include "conn-func.h" /** * Update "idle timestamp", the time of the last visible user action * (e. g. like sending messages, joining or leaving channels). * * @param Idx Connection index. */ GLOBAL void Conn_UpdateIdle(CONN_ID Idx) { assert(Idx > NONE); My_Connections[Idx].lastprivmsg = time(NULL); } /** * Update "ping timestamp", the time of the last outgoing PING request. * * @param Idx Connection index. */ GLOBAL void Conn_UpdatePing(CONN_ID Idx) { assert(Idx > NONE); My_Connections[Idx].lastping = time(NULL); } /* * Get signon time of a connection. */ GLOBAL time_t Conn_GetSignon(CONN_ID Idx) { assert(Idx > NONE); return My_Connections[Idx].signon; } GLOBAL time_t Conn_GetIdle( CONN_ID Idx ) { /* Return Idle-Timer of a connetion */ assert( Idx > NONE ); return time( NULL ) - My_Connections[Idx].lastprivmsg; } /* Conn_GetIdle */ GLOBAL time_t Conn_LastPing( CONN_ID Idx ) { assert( Idx > NONE ); return My_Connections[Idx].lastping; } /* Conn_LastPing */ /** * Add "penalty time" for a connection. * * During the "penalty time" 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. * * @param Idex Connection index. * @param Seconds Seconds to add. * @see Conn_ResetPenalty */ GLOBAL void Conn_SetPenalty(CONN_ID Idx, time_t Seconds) { time_t t; assert(Idx > NONE); assert(Seconds >= 0); t = time(NULL); if (My_Connections[Idx].delaytime < t) My_Connections[Idx].delaytime = t; My_Connections[Idx].delaytime += Seconds; #ifdef DEBUG Log(LOG_DEBUG, "Add penalty time on connection %d: %ld second%s, total %ld second%s.", Idx, (long)Seconds, Seconds != 1 ? "s" : "", My_Connections[Idx].delaytime - t, My_Connections[Idx].delaytime - t != 1 ? "s" : ""); #endif } /* Conn_SetPenalty */ GLOBAL void Conn_ClearFlags( void ) { CONN_ID i; for( i = 0; i < Pool_Size; i++ ) My_Connections[i].flag = 0; } /* Conn_ClearFlags */ GLOBAL int Conn_Flag( CONN_ID Idx ) { assert( Idx > NONE ); return My_Connections[Idx].flag; } /* Conn_Flag */ GLOBAL void Conn_SetFlag( CONN_ID Idx, int Flag ) { assert( Idx > NONE ); My_Connections[Idx].flag = Flag; } /* Conn_SetFlag */ GLOBAL CONN_ID Conn_First( void ) { CONN_ID i; for( i = 0; i < Pool_Size; i++ ) { if( My_Connections[i].sock != NONE ) return i; } return NONE; } /* Conn_First */ GLOBAL CONN_ID Conn_Next( CONN_ID Idx ) { CONN_ID i = NONE; assert( Idx > NONE ); for( i = Idx + 1; i < Pool_Size; i++ ) { if( My_Connections[i].sock != NONE ) return i; } return NONE; } /* Conn_Next */ GLOBAL UINT16 Conn_Options( CONN_ID Idx ) { assert( Idx > NONE ); return My_Connections[Idx].options; } /* Conn_Options */ /** * 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). */ GLOBAL time_t Conn_StartTime( CONN_ID Idx ) { CLIENT *c; assert(Idx > NONE); /* Search client structure for this link ... */ c = Conn_GetClient(Idx); if(c != NULL) return Client_StartTime(c); return 0; } /* Conn_StartTime */ /** * return number of bytes queued for writing */ GLOBAL size_t Conn_SendQ( CONN_ID Idx ) { assert( Idx > NONE ); #ifdef ZLIB if( My_Connections[Idx].options & CONN_ZIP ) return array_bytes(&My_Connections[Idx].zip.wbuf); else #endif return array_bytes(&My_Connections[Idx].wbuf); } /* Conn_SendQ */ /** * return number of messages sent on this connection so far */ GLOBAL long Conn_SendMsg( CONN_ID Idx ) { 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 ) { 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 ) { assert( Idx > NONE ); #ifdef ZLIB if( My_Connections[Idx].options & CONN_ZIP ) return array_bytes(&My_Connections[Idx].zip.rbuf); else #endif return array_bytes(&My_Connections[Idx].rbuf); } /* Conn_RecvQ */ /** * return number of messages received on this connection so far */ GLOBAL long Conn_RecvMsg( CONN_ID Idx ) { 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 ) { assert( Idx > NONE ); return My_Connections[Idx].bytes_in; } /* Conn_RecvBytes */ /** * Return the remote IP address of this connection as string. */ GLOBAL const char * Conn_IPA(CONN_ID Idx) { assert (Idx > NONE); return ng_ipaddr_tostr(&My_Connections[Idx].addr); } GLOBAL void Conn_ResetWCounter( void ) { WCounter = 0; } /* Conn_ResetWCounter */ GLOBAL long Conn_WCounter( void ) { return WCounter; } /* Conn_WCounter */ /* -eof- */ ngircd-21/src/ngircd/parse.c0000644000175000116100000004107112230312353012771 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * IRC command parser and validator. */ #include "imp.h" #include #include #include #include #include #include "ngircd.h" #include "defines.h" #include "conn-func.h" #include "channel.h" #include "log.h" #include "messages.h" #include "tool.h" #include "exp.h" #include "parse.h" #include "imp.h" #include "irc.h" #include "irc-cap.h" #include "irc-channel.h" #include "irc-encoding.h" #include "irc-info.h" #include "irc-login.h" #include "irc-metadata.h" #include "irc-mode.h" #include "irc-op.h" #include "irc-oper.h" #include "irc-server.h" #include "irc-write.h" #include "numeric.h" #include "exp.h" #include "conf.h" struct _NUMERIC { int numeric; bool (*function) PARAMS(( CLIENT *Client, REQUEST *Request )); }; static COMMAND My_Commands[] = { { "ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, { "AWAY", IRC_AWAY, CLIENT_USER, 0, 1, 0, 0, 0 }, { "CAP", IRC_CAP, CLIENT_ANY, 1, 2, 0, 0, 0 }, { "CONNECT", IRC_CONNECT, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, #ifdef STRICT_RFC { "DIE", IRC_DIE, CLIENT_USER, 0, 0, 0, 0, 0 }, #else { "DIE", IRC_DIE, CLIENT_USER, 0, 1, 0, 0, 0 }, #endif { "DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 1, 1, 0, 0, 0 }, { "ERROR", IRC_ERROR, CLIENT_ANY, 0, -1, 0, 0, 0 }, { "GLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, { "HELP", IRC_HELP, CLIENT_USER, 0, 1, 0, 0, 0 }, { "INFO", IRC_INFO, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, { "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 2, 2, 0, 0, 0 }, { "ISON", IRC_ISON, CLIENT_USER, 1, -1, 0, 0, 0 }, { "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 1, 2, 0, 0, 0 }, { "KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 2, 3, 0, 0, 0 }, { "KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 2, 2, 0, 0, 0 }, { "KLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, { "LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, { "LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, { "LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, { "METADATA", IRC_METADATA, CLIENT_SERVER, 3, 3, 0, 0, 0 }, { "MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 1, -1, 0, 0, 0 }, { "MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, { "NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, { "NICK", IRC_NICK, CLIENT_ANY, 0, -1, 0, 0, 0 }, { "NJOIN", IRC_NJOIN, CLIENT_SERVER, 2, 2, 0, 0, 0 }, { "NOTICE", IRC_NOTICE, CLIENT_ANY, 0, -1, 0, 0, 0 }, { "OPER", IRC_OPER, CLIENT_USER, 2, 2, 0, 0, 0 }, { "PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 1, 2, 0, 0, 0 }, { "PASS", IRC_PASS, CLIENT_ANY, 0, -1, 0, 0, 0 }, { "PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, { "PONG", IRC_PONG, CLIENT_ANY, 0, -1, 0, 0, 0 }, { "PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, { "QUIT", IRC_QUIT, CLIENT_ANY, 0, 1, 0, 0, 0 }, { "REHASH", IRC_REHASH, CLIENT_USER, 0, 0, 0, 0, 0 }, { "RESTART", IRC_RESTART, CLIENT_USER, 0, 0, 0, 0, 0 }, { "SERVER", IRC_SERVER, CLIENT_ANY, 0, -1, 0, 0, 0 }, { "SERVICE", IRC_SERVICE, CLIENT_ANY, 6, 6, 0, 0, 0 }, { "SERVLIST", IRC_SERVLIST, CLIENT_USER, 0, 2, 0, 0, 0 }, { "SQUERY", IRC_SQUERY, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, { "SQUIT", IRC_SQUIT, CLIENT_USER|CLIENT_SERVER, 2, 2, 0, 0, 0 }, { "STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, { "SVSNICK", IRC_SVSNICK, CLIENT_SERVER, 2, 2, 0, 0, 0 }, { "SUMMON", IRC_SUMMON, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, { "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, { "TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 1, 2, 0, 0, 0 }, { "TRACE", IRC_TRACE, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, { "USER", IRC_USER, CLIENT_ANY, 0, -1, 0, 0, 0 }, { "USERHOST", IRC_USERHOST, CLIENT_USER, 1, -1, 0, 0, 0 }, { "USERS", IRC_USERS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, { "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, { "WALLOPS", IRC_WALLOPS, CLIENT_USER|CLIENT_SERVER, 1, 1, 0, 0, 0 }, { "WEBIRC", IRC_WEBIRC, CLIENT_UNKNOWN, 4, 4, 0, 0, 0 }, { "WHO", IRC_WHO, CLIENT_USER, 0, 2, 0, 0, 0 }, { "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, { "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, #ifdef IRCPLUS { "CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, -1, 0, 0, 0 }, # ifdef ICONV { "CHARCONV", IRC_CHARCONV, CLIENT_USER, 1, 1, 0, 0, 0 }, # endif #endif #ifndef STRICT_RFC { "GET", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1, 0, 0, 0 }, { "POST", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1, 0, 0, 0 }, #endif { NULL, NULL, 0x0, 0, 0, 0, 0, 0 } /* End-Mark */ }; static void Init_Request PARAMS(( REQUEST *Req )); static bool Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed )); static bool Validate_Command PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed )); static bool Validate_Args PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed )); static bool Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req )); static bool ScrubCTCP PARAMS((char *Request)); /** * Return the pointer to the global "IRC command structure". * This structure, an array of type "COMMAND" describes all the IRC commands * implemented by ngIRCd and how to handle them. * @return Pointer to the global command structure. */ GLOBAL COMMAND * Parse_GetCommandStruct( void ) { return My_Commands; } /* Parse_GetCommandStruct */ /** * Parse a command ("request") received from a client. * * This function is called after the connection layer received a valid CR+LF * terminated line of text: we assume that this is a valid IRC command and * try to do something useful with it :-) * * All errors are reported to the client from which the command has been * received, and if the error is fatal this connection is closed down. * * This function is able to parse the syntax as described in RFC 2812, * section 2.3. * * @param Idx Index of the connection from which the command has been received. * @param Request NULL terminated line of text (the "command"). * @return true on success (valid command or "regular" error), false if a * fatal error occurred and the connection has been shut down. */ GLOBAL bool Parse_Request( CONN_ID Idx, char *Request ) { REQUEST req; char *start, *ptr; bool closed; assert( Idx >= 0 ); assert( Request != NULL ); #ifdef SNIFFER if( NGIRCd_Sniffer ) Log( LOG_DEBUG, " <- connection %d: '%s'.", Idx, Request ); #endif Init_Request( &req ); /* remove leading & trailing whitespace */ ngt_TrimStr( Request ); if (Conf_ScrubCTCP && ScrubCTCP(Request)) return true; if (Request[0] == ':') { /* Prefix */ req.prefix = Request + 1; ptr = strchr( Request, ' ' ); if( ! ptr ) { LogDebug("Connection %d: Parse error: prefix without command!?", Idx); return Conn_WriteStr(Idx, "ERROR :Prefix without command"); } *ptr = '\0'; #ifndef STRICT_RFC /* ignore multiple spaces between prefix and command */ while( *(ptr + 1) == ' ' ) ptr++; #endif start = ptr + 1; } else start = Request; ptr = strchr( start, ' ' ); if( ptr ) { *ptr = '\0'; #ifndef STRICT_RFC /* ignore multiple spaces between parameters */ while( *(ptr + 1) == ' ' ) ptr++; #endif } req.command = start; /* Arguments, Parameters */ if( ptr ) { start = ptr + 1; while( start ) { if( start[0] == ':' ) { req.argv[req.argc] = start + 1; ptr = NULL; } else { req.argv[req.argc] = start; ptr = strchr( start, ' ' ); if( ptr ) { *ptr = '\0'; #ifndef STRICT_RFC while( *(ptr + 1) == ' ' ) ptr++; #endif } } req.argc++; if( start[0] == ':' ) break; if( req.argc > 14 ) break; if( ptr ) start = ptr + 1; else start = NULL; } } if( ! Validate_Prefix( Idx, &req, &closed )) return ! closed; if( ! Validate_Command( Idx, &req, &closed )) return ! closed; if( ! Validate_Args( Idx, &req, &closed )) return ! closed; return Handle_Request( Idx, &req ); } /* Parse_Request */ /** * Initialize request structure. * @param Req Request structure to be initialized. */ static void Init_Request( REQUEST *Req ) { int i; assert( Req != NULL ); Req->prefix = NULL; Req->command = NULL; for( i = 0; i < 15; Req->argv[i++] = NULL ); Req->argc = 0; } /* Init_Request */ static bool Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Closed ) { CLIENT *client, *c; assert( Idx >= 0 ); assert( Req != NULL ); *Closed = false; client = Conn_GetClient( Idx ); assert( client != NULL ); if (!Req->prefix && Client_Type(client) == CLIENT_SERVER && !(Conn_Options(Idx) & CONN_RFC1459) && strcasecmp(Req->command, "ERROR") != 0 && strcasecmp(Req->command, "PING") != 0) { Log(LOG_ERR, "Received command without prefix (connection %d, command \"%s\")!?", Idx, Req->command); if (!Conn_WriteStr(Idx, "ERROR :Prefix missing")) *Closed = true; return false; } if (!Req->prefix) return true; /* only validate if this connection is already registered */ if (Client_Type(client) != CLIENT_USER && Client_Type(client) != CLIENT_SERVER && Client_Type(client) != CLIENT_SERVICE) { /* not registered, ignore prefix */ Req->prefix = NULL; return true; } /* check if client in prefix is known */ c = Client_Search(Req->prefix); if (!c) { if (Client_Type(client) != CLIENT_SERVER) { Log(LOG_ERR, "Ignoring command with invalid prefix \"%s\" from \"%s\" (connection %d, command \"%s\")!", Req->prefix, Client_ID(client), Idx, Req->command); if (!Conn_WriteStr(Idx, "ERROR :Invalid prefix \"%s\"", Req->prefix)) *Closed = true; IRC_SetPenalty(client, 2); } else LogDebug("Ignoring command with invalid prefix \"%s\" from \"%s\" (connection %d, command \"%s\")!", Req->prefix, Client_ID(client), Idx, Req->command); return false; } /* check if the client named in the prefix is expected * to come from that direction */ if (Client_NextHop(c) != client) { if (Client_Type(c) != CLIENT_SERVER) { Log(LOG_ERR, "Spoofed prefix \"%s\" from \"%s\" (connection %d, command \"%s\"), closing connection!", Req->prefix, Client_ID(client), Idx, Req->command); Conn_Close(Idx, NULL, "Spoofed prefix", true); *Closed = true; } else { Log(LOG_WARNING, "Ignoring command with spoofed prefix \"%s\" from \"%s\" (connection %d, command \"%s\")!", Req->prefix, Client_ID(client), Idx, Req->command); } return false; } return true; } /* Validate_Prefix */ static bool Validate_Command( UNUSED CONN_ID Idx, UNUSED REQUEST *Req, bool *Closed ) { assert( Idx >= 0 ); assert( Req != NULL ); *Closed = false; return true; } /* Validate_Command */ static bool #ifdef STRICT_RFC Validate_Args(CONN_ID Idx, REQUEST *Req, bool *Closed) #else Validate_Args(UNUSED CONN_ID Idx, UNUSED REQUEST *Req, bool *Closed) #endif { #ifdef STRICT_RFC int i; #endif *Closed = false; #ifdef STRICT_RFC assert( Idx >= 0 ); assert( Req != NULL ); /* CR and LF are never allowed in command parameters. * But since we do accept lines terminated only with CR or LF in * "non-RFC-compliant mode" (besides the correct CR+LF combination), * this check can only trigger in "strict RFC" mode; therefore we * optimize it away otherwise ... */ for (i = 0; i < Req->argc; i++) { if (strchr(Req->argv[i], '\r') || strchr(Req->argv[i], '\n')) { Log(LOG_ERR, "Invalid character(s) in parameter (connection %d, command %s)!?", Idx, Req->command); if (!Conn_WriteStr(Idx, "ERROR :Invalid character(s) in parameter!")) *Closed = true; return false; } } #endif return true; } /* Validate_Args */ /* Command is a status code ("numeric") from another server */ static bool Handle_Numeric(CLIENT *client, REQUEST *Req) { static const struct _NUMERIC Numerics[] = { { 5, IRC_Num_ISUPPORT }, { 20, NULL }, { 376, IRC_Num_ENDOFMOTD } }; int i, num; char str[COMMAND_LEN]; CLIENT *prefix, *target = NULL; /* Determine target */ if (Req->argc > 0) { if (strcmp(Req->argv[0], "*") != 0) target = Client_Search(Req->argv[0]); else target = Client_ThisServer(); } if (!target) { /* Status code without target!? */ if (Req->argc > 0) Log(LOG_WARNING, "Unknown target for status code %s: \"%s\"", Req->command, Req->argv[0]); else Log(LOG_WARNING, "Unknown target for status code %s!", Req->command); return true; } if (target == Client_ThisServer()) { /* This server is the target of the numeric */ num = atoi(Req->command); for (i = 0; i < (int) C_ARRAY_SIZE(Numerics); i++) { if (num == Numerics[i].numeric) { if (!Numerics[i].function) return CONNECTED; return Numerics[i].function(client, Req); } } LogDebug("Ignored status code %s from \"%s\".", Req->command, Client_ID(client)); return true; } /* Determine source */ if (! Req->prefix[0]) { /* Oops, no prefix!? */ Log(LOG_WARNING, "Got status code %s from \"%s\" without prefix!?", Req->command, Client_ID(client)); return true; } prefix = Client_Search(Req->prefix); if (! prefix) { /* Oops, unknown prefix!? */ Log(LOG_WARNING, "Got status code %s from unknown source: \"%s\"", Req->command, Req->prefix); return true; } /* Forward status code */ strlcpy(str, Req->command, sizeof(str)); for (i = 0; i < Req->argc; i++) { if (i < Req->argc - 1) strlcat(str, " ", sizeof(str)); else strlcat(str, " :", sizeof(str)); strlcat(str, Req->argv[i], sizeof(str)); } return IRC_WriteStrClientPrefix(target, prefix, "%s", str); } static bool Handle_Request( CONN_ID Idx, REQUEST *Req ) { CLIENT *client; bool result = true; int client_type; COMMAND *cmd; assert( Idx >= 0 ); assert( Req != NULL ); assert( Req->command != NULL ); client = Conn_GetClient( Idx ); assert( client != NULL ); /* Numeric? */ client_type = Client_Type(client); if ((client_type == CLIENT_SERVER || client_type == CLIENT_UNKNOWNSERVER) && strlen(Req->command) == 3 && atoi(Req->command) > 1) return Handle_Numeric(client, Req); cmd = My_Commands; while (cmd->name) { if (strcasecmp(Req->command, cmd->name) != 0) { cmd++; continue; } if (!(client_type & cmd->type)) { if (client_type == CLIENT_USER && cmd->type & CLIENT_SERVER) return IRC_WriteErrClient(client, ERR_NOTREGISTEREDSERVER_MSG, Client_ID(client)); else return IRC_WriteErrClient(client, ERR_NOTREGISTERED_MSG, Client_ID(client)); } if (Req->argc < cmd->min_argc || (cmd->max_argc != -1 && Req->argc > cmd->max_argc)) { IRC_SetPenalty(client, 2); return IRC_WriteStrClient(client, ERR_NEEDMOREPARAMS_MSG, Client_ID(client), Req->command); } /* Command is allowed for this client: call it and count * generated bytes in output */ Conn_ResetWCounter(); result = (cmd->function)(client, Req); cmd->bytes += Conn_WCounter(); /* Adjust counters */ if (client_type != CLIENT_SERVER) cmd->lcount++; else cmd->rcount++; return result; } if (client_type != CLIENT_USER && client_type != CLIENT_SERVER && client_type != CLIENT_SERVICE ) return true; /* Unknown command and registered connection: generate error: */ LogDebug("Connection %d: Unknown command \"%s\", %d %s,%s prefix.", Client_Conn( client ), Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" ); if (Client_Type(client) != CLIENT_SERVER) result = IRC_WriteErrClient(client, ERR_UNKNOWNCOMMAND_MSG, Client_ID(client), Req->command); return result; } /* Handle_Request */ /** * Check if incoming messages contains CTCP commands and should be dropped. * * @param Request NULL terminated incoming command. * @returns true, when the message should be dropped. */ static bool ScrubCTCP(char *Request) { static const char me_cmd[] = "ACTION "; static const char ctcp_char = 0x1; bool dropCommand = false; char *ptr = Request; char *ptrEnd = strchr(Request, '\0'); if (Request[0] == ':' && ptrEnd > ptr) ptr++; while (ptr != ptrEnd && *ptr != ':') ptr++; if ((ptrEnd - ptr) > 1) { ptr++; if (*ptr == ctcp_char) { dropCommand = true; ptr++; /* allow /me commands */ if ((size_t)(ptrEnd - ptr) >= strlen(me_cmd) && !strncmp(ptr, me_cmd, strlen(me_cmd))) dropCommand = false; } } return dropCommand; } /* -eof- */ ngircd-21/src/ngircd/conn-func.h0000644000175000116100000000424612206130744013562 00000000000000/* * 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. */ #ifndef __conn_func_h__ #define __conn_func_h__ /** * @file * Connection management: Global functions (header) */ /* Include the header conn.h if this header is _not_ included by any module * containing connection handling functions. So other modules must only * include this conn-func.h header. */ #ifndef CONN_MODULE #include "conn.h" #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 GLOBAL void Conn_UpdateIdle PARAMS((CONN_ID Idx)); GLOBAL void Conn_UpdatePing PARAMS((CONN_ID Idx)); GLOBAL time_t Conn_GetSignon PARAMS((CONN_ID Idx)); GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx )); GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx )); GLOBAL time_t Conn_StartTime PARAMS(( CONN_ID Idx )); GLOBAL size_t Conn_SendQ PARAMS(( CONN_ID Idx )); GLOBAL size_t Conn_RecvQ PARAMS(( CONN_ID Idx )); GLOBAL long Conn_SendMsg PARAMS(( CONN_ID Idx )); GLOBAL long Conn_RecvMsg PARAMS(( CONN_ID Idx )); GLOBAL long Conn_SendBytes PARAMS(( CONN_ID Idx )); GLOBAL long Conn_RecvBytes PARAMS(( CONN_ID Idx )); GLOBAL const char *Conn_IPA PARAMS(( CONN_ID Idx )); GLOBAL void Conn_SetPenalty PARAMS(( CONN_ID Idx, time_t Seconds )); GLOBAL void Conn_ClearFlags PARAMS(( void )); GLOBAL int Conn_Flag PARAMS(( CONN_ID Idx )); GLOBAL void Conn_SetFlag PARAMS(( CONN_ID Idx, int Flag )); GLOBAL CONN_ID Conn_First PARAMS(( void )); GLOBAL CONN_ID Conn_Next PARAMS(( CONN_ID Idx )); GLOBAL 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 )); #endif /* -eof- */ ngircd-21/src/ngircd/resolve.h0000644000175000116100000000142511526006312013344 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2010 by Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. */ #ifndef __resolve_h__ #define __resolve_h__ /** * @file * Asynchronous resolver (header) */ GLOBAL bool Resolve_Addr PARAMS((PROC_STAT * s, const ng_ipaddr_t * Addr, int identsock, void (*cbfunc) (int, short))); GLOBAL bool Resolve_Name PARAMS((PROC_STAT * s, const char *Host, void (*cbfunc) (int, short))); #endif /* -eof- */ ngircd-21/src/ngircd/conf.c0000644000175000116100000017421612230312353012614 00000000000000/* * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * * 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. */ #include "portab.h" /** * @file * Configuration management (reading, parsing & validation) */ #include "imp.h" #include #include #include #ifdef PROTOTYPES # include #else # include #endif #include #include #include #include #include #include #include #include #include #include #include "array.h" #include "ngircd.h" #include "conn.h" #include "channel.h" #include "defines.h" #include "log.h" #include "match.h" #include "tool.h" #include "exp.h" #include "conf.h" static bool Use_Log = true, Using_MotdFile = true; static CONF_SERVER New_Server; static int New_Server_Idx; static char Conf_MotdFile[FNAME_LEN]; static char Conf_HelpFile[FNAME_LEN]; static char Conf_IncludeDir[FNAME_LEN]; static void Set_Defaults PARAMS(( bool InitServers )); static bool Read_Config PARAMS(( bool TestOnly, bool IsStarting )); static void Read_Config_File PARAMS(( const char *File, FILE *fd )); static bool Validate_Config PARAMS(( bool TestOnly, bool Rehash )); static void Handle_GLOBAL PARAMS((const char *File, int Line, char *Var, char *Arg )); static void Handle_LIMITS PARAMS((const char *File, int Line, char *Var, char *Arg )); static void Handle_OPTIONS PARAMS((const char *File, int Line, char *Var, char *Arg )); static void Handle_OPERATOR PARAMS((const char *File, int Line, char *Var, char *Arg )); static void Handle_SERVER PARAMS((const char *File, int Line, char *Var, char *Arg )); static void Handle_CHANNEL PARAMS((const char *File, int Line, char *Var, char *Arg )); static void Config_Error PARAMS((const int Level, const char *Format, ...)); static void Config_Error_NaN PARAMS((const char *File, const int LINE, const char *Value)); static void Config_Error_Section PARAMS((const char *File, const int Line, const char *Item, const char *Section)); static void Config_Error_TooLong PARAMS((const char *File, 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 HAVE_LIBSSL #define DEFAULT_CIPHERS "HIGH:!aNULL:@STRENGTH" #endif #ifdef HAVE_LIBGNUTLS #define DEFAULT_CIPHERS "SECURE128" #endif #ifdef SSL_SUPPORT static void Handle_SSL PARAMS((const char *File, int Line, char *Var, char *Ark)); struct SSLOptions Conf_SSLOptions; /** * Initialize SSL configuration. */ 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); array_free(&Conf_SSLOptions.ListenPorts); free(Conf_SSLOptions.CipherList); Conf_SSLOptions.CipherList = NULL; } /** * Check if the current configuration uses/requires SSL. * * @returns true if SSL is used and should be initialized. */ GLOBAL bool Conf_SSLInUse(void) { int i; /* SSL listen ports configured? */ if (array_bytes(&Conf_SSLOptions.ListenPorts)) return true; for (i = 0; i < MAX_SERVERS; i++) { if (Conf_Server[i].port > 0 && Conf_Server[i].SSLConnect) return true; } return false; } /** * Make sure that a configured file is readable. * * Currently, this function is only used for SSL-related options ... * * @param Var Configuration variable * @param Filename Configured filename */ static void CheckFileReadable(const char *Var, const char *Filename) { FILE *fp; if (!Filename) return; fp = fopen(Filename, "r"); if (fp) fclose(fp); else Config_Error(LOG_ERR, "Can't read \"%s\" (\"%s\"): %s", Filename, Var, strerror(errno)); } #endif /** * Duplicate string and warn on errors. * * @returns Pointer to string on success, NULL otherwise. */ static char * strdup_warn(const char *str) { char *ptr = strdup(str); if (!ptr) Config_Error(LOG_ERR, "Could not allocate memory for string: %s", str); return ptr; } /** * Output a comma separated list of ports (integer values). */ static void ports_puts(array *a) { size_t len; UINT16 *ports; len = array_length(a, sizeof(UINT16)); if (len--) { ports = (UINT16*) array_start(a); printf("%u", (unsigned int) *ports); while (len--) { ports++; printf(", %u", (unsigned int) *ports); } } putc('\n', stdout); } /** * Parse a comma separated string into an array of port numbers (integers). */ static void ports_parse(array *a, const char *File, int Line, char *Arg) { char *ptr; int port; UINT16 port16; array_trunc(a); ptr = strtok( Arg, "," ); while (ptr) { ngt_TrimStr(ptr); port = atoi(ptr); if (port > 0 && port < 0xFFFF) { port16 = (UINT16) port; if (!array_catb(a, (char*)&port16, sizeof port16)) Config_Error(LOG_ERR, "%s, line %d Could not add port number %ld: %s", File, Line, port, strerror(errno)); } else { Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Illegal port number %ld!", File, Line, port ); } ptr = strtok( NULL, "," ); } } /** * Initialize configuration module. */ GLOBAL void Conf_Init( void ) { Read_Config(false, true); Validate_Config(false, false); } /** * "Rehash" (reload) server configuration. * * @returns true if configuration has been re-read, false on errors. */ GLOBAL bool Conf_Rehash( void ) { if (!Read_Config(false, false)) return false; Validate_Config(false, true); /* Update CLIENT structure of local server */ Client_SetInfo(Client_ThisServer(), Conf_ServerInfo); return true; } /** * Output a boolean value as "yes/no" string. */ static const char* yesno_to_str(int boolean_value) { if (boolean_value) return "yes"; return "no"; } /** * Free all IRC operator configuration structures. */ static void opers_free(void) { struct Conf_Oper *op; size_t len; len = array_length(&Conf_Opers, sizeof(*op)); op = array_start(&Conf_Opers); while (len--) { free(op->mask); op++; } array_free(&Conf_Opers); } /** * Output all IRC operator configuration structures. */ static void opers_puts(void) { struct Conf_Oper *op; size_t count, i; count = array_length(&Conf_Opers, sizeof(*op)); op = array_start(&Conf_Opers); for (i = 0; i < count; i++, op++) { if (!op->name[0]) continue; puts("[OPERATOR]"); printf(" Name = %s\n", op->name); printf(" Password = %s\n", op->pwd); printf(" Mask = %s\n\n", op->mask ? op->mask : ""); } } /** * Read configuration, validate and output it. * * This function waits for a keypress of the user when stdin/stdout are valid * tty's ("you can read our nice message and we can read in your keypress"). * * @return 0 on success, 1 on failure(s); therefore the result code can * directly be used by exit() when running "ngircd --configtest". */ GLOBAL int Conf_Test( void ) { struct passwd *pwd; struct group *grp; unsigned int i; bool config_valid; size_t predef_channel_count; struct Conf_Channel *predef_chan; Use_Log = false; if (!Read_Config(true, true)) return 1; config_valid = Validate_Config(true, false); /* Valid tty? */ if(isatty(fileno(stdin)) && isatty(fileno(stdout))) { puts("OK, press enter to see a dump of your server configuration ..."); getchar(); } else puts("Ok, dump of your server configuration follows:\n"); puts("[GLOBAL]"); printf(" Name = %s\n", Conf_ServerName); printf(" AdminInfo1 = %s\n", Conf_ServerAdmin1); printf(" AdminInfo2 = %s\n", Conf_ServerAdmin2); printf(" AdminEMail = %s\n", Conf_ServerAdminMail); printf(" HelpFile = %s\n", Conf_HelpFile); printf(" Info = %s\n", Conf_ServerInfo); printf(" Listen = %s\n", Conf_ListenAddress); if (Using_MotdFile) { printf(" MotdFile = %s\n", Conf_MotdFile); printf(" MotdPhrase =\n"); } else { printf(" MotdFile = \n"); printf(" MotdPhrase = %s\n", array_bytes(&Conf_Motd) ? (const char*) array_start(&Conf_Motd) : ""); } #ifndef PAM printf(" Password = %s\n", Conf_ServerPwd); #endif printf(" PidFile = %s\n", Conf_PidFile); printf(" Ports = "); ports_puts(&Conf_ListenPorts); grp = getgrgid(Conf_GID); if (grp) printf(" ServerGID = %s\n", grp->gr_name); else printf(" ServerGID = %ld\n", (long)Conf_GID); pwd = getpwuid(Conf_UID); if (pwd) printf(" ServerUID = %s\n", pwd->pw_name); else printf(" ServerUID = %ld\n", (long)Conf_UID); puts(""); puts("[LIMITS]"); printf(" ConnectRetry = %d\n", Conf_ConnectRetry); printf(" IdleTimeout = %d\n", Conf_IdleTimeout); printf(" MaxConnections = %d\n", Conf_MaxConnections); printf(" MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP); printf(" MaxJoins = %d\n", Conf_MaxJoins > 0 ? Conf_MaxJoins : -1); printf(" MaxNickLength = %u\n", Conf_MaxNickLength - 1); printf(" MaxListSize = %d\n", Conf_MaxListSize); printf(" PingTimeout = %d\n", Conf_PingTimeout); printf(" PongTimeout = %d\n", Conf_PongTimeout); puts(""); puts("[OPTIONS]"); printf(" AllowedChannelTypes = %s\n", Conf_AllowedChannelTypes); printf(" AllowRemoteOper = %s\n", yesno_to_str(Conf_AllowRemoteOper)); printf(" ChrootDir = %s\n", Conf_Chroot); printf(" CloakHost = %s\n", Conf_CloakHost); printf(" CloakHostModeX = %s\n", Conf_CloakHostModeX); printf(" CloakHostSalt = %s\n", Conf_CloakHostSalt); printf(" CloakUserToNick = %s\n", yesno_to_str(Conf_CloakUserToNick)); #ifdef WANT_IPV6 printf(" ConnectIPv4 = %s\n", yesno_to_str(Conf_ConnectIPv6)); printf(" ConnectIPv6 = %s\n", yesno_to_str(Conf_ConnectIPv4)); #endif printf(" DefaultUserModes = %s\n", Conf_DefaultUserModes); printf(" DNS = %s\n", yesno_to_str(Conf_DNS)); #ifdef IDENT printf(" Ident = %s\n", yesno_to_str(Conf_Ident)); #endif printf(" IncludeDir = %s\n", Conf_IncludeDir); printf(" MorePrivacy = %s\n", yesno_to_str(Conf_MorePrivacy)); printf(" NoticeAuth = %s\n", yesno_to_str(Conf_NoticeAuth)); printf(" OperCanUseMode = %s\n", yesno_to_str(Conf_OperCanMode)); printf(" OperChanPAutoOp = %s\n", yesno_to_str(Conf_OperChanPAutoOp)); printf(" OperServerMode = %s\n", yesno_to_str(Conf_OperServerMode)); #ifdef PAM printf(" PAM = %s\n", yesno_to_str(Conf_PAM)); printf(" PAMIsOptional = %s\n", yesno_to_str(Conf_PAMIsOptional)); #endif #ifndef STRICT_RFC printf(" RequireAuthPing = %s\n", yesno_to_str(Conf_AuthPing)); #endif printf(" ScrubCTCP = %s\n", yesno_to_str(Conf_ScrubCTCP)); #ifdef SYSLOG printf(" SyslogFacility = %s\n", ngt_SyslogFacilityName(Conf_SyslogFacility)); #endif printf(" WebircPassword = %s\n", Conf_WebircPwd); puts(""); #ifdef SSL_SUPPORT puts("[SSL]"); printf(" CertFile = %s\n", Conf_SSLOptions.CertFile ? Conf_SSLOptions.CertFile : ""); printf(" CipherList = %s\n", Conf_SSLOptions.CipherList ? Conf_SSLOptions.CipherList : DEFAULT_CIPHERS); printf(" DHFile = %s\n", Conf_SSLOptions.DHFile ? Conf_SSLOptions.DHFile : ""); printf(" KeyFile = %s\n", Conf_SSLOptions.KeyFile ? Conf_SSLOptions.KeyFile : ""); if (array_bytes(&Conf_SSLOptions.KeyFilePassword)) puts(" KeyFilePassword = "); else puts(" KeyFilePassword = "); array_free_wipe(&Conf_SSLOptions.KeyFilePassword); printf(" Ports = "); ports_puts(&Conf_SSLOptions.ListenPorts); puts(""); #endif opers_puts(); for( i = 0; i < MAX_SERVERS; i++ ) { if( ! Conf_Server[i].name[0] ) continue; /* Valid "Server" section */ puts( "[SERVER]" ); 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"); } 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", 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); } /** * Remove connection information from configured server. * * If the server is set as "once", delete it from our configuration; * otherwise set the time for the next connection attempt. * * Non-server connections will be silently ignored. */ GLOBAL void Conf_UnsetServer( CONN_ID Idx ) { int i; time_t t; /* Check all our configured servers */ for( i = 0; i < MAX_SERVERS; i++ ) { if( Conf_Server[i].conn_id != Idx ) continue; /* Gotcha! Mark server configuration as "unused": */ Conf_Server[i].conn_id = NONE; if( Conf_Server[i].flags & CONF_SFLAG_ONCE ) { /* Delete configuration here */ Init_Server_Struct( &Conf_Server[i] ); } else { /* Set time for next connect attempt */ t = time(NULL); if (Conf_Server[i].lasttry < t - Conf_ConnectRetry) { /* The connection has been "long", so we don't * require the next attempt to be delayed. */ Conf_Server[i].lasttry = t - Conf_ConnectRetry + RECONNECT_DELAY; } else { /* "Short" connection, enforce "ConnectRetry" * but randomize it a little bit: 15 seconds. */ Conf_Server[i].lasttry = #ifdef HAVE_ARC4RANDOM t + (arc4random() % 15); #else t + rand() / (RAND_MAX / 15); #endif } } } } /** * Set connection information for specified configured server. */ GLOBAL bool Conf_SetServer( int ConfServer, CONN_ID Idx ) { assert( ConfServer > NONE ); assert( Idx > NONE ); if (Conf_Server[ConfServer].conn_id > NONE && Conf_Server[ConfServer].conn_id != Idx) { Log(LOG_ERR, "Connection %d: Server configuration of \"%s\" already in use by connection %d!", Idx, Conf_Server[ConfServer].name, Conf_Server[ConfServer].conn_id); Conn_Close(Idx, NULL, "Server configuration already in use", true); return false; } Conf_Server[ConfServer].conn_id = Idx; return true; } /** * Get index of server in configuration structure. */ GLOBAL int Conf_GetServer( CONN_ID Idx ) { int i = 0; assert( Idx > NONE ); for( i = 0; i < MAX_SERVERS; i++ ) { if( Conf_Server[i].conn_id == Idx ) return i; } return NONE; } /** * Enable a server by name and adjust its port number. * * @returns true if a server has been enabled and now has a valid port * number and host name for outgoing connections. */ GLOBAL bool Conf_EnableServer( const char *Name, UINT16 Port ) { int i; assert( Name != NULL ); for( i = 0; i < MAX_SERVERS; i++ ) { if( strcasecmp( Conf_Server[i].name, Name ) == 0 ) { /* Gotcha! Set port and enable server: */ Conf_Server[i].port = Port; Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED; return (Conf_Server[i].port && Conf_Server[i].host[0]); } } return false; } /** * Enable a server by name. * * The server is only usable as outgoing server, if it has set a valid port * number for outgoing connections! * If not, you have to use Conf_EnableServer() function to make it available. * * @returns true if a server has been enabled; false otherwise. */ GLOBAL bool Conf_EnablePassiveServer(const char *Name) { int i; assert( Name != NULL ); for (i = 0; i < MAX_SERVERS; i++) { if ((strcasecmp( Conf_Server[i].name, Name ) == 0) && (Conf_Server[i].port > 0)) { /* BINGO! Enable server */ Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED; return true; } } return false; } /** * Disable a server by name. * An already established connection will be disconnected. * * @returns true if a server was found and has been disabled. */ GLOBAL bool Conf_DisableServer( const char *Name ) { int i; assert( Name != NULL ); for( i = 0; i < MAX_SERVERS; i++ ) { if( strcasecmp( Conf_Server[i].name, Name ) == 0 ) { /* Gotcha! Disable and disconnect server: */ Conf_Server[i].flags |= CONF_SFLAG_DISABLED; if( Conf_Server[i].conn_id > NONE ) Conn_Close(Conf_Server[i].conn_id, NULL, "Server link terminated on operator request", true); return true; } } return false; } /** * Add a new remote server to our configuration. * * @param Name Name of the new server. * @param Port Port number to connect to or 0 for incoming connections. * @param Host Host name to connect to. * @param MyPwd Password that will be sent to the peer. * @param PeerPwd Password that must be received from the peer. * @returns true if the new server has been added; false otherwise. */ GLOBAL bool Conf_AddServer(const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd) { int i; assert( Name != NULL ); assert( Host != NULL ); assert( MyPwd != NULL ); assert( PeerPwd != NULL ); /* Search unused item in server configuration structure */ for( i = 0; i < MAX_SERVERS; i++ ) { /* Is this item used? */ if( ! Conf_Server[i].name[0] ) break; } if( i >= MAX_SERVERS ) return false; Init_Server_Struct( &Conf_Server[i] ); strlcpy( Conf_Server[i].name, Name, sizeof( Conf_Server[i].name )); strlcpy( Conf_Server[i].host, Host, sizeof( Conf_Server[i].host )); strlcpy( Conf_Server[i].pwd_out, MyPwd, sizeof( Conf_Server[i].pwd_out )); strlcpy( Conf_Server[i].pwd_in, PeerPwd, sizeof( Conf_Server[i].pwd_in )); Conf_Server[i].port = Port; Conf_Server[i].flags = CONF_SFLAG_ONCE; return true; } /** * Check if the given nickname is reserved for services on a particular server. * * @param ConfServer The server index to check. * @param Nick The nickname to check. * @returns true if the given nickname belongs to an "IRC service". */ GLOBAL bool Conf_NickIsService(int ConfServer, const char *Nick) { assert (ConfServer >= 0); assert (ConfServer < MAX_SERVERS); return MatchCaseInsensitiveList(Conf_Server[ConfServer].svs_mask, Nick, ","); } /** * Check if the given nickname is blocked for "normal client" use. * * @param ConfServer The server index or NONE to check all configured servers. * @param Nick The nickname to check. * @returns true if the given nickname belongs to an "IRC service". */ GLOBAL bool Conf_NickIsBlocked(const char *Nick) { int i; for(i = 0; i < MAX_SERVERS; i++) { if (!Conf_Server[i].name[0]) continue; if (Conf_NickIsService(i, Nick)) return true; } return false; } /** * Initialize configuration settings with their default values. */ static void Set_Defaults(bool InitServers) { int i; char random[RANDOM_SALT_LEN + 1]; /* Global */ strcpy(Conf_ServerName, ""); strcpy(Conf_ServerAdmin1, ""); strcpy(Conf_ServerAdmin2, ""); strcpy(Conf_ServerAdminMail, ""); snprintf(Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s", PACKAGE_NAME, PACKAGE_VERSION); free(Conf_ListenAddress); Conf_ListenAddress = NULL; array_free(&Conf_ListenPorts); array_free(&Conf_Motd); array_free(&Conf_Helptext); strlcpy(Conf_MotdFile, SYSCONFDIR, sizeof(Conf_MotdFile)); strlcat(Conf_MotdFile, MOTD_FILE, sizeof(Conf_MotdFile)); strlcpy(Conf_HelpFile, DOCDIR, sizeof(Conf_HelpFile)); strlcat(Conf_HelpFile, HELP_FILE, sizeof(Conf_HelpFile)); strcpy(Conf_ServerPwd, ""); strlcpy(Conf_PidFile, PID_FILE, sizeof(Conf_PidFile)); Conf_UID = Conf_GID = 0; /* Limits */ Conf_ConnectRetry = 60; Conf_IdleTimeout = 0; Conf_MaxConnections = 0; Conf_MaxConnectionsIP = 5; Conf_MaxJoins = 10; Conf_MaxNickLength = CLIENT_NICK_LEN_DEFAULT; Conf_MaxListSize = 100; Conf_PingTimeout = 120; Conf_PongTimeout = 20; /* Options */ strlcpy(Conf_AllowedChannelTypes, CHANTYPES, sizeof(Conf_AllowedChannelTypes)); Conf_AllowRemoteOper = false; #ifndef STRICT_RFC Conf_AuthPing = false; #endif strlcpy(Conf_Chroot, CHROOT_DIR, sizeof(Conf_Chroot)); strcpy(Conf_CloakHost, ""); strcpy(Conf_CloakHostModeX, ""); strlcpy(Conf_CloakHostSalt, ngt_RandomStr(random, RANDOM_SALT_LEN), sizeof(Conf_CloakHostSalt)); Conf_CloakUserToNick = false; Conf_ConnectIPv4 = true; #ifdef WANT_IPV6 Conf_ConnectIPv6 = true; #else Conf_ConnectIPv6 = false; #endif strcpy(Conf_DefaultUserModes, ""); Conf_DNS = true; #ifdef IDENTAUTH Conf_Ident = true; #else Conf_Ident = false; #endif strcpy(Conf_IncludeDir, ""); Conf_MorePrivacy = false; Conf_NoticeAuth = false; Conf_OperCanMode = false; Conf_OperChanPAutoOp = true; Conf_OperServerMode = false; #ifdef PAM Conf_PAM = true; #else Conf_PAM = false; #endif Conf_PAMIsOptional = false; #ifdef SYSLOG Conf_ScrubCTCP = false; #ifdef LOG_LOCAL5 Conf_SyslogFacility = LOG_LOCAL5; #else Conf_SyslogFacility = 0; #endif #endif /* Initialize server configuration structures */ if (InitServers) { for (i = 0; i < MAX_SERVERS; Init_Server_Struct(&Conf_Server[i++])); } } /** * Get number of configured listening ports. * * @returns The number of ports (IPv4+IPv6) on which the server should listen. */ 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; } /** * Read contents of a text file into an array. * * This function is used to read the MOTD and help text file, for example. * * @param filename Name of the file to read. * @return true, when the file has been read in. */ static bool Read_TextFile(const char *Filename, const char *Name, array *Destination) { char line[127]; FILE *fp; int line_no = 1; if (*Filename == '\0') return false; fp = fopen(Filename, "r"); if (!fp) { Config_Error(LOG_ERR, "Can't read %s file \"%s\": %s", Name, Filename, strerror(errno)); return false; } array_free(Destination); while (fgets(line, (int)sizeof line, fp)) { ngt_TrimLastChr(line, '\n'); /* add text including \0 */ if (!array_catb(Destination, line, strlen(line) + 1)) { Log(LOG_ERR, "Cannot read/add \"%s\", line %d: %s", Filename, line_no, strerror(errno)); break; } line_no++; } fclose(fp); return true; } /** * Read ngIRCd configuration file. * * Please note that this function uses exit(1) on fatal errors and therefore * can result in ngIRCd terminating! * * @param ngircd_starting Flag indicating if ngIRCd is starting or not. * @returns true when the configuration file has been read * successfully; false otherwise. */ static bool Read_Config(bool TestOnly, bool IsStarting) { const UINT16 defaultport = 6667; char *ptr, file[FNAME_LEN]; struct dirent *entry; int i, n; FILE *fd; DIR *dh; /* Open configuration file */ fd = fopen( NGIRCd_ConfFile, "r" ); if( ! fd ) { /* No configuration file found! */ Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno )); if (!IsStarting) return false; Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME ); exit( 1 ); } opers_free(); Set_Defaults(IsStarting); if (TestOnly) Config_Error(LOG_INFO, "Reading configuration from \"%s\" ...", NGIRCd_ConfFile ); /* Clean up server configuration structure: mark all already * configured servers as "once" so that they are deleted * after the next disconnect and delete all unused servers. * And delete all servers which are "duplicates" of servers * that are already marked as "once" (such servers have been * created by the last rehash but are now useless). */ for( i = 0; i < MAX_SERVERS; i++ ) { if( Conf_Server[i].conn_id == NONE ) Init_Server_Struct( &Conf_Server[i] ); else { /* This structure is in use ... */ if( Conf_Server[i].flags & CONF_SFLAG_ONCE ) { /* Check for duplicates */ for( n = 0; n < MAX_SERVERS; n++ ) { if( n == i ) continue; if( Conf_Server[i].conn_id == Conf_Server[n].conn_id ) { Init_Server_Struct( &Conf_Server[n] ); #ifdef DEBUG Log(LOG_DEBUG,"Deleted unused duplicate server %d (kept %d).", n, i ); #endif } } } else { /* Mark server as "once" */ Conf_Server[i].flags |= CONF_SFLAG_ONCE; Log( LOG_DEBUG, "Marked server %d as \"once\"", i ); } } } /* Initialize variables */ Init_Server_Struct( &New_Server ); New_Server_Idx = NONE; #ifdef SSL_SUPPORT ConfSSL_Init(); #endif Read_Config_File(NGIRCd_ConfFile, fd); fclose(fd); if (Conf_IncludeDir[0]) { dh = opendir(Conf_IncludeDir); if (!dh) Config_Error(LOG_ALERT, "Can't open include directory \"%s\": %s", Conf_IncludeDir, strerror(errno)); } else { strlcpy(Conf_IncludeDir, SYSCONFDIR, sizeof(Conf_IncludeDir)); strlcat(Conf_IncludeDir, CONFIG_DIR, sizeof(Conf_IncludeDir)); dh = opendir(Conf_IncludeDir); } /* Include further configuration files, if IncludeDir is available */ if (dh) { while ((entry = readdir(dh)) != NULL) { ptr = strrchr(entry->d_name, '.'); if (!ptr || strcasecmp(ptr, ".conf") != 0) continue; snprintf(file, sizeof(file), "%s/%s", Conf_IncludeDir, entry->d_name); if (TestOnly) Config_Error(LOG_INFO, "Reading configuration from \"%s\" ...", file); fd = fopen(file, "r"); if (fd) { Read_Config_File(file, fd); fclose(fd); } else Config_Error(LOG_ALERT, "Can't read configuration \"%s\": %s", file, strerror(errno)); } closedir(dh); } /* Check if there is still a server to add */ if( New_Server.name[0] ) { /* Copy data to "real" server structure */ assert( New_Server_Idx > NONE ); Conf_Server[New_Server_Idx] = New_Server; } /* 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)); 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); } /* No MOTD phrase configured? (re)try motd file. */ if (array_bytes(&Conf_Motd) == 0) { if (Read_TextFile(Conf_MotdFile, "MOTD", &Conf_Motd)) Using_MotdFile = true; } /* Try to read ngIRCd help text file. */ (void)Read_TextFile(Conf_HelpFile, "help text", &Conf_Helptext); if (!array_bytes(&Conf_Helptext)) Config_Error(LOG_WARNING, "No help text available, HELP command will be of limited use."); #ifdef SSL_SUPPORT /* Make sure that all SSL-related files are readable */ CheckFileReadable("CertFile", Conf_SSLOptions.CertFile); CheckFileReadable("DHFile", Conf_SSLOptions.DHFile); CheckFileReadable("KeyFile", Conf_SSLOptions.KeyFile); /* Set the default ciphers if none were configured */ if (!Conf_SSLOptions.CipherList) Conf_SSLOptions.CipherList = strdup_warn(DEFAULT_CIPHERS); #endif return true; } /** * ... */ static void Read_Config_File(const char *File, FILE *fd) { char section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr; int i, line = 0; size_t count; /* Read configuration file */ section[0] = '\0'; while (true) { if (!fgets(str, sizeof(str), fd)) break; ngt_TrimStr(str); line++; /* Skip comments and empty lines */ if (str[0] == ';' || str[0] == '#' || str[0] == '\0') continue; if (strlen(str) >= sizeof(str) - 1) { Config_Error(LOG_WARNING, "%s, line %d too long!", File, line); continue; } /* Is this the beginning of a new section? */ if ((str[0] == '[') && (str[strlen(str) - 1] == ']')) { strlcpy(section, str, sizeof(section)); if (strcasecmp(section, "[GLOBAL]") == 0 || strcasecmp(section, "[LIMITS]") == 0 || strcasecmp(section, "[OPTIONS]") == 0 #ifdef SSL_SUPPORT || strcasecmp(section, "[SSL]") == 0 #endif ) continue; if (strcasecmp(section, "[SERVER]") == 0) { /* Check if there is already a server to add */ if (New_Server.name[0]) { /* Copy data to "real" server structure */ assert(New_Server_Idx > NONE); Conf_Server[New_Server_Idx] = New_Server; } /* Re-init structure for new server */ Init_Server_Struct(&New_Server); /* Search unused item in server configuration structure */ for (i = 0; i < MAX_SERVERS; i++) { /* Is this item used? */ if (!Conf_Server[i].name[0]) break; } if (i >= MAX_SERVERS) { /* Oops, no free item found! */ Config_Error(LOG_ERR, "Too many servers configured."); New_Server_Idx = NONE; } else New_Server_Idx = i; continue; } if (strcasecmp(section, "[CHANNEL]") == 0) { count = array_length(&Conf_Channels, sizeof(struct Conf_Channel)); if (!array_alloc (&Conf_Channels, sizeof(struct Conf_Channel), count)) { Config_Error(LOG_ERR, "Could not allocate memory for new operator (line %d)", line); } continue; } if (strcasecmp(section, "[OPERATOR]") == 0) { count = array_length(&Conf_Opers, sizeof(struct Conf_Oper)); if (!array_alloc(&Conf_Opers, sizeof(struct Conf_Oper), count)) { Config_Error(LOG_ERR, "Could not allocate memory for new channel (line &d)", line); } continue; } Config_Error(LOG_ERR, "%s, line %d: Unknown section \"%s\"!", File, line, section); section[0] = 0x1; } if (section[0] == 0x1) continue; /* Split line into variable name and parameters */ ptr = strchr(str, '='); if (!ptr) { Config_Error(LOG_ERR, "%s, line %d: Syntax error!", File, line); continue; } *ptr = '\0'; var = str; ngt_TrimStr(var); arg = ptr + 1; ngt_TrimStr(arg); if (strcasecmp(section, "[GLOBAL]") == 0) Handle_GLOBAL(File, line, var, arg); else if (strcasecmp(section, "[LIMITS]") == 0) Handle_LIMITS(File, line, var, arg); else if (strcasecmp(section, "[OPTIONS]") == 0) Handle_OPTIONS(File, line, var, arg); #ifdef SSL_SUPPORT else if (strcasecmp(section, "[SSL]") == 0) Handle_SSL(File, line, var, arg); #endif else if (strcasecmp(section, "[OPERATOR]") == 0) Handle_OPERATOR(File, line, var, arg); else if (strcasecmp(section, "[SERVER]") == 0) Handle_SERVER(File, line, var, arg); else if (strcasecmp(section, "[CHANNEL]") == 0) Handle_CHANNEL(File, line, var, arg); else Config_Error(LOG_ERR, "%s, line %d: Variable \"%s\" outside section!", File, line, var); } } /** * Check whether a string argument is "true" or "false". * * @param Arg Input string. * @returns true if the input string has been parsed as "yes", "true" * (case insensitive) or a non-zero integer value. */ static bool Check_ArgIsTrue(const char *Arg) { if (strcasecmp(Arg, "yes") == 0) return true; if (strcasecmp(Arg, "true") == 0) return true; if (atoi(Arg) != 0) return true; return false; } /** * Handle setting of "MaxNickLength". * * @param Line Line number in configuration file. * @raram Arg Input string. * @returns New configured maximum nickname length. */ static unsigned int Handle_MaxNickLength(const char *File, int Line, const char *Arg) { unsigned new; new = (unsigned) atoi(Arg) + 1; if (new > CLIENT_NICK_LEN) { Config_Error(LOG_WARNING, "%s, line %d: Value of \"MaxNickLength\" exceeds %u!", File, Line, CLIENT_NICK_LEN - 1); return CLIENT_NICK_LEN; } if (new < 2) { Config_Error(LOG_WARNING, "%s, line %d: Value of \"MaxNickLength\" must be at least 1!", File, Line); return 2; } return new; } /** * Output a warning messages if IDENT is configured but not compiled in. */ static void WarnIdent(const char UNUSED *File, int UNUSED Line) { #ifndef IDENTAUTH if (Conf_Ident) { /* user has enabled ident lookups explicitly, but ... */ Config_Error(LOG_WARNING, "%s: line %d: \"Ident = yes\", but ngircd was built without IDENT support!", File, Line); } #endif } /** * Output a warning messages if IPv6 is configured but not compiled in. */ static void WarnIPv6(const char UNUSED *File, int UNUSED Line) { #ifndef WANT_IPV6 if (Conf_ConnectIPv6) { /* user has enabled IPv6 explicitly, but ... */ Config_Error(LOG_WARNING, "%s: line %d: \"ConnectIPv6 = yes\", but ngircd was built without IPv6 support!", File, Line); } #endif } /** * Output a warning messages if PAM is configured but not compiled in. */ static void WarnPAM(const char UNUSED *File, int UNUSED Line) { #ifndef PAM if (Conf_PAM) { Config_Error(LOG_WARNING, "%s: line %d: \"PAM = yes\", but ngircd was built without PAM support!", File, Line); } #endif } /** * Handle legacy "NoXXX" options in [GLOBAL] section. * * TODO: This function and support for "NoXXX" could be removed starting * with ngIRCd release 19 (one release after marking it "deprecated"). * * @param Var Variable name. * @param Arg Argument string. * @returns true if a NoXXX option has been processed; false otherwise. */ static bool CheckLegacyNoOption(const char *Var, const char *Arg) { if(strcasecmp(Var, "NoDNS") == 0) { Conf_DNS = !Check_ArgIsTrue( Arg ); return true; } if (strcasecmp(Var, "NoIdent") == 0) { Conf_Ident = !Check_ArgIsTrue(Arg); return true; } if(strcasecmp(Var, "NoPAM") == 0) { Conf_PAM = !Check_ArgIsTrue(Arg); return true; } return false; } /** * Handle deprecated legacy options in [GLOBAL] section. * * TODO: This function and support for these options in the [Global] section * could be removed starting with ngIRCd release 19 (one release after * marking it "deprecated"). * * @param Var Variable name. * @param Arg Argument string. * @returns true if a legacy option has been processed; false otherwise. */ static const char* CheckLegacyGlobalOption(const char *File, int Line, char *Var, char *Arg) { if (strcasecmp(Var, "AllowRemoteOper") == 0 || strcasecmp(Var, "ChrootDir") == 0 || strcasecmp(Var, "ConnectIPv4") == 0 || strcasecmp(Var, "ConnectIPv6") == 0 || strcasecmp(Var, "OperCanUseMode") == 0 || strcasecmp(Var, "OperChanPAutoOp") == 0 || strcasecmp(Var, "OperServerMode") == 0 || strcasecmp(Var, "PredefChannelsOnly") == 0 || strcasecmp(Var, "SyslogFacility") == 0 || strcasecmp(Var, "WebircPassword") == 0) { Handle_OPTIONS(File, Line, Var, Arg); return "[Options]"; } if (strcasecmp(Var, "ConnectRetry") == 0 || strcasecmp(Var, "IdleTimeout") == 0 || strcasecmp(Var, "MaxConnections") == 0 || strcasecmp(Var, "MaxConnectionsIP") == 0 || strcasecmp(Var, "MaxJoins") == 0 || strcasecmp(Var, "MaxNickLength") == 0 || strcasecmp(Var, "PingTimeout") == 0 || strcasecmp(Var, "PongTimeout") == 0) { Handle_LIMITS(File, Line, Var, Arg); return "[Limits]"; } #ifdef SSL_SUPPORT if (strcasecmp(Var, "SSLCertFile") == 0 || strcasecmp(Var, "SSLDHFile") == 0 || strcasecmp(Var, "SSLKeyFile") == 0 || strcasecmp(Var, "SSLKeyFilePassword") == 0 || strcasecmp(Var, "SSLPorts") == 0) { Handle_SSL(File, Line, Var + 3, Arg); return "[SSL]"; } #endif return NULL; } /** * Strip "no" prefix of a string. * * TODO: This function and support for "NoXXX" should be removed starting * with ngIRCd release 19! (One release after marking it "deprecated"). * * @param str Pointer to input string starting with "no". * @returns New pointer to string without "no" prefix. */ static const char * NoNo(const char *str) { assert(strncasecmp("no", str, 2) == 0 && str[2]); return str + 2; } /** * Invert "boolean" string. * * TODO: This function and support for "NoXXX" should be removed starting * with ngIRCd release 19! (One release after marking it "deprecated"). * * @param arg "Boolean" input string. * @returns Pointer to inverted "boolean string". */ static const char * InvertArg(const char *arg) { return yesno_to_str(!Check_ArgIsTrue(arg)); } /** * Handle variable in [Global] configuration section. * * @param Line Line numer in configuration file. * @param Var Variable name. * @param Arg Variable argument. */ static void Handle_GLOBAL(const char *File, int Line, char *Var, char *Arg ) { struct passwd *pwd; struct group *grp; size_t len; const char *section; assert(File != NULL); assert(Line > 0); assert(Var != NULL); assert(Arg != NULL); if (strcasecmp(Var, "Name") == 0) { len = strlcpy(Conf_ServerName, Arg, sizeof(Conf_ServerName)); if (len >= sizeof(Conf_ServerName)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "AdminInfo1") == 0) { len = strlcpy(Conf_ServerAdmin1, Arg, sizeof(Conf_ServerAdmin1)); if (len >= sizeof(Conf_ServerAdmin1)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "AdminInfo2") == 0) { len = strlcpy(Conf_ServerAdmin2, Arg, sizeof(Conf_ServerAdmin2)); if (len >= sizeof(Conf_ServerAdmin2)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "AdminEMail") == 0) { len = strlcpy(Conf_ServerAdminMail, Arg, sizeof(Conf_ServerAdminMail)); if (len >= sizeof(Conf_ServerAdminMail)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "Info") == 0) { len = strlcpy(Conf_ServerInfo, Arg, sizeof(Conf_ServerInfo)); if (len >= sizeof(Conf_ServerInfo)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "HelpFile") == 0) { len = strlcpy(Conf_HelpFile, Arg, sizeof(Conf_HelpFile)); if (len >= sizeof(Conf_HelpFile)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "Listen") == 0) { if (Conf_ListenAddress) { Config_Error(LOG_ERR, "Multiple Listen= options, ignoring: %s", Arg); return; } Conf_ListenAddress = strdup_warn(Arg); /* If allocation fails, we're in trouble: we cannot ignore the * error -- otherwise ngircd would listen on all interfaces. */ if (!Conf_ListenAddress) { Config_Error(LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME); exit(1); } return; } if (strcasecmp(Var, "MotdFile") == 0) { len = strlcpy(Conf_MotdFile, Arg, sizeof(Conf_MotdFile)); if (len >= sizeof(Conf_MotdFile)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "MotdPhrase") == 0) { len = strlen(Arg); if (len == 0) return; if (len >= 127) { Config_Error_TooLong(File, Line, Var); return; } if (!array_copyb(&Conf_Motd, Arg, len + 1)) Config_Error(LOG_WARNING, "%s, line %d: Could not append MotdPhrase: %s", File, Line, strerror(errno)); Using_MotdFile = false; return; } if(strcasecmp(Var, "Password") == 0) { len = strlcpy(Conf_ServerPwd, Arg, sizeof(Conf_ServerPwd)); if (len >= sizeof(Conf_ServerPwd)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "PidFile") == 0) { len = strlcpy(Conf_PidFile, Arg, sizeof(Conf_PidFile)); if (len >= sizeof(Conf_PidFile)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "Ports") == 0) { ports_parse(&Conf_ListenPorts, File, Line, Arg); return; } if (strcasecmp(Var, "ServerGID") == 0) { grp = getgrnam(Arg); if (grp) Conf_GID = grp->gr_gid; else { Conf_GID = (unsigned int)atoi(Arg); if (!Conf_GID && strcmp(Arg, "0")) Config_Error(LOG_WARNING, "%s, line %d: Value of \"%s\" is not a valid group name or ID!", File, Line, Var); } return; } if (strcasecmp(Var, "ServerUID") == 0) { pwd = getpwnam(Arg); if (pwd) Conf_UID = pwd->pw_uid; else { Conf_UID = (unsigned int)atoi(Arg); if (!Conf_UID && strcmp(Arg, "0")) Config_Error(LOG_WARNING, "%s, line %d: Value of \"%s\" is not a valid user name or ID!", File, Line, Var); } return; } if (CheckLegacyNoOption(Var, Arg)) { /* TODO: This function and support for "NoXXX" could be * be removed starting with ngIRCd release 19 (one release * after marking it "deprecated"). */ Config_Error(LOG_WARNING, "%s, line %d (section \"Global\"): \"No\"-Prefix is deprecated, use \"%s = %s\" in [Options] section!", File, Line, NoNo(Var), InvertArg(Arg)); if (strcasecmp(Var, "NoIdent") == 0) WarnIdent(File, Line); else if (strcasecmp(Var, "NoPam") == 0) WarnPAM(File, Line); return; } if ((section = CheckLegacyGlobalOption(File, Line, Var, Arg))) { /** TODO: This function and support for these options in the * [Global] section could be removed starting with ngIRCd * release 19 (one release after marking it "deprecated"). */ if (strncasecmp(Var, "SSL", 3) == 0) { Config_Error(LOG_WARNING, "%s, line %d (section \"Global\"): \"%s\" is deprecated here, move it to %s and rename to \"%s\"!", File, Line, Var, section, Var + 3); } else { Config_Error(LOG_WARNING, "%s, line %d (section \"Global\"): \"%s\" is deprecated here, move it to %s!", File, Line, Var, section); } return; } Config_Error_Section(File, Line, Var, "Global"); } /** * Handle variable in [Limits] configuration section. * * @param Line Line numer in configuration file. * @param Var Variable name. * @param Arg Variable argument. */ static void Handle_LIMITS(const char *File, int Line, char *Var, char *Arg) { assert(File != NULL); assert(Line > 0); assert(Var != NULL); assert(Arg != NULL); if (strcasecmp(Var, "ConnectRetry") == 0) { Conf_ConnectRetry = atoi(Arg); if (Conf_ConnectRetry < 5) { Config_Error(LOG_WARNING, "%s, line %d: Value of \"ConnectRetry\" too low!", File, Line); Conf_ConnectRetry = 5; } return; } if (strcasecmp(Var, "IdleTimeout") == 0) { Conf_IdleTimeout = atoi(Arg); if (!Conf_IdleTimeout && strcmp(Arg, "0")) Config_Error_NaN(File, Line, Var); return; } if (strcasecmp(Var, "MaxConnections") == 0) { Conf_MaxConnections = atoi(Arg); if (!Conf_MaxConnections && strcmp(Arg, "0")) Config_Error_NaN(File, Line, Var); return; } if (strcasecmp(Var, "MaxConnectionsIP") == 0) { Conf_MaxConnectionsIP = atoi(Arg); if (!Conf_MaxConnectionsIP && strcmp(Arg, "0")) Config_Error_NaN(File, Line, Var); return; } if (strcasecmp(Var, "MaxJoins") == 0) { Conf_MaxJoins = atoi(Arg); if (!Conf_MaxJoins && strcmp(Arg, "0")) Config_Error_NaN(File, Line, Var); return; } if (strcasecmp(Var, "MaxNickLength") == 0) { Conf_MaxNickLength = Handle_MaxNickLength(File, Line, Arg); return; } if (strcasecmp(Var, "MaxListSize") == 0) { Conf_MaxListSize = atoi(Arg); if (!Conf_MaxListSize && strcmp(Arg, "0")) Config_Error_NaN(File, Line, Var); return; } if (strcasecmp(Var, "PingTimeout") == 0) { Conf_PingTimeout = atoi(Arg); if (Conf_PingTimeout < 5) { Config_Error(LOG_WARNING, "%s, line %d: Value of \"PingTimeout\" too low!", File, Line); Conf_PingTimeout = 5; } return; } if (strcasecmp(Var, "PongTimeout") == 0) { Conf_PongTimeout = atoi(Arg); if (Conf_PongTimeout < 5) { Config_Error(LOG_WARNING, "%s, line %d: Value of \"PongTimeout\" too low!", File, Line); Conf_PongTimeout = 5; } return; } Config_Error_Section(File, Line, Var, "Limits"); } /** * Handle variable in [Options] configuration section. * * @param Line Line numer in configuration file. * @param Var Variable name. * @param Arg Variable argument. */ static void Handle_OPTIONS(const char *File, int Line, char *Var, char *Arg) { size_t len; char *p; assert(File != NULL); assert(Line > 0); assert(Var != NULL); assert(Arg != NULL); if (strcasecmp(Var, "AllowedChannelTypes") == 0) { p = Arg; Conf_AllowedChannelTypes[0] = '\0'; while (*p) { if (strchr(Conf_AllowedChannelTypes, *p)) { /* Prefix is already included; ignore it */ p++; continue; } if (strchr(CHANTYPES, *p)) { len = strlen(Conf_AllowedChannelTypes) + 1; assert(len < sizeof(Conf_AllowedChannelTypes)); Conf_AllowedChannelTypes[len - 1] = *p; Conf_AllowedChannelTypes[len] = '\0'; } else { Config_Error(LOG_WARNING, "%s, line %d: Unknown channel prefix \"%c\" in \"AllowedChannelTypes\"!", File, Line, *p); } p++; } return; } if (strcasecmp(Var, "AllowRemoteOper") == 0) { Conf_AllowRemoteOper = Check_ArgIsTrue(Arg); return; } if (strcasecmp(Var, "ChrootDir") == 0) { len = strlcpy(Conf_Chroot, Arg, sizeof(Conf_Chroot)); if (len >= sizeof(Conf_Chroot)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "CloakHost") == 0) { len = strlcpy(Conf_CloakHost, Arg, sizeof(Conf_CloakHost)); if (len >= sizeof(Conf_CloakHost)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "CloakHostModeX") == 0) { len = strlcpy(Conf_CloakHostModeX, Arg, sizeof(Conf_CloakHostModeX)); if (len >= sizeof(Conf_CloakHostModeX)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "CloakHostSalt") == 0) { len = strlcpy(Conf_CloakHostSalt, Arg, sizeof(Conf_CloakHostSalt)); if (len >= sizeof(Conf_CloakHostSalt)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "CloakUserToNick") == 0) { Conf_CloakUserToNick = Check_ArgIsTrue(Arg); return; } if (strcasecmp(Var, "ConnectIPv6") == 0) { Conf_ConnectIPv6 = Check_ArgIsTrue(Arg); WarnIPv6(File, Line); return; } if (strcasecmp(Var, "ConnectIPv4") == 0) { Conf_ConnectIPv4 = Check_ArgIsTrue(Arg); return; } if (strcasecmp(Var, "DefaultUserModes") == 0) { p = Arg; Conf_DefaultUserModes[0] = '\0'; while (*p) { if (strchr(Conf_DefaultUserModes, *p)) { /* Mode is already included; ignore it */ p++; continue; } if (strchr(USERMODES, *p)) { len = strlen(Conf_DefaultUserModes) + 1; assert(len < sizeof(Conf_DefaultUserModes)); Conf_DefaultUserModes[len - 1] = *p; Conf_DefaultUserModes[len] = '\0'; } else { Config_Error(LOG_WARNING, "%s, line %d: Unknown user mode \"%c\" in \"DefaultUserModes\"!", File, Line, *p); } p++; } return; } if (strcasecmp(Var, "DNS") == 0) { Conf_DNS = Check_ArgIsTrue(Arg); return; } if (strcasecmp(Var, "Ident") == 0) { Conf_Ident = Check_ArgIsTrue(Arg); WarnIdent(File, Line); return; } if (strcasecmp(Var, "IncludeDir") == 0) { if (Conf_IncludeDir[0]) { Config_Error(LOG_ERR, "%s, line %d: Can't overwrite value of \"IncludeDir\" variable!", File, Line); return; } len = strlcpy(Conf_IncludeDir, Arg, sizeof(Conf_IncludeDir)); if (len >= sizeof(Conf_IncludeDir)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "MorePrivacy") == 0) { Conf_MorePrivacy = Check_ArgIsTrue(Arg); return; } if (strcasecmp(Var, "NoticeAuth") == 0) { Conf_NoticeAuth = Check_ArgIsTrue(Arg); return; } if (strcasecmp(Var, "OperCanUseMode") == 0) { Conf_OperCanMode = Check_ArgIsTrue(Arg); return; } if (strcasecmp(Var, "OperChanPAutoOp") == 0) { Conf_OperChanPAutoOp = Check_ArgIsTrue(Arg); return; } if (strcasecmp(Var, "OperServerMode") == 0) { Conf_OperServerMode = Check_ArgIsTrue(Arg); return; } if (strcasecmp(Var, "PAM") == 0) { Conf_PAM = Check_ArgIsTrue(Arg); WarnPAM(File, Line); return; } if (strcasecmp(Var, "PAMIsOptional") == 0 ) { Conf_PAMIsOptional = Check_ArgIsTrue(Arg); return; } if (strcasecmp(Var, "PredefChannelsOnly") == 0) { /* * TODO: This section and support for "PredefChannelsOnly" * could be removed starting with ngIRCd release 22 (one * release after marking it "deprecated") ... */ Config_Error(LOG_WARNING, "%s, line %d (section \"Options\"): \"%s\" is deprecated, please use \"AllowedChannelTypes\"!", File, Line, Var); if (Check_ArgIsTrue(Arg)) Conf_AllowedChannelTypes[0] = '\0'; else strlcpy(Conf_AllowedChannelTypes, CHANTYPES, sizeof(Conf_AllowedChannelTypes)); return; } #ifndef STRICT_RFC if (strcasecmp(Var, "RequireAuthPing") == 0) { Conf_AuthPing = Check_ArgIsTrue(Arg); return; } #endif if (strcasecmp(Var, "ScrubCTCP") == 0) { Conf_ScrubCTCP = Check_ArgIsTrue(Arg); return; } #ifdef SYSLOG if (strcasecmp(Var, "SyslogFacility") == 0) { Conf_SyslogFacility = ngt_SyslogFacilityID(Arg, Conf_SyslogFacility); return; } #endif if (strcasecmp(Var, "WebircPassword") == 0) { len = strlcpy(Conf_WebircPwd, Arg, sizeof(Conf_WebircPwd)); if (len >= sizeof(Conf_WebircPwd)) Config_Error_TooLong(File, Line, Var); return; } Config_Error_Section(File, Line, Var, "Options"); } #ifdef SSL_SUPPORT /** * Handle variable in [SSL] configuration section. * * @param Line Line numer in configuration file. * @param Var Variable name. * @param Arg Variable argument. */ static void Handle_SSL(const char *File, int Line, char *Var, char *Arg) { assert(File != NULL); assert(Line > 0); assert(Var != NULL); assert(Arg != NULL); if (strcasecmp(Var, "CertFile") == 0) { assert(Conf_SSLOptions.CertFile == NULL); Conf_SSLOptions.CertFile = strdup_warn(Arg); return; } if (strcasecmp(Var, "DHFile") == 0) { assert(Conf_SSLOptions.DHFile == NULL); Conf_SSLOptions.DHFile = strdup_warn(Arg); return; } if (strcasecmp(Var, "KeyFile") == 0) { assert(Conf_SSLOptions.KeyFile == NULL); Conf_SSLOptions.KeyFile = strdup_warn(Arg); return; } if (strcasecmp(Var, "KeyFilePassword") == 0) { assert(array_bytes(&Conf_SSLOptions.KeyFilePassword) == 0); if (!array_copys(&Conf_SSLOptions.KeyFilePassword, Arg)) Config_Error(LOG_ERR, "%s, line %d (section \"SSL\"): Could not copy %s: %s!", File, Line, Var, strerror(errno)); return; } if (strcasecmp(Var, "Ports") == 0) { ports_parse(&Conf_SSLOptions.ListenPorts, File, Line, Arg); return; } if (strcasecmp(Var, "CipherList") == 0) { assert(Conf_SSLOptions.CipherList == NULL); Conf_SSLOptions.CipherList = strdup_warn(Arg); return; } Config_Error_Section(File, Line, Var, "SSL"); } #endif /** * Handle variable in [Operator] configuration section. * * @param Line Line numer in configuration file. * @param Var Variable name. * @param Arg Variable argument. */ static void Handle_OPERATOR(const char *File, int Line, char *Var, char *Arg ) { size_t len; struct Conf_Oper *op; assert( File != NULL ); assert( Line > 0 ); assert( Var != NULL ); assert( Arg != NULL ); op = array_get(&Conf_Opers, sizeof(*op), array_length(&Conf_Opers, sizeof(*op)) - 1); if (!op) return; if (strcasecmp(Var, "Name") == 0) { /* Name of IRC operator */ len = strlcpy(op->name, Arg, sizeof(op->name)); if (len >= sizeof(op->name)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "Password") == 0) { /* Password of IRC operator */ len = strlcpy(op->pwd, Arg, sizeof(op->pwd)); if (len >= sizeof(op->pwd)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "Mask") == 0) { if (op->mask) return; /* Hostname already configured */ op->mask = strdup_warn( Arg ); return; } Config_Error_Section(File, Line, Var, "Operator"); } /** * Handle variable in [Server] configuration section. * * @param Line Line numer in configuration file. * @param Var Variable name. * @param Arg Variable argument. */ static void Handle_SERVER(const char *File, int Line, char *Var, char *Arg ) { long port; size_t len; assert( File != NULL ); assert( Line > 0 ); assert( Var != NULL ); assert( Arg != NULL ); /* Ignore server block if no space is left in server configuration structure */ if( New_Server_Idx <= NONE ) return; if( strcasecmp( Var, "Host" ) == 0 ) { /* Hostname of the server */ len = strlcpy( New_Server.host, Arg, sizeof( New_Server.host )); if (len >= sizeof( New_Server.host )) Config_Error_TooLong(File, Line, Var); return; } if( strcasecmp( Var, "Name" ) == 0 ) { /* Name of the server ("Nick"/"ID") */ len = strlcpy( New_Server.name, Arg, sizeof( New_Server.name )); if (len >= sizeof( New_Server.name )) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "Bind") == 0) { if (ng_ipaddr_init(&New_Server.bind_addr, Arg, 0)) return; Config_Error(LOG_ERR, "%s, line %d (section \"Server\"): Can't parse IP address \"%s\"", File, Line, Arg); return; } if( strcasecmp( Var, "MyPassword" ) == 0 ) { /* Password of this server which is sent to the peer */ if (*Arg == ':') { Config_Error(LOG_ERR, "%s, line %d (section \"Server\"): MyPassword must not start with ':'!", File, Line); } len = strlcpy( New_Server.pwd_in, Arg, sizeof( New_Server.pwd_in )); if (len >= sizeof( New_Server.pwd_in )) Config_Error_TooLong(File, Line, Var); return; } if( strcasecmp( Var, "PeerPassword" ) == 0 ) { /* Passwort of the peer which must be received */ len = strlcpy( New_Server.pwd_out, Arg, sizeof( New_Server.pwd_out )); if (len >= sizeof( New_Server.pwd_out )) Config_Error_TooLong(File, Line, Var); return; } if( strcasecmp( Var, "Port" ) == 0 ) { /* Port to which this server should connect */ port = atol( Arg ); if (port >= 0 && port < 0xFFFF) New_Server.port = (UINT16)port; else Config_Error(LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", File, 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 */ New_Server.group = atoi( Arg ); if (!New_Server.group && strcmp(Arg, "0")) Config_Error_NaN(File, Line, Var); return; } if( strcasecmp( Var, "Passive" ) == 0 ) { if (Check_ArgIsTrue(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(File, Line, Var); return; } Config_Error_Section(File, Line, Var, "Server"); } /** * Copy channel name into channel structure. * * If the channel name is not valid because of a missing prefix ('#', '&'), * a default prefix of '#' will be added. * * @param new_chan New already allocated channel structure. * @param name Name of the new channel. * @returns true on success, false otherwise. */ static bool Handle_Channelname(struct Conf_Channel *new_chan, const char *name) { size_t size = sizeof(new_chan->name); char *dest = new_chan->name; if (!Channel_IsValidName(name)) { /* * maybe user forgot to add a '#'. * This is only here for user convenience. */ *dest = '#'; --size; ++dest; } return size > strlcpy(dest, name, size); } /** * Handle variable in [Channel] configuration section. * * @param Line Line numer in configuration file. * @param Var Variable name. * @param Arg Variable argument. */ static void Handle_CHANNEL(const char *File, int Line, char *Var, char *Arg) { size_t len; struct Conf_Channel *chan; assert( File != NULL ); assert( Line > 0 ); assert( Var != NULL ); assert( Arg != NULL ); chan = array_get(&Conf_Channels, sizeof(*chan), array_length(&Conf_Channels, sizeof(*chan)) - 1); if (!chan) return; if (strcasecmp(Var, "Name") == 0) { if (!Handle_Channelname(chan, Arg)) Config_Error_TooLong(File, Line, Var); return; } if (strcasecmp(Var, "Modes") == 0) { /* Initial modes */ len = strlcpy(chan->modes, Arg, sizeof(chan->modes)); if (len >= sizeof(chan->modes)) Config_Error_TooLong(File, Line, Var); return; } if( strcasecmp( Var, "Topic" ) == 0 ) { /* Initial topic */ len = strlcpy(chan->topic, Arg, sizeof(chan->topic)); if (len >= sizeof(chan->topic)) Config_Error_TooLong(File, Line, Var); return; } if( strcasecmp( Var, "Key" ) == 0 ) { /* Initial Channel Key (mode k) */ len = strlcpy(chan->key, Arg, sizeof(chan->key)); if (len >= sizeof(chan->key)) Config_Error_TooLong(File, Line, Var); return; } if( strcasecmp( Var, "MaxUsers" ) == 0 ) { /* maximum user limit, mode l */ chan->maxusers = (unsigned long) atol(Arg); if (!chan->maxusers && strcmp(Arg, "0")) Config_Error_NaN(File, 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(File, Line, Var); return; } Config_Error_Section(File, Line, Var, "Channel"); } /** * Validate server configuration. * * Please note that this function uses exit(1) on fatal errors and therefore * can result in ngIRCd terminating! * * @param Configtest true if the daemon has been called with "--configtest". * @param Rehash true if re-reading configuration on runtime. * @returns true if configuration is valid. */ static bool Validate_Config(bool Configtest, bool Rehash) { /* Validate configuration settings. */ #ifdef DEBUG int i, servers, servers_once; #endif bool config_valid = true; char *ptr; /* Emit a warning when the config file is not a full path name */ if (NGIRCd_ConfFile[0] && NGIRCd_ConfFile[0] != '/') { Config_Error(LOG_WARNING, "Not specifying a full path name to \"%s\" can cause problems when rehashing the server!", NGIRCd_ConfFile); } /* Validate configured server name, see RFC 2812 section 2.3.1 */ ptr = Conf_ServerName; do { if (*ptr >= 'a' && *ptr <= 'z') continue; if (*ptr >= 'A' && *ptr <= 'Z') continue; if (*ptr >= '0' && *ptr <= '9') continue; if (ptr > Conf_ServerName) { if (*ptr == '.' || *ptr == '-') continue; } Conf_ServerName[0] = '\0'; break; } while (*(++ptr)); if (!Conf_ServerName[0]) { /* No server name configured! */ config_valid = false; Config_Error(LOG_ALERT, "No (valid) server name configured in \"%s\" (section 'Global': 'Name')!", NGIRCd_ConfFile); if (!Configtest && !Rehash) { Config_Error(LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME); exit(1); } } if (Conf_ServerName[0] && !strchr(Conf_ServerName, '.')) { /* No dot in server name! */ config_valid = false; Config_Error(LOG_ALERT, "Invalid server name configured in \"%s\" (section 'Global': 'Name'): Dot missing!", NGIRCd_ConfFile); if (!Configtest) { Config_Error(LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME); exit(1); } } #ifdef STRICT_RFC if (!Conf_ServerAdminMail[0]) { /* No administrative contact configured! */ config_valid = false; Config_Error(LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile); if (!Configtest) { Config_Error(LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME); exit(1); } } #endif if (!Conf_ServerAdmin1[0] && !Conf_ServerAdmin2[0] && !Conf_ServerAdminMail[0]) { /* No administrative information configured! */ Config_Error(LOG_WARNING, "No administrative information configured but required by RFC!"); } #ifdef PAM if (Conf_ServerPwd[0]) Config_Error(LOG_ERR, "This server uses PAM, \"Password\" in [Global] section will be ignored!"); #endif #ifdef DEBUG servers = servers_once = 0; for (i = 0; i < MAX_SERVERS; i++) { if (Conf_Server[i].name[0]) { servers++; if (Conf_Server[i].flags & CONF_SFLAG_ONCE) servers_once++; } } Log(LOG_DEBUG, "Configuration: Operators=%ld, Servers=%d[%d], Channels=%ld", array_length(&Conf_Opers, sizeof(struct Conf_Oper)), servers, servers_once, array_length(&Conf_Channels, sizeof(struct Conf_Channel))); #endif return config_valid; } /** * Output "line too long" warning. * * @param Line Line number in configuration file. * @param Item Affected variable name. */ static void Config_Error_TooLong(const char *File, const int Line, const char *Item) { Config_Error(LOG_WARNING, "%s, line %d: Value of \"%s\" too long!", File, Line, Item ); } /** * Output "unknown variable" warning. * * @param Line Line number in configuration file. * @param Item Affected variable name. * @param Section Section name. */ static void Config_Error_Section(const char *File, const int Line, const char *Item, const char *Section) { Config_Error(LOG_ERR, "%s, line %d (section \"%s\"): Unknown variable \"%s\"!", File, Line, Section, Item); } /** * Output "not a number" warning. * * @param Line Line number in configuration file. * @param Item Affected variable name. */ static void Config_Error_NaN(const char *File, const int Line, const char *Item ) { Config_Error(LOG_WARNING, "%s, line %d: Value of \"%s\" is not a number!", File, Line, Item ); } /** * Output configuration error to console and/or logfile. * * On runtime, the normal log functions of the daemon are used. But when * testing the configuration ("--configtest"), all messages go directly * to the console. * * @param Level Severity level of the message. * @param Format Format string; see printf() function. */ #ifdef PROTOTYPES static void Config_Error( const int Level, const char *Format, ... ) #else static void Config_Error( Level, Format, va_alist ) const int Level; const char *Format; va_dcl #endif { char msg[MAX_LOG_MSG_LEN]; va_list ap; assert( Format != NULL ); #ifdef PROTOTYPES va_start( ap, Format ); #else va_start( ap ); #endif vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap ); va_end( ap ); if (!Use_Log) { if (Level <= LOG_WARNING) printf(" - %s\n", msg); else puts(msg); } else Log(Level, "%s", msg); } #ifdef DEBUG /** * Dump internal state of the "configuration module". */ GLOBAL void Conf_DebugDump(void) { int i; Log(LOG_DEBUG, "Configured servers:"); for (i = 0; i < MAX_SERVERS; i++) { if (! Conf_Server[i].name[0]) continue; Log(LOG_DEBUG, " - %s: %s:%d, last=%ld, group=%d, flags=%d, conn=%d", Conf_Server[i].name, Conf_Server[i].host, Conf_Server[i].port, Conf_Server[i].lasttry, Conf_Server[i].group, Conf_Server[i].flags, Conf_Server[i].conn_id); } } #endif /** * Initialize server configuration structure to default values. * * @param Server Pointer to server structure to initialize. */ static void Init_Server_Struct( CONF_SERVER *Server ) { assert( Server != NULL ); memset( Server, 0, sizeof (CONF_SERVER) ); Server->group = NONE; Server->lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY; if( NGIRCd_Passive ) Server->flags = CONF_SFLAG_DISABLED; Proc_InitStruct(&Server->res_stat); Server->conn_id = NONE; memset(&Server->bind_addr, 0, sizeof(Server->bind_addr)); } /* -eof- */ ngircd-21/COPYING0000644000175000116100000004325411655571673010544 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. ngircd-21/aclocal.m40000644000175000116100000010660012234274150011324 00000000000000# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 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. # 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. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, [m4_warning([this file was generated for autoconf 2.67. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 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_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' 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.11.1], [], [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 and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 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. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # 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 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. 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])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # 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 10 # 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, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl 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=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # 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 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # 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. # 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 -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 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 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # 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.62])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 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 if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl 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 _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl 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 ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 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_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 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 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 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 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # 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 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # 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 if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # 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, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_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 -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 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 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # 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 5 AC_DEFUN([AM_C_PROTOTYPES], [AC_REQUIRE([AC_C_PROTOTYPES]) if test "$ac_cv_prog_cc_stdc" != no; then U= ANSI2KNR= else U=_ ANSI2KNR=./ansi2knr 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 _AM_SUBST_NOTMAKE([ANSI2KNR])dnl ]) AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # 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 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2009 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 1 # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # (`yes' being less verbose, `no' or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [ --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0')]) case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001, 2003, 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. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. 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="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 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 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 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 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR ngircd-21/autogen.sh0000754000175000116100000001767112206130744011474 00000000000000#!/bin/sh # # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # # 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. # # Usage: # [VAR=] ./autogen.sh [] # # This script generates the ./configure script using GNU automake and # GNU autoconf. It tries to be smart in finding the correct/usable/available # installed versions of these tools on your system. # # In addition, it enables or disables the "de-ANSI-fication" support of GNU # automake, which is supported up to autoconf 1.11.x an has been removed # in automake 1.12 -- make sure to use a version of automake supporting it # when generating distribution archives! # # The following strategy is used for each of aclocal, autoheader, automake, # and autoconf: first, "tool" (the regular name of the tool, e. g. "autoconf" # or "automake") is checked. If this fails, "tool" (for example # "automake16") and "tool-." (e. g. "autoconf-2.54") are tried # with being 2 for tool of GNU autoconf and 1 for tools of automake; # is tried from 99 to 0. The first occurrence will be used. # # When you pass to autogen.sh it will call the generated # ./configure script on success and pass these parameters to it. # # You can tweak the behaviour using these environment variables: # # - ACLOCAL=, AUTOHEADER=, AUTOMAKE=, AUTOCONF= # Name and optionally path to the particular tool. # - PREFIX= # Search the GNU autoconf and GNU automake tools in first. If the # generated ./configure script will be called, pass "--prefix=" to it. # - EXIST= # Use to test for aclocal, autoheader etc. pp. ... # When not specified, either "type" or "which" is used. # - VERBOSE=1 # Output the detected names of the GNU automake and GNU autoconf tools. # - GO=1 # Call ./configure even if no arguments have been passed to autogen.sh. # # Examples: # # - ./autogen.sh # Generates the ./configure script. # - GO=1 ./autogen.sh # Generates the ./configure script and runs it as "./configure". # - VERBOSE=1 ./autogen.sh --with-ident # Show tool names, generates the ./configure script, and runs it with # these arguments: "./configure --with-ident". # - ACLOCAL=aclocal-1.6 GO=1 PREFIX=$HOME ./autogen.sh # Uses "aclocal-1.6" as aclocal tool, generates the ./configure script, # and runs it with these arguments: "./configure --prefix=$HOME". # Search() { [ $# -eq 2 ] || exit 1 searchlist="$1" major="$2" minor=99 [ -n "$PREFIX" ] && searchlist="${PREFIX}/$1 ${PREFIX}/bin/$1 $searchlist" for name in $searchlist; do $EXIST "${name}" >/dev/null 2>&1 if [ $? -eq 0 ]; then "${name}" --version 2>&1 \ | grep -v "environment variable" >/dev/null 2>&1 if [ $? -eq 0 ]; then echo "${name}" return 0 fi fi done while [ $minor -ge 0 ]; do for name in $searchlist; do $EXIST "${name}${major}${minor}" >/dev/null 2>&1 if [ $? -eq 0 ]; then echo "${name}${major}${minor}" return 0 fi $EXIST "${name}-${major}.${minor}" >/dev/null 2>&1 if [ $? -eq 0 ]; then echo "${name}-${major}.${minor}" return 0 fi done minor=`expr $minor - 1` done return 1 } Notfound() { echo "Error: $* not found!" echo "Please install recent versions of GNU autoconf and GNU automake." exit 1 } Run() { [ "$VERBOSE" = "1" ] && echo " - running \"$@\" ..." $@ } # Reset locale settings to suppress warning messages of Perl unset LC_ALL unset LANG # Which command should be used to detect the automake/autoconf tools? [ -z "$EXIST" ] && existlist="type which" || existlist="$EXIST" EXIST="" for t in $existlist; do $t /bin/ls >/dev/null 2>&1 if [ $? -eq 0 ]; then rm -f /tmp/test.$$ $t /tmp/test.$$ >/dev/null 2>&1 [ $? -ne 0 ] && EXIST="$t" fi [ -n "$EXIST" ] && break done if [ -z "$EXIST" ]; then echo "Didn't detect a working command to test for the autoconf/automake tools!" echo "Searchlist: $existlist" exit 1 fi [ "$VERBOSE" = "1" ] && echo "Using \"$EXIST\" to test for tools." # Try to detect the needed tools when no environment variable already # specifies one: echo "Searching for required tools ..." [ -z "$ACLOCAL" ] && ACLOCAL=`Search aclocal 1` [ "$VERBOSE" = "1" ] && echo " - ACLOCAL=$ACLOCAL" [ -z "$AUTOHEADER" ] && AUTOHEADER=`Search autoheader 2` [ "$VERBOSE" = "1" ] && echo " - AUTOHEADER=$AUTOHEADER" [ -z "$AUTOMAKE" ] && AUTOMAKE=`Search automake 1` [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE=$AUTOMAKE" [ -z "$AUTOCONF" ] && AUTOCONF=`Search autoconf 2` [ "$VERBOSE" = "1" ] && echo " - AUTOCONF=$AUTOCONF" AUTOCONF_VERSION=`echo $AUTOCONF | cut -d'-' -f2-` [ -n "$AUTOCONF_VERSION" -a "$AUTOCONF_VERSION" != "autoconf" ] \ && export AUTOCONF_VERSION || unset AUTOCONF_VERSION [ "$VERBOSE" = "1" ] && echo " - AUTOCONF_VERSION=$AUTOCONF_VERSION" AUTOMAKE_VERSION=`echo $AUTOMAKE | cut -d'-' -f2-` [ -n "$AUTOMAKE_VERSION" -a "$AUTOMAKE_VERSION" != "automake" ] \ && export AUTOMAKE_VERSION || unset AUTOMAKE_VERSION [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE_VERSION=$AUTOMAKE_VERSION" [ $# -gt 0 ] && CONFIGURE_ARGS=" $@" || CONFIGURE_ARGS="" [ -z "$GO" -a -n "$CONFIGURE_ARGS" ] && GO=1 # Verify that all tools have been found [ -z "$ACLOCAL" ] && Notfound aclocal [ -z "$AUTOHEADER" ] && Notfound autoheader [ -z "$AUTOMAKE" ] && Notfound automake [ -z "$AUTOCONF" ] && Notfound autoconf AM_VERSION=`$AUTOMAKE --version | head -n 1 | sed -e 's/.* //g'` ifs=$IFS; IFS="."; set $AM_VERSION; IFS=$ifs AM_MAJOR="$1"; AM_MINOR="$2"; AM_PATCHLEVEL="$3" echo "Detected automake $AM_VERSION ..." AM_MAKEFILES="src/ipaddr/Makefile.ng src/ngircd/Makefile.ng src/testsuite/Makefile.ng src/tool/Makefile.ng" # De-ANSI-fication? if [ "$AM_MAJOR" -eq "1" -a "$AM_MINOR" -lt "12" ]; then # automake < 1.12 => automatic de-ANSI-fication support available echo " - Enabling de-ANSI-fication support." sed -e "s|^__ng_PROTOTYPES__|AM_C_PROTOTYPES|g" configure.ng >configure.ac DEANSI_START="" DEANSI_END="" else # automake >= 1.12 => no de-ANSI-fication support available echo " - Disabling de-ANSI-fication support." sed -e "s|^__ng_PROTOTYPES__|AC_C_PROTOTYPES|g" configure.ng >configure.ac DEANSI_START="#" DEANSI_END=" (disabled by ./autogen.sh script)" fi # Serial test harness? if [ "$AM_MAJOR" -eq "1" -a "$AM_MINOR" -ge "13" ]; then # automake >= 1.13 => enforce "serial test harness" echo " - Enforcing serial test harness." SERIAL_TESTS="serial-tests" else # automake < 1.13 => no new test harness, nothing to do SERIAL_TEST="" fi sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}ansi2knr${DEANSI_END}|g" \ src/portab/Makefile.ng >src/portab/Makefile.am for makefile_ng in $AM_MAKEFILES; do makefile_am=`echo "$makefile_ng" | sed -e "s|\.ng\$|\.am|g"` sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}../portab/ansi2knr${DEANSI_END}|g" \ $makefile_ng >$makefile_am done export ACLOCAL AUTOHEADER AUTOMAKE AUTOCONF # Generate files echo "Generating files using \"$AUTOCONF\" and \"$AUTOMAKE\" ..." Run $ACLOCAL && \ Run $AUTOCONF && \ Run $AUTOHEADER && \ Run $AUTOMAKE --add-missing --no-force if [ $? -eq 0 -a -x ./configure ]; then # Success: if we got some parameters we call ./configure and pass # all of them to it. NAME=`grep PACKAGE_STRING= configure | cut -d"'" -f2` if [ "$GO" = "1" ]; then [ -n "$PREFIX" ] && p=" --prefix=$PREFIX" || p="" c="./configure${p}${CONFIGURE_ARGS}" echo "Okay, autogen.sh for $NAME done." echo "Calling \"$c\" ..." $c exit $? else echo "Okay, autogen.sh for $NAME done." echo "Now run the \"./configure\" script." exit 0 fi else # Failure!? echo "Error! Check your installation of GNU automake and autoconf!" exit 1 fi # -eof- ngircd-21/configure.ac0000644000175000116100000004613012234274146011760 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # # 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. # define(VERSION_ID,esyscmd([ V=`git describe 2>/dev/null | sed -e 's/rel-//g' | sed -e 's/-/~/'`; [ -z "$V" -a -r configure ] \ && V=`grep "PACKAGE_STRING=" configure | cut -d"'" -f2 | cut -d' ' -f2` ( [ -n "$V" ] && echo "$V" || echo "??" ) | tr -d '\n'; ])) m4_ifdef([AM_SILENT_RULES], [m4_define([ng_color_tests], [color-tests])], [m4_define([ng_color_tests], [])]) # -- Initialisation -- AC_PREREQ([2.61]) AC_INIT([ngIRCd], VERSION_ID, [ngircd-ml@ngircd.barton.de], [ngircd], [http://ngircd.barton.de/]) AC_CONFIG_SRCDIR([src/ngircd/ngircd.c]) AC_CONFIG_HEADER([src/config.h]) AC_CANONICAL_HOST AM_INIT_AUTOMAKE([-Wall 1.10 ]ng_color_tests) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # -- Templates for config.h -- AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled]) AH_TEMPLATE([HAVE_sockaddr_in_len], [Define if sockaddr_in.sin_len exists]) AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists]) AH_TEMPLATE([ICONV], [Define if libiconv can be used, e.g. for CHARCONV]) AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests]) AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used]) AH_TEMPLATE([PAM], [Define if PAM should be used]) AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled]) AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant]) AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging]) AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used]) AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled]) AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled]) AH_TEMPLATE([HOST_OS], [Target operating system name]) AH_TEMPLATE([HOST_VENDOR], [Target system vendor]) AH_TEMPLATE([HOST_CPU], [Target CPU name]) # -- C Compiler -- AC_PROG_CC AC_PROG_CC_STDC # -- Helper programs -- m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) AC_PROG_AWK AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_RANLIB # -- Compiler Features -- AC_C_CONST AC_C_INLINE AM_C_PROTOTYPES # -- Hard coded system and compiler dependencies/features/options ... -- AC_DEFUN([GCC_STACK_PROTECT_CC],[ ssp_cc=yes # we use -fstack-protector-all for the test to enfoce the use of the guard variable AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector]) ssp_old_cflags="$CFLAGS" CFLAGS="$CFLAGS -fstack-protector-all" AC_TRY_LINK(,,, ssp_cc=no) echo $ssp_cc CFLAGS="$ssp_old_cflags" if test "X$ssp_cc" = "Xyes"; then CFLAGS="$CFLAGS -fstack-protector" AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.]) fi ]) if test "$GCC" = "yes"; then # We are using the GNU C compiler. Good! CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes" GCC_STACK_PROTECT_CC fi case "$host_os" in hpux*) # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED # (tested with HP/UX 11.11) CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" ;; esac # Add additional CFLAGS, eventually specified on the command line: test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD" CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"' -DDOCDIR='\"\$(docdir)\"'" # -- Headers -- AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_TIME # Required header files AC_CHECK_HEADERS([ \ fcntl.h netdb.h netinet/in.h stdlib.h string.h \ strings.h sys/socket.h sys/time.h unistd.h \ ],,AC_MSG_ERROR([required C header missing!])) # Optional header files AC_CHECK_HEADERS_ONCE([ \ arpa/inet.h inttypes.h malloc.h netinet/in_systm.h netinet/ip.h \ stdbool.h stddef.h stdint.h varargs.h \ ]) # -- Datatypes -- AC_MSG_CHECKING(whether socklen_t exists) AC_TRY_COMPILE([ #include #include ],[ socklen_t a, b; a = 2; b = 4; a += b; ],[ AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) ]) AC_TYPE_PID_T AC_TYPE_SIGNAL AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UID_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T AC_CHECK_MEMBER([struct sockaddr_in.sin_len], AC_DEFINE(HAVE_sockaddr_in_len),, [#include ]) # -- Libraries -- # memmove: A/UX libUTIL AC_SEARCH_LIBS([memmove], [UTIL], [], [ AC_MSG_ERROR([unable to find the memmove() function]) ]) # gethostbyname: Solaris libnsl AC_SEARCH_LIBS([gethostbyname], [bind nsl network], [], [ AC_MSG_ERROR([unable to find the gethostbyname() function]) ]) # bind: SVR4 libsocket AC_SEARCH_LIBS([bind], [socket network], [], [ AC_MSG_ERROR([unable to find the bind() function]) ]) # -- Functions -- AC_FUNC_FORK AC_FUNC_STRFTIME # Required functions AC_CHECK_FUNCS([ \ alarm dup2 endpwent gethostbyaddr gethostbyname gethostname \ gettimeofday inet_ntoa memmove memset setsid socket strcasecmp \ strchr strcspn strerror strncasecmp strrchr strspn strstr \ ],, AC_MSG_ERROR([required function missing!])) # Optional functions AC_CHECK_FUNCS_ONCE([ \ arc4random arc4random_stir gai_strerror getaddrinfo getnameinfo inet_aton sigaction sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat \ strtok_r waitpid]) # -- Configuration options -- # use syslog? x_syslog_on=no AC_ARG_WITH(syslog, AS_HELP_STRING([--without-syslog], [disable syslog (autodetected by default)]), [ 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_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes], [ AC_MSG_ERROR([Can't enable syslog!]) ]) fi ], [ AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes]) ] ) if test "$x_syslog_on" = "yes"; then AC_DEFINE(SYSLOG, 1) AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!])) fi # use zlib compression? x_zlib_on=no AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib], [disable zlib compression (autodetected by default)]), [ 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(z, deflate) AC_CHECK_FUNCS(deflate, x_zlib_on=yes, AC_MSG_ERROR([Can't enable zlib!]) ) fi ], [ AC_CHECK_LIB(z, deflate) AC_CHECK_FUNCS(deflate, x_zlib_on=yes) ] ) if test "$x_zlib_on" = "yes"; then AC_DEFINE(ZLIB, 1) AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!])) fi # detect which IO API to use: x_io_backend=none AC_ARG_WITH(select, AS_HELP_STRING([--without-select], [disable select IO support (autodetected by default)]), [ 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_FUNCS(select, x_io_select=yes, AC_MSG_ERROR([Can't enable select IO support!]) ) fi ], [ AC_CHECK_FUNCS(select, x_io_select=yes) ] ) AC_ARG_WITH(poll, AS_HELP_STRING([--without-poll], [disable poll support (autodetected by default)]), [ 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_FUNCS(poll, [ AC_CHECK_HEADERS(poll.h, x_io_backend=poll\(\), AC_MSG_ERROR( [Can't enable poll IO support!]) ) ], [ AC_MSG_ERROR([Can't enable poll IO support!]) ]) fi ], [ AC_CHECK_FUNCS(poll, [ AC_CHECK_HEADERS(poll.h, x_io_backend=poll\(\)) ]) ] ) AC_ARG_WITH(devpoll, AS_HELP_STRING([--without-devpoll], [disable /dev/poll IO support (autodetected by default)]), [ 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_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!])) fi ], [ AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll) ] ) AC_ARG_WITH(epoll, AS_HELP_STRING([--without-epoll], [disable epoll IO support (autodetected by default)]), [ 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_FUNCS(epoll_create, x_io_epoll=yes, AC_MSG_ERROR([Can't enable epoll IO support!]) ) fi ], [ AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes) ] ) AC_ARG_WITH(kqueue, AS_HELP_STRING([--without-kqueue], [disable kqueue IO support (autodetected by default)]), [ 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_FUNCS(kqueue, x_io_backend=kqueue\(\), AC_MSG_ERROR([Can't enable kqueue IO support!]) ) fi ], [ AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\)) ] ) if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then # when epoll() and select() are available, we'll use both! x_io_backend="epoll(), select()" else if test "$x_io_epoll" = "yes"; then # we prefere epoll() if it is available x_io_backend="epoll()" else if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then # we'll use select, when available and no "better" # interface has been detected ... x_io_backend="select()" fi fi fi if test "$x_io_backend" = "none"; then AC_MSG_ERROR([No useable IO API activated/found!?]) fi # use SSL? AC_ARG_WITH(openssl, AS_HELP_STRING([--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, AS_HELP_STRING([--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 AC_ARG_WITH(tcp-wrappers, AS_HELP_STRING([--with-tcp-wrappers], [enable TCP wrappers support]), [ 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_MSG_CHECKING(for hosts_access) LIBS="-lwrap $LIBS" AC_TRY_LINK([ #include int allow_severity = 0; int deny_severity = 0; ],[ tcpd_warn("link test"); ],[ AC_MSG_RESULT(yes) AC_DEFINE(TCPWRAP, 1) x_tcpwrap_on=yes ],[ AC_MSG_RESULT(no) AC_MSG_ERROR([Can't enable TCP wrappers!]) ]) fi ] ) # do IDENT requests using libident? x_identauth_on=no AC_ARG_WITH(ident, AS_HELP_STRING([--with-ident], [enable "IDENT" ("AUTH") protocol support]), [ 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(ident, ident_id) AC_CHECK_FUNCS(ident_id, x_identauth_on=yes, AC_MSG_ERROR([Can't enable IDENT support!]) ) fi ] ) if test "$x_identauth_on" = "yes"; then AC_DEFINE(IDENTAUTH, 1) AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!])) fi # compile in PAM support? x_pam_on=no AC_ARG_WITH(pam, AS_HELP_STRING([--with-pam], [enable user authentication using PAM]), [ 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(pam, pam_authenticate) AC_CHECK_FUNCS(pam_authenticate, x_pam_on=yes, AC_MSG_ERROR([Can't enable PAM support!]) ) fi ] ) if test "$x_pam_on" = "yes"; then AC_DEFINE(PAM, 1) AC_CHECK_HEADERS(security/pam_appl.h,pam_ok=yes) if test "$pam_ok" != "yes"; then AC_CHECK_HEADERS(pam/pam_appl.h,pam_ok=yes, AC_MSG_ERROR([required C header missing!])) fi fi # compile in IRC+ protocol support? x_ircplus_on=yes AC_ARG_ENABLE(ircplus, AS_HELP_STRING([--disable-ircplus], [disable IRC+ protocol]), if test "$enableval" = "no"; then x_ircplus_on=no; fi ) if test "$x_ircplus_on" = "yes"; then AC_DEFINE(IRCPLUS, 1) # Compile in iconv support? # We only check for it when IRC+ is enabled, because the IRC+ command # CHARCONV is the only function depending on it. x_iconv_on=no AC_ARG_WITH(iconv, AS_HELP_STRING([--with-iconv], [enable character conversion using libiconv]), [ 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(iconv, iconv_open) AC_CHECK_FUNCS(iconv_open, x_iconv_on=yes) if test "$x_iconv_on" != "yes"; then AC_CHECK_LIB(iconv, libiconv_open) AC_CHECK_FUNCS(libiconv_open, x_iconv_on=yes) fi if test "$x_iconv_on" != "yes"; then AC_MSG_ERROR([Can't enable libiconv support!]) fi fi ] ) if test "$x_iconv_on" = "yes"; then AC_DEFINE(ICONV, 1) fi fi # enable support for IPv6? x_ipv6_on=no AC_ARG_ENABLE(ipv6, AS_HELP_STRING([--enable-ipv6], [enable IPv6 protocol support]), 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!])) AC_DEFINE(WANT_IPV6, 1) fi # compile in IRC "sniffer"? x_sniffer_on=no; x_debug_on=no AC_ARG_ENABLE(sniffer, AS_HELP_STRING([--enable-sniffer], [enable IRC traffic sniffer (enables debug mode)]), if test "$enableval" = "yes"; then AC_DEFINE(SNIFFER, 1) x_sniffer_on=yes; x_debug_on=yes fi ) # enable additional debugging code? AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [show additional debug output]), if test "$enableval" = "yes"; then x_debug_on=yes; fi ) 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"? x_strict_rfc_on=no AC_ARG_ENABLE(strict-rfc, AS_HELP_STRING([--enable-strict-rfc], [strict RFC conformance -- may break clients!]), if test "$enableval" = "yes"; then AC_DEFINE(STRICT_RFC, 1) x_strict_rfc_on=yes fi ) # -- Definitions -- AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" ) AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" ) AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" ) # Add additional CFLAGS, eventually specified on the command line, but after # running this configure script. Useful for "-Werror" for example. test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END" # -- Generate files -- AC_CONFIG_FILES([ \ Makefile \ contrib/Debian/Makefile \ contrib/MacOSX/Makefile \ contrib/MacOSX/ngIRCd.pmdoc/Makefile \ contrib/MacOSX/ngIRCd.xcodeproj/Makefile \ contrib/Makefile \ doc/Makefile \ doc/src/Makefile \ man/Makefile \ src/ipaddr/Makefile \ src/Makefile \ src/ngircd/Makefile \ src/portab/Makefile \ src/testsuite/Makefile \ src/tool/Makefile \ ]) AC_OUTPUT type dpkg >/dev/null 2>&1 if test $? -eq 0; then # Generate debian/ link if the dpkg command exists # (read: if we are running on a debian compatible system) echo "creating Debian-specific links ..." test -f debian/rules || ln -s contrib/Debian debian fi # -- Result -- echo echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:" echo # Someone please show me a better way :) [borrowed by OpenSSH] B=`eval echo ${bindir}` ; B=`eval echo ${B}` S=`eval echo ${sbindir}` ; S=`eval echo ${S}` C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}` M=`eval echo ${mandir}` ; M=`eval echo ${M}` D=`eval echo ${docdir}` ; D=`eval echo ${D}` echo " Host: ${host}" echo " Compiler: ${CC}" test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}" test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}" test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}" test -n "$LIBS" && echo " Libraries: ${LIBS}" echo echo " 'ngircd' binary: $S" echo " Configuration file: $C" echo " Manual pages: $M" echo " Documentation: $D" echo echo $ECHO_N " Syslog support: $ECHO_C" test "$x_syslog_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " Enable debug code: $ECHO_C" test "$x_debug_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " zlib compression: $ECHO_C" test "$x_zlib_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " IRC sniffer: $ECHO_C" test "$x_sniffer_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " Use TCP Wrappers: $ECHO_C" test "$x_tcpwrap_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " Strict RFC mode: $ECHO_C" test "$x_strict_rfc_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " IDENT support: $ECHO_C" test "$x_identauth_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " IRC+ protocol: $ECHO_C" test "$x_ircplus_on" = "yes" \ && echo "yes" \ || echo "no" echo $ECHO_N " IPv6 protocol: $ECHO_C" test "$x_ipv6_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " I/O backend: $ECHO_C" echo "$x_io_backend" echo $ECHO_N " PAM support: $ECHO_C" test "$x_pam_on" = "yes" \ && echo $ECHO_N "yes $ECHO_C" \ || echo $ECHO_N "no $ECHO_C" echo $ECHO_N " SSL support: $ECHO_C" echo "$x_ssl_lib" echo $ECHO_N " libiconv support: $ECHO_C" echo "$x_iconv_on" echo define(_automake_regex_,[[^AUTOMAKE_OPTIONS = [a-z .\-]*/portab/ansi2knr]]) if ! grep "_automake_regex_" src/ngircd/Makefile.am >/dev/null 2>&1; then echo "WARNING:" echo "This GNU automake generated build system does not support \"de-ANSI-fication\"," echo "therefore don't use it to generate \"official\" distribution archives!" echo "(Most probably you want to use GNU automake 1.11.x for this purpose ...)" echo fi # -eof- ngircd-21/missing0000755000175000000000000002623312005170750011052 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 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. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails 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 help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # 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). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." 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 echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package 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 test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." 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 echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, 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 "$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` # ... 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 ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: ngircd-21/doc/0000755000175000116100000000000012234274324010311 500000000000000ngircd-21/doc/README-BeOS.txt0000644000175000116100000000434611130147557012525 00000000000000 ngIRCd - Next Generation IRC Server (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ ngIRCd is free software and published under the terms of the GNU General Public License. -- README-BeOS.txt -- +-------------------------------------------------------------+ | This text is only available in german at the moment, sorry! | | Contributors for this text or the BeOS port are welcome :-) | +-------------------------------------------------------------+ BeOS gehoert im Moment (noch?) nicht zu den offiziell unterstuetzten Plat- formen: der ngIRCd enthaelt zwar bereits einige Anpassungen an BeOS und compiliert auch, jedoch bricht er bei jedem Connect-Versuch eines Clients 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 asynchron gestartet wird, also Pipe-Handles im select() vorhanden sind, fuehrt das zu obiger Meldung. Theoretische "Loesung"/Workaround: Den Resolver unter BeOS nicht verwenden, sondern mit IP-Adressen arbeiten. Nachteil: der ngIRCd koennte sich nicht zu Servern verbinden, die dynamische Adressen benutzen -- dazu muesste er den Namen aufloesen. Ansonsten sollte es eigentlich zu keinen Beeintraechtigungen kommen ... Also: wenn es jemand implementieren will ... ;-)) Vielleicht mache ich es auch irgendwann mal selber. Mal sehen. 2002-05-19: Ich habe gerade damit ein wenig gespielt und den Source hier so geaendert, dass unter BeOS keine Resolver-Subprozesse mehr erzeugt werden, sondern mit den "rohen" IP-Adressen gearbeitet wird. Das funktioniert so weit auch, allerdings verschluckt sich BeOS nun bei anderen Funktionen, so zum Beispiel bei close(), wenn ein Socket eines Clients geschlossen werden soll!? Sehr komisch. Wer Interesse daran hat, das weiter zu verfolgen, der moege sich bitte mit mir in Verbindung setzen (alex@barton.de), ich maile gerne meine Patches zu. Fuer eine Aenderung im CVS ist es aber meiner Meinung nach noch zu frueh ... -- $Id: README-BeOS.txt,v 1.7 2003/05/15 21:47:57 alex Exp $ ngircd-21/doc/PAM.txt0000644000175000116100000000334612216423303011406 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2013 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- PAM.txt -- ngIRCd can optionally be compiled to use PAM, the Pluggable Authentication Modules library, for user authentication. When compiled with PAM support, ngIRCd will authenticate all users connecting to the daemon using the configured PAM modules in an asynchronous child process. To enable PAM, you have to pass the command line parameter "--with-pam" to the "configure" script. Please see the PAM documentation ("man 7 pam") for details and information about configuring PAM and its individual modules. A very simple -- and quite useless ;-) -- example would be: /etc/pam.d/ngircd: auth required pam_debug.so Here the "pam_debug" module will be called each time a client connects to the ngIRCd and has sent its PASS, NICK, and USER commands. Please note ONE VERY IMPORTANT THING: All the PAM modules are executed with the privileges of the user ngIRCd is running as. Therefore a lot of PAM modules aren't working as expected, because they need root privileges ("pam_unix", for example)! Only PAM modules not(!) requiring root privileges (such as "pam_pgsql", "pam_mysql", "pam_opendirectory" ...) can be used in conjunction with ngIRCd. More Examples: * Use an own "password file" for ngIRCd: Note: you can use the htpasswd(1) utility of Apache to manage password files used by pam_pwdfile, see "man htpasswd"! /etc/pam.d/ngircd: auth required pam_pwdfile.so pwdfile=/etc/ngircd/ngircd.passwd ngircd-21/doc/Makefile.in0000644000175000116100000004501712234274153012305 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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-2013 Alexander Barton (alex@barton.de) and Contributors # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-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 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUFFIXES = .tmpl static_docs = \ Bopm.txt \ Capabilities.txt \ Commands.txt \ Contributing.txt \ FAQ.txt \ GIT.txt \ HowToRelease.txt \ Modes.txt \ PAM.txt \ Platforms.txt \ Protocol.txt \ README-AUX.txt \ README-BeOS.txt \ README-Interix.txt \ RFC.txt \ Services.txt \ SSL.txt doc_templates = sample-ngircd.conf.tmpl generated_docs = sample-ngircd.conf toplevel_docs = ../AUTHORS ../COPYING ../ChangeLog ../INSTALL ../NEWS ../README SUBDIRS = src EXTRA_DIST = $(static_docs) $(doc_templates) CLEANFILES = $(generated_docs) all: all-recursive .SUFFIXES: .SUFFIXES: .tmpl $(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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/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 $(am__aclocal_m4_deps): # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" 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)'; \ 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-data-am install-strip tags-recursive \ uninstall-am .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-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 uninstall-hook .tmpl: $(AM_V_GEN)sed \ -e "s@:ETCDIR:@${sysconfdir}@" \ -e "s@:DOCDIR:@${docdir}@" \ <$< >$@ maintainer-clean-local: rm -f Makefile Makefile.in all: $(generated_docs) install-data-hook: $(static_docs) $(toplevel_docs) $(generated_docs) $(mkinstalldirs) $(DESTDIR)$(sysconfdir) @if [ ! -f $(DESTDIR)$(sysconfdir)/ngircd.conf ]; then \ make install-config; \ fi $(mkinstalldirs) $(DESTDIR)$(docdir) for f in $(static_docs) $(toplevel_docs); do \ $(INSTALL) -m 644 -c $(srcdir)/$$f $(DESTDIR)$(docdir)/; \ done for f in $(generated_docs); do \ $(INSTALL) -m 644 -c $$f $(DESTDIR)$(docdir)/; \ done install-config: $(INSTALL) -m 600 -c sample-ngircd.conf $(DESTDIR)$(sysconfdir)/ngircd.conf @echo; \ echo " ** NOTE: Installed sample configuration file:"; \ echo " ** \"$(DESTDIR)$(sysconfdir)/ngircd.conf\""; \ echo uninstall-hook: rm -rf $(DESTDIR)$(docdir) @if cmp --silent sample-ngircd.conf $(DESTDIR)$(sysconfdir)/ngircd.conf; then \ make uninstall-config; \ else \ echo; \ echo " ** NOTE: Not uninstalling changed configuration file:"; \ echo " ** \"$(DESTDIR)$(sysconfdir)/ngircd.conf\""; \ echo; \ fi uninstall-config: rm -f $(DESTDIR)$(sysconfdir)/ngircd.conf srcdoc: make -C src srcdoc .PHONY: install-config uninstall-config srcdoc # -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: ngircd-21/doc/Capabilities.txt0000644000175000116100000000166211766064471013401 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2012 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- Capabilities.txt -- This document lists and describes the "IRC capabilities" that ngIRCd supports and can be requested by a IRC/IRCv3 client that supports the "CAP" command. ngIRCd implements the "IRC Client Capabilities Extension" as described here: I. Supported Capabilities ~~~~~~~~~~~~~~~~~~~~~~~~~ * "multi-prefix" When requested, the multi-prefix client capability will cause the IRC server to send all possible prefixes which apply to a user in NAMES and WHO output. See . ngircd-21/doc/SSL.txt0000644000175000116100000000702111602333305011424 00000000000000 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. -- SSL.txt -- 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 [SSL] section of ngircd.conf(5): Ports, KeyFile, and CertFile. 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 4096 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 4096 --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: 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 ! Put this in your stunnel.conf: [ircs] accept = 6667 connect = 6668 This makes stunnel listen for incoming connections on port 6667 and forward decrypted data to port 6668. We call the connection 'ircs'. Stunnel will use this name when logging connection attempts via syslog. You can also use the name in /etc/hosts.{allow,deny} if you run tcp-wrappers. To make sure ngircd is listening on the port where the decrypted data arrives, set Ports = 6668 in your ngircd.conf. Start stunnel and restart ngircd. That's it. Don't forget to activate ssl support in your irc client ;) 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 === ngircd-21/doc/Modes.txt0000644000175000116100000000627312206130744012045 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2012 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- Modes.txt -- This document lists the different user modes, channel modes, and channel user modes that ngIRCd supports. I. User Modes ~~~~~~~~~~~~~ User modes are attributes a user has in the network, regardless of the channels he is using at the moment. mode since description a 0.3.0 User is away. b 20 User blocks private messages and notices. B 20 User is flagged as a "bot". c 17 IRC operator wants to receive connect/disconnect NOTICEs. C 19 Only users that share a channel are allowed to send messages. i 0.0.1 User is "invisible". o 0.0.1 User is IRC operator. q 20 User is protected, can not be kicked from a channel. r 0.0.1 User is restricted. R (1) 19 User is registered (e.g. by NickServ). s 0.4.0 User wants to receive server notices. w 0.11.0 User wants to receive WALLOPS messages. x 17 Hostname of this user is "cloaked". II. Channel Modes ~~~~~~~~~~~~~~~~~ Channel modes are attributes of specific channels which are valid for all users joined (or trying to join) to this channel. Some modes add and remove users to lists (e.g. "invite list", "ban list"), others have parameters (like "channel key"), most are simple flags (like "moderated"). mode since description b 0.5.0 Add/remove a host mask to the ban list. e 19 Add/remove a host mask to the exception list. i 0.5.0 Channel is "invite only". I 0.5.0 Add/remove a host mask to the invite list. k 0.6.0 Channel has a "key" (a password). l 0.6.0 Channel has a user limit. m 0.3.0 Channel is moderated, only "voiced" users can send messages. M 20 Only registered users (and IRC Ops) can send messages. n 0.3.0 Channel doesn't allow messages of users not being members. O 18 Only IRC operators are allowed to join this channel. P 0.5.0 Channel is "persistent". Q 20 Nobody can be kicked from the channel. r (1) 19 Channel is "registered" (e.g. by ChanServ). R 19 Only registered users are allowed to join this channel. s 0.9.0 Channel is "secret". t 0.3.0 Only ChanOps are allowed to modify the channel topic. V 20 Channel doesn't allow invites. z 16 Only users connected via SSL are allowed to join the channel. III. Channel User Modes ~~~~~~~~~~~~~~~~~~~~~~~ Channel user modes are attributes that a particular user has in a specific channel of which he is a member. mode since description q 20 User is channel owner can only be set by a service, other owner and irc op. Can promote other users to q, a, o, h, v. a 20 User is channel admin and can promote other users to v, h, o o 0.2.0 User is channel operator and can op/kick/... other members. h 20 User is half op and can set channel modes imntvIbek and kick voiced and normal users. v 0.2.0 User is "voiced" and can speak even if channel is moderated. Notes ~~~~~ (1) This mode is not set by ngIRCd itself but by services. ngIRCd handles the mode transparently and possibly adjusts its behaviour. ngircd-21/doc/Services.txt0000644000175000116100000000675212206130744012563 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2011 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- Services.txt -- ngIRCd doesn't implement a "special IRC services interface", but services acting as a "regular servers" ("pseudo servers") are supported, either using the IRC protocol as defined in RFC 1459 or RFC 2812. Support for Services has been tested using - Anope 1.9.8 or later () - Atheme 7.0.2 or later () - "IRC Services" 5.1.x by Andrew Church () This document describes setting up ngIRCd and these services. Please let us know if you are successfully using other IRC service packages or which problems you encounter -- thanks! 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 Anope 1.9.x ~~~~~~~~~~~~~~~~~~~~~~ Anope 1.9.8 or later () can be used with ngIRCd using the "ngircd" protocol module. At least the following settings have to be tweaked, in addition to all the settings marked as required by Anope: In conf/services.conf: define { name = "services.host" value = "services.irc.net" } uplink { host = "server.irc.net" port = 6667 password = "123abc" } # Load ngIRCd protocol module module { name = "ngircd" } networkinfo { # Must be set to the "MaxNickLength" setting of ngIRCd! nicklen = 9 chanlen = 50 } In conf/nickserv.conf: nickserv { # not required if you are running ngIRCd with a higher nickname limit # ("MaxNickLength") than 11 characters, but REQUIRED by default! guestnickprefix = "G-" } Setting up Atheme 7.0.2 or later ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Atheme 7.0.2 or later () may be used with ngIRCd using the "ngircd" protocol module. The following settings need to be in atheme.conf: loadmodule "modules/protocol/ngircd"; uplink "server.irc.net" { password = "123abc"; port = 6667; }; The documentation of Atheme can be found in the doc/ directory of the Atheme source distribution. 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: 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: ngircd-21/doc/Makefile.am0000644000175000116100000000442112206130744012262 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # # 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. # .tmpl: $(AM_V_GEN)sed \ -e "s@:ETCDIR:@${sysconfdir}@" \ -e "s@:DOCDIR:@${docdir}@" \ <$< >$@ SUFFIXES = .tmpl static_docs = \ Bopm.txt \ Capabilities.txt \ Commands.txt \ Contributing.txt \ FAQ.txt \ GIT.txt \ HowToRelease.txt \ Modes.txt \ PAM.txt \ Platforms.txt \ Protocol.txt \ README-AUX.txt \ README-BeOS.txt \ README-Interix.txt \ RFC.txt \ Services.txt \ SSL.txt doc_templates = sample-ngircd.conf.tmpl generated_docs = sample-ngircd.conf toplevel_docs = ../AUTHORS ../COPYING ../ChangeLog ../INSTALL ../NEWS ../README SUBDIRS = src EXTRA_DIST = $(static_docs) $(doc_templates) CLEANFILES = $(generated_docs) maintainer-clean-local: rm -f Makefile Makefile.in all: $(generated_docs) install-data-hook: $(static_docs) $(toplevel_docs) $(generated_docs) $(mkinstalldirs) $(DESTDIR)$(sysconfdir) @if [ ! -f $(DESTDIR)$(sysconfdir)/ngircd.conf ]; then \ make install-config; \ fi $(mkinstalldirs) $(DESTDIR)$(docdir) for f in $(static_docs) $(toplevel_docs); do \ $(INSTALL) -m 644 -c $(srcdir)/$$f $(DESTDIR)$(docdir)/; \ done for f in $(generated_docs); do \ $(INSTALL) -m 644 -c $$f $(DESTDIR)$(docdir)/; \ done install-config: $(INSTALL) -m 600 -c sample-ngircd.conf $(DESTDIR)$(sysconfdir)/ngircd.conf @echo; \ echo " ** NOTE: Installed sample configuration file:"; \ echo " ** \"$(DESTDIR)$(sysconfdir)/ngircd.conf\""; \ echo uninstall-hook: rm -rf $(DESTDIR)$(docdir) @if cmp --silent sample-ngircd.conf $(DESTDIR)$(sysconfdir)/ngircd.conf; then \ make uninstall-config; \ else \ echo; \ echo " ** NOTE: Not uninstalling changed configuration file:"; \ echo " ** \"$(DESTDIR)$(sysconfdir)/ngircd.conf\""; \ echo; \ fi uninstall-config: rm -f $(DESTDIR)$(sysconfdir)/ngircd.conf srcdoc: make -C src srcdoc .PHONY: install-config uninstall-config srcdoc # -eof- ngircd-21/doc/README-AUX.txt0000644000175000116100000000451111130147557012364 00000000000000 ngIRCd - Next Generation IRC Server (c)2001-2005 Alexander Barton, alex@barton.de, http://www.barton.de/ ngIRCd is free software and published under the terms of the GNU General Public License. -- README-AUX.txt -- Since version 0.2.2-pre Apple's A/UX belongs to the officially supported platforms. It is not restricted in any way. Since version 0.5.0 ngIRCd's source compiles with the native A/UX c compiler. GNU C isn't a must-have anymore. The following software packages are needed: - GNU sed Source: http://www.rezepte-im-web.de/appleux/sed-3.02.tar.gz ftp://arthur.barton.de/pub/unix/aux/tools/sed-3.02.tar.gz A/UX comes with /bin/sed which isn't supporting all functions needed by GNU automake/autoconf. Warning: When installing GNU sed please make sure that A/UX doesn't use the old one anymore which means set the $PATH or replace /bin/sed at all. - libUTIL.a Source: ftp://ftp.mayn.de/pub/really_old_stuff/apple/apple_unix/Sys_stuff/libUTIL-2.1.tar.gz> 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() and strdup(). After installation of these packages just do a "./configure" and "make" to compile ngIRCd on A/UX. A few hints in case of errors: - Either there's an 'install' on your system which is completely broken (so 'configure' uses its own shell script) or use a fully functionable one. There's at least one binary "out there" causing problems. The one of the GNU fileutils works fine: ftp://arthur.barton.de/pub/unix/aux/tools/fileutils-4.0.tar.gz - The precompiled binary of the old 'bash' shouldn't be installed within /bin (better do this in /usr/local/bin) because 'configure' would choose it as its shell which wouldn't work. - Because of limitations of /bin/sh on A/UX it can't be used to create the 'config.status' script. Better rename /bin/sh to /bin/sh.AUX and replace it by a symbolic link to /bin/ksh (ln -s /bin/ksh /bin/sh as root). These procedure shouldn't cause you into problems and is recommended even if you don't use ngIRCd. -- $Id: README-AUX.txt,v 1.10 2006/07/23 12:19:57 alex Exp $ ngircd-21/doc/Bopm.txt0000644000175000116100000000350511602332715011667 00000000000000 ngIRCd - Next Generation IRC Server (c)2001-2010 Alexander Barton, alex@barton.de, http://www.barton.de/ ngIRCd is free software and published under the terms of the GNU General Public License. -- BOPM.txt -- I. Introduction ~~~~~~~~~~~~~~~~ Citing : "BOPM is an open source open proxy monitor, designed for use with hybrid-based ircds, although it can be used with slight modification on any server which has the ability to show connects to opers and that supports KLINEs." And starting with Release 17, ngIRCd supports all required log messages that BOPM requires to be useful. II. Installation ~~~~~~~~~~~~~~~~~ Install BOPM as usual, please see the BOPM documentation for details. Afterwards adjust the following configuration parameters that are important for ngIRCd: a) BOPM "IRC" section: 1) Set "server" and "port" accordingly, 2) adjust the "oper" line to match an [Operator] block in ngircd.conf, 3) change "mode" to "+ci" or "+c". 4) Set "connregex" to the following string, everything in one line(!): "\\*\\*\\* Notice -- Client connecting: ([^ ]+) \\(([^@]+)@([^\\)]+)\\) \\[([0-9\\.]+)\\].*"; and comment all the other "connregex" examples (prepend a "#" character). 5) Set "kline" to "KILL %n :Open proxy found on your host!"; for example, and comment all the other "kline" examples. b) BOPM "scanner" section: Make sure you configure a valid "target_ip" and "target_port" for the configured scanners to test. And please note that you CAN'T USE the port of ngIRCd, because ngIRCd doesn't send any banner message by default! So you need a service what sends a banner, so for example POP3, SMTP, IMAP, or SSH daemons should work ... ngircd-21/doc/RFC.txt0000644000175000116100000000170311000116207011366 00000000000000 ngIRCd - Next Generation IRC Server (c)2001-2003 by Alexander Barton, alex@barton.de, http://www.barton.de/ ngIRCd is free software and published under the terms of the GNU General Public License. -- RFC.txt -- The Internet Relay Chat (IRC) protocol is documented in these Request for Comments (RFC), which you can get e.g. via : 1459 Oikarinen, J. & D. Reed, "Internet Relay Chat Protocol", May 1993, [IRC]. 2810 Kalt, C., "Internet Relay Chat: Architecture", April 2000, [IRC-ARCH]. 2811 Kalt, C., "Internet Relay Chat: Channel Management", April 2000, [IRC-CHAN]. 2812 Kalt, C., "Internet Relay Chat: Client Protocol", April 2000, [IRC-CLIENT]. 2813 Kalt, C., "Internet Relay Chat: Server Protocol", April 2000, [IRC-SERVER]. -- $Id: RFC.txt,v 1.6 2003/03/07 20:42:20 alex Exp $ ngircd-21/doc/Commands.txt0000644000175000116100000007514712221142771012545 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2013 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- Commands.txt -- This file lists all commands available on ngIRCd. It is written in a format that is human readable as well as machine parseable and therefore can be used as "help text file" of the daemon. In short, the daemon reads this file on startup and parses it as following when an user issues a "HELP " command: 1. Search the file for a line "- ", 2. Output all subsequent lines that start with a TAB (ASCII 9) character to the client using NOTICE commands, treat lines containing a single "." after the TAB as empty lines. 3. Break at the first line not starting with a TAB character. This format allows to have information to each command stored in this file which will not be sent to an IRC user requesting help which enables us to have additional annotations stored here which further describe the origin, implementation details, or limits of the specific command which are not relevant to an end-user but administrators and developers. A special "Intro" block is returned to the user when the HELP command is used without a command name: - Intro This is ngIRCd, a server software for Internet Relay Chat (IRC) networks. You can find more information about ngIRCd on its homepage: . Use "HELP COMMANDS" to get a list of all available commands and "HELP " to get help for a specific IRC command, for example "HELP quit" or "HELP privmsg". Connection Handling Commands ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - CAP CAP LS CAP LIST CAP REQ CAP ACK CAP NAK CAP CLEAR CAP END . List, request, and clear "IRC Capabilities". . Using this command, an IRC client can request additional "IRC capabilities" during login or later on, which influences the communication between server and client. Normally, these commands aren't directly used by humans, but automatically by their client software. And please note that issuing such commands manually can irritate the client software used, because of the "non-standard" behavior of the server! . - CAP LS: list all available capabilities. - CAP LIST: list active capabilities of this connection. - CAP REQ: Request particular capabilities. - CAP ACK: Acknowledge a set of capabilities to be enabled/disabled. - CAP NAK: Reject a set of capabilities. - CAP CLEAR: Clear all set capabilities. - CAP END: Indicate end of capability negotiation during login, ignored in an fully registered session. Please note that the must be given in a single parameter but whitespace separated, therefore a command could look like this: "CAP REQ :capability1 capability2 capability3" for example. References: - - - doc/Capabilities.txt - CHARCONV CHARCONV . Set client character set encoding to . . After receiving such a command, the server translates all message data received from the client using the set to the server encoding (UTF-8), and all message data which is to be sent to the client from the server encoding (UTF-8) to . . This enables older clients and clients using "strange" character sets to transparently participate in channels and direct messages to clients using UTF-8, which should be the default today. References: - IRC+, - IRC+, doc/Protocol.txt - NICK NICK NICK [] NICK . Set or change the of a client (first form) and register remote clients (second and third form; servers only). References: - RFC 1459, 4.1.2 "Nick message" (old client and server protocol) - RFC 2812, 3.1.2 "Nick message" (client protocol) - RFC 2813, 4.1.3 "Nick" (server protocol) - PASS PASS PASS [] . Set a connection . This command must be the first command sent to the server, even before the NICK/USER or SERVER commands. . The first form is used by user sessions or (old) RFC 1459 servers, the second form is used by RFC 2812 or IRC+ compliant servers and enables the server to indicate its version and supported protocol features. References: - RFC 1459, 4.1.1 "Password message" (old client and server protocol) - RFC 2812, 3.1.1 "Password message" (client protocol) - RFC 2813, 4.1.1 "Password message" (server protocol) - IRC+, - IRC+, doc/Protocol.txt - PING PING [] . Tests the presence of a connection to a client or server. . If no has been given, the local server is used. User clients can only use other servers as , no user clients. . A PING message results in a PONG reply containing the , which can be arbitrary text. Please note: The RFCs state that the parameter is used to specify the origin of the PING command when forwarded in the network, but this is not the case: the sender is specified using the prefix as usual, and the parameter is used to identify the PONG reply in practice. References: - RFC 2812, 3.7.2 "Ping message" - PONG PONG [] . Reply to a "PING" command, indicate that the connection is alive. . The is the arbitrary text received in the "PING" command and can be used to identify the correct PONG sent as answer. . When the "PONG" command is received from a user session, the parameter is ignored; otherwise the PONG is forwarded to this client. References: - RFC 2812, 3.7.3 "Pong message" - QUIT QUIT [] . Terminate a user session. . When received from a user, the server acknowledges this by sending an "ERROR" message back to the client and terminates the connection. . When a has been given, it is sent to all the channels that the client is a member of when leaving. References: - RFC 2812, 3.1.7 "Quit" - RFC 2813, 4.1.5 "Quit" - USER USER . Register (and authenticate) a new user session with a short and a human-readable . . The parameter is only used when received by an other server and ignored otherwise; and the parameter is always ignored. But both parameters are required on each invocation by the protocol and can be set to arbitrary characters/text when not used. . If contains an "@" character, the full is used for authentication, but only the first part up to this character is set as "user name" for this session. References: - RFC 2812, 3.1.3 "User message" - WEBIRC WEBIRC . Allow Web-to-IRC gateway software (for example) to set the correct user name and host name of users instead of their own. . It must be the very first command sent to the server, even before USER and NICK commands! . The must be set in the server configuration file to prevent unauthorized clients to fake their identity; it is an arbitrary string. References: - IRC+, - IRC+, doc/Protocol.txt General Commands ~~~~~~~~~~~~~~~~ - AWAY AWAY [] . Provides the server with a message to automatically send in reply to a PRIVMSG directed at the user, but not to a channel they are on. . If is omitted, the away status is removed. References: - RFC 2812, 4.1 "Away" - HELP HELP [] . Show help information for a specific IRC . The name is case-insensitive. . Use the command "HELP Commands" to get a list of all available commands. The HELP command isn't specified by any RFC but implemented by most daemons. If no help text could be read in, ngIRCd outputs a list of all implemented commands when receiving a plain "HELP" command as well as on "HELP Commands". ngIRCd replies using "NOTICE" commands like ircd 2.10/2.11; other implementations are using numerics 704, 705, and 706. - MODE MODE [{+|-}[] [{+|-}[] [...]]] MODE [{+|-}[] [ [ [...]]] [{+|-}[] [ [ [...]]] [...]]] . Set and get user and channel modes. . When no mode parameters are given, the currently set user or channel modes are returned. Otherwise the modes are adjusted accordingly and the changes will be reported back to the client. . All user and channel "modes" are indicated by single case-sensitive characters. . Please note that a user can only get and set his own modes, and not all user "levels" are allowed to change all channel modes ... . The mode parameters can become quite complex, especially when dealing with channel modes that require additional arguments: . {+|-} -- set or unset one or more modes. + - -- set some modes and unset others. + -- set (at least) two modes with arguments. . Some examples: . MODE nick +i -- set user to "invisible". MODE #chan +tn -- set "topic lock" and "no external messages". MODE #chan -t +l 50 -- remove "topic lock", set "user limit" to 50. MODE #chan +ov nick1 nick2 -- set "channel op" and "voice" mode to nick1 and nick2 in channel #chan. . A complete list of all modes supported by ngIRCd can be found online here: . References: - RFC 2811, 4. "Channel Modes" - RFC 2812, 3.1.5 "User mode message" - RFC 2812, 3.2.3 "Channel mode message" - - doc/Modes.txt - NOTICE NOTICE [,[,...]] . Send a to a given , which can be a user or a channel, but DON'T report any error. . The "NOTICE" command exactly behaves like the "PRIVMSG" command, but doesn't report any errors it encounters (like an unknown ). Please see the help text of the "PRIVMSG" command for a detailed description of the parameters! References: - RFC 2812, 2.3.1 "Message format in Augmented BNF" - RFC 2812, 3.3 "Sending messages" - RFC 2812, 3.3.2 "Notice" - PRIVMSG PRIVMSG [,[,...]] . Send a to a given , which can be a user or a channel, and report all errors. . The must follow one of these syntax variants: . - - - [%]@ - % - !@ . If the is a user, a private message is sent directly to this user; if it resolves to a channel name, a public message is sent to all the members of that channel. . In addition, IRC Ops can use these two forms to specify the : . - # - # . The can contain the wildcard characters "*" and "?", but must contain at least one dot (".") and no wildcard after the last one. Then, the is sent to all users matching this . . All warnings and errors are reported back to the initiator using numeric status codes, which is the only difference to the "NOTICE" command, which doesn't report back any errors or warnings at all. . Please note that clients often use "MSG" as an alias to PRIVMSG, and a command "QUERY []" to initiate private chats. Both are command extensions of the client and never sent to the server. References: - RFC 2812, 2.3.1 "Message format in Augmented BNF" - RFC 2812, 3.3 "Sending messages" - RFC 2812, 3.3.1 "Private messages" Status and Informational Commands ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ADMIN ADMIN [] . Show administrative information about an IRC server in the network. . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. The server of the current connection is used when is omitted. References: - RFC 2812, 3.4.9 "Admin command" - INFO INFO [] . Show the version, birth & online time of an IRC server in the network. . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. The server of the current connection is used when is omitted. References: - RFC 2812, 3.4.10 "Info command" - ISON ISON [ [...]] . Query online status of a list of nicknames. The server replies with a list only containing nicknames actually connected to a server in the network. If no nicknames of the given list are online, an empty list is returned to the client requesting the information. Please note that "all" IRC daemons even parse separate nicknames in a single parameter (like ":nick1 nick2"), and therefore ngIRCd implements this behaviour, too. References: - RFC 2812, 4.9 "Ison message" - LINKS LINKS [[] [] . List all servers currently registered in the network matching , or all servers if has been omitted, as seen by the server specified by or the local server when is omitted. . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. References: - RFC 2812, 3.4.5 "Links message" - LUSERS LUSERS [ []] . Return statistics about the number of clients (users, servers, services, ...) in the network as seen by the server . . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. The server of the current connection is used when is omitted. Please note that ngIRCd ignores the parameter entirely: it is not possible to get information for a part of the network only. References: - RFC 2812, 3.4.2 "Lusers message" - MOTD MOTD [] . Show the "Message of the Day" (MOTD) of an IRC server in the network. . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. The server of the current connection is used when is omitted. References: - RFC 2812, 3.4.1 "Motd message" - NAMES NAMES [[,[,...]] []] . Show the list of users that are members of a particular (and that are visible for the client requesting this information) as seen by the server . More than one can be given separated by "," (but not whitespaces!). . If has been omitted, all visible users are shown, grouped by channel name, and all visible users not being members of at least one channel are shown as members of the pseudo channel "*". . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. The server of the current connection is used when is omitted. References: - RFC 2812, 3.2.5 "Names message" - STATS STATS [ []] . Show statistics and other information of type of a particular IRC server in the network. . The following types are supported (case-insensitive where applicable): . - g Network-wide bans ("G-Lines"). - k Server-local bans ("K-Lines"). - L Link status (servers and user links). - l Link status (servers and own link). - m Command usage count. - u Server uptime. . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. The server of the current connection is used when is omitted. . To use "STATS L" the user must be an IRC Operator. References: - RFC 2812, 3.4.4 "Stats message" - TIME TIME [] . Show the local time of an IRC server in the network. . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. The server of the current connection is used when is omitted. References - RFC 2812, 3.4.6 "Time message" - TRACE TRACE [] . Find the route to a specific server and send information about its peers. Each server that processes this command reports back to the sender about it: the replies from pass-through servers form a chain which shows the route to the destination. . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. The server of the current connection is used when is omitted. References: - RFC 2812, 3.4.8 "Trace message" - USERHOST USERHOST [ [...]] . Show flags and the hostmasks (@) of the s, separated by spaces. The following flags are used: . - "-" The client is "away" (the mode "+a" is set on this client). - "+" Client seems to be available, at least it isn't marked "away". - "*" The client is an IRC operator (the mode "+o" is set). References: - RFC 2812, 4.8 "Userhost message" - VERSION VERSION [] . Show version information about a particular IRC server in the network. . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. The server of the current connection is used when is omitted. . Please note: in normal operation, the version number ends in a dot (".", for example "ngIRCd-20.1."). If it ends in ".1" (for example "ngIRCd-20.1.1", same version than before!), the server is running in debug-mode; and if it ends in ".2", the "network sniffer" is active! Keep your privacy in mind ... References: - RFC 2812, 3.4.3 "Version message" - WHO WHO [ ["o"]] . Show a list of users who match the , or all visible users when the has been omitted. (Special case: the "0" is equivalent to "*") . If the flag "o" is given, the server will only return information about IRC Operators. References: - RFC 2812, 3.6.1 "Who query" - WHOIS WHOIS [] [,[,...]] . Query information about users matching the parameter(s) as seen by the server ; up to 3 are supported. . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. The server of the current connection is used when is omitted. References: - RFC 2812, 3.6.2 "Whois query" - WHOWAS WHOWAS [,[,...]] [ []] . Query information about nicknames no longer in use in the network, either because of nickname changes or disconnects. The history is searched backwards, returning the most recent entry first. If there are multiple entries, up to entries will be shown (or all of them, if no has been given). . can be a server name, the nickname of a client connected to a specific server, or a mask matching a server name in the network. The server of the current connection is used when is omitted. References: - RFC 2812, 3.6.3 "Whowas" Channel Commands ~~~~~~~~~~~~~~~~ - INVITE INVITE . Invite to join channel . . does not have to exist, but if it does, only members of the channel are allowed to invite other users. If the channel mode "+i" is set, only channel "half-ops" (and above) may invite other clients, and if channel mode "+V" is set, nobody can invite other users. References: - RFC 2812, 3.2.7 "Invite message" - JOIN JOIN {[,[,...]] [[,[,...]]] | 0} . Makes the client join the (comma-separated list), specifying the channel keys ("passwords"). A is only needed if the has the mode "+k" set. . If the channel(s) do not exist, then they will be created. . Using "JOIN 0" parts all channels at once. References: - RFC 2812, 3.2.1 "Join message" (client protocol) - RFC 2813, 4.2.1 "Join message" (server protocol) - KICK KICK [,[,...]] [,[,...]] [] . Remove users(s) with (s) from (s). . There must be either exactly one parameter and multiple parameters, or as many parameters as there are parameters. The is shown to the users being kicked, and the nickname of the current user is used when is omitted. References: - RFC 2812, 3.2.8 "Kick command" - LIST LIST [[,[,...]] []] . List all visible (comma-separated list). . If is given, the command will be forwarded to for evaluation. References: - RFC 2812, 3.2.6 "List message" - PART PART [,[,...]] [] . Leave (comma-separated list), optionally with sending a to all the other channel members. References: - RFC 2812, 3.2.2 "Part message" - TOPIC TOPIC [] . Change or view the topic of a channel. . The topic for channel is returned if there is no given. If the parameter is present, the topic for that channel will be changed, if this action is allowed for the user requesting it. If the parameter is an empty string, the topic for that channel will be removed. References: - RFC 2812, 3.2.4 "Topic message" Administrative Commands ~~~~~~~~~~~~~~~~~~~~~~~ - CONNECT CONNECT [ [ [ ]]] . Instructs the current server, or if specified, to connect to the server named , which must be configured in the server configuration file. . To use this command, the user must be an IRC Operator. To establish a connection on a , you must have remote IRC operator privileges. . If , and are given, these values override the ones specified in the server configuration file. References: - RFC 2812, 3.4.7 "Connect message" - DIE DIE [] . Instructs the server to shut down. . The optional (and non-standard) text is sent to each client connected to this server before all connections are closed. . To use this command, the user must be an IRC Operator. References: - RFC 2812, 4.3 "Die message" - DISCONNECT DISCONNECT . Disconnect and disable a locally linked server. . To use this command, the user must be an IRC Operator. References: - This command is not specified in the IRC RFCs, it is an extension of ngIRCd. - GLINE GLINE [ :] . This command provides timed G-Lines (network-wide bans). . If a client matches a G-Line, it cannot connect to any server on the IRC network for seconds. When is 0, it make the G-Line permanent. . If no and no is given, the G-Line is removed. . To use this command, the user must be an IRC Operator. . "STATS g" can be used to list all currently active G-Lines. References: - This command is not specified in the IRC RFCs, it is an extension of ngIRCd. - KILL KILL . Forcibly remove all users with a given from the IRC network and display the given to them. . This command is used internally between servers, too, for example to disconnect duplicate 's after a "net split". . To use this command, the user must be an IRC Operator. References: - RFC 2812, 3.7.1 "Kill message" - KLINE KLINE [ :] . This command provides timed K-Lines (server-local bans). . If a client matches a K-Line, it cannot connect to this server for seconds. When is 0, it makes the K-Line permanent. . If no and no is given, the K-Line is removed. . To use this command, the user must be an IRC Operator. . "STATS k" can be used to list all currently active K-Lines. References: - This command is not specified in the IRC RFCs, it is an extension of ngIRCd. - OPER OPER . Authenticates a user named as an IRC operator on the current server/network. . This operator must be configured in the server configuration. . Please note that is NOT related to a nickname at all! References: - RFC 2812, 3.1.4 "Oper message" - REHASH REHASH . Causes the server to re-read and re-process its configuration file(s). . While rehashing, no new connections are accepted, but all already established connections stay connected. . To use this command, the user must be an IRC Operator. References: - RFC 2812, 4.2 "Rehash message" - RESTART RESTART . Restart the server. . While restarting, all connections are reset and no new connections are accepted. . To use this command, the user must be an IRC Operator. References: - RFC 2812, 4.4 "Restart message" - WALLOPS WALLOPS . Sends to all users with user mode "+w". . To use this command, the user must be an IRC Operator. References: - RFC 2812, 4.7 "Operwall message" IRC Service Commands ~~~~~~~~~~~~~~~~~~~~ - SERVICE SERVICE SERVICE {|+} . Register a new service in the network. . The first form is used by directly linked services and isn't supported by ngIRCd at the moment. The second form announces services connected to remote "pseudo-servers" ("services hubs"). . The and parameters are ignored by ngIRCd. References: - RFC 2812, 3.1.6 "Service message" - RFC 2813, 4.1.4 "Service message" - SERVLIST SERVLIST [ []] . List all IRC services currently registered in the network. . The optional and parameters can be used to limit the listing to services matching the and that are of type . . Please note that ngIRCd doesn't use any service types at the moment and therefore all services are of type "0". References: - RFC 2812, 3.5.1 "Servlist message" - SQUERY SQUERY [,[,...]] . Send a to a given IRC service, and report all errors. . The "SQUERY" command exactly behaves like the "PRIVMSG" command, but enforces that the of the is an IRC service. Please see the help text of the "PRIVMSG" command for a detailed description of the parameters! . If a user wants to interact with IRC services, he should use "SQUERY" instead of "PRIVMSG" or "NOTICE": only "SQUERY makes sure that no regular user, which uses the nickname of an IRC service, receives the command in error, for example during a "net split"! References: - RFC 2812, 2.3.1 "Message format in Augmented BNF" - RFC 2812, 3.3 "Sending messages" - RFC 2812, 3.3.2 "Notice" - SVSNICK SVSNICK . Forcefully change foreign user nicknames. This command is allowed for servers only. . The "SVSNICK" command is forwarded to the server to which the user with nickname is connected to, which in turn generates a regular "NICK" command that then is sent to the client, so no special support in the client software is required. References: - ngIRCd GIT commit e3f300d3231f Server Protocol Commands ~~~~~~~~~~~~~~~~~~~~~~~~ - CHANINFO CHANINFO + [[ ] ] . CHANINFO is used by servers to inform each other about a channel: its modes, channel key, user limits and its topic. . The CHANINFO command is allowed on server-links only. References: - IRC+, - IRC+, doc/Protocol.txt - ERROR ERROR [ [<> [...]]] . Inform a client or a server about an error condition. The first parameter, if given, is logged by the server receiving the message, all other parameters are silently ignored. . This command is silently ignored on non-server and non-service links and shouldn't be used by regular IRC clients. . The ERROR message is also sent before terminating a regular client connection. References: - RFC 2812, 3.7.4 "Error message" - METADATA METADATA . The METADATA command is used on server-links to update "metadata" information of clients, like the hostname, the info text ("real name"), or the user name. . The METADATA command is allowed on server-links only. References: - IRC+, - IRC+, doc/Protocol.txt - NJOIN NJOIN [][,[][,...]] . The NJOIN command is used on server-links to add users with and to a while peering. . The NJOIN command is allowed on server-links only. References: - RFC 2813, 4.2.2 "Njoin message" - SERVER SERVER SERVER SERVER . The first form registers the local connection as a new server in the network, the second (RFC 1459) and third (RFC 2812) form announce a new remote server in the network. . The SERVER command is allowed on unregistered or server-links only. References: - RFC 1459, 4.1.4 "Server message" - RFC 2813, 4.1.2 "Server message" - SQUIT SQUIT . Disconnects an IRC Server from the network. . This command is used on server-links, but can be used by IRC Operators to forcefully disconnect servers from the network, too. References: - RFC 2812, 3.1.8 "Squit" - RFC 2813, 4.1.6 "Server quit message" Dummy Commands ~~~~~~~~~~~~~~ - SUMMON SUMMON [ []] . This command was intended to call people into IRC who are directly connected to the terminal console of the IRC server -- but is deprecated today. Therefore ngIRCd doesn't really implement this command and always returns an error message, regardless of the parameters given. References: - RFC 2812, 4.5 "Summon message" - USERS USERS [] . This command was intended to list users directly logged in into the console of the IRC server -- but is deprecated today. Therefore ngIRCd doesn't really implement this command and always returns an error message, regardless of the parameters given. References: - RFC 2812, 4.6 "Users" - GET GET [...] . Fake HTTP GET command. When received, the connection is shut down immediately again to protect against crazy web browsers ... References: - ngIRCd GIT commit 33e8c2480649 - POST POST [...] . Fake HTTP POST command. When received, the connection is shut down immediately again to protect against crazy web browsers ... References: - ngIRCd GIT commit 33e8c2480649 ngircd-21/doc/sample-ngircd.conf.tmpl0000644000175000116100000003360112216413514014577 00000000000000# # 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 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 # and their descriptions. # [Global] # The [Global] section of this file is used to define the main # configuration of the server, like the server name and the ports # on which the server should be listening. # These settings depend on your personal preferences, so you should # make sure that they correspond to your installation and setup! # Server name in the IRC network, must contain at least one dot # (".") and be unique in the IRC network. Required! Name = irc.example.net # Information about the server and the administrator, used by the # ADMIN command. Not required by server but by RFC! ;AdminInfo1 = Description ;AdminInfo2 = Location ;AdminEMail = admin@irc.server # Text file which contains the ngIRCd help text. This file is required # to display help texts when using the "HELP " command. ;HelpFile = :DOCDIR:/Commands.txt # Info text of the server. This will be shown by WHOIS and # LINKS requests for example. Info = Server Info Text # 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. ;Listen = 127.0.0.1,192.168.0.1 # Text file with the "message of the day" (MOTD). This message will # be shown to all users connecting to the server: ;MotdFile = :ETCDIR:/ngircd.motd # A simple Phrase (<256 chars) if you don't want to use a motd file. ;MotdPhrase = "Hello world!" # Global password for all users needed to connect to the server. # (Default: not set) ;Password = abc # This tells ngIRCd to write its current process ID to a file. # Note that the pidfile is written AFTER chroot and switching the # user ID, e.g. the directory the pidfile resides in must be # writable by the ngIRCd user and exist in the chroot directory. ;PidFile = /var/run/ngircd/ngircd.pid # Ports on which the server should listen. There may be more than # one port, separated with ",". (Default: 6667) ;Ports = 6667, 6668, 6669 # Group ID under which the ngIRCd should run; you can use the name # of the group or the numerical ID. ATTENTION: For this to work the # server must have been started with root privileges! ;ServerGID = 65534 # User ID under which the server should run; you can use the name # of the user or the numerical ID. ATTENTION: For this to work the # server must have been started with root privileges! In addition, # the configuration and MOTD files must be readable by this user, # otherwise RESTART and REHASH won't work! ;ServerUID = 65534 [Limits] # Define some limits and timeouts for this ngIRCd instance. Default # values should be safe, but it is wise to double-check :-) # The server tries every seconds to establish a link # to not yet (or no longer) connected servers. ;ConnectRetry = 60 # Number of seconds after which the whole daemon should shutdown when # no connections are left active after handling at least one client # (0: never, which is the default). # This can be useful for testing or when ngIRCd is started using # "socket activation" with systemd(8), for example. ;IdleTimeout = 0 # 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 # the server will accept (0: unlimited): ;MaxConnectionsIP = 5 # Maximum number of channels a user can be member of (0: no limit): ;MaxJoins = 10 # Maximum length of an user nickname (Default: 9, as in RFC 2812). # Please note that all servers in an IRC network MUST use the same # maximum nickname length! ;MaxNickLength = 9 # Maximum number of channels returned in response to a /list # command (0: unlimited): ;MaxListSize = 100 # After seconds of inactivity the server will send a # PING to the peer to test whether it is alive or not. ;PingTimeout = 120 # If a client fails to answer a PING with a PONG within # seconds, it will be disconnected by the server. ;PongTimeout = 20 [Options] # Optional features and configuration options to further tweak the # behavior of ngIRCd. If you want to get started quickly, you most # probably don't have to make changes here -- they are all optional. # List of allowed channel types (channel prefixes) for newly created # channels on the local server. By default, all supported channel # types are allowed. Set this variable to the empty string to disallow # creation of new channels by local clients at all. ;AllowedChannelTypes = #&+ # Are remote IRC operators allowed to control this server, e.g. # use commands like CONNECT, SQUIT, DIE, ...? ;AllowRemoteOper = no # A directory to chroot in when everything is initialized. It # doesn't need to be populated if ngIRCd is compiled as a static # binary. By default ngIRCd won't use the chroot() feature. # ATTENTION: For this to work the server must have been started # with root privileges! ;ChrootDir = /var/empty # Set this hostname for every client instead of the real one. # Use %x to add the hashed value of the original hostname. ;CloakHost = cloaked.host # Use this hostname for hostname cloaking on clients that have the # user mode "+x" set, instead of the name of the server. # Use %x to add the hashed value of the original hostname. ;CloakHostModeX = cloaked.user # The Salt for cloaked hostname hashing. When undefined a random # hash is generated after each server start. ;CloakHostSalt = abcdefghijklmnopqrstuvwxyz # Set every clients' user name to their nickname ;CloakUserToNick = yes # Try to connect to other IRC servers using IPv4 and IPv6, if possible. ;ConnectIPv6 = yes ;ConnectIPv4 = yes # Default user mode(s) to set on new local clients. Please note that # only modes can be set that the client could set on itself, you can't # set "a" (away) or "o" (IRC Op), for example! Default: none. ;DefaultUserModes = i # Do DNS lookups when a client connects to the server. ;DNS = yes # Do IDENT lookups if ngIRCd has been compiled with support for it. # Users identified using IDENT are registered without the "~" character # prepended to their user name. ;Ident = yes # Directory containing configuration snippets (*.conf), that should # be read in after parsing this configuration file. ;IncludeDir = :ETCDIR:/conf.d # Enhance user privacy slightly (useful for IRC server on TOR or I2P) # by censoring some information like idle time, logon time, etc. ;MorePrivacy = no # Normally ngIRCd doesn't send any messages to a client until it is # registered. Enable this option to let the daemon send "NOTICE AUTH" # messages to clients while connecting. ;NoticeAuth = no # Should IRC Operators be allowed to use the MODE command even if # they are not(!) channel-operators? ;OperCanUseMode = no # Should IRC Operators get AutoOp (+o) in persistent (+P) channels? ;OperChanPAutoOp = yes # Mask IRC Operator mode requests as if they were coming from the # server? (This is a compatibility hack for ircd-irc2 servers) ;OperServerMode = no # Use PAM if ngIRCd has been compiled with support for it. # Users identified using PAM are registered without the "~" character # prepended to their user name. ;PAM = yes # When PAM is enabled, all clients are required to be authenticated # using PAM; connecting to the server without successful PAM # authentication isn't possible. # If this option is set, clients not sending a password are still # allowed to connect: they won't become "identified" and keep the "~" # character prepended to their supplied user name. # Please note: To make some use of this behavior, it most probably # isn't useful to enable "Ident", "PAM" and "PAMIsOptional" at the # same time, because you wouldn't be able to distinguish between # Ident'ified and PAM-authenticated users: both don't have a "~" # character prepended to their respective user names! ;PAMIsOptional = no # Let ngIRCd send an "authentication PING" when a new client connects, # and register this client only after receiving the corresponding # "PONG" reply. ;RequireAuthPing = no # Silently drop all incoming CTCP requests. ;ScrubCTCP = no # Syslog "facility" to which ngIRCd should send log messages. # Possible values are system dependent, but most probably auth, daemon, # user and local1 through local7 are possible values; see syslog(3). # Default is "local5" for historical reasons, you probably want to # change this to "daemon", for example. ;SyslogFacility = local1 # Password required for using the WEBIRC command used by some # Web-to-IRC gateways. If not set/empty, the WEBIRC command can't # be used. (Default: not set) ;WebircPassword = xyz ;[SSL] # SSL-related configuration options. Please note that this section # is only available when ngIRCd is compiled with support for SSL! # So don't forget to remove the ";" above if this is the case ... # SSL Server Key Certificate ;CertFile = :ETCDIR:/ssl/server-cert.pem # Select cipher suites allowed for SSL/TLS connections. This defaults # to HIGH:!aNULL:@STRENGTH (OpenSSL) or SECURE128 (GnuTLS). # See 'man 1ssl ciphers' (OpenSSL) or 'man 3 gnutls_priority_init' # (GnuTLS) for details. # For OpenSSL: ;CipherList = HIGH:!aNULL:@STRENGTH # For GnuTLS: ;CipherList = SECURE128 # Diffie-Hellman parameters ;DHFile = :ETCDIR:/ssl/dhparams.pem # SSL Server Key ;KeyFile = :ETCDIR:/ssl/server-key.pem # password to decrypt SSLKeyFile (OpenSSL only) ;KeyFilePassword = secret # Additional Listen Ports that expect SSL/TLS encrypted connections ;Ports = 6697, 9999 [Operator] # [Operator] sections are used to define IRC Operators. There may be # more than one [Operator] block, one for each local operator. # ID of the operator (may be different of the nickname) ;Name = TheOper # Password of the IRC operator ;Password = ThePwd # Optional Mask from which /OPER will be accepted ;Mask = *!ident@somewhere.example.com [Operator] # More [Operator] sections, if you like ... [Server] # Other servers are configured in [Server] sections. If you # configure a port for the connection, then this ngircd tries to # connect to to the other server on the given port; if not it waits # for the other server to connect. # There may be more than one server block, one for each server. # # Server Groups: # The ngIRCd allows "server groups": You can assign an "ID" to every # server with which you want this ngIRCd to link. If a server of a # group won't answer, the ngIRCd tries to connect to the next server # in the given group. But the ngircd never tries to connect to two # servers with the same group ID. # IRC name of the remote server, must match the "Name" variable in # the [Global] section of the other server (when using ngIRCd). ;Name = irc2.example.net # Internet host name or IP address of the peer (only required when # this server should establish the connection). ;Host = connect-to-host.example.net # 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 # assign no port the ngIRCd waits for incoming connections. ;Port = 6667 # Own password for the connection. This password has to be configured # as "PeerPassword" on the other server. ;MyPassword = MySecret # Foreign password for this connection. This password has to be # configured as "MyPassword" on the other server. ;PeerPassword = PeerSecret # Group of this server (optional) ;Group = 123 # 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. ;Passive = no # Connect to the remote server using TLS/SSL (Default: false) ;SSLConnect = yes # Define a (case insensitive) list of masks matching nicknames that # should be treated as IRC services when introduced via this remote # server, separated by commas (","). # 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" or "NickServ,ChanServ,XyzServ". ;ServiceMask = *Serv,Global [Server] # More [Server] sections, if you like ... [Channel] # Pre-defined channels can be configured in [Channel] sections. # Such channels are created by the server when starting up and even # persist when there are no more members left. # Persistent channels are marked with the mode 'P', which can be set # and unset by IRC operators like other modes on the fly. # There may be more than one [Channel] block, one for each channel. # Name of the channel ;Name = #TheName # Topic for this channel ;Topic = a great topic # Initial channel modes ;Modes = tnk # initial channel password (mode k) ;Key = Secret # Key file, syntax for each line: "::". # Default: none. ;KeyFile = :ETCDIR:/#chan.key # maximum users per channel (mode l) ;MaxUsers = 23 [Channel] # More [Channel] sections, if you like ... # -eof- ngircd-21/doc/Protocol.txt0000644000175000116100000002426112206365167012605 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2012 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- Protocol.txt -- I. Compatibility ~~~~~~~~~~~~~~~~ The ngIRCd implements the Internet Relay Chat (IRC) protocol version 2.10 as defined in RFC ("request for comment") 1459 and 2810-2813. These (and probably further relevant RFCs) are listed in doc/RFC.txt. Unfortunately, even the "original" ircd doesn't follow these specifications in all details. But because the ngIRCd should be a fully compatible replacement for this server ("ircd") it tries to emulate these differences. If you don't like this behavior please ./configure the ngIRCd using the "--enable-strict-rfc" command line option. But keep in mind: not all IRC clients are compatible with a server configured that way, some can't even connect at all! Therefore this option usually isn't desired for "normal server operation". II. The IRC+ Protocol ~~~~~~~~~~~~~~~~~~~~~ Starting with version 0.5.0, the ngIRCd extends the original IRC protocol as defined in RFC 2810-2813. This enhanced protocol is named "IRC+". It is backwards compatible to the "plain" IRC protocol and will only be used by the ngIRCd if it detects that the peer supports it as well. The "PASS" command is used to detect the protocol and peer versions see RFC 2813 (section 4.1.1) and below. II.1 Register new server link Command: PASS Parameters: [] Used by: servers only (with these parameters) is the password for this new server link as defined in the server configuration which is sent to the peer or received from it. consists of two parts and is at least 4, at most 14 characters long: the first four bytes contain the IRC protocol version number, whereas the first two bytes represent the major version, the last two bytes the minor version (the string "0210" indicates version 2.10, e.g.). The following optional(!) 10 bytes contain an implementation-dependent version number. Servers supporting the IRC+ protocol as defined in this document provide the string "-IRC+" here. Example for : "0210-IRC+". consists of two parts separated with the character "|" and is at most 100 bytes long. The first part contains the name of the implementation (ngIRCd sets this to "ngircd", the original ircd to "IRC", e.g.). The second part is implementation-dependent and should only be parsed if the peer supports the IRC+ protocol as well. In this case the following syntax is used: "[:]". is an ASCII representation of the clear-text server version number, indicates the supported IRC+ protocol extensions (and may be empty!). The following are defined at the moment: - C: The server supports the CHANINFO command. - L: INVITE- and BAN-lists should be synchronized between servers: if the peer understands this flag, it will send "MODE +I" and "MODE +b" commands after the server link has been established. - H: The server supports the "enhanced server handshake", see section II.2 for a detailed description. - M: Changing client "metadata" (hostname, real name, ...) using the METADATA command is supported. - 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). - X: Server supports XOP channel modes (owner, admin, halfop) and supports these user prefixes in CHANINFO commands, for example. - Z: Compressed server links are supported by the server. Example for a complete string: "ngircd|0.7.5:CZ". The optional parameter is used to propagate server options as defined in RFC 2813, section 4.1.1. II.2 Enhanced Server Handshake The "enhanced server handshake" is used when both servers support this IRC+ extension, which is indicated by the 'H' flag in the sent with the PASS command, see section II.1. It basically means, that after exchanging the PASS and SERVER commands the server is not registered in the network (as usual), but that IRC numerics are exchanged until the numeric 376 (ENDOFMOTD) is received. Afterwards the peer is registered in the network as with the regular IRC protocol. A server implementing the enhanced server handshake (and indicating this using 'H' in the ) MUST ignore all unknown numerics to it silently. In addition, such a server should at least send the numeric 005 (ISUPPORT) to its peer, containing the following information. Syntax: =, one token per IRC parameter. If the server has to send more than 12 token it must send separate ISUPPORT numerics (this is a limitation of the IRC protocol which allows at max 15 arguments per command). - NICKLEN: Maximum nickname length. Default: 9. - CASEMAPPING: Case mapping used for nick- and channel name comparing. Default: "ascii", the chars [a-z] are lowercase of [A-Z]. - PREFIX: List of channel modes a person can get and the respective prefix a channel or nickname will get in case the person has it. The order of the modes goes from most powerful to least powerful. Default: "(ov)@+" - CHANTYPES: Supported channel prefixes. Default: "#". - CHANMODES: List of channel modes for 4 types, separated by comma (","): Mode that adds or removes a nick or address to a list, mode that changes a setting (both have always has a parameter), mode that changes a setting and only has a parameter when set, and mode that changes a setting and never has a parameter. For example "bI,k,l,imnPst". - CHANLIMIT: Maximum number of channels allowed to join by channel prefix, for example "#:10". Please see for details. The information exchanged using ISUPPORT can be used to detect configuration incompatibilities (different maximum nickname length, for example) and therefore to disconnect the peer prior to registering it in the network. II.3 Exchange channel-modes, topics, and persistent channels Command: CHANINFO Parameters: + [[ ] ] Used by: servers only CHANINFO is used by servers to inform each other about a channel: its modes, channel key, user limits and its topic. The parameter combination and is optional, as well as the parameter, so that there are three possible forms of this command: CHANINFO + CHANINFO + CHANINFO + If the channel already exists on the server receiving the CHANINFO command, it only adopts the (or the ) if there are no modes (or topic) already set. It there are already values set the server ignores the corresponding parameter. If the channel doesn't exists at all it will be created. The parameter must be ignored if a channel has no key (the parameter doesn't list the "k" channel mode). In this case should contain "*" because the parameter is required by the CHANINFO syntax and therefore can't be omitted. The parameter must be ignored when a channel has no user limit (the parameter doesn't list the "l" channel mode). In this case should be "0". II.4 Update webchat/proxy client information Command: WEBIRC Parameters: Used by: unregistered clients only The WEBIRC command is used by some Web-to-IRC gateways to set the correct user name and host name of users instead of their own. It must be the very first command sent to the server, even before USER and NICK commands! The must be set in the server configuration file to prevent unauthorized clients to fake their identity; it is an arbitrary string. II.5 Client character encoding conversion Command: CHARCONV Parameters: Used by: registered clients Replies: RPL_IP_CHARCONV, ERR_IP_CHARCONV A client can set its character set encoding using the CHARCONV command: after receiving such a command, the server translates all message data received from the client using the set to the server encoding (UTF-8), and all message data which is to be sent to the client from the server encoding (UTF-8) to . The list of supported client character sets is implementation dependent. If a client sets its to the server encoding (UTF-8), it disables all conversions; the connection behaves as if no CHARCONV command has been sent at all in this session. II.6 Update client "metadata" Command: METADATA Parameters: Used by: servers only The METADATA command is used on server-links to update "metadata" information of clients, like the hostname, the info text ("real name"), or the user name. The server updates its client database according to the received and parameters, and passes the METADATA command on to all the other servers in the network that support this command (see section II.1 "Register new server link", "M"), even if it doesn't support the given itself: unknown names are ignored silently! The following names are defined: - "accountname": the account name of a client (can't be empty) - "certfp": the certificate fingerprint of a client (can't be empty) - "cloakhost": the cloaked hostname of a client - "host": the hostname of a client (can't be empty) - "info": info text ("real name") of a client - "user": the user name of a client (can't be empty) III. Numerics used by IRC+ Protocol ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The IRC+ protocol uses numerics in the range 800-899 which aren't used by RFC 2812 and hopefully don't clash with other implementations ... Numerics 800-849 are used for status and success messages, and numerics 850-899 are failure and error messages. III.1 IRC+ status and success numerics 801 - RPL_IP_CHARCONV %1 :Client encoding set" %1 client character set III.2 IRC+ failure and error numerics 851 - ERR_IP_CHARCONV :Can't initialize client encoding ngircd-21/doc/GIT.txt0000644000175000116100000000400711631672007011416 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2011 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- GIT.txt -- The source code of ngIRCd is maintained using GIT, an distributed version control system. Homepage including documentation: . I. Viewing the source code online ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ngIRCd "GITweb" interface allows you to browse the GIT repository and to see all individual files, tags, branches, commits etc.: II. Getting the source code ~~~~~~~~~~~~~~~~~~~~~~~~~~~ To access (copy, clone) the source tree repository anonymously, run: $ git clone git://ngircd.barton.de/ngircd.git Thereby a new folder "ngircd" will be created containing all the individual source files. The newly created directory ("ngircd") is the "working directory", all GIT commands will be executed from within this directory in the future. Please note: When checking out a fresh copy of ngIRCd using GIT, the configure script doesn't exist; you have to run the autogen.sh shell script (which is included in the source tree) to generate it. This requires you to have GNU automake and GNU autoconf installed on your system. Please see the file INSTALL for details! To update the local GIT repository: $ git pull This retrieves all changes and merges them into the current branch. III. Contributing ~~~~~~~~~~~~~~~~~ Patches should be sent to the ngircd mailing list. List homepage: http://arthur.barton.de/mailman/listinfo/ngircd-ml If you do not want to send them to the list, you can also mail them to Alex Barton, . IV. Write Access ~~~~~~~~~~~~~~~~ If you want to contribute a couple of patches and write access to the GIT repository would be handy, please contact Alex Barton, . ngircd-21/doc/FAQ.txt0000644000175000116100000001063311743247367011417 00000000000000 ngIRCd - Next Generation IRC Server (c)2001-2010 by Alexander Barton, alex@barton.de, http://www.barton.de/ ngIRCd is free software and published under the terms of the GNU General Public License. -- FAQ: Frequently Asked Questions -- I. General ~~~~~~~~~~ Q: Is it possible to link the ngIRCd with non-ngIRCd servers? A: Yes. ngIRCd is compatible to the original ircd used by IRCNet. Actually this is being tested with version 2.10.3p3. Please note that newer versions (2.11.x) aren't compatible any more! Q: Is there a homepage with further information and downloads? A: Yes. Please visit . Q: Why should I use ngIRCd instead of the original one? A: ngIRCd offers several benefits: no problems with dynamic IPs, easy to configure, open source (GPL), under active development. II. Compilation ~~~~~~~~~~~~~~~ Q: I did a "CVS checkout" but can't execute ./configure because the script is missing in the generated directory!? A: When using development versions via CVS, the configure script as well as the Makefile.in templates must be generated using GNU automake and GNU autoconf. To simplify this task run the ./autogen.sh script which will execute the required tools for you; then continue with executing the ./configure script as usual. Q: The ./autogen.sh script complains "aclocal: command not found". A: GNU automake is missing on your system but required for building CVS versions of ngIRCd. Install GNU automake 1.6 or later and try again. Q: The ./autogen.sh script stops with "autoheader: command not found". A: GNU autoconf is missing on your system but required for building CVS versions of ngIRCd. Install GNU autoconf 2.52 or later and try again. Q: The ./autogen.sh script fails and the message "automake: configure.in: AM_INIT_AUTOMAKE must be used" is displayed. A: Most probably you are using version 1.5 of GNU automake which seems to be incompatible to the build system of ngIRCd. Solution: upgrade to at least version 1.6 of GNU automake. (If you are using Debian 3.0 "Woody" you can try to downgrade to version 1.4 of GNU automake shipped with this distribution; it should work, too.) III. 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: see next question blow ... Q: When running ngIRCd inside a chroot, no IP addresses can be translated in DNS names, errors like "Name or service not known" are logged. A: On Linux/glibc with chroot enabled you need to put some libraries inside the chroot as well, notably libnss_dns; maybe others. Unfortunately, even linking ngIRCd statically does not help this. So you can either copy all the required files into the chroot directory: $ mkdir -p ./chroot/etc ./chroot/lib $ cp -a /etc/hosts /etc/resolv.conf /etc/nsswitch.conf ./chroot/etc/ $ cp -a /lib/libresolv* /lib/libnss_* ./chroot/lib/ Or you can try to link ngIRCd against an other C library (like dietlibc) that doesn't depend on NSS modules and/or these files. 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, then IRC operators can use the MODE command for changing modes even when they are not joined to the specific channel. IV. Bugs!? ~~~~~~~~~~ Q: Is there a list of known bugs and desired feature enhancements? A: Yes. Have a look at the bug tracking system (Bugzilla) for ngIRCd located at . There you can file bug reports and feature requests as well as search the bug database. Q: What should I do if I found a bug? A: Please file a bug report at ! The author of the particular component will be notified automagically :-) ngircd-21/doc/src/0000755000175000116100000000000012234274324011100 500000000000000ngircd-21/doc/src/Makefile.in0000644000175000116100000002324412234274153013072 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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-2011 Alexander Barton (alex@barton.de) and Contributors. # # 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@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@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@ subdir = doc/src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 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 = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 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_URL = @PACKAGE_URL@ 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_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = Doxyfile footer.inc.html 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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/src/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 $(am__aclocal_m4_deps): 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 distclean-local dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am 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 distclean-local 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 distclean-local: rm -rf html srcdoc: @doxygen --version >/dev/null 2>&1 \ || ( echo; echo "Error: \"doxygen\" not found!"; echo; exit 1 ) doxygen # -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: ngircd-21/doc/src/Makefile.am0000644000175000116100000000127611541154311013053 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. # # 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 = Doxyfile footer.inc.html maintainer-clean-local: rm -f Makefile Makefile.in distclean-local: rm -rf html srcdoc: @doxygen --version >/dev/null 2>&1 \ || ( echo; echo "Error: \"doxygen\" not found!"; echo; exit 1 ) doxygen # -eof- ngircd-21/doc/src/footer.inc.html0000644000175000116100000000044612206130744013754 00000000000000

ngIRCd Homepage, GIT-Repository, Bug-Tracker.

ngircd-21/doc/src/Doxyfile0000644000175000116100000000613512206130744012527 00000000000000# # ngIRCd -- The Next Generation IRC Daemon # Copyright (c)2001-2010 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 file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for ngIRCd. # #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = ngIRCd PROJECT_BRIEF = "Lightweight Internet Relay Chat server" PROJECT_LOGO = "../../contrib/ngIRCd-Logo.gif" OUTPUT_DIRECTORY = . STRIP_FROM_PATH = ../.. JAVADOC_AUTOBRIEF = YES OPTIMIZE_OUTPUT_FOR_C = YES TYPEDEF_HIDES_STRUCT = YES TAB_SIZE = 8 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = YES EXTRACT_STATIC = YES SHOW_DIRECTORIES = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = YES #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = ../../src INPUT_ENCODING = UTF-8 RECURSIVE = YES #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = YES STRIP_CODE_COMMENTS = NO REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES #--------------------------------------------------------------------------- # Output formats #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_FOOTER = footer.inc.html HTML_DYNAMIC_SECTIONS = YES GENERATE_DOCSET = NO 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 #--------------------------------------------------------------------------- PREDEFINED = DEBUG ZLIB PAM ZEROCONF CONN_MODULE __client_c__ # -eof- ngircd-21/doc/Platforms.txt0000644000175000116100000001600312234221313012727 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2013 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- Platforms.txt -- This file lists the status of all platforms on which ngIRCd has been tested. Included is the date and version of the last test and the name of the tester or maintainer. If you successfully compiled and tested ngIRCd on a platform that isn't listed here, please write to the mailing list so that this list can be updated. The script "./contrib/platformtest.sh" should output a summary that is suitable for inclusion here. Thanks for your help! the executable works ("runs") as expected --+ tests run successfully ("make check") --+ | ngIRCd compiles ("make") --+ | | ./configure works --+ | | | | | | | Platform Compiler ngIRCd Date Tester C M T R * --------------------------- ------------ ---------- -------- -------- - - - - - alpha/unknown/netbsd3.0 gcc 3.3.3 CVSHEAD 06-05-07 fw Y Y Y Y 3 armv6l/unk./linux-gnueabi gcc 4.7.2 20.2 13-03-08 goetz Y Y Y Y 5 armv6l/unk./linux-gnueabihf gcc 4.6.3 21~rc2 13-10-26 pi Y Y Y Y 5 armv7l/unk./linux-gnueabi gcc 4.4.3 19.1 12-04-29 goetz Y Y Y Y 5 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 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.8.0 gcc 4.2.1 19 12-02-26 alex Y Y Y Y 3 i386/apple/darwin11.3.0 gcc 4.2.1 19 12-02-26 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 4.5.2 21~rc2 13-10-27 alex Y Y N 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.2 gcc 3.4.6 20~rc1 12-11-13 alex Y Y Y Y 3 i386/unknown/freebsd7.3 gcc 4.2.1 20~rc1 12-11-13 alex Y Y Y Y 3 i686/pc/minix gcc 4.4.6 21~rc2 13-10-27 alex Y Y N N i686/unknown/gnu0.3 gcc 4.4.5 19 12-02-29 alex Y Y Y Y i686/unknown/gnu0.5 gcc 4.8.1 21~rc2 13-10-27 alex Y Y Y Y i686/unkn./kfreebsd7.2-gnu gcc 4.3.4 15 09-12-02 alex Y Y Y Y 3 i386/unknown/netbsdelf1.6.2 gcc 2.95.3 18 11-07-10 goetz 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 19 12-02-29 alex Y Y Y Y 3 i386/unknown/netbsdelf5.0.2 gcc 4.1.3 19 12-02-26 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 16 10-04-11 alex Y Y Y Y 3 i386/unknown/openbsd5.3 gcc 4.2.1 21~rc2 13-10-21 dspruell Y Y Y Y 3 i586/pc/haiku gcc 2.95.3 19.2~138 12-10-11 user Y Y N N i586/pc/interix3.5 gcc 3.3 19 12-02-29 alex Y Y N Y i686/pc/cygwin gcc 3.3.1 0.8.0 04-05-30 alex Y Y N Y i686/pc/linux-gnu gcc 2.7.2 19.1 12-05-30 goetz Y Y Y Y 1 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.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.0.1 gcc 2.7.2 17 10-11-07 alex Y Y N Y m68k/apple/aux3.0.1 Orig. A/UX 17 10-11-07 alex Y Y N Y 2 m68k/apple/aux3.1.1 gcc 2.7.2 19 12-02-26 alex Y Y N Y m68k/apple/aux3.1.1 Orig. A/UX 19 12-02-26 alex Y Y N 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 ? ? mipsel/unknown/linux-gnu gcc 4.1.2 18 11-07-05 goetz Y Y N Y 1 mipsel/unknown/linux-gnu gcc 4.4.5 18 11-07-30 goetz Y Y Y Y 1 powerpc/apple/darwin6.5 gcc 3.1 0.7.x-CVS 03-04-23 alex Y Y Y Y powerpc/apple/darwin7.9.0 gcc 3.3 19.1 12-05-22 goetz Y Y Y Y 3 powerpc/apple/darwin8.11.0 gcc 4.0.1 18 11-07-02 goetz Y Y Y Y 3 powerpc/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y 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/apple/darwin10.8.0 gcc 4.2.1 21~rc2 13-10-30 alex Y Y Y Y 3 x86_64/apple/darwin12.3.0 gcc 4.2.1 20.2 13-04-01 alex Y Y Y Y 3 x86_64/apple/darwin13.0.0 A-clang 5.0 21~rc2 13-10-20 alex Y Y Y Y 3 x86_64/unknown/freebsd8.4 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3 x86_64/unknown/freebsd9.1 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3 x86_64/unkn./freebsd8.1-gnu gcc 4.4.5 19 12-02-26 alex Y Y Y Y 3 x86_64/unknown/linux-gnu clang 3.2 21~rc2 13-10-20 alex Y Y Y Y 1 x86_64/unknown/linux-gnu gcc 4.8.1 21~rc2 13-10-20 alex Y Y Y Y 1 x86_64/unknown/linux-gnu Open64 20.3 13-10-16 goetz Y Y Y Y 1 x86_64/unknown/linux-gnu tcc 0.9.25 20.3 13-10-16 goetz Y Y Y Y 1 x86_64/unknown/openbsd4.7 gcc 3.3.5 20~rc1 12-02-26 alex Y Y Y Y 3 x86_64/unknown/openbsd4.8 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3 x86_64/unknown/openbsd5.1 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3 * Notes ~~~~~~~ (1) */*/linux-gnu (Linux platforms): 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.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 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. (4) Using the /dev/poll IO interface. (5) Using the epoll() IO interface. ngircd-21/doc/HowToRelease.txt0000644000175000116100000000546512206130744013341 00000000000000 ngIRCd - Next Generation IRC Server (c)2001-2010 Alexander Barton, alex@barton.de, http://www.barton.de/ ngIRCd is free software and published under the terms of the GNU General Public License. -- HowToRelease.txt -- I. Introduction ~~~~~~~~~~~~~~~ Creating a new ngIRCd release requires a few steps to follow: the source tree must be in a releasable state (be up to date, include all required patches, be tested on as many platforms as possible), a name for the new release must be chosen, and all the files describing the release must be updated accordingly. Since ngIRCd release 13 (2009-12-25) we use "simple" release numbers for major releases (e.g. "13", "17", "42", ...) introducing new features and sub-releases for bug fixes only (e.g. "14.1", "22.3", ...). When creating pre-releases or release candidates, please use the tilde ("~") character to separate the "postfix" in the release number (e.g. "17~rc2" or "123.4~rc6"). The release/version number of a build is automatically generated using the GIT "describe" command, see git-describe(1). Therefore it is required that a new release is tagged in the GIT tree and that the configure script is up-to-date (e.g. using ./autogen.sh) before generating the archives! II. How to prepare a new ngIRCd release? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a) Make sure the source tree is in a releasable state ;-) b) Make sure you have working versions of GNU autoconf and GNU automake installed on the system you use for generating the release: as of October 2010 we are using GNU autoconf 2.67 and GNU automake 1.11.1 which seem to work just fine. c) Update the files describing the new release: - ChangeLog - NEWS d) Update the version numbers in the following files: - contrib/ngircd.spec e) Generate a new Debian change log entry in the following file, e.g. using the Debian "dch" tool of the "devscripts" package: - contrib/Debian/changelog f) Commit the above changes to GIT: "git add", "git commit" g) Create a new signed GIT tag for the new release: "git tag -s". Please note that we don't use the tilde ("~") here, instead use a simple hyphen ("-") as delimiter: e.g. "rel-16" "rel-17-rc1", "rel-18-pre2", ... h) Run "./autogen.sh" to update the ./configure script with the correct release number (autogenerated using "git describe", see above). i) Run "./configure" to rebuild all generated Makefiles. j) Run "make distcheck" to generate the distribution archives. k) Sign the distribution archive(s) using GnuPG: "gpg -b " l) Upload and distribute the newly generated ngIRCd release archive(s) and GnuPG signatures. m) Write an announcement to the mailing list, freshmeat, Twitter, ... n) Relax :-) ngircd-21/doc/README-Interix.txt0000644000175000116100000000314711723426171013355 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2012 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- README-Interix.txt -- ngIRCd release 15 has successfully been tested on Microsoft Windows XP Professional using the Services for UNIX (SFU) version 3.5 and Microsoft Windows 7 with the bundled Subsystem for UNIX Applications (SUA). SFU are supported on Windows 2000, Windows 2000 Server, Windows XP, and Windows Server 2003. SUA is supported on Windows Server 2003 R2, Windows Server 2008 & 2008 R2, Windows Vista, and Windows 7 -- so ngIRCd should be able to run on all of these platforms. But please note that two things: 1. Don't use the poll() IO API The poll() API function is not fully implemented by SFU/SUA and therefore can't be used by ngIRCd -- which normally would be the default. Please see section 4.25 for details: "If you do try to use the poll() API your program will block on the API call forever. You must direct your program to build using the select() API." So when running the ./configure script, you HAVE TO DISABLE poll() support: ./configure --without-poll ngIRCd then defaults to using the select() API function which works fine. 2. Use GNU make(1) Starting with ngIRCd 18, our build system doesn't work with the default make(1) binary of Interix, you should use GNU make instead (tested with version 3.82 built from source). ngircd-21/doc/Contributing.txt0000644000175000116100000000403511602332635013441 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2011 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- Contributing.txt -- If you want to contribute to ngIRCd, please read the following paragraphs to get an idea of how to do it the best :-) - Use GIT The source code of ngIRCd is maintained using GIT, see doc/GIT.txt. So if remotely possible, use GIT for your work, too. It makes your and our lifes much easier ;-) - Don't forget to include documentation When adding features and new configuration options, don't forget to not only code the features but to describe them in doc/sample-ngircd.conf, man/ngircd.8.tmp and/or man/ngircd.conf.5.tmpl as well! - Be present on IRC If you intend to code some new features or do some code cleanups or better documentation, please be present on and discuss your plans early! So other developers have an idea on what others are working on, can offer help, and can synchronize their own work. - Check and validate your work! Use "make check" to validate your work, and use "make distcheck" to validate the resulting archives, especially when adding/removing files! - Send patches in "unified diff" format Please send patches in "unified" format, that is, use "diff -u". Or even better: use GIT ("git diff"), see above. - Send patches to the mailing list If you have some code to present, send the patch(es) and/or pointers to your GIT repository to the official ngIRCd mailing list for review, not only to #ngircd: so it becomes archived and more people have a chance to review your patch. Sure it is a good idea to post some notes to #ngircd, too! :-) And this is open source, your work must not be 100% finished and perfect, work in progress is interesting, too: "release early, release often"! ngircd-21/README0000644000175000116100000000634312206130744010346 00000000000000 ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ (c)2001-2013 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- README -- I. Introduction ~~~~~~~~~~~~~~~ ngIRCd is a free, portable and lightweight Internet Relay Chat server for small or private networks, developed under the GNU General Public License (GPL; please see the file COPYING for details). It is simple to configure, can cope with dynamic IP addresses, and supports IPv6 as well as SSL. It is written from scratch and not based on the original IRCd. The name ngIRCd means next generation IRC daemon, which is a little bit exaggerated: lightweight Internet Relay Chat server most probably would be a better name :-) Please see the INSTALL document for installation and upgrade information! II. Status ~~~~~~~~~~~ It is not the goal of ngIRCd to implement all the nasty behaviours of the original ircd, but to implement most of the useful commands and semantics specified by the RFCs. In the meantime ngIRCd should be quite feature complete and stable to be used in real IRC networks. Implemented IRC-commands are: ADMIN, AWAY, CHANINFO, CONNECT, DIE, DISCONNECT, ERROR, GLINE, HELP, INFO, INVITE, ISON, JOIN, KICK, KILL, KLINE, LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, NOTICE, OPER, PART, PASS, PING, PONG, PRIVMSG, QUIT, REHASH, RESTART, SERVER, SERVICE, SERVLIST, SQUERY, SQUIT, STATS, SUMMON, TIME, TOPIC, TRACE, USER, USERHOST, USERS, VERSION, WALLOPS, WEBIRC, WHO, WHOIS, WHOWAS. III. Features (or: why use ngIRCd?) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - well arranged (lean) configuration file - simple to build/install, configure and maintain - supports IPv6 and SSL - no problems with servers that have dynamic IP addresses - freely available, modern, portable and tidy C-source - wide field of supported platforms, including AIX, A/UX, FreeBSD, HP-UX, IRIX, Linux, Mac OS X, NetBSD, OpenBSD, Solaris, and Windows with Cygwin. - ngIRCd is being actively developed since 2001. IV. Documentation ~~~~~~~~~~~~~~~~~ More documentation can be found in the "doc/" directory and the homepage of the ngIRCd: . V. Download ~~~~~~~~~~~ The homepage of the ngIRCd is: ; you will find the newest information about the ngIRCd and the most recent ("stable") releases there. If you are interested in the latest development versions (which are not always stable), then please read the section about "GIT" on the homepage and the file "doc/GIT.txt" which describes the use of GIT, the version control system used by ngIRCd (homepage: http://git-scm.com/). VI. Bugs ~~~~~~~~ If you find bugs in the ngIRCd (which might be there :-), please report them at the following URL: There you can read about known bugs and limitations, too. If you have critics, patches or something else, please feel free to post a mail to the ngIRCd mailing list: (please see for details) or join the ngIRCd IRC channel: .