Compare commits

..

No commits in common. "armageddon" and "charybdis-3.0.0-rc1" have entirely different histories.

467 changed files with 101394 additions and 198272 deletions

View File

@ -1,42 +1,27 @@
syntax: glob
Makefile
*~
*.o
*.so
*.dSYM/
*.lo
*.la
*.swp
*.orig
*.log
.deps
.libs
autom4te.cache
bandb/bandb
bandb/bantool
config.log
config.status
include/setup.h
include/serno.h
libratbox/include/libratbox_config.h
libratbox/include/librb-config.h
libratbox/include/stamp-h1
libratbox/libratbox.pc
libratbox/libtool
libratbox/src/version.c
scripts/*.tbz2
scripts/*.tgz
scripts/*.tar.bz2
scripts/*.tar.gz
servlink/servlink
src/ircd
src/lex.yy.c
src/version.c.last
src/y.tab.h
src/y.tab.c
ssld/ssld
tools/convertilines
tools/convertklines
tools/genssl.sh
tools/mkpasswd
tools/viconf
include/serno.h
libratbox/src/version.c.last

View File

@ -1,2 +0,0 @@
au BufWritePost *.c execute 'silent !astyle --style=linux --mode=c -n' shellescape(expand('%'), 1) ' >/dev/null'
au BufWritePost *.h execute 'silent !astyle --style=linux --mode=c -n' shellescape(expand('%'), 1) ' >/dev/null'

View File

@ -1,12 +0,0 @@
language: c
compiler:
- gcc
before-install:
- sudo apt-get update
install:
- sudo apt-get install build-essential libssl-dev flex bison
script: "./configure && make"
notifications:
irc: "irc.yolo-swag.com#elemental-ircd"

28
BUGS Normal file
View File

@ -0,0 +1,28 @@
Known Bugs worthy of a mention:
--------------------------------------------------------------------------------
1. /MODUNLOAD causes cores:
- If a module is modified before being unloaded, /MODUNLOAD (and
therefore /MODRELOAD) may cause a core.
This problem is caused by the behaviour of the OS, which treats
shared libraries differently to executables (modifying the ircd
binary whilst it is running would also cause a core, but is denied
by the OS).
A workaround to avoid coring is possible however. To install new
modules, first remove or rename the old module, then copy/move the
new file into place. install or make install is also safe.
/MODUNLOAD will then work successfully.
We will likely have a workaround implemented in the next version.
BUG REPORTS: If you run this code and encounter problems, you must report
the bug on http://bugs-meta.atheme.org/ (Charybdis project) or via IRC,
irc.atheme.org #charybdis.
Please include a gdb backtrace and keep your binaries, modules and core file
in case the developers need more information.
--------------------------------------------------------------------------------
$Id: BUGS 3344 2007-04-01 22:20:00Z jilles $

View File

@ -1,20 +0,0 @@
# Contribution guidelines
Please open contributions as either issue reports or pull requests. We will ask
that anything that requires testing outside our normally supported platforms be
marked as such.
As ircd is such an ancient project with varying code styles, please try to
follow the current coding style of the file you are in. If all else fails,
please use the [Linux Kernel](https://www.kernel.org/doc/Documentation/CodingStyle)
coding style.
Please run all code against the following `astyle` command before sending in
a pull request:
```console
$ astyle --style=linux --mode=c -n $file
```
It should be trivial to set up your text editor to do this for you.

49
CREDITS
View File

@ -1,41 +1,5 @@
$Id: CREDITS 3133 2007-01-21 15:38:16Z jilles $
Elemental-IRCd is a fork of the now-defunct ShadowIRCD project.
The Elemental-IRCd team is listed below in nick-alphabetical order:
Xena, Sam Dodrill <shadowh511 -at- gmail.com>
Some Elemental-IRCd features are modeled after or direct ports of
code from Charybdis.
ponychat-ircd is a fork of the ShadowIRCD project created to meet
PonyChat's needs and keep the now-defunct ShadowIRCD project's goals
alive.
The ponychat-ircd team is listed in nick-alphabetical order:
aji, Alex Iadicico <alex -at- ajitek.net>
Kabaka, Kyle Johnson <kabaka -at- ponychat.net>
Xe, Sam Dodrill <shadowh511 -at- gmail.com>
ShadowIRCd 6 is a modern restart of the old ShadowIRCd project
based on Charybdis with a few additional features to make it appeal
more to more users. We try to work as closely as possible with the
Charybdis team.
The ShadowIRCd team is listed in nick-alphabetical order:
jdhore, JD Horelick <jdhore1 -at- gmail.com>
Taros, Brett Greenham <taros34 -at- hotmail.com>
Some ShadowIRCd 6 features such as the oper-override and remote
RESTART, DIE and MOD* commands were borrowed from ircd-seven.
ircd-seven is written by:
spb, Stephen Bennett <spb -at- attenuate.org>
Charybdis started as an evolution from ircd-ratbox. Its development
is led by a team of dedicated developers who have put a lot of time
into the project, and it has seen use on a variety of different
@ -43,9 +7,10 @@ network configurations.
The charybdis core team is listed in nick-alphabetical order:
dwr, Valery Yatsko <darkwire -at- darkwire.ru>
gxti, Michael Tharp <gxti -at- partiallystapled.com>
jilles, Jilles Tjoelker <jilles -at- stack.nl>
nenolod, William Pitcock <nenolod -at- nenolod.net>
spb, Stephen Bennett <spb -at- attenuate.org>
The following people have made contributions to the Charybdis releases,
in nick-alphabetical order:
@ -53,15 +18,11 @@ in nick-alphabetical order:
AndroSyn, Aaron Sethman <androsyn -at- ratbox.org>
anfl, Lee Hardy <lee -at- leeh.co.uk>
beu, Elfyn McBratney <elfyn.mcbratney -at- gmail.com>
dwr, Valery Yatsko <dwr -at- shadowircd.net>
Entrope, Michael Poole <mdpoole -at- trolius.org>
gxti, Michael Tharp <gxti -at- partiallystapled.com>
jdhore, JD Horelick <jdhore1 -at- gmail.com>
mr_flea, Keith Buck <mr_flea -at- esper.net>
Taros, Brett Greenham <taros -at- shadowircd.net>
spb, Stephen Bennett <spb -at- attenuate.org>
ThaPrince, Jon Christopherson <jon -at- vile.com>
twincest, River Tarnell <river -at- attenuate.org>
w00t, Robin Burchell <surreal.w00t -at- gmail.com>
Visit the elemental-ircd repo at: http://www.github.com/ponychat/elemental-ircd
Visit us on IRC at: irc.ponychat.net #rainbow-factory
Visit the Charybdis website at: http://www.ircd-charybdis.net
Visit us on IRC at: irc.staticbox.net #charybdis

15246
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

99
Config
View File

@ -1,99 +0,0 @@
#!/usr/bin/env python
"""
Copyright 2014 Sam Dodrill <shadowh511@gmail.com>
This software is under GPL.
"""
from os import system
try:
raw_input = raw_input
except NameError:
raw_input = input
art = """
_______ __ __ __ _______ ______ ______ __
| ___| |.-----.--------.-----.-----.| |_.---.-.| |_____|_ _| __ \ |.--| |
| ___| || -__| | -__| || _| _ || |______|| |_| < ---|| _ |
|_______|__||_____|__|__|__|_____|__|__||____|___._||__| |_______|___|__|______||_____|"""
welcome ="""
Welcome to the Elemental-IRCd Configuration script. This script will help you choose the
best compile flags for your installation of Elemental-IRCd.
"""
class Configure():
def promptUser(self, prompt, default):
inp = raw_input("%s [%s]> " % (prompt, default))
if inp == "":
return default
return inp
def promptYesNo(self, prompt, defult=True):
inp = False if self.promptUser(prompt, "Y") == "N" else True
return inp
def go(self):
configflags = ["./configure"]
print(art)
print(welcome)
print("Please specify where you would like to install Elemental-IRCd.")
installloc = self.promptUser("Install location?", "$HOME/ircd")
print("")
print("Please specify the maximum nickname length. This must be the same across")
print("all servers in your network or you risk desyncs. The maximum is 50.")
nicklen = 0
nicklen_valid = False
while not nicklen_valid:
try:
nicklen = int(self.promptUser("Maximum nickname length?", "31"))
if nicklen < 51:
nicklen_valid = True
except ValueError:
nicklen_valid = False
if not nicklen_valid:
print("Error: you must choose an integer value under 50.")
print("")
print("Would you like to disable small network support? This increases the size")
print("of a few buffers in the code and can increase performance on large networks.")
smallnet = self.promptYesNo("Small network? (Y/N)")
configflags.append("--prefix=%s" % installloc)
configflags.append("--with-nicklen=%s" % nicklen)
if not smallnet:
configflags.append("--enable-small-net")
else:
configflags.append("--disable-small-net")
print("\nThat should be it for now. Running %s" % " ".join(configflags))
raw_input("Press enter to continue... ")
system(" ".join(configflags))
print(art)
print("""
Next, run `make` and `make install`. Then copy %s/etc/example.conf to
%s/etc/ircd.conf and read through the example configuration completely to make
sure your install is tailored to your needs. After that, run %s/bin/ircd
and start to connect clients and servers as you need.
If you have any problems, please check the documentation in the doc/ folder
of the source repository. If problems persist please stop by #elemental-ircd
on irc.yolo-swag.com and ask. Running Elemental-IRCd in insane conditions may
make support either very difficult or at most impossible.""" % (installloc, installloc, installloc))
system("clear")
c = Configure()
try:
c.go()
except (KeyboardInterrupt, EOFError):
print("\nInterrupted, exiting!")
# vim: set ts=4 sw=4 tw=0 et

View File

@ -1,22 +0,0 @@
FROM flitter/init
MAINTAINER Xena <xena@yolo-swag.com>
# Update base system
RUN apt-get update && apt-get upgrade -yq && \
apt-get -yq install build-essential autoconf libssl-dev flex bison && \
adduser --system --home /home/ircd ircd && \
mkdir /home/ircd/src && \
chmod 777 /home/ircd/src
ADD . /home/ircd/src
RUN cd /home/ircd/src; ./configure --prefix=/home/ircd/run ; make ; make install
ADD doc/example.conf /home/ircd/run/etc/ircd.conf
ADD extra/runit/ /etc/service/ircd/
RUN chmod -R 777 /home/ircd/run
EXPOSE 6667
ENTRYPOINT /sbin/my_init

21
INSTALL
View File

@ -1,11 +1,10 @@
ShadowIRCd INSTALL Document
Charybdis INSTALL Document
$Id: INSTALL 3384 2007-04-03 22:45:04Z jilles $
Copyright (c) 2001 by ircd-hybrid team
Copyright (c) 2002-2004 ircd-ratbox development team
Copyright (c) 2005-2008 charybdis development team
Copyright (c) 2010 by ShadowIRCd development team
----------------------------------------------------------------------
@ -18,7 +17,7 @@
1.
Read the NEWS file to find out about the exciting new features in
this version. Other good reads are doc/example.conf, and
this version. Other good reads are BUGS, doc/example.conf, and
README.FIRST.
2.
@ -26,7 +25,7 @@
Run the configure script. It will create include/setup.h and the
Makefiles to match your system. In ircd-ratbox, the paths are now handled
with the --prefix option to configure, not in config.h.
$HOME/ircd is the default if no prefix is specified.
/usr/local/ircd is the default if no prefix is specified.
./configure --prefix="/usr/local/ircd"
@ -137,12 +136,16 @@
HOW TO GET HELP
The best way to get help regarding bugs and such is by asking on our
IRC channel which is at irc.thinstack.net #shadowircd . Bugs can also
be filed on our bugtracker at:
http://bitbucket.org/uranium/shadowircd/issues/?status=new&status=open
Send Check or Money Order to... just kidding! You're on your own for
support. Try asking other ircd-ratbox admins on EFnet if you can't fix it
yourself. If you do fix anything, however, please send context or unified
diffs to ircd-ratbox@lists.ratbox.org so the fixes can be incorporated into
the next release of ircd-hybrid. If ratbox crashes on you, PLEASE contact
ircd-ratbox@lists.ratbox.org ASAP with a backtrace of the core.
DISCUSSION: There is a mailing list for discussion of ratbox issues,
To subscribe, visit:
http://lists.ratbox.org/cgi-bin/mailman/listinfo/ircd-ratbox
----------------------------------------------------------------------

View File

@ -24,17 +24,10 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
libdir = @libdir@
pkglibdir = @pkglibdir@
moduledir = @moduledir@
helpdir = @helpdir@
sysconfdir = @sysconfdir@
confdir = @confdir@
logdir = @logdir@
rundir = @rundir@
pkgrundir = @pkgrundir@
localstatedir = @localstatedir@
pkglocalstatedir= @pkglocalstatedir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
# Default CFLAGS
# CFLAGS = -g -O2 -DNDEBUG
@ -53,8 +46,7 @@ CFLAGS = @CFLAGS@
# the system one.
#CFLAGS= -DNDEBUG -g -O2 -D"FD_SETSIZE=1024"
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 doc help
CLEANDIRS = ${SUBDIRS}
RSA_FILES=rsa_respond/README rsa_respond/respond.c rsa_respond/Makefile
@ -75,7 +67,7 @@ build:
sh configure; \
fi
@if [ -d .hg ] ; then \
revh=`hg parents --template '{date|shortdate}_{node|short}' 2>/dev/null | sed -e s/-//g -e s/_/-/`;\
revh=`hg parents --template '#date|shortdate#_#node|short#' 2>/dev/null | sed -e s/-//g -e s/_/-/`;\
[ -z "$$revh" ] || echo '#define SERNO "'$$revh'"' >include/serno.h ; \
fi
@[ -f include/serno.h ] || echo '#define SERNO "unknown"' >include/serno.h
@ -124,27 +116,27 @@ lint:
install-mkdirs:
@echo "ircd: setting up ircd directory structure"
-@if test ! -d $(DESTDIR)$(prefix); then \
mkdir -p -m 755 $(DESTDIR)$(prefix); \
mkdir $(DESTDIR)$(prefix); \
fi
-@if test ! -d $(DESTDIR)$(bindir); then \
mkdir -p -m 755 $(DESTDIR)$(bindir); \
mkdir $(DESTDIR)$(bindir); \
fi
-@if test ! -d $(DESTDIR)$(sysconfdir); then \
mkdir -p -m 755 $(DESTDIR)$(sysconfdir); \
-@if test ! -d $(DESTDIR)$(confdir); then \
mkdir $(DESTDIR)$(confdir); \
fi
-@if test ! -d $(DESTDIR)$(mandir); then \
mkdir -p -m 755 $(DESTDIR)$(mandir); \
mkdir $(DESTDIR)$(mandir); \
fi
-@if test ! -d $(DESTDIR)$(moduledir); then \
mkdir $(DESTDIR)$(moduledir); \
fi
-@if test ! -d $(DESTDIR)$(helpdir); then \
mkdir $(DESTDIR)$(helpdir); \
fi
-@if test ! -d $(DESTDIR)$(logdir); then \
mkdir -p -m 755 $(DESTDIR)$(logdir); \
mkdir $(DESTDIR)$(logdir); \
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
@for i in $(SUBDIRS); do \
echo "install ==> $$i";\

9
Mercurial-Access Normal file
View File

@ -0,0 +1,9 @@
The Charybdis Mercurial repository can be checked out using the following command:
hg clone http://hg.atheme.org/charybdis charybdis-devel
The stable version can be checked out using the following command:
hg clone http://hg.atheme.org/release/charybdis-2.2 charybdis-stable
Charybdis's Mercurial repository depot can be browsed over the internet at
the following address:
http://hg.atheme.org/

541
NEWS
View File

@ -1,540 +1,21 @@
This is elemental-ircd 6.6.1, Copyright (c) 2014 elemental-ircd team.
This is charybdis 3.0.0, Copyright (c) 2005-2008 Charybdis team.
See LICENSE for licensing details (GPL v2).
-- elemental-ircd 6.6.1
All code is now in the linux kernel coding style. Patches that do not
follow this coding style are at risk of being rejected. It is suggested
that your editor be set up to automatically style your code in the
desired format. A vim resource file is provided in the repository root.
additions
- automatic code styling for vim
- Dockerfile and nightly docker builds
- show cloaked I:Line vhost IP address remotely
bugfixes
- all channel lists have their own limit instead of sharing one.
5ba9c76d224afac877d9500d6ac1eb8f2bddd076
- fix potential undefined behavior with m_away
7d3966bc9bd9e9ab7833b4ecb0751671bdd085e7
- fix Anope 2.0 protocol module
79a3bf79ae66c43470c4bed25c33053b13a032d1
-- elemental-ircd 6.6
additions
- add OWNER=y to 005
- add autoconfigure script like unrealircd
- add channel mode +u to hide banlists unless users have halfop or up
- add modules for services packages
- add quotes around PART reason
- add umode +I to hide channels line from WHOIS
- make end-user /OPER failures much more generic
- make flooding SNOTEs global
- show own modes in whois
- show remote server IP addresses
- update helpfiles to have much more up to date information
bugfixes
- don't strip unicode in strip_unprintable
- fix extended-join for remote users
- fix null reference in away-notify
- make genssl.sh generate ten year certs
- merge some upstream charybdis patches
removals
- remove away-notify
- remove AHBL from default configs
- remove m_post SNOTEs because of an upstream change
The official channel for Elemental-IRCd is now #elemental-ircd on
irc.yolo-swag.com.
-- elemental-ircd 6.5.1
Rename to Elemental-IRCd
-- ponychat-ircd 6.5
additions
- Channel owner mode (+y)
- away-notify, account-notify and extended-join client capabilities
- DNSBL hit and m_post HTTP proxy rejection server notices are global
- IPv6 DNSBL support
- Away rate limiting added
- Added snotes for failed SASL authentication attempts if need_sasl flag is set
bugfixes
- Reject nicks with '~' in them, rather than cutting at the '~'
- Fix possible memory leak of certificate fingerprints
- Printed error message on unreadable config file rather than just a log entry
-- ponychat-ircd 6.3.4
bugfixes
- Fix compilation with GCC 4.8 and above
-- shadowircd 6.3.3
bugfixes
- Fix compilation with Glibc-2.16 and newer
- Fix extensions/ip_cloaking not telling linked servers about a changed hostname
- Fix crash when a CAPAB with no parameters is sent
- Fix bugs when shadowircd is run under OpenVZ or Virtuozzo
-- shadowircd 6.3.2.1
bugfixes
- Fix small buildsystem regressions introduced in shadowircd 6.3.2
-- shadowircd 6.3.2
bugfixes
- Fix ACTIONs working on a channel when cmode +G (blockcaps) is set.
other
- Do some things the git was as we've switched to git as our VCS since 6.3.1.
- Add support for proper system-wide installability.
- Add a few simple helper scripts for irssi, WeeChat and XChat to add a /OHELP
command which makes it far easier to view ShadowIRCd help on clients that use
/HELP for their own uses.
-- shadowircd 6.3.1
bugfixes
- When setting/unsetting cmode +M, wallops are only sent once, globally,
not for every server on the network where the mode change happens.
- Don't allow +Z to be set by default_umodes.
- Cope with OPENSSL_VERSION_NUMBER not being a long. This is the case on
very new FreeBSD versions.
- Disallow mIRC italics in channel names when disable_fake_channels is in use.
- Allow kick_on_split_riding to protect channels with mlocked keys.
-- shadowircd-6.3.0
new modes
- channelmode 'N' has been moved to 'd' to allow for m_roleplay and
specifically, compatibility with the charybdis m_roleplay.
new modules
- m_roleplay: New extension allowing many roleplay commands. Individual
channels can disable this by setting channelmode +N on their channels.
configuration
- use auth::auth_user for SASL. It is no longer usable in PASS (though its
use-case there is non-existant), but you can now set so if a user
successfully authenticates to the accountname in auth_user with SASL,
they will get the proper auth block privs. You can have multiple auth_users
in one auth block.
- you can now specify a SSL fingerprint that the remote server must have in
order to link.
opers
- wallops are now sent upon setting or unsetting of +M or any other hidden
channelmode.
- /LIST now has operspy support. You can see all channels (including secret
channels) with /LIST ! or /LIST !#target. OLIST still exists and can be
used as well. OLIST will also show channelmodes whereas LIST will not.
users
- /LIST can now be constrained by topic TS and channel TS.
code
- native support for SHA256, SHA512 and Blowfish added everywhere.
- many small improvements and bugfixes.
-- shadowircd-6.2.0
configuration
- add channel::hide_channel_below_users - Channels with a user count lower
than the value of this option will not be shown by default in /LIST.
- add channel::admin_on_channel_create - If enabled, gives users creating
new channels +ao in that channel instead of just +o.
- add channel::disabledmodes - This allows opers to disallow users from
using certain channelmodes. This is only read on startup and your services
and remote servers must be configured the same otherwise desyncs will occur.
- add many services aliases for new Atheme services.
opers
- when users get hit by a DNSBL, this is now shown in the snotes.
other
- change kicknorejoin to not be a config option and be hardcoded to 2 seconds
because a longer time is kind of pointless.
- Many new features and improvements from charybdis 3.3.0. See below for
information about all that.
code
- many bugfixes and various cleanups.
-- charybdis-3.3.0
server protocol
- Add new BAN command, for propagated network-wide bans (K/X:lines and RESVs).
These will burst to new servers as they are introduced, and will stay in sync
across the whole network (new BAN capab).
- Add new MLOCK command, to implement ircd-side channel mode locks. This allows
services to send out a list of mode letters for a given channel which may not
be changed, preventing mode fights between services and client bots (new MLOCK
capab).
user
- New RPL_QUIETLIST(728) and RPL_ENDOFQUIETLIST(729) numerics are used for the
quiet (+q) list, instead of overloading the ban list numerics.
- Users may no longer change the topic of a -t channel if they cannot send to
it.
- Add help for EXTBAN, describing the syntax of extended bans in general, as
well as the most common types.
- Changed AWAY messages are now propagated to other servers. Previously, AWAY
was only propagated when the user was not already away.
- Channel mode +c (and other places that disallow colour codes) now also strip
ASCII 29 (mIRC 7 italics).
- Add auto-accept for user mode +g (callerid): Messaging a user while set +g
will automatically add them to your accept list.
- Add target change for channels. It applies to unopped, unvoiced and unopered
users. This has the effect of stopping spambots which join, message and part
many channels at a time.
- Show RPL_WHOISLOGGEDIN in /whowas as well as in /whois entries. This adds at
most an additional 0.5MB of memory usage.
oper
config
- Add general::use_propagated_bans to switch the new BAN system on or off.
- Add general::default_ident_timeout, to control the timeout for identd (auth)
connections.
- Add channel::channel_target_change to switch the new channel target change limits
on or off.
- Fix class::number_per_ident so that it also applies to connections without
identd.
- Change the example sslport option to 6697, which is more standard than 9999.
misc
- The custom channel mode API has been rewritten, allowing these modules to work
correctly when reloaded, or loaded from the config file.
- The EFNet RBL is now recommended, instead of DroneBL.
- Remove the unsupported modules directory.
- Numerous bug fixes and code cleanups.
- In mkpasswd, default to MD5 crypt instead of insecure DES.
-- shadowircd-6.1.0
new configuration options
- general::static_quit - Quit message to display for all users (not opers).
- general::no_part_messages - If this option is set to no, the ircd will not
display PART messages/reasons from users.
- general::true_no_oper_flood - Turns off *ALL* flood protection for opers.
Instead of command flooding being 4x what it is for a user with no_oper_flood,
there is no limit at all. This option also allows opers to flood channels/users
so if you do set it, be extremely careful.
- serverinfo::helpchan and helpurl - These are 2 config options that tell users,
when they do /quote help (with no extra parameters) the official network help
channel and a special URL for help. If these options are disabled, the users
will just get the help index and that's it on /quote help.
- general::default_ident_timeout - Allows you to set the default ident timeout
in the ircd.conf instead of it being hardcoded and only settable with /SET.
new commands
- CYCLE #channel - server-side CYCLE, also called HOP in some clients/servers.
Parts the user from the given channel, then joins them to it immediately after.
Enabled by loading extensions/m_cycle.
opers
- Override no longer alows overriding opers to talk through +q, +m, etc.
If you need to talk through one of these modes, its recommended to remove
the offending mode or give yourself voice/ops.
- OLIST now shows channel modes so opers can easily see which channels are
+s and see which channels have oper-only channel modes set.
- RESTART and DIE now can be executed remotely. See the appropriate helpfiles
for details.
- All module management commands (MODLOAD, MODLIST, MODUNLOAD, MODRELOAD and
MODRESTART) can be executed remotely. See the appropriate helpfile for
details.
- OMODE can now set and unset +ah.
- OJOIN now works with !#channel and %#channel.
- Staff channelmodes (+AO) now require chanops to set.
- OPERHOST option added to SET. You can now use SET to change the default
operhost that operators get upon opering up, though like the
general::default_operhost config option it will not override the
operator::vhost config option.
other
- Added a strip_unprintable function to make evasion of cmodes +G and +K
less trivial.
- Massive helpfile updates.
- Added SVSJOIN s2s command. This allows things like atheme's ns_ajoin
to work on shadowircd.
- Added BAN stuff (propogated bans on burst) from charybdis trunk. This
can be disabled and the old behavior can be used by setting the
general::use_propogated_bans option to no.
- The --enable-small-net configure option is now enabled by default.
If you wish to disable small net mode, pass --disable-small-net to
configure.
- New channel mode adding API has been added from charybdis trunk.
- NOTICE/PRIVMSG @#channel and +#channel now go to admin/halfop as well
as chanop.
-- shadowircd-6.0.0
new modes
- Add umode +C (no CTCP).
- Add umode +V, users with this mode set will never recieve channel invites
from other users.
- Add umode +B which identifies users as being bots in /whois.
- Add umode +G which disallows users from messaging you unless you're both
on at least one channel together. This can be "overridden" with /accept.
- Add cmode +T which blocks all notices to the channel.
- Add cmode +D which blocks all actions (/me's) from being sent to the channel.
- Add cmode +E which disallows channel ops from kicking users.
- Add cmode +N which disallows users from changing their nick while they're on
a channel with this mode set.
- Add cmode +K (norepeat) which will block repeated messages, regardless of
who they're from.
- Add cmode +G which blocks messages containing 50% or more capital letters
from being sent to the channel.
- Add cmode +J which disallows a kicked user from rejoining within 'X' seconds
of them being kicked, where 'X' is the variable of the channel::kick_no_rejoin_time
configuration option.
- Add cmodes +a and +h (admin and halfop, respectively). There are 2 extra
prefixes to more finely-grain the status of staff members in your channels.
They can be enabled or disabled in the configuration file with the options
channel::use_halfop and channel::use_admin.
new configuration options
- auth::autojoin - This option will specify what channels users in a matching
auth {} block will automatically join on connect to your server/network.
- auth::autojoin_opers - This option will specify what channels opers in a
matching auth {} block will automatically join on oper up (/oper).
- channel::cycle_host_change - This option defines whether or not users
will cycle (part and rejoin) the channels they're in when their host changes.
This can be annoying to some people, but disabling it can cause client desyncs.
- channel::host_in_topic - This option defines whether or not a host setter's
full host or just their nick will be shown on /TOPIC.
- channel::use_local_channels - With this option, you can enable/disable
support for local channels on your server/network.
- channel::exemptchanops - This option defines what channel modes channel
operators are exempt from, channel modes usable in this option are: cCDTNGK.
- general::secret_channels_in_whois - This option defines whether or not opers
can see secret channels that a user is in when whoising them. Secret channels
will show up in the whois prefixed with *. If this option is disabled, opers
will still be able to see secret channels a user is in with the /SPYWHOIS
command.
- Enabled a few popular extensions by default, added a few extensions to the
example config files that were missing, add a few more services aliases
by default, enable ip_cloaking by default and get rid of all the old
ip_cloaking modules.
opers
- Users' umodes are shown when you whois them.
- swhois support - Adds a mostly free-form line of text to opers' whois
if one is set in their operator {} block.
- custom operstring - Instead of showing the IRC operator or IRC administrator
oper strings, you can customize what it shows in each oper's operator {}
block.
- host-on-oper - Give a vhost to operators upon oper up. Can be defined
generally, then the general option may be overridden by each operator {}
block.
- operoverride - Oper override works very differently in ShadowIRCd compared
to all other IRCd's which support oper override. In ShadowIRCd, to be able
to override, you must have the oper:override privledge and you must then
set umode +p on yourself. The p umode will automatically expire and un-set
itself after a time set in the configuration option general::expire_override_time.
- immune - Adds cmode +M. Opers can set this on a channel (even if they don't
have ops) without the channel's ops or other users seeing (only opers see
this mode at all.) It disallows anyone in the channel from kicking opers.
- OACCEPT/callerid override - In ShadowIRCd 6, opers no longer can simply PM
users that have umodes +g or +G set and the oper is not on their accept list.
To allow opers to still be able to PM users in this situation, OACCEPT has been
added. OACCEPT is a new extension that enables the command /oaccept <user>
which adds a piece of metadata to that use which will allow you to PM them.
other
- Changed default NICKLEN to 31 (from 15) to fit more closely with other
IRCd's.
- Rebrand many things from Charybdis to ShadowIRCd.
- Move the m_force module to extensions.
- Add a metadata framework. Currently used for swhois, custom operstring,
OACCEPT, cmode +J, cmode +K.
-- charybdis-3.2.0
server protocol
- Apply +z to messages blocked by +b and +q as well. (new EOPMOD capab)
- Add new topic command ETB, allowing services to set topic+setter+ts always.
(new EOPMOD capab)
- The slash ('/') character is now allowed in spoofs.
user
- Add can_kick hook, based on the ircd-seven one.
- Add cmode +C (no CTCP) from ircd-seven.
- Flood checking has been reworked.
- Fix op-moderate (cmode +z) for channel names with '@'.
- Add CERTFP support, allowing users to connect with an SSL client
certificate and propagating the certificate fingerprint to other servers.
Services packages can use this to identify users based on client
certificates.
- Maintain the list of recently used targets (for the target change
anti-spam system) in most-recently-used order, overwriting the least
recently used target with a new one. This should be friendlier to users
without giving spambots anything.
- Do not require target change slots for replying to the last five users to
send a private message, notice or invite.
- Apply target change restrictions to /invite.
- Apply umode +g/+R restrictions to /invite, with the difference that
instead of sending "<user> is messaging you" the invite is let through
since that is just as noisy.
oper
- Add /rehash throttles to clear throttling.
- Send all server notices resulting from a remote /rehash to the oper.
- '\s' for space is now part of the matching, not a substitution at xline
time, fixing various issues with it.
- Display o:line "nickname" in oper-up server notices.
- Fix sendq exceeded snotes for servers.
- SCAN UMODES: default list-max to 500, like a global WHO.
- Ignore directory names in MODRELOAD to avoid crashing if it is a core
module and the path is incorrect.
- Tweaks to spambot checks.
config
- Add channel::only_ascii_channels config option to restrict channel names
to printable ascii only.
- Add channel::resv_forcepart, forcibly parts local users on channel RESV,
default enabled.
misc
- New mkpasswd from ircd-ratbox.
- Check more system calls for errors and handle the errors.
- Various ssld/libratbox bugfixes from ircd-ratbox. [some MERGED]
- Fix fd passing on FreeBSD/amd64 and possibly Solaris/sparc. [MERGED]
- Various documentation improvements. [some MERGED]
- Fix some crash issues. [MERGED]
- Add bandb from ircd-ratbox, which stores permanent dlines/klines/xlines/resvs
in an sqlite database instead of a flatfile and does the storage in a
helper process.
-- charybdis-3.1.0
- Remove TS5 support. No TS5 servers are permitted in a network with
charybdis 3.1.0 or newer, except jupes.
- Replace oper flags by privilege sets (privsets). This adds an extra
level of indirection between oper flags and operator blocks. /stats O
(capital O) shows the configured privsets.
- Update libratbox and ssld from upstream and use it better.
- Add auth_user to auth{}. This allows specifying a username:password instead
of just a password in PASS, so that a fixed user@host is not necessary
for a specific auth{} block.
- Add need_ssl to auth{} and operator{}. This makes these blocks reject
the user if not connected via SSL.
- Allow modules to provide simple channel modes without parameter.
- Remove restrictions on CNAME in the resolver.
- Make the resolver remember nonresponsive nameservers.
- Move nick collision notices from +s to +k.
- Add additional information to various server notices about server
connections.
- Show throttle information in /stats t.
- Show rejectcache and throttle information in /testline.
- Show oper reason in /testline.
- Allow opers to see other users' umodes with /mode <nick>.
- SCAN UMODES GLOBAL NO-LIST MASK <mask> is no longer an operspy command.
- Also apply floodcount to messages to remote clients (except services).
- Remove user@server messages to local users. Sending such messages to
remote servers is still possible, for securely messaging pseudoservers
whether service{}'ed or not. The special oper-only syntax opers@server
remains as well.
- Allow /list on a named +p channel. A full /list already included +p channels.
- Add operspy /topic.
- For remote rehashes, send error messages to the requesting oper as well.
- Disable autoconnect for a server with excessive TS delta.
- Disallow invites to juped channels.
- Warn about certain duplicate and redundant auth blocks.
- Make PRIVMSG/NOTICE behave as CPRIVMSG/CNOTICE automatically if possible.
- Allow +z messages from outside if a channel is -n.
- Allow coloured part reasons in -c channels.
- Add ircu-like WHOX support. This allows requesting specific information
in /who and allows obtaining services login name for all users in a
channel. XChat/Conspire use WHOX to update away status more efficiently.
- Allow opers and shide_exempt users to see hopcounts even if flatten_links
is on.
- Rework ip_cloaking.
- Add the IP address to userlog, as in ircd-ratbox 3.0.
- Split cidr_bitlen into cidr_ipv4_bitlen and cidr_ipv6_bitlen.
- Allow using ziplinks with SSL connections. This is not as efficient as
using OpenSSL's built in compression, but also works with older versions
of OpenSSL.
- Fix an off by one error with zipstats processing, which could overwrite
a variable with NULL causing a crash on some systems.
- Document some extensions in charybdis-oper-guide.
- Add more server protocol documentation.
- Add m_sendbans extension, SENDBANS command to propagate xlines and resvs
manually.
- Add chm_sslonly extension, cmode +S for SSL/TLS only channels.
- Add chm_operonly extension, cmode +O for IRCop only channels.
- Add chm_adminonly extension, cmode +A for server admin only channels.
- Various code cleanups.
-- charybdis-3.0.4
- Fix a crash on certain recent versions of Ubuntu.
- Allow 127.x.y.z for DNSBL replies instead of just 127.0.0.x.
- Various documentation improvements.
-- charybdis-3.0.3
- Fix IPv6 D:lines
- Fix rejectcache and unknown_count.
- Fix genssl.sh.
- Fix ident for SSL/TLS connections.
- Fix SSL/TLS bugs for servers with more than about 100 connections.
- Small bugfixes.
-- charybdis-3.0.2
- Improve OLIST extension error messages.
- Improve some kline error checking.
- Avoid timing out clients if we are still waiting for a DNSBL lookup.
- Fix resolver hangs with epoll.
- Fix compilation without zlib.
-- charybdis-3.0.1
- Fix occasional hung clients with kqueue.
- Fix a rare ssld crash.
- Fix a bug that could cause incorrect connect failure reasons to be
reported.
- Make the IRCd work on MacOS X again.
-- charybdis-3.0.0
- Port the IRCd to libratbox, which has improved our portability and allows
us to reuse low-level code instead of maintaining our own.
- Change configuration of maximum number of clients to ircd-ratbox 3 way.
- Add adminwall from ircd-ratbox, as an extension.
- Add client and server-to-server SSL, read example.conf for setup.
- Replace servlink with ssld (also for ziplinks).
- A new extban, $z, has been added for ssl users (extensions/extb_ssl.so).
- The IRCd has been ported to libratbox, which has improved our portability.
- Client SSL and Server-to-Server SSL are now available, read the example.conf
for setup.
- A new extban, $z, has been added for ssl users.
- A new compatibility channel mode, +R, has been added, it sets
+q/-q $~a (extensions/chm_operonly_compat.so). This is similar to
the +R seen in ircd-seven.
+q/-q $~a. This is similar to the +R seen in ircd-seven.
- A new compatibility channel mode, +S, has been added, it sets
+b/-b $~z (extensions/chm_sslonly_compat.so).
+b/-b $~z.
- A new compatibility channel mode, +O, has been added, it sets
+iI/-iI $o (extensions/chm_operonly_compat.so).
- Add remote D:lines. Note that these are not enabled by default.
- Remove EFnet-style G:lines. Noone appears to use these.
- Remove idle time checking (auto disconnecting users idle too long).
- Display a notice to clients when the IRCd is shut down using SIGTERM.
- Some error messages have been clarified to enhance usability.
- Close the link to servers that send invalid nicks (e.g. nicklen mismatches).
Formerly the users were killed from the network.
- Enable topicburst by default in connect{}.
- Fix a potential desync which can happen with oper override.
- Remove "deopped" flag (TS5 legacy).
- Use 127.0.0.1 as nameserver if none can be found in /etc/resolv.conf.
- Only accept 127.0.0.x as a dnsbl listing.
- Change cloaking module (same as 2.2.1, different from 2.2.0).
- Make some more server notices about failed remote connect attempts
network wide.
- Make some server notices about flooders and TS delta network wide.
- Remove redundant "<server> had been connected for <time>" server notice.
- Add resv oper privilege to control /resv, /unresv and cmode +L and +P,
enabled by default.
- Add mass_notice oper privilege to control global notices and /wallops,
enabled by default.
- Rework unkline/undline/unxline/unresv so they show the exact item removed
and do not rehash bans.
- Show opers a list of recently (<24hrs) split servers in /map.
- Add /privs command, shows effective privileges of a client.
+iI/-iI $o.
- The /privs command has been added which shows you your privileges and
access level.
- Many error messages have been clarified to enhance usability.
-- charybdis-2.2.0

102
README.FIRST Normal file
View File

@ -0,0 +1,102 @@
If you don't read this first, we won't help you.
:-)
******************************* IMPORTANT *************************************
*********** Note for those who dont bother reading docs *****************
* - Reading INSTALL is now a must, as the old DPATH is now specified *
* when configure is run. *
* You now need to ./configure --prefix="/path/to/install/it" *
* - The old config format WILL NOT WORK. Please see doc/example.conf ! *
* - The old kline format WILL NOT WORK. Please use convertklines which *
* will be installed with your ircd! *
*************************************************************************
ALSO, IF YOU ARE UPGRADING YOUR CURRENT SOURCE TREE, AND YOU TRY TO BUILD
IN IT WITHOUT PERFORMING AT LEAST 'make clean', THINGS _WILL_ BREAK. IT IS
RECOMMENDED THAT YOU RUN 'make distclean' AND THEN RERUN './configure'!
******************************* REQUIREMENTS **********************************
Necessary Requirements:
- A supported platform (look below)
- A working dynamic load library, unless
compiling as static, without module
support.
- A working lex. Solaris /usr/ccs/bin/lex
appears to be broken, on this system flex
should be used.
Feature Specific Requirements:
- For the SSL Challenge controlled OPER feature and encrypted server links,
a working OpenSSL library
- For encrypted oper and (optional) server passwords, a working DES and/or
MD5 library
*******************************************************************************
- To report bugs in ircd-ratbox, send the bug report to ircd-ratbox@lists.ratbox.org
- Known bugs are listed in the BUGS file
- See the INSTALL document for info on configuring and compiling
ircd-ratbox.
- Please read doc/index.txt to get an overview of the current documentation.
- Old Hybrid 5/6 configuration files are no longer supported. All conf
files will have to be converted to the new format. A convertconf
utility is provided and installed into bin/.
- If you are wondering why config.h is practically empty, its because many
things that were once in config.h are now specified in the 'general'
block of ircd.conf. Look at example.conf for more information about
these options.
- The files, /etc/services, /etc/protocols, and /etc/resolv.conf, MUST be
readable by the user running the server in order for ircd to start.
Errors from adns causing the ircd to refuse to start up are often related
to permission problems on these files.
- There is a mailing list for ircd-ratbox. To subscribe to this list
visit http://lists.ratbox.org/cgi-bin/mailman/listinfo/ircd-ratbox
Note that this list also gets the commit emails from the CVS server.
- FREEBSD USERS: if you are compiling with ipv6 you may experience
problems with ipv4 due to the way the socket code is written. To
fix this you must: "sysctl net.inet6.ip6.v6only=0"
- SOLARIS USERS: this code appears to tickle a bug in older gcc and
egcs ONLY on 64-bit Solaris7. gcc-2.95 and SunPro C on 64bit should
work fine, and any gcc or SunPro compiled on 32bit.
- DARWIN AND MACOS X USERS: You must be using at least the December 2001
Development Tools from Apple to build ircd-ratbox with shared modules.
Before then you MUST disable shared modules, as we do not have the proper
flags for cc(1) prior to that point to produce shared modules.
- SUPPORTED PLATFORMS: this code should compile without any warnings
on FreeBSD 3.x/4.x, RedHat 6.2, Debian Potato and Solaris 7/8 sparc.
Please let us know if you find otherwise.
It probably does not compile on AIX, IRIX or libc5 Linux.
- TESTED PLATFORMS: The code has been tested on the following platforms, and
is known to run properly.
FreeBSD 3.x/4.x
Linux glibc
Solaris 2.6/7/8
OpenBSD 2.8
NetBSD 1.4
- Please read doc/whats-new.txt for information about what is in this release
- Other files recommended for reading: BUGS, INSTALL
--------------------------------------------------------------------------------
$Id: README.FIRST 1837 2006-08-22 14:05:58Z nenolod $

View File

@ -1,35 +0,0 @@
# Elemental-IRCd
**Elemental-IRCd** is a high performance, lightweight, and scalable
IRC daemon. It is a fork of the now-defunct ShadowIRCD and seeks to continue in
the direction ShadowIRCD was headed.
## Supported Platforms
All modern \*NIX systems should work. You need the equivalent of the following
Debian packages:
- `libssl-dev`
- `flex`
- `bison`
- `build-essential`
```
Cassy | If you put something on a platform which cannot support it
| it may tip and fall and become broken. Simple physics.
```
Read the included documentation for detailed compilation and install
directions.
## Support
The official channel for Elemental-IRCd is `#elemental-ircd` on
`irc.yolo-swag.com`. Anyone with push access to the repository will have halfop
(`+h`, `%`) or higher.
Atheme and Anope (1.8 and 2.0) modules are included in the source tree of
Elemental-IRCd. For most cases the default `protocol/elemental-ircd` module in
Atheme should be fine, but this version will always be more up-to-date.
To report bugs, please use the GitHub issue tracker.

42
TODO Normal file
View File

@ -0,0 +1,42 @@
/ = in progress, x = done, ? = to be discussed, F = charybdis3.1 or next releases
[/] finish legacy code removal
[x] remove 2.8 report_error() in ratbox imported stuff
[F] client.c, channel.c is very 2.8 style still. it'd be nice to pack them into their own
namespace and such. moreover, the other 2.8 code needs similar rewriting/reworking too...
[ ] rewrite s_auth.c
[ ] authentication state/lock manager
[ ] move resolver/auth checker code into separated modules
[x] port to libratbox
[x] get it running
[x] clean up maxconnections kludges &c
[x] in-process SSL
[x] port and use ratbox ssld for server links
[/] ssl stuff
[x] client-to-client ssl
[x] server-to-server ssl
[x] ssl usermode (+Z)
[x] ssl channelmode (done by extban and chm_compat)
[ ] acknowledgement message for SSL users like '* *** You are connected using SSL cipher "DHE RSA-AES 128 CBC-SHA"'
[ ] ssl stuff files generator in ./configure time
[x] merge some stuff from ircd-seven directly (to be determined what)
[x] remote d:lines support
[F] kline/xline/resv sync
[F] make an ability of using bandb instead of .conf files as bans storage
[F] drop non-TS6 (legacy protocol) support
[F] Doxygen code documentation
[F] module engine rework
[F] more beautiful way of adding new channel modes by module
[F] make nick/user/host validation functions/match tables able to work in separated modules,
this will help us making support for native characters sets/slashes in host etc
[F] auth checker module
[F] resolver module
[x] Remove glines entirely
--- other stuff
[?] PASS selector:password for auth{} from ircd-seven? (useful for dynamic IPs)
[?] +C (noctcp) channel/usermode from ircd-seven?
[?] internally split out +o/+v "ranks" into a series of permissions. this could allow for configure-defined
special access levels, halfops, etc. (would need to match globally, somehow. extra SVINFO param?)
[?] somehow hide channel operators like ircnet can do?
[x] merge m_join.c and m_sjoin.c in one module (same functions, done in ratbox3)
[x] create chmode.h and put there all declarations of chm_* - this will make some modules clean

View File

@ -1,23 +0,0 @@
# TODO
## elemental-ircd 6.7
- [ ] Finish websocket support
- [x] Configuration for websocket ports
- [x] HTTP parsing of websocket data
- [ ] Client connections via websockets
- [x] Send cloaked host as METADATA
- [x] Fix a flaw in the kick permission logic
- [x] Fix segfault on `autojoin_opers`
- [x] Update many of the helpfiles with the proper permissions
- [ ] extban by certfp
### Services Modules
- [ ] Support METADATA for the cloaked host
- [ ] Anope 2.0
- [ ] Atheme
- [ ] Have /hs off re-set the cloaked host instead of the user's real hostmask
- [ ] Anope 2.0
- [ ] Atheme

13
aclocal.m4 vendored
View File

@ -2,17 +2,8 @@
AC_DEFUN([AC_DEFINE_DIR], [
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
last_ac_define_dir=`eval echo [$]$2`
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
ac_define_dir=`eval echo [$]$2`
ac_define_dir=`eval echo [$]ac_define_dir`
$1="$ac_define_dir"
AC_SUBST($1)
ifelse($3, ,

View File

@ -1,108 +0,0 @@
#
# Makefile.in for bandb/src
#
# $Id: Makefile.in 1285 2006-05-05 15:03:53Z nenolod $
#
CC = @CC@
INSTALL = @INSTALL@
INSTALL_BIN = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SUID = @INSTALL_PROGRAM@ -o root -m 4755
RM = @RM@
LEX = @LEX@
LEXLIB = @LEXLIB@
CFLAGS = @IRC_CFLAGS@ -DIRCD_PREFIX=\"@prefix@\"
LDFLAGS = @LDFLAGS@
MKDEP = @MKDEP@ -DIRCD_PREFIX=\"@prefix@\"
MV = @MV@
RM = @RM@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
libexecdir = @libexecdir@
pkglibexecdir = @pkglibexecdir@
sysconfdir = @sysconfdir@
localstatedir = @localstatedir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
ZIP_LIB = @ZLIB_LD@
IRCDLIBS = @MODULES_LIBS@ -L../libratbox/src/.libs -lratbox @LIBS@ $(SSL_LIBS) $(ZIP_LIB)
INCLUDES = -I. -I../include -I../libratbox/include $(SSL_INCLUDES)
CPPFLAGS = ${INCLUDES} @CPPFLAGS@
CFLAGS += -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION=1
pkglibexec_PROGS = bandb
bin_PROGS = bantool
PROGS = $(pkglibexec_PROGS) $(bin_PROGS)
BANDB_SOURCES = \
bandb.c \
rsdb_snprintf.c \
rsdb_sqlite3.c \
sqlite3.c
BANDB_OBJECTS = ${BANDB_SOURCES:.c=.o}
BANTOOL_SOURCES = \
bantool.c \
rsdb_snprintf.c \
rsdb_sqlite3.c \
sqlite3.c
BANTOOL_OBJECTS = ${BANTOOL_SOURCES:.c=.o}
all: bandb bantool
build: all
bandb: ${BANDB_OBJECTS}
${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${BANDB_OBJECTS} ${IRCDLIBS}
bantool: ${BANTOOL_OBJECTS}
${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${BANTOOL_OBJECTS} ${IRCDLIBS}
install: build
@echo "ircd: installing bandb ($(PROGS))"
@for i in $(bin_PROGS); do \
if test -f $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; then \
$(MV) $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i.old; \
fi; \
$(INSTALL_BIN) $$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; \
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:
${CC} ${CPPFLAGS} ${CFLAGS} -c $<
.PHONY: depend clean distclean
depend:
@${MKDEP} ${CPPFLAGS} ${SOURCES} > .depend.tmp
@sed -e '/^# DO NOT DELETE THIS LINE/,$$d' <Makefile >Makefile.depend
@echo '# DO NOT DELETE THIS LINE!!!' >>Makefile.depend
@echo '# make depend needs it.' >>Makefile.depend
@cat .depend.tmp >>Makefile.depend
@mv Makefile.depend Makefile
@rm -f .depend.tmp
clean:
${RM} -f *.o *~ *.core core bandb
lint:
lint -aacgprxhH $(CPPFLAGS) -DIRCD_PREFIX=\"@prefix@\" $(SOURCES) >>../lint.out
distclean: clean
${RM} -f Makefile
# End of Makefile

View File

@ -1,324 +0,0 @@
/* bandb/bandb.c
*
* Copyright (C) 2006 Lee Hardy <lee -at- leeh.co.uk>
* Copyright (C) 2006-2008 ircd-ratbox development team
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1.Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2.Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3.The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 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.
*
* $Id: bandb.c 26094 2008-09-19 15:33:46Z androsyn $
*/
#include "setup.h"
#include <ratbox_lib.h>
#include <stdio.h>
#include "rsdb.h"
#include "common.h"
#define MAXPARA 10
#define COMMIT_INTERVAL 3 /* seconds */
typedef enum {
BANDB_KLINE,
BANDB_DLINE,
BANDB_XLINE,
BANDB_RESV,
LAST_BANDB_TYPE
} bandb_type;
static char bandb_letter[LAST_BANDB_TYPE] = {
'K', 'D', 'X', 'R'
};
static const char *bandb_table[LAST_BANDB_TYPE] = {
"kline", "dline", "xline", "resv"
};
static rb_helper *bandb_helper;
static int in_transaction;
static void check_schema(void);
static void
bandb_commit(void *unused)
{
rsdb_transaction(RSDB_TRANS_END);
in_transaction = 0;
}
static void
parse_ban(bandb_type type, char *parv[], int parc)
{
const char *mask1 = NULL;
const char *mask2 = NULL;
const char *oper = NULL;
const char *curtime = NULL;
const char *reason = NULL;
const char *perm = NULL;
int para = 1;
if(type == BANDB_KLINE) {
if(parc != 7)
return;
} else if(parc != 6)
return;
mask1 = parv[para++];
if(type == BANDB_KLINE)
mask2 = parv[para++];
oper = parv[para++];
curtime = parv[para++];
perm = parv[para++];
reason = parv[para++];
if(!in_transaction) {
rsdb_transaction(RSDB_TRANS_START);
in_transaction = 1;
rb_event_addonce("bandb_commit", bandb_commit, NULL,
COMMIT_INTERVAL);
}
rsdb_exec(NULL,
"INSERT INTO %s (mask1, mask2, oper, time, perm, reason) VALUES('%Q', '%Q', '%Q', %s, %s, '%Q')",
bandb_table[type], mask1, mask2 ? mask2 : "", oper, curtime, perm, reason);
}
static void
parse_unban(bandb_type type, char *parv[], int parc)
{
const char *mask1 = NULL;
const char *mask2 = NULL;
if(type == BANDB_KLINE) {
if(parc != 3)
return;
} else if(parc != 2)
return;
mask1 = parv[1];
if(type == BANDB_KLINE)
mask2 = parv[2];
if(!in_transaction) {
rsdb_transaction(RSDB_TRANS_START);
in_transaction = 1;
rb_event_addonce("bandb_commit", bandb_commit, NULL,
COMMIT_INTERVAL);
}
rsdb_exec(NULL, "DELETE FROM %s WHERE mask1='%Q' AND mask2='%Q'",
bandb_table[type], mask1, mask2 ? mask2 : "");
}
static void
list_bans(void)
{
static char buf[512];
struct rsdb_table table;
int i, j;
/* schedule a clear of anything already pending */
rb_helper_write_queue(bandb_helper, "C");
for(i = 0; i < LAST_BANDB_TYPE; i++) {
rsdb_exec_fetch(&table, "SELECT mask1,mask2,oper,reason FROM %s WHERE 1",
bandb_table[i]);
for(j = 0; j < table.row_count; j++) {
if(i == BANDB_KLINE)
snprintf(buf, sizeof(buf), "%c %s %s %s :%s",
bandb_letter[i], table.row[j][0],
table.row[j][1], table.row[j][2], table.row[j][3]);
else
snprintf(buf, sizeof(buf), "%c %s %s :%s",
bandb_letter[i], table.row[j][0],
table.row[j][2], table.row[j][3]);
rb_helper_write_queue(bandb_helper, "%s", buf);
}
rsdb_exec_fetch_end(&table);
}
rb_helper_write(bandb_helper, "F");
}
static void
parse_request(rb_helper *helper)
{
static char *parv[MAXPARA + 1];
static char readbuf[READBUF_SIZE];
int parc;
int len;
while((len = rb_helper_read(helper, readbuf, sizeof(readbuf))) > 0) {
parc = rb_string_to_array(readbuf, parv, MAXPARA);
if(parc < 1)
continue;
switch (parv[0][0]) {
case 'K':
parse_ban(BANDB_KLINE, parv, parc);
break;
case 'D':
parse_ban(BANDB_DLINE, parv, parc);
break;
case 'X':
parse_ban(BANDB_XLINE, parv, parc);
break;
case 'R':
parse_ban(BANDB_RESV, parv, parc);
break;
case 'k':
parse_unban(BANDB_KLINE, parv, parc);
break;
case 'd':
parse_unban(BANDB_DLINE, parv, parc);
break;
case 'x':
parse_unban(BANDB_XLINE, parv, parc);
break;
case 'r':
parse_unban(BANDB_RESV, parv, parc);
break;
case 'L':
list_bans();
break;
default:
break;
}
}
}
static void
error_cb(rb_helper *helper)
{
if(in_transaction)
rsdb_transaction(RSDB_TRANS_END);
exit(1);
}
#ifndef WINDOWS
static void
dummy_handler(int sig)
{
return;
}
#endif
static void
setup_signals()
{
#ifndef WINDOWS
struct sigaction act;
act.sa_flags = 0;
act.sa_handler = SIG_IGN;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask, SIGPIPE);
sigaddset(&act.sa_mask, SIGALRM);
#ifdef SIGTRAP
sigaddset(&act.sa_mask, SIGTRAP);
#endif
#ifdef SIGWINCH
sigaddset(&act.sa_mask, SIGWINCH);
sigaction(SIGWINCH, &act, 0);
#endif
sigaction(SIGPIPE, &act, 0);
#ifdef SIGTRAP
sigaction(SIGTRAP, &act, 0);
#endif
act.sa_handler = dummy_handler;
sigaction(SIGALRM, &act, 0);
#endif
}
static void
db_error_cb(const char *errstr)
{
char buf[256];
snprintf(buf, sizeof(buf), "! :%s", errstr);
rb_helper_write(bandb_helper, buf);
rb_sleep(2 << 30, 0);
exit(1);
}
int
main(int argc, char *argv[])
{
setup_signals();
bandb_helper = rb_helper_child(parse_request, error_cb, NULL, NULL, NULL, 256, 256, 256, 256); /* XXX fix me */
if(bandb_helper == NULL) {
fprintf(stderr,
"This is ircd-ratbox bandb. You aren't supposed to run me directly. Maybe you want bantool?\n");
fprintf(stderr,
"However I will print my Id tag $Id: bandb.c 26094 2008-09-19 15:33:46Z androsyn $\n");
fprintf(stderr, "Have a nice day\n");
exit(1);
}
rsdb_init(db_error_cb);
check_schema();
rb_helper_loop(bandb_helper, 0);
return 0;
}
static void
check_schema(void)
{
struct rsdb_table table;
int i;
for(i = 0; i < LAST_BANDB_TYPE; i++) {
rsdb_exec_fetch(&table,
"SELECT name FROM sqlite_master WHERE type='table' AND name='%s'",
bandb_table[i]);
rsdb_exec_fetch_end(&table);
if(!table.row_count)
rsdb_exec(NULL,
"CREATE TABLE %s (mask1 TEXT, mask2 TEXT, oper TEXT, time INTEGER, perm INTEGER, reason TEXT)",
bandb_table[i]);
}
}

