0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-06 02:28:38 +02:00

Merge branch 'master' of git.atheme.org:/gitroot/charybdis

This commit is contained in:
William Pitcock 2012-03-04 17:25:17 -06:00
commit dd2654fadb
55 changed files with 3034 additions and 2195 deletions

1
.gitignore vendored
View file

@ -34,6 +34,7 @@ src/y.tab.c
ssld/ssld ssld/ssld
tools/convertilines tools/convertilines
tools/convertklines tools/convertklines
tools/genssl.sh
tools/mkpasswd tools/mkpasswd
tools/viconf tools/viconf
include/serno.h include/serno.h

View file

@ -8,6 +8,7 @@ network configurations.
The charybdis core team is listed in nick-alphabetical order: The charybdis core team is listed in nick-alphabetical order:
jilles, Jilles Tjoelker <jilles -at- stack.nl> jilles, Jilles Tjoelker <jilles -at- stack.nl>
mr_flea, Keith Buck <mr_flea -at- esper.net>
nenolod, William Pitcock <nenolod -at- nenolod.net> nenolod, William Pitcock <nenolod -at- nenolod.net>
spb, Stephen Bennett <spb -at- attenuate.org> spb, Stephen Bennett <spb -at- attenuate.org>
@ -22,7 +23,6 @@ Elizacat, Elizabeth Myers <elizabeth -at- sporksmoo.net>
Entrope, Michael Poole <mdpoole -at- trolius.org> Entrope, Michael Poole <mdpoole -at- trolius.org>
gxti, Michael Tharp <gxti -at- partiallystapled.com> gxti, Michael Tharp <gxti -at- partiallystapled.com>
jdhore, JD Horelick <jdhore1 -at- gmail.com> jdhore, JD Horelick <jdhore1 -at- gmail.com>
mr_flea, Keith Buck <mr_flea -at- esper.net>
Taros, Brett Greenham <taros -at- shadowircd.net> Taros, Brett Greenham <taros -at- shadowircd.net>
ThaPrince, Jon Christopherson <jon -at- vile.com> ThaPrince, Jon Christopherson <jon -at- vile.com>
twincest, River Tarnell <river -at- attenuate.org> twincest, River Tarnell <river -at- attenuate.org>

View file

@ -24,10 +24,17 @@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
bindir = @bindir@ bindir = @bindir@
mandir = @mandir@ mandir = @mandir@
libdir = @libdir@
pkglibdir = @pkglibdir@
moduledir = @moduledir@ moduledir = @moduledir@
helpdir = @helpdir@ helpdir = @helpdir@
confdir = @confdir@ sysconfdir = @sysconfdir@
logdir = @logdir@ logdir = @logdir@
rundir = @rundir@
pkgrundir = @pkgrundir@
localstatedir = @localstatedir@
pkglocalstatedir= @pkglocalstatedir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
# Default CFLAGS # Default CFLAGS
# CFLAGS = -g -O2 -DNDEBUG # CFLAGS = -g -O2 -DNDEBUG
@ -46,6 +53,7 @@ CFLAGS = @CFLAGS@
# the system one. # the system one.
#CFLAGS= -DNDEBUG -g -O2 -D"FD_SETSIZE=1024" #CFLAGS= -DNDEBUG -g -O2 -D"FD_SETSIZE=1024"
SHELL=/bin/sh SHELL=/bin/sh
# `extensions' must be after `modules' for proper creation of $(moduledir).
SUBDIRS=libratbox modules extensions src tools ssld bandb doc help SUBDIRS=libratbox modules extensions src tools ssld bandb doc help
CLEANDIRS = ${SUBDIRS} CLEANDIRS = ${SUBDIRS}
RSA_FILES=rsa_respond/README rsa_respond/respond.c rsa_respond/Makefile RSA_FILES=rsa_respond/README rsa_respond/respond.c rsa_respond/Makefile
@ -117,27 +125,27 @@ lint:
install-mkdirs: install-mkdirs:
@echo "ircd: setting up ircd directory structure" @echo "ircd: setting up ircd directory structure"
-@if test ! -d $(DESTDIR)$(prefix); then \ -@if test ! -d $(DESTDIR)$(prefix); then \
mkdir $(DESTDIR)$(prefix); \ mkdir -p -m 755 $(DESTDIR)$(prefix); \
fi fi
-@if test ! -d $(DESTDIR)$(bindir); then \ -@if test ! -d $(DESTDIR)$(bindir); then \
mkdir $(DESTDIR)$(bindir); \ mkdir -p -m 755 $(DESTDIR)$(bindir); \
fi fi
-@if test ! -d $(DESTDIR)$(confdir); then \ -@if test ! -d $(DESTDIR)$(sysconfdir); then \
mkdir $(DESTDIR)$(confdir); \ mkdir -p -m 755 $(DESTDIR)$(sysconfdir); \
fi fi
-@if test ! -d $(DESTDIR)$(mandir); then \ -@if test ! -d $(DESTDIR)$(mandir); then \
mkdir $(DESTDIR)$(mandir); \ mkdir -p -m 755 $(DESTDIR)$(mandir); \
fi
-@if test ! -d $(DESTDIR)$(moduledir); then \
mkdir $(DESTDIR)$(moduledir); \
fi
-@if test ! -d $(DESTDIR)$(helpdir); then \
mkdir $(DESTDIR)$(helpdir); \
fi fi
-@if test ! -d $(DESTDIR)$(logdir); then \ -@if test ! -d $(DESTDIR)$(logdir); then \
mkdir $(DESTDIR)$(logdir); \ mkdir -p -m 755 $(DESTDIR)$(logdir); \
fi fi
-@if test ! -d '$(DESTDIR)$(pkgrundir)'; then \
mkdir -p -m 755 '$(DESTDIR)$(pkgrundir)'; \
fi
-@if test ! -d '$(DESTDIR)$(pkglocalstatedir)'; then \
mkdir -p -m 755 '$(DESTDIR)$(pkglocalstatedir)'; \
fi
install: install-mkdirs all install: install-mkdirs all
@for i in $(SUBDIRS); do \ @for i in $(SUBDIRS); do \
echo "install ==> $$i";\ echo "install ==> $$i";\

13
aclocal.m4 vendored
View file

