#!/bin/sh
#
# ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2008 Alexander Barton <alex@barton.de>
+# 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
exit 1
}
+Run()
+{
+ [ "$VERBOSE" = "1" ] && echo " - running \"$@\" ..."
+ $@
+}
+
# Reset locale settings to suppress warning messages of Perl
unset LC_ALL
unset LANG
# specifies one:
echo "Searching tools ..."
[ -z "$ACLOCAL" ] && ACLOCAL=`Search aclocal 1`
-[ "$VERBOSE" = "1" ] && echo "ACLOCAL=$ACLOCAL"
+[ "$VERBOSE" = "1" ] && echo " - ACLOCAL=$ACLOCAL"
[ -z "$AUTOHEADER" ] && AUTOHEADER=`Search autoheader 2`
-[ "$VERBOSE" = "1" ] && echo "AUTOHEADER=$AUTOHEADER"
+[ "$VERBOSE" = "1" ] && echo " - AUTOHEADER=$AUTOHEADER"
[ -z "$AUTOMAKE" ] && AUTOMAKE=`Search automake 1`
-[ "$VERBOSE" = "1" ] && echo "AUTOMAKE=$AUTOMAKE"
+[ "$VERBOSE" = "1" ] && echo " - AUTOMAKE=$AUTOMAKE"
[ -z "$AUTOCONF" ] && AUTOCONF=`Search autoconf 2`
-[ "$VERBOSE" = "1" ] && echo "AUTOCONF=$AUTOCONF"
+[ "$VERBOSE" = "1" ] && echo " - AUTOCONF=$AUTOCONF"
# Call ./configure when parameters have been passed to this script and
# GO isn't already defined.
# Generate files
echo "Generating files ..."
-$ACLOCAL && \
- $AUTOHEADER && \
- $AUTOMAKE --add-missing && \
- $AUTOCONF --force
+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
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
-timestamp='2012-02-10'
+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
# 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}
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
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 ;;
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
+ NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
exit ;;
esac
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
-timestamp='2012-02-10'
+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
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
+ -lynx*178)
+ os=-lynxos178
+ ;;
+ -lynx*5)
+ os=-lynxos5
+ ;;
-lynx*)
os=-lynxos
;;
microblaze)
basic_machine=microblaze-xilinx
;;
+ mingw64)
+ basic_machine=x86_64-pc
+ os=-mingw64
+ ;;
mingw32)
basic_machine=i386-pc
os=-mingw32
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -openbsd* | -solidbsd* \
+ | -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* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
+ | -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* \
c4x-* | tic4x-*)
os=-coff
;;
+ hexagon-*)
+ os=-elf
+ ;;
tic54x-*)
os=-coff
;;
# -- Initialisation --
-AC_PREREQ(2.50)
-AC_INIT(ngircd, VERSION_ID)
-AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
-AC_CANONICAL_TARGET
-AM_INIT_AUTOMAKE(1.6)
-AC_CONFIG_HEADER(src/config.h)
+AC_PREREQ([2.67])
+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([1.11])
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([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([ZLIB], [Define if zlib compression should be enabled])
AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
-AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled])
-AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
-AH_TEMPLATE([PAM], [Define if PAM should be used])
-AH_TEMPLATE([HAVE_sockaddr_in_len], [Define if sockaddr_in.sin_len exists])
+AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
-AH_TEMPLATE([TARGET_OS], [Target operating system name])
-AH_TEMPLATE([TARGET_VENDOR], [Target system vendor])
-AH_TEMPLATE([TARGET_CPU], [Target CPU name])
+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
-AC_C_PROTOTYPES
# -- Helper programs --
# -- Compiler Features --
-AM_C_PROTOTYPES
AC_C_CONST
AC_C_INLINE
+AM_C_PROTOTYPES
# -- Hard coded system and compiler dependencies/features/options ... --
GCC_STACK_PROTECT_CC
fi
-case "$target_os" in
+case "$host_os" in
hpux*)
# This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
# (tested with HP/UX 11.11)
# -- Headers --
AC_HEADER_STDC
-AC_HEADER_TIME
AC_HEADER_SYS_WAIT
+AC_HEADER_TIME
+# Required header files
AC_CHECK_HEADERS([ \
- ctype.h errno.h fcntl.h netdb.h netinet/in.h netinet/in_systm.h \
- stdlib.h string.h strings.h sys/socket.h sys/time.h unistd.h \
+ fcntl.h netdb.h netinet/in.h netinet/in_systm.h stdlib.h string.h \
+ strings.h sys/socket.h sys/time.h unistd.h \
],,AC_MSG_ERROR([required C header missing!]))
-AC_CHECK_HEADERS([ \
- arpa/inet.h ctype.h malloc.h netinet/ip.h stdbool.h stddef.h varargs.h \
- ],[],[],[[
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- ]]
-)
+# Optional header files
+AC_CHECK_HEADERS_ONCE([ \
+ arpa/inet.h inttypes.h malloc.h netinet/ip.h stdbool.h stddef.h \
+ stdint.h varargs.h \
+ ])
# -- Datatypes --
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 <arpa/inet.h>])
# -- Libraries --
-# A/UX needs this.
-AC_CHECK_LIB(UTIL,memmove)
-# needed on solaris. GNU libc also has a libnsl, but we do not need it.
-AC_SEARCH_LIBS(gethostbyname,nsl)
-AC_CHECK_LIB(socket,bind)
+# 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], [nsl], [], [
+ AC_MSG_ERROR([unable to find the gethostbyname() function])
+])
+# bind: SVR4 libsocket
+AC_SEARCH_LIBS([bind], [socket], [], [
+ AC_MSG_ERROR([unable to find the bind() function])
+])
# -- Functions --
AC_FUNC_FORK
AC_FUNC_STRFTIME
+# Required functions
AC_CHECK_FUNCS([ \
- bind gethostbyaddr gethostbyname gethostname inet_ntoa \
- setsid setsockopt socket strcasecmp waitpid],,
+ 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!]))
-AC_CHECK_FUNCS([ \
- gai_strerror getaddrinfo getnameinfo inet_aton sigaction \
- sigprocmask snprintf vsnprintf strdup strlcpy strlcat strtok_r])
+# Optional functions
+AC_CHECK_FUNCS_ONCE([ \
+ gai_strerror getaddrinfo getnameinfo inet_aton sigaction sigprocmask \
+ snprintf vsnprintf strdup strlcpy strlcat strtok_r waitpid])
# -- Configuration options --
x_syslog_on=no
AC_ARG_WITH(syslog,
- [ --without-syslog disable syslog (autodetected by default)],
+ 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_CHECK_LIB(be, syslog)
- AC_CHECK_FUNCS(syslog, x_syslog_on=yes,
+ AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes], [
AC_MSG_ERROR([Can't enable syslog!])
- )
+ ])
fi
],
- [
- AC_CHECK_LIB(be, syslog)
- AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
+ [ AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes])
]
)
if test "$x_syslog_on" = "yes"; then
x_zlib_on=no
AC_ARG_WITH(zlib,
- [ --without-zlib disable zlib compression (autodetected by default)],
+ 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"
x_io_backend=none
AC_ARG_WITH(select,
- [ --without-select disable select IO support (autodetected by default)],
+ 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"
)
AC_ARG_WITH(poll,
- [ --without-poll disable poll support (autodetected by default)],
+ 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"
)
AC_ARG_WITH(devpoll,
- [ --without-devpoll disable /dev/poll IO support (autodetected by default)],
+ 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"
)
AC_ARG_WITH(epoll,
- [ --without-epoll disable epoll IO support (autodetected by default)],
+ 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"
)
AC_ARG_WITH(kqueue,
- [ --without-kqueue disable kqueue IO support (autodetected by default)],
+ 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"
# use SSL?
AC_ARG_WITH(openssl,
- [ --with-openssl enable SSL support using 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"
)
AC_ARG_WITH(gnutls,
- [ --with-gnutls enable SSL support using 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"
x_tcpwrap_on=no
AC_ARG_WITH(tcp-wrappers,
- [ --with-tcp-wrappers enable TCP wrappers support],
+ 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"
x_identauth_on=no
AC_ARG_WITH(ident,
- [ --with-ident enable "IDENT" ("AUTH") protocol support],
+ 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"
x_pam_on=no
AC_ARG_WITH(pam,
- [ --with-pam enable user authentication using 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"
x_ircplus_on=yes
AC_ARG_ENABLE(ircplus,
- [ --disable-ircplus disable IRC+ protocol],
+ 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
# enable support for IPv6?
x_ipv6_on=no
AC_ARG_ENABLE(ipv6,
- [ --enable-ipv6 enable IPv6 protocol support],
+ 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
x_sniffer_on=no; x_debug_on=no
AC_ARG_ENABLE(sniffer,
- [ --enable-sniffer enable IRC traffic sniffer (enables debug mode)],
+ 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
# enable additional debugging code?
AC_ARG_ENABLE(debug,
- [ --enable-debug show additional debug output],
+ 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
x_strict_rfc_on=no
AC_ARG_ENABLE(strict-rfc,
- [ --enable-strict-rfc strict RFC conformance -- may break clients!],
+ 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
# -- Definitions --
-AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
-AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
-AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
+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.
# -- Generate files --
-AC_OUTPUT([ \
+AC_CONFIG_FILES([ \
Makefile \
+ contrib/Anope/Makefile \
+ contrib/Debian/Makefile \
+ contrib/MacOSX/Makefile \
+ contrib/MacOSX/ngIRCd.pmdoc/Makefile \
+ contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
+ contrib/Makefile \
doc/Makefile \
doc/src/Makefile \
- src/Makefile \
- src/portab/Makefile \
+ man/Makefile \
src/ipaddr/Makefile \
- src/tool/Makefile \
+ src/Makefile \
src/ngircd/Makefile \
+ src/portab/Makefile \
src/testsuite/Makefile \
- man/Makefile \
- contrib/Makefile \
- contrib/Anope/Makefile \
- contrib/Debian/Makefile \
- contrib/MacOSX/Makefile \
- contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
- contrib/MacOSX/ngIRCd.pmdoc/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
M=`eval echo ${mandir}` ; M=`eval echo ${M}`
D=`eval echo ${docdir}` ; D=`eval echo ${D}`
-echo " Target: ${target}"
-test "$target" != "$host" && echo " Host: ${host}"
+echo " Host: ${host}"
echo " Compiler: ${CC}"
test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
#
.tmpl:
- sed \
+ $(AM_V_GEN)sed \
-e s@:ETCDIR:@${sysconfdir}@ \
<$< >$@
SUFFIXES = .tmpl .
.tmpl:
- sed \
+ $(AM_V_GEN)sed \
-e s@:SBINDIR:@${sbindir}@ \
-e s@:BINDIR:@${bindir}@ \
-e s@:ETCDIR:@${sysconfdir}@ \
-AUTOMAKE_OPTIONS = ansi2knr
+#
+# ipaddr/Makefile.am
+# (c) 2008 Florian Westphal <fw@strlen.de>, public domain.
+#
+
+AUTOMAKE_OPTIONS = ../portab/ansi2knr
INCLUDES = -I$(srcdir)/../portab
#include "imp.h"
#include <assert.h>
+#include <ctype.h>
#include <errno.h>
#ifdef PROTOTYPES
# include <stdarg.h>
#include <sys/types.h>
#include <unistd.h>
-#ifdef HAVE_CTYPE_H
-# include <ctype.h>
-#endif
#include "array.h"
#include "ngircd.h"
free(Conf_SSLOptions.DHFile);
Conf_SSLOptions.DHFile = NULL;
array_free_wipe(&Conf_SSLOptions.KeyFilePassword);
+
+ array_free(&Conf_SSLOptions.ListenPorts);
}
/**
PACKAGE_NAME, PACKAGE_VERSION);
free(Conf_ListenAddress);
Conf_ListenAddress = NULL;
+ array_free(&Conf_ListenPorts);
array_free(&Conf_Motd);
strlcpy(Conf_MotdFile, SYSCONFDIR, sizeof(Conf_MotdFile));
strlcat(Conf_MotdFile, MOTD_FILE, sizeof(Conf_MotdFile));
bool
ConnSSL_InitLibrary( void )
{
+ if (!array_bytes(&Conf_SSLOptions.ListenPorts))
+ return true;
+
#ifdef HAVE_LIBSSL
SSL_CTX *newctx;
* 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("SSL_CTX_new()", NULL);
+ array_free(&Conf_SSLOptions.ListenPorts);
return false;
}
return true;
out:
SSL_CTX_free(newctx);
+ array_free(&Conf_SSLOptions.ListenPorts);
return false;
#endif
#ifdef HAVE_LIBGNUTLS
err = gnutls_global_init();
if (err) {
Log(LOG_ERR, "gnutls_global_init(): %s", gnutls_strerror(err));
+ array_free(&Conf_SSLOptions.ListenPorts);
return false;
}
- if (!ConnSSL_LoadServerKey_gnutls())
+ if (!ConnSSL_LoadServerKey_gnutls()) {
+ array_free(&Conf_SSLOptions.ListenPorts);
return false;
+ }
Log(LOG_INFO, "gnutls %s initialized.", gnutls_check_version(NULL));
initialized = true;
return true;
cert_file = Conf_SSLOptions.CertFile ? Conf_SSLOptions.CertFile:Conf_SSLOptions.KeyFile;
if (!cert_file) {
- Log(LOG_NOTICE, "No SSL server key configured, SSL disabled.");
+ Log(LOG_ERR, "No SSL server key configured!");
return false;
}
assert(ctx);
if (!Conf_SSLOptions.KeyFile) {
- Log(LOG_NOTICE, "No SSL server key configured, SSL disabled.");
+ Log(LOG_ERR, "No SSL server key configured!");
return false;
}
# include <netinet/ip.h>
#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h> /* e.g. for Mac OS X */
-#endif
-
#ifdef TCPWRAP
# include <tcpd.h> /* for TCP Wrappers */
#endif
* @returns Accepted socket descriptor or -1 on error.
*/
static int
-New_Connection(int Sock, bool IsSSL)
+New_Connection(int Sock, UNUSED bool IsSSL)
{
#ifdef TCPWRAP
struct request_info req;
Client_ID(Client),
Req->command);
- /* User name: only alphanumeric characters are allowed! */
+ /* User name: only alphanumeric characters and limited
+ punctuation is allowed.*/
ptr = Req->argv[0];
while (*ptr) {
if ((*ptr < '0' || *ptr > '9') &&
(*ptr < 'A' || *ptr > 'Z') &&
- (*ptr < 'a' || *ptr > 'z')) {
+ (*ptr < 'a' || *ptr > 'z') &&
+ (*ptr != '+') && (*ptr != '-') &&
+ (*ptr != '.') && (*ptr != '_')) {
Conn_Close(Client_Conn(Client), NULL,
"Invalid user name", true);
return DISCONNECTED;
return false;
if (!IRC_WriteStrClient
(Client, RPL_YOURHOST_MSG, Client_ID(Client),
- Client_ID(Client_ThisServer()), PACKAGE_VERSION, TARGET_CPU,
- TARGET_VENDOR, TARGET_OS))
+ 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))
Channel_Exit();
Class_Exit();
Log_Exit();
+ Signals_Exit();
}
Pidfile_Delete();
* line switch.
*/
static void
-Fill_Version( void )
+Fill_Version(void)
{
NGIRCd_VersionAddition[0] = '\0';
-#ifdef SYSLOG
- strlcpy( NGIRCd_VersionAddition, "SYSLOG", sizeof NGIRCd_VersionAddition );
-#endif
-#ifdef ZLIB
- if( NGIRCd_VersionAddition[0] )
- strlcat( NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition );
- strlcat( NGIRCd_VersionAddition, "ZLIB", sizeof NGIRCd_VersionAddition );
+#ifdef DEBUG
+ if (NGIRCd_VersionAddition[0])
+ strlcat(NGIRCd_VersionAddition, "+",
+ sizeof NGIRCd_VersionAddition);
+ strlcat(NGIRCd_VersionAddition, "DEBUG",
+ sizeof NGIRCd_VersionAddition);
#endif
-#ifdef SSL_SUPPORT
- if ( NGIRCd_VersionAddition[0] ) strlcat( NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition );
- strlcat( NGIRCd_VersionAddition, "SSL", sizeof NGIRCd_VersionAddition );
+#ifdef IDENTAUTH
+ if (NGIRCd_VersionAddition[0])
+ strlcat(NGIRCd_VersionAddition, "+",
+ sizeof NGIRCd_VersionAddition);
+ strlcat(NGIRCd_VersionAddition, "IDENT",
+ sizeof NGIRCd_VersionAddition);
#endif
-#ifdef TCPWRAP
- if( NGIRCd_VersionAddition[0] )
- strlcat( NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition );
- strlcat( NGIRCd_VersionAddition, "TCPWRAP", sizeof NGIRCd_VersionAddition );
+#ifdef WANT_IPV6
+ if (NGIRCd_VersionAddition[0])
+ strlcat(NGIRCd_VersionAddition, "+",
+ sizeof(NGIRCd_VersionAddition));
+ strlcat(NGIRCd_VersionAddition, "IPv6",
+ sizeof(NGIRCd_VersionAddition));
#endif
-#ifdef IDENTAUTH
- if( NGIRCd_VersionAddition[0] )
- strlcat( NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition );
- strlcat( NGIRCd_VersionAddition, "IDENT", sizeof NGIRCd_VersionAddition );
+#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);
+ strlcat(NGIRCd_VersionAddition, "+",
+ sizeof NGIRCd_VersionAddition);
+ strlcat(NGIRCd_VersionAddition, "PAM",
+ sizeof NGIRCd_VersionAddition);
#endif
-#ifdef DEBUG
- if( NGIRCd_VersionAddition[0] )
- strlcat( NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition );
- strlcat( NGIRCd_VersionAddition, "DEBUG", sizeof NGIRCd_VersionAddition );
+#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 );
+ if (NGIRCd_VersionAddition[0])
+ strlcat(NGIRCd_VersionAddition, "+",
+ sizeof NGIRCd_VersionAddition);
+ strlcat(NGIRCd_VersionAddition, "SNIFFER",
+ sizeof NGIRCd_VersionAddition);
#endif
-#ifdef STRICT_RFC
- if( NGIRCd_VersionAddition[0] )
- strlcat( NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition );
- strlcat( NGIRCd_VersionAddition, "RFC", sizeof NGIRCd_VersionAddition );
+#ifdef SSL_SUPPORT
+ if (NGIRCd_VersionAddition[0])
+ strlcat(NGIRCd_VersionAddition, "+",
+ sizeof NGIRCd_VersionAddition);
+ strlcat(NGIRCd_VersionAddition, "SSL",
+ sizeof NGIRCd_VersionAddition);
#endif
-#ifdef IRCPLUS
- if( NGIRCd_VersionAddition[0] )
- strlcat( NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition );
- strlcat( NGIRCd_VersionAddition, "IRCPLUS", sizeof NGIRCd_VersionAddition );
+#ifdef SYSLOG
+ if (NGIRCd_VersionAddition[0])
+ strlcat(NGIRCd_VersionAddition, "+",
+ sizeof NGIRCd_VersionAddition);
+ strlcat(NGIRCd_VersionAddition, "SYSLOG",
+ sizeof NGIRCd_VersionAddition);
#endif
-#ifdef WANT_IPV6
+#ifdef TCPWRAP
if (NGIRCd_VersionAddition[0])
- strlcat(NGIRCd_VersionAddition, "+", sizeof(NGIRCd_VersionAddition));
- strlcat(NGIRCd_VersionAddition, "IPv6", sizeof(NGIRCd_VersionAddition));
+ strlcat(NGIRCd_VersionAddition, "+",
+ sizeof NGIRCd_VersionAddition);
+ strlcat(NGIRCd_VersionAddition, "TCPWRAP",
+ sizeof NGIRCd_VersionAddition);
#endif
- if( NGIRCd_VersionAddition[0] )
- strlcat( NGIRCd_VersionAddition, "-", sizeof( NGIRCd_VersionAddition ));
-
- strlcat( NGIRCd_VersionAddition, TARGET_CPU, sizeof( NGIRCd_VersionAddition ));
- strlcat( NGIRCd_VersionAddition, "/", sizeof( NGIRCd_VersionAddition ));
- strlcat( NGIRCd_VersionAddition, TARGET_VENDOR, sizeof( NGIRCd_VersionAddition ));
- strlcat( NGIRCd_VersionAddition, "/", sizeof( NGIRCd_VersionAddition ));
- strlcat( NGIRCd_VersionAddition, TARGET_OS, sizeof( NGIRCd_VersionAddition ));
+#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);
/* SSL initialization */
if (!ConnSSL_InitLibrary())
Log(LOG_WARNING,
- "Warning: Error during SSL initialization, continuing ...");
+ "Error during SSL initialization, continuing without SSL ...");
/* Change root */
if (Conf_Chroot[0]) {
}
/* New child process */
-#ifndef NeXT
+#ifdef HAVE_SETSID
(void)setsid();
#else
setpgrp(0, getpid());
{
{ "ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "AWAY", IRC_AWAY, CLIENT_USER, 0, 0, 0 },
+ { "CAP", IRC_CAP, 0xFFFF, 0, 0, 0 },
{ "CONNECT", IRC_CONNECT, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "DIE", IRC_DIE, CLIENT_USER, 0, 0, 0 },
{ "DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 0, 0, 0 },
{ "WHO", IRC_WHO, CLIENT_USER, 0, 0, 0 },
{ "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
+
#ifdef IRCPLUS
{ "CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, 0, 0 },
#endif
+
#ifndef STRICT_RFC
- { "CAP", IRC_CAP, 0xFFFF, 0, 0, 0 },
{ "GET", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, 0, 0 },
{ "POST", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, 0, 0 },
#endif
#endif
close(signalpipe[1]);
close(signalpipe[0]);
+ signalpipe[0] = signalpipe[1] = 0;
}
/* -eof- */
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
+ * 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
/* target constants */
-#ifndef TARGET_OS
-#define TARGET_OS "unknown"
+#ifndef HOST_OS
+#define HOST_OS "unknown"
#endif
-#ifndef TARGET_CPU
-#define TARGET_CPU "unknown"
+#ifndef HOST_CPU
+#define HOST_CPU "unknown"
#endif
-#ifndef TARGET_VENDOR
-#define TARGET_VENDOR "unknown"
+#ifndef HOST_VENDOR
+#define HOST_VENDOR "unknown"
#endif
#
# ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+# 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
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
-# $Id: Makefile.am,v 1.1 2003/01/13 12:20:16 alex Exp $
-#
-AUTOMAKE_OPTIONS = ansi2knr
+AUTOMAKE_OPTIONS = ../portab/ansi2knr
INCLUDES = -I$(srcdir)/../portab