View File

@ -1,855 +0,0 @@
/**
* ircd-ratbox: A slightly useful ircd.
* bantool.c: The ircd-ratbox database managment tool.
*
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
* Copyright (C) 1996-2002 Hybrid Development Team
* Copyright (C) 2002-2008 ircd-ratbox development team
* Copyright (C) 2008 Daniel J Reidy <dubkat@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: bantool.c 26164 2008-10-26 19:52:43Z androsyn $
*
*
* The following server admins have either contributed various configs to test against,
* or helped with debugging and feature requests. Many thanks to them.
* stevoo / efnet.port80.se
* AndroSyn / irc2.choopa.net, irc.igs.ca
* Salvation / irc.blessed.net
* JamesOff / efnet.demon.co.uk
*
* Thanks to AndroSyn for challenging me to learn C on the fly :)
* BUGS Direct Question, Bug Reports, and Feature Requests to #ratbox on EFnet.
* BUGS Complaints >/dev/null
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "stdinc.h"
#include "common.h"
#include "rsdb.h"
#define EmptyString(x) ((x == NULL) || (*(x) == '\0'))
#define CheckEmpty(x) EmptyString(x) ? "" : x
#define BT_VERSION "0.4.1"
typedef enum {
BANDB_KLINE,
BANDB_KLINE_PERM,
BANDB_DLINE,
BANDB_DLINE_PERM,
BANDB_XLINE,
BANDB_XLINE_PERM,
BANDB_RESV,
BANDB_RESV_PERM,
LAST_BANDB_TYPE
} bandb_type;
static char bandb_letter[LAST_BANDB_TYPE] = {
'K', 'K', 'D', 'D', 'X', 'X', 'R', 'R'
};
static const char *bandb_table[LAST_BANDB_TYPE] = {
"kline", "kline", "dline", "dline", "xline", "xline", "resv", "resv"
};
static const char *bandb_suffix[LAST_BANDB_TYPE] = {
"", ".perm",
"", ".perm",
"", ".perm",
"", ".perm"
};
static char me[PATH_MAX];
/* *INDENT-OFF* */
/* report counters */
struct counter {
unsigned int klines;
unsigned int dlines;
unsigned int xlines;
unsigned int resvs;
unsigned int error;
} count = {0, 0, 0, 0, 0};
/* flags set by command line options */
struct flags {
int none;
int export;
int import;
int verify;
int vacuum;
int pretend;
int verbose;
int wipe;
int dupes_ok;
} flag = {YES, NO, NO, NO, NO, NO, NO, NO, NO};
/* *INDENT-ON* */
static int table_has_rows(const char *table);
static int table_exists(const char *table);
static const char *clean_gecos_field(const char *gecos);
static char *bt_smalldate(const char *string);
static char *getfield(char *newline);
static char *strip_quotes(const char *string);
static char *mangle_reason(const char *string);
static char *escape_quotes(const char *string);
static void db_error_cb(const char *errstr);
static void db_reclaim_slack(void);
static void export_config(const char *conf, int id);
static void import_config(const char *conf, int id);
static void check_schema(void);
static void print_help(int i_exit);
static void wipe_schema(void);
static void drop_dupes(const char *user, const char *host, const char *t);
/**
* swing your pants
*/
int
main(int argc, char *argv[])
{
char etc[PATH_MAX];
char conf[PATH_MAX];
int opt;
int i;
rb_strlcpy(me, argv[0], sizeof(me));
while((opt = getopt(argc, argv, "hieuspvwd")) != -1) {
switch (opt) {
case 'h':
print_help(EXIT_SUCCESS);
break;
case 'i':
flag.none = NO;
flag.import = YES;
break;
case 'e':
flag.none = NO;
flag.export = YES;
break;
case 'u':
flag.none = NO;
flag.verify = YES;
break;
case 's':
flag.none = NO;
flag.vacuum = YES;
break;
case 'p':
flag.pretend = YES;
break;
case 'v':
flag.verbose = YES;
break;
case 'w':
flag.wipe = YES;
break;
case 'd':
flag.dupes_ok = YES;
break;
default: /* '?' */
print_help(EXIT_FAILURE);
}
}
/* they should really read the help. */
if(flag.none)
print_help(EXIT_FAILURE);
if((flag.import && flag.export) || (flag.export && flag.wipe)
|| (flag.verify && flag.pretend) || (flag.export && flag.pretend)) {
fprintf(stderr, "* Error: Conflicting flags.\n");
if(flag.export && flag.pretend)
fprintf(stderr, "* There is nothing to 'pretend' when exporting.\n");
fprintf(stderr, "* For an explination of commands, run: %s -h\n", me);
exit(EXIT_FAILURE);
}
if(argv[optind] != NULL)
rb_strlcpy(etc, argv[optind], sizeof(etc));
else
rb_strlcpy(etc, ETCPATH, sizeof(ETCPATH));
fprintf(stdout,
"* ircd-ratbox bantool v.%s ($Id: bantool.c 26164 2008-10-26 19:52:43Z androsyn $)\n",
BT_VERSION);
if(flag.pretend == NO) {
if(rsdb_init(db_error_cb) == -1) {
fprintf(stderr, "* Error: Unable to open database\n");
exit(EXIT_FAILURE);
}
check_schema();
if(flag.vacuum)
db_reclaim_slack();
if(flag.import && flag.wipe) {
flag.dupes_ok = YES; /* dont check for dupes if we are wiping the db clean */
for(i = 0; i < 3; i++)
fprintf(stdout,
"* WARNING: YOU ARE ABOUT TO WIPE YOUR DATABASE!\n");
fprintf(stdout, "* Press ^C to abort! ");
fflush(stdout);
rb_sleep(10, 0);
fprintf(stdout, "Carrying on...\n");
wipe_schema();
}
}
if(flag.verbose && flag.dupes_ok == YES)
fprintf(stdout, "* Allowing duplicate bans...\n");
/* checking for our files to import or export */
for(i = 0; i < LAST_BANDB_TYPE; i++) {
snprintf(conf, sizeof(conf), "%s/%s.conf%s",
etc, bandb_table[i], bandb_suffix[i]);
if(flag.import && flag.pretend == NO)
rsdb_transaction(RSDB_TRANS_START);
if(flag.import)
import_config(conf, i);
if(flag.export)
export_config(conf, i);
if(flag.import && flag.pretend == NO)
rsdb_transaction(RSDB_TRANS_END);
}
if(flag.import) {
if(count.error && flag.verbose)
fprintf(stderr, "* I was unable to locate %i config files to import.\n",
count.error);
fprintf(stdout, "* Import Stats: Klines: %i, Dlines: %i, Xlines: %i, Resvs: %i \n",
count.klines, count.dlines, count.xlines, count.resvs);
fprintf(stdout,
"*\n* If your IRC server is currently running, newly imported bans \n* will not take effect until you issue the command: /quote rehash bans\n");
if(flag.pretend)
fprintf(stdout,
"* Pretend mode engaged. Nothing was actually entered into the database.\n");
}
return 0;
}
/**
* export the database to old-style flat files
*/
static void
export_config(const char *conf, int id)
{
struct rsdb_table table;
static char sql[BUFSIZE * 2];
static char buf[512];
FILE *fd = NULL;
int j;
/* for sanity sake */
const int mask1 = 0;
const int mask2 = 1;
const int reason = 2;
const int oper = 3;
const int ts = 4;
/* const int perm = 5; */
if(!table_has_rows(bandb_table[id]))
return;
if(strstr(conf, ".perm") != 0)
snprintf(sql, sizeof(sql),
"SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 1 ORDER BY time",
bandb_table[id]);
else
snprintf(sql, sizeof(sql),
"SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 0 ORDER BY time",
bandb_table[id]);
rsdb_exec_fetch(&table, sql);
if(table.row_count <= 0) {
rsdb_exec_fetch_end(&table);
return;
}
if(flag.verbose)
fprintf(stdout, "* checking for %s: ", conf); /* debug */
/* open config for reading, or skip to the next */
if(!(fd = fopen(conf, "w"))) {
if(flag.verbose)
fprintf(stdout, "\tmissing.\n");
count.error++;
return;
}
for(j = 0; j < table.row_count; j++) {
switch (id) {
case BANDB_DLINE:
case BANDB_DLINE_PERM:
snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n",
table.row[j][mask1],
mangle_reason(table.row[j][reason]),
bt_smalldate(table.row[j][ts]),
table.row[j][oper], table.row[j][ts]);
break;
case BANDB_XLINE:
case BANDB_XLINE_PERM:
snprintf(buf, sizeof(buf),
"\"%s\",\"0\",\"%s\",\"%s\",%s\n",
escape_quotes(table.row[j][mask1]),
mangle_reason(table.row[j][reason]),
table.row[j][oper], table.row[j][ts]);
break;
case BANDB_RESV:
case BANDB_RESV_PERM:
snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"%s\",%s\n",
table.row[j][mask1],
mangle_reason(table.row[j][reason]),
table.row[j][oper], table.row[j][ts]);
break;
default: /* Klines */
snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n",
table.row[j][mask1], table.row[j][mask2],
mangle_reason(table.row[j][reason]),
bt_smalldate(table.row[j][ts]), table.row[j][oper],
table.row[j][ts]);
break;
}
fprintf(fd, "%s", buf);
}
rsdb_exec_fetch_end(&table);
if(flag.verbose)
fprintf(stdout, "\twritten.\n");
fclose(fd);
}
/**
* attempt to condense the individual conf functions into one
*/
static void
import_config(const char *conf, int id)
{
FILE *fd;
char line[BUFSIZE];
char *p;
int i = 0;
char f_perm = 0;
const char *f_mask1 = NULL;
const char *f_mask2 = NULL;
const char *f_oper = NULL;
const char *f_time = NULL;
const char *f_reason = NULL;
const char *f_oreason = NULL;
char newreason[REASONLEN];
if(flag.verbose)
fprintf(stdout, "* checking for %s: ", conf); /* debug */
/* open config for reading, or skip to the next */
if(!(fd = fopen(conf, "r"))) {
if(flag.verbose)
fprintf(stdout, "%*s", strlen(bandb_suffix[id]) > 0 ? 10 : 15,
"missing.\n");
count.error++;
return;
}
if(strstr(conf, ".perm") != 0)
f_perm = 1;
/* xline
* "SYSTEM","0","banned","stevoo!stevoo@efnet.port80.se{stevoo}",1111080437
* resv
* "OseK","banned nickname","stevoo!stevoo@efnet.port80.se{stevoo}",1111031619
* dline
* "194.158.192.0/19","laptop scammers","","2005/3/17 05.33","stevoo!stevoo@efnet.port80.se{stevoo}",1111033988
*/
while(fgets(line, sizeof(line), fd)) {
if((p = strpbrk(line, "\r\n")) != NULL)
*p = '\0';
if((*line == '\0') || (*line == '#'))
continue;
/* mask1 */
f_mask1 = getfield(line);
if(EmptyString(f_mask1))
continue;
/* mask2 */
switch (id) {
case BANDB_XLINE:
case BANDB_XLINE_PERM:
f_mask1 = escape_quotes(clean_gecos_field(f_mask1));
getfield(NULL); /* empty field */
break;
case BANDB_RESV:
case BANDB_RESV_PERM:
case BANDB_DLINE:
case BANDB_DLINE_PERM:
break;
default:
f_mask2 = getfield(NULL);
if(EmptyString(f_mask2))
continue;
break;
}
/* reason */
f_reason = getfield(NULL);
if(EmptyString(f_reason))
continue;
/* oper comment */
switch (id) {
case BANDB_KLINE:
case BANDB_KLINE_PERM:
case BANDB_DLINE:
case BANDB_DLINE_PERM:
f_oreason = getfield(NULL);
getfield(NULL);
break;
default:
break;
}
f_oper = getfield(NULL);
f_time = strip_quotes(f_oper + strlen(f_oper) + 2);
if(EmptyString(f_oper))
f_oper = "unknown";
/* meh */
if(id == BANDB_KLINE || id == BANDB_KLINE_PERM) {
if(strstr(f_mask1, "!") != NULL) {
fprintf(stderr,
"* SKIPPING INVALID KLINE %s@%s set by %s\n",
f_mask1, f_mask2, f_oper);
fprintf(stderr, " You may wish to re-apply it correctly.\n");
continue;
}
}
/* append operreason_field to reason_field */
if(!EmptyString(f_oreason))
snprintf(newreason, sizeof(newreason), "%s | %s", f_reason, f_oreason);
else
snprintf(newreason, sizeof(newreason), "%s", f_reason);
if(flag.pretend == NO) {
if(flag.dupes_ok == NO)
drop_dupes(f_mask1, f_mask2, bandb_table[id]);
rsdb_exec(NULL,
"INSERT INTO %s (mask1, mask2, oper, time, perm, reason) VALUES('%Q','%Q','%Q','%Q','%d','%Q')",
bandb_table[id], f_mask1, f_mask2, f_oper, f_time, f_perm,
newreason);
}
if(flag.pretend && flag.verbose)
fprintf(stdout,
"%s: perm(%d) mask1(%s) mask2(%s) oper(%s) reason(%s) time(%s)\n",
bandb_table[id], f_perm, f_mask1, f_mask2, f_oper, newreason,
f_time);
i++;
}
switch (bandb_letter[id]) {
case 'K':
count.klines += i;
break;
case 'D':
count.dlines += i;
break;
case 'X':
count.xlines += i;
break;
case 'R':
count.resvs += i;
break;
default:
break;
}
if(flag.verbose)
fprintf(stdout, "%*s\n", strlen(bandb_suffix[id]) > 0 ? 10 : 15, "imported.");
return;
}
/**
* getfield
*
* inputs - input buffer
* output - next field
* side effects - field breakup for ircd.conf file.
*/
char *
getfield(char *newline)
{
static char *line = NULL;
char *end, *field;
if(newline != NULL)
line = newline;
if(line == NULL)
return (NULL);
field = line;
/* XXX make this skip to first " if present */
if(*field == '"')
field++;
else
return (NULL); /* mal-formed field */
end = strchr(line, ',');
while(1) {
/* no trailing , - last field */
if(end == NULL) {
end = line + strlen(line);
line = NULL;
if(*end == '"') {
*end = '\0';
return field;
} else
return NULL;
} else {
/* look for a ", to mark the end of a field.. */
if(*(end - 1) == '"') {
line = end + 1;
end--;
*end = '\0';
return field;
}
/* search for the next ',' */
end++;
end = strchr(end, ',');
}
}
return NULL;
}
/**
* strip away "quotes" from around strings
*/
static char *
strip_quotes(const char *string)
{
static char buf[14]; /* int(11) + 2 + \0 */
char *str = buf;
if(string == NULL)
return NULL;
while(*string) {
if(*string != '"') {
*str++ = *string;
}
string++;
}
*str = '\0';
return buf;
}
/**
* escape quotes in a string
*/
static char *
escape_quotes(const char *string)
{
static char buf[BUFSIZE * 2];
char *str = buf;
if(string == NULL)
return NULL;
while(*string) {
if(*string == '"') {
*str++ = '\\';
*str++ = '"';
} else {
*str++ = *string;
}
string++;
}
*str = '\0';
return buf;
}
static char *
mangle_reason(const char *string)
{
static char buf[BUFSIZE * 2];
char *str = buf;
if(string == NULL)
return NULL;
while(*string) {
switch (*string) {
case '"':
*str = '\'';
break;
case ':':
*str = ' ';
break;
default:
*str = *string;
}
string++;
str++;
}
*str = '\0';
return buf;
}
/**
* change spaces to \s in gecos field
*/
static const char *
clean_gecos_field(const char *gecos)
{
static char buf[BUFSIZE * 2];
char *str = buf;
if(gecos == NULL)
return NULL;
while(*gecos) {
if(*gecos == ' ') {
*str++ = '\\';
*str++ = 's';
} else
*str++ = *gecos;
gecos++;
}
*str = '\0';
return buf;
}
/**
* verify the database integrity, and if necessary create apropriate tables
*/
static void
check_schema(void)
{
int i, j;
char type[8]; /* longest string is 'INTEGER\0' */
if(flag.verify || flag.verbose)
fprintf(stdout, "* Verifying database.\n");
const char *columns[] = {
"perm",
"mask1",
"mask2",
"oper",
"time",
"reason",
NULL
};
for(i = 0; i < LAST_BANDB_TYPE; i++) {
if(!table_exists(bandb_table[i])) {
rsdb_exec(NULL,
"CREATE TABLE %s (mask1 TEXT, mask2 TEXT, oper TEXT, time INTEGER, perm INTEGER, reason TEXT)",
bandb_table[i]);
}
/*
* i can't think of any better way to do this, other then attempt to
* force the creation of column that may, or may not already exist. --dubkat
*/
else {
for(j = 0; columns[j] != NULL; j++) {
if(!strcmp(columns[j], "time") && !strcmp(columns[j], "perm"))
rb_strlcpy(type, "INTEGER", sizeof(type));
else
rb_strlcpy(type, "TEXT", sizeof(type));
/* attempt to add a column with extreme prejudice, errors are ignored */
rsdb_exec(NULL, "ALTER TABLE %s ADD COLUMN %s %s", bandb_table[i],
columns[j], type);
}
}
i++; /* skip over .perm */
}
}
static void
db_reclaim_slack(void)
{
fprintf(stdout, "* Reclaiming free space.\n");
rsdb_exec(NULL, "VACUUM");
}
/**
* check that appropriate tables exist.
*/
static int
table_exists(const char *dbtab)
{
struct rsdb_table table;
rsdb_exec_fetch(&table, "SELECT name FROM sqlite_master WHERE type='table' AND name='%s'",
dbtab);
rsdb_exec_fetch_end(&table);
return table.row_count;
}
/**
* check that there are actual entries in a table
*/
static int
table_has_rows(const char *dbtab)
{
struct rsdb_table table;
rsdb_exec_fetch(&table, "SELECT * FROM %s", dbtab);
rsdb_exec_fetch_end(&table);
return table.row_count;
}
/**
* completly wipes out an existing ban.db of all entries.
*/
static void
wipe_schema(void)
{
int i;
rsdb_transaction(RSDB_TRANS_START);
for(i = 0; i < LAST_BANDB_TYPE; i++) {
rsdb_exec(NULL, "DROP TABLE %s", bandb_table[i]);
i++; /* double increment to skip over .perm */
}
rsdb_transaction(RSDB_TRANS_END);
check_schema();
}
/**
* remove pre-existing duplicate bans from the database.
* we favor the new, imported ban over the one in the database
*/
void
drop_dupes(const char *user, const char *host, const char *t)
{
rsdb_exec(NULL, "DELETE FROM %s WHERE mask1='%Q' AND mask2='%Q'", t, user, host);
}
static void
db_error_cb(const char *errstr)
{
return;
}
/**
* convert unix timestamp to human readable (small) date
*/
static char *
bt_smalldate(const char *string)
{
static char buf[MAX_DATE_STRING];
struct tm *lt;
time_t t;
t = strtol(string, NULL, 10);
lt = gmtime(&t);
if(lt == NULL)
return NULL;
snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d",
lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min);
return buf;
}
/**
* you are here ->.
*/
void
print_help(int i_exit)
{
fprintf(stderr, "bantool v.%s - the ircd-ratbox database tool.\n", BT_VERSION);
fprintf(stderr, "Copyright (C) 2008 Daniel J Reidy <dubkat@gmail.com>\n");
fprintf(stderr, "$Id: bantool.c 26164 2008-10-26 19:52:43Z androsyn $\n\n");
fprintf(stderr, "This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n\n");
fprintf(stderr, "Usage: %s <-i|-e> [-p] [-v] [-h] [-d] [-w] [path]\n", me);
fprintf(stderr, " -h : Display some slightly useful help.\n");
fprintf(stderr, " -i : Actually import configs into your database.\n");
fprintf(stderr, " -e : Export your database to old-style flat files.\n");
fprintf(stderr,
" This is suitable for redistrubuting your banlists, or creating backups.\n");
fprintf(stderr, " -s : Reclaim empty slack space the database may be taking up.\n");
fprintf(stderr, " -u : Update the database tables to support any new features.\n");
fprintf(stderr,
" This is automaticlly done if you are importing or exporting\n");
fprintf(stderr, " but should be run whenever you upgrade the ircd.\n");
fprintf(stderr,
" -p : pretend, checks for the configs, and parses them, then tells you some data...\n");
fprintf(stderr, " but does not touch your database.\n");
fprintf(stderr,
" -v : Be verbose... and it *is* very verbose! (intended for debugging)\n");
fprintf(stderr, " -d : Enable checking for redunant entries.\n");
fprintf(stderr, " -w : Completly wipe your database clean. May be used with -i \n");
fprintf(stderr,
" path : An optional directory containing old ratbox configs for import, or export.\n");
fprintf(stderr, " If not specified, it looks in PREFIX/etc.\n");
exit(i_exit);
}