@ -2,8 +2,17 @@
AC_DEFUN([AC_DEFINE_DIR], [ AC_DEFUN([AC_DEFINE_DIR], [
test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo [$]$2` last_ac_define_dir=`eval echo [$]$2`
ac_define_dir=`eval echo [$]ac_define_dir` ac_define_dir=`eval echo [$]last_ac_define_dir`
ac_define_dir_counter=0
while test "x[$]last_ac_define_dir" != "x[$]ac_define_dir"; do
last_ac_define_dir="[$]ac_define_dir"
ac_define_dir=`eval echo [$]last_ac_define_dir`
AS_VAR_ARITH([ac_define_dir_counter], [$ac_define_dir_counter + 1])
AS_VAR_IF([ac_define_dir_counter], [128],
[AC_MSG_ERROR([detected recusive directory expansion when expanding $1=[$]$2: [$]ac_define_dir])
break])
done
$1="$ac_define_dir" $1="$ac_define_dir"
AC_SUBST($1) AC_SUBST($1)
ifelse($3, , ifelse($3, ,

View file

@ -22,8 +22,12 @@ exec_prefix = @exec_prefix@
bindir = @bindir@ bindir = @bindir@
libdir = @libdir@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
confdir = @confdir@ pkglibexecdir = @pkglibexecdir@
sysconfdir = @sysconfdir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
ZIP_LIB = @ZLIB_LD@ ZIP_LIB = @ZLIB_LD@
@ -34,7 +38,9 @@ CPPFLAGS = ${INCLUDES} @CPPFLAGS@
CFLAGS += -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION=1 CFLAGS += -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION=1
PROGS = bandb bantool pkglibexec_PROGS = bandb
bin_PROGS = bantool
PROGS = $(pkglibexec_PROGS) $(bin_PROGS)
BANDB_SOURCES = \ BANDB_SOURCES = \
bandb.c \ bandb.c \
@ -64,12 +70,18 @@ bantool: ${BANTOOL_OBJECTS}
install: build install: build
@echo "ircd: installing bandb ($(PROGS))" @echo "ircd: installing bandb ($(PROGS))"
@for i in $(PROGS); do \ @for i in $(bin_PROGS); do \
if test -f $(DESTDIR)$(bindir)/$$i; then \ if test -f $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; then \
$(MV) $(DESTDIR)$(bindir)/$$i $(DESTDIR)$(bindir)/$$i.old; \ $(MV) $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i.old; \
fi; \ fi; \
$(INSTALL_BIN) $$i $(DESTDIR)$(bindir); \ $(INSTALL_BIN) $$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; \
done done
@for i in $(pkglibexec_PROGS); do \
if test -f '$(DESTDIR)$(pkglibexecdir)/'$$i; then \
$(MV) '$(DESTDIR)$(pkglibexecdir)/'$$i '$(DESTDIR)$(pkglibexecdir)/'$$i.old; \
fi; \
$(INSTALL_BIN) $$i '$(DESTDIR)$(pkglibexecdir)/'$$i; \
done
.c.o: .c.o:
${CC} ${CPPFLAGS} ${CFLAGS} -c $< ${CC} ${CPPFLAGS} ${CFLAGS} -c $<

View file

@ -58,19 +58,19 @@ mlog(const char *errstr, ...)
int int
rsdb_init(rsdb_error_cb * ecb) rsdb_init(rsdb_error_cb * ecb)
{ {
const char *bandb_dpath; const char *bandb_dbpath_env;
char dbpath[PATH_MAX]; char dbpath[PATH_MAX];
char errbuf[128]; char errbuf[128];
error_cb = ecb; error_cb = ecb;
/* try a path from the environment first, useful for basedir overrides */ /* try a path from the environment first, useful for basedir overrides */
bandb_dpath = getenv("BANDB_DPATH"); bandb_dbpath_env = getenv("BANDB_DBPATH");
if(bandb_dpath != NULL) if(bandb_dbpath_env != NULL)
rb_snprintf(dbpath, sizeof(dbpath), "%s/etc/ban.db", bandb_dpath); rb_strlcpy(dbpath, bandb_dbpath_env, sizeof(dbpath));
else else
rb_strlcpy(dbpath, DBPATH, sizeof(dbpath)); rb_strlcpy(dbpath, DBPATH, sizeof(dbpath));
if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK) if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK)
{ {
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s", rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",

384
configure vendored
View file

@ -613,19 +613,27 @@ SSL_SRCS_ENABLE
MOD_TARGET MOD_TARGET
MODULES_LIBS MODULES_LIBS
SELECT_TYPE SELECT_TYPE
PROGRAM_PREFIX
PKGRUNDIR
moduledir moduledir
MODULE_DIR MODULE_DIR
helpdir helpdir
HELP_DIR HELP_DIR
logdir logdir
LOG_DIR LOG_DIR
confdir
ETC_DIR ETC_DIR
ZLIB_LD ZLIB_LD
ENCSPEED ENCSPEED
ALLOCA ALLOCA
VICONF VICONF
CRYPT_LIB CRYPT_LIB
PKGLIBEXECDIR
pkglibexecdir
PKGLOCALSTATEDIR
pkglocalstatedir
pkgrundir
rundir
pkglibdir
LEXLIB LEXLIB
LEX_OUTPUT_ROOT LEX_OUTPUT_ROOT
LEX LEX
@ -699,6 +707,7 @@ SHELL'
ac_subst_files='' ac_subst_files=''
ac_user_opts=' ac_user_opts='
enable_option_checking enable_option_checking
enable_fhs_paths
enable_ipv6 enable_ipv6
enable_openssl enable_openssl
with_zlib_path with_zlib_path
@ -712,6 +721,8 @@ with_confdir
with_logdir with_logdir
with_helpdir with_helpdir
with_moduledir with_moduledir
with_rundir
with_program_prefix
with_custom_branding with_custom_branding
with_custom_version with_custom_version
enable_assert enable_assert
@ -1345,6 +1356,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options --disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-fhs-paths Use more FHS-like pathnames (for packagers).
--enable-ipv6 Enable IPv6 support --enable-ipv6 Enable IPv6 support
--enable-openssl=DIR Enable OpenSSL support (DIR optional). --enable-openssl=DIR Enable OpenSSL support (DIR optional).
--disable-openssl Disable OpenSSL support. --disable-openssl Disable OpenSSL support.
@ -1366,10 +1378,14 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-zlib-path=DIR Path to libz.so for ziplinks support. --with-zlib-path=DIR Path to libz.so for ziplinks support.
--with-confdir=DIR Directory to install config files. --with-confdir=DIR Directory to install config files [deprecated, use
--sysconfdir instead].
--with-logdir=DIR Directory where to write logfiles. --with-logdir=DIR Directory where to write logfiles.
--with-helpdir=DIR Directory to install help files. --with-helpdir=DIR Directory to install help files.
--with-moduledir=DIR Directory to install modules. --with-moduledir=DIR Directory to install modules.
--with-rundir=DIR Directory in which to store pidfile.
--with-program-prefix= If set, programs installed into PATH will be
installed with names prefixed by this prefix.
--with-custom-branding=NAME --with-custom-branding=NAME
Custom branding name. Custom branding name.
--with-custom-version=NAME --with-custom-version=NAME
@ -5355,12 +5371,86 @@ if test "$LEX" = ":"; then
as_fn_error $? "could not locate a suitable lexical generator, install flex or lex." "$LINENO" 5 as_fn_error $? "could not locate a suitable lexical generator, install flex or lex." "$LINENO" 5
fi fi
if test "$libexecdir" = '${exec_prefix}/libexec' && # Check whether --enable-fhs-paths was given.
test "$localstatedir" = '${prefix}/var'; then if test "${enable_fhs_paths+set}" = set; then :
libexecdir='${bindir}' enableval=$enable_fhs_paths;
localstatedir='${prefix}' else
if test "$libexecdir" = '${exec_prefix}/libexec' && \
test "$localstatedir" = '${prefix}/var' && \
test "$libdir" = '${exec_prefix}/lib'; then :
enable_fhs_paths=no
else
enable_fhs_paths=yes
fi fi
fi
if test "x$enable_fhs_paths" = "xyes"; then :
pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}'
rundir=${rundir-'${prefix}/run'}
pkgrundir='${rundir}/${PACKAGE_TARNAME}'
pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'
else
libexecdir='${bindir}'
pkglibexecdir='${libexecdir}'
rundir='${sysconfdir}'
pkgrundir='${rundir}'
localstatedir='${prefix}'
pkglocalstatedir='${sysconfdir}'
fi
pkglibdir='${libdir}/${PACKAGE_TARNAME}'
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
last_ac_define_dir=`eval echo $pkglocalstatedir`
ac_define_dir=`eval echo $last_ac_define_dir`
ac_define_dir_counter=0
while test "x$last_ac_define_dir" != "x$ac_define_dir"; do
last_ac_define_dir="$ac_define_dir"
ac_define_dir=`eval echo $last_ac_define_dir`
as_fn_arith $ac_define_dir_counter + 1 && ac_define_dir_counter=$as_val
if test "x$ac_define_dir_counter" = x128; then :
as_fn_error $? "detected recusive directory expansion when expanding PKGLOCALSTATEDIR=$pkglocalstatedir: $ac_define_dir" "$LINENO" 5
break
fi
done
PKGLOCALSTATEDIR="$ac_define_dir"
cat >>confdefs.h <<_ACEOF
#define PKGLOCALSTATEDIR "$ac_define_dir"
_ACEOF
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
last_ac_define_dir=`eval echo $pkglibexecdir`
ac_define_dir=`eval echo $last_ac_define_dir`
ac_define_dir_counter=0
while test "x$last_ac_define_dir" != "x$ac_define_dir"; do
last_ac_define_dir="$ac_define_dir"
ac_define_dir=`eval echo $last_ac_define_dir`
as_fn_arith $ac_define_dir_counter + 1 && ac_define_dir_counter=$as_val
if test "x$ac_define_dir_counter" = x128; then :
as_fn_error $? "detected recusive directory expansion when expanding PKGLIBEXECDIR=$pkglibexecdir: $ac_define_dir" "$LINENO" 5
break
fi
done
PKGLIBEXECDIR="$ac_define_dir"
cat >>confdefs.h <<_ACEOF
#define PKGLIBEXECDIR "$ac_define_dir"
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; } $as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then : if ${ac_cv_header_stdc+:} false; then :
@ -7204,45 +7294,29 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to modify confdir" >&5
$as_echo_n "checking whether to modify confdir... " >&6; }
# Check whether --with-confdir was given. # Check whether --with-confdir was given.
if test "${with_confdir+set}" = set; then : if test "${with_confdir+set}" = set; then :
withval=$with_confdir; confdir=`echo $withval | sed 's/\/$//'` withval=$with_confdir; sysconfdir=`echo $withval | sed 's/\/$//'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo $confdir`
ac_define_dir=`eval echo $ac_define_dir`
ETC_DIR="$ac_define_dir"
cat >>confdefs.h <<_ACEOF
#define ETC_DIR "$ac_define_dir"
_ACEOF
confdir=`(
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
eval echo \""$confdir"\"
)`
else else
confdir='${prefix}/etc' confdir='${sysconfdir}'
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 fi
$as_echo "no" >&6; }
test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo $confdir` last_ac_define_dir=`eval echo $sysconfdir`
ac_define_dir=`eval echo $ac_define_dir` ac_define_dir=`eval echo $last_ac_define_dir`
ac_define_dir_counter=0
while test "x$last_ac_define_dir" != "x$ac_define_dir"; do
last_ac_define_dir="$ac_define_dir"
ac_define_dir=`eval echo $last_ac_define_dir`
as_fn_arith $ac_define_dir_counter + 1 && ac_define_dir_counter=$as_val
if test "x$ac_define_dir_counter" = x128; then :
as_fn_error $? "detected recusive directory expansion when expanding ETC_DIR=$sysconfdir: $ac_define_dir" "$LINENO" 5
break
fi
done
ETC_DIR="$ac_define_dir" ETC_DIR="$ac_define_dir"
@ -7253,18 +7327,6 @@ _ACEOF
confdir=`(
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
eval echo \""$confdir"\"
)`
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to modify logdir" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to modify logdir" >&5
$as_echo_n "checking whether to modify logdir... " >&6; } $as_echo_n "checking whether to modify logdir... " >&6; }
@ -7273,37 +7335,31 @@ if test "${with_logdir+set}" = set; then :
withval=$with_logdir; logdir=`echo $withval | sed 's/\/$//'` withval=$with_logdir; logdir=`echo $withval | sed 's/\/$//'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo $logdir`
ac_define_dir=`eval echo $ac_define_dir`
LOG_DIR="$ac_define_dir"
cat >>confdefs.h <<_ACEOF
#define LOG_DIR "$ac_define_dir"
_ACEOF
logdir=`(
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
eval echo \""$logdir"\"
)`
else else
logdir='${prefix}/logs' if test "x$enable_fhs_paths" = "xyes"; then :
logdir='${localstatedir}/log/${PACKAGE_TARNAME}'
else
logdir='${prefix}/logs'
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }
fi
test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo $logdir` last_ac_define_dir=`eval echo $logdir`
ac_define_dir=`eval echo $ac_define_dir` ac_define_dir=`eval echo $last_ac_define_dir`
ac_define_dir_counter=0
while test "x$last_ac_define_dir" != "x$ac_define_dir"; do
last_ac_define_dir="$ac_define_dir"
ac_define_dir=`eval echo $last_ac_define_dir`
as_fn_arith $ac_define_dir_counter + 1 && ac_define_dir_counter=$as_val
if test "x$ac_define_dir_counter" = x128; then :
as_fn_error $? "detected recusive directory expansion when expanding LOG_DIR=$logdir: $ac_define_dir" "$LINENO" 5
break
fi
done
LOG_DIR="$ac_define_dir" LOG_DIR="$ac_define_dir"
@ -7322,9 +7378,6 @@ _ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to modify helpdir" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to modify helpdir" >&5
$as_echo_n "checking whether to modify helpdir... " >&6; } $as_echo_n "checking whether to modify helpdir... " >&6; }
@ -7334,37 +7387,31 @@ if test "${with_helpdir+set}" = set; then :
withval=$with_helpdir; helpdir=`echo $withval | sed 's/\/$//'` withval=$with_helpdir; helpdir=`echo $withval | sed 's/\/$//'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo $helpdir`
ac_define_dir=`eval echo $ac_define_dir`
HELP_DIR="$ac_define_dir"
cat >>confdefs.h <<_ACEOF
#define HELP_DIR "$ac_define_dir"
_ACEOF
helpdir=`(
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
eval echo \""$helpdir"\"
)`
else else
helpdir='${prefix}/help' if test "x$enable_fhs_paths" = "xyes"; then :
helpdir='${datadir}/${PACKAGE_TARNAME}/help'
else
helpdir='${prefix}/help'
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }
fi
test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo $helpdir` last_ac_define_dir=`eval echo $helpdir`
ac_define_dir=`eval echo $ac_define_dir` ac_define_dir=`eval echo $last_ac_define_dir`
ac_define_dir_counter=0
while test "x$last_ac_define_dir" != "x$ac_define_dir"; do
last_ac_define_dir="$ac_define_dir"
ac_define_dir=`eval echo $last_ac_define_dir`
as_fn_arith $ac_define_dir_counter + 1 && ac_define_dir_counter=$as_val
if test "x$ac_define_dir_counter" = x128; then :
as_fn_error $? "detected recusive directory expansion when expanding HELP_DIR=$helpdir: $ac_define_dir" "$LINENO" 5
break
fi
done
HELP_DIR="$ac_define_dir" HELP_DIR="$ac_define_dir"
@ -7383,9 +7430,6 @@ _ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to modify moduledir" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to modify moduledir" >&5
$as_echo_n "checking whether to modify moduledir... " >&6; } $as_echo_n "checking whether to modify moduledir... " >&6; }
@ -7395,37 +7439,32 @@ if test "${with_moduledir+set}" = set; then :
withval=$with_moduledir; moduledir=`echo $withval | sed 's/\/$//'` withval=$with_moduledir; moduledir=`echo $withval | sed 's/\/$//'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo $moduledir`
ac_define_dir=`eval echo $ac_define_dir`
MODULE_DIR="$ac_define_dir"
cat >>confdefs.h <<_ACEOF
#define MODULE_DIR "$ac_define_dir"
_ACEOF
moduledir=`(
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
eval echo \""$moduledir"\"
)`
else else
moduledir='${prefix}/modules' if test "x$enable_fhs_paths" = "xyes"; then :
moduledir='${pkglibdir}/modules'
else
moduledir='${prefix}/modules'
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }
fi
test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo $moduledir` last_ac_define_dir=`eval echo $moduledir`
ac_define_dir=`eval echo $ac_define_dir` ac_define_dir=`eval echo $last_ac_define_dir`
ac_define_dir_counter=0
while test "x$last_ac_define_dir" != "x$ac_define_dir"; do
last_ac_define_dir="$ac_define_dir"
ac_define_dir=`eval echo $last_ac_define_dir`
as_fn_arith $ac_define_dir_counter + 1 && ac_define_dir_counter=$as_val
if test "x$ac_define_dir_counter" = x128; then :
as_fn_error $? "detected recusive directory expansion when expanding MODULE_DIR=$moduledir: $ac_define_dir" "$LINENO" 5
break
fi
done
MODULE_DIR="$ac_define_dir" MODULE_DIR="$ac_define_dir"
@ -7444,7 +7483,68 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether or modify rundir" >&5
$as_echo_n "checking whether or modify rundir... " >&6; }
# Check whether --with-rundir was given.
if test "${with_rundir+set}" = set; then :
withval=$with_rundir; { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
rundir=`echo $withval | sed 's/\/$//'`
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if test "x$enable_fhs_paths" = "xyes"; then :
rundir='${prefix}/run'
else
rundir='${sysconfdir}'
fi fi
fi
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
last_ac_define_dir=`eval echo $pkgrundir`
ac_define_dir=`eval echo $last_ac_define_dir`
ac_define_dir_counter=0
while test "x$last_ac_define_dir" != "x$ac_define_dir"; do
last_ac_define_dir="$ac_define_dir"
ac_define_dir=`eval echo $last_ac_define_dir`
as_fn_arith $ac_define_dir_counter + 1 && ac_define_dir_counter=$as_val
if test "x$ac_define_dir_counter" = x128; then :
as_fn_error $? "detected recusive directory expansion when expanding PKGRUNDIR=$pkgrundir: $ac_define_dir" "$LINENO" 5
break
fi
done
PKGRUNDIR="$ac_define_dir"
cat >>confdefs.h <<_ACEOF
#define PKGRUNDIR "$ac_define_dir"
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for program prefix" >&5
$as_echo_n "checking for program prefix... " >&6; }
# Check whether --with-program-prefix was given.
if test "${with_program_prefix+set}" = set; then :
withval=$with_program_prefix; test "x$with_program_prefix" = "xno" && with_program_prefix=
else
with_program_prefix=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$with_program_prefix\"" >&5
$as_echo "\"$with_program_prefix\"" >&6; }
PROGRAM_PREFIX="$with_program_prefix"
cat >>confdefs.h <<_ACEOF
#define PROGRAM_PREFIX "$with_program_prefix"
_ACEOF
@ -9528,7 +9628,9 @@ _ACEOF
fi fi
ac_config_files="$ac_config_files Makefile bandb/Makefile ssld/Makefile extensions/Makefile src/Makefile modules/Makefile tools/Makefile doc/Makefile help/Makefile" ac_config_files="$ac_config_files Makefile bandb/Makefile ssld/Makefile extensions/Makefile src/Makefile modules/Makefile tools/Makefile tools/genssl.sh doc/Makefile help/Makefile"
ac_config_commands="$ac_config_commands tools/genssl.sh_chmod"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
@ -10078,6 +10180,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for. # Files that config.status was made for.
config_files="$ac_config_files" config_files="$ac_config_files"
config_headers="$ac_config_headers" config_headers="$ac_config_headers"
config_commands="$ac_config_commands"
_ACEOF _ACEOF
@ -10107,6 +10210,9 @@ $config_files
Configuration headers: Configuration headers:
$config_headers $config_headers
Configuration commands:
$config_commands
Report bugs to the package provider." Report bugs to the package provider."
_ACEOF _ACEOF
@ -10243,8 +10349,10 @@ do
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"modules/Makefile") CONFIG_FILES="$CONFIG_FILES modules/Makefile" ;; "modules/Makefile") CONFIG_FILES="$CONFIG_FILES modules/Makefile" ;;
"tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
"tools/genssl.sh") CONFIG_FILES="$CONFIG_FILES tools/genssl.sh" ;;
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"help/Makefile") CONFIG_FILES="$CONFIG_FILES help/Makefile" ;; "help/Makefile") CONFIG_FILES="$CONFIG_FILES help/Makefile" ;;
"tools/genssl.sh_chmod") CONFIG_COMMANDS="$CONFIG_COMMANDS tools/genssl.sh_chmod" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac esac
@ -10258,6 +10366,7 @@ done
if $ac_need_defaults; then if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi fi
# Have a temporary directory for convenience. Make it in the build tree # Have a temporary directory for convenience. Make it in the build tree
@ -10554,7 +10663,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_HEADERS" fi # test -n "$CONFIG_HEADERS"
eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
shift shift
for ac_tag for ac_tag
do do
@ -10792,9 +10901,16 @@ $as_echo "$as_me: $ac_file is unchanged" >&6;}
fi fi
;; ;;
:C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
$as_echo "$as_me: executing $ac_file commands" >&6;}
;;
esac esac
case $ac_file$ac_mode in
"tools/genssl.sh_chmod":C) chmod 755 tools/genssl.sh ;;
esac
done # for ac_tag done # for ac_tag

View file

@ -225,12 +225,37 @@ if test "$LEX" = ":"; then
AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.]) AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
fi fi
AC_ARG_ENABLE([fhs-paths],
[AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])],
[],
[dnl detect if the user appears to want --enable-fhs-paths
AS_IF([test "$libexecdir" = '${exec_prefix}/libexec' && \
test "$localstatedir" = '${prefix}/var' && \
test "$libdir" = '${exec_prefix}/lib'],
[enable_fhs_paths=no],
[enable_fhs_paths=yes])
])
dnl use directory structure of cached as default (hack) dnl use directory structure of cached as default (hack)
if test "$libexecdir" = '${exec_prefix}/libexec' && AS_IF([test "x$enable_fhs_paths" = "xyes"],
test "$localstatedir" = '${prefix}/var'; then [dnl Avoid name collisions.
libexecdir='${bindir}' pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}'
rundir=${rundir-'${prefix}/run'}
pkgrundir='${rundir}/${PACKAGE_TARNAME}'
pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'],
[libexecdir='${bindir}'
pkglibexecdir='${libexecdir}'
rundir='${sysconfdir}'
pkgrundir='${rundir}'
localstatedir='${prefix}' localstatedir='${prefix}'
fi pkglocalstatedir='${sysconfdir}'])
pkglibdir='${libdir}/${PACKAGE_TARNAME}'
AC_SUBST([pkglibdir])
AC_SUBST([rundir])
AC_SUBST([pkgrundir])
AC_SUBST([pkglocalstatedir])
AC_DEFINE_DIR([PKGLOCALSTATEDIR], [pkglocalstatedir], [[Directory in which to store state, such as band database]])
AC_SUBST([pkglibexecdir])
AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IRCd itself spawns live])
dnl Checks for header files. dnl Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
@ -584,22 +609,15 @@ AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Lin
],) ],)
dnl ********************************************************************** dnl **********************************************************************
dnl Check for --with-confdir dnl Check for --with-confdir [deprecated, use --sysconfdir instead]
dnl ********************************************************************** dnl **********************************************************************
AC_MSG_CHECKING([whether to modify confdir]) AC_ARG_WITH([confdir],
AC_ARG_WITH(confdir, [AC_HELP_STRING([--with-confdir=DIR],
AC_HELP_STRING([--with-confdir=DIR], [Directory to install config files [deprecated, use --sysconfdir instead].])],
[Directory to install config files.]), [ sysconfdir=`echo $withval | sed 's/\/$//'` ],
[ confdir=`echo $withval | sed 's/\/$//'` [ confdir='${sysconfdir}' ])
AC_MSG_RESULT(yes) AC_DEFINE_DIR([ETC_DIR], [sysconfdir], [Prefix where config files are installed.])
AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
AC_SUBST_DIR([confdir]) ],
[ confdir='${prefix}/etc'
AC_MSG_RESULT(no)
AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
AC_SUBST_DIR([confdir])]
)
dnl ********************************************************************** dnl **********************************************************************
dnl Check for --with-logdir dnl Check for --with-logdir
@ -610,14 +628,13 @@ AC_ARG_WITH(logdir,
AC_HELP_STRING([--with-logdir=DIR], AC_HELP_STRING([--with-logdir=DIR],
[Directory where to write logfiles.]), [Directory where to write logfiles.]),
[ logdir=`echo $withval | sed 's/\/$//'` [ logdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)],
AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.]) [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
AC_SUBST_DIR([logdir]) ], [logdir='${localstatedir}/log/${PACKAGE_TARNAME}'],
[ logdir='${prefix}/logs' [logdir='${prefix}/logs'])
AC_MSG_RESULT(no) AC_MSG_RESULT(no)])
AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.]) AC_DEFINE_DIR([LOG_DIR], [logdir], [Prefix where to write logfiles.])
AC_SUBST_DIR([logdir])] AC_SUBST_DIR([logdir])
)
dnl ********************************************************************** dnl **********************************************************************
dnl Check for --with-helpdir dnl Check for --with-helpdir
@ -628,14 +645,13 @@ AC_ARG_WITH(helpdir,
AC_HELP_STRING([--with-helpdir=DIR], AC_HELP_STRING([--with-helpdir=DIR],
[Directory to install help files.]), [Directory to install help files.]),
[ helpdir=`echo $withval | sed 's/\/$//'` [ helpdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes) ],
AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.]) [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
AC_SUBST_DIR([helpdir]) ], [helpdir='${datadir}/${PACKAGE_TARNAME}/help'],
[ helpdir='${prefix}/help' [helpdir='${prefix}/help'])
AC_MSG_RESULT(no) AC_MSG_RESULT(no) ])
AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.]) AC_DEFINE_DIR([HELP_DIR], [helpdir], [Prefix where help files are installed.])
AC_SUBST_DIR([helpdir])] AC_SUBST_DIR([helpdir])
)
dnl ********************************************************************** dnl **********************************************************************
dnl Check for --with-moduledir dnl Check for --with-moduledir
@ -643,17 +659,44 @@ dnl **********************************************************************
AC_MSG_CHECKING([whether to modify moduledir]) AC_MSG_CHECKING([whether to modify moduledir])
AC_ARG_WITH(moduledir, AC_ARG_WITH(moduledir,
AC_HELP_STRING([--with-moduledir=DIR], [AC_HELP_STRING([--with-moduledir=DIR],
[Directory to install modules.]), [Directory to install modules.])],
[ moduledir=`echo $withval | sed 's/\/$//'` [ moduledir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)],
AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.]) [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
AC_SUBST_DIR([moduledir]) ], [moduledir='${pkglibdir}/modules'],
[ moduledir='${prefix}/modules' [moduledir='${prefix}/modules'])
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.]) ])
AC_SUBST_DIR([moduledir])] AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
) AC_SUBST_DIR([moduledir])
dnl Check for --with-rundir
AC_MSG_CHECKING([whether or modify rundir])
AC_ARG_WITH([rundir],
[AC_HELP_STRING([--with-rundir=DIR],
[Directory in which to store pidfile.])],
[AC_MSG_RESULT([yes])
rundir=`echo $withval | sed 's/\/$//'`],
[AC_MSG_RESULT([no])
AS_IF([test "x$enable_fhs_paths" = "xyes"],
[rundir='${prefix}/run'],
[rundir='${sysconfdir}'])])
AC_SUBST([rundir])
AC_DEFINE_DIR([PKGRUNDIR], [pkgrundir], [Directory to store pidfile in.])
dnl Installed utility program prefixes (does not affect binaries
dnl installed into pkglibexecdir)
AC_MSG_CHECKING([for program prefix])
AC_ARG_WITH([program-prefix],
[AS_HELP_STRING([--with-program-prefix=], [If set, programs installed into PATH will be installed with names prefixed by this prefix.])],
[test "x$with_program_prefix" = "xno" && with_program_prefix=],
[with_program_prefix=])
AC_MSG_RESULT(["$with_program_prefix"])
PROGRAM_PREFIX="$with_program_prefix"
AC_SUBST([PROGRAM_PREFIX])
AC_DEFINE_UNQUOTED([PROGRAM_PREFIX], ["$with_program_prefix"], [String with which all programs intended to be in PATH are prefixed.])
dnl ********************************************************************** dnl **********************************************************************
dnl Branding dnl Branding
@ -1197,9 +1240,11 @@ AC_CONFIG_FILES( \
src/Makefile \ src/Makefile \
modules/Makefile \ modules/Makefile \
tools/Makefile \ tools/Makefile \
tools/genssl.sh \
doc/Makefile \ doc/Makefile \
help/Makefile \ help/Makefile \
) )
AC_CONFIG_COMMANDS([tools/genssl.sh_chmod], [chmod 755 tools/genssl.sh])
AC_OUTPUT AC_OUTPUT

View file

@ -15,12 +15,14 @@ RM = @RM@
CP = @CP@ CP = @CP@
TOUCH = @TOUCH@ TOUCH = @TOUCH@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
exec_suffix = @exec_suffix@ exec_suffix = @exec_suffix@
bindir = @bindir@ bindir = @bindir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
confdir = @confdir@ sysconfdir = @sysconfdir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
# Change this later! -- adrian # Change this later! -- adrian
moduledir = @moduledir@ moduledir = @moduledir@
@ -43,9 +45,9 @@ CPPFLAGS = ${INCLUDES} @CPPFLAGS@
all: build all: build
install-mkdirs: install-mkdirs:
-@if test ! -d $(DESTDIR)$(confdir); then \ -@if test ! -d $(DESTDIR)$(sysconfdir); then \
echo "mkdir -p $(confdir)"; \ echo "mkdir -p $(sysconfdir)"; \
mkdir -p $(DESTDIR)$(confdir); \ mkdir -p $(DESTDIR)$(sysconfdir); \
fi fi
-@if test ! -d $(DESTDIR)$(mandir); then \ -@if test ! -d $(DESTDIR)$(mandir); then \
@ -56,25 +58,25 @@ install-mkdirs:
install: install-mkdirs build install: install-mkdirs build
@echo "ircd: installing example config files ($(CONFS))" @echo "ircd: installing example config files ($(CONFS))"
@for i in $(CONFS); do \ @for i in $(CONFS); do \
if test -f $(DESTDIR)$(confdir)/$$i; then \ if test -f $(DESTDIR)$(sysconfdir)/$$i; then \
$(MV) $(DESTDIR)$(confdir)/$$i $(DESTDIR)$(confdir)/$$i.old; \ $(MV) $(DESTDIR)$(sysconfdir)/$$i $(DESTDIR)$(sysconfdir)/$$i.old; \
fi; \ fi; \
$(INSTALL_DATA) $$i $(DESTDIR)$(confdir); \ $(INSTALL_DATA) $$i $(DESTDIR)$(sysconfdir); \
done done
-@if test ! -f $(DESTDIR)$(confdir)/ircd.motd; then \ -@if test ! -f $(DESTDIR)$(sysconfdir)/ircd.motd; then \
echo "ircd: installing motd file (ircd.motd)"; \ echo "ircd: installing motd file (ircd.motd)"; \
$(INSTALL_DATA) ircd.motd $(DESTDIR)$(confdir); \ $(INSTALL_DATA) ircd.motd $(DESTDIR)$(sysconfdir); \
fi fi
-@if test -f $(DESTDIR)$(confdir)/links.txt; then \ -@if test -f $(DESTDIR)$(sysconfdir)/links.txt; then \
$(RM) $(DESTDIR)$(confdir)/links.txt; \ $(RM) $(DESTDIR)$(sysconfdir)/links.txt; \
fi fi
@echo "ircd: installing manpage" @echo "ircd: installing manpage"
@for i in $(MANPAGES); do \ @for i in $(MANPAGES); do \
if test ! -f $(DESTDIR)$(mandir)/$$i; then \ if test ! -f $(DESTDIR)$(mandir)/$(PROGRAM_PREFIX)$$i; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(mandir); \ $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/$(PROGRAM_PREFIX)$$i; \
fi; \ fi; \
done done

43
doc/away-notify.txt Normal file
View file

@ -0,0 +1,43 @@
away-notify client capability specification
----------------------------------------------
Copyright (c) 2012 Keith Buck <mr_flea@esper.net>.
Unlimited redistribution and modification of this document is allowed
provided that the above copyright notice and this permission notice
remains in tact.
The away-notify client capability allows a client to specify that it
would like to be notified when users are marked/unmarked as away. This
capability is referred to as 'away-notify' at capability negotiation
time.
This capability is designed to replace polling of WHO as a more
efficient method of tracking the away state of users in a channel. The
away-notify capability both conserves bandwidth as WHO requests are
not continually sent and allows the client to be notified immediately
upon a user setting or removing their away state (as opposed to when
WHO is next polled).
When this capability is enabled, clients will be sent an AWAY message
when a user sharing a channel with them sets or removes their away
state, as well as when a user joins and has an away message set.
(Note that AWAY will not be sent for joining users with no away
message set.)
The format of the AWAY message is as follows:
:nick!user@host AWAY [:message]
If the message is present, the user (specified by the nick!user@host
mask) is going away. If the message is not present, the user is
removing their away message/state.
To fully track the away state of users, clients should:
1) Enable the away-notify capability at negotiation time.
2) Execute WHO when joining a channel to capture the current away
state of all users in that channel.
3) Update state appropriately upon receiving an AWAY message.

View file

@ -514,6 +514,8 @@ general {
reject_duration = 5 minutes; reject_duration = 5 minutes;
throttle_duration = 60; throttle_duration = 60;
throttle_count = 4; throttle_count = 4;
max_ratelimit_tokens = 30;
away_interval = 30;
}; };
modules { modules {

View file

@ -1264,6 +1264,19 @@ general {
client_flood_burst_max = 5; client_flood_burst_max = 5;
client_flood_message_time = 1; client_flood_message_time = 1;
client_flood_message_num = 2; client_flood_message_num = 2;
/* max_ratelimit_tokens: the maximum number of ratelimit tokens that one
* user can accumulate. This attempts to limit the amount of outbound
* bandwidth one user can consume. Do not change unless you know what
* you're doing.
*/
max_ratelimit_tokens = 30;
/* away_interval: the minimum interval between AWAY commands. One
* additional AWAY command is allowed, and only marking as away
* counts.
*/
away_interval = 30;
}; };
modules { modules {

View file

@ -16,7 +16,14 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_SUID = @INSTALL_PROGRAM@ -o root -m 4755 INSTALL_SUID = @INSTALL_PROGRAM@ -o root -m 4755
SHELL = /bin/sh SHELL = /bin/sh
AUTOMODULEDIR = @moduledir@/extensions
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
pkglibdir = @pkglibdir@
moduledir = @moduledir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
AUTOMODULEDIR = $(moduledir)/extensions
SSL_LIBS = @SSL_LIBS@ SSL_LIBS = @SSL_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@ SSL_INCLUDES = @SSL_INCLUDES@
@ -98,7 +105,7 @@ install: all
.SUFFIXES: .so .SUFFIXES: .so
.c.so: .c.so:
${CC} ${PICFLAGS} ${CPPFLAGS} ${CFLAGS} $< -o $@ ${CC} ${PICFLAGS} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} $< -o $@
.PHONY: depend clean distclean .PHONY: depend clean distclean
depend: depend:

View file

@ -47,25 +47,28 @@ DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3526 $"); ip_cloaking_hfnlist, "$Revision: 3526 $");
static void static void
distribute_hostchange(struct Client *client) distribute_hostchange(struct Client *client_p, char *newhost)
{ {
if (irccmp(client->host, client->orighost)) if (newhost != client_p->orighost)
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
client->host); client_p->host);
else else
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :hostname reset", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
client->host); client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s", CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s", CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
if (irccmp(client->host, client->orighost))
SetDynSpoof(client); change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else else
ClearDynSpoof(client); ClearDynSpoof(client_p);
} }
static void static void
@ -179,8 +182,7 @@ check_umode_change(void *vdata)
} }
if (strcmp(source_p->host, source_p->localClient->mangledhost)) if (strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN + 1); distribute_hostchange(source_p, source_p->localClient->mangledhost);
distribute_hostchange(source_p);
} }
else /* not really nice, but we need to send this numeric here */ else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
@ -191,8 +193,7 @@ check_umode_change(void *vdata)
if (source_p->localClient->mangledhost != NULL && if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) !strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN + 1); distribute_hostchange(source_p, source_p->orighost);
distribute_hostchange(source_p);
} }
} }
} }

View file

@ -44,25 +44,28 @@ DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3526 $"); ip_cloaking_hfnlist, "$Revision: 3526 $");
static void static void
distribute_hostchange(struct Client *client) distribute_hostchange(struct Client *client_p, char *newhost)
{ {
if (irccmp(client->host, client->orighost)) if (newhost != client_p->orighost)
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
client->host); client_p->host);
else else
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :hostname reset", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
client->host); client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s", CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s", CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
if (irccmp(client->host, client->orighost))
SetDynSpoof(client); change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else else
ClearDynSpoof(client); ClearDynSpoof(client_p);
} }
#define Nval 0x8c3a48ac #define Nval 0x8c3a48ac
@ -186,8 +189,7 @@ check_umode_change(void *vdata)
} }
if (strcmp(source_p->host, source_p->localClient->mangledhost)) if (strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN); distribute_hostchange(source_p, source_p->localClient->mangledhost);
distribute_hostchange(source_p);
} }
else /* not really nice, but we need to send this numeric here */ else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
@ -198,8 +200,7 @@ check_umode_change(void *vdata)
if (source_p->localClient->mangledhost != NULL && if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) !strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN); distribute_hostchange(source_p, source_p->orighost);
distribute_hostchange(source_p);
} }
} }
} }

View file

@ -47,25 +47,28 @@ DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3526 $"); ip_cloaking_hfnlist, "$Revision: 3526 $");
static void static void
distribute_hostchange(struct Client *client) distribute_hostchange(struct Client *client_p, char *newhost)
{ {
if (irccmp(client->host, client->orighost)) if (newhost != client_p->orighost)
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
client->host); client_p->host);
else else
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :hostname reset", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
client->host); client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s", CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s", CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
if (irccmp(client->host, client->orighost))
SetDynSpoof(client); change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else else
ClearDynSpoof(client); ClearDynSpoof(client_p);
} }
static void static void
@ -179,8 +182,7 @@ check_umode_change(void *vdata)
} }
if (strcmp(source_p->host, source_p->localClient->mangledhost)) if (strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN + 1); distribute_hostchange(source_p, source_p->localClient->mangledhost);
distribute_hostchange(source_p);
} }
else /* not really nice, but we need to send this numeric here */ else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
@ -191,8 +193,7 @@ check_umode_change(void *vdata)
if (source_p->localClient->mangledhost != NULL && if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) !strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN + 1); distribute_hostchange(source_p, source_p->orighost);
distribute_hostchange(source_p);
} }
} }
} }

View file

@ -44,25 +44,28 @@ DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3522 $"); ip_cloaking_hfnlist, "$Revision: 3522 $");
static void static void
distribute_hostchange(struct Client *client) distribute_hostchange(struct Client *client_p, char *newhost)
{ {
if (irccmp(client->host, client->orighost)) if (newhost != client_p->orighost)
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
client->host); client_p->host);
else else
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :hostname reset", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
client->host); client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s", CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s", CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
if (irccmp(client->host, client->orighost))
SetDynSpoof(client); change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else else
ClearDynSpoof(client); ClearDynSpoof(client_p);
} }
static void static void
@ -128,8 +131,7 @@ check_umode_change(void *vdata)
} }
if (strcmp(source_p->host, source_p->localClient->mangledhost)) if (strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN); distribute_hostchange(source_p, source_p->localClient->mangledhost);
distribute_hostchange(source_p);
} }
else /* not really nice, but we need to send this numeric here */ else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
@ -140,8 +142,7 @@ check_umode_change(void *vdata)
if (source_p->localClient->mangledhost != NULL && if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) !strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN); distribute_hostchange(source_p, source_p->orighost);
distribute_hostchange(source_p);
} }
} }
} }

View file

@ -7,7 +7,9 @@ INSTALL_DATA= @INSTALL_DATA@
RM= @RM@ RM= @RM@
prefix= @prefix@ prefix= @prefix@
exec_prefix= @execprefix@ exec_prefix= @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
helpdir= @helpdir@ helpdir= @helpdir@
uhelpdir= ${helpdir}/users uhelpdir= ${helpdir}/users
ohelpdir= ${helpdir}/opers ohelpdir= ${helpdir}/opers

View file

@ -237,7 +237,7 @@ struct LocalUser
struct DNSQuery *dnsquery; /* for outgoing server's name lookup */ struct DNSQuery *dnsquery; /* for outgoing server's name lookup */
time_t last_away; /* Away since... */ time_t next_away; /* Don't allow next away before... */
time_t last; time_t last;
/* clients allowed to talk through +g */ /* clients allowed to talk through +g */
@ -252,8 +252,6 @@ struct LocalUser
* to avoid flooding. * to avoid flooding.
* -- adrian * -- adrian
*/ */
int dummy1;
int dummy0;
int sent_parsed; /* how many messages we've parsed in this second */ int sent_parsed; /* how many messages we've parsed in this second */
time_t last_knock; /* time of last knock */ time_t last_knock; /* time of last knock */
unsigned long random_ping; unsigned long random_ping;
@ -268,6 +266,10 @@ struct LocalUser
unsigned int targets_free; /* free targets */ unsigned int targets_free; /* free targets */
time_t target_last; /* last time we cleared a slot */ time_t target_last; /* last time we cleared a slot */
/* ratelimit items */
time_t ratelimit;
unsigned int join_who_credits;
struct ListClient *safelist_data; struct ListClient *safelist_data;
char *mangledhost; /* non-NULL if host mangling module loaded and char *mangledhost; /* non-NULL if host mangling module loaded and
@ -444,6 +446,7 @@ struct ListClient
#define CLICAP_SASL 0x0002 #define CLICAP_SASL 0x0002
#define CLICAP_ACCOUNT_NOTIFY 0x0004 #define CLICAP_ACCOUNT_NOTIFY 0x0004
#define CLICAP_EXTENDED_JOIN 0x0008 #define CLICAP_EXTENDED_JOIN 0x0008
#define CLICAP_AWAY_NOTIFY 0x0010
/* /*
* flags macros. * flags macros.

View file

@ -59,14 +59,13 @@
#define HPATH HELP_DIR "/opers" #define HPATH HELP_DIR "/opers"
/* files */ /* files */
#define SPATH BINPATH "/ircd" /* ircd executable */ #define SPATH BINPATH "/" PROGRAM_PREFIX "ircd" /* ircd executable */
#define LIPATH LIBPATH "/libircd" SHARED_SUFFIX /* ircd library */
#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */ #define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */
#define MPATH ETCPATH "/ircd.motd" /* MOTD file */ #define MPATH ETCPATH "/ircd.motd" /* MOTD file */
#define LPATH LOGPATH "/ircd.log" /* ircd logfile */ #define LPATH LOGPATH "/ircd.log" /* ircd logfile */
#define PPATH ETCPATH "/ircd.pid" /* pid file */ #define PPATH PKGRUNDIR "/ircd.pid" /* pid file */
#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */ #define OPATH ETCPATH "/opers.motd" /* oper MOTD file */
#define DBPATH ETCPATH "/ban.db" /* bandb file */ #define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */
/* IGNORE_BOGUS_TS /* IGNORE_BOGUS_TS
* Ignore bogus timestamps from other servers. Yes this will desync * Ignore bogus timestamps from other servers. Yes this will desync

View file

@ -380,6 +380,7 @@ extern const char *form_str(int);
#define ERR_SASLTOOLONG 905 #define ERR_SASLTOOLONG 905
#define ERR_SASLABORTED 906 #define ERR_SASLABORTED 906
#define ERR_SASLALREADY 907 #define ERR_SASLALREADY 907
#define RPL_SASLMECHS 908
#define ERR_LAST_ERR_MSG 999 #define ERR_LAST_ERR_MSG 999

30
include/ratelimit.h Normal file
View file

@ -0,0 +1,30 @@
/*
* charybdis: an advanced Internet Relay Chat Daemon(ircd).
*
* Copyright (C) 2012 Keith Buck <mr_flea@esper.net>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice is present in all copies.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef INCLUDED_ratelimit_h
#define INCLUDED_ratelimit_h
int ratelimit_client(struct Client *client_p, unsigned int penalty);
int ratelimit_client_who(struct Client *client_p, unsigned int penalty);
void credit_client_join(struct Client *client_p);
#endif /* INCLUDED_ratelimit_h */

View file

@ -224,6 +224,8 @@ struct config_file_entry
int global_snotices; int global_snotices;
int operspy_dont_care_user_info; int operspy_dont_care_user_info;
int use_propagated_bans; int use_propagated_bans;
int max_ratelimit_tokens;
int away_interval;
int client_flood_max_lines; int client_flood_max_lines;
int client_flood_burst_rate; int client_flood_burst_rate;

View file

@ -67,6 +67,7 @@ struct ServerStatistics
unsigned int is_ssuc; /* successful sasl authentications */ unsigned int is_ssuc; /* successful sasl authentications */
unsigned int is_sbad; /* failed sasl authentications */ unsigned int is_sbad; /* failed sasl authentications */
unsigned int is_tgch; /* messages blocked due to target change */ unsigned int is_tgch; /* messages blocked due to target change */
unsigned int is_rl; /* commands blocked due to ratelimit */
}; };
extern struct ServerStatistics ServerStats; extern struct ServerStatistics ServerStats;

View file

@ -183,7 +183,7 @@
/* Define to 1 if you have the <wait.h> header file. */ /* Define to 1 if you have the <wait.h> header file. */
#undef HAVE_WAIT_H #undef HAVE_WAIT_H
/* Prefix where help file are installed. */ /* Prefix where help files are installed. */
#undef HELP_DIR #undef HELP_DIR
/* Prefix where the ircd is installed. */ /* Prefix where the ircd is installed. */
@ -246,6 +246,18 @@
/* Size of the pre-client heap. */ /* Size of the pre-client heap. */
#undef PCLIENT_HEAP_SIZE #undef PCLIENT_HEAP_SIZE
/* Directory where binaries the IRCd itself spawns live */
#undef PKGLIBEXECDIR
/* Directory in which to store state, such as band database */
#undef PKGLOCALSTATEDIR
/* Directory to store pidfile in. */
#undef PKGRUNDIR
/* String with which all programs intended to be in PATH are prefixed. */
#undef PROGRAM_PREFIX
/* This is the type of IO loop we are using */ /* This is the type of IO loop we are using */
#undef SELECT_TYPE #undef SELECT_TYPE

View file

@ -2,8 +2,17 @@
AC_DEFUN([AC_DEFINE_DIR], [ AC_DEFUN([AC_DEFINE_DIR], [
test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo [$]$2` last_ac_define_dir=`eval echo [$]$2`
ac_define_dir=`eval echo [$]ac_define_dir` ac_define_dir=`eval echo [$]last_ac_define_dir`
ac_define_dir_counter=0
while test "x[$]last_ac_define_dir" != "x[$]ac_define_dir"; do
last_ac_define_dir="[$]ac_define_dir"
ac_define_dir=`eval echo [$]last_ac_define_dir`
AS_VAR_ARITH([ac_define_dir_counter], [$ac_define_dir_counter + 1])
AS_VAR_IF([ac_define_dir_counter], [128],
[AC_MSG_ERROR([detected recusive directory expansion when expanding $1=[$]$2: [$]ac_define_dir])
break])
done
$1="$ac_define_dir" $1="$ac_define_dir"
AC_SUBST($1) AC_SUBST($1)
ifelse($3, , ifelse($3, ,

File diff suppressed because it is too large Load diff

View file

@ -28,7 +28,11 @@ SSL_INCLUDES = @SSL_INCLUDES@
IRCDLIBS = @LIBS@ $(SSL_LIBS) IRCDLIBS = @LIBS@ $(SSL_LIBS)
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
pkglibdir = @pkglibdir@
moduledir = @moduledir@ moduledir = @moduledir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
# Change this later! -- adrian # Change this later! -- adrian
automoduledir = @moduledir@/autoload automoduledir = @moduledir@/autoload
@ -152,9 +156,6 @@ libmodules.a: $(S_OBJS) static_modules.o
install-mkdirs: install-mkdirs:
@echo "ircd: setting up modular directory structure" @echo "ircd: setting up modular directory structure"
-@if test ! -d $(DESTDIR)$(moduledir); then \
mkdir $(DESTDIR)$(moduledir); \
fi
-@if test -d $(DESTDIR)$(moduledir)-old; then \ -@if test -d $(DESTDIR)$(moduledir)-old; then \
rm -rf $(DESTDIR)$(moduledir)-old; \ rm -rf $(DESTDIR)$(moduledir)-old; \
fi fi
@ -195,7 +196,7 @@ install_hpux_shared: install-mkdirs
${CC} ${CPPFLAGS} ${CFLAGS} -DMODNAME=`basename $< .c`_mheader -c $< -o $@ ${CC} ${CPPFLAGS} ${CFLAGS} -DMODNAME=`basename $< .c`_mheader -c $< -o $@
.c.so: .c.so:
${CC} ${PICFLAGS} ${CPPFLAGS} ${CFLAGS} $< -o $@ ${CC} ${PICFLAGS} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} $< -o $@
.so.sl: .so.sl:
$(LD) -b $< -o $@ $(LD) -b $< -o $@

View file

@ -41,6 +41,7 @@
#include "modules.h" #include "modules.h"
#include "packet.h" #include "packet.h"
#include "chmode.h" #include "chmode.h"
#include "ratelimit.h"
static int m_join(struct Client *, struct Client *, int, const char **); static int m_join(struct Client *, struct Client *, int, const char **);
static int ms_join(struct Client *, struct Client *, int, const char **); static int ms_join(struct Client *, struct Client *, int, const char **);
@ -325,6 +326,9 @@ m_join(struct Client *client_p, struct Client *source_p, int parc, const char *p
} }
chptr->join_count++; chptr->join_count++;
/* credit user for join */
credit_client_join(source_p);
/* we send the user their join here, because we could have to /* we send the user their join here, because we could have to
* send a mode out next. * send a mode out next.
*/ */
@ -1268,7 +1272,8 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
banptr = ptr->data; banptr = ptr->data;
/* trailing space, and the mode letter itself */ /* trailing space, and the mode letter itself */
plen = strlen(banptr->banstr) + 2; plen = strlen(banptr->banstr) +
(banptr->forward ? strlen(banptr->forward) + 1 : 0) + 2;
if(count >= MAXMODEPARAMS || (cur_len + plen) > BUFSIZE - 4) if(count >= MAXMODEPARAMS || (cur_len + plen) > BUFSIZE - 4)
{ {
@ -1286,7 +1291,10 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
*mbuf++ = c; *mbuf++ = c;
cur_len += plen; cur_len += plen;
pbuf += rb_sprintf(pbuf, "%s ", banptr->banstr); if (banptr->forward)
pbuf += rb_sprintf(pbuf, "%s$%s ", banptr->banstr, banptr->forward);
else
pbuf += rb_sprintf(pbuf, "%s ", banptr->banstr);
count++; count++;
free_ban(banptr); free_ban(banptr);

View file

@ -240,6 +240,35 @@ ms_mlock(struct Client *client_p, struct Client *source_p, int parc, const char
return 0; return 0;
} }
static void
possibly_remove_lower_forward(struct Client *fakesource_p, int mems,
struct Channel *chptr, rb_dlink_list *banlist, int mchar,
const char *mask, const char *forward)
{
struct Ban *actualBan;
rb_dlink_node *ptr;
RB_DLINK_FOREACH(ptr, banlist->head)
{
actualBan = ptr->data;
if(!irccmp(actualBan->banstr, mask) &&
(actualBan->forward == NULL ||
irccmp(actualBan->forward, forward) < 0))
{
sendto_channel_local(mems, chptr, ":%s MODE %s -%c %s%s%s",
fakesource_p->name,
chptr->chname,
mchar,
actualBan->banstr,
actualBan->forward ? "$" : "",
actualBan->forward ? actualBan->forward : "");
rb_dlinkDelete(&actualBan->node, banlist);
free_ban(actualBan);
return;
}
}
}
static int static int
ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
@ -346,7 +375,9 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
{ {
*forward++ = '\0'; *forward++ = '\0';
if(*forward == '\0') if(*forward == '\0')
forward = NULL; tlen--, forward = NULL;
possibly_remove_lower_forward(fakesource_p, mems,
chptr, banlist, parv[3][0], s, forward);
} }
if(add_id(fakesource_p, chptr, s, forward, banlist, mode_type)) if(add_id(fakesource_p, chptr, s, forward, banlist, mode_type))
@ -358,14 +389,15 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
*mbuf = '\0'; *mbuf = '\0';
*(pbuf - 1) = '\0'; *(pbuf - 1) = '\0';
sendto_channel_local(mems, chptr, "%s %s", modebuf, parabuf); sendto_channel_local(mems, chptr, "%s %s", modebuf, parabuf);
sendto_server(client_p, chptr, needcap, CAP_TS6,
"%s %s", modebuf, parabuf);
mbuf = modebuf + mlen; mbuf = modebuf + mlen;
pbuf = parabuf; pbuf = parabuf;
plen = modecount = 0; plen = modecount = 0;
} }
if (forward != NULL)
forward[-1] = '$';
*mbuf++ = parv[3][0]; *mbuf++ = parv[3][0];
arglen = rb_sprintf(pbuf, "%s ", s); arglen = rb_sprintf(pbuf, "%s ", s);
pbuf += arglen; pbuf += arglen;
@ -393,7 +425,6 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
*mbuf = '\0'; *mbuf = '\0';
*(pbuf - 1) = '\0'; *(pbuf - 1) = '\0';
sendto_channel_local(mems, chptr, "%s %s", modebuf, parabuf); sendto_channel_local(mems, chptr, "%s %s", modebuf, parabuf);
sendto_server(client_p, chptr, needcap, CAP_TS6, "%s %s", modebuf, parabuf);
} }
sendto_server(client_p, chptr, CAP_TS6 | needcap, NOCAPS, ":%s BMASK %ld %s %s :%s", sendto_server(client_p, chptr, CAP_TS6 | needcap, NOCAPS, ":%s BMASK %ld %s %s :%s",

View file

@ -37,7 +37,6 @@
#include "s_serv.h" #include "s_serv.h"
#include "packet.h" #include "packet.h"
static int m_away(struct Client *, struct Client *, int, const char **); static int m_away(struct Client *, struct Client *, int, const char **);
struct Message away_msgtab = { struct Message away_msgtab = {
@ -69,7 +68,8 @@ DECLARE_MODULE_AV1(away, NULL, NULL, away_clist, NULL, NULL, "$Revision: 3370 $"
static int static int
m_away(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_away(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(MyClient(source_p) && !IsFloodDone(source_p)) if(MyClient(source_p) && source_p->localClient->next_away &&
!IsFloodDone(source_p))
flood_endgrace(source_p); flood_endgrace(source_p);
if(!IsClient(source_p)) if(!IsClient(source_p))
@ -84,12 +84,33 @@ m_away(struct Client *client_p, struct Client *source_p, int parc, const char *p
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
":%s AWAY", use_id(source_p)); ":%s AWAY", use_id(source_p));
free_away(source_p); free_away(source_p);
sendto_common_channels_local_butone(source_p, CLICAP_AWAY_NOTIFY, ":%s!%s@%s AWAY",
source_p->name, source_p->username, source_p->host);
} }
if(MyConnect(source_p)) if(MyConnect(source_p))
sendto_one_numeric(source_p, RPL_UNAWAY, form_str(RPL_UNAWAY)); sendto_one_numeric(source_p, RPL_UNAWAY, form_str(RPL_UNAWAY));
return 0; return 0;
} }
/* Rate limit this because it is sent to common channels. */
if (MyClient(source_p))
{
if(!IsOper(source_p) &&
source_p->localClient->next_away > rb_current_time())
{
sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "AWAY");
return;
}
if(source_p->localClient->next_away < rb_current_time() -
ConfigFileEntry.away_interval)
source_p->localClient->next_away = rb_current_time();
else
source_p->localClient->next_away = rb_current_time() +
ConfigFileEntry.away_interval;
}
if(source_p->user->away == NULL) if(source_p->user->away == NULL)
allocate_away(source_p); allocate_away(source_p);
if(strncmp(source_p->user->away, parv[1], AWAYLEN - 1)) if(strncmp(source_p->user->away, parv[1], AWAYLEN - 1))
@ -97,8 +118,15 @@ m_away(struct Client *client_p, struct Client *source_p, int parc, const char *p
rb_strlcpy(source_p->user->away, parv[1], AWAYLEN); rb_strlcpy(source_p->user->away, parv[1], AWAYLEN);
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
":%s AWAY :%s", use_id(source_p), source_p->user->away); ":%s AWAY :%s", use_id(source_p), source_p->user->away);
sendto_common_channels_local_butone(source_p,
CLICAP_AWAY_NOTIFY,
":%s!%s@%s AWAY :%s",
source_p->name,
source_p->username,
source_p->host,
source_p->user->away);
} }
if(MyConnect(source_p)) if(MyConnect(source_p))
sendto_one_numeric(source_p, RPL_NOWAWAY, form_str(RPL_NOWAWAY)); sendto_one_numeric(source_p, RPL_NOWAWAY, form_str(RPL_NOWAWAY));

View file

@ -72,6 +72,7 @@ static struct clicap
_CLICAP("sasl", CLICAP_SASL, 0, 0), _CLICAP("sasl", CLICAP_SASL, 0, 0),
_CLICAP("account-notify", CLICAP_ACCOUNT_NOTIFY, 0, 0), _CLICAP("account-notify", CLICAP_ACCOUNT_NOTIFY, 0, 0),
_CLICAP("extended-join", CLICAP_EXTENDED_JOIN, 0, 0), _CLICAP("extended-join", CLICAP_EXTENDED_JOIN, 0, 0),
_CLICAP("away-notify", CLICAP_AWAY_NOTIFY, 0, 0),
}; };
#define CLICAP_LIST_LEN (sizeof(clicap_list) / sizeof(struct clicap)) #define CLICAP_LIST_LEN (sizeof(clicap_list) / sizeof(struct clicap))

View file

@ -518,6 +518,18 @@ static struct InfoStruct info_table[] = {
&ConfigFileEntry.use_propagated_bans, &ConfigFileEntry.use_propagated_bans,
"KLINE sets fully propagated bans" "KLINE sets fully propagated bans"
}, },
{
"max_ratelimit_tokens",
OUTPUT_DECIMAL,
&ConfigFileEntry.max_ratelimit_tokens,
"The maximum number of tokens that can be accumulated for executing rate-limited commands",
},
{
"away_interval",
OUTPUT_DECIMAL,
&ConfigFileEntry.away_interval,
"The minimum time between aways",
},
{ {
"default_split_server_count", "default_split_server_count",
OUTPUT_DECIMAL, OUTPUT_DECIMAL,

View file

@ -36,6 +36,7 @@
#include "modules.h" #include "modules.h"
#include "s_conf.h" #include "s_conf.h"
#include "cache.h" #include "cache.h"
#include "ratelimit.h"
static int m_motd(struct Client *, struct Client *, int, const char **); static int m_motd(struct Client *, struct Client *, int, const char **);
static int mo_motd(struct Client *, struct Client *, int, const char **); static int mo_motd(struct Client *, struct Client *, int, const char **);
@ -66,7 +67,7 @@ m_motd(struct Client *client_p, struct Client *source_p, int parc, const char *p
{ {
static time_t last_used = 0; static time_t last_used = 0;
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) if((last_used + ConfigFileEntry.pace_wait) > rb_current_time() || !ratelimit_client(source_p, 6))
{ {
/* safe enough to give this on a local connect only */ /* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI), sendto_one(source_p, form_str(RPL_LOAD2HI),

View file

@ -40,12 +40,13 @@
#include "s_conf.h" #include "s_conf.h"
#include "s_newconf.h" #include "s_newconf.h"
static int m_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int me_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static int me_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int mo_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static int mo_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message privs_msgtab = { struct Message privs_msgtab = {
"PRIVS", 0, 0, 0, MFLG_SLOW, "PRIVS", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_privs, 0}, {mo_privs, 0}} {mg_unreg, {m_privs, 0}, mg_ignore, mg_ignore, {me_privs, 0}, {mo_privs, 0}}
}; };
mapi_clist_av1 privs_clist[] = { mapi_clist_av1 privs_clist[] = {
@ -151,3 +152,16 @@ static int mo_privs(struct Client *client_p, struct Client *source_p, int parc,
use_id(target_p)); use_id(target_p));
return 0; return 0;
} }
static int m_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if (parc >= 2 && !EmptyString(parv[1]) &&
irccmp(parv[1], source_p->name)) {
sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str(ERR_NOPRIVILEGES));
return 0;
}
show_privs(source_p, source_p);
return 0;
}

View file

@ -133,7 +133,7 @@ static struct StatsStruct stats_cmd_table[] = {
{'b', stats_delay, 1, 1, }, {'b', stats_delay, 1, 1, },
{'B', stats_hash, 1, 1, }, {'B', stats_hash, 1, 1, },
{'c', stats_connect, 0, 0, }, {'c', stats_connect, 0, 0, },
{'C', stats_capability, 1, 1, }, {'C', stats_capability, 1, 0, },
{'d', stats_tdeny, 1, 0, }, {'d', stats_tdeny, 1, 0, },
{'D', stats_deny, 1, 0, }, {'D', stats_deny, 1, 0, },
{'e', stats_exempt, 1, 0, }, {'e', stats_exempt, 1, 0, },
@ -944,6 +944,8 @@ stats_tstats (struct Client *source_p)
sendto_one_numeric(source_p, RPL_STATSDEBUG, sendto_one_numeric(source_p, RPL_STATSDEBUG,
"T :tgchange blocked msgs %u restricted addrs %lu", "T :tgchange blocked msgs %u restricted addrs %lu",
sp.is_tgch, rb_dlink_list_length(&tgchange_list)); sp.is_tgch, rb_dlink_list_length(&tgchange_list));
sendto_one_numeric(source_p, RPL_STATSDEBUG,
"T :ratelimit blocked commands %u", sp.is_rl);
sendto_one_numeric(source_p, RPL_STATSDEBUG, sendto_one_numeric(source_p, RPL_STATSDEBUG,
"T :auth successes %u fails %u", "T :auth successes %u fails %u",
sp.is_asuc, sp.is_abad); sp.is_asuc, sp.is_abad);

View file

@ -40,6 +40,7 @@
#include "modules.h" #include "modules.h"
#include "packet.h" #include "packet.h"
#include "s_newconf.h" #include "s_newconf.h"
#include "ratelimit.h"
#define FIELD_CHANNEL 0x0001 #define FIELD_CHANNEL 0x0001
#define FIELD_HOP 0x0002 #define FIELD_HOP 0x0002
@ -177,8 +178,18 @@ m_who(struct Client *client_p, struct Client *source_p, int parc, const char *pa
{ {
/* List all users on a given channel */ /* List all users on a given channel */
chptr = find_channel(parv[1] + operspy); chptr = find_channel(parv[1] + operspy);
if(chptr != NULL) if(chptr != NULL)
{ {
if (!IsOper(source_p) && !ratelimit_client_who(source_p, rb_dlink_list_length(&chptr->members)/50))
{
sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "WHO");
sendto_one(source_p, form_str(RPL_ENDOFWHO),
me.name, source_p->name, "*");
return 0;
}
if(operspy) if(operspy)
report_operspy(source_p, "WHO", chptr->chname); report_operspy(source_p, "WHO", chptr->chname);
@ -187,6 +198,7 @@ m_who(struct Client *client_p, struct Client *source_p, int parc, const char *pa
else if(!SecretChannel(chptr)) else if(!SecretChannel(chptr))
do_who_on_channel(source_p, chptr, server_oper, NO, &fmt); do_who_on_channel(source_p, chptr, server_oper, NO, &fmt);
} }
sendto_one(source_p, form_str(RPL_ENDOFWHO), sendto_one(source_p, form_str(RPL_ENDOFWHO),
me.name, source_p->name, parv[1] + operspy); me.name, source_p->name, parv[1] + operspy);
return 0; return 0;
@ -233,7 +245,7 @@ m_who(struct Client *client_p, struct Client *source_p, int parc, const char *pa
/* it has to be a global who at this point, limit it */ /* it has to be a global who at this point, limit it */
if(!IsOper(source_p)) if(!IsOper(source_p))
{ {
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) if((last_used + ConfigFileEntry.pace_wait) > rb_current_time() || !ratelimit_client(source_p, 1))
{ {
sendto_one(source_p, form_str(RPL_LOAD2HI), sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "WHO"); me.name, source_p->name, "WHO");

View file

@ -44,6 +44,7 @@
#include "hook.h" #include "hook.h"
#include "s_newconf.h" #include "s_newconf.h"
#include "ipv4_from_ipv6.h" #include "ipv4_from_ipv6.h"
#include "ratelimit.h"
static void do_whois(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void do_whois(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void single_whois(struct Client *source_p, struct Client *target_p, int operspy); static void single_whois(struct Client *source_p, struct Client *target_p, int operspy);
@ -89,7 +90,7 @@ m_whois(struct Client *client_p, struct Client *source_p, int parc, const char *
if(!IsOper(source_p)) if(!IsOper(source_p))
{ {
/* seeing as this is going across servers, we should limit it */ /* seeing as this is going across servers, we should limit it */
if((last_used + ConfigFileEntry.pace_wait_simple) > rb_current_time()) if((last_used + ConfigFileEntry.pace_wait_simple) > rb_current_time() || !ratelimit_client(source_p, 2))
{ {
sendto_one(source_p, form_str(RPL_LOAD2HI), sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "WHOIS"); me.name, source_p->name, "WHOIS");

File diff suppressed because it is too large Load diff

View file

@ -12,7 +12,7 @@ RM = @RM@
LEX = @LEX@ LEX = @LEX@
LEXLIB = @LEXLIB@ LEXLIB = @LEXLIB@
PICFLAGS = @PICFLAGS@ PICFLAGS = @PICFLAGS@
CFLAGS = @IRC_CFLAGS@ -DIRCD_PREFIX=\"@prefix@\" CFLAGS = @IRC_CFLAGS@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
MKDEP = @MKDEP@ -DIRCD_PREFIX=\"@prefix@\" MKDEP = @MKDEP@ -DIRCD_PREFIX=\"@prefix@\"
MV = @MV@ MV = @MV@
@ -23,6 +23,9 @@ exec_prefix = @exec_prefix@
bindir = @bindir@ bindir = @bindir@
libdir = @libdir@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
pkglibexecdir = @pkglibexecdir@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
DOLLAR = $$ DOLLAR = $$
@ -36,7 +39,7 @@ SSL_INCLUDES = @SSL_INCLUDES@
IRCDLIBS = @MODULES_LIBS@ -L../libratbox/src/.libs -lratbox @LIBS@ $(SSL_LIBS) IRCDLIBS = @MODULES_LIBS@ -L../libratbox/src/.libs -lratbox @LIBS@ $(SSL_LIBS)
INCLUDES = -I../include -I../libratbox/include $(SSL_INCLUDES) INCLUDES = -I../include -I../libratbox/include $(SSL_INCLUDES)
CPPFLAGS = ${INCLUDES} @CPPFLAGS@ CPPFLAGS = ${INCLUDES} -DIRCD_PREFIX=\"@prefix@\" @CPPFLAGS@
default: all default: all
@ -46,8 +49,9 @@ y.tab.o: y.tab.c ircd_parser.y
# Note GNU bison uses <file>.tab.c not y.tab.c # Note GNU bison uses <file>.tab.c not y.tab.c
y.tab.c: ircd_parser.y y.tab.c: ircd_parser.y
${YACC} -d ircd_parser.y ${YACC} -d ircd_parser.y
y.tab.h: y.tab.c
lex.yy.o: lex.yy.c ircd_lexer.l lex.yy.o: lex.yy.c ircd_lexer.l y.tab.h
${CC} ${CPPFLAGS} ${PICFLAGS} ${CFLAGS} -I. -c lex.yy.c ${CC} ${CPPFLAGS} ${PICFLAGS} ${CFLAGS} -I. -c lex.yy.c
lex.yy.c: ircd_lexer.l lex.yy.c: ircd_lexer.l
@ -82,6 +86,7 @@ SRCS = \
packet.c \ packet.c \
parse.c \ parse.c \
privilege.c \ privilege.c \
ratelimit.c \
res.c \ res.c \
reslib.c \ reslib.c \
reject.c \ reject.c \
@ -131,10 +136,10 @@ install: install-mkdirs build
fi fi
@echo "ircd: installing ircd ($(PROGS))" @echo "ircd: installing ircd ($(PROGS))"
@for i in $(PROGS); do \ @for i in $(PROGS); do \
if test -f $(DESTDIR)$(bindir)/$$i; then \ if test -f $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; then \
$(MV) $(DESTDIR)$(bindir)/$$i $(DESTDIR)$(bindir)/$$i.old; \ $(MV) $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i.old; \
fi; \ fi; \
$(INSTALL_BIN) $$i $(DESTDIR)$(bindir); \ $(INSTALL_BIN) $$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; \
done done
version.c: version.c.SH version.c: version.c.SH

View file

@ -82,10 +82,10 @@ start_bandb(void)
const char *suffix = ""; const char *suffix = "";
#endif #endif
rb_setenv("BANDB_DPATH", ConfigFileEntry.dpath, 1); rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1);
if(bandb_path == NULL) if(bandb_path == NULL)
{ {
rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", BINPATH, suffix); rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix);
if(access(fullpath, X_OK) == -1) if(access(fullpath, X_OK) == -1)
{ {
@ -95,8 +95,8 @@ start_bandb(void)
if(access(fullpath, X_OK) == -1) if(access(fullpath, X_OK) == -1)
{ {
ilog(L_MAIN, ilog(L_MAIN,
"Unable to execute bandb in %s or %s/bin", "Unable to execute bandb%s in %s or %s/bin",
BINPATH, ConfigFileEntry.dpath); suffix, PKGLIBEXECDIR, ConfigFileEntry.dpath);
return 0; return 0;
} }
} }

View file

@ -136,6 +136,12 @@ send_channel_join(struct Channel *chptr, struct Client *client_p)
client_p->name, client_p->username, client_p->host, chptr->chname, client_p->name, client_p->username, client_p->host, chptr->chname,
EmptyString(client_p->user->suser) ? "*" : client_p->user->suser, EmptyString(client_p->user->suser) ? "*" : client_p->user->suser,
client_p->info); client_p->info);
/* Send away message to away-notify enabled clients. */
if (client_p->user->away)
sendto_channel_local_with_capability_butone(client_p, ALL_MEMBERS, CLICAP_AWAY_NOTIFY, NOCAPS, chptr,
":%s!%s@%s AWAY :%s", client_p->name, client_p->username,
client_p->host, client_p->user->away);
} }
/* find_channel_membership() /* find_channel_membership()

View file

@ -941,9 +941,9 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
} }
if(removed && removed->forward) if(removed && removed->forward)
removed_mask_pos += rb_snprintf(buf, sizeof(buf), "%s$%s", removed->banstr, removed->forward); removed_mask_pos += rb_snprintf(buf + old_removed_mask_pos, sizeof(buf), "%s$%s", removed->banstr, removed->forward) + 1;
else else
removed_mask_pos += rb_strlcpy(buf, mask, sizeof(buf)); removed_mask_pos += rb_strlcpy(buf + old_removed_mask_pos, mask, sizeof(buf)) + 1;
if(removed) if(removed)
{ {
free_ban(removed); free_ban(removed);

View file

@ -933,7 +933,7 @@ static const char * replies[] = {
/* 905 ERR_SASLTOOLONG */ ":%s 905 %s :SASL message too long", /* 905 ERR_SASLTOOLONG */ ":%s 905 %s :SASL message too long",
/* 906 ERR_SASLABORTED */ ":%s 906 %s :SASL authentication aborted", /* 906 ERR_SASLABORTED */ ":%s 906 %s :SASL authentication aborted",
/* 907 ERR_SASLALREADY */ ":%s 907 %s :You have already completed SASL authentication", /* 907 ERR_SASLALREADY */ ":%s 907 %s :You have already completed SASL authentication",
/* 908 */ NULL, /* 908 RPL_SASLMECHS */ ":%s 908 %s %s :are available SASL mechanisms",
/* 909 */ NULL, /* 909 */ NULL,
/* 910 */ NULL, /* 910 */ NULL,
/* 911 */ NULL, /* 911 */ NULL,

View file

@ -2277,6 +2277,8 @@ static struct ConfEntry conf_general_table[] =
{ "client_flood_burst_max", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_burst_max }, { "client_flood_burst_max", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_burst_max },
{ "client_flood_message_num", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_num }, { "client_flood_message_num", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_num },
{ "client_flood_message_time", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_time }, { "client_flood_message_time", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_time },
{ "max_ratelimit_tokens", CF_INT, NULL, 0, &ConfigFileEntry.max_ratelimit_tokens },
{ "away_interval", CF_INT, NULL, 0, &ConfigFileEntry.away_interval },
{ "\0", 0, NULL, 0, NULL } { "\0", 0, NULL, 0, NULL }
}; };

132
src/ratelimit.c Normal file
View file

@ -0,0 +1,132 @@
/*
* charybdis: an advanced ircd
* ratelimit.c: Per-client ratelimiting for high-bandwidth commands.
*
* Copyright (c) 2012 Keith Buck <mr_flea -at- esper.net>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice is present in all copies.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "stdinc.h"
#include "s_conf.h"
#include "s_stats.h"
#include "ratelimit.h"
/*
* ratelimit_client(struct Client *client_p, int penalty)
*
* Applies a penalty to a client for executing a rate-limited command.
*
* Inputs:
* - the client to be rate-limited
* - the penalty to apply
*
* Outputs:
* - 1 if the user has been penalized and the command should be
* allowed to execute
* - 0 if the command should not execute and the user has not
* been penalized (they are executing commands too fast and have
* been rate-limited)
* The caller should return RPL_LOAD2HI
*
* Side effects:
* - The ratelimit for the user will be initialized if it hasn't
* been initialized yet.
*/
int ratelimit_client(struct Client *client_p, unsigned int penalty)
{
s_assert(client_p);
s_assert(MyClient(client_p));
if (!client_p->localClient->ratelimit)
{
/* Not initialized yet - do it now. */
client_p->localClient->ratelimit = rb_current_time() - ConfigFileEntry.max_ratelimit_tokens;
}
/* Don't make it impossible to execute anything. */
if (penalty > ConfigFileEntry.max_ratelimit_tokens)
penalty = ConfigFileEntry.max_ratelimit_tokens;
if (client_p->localClient->ratelimit <= rb_current_time() - ConfigFileEntry.max_ratelimit_tokens)
{
client_p->localClient->ratelimit = rb_current_time() - ConfigFileEntry.max_ratelimit_tokens + penalty;
return 1;
}
if (client_p->localClient->ratelimit + penalty > rb_current_time())
{
ServerStats.is_rl++;
return 0;
}
client_p->localClient->ratelimit += penalty;
return 1;
}
/*
* ratelimit_client_who(struct Client *client_p, int penalty)
*
* Rate-limits a client for a WHO query if they have no remaining "free"
* WHO queries to execute.
*
* Inputs:
* - same as ratelimit_client
*
* Outputs:
* - same as ratelimit_client
*
* Side effects:
* - A "free who" token will be removed from the user if one exists.
* If one doesn't exist, the user will be ratelimited as normal.
*/
int ratelimit_client_who(struct Client *client_p, unsigned int penalty)
{
s_assert(client_p);
s_assert(MyClient(client_p));
if (client_p->localClient->join_who_credits)
{
--client_p->localClient->join_who_credits;
return 1;
}
return ratelimit_client(client_p, penalty);
}
/*
* credit_client_join(struct Client *client_p)
*
* Gives a user a credit to execute a WHO for joining a channel.
*
* Inputs:
* - the client to be credited
*
* Outputs:
* - (none)
*
* Side effects:
* - (none)
*/
void credit_client_join(struct Client *client_p)
{
s_assert(client_p);
s_assert(MyClient(client_p));
++client_p->localClient->join_who_credits;
}

View file

@ -745,6 +745,8 @@ set_default_conf(void)
ConfigFileEntry.global_snotices = YES; ConfigFileEntry.global_snotices = YES;
ConfigFileEntry.operspy_dont_care_user_info = NO; ConfigFileEntry.operspy_dont_care_user_info = NO;
ConfigFileEntry.use_propagated_bans = YES; ConfigFileEntry.use_propagated_bans = YES;
ConfigFileEntry.max_ratelimit_tokens = 30;
ConfigFileEntry.away_interval = 30;
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
ConfigFileEntry.compression_level = 4; ConfigFileEntry.compression_level = 4;

View file

@ -500,7 +500,7 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
{ {
banptr = ptr->data; banptr = ptr->data;
tlen = strlen(banptr->banstr) + 1; tlen = strlen(banptr->banstr) + (banptr->forward ? strlen(banptr->forward) + 1 : 0) + 1;
/* uh oh */ /* uh oh */
if(cur_len + tlen > BUFSIZE - 3) if(cur_len + tlen > BUFSIZE - 3)
@ -519,7 +519,10 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
t = buf + mlen; t = buf + mlen;
} }
rb_sprintf(t, "%s ", banptr->banstr); if (banptr->forward)
rb_sprintf(t, "%s$%s ", banptr->banstr, banptr->forward);
else
rb_sprintf(t, "%s ", banptr->banstr);
t += tlen; t += tlen;
cur_len += tlen; cur_len += tlen;
} }

View file

@ -1468,6 +1468,12 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
*modeval = '\0'; *modeval = '\0';
} }
/* Resend away message to away-notify enabled clients. */
if (target_p->user->away)
sendto_common_channels_local_butone(target_p, CLICAP_AWAY_NOTIFY, ":%s!%s@%s AWAY :%s",
target_p->name, target_p->username, target_p->host,
target_p->user->away);
if(MyClient(target_p) && changed_case) if(MyClient(target_p) && changed_case)
sendto_one(target_p, ":%s!%s@%s NICK %s", sendto_one(target_p, ":%s!%s@%s NICK %s",
target_p->name, target_p->username, target_p->host, nick); target_p->name, target_p->username, target_p->host, nick);

View file

@ -261,7 +261,7 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
if(ssld_path == NULL) if(ssld_path == NULL)
{ {
rb_snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", BINPATH, suffix); rb_snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", PKGLIBEXECDIR, suffix);
if(access(fullpath, X_OK) == -1) if(access(fullpath, X_OK) == -1)
{ {
@ -270,8 +270,8 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
if(access(fullpath, X_OK) == -1) if(access(fullpath, X_OK) == -1)
{ {
ilog(L_MAIN, ilog(L_MAIN,
"Unable to execute ssld%s in %s/bin or %s", "Unable to execute ssld%s in %s or %s/bin",
ConfigFileEntry.dpath, suffix, BINPATH); suffix, PKGLIBEXECDIR, ConfigFileEntry.dpath);
return 0; return 0;
} }
} }

View file

@ -22,8 +22,12 @@ exec_prefix = @exec_prefix@
bindir = @bindir@ bindir = @bindir@
libdir = @libdir@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
confdir = @confdir@ pkglibexecdir = @pkglibexecdir@
sysconfdir = @sysconfdir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
ZIP_LIB = @ZLIB_LD@ ZIP_LIB = @ZLIB_LD@
@ -32,7 +36,8 @@ IRCDLIBS = @MODULES_LIBS@ -L../libratbox/src/.libs -lratbox @LIBS@ $(SSL_LIBS) $
INCLUDES = -I. -I../include -I../libratbox/include $(SSL_INCLUDES) INCLUDES = -I. -I../include -I../libratbox/include $(SSL_INCLUDES)
CPPFLAGS = ${INCLUDES} @CPPFLAGS@ CPPFLAGS = ${INCLUDES} @CPPFLAGS@
PROGS = ssld pkglibexec_PROGS = ssld
PROGS = $(pkglibexec_PROGS)
SOURCES = \ SOURCES = \
ssld.c ssld.c
@ -47,14 +52,27 @@ build: all
ssld: ${OBJECTS} ssld: ${OBJECTS}
${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${IRCDLIBS} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${IRCDLIBS}
install: build install-mkdirs:
-@for dir in '$(bindir)' '$(pkglibexecdir)'; do \
if test ! -d '$(DESTDIR)'"$${dir}"; then \
mkdir -p -m 755 '$(DESTDIR)'"$${dir}"; \
fi; \
done
install: install-mkdirs build
@echo "ircd: installing ssld ($(PROGS))" @echo "ircd: installing ssld ($(PROGS))"
@for i in $(PROGS); do \ @for i in $(bin_PROGS); do \
if test -f $(DESTDIR)$(bindir)/$$i; then \ if test -f $(DESTDIR)$(bindir)/$$i; then \
$(MV) $(DESTDIR)$(bindir)/$$i $(DESTDIR)$(bindir)/$$i.old; \ $(MV) $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i.old; \
fi; \ fi; \
$(INSTALL_BIN) $$i $(DESTDIR)$(bindir); \ $(INSTALL_BIN) $$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; \
done done
@for i in $(pkglibexec_PROGS); do \
if test -f '$(DESTDIR)$(pkglibexecdir)/'$$i; then \
$(MV) '$(DESTDIR)$(pkglibexecdir)/'$$i '$(DESTDIR)$(pkglibexecdir)/'$$i.old; \
fi; \
$(INSTALL_BIN) $$i '$(DESTDIR)$(pkglibexecdir)/'$$i; \
done
.c.o: .c.o:
${CC} ${CPPFLAGS} ${CFLAGS} -c $< ${CC} ${CPPFLAGS} ${CFLAGS} -c $<

View file

@ -15,6 +15,8 @@ MV = @MV@
RM = @RM@ RM = @RM@
LN = @LN@ LN = @LN@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
IRCDLIBS = -L../libratbox/src/.libs -lratbox @LIBS@ IRCDLIBS = -L../libratbox/src/.libs -lratbox @LIBS@
INCLUDES = -I../include -I../libratbox/include INCLUDES = -I../include -I../libratbox/include
CPPFLAGS = ${INCLUDES} @CPPFLAGS@ CPPFLAGS = ${INCLUDES} @CPPFLAGS@
@ -24,7 +26,7 @@ exec_prefix = @exec_prefix@
bindir = @bindir@ bindir = @bindir@
libdir = @libdir@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
confdir = @confdir@ sysconfdir = @sysconfdir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
PROGS = viconf mkpasswd convertilines convertklines genssl.sh PROGS = viconf mkpasswd convertilines convertklines genssl.sh
@ -36,7 +38,7 @@ build: all
mkpasswd: mkpasswd.c mkpasswd: mkpasswd.c
$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) mkpasswd.c -o mkpasswd $(IRCDLIBS) $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) mkpasswd.c -o mkpasswd $(IRCDLIBS)
viconf: viconf.c viconf: viconf.c ../include/setup.h ../include/config.h
$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) viconf.c -o viconf $(IRCDLIBS) $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) viconf.c -o viconf $(IRCDLIBS)
convertilines: convertilines.c convertilines: convertilines.c
@ -45,13 +47,14 @@ convertilines: convertilines.c
convertklines: convertklines.c convertklines: convertklines.c
$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) convertklines.c -o convertklines $(IRCDLIBS) $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) convertklines.c -o convertklines $(IRCDLIBS)
genssl.sh: genssl.sh: genssl.sh.in
cd .. && ./config.status tools/genssl.sh && ./config.status tools/genssl.sh_chmod
clean: clean:
$(RM) -f encspeed viconf chkconf mkpasswd *~ core *.exe convertklines convertilines $(RM) -f encspeed viconf chkconf mkpasswd *~ core *.exe convertklines convertilines
distclean: clean distclean: clean
$(RM) -f Makefile $(RM) -f genssl.sh Makefile
lint: lint:
lint -aacgprxhH $(CPPFLAGS) -DIRCD_PREFIX=\"@prefix@\" $(convertklines_SOURCES) $(mkpasswd_SOURCES) $(viconf_SOURCES) $(encspeed_SOURCES) >>../lint.out lint -aacgprxhH $(CPPFLAGS) -DIRCD_PREFIX=\"@prefix@\" $(convertklines_SOURCES) $(mkpasswd_SOURCES) $(viconf_SOURCES) $(encspeed_SOURCES) >>../lint.out
@ -63,16 +66,12 @@ depend:
# DO NOT DELETE # DO NOT DELETE
viconf.o: ../include/config.h ../include/setup.h
viconf.o:
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
exec_suffix = @exec_suffix@ exec_suffix = @exec_suffix@
bindir = @bindir@ bindir = @bindir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
confdir = @confdir@ sysconfdir = @sysconfdir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
# Change this later! -- adrian # Change this later! -- adrian
moduledir = @moduledir@ moduledir = @moduledir@
@ -95,11 +94,11 @@ install-mkdirs:
install: install-mkdirs build install: install-mkdirs build
@echo "ircd: installing tools ($(PROGS))" @echo "ircd: installing tools ($(PROGS))"
@for i in $(PROGS); do \ @for i in $(PROGS); do \
if test -f $(DESTDIR)$(bindir)/$$i; then \ if test -f $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; then \
$(MV) $(DESTDIR)$(bindir)/$$i $(DESTDIR)$(bindir)/$$i.old; \ $(MV) $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i.old; \
fi; \ fi; \
$(INSTALL_BIN) $$i $(DESTDIR)$(bindir); \ $(INSTALL_BIN) $$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; \
done; \ done; \
$(RM) -f $(DESTDIR)$(bindir)/vimotd $(RM) -f $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)vimotd
$(LN) $(DESTDIR)$(bindir)/viconf $(DESTDIR)$(bindir)/vimotd $(LN) $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)viconf $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)vimotd