View File

@ -1,39 +0,0 @@
#ifndef INCLUDED_rsdb_h
#define INCLUDED_rsdb_h
/* error handler callback */
typedef void rsdb_error_cb(const char *);
typedef int (*rsdb_callback) (int, const char **);
typedef enum rsdb_transtype {
RSDB_TRANS_START,
RSDB_TRANS_END
}
rsdb_transtype;
struct rsdb_table {
char ***row;
int row_count;
int col_count;
void *arg;
};
int rsdb_init(rsdb_error_cb *);
void rsdb_shutdown(void);
const char *rsdb_quote(const char *src);
void rsdb_exec(rsdb_callback cb, const char *format, ...);
void rsdb_exec_fetch(struct rsdb_table *data, const char *format, ...);
void rsdb_exec_fetch_end(struct rsdb_table *data);
void rsdb_transaction(rsdb_transtype type);
/* rsdb_snprintf.c */
int rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args);
int rs_snprintf(char *dest, const size_t bytes, const char *format, ...);
#endif

View File

@ -1,589 +0,0 @@
/*
* libString, Copyright (C) 1999 Patrick Alken
* This library comes with absolutely NO WARRANTY
*
* Should you choose to use and/or modify this source code, please
* do so under the terms of the GNU General Public License under which
* this library is distributed.
*
*/
#include "stdinc.h"
#include "rsdb.h"
/*
* This table is arranged in chronological order from 0-999,
* however the numbers are written backwards, so the number 100
* is expressed in this table as "001".
* It's purpose is to ensure fast conversions from integers to
* ASCII strings. When an integer variable is encountered, a
* simple hash algorithm is used to determine where to look
* in this array for the corresponding string.
* This outperforms continually dividing by 10 and using the
* digit obtained as a character, because we can now divide by
* 1000 and use the remainder directly, thus cutting down on
* the number of costly divisions needed. For an integer's worst
* case, 2 divisions are needed because it can only go up to
* 32767, so after 2 divisions by 1000, and some algebra, we will
* be left with 327 which we can get from this table. This is much
* better than the 5 divisions by 10 that we would need if we did
* it the conventional way. Of course, if we made this table go
* from 0-9999, only 1 division would be needed.
* Longs and unsigned ints of course, are another matter :-).
*
* Patrick Alken <wnder@underworld.net>
*/
/*
* Set this to the number of indices (numbers) in our table
*/
#define TABLE_MAX 1000
static const char *IntTable[] = {
"000", "100", "200", "300", "400",
"500", "600", "700", "800", "900",
"010", "110", "210", "310", "410",
"510", "610", "710", "810", "910",
"020", "120", "220", "320", "420",
"520", "620", "720", "820", "920",
"030", "130", "230", "330", "430",
"530", "630", "730", "830", "930",
"040", "140", "240", "340", "440",
"540", "640", "740", "840", "940",
"050", "150", "250", "350", "450",
"550", "650", "750", "850", "950",
"060", "160", "260", "360", "460",
"560", "660", "760", "860", "960",
"070", "170", "270", "370", "470",
"570", "670", "770", "870", "970",
"080", "180", "280", "380", "480",
"580", "680", "780", "880", "980",
"090", "190", "290", "390", "490",
"590", "690", "790", "890", "990",
"001", "101", "201", "301", "401",
"501", "601", "701", "801", "901",
"011", "111", "211", "311", "411",
"511", "611", "711", "811", "911",
"021", "121", "221", "321", "421",
"521", "621", "721", "821", "921",
"031", "131", "231", "331", "431",
"531", "631", "731", "831", "931",
"041", "141", "241", "341", "441",
"541", "641", "741", "841", "941",
"051", "151", "251", "351", "451",
"551", "651", "751", "851", "951",
"061", "161", "261", "361", "461",
"561", "661", "761", "861", "961",
"071", "171", "271", "371", "471",
"571", "671", "771", "871", "971",
"081", "181", "281", "381", "481",
"581", "681", "781", "881", "981",
"091", "191", "291", "391", "491",
"591", "691", "791", "891", "991",
"002", "102", "202", "302", "402",
"502", "602", "702", "802", "902",
"012", "112", "212", "312", "412",
"512", "612", "712", "812", "912",
"022", "122", "222", "322", "422",
"522", "622", "722", "822", "922",
"032", "132", "232", "332", "432",
"532", "632", "732", "832", "932",
"042", "142", "242", "342", "442",
"542", "642", "742", "842", "942",
"052", "152", "252", "352", "452",
"552", "652", "752", "852", "952",
"062", "162", "262", "362", "462",
"562", "662", "762", "862", "962",
"072", "172", "272", "372", "472",
"572", "672", "772", "872", "972",
"082", "182", "282", "382", "482",
"582", "682", "782", "882", "982",
"092", "192", "292", "392", "492",
"592", "692", "792", "892", "992",
"003", "103", "203", "303", "403",
"503", "603", "703", "803", "903",
"013", "113", "213", "313", "413",
"513", "613", "713", "813", "913",
"023", "123", "223", "323", "423",
"523", "623", "723", "823", "923",
"033", "133", "233", "333", "433",
"533", "633", "733", "833", "933",
"043", "143", "243", "343", "443",
"543", "643", "743", "843", "943",
"053", "153", "253", "353", "453",
"553", "653", "753", "853", "953",
"063", "163", "263", "363", "463",
"563", "663", "763", "863", "963",
"073", "173", "273", "373", "473",
"573", "673", "773", "873", "973",
"083", "183", "283", "383", "483",
"583", "683", "783", "883", "983",
"093", "193", "293", "393", "493",
"593", "693", "793", "893", "993",
"004", "104", "204", "304", "404",
"504", "604", "704", "804", "904",
"014", "114", "214", "314", "414",
"514", "614", "714", "814", "914",
"024", "124", "224", "324", "424",
"524", "624", "724", "824", "924",
"034", "134", "234", "334", "434",
"534", "634", "734", "834", "934",
"044", "144", "244", "344", "444",
"544", "644", "744", "844", "944",
"054", "154", "254", "354", "454",
"554", "654", "754", "854", "954",
"064", "164", "264", "364", "464",
"564", "664", "764", "864", "964",
"074", "174", "274", "374", "474",
"574", "674", "774", "874", "974",
"084", "184", "284", "384", "484",
"584", "684", "784", "884", "984",
"094", "194", "294", "394", "494",
"594", "694", "794", "894", "994",
"005", "105", "205", "305", "405",
"505", "605", "705", "805", "905",
"015", "115", "215", "315", "415",
"515", "615", "715", "815", "915",
"025", "125", "225", "325", "425",
"525", "625", "725", "825", "925",
"035", "135", "235", "335", "435",
"535", "635", "735", "835", "935",
"045", "145", "245", "345", "445",
"545", "645", "745", "845", "945",
"055", "155", "255", "355", "455",
"555", "655", "755", "855", "955",
"065", "165", "265", "365", "465",
"565", "665", "765", "865", "965",
"075", "175", "275", "375", "475",
"575", "675", "775", "875", "975",
"085", "185", "285", "385", "485",
"585", "685", "785", "885", "985",
"095", "195", "295", "395", "495",
"595", "695", "795", "895", "995",
"006", "106", "206", "306", "406",
"506", "606", "706", "806", "906",
"016", "116", "216", "316", "416",
"516", "616", "716", "816", "916",
"026", "126", "226", "326", "426",
"526", "626", "726", "826", "926",
"036", "136", "236", "336", "436",
"536", "636", "736", "836", "936",
"046", "146", "246", "346", "446",
"546", "646", "746", "846", "946",
"056", "156", "256", "356", "456",
"556", "656", "756", "856", "956",
"066", "166", "266", "366", "466",
"566", "666", "766", "866", "966",
"076", "176", "276", "376", "476",
"576", "676", "776", "876", "976",
"086", "186", "286", "386", "486",
"586", "686", "786", "886", "986",
"096", "196", "296", "396", "496",
"596", "696", "796", "896", "996",
"007", "107", "207", "307", "407",
"507", "607", "707", "807", "907",
"017", "117", "217", "317", "417",
"517", "617", "717", "817", "917",
"027", "127", "227", "327", "427",
"527", "627", "727", "827", "927",
"037", "137", "237", "337", "437",
"537", "637", "737", "837", "937",
"047", "147", "247", "347", "447",
"547", "647", "747", "847", "947",
"057", "157", "257", "357", "457",
"557", "657", "757", "857", "957",
"067", "167", "267", "367", "467",
"567", "667", "767", "867", "967",
"077", "177", "277", "377", "477",
"577", "677", "777", "877", "977",
"087", "187", "287", "387", "487",
"587", "687", "787", "887", "987",
"097", "197", "297", "397", "497",
"597", "697", "797", "897", "997",
"008", "108", "208", "308", "408",
"508", "608", "708", "808", "908",
"018", "118", "218", "318", "418",
"518", "618", "718", "818", "918",
"028", "128", "228", "328", "428",
"528", "628", "728", "828", "928",
"038", "138", "238", "338", "438",
"538", "638", "738", "838", "938",
"048", "148", "248", "348", "448",
"548", "648", "748", "848", "948",
"058", "158", "258", "358", "458",
"558", "658", "758", "858", "958",
"068", "168", "268", "368", "468",
"568", "668", "768", "868", "968",
"078", "178", "278", "378", "478",
"578", "678", "778", "878", "978",
"088", "188", "288", "388", "488",
"588", "688", "788", "888", "988",
"098", "198", "298", "398", "498",
"598", "698", "798", "898", "998",
"009", "109", "209", "309", "409",
"509", "609", "709", "809", "909",
"019", "119", "219", "319", "419",
"519", "619", "719", "819", "919",
"029", "129", "229", "329", "429",
"529", "629", "729", "829", "929",
"039", "139", "239", "339", "439",
"539", "639", "739", "839", "939",
"049", "149", "249", "349", "449",
"549", "649", "749", "849", "949",
"059", "159", "259", "359", "459",
"559", "659", "759", "859", "959",
"069", "169", "269", "369", "469",
"569", "669", "769", "869", "969",
"079", "179", "279", "379", "479",
"579", "679", "779", "879", "979",
"089", "189", "289", "389", "489",
"589", "689", "789", "889", "989",
"099", "199", "299", "399", "499",
"599", "699", "799", "899", "999"
};
/*
* Since we calculate the right-most digits for %d %u etc first,
* we need a temporary buffer to store them in until we get
* to the left-most digits
*/
#define TEMPBUF_MAX 20
static char TempBuffer[TEMPBUF_MAX];
/*
vSnprintf()
Backend to Snprintf() - performs the construction of 'dest'
using the string 'format' and the given arguments. Also makes sure
not more than 'bytes' characters are copied to 'dest'
We always allow room for a terminating \0 character, so at most,
bytes - 1 characters will be written to dest.
Return: Number of characters written, NOT including the terminating
\0 character which is *always* placed at the end of the string
NOTE: This function handles the following flags only:
%s %d %c %u %ld %lu
In addition, this function performs *NO* precision, padding,
or width formatting. If it receives an unknown % character,
it will call vsprintf() to complete the remainder of the
string.
*/
int
rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
{
char ch;
int written = 0; /* bytes written so far */
int maxbytes = bytes - 1;
while((ch = *format++) && (written < maxbytes)) {
if(ch == '%') {
/*
* Advance past the %
*/
ch = *format++;
/*
* Put the most common cases first - %s %d etc
*/
if(ch == 's') {
const char *str = va_arg(args, const char *);
while((*dest = *str)) {
++dest;
++str;
if(++written >= maxbytes)
break;
}
continue;
}
if(ch == 'd') {
int num = va_arg(args, int);
int quotient;
const char *str;
char *digitptr = TempBuffer;
/*
* We have to special-case "0" unfortunately
*/
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
if(num < 0) {
*dest++ = '-';
if(++written >= maxbytes)
continue;
num = -num;
}
do {
quotient = num / TABLE_MAX;
/*
* We'll start with the right-most digits of 'num'.
* Dividing by TABLE_MAX cuts off all but the X
* right-most digits, where X is such that:
*
* 10^X = TABLE_MAX
*
* For example, if num = 1200, and TABLE_MAX = 1000,
* quotient will be 1. Multiplying this by 1000 and
* subtracting from 1200 gives: 1200 - (1 * 1000) = 200.
* We then go right to slot 200 in our array and behold!
* The string "002" (200 backwards) is conveniently
* waiting for us. Then repeat the process with the
* digits left.
*
* The reason we need to have the integers written
* backwards, is because we don't know how many digits
* there are. If we want to express the number 12130
* for example, our first pass would leave us with 130,
* whose slot in the array yields "031", which we
* plug into our TempBuffer[]. The next pass gives us
* 12, whose slot yields "21" which we append to
* TempBuffer[], leaving us with "03121". This is the
* exact number we want, only backwards, so it is
* a simple matter to reverse the string. If we used
* straightfoward numbers, we would have a TempBuffer
* looking like this: "13012" which would be a nightmare
* to deal with.
*/
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str)) {
++digitptr;
++str;
}
} while((num = quotient) != 0);
/*
* If the last quotient was a 1 or 2 digit number, there
* will be one or more leading zeroes in TempBuffer[] -
* get rid of them.
*/
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
continue;
} /* if (ch == 'd') */
if(ch == 'c') {
*dest++ = va_arg(args, int);
++written;
continue;
} /* if (ch == 'c') */
if(ch == 'u') {
unsigned int num = va_arg(args, unsigned int);
unsigned int quotient;
const char *str;
char *digitptr = TempBuffer;
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
do {
quotient = num / TABLE_MAX;
/*
* Very similar to case 'd'
*/
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str)) {
++digitptr;
++str;
}
} while((num = quotient) != 0);
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
continue;
} /* if (ch == 'u') */
if(ch == 'Q') {
const char *arg = va_arg(args, const char *);
if(arg == NULL)
continue;
const char *str = rsdb_quote(arg);
while((*dest = *str)) {
++dest;
++str;
if(++written >= maxbytes)
break;
}
continue;
}
if(ch == 'l') {
if(*format == 'u') {
unsigned long num = va_arg(args, unsigned long);
unsigned long quotient;
const char *str;
char *digitptr = TempBuffer;
++format;
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
do {
quotient = num / TABLE_MAX;
/*
* Very similar to case 'u'
*/
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str)) {
++digitptr;
++str;
}
} while((num = quotient) != 0);
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
continue;
} else
/* if (*format == 'u') */ if(*format == 'd') {
long num = va_arg(args, long);
long quotient;
const char *str;
char *digitptr = TempBuffer;
++format;
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
if(num < 0) {
*dest++ = '-';
if(++written >= maxbytes)
continue;
num = -num;
}
do {
quotient = num / TABLE_MAX;
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str)) {
++digitptr;
++str;
}
} while((num = quotient) != 0);
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
continue;
} else { /* if (*format == 'd') */
/* XXX error */
exit(1);
}
} /* if (ch == 'l') */
if(ch != '%') {
/* XXX error */
exit(1);
} /* if (ch != '%') */
} /* if (ch == '%') */
*dest++ = ch;
++written;
} /* while ((ch = *format++) && (written < maxbytes)) */
/*
* Terminate the destination buffer with a \0
*/
*dest = '\0';
return (written);
} /* vSnprintf() */
/*
rs_snprintf()
Optimized version of snprintf().
Inputs: dest - destination string
bytes - number of bytes to copy
format - formatted string
args - args to 'format'
Return: number of characters copied, NOT including the terminating
NULL which is always placed at the end of the string
*/
int
rs_snprintf(char *dest, const size_t bytes, const char *format, ...)
{
va_list args;
int count;
va_start(args, format);
count = rs_vsnprintf(dest, bytes, format, args);
va_end(args);
return (count);
} /* Snprintf() */

View File

@ -1,246 +0,0 @@
/* src/rsdb_sqlite.h
* Contains the code for the sqlite database backend.
*
* Copyright (C) 2003-2006 Lee Hardy <leeh@leeh.co.uk>
* Copyright (C) 2003-2006 ircd-ratbox development team
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1.Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2.Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3.The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 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 "rsdb.h"
#include <sqlite3.h>
struct sqlite3 *rb_bandb;
rsdb_error_cb *error_cb;
static void
mlog(const char *errstr, ...)
{
if(error_cb != NULL) {
char buf[256];
va_list ap;
va_start(ap, errstr);
vsnprintf(buf, sizeof(buf), errstr, ap);
va_end(ap);
error_cb(buf);
} else
exit(1);
}
int
rsdb_init(rsdb_error_cb * ecb)
{
const char *bandb_dbpath_env;
char dbpath[PATH_MAX];
char errbuf[128];
error_cb = ecb;
/* try a path from the environment first, useful for basedir overrides */
bandb_dbpath_env = getenv("BANDB_DBPATH");
if(bandb_dbpath_env != NULL)
rb_strlcpy(dbpath, bandb_dbpath_env, sizeof(dbpath));
else
rb_strlcpy(dbpath, DBPATH, sizeof(dbpath));
if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK) {
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",
sqlite3_errmsg(rb_bandb));
mlog(errbuf);
return -1;
}
if(access(dbpath, W_OK)) {
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno));
mlog(errbuf);
return -1;
}
return 0;
}
void
rsdb_shutdown(void)
{
if(rb_bandb)
sqlite3_close(rb_bandb);
}
const char *
rsdb_quote(const char *src)
{
static char buf[BUFSIZE * 4];
char *p = buf;
/* cheap and dirty length check.. */
if(strlen(src) >= (sizeof(buf) / 2))
return NULL;
while(*src) {
if(*src == '\'')
*p++ = '\'';
*p++ = *src++;
}
*p = '\0';
return buf;
}
static int
rsdb_callback_func(void *cbfunc, int argc, char **argv, char **colnames)
{
rsdb_callback cb = (rsdb_callback)((uintptr_t)cbfunc);
(cb) (argc, (const char **)argv);
return 0;
}
void
rsdb_exec(rsdb_callback cb, const char *format, ...)
{
static char buf[BUFSIZE * 4];
va_list args;
char *errmsg;
unsigned int i;
int j;
va_start(args, format);
i = rs_vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
if(i >= sizeof(buf)) {
mlog("fatal error: length problem with compiling sql");
}
if((i = sqlite3_exec(rb_bandb, buf, (cb ? rsdb_callback_func : NULL), (void *)((uintptr_t)cb), &errmsg))) {
switch (i) {
case SQLITE_BUSY:
for(j = 0; j < 5; j++) {
rb_sleep(0, 500000);
if(!sqlite3_exec
(rb_bandb, buf, (cb ? rsdb_callback_func : NULL), (void *)((uintptr_t)cb), &errmsg))
return;
}
/* failed, fall through to default */
mlog("fatal error: problem with db file: %s", errmsg);
break;
default:
mlog("fatal error: problem with db file: %s", errmsg);
break;
}
}
}
void
rsdb_exec_fetch(struct rsdb_table *table, const char *format, ...)
{
static char buf[BUFSIZE * 4];
va_list args;
char *errmsg;
char **data;
int pos;
unsigned int retval;
int i, j;
va_start(args, format);
retval = rs_vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
if(retval >= sizeof(buf)) {
mlog("fatal error: length problem with compiling sql");
}
if((retval =
sqlite3_get_table(rb_bandb, buf, &data, &table->row_count, &table->col_count, &errmsg))) {
int success = 0;
switch (retval) {
case SQLITE_BUSY:
for(i = 0; i < 5; i++) {
rb_sleep(0, 500000);
if(!sqlite3_get_table
(rb_bandb, buf, &data, &table->row_count, &table->col_count,
&errmsg)) {
success++;
break;
}
}
if(success)
break;
mlog("fatal error: problem with db file: %s", errmsg);
break;
default:
mlog("fatal error: problem with db file: %s", errmsg);
break;
}
}
/* we need to be able to free data afterward */
table->arg = data;
if(table->row_count == 0) {
table->row = NULL;
return;
}
/* sqlite puts the column names as the first row */
pos = table->col_count;
table->row = rb_malloc(sizeof(char **) * table->row_count);
for(i = 0; i < table->row_count; i++) {
table->row[i] = rb_malloc(sizeof(char *) * table->col_count);
for(j = 0; j < table->col_count; j++) {
table->row[i][j] = data[pos++];
}
}
}
void
rsdb_exec_fetch_end(struct rsdb_table *table)
{
int i;
for(i = 0; i < table->row_count; i++) {
rb_free(table->row[i]);
}
rb_free(table->row);
sqlite3_free_table((char **)table->arg);
}
void
rsdb_transaction(rsdb_transtype type)
{
if(type == RSDB_TRANS_START)
rsdb_exec(NULL, "BEGIN TRANSACTION");
else if(type == RSDB_TRANS_END)
rsdb_exec(NULL, "COMMIT TRANSACTION");
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

15127
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -8,9 +8,9 @@ dnl said functions need to be just about as complex as they already are.
AC_PREREQ(2.57)
dnl Sneaky way to get an Id tag into the configure script
AC_COPYRIGHT([2014 elemental-ircd Team])
AC_COPYRIGHT([$Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $])
AC_INIT([elemental-ircd],[6.6.1])
AC_INIT([charybdis],[3.0.0-RC1])
AC_CONFIG_HEADER(include/setup.h)
@ -81,7 +81,7 @@ esac
fi
AC_MSG_CHECKING([uname -s for Solaris, AIX or HPUX])
AC_MSG_CHECKING([uname -s for Cygwin, Solaris, AIX or HPUX])
OSNAME=`uname -s`
case "$OSNAME" in
HP-UX*)
@ -96,6 +96,10 @@ case "$OSNAME" in
AC_MSG_RESULT(already using newer HPUX)
fi
;;
CYGWIN*)
AC_MSG_RESULT(Cygwin)
CYGWIN=yes
;;
SunOS*)
AC_MSG_RESULT(SunOS or Solaris)
AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.])
@ -225,37 +229,12 @@ if test "$LEX" = ":"; then
AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
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)
AS_IF([test "x$enable_fhs_paths" = "xyes"],
[dnl Avoid name collisions.
pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}'
rundir=${rundir-'${prefix}/run'}
pkgrundir='${rundir}/${PACKAGE_TARNAME}'
pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'],
[libexecdir='${bindir}'
pkglibexecdir='${libexecdir}'
rundir='${sysconfdir}'
pkgrundir='${rundir}'
if test "$libexecdir" = '${exec_prefix}/libexec' &&
test "$localstatedir" = '${prefix}/var'; then
libexecdir='${bindir}'
localstatedir='${prefix}'
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 ban database]])
AC_SUBST([pkglibexecdir])
AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IRCd itself spawns live])
fi
dnl Checks for header files.
AC_HEADER_STDC
@ -336,7 +315,7 @@ fi
AC_C_BIGENDIAN
dnl Check for stdarg.h - if we can't find it, halt configure
AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - charybdis will not compile without it **])])
AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - ircd-ratbox will not compile without it **])])
dnl Checks for the existence of strlcat, strlcpy, basename...
dnl This more reliable test only works with gcc though.
@ -609,15 +588,22 @@ AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Lin
],)
dnl **********************************************************************
dnl Check for --with-confdir [deprecated, use --sysconfdir instead]
dnl Check for --with-confdir
dnl **********************************************************************
AC_ARG_WITH([confdir],
[AC_HELP_STRING([--with-confdir=DIR],
[Directory to install config files [deprecated, use --sysconfdir instead].])],
[ sysconfdir=`echo $withval | sed 's/\/$//'` ],
[ confdir='${sysconfdir}' ])
AC_DEFINE_DIR([ETC_DIR], [sysconfdir], [Prefix where config files are installed.])
AC_MSG_CHECKING([whether to modify confdir])
AC_ARG_WITH(confdir,
AC_HELP_STRING([--with-confdir=DIR],
[Directory to install config files.]),
[ confdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes)
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 Check for --with-logdir
@ -628,13 +614,14 @@ AC_ARG_WITH(logdir,
AC_HELP_STRING([--with-logdir=DIR],
[Directory where to write logfiles.]),
[ logdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes)],
[ AS_IF([test "x$enable_fhs_paths" = "xyes"],
[logdir='${localstatedir}/log/${PACKAGE_TARNAME}'],
[logdir='${prefix}/logs'])
AC_MSG_RESULT(no)])
AC_DEFINE_DIR([LOG_DIR], [logdir], [Prefix where to write logfiles.])
AC_SUBST_DIR([logdir])
AC_MSG_RESULT(yes)
AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
AC_SUBST_DIR([logdir]) ],
[ logdir='${prefix}/logs'
AC_MSG_RESULT(no)
AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
AC_SUBST_DIR([logdir])]
)
dnl **********************************************************************
dnl Check for --with-helpdir
@ -645,13 +632,14 @@ AC_ARG_WITH(helpdir,
AC_HELP_STRING([--with-helpdir=DIR],
[Directory to install help files.]),
[ helpdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes) ],
[ AS_IF([test "x$enable_fhs_paths" = "xyes"],
[helpdir='${datadir}/${PACKAGE_TARNAME}/help'],
[helpdir='${prefix}/help'])
AC_MSG_RESULT(no) ])
AC_DEFINE_DIR([HELP_DIR], [helpdir], [Prefix where help files are installed.])
AC_SUBST_DIR([helpdir])
AC_MSG_RESULT(yes)
AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.])
AC_SUBST_DIR([helpdir]) ],
[ helpdir='${prefix}/help'
AC_MSG_RESULT(no)
AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.])
AC_SUBST_DIR([helpdir])]
)
dnl **********************************************************************
dnl Check for --with-moduledir
@ -659,44 +647,17 @@ dnl **********************************************************************
AC_MSG_CHECKING([whether to modify moduledir])
AC_ARG_WITH(moduledir,
[AC_HELP_STRING([--with-moduledir=DIR],
[Directory to install modules.])],
AC_HELP_STRING([--with-moduledir=DIR],
[Directory to install modules.]),
[ moduledir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes)],
[ AS_IF([test "x$enable_fhs_paths" = "xyes"],
[moduledir='${pkglibdir}/modules'],
[moduledir='${prefix}/modules'])
AC_MSG_RESULT(yes)
AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
AC_SUBST_DIR([moduledir]) ],
[ moduledir='${prefix}/modules'
AC_MSG_RESULT(no)
])
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.])
AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
AC_SUBST_DIR([moduledir])]
)
if test ! -z "$SELECT_TYPE_EXPLICIT"; then
SELECT_TYPE="$SELECT_TYPE_EXPLICIT";
@ -862,8 +823,8 @@ if test "$balloc" = no; then
fi
AC_ARG_ENABLE(small-net,
AC_HELP_STRING([--disable-small-net],[Disable small network support.]),
[small_net=$enableval], [small_net=yes])
AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
[small_net=$enableval], [small_net=no])
if test "$small_net" = yes; then
dnl AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.])
@ -905,18 +866,15 @@ dnl so enable small net unless you really need this much support
fi
AC_ARG_WITH(nicklen,
AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 31, max 50)]),
AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 15, max 50)]),
[
if ! expr "$withval" + 0 >/dev/null 2>&1; then
AC_ERROR([NICKLEN must be a numeric value])
fi
if test $withval -ge 50; then
NICKLEN=50
AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
else
NICKLEN="$withval"
fi
], [NICKLEN=31])
], [NICKLEN=15])
AC_ARG_WITH(topiclen,
AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
@ -935,6 +893,12 @@ AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
shared_modules="yes"
dnl Some first-stage sanity checks.
if test "$shared_modules" = yes; then
if test "$CYGWIN" = yes; then
AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
shared_modules="no"
fi
dnl TenDRA's cc is called tcc too.
if test "$CC" = tcc -a "$TenDRA" = "no"; then
AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
@ -1056,17 +1020,6 @@ if test "$shared_modules" = yes; then
fi
fi
# rpath, for finding libratbox.so at run time
hold_ldflags=$LDFLAGS
AC_MSG_CHECKING(for the ld -rpath flag)
LDFLAGS="${LDFLAGS} -Wl,-rpath=${libdir}"
AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
LDFLAGS=$hold_ldflags
AC_MSG_RESULT($found)
if test "$found" = yes; then
LDFLAGS="${LDFLAGS} -Wl,-rpath=\${libdir}"
fi
# This must be down here, or it will mess up checks like the ones
# for -Wl,-export-dynamic
# -- jilles
@ -1082,8 +1035,7 @@ CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings)
CHARYBDIS_C_GCC_TRY_FLAGS([-Werror-implicit-function-declaration], charybdis_cv_c_gcc_w_error_implicit_function_declaration)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_float_equal)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis)
CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w)
@ -1093,10 +1045,12 @@ CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_nor
CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wbad-function-cast], charybdis_cv_c_gcc_w_bad_function_cast)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wno-format-security], charybdis_cv_c_gcc_w_format)
CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wformat-security], charybdis_cv_c_gcc_w_format)
CHARYBDIS_C_GCC_TRY_FLAGS([-pedantic], charybdis_cv_c_gcc_pedantic)
IRC_CFLAGS="$CFLAGS"
],[])
@ -1200,18 +1154,15 @@ fi
AC_CONFIG_FILES( \
Makefile \
bandb/Makefile \
ssld/Makefile \
extensions/Makefile \
unsupported/Makefile \
src/Makefile \
modules/Makefile \
tools/Makefile \
tools/genssl.sh \
doc/Makefile \
help/Makefile \
)
AC_CONFIG_COMMANDS([tools/genssl.sh_chmod], [chmod 755 tools/genssl.sh])
AC_OUTPUT
@ -1240,5 +1191,5 @@ Configuration:
Nickname length : $NICKLEN
Topic length : $TOPICLEN
Use (g)make to compile elemental-ircd, then (g)make install to install it.
Use (g)make to compile Charybdis, then (g)make install to install it.
"

View File

@ -1,3 +1,4 @@
$Id: CIDR.txt 6 2005-09-10 01:02:21Z nenolod $
CIDR Information
----------------

View File

@ -15,14 +15,12 @@ RM = @RM@
CP = @CP@
TOUCH = @TOUCH@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
prefix = @prefix@
exec_prefix = @exec_prefix@
exec_suffix = @exec_suffix@
bindir = @bindir@
libexecdir = @libexecdir@
sysconfdir = @sysconfdir@
confdir = @confdir@
localstatedir = @localstatedir@
# Change this later! -- adrian
moduledir = @moduledir@
@ -33,6 +31,7 @@ mandir = @mandir@/man8
MANPAGES = ircd.8
CONFS = example.conf reference.conf
DEFAULTCONFS = kline.conf dline.conf xline.conf resv.conf
SSL_LIBS = @SSL_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@
@ -41,13 +40,11 @@ IRCDLIBS = @LIBS@ $(SSL_LIBS)
INCLUDES = -I../include $(SSL_INCLUDES)
CPPFLAGS = ${INCLUDES} @CPPFLAGS@
all: build
install-mkdirs:
-@if test ! -d $(DESTDIR)$(sysconfdir); then \
echo "mkdir -p $(sysconfdir)"; \
mkdir -p $(DESTDIR)$(sysconfdir); \
-@if test ! -d $(DESTDIR)$(confdir); then \
echo "mkdir -p $(confdir)"; \
mkdir -p $(DESTDIR)$(confdir); \
fi
-@if test ! -d $(DESTDIR)$(mandir); then \
@ -58,25 +55,32 @@ install-mkdirs:
install: install-mkdirs build
@echo "ircd: installing example config files ($(CONFS))"
@for i in $(CONFS); do \
if test -f $(DESTDIR)$(sysconfdir)/$$i; then \
$(MV) $(DESTDIR)$(sysconfdir)/$$i $(DESTDIR)$(sysconfdir)/$$i.old; \
if test -f $(DESTDIR)$(confdir)/$$i; then \
$(MV) $(DESTDIR)$(confdir)/$$i $(DESTDIR)$(confdir)/$$i.old; \
fi; \
$(INSTALL_DATA) $$i $(DESTDIR)$(sysconfdir); \
$(INSTALL_DATA) $$i $(DESTDIR)$(confdir); \
done
-@if test ! -f $(DESTDIR)$(sysconfdir)/ircd.motd; then \
@for i in $(DEFAULTCONFS); do \
if test ! -f $(DESTDIR)$(confdir)/$$i; then \
echo "ircd: creating config file ($$i)"; \
${TOUCH} $(DESTDIR)$(confdir)/$$i; \
fi; \
done
-@if test ! -f $(DESTDIR)$(confdir)/ircd.motd; then \
echo "ircd: installing motd file (ircd.motd)"; \
$(INSTALL_DATA) ircd.motd $(DESTDIR)$(sysconfdir); \
$(INSTALL_DATA) ircd.motd $(DESTDIR)$(confdir); \
fi
-@if test -f $(DESTDIR)$(sysconfdir)/links.txt; then \
$(RM) $(DESTDIR)$(sysconfdir)/links.txt; \
-@if test -f $(DESTDIR)$(confdir)/links.txt; then \
$(RM) $(DESTDIR)$(confdir)/links.txt; \
fi
@echo "ircd: installing manpage"
@for i in $(MANPAGES); do \
if test ! -f $(DESTDIR)$(mandir)/$(PROGRAM_PREFIX)$$i; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/$(PROGRAM_PREFIX)$$i; \
if test ! -f $(DESTDIR)$(mandir)/$$i; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(mandir); \
fi; \
done

View File

@ -83,3 +83,4 @@ A number of scripts for clients have already been written to automate this
process, see client-scripts/README for more information.
--
$Id: challenge.txt 678 2006-02-03 20:25:01Z jilles $

View File

@ -44,3 +44,4 @@ nick changes their nick but is collided again (the server detecting the
collision will not propagate the nick change further).
--
$Id: collision_fnc.txt 3422 2007-04-22 14:35:28Z jilles $

View File

@ -3,7 +3,6 @@
* Copyright (C) 2000-2002 Hybrid Development Team
* Copyright (C) 2002-2005 ircd-ratbox development team
* Copyright (C) 2005-2006 charybdis development team
* Copyright (C) 2014 Elemental-IRCd development team
*
* $Id: example.conf 3582 2007-11-17 21:55:48Z jilles $
*
@ -11,50 +10,34 @@
*/
/* Extensions */
#loadmodule "extensions/chm_adminonly.so";
loadmodule "extensions/chm_operonly.so";
#loadmodule "extensions/chm_sslonly.so";
#loadmodule "extensions/chm_operonly_compat.so";
#loadmodule "extensions/chm_quietunreg_compat.so";
#loadmodule "extensions/chm_sslonly_compat.so";
#loadmodule "extensions/createauthonly.so";
loadmodule "extensions/extb_account.so";
loadmodule "extensions/extb_canjoin.so";
loadmodule "extensions/extb_channel.so";
loadmodule "extensions/extb_extgecos.so";
loadmodule "extensions/extb_oper.so";
loadmodule "extensions/extb_realname.so";
#loadmodule "extensions/extb_account.so";
#loadmodule "extensions/extb_canjoin.so";
#loadmodule "extensions/extb_channel.so";
#loadmodule "extensions/extb_extgecos.so";
#loadmodule "extensions/extb_oper.so";
#loadmodule "extensions/extb_realname.so";
#loadmodule "extensions/extb_server.so";
#loadmodule "extensions/extb_ssl.so";
#loadmodule "extensions/hurt.so";
loadmodule "extensions/ip_cloaking.so";
#loadmodule "extensions/ip_cloaking.so";
#loadmodule "extensions/m_findforwards.so";
loadmodule "extensions/m_identify.so";
loadmodule "extensions/m_mkpasswd.so";
loadmodule "extensions/m_webirc.so";
#loadmodule "extensions/m_cycle.so";
#loadmodule "extensions/m_oaccept.so";
#loadmodule "extensions/m_opme.so";
#loadmodule "extensions/m_ojoin.so";
#loadmodule "extensions/m_omode.so";
#loadmodule "extensions/m_olist.so";
#loadmodule "extensions/m_okick.so";
#loadmodule "extensions/m_force.so";
#loadmodule "extensions/m_roleplay.so";
#loadmodule "extensions/m_identify.so";
#loadmodule "extensions/no_oper_invis.so";
loadmodule "extensions/sno_farconnect.so";
loadmodule "extensions/sno_globalkline.so";
loadmodule "extensions/sno_globaloper.so";
#loadmodule "extensions/sno_farconnect.so";
#loadmodule "extensions/sno_globalkline.so";
#loadmodule "extensions/sno_globaloper.so";
#loadmodule "extensions/sno_whois.so";
serverinfo {
name = "hostname.domain.tld";
name = "hades.arpa";
sid = "42X";
description = "elemental-ircd test server";
network_name = "ShadowNET";
description = "charybdis test server";
network_name = "AthemeNET";
network_desc = "Your IRC network.";
helpchan = "#help";
helpurl = "http://www.mynet.net/help";
hub = yes;
/* On multi-homed hosts you may need the following. These define
@ -63,21 +46,18 @@ serverinfo {
#vhost = "192.169.0.1";
/* for IPv6 */
#vhost6 = "3ffe:80e8:546::2";
/* ssl_private_key: our ssl private key */
ssl_private_key = "etc/ssl.key";
ssl_private_key = "etc/test.key";
/* ssl_cert: certificate for our ssl server */
ssl_cert = "etc/ssl.cert";
ssl_cert = "etc/test.cert";
/* ssl_dh_params: DH parameters, generate with openssl dhparam -out dh.pem 1024 */
ssl_dh_params = "etc/dh.pem";
/* ssld_count: number of ssld processes you want to start, if you
* have a really busy server, using N-1 where N is the number of
* cpu/cpu cores you have might be useful. A number greater than one
* can also be useful in case of bugs in ssld and because ssld needs
* two file descriptors per SSL connection.
/* ssld_count: number of ssld processes you want to start, if you have a really busy
* server, using N-1 where N is the number of cpu/cpu cores you have might be useful
*/
ssld_count = 1;
@ -91,7 +71,7 @@ serverinfo {
admin {
name = "Lazy admin (lazya)";
description = "ShadowNET client server";
description = "AthemeNET client server";
email = "nobody@127.0.0.1";
};
@ -112,12 +92,11 @@ log {
*/
class "users" {
ping_time = 2 minutes;
number_per_ident = 10;
number_per_ident = 10;
number_per_ip = 10;
number_per_ip_global = 50;
cidr_ipv4_bitlen = 24;
cidr_ipv6_bitlen = 64;
number_per_cidr = 200;
number_per_ip_global = 50;
cidr_bitlen = 64;
number_per_cidr = 8;
max_number = 3000;
sendq = 400 kbytes;
};
@ -137,25 +116,17 @@ class "server" {
};
listen {
/* defer_accept: wait for clients to send IRC handshake data before
* accepting them. if you intend to use software which depends on the
* server replying first, such as BOPM, you should disable this feature.
* otherwise, you probably want to leave it on. Disabling this will not
* update on a rehash.
*/
defer_accept = yes;
/* If you want to listen on a specific IP only, specify host.
* host definitions apply only to the following port line.
*/
#host = "192.169.0.1";
port = 5000, 6665 .. 6669;
sslport = 6697;
sslport = 9999;
/* Listen on IPv6 (if you used host= above). */
#host = "3ffe:1234:a:b:c::d";
#port = 5000, 6665 .. 6669;
#sslport = 9999;
#port = 5000, 6665 .. 6669;
#sslport = 9999;
};
/* auth {}: allow users to connect to the ircd (OLD I:)
@ -173,35 +144,20 @@ auth {
user = "*@172.16.0.0/12";
user = "*test@123D:B567:*";
/* auth_user: The username (authenticated via SASL or PASS) allowed
* to connect. You are able to put multiple auth_user lines. If people
* are authenticating via SASL in this way, it is recommended to comment
* out the password option below. You will also *NEED* to specify a user
* line above auth_user, this can safely be "*@*", however.
*/
auth_user = "jilles";
auth_user = "jdhore";
/* password: an optional password that is required to use this block.
* By default this is not encrypted, specify the flag "encrypted" in
* flags = ...; below if it is.
*/
password = "letmein";
/* spoof: fake the users user@host to be be this. You may either
* specify a host or a user@host to spoof to. This is free-form,
* just do everyone a favour and dont abuse it. (OLD I: = flag)
*/
spoof = "I.still.hate.packets";
/* autojoin: Channel (or channels, comma-seperated) to join users
* in this auth block to on connect. Note that this won't join
* the user through any bans or otherwise restrictive chmodes.
*/
autojoin = "#shadowircd,#test";
/* Possible flags in auth:
*
*
* encrypted | password is encrypted with mkpasswd
* spoof_notice | give a notice when spoofing hosts
* exceed_limit (old > flag) | allow user to exceed class user limits
@ -212,65 +168,23 @@ auth {
* jupe_exempt | exempt this user from generating
* warnings joining juped channels
* resv_exempt | exempt this user from resvs
* flood_exempt | exempt this user from flood limits
* USE WITH CAUTION.
* flood_exempt | exempt this user from flood limits
* USE WITH CAUTION.
* no_tilde (old - flag) | don't prefix ~ to username if no ident
* need_ident (old + flag) | require ident for user in this class
* need_ssl | require SSL/TLS for user in this class
* need_sasl | require SASL id for user in this class
*/
flags = kline_exempt, exceed_limit;
/* class: the class the user is placed in */
class = "opers";
};
/* Example WEBIRC authblock */
auth {
/* user: webirc@IP.OF.YOUR.WEBIRC . the webirc@ part is required */
user = "webirc@192.168.1.1";
/* password: password the webirc client sends in the WEBIRC command.
* You can use a encrypted password here (see above auth block).
*/
password = "<password>";
/* spoof: This is required to keep it what it is currently if you
* want the webirc client to show the users' real host as their
* host on IRC.
*/
spoof = "webirc.";
class = "users";
};
auth {
user = "*@*";
class = "users";
};
/* privset {} blocks MUST be specified before anything that uses them. That
* means they must be defined before operator {}.
*/
privset "local_op" {
privs = oper:local_kill, oper:operwall;
};
privset "server_bot" {
extends = "local_op";
privs = oper:kline, oper:remoteban, snomask:nick_changes;
};
privset "global_op" {
extends = "local_op";
privs = oper:global_kill, oper:routing, oper:kline, oper:unkline, oper:xline,
oper:resv, oper:mass_notice, oper:remoteban;
};
privset "admin" {
extends = "global_op";
privs = oper:admin, oper:die, oper:rehash, oper:spy, oper:override;
};
operator "god" {
/* name: the name of the oper must go above */
@ -281,13 +195,13 @@ operator "god" {
user = "*god@127.0.0.1";
/* password: the password required to oper. Unless ~encrypted is
* contained in flags = ...; this will need to be encrypted using
* contained in flags = ...; this will need to be encrypted using
* mkpasswd, MD5 is supported
*/
password = "etcnjl8juSU1E";
/* rsa key: the public key for this oper when using Challenge.
* A password should not be defined when this is used, see
* A password should not be defined when this is used, see
* doc/challenge.txt for more information.
*/
#rsa_public_key_file = "/usr/local/ircd/etc/oper.pub";
@ -298,48 +212,47 @@ operator "god" {
*/
#umodes = locops, servnotice, operwall, wallop;
/* fingerprint: if specified, the oper's client certificate
* fingerprint will be checked against the specified fingerprint
* below.
*/
#fingerprint = "c77106576abf7f9f90cca0f63874a60f2e40a64b";
/* snomask: specific server notice mask on oper up.
* If this is specified an oper will not be given oper_snomask.
*/
snomask = "+Zbfkrsuy";
/* vhost: defines the vhost that this oper will get on oper up.
* this must be a valid hostmask. If this is specified the oper
* will not be given default_operhost.
*/
vhost = "is.an.oper";
/* swhois: defines an additional line that will be displayed
* whenever someone does /whois on the oper in question.
*/
swhois = "is wearing pants.";
/* operstring: defines a custom operstring for this oper,
* which will be shown in whois instead of default_operstring
* or default_adminstring.
*/
operstring = "is a lazy IRC Operator";
/* flags: misc options for the operator. You may prefix an option
* with ~ to disable it, e.g. ~encrypted.
/* privileges: controls the activities and commands an oper is
* allowed to do on the server. You may prefix an option with ~ to
* disable it, ie ~operwall
*
* Default flags are encrypted.
* Default flags are operwall, remoteban and encrypted.
*
* Available options:
*
* encrypted: the password above is encrypted [DEFAULT]
* need_ssl: must be using SSL/TLS to oper up
* local_kill: allows local users to be /KILL'd
* global_kill: allows local and remote users to be
* /KILL'd (OLD 'O' flag)
* remote: allows remote SQUIT and CONNECT (OLD 'R' flag)
* kline: allows KLINE and DLINE (OLD 'K' flag)
* unkline: allows UNKLINE and UNDLINE (OLD 'U' flag)
* nick_changes: allows oper to see nickchanges (OLD 'N' flag)
* via snomask +n
* rehash: allows oper to REHASH config (OLD 'H' flag)
* die: allows DIE and RESTART (OLD 'D' flag)
* admin: gives admin privileges. admins
* may (un)load modules and see the
* real IPs of servers.
* hidden_admin: gives admin privileges except
* will not have the admin lines in
* stats p and whois.
* xline: allows use of /quote xline/unxline
* resv: allows /quote resv/unresv and cmode +LP [DEFAULT]
* operwall: allows the oper to send/receive operwalls [DEFAULT]
* oper_spy: allows 'operspy' features to see through +s
* channels etc. see /quote help operspy
* hidden_oper: hides the oper from /stats p (OLD UMODE +p)
* remoteban: allows remote kline etc [DEFAULT]
* mass_notice: allows sending wallops and mass notices [DEFAULT]
*/
flags = encrypted;
/* privset: privileges set to grant */
privset = "admin";
flags = global_kill, remote, kline, unkline,
die, rehash, admin, xline, operwall;
};
connect "irc.uplink.com" {
@ -351,8 +264,6 @@ connect "irc.uplink.com" {
class = "server";
flags = compressed, topicburst;
#fingerprint = "c77106576abf7f9f90cca0f63874a60f2e40a64b";
/* If the connection is IPv6, uncomment below.
* Use 0::1, not ::1, for IPv6 localhost. */
#aftype = ipv6;
@ -379,7 +290,7 @@ cluster {
shared {
oper = "*@*", "*";
flags = all;
flags = all, rehash;
};
/* exempt {}: IPs that are exempt from Dlines and rejectcache. (OLD d:) */
@ -388,31 +299,21 @@ exempt {
};
channel {
#disabledmodes = "ME";
autochanmodes = "nt";
admin_on_channel_create = no;
exemptchanops = "NT";
use_halfop = yes;
use_admin = yes;
use_owner = yes;
use_invex = yes;
use_except = yes;
use_knock = yes;
use_local_channels = yes;
use_forward = yes;
knock_delay = 5 minutes;
knock_delay_channel = 1 minute;
max_chans_per_user = 15;
max_bans = 100;
max_bans_large = 500;
max_bans = 100;
max_bans_large = 500;
default_split_user_count = 0;
default_split_server_count = 0;
no_create_on_split = no;
no_join_on_split = no;
burst_topicwho = yes;
kick_on_split_riding = no;
only_ascii_channels = no;
cycle_host_change = yes;
host_in_topic = yes;
resv_forcepart = yes;
channel_target_change = yes;
};
serverhide {
@ -424,10 +325,10 @@ serverhide {
/* These are the blacklist settings.
* You can have multiple combinations of host and rejection reasons.
* They are used in pairs of one host/rejection reason.
* They are used in pairs of one host/rejection reason, or multiple hosts/rejection reason.
*
* These settings should be adequate for most networks, and are (presently)
* required for use on ShadowNet.
* required for use on AthemeNet.
*
* Word to the wise: Do not use blacklists like SPEWS for blocking IRC
* connections.
@ -441,16 +342,19 @@ serverhide {
* ${nick} - the user's nickname
* ${network-name} - the name of the network
*
* Note: AHBL (the providers of the below *.ahbl.org BLs) request that they be
* contacted, via email, at admins@2mbit.com before using these BLs.
* See <http://www.ahbl.org/services.php> for more information.
*/
blacklist {
host = "rbl.efnetrbl.org";
reject_reason = "${nick}, your IP (${ip}) is listed in EFnet's RBL. For assistance, see http://efnetrbl.org/?i=${ip}";
host = "dnsbl.dronebl.org";
reject_reason = "${nick}, your IP (${ip}) is listed in DroneBL. For assistance, see http://dronebl.org/lookup_branded.do?ip=${ip}&network=${network-name}";
host = "torexit.dan.me.uk";
reject_reason = "${nick}, your IP (${ip}) is listed as a TOR exit node. In order to protect ${network-name} from TOR-based abuse, we are not allowing TOR exit nodes to connect to our network.";
# host = "ircbl.ahbl.org";
# reject_reason = "${nick}, your IP (${ip}) is listed in ${dnsbl-host} for having an open proxy. In order to protect ${network-name} from abuse, we are not allowing connections with open proxies to connect.";
#
# host = "tor.ahbl.org";
# reject_reason = "${nick}, your IP (${ip}) is listed as a TOR exit node. In order to protect ${network-name} from tor-based abuse, we are not allowing TOR exit nodes to connect to our network.";
};
alias "NickServ" {
@ -469,22 +373,6 @@ alias "MemoServ" {
target = "MemoServ";
};
alias "HostServ" {
target = "HostServ";
};
alias "BotServ" {
target = "BotServ";
};
alias "InfoServ" {
target = "InfoServ";
};
alias "GroupServ" {
target = "GroupServ";
};
alias "NS" {
target = "NickServ";
};
@ -501,54 +389,34 @@ alias "MS" {
target = "MemoServ";
};
alias "HS" {
target = "HostServ";
};
alias "BS" {
target = "BotServ";
};
alias "IS" {
target = "InfoServ";
};
alias "GS" {
target = "GroupServ";
};
general {
hide_error_messages = opers;
hide_spoof_ips = yes;
/*
* default umodes: umodes to set upon connection
* If you have enabled the ip_cloaking extension, and you wish for
* incoming clients to be cloaked upon connection, +x must be in
* the umode string below.
* default_umodes: umodes to enable on connect.
* If you have enabled the ip_cloaking module, and you want
* to make use of it, add +h to this option, i.e.:
* default_umodes = "+ih";
*/
default_umodes = "+ix";
default_umodes = "+i";
default_operstring = "is an IRC Operator";
default_adminstring = "is a Server Administrator";
#default_operhost = "staff.testnet.net";
#static_quit = "I like turtles!";
servicestring = "is a Network Service";
disable_fake_channels = no;
hide_channel_below_users = 3;
tkline_expire_notices = no;
default_floodcount = 10;
tkline_expire_notices = no;
default_floodcount = 10;
failed_oper_notice = yes;
dots_in_ident=2;
min_nonwildcard = 4;
min_nonwildcard_simple = 3;
max_accept = 100;
max_accept = 100;
max_monitor = 100;
anti_nick_flood = yes;
max_nick_time = 20 seconds;
max_nick_changes = 5;
anti_spam_exit_message_time = 5 minutes;
use_part_messages = yes;
anti_spam_exit_message_time = 5 minutes;
ts_warn_delta = 30 seconds;
ts_max_delta = 5 minutes;
client_exit = yes;
@ -562,7 +430,6 @@ general {
identify_command = "IDENTIFY";
non_redundant_klines = yes;
warn_no_nline = yes;
use_propagated_bans = yes;
stats_e_disabled = no;
stats_c_oper_only=no;
stats_h_oper_only=no;
@ -571,35 +438,29 @@ general {
stats_P_oper_only=no;
stats_i_oper_only=masked;
stats_k_oper_only=masked;
map_oper_only = no;
map_oper_only = no;
operspy_admin_only = no;
operspy_dont_care_user_info = no;
secret_channels_in_whois = no;
caller_id_wait = 1 minute;
pace_wait_simple = 1 second;
pace_wait = 10 seconds;
short_motd = no;
ping_cookie = no;
connect_timeout = 30 seconds;
default_ident_timeout = 5;
disable_auth = no;
no_oper_flood = yes;
true_no_oper_flood = no;
max_targets = 4;
client_flood = 20;
use_whois_actually = no;
use_whois_actually = no;
oper_only_umodes = operwall, locops, servnotice;
oper_umodes = locops, servnotice, operwall, wallop;
oper_snomask = "+s";
burst_away = yes;
burst_away = yes;
nick_delay = 0 seconds; # 15 minutes if you want to enable this
reject_ban_time = 1 minute;
reject_after_count = 3;
reject_duration = 5 minutes;
throttle_duration = 60;
throttle_count = 4;
expire_override_time = 5 minutes;
away_interval = 30;
max_unknown_ip = 2;
};
modules {

View File

@ -89,3 +89,4 @@ a +bqeI entry of the given extban type, and whenever a local client tries to
add such an entry. (Clients are allowed to add bans matching themselves.)
--
$Id: extban.txt 1639 2006-06-04 23:26:47Z jilles $

View File

@ -121,3 +121,4 @@ community.
"iorecv"
"iorecvctrl"
$Id: hooks.txt 3414 2007-04-15 16:54:50Z jilles $

View File

@ -1,4 +1,5 @@
# $Id: index.txt 6 2005-09-10 01:02:21Z nenolod $
Here is the overview of the documents in the doc/ directory.
CIDR.txt - Description of CIDR in IPv4

View File

@ -1,2 +1,2 @@
This is the Elemental-IRCd MOTD. You can use this if you like;
but if you do, your teacher may send you to magic kindergarten.
This is charybdis MOTD you might replace it, but if not your friends will
laugh at you.

View File

@ -1,4 +1,5 @@
ircd-ratbox logfiles - Lee H <lee -at- leeh.co.uk>
$Id: logfiles.txt 6 2005-09-10 01:02:21Z nenolod $
---------------------------
fname_killlog

View File

@ -215,3 +215,4 @@ which is ambiguous if the user may contain a [ and in the author's opinion ugly.
--
W. Campbell
updated by J. Tjoelker
$Id: modeg.txt 3556 2007-08-18 14:45:10Z jilles $

View File

@ -7,3 +7,4 @@ The sgml docs have more detailed descriptions.
User mode +h (hide hostname) is provided by contrib/ip_cloaking.so
Server notice mask +F (far connects) is provided by contrib/sno_farconnect.so
# $Id: modes.txt 996 2006-03-09 01:14:34Z jilles $

View File

@ -1,5 +1,6 @@
MONITOR - Protocol for notification of when clients become online/offline
Lee Hardy <lee -at- leeh.co.uk>
$Id: monitor.txt 3520 2007-06-30 22:15:35Z jilles $
-------------------------------------------------------------------------
Currently, ISON requests by clients use a large amount of bandwidth. It is

View File

@ -365,3 +365,4 @@ Vuurwerk Internet '|.|' PGP - 0xD68A7AAB
And on the seventh day, He exited from append mode.
# $Id: operguide.txt 6 2005-09-10 01:02:21Z nenolod $

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
/* doc/reference.conf - shadowircd Example configuration file
/* doc/reference.conf - charybdis Example configuration file
*
* Copyright (C) 2000-2002 Hybrid Development Team
* Copyright (C) 2002-2005 ircd-ratbox development team
* Copyright (C) 2005-2006 charybdis development team
*
* Written by ejb, wcampbel, db, leeh, Taros, jdhore and others
* Written by ejb, wcampbel, db, leeh and others
*
* $Id: reference.conf 3582 2007-11-17 21:55:48Z jilles $
*/
@ -18,9 +18,6 @@
* that matches a user will be used. So place spoofs first, then specials,
* then general access, then restricted.
*
* privset {} blocks MUST be specified before anything that uses them. That
* means they must be defined before operator {}.
*
* Both shell style (#) and C style comments are supported.
*
* Files may be included by either:
@ -41,13 +38,9 @@
/* Extensions:
*
* ShadowIRCd contains several extensions that are not enabled by default.
* To use them, uncomment the lines below. More information on each extension
* can be found in extensions/README
* Charybdis contains several extensions that are not enabled by default.
* To use them, uncomment the lines below.
*
* Channel mode +-A (admin only) -- chm_adminonly.so
* Channel mode +-O (oper only) -- chm_operonly.so
* Channel mode +-S (ssl only) -- chm_sslonly.so
* Emulates channel mode +-O (oper only) (+-iI $o) -- chm_operonly_compat.so
* Emulates channel mode +-R (quiet unreg) (+-q $~a) -- chm_quietunreg_compat.so
* Emulates channel mode +-S (ssl only) (+-b $~z) -- chm_sslonly_compat.so
@ -61,62 +54,36 @@
* Server bans (+b $s:mask) -- extb_server.so
* SSL bans (+b $z) -- extb_ssl.so
* HURT system -- hurt.so
* New host mangling (umode +x) -- ip_cloaking.so
* Host mangling (umode +h) -- ip_cloaking.so
* Find channel forwards -- m_findforwards.so
* /identify support -- m_identify.so
* /mkpassword support -- m_mkpasswd.so
* WEBIRC support -- m_webirc.so
* Server-side /CYCLE -- m_cycle.so
* /oaccept - add to target's accept list, oper only -- m_oaccept.so
* /opme - op self in opless channels, admin only -- m_opme.so
* /ojoin - join despite restrictions, admin only -- m_ojoin.so
* /omode - force modes in channels, admin only -- m_omode.so
* /olist - see all channels in /list, oper only -- m_olist.so
* /okick - kick users without having ops, oper only -- m_okick.so
* /forcejoin - force join users, admin only -- m_force.so
* roleplay commands - send msgs from fake users -- m_roleplay.so
* Opers cannot be invisible (umode +i) -- no_oper_invis.so
* Far connection notices (snomask +F) -- sno_farconnect.so
* Remote k/d/x line active notices -- sno_globalkline.so
* Remote oper up notices -- sno_globaloper.so
* /whois notifications (snomask +W) -- sno_whois.so
*/
#loadmodule "extensions/chm_adminonly.so";
loadmodule "extensions/chm_operonly.so";
#loadmodule "extensions/chm_sslonly.so";
#loadmodule "extensions/chm_operonly_compat.so";
#loadmodule "extensions/chm_quietunreg_compat.so";
#loadmodule "extensions/chm_sslonly_compat.so";
#loadmodule "extensions/createauthonly.so";
loadmodule "extensions/extb_account.so";
loadmodule "extensions/extb_canjoin.so";
loadmodule "extensions/extb_channel.so";
loadmodule "extensions/extb_extgecos.so";
loadmodule "extensions/extb_oper.so";
loadmodule "extensions/extb_realname.so";
#loadmodule "extensions/extb_account.so";
#loadmodule "extensions/extb_canjoin.so";
#loadmodule "extensions/extb_channel.so";
#loadmodule "extensions/extb_extgecos.so";
#loadmodule "extensions/extb_oper.so";
#loadmodule "extensions/extb_realname.so";
#loadmodule "extensions/extb_server.so";
#loadmodule "extensions/extb_ssl.so";
#loadmodule "extensions/hurt.so";
loadmodule "extensions/ip_cloaking.so";
#loadmodule "extensions/ip_cloaking.so";
#loadmodule "extensions/m_findforwards.so";
loadmodule "extensions/m_identify.so";
loadmodule "extensions/m_mkpasswd.so";
loadmodule "extensions/m_webirc.so";
#loadmodule "extensions/m_cycle.so";
#loadmodule "extensions/m_oaccept.so";
#loadmodule "extensions/m_opme.so";
#loadmodule "extensions/m_ojoin.so";
#loadmodule "extensions/m_omode.so";
#loadmodule "extensions/m_olist.so";
#loadmodule "extensions/m_okick.so";
#loadmodule "extensions/m_force.so";
#loadmodule "extensions/m_roleplay.so";
#loadmodule "extensions/m_identify.so";
#loadmodule "extensions/no_oper_invis.so";
loadmodule "extensions/sno_farconnect.so";
loadmodule "extensions/sno_globalkline.so";
loadmodule "extensions/sno_globaloper.so";
#loadmodule "extensions/sno_farconnect.so";
#loadmodule "extensions/sno_globalkline.so";
#loadmodule "extensions/sno_globaloper.so";
#loadmodule "extensions/sno_whois.so";
/* serverinfo {}: Contains information about the server. (OLD M:) */
serverinfo {
@ -134,7 +101,7 @@ serverinfo {
/* description: the description of our server. '[' and ']' may not
* be used here for compatibility with older servers.
*/
description = "shadowircd test server";
description = "charybdis test server";
/* network info: the name and description of the network this server
* is on. Shown in the 005 reply and used with serverhiding.
@ -142,14 +109,6 @@ serverinfo {
network_name = "MyNet";
network_desc = "This is My Network";
/* helpchan/helpurl: These 2 items are shown when a user does
* /quote help with no additional parameters to direct them
* to a channel/URL where they can get more or network-specific help.
* They can be commented out and will not show to users if they are.
*/
helpchan = "#help";
helpurl = "http://www.mynet.net/help";
/* hub: allow this server to act as a hub and have multiple servers
* connected to it.
*/
@ -166,19 +125,16 @@ serverinfo {
#vhost6 = "3ffe:80e8:546::2";
/* ssl_private_key: our ssl private key */
ssl_private_key = "etc/ssl.key";
ssl_private_key = "etc/test.key";
/* ssl_cert: certificate for our ssl server */
ssl_cert = "etc/ssl.cert";
ssl_cert = "etc/test.cert";
/* ssl_dh_params: DH parameters, generate with openssl dhparam -out dh.pem 1024 */
ssl_dh_params = "etc/dh.pem";
/* ssld_count: number of ssld processes you want to start, if you
* have a really busy server, using N-1 where N is the number of
* cpu/cpu cores you have might be useful. A number greater than one
* can also be useful in case of bugs in ssld and because ssld needs
* two file descriptors per SSL connection.
/* ssld_count: number of ssld processes you want to start, if you have a really busy
* server, using N-1 where N is the number of cpu/cpu cores you have might be useful
*/
ssld_count = 1;
@ -248,19 +204,19 @@ class "users" {
*/
number_per_ip_global = 5;
/* cidr_ipv4_bitlen: Limits numbers of connections from a subnet size
*/
cidr_ipv4_bitlen = 24;
/* cidr_ipv6_bitlen: Limits numbers of connections from a subnet size
/* cidr_bitlen: Limits numbers of connections from a subnet size
* the following example makes the subnet /64 this is useful
* for IPv6 connections in particular
* Also note that the way charybdis is written if you have
* compiled support for IPv6, IPv4 cidr bitlens need to be modified
* Basically to get the approriate length add 96 to the IPv4 length
* For example for a /24 do 96+24 = 120
*
*/
cidr_ipv6_bitlen = 64;
cidr_bitlen = 64;
/* number_per_cidr: Number of connections to allow from a subnet of the
* size given in cidr_ipv4_bitlen/cidr_ipv6_bitlen.
* 4 seems to be a good default to me.
* size given in cidr_bitlen. 4 seems to be a good default to me.
*/
number_per_cidr = 4;
@ -304,13 +260,6 @@ class "server" {
/* listen {}: contain information about the ports ircd listens on (OLD P:) */
listen {
/* defer_accept: wait for clients to send IRC handshake data before
* accepting them. if you intend to use software which depends on the
* server replying first, such as BOPM, you should disable this feature.
* otherwise, you probably want to leave it on.
*/
defer_accept = yes;
/* port: the specific port to listen on. if no host is specified
* before, it will listen on all available IPs.
*
@ -349,15 +298,6 @@ auth {
user = "*@172.16.0.0/12";
user = "*test@123D:B567:*";
/* auth_user: The username (authenticated via SASL or PASS) allowed
* to connect. You are able to put multiple auth_user lines. If people
* are authenticating via SASL in this way, it is recommended to comment
* out the password option below. You will also *NEED* to specify a user
* line above auth_user, this can safely be "*@*", however.
*/
auth_user = "jilles";
auth_user = "jdhore";
/* password: an optional password that is required to use this block.
* By default this is not encrypted, specify the flag "encrypted" in
* flags = ...; below if it is.
@ -370,12 +310,6 @@ auth {
*/
spoof = "I.still.hate.packets";
/* autojoin: Channel (or channels, comma-seperated) to join users
* in this auth block to on connect. Note that this won't join
* the user through any bans or otherwise restrictive chmodes.
*/
autojoin = "#shadowircd,#test";
/* Possible flags in auth:
*
* encrypted | password is encrypted with mkpasswd
@ -392,7 +326,6 @@ auth {
* USE WITH CAUTION.
* no_tilde (old - flag) | don't prefix ~ to username if no ident
* need_ident (old + flag) | require ident for user in this class
* need_ssl | require SSL/TLS for user in this class
* need_sasl | require SASL id for user in this class
*/
flags = kline_exempt, exceed_limit;
@ -401,24 +334,6 @@ auth {
class = "opers";
};
/* Example WEBIRC authblock */
auth {
/* user: webirc@IP.OF.YOUR.WEBIRC . the webirc@ part is required */
user = "webirc@192.168.1.1";
/* password: password the webirc client sends in the WEBIRC command.
* You can use a encrypted password here (see above auth block).
*/
password = "<password>";
/* spoof: This is required to keep it what it is currently if you
* want the webirc client to show the users' real host as their
* host on IRC.
*/
spoof = "webirc.";
class = "users";
};
auth {
/* redirect: the server and port to redirect a user to. A user does
* not have to obey the redirection, the ircd just suggests to them
@ -440,60 +355,10 @@ auth {
flags = need_ident;
};
/* privset{}: defines operator privilege sets. */
privset "local_op" {
/* privs: controls the activities and commands an oper is
* allowed to do on the server
*
* Available options:
*
* oper:local_kill: allows local users to be /KILL'd
* oper:global_kill: allows local and remote users to be /KILL'd
* oper:routing: allows remote SQUIT and CONNECT
* oper:kline: allows KLINE and DLINE
* oper:unkline: allows UNKLINE and UNDLINE
* snomask:nick_changes: allows oper to see nickchanges via snomask +n
* oper:rehash: allows oper to REHASH config
* oper:die: allows DIE and RESTART
* oper:admin: gives admin privileges. admins
* may (un)load modules and see various
* additional information.
* oper:hidden_admin: gives admin privileges except
* will not have the admin lines in
* whois.
* oper:xline: allows use of /quote xline/unxline
* oper:resv: allows /quote resv/unresv and cmode +LP
* oper:operwall: allows the oper to send/receive operwalls
* oper:override: allows the oper to set umode +p on themself
which grants the ability to have implicit
operator access in all channels.
* oper:spy: allows 'operspy' features to see through +s
* channels etc. see /quote help operspy
* oper:hidden: hides the oper from /stats p
* oper:remoteban: allows remote kline etc
* oper:mass_notice: allows sending wallops and mass notices
*/
privs = oper:local_kill, oper:operwall;
};
privset "server_bot" {
/* extends: a privset to inherit in this privset */
extends = "local_op";
privs = oper:kline, oper:remoteban, snomask:nick_changes;
};
privset "global_op" {
extends = "local_op";
privs = oper:global_kill, oper:routing, oper:kline, oper:unkline, oper:xline,
oper:resv, oper:mass_notice, oper:remoteban;
};
privset "admin" {
extends = "global_op";
privs = oper:admin, oper:die, oper:rehash, oper:spy, oper:override;
};
/* operator {}: defines ircd operators. (OLD O:) */
/* operator {}: defines ircd operators. (OLD O:)
* charybdis no longer supports local operators, privileges are
* controlled via flags.
*/
operator "god" {
/* name: the name of the oper must go above */
@ -516,12 +381,6 @@ operator "god" {
*/
#rsa_public_key_file = "/usr/local/ircd/etc/oper.pub";
/* fingerprint: if specified, the oper's client certificate
* fingerprint will be checked against the specified fingerprint
* below.
*/
#fingerprint = "c77106576abf7f9f90cca0f63874a60f2e40a64b";
/* umodes: the specific umodes this oper gets when they oper.
* If this is specified an oper will not be given oper_umodes
* These are described above oper_only_umodes in general {};
@ -531,39 +390,44 @@ operator "god" {
/* snomask: specific server notice mask on oper up.
* If this is specified an oper will not be given oper_snomask.
*/
snomask = "+FZbcfkrsuy";
snomask = "+Zbfkrsuy";
/* vhost: defines the vhost that this oper will get on oper up.
* this must be a valid hostmask. If this is specified the oper
* will not be given default_operhost.
*/
vhost = "is.an.oper";
/* swhois: defines an additional line that will be displayed
* whenever someone does /whois on the oper in question.
*/
swhois = "is wearing pants.";
/* operstring: defines a custom operstring for this oper,
* which will be shown in whois instead of default_operstring
* or default_adminstring.
*/
operstring = "is a lazy IRC Operator";
/* flags: misc options for the operator. You may prefix an option
* with ~ to disable it, e.g. ~encrypted.
/* privileges: controls the activities and commands an oper is
* allowed to do on the server. You may prefix an option with ~ to
* disable it, ie ~operwall
*
* Default flags are encrypted.
* Default flags are operwall, remoteban and encrypted.
*
* Available options:
*
* encrypted: the password above is encrypted [DEFAULT]
* need_ssl: must be using SSL/TLS to oper up
* local_kill: allows local users to be /KILL'd
* global_kill: allows local and remote users to be
* /KILL'd (OLD 'O' flag)
* remote: allows remote SQUIT and CONNECT (OLD 'R' flag)
* kline: allows KLINE and DLINE (OLD 'K' flag)
* unkline: allows UNKLINE and UNDLINE (OLD 'U' flag)
* nick_changes: allows oper to see nickchanges (OLD 'N' flag)
* via snomask +n
* rehash: allows oper to REHASH config (OLD 'H' flag)
* die: allows DIE and RESTART (OLD 'D' flag)
* admin: gives admin privileges. admins
* may (un)load modules and see the
* real IPs of servers.
* hidden_admin: gives admin privileges except
* will not have the admin lines in
* stats p and whois.
* xline: allows use of /quote xline/unxline
* resv: allows /quote resv/unresv and cmode +LP [DEFAULT]
* operwall: allows the oper to send/receive operwalls [DEFAULT]
* oper_spy: allows 'operspy' features to see through +s
* channels etc. see /quote help operspy
* hidden_oper: hides the oper from /stats p (OLD UMODE +p)
* remoteban: allows remote kline etc [DEFAULT]
* mass_notice: allows sending wallops and mass notices [DEFAULT]
*/
flags = encrypted;
/* privset: privileges set to grant */
privset = "admin";
flags = global_kill, remote, kline, unkline,
die, rehash, admin, xline, operwall;
};
/* connect {}: controls servers we connect to (OLD C:, N:, H:, L:) */
@ -586,12 +450,6 @@ connect "irc.uplink.com" {
send_password = "password";
accept_password = "anotherpassword";
/* fingerprint: if specified, the server's client certificate
* fingerprint will be checked against the specified fingerprint
* below.
*/
#fingerprint = "c77106576abf7f9f90cca0f63874a60f2e40a64b";
/* port: the port to connect to this server on */
port = 6666;
@ -719,11 +577,9 @@ shared {
* resv - allow setting perm/temp resvs
* tresv - allow setting temp resvs
* unresv - allow removing xlines
* rehash - allow rehashing
* all - allow oper/server to do all of above.
* locops - allow locops - only used for servers who cluster
* die - allow restarting/dying of servers
* modules - allow loading/unloading/reloading of modules
* rehash - allow rehashing
* dline - allow setting perm/temp dlines
* tdline - allow setting temp dlines
* undline - allow removing dlines
@ -759,62 +615,20 @@ exempt {
/* The channel block contains options pertaining to channels */
channel {
/* disabledmodes: Modes that will be disabled, users will not be
* able to set them. This is only read on startup, you need to
* restart the ircd for this to have any effect. This only prevents
* local users/opers from setting these modes. This does not prevent
* remote servers/users (ex: services) from setting them. Make sure
* your services and remote servers are properly configured when
* using this option!
* Valid parameters are: CLPFQITDENGJKMrczgqefj
/* invex: Enable/disable channel mode +I, a n!u@h list of masks
* that can join a +i channel without an invite.
*/
#disabledmodes = "ME";
use_invex = yes;
/* autochanmodes: Modes that will be set on a unregistered channel
* when the first user joins it.
/* except: Enable/disable channel mode +e, a n!u@h list of masks
* that can join a channel through a ban (+b).
*/
autochanmodes = "nt";
use_except = yes;
/* admin_on_channel_create: If set to yes, users joining new channels
* will be given +ao instead of just +o. Requires use_admin.
/* forward: Enable/disable channel mode +f, a channel to forward
* users to if they can't join because of +i etc.
*/
admin_on_channel_create = no;
/* exemptchanops: Channel modes that any form of channel ops (+aoh)
* will be exempt from. Even if the mode is set, it will not apply to the
* channel ops if it is listed in this option. Valid modes are cCDTNGK.
*/
exemptchanops = "NT";
/* halfop: Enable/disable channel mode +h, which adds halfop,
* a channel status below op that has op powers (kick, ban, mode, etc.)
* halfops can only kick/devoice/etc people who are +v or
* do not have any channel status. Disabling this via rehash will
* cause things which are rather confusing to occur, it is highly
* recommended to restart if you wish to disable this option, though
* it may be enabled by rehash with no problems.
*/
use_halfop = yes;
/* admin: Enable/disable channel mode +a, which adds admin,
* a channel status above op that has op powers (kick, ban, mode, etc.)
* admins can only be kicked/deadmined by other admins, and may kick
* or deop anyone. Disabling this via rehash will cause things which
* are rather confusing to occur, it is highly recommended to restart
* if you wish to disable this option, though it may be enabled
* by rehash with no problems.
*/
use_admin = yes;
/* owner: Enable/disable channel mode +y, which adds owner,
* a channel status above admin that has op powers (kick, ban, mode, etc.)
* owners can only be kicked/deadmined by other owners, and may kick
* or deop anyone. Disabling this via rehash will cause things which
* are rather confusing to occur, it is highly recommended to restart
* if you wish to disable this option, though it may be enabled
* by rehash with no problems.
*/
use_owner = yes;
use_forward = yes;
/* knock: Allows users to request an invite to a channel that
* is locked somehow (+ikl). If the channel is +p or you are banned
@ -822,12 +636,6 @@ channel {
*/
use_knock = yes;
/* local channels: &Channel - a channel that exists only on one server
* people on other servers will not be able to see or join local channels
* from another server.
*/
use_local_channels = yes;
/* knock delay: The amount of time a user must wait between issuing
* the knock command.
*/
@ -842,7 +650,7 @@ channel {
max_chans_per_user = 15;
/* max bans: maximum number of +b/e/I/q modes in a channel */
max_bans = 100;
max_bans = 25;
/* max bans: maximum number of +b/e/I/q modes in a +L channel */
max_bans_large = 500;
@ -890,35 +698,6 @@ channel {
* ratbox-services does.
*/
kick_on_split_riding = no;
/* only ascii channels: disable local users joining channels
* containing characters outside the range 33-126 (non-printable
* or non-ASCII).
*/
only_ascii_channels = no;
/* cycle_host_change: Should a user be cycled in the channels
* they're in when their host changes. If set to no, this may
* cause client desyncs.
*/
cycle_host_change = yes;
/* host_in_topic: Defines whether or not the topicsetter's
* host is shown when users request the TOPIC. If this option
* is set to no, it will only show the nick of the topicsetter.
*/
host_in_topic = yes;
/* resv_forcepart: force any local users to part a channel
* when a RESV is issued.
*/
resv_forcepart = yes;
/* channel target change: restrict how many channels users can
* message per unit of time. IRC operators, channel operators and
* voiced users are exempt.
*/
channel_target_change = yes;
};
@ -926,7 +705,7 @@ channel {
serverhide {
/* flatten links: this option will hide various routing information
* and make all servers in /links appear that they are linked to
* this server. This option also disallows non-opers from using /map
* this server.
*/
flatten_links = no;
@ -948,7 +727,7 @@ serverhide {
/* These are the blacklist settings.
* You can have multiple combinations of host and rejection reasons.
* They are used in pairs of one host/rejection reason.
* They are used in pairs of one host/rejection reason, or multiple hosts/rejection reason.
*
* These settings should be adequate for most networks, and are (presently)
* required for use on AthemeNet.
@ -965,13 +744,19 @@ serverhide {
* ${nick} - the user's nickname
* ${network-name} - the name of the network
*
* Note: AHBL (the providers of the below *.ahbl.org BLs) request that they be
* contacted, via email, at admins@2mbit.com before using these BLs.
* See <http://www.ahbl.org/services.php> for more information.
*/
blacklist {
host = "rbl.efnetrbl.org";
reject_reason = "${nick}, your IP (${ip}) is listed in EFnet's RBL. For assistance, see http://efnetrbl.org/?i=${ip}";
host = "dnsbl.dronebl.org";
reject_reason = "${nick}, your IP (${ip}) is listed in DroneBL. For assistance, see http://dronebl.org/lookup_branded.do?ip=${ip}&network=${network-name}";
# host = "ircbl.ahbl.org";
# reject_reason = "${nick}, your IP (${ip}) is listed in ${dnsbl-host} for having an open proxy. In order to protect ${network-name} from abuse, we are not allowing connections with open proxies to connect.";
#
# host = "tor.ahbl.org";
# reject_reason = "${nick}, your IP (${ip}) is listed as a TOR exit node. In order to protect ${network-name} from tor-based abuse, we are not allowing TOR exit nodes to connect to our network.";
};
/*
@ -1002,22 +787,6 @@ alias "MemoServ" {
target = "MemoServ";
};
alias "HostServ" {
target = "HostServ";
};
alias "BotServ" {
target = "BotServ";
};
alias "InfoServ" {
target = "InfoServ";
};
alias "GroupServ" {
target = "GroupServ";
};
alias "NS" {
target = "NickServ";
};
@ -1034,22 +803,6 @@ alias "MS" {
target = "MemoServ";
};
alias "HS" {
target = "HostServ";
};
alias "BS" {
target = "BotServ";
};
alias "IS" {
target = "InfoServ";
};
alias "GS" {
target = "GroupServ";
};
/* The general block contains many of the options that were once compiled
* in options in config.h. The general block is read at start time.
*/
@ -1076,10 +829,10 @@ general {
/* default umodes: umodes to set upon connection
* If you have enabled the ip_cloaking extension, and you wish for
* incoming clients to be cloaked upon connection, +x must be in
* the umode string below.
* incoming clients to be set +h upon connection, add +h to the umode
* string below.
*/
default_umodes = "+ix";
default_umodes = "+i";
/* default operstring: defines the default oper response
* in /whois queries, eg "is an IRC Operator".
@ -1093,18 +846,6 @@ general {
*/
default_adminstring = "is a Server Administrator";
/* default operhost: defines the default virtual host that
* operators will receiving upon opering up. Can be overriden
* by the vhost option in individual operator blocks. This
* must be a valid hostmask.
*/
default_operhost = "staff.testnet.net";
/* static quit: Quit message to display for all users (not opers)
* on QUIT.
*/
#static_quit = "I like turtles!";
/* servicestring: defines the response for opered services (+S)
* in /whois queries, eg "is a Network Service".
* This is updated on rehash.
@ -1117,12 +858,6 @@ general {
*/
disable_fake_channels = no;
/* hide_channel_below_users: Amount of users a channel must have in it
* before it is shown in a standard LIST. This can be overridden by
* invoking LIST like: /LIST <3
*/
hide_channel_below_users = 3;
/* tkline_expire_notices: give a notice to opers when a tkline
* expires
*/
@ -1156,7 +891,7 @@ general {
*/
min_nonwildcard_simple = 3;
/* max accept: maximum allowed /accept's for +gGR usermodes */
/* max accept: maximum allowed /accept's for +g usermode */
max_accept = 20;
/* max monitor: the maximum amount of nicknames a client may have in
@ -1171,16 +906,10 @@ general {
max_nick_time = 20 seconds;
max_nick_changes = 5;
/* anti spam time: the minimum time a user must be connected before
/* anti spam time: the minimum time a user must be connected before
* custom quit messages are allowed.
*/
anti_spam_exit_message_time = 5 minutes;
/* use part messages: This option controls whether users should be
* allowed to send PART messages to channels. It should probably
* be set to no if static_quit is set.
*/
use_part_messages = yes;
anti_spam_exit_message_time = 5 minutes;
/* ts delta: the time delta allowed between server clocks before
* a warning is given, or before the link is dropped. all servers
@ -1225,7 +954,7 @@ general {
/* kline reason: make the users quit message on channels this
* reason instead of the oper's reason.
*/
kline_reason = "K-Lined";
kline_reason = "Connection closed";
/* identify to services via server password
* if auth{} block had no password but the user specified a
@ -1244,13 +973,6 @@ general {
*/
warn_no_nline = yes;
/* use propagated bans: KLINE, XLINE and RESV set fully propagated bans.
* That means the bans are part of the netburst and restarted/split
* servers will get them, but they will not apply to 3.2 and older
* servers at all.
*/
use_propagated_bans = yes;
/* stats e disabled: disable stats e. useful if server ips are
* exempted and you dont want them listing on irc.
*/
@ -1300,12 +1022,6 @@ general {
* protected. */
operspy_dont_care_user_info = no;
/* secret channels in whois: display secret channels in /whois
* even if operspy was not used, as long as the oper doing the
* whois has the oper:spy priv. this will not send any kind of
* server notice. */
secret_channels_in_whois = no;
/* caller id wait: time between notifying a +g user that somebody
* is messaging them.
*/
@ -1336,29 +1052,12 @@ general {
*/
connect_timeout = 30 seconds;
/* ident timeout: Amount of time (in seconds) that the IRCd will
* wait for a user to respond to an ident request.
*/
default_ident_timeout = 5;
/* disable auth: disables identd checking */
disable_auth = no;
/* no oper flood: increase flood limits for opers.
* This option quadruples the user command flood limits, it
* DOES NOT affect PRIVMSG/NOTICE usage.
*/
/* no oper flood: increase flood limits for opers. */
no_oper_flood = yes;
/* true no oper flood: Allow opers to NEVER hit flood limits.
* With the above setting, flood limits are set to 4x what they
* are for normal users. With this setting, they're removed entirely.
* For this setting to work, you need to have no_oper_flood enabled as well.
* This option DOES allow PRIVMSG/NOTICE flooding.
* ENABLE THIS SETTING WITH CAUTION.
*/
true_no_oper_flood = no;
/* REMOVE ME. The following line checks you've been reading. */
havent_read_conf = yes;
@ -1389,11 +1088,6 @@ general {
* +s - servnotice - See server notices
* +w - wallop - See oper and server generated WALLOPS
* +z - operwall - See operwalls
* +C - noctcp - Block CTCPs to user.
* +V - noinvite - Block INVITE to user.
* +B - bot - Marks as a bot.
* +p - override - Implicit operator access in all channels.
* This is oper-only and requires the oper:override priv.
*/
/* oper only umodes: usermodes only opers may set */
@ -1406,6 +1100,13 @@ general {
* provided they have umode +s set */
oper_snomask = "+s";
/* servlink path: path to 'servlink' program used by ircd to handle
* encrypted/compressed server <-> server links.
*
* only define if servlink is not in same directory as ircd itself.
*/
#servlink_path = "/usr/local/ircd/bin/servlink";
/* use egd: if your system does not have *random devices yet you
* want to use OpenSSL and encrypted links, enable this. Beware -
* EGD is *very* CPU intensive when gathering data for its pool
@ -1452,25 +1153,10 @@ general {
/* reject duration: the amount of time to cache the rejection */
reject_duration = 5 minutes;
/* throttle_duration: Amount of time that throttling will be applied to an IP
* address.
/* max_unknown_ip: maximum number of pending connections to the server
* that are allowed per IP address
*/
throttle_duration = 60;
/* throttle_count: Number of connections within throttle_duration that it takes
* for throttling to take effect */
throttle_count = 4;
/* expire_override_time: User mode +p will be automatically unset
* this long after it is set. 0 disables this. Default is 5 minutes.
*/
expire_override_time = 5 minutes;
/* away_interval: the minimum interval between AWAY commands. One
* additional AWAY command is allowed, and only marking as away
* counts.
*/
away_interval = 30;
max_unknown_ip = 2;
};
modules {

View File

@ -116,3 +116,4 @@ See also http://sasl.charybdis.be/ and
http://wiki.atheme.net/index.php/PR:SASL_Authentication (these links are
currently dead but may be resurrected in the future).
$Id: sasl.txt 3169 2007-01-28 22:13:18Z jilles $

View File

@ -42,6 +42,9 @@ following features to ircd:
When users are logged in, WHOIS will also give numeric 330:
:<server> 330 <yournick> <targetnick> <loginname> :is logged in as
Note this needs to be a remote whois to work when the target is
on a different server.
6. Forced nick change
When using nickname services and a client requests they regain a
@ -49,14 +52,4 @@ following features to ircd:
This forcibly changes the clients nickname to the one they requested
they regain, ensuring they can always regain their nickname.
7. User mode +R
This user mode will require users are logged in with user services
before they may send private messages or notices to the user.
As with user mode +g, IRC operators and accepted users can send even
if they are not logged in.
Gives numeric 486 to users sending a PRIVMSG who are not logged in:
:<server> 486 <nick> <targetnick> :You must log in with services to message this user
# $Id: services.txt 6 2005-09-10 01:02:21Z nenolod $

View File

@ -9,7 +9,7 @@
]>
<book id="charybdis-oper-guide">
<bookinfo>
<date>2009</date>
<date>24 November 2005</date>
<title>Operators guide for the charybdis IRC server</title>
<author>
<firstname>William</firstname>
@ -20,7 +20,7 @@
<surname>Tjoelker</surname>
</author>
<copyright>
<year>2005-2009</year>
<year>2005-2008</year>
<holder>William Pitcock and Jilles Tjoelker</holder>
</copyright>
<legalnotice>

View File

@ -296,11 +296,11 @@
<sect2>
<title>+z, reduced moderation</title>
<para>
When +z is set, the effects of +m, +b and +q are relaxed. For each message, if that message
would normally be blocked by one of these modes, it is instead sent to all channel operators. This is intended for use in moderated debates.
When +z is set, the effects of +m are relaxed. For each message, if that message
would normally be blocked by moderation, it is instead sent to all channel operators. This is intended for use in moderated debates.
</para>
<para>
Note that +n is unaffected by this. To silence a given user completely,
Note that +n and channel bans/quiets are unaffected by this. To silence a given user completely,
remove them from the channel.
</para>
</sect2>

View File

@ -4,9 +4,7 @@
<title>Network management commands</title>
<note>
<para>
All commands and names are case insensitive.
Parameters consisting of one or more separate letters,
such as in MODE, STATS and WHO, are case sensitive.
Except STATS letters, all commands and names are case insensitive.
</para>
</note>
<sect2>
@ -22,10 +20,6 @@
<replaceable class=parameter>source</replaceable> is given, tell that server to initiate the connection
attempt, otherwise it will be made from the server you are attached to.
</para>
<para>
To use the default port with <replaceable class=parameter>source</replaceable>,
specify 0 for <replaceable class=parameter>port</replaceable>.
</para>
</sect2>
<sect2>
<title>SQUIT</title>
@ -158,144 +152,66 @@
<cmdsynopsis>
<command>SET</command>
<group>
<arg>ADMINSTRING</arg>
<arg>AUTOCONN</arg>
<arg>AUTOCONNALL</arg>
<arg>FLOODCOUNT</arg>
<arg>IDENTTIMEOUT</arg>
<arg>LOG</arg>
<arg>MAX</arg>
<arg>OPERSTRING</arg>
<arg>SPLITDELAY</arg>
<arg>SMALLNET</arg>
<arg>SPAMNUM</arg>
<arg>SPAMTIME</arg>
<arg>SPLITMODE</arg>
<arg>SPLITNUM</arg>
<arg>SPLITUSERS</arg>
</group>
<arg choice=plain><replaceable>value</replaceable></arg>
</cmdsynopsis>
<para>The SET command sets a runtime-configurable value.</para>
<para>
Most of the <filename>ircd.conf</filename> equivalents have
a default_ prefix and are only read on startup. SET is the only
way to change these at run time.
</para>
<para>
Most of the values can be queried by omitting
<replaceable>value</replaceable>.
</para>
<para>The SET command sets a runtime-configurable value</para>
<variablelist>
<varlistentry>
<term>ADMINSTRING</term>
<listitem><para>
Sets string shown in WHOIS for admins.
(umodes +o and +a set, umode +S not set).
</para></listitem>
</varlistentry>
<varlistentry>
<term>AUTOCONN</term>
<listitem><para>
Sets auto-connect on or off for a particular server.
Takes two parameters, server name and new state.
</para><para>
To see these values, use /stats c.
Changes to this are lost on a rehash.
</para></listitem>
</varlistentry>
<varlistentry>
<term>AUTOCONNALL</term>
<listitem><para>
Globally sets auto-connect on or off. If disabled, no automatic
connections are done; if enabled, automatic connections are done
following the rules for them.
</para></listitem>
</varlistentry>
<varlistentry>
<term>FLOODCOUNT</term>
<listitem><para>
The number of lines allowed to be sent to a connection before
throttling it due to flooding.
Note that this variable is used for both
channels and clients.
</para><para>
For channels, op or voice overrides this; for users, IRC
operator status or op or voice on a common channel overrides
this.
</para></listitem>
</varlistentry>
<varlistentry>
<term>IDENTTIMEOUT</term>
<listitem><para>
Timeout for requesting ident from a client.
</para></listitem>
<term>LOG</term>
<listitem>
<para>Logging level for ircd.log and syslog</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry>
<term>MAX</term>
<listitem><para>
Sets the maximum number of connections
to <replaceable>value</replaceable>.
</para><para>
This number cannot exceed maxconnections - MAX_BUFFER.
maxconnections is the rlimit for number of open files.
MAX_BUFFER is defined in config.h, normally 60.
</para><para>
MAXCLIENTS is an alias for this.
</para></listitem>
<listitem>
<para>Set the maximum connections allowed (may not exceed the compiled-in value HARD_FDLIMIT)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>OPERSTRING</term>
<listitem><para>
Sets string shown in WHOIS for opers
(umode +o set, umodes +a and +S not set).
</para></listitem>
<term>DRONETIME</term>
<listitem>
<para>Number of seconds in which DRONECOUNT messages must occur to trip the drone alarm</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DRONECOUNT</term>
<listitem>
<para>Number of messages which constitutes a drone flood. 0 disables drone flood checking.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>SPLITDELAY</term>
<listitem>
<para>Number of minutes after a connect burst begins until joining an empty channel will give you ops</para>
</listitem>
</varlistentry>
<varlistentry>
<term>SMALLNET</term>
<listitem>
<para>Sets the number of servers which are needed to constitute <quote>attached to the network</quote>, as opposed to <quote>split</quote></para>
</listitem>
</varlistentry>
<varlistentry>
<term>SPAMNUM</term>
<listitem><para>
Sets how many join/parts to channels
constitutes a possible spambot.
</para></listitem>
<listitem>
<para>Sets the number of JOINs/PARTs which constitutes a possible spambot</para>
</listitem>
</varlistentry>
<varlistentry>
<term>SPAMTIME</term>
<listitem><para>
Below this time on a channel
counts as a join/part as above.
</para></listitem>
</varlistentry>
<varlistentry>
<term>SPLITMODE</term>
<listitem><para>
Sets splitmode to <replaceable>value</replaceable>:
<variablelist>
<varlistentry>
<term>ON</term>
<listitem><para>splitmode is permanently on</para></listitem>
</varlistentry>
<varlistentry>
<term>OFF</term>
<listitem><para>splitmode is permanently off (default if no_create_on_split and no_join_on_split are disabled)</para></listitem>
</varlistentry>
<varlistentry>
<term>AUTO</term>
<listitem><para>ircd chooses splitmode based on SPLITUSERS and SPLITNUM (default if no_create_on_split or no_join_on_split are enabled)</para></listitem>
</varlistentry>
</variablelist>
</para></listitem>
</varlistentry>
<varlistentry>
<term>SPLITUSERS</term>
<listitem><para>
Sets the minimum amount of users needed to
deactivate automatic splitmode.
</para></listitem>
</varlistentry>
<varlistentry>
<term>SPLITNUM</term>
<listitem><para>
Sets the minimum amount of servers needed to
deactivate automatic splitmode.
Only servers that have finished bursting count for this.
</para></listitem>
<listitem>
<para>Staying on a channel for less than this length of time adds to the SPAMNUM count</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
@ -388,7 +304,11 @@
Works similarly to KLINE, but matches against the real name field.
The wildcards are * (any sequence), ? (any character),
# (a digit) and @ (a letter); wildcard characters can be
escaped with a backslash. The sequence \s matches a space.
escaped with a backslash.
</para>
<para>
Use \s for a space; this currently interferes with the
check whether the mask is already xlined and UNXLINE.
</para>
<para>
All clients matching the X:line will be disconnected from the server immediately.
@ -711,27 +631,6 @@
no target is specified.
</para>
</sect2>
<sect2>
<title>PRIVS</title>
<cmdsynopsis>
<command>PRIVS</command>
<arg><replaceable>nick</replaceable></arg>
</cmdsynopsis>
<para>
Displays effective operator privileges for
the specified nick, or for yourself if no nick is
given. This includes all privileges from the operator
block, the name of the operator block and those
privileges from the auth block that have an effect
after the initial connection.
</para>
<para>
The exact output depends on the server the nick is on,
see the matching version of this document.
If the remote server does not support this extension, you will not
receive a reply.
</para>
</sect2>
<sect2>
<title>MASKTRACE</title>
<cmdsynopsis>
@ -805,7 +704,7 @@
is hidden (auth{} spoof).
</para>
<para>
Network searches where a listing is given
Network searches where a listing is given or the mask option is used
are operspy commands.
</para>
</sect2>
@ -1010,12 +909,6 @@
<para>Show operator blocks</para>
</listitem>
</varlistentry>
<varlistentry>
<term>O</term>
<listitem>
<para>Show privset blocks</para>
</listitem>
</varlistentry>
<varlistentry>
<term>p</term>
<listitem>

View File

@ -170,8 +170,7 @@ class "<replaceable>name</replaceable>" {
number_per_ident = <replaceable>number</replaceable>;
number_per_ip = <replaceable>number</replaceable>;
number_per_ip_global = <replaceable>number</replaceable>;
cidr_ipv4_bitlen = <replaceable>number</replaceable>;
cidr_ipv6_bitlen = <replaceable>number</replaceable>;
cidr_bitlen = <replaceable>number</replaceable>;
number_per_cidr = <replaceable>number</replaceable>;
max_number = <replaceable>number</replaceable>;
sendq = <replaceable>size</replaceable>;
@ -220,22 +219,15 @@ class "<replaceable>name</replaceable>" {
</listitem>
</varlistentry>
<varlistentry>
<term>cidr_ipv4_bitlen</term>
<term>cidr_bitlen</term>
<listitem>
<para>The netblock length to use with CIDR-based client limiting for IPv4 users in this class (between 0 and 32).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>cidr_ipv6_bitlen</term>
<listitem>
<para>The netblock length to use with CIDR-based client limiting for IPv6 users in this class (between 0 and 128).</para>
<para>The netblock length to use with CIDR-based client limiting for this class.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>number_per_cidr</term>
<listitem>
<para>The amount of clients which may be connected from a single netblock.</para>
<para>If this needs to differ between IPv4 and IPv6, make different classes for IPv4 and IPv6 users.</para>
</listitem>
</varlistentry>
<varlistentry>
@ -418,12 +410,6 @@ auth {
<para>Users in this auth{} block must have identd, otherwise they will be rejected.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>need_ssl</term>
<listitem>
<para>Users in this auth{} block must be connected via SSL/TLS, otherwise they will be rejected.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>need_sasl</term>
<listitem>
@ -456,33 +442,6 @@ exempt {
</varlistentry>
</variablelist>
</sect2>
<sect2>
<title>privset {} block</title>
<synopsis>
privset {
extends = "<replaceable>name</replaceable>";
privs = <replaceable>list</replaceable>;
};</synopsis>
<para>
A privset (privilege set) block specifies a set of
operator privileges.
</para>
<variablelist>
<title>privset {} variables</title>
<varlistentry>
<term>extends</term>
<listitem>
<para>An optional privset to inherit. The new privset will have all privileges that the given privset has.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>privs</term>
<listitem>
<para>Privileges to grant to this privset. These are described in the operator privileges section.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2>
<title>operator {} block</title>
<synopsis>
@ -550,34 +509,18 @@ operator "<replaceable>name</replaceable>" {
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>privset</term>
<listitem>
<para>
The privilege set granted to successfully opered clients.
This must be defined before this operator{} block.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>flags</term>
<listitem>
<para>A list of flags to apply to this operator{} block. They are listed below.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist>
<title>operator {} flags</title>
<varlistentry>
<term>encrypted</term>
<listitem>
<para>The password used has been encrypted. This is enabled by default, use ~encrypted to disable it.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>need_ssl</term>
<listitem>
<para>Restricts use of this operator{} block to SSL/TLS connections only.</para>
<para>
A listing of privileges granted to operators using this block.
By default, the mass_notice, operwall, remoteban and resv privileges are granted;
use ~mass_notice, ~operwall, ~remoteban and ~resv to disable them if necessary.
</para>
<para>
In addition, a flag designating if the password is encrypted is here.
Privileges are documented elsewhere in this guide.
</para>
</listitem>
</varlistentry>
</variablelist>
@ -606,6 +549,8 @@ connect "<replaceable>name</replaceable>" {
<listitem>
<para>The hostname or IP to connect to.</para>
<note><para>
Charybdis uses solely DNS for all hostname/address lookups
(no <filename>/etc/hosts</filename> or anything else).
Furthermore, if a hostname is used, it must have an A or AAAA
record (no CNAME) and it must be the primary
hostname for inbound connections to work.
@ -1149,28 +1094,6 @@ service {
</variablelist>
</sect2>
</sect1>
<sect1>
<title>Hostname resolution (DNS)</title>
<para>
Charybdis uses solely DNS for all hostname/address lookups
(no <filename>/etc/hosts</filename> or anything else).
The DNS servers are taken from <filename>/etc/resolv.conf</filename>.
If this file does not exist or no valid IP addresses are listed in it,
the local host (127.0.0.1) is used. (Note that the latter part
did not work in older versions of Charybdis.)
</para>
<para>
IPv4 as well as IPv6 DNS servers are supported, but it is not
possible to use both IPv4 and IPv6 in
<filename>/etc/resolv.conf</filename>.
</para>
<para>
For both security and performance reasons, it is recommended
that a caching nameserver such as BIND be run on the same machine
as Charybdis and that <filename>/etc/resolv.conf</filename> only
list 127.0.0.1.
</para>
</sect1>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:

View File

@ -4,7 +4,7 @@
<title>Scope of this document</title>
<para>
This document describes the commands and functions available to operators in
shadowircd, as used on <ulink url="http://www.thinstack.net">Thinstack</ulink>.
the charybdis ircd, as used on <ulink url="http://www.atheme.net">AthemeNet</ulink>.
</para>
<para>
This document, and various ideas for features of charybdis, have
@ -16,9 +16,9 @@
it is intended as a reference for network staff.
</para>
<para>
ShadowIRCd is based on Charybdis which is based on ircd-ratbox 3.0.0,
although much has changed. <ulink url="http://www.ircd-ratbox.org">ircd-ratbox</ulink>
is commonly used on efnet, and some other networks.
Charybdis is based on ircd-ratbox 2.1.4, although much has changed.
<ulink url="http://www.ircd-ratbox.org">ircd-ratbox</ulink> is commonly used
on efnet, and some other networks.
</para>
</sect1>
</chapter>

View File

@ -3,10 +3,12 @@
<sect1 id="oprivlist">
<title>Meanings of oper privileges</title>
<para>
These are specified in privset{}.
These are flags in operator{}.
The letter appears after opering up and in /stats o; an uppercase
letter means the privilege is possessed, lowercase means it is not.
</para>
<sect2>
<title>oper:admin, server administrator</title>
<title>admin (A), server administrator</title>
<para>
Various privileges intended for server administrators.
Among other things, this automatically sets umode +a and allows
@ -14,50 +16,56 @@
</para>
</sect2>
<sect2>
<title>oper:die, die and restart</title>
<title>remoteban (B), set remote bans</title>
<para>
This grants permission to use DIE and RESTART, shutting down
or restarting the server.
This grants the ability to use the ON argument on KLINE/XLINE/RESV
and UNKLINE/UNXLINE/UNRESV to set and unset bans on other servers,
and the server argument on REHASH.
This is only allowed if the oper may perform the action locally,
and if the remote server has a shared{} block.
</para>
<note><para>
If a cluster{} block is present, bans are sent remotely even
if the oper does not have remoteban privilege.
</para></note>
</sect2>
<sect2>
<title>oper:global_kill, global kill</title>
<para>
Allows using KILL on users on any server.
</para>
</sect2>
<sect2>
<title>oper:hidden, hide from /stats p</title>
<para>
This privilege currently does nothing, but was designed
to hide bots from /stats p so users will not message them
for help.
</para>
</sect2>
<sect2>
<title>oper:hidden_admin, hidden administrator</title>
<para>
This grants everything granted to the oper:admin privilege,
except the ability to set umode +a. If both oper:admin and oper:hidden_admin
are possessed, umode +a can still not be used.
</para>
</sect2>
<sect2>
<title>oper:kline, kline and dline</title>
<para>
Allows using KLINE and DLINE, to ban users by user@host mask
or IP address.
</para>
</sect2>
<sect2>
<title>oper:local_kill, kill local users</title>
<title>local_kill (C), kill local users</title>
<para>
This grants permission to use KILL on users on the same server,
disconnecting them from the network.
</para>
</sect2>
<sect2>
<title>oper:mass_notice, global notices and wallops</title>
<title>die (D), die and restart</title>
<para>
This grants permission to use DIE and RESTART, shutting down
or restarting the server.
</para>
</sect2>
<sect2>
<title>rehash (H), rehash</title>
<para>
Allows using the REHASH command, to rehash various configuration
files or clear certain lists.
</para>
</sect2>
<sect2>
<title>kline (K), kline and dline</title>
<para>
Allows using KLINE and DLINE, to ban users by user@host mask
or IP address.
</para>
</sect2>
<sect2>
<title>operwall (L), send/receive operwall</title>
<para>
Allows using the OPERWALL command and umode +z to send and
receive operwalls.
</para>
</sect2>
<sect2>
<title>mass_notice (M), global notices and wallops</title>
<para>
Allows using server name ($$mask) and hostname ($#mask) masks in
NOTICE and PRIVMSG to send a message to all matching users, and
@ -66,42 +74,35 @@
</para>
</sect2>
<sect2>
<title>oper:operwall, send/receive operwall</title>
<title>nick_changes (N), see nick changes</title>
<para>
Allows using the OPERWALL command and umode +z to send and
receive operwalls.
Allows using snomask +n to see local client nick changes.
This is designed for monitor bots.
</para>
</sect2>
<sect2>
<title>oper:rehash, rehash</title>
<title>global_kill (O), global kill</title>
<para>
Allows using the REHASH command, to rehash various configuration
files or clear certain lists.
Allows using KILL on users on any server.
</para>
</sect2>
<sect2>
<title>oper:remoteban, set remote bans</title>
<title>hidden_oper (P), hide from /stats p</title>
<para>
This grants the ability to use the ON argument on
DLINE/KLINE/XLINE/RESV and UNDLINE/UNKLINE/UNXLINE/UNRESV to set
and unset bans on other servers, and the server argument on REHASH.
This is only allowed if the oper may perform the action locally,
and if the remote server has a shared{} block.
This privilege currently does nothing, but was designed
to hide bots from /stats p so users will not message them
for help.
</para>
<note><para>
If a cluster{} block is present, bans are sent remotely even
if the oper does not have oper:remoteban privilege.
</para></note>
</sect2>
<sect2>
<title>oper:resv, channel control</title>
<title>resv (Q), channel control</title>
<para>
This allows using /resv, /unresv and changing the channel
modes +L and +P.
</para>
</sect2>
<sect2>
<title>oper:routing, remote routing</title>
<title>remote (R), remote routing</title>
<para>
This allows using the third argument of the CONNECT command, to
instruct another server to connect somewhere, and using SQUIT
@ -109,21 +110,13 @@
(In both cases all opers with +w set will be notified.)
</para>
</sect2>
<sect2>
<title>oper:override, operator access in all channels</title>
<para>
This allows the operator to have implicit operator access
in all channels. It is enabled by setting user mode +p which
will automatically expire after a period of time set in the
configuration file.
</para>
<sect2>
<title>oper:spy, use operspy</title>
<title>oper_spy (S), use operspy</title>
<para>
This allows using /mode !#channel, /whois !nick, /who !#channel,
/chantrace !#channel, /topic !#channel, /who !mask,
/masktrace !user@host :gecos and /scan umodes +modes-modes global list
to see through secret channels, invisible users, etc.
/chantrace !#channel, /who !mask, /masktrace !user@host :gecos
and /scan umodes +modes-modes global list to see through secret
channels, invisible users, etc.
</para>
<para>
All operspy usage is broadcasted to opers with snomask +Z set
@ -140,23 +133,27 @@
</para>
</sect2>
<sect2>
<title>oper:unkline, unkline and undline</title>
<title>unkline (U), unkline</title>
<para>
Allows using UNKLINE and UNDLINE.
</para>
</sect2>
<sect2>
<title>oper:xline, xline and unxline</title>
<title>xline (X), xline and unxline</title>
<para>
Allows using XLINE and UNXLINE, to ban/unban users by realname.
</para>
</sect2>
<sect2>
<title>snomask:nick_changes, see nick changes</title>
<title>hidden_admin, hidden administrator</title>
<para>
Allows using snomask +n to see local client nick changes.
This is designed for monitor bots.
This grants everything granted to the admin privilege,
except the ability to set umode +a. If both admin and hidden_admin
are possessed, umode +a can still not be used.
</para>
<note><para>
This privilege does not appear in /stats o or oper up notices.
</para></note>
</sect2>
</sect1>
</chapter>

View File

@ -51,10 +51,6 @@
you should probably use this command, for example sending a
notice to every user joining a certain channel.
</para>
<para>
As of charybdis 3.1, NOTICE automatically behaves as CNOTICE
if you are in a channel fulfilling the conditions.
</para>
<para>
Support of this command is indicated by the CNOTICE token in
RPL_ISUPPORT (005).
@ -78,34 +74,11 @@
If you get <quote>Targets changing too fast, message dropped</quote>,
you should probably use this command.
</para>
<para>
As of charybdis 3.1, PRIVMSG automatically behaves as CPRIVMSG
if you are in a channel fulfilling the conditions.
</para>
<para>
Support of this command is indicated by the CPRIVMSG token in
RPL_ISUPPORT (005).
</para>
</sect2>
<sect2>
<title>FINDFORWARDS</title>
<cmdsynopsis><command>FINDFORWARDS</command>
<arg choice=plain><replaceable>channel</replaceable></arg>
</cmdsynopsis>
<para>
<note>
<para>
This command is only available if the <filename>m_findforwards.so</filename> extension is loaded.
</para>
</note>
Displays which channels forward to the given channel (via cmode +f).
If there are very many channels the list will be truncated.
</para>
<para>
You must be a channel operator on the channel or an IRC operator
to use this command.
</para>
</sect2>
<sect2>
<title>HELP</title>
<cmdsynopsis><command>HELP</command>
@ -120,30 +93,6 @@
UHELP to query the user help files.
</para>
</sect2>
<sect2>
<title>IDENTIFY</title>
<cmdsynopsis><command>IDENTIFY</command>
<arg choice=plain><replaceable>parameters...</replaceable></arg>
</cmdsynopsis>
<para>
<note>
<para>
This command is only available if the <filename>m_identify.so</filename> extension is loaded.
</para>
</note>
Sends an identify command to either NickServ or ChanServ.
If the first parameter starts with #, the command is sent to
ChanServ, otherwise to NickServ.
The word IDENTIFY, a space and all parameters are concatenated
and sent as a PRIVMSG to the service.
If the service is not online or does not have umode +S set,
no message will be sent.
</para>
<para>
The exact syntax for this command depends on the services package
in use.
</para>
</sect2>
<sect2>
<title>KNOCK</title>
<cmdsynopsis><command>KNOCK</command>

View File

@ -43,9 +43,8 @@
wishes to speak to them.
</para>
<para>
If a network operator needs to speak to a user who has +g set,
the operator can use the OACCEPT command to be able to speak to
the user.
Network operators are not affected by the callerid whitelist system in the event
that they need to speak to users who have it enabled.
</para>
<para>
Support of this umode is indicated by the CALLERID token in
@ -148,10 +147,8 @@
</note>
This umode grants various features useful for services. For example,
clients with this umode cannot be kicked or deopped on channels,
can send to any channel, do not show channels in WHOIS,
can be the target of services aliases and do not appear in /stats p.
No server notices are sent for hostname changes by services clients;
server notices about kills are sent to snomask +k instead of +s.
do not show channels the querying user is not on in WHOIS,
and do not appear in /stats p.
</para>
<para>
The exact effects of this umode are variable; no user or oper on
@ -168,8 +165,7 @@
</note>
Users with the +w umode set will receive WALLOPS messages sent by opers.
Opers with +w additionally receive WALLOPS sent by servers (e.g.
remote CONNECT, remote SQUIT, various severe misconfigurations,
many services packages).
remote CONNECT, remote SQUIT, many services packages).
</para>
</sect2>
<sect2>
@ -257,28 +253,6 @@
limit settable with /quote set max).
</para>
</sect2>
<sect2>
<title>+F, far client connection notices</title>
<para>
<note>
<para>
This snomask is only available if the <filename>sno_farconnect.so</filename> extension is loaded.
</para>
</note>
Opers with +F receive server notices when clients connect or
disconnect on other servers. The notices have the same format
as those from the +c snomask, except that the class is ? and
the source server of the notice is the server the user is/was on.
</para>
<para>
No notices are generated for netsplits and netjoins.
Hence, these notices cannot be used to keep track of all
clients on the network.
</para>
<para>
There is no far equivalent of the +C snomask.
</para>
</sect2>
<sect2>
<title>+k, server kill notices</title>
<para>
@ -317,18 +291,6 @@
available auth{} block.
</para>
</sect2>
<sect2>
<title>+W, whois notifications</title>
<para>
<note>
<para>
This snomask is only available if the <filename>sno_whois.so</filename> extension is loaded.
</para>
</note>
Opers with +W receive notices when a WHOIS is executed on them
on their server (showing idle time).
</para>
</sect2>
<sect2>
<title>+x, extra routing notices</title>
<para>
@ -344,7 +306,8 @@
<para>
Opers with +y receive notices when users try to join RESV'ed (<quote>juped</quote>) channels.
Additionally, if certain extension modules are loaded, they will
receive notices when special commands are used.
receive notices when special commands are used and/or when they
are whoised.
</para>
</sect2>
<sect2>

View File

@ -1,3 +1,4 @@
$Id: cluster.txt 6 2005-09-10 01:02:21Z nenolod $
Short description of how remote kline and friends are propagated under
the old hyb7 style (CAP_KLN etc) and under the new style over ENCAP.

View File

@ -1,68 +0,0 @@
## Elemental-ircd specific deviations from the normal TS6 protocol
As a general rule of thumb and for compatibility reasons, protocol changes are
made as infrequently and minimally as possible. However there are some things
that have been changed in how elemental handles the server to server protocol
that are worth mentioning.
For readability's sake, any lines that a server sends are prefixed by `>>>` and
any lines it expects to recieve are prefixed by `<<<`.
### Changes
#### Channel owner mode
If enabled, a new mode will be added to the channel prefix list. This mode (+y)
has a prefix of "~" and in most IRC services packages is used to signify the
owner of a specific channel. If enabled, it will show up in SJOIN lines as such:
>>> :[sid] SJOIN [channel-ts] #opers + :~[ts6-uid]
A more practical example would be:
>>> :420 SJOIN 13840003504 #opers + :~@42000000A
As the mode for this channel is `+y`, all `TMODE` changes adding or removing `+y`
from a client in a channel should set and unset this mode accordingly. An example
of adding the mode follows:
>>> :47GAAAAAB TMODE 13840003504 #opers +y 42000000A
Handling removal is similar.
Currently, the only way to detect if a remote server supports these extended
modes is to remotely query a server's `VERSION` and read out the `005` reply.
### Things added to existing commands
#### Server notice mask broadcasts
Currently the NEEDSASL, DNSBL hit, hunted command flooding and `m_post` rejections
are globally broadcast server notices. They will show up in TS6 lines such as:
<<< :[sid] ENCAP * SNOTE [snomask] :[server name] :[message]
For a more practical example:
<<< :47G ENCAP * SNOTE b :rarity.shadownet.int :Client floodbot (~a@127.0.0.1) is attempting to flood ADMIN
These broadcasts are there for IRC operators on more centrally managed networks
to better see what is going on on other ends of the network without having to hop
servers and check. Bots or pseudoservices may also uses these lines to perform
additional actions (such as `AKILL`s or logging to channels) as needed by the
bot author.
#### METADATA
The old ShadowIRCD implementation of METADATA used `ADD` and `DELETE` verbs for
adding and deleting metadata to channels and clients. This, in practice looks
something like:
<<< :45X ENCAP * METADATA ADD 1NRAAAABR OPERSTRING :is an IRC Administrator
<<< :45X ENCAP * METADATA DELETE 1NRAAAABR OPERSTRING
Functionality is identical to the new `SET` and `CLEAR` verbs, but this deviates
from the spec by being **only** a server to server command. Support for client
to server and server to client metadata setting/getting will come in a future
version of elemental-ircd.

View File

@ -1,3 +1,4 @@
$Id: euid.txt 1863 2006-08-27 13:40:37Z jilles $
Extended UID command proposal
Jilles Tjoelker <jilles@stack.nl>

View File

@ -1,6 +1,7 @@
Overview of the event subsystem
Adrian Chadd <adrian@creative.net.au>
$Id: event.txt 6 2005-09-10 01:02:21Z nenolod $
One of the things that immediately struck me whilst first looking at the

View File

@ -1,6 +1,7 @@
Overview of the filedescriptor subsystem
Adrian Chadd <adrian@creative.net.au>
$Id: fd-management.txt 6 2005-09-10 01:02:21Z nenolod $
Filedescriptor lists

View File

@ -1,5 +1,6 @@
The hostmask/netmask system.
Copyright(C) 2001 by Andrew Miller(A1kmm)<a1kmm@mware.virtualave.net>
$Id: hostmask.txt 6 2005-09-10 01:02:21Z nenolod $
Contents
========

View File

@ -16,3 +16,4 @@ rfc1459.txt - The IRC RFC
send.txt - Document on all of the send_to functions
whats-new-code.txt - Whats changed in the code
# $Id: index.txt 6 2005-09-10 01:02:21Z nenolod $

View File

@ -3,6 +3,7 @@ linebuf - a dbuf replacement for the New World Order(tm)
By Adrian Chadd <adrian@creative.net.au>
$Id: linebuf.txt 6 2005-09-10 01:02:21Z nenolod $
History

View File

@ -1,6 +1,7 @@
Overview of the network subsystem
Adrian Chadd <adrian@creative.net.au>
$Id: network.txt 6 2005-09-10 01:02:21Z nenolod $
This document is an overview of the new and hopefully improved network

View File

@ -250,3 +250,4 @@ sendto_wallops_flags()
-- Diane Bruce
Updated Jan 2006 by jilles with ratbox and late hybrid7 changes
$Id: send.txt 587 2006-01-27 19:45:11Z jilles $

151
doc/technical/ts5.txt Normal file
View File

@ -0,0 +1,151 @@
Overview of the TS5 system
Lee H <lee@leeh.co.uk>
$Id: ts5.txt 6 2005-09-10 01:02:21Z nenolod $
For the purposes of this document, ircd versions:
hybrid6.0
ircd-comstud-1.12
CSr31pl4
and prior, are TS3.
ircd-hybrid-6.2 and later support TS5.
Whats TS5?
----------
The difference between TS5 and TS3 is what happened on opless channels. TS
works by establishing which server has the oldest version of the channel,
the version that is oldest, keeps its modes and ops, the version that is
youngest, removes their modes and ops, and accepts the older version.
There was an exception to this rule with opless channels, if a channel was
opless, TS3 would allow anybody to keep their ops and modes on the channel.
TS5 aims to stop this, by removing this exception.
Example1:
An irc network, with server A (every server is ts3)
UserA is on ServerA, in channel #broken. This channel is opless, and has a
TS of 800000000. ServerA splits, and whilst it is split, UserA cycles
channel #broken, recreates the channel and is given ops. On ServerA #broken
now has a TS of 900000000 and has ops. ServerA rejoins with the network,
via HubB. HubB realises #broken is opless, so allows UserA to retain ops.
The TS is moved forward to 900000000.
The network now sees #broken as having a TS of 900000000, with UserA being
opped.
Example2:
An irc network, with server C (every server is ts5)
Same scenario as above. ServerC splits and UserC cycles channel #broken,
recreating it with a TS of 900000000. ServerC rejoins with the network via
HubD. HubD realises #broken has a TS of 800000000 locally, and ServerC is
showing a TS of 900000000, it ignores ServerC's modes and ops. The channel
remains opless. ServerC receives HubD's modes, and it notices HubD has a
lower TS of channel #broken. It removes UserC's ops, removes the channel
modes on #broken, and accepts HubD's status.
The network version of #broken hasnt changed. It is still opless, with a TS
of 800000000.
As you can see, TS5 makes splitting a server to regain ops useless, as it
cannot be abused to give ops after a netsplit.
The problem with TS5 however, is what happens on a mixed TS5/TS3 network.
Channels where the older TS has ops will behave the same way on TS5 and TS3,
however an opless channel will behave differently, as you can see above.
The result of TS5/TS3 mixed can be a desync:
Example1:
As per Example1 above, except the rest of the network is TS5, ServerA is
TS3. ServerA would keep its modes and ops, whilst the rest of the network
would remove them. This means only ServerA would see UserA as opped. The
desync can be abused, as UserA can send modes. Hybrid6.0 servers will
accept these modes from the unopped client, so if UserA ops UserB, who then
ops UserA, the channel will be the same across all Hybrid6.0 and Hybrid6.1
servers.
Example2:
As per Example2 above, except the rest of the network is TS3. ServerC is
TS5. ServerC would remove its modes and ops, therefore UserC would not be
opped on ServerC, therefore it could not send any mode changes to the
channel. Although it is opped elsewhere, it isnt opped locally, so the
desync cannot be abused.
As you can see, the desync's that can occur can either be resynced, or are
useless to the user, so a mixed TS5/TS3 network is not a huge problem,
although a desync is NOT a good thing to have.
Why TS5?
--------
We have jumped to TS5 from TS3, because there was a version of ircd that was
TS4, so it was thought better to avoid a clash with an existing version.
Advantages
----------
Its a realistic event that a server will be attacked so it splits off a
network, then used to regain ops in a channel. TS5 makes this pointless,
the server will never give ops on a netsplit. TS5 is network wide, so it
leaves individual servers free to choose options like NO_JOIN_ON_SPLIT,
whilst keeping splits useless to users.
Disadvantages
-------------
Its virtually impossible for a user to actively regain ops themselves (some
regard this as an advantage..) because on a large sized channel, its
impossible to get people to leave so it can be recreated, therefore if a
network did not have some form of services, it could possibly end up
requiring oper intervention, as you cant get everybody to leave, and you
cant use splits to regain ops, therefore if the channel is open (an
invite-only channel would gradually destroy itself as noone new can join) it
could be impossible for a user to regain ops.
On a network that has some form of services, The effect of TS5 would be
minimal, however the services must be of sufficient quality to fix opless
channels, as TS5 renders netsplits for ops worthless.
Recommendations
---------------
If your network has good stable services, we recommend TS5 is enabled, as
people have no reason to abuse netsplits anyway.
If your network has no services at all, then TS5 may cause problems with
users being left with a permanently opless channel.
If your network occupies the middle ground, then its a choice between users
needing to be able to use splits to regain ops, or making netsplits that are
caused to regain ops worthless.
If TS5 is chosen, the FULL network must upgrade and this should be done in a
relatively short space of time to minimise the possible desync effects.
Alternatives
------------
There is also NO_JOIN_ON_SPLIT and NO_OP_ON_SPLIT, however these use the
configuration of minimum servers and users, and sometimes a split that is
above these limits is enough to be abused to regain ops, whereas if the
limits are too high, clients will never be able to join anything or be opped
when they create a channel.
EOF

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
$Id: ts6.txt 3211 2007-02-20 00:34:28Z jilles $
TS6 Proposal (v8)
Written by Lee H <lee@leeh.co.uk>

View File

@ -2,44 +2,37 @@ Target Change for Messages
Lee H <lee -at- leeh.co.uk>
---------------------------
Reworked by Jilles Tjoelker, February 2010.
Channel target change added by Jilles Tjoelker, August 2010.
If the server you are using uses the target change mechanism, then
restrictions are placed on how many different users and/or channels you can
message in a set timeframe. This also applies to invites (for the target
user) and topic changes.
restrictions are placed on how many different users you can message in a set
timeframe.
Target change does not apply to ctcp replies, messages to yourself, messages
to services and joins.
Target change does not apply to channels, ctcp replies or messages to
yourself.
You will have a set number of 'slots', each different target you message
You will have a set number of 'slots', each different client you message
will take up one slot. A client doing a nick change will not use a new slot,
however a client disconnecting from the server it is on and reconnecting
will. You will receive 1 new slot roughly every minute.
Additionally, clients that message or invite you are placed in one of a
small number of special slots, in many cases allowing replies without using
a slot.
When all slots are filled, messages to new targets will not be accepted.
Messages to targets already filling a slot will be accepted. If all slots
When all slots are filled, messages to new clients will not be accepted.
Messages to clients already filling a slot will be accepted. If all slots
are full, you will receive the ERR_TARGCHANGE numeric, number 707 in the
form:
:<server> 707 <yournick> <target> :Targets changing too fast, message dropped
:<server> 707 <yournick> <targetnick> :Targets changing too fast, message dropped
The slots are operated in an LRU (least recently used), so the person or
channel you have talked to least recently will be replaced.
The slots are operated as a FIFO (first in, first out), so the first person
you message will be the first person removed from a slot, even if you are
still talking to this person.
The number of slots in use will be kept through a reconnection, though the
information in those slots will be dropped. However, you will always
receive one free slot on a reconnection. Other servers using this mechanism
will also be made aware of details about slots.
Target change does not apply if you are opped or voiced in a channel, and
you are messaging that channel or a client within that channel. The latter
can be done explicitly using the CNOTICE and CPRIVMSG commands, see
/quote help cnotice and /quote help cprivmsg, but is also implicit in a
normal /msg, /notice or /invite.
Target change can be avoided via the CNOTICE and CPRIVMSG commands, when you
are opped or voiced in a channel, and you are messaging a client within that
channel. See /quote help cnotice and /quote help cprivmsg for more
information.
--
$Id: tgchange.txt 6 2005-09-10 01:02:21Z nenolod $

113
doc/whats-new-2.0.txt Normal file
View File

@ -0,0 +1,113 @@
$Id: whats-new-2.0.txt 6 2005-09-10 01:02:21Z nenolod $
The following is a list of major changes between ircd-ratbox-1.x and
ircd-ratbox-2.0
Config File
-----------
- name="foo"; is no longer supported in connect {}; operator {}; and
class {};. You must now use connect "irc.foo.com" { ... }; etc.
- operator {}; no longer contains a class
- kline_with_connection_closed is gone, replaced with
kline_reason = "Connection closed";
- logging {}; is gone, replaced with more advanced log system - see
example.conf log {}; for more info. Note, by default only very basic
information will be logged.
- support for a specific opers initial umodes on /oper, by umodes = ...;
in operator {};
- added stats_e_disabled = yes|no; to general {};, controlling whether stats
e (which can contain server ips) is never shown to anyone
- support for compressed|encrypted|topicburst|autoconn = yes|no; is gone,
replaced with flags = compressed, encrypted, topicburst, autoconn;
- support for individual auth flags "kline_exempt = yes"; etc removed, now
must use flags = ...; method
- support for individual oper flags "kline = yes;" etc removed, now must use
flags = ...; method.
- extended flags = ...; method to allow negation, so you may prefix a flag
with '~' to negate it. Default oper flags are operwall, remoteban and
encrypted (indicates password is encrypted with mkpasswd)
- new flags in shared {};, tkline, txline and tresv, allowing temp only of
kline, xline and resv respectively.
- new flags in cluster {}; tkline, txline and tresv which will cluster
only the temp of each type. kline, xline and resv will now only
cluster the permanent ones of each type.
- cluster {}; no longer allows a server to place klines etc locally, it
simply dictates who we send to.
- shared {}; is now ordered top-down and the first one that matches the
user@host and server will be used, and the flags taken from this. This
means if a remote oper matches a shared block without kline privs, even
though there is a shared {}; block they match under it with kline privs
they will not be able to place klines.
- added invite_ops_only to channel {}; which will restrict the use of INVITE
to chanops on that channel always, rather than just to +i chans.
Client
------
- /help is now available for all users, as its now cached in memory.
removes config option use_help from general {};
- default CHANNELLEN for local clients is now 50
- AWAYLEN added to 005, default is 90
- kick/part/quit now use REASONLEN (120) rather than TOPICLEN
- umode +g now exempts users messaging themselves
Oper
----
- kline/dline <nick> is no longer supported
- oper reasons are now more fully supported
- opers can now be hidden from stats p, by flag "invisible"
- XLINEs no longer contain a type field, theyll now all just silently reject
- xlines are now 'tracked' - stats X shows how many times each xline has
rejected a client
- temp xlines and resvs
- klines set against spoofed users will now take effect when the user
connects as well, if the user is not kline_exempt
- trace spy now contains target param if its against a single user
- the old "you need xline=yes;" notices have been replaced by ERR_NOPRIVS
(numeric 723)
- umode +C, machine parsable client connect/exit notices which includes the
two unused fields sent in the USER command
Channels
--------
- persistent channels have been removed
- quiet_on_ban now uses a cache, which should speed it up
Server <-> Server Protocol
--------------------------
- support for bursting away messages on connect, controlled by
burst_away = yes|no; in general {};
- TS6, the new server <-> server protocol. As part of this you *must*
specify a "sid" in serverinfo {}; that is three alphanumeric characters,
and must start with a digit. use_ts6 = yes|no; in general controls
whether it is actually used or not. For more information, see:
http://www.ircd-ratbox.org/TS6.txt
- fakename in connect {}; is gone, you can no longer mask servers.
- support for encrypted links are gone
- global capabilities. The server will now inform the rest of the network
over ENCAP about the capabilities of other servers.
Misc
----
- support for message translation has been removed. If you want these,
modify messages.tab and distribute that.
- most of server hiding is gone, only thing that is left is flattened links
- flattened links cache is now stored in memory instead of a file
- nick delay. any client which splits will have their nick 'locked', until
a remote client uses this nick, or until it expires after the time nick_delay
in general {}. This prevents the masses of kills from clients 'regaining'
nicknames on a short split.
- support for disabling bold chars etc in channel names for local users, to
prevent faking channels. disable_fake_channels = <yes|no>; in general {};
Code cleanups
-------------
- remove mapped ipv4 in ipv6 sockets, the correct native socket will now be
used for each.
- module API has been rewritten, 1.x modules will no longer work.
- hook API has been rewritten
- proper handlers for ENCAP commands
- support for vms ast i/o
- connect {}; and operator {}; are now in their own structs, saving memory
in ConfItem
- shared/cluster now use the same struct and flags
- various other code cleanups thatd take all year to list ;)

69
doc/whats-new-2.1.txt Normal file
View File

@ -0,0 +1,69 @@
# $Id: whats-new-2.1.txt 6 2005-09-10 01:02:21Z nenolod $
The following is a list of the major changes between ircd-ratbox-2.0 and
ircd-ratbox-2.1.
Config file
-----------
- IP entries within exempt {}; can now be stacked, eg:
exempt { ip = "127.0.0.1"; ip = "192.168.0.0/24"; };
- shared {}; has been completely reworked so that it allows stacking.
shared {}; blocks for 2.0 and earlier will no longer work.
See example.conf for the new format.
- cluster {}; has been reworked to allow stacking.
cluster {}; blocks for 2.0 and earlier will no longer work.
See example.conf for the new format.
- New auth flag, jupe_exempt. When set on a client, that client will not
generate jupe warning notices when they try to join juped channels.
- You may no longer specify klines, dlines, xlines and resvs in ircd.conf.
Instead, there is no support for banconfigs with a ".perm" extension,
eg kline.conf.perm. Anything within a .perm file will be read, but
cannot be removed via the ircd. The format of these files is the same
format as their normal non-permanent counterpart. So kline.conf.perm
takes the same format as kline.conf, and so on.
- rehash and kill -HUP no longer reread the ban configs kline.conf etc.
You must now use /rehash bans, or kill -USR2
- New config option to general {};, dline_with_reason = yes|no;. Default no.
Traditionally, when a client connects and is dlined, the reason is never
shown. Enabling this will output the reason to clients.
Client
------
- Support for "deaf", umode +D. When a client is 'deaf', they will not
receive any messages sent towards channels. They will still receive joins
etc, but normal channel chat will not be sent. Any private messages
will still be sent.
- Target change anti-spam system. Restrictions are now placed upon how many
different clients (not channels) can be messaged within a specific time
period.
- Server-side notify lists. These allow a client to request a server
notifies them when a nickname comes online or goesoffline. See
doc/monitor.txt for more information.
- Client capabilities. These allow clients to negotiate capabilities with
the server. Currently supports:
- multi-prefix: A +ov client will have "@+" shown in names/who replies.
Oper
----
- RESVs are now tracked. Stats q/Q have been modified so that the first
field of the output is now a number indicating how many times the RESV
has been hit.
ratbox-services support (non-efnet)
-----------------------------------
- For those of you using ratbox-services, there is now compatibility code
within ircd, enabled by passing '--enable-services' to configure.
See doc/services.txt for more information.
Code cleanups
-------------
- Removed the custom file implementation, use the system one instead.
- The hook system has been redesigned, theres now a more thorough set of
hooks that may be used. See docs/hooks.txt
- Removed support for VMS. It hasnt worked for a long time.
- Cleanups to the expiry of temp klines/dlines.
- Various other things ;-).
- Better splitcode, it now works on how many servers have notified
us of burst finishing, rather than how many servers are linked to the
network.

View File

@ -16,14 +16,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SUID = @INSTALL_PROGRAM@ -o root -m 4755
SHELL = /bin/sh
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
pkglibdir = @pkglibdir@
moduledir = @moduledir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
AUTOMODULEDIR = $(moduledir)/extensions
AUTOMODULEDIR = @moduledir@/extensions
SSL_LIBS = @SSL_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@
@ -34,11 +27,8 @@ INCLUDES = -I. -I../include -I../libratbox/include $(SSL_INCLUDES)
CPPFLAGS = ${INCLUDES} @CPPFLAGS@
SRCS = \
chm_adminonly.c \
chm_operonly.c \
chm_operonly_compat.c \
chm_quietunreg_compat.c \
chm_sslonly.c \
chm_sslonly_compat.c \
createauthonly.c \
createoperonly.c \
@ -53,29 +43,24 @@ SRCS = \
force_user_invis.c \
hurt.c \
ip_cloaking.c \
ip_cloaking-5.c \
ip_cloaking_old.c \
sno_farconnect.c \
sno_globalkline.c \
sno_globaloper.c \
sno_whois.c \
m_42.c \
m_adminwall.c \
m_cycle.c \
m_findforwards.c \
m_force.c \
m_identify.c \
m_mkpasswd.c \
m_oaccept.c \
m_ojoin.c \
m_olist.c \
m_okick.c \
m_omode.c \
m_opme.c \
m_sendbans.c \
m_webirc.c \
no_locops.c \
no_oper_invis.c \
m_roleplay.c \
spy_admin_notice.c \
spy_info_notice.c \
spy_links_notice.c \
@ -103,7 +88,7 @@ install: all
.SUFFIXES: .so
.c.so:
${CC} ${PICFLAGS} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} $< -o $@
${CC} ${PICFLAGS} ${CPPFLAGS} ${CFLAGS} $< -o $@
.PHONY: depend clean distclean
depend:

View File

@ -11,7 +11,7 @@ Modules
createauthonly.c - Only allow authenticated (identified) users to create
channels.
ip_cloaking.c - Cloak (spoof) the host for users that have umode +x.
ip_cloaking.c - Cloak (spoof) the host for users that have umode +h.
m_42.c - The Answer to Life, the Universe, and Everything.
Syntax: 42
@ -19,9 +19,6 @@ m_42.c - The Answer to Life, the Universe, and Everything.
m_adminwall.c - Sends a message to all admins network-wide (umode +a)
Syntax: ADMINWALL :<message>
m_cycle - Server-side /CYCLE (also called /HOP in some clients/servers).
Syntax: CYCLE <#channel>
m_findforwards.c - Find channels that forward (+f) to a given channel.
Syntax: FINDFORWARDS <channel>
@ -31,12 +28,8 @@ m_identify.c - Identifies to NickServ or ChanServ
m_mkpasswd.c - MKPASSWD - generate a DES or MD5 encryption of a password
Syntax: MKPASSWD <plaintext> [MD5|DES]
m_oaccept.c - OACCEPT - Add metadata to a user that will allow you to
message them even if they are +gGR.
Syntax: OACCEPT <nick>
m_ojoin.c - OJOIN - Join a channel through any modes or limits with
an optional status (!@%+)
an optional status (@+)
Syntax: OJOIN [status]<channel>
m_olist.c - OLIST - Lists channels like LIST, but shows hidden
@ -48,21 +41,9 @@ m_opme.c - OPME - Allows an admin to op themselves in an opless channel
m_omode.c - OMODE - Allows an admin to do all sorts of evil upon a
channel, sets modes with extreme prejudice
m_okick.c - OKICK - Allows an oper to kick a user from a channel
regardless of if they have ops or not.
Syntax: OKICK <channel> <nick> :<message>
m_roleplay.c - ROLEPLAY - Allows a variety of roleplaying commands.
no_oper_invis.c - Disallow opers setting marking themselves as invisible
(+i) unless they have the hidden_oper flag.
m_force.c - Allows opers to FORCEJOIN users to any channel they
so desire, regardless of bans or restricting modes
that may be keeping them out. Similar to the SAJOIN
command in other ircds.
Syntax: FORCEJOIN <user> <channel>
example_module.c - An example module to be used for creating your own.
Syntax: TEST

View File

@ -1,51 +0,0 @@
#include "stdinc.h"
#include "modules.h"
#include "hook.h"
#include "client.h"
#include "ircd.h"
#include "send.h"
#include "s_conf.h"
#include "s_user.h"
#include "s_serv.h"
#include "numeric.h"
#include "chmode.h"
static void h_can_join(hook_data_channel *);
mapi_hfn_list_av1 adminonly_hfnlist[] = {
{ "can_join", (hookfn) h_can_join },
{ NULL, NULL }
};
static unsigned int mymode;
static int
_modinit(void)
{
mymode = cflag_add('A', chm_staff);
if (mymode == 0)
return -1;
return 0;
}
static void
_moddeinit(void)
{
cflag_orphan('A');
}
DECLARE_MODULE_AV1(chm_adminonly, _modinit, _moddeinit, NULL, NULL, adminonly_hfnlist, "$Revision$");
static void
h_can_join(hook_data_channel *data)
{
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;
if((chptr->mode.mode & mymode) && !IsAdmin(source_p)) {
sendto_one_numeric(source_p, 519, "%s :Cannot join channel (+A) - you are not an IRC server administrator", chptr->chname);
data->approved = ERR_CUSTOM;
}
}

View File

@ -1,56 +0,0 @@
#include "stdinc.h"
#include "modules.h"
#include "hook.h"
#include "client.h"
#include "ircd.h"
#include "send.h"
#include "s_conf.h"
#include "s_user.h"
#include "s_serv.h"
#include "numeric.h"
#include "chmode.h"
static void h_can_join(hook_data_channel *);
mapi_hfn_list_av1 operonly_hfnlist[] = {
{ "can_join", (hookfn) h_can_join },
{ NULL, NULL }
};
static unsigned int mymode;
/* This is a simple example of how to use dynamic channel modes.
* Not tested enough yet, use at own risk.
* -- dwr
*/
static int
_modinit(void)
{
mymode = cflag_add('O', chm_staff);
if (mymode == 0)
return -1;
return 0;
}
static void
_moddeinit(void)
{
cflag_orphan('O');
}
DECLARE_MODULE_AV1(chm_operonly, _modinit, _moddeinit, NULL, NULL, operonly_hfnlist, "$Revision$");
static void
h_can_join(hook_data_channel *data)
{
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;
if((chptr->mode.mode & mymode) && !IsOper(source_p)) {
sendto_one_numeric(source_p, 520, "%s :Cannot join channel (+O) - you are not an IRC operator", chptr->chname);
data->approved = ERR_CUSTOM;
}
}

View File

@ -12,41 +12,41 @@
static int _modinit(void);
static void _moddeinit(void);
static void chm_operonly(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
DECLARE_MODULE_AV1(chm_operonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision$");
static int
_modinit(void)
{
chmode_table['O'].set_func = chm_operonly;
chmode_table['O'].mode_type = 0;
chmode_table['O'].set_func = chm_operonly;
chmode_table['O'].mode_type = 0;
return 0;
return 0;
}
static void
_moddeinit(void)
{
chmode_table['O'].set_func = chm_nosuch;
chmode_table['O'].mode_type = 0;
chmode_table['O'].set_func = chm_nosuch;
chmode_table['O'].mode_type = 0;
}
static void
chm_operonly(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
{
int newparn = 0;
const char *newparv[] = { "$o" };
int newparn = 0;
const char *newparv[] = { "$o" };
if (MyClient(source_p)) {
chm_simple(source_p, chptr, alevel, parc, parn, parv,
errors, dir, 'i', MODE_INVITEONLY);
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'I', CHFL_INVEX);
} else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
if (MyClient(source_p)) {
chm_simple(source_p, chptr, alevel, parc, parn, parv,
errors, dir, 'i', MODE_INVITEONLY);
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'I', CHFL_INVEX);
} else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
}

View File

@ -13,39 +13,39 @@
static int _modinit(void);
static void _moddeinit(void);
static void chm_quietunreg(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
DECLARE_MODULE_AV1(chm_quietunreg_compat, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision$");
static int
_modinit(void)
{
chmode_table['R'].set_func = chm_quietunreg;
chmode_table['R'].mode_type = 0;
chmode_table['R'].set_func = chm_quietunreg;
chmode_table['R'].mode_type = 0;
return 0;
return 0;
}
static void
_moddeinit(void)
{
chmode_table['R'].set_func = chm_nosuch;
chmode_table['R'].mode_type = 0;
chmode_table['R'].set_func = chm_nosuch;
chmode_table['R'].mode_type = 0;
}
static void
chm_quietunreg(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
{
int newparn = 0;
const char *newparv[] = { "$~a" };
int newparn = 0;
const char *newparv[] = { "$~a" };
if (MyClient(source_p))
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'q', CHFL_QUIET);
else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
if (MyClient(source_p))
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'q', CHFL_QUIET);
else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
}

View File

@ -1,52 +0,0 @@
#include "stdinc.h"
#include "modules.h"
#include "hook.h"
#include "client.h"
#include "ircd.h"
#include "send.h"
#include "s_conf.h"
#include "s_user.h"
#include "s_serv.h"
#include "numeric.h"
#include "chmode.h"
static void h_can_join(hook_data_channel *);
mapi_hfn_list_av1 sslonly_hfnlist[] = {
{ "can_join", (hookfn) h_can_join },
{ NULL, NULL }
};
static unsigned int mymode;
static int
_modinit(void)
{
mymode = cflag_add('S', chm_simple);
if (mymode == 0)
return -1;
return 0;
}
static void
_moddeinit(void)
{
cflag_orphan('S');
}
DECLARE_MODULE_AV1(chm_sslonly, _modinit, _moddeinit, NULL, NULL, sslonly_hfnlist, "$Revision$");
static void
h_can_join(hook_data_channel *data)
{
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;
if((chptr->mode.mode & mymode) && !IsSSLClient(source_p)) {
sendto_one_notice(source_p, ":Only users using SSL can join this channel!");
data->approved = ERR_CUSTOM;
}
}

View File

@ -12,39 +12,39 @@
static int _modinit(void);
static void _moddeinit(void);
static void chm_sslonly(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
DECLARE_MODULE_AV1(chm_sslonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision$");
static int
_modinit(void)
{
chmode_table['S'].set_func = chm_sslonly;
chmode_table['S'].mode_type = 0;
chmode_table['S'].set_func = chm_sslonly;
chmode_table['S'].mode_type = 0;
return 0;
return 0;
}
static void
_moddeinit(void)
{
chmode_table['S'].set_func = chm_nosuch;
chmode_table['S'].mode_type = 0;
chmode_table['S'].set_func = chm_nosuch;
chmode_table['S'].mode_type = 0;
}
static void
chm_sslonly(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
{
int newparn = 0;
const char *newparv[] = { "$~z" };
int newparn = 0;
const char *newparv[] = { "$~z" };
if (MyClient(source_p))
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'b', CHFL_BAN);
else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
if (MyClient(source_p))
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'b', CHFL_BAN);
else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
}

View File

@ -5,6 +5,7 @@
* problems. It will return ERR_NEEDREGGEDNICK on failure.
* -- nenolod
*
* $Id: createauthonly.c 833 2006-02-15 00:27:59Z jilles $
*/
#include "stdinc.h"
@ -20,8 +21,8 @@
static void h_can_create_channel_authenticated(hook_data_client_approval *);
mapi_hfn_list_av1 restrict_hfnlist[] = {
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
{ NULL, NULL }
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(createauthonly, NULL, NULL, NULL, NULL, restrict_hfnlist, "$Revision: 833 $");
@ -29,8 +30,8 @@ DECLARE_MODULE_AV1(createauthonly, NULL, NULL, NULL, NULL, restrict_hfnlist, "$R
static void
h_can_create_channel_authenticated(hook_data_client_approval *data)
{
struct Client *source_p = data->client;
struct Client *source_p = data->client;
if (*source_p->user->suser == '\0' && !IsOper(source_p))
data->approved = ERR_NEEDREGGEDNICK;
if (*source_p->user->suser == '\0' && !IsOper(source_p))
data->approved = ERR_NEEDREGGEDNICK;
}

View File

@ -5,6 +5,7 @@
* return ERR_NEEDREGGEDNICK on failure.
* -- nenolod
*
* $Id: createoperonly.c 3476 2007-05-24 04:28:36Z nenolod $
*/
#include "stdinc.h"
@ -20,8 +21,8 @@
static void h_can_create_channel_authenticated(hook_data_client_approval *);
mapi_hfn_list_av1 restrict_hfnlist[] = {
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
{ NULL, NULL }
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(createoperonly, NULL, NULL, NULL, NULL, restrict_hfnlist, "$Revision: 3476 $");
@ -29,10 +30,11 @@ DECLARE_MODULE_AV1(createoperonly, NULL, NULL, NULL, NULL, restrict_hfnlist, "$R
static void
h_can_create_channel_authenticated(hook_data_client_approval *data)
{
struct Client *source_p = data->client;
struct Client *source_p = data->client;
if (!IsOper(source_p)) {
sendto_one_notice(source_p, ":*** Channel creation is restricted to network staff only.");
data->approved = ERR_NEEDREGGEDNICK;
}
if (!IsOper(source_p))
{
sendto_one_notice(source_p, ":*** Channel creation is restricted to network staff only.");
data->approved = ERR_NEEDREGGEDNICK;
}
}

View File

@ -16,6 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: example_module.c 3161 2007-01-25 07:23:01Z nenolod $
*/
/* List of ircd includes from ../include/ */
@ -47,25 +48,25 @@ static int moper_test(struct Client *client_p, struct Client *source_p, int parc
*/
struct Message test_msgtab = {
"TEST", /* the /COMMAND you want */
0, /* SET TO ZERO -- number of times command used by clients */
0, /* SET TO ZERO -- number of times command used by clients */
0, /* SET TO ZERO -- number of times command used by clients */
MFLG_SLOW, /* ALWAYS SET TO MFLG_SLOW */
"TEST", /* the /COMMAND you want */
0, /* SET TO ZERO -- number of times command used by clients */
0, /* SET TO ZERO -- number of times command used by clients */
0, /* SET TO ZERO -- number of times command used by clients */
MFLG_SLOW, /* ALWAYS SET TO MFLG_SLOW */
/* the functions to call for each handler. If not using the generic
* handlers, the first param is the function to call, the second is the
* required number of parameters. NOTE: If you specify a min para of 2,
* then parv[1] must *also* be non-empty.
*/
{
{munreg_test, 0}, /* function call for unregistered clients, 0 parms required */
{mclient_test, 0}, /* function call for local clients, 0 parms required */
{mrclient_test, 0}, /* function call for remote clients, 0 parms required */
{mserver_test, 0}, /* function call for servers, 0 parms required */
mg_ignore, /* function call for ENCAP, unused in this test */
{moper_test, 0} /* function call for operators, 0 parms required */
}
/* the functions to call for each handler. If not using the generic
* handlers, the first param is the function to call, the second is the
* required number of parameters. NOTE: If you specify a min para of 2,
* then parv[1] must *also* be non-empty.
*/
{
{munreg_test, 0}, /* function call for unregistered clients, 0 parms required */
{mclient_test, 0}, /* function call for local clients, 0 parms required */
{mrclient_test, 0}, /* function call for remote clients, 0 parms required */
{mserver_test, 0}, /* function call for servers, 0 parms required */
mg_ignore, /* function call for ENCAP, unused in this test */
{moper_test, 0} /* function call for operators, 0 parms required */
}
};
/*
* There are also some macros for the above function calls and parameter counts.
@ -93,9 +94,9 @@ mapi_clist_av1 test_clist[] = { &test_msgtab, NULL };
* terminated with NULLs.
*/
int doing_example_hook;
mapi_hlist_av1 test_hlist[] = {
{ "doing_example_hook", &doing_example_hook, },
{ NULL, NULL }
mapi_hlist_av1 test_hlist[] = {
{ "doing_example_hook", &doing_example_hook, },
{ NULL, NULL }
};
/* The mapi_hfn_list_av1 declares the hook functions which other modules can
@ -106,50 +107,51 @@ mapi_hlist_av1 test_hlist[] = {
static void show_example_hook(void *unused);
mapi_hfn_list_av1 test_hfnlist[] = {
{ "doing_example_hook", (hookfn) show_example_hook },
{ NULL, NULL }
{ "doing_example_hook", (hookfn) show_example_hook },
{ NULL, NULL }
};
/* Here we tell it what to do when the module is loaded */
static int
modinit(void)
{
/* Nothing to do for the example module. */
/* The init function should return -1 on failure,
which will cause the module to be unloaded,
otherwise 0 to indicate success. */
return 0;
/* Nothing to do for the example module. */
/* The init function should return -1 on failure,
which will cause the module to be unloaded,
otherwise 0 to indicate success. */
return 0;
}
/* here we tell it what to do when the module is unloaded */
static void
moddeinit(void)
{
/* Again, nothing to do. */
/* Again, nothing to do. */
}
/* DECLARE_MODULE_AV1() actually declare the MAPI header. */
DECLARE_MODULE_AV1(
/* The first argument is the name */
example,
/* The second argument is the function to call on load */
modinit,
/* And the function to call on unload */
moddeinit,
/* Then the MAPI command list */
test_clist,
/* Next the hook list, if we have one. */
test_hlist,
/* Then the hook function list, if we have one */
test_hfnlist,
/* And finally the version number of this module. */
"$Revision: 3161 $");
/* The first argument is the name */
example,
/* The second argument is the function to call on load */
modinit,
/* And the function to call on unload */
moddeinit,
/* Then the MAPI command list */
test_clist,
/* Next the hook list, if we have one. */
test_hlist,
/* Then the hook function list, if we have one */
test_hfnlist,
/* And finally the version number of this module. */
"$Revision: 3161 $");
/* Any of the above arguments can be NULL to indicate they aren't used. */
/*
* mr_test
* parv[0] = sender prefix
* parv[1] = parameter
*/
@ -159,86 +161,105 @@ DECLARE_MODULE_AV1(
static int
munreg_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2) {
sendto_one_notice(source_p, ":You are unregistered and sent no parameters");
} else {
sendto_one_notice(source_p, ":You are unregistered and sent parameter: %s", parv[1]);
}
if(parc < 2)
{
sendto_one_notice(source_p, ":You are unregistered and sent no parameters");
}
else
{
sendto_one_notice(source_p, ":You are unregistered and sent parameter: %s", parv[1]);
}
/* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL);
/* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL);
return 0;
return 0;
}
/*
* mclient_test
* parv[0] = sender prefix
* parv[1] = parameter
*/
static int
mclient_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2) {
sendto_one_notice(source_p, ":You are a normal user, and sent no parameters");
} else {
sendto_one_notice(source_p, ":You are a normal user, and send parameters: %s", parv[1]);
}
if(parc < 2)
{
sendto_one_notice(source_p, ":You are a normal user, and sent no parameters");
}
else
{
sendto_one_notice(source_p, ":You are a normal user, and send parameters: %s", parv[1]);
}
/* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL);
/* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL);
return 0;
return 0;
}
/*
* mrclient_test
* parv[0] = sender prefix
* parv[1] = parameter
*/
static int
mrclient_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2) {
sendto_one_notice(source_p, ":You are a remote client, and sent no parameters");
} else {
sendto_one_notice(source_p, ":You are a remote client, and sent parameters: %s", parv[1]);
}
return 0;
if(parc < 2)
{
sendto_one_notice(source_p, ":You are a remote client, and sent no parameters");
}
else
{
sendto_one_notice(source_p, ":You are a remote client, and sent parameters: %s", parv[1]);
}
return 0;
}
/*
* mserver_test
* parv[0] = sender prefix
* parv[1] = parameter
*/
static int
mserver_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2) {
sendto_one_notice(source_p, ":You are a server, and sent no parameters");
} else {
sendto_one_notice(source_p, ":You are a server, and sent parameters: %s", parv[1]);
}
return 0;
if(parc < 2)
{
sendto_one_notice(source_p, ":You are a server, and sent no parameters");
}
else
{
sendto_one_notice(source_p, ":You are a server, and sent parameters: %s", parv[1]);
}
return 0;
}
/*
* moper_test
* parv[0] = sender prefix
* parv[1] = parameter
*/
static int
moper_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2) {
sendto_one_notice(source_p, ":You are an operator, and sent no parameters");
} else {
sendto_one_notice(source_p, ":You are an operator, and sent parameters: %s", parv[1]);
}
return 0;
if(parc < 2)
{
sendto_one_notice(source_p, ":You are an operator, and sent no parameters");
}
else
{
sendto_one_notice(source_p, ":You are an operator, and sent parameters: %s", parv[1]);
}
return 0;
}
static void
show_example_hook(void *unused)
{
sendto_realops_snomask(SNO_GENERAL, L_ALL, "Called example hook!");
sendto_realops_snomask(SNO_GENERAL, L_ALL, "Called example hook!");
}
/* END OF EXAMPLE MODULE */

View File

@ -2,6 +2,7 @@
* Account extban type: bans all users with any/matching account
* -- jilles
*
* $Id: extb_account.c 1299 2006-05-11 15:43:03Z jilles $
*/
#include "stdinc.h"
@ -18,25 +19,25 @@ DECLARE_MODULE_AV1(extb_account, _modinit, _moddeinit, NULL, NULL, NULL, "$Revis
static int
_modinit(void)
{
extban_table['a'] = eb_account;
extban_table['a'] = eb_account;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['a'] = NULL;
extban_table['a'] = NULL;
}
static int eb_account(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
(void)chptr;
/* $a alone matches any logged in user */
if (data == NULL)
return EmptyString(client_p->user->suser) ? EXTBAN_NOMATCH : EXTBAN_MATCH;
/* $a:MASK matches users logged in under matching account */
return match(data, client_p->user->suser) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
/* $a alone matches any logged in user */
if (data == NULL)
return EmptyString(client_p->user->suser) ? EXTBAN_NOMATCH : EXTBAN_MATCH;
/* $a:MASK matches users logged in under matching account */
return match(data, client_p->user->suser) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -3,6 +3,7 @@
* specified channel.
* -- nenolod/jilles
*
* $Id: extb_canjoin.c 1841 2006-08-22 17:30:03Z jilles $
*/
#include "stdinc.h"
@ -21,46 +22,46 @@ DECLARE_MODULE_AV1(extb_canjoin, _modinit, _moddeinit, NULL, NULL, NULL, "$Revis
static int
_modinit(void)
{
extban_table['j'] = eb_canjoin;
extban_table['j'] = eb_canjoin;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['j'] = NULL;
extban_table['j'] = NULL;
}
static int eb_canjoin(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
struct Channel *chptr2;
int ret;
static int recurse = 0;
struct Channel *chptr2;
int ret;
static int recurse = 0;
(void)mode_type;
/* don't process a $j in a $j'ed list */
if (recurse)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
chptr2 = find_channel(data);
/* must exist, and no point doing this with the same channel */
if (chptr2 == NULL || chptr2 == chptr)
return EXTBAN_INVALID;
/* require consistent target */
if (chptr->chname[0] == '#' && data[0] == '&')
return EXTBAN_INVALID;
/* this allows getting some information about ban exceptions
* but +s/+p doesn't seem the right criterion */
(void)mode_type;
/* don't process a $j in a $j'ed list */
if (recurse)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
chptr2 = find_channel(data);
/* must exist, and no point doing this with the same channel */
if (chptr2 == NULL || chptr2 == chptr)
return EXTBAN_INVALID;
/* require consistent target */
if (chptr->chname[0] == '#' && data[0] == '&')
return EXTBAN_INVALID;
/* this allows getting some information about ban exceptions
* but +s/+p doesn't seem the right criterion */
#if 0
/* privacy! don't allow +s/+p channels to influence another channel */
if (!PubChannel(chptr2))
return EXTBAN_INVALID;
/* privacy! don't allow +s/+p channels to influence another channel */
if (!PubChannel(chptr2))
return EXTBAN_INVALID;
#endif
recurse = 1;
ret = is_banned(chptr2, client_p, NULL, NULL, NULL) == CHFL_BAN ? EXTBAN_MATCH : EXTBAN_NOMATCH;
recurse = 0;
return ret;
recurse = 1;
ret = is_banned(chptr2, client_p, NULL, NULL, NULL) == CHFL_BAN ? EXTBAN_MATCH : EXTBAN_NOMATCH;
recurse = 0;
return ret;
}

View File

@ -2,6 +2,7 @@
* Channel extban type: matches users who are in a certain public channel
* -- jilles
*
* $Id: extb_channel.c 1723 2006-07-06 15:23:58Z jilles $
*/
#include "stdinc.h"
@ -20,34 +21,34 @@ DECLARE_MODULE_AV1(extb_channel, _modinit, _moddeinit, NULL, NULL, NULL, "$Revis
static int
_modinit(void)
{
extban_table['c'] = eb_channel;
extban_table['c'] = eb_channel;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['c'] = NULL;
extban_table['c'] = NULL;
}
static int eb_channel(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
struct Channel *chptr2;
struct Channel *chptr2;
(void)chptr;
(void)mode_type;
if (data == NULL)
return EXTBAN_INVALID;
chptr2 = find_channel(data);
if (chptr2 == NULL)
return EXTBAN_INVALID;
/* require consistent target */
if (chptr->chname[0] == '#' && data[0] == '&')
return EXTBAN_INVALID;
/* privacy! don't allow +s/+p channels to influence another channel */
if (!PubChannel(chptr2))
return EXTBAN_INVALID;
return IsMember(client_p, chptr2) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
(void)mode_type;
if (data == NULL)
return EXTBAN_INVALID;
chptr2 = find_channel(data);
if (chptr2 == NULL)
return EXTBAN_INVALID;
/* require consistent target */
if (chptr->chname[0] == '#' && data[0] == '&')
return EXTBAN_INVALID;
/* privacy! don't allow +s/+p channels to influence another channel */
if (!PubChannel(chptr2))
return EXTBAN_INVALID;
return IsMember(client_p, chptr2) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -3,6 +3,7 @@
* Requested by Lockwood.
* - nenolod
*
* $Id: extb_realname.c 1339 2006-05-17 00:45:40Z nenolod $
*/
#include "stdinc.h"
@ -19,39 +20,40 @@ DECLARE_MODULE_AV1(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, "$Revi
static int
_modinit(void)
{
extban_table['x'] = eb_extended;
extban_table['x'] = eb_extended;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['x'] = NULL;
extban_table['x'] = NULL;
}
static int eb_extended(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
char buf[BUFSIZE];
int ret;
char buf[BUFSIZE];
int ret;
(void)chptr;
(void)chptr;
if (data == NULL)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->host, client_p->info);
rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->host, client_p->info);
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p)) {
snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->orighost, client_p->info);
if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p))
{
rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->orighost, client_p->info);
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}
return ret;
return ret;
}

View File

@ -2,6 +2,7 @@
* Oper extban type: matches opers
* -- jilles
*
* $Id: extb_oper.c 1299 2006-05-11 15:43:03Z jilles $
*/
#include "stdinc.h"
@ -18,26 +19,26 @@ DECLARE_MODULE_AV1(extb_oper, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision
static int
_modinit(void)
{
extban_table['o'] = eb_oper;
extban_table['o'] = eb_oper;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['o'] = NULL;
extban_table['o'] = NULL;
}
static int eb_oper(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
(void)chptr;
(void)mode_type;
/* perhaps use data somehow? (opernick/flags?) */
/* so deny any bans with data for now */
if (data != NULL)
return EXTBAN_INVALID;
return IsOper(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
(void)mode_type;
/* perhaps use data somehow? (opernick/flags?) */
/* so deny any bans with data for now */
if (data != NULL)
return EXTBAN_INVALID;
return IsOper(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -2,6 +2,7 @@
* Realname extban type: bans all users with matching gecos
* -- jilles
*
* $Id: extb_realname.c 1299 2006-05-11 15:43:03Z jilles $
*/
#include "stdinc.h"
@ -18,26 +19,26 @@ DECLARE_MODULE_AV1(extb_realname, _modinit, _moddeinit, NULL, NULL, NULL, "$Revi
static int
_modinit(void)
{
extban_table['r'] = eb_realname;
extban_table['r'] = eb_realname;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['r'] = NULL;
extban_table['r'] = NULL;
}
static int eb_realname(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
(void)chptr;
/* This type is not safe for exceptions */
if (mode_type == CHFL_EXCEPTION || mode_type == CHFL_INVEX)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
return match(data, client_p->info) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
/* This type is not safe for exceptions */
if (mode_type == CHFL_EXCEPTION || mode_type == CHFL_INVEX)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
return match(data, client_p->info) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -2,6 +2,7 @@
* Server name extban type: bans all users using a certain server
* -- jilles
*
* $Id: extb_server.c 1299 2006-05-11 15:43:03Z jilles $
*/
#include "stdinc.h"
@ -18,26 +19,26 @@ DECLARE_MODULE_AV1(extb_server, _modinit, _moddeinit, NULL, NULL, NULL, "$Revisi
static int
_modinit(void)
{
extban_table['s'] = eb_server;
extban_table['s'] = eb_server;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['s'] = NULL;
extban_table['s'] = NULL;
}
static int eb_server(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
(void)chptr;
/* This type is not safe for exceptions */
if (mode_type == CHFL_EXCEPTION || mode_type == CHFL_INVEX)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
return match(data, me.name) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
/* This type is not safe for exceptions */
if (mode_type == CHFL_EXCEPTION || mode_type == CHFL_INVEX)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
return match(data, me.name) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -14,24 +14,24 @@ DECLARE_MODULE_AV1(extb_ssl, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision$
static int
_modinit(void)
{
extban_table['z'] = eb_ssl;
extban_table['z'] = eb_ssl;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['z'] = NULL;
extban_table['z'] = NULL;
}
static int eb_ssl(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
(void)chptr;
(void)mode_type;
if (data != NULL)
return EXTBAN_INVALID;
return IsSSLClient(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
(void)mode_type;
if (data != NULL)
return EXTBAN_INVALID;
return IsSSLClient(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -18,8 +18,8 @@
static void h_noi_umode_changed(hook_data_umode_changed *);
mapi_hfn_list_av1 noi_hfnlist[] = {
{ "umode_changed", (hookfn) h_noi_umode_changed },
{ NULL, NULL }
{ "umode_changed", (hookfn) h_noi_umode_changed },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(force_user_invis, NULL, NULL, NULL, NULL, noi_hfnlist, "1.0.0");
@ -27,9 +27,9 @@ DECLARE_MODULE_AV1(force_user_invis, NULL, NULL, NULL, NULL, noi_hfnlist, "1.0.0
static void
h_noi_umode_changed(hook_data_umode_changed *hdata)
{
struct Client *source_p = hdata->client;
struct Client *source_p = hdata->client;
if (MyClient(source_p) && !IsOper(source_p) && !IsInvisible(source_p)) {
SetInvisible(source_p);
}
if (MyClient(source_p) && !IsOper(source_p) && !IsInvisible(source_p)) {
SetInvisible(source_p);
}
}

View File

@ -4,6 +4,7 @@
* Copyright (C) 2006 charybdis development team
* All rights reserved
*
* $Id: hurt.c 3161 2007-01-25 07:23:01Z nenolod $
*/
#include "stdinc.h"
#include "modules.h"
@ -23,25 +24,25 @@
#define HURT_EXIT_REASON "Hurt: Failed to identify to services"
enum {
HEAL_NICK = 0,
HEAL_IP
HEAL_NICK = 0,
HEAL_IP
};
typedef struct _hurt_state {
time_t start_time;
uint32_t n_hurts;
rb_dlink_list hurt_clients;
uint16_t cutoff;
time_t default_expire;
const char *exit_reason;
time_t start_time;
uint32_t n_hurts;
rb_dlink_list hurt_clients;
uint16_t cutoff;
time_t default_expire;
const char *exit_reason;
} hurt_state_t;
typedef struct _hurt {
char *ip;
struct sockaddr *saddr;
int saddr_bits;
char *reason;
time_t expire;
char *ip;
struct sockaddr *saddr;
int saddr_bits;
char *reason;
time_t expire;
} hurt_t;
/* }}} */
@ -82,45 +83,45 @@ rb_dlink_list hurt_confs = { NULL, NULL, 0 };
/* {{{ Messages */
struct Message hurt_msgtab = {
"HURT", 0, 0, 0, MFLG_SLOW, {
mg_ignore, mg_ignore, mg_ignore,
mg_ignore, {me_hurt, 0}, {mo_hurt, 3}
}
"HURT", 0, 0, 0, MFLG_SLOW, {
mg_ignore, mg_ignore, mg_ignore,
mg_ignore, {me_hurt, 0}, {mo_hurt, 3}
}
};
struct Message heal_msgtab = {
"HEAL", 0, 0, 0, MFLG_SLOW, {
mg_ignore, mg_ignore, mg_ignore,
mg_ignore, {me_heal, 0}, {mo_heal, 2}
}
"HEAL", 0, 0, 0, MFLG_SLOW, {
mg_ignore, mg_ignore, mg_ignore,
mg_ignore, {me_heal, 0}, {mo_heal, 2}
}
};
/* }}} */
/* {{{ Misc module stuff */
mapi_hfn_list_av1 hurt_hfnlist[] = {
{"client_exit", (hookfn) client_exit_hook},
{"new_local_user", (hookfn) new_local_user_hook},
{"doing_stats", (hookfn) doing_stats_hook},
{NULL, NULL},
{"client_exit", (hookfn) client_exit_hook},
{"new_local_user", (hookfn) new_local_user_hook},
{"doing_stats", (hookfn) doing_stats_hook},
{NULL, NULL},
};
mapi_clist_av1 hurt_clist[] = { &hurt_msgtab, &heal_msgtab, NULL };
DECLARE_MODULE_AV1(
hurt,
modinit,
modfini,
hurt_clist,
NULL,
hurt_hfnlist,
"$Revision: 3161 $"
hurt,
modinit,
modfini,
hurt_clist,
NULL,
hurt_hfnlist,
"$Revision: 3161 $"
);
/* }}} */
hurt_state_t hurt_state = {
.cutoff = HURT_CUTOFF,
.default_expire = HURT_DEFAULT_EXPIRE,
.exit_reason = HURT_EXIT_REASON,
.cutoff = HURT_CUTOFF,
.default_expire = HURT_DEFAULT_EXPIRE,
.exit_reason = HURT_EXIT_REASON,
};
/*
@ -135,14 +136,14 @@ struct ev_entry *hurt_check_ev = NULL;
static int
modinit(void)
{
/* set-up hurt_state. */
hurt_state.start_time = rb_current_time();
/* set-up hurt_state. */
hurt_state.start_time = rb_current_time();
/* add our event handlers. */
hurt_expire_ev = rb_event_add("hurt_expire", hurt_expire_event, NULL, 60);
hurt_check_ev = rb_event_add("hurt_check", hurt_check_event, NULL, 5);
/* add our event handlers. */
hurt_expire_ev = rb_event_add("hurt_expire", hurt_expire_event, NULL, 60);
hurt_check_ev = rb_event_add("hurt_check", hurt_check_event, NULL, 5);
return 0;
return 0;
}
/* }}} */
@ -150,15 +151,16 @@ modinit(void)
static void
modfini(void)
{
rb_dlink_node *ptr, *next_ptr;
rb_dlink_node *ptr, *next_ptr;
/* and delete our events. */
rb_event_delete(hurt_expire_ev);
rb_event_delete(hurt_check_ev);
/* and delete our events. */
rb_event_delete(hurt_expire_ev);
rb_event_delete(hurt_check_ev);
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head) {
rb_dlinkDestroy(ptr, &hurt_state.hurt_clients);
}
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head)
{
rb_dlinkDestroy(ptr, &hurt_state.hurt_clients);
}
}
/* }}} */
@ -169,79 +171,84 @@ modfini(void)
/* {{{ static int mo_hurt()
*
* HURT [<expire>] <ip> <reason>
*
*
* parv[1] - expire or ip
* parv[2] - ip or reason
* parv[3] - reason or NULL
*/
static int
mo_hurt(struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
int parc, const char **parv)
{
const char *ip, *expire, *reason;
int expire_time;
hurt_t *hurt;
struct Client *target_p;
const char *ip, *expire, *reason;
int expire_time;
hurt_t *hurt;
struct Client *target_p;
if (!IsOperK(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
source_p->name, "kline");
return 0;
}
if (!IsOperK(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
source_p->name, "kline");
return 0;
}
if (parc == 3)
expire = NULL, ip = parv[1], reason = parv[2];
else
expire = parv[1], ip = parv[2], reason = parv[3];
if (parc == 3)
expire = NULL, ip = parv[1], reason = parv[2];
else
expire = parv[1], ip = parv[2], reason = parv[3];
if (!expire)
expire_time = HURT_DEFAULT_EXPIRE;
if (expire && (expire_time = valid_temp_time(expire)) < 1) {
sendto_one_notice(source_p, ":Permanent HURTs are not supported");
return 0;
}
if (EmptyString(reason)) {
sendto_one_notice(source_p, ":Empty HURT reasons are bad for business");
return 0;
}
if (!expire)
expire_time = HURT_DEFAULT_EXPIRE;
if (expire && (expire_time = valid_temp_time(expire)) < 1) {
sendto_one_notice(source_p, ":Permanent HURTs are not supported");
return 0;
}
if (EmptyString(reason)) {
sendto_one_notice(source_p, ":Empty HURT reasons are bad for business");
return 0;
}
/* Is this a client? */
if (strchr(ip, '.') == NULL && strchr(ip, ':') == NULL) {
target_p = find_named_person(ip);
if (target_p == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), ip);
return 0;
}
ip = target_p->orighost;
} else {
if (!strncmp(ip, "*@", 2))
ip += 2;
if (strchr(ip, '!') || strchr(ip, '@')) {
sendto_one_notice(source_p, ":Invalid HURT mask [%s]",
ip);
return 0;
}
}
/* Is this a client? */
if (strchr(ip, '.') == NULL && strchr(ip, ':') == NULL)
{
target_p = find_named_person(ip);
if (target_p == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), ip);
return 0;
}
ip = target_p->orighost;
}
else
{
if (!strncmp(ip, "*@", 2))
ip += 2;
if (strchr(ip, '!') || strchr(ip, '@'))
{
sendto_one_notice(source_p, ":Invalid HURT mask [%s]",
ip);
return 0;
}
}
if (hurt_find(ip) != NULL) {
sendto_one(source_p, ":[%s] already HURT", ip);
return 0;
}
if (hurt_find(ip) != NULL) {
sendto_one(source_p, ":[%s] already HURT", ip);
return 0;
}
/*
* okay, we've got this far, now it's time to add the the HURT locally
* and propagate it to other servers on the network.
*/
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added HURT on [%s] for %ld minutes with reason [%s]",
get_oper_name(source_p), ip, (long) expire_time / 60, reason);
/*
* okay, we've got this far, now it's time to add the the HURT locally
* and propagate it to other servers on the network.
*/
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added HURT on [%s] for %ld minutes with reason [%s]",
get_oper_name(source_p), ip, (long) expire_time / 60, reason);
hurt = hurt_new(expire_time, ip, reason);
hurt_add(hurt);
hurt_propagate(NULL, source_p, hurt);
hurt = hurt_new(expire_time, ip, reason);
hurt_add(hurt);
hurt_propagate(NULL, source_p, hurt);
return 0;
return 0;
}
/* }}} */
@ -255,32 +262,32 @@ mo_hurt(struct Client *client_p, struct Client *source_p,
*/
static int
me_hurt(struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
int parc, const char **parv)
{
time_t expire_time;
hurt_t *hurt;
time_t expire_time;
hurt_t *hurt;
/*
* right... if we don't get enough arguments, or if we get any invalid
* arguments, just ignore this request - shit happens, and it's not worth
* dropping a server over.
*/
if (parc < 4 || !IsPerson(source_p))
return 0;
if ((expire_time = atoi(parv[1])) < 1)
return 0;
if (hurt_find(parv[2]) != NULL)
return 0;
if (EmptyString(parv[3]))
return 0;
/*
* right... if we don't get enough arguments, or if we get any invalid
* arguments, just ignore this request - shit happens, and it's not worth
* dropping a server over.
*/
if (parc < 4 || !IsPerson(source_p))
return 0;
if ((expire_time = atoi(parv[1])) < 1)
return 0;
if (hurt_find(parv[2]) != NULL)
return 0;
if (EmptyString(parv[3]))
return 0;
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added HURT on [%s] for %ld minutes with reason [%s]",
get_oper_name(source_p), parv[2], (long) expire_time / 60, parv[3]);
hurt = hurt_new(expire_time, parv[2], parv[3]);
hurt_add(hurt);
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added HURT on [%s] for %ld minutes with reason [%s]",
get_oper_name(source_p), parv[2], (long) expire_time / 60, parv[3]);
hurt = hurt_new(expire_time, parv[2], parv[3]);
hurt_add(hurt);
return 0;
return 0;
}
/* }}} */
@ -292,76 +299,88 @@ me_hurt(struct Client *client_p, struct Client *source_p,
*/
static int
mo_heal(struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
int parc, const char **parv)
{
struct Client *target_p;
struct Client *target_p;
if (!IsOperUnkline(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "unkline");
return 0;
}
if (!IsOperUnkline(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "unkline");
return 0;
}
if (nick_is_valid(parv[1])) {
target_p = find_named_person(parv[1]);
if (target_p == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
}
if (MyConnect(target_p))
heal_nick(source_p, target_p);
else
sendto_one(target_p, ":%s ENCAP %s HEAL %s",
get_id(source_p, target_p),
target_p->servptr->name,
get_id(target_p, target_p));
} else if (strchr(parv[1], '.')) {
if (hurt_find_exact(parv[1]) == NULL) {
sendto_one_notice(source_p, ":Mask [%s] is not HURT", parv[1]);
return 0;
}
hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
get_oper_name(source_p), parv[1]);
sendto_server(NULL, NULL, NOCAPS, NOCAPS, ":%s ENCAP * HEAL %s",
source_p->name, parv[1]);
} else {
sendto_one(source_p, ":[%s] is not a valid IP address/nick", parv[1]);
return 0;
}
if (nick_is_valid(parv[1]))
{
target_p = find_named_person(parv[1]);
if (target_p == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
}
if (MyConnect(target_p))
heal_nick(source_p, target_p);
else
sendto_one(target_p, ":%s ENCAP %s HEAL %s",
get_id(source_p, target_p),
target_p->servptr->name,
get_id(target_p, target_p));
}
else if (strchr(parv[1], '.'))
{
if (hurt_find_exact(parv[1]) == NULL)
{
sendto_one_notice(source_p, ":Mask [%s] is not HURT", parv[1]);
return 0;
}
hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
get_oper_name(source_p), parv[1]);
sendto_server(NULL, NULL, NOCAPS, NOCAPS, ":%s ENCAP * HEAL %s",
source_p->name, parv[1]);
}
else
{
sendto_one(source_p, ":[%s] is not a valid IP address/nick", parv[1]);
return 0;
}
return 0;
return 0;
}
/* }}} */
static int
me_heal(struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
int parc, const char **parv)
{
struct Client *target_p;
struct Client *target_p;
/* as noted in me_hurt(), if we don't get sufficient arguments...
* *poof*, it's dropped...
*/
if (parc < 2)
return 0;
/* as noted in me_hurt(), if we don't get sufficient arguments...
* *poof*, it's dropped...
*/
if (parc < 2)
return 0;
if (nick_is_valid(parv[1])) {
target_p = find_person(parv[1]);
if (target_p != NULL && MyConnect(target_p))
heal_nick(source_p, target_p);
} else if (strchr(parv[1], '.')) { /* host or mask to remove ban for */
if (hurt_find_exact(parv[1]) == NULL)
return 0;
if (nick_is_valid(parv[1]))
{
target_p = find_person(parv[1]);
if (target_p != NULL && MyConnect(target_p))
heal_nick(source_p, target_p);
}
else if (strchr(parv[1], '.')) /* host or mask to remove ban for */
{
if (hurt_find_exact(parv[1]) == NULL)
return 0;
hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
get_oper_name(source_p), parv[1]);
} else
return 0;
hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
get_oper_name(source_p), parv[1]);
}
else
return 0;
return 0;
return 0;
}
/*
@ -372,18 +391,21 @@ me_heal(struct Client *client_p, struct Client *source_p,
static void
hurt_check_event(void *arg)
{
rb_dlink_node *ptr, *next_ptr;
struct Client *client_p;
rb_dlink_node *ptr, *next_ptr;
struct Client *client_p;
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head) {
client_p = ptr->data;
if (!EmptyString(client_p->user->suser)) {
rb_dlinkDestroy(ptr, &hurt_state.hurt_clients);
sendto_one_notice(client_p, ":HURT restriction removed for this session");
client_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
} else if (client_p->localClient->receiveM > hurt_state.cutoff)
exit_client(NULL, client_p, &me, hurt_state.exit_reason);
}
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head) {
client_p = ptr->data;
if (!EmptyString(client_p->user->suser))
{
rb_dlinkDestroy(ptr, &hurt_state.hurt_clients);
sendto_one_notice(client_p, ":HURT restriction removed for this session");
USED_TARGETS(client_p) = 0;
client_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
}
else if (client_p->localClient->receiveM > hurt_state.cutoff)
exit_client(NULL, client_p, &me, hurt_state.exit_reason);
}
}
/* }}} */
@ -391,17 +413,19 @@ hurt_check_event(void *arg)
static void
hurt_expire_event(void *unused)
{
rb_dlink_node *ptr, *next_ptr;
hurt_t *hurt;
rb_dlink_node *ptr, *next_ptr;
hurt_t *hurt;
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_confs.head)
{
hurt = (hurt_t *) ptr->data;
if (hurt->expire <= rb_current_time()) {
rb_dlinkFindDestroy(hurt, &hurt_confs);
hurt_destroy(hurt);
}
}
if (hurt->expire <= rb_current_time())
{
rb_dlinkFindDestroy(hurt, &hurt_confs);
hurt_destroy(hurt);
}
}
}
/* }}} */
@ -413,10 +437,10 @@ hurt_expire_event(void *unused)
static void
client_exit_hook(hook_data_client_exit *data)
{
s_assert(data != NULL);
s_assert(data->target != NULL);
s_assert(data != NULL);
s_assert(data->target != NULL);
rb_dlinkFindDestroy(data->target, &hurt_state.hurt_clients);
rb_dlinkFindDestroy(data->target, &hurt_state.hurt_clients);
}
/* }}} */
@ -424,16 +448,18 @@ client_exit_hook(hook_data_client_exit *data)
static void
new_local_user_hook(struct Client *source_p)
{
if (IsAnyDead(source_p) || !EmptyString(source_p->user->suser) ||
IsExemptKline(source_p))
return;
if (IsAnyDead(source_p) || !EmptyString(source_p->user->suser) ||
IsExemptKline(source_p))
return;
if (hurt_find(source_p->sockhost) || hurt_find(source_p->orighost)) {
source_p->localClient->target_last = rb_current_time() + 600; /* don't ask --nenolod */
SetTGChange(source_p);
rb_dlinkAddAlloc(source_p, &hurt_state.hurt_clients);
sendto_one_notice(source_p, ":You are hurt. Please identify to services immediately, or use /stats p for assistance.");
}
if (hurt_find(source_p->sockhost) || hurt_find(source_p->orighost))
{
USED_TARGETS(source_p) = 10;
source_p->localClient->target_last = rb_current_time() + 600; /* don't ask --nenolod */
SetTGChange(source_p);
rb_dlinkAddAlloc(source_p, &hurt_state.hurt_clients);
sendto_one_notice(source_p, ":You are hurt. Please identify to services immediately, or use /stats p for assistance.");
}
}
/* }}} */
@ -441,43 +467,47 @@ new_local_user_hook(struct Client *source_p)
static void
doing_stats_hook(hook_data_int *hdata)
{
rb_dlink_node *ptr;
hurt_t *hurt;
struct Client *source_p;
rb_dlink_node *ptr;
hurt_t *hurt;
struct Client *source_p;
s_assert(hdata);
s_assert(hdata->client);
s_assert(hdata);
s_assert(hdata->client);
source_p = hdata->client;
if(hdata->arg2 != (int) 's')
return;
if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper(source_p))
return;
if ((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper(source_p)) {
hurt = hurt_find(source_p->sockhost);
if (hurt != NULL) {
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
return;
}
source_p = hdata->client;
if(hdata->arg2 != (int) 's')
return;
if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper(source_p))
return;
if ((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper(source_p))
{
hurt = hurt_find(source_p->sockhost);
if (hurt != NULL)
{
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
return;
}
hurt = hurt_find(source_p->orighost);
if (hurt != NULL) {
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
return;
}
return;
}
hurt = hurt_find(source_p->orighost);
if (hurt != NULL)
{
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
return;
}
return;
}
RB_DLINK_FOREACH(ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
}
RB_DLINK_FOREACH(ptr, hurt_confs.head)
{
hurt = (hurt_t *) ptr->data;
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
}
}
/* }}} */
@ -491,18 +521,18 @@ doing_stats_hook(hook_data_int *hdata)
static void
hurt_propagate(struct Client *client_p, struct Client *source_p, hurt_t *hurt)
{
if (client_p)
sendto_one(client_p,
":%s ENCAP %s HURT %ld %s :%s",
source_p->name, client_p->name,
(long)(hurt->expire - rb_current_time()),
hurt->ip, hurt->reason);
else
sendto_server(&me, NULL, NOCAPS, NOCAPS,
":%s ENCAP * HURT %ld %s :%s",
source_p->name,
(long)(hurt->expire - rb_current_time()),
hurt->ip, hurt->reason);
if (client_p)
sendto_one(client_p,
":%s ENCAP %s HURT %ld %s :%s",
source_p->name, client_p->name,
(long)(hurt->expire - rb_current_time()),
hurt->ip, hurt->reason);
else
sendto_server(&me, NULL, NOCAPS, NOCAPS,
":%s ENCAP * HURT %ld %s :%s",
source_p->name,
(long)(hurt->expire - rb_current_time()),
hurt->ip, hurt->reason);
}
/* }}} */
@ -510,15 +540,15 @@ hurt_propagate(struct Client *client_p, struct Client *source_p, hurt_t *hurt)
static hurt_t *
hurt_new(time_t expire, const char *ip, const char *reason)
{
hurt_t *hurt;
hurt_t *hurt;
hurt = rb_malloc(sizeof(hurt_t));
hurt = rb_malloc(sizeof(hurt_t));
hurt->ip = rb_strdup(ip);
hurt->reason = rb_strdup(reason);
hurt->expire = rb_current_time() + expire;
hurt->ip = rb_strdup(ip);
hurt->reason = rb_strdup(reason);
hurt->expire = rb_current_time() + expire;
return hurt;
return hurt;
}
/* }}} */
@ -526,80 +556,86 @@ hurt_new(time_t expire, const char *ip, const char *reason)
static void
hurt_destroy(void *hurt)
{
hurt_t *h;
hurt_t *h;
if (!hurt)
return;
if (!hurt)
return;
h = (hurt_t *) hurt;
rb_free(h->ip);
rb_free(h->reason);
rb_free(h);
h = (hurt_t *) hurt;
rb_free(h->ip);
rb_free(h->reason);
rb_free(h);
}
/* }}} */
static void
hurt_add(hurt_t *hurt)
{
rb_dlinkAddAlloc(hurt, &hurt_confs);
rb_dlinkAddAlloc(hurt, &hurt_confs);
}
static hurt_t *
hurt_find_exact(const char *ip)
{
rb_dlink_node *ptr;
hurt_t *hurt;
rb_dlink_node *ptr;
hurt_t *hurt;
RB_DLINK_FOREACH(ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
RB_DLINK_FOREACH(ptr, hurt_confs.head)
{
hurt = (hurt_t *) ptr->data;
if (!strcasecmp(ip, hurt->ip))
return hurt;
}
if (!strcasecmp(ip, hurt->ip))
return hurt;
}
return NULL;
return NULL;
}
static hurt_t *
hurt_find(const char *ip)
{
rb_dlink_node *ptr;
hurt_t *hurt;
rb_dlink_node *ptr;
hurt_t *hurt;
RB_DLINK_FOREACH(ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
RB_DLINK_FOREACH(ptr, hurt_confs.head)
{
hurt = (hurt_t *) ptr->data;
if (match(hurt->ip, ip))
return hurt;
}
if (match(hurt->ip, ip))
return hurt;
}
return NULL;
return NULL;
}
static void
hurt_remove(const char *ip)
{
hurt_t *hurt = hurt_find_exact(ip);
hurt_t *hurt = hurt_find_exact(ip);
rb_dlinkFindDestroy(hurt, &hurt_confs);
hurt_destroy(hurt);
rb_dlinkFindDestroy(hurt, &hurt_confs);
hurt_destroy(hurt);
}
/* {{{ static int heal_nick() */
static int
heal_nick(struct Client *source_p, struct Client *target_p)
{
if (rb_dlinkFindDestroy(target_p, &hurt_state.hurt_clients)) {
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s used HEAL on %s",
get_oper_name(source_p), get_client_name(target_p, HIDE_IP));
sendto_one_notice(target_p, ":HURT restriction temporarily removed by operator");
sendto_one_notice(source_p, ":HURT restriction on %s temporarily removed", target_p->name);
target_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
return 1;
} else {
sendto_one_notice(source_p, ":%s was not hurt", target_p->name);
return 0;
}
if (rb_dlinkFindDestroy(target_p, &hurt_state.hurt_clients))
{
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s used HEAL on %s",
get_oper_name(source_p), get_client_name(target_p, HIDE_IP));
sendto_one_notice(target_p, ":HURT restriction temporarily removed by operator");
sendto_one_notice(source_p, ":HURT restriction on %s temporarily removed", target_p->name);
USED_TARGETS(target_p) = 0;
target_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
return 1;
}
else
{
sendto_one_notice(source_p, ":%s was not hurt", target_p->name);
return 0;
}
}
/* }}} */
@ -611,14 +647,14 @@ heal_nick(struct Client *source_p, struct Client *target_p)
static int
nick_is_valid(const char *nick)
{
const char *s = nick;
const char *s = nick;
for (; *s != '\0'; s++) {
if (!IsNickChar(*s))
return 0;
}
for (; *s != '\0'; s++) {
if (!IsNickChar(*s))
return 0;
}
return 1;
return 1;
}
/* }}} */

View File

@ -1,160 +0,0 @@
/*
* Charybdis: an advanced ircd
* ip_cloaking.c: provide user hostname cloaking
*
* Written originally by nenolod, altered to use FNV by Elizabeth in 2008
* altered some more by groente
*/
#include <openssl/hmac.h>
#include "stdinc.h"
#include "modules.h"
#include "hook.h"
#include "client.h"
#include "ircd.h"
#include "send.h"
#include "hash.h"
#include "s_conf.h"
#include "s_user.h"
#include "s_serv.h"
#include "numeric.h"
#include "newconf.h"
char *secretsalt = "32qwnqoWI@DpMd&w";
static void
conf_set_secretsalt(void *data)
{
secretsalt = rb_strdup(data);
}
static int
_modinit(void)
{
/* add the usermode to the available slot */
user_modes['x'] = find_umode_slot();
construct_umodebuf();
add_top_conf("cloaking", NULL, NULL, NULL);
add_conf_item("cloaking", "secretsalt", CF_QSTRING, conf_set_secretsalt);
return 0;
}
static void
_moddeinit(void)
{
/* disable the umode and remove it from the available list */
user_modes['x'] = 0;
construct_umodebuf();
add_top_conf("cloaking", NULL, NULL, NULL);
add_conf_item("cloaking", "secretsalt", CF_QSTRING, conf_set_secretsalt);
}
static void check_umode_change(void *data);
static void check_new_user(void *data);
mapi_hfn_list_av1 ip_cloaking_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3526 $");
static void
distribute_hostchange(struct Client *client_p, char *newhost)
{
if (newhost != client_p->orighost)
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
newhost);
else
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
newhost);
sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
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
ClearDynSpoof(client_p);
}
static void
do_host_cloak(const char *inbuf, char *outbuf)
{
unsigned char *hash;
char buf[3];
char output[HOSTLEN+1];
int i;
hash = HMAC(EVP_sha256(), secretsalt, strlen(secretsalt), (unsigned char*)inbuf, strlen(inbuf), NULL, NULL);
output[0]=0;
for (i = 0; i < 32; i++) {
sprintf(buf, "%.2x", hash[i]);
strcat(output,buf);
}
rb_strlcpy(outbuf,output,HOSTLEN+1);
}
static void
check_umode_change(void *vdata)
{
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
struct Client *source_p = data->client;
if (!MyClient(source_p))
return;
/* didn't change +h umode, we don't need to do anything */
if (!((data->oldumodes ^ source_p->umodes) & user_modes['x']))
return;
if (source_p->umodes & user_modes['h']) {
if (IsIPSpoof(source_p) || source_p->localClient->mangledhost == NULL || (IsDynSpoof(source_p) && strcmp(source_p->host, source_p->localClient->mangledhost))) {
source_p->umodes &= ~user_modes['x'];
return;
}
if (strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->localClient->mangledhost);
} 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",
source_p->host);
} else if (!(source_p->umodes & user_modes['x'])) {
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->orighost);
}
}
}
static void
check_new_user(void *vdata)
{
struct Client *source_p = (void *)vdata;
if (IsIPSpoof(source_p)) {
source_p->umodes &= ~user_modes['x'];
return;
}
source_p->localClient->mangledhost = rb_malloc(HOSTLEN + 1);
do_host_cloak(source_p->orighost, source_p->localClient->mangledhost);
if (IsDynSpoof(source_p))
source_p->umodes &= ~user_modes['x'];
if (source_p->umodes & user_modes['x']) {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}
}

View File

@ -1,9 +1,4 @@
/*
* Charybdis: an advanced ircd
* ip_cloaking.c: provide user hostname cloaking
*
* Written originally by nenolod, altered to use FNV by Elizabeth in 2008
*/
/* $Id: ip_cloaking.c 3526 2007-07-06 07:56:14Z nenolod $ */
#include "stdinc.h"
#include "modules.h"
@ -11,200 +6,214 @@
#include "client.h"
#include "ircd.h"
#include "send.h"
#include "hash.h"
#include "s_conf.h"
#include "s_user.h"
#include "s_serv.h"
#include "numeric.h"
/* if you're modifying this module, you'll probably to change this */
#define KEY 0x13748cfa
static int
_modinit(void)
{
/* add the usermode to the available slot */
user_modes['x'] = find_umode_slot();
construct_umodebuf();
/* add the usermode to the available slot */
user_modes['h'] = find_umode_slot();
construct_umodebuf();
return 0;
return 0;
}
static void
_moddeinit(void)
{
/* disable the umode and remove it from the available list */
user_modes['x'] = 0;
construct_umodebuf();
/* disable the umode and remove it from the available list */
user_modes['h'] = 0;
construct_umodebuf();
}
static void check_umode_change(void *data);
static void check_new_user(void *data);
mapi_hfn_list_av1 ip_cloaking_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ NULL, NULL }
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3526 $");
ip_cloaking_hfnlist, "$Revision: 3526 $");
static void
distribute_hostchange(struct Client *client_p, char *newhost)
distribute_hostchange(struct Client *client)
{
if (newhost != client_p->orighost)
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
newhost);
else
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
newhost);
if (irccmp(client->host, client->orighost))
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :is now your hidden host",
client->host);
else
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :hostname reset",
client->host);
sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client), client->host);
sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client), client->host);
sendto_server(NULL, NULL,
NOCAPS, CAP_TS6, ":%s ENCAP * CHGHOST %s :%s",
me.name, client->name, client->host);
if (irccmp(client->host, client->orighost))
SetDynSpoof(client);
else
ClearDynSpoof(client);
}
change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
#define Nval 0x8c3a48ac
#define HOSTLEN 63
#define INITDATA "98fwqefnoiqefv03f423t34gbv3vb89tg432t3b8" /* change this */
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else
ClearDynSpoof(client_p);
static inline unsigned int
get_string_entropy(const char *inbuf)
{
unsigned int accum = 1;
while(*inbuf != '\0')
accum += *inbuf++;
return accum;
}
/* calls get_string_entropy() and toasts it against INITDATA */
static inline unsigned int
get_string_weighted_entropy(const char *inbuf)
{
static int base_entropy = 0;
unsigned int accum = get_string_entropy(inbuf);
/* initialize the algorithm if it is not yet ready */
if (base_entropy == 0)
base_entropy = get_string_entropy(INITDATA);
return (Nval * accum) ^ base_entropy;
}
static void
do_host_cloak_ip(const char *inbuf, char *outbuf)
{
/* None of the characters in this table can be valid in an IP */
char chartable[] = "ghijklmnopqrstuvwxyz";
char *tptr;
uint32_t accum = fnv_hash((const unsigned char*) inbuf, 32);
int sepcount = 0;
int totalcount = 0;
int ipv6 = 0;
char *tptr;
unsigned int accum = get_string_weighted_entropy(inbuf);
char buf[HOSTLEN];
rb_strlcpy(outbuf, inbuf, HOSTLEN + 1);
strncpy(buf, inbuf, HOSTLEN);
tptr = strrchr(buf, '.');
if (strchr(outbuf, ':')) {
ipv6 = 1;
if (tptr == NULL)
{
strncpy(outbuf, inbuf, HOSTLEN);
return;
}
/* Damn you IPv6...
* We count the number of colons so we can calculate how much
* of the host to cloak. This is because some hostmasks may not
* have as many octets as we'd like.
*
* We have to do this ahead of time because doing this during
* the actual cloaking would get ugly
*/
for (tptr = outbuf; *tptr != '\0'; tptr++)
if (*tptr == ':')
totalcount++;
} else if (!strchr(outbuf, '.'))
return;
*tptr++ = '\0';
for (tptr = outbuf; *tptr != '\0'; tptr++) {
if (*tptr == ':' || *tptr == '.') {
sepcount++;
continue;
}
if (ipv6 && sepcount < totalcount / 2)
continue;
if (!ipv6 && sepcount < 2)
continue;
*tptr = chartable[(*tptr + accum) % 20];
accum = (accum << 1) | (accum >> 31);
}
snprintf(outbuf, HOSTLEN, "%s.%x", buf, accum);
}
static void
do_host_cloak_host(const char *inbuf, char *outbuf)
{
char b26_alphabet[] = "abcdefghijklmnopqrstuvwxyz";
char *tptr;
uint32_t accum = fnv_hash((const unsigned char*) inbuf, 32);
char b26_alphabet[] = "abcdefghijklmnopqrstuvwxyz";
char *tptr;
unsigned int accum = get_string_weighted_entropy(inbuf);
rb_strlcpy(outbuf, inbuf, HOSTLEN + 1);
strncpy(outbuf, inbuf, HOSTLEN);
/* pass 1: scramble first section of hostname using base26
* alphabet toasted against the FNV hash of the string.
*
* numbers are not changed at this time, only letters.
*/
for (tptr = outbuf; *tptr != '\0'; tptr++) {
if (*tptr == '.')
break;
/* pass 1: scramble first section of hostname using base26
* alphabet toasted against the weighted entropy of the string.
*
* numbers are not changed at this time, only letters.
*/
for (tptr = outbuf; *tptr != '\0'; tptr++)
{
if (*tptr == '.')
break;
if (isdigit(*tptr) || *tptr == '-')
continue;
if (isdigit(*tptr) || *tptr == '-')
continue;
*tptr = b26_alphabet[(*tptr + accum) % 26];
*tptr = b26_alphabet[(*tptr * accum) % 26];
}
/* Rotate one bit to avoid all digits being turned odd or even */
accum = (accum << 1) | (accum >> 31);
}
/* pass 2: scramble each number in the address */
for (tptr = outbuf; *tptr != '\0'; tptr++) {
if (isdigit(*tptr))
*tptr = '0' + (*tptr + accum) % 10;
accum = (accum << 1) | (accum >> 31);
}
/* pass 2: scramble each number in the address */
for (tptr = outbuf; *tptr != '\0'; tptr++)
{
if (isdigit(*tptr))
{
*tptr = 48 + ((*tptr * accum) % 10);
}
}
}
static void
check_umode_change(void *vdata)
{
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
struct Client *source_p = data->client;
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
struct Client *source_p = data->client;
if (!MyClient(source_p))
return;
if (!MyClient(source_p))
return;
/* didn't change +h umode, we don't need to do anything */
if (!((data->oldumodes ^ source_p->umodes) & user_modes['x']))
return;
/* didn't change +h umode, we don't need to do anything */
if (!((data->oldumodes ^ source_p->umodes) & user_modes['h']))
return;
if (source_p->umodes & user_modes['x']) {
if (IsIPSpoof(source_p) || source_p->localClient->mangledhost == NULL || (IsDynSpoof(source_p) && strcmp(source_p->host, source_p->localClient->mangledhost))) {
source_p->umodes &= ~user_modes['x'];
return;
}
if (strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->localClient->mangledhost);
} 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",
source_p->host);
} else if (!(source_p->umodes & user_modes['x'])) {
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->orighost);
}
}
if (source_p->umodes & user_modes['h'])
{
if (IsIPSpoof(source_p) || source_p->localClient->mangledhost == NULL || (IsDynSpoof(source_p) && strcmp(source_p->host, source_p->localClient->mangledhost)))
{
source_p->umodes &= ~user_modes['h'];
return;
}
if (strcmp(source_p->host, source_p->localClient->mangledhost))
{
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN);
distribute_hostchange(source_p);
}
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",
source_p->host);
}
else if (!(source_p->umodes & user_modes['h']))
{
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost))
{
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN);
distribute_hostchange(source_p);
}
}
}
static void
check_new_user(void *vdata)
{
struct Client *source_p = (void *)vdata;
struct Client *source_p = (void *)vdata;
if (IsIPSpoof(source_p)) {
source_p->umodes &= ~user_modes['x'];
return;
}
source_p->localClient->mangledhost = rb_malloc(HOSTLEN + 1);
if (!irccmp(source_p->orighost, source_p->sockhost))
do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost);
else
do_host_cloak_host(source_p->orighost, source_p->localClient->mangledhost);
if (IsDynSpoof(source_p))
source_p->umodes &= ~user_modes['x'];
if (source_p->umodes & user_modes['x']) {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}
if (IsIPSpoof(source_p))
{
source_p->umodes &= ~user_modes['h'];
return;
}
source_p->localClient->mangledhost = rb_malloc(HOSTLEN);
if (!irccmp(source_p->orighost, source_p->sockhost))
do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost);
else
do_host_cloak_host(source_p->orighost, source_p->localClient->mangledhost);
if (IsDynSpoof(source_p))
source_p->umodes &= ~user_modes['h'];
if (source_p->umodes & user_modes['h'])
{
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}
}

View File

@ -0,0 +1,175 @@
/* $Id: ip_cloaking_old.c 3522 2007-07-06 07:48:28Z nenolod $ */
#include "stdinc.h"
#include "modules.h"
#include "hook.h"
#include "client.h"
#include "ircd.h"
#include "send.h"
#include "s_conf.h"
#include "s_user.h"
#include "s_serv.h"
#include "numeric.h"
/* if you're modifying this module, you'll probably to change this */
#define KEY 0x13748cfa
static int
_modinit(void)
{
/* add the usermode to the available slot */
user_modes['h'] = find_umode_slot();
construct_umodebuf();
return 0;
}
static void
_moddeinit(void)
{
/* disable the umode and remove it from the available list */
user_modes['h'] = 0;
construct_umodebuf();
}
static void check_umode_change(void *data);
static void check_new_user(void *data);
mapi_hfn_list_av1 ip_cloaking_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3522 $");
static void
distribute_hostchange(struct Client *client)
{
if (irccmp(client->host, client->orighost))
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :is now your hidden host",
client->host);
else
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :hostname reset",
client->host);
sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client), client->host);
sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client), client->host);
sendto_server(NULL, NULL,
NOCAPS, CAP_TS6, ":%s ENCAP * CHGHOST %s :%s",
me.name, client->name, client->host);
if (irccmp(client->host, client->orighost))
SetDynSpoof(client);
else
ClearDynSpoof(client);
}
static void
do_host_cloak(const char *inbuf, char *outbuf, int ipmask)
{
int cyc;
unsigned int hosthash = 1, hosthash2 = 1;
unsigned int maxcycle = strlen(inbuf);
int len1;
const char *rest, *next;
for (cyc = 0; cyc < maxcycle - 2; cyc += 2)
hosthash *= (unsigned int) inbuf[cyc];
/* safety: decrement ourselves two steps back */
for (cyc = maxcycle - 1; cyc >= 1; cyc -= 2)
hosthash2 *= (unsigned int) inbuf[cyc];
/* lets do some bitshifting -- this pretty much destroys the IP
* sequence, while still providing a checksum. exactly what
* we're shooting for. --nenolod
*/
hosthash += (hosthash2 / KEY);
hosthash2 += (hosthash / KEY);
if (ipmask == 0)
{
rb_snprintf(outbuf, HOSTLEN, "%s-%X%X",
ServerInfo.network_name, hosthash2, hosthash);
len1 = strlen(outbuf);
rest = strchr(inbuf, '.');
if (rest == NULL)
rest = ".";
/* try to avoid truncation -- jilles */
while (len1 + strlen(rest) >= HOSTLEN && (next = strchr(rest + 1, '.')) != NULL)
rest = next;
rb_strlcat(outbuf, rest, HOSTLEN);
}
else
rb_snprintf(outbuf, HOSTLEN, "%X%X.%s",
hosthash2, hosthash, ServerInfo.network_name);
}
static void
check_umode_change(void *vdata)
{
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
struct Client *source_p = data->client;
if (!MyClient(source_p))
return;
/* didn't change +h umode, we don't need to do anything */
if (!((data->oldumodes ^ source_p->umodes) & user_modes['h']))
return;
if (source_p->umodes & user_modes['h'])
{
if (IsIPSpoof(source_p) || source_p->localClient->mangledhost == NULL || (IsDynSpoof(source_p) && strcmp(source_p->host, source_p->localClient->mangledhost)))
{
source_p->umodes &= ~user_modes['h'];
return;
}
if (strcmp(source_p->host, source_p->localClient->mangledhost))
{
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN);
distribute_hostchange(source_p);
}
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",
source_p->host);
}
else if (!(source_p->umodes & user_modes['h']))
{
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost))
{
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN);
distribute_hostchange(source_p);
}
}
}
static void
check_new_user(void *vdata)
{
struct Client *source_p = (void *)vdata;
if (IsIPSpoof(source_p))
{
source_p->umodes &= ~user_modes['h'];
return;
}
source_p->localClient->mangledhost = rb_malloc(HOSTLEN);
if (!irccmp(source_p->orighost, source_p->sockhost))
do_host_cloak(source_p->orighost, source_p->localClient->mangledhost, 1);
else
do_host_cloak(source_p->orighost, source_p->localClient->mangledhost, 0);
if (IsDynSpoof(source_p))
source_p->umodes &= ~user_modes['h'];
if (source_p->umodes & user_modes['h'])
{
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}
}