View file

@ -1,16 +0,0 @@
#!/bin/sh
echo "Generating self-signed certificate .. "
openssl req -x509 -nodes -newkey rsa:1024 -keyout ../etc/ssl.key -out ../etc/ssl.cert
echo "Generating Diffie-Hellman file for secure SSL/TLS negotiation .. "
openssl dhparam -out ../etc/dh.pem 1024
echo "
Now change these lines in the IRCd config file:
ssl_private_key = "etc/ssl.key";
ssl_cert = "etc/ssl.cert";
ssl_dh_params = "etc/dh.pem";
Enjoy using ssl.
"

29
tools/genssl.sh.in Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
prefix="@prefix@"
exec_prefix="@exec_prefix@"
sysconfdir="@sysconfdir@"
echo "Generating self-signed certificate .. "
openssl req -x509 -nodes -newkey rsa:1024 -keyout "${sysconfdir}"/ssl.key -out "${sysconfdir}"/ssl.cert
echo "Generating Diffie-Hellman file for secure SSL/TLS negotiation .. "
openssl dhparam -out "${sysconfdir}"/dh.pem 1024
# If sysconfdir is relative to prefix, make the path relative. I.e.,
# prefix=/usr and sysconfdir=/etc -> relative_sysconfdir=/etc,
# prefix=/home/binki/chary and sysconfdir=/home/binki/chary/etc ->
# relative_sysconfdir=etc
relative_sysconfdir="${sysconfdir#${prefix%/}/}"
relative_sysconfdir="${relative_sysconfdir%/}"
cat <<EOF
Now change these lines in the IRCd config file:
ssl_private_key = "${relative_sysconfdir}/ssl.key";
ssl_cert = "${relative_sysconfdir}/ssl.cert";
ssl_dh_params = "${relative_sysconfdir}/dh.pem";
Enjoy using ssl.
EOF

View file

@ -13,6 +13,9 @@
#include <signal.h> #include <signal.h>
#include "config.h" #include "config.h"
#ifndef PROGRAM_PREFIX
#define PROGRAM_PREFIX ""
#endif
/* wait.h is in /include on solaris, likely on other SYSV machines as well /* wait.h is in /include on solaris, likely on other SYSV machines as well
* but wait.h is normally in /include/sys on BSD boxen, * but wait.h is normally in /include/sys on BSD boxen,
@ -45,7 +48,7 @@ int main(int argc, char *argv[])
else else
p++; p++;
if(strcmp(p, "vimotd") == 0) if(strcmp(p, PROGRAM_PREFIX "vimotd") == 0)
filename = MPATH; filename = MPATH;
if(LockedFile(filename)) if(LockedFile(filename))