View File

@ -1,7 +1,8 @@
/*
* Copyright (C) infinity-infinity God <God@Heaven>
*
* Bob was here
* Bob was here
* $Id: m_42.c 3161 2007-01-25 07:23:01Z nenolod $
*/
#include "stdinc.h"
@ -13,10 +14,9 @@
static int mclient_42(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message hgtg_msgtab = {
"42", 0, 0, 0, MFLG_SLOW,
{
mg_ignore, {mclient_42, 0}, mg_ignore, mg_ignore, mg_ignore, {mclient_42, 0}
}
"42", 0, 0, 0, MFLG_SLOW,
{ mg_ignore, {mclient_42, 0}, mg_ignore, mg_ignore, mg_ignore, {mclient_42, 0}
}
};
mapi_clist_av1 hgtg_clist[] = { &hgtg_msgtab, NULL };
@ -28,8 +28,8 @@ DECLARE_MODULE_AV1(42, NULL, NULL, hgtg_clist, NULL, NULL, "Revision 0.42");
static int
mclient_42(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
sendto_one_notice(source_p, ":The Answer to Life, the Universe, and Everything.");
return 0;
sendto_one_notice(source_p, ":The Answer to Life, the Universe, and Everything.");
return 0;
}

View File

@ -21,6 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_wallops.c 20702 2005-08-31 20:59:02Z leeh $
*/
#include "stdinc.h"
@ -41,10 +42,10 @@ static int mo_adminwall(struct Client *, struct Client *, int, const char **);
static int me_adminwall(struct Client *, struct Client *, int, const char **);
struct Message adminwall_msgtab = {
"ADMINWALL", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_adminwall, 2}, {mo_adminwall, 2}}
"ADMINWALL", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_adminwall, 2}, {mo_adminwall, 2}}
};
mapi_clist_av1 adminwall_clist[] = { &adminwall_msgtab, NULL };
DECLARE_MODULE_AV1(adminwall, NULL, NULL, adminwall_clist, NULL, NULL, "$Revision: 20702 $");
@ -56,21 +57,22 @@ DECLARE_MODULE_AV1(adminwall, NULL, NULL, adminwall_clist, NULL, NULL, "$Revisio
*/
static int
mo_adminwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(!IsAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "adminwall");
mo_adminwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(!IsAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "adminwall");
return 0;
}
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ADMINWALL :%s", parv[1]);
return 0;
}
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ADMINWALL :%s", parv[1]);
return 0;
}
}
static int
me_adminwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
return 0;
me_adminwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
return 0;
}

View File

@ -1,92 +0,0 @@
/*
* m_cycle.c: server-side CYCLE
*
* Copyright (c) 2010 The ShadowIRCd team
*/
#include "stdinc.h"
#include "common.h"
#include "channel.h"
#include "client.h"
#include "hash.h"
#include "match.h"
#include "ircd.h"
#include "numeric.h"
#include "send.h"
#include "s_conf.h"
#include "s_serv.h"
#include "msg.h"
#include "parse.h"
#include "modules.h"
#include "packet.h"
#include "hook.h"
extern struct module **modlist;
static int m_cycle(struct Client *, struct Client *, int, const char **);
struct Message cycle_msgtab = {
"CYCLE", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_cycle, 2}, {m_cycle, 2}, mg_ignore, mg_ignore, {m_cycle, 2}}
};
mapi_clist_av1 cycle_clist[] = { &cycle_msgtab, NULL };
DECLARE_MODULE_AV1(cycle, NULL, NULL, cycle_clist, NULL, NULL, "$Revision$");
static int
m_cycle(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
char *p, *name;
char *s = LOCAL_COPY(parv[1]);
struct Channel *chptr;
struct membership *msptr;
name = rb_strtok_r(s, ",", &p);
/* Finish the flood grace period... */
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
while(name) {
if((chptr = find_channel(name)) == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0;
}
msptr = find_channel_membership(chptr, source_p);
if(msptr == NULL) {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
return 0;
}
if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
check_spambot_warning(source_p, NULL);
if((is_any_op(msptr) || !MyConnect(source_p) ||
((can_send(chptr, source_p, msptr) > 0 &&
(source_p->localClient->firsttime +
ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time())))) {
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s :Cycling", use_id(source_p), chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :Cycling",
source_p->name, source_p->username,
source_p->host, chptr->chname);
} else {
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s", use_id(source_p), chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
source_p->name, source_p->username,
source_p->host, chptr->chname);
}
remove_user_from_channel(msptr);
chptr = NULL;
msptr = NULL;
name = rb_strtok_r(NULL, ",", &p);
}
user_join(client_p, source_p, parv[1], parc > 2 ? parv[2] : NULL);
return 0;
}

View File

@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: m_findforwards.c 986 2006-03-08 00:10:46Z jilles $
*/
#include "stdinc.h"
#include "channel.h"
@ -35,11 +36,11 @@
#include "packet.h"
static int m_findforwards(struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
int parc, const char *parv[]);
struct Message findforwards_msgtab = {
"FINDFORWARDS", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_findforwards, 2}, mg_ignore, mg_ignore, mg_ignore, {m_findforwards, 2}}
"FINDFORWARDS", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_findforwards, 2}, mg_ignore, mg_ignore, mg_ignore, {m_findforwards, 2}}
};
mapi_clist_av1 findforwards_clist[] = { &findforwards_msgtab, NULL };
@ -48,59 +49,68 @@ DECLARE_MODULE_AV1(findforwards, NULL, NULL, findforwards_clist, NULL, NULL, "$R
/*
** mo_findforwards
** parv[0] = sender prefix
** parv[1] = channel
*/
static int
m_findforwards(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
static time_t last_used = 0;
struct Channel *chptr;
struct membership *msptr;
rb_dlink_node *ptr;
char buf[414];
char *p = buf, *end = buf + sizeof buf - 1;
*p = '\0';
static time_t last_used = 0;
struct Channel *chptr;
struct membership *msptr;
rb_dlink_node *ptr;
char buf[414];
char *p = buf, *end = buf + sizeof buf - 1;
*p = '\0';
/* Allow ircops to search for forwards to nonexistent channels */
if(!IsOper(source_p)) {
if((chptr = find_channel(parv[1])) == NULL || (msptr = find_channel_membership(chptr, source_p)) == NULL) {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), parv[1]);
return 0;
}
/* Allow ircops to search for forwards to nonexistent channels */
if(!IsOper(source_p))
{
if((chptr = find_channel(parv[1])) == NULL || (msptr = find_channel_membership(chptr, source_p)) == NULL)
{
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), parv[1]);
return 0;
}
if(!is_any_op(msptr)) {
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, parv[1]);
return 0;
}
if(!is_chanop(msptr))
{
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, parv[1]);
return 0;
}
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) {
sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "FINDFORWARDS");
return 0;
} else
last_used = rb_current_time();
}
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
{
sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "FINDFORWARDS");
return 0;
}
else
last_used = rb_current_time();
}
RB_DLINK_FOREACH(ptr, global_channel_list.head)
{
chptr = ptr->data;
if(chptr->mode.forward && !irccmp(chptr->mode.forward, parv[1]))
{
if(p + strlen(chptr->chname) >= end - 13)
{
strcpy(p, "<truncated> ");
p += 12;
break;
}
strcpy(p, chptr->chname);
p += strlen(chptr->chname);
*p++ = ' ';
}
}
RB_DLINK_FOREACH(ptr, global_channel_list.head) {
chptr = ptr->data;
if(chptr->mode.forward && !irccmp(chptr->mode.forward, parv[1])) {
if(p + strlen(chptr->chname) >= end - 13) {
strcpy(p, "<truncated> ");
p += 12;
break;
}
strcpy(p, chptr->chname);
p += strlen(chptr->chname);
*p++ = ' ';
}
}
if(buf[0])
*(--p) = '\0';
if(buf[0])
*(--p) = '\0';
sendto_one_notice(source_p, ":Forwards for %s: %s", parv[1], buf);
sendto_one_notice(source_p, ":Forwards for %s: %s", parv[1], buf);
return 0;
return 0;
}

View File

@ -1,203 +0,0 @@
/* contrib/m_force.c
* Copyright (C) 1996-2002 Hybrid Development Team
* Copyright (C) 2004 ircd-ratbox Development Team
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1.Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2.Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3.The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 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 "channel.h"
#include "class.h"
#include "client.h"
#include "common.h"
#include "match.h"
#include "ircd.h"
#include "hostmask.h"
#include "numeric.h"
#include "s_conf.h"
#include "s_newconf.h"
#include "logger.h"
#include "send.h"
#include "hash.h"
#include "s_serv.h"
#include "msg.h"
#include "parse.h"
#include "modules.h"
static int mo_forcejoin(struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
struct Message forcejoin_msgtab = {
"FORCEJOIN", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_forcejoin, 3}}
};
mapi_clist_av1 force_clist[] = { &forcejoin_msgtab, NULL };
DECLARE_MODULE_AV1(force, NULL, NULL, force_clist, NULL, NULL, "$Revision: 3297 $");
/*
* m_forcejoin
* parv[1] = user to force
* parv[2] = channel to force them into
*/
static int
mo_forcejoin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Client *target_p;
struct Channel *chptr;
int type;
char mode;
char sjmode;
char *newch;
if(!IsOperAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
if((hunt_server(client_p, source_p, ":%s FORCEJOIN %s %s", 1, parc, parv)) != HUNTED_ISME)
return 0;
/* if target_p is not existant, print message
* to source_p and bail - scuzzy
*/
if((target_p = find_client(parv[1])) == NULL) {
sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, parv[1]);
return 0;
}
if(!IsPerson(target_p))
return 0;
sendto_wallops_flags(UMODE_WALLOP, &me,
"FORCEJOIN called for %s %s by %s!%s@%s",
parv[1], parv[2], source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "FORCEJOIN called for %s %s by %s!%s@%s",
parv[1], parv[2], source_p->name, source_p->username, source_p->host);
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :FORCEJOIN called for %s %s by %s!%s@%s",
me.name, parv[1], parv[2],
source_p->name, source_p->username, source_p->host);
/* select our modes from parv[2] if they exist... (chanop) */
if(*parv[2] == '@') {
type = CHFL_CHANOP;
mode = 'o';
sjmode = '@';
} else if(*parv[2] == '+') {
type = CHFL_VOICE;
mode = 'v';
sjmode = '+';
} else {
type = CHFL_PEON;
mode = sjmode = '\0';
}
if(mode != '\0')
parv[2]++;
if((chptr = find_channel(parv[2])) != NULL) {
if(IsMember(target_p, chptr)) {
/* debugging is fun... */
sendto_one_notice(source_p, ":*** Notice -- %s is already in %s",
target_p->name, chptr->chname);
return 0;
}
add_user_to_channel(chptr, target_p, type);
sendto_server(target_p, chptr, NOCAPS, NOCAPS,
":%s SJOIN %ld %s + :%c%s",
me.name, (long) chptr->channelts,
chptr->chname, type ? sjmode : ' ', target_p->name);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s",
target_p->name, target_p->username,
target_p->host, chptr->chname);
if(type)
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +%c %s",
me.name, chptr->chname, mode, target_p->name);
if(chptr->topic != NULL) {
sendto_one(target_p, form_str(RPL_TOPIC), me.name,
target_p->name, chptr->chname, chptr->topic);
sendto_one(target_p, form_str(RPL_TOPICWHOTIME),
me.name, source_p->name, chptr->chname,
chptr->topic_info, chptr->topic_time);
}
channel_member_names(chptr, target_p, 1);
} else {
newch = LOCAL_COPY(parv[2]);
if(!check_channel_name(newch)) {
sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name,
source_p->name, (unsigned char *) newch);
return 0;
}
/* channel name must begin with & or # */
if(!IsChannelName(newch)) {
sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name,
source_p->name, (unsigned char *) newch);
return 0;
}
/* newch can't be longer than CHANNELLEN */
if(strlen(newch) > CHANNELLEN) {
sendto_one_notice(source_p, ":Channel name is too long");
return 0;
}
chptr = get_or_create_channel(target_p, newch, NULL);
add_user_to_channel(chptr, target_p, CHFL_CHANOP);
/* send out a join, make target_p join chptr */
sendto_server(target_p, chptr, NOCAPS, NOCAPS,
":%s SJOIN %ld %s +nt :@%s", me.name,
(long) chptr->channelts, chptr->chname, target_p->name);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s",
target_p->name, target_p->username,
target_p->host, chptr->chname);
chptr->mode.mode |= MODE_TOPICLIMIT;
chptr->mode.mode |= MODE_NOPRIVMSGS;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +nt", me.name, chptr->chname);
target_p->localClient->last_join_time = rb_current_time();
channel_member_names(chptr, target_p, 1);
/* we do this to let the oper know that a channel was created, this will be
* seen from the server handling the command instead of the server that
* the oper is on.
*/
sendto_one_notice(source_p, ":*** Notice -- Creating channel %s", chptr->chname);
}
return 0;
}

View File

@ -28,6 +28,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $Id: m_identify.c 2729 2006-11-09 23:52:06Z jilles $
*/
#include "stdinc.h"
@ -52,45 +53,49 @@ char *reconstruct_parv(int parc, const char *parv[]);
static int m_identify(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message identify_msgtab = {
"IDENTIFY", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_identify, 0}, mg_ignore, mg_ignore, mg_ignore, {m_identify, 0}}
"IDENTIFY", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_identify, 0}, mg_ignore, mg_ignore, mg_ignore, {m_identify, 0}}
};
mapi_clist_av1 identify_clist[] = {
&identify_msgtab,
NULL
&identify_msgtab,
NULL
};
DECLARE_MODULE_AV1(identify, NULL, NULL, identify_clist, NULL, NULL, "$Revision: 2729 $");
char *reconstruct_parv(int parc, const char *parv[])
{
static char tmpbuf[BUFSIZE];
int i;
static char tmpbuf[BUFSIZE]; int i;
rb_strlcpy(tmpbuf, parv[0], BUFSIZE);
for (i = 1; i < parc; i++) {
rb_strlcat(tmpbuf, " ", BUFSIZE);
rb_strlcat(tmpbuf, parv[i], BUFSIZE);
}
return tmpbuf;
rb_strlcpy(tmpbuf, parv[0], BUFSIZE);
for (i = 1; i < parc; i++)
{
rb_strlcat(tmpbuf, " ", BUFSIZE);
rb_strlcat(tmpbuf, parv[i], BUFSIZE);
}
return tmpbuf;
}
static int m_identify(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
const char *nick;
struct Client *target_p;
const char *nick;
struct Client *target_p;
if (parc < 2 || EmptyString(parv[1])) {
sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
return 0;
}
if (parc < 2 || EmptyString(parv[1]))
{
sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
return 0;
}
nick = parv[1][0] == '#' ? SVS_chanserv_NICK : SVS_nickserv_NICK;
if ((target_p = find_named_person(nick)) && IsService(target_p)) {
sendto_one(target_p, ":%s PRIVMSG %s :IDENTIFY %s", get_id(source_p, target_p), get_id(target_p, target_p), reconstruct_parv(parc - 1, &parv[1]));
} else {
sendto_one_numeric(source_p, ERR_SERVICESDOWN, form_str(ERR_SERVICESDOWN), nick);
}
return 0;
nick = parv[1][0] == '#' ? SVS_chanserv_NICK : SVS_nickserv_NICK;
if ((target_p = find_named_person(nick)) && IsService(target_p))
{
sendto_one(target_p, ":%s PRIVMSG %s :IDENTIFY %s", get_id(source_p, target_p), get_id(target_p, target_p), reconstruct_parv(parc - 1, &parv[1]));
}
else
{
sendto_one_numeric(source_p, ERR_SERVICESDOWN, form_str(ERR_SERVICESDOWN), nick);
}
return 0;
}